/*
 * Penguins on the ice sea, after the team's (unofficial) design: a navy frame, blue links, and primary
 * buttons in a blue close to Idi's body with white text. Navy with orange reads as AWS, so orange is
 * left only to Idi's beak and feet. Workspaces are ice floes and the AI is Idi the penguin.
 * Headings use Zen Kaku Gothic New and body text IBM Plex Sans JP, both self-hosted under /fonts/.
 * Shapes: panels have floe corners (top-left and bottom-right rounder), controls 6px, chips fully rounded.
 */
:root {
  color-scheme: light;
  /* The frame (top bar) is the night sea; the working surfaces are ice floating on it. */
  --sea: #10193a;
  --sea-hi: #1e2850;
  --sea-line: #26325f;
  --on-sea: #ffffff;
  --on-sea-muted: #adb4cb;
  --bg: #f4f5f9;
  --surface: #ffffff;
  --shelf: #eff1f6;
  --ink: #10193a;
  --muted: #59617a;
  --faint: #7a8298;
  --line: #dfe2ea;
  --line-strong: #cdd2de;
  --accent: #2a58a8;
  --accent-hover: #1d4180;
  --accent-line: #c9d9f2;
  --on-accent: #ffffff;
  --chip-bg: #eff1f6;
  --tint: #eaf0fa;
  --action: #2a58a8;
  --action-hover: #1d4180;
  --action-on: #ffffff;
  --ok: #16775a;
  --busy: #d9821c;
  --error: #b9372c;
  --ws1: #2a58a8;
  --ws2: #16775a;
  --ws3: #6f5bb5;
  --ws4: #d9821c;
  --raise: 0 1px 2px rgb(20 28 58 / 8%);
  --drop: rgb(234 240 250 / 90%);
  /* The scene behind the search box: snow, sea and the floe. The penguin's own colors never change with the theme. */
  --snow: #ffffff;
  --snow-shade: #c6daec;
  --snow-print: rgb(96 128 168 / 60%);
  --splash: #d7f0ff;
  --water-top: #4a93e0;
  --water-mid: #2f6fc0;
  --water-deep: #1d4180;
  --water-line: #9fd6ff;
  --ice-op: .92;
  --font-display: "Zen Kaku Gothic New", "Hiragino Sans", "Yu Gothic", sans-serif;
  --font-body: "IBM Plex Sans JP", "Hiragino Sans", "Yu Gothic", Meiryo, sans-serif;
  --font-mono: ui-monospace, Consolas, Menlo, monospace;
  --radius-panel: 10px 4px 10px 4px;
  --radius-control: 6px;
  --control-height: 36px;
  --control-height-sm: 28px;

  --icon-folder: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linejoin='round'><path d='M3 7.5A2.5 2.5 0 0 1 5.5 5H9l2 2h7.5A2.5 2.5 0 0 1 21 9.5v7a2.5 2.5 0 0 1-2.5 2.5h-13A2.5 2.5 0 0 1 3 16.5z'/></svg>");
  --icon-chat: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linejoin='round'><path d='M20 12a8 8 0 0 1-11.7 7.1L4 20l1-4.1A8 8 0 1 1 20 12z'/></svg>");
  --icon-file: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linejoin='round'><path d='M14 3H7.5A2.5 2.5 0 0 0 5 5.5v13A2.5 2.5 0 0 0 7.5 21h9a2.5 2.5 0 0 0 2.5-2.5V8z'/><path d='M14 3v5h5'/></svg>");
  --icon-plus: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'><path d='M12 5v14M5 12h14'/></svg>");
  --icon-send: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M12 19V5M6 11l6-6 6 6'/></svg>");
  --icon-clip: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><path d='m20.5 11.5-8.4 8.4a5 5 0 0 1-7.1-7.1l8.4-8.4a3.3 3.3 0 0 1 4.7 4.7l-8.4 8.4a1.7 1.7 0 0 1-2.4-2.4l7.7-7.7'/></svg>");
  --icon-refresh: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><path d='M20 12a8 8 0 1 1-2.3-5.7M20 4v4.5h-4.5'/></svg>");
  --icon-trash: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><path d='M4 7h16M9 7V4.5h6V7M6.5 7l1 13h9l1-13M10 11v5.5M14 11v5.5'/></svg>");
  --icon-download: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><path d='M12 4v11M7 10l5 5 5-5M5 20h14'/></svg>");
  --icon-pencil: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><path d='M4 20h4L19 9l-4-4L4 16z'/><path d='m14 6 4 4'/></svg>");
  --icon-caret: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><path d='m7 10 5 5 5-5'/></svg>");
  --icon-chevron: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235a6672' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='m7 10 5 5 5-5'/></svg>");
  --icon-chevron: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2359617a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='m7 10 5 5 5-5'/></svg>");
  --icon-search: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'><circle cx='11' cy='11' r='6.5'/><path d='m16 16 4.5 4.5'/></svg>");
  --icon-gear: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linejoin='round'><path d='M12 9.2a2.8 2.8 0 1 0 0 5.6 2.8 2.8 0 0 0 0-5.6zM18.57 12.63L20.79 13.95L19.59 16.84L17.09 16.2L16.2 17.09L16.84 19.59L13.95 20.79L12.63 18.57L11.37 18.57L10.05 20.79L7.16 19.59L7.8 17.09L6.91 16.2L4.41 16.84L3.21 13.95L5.43 12.63L5.43 11.37L3.21 10.05L4.41 7.16L6.91 7.8L7.8 6.91L7.16 4.41L10.05 3.21L11.37 5.43L12.63 5.43L13.95 3.21L16.84 4.41L16.2 6.91L17.09 7.8L19.59 7.16L20.79 10.05L18.57 11.37z'/></svg>");
  --icon-flag: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><path d='M5.5 21V4M5.5 4.5h11l-2.2 4 2.2 4h-11'/></svg>");
  --icon-panel: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linejoin='round'><path d='M4 5h16v14H4zM15 5v14'/></svg>");
  --icon-home: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linejoin='round'><path d='M4 11 12 4l8 7v9h-5.5v-6h-5v6H4z'/></svg>");
  --icon-snow: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><path d='M12 2.5v19M3.8 7.25l16.4 9.5M3.8 16.75l16.4-9.5M9.3 4.3 12 6.6l2.7-2.3M9.3 19.7 12 17.4l2.7 2.3M4.6 10.4l3.3-1.1-.6-3.4M19.4 13.6l-3.3 1.1.6 3.4M4.6 13.6l3.3 1.1-.6 3.4M19.4 10.4l-3.3-1.1.6-3.4'/></svg>");
  --icon-activity: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><path d='M3 12h4l2.5-6 5 12 2.5-6h4'/></svg>");
  --icon-building: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><path d='M4 21V6l8-3 8 3v15M2.5 21h19M9 21v-4h6v4M8.5 8.5h.01M12 8.5h.01M15.5 8.5h.01M8.5 12.5h.01M12 12.5h.01M15.5 12.5h.01'/></svg>");
  --icon-plug: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><path d='M9 3v5M15 3v5M7 8h10v3a5 5 0 0 1-10 0zM12 16v5'/></svg>");
  --icon-user: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round'><circle cx='12' cy='8.5' r='3.8'/><path d='M4.5 20c1.2-3.6 4-5.5 7.5-5.5s6.3 1.9 7.5 5.5'/></svg>");
  --icon-bell: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linejoin='round' stroke-linecap='round'><path d='M6.5 16.5V11a5.5 5.5 0 0 1 11 0v5.5L19 18H5z'/><path d='M10 20.5a2 2 0 0 0 4 0'/></svg>");
  --icon-bolt: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linejoin='round'><path d='M13 3 5 13.5h6l-1 7.5 8-10.5h-6z'/></svg>");

  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
}
/* Dark follows the device until the viewer picks one with the sun/moon button (data-theme on the root). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --sea: #0c1226; --sea-hi: #1e2850; --sea-line: #242d51; --on-sea-muted: #98a0bd;
    --bg: #0c1226; --surface: #10193a; --shelf: #0f1730; --ink: #e7eaf2; --muted: #98a0bd; --faint: #7e87a5;
    --line: #242d51; --line-strong: #39426b; --accent: #6f9ae0; --accent-hover: #92b4ea; --accent-line: #26346b; --on-accent: #0c1226;
    --chip-bg: #1c2447; --tint: #16224a; --action: #3d6fd0; --action-hover: #5a86dc;
    --ok: #46a382; --busy: #eda440; --error: #e0685c;
    --ws1: #6f9ae0; --ws2: #46a382; --ws3: #9b8ae0; --ws4: #eda440;
    --raise: 0 1px 2px rgb(0 0 0 / 35%); --drop: rgb(22 34 74 / 90%); --ice-op: .72;
    --icon-chevron: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2398a0bd' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='m7 10 5 5 5-5'/></svg>");
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --sea: #0c1226; --sea-hi: #1e2850; --sea-line: #242d51; --on-sea-muted: #98a0bd;
  --bg: #0c1226; --surface: #10193a; --shelf: #0f1730; --ink: #e7eaf2; --muted: #98a0bd; --faint: #7e87a5;
  --line: #242d51; --line-strong: #39426b; --accent: #6f9ae0; --accent-hover: #92b4ea; --accent-line: #26346b; --on-accent: #0c1226;
  --chip-bg: #1c2447; --tint: #16224a; --action: #3d6fd0; --action-hover: #5a86dc;
  --ok: #46a382; --busy: #eda440; --error: #e0685c;
  --ws1: #6f9ae0; --ws2: #46a382; --ws3: #9b8ae0; --ws4: #eda440;
  --raise: 0 1px 2px rgb(0 0 0 / 35%); --drop: rgb(22 34 74 / 90%); --ice-op: .72;
  --icon-chevron: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2398a0bd' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='m7 10 5 5 5-5'/></svg>");
}

* { box-sizing: border-box; }
body { margin: 0; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; background: var(--bg); font-size: 15px; line-height: 1.7; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 700; text-wrap: balance; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Buttons */
button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: var(--control-height); padding: 0 14px; border: 1px solid var(--line); border-radius: var(--radius-control);
  background: var(--surface); color: var(--ink); font-size: 13.5px; font-weight: 500; line-height: 1.2; cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s;
}
button:hover:not(:disabled) { background: var(--chip-bg); border-color: var(--line-strong); }
button.primary { background: var(--action); border-color: var(--action); color: var(--action-on); font-weight: 700; }
button.primary:hover:not(:disabled) { background: var(--action-hover); border-color: var(--action-hover); }
button.danger:hover:not(:disabled) { color: var(--error); }
.icon-btn { width: 34px; padding: 0; border-color: transparent; background: transparent; color: var(--muted); }
.icon-btn:hover:not(:disabled) { color: var(--ink); background: var(--chip-bg); border-color: transparent; }
.count { margin-left: 4px; color: var(--faint); font-size: 11px; font-weight: 500; font-variant-numeric: tabular-nums; }
button.ghost { background: transparent; border-color: transparent; color: var(--muted); }
button.ghost:hover:not(:disabled) { color: var(--ink); }
button:disabled { opacity: .45; cursor: not-allowed; }

/* Form controls */
label { font-size: 12.5px; font-weight: 500; color: var(--muted); }
input, select, textarea {
  width: 100%; min-height: var(--control-height); padding: 6px 10px; border: 1px solid var(--line); border-radius: var(--radius-control);
  background: var(--surface); font-size: 14px; transition: border-color .15s, box-shadow .15s;
}
input:hover, select:hover, textarea:hover { border-color: var(--line-strong); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--tint); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; }
input::placeholder, textarea::placeholder { color: var(--faint); }
select { appearance: none; padding-right: 32px; background: var(--surface) var(--icon-chevron) no-repeat right 10px center / 16px; cursor: pointer; }
textarea { min-height: 76px; resize: vertical; line-height: 1.7; }
input[type="file"] { padding: 5px; font-size: 12.5px; color: var(--muted); border-style: dashed; background: transparent; cursor: pointer; }
input[type="file"]::file-selector-button {
  margin-right: 10px; min-height: var(--control-height-sm); padding: 0 10px; border: 1px solid var(--line); border-radius: 6px;
  background: var(--surface); color: var(--ink); font: inherit; font-weight: 500; cursor: pointer;
}
.stack { display: grid; gap: 8px; margin-top: 14px; }
.button-row { display: flex; flex-wrap: wrap; gap: 6px; }
.button-row button { min-height: var(--control-height-sm); padding: 0 10px; font-size: 12.5px; }

/* Top bar */
.topbar {
  flex: 0 0 auto; min-height: 56px; padding: 8px 20px; background: var(--sea); color: var(--on-sea); border-bottom: 1px solid var(--sea-line);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.topbar button.ghost { color: var(--on-sea-muted); }
.topbar button.ghost:hover:not(:disabled) { background: var(--sea-hi); color: var(--on-sea); }
.theme-toggle { width: 36px; color: var(--on-sea); }
.theme-toggle:hover:not(:disabled) { background: var(--sea-hi); }
.theme-toggle svg { width: 20px; height: 20px; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand strong { font-family: var(--font-display); font-size: 17px; font-weight: 700; letter-spacing: .01em; white-space: nowrap; }
.brand-mark { display: block; flex: none; width: 27.5px; height: 27.5px; }
.brand-mark > svg { display: block; width: 27.5px; height: 27.5px; }
.brand-mark.large { width: 77px; height: 77px; }
.brand-mark.large > svg { width: 77px; height: 77px; }
/* Idi frames are 16x17 dots with room around the penguin for jumps and raised flippers; the negative
   margins keep that room out of the layout so the penguin itself fills the mark. */
.idi { display: block; }
.idi > svg { display: block; width: 100%; height: 100%; overflow: visible; }
.brand-mark .idi { width: 40px; height: 42.5px; margin: -10px -7.5px -5px -5px; }
.brand-mark.large .idi { width: 112px; height: 119px; margin: -28px -21px -14px -14px; }
/* The search box is a dark glass over the night sea and the snowfield, where the penguin walks behind it (ice-stage.js).
   The zone fills the bar's full height so the snow reaches its bottom edge. */
.search-zone { position: relative; flex: 1; min-width: 0; align-self: stretch; margin-block: -8px; display: flex; align-items: center; justify-content: center; }
body:has(#app[hidden]) .search-trigger { visibility: hidden; }
.search-trigger {
  position: relative; z-index: 1; flex: 0 1 420px; min-width: 0; min-height: 36px; justify-content: flex-start; gap: 8px; padding: 0 8px 0 14px;
  border: 1px solid rgb(255 255 255 / 32%); border-radius: 999px; background: rgb(16 25 58 / 50%);
  color: #dfe4f2; font-weight: 400;
}
.search-trigger:hover:not(:disabled) { background: rgb(16 25 58 / 70%); border-color: rgb(255 255 255 / 45%); }
.search-label { text-shadow: 0 0 3px var(--sea), 0 0 1px var(--sea); }
.ice-stage { position: absolute; inset: 0; z-index: 0; overflow: hidden; pointer-events: none;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent); mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent); }
.ice-stage > * { position: absolute; }
.flake { top: -4px; z-index: 0; border-radius: 50%; background: var(--snow); animation: snowfall linear infinite; }
.ice-land { right: 0; bottom: 0; z-index: 1; height: 24px; opacity: var(--ice-op); }
.snow-back { position: absolute; inset: 0; width: 100%; height: 100%; }
.snow-top { fill: var(--snow); }
.snow-shade { fill: var(--snow-shade); }
.ice-cliff { position: absolute; left: 0; bottom: 0; width: 5px; height: 14px; background: linear-gradient(90deg, var(--snow-shade), var(--snow)); border-radius: 2px 0 0 0; }
.glint { bottom: 11.5px; z-index: 2; width: 2px; height: 2px; border-radius: 50%; background: var(--snow); box-shadow: 0 0 3px var(--snow); animation: twinkle 4s ease-in-out infinite; }
.print { bottom: 10.5px; z-index: 2; width: 3px; height: 1.5px; border-radius: 1px; background: var(--snow-print); transform: translateX(-50%); animation: fade-mark 10s linear forwards; }
.print.r { bottom: 9.6px; }
.groove { bottom: 10px; z-index: 2; height: 2px; border-radius: 1px; background: var(--snow-print); opacity: .7; animation: fade-mark 13s linear forwards; }
.ice-penguin.on-floe { bottom: 12.5px; }
.on-floe .ip-ride { transform-origin: 50% 100%; animation: floe-bob 3.6s ease-in-out infinite; }
.ice-penguin { bottom: 10px; z-index: 3; transform: translateX(-50%); transition-property: left; }
.ip-flip { display: flex; align-items: flex-end; }
.ip-body { position: relative; display: grid; transform-origin: 50% 100%; }
.ip-body > .sprite { grid-area: 1 / 1; display: block; overflow: visible; }
.ip-body .frame-b { opacity: 0; }
.ice-penguin .eye { animation: blink 4.6s infinite; }
.pose-walk .ip-body { animation: waddle var(--step) ease-in-out infinite alternate; }
.pose-walk .frame-a { animation: frame-a calc(var(--step) * 2) steps(1) infinite; }
.pose-walk .frame-b { animation: frame-b calc(var(--step) * 2) steps(1) infinite; }
.pose-flap .frame-a { animation: frame-a calc(var(--flap) * 2) steps(1) infinite; }
.pose-flap .frame-b { animation: frame-b calc(var(--flap) * 2) steps(1) infinite; }
.pose-swim .ip-body { transform: translateY(6px); }
.anim-hop { animation: hop .7s ease-out; }
.anim-trip { animation: trip .52s ease-in forwards; }
.anim-flop { animation: flop .5s ease-out; }
.anim-wiggle { animation: wiggle .25s ease-in-out 4 alternate; }
.anim-getup { animation: getup .9s ease-out; }
.anim-shake { animation: shake .14s linear 6 alternate; }
.anim-peck { animation: peck 1.6s ease-in-out; }
.anim-rest { animation: rest 2.6s ease-in-out infinite; }
.anim-liedown { animation: liedown .55s ease-out; }
.anim-drop { animation: drop .55s cubic-bezier(.5, 0, .9, .6) forwards; }
.anim-surface { animation: surface 1.4s ease-out forwards; }
.anim-slidedrop { animation: slidedrop .5s ease-in forwards; }
.anim-slip { animation: slip 1.3s ease-in-out forwards; }
.anim-haul { animation: haul 1.2s ease-out forwards; }
.anim-teeter { animation: teeter 1.6s ease-in-out; }
.anim-stepout { animation: stepout .45s ease-out forwards; }
.anim-paddle { animation: paddle 2.2s ease-in-out infinite; }
.anim-porpoise { animation: porpoise 1.8s ease-in-out forwards; }
.sea { left: 0; bottom: 0; z-index: 4; height: 7px; border-top: 1px solid var(--water-line); opacity: .94; transform-origin: 50% 100%;
  background: linear-gradient(var(--water-top), var(--water-mid) 45%, var(--water-deep)); animation: swell 6s ease-in-out infinite; }
.sea > i, .sea > span { position: absolute; }
.wave { left: 0; right: 0; height: 4px; background-repeat: repeat-x; }
.wave.back { top: -5px; opacity: .5; background-size: 26px 4px; animation: waves-r 14s linear infinite;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='26' height='4'%3E%3Cpath d='M0 3Q6.5 0 13 3T26 3' fill='none' stroke='%23d7f0ff' stroke-width='1'/%3E%3C/svg%3E"); }
.wave.front { top: -3.5px; background-size: 16px 4px; animation: waves-l 9s linear infinite;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='4'%3E%3Cpath d='M0 4V3Q4 .8 8 3T16 3V4z' fill='%234a93e0'/%3E%3Cpath d='M0 3Q4 .8 8 3T16 3' fill='none' stroke='%23bfe6ff' stroke-width='.8'/%3E%3C/svg%3E"); }
.sea-reflect { top: 0; right: 0; bottom: 0; width: 18px; background: linear-gradient(90deg, transparent, rgb(255 255 255 / 32%)); animation: shimmer 3.4s ease-in-out infinite; }
.sea-glint { width: 4px; height: 1px; border-radius: 1px; background: #ffffff; opacity: 0; animation: twinkle 4s ease-in-out infinite; }
.foam { top: -2px; right: 0; width: 0; height: 0; }
.foam i { position: absolute; width: 3px; height: 2px; border-radius: 50%; background: var(--splash); animation: foam 2.6s ease-in-out infinite; }
.foam i:nth-child(1) { top: 0; right: 0; }
.foam i:nth-child(2) { top: 1px; right: 3px; animation-delay: -.7s; }
.foam i:nth-child(3) { top: 0; right: 6px; animation-delay: -1.4s; }
.foam i:nth-child(4) { top: 2px; right: 1px; animation-delay: -2s; }
.drift-floe { bottom: 3px; z-index: 3; }
.drift-floe svg { display: block; transform-origin: 50% 100%; animation: floe-bob 3.6s ease-in-out infinite; }
.df-top { fill: var(--snow); }
.df-under { fill: var(--snow-shade); }
.ripple { bottom: 6.5px; z-index: 5; width: 5px; height: 2px; border: 1px solid var(--splash); border-radius: 50%; transform: translateX(-50%); animation: ripple 1.8s ease-out forwards; }
.bubble { bottom: 0; z-index: 5; width: 2.5px; height: 2.5px; border: 1px solid var(--splash); border-radius: 50%; animation: bubble 1.4s ease-out forwards; }
.puff, .splash { z-index: 5; width: 0; height: 0; }
.puff { bottom: 11px; }
.splash { bottom: 7px; }
.puff i, .splash i { position: absolute; left: 0; bottom: 0; border-radius: 50%; }
.puff i { background: var(--snow); animation: burst 1s ease-out forwards; }
.splash i { background: var(--splash); animation: spray 1.2s ease-out forwards; }
.snow-front { bottom: 0; z-index: 6; height: 6px; opacity: var(--ice-op); }
.snow-front path { fill: var(--snow); }
@keyframes snowfall { to { transform: translate(var(--dx), 64px); } }
@keyframes twinkle { 0%, 100% { opacity: 0; } 50% { opacity: .9; } }
@keyframes fade-mark { 0% { opacity: .9; } 100% { opacity: 0; } }
@keyframes blink { 0%, 95%, 100% { fill: #10193a; } 96%, 98% { fill: #4a7bd0; } }
@keyframes frame-a { 50% { opacity: 0; } }
@keyframes frame-b { 0% { opacity: 0; } 50% { opacity: 1; } }
@keyframes waddle { from { transform: rotate(-5deg); } to { transform: rotate(5deg) translateY(-.6px); } }
@keyframes hop { 40% { transform: translateY(-4px); } }
@keyframes trip { to { transform: translateY(2px) rotate(75deg); } }
@keyframes flop { 0% { transform: translateY(-3px); } 50% { transform: translateY(1px); } }
@keyframes wiggle { from { transform: translateX(-1px); } to { transform: translateX(1px); } }
@keyframes getup { from { transform: translateY(2px) rotate(70deg); } 70% { transform: rotate(-6deg); } }
@keyframes shake { from { transform: rotate(-6deg); } to { transform: rotate(6deg); } }
@keyframes peck { 20% { transform: rotate(26deg); } 35% { transform: rotate(4deg); } 55% { transform: rotate(30deg); } 75% { transform: none; } }
@keyframes rest { 0%, 100% { transform: scaleY(.9); } 50% { transform: scaleY(.94); } }
@keyframes liedown { from { transform: translateY(-4px); } }
@keyframes drop { 0% { transform: rotate(7deg); } 25% { transform: translateY(1px) rotate(14deg); } 100% { transform: translateY(16px) rotate(34deg); } }
@keyframes stepout { to { transform: translateY(-.5px) rotate(7deg); } }
@keyframes teeter { 20% { transform: rotate(12deg); } 35% { transform: rotate(3deg); } 55% { transform: rotate(15deg); } 75% { transform: rotate(-5deg); } }
@keyframes surface { 0% { transform: translateY(16px) rotate(18deg); } 100% { transform: translateY(6px); } }
@keyframes slidedrop { to { transform: translateY(14px) rotate(26deg); } }
@keyframes slip { 0% { transform: translateY(6px); } 45% { transform: translateY(2px) rotate(-26deg); } 60% { transform: translateY(1px) rotate(-24deg); } 100% { transform: translateY(7px); } }
@keyframes haul { 0% { transform: translateY(6px) rotate(-28deg); } 50% { transform: translateY(2px) rotate(-26deg); } 80% { transform: translateY(-1px) rotate(-4deg); } 100% { transform: none; } }
@keyframes paddle { 0%, 100% { transform: translateY(6px); } 50% { transform: translateY(5px) rotate(-3deg); } }
@keyframes porpoise { 0% { transform: translateY(6px) rotate(-25deg); } 50% { transform: translateY(-2px); } 100% { transform: translateY(7px) rotate(25deg); } }
@keyframes swell { 50% { transform: scaleY(1.14); } }
@keyframes waves-r { to { background-position-x: 104px; } }
@keyframes waves-l { to { background-position-x: -64px; } }
@keyframes shimmer { 0%, 100% { opacity: .4; } 50% { opacity: .9; } }
@keyframes foam { 0%, 100% { opacity: .15; transform: scale(.6); } 50% { opacity: .95; transform: translateX(-3px) scale(1.25); } }
@keyframes floe-bob { 0%, 100% { transform: rotate(-2deg); } 50% { transform: translateY(1px) rotate(2deg); } }
@keyframes ripple { from { opacity: .9; } to { opacity: 0; transform: translateX(-50%) scale(5, 2); } }
@keyframes bubble { from { opacity: .9; } to { opacity: 0; transform: translateY(-6px); } }
@keyframes burst { to { opacity: 0; transform: translate(var(--dx), var(--dy)); } }
@keyframes spray { 45% { opacity: 1; transform: translate(calc(var(--dx) * .6), var(--dy)); } 100% { opacity: 0; transform: translate(var(--dx), 3px); } }
.search-trigger::before { content: ""; flex: none; width: 15px; height: 15px; background: currentColor; -webkit-mask: var(--icon-search) center / contain no-repeat; mask: var(--icon-search) center / contain no-repeat; }
.search-label { flex: 1; min-width: 0; overflow: hidden; text-align: left; white-space: nowrap; text-overflow: ellipsis; }
.search-trigger kbd { padding: 0 6px; border: 1px solid rgb(255 255 255 / 32%); border-radius: 4px; font-family: var(--font-mono); font-size: 11px; color: #dfe4f2; }
/* Switches between the workspace and the agents, like a chat/code toggle. */
.mode-switch { flex: none; display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--sea-line); border-radius: 999px; background: var(--sea-hi); }
body:has(#app[hidden]) .mode-switch { visibility: hidden; }
.mode-switch button { min-height: 28px; gap: 6px; padding: 0 12px; border: 0; border-radius: 999px; background: transparent; color: var(--on-sea-muted); font-size: 12.5px; font-weight: 500; }
.mode-switch button::before { content: ""; flex: none; width: 15px; height: 15px; background: currentColor; -webkit-mask: var(--icon-home) center / contain no-repeat; mask: var(--icon-home) center / contain no-repeat; }
.mode-switch button[data-mode="agent"]::before { -webkit-mask-image: var(--icon-bolt); mask-image: var(--icon-bolt); }
.mode-switch button:hover:not(:disabled) { background: transparent; color: var(--on-sea); }
.mode-switch button[aria-selected="true"], .mode-switch button[aria-selected="true"]:hover:not(:disabled) { background: #ffffff; color: #10193a; font-weight: 700; }
.mode-switch button:disabled { opacity: .6; }
.top-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.top-actions button { white-space: nowrap; }
.me-anchor { position: relative; }
.top-actions .bell { width: 36px; border-color: transparent; background: transparent; color: var(--on-sea); }
.top-actions .bell:hover:not(:disabled), .top-actions .bell[aria-expanded="true"] { background: var(--sea-hi); color: var(--on-sea); }
.top-actions .bell::before { content: ""; width: 19px; height: 19px; background: currentColor; -webkit-mask: var(--icon-bell) center / contain no-repeat; mask: var(--icon-bell) center / contain no-repeat; }
.bell-menu { width: 300px; padding: 12px 14px; }
.bell-head { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.bell-menu p { margin: 6px 0 0; color: var(--muted); font-size: 13px; line-height: 1.7; }
.me, .me-avatar { display: grid; place-items: center; flex: none; width: 32px; height: 32px; min-height: 0; padding: 0; border: 2px solid transparent; border-radius: 50%; background: var(--action); color: var(--action-on); font-size: 13px; font-weight: 700; }
.me:hover:not(:disabled), .me[aria-expanded="true"] { background: var(--action); border-color: var(--on-sea); }
.me.anonymous::before, .me-avatar.anonymous::before { content: ""; width: 18px; height: 18px; background: currentColor; -webkit-mask: var(--icon-user) center / contain no-repeat; mask: var(--icon-user) center / contain no-repeat; }
.me-menu { position: absolute; top: calc(100% + 8px); right: 0; z-index: 50; display: grid; gap: 2px; width: 260px; padding: 8px; border: 1px solid var(--line); border-radius: var(--radius-panel); background: var(--surface); color: var(--ink); box-shadow: 0 12px 32px rgb(12 18 38 / 22%); }
.me-head { display: flex; align-items: center; gap: 10px; padding: 6px 6px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.me-head div { display: grid; min-width: 0; line-height: 1.45; }
.me-head small { overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.me-menu > button { width: 100%; min-height: 34px; justify-content: flex-start; padding: 0 8px; border: 0; background: transparent; color: var(--ink); font-weight: 400; }
.me-menu > button:hover:not(:disabled) { background: var(--chip-bg); }
.page-note { margin: 0 0 12px; color: var(--muted); font-size: 13.5px; line-height: 1.7; }
.profile-main { max-width: 860px; }
.profile-status { display: block; margin-top: 6px; color: var(--muted); font-size: 12.5px; }
.profile-status:empty { display: none; }
.profile-note { margin-bottom: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-control); background: var(--bg); font-size: 14px; line-height: 1.75; overflow-wrap: anywhere; }
.profile-note > :first-child { margin-top: 0; }
.profile-note > :last-child { margin-bottom: 0; }

/* Signed-out welcome */
.welcome { display: none; flex: 1 1 auto; place-items: center; padding: 32px 20px; }
body:has(#app[hidden]) .welcome { display: grid; }
.welcome-card { max-width: 32rem; text-align: center; display: grid; justify-items: center; gap: 10px; }
.welcome-card h1 { margin: 10px 0 0; font-size: clamp(28px, 4.4vw, 38px); line-height: 1.25; }
.welcome-card p { margin: 0; color: var(--muted); }
.welcome-card .welcome-hint { color: var(--faint); font-size: 13px; }

/* Layout and sidebar */
.layout {
  --sidebar-width: 296px;
  --rail-width: 76px;
  position: relative; flex: 1 1 auto; min-height: 0; display: grid;
  grid-template-columns: var(--rail-width) var(--sidebar-width) minmax(0, 1fr); overflow: hidden;
  background: var(--sea);
}
/* The side panel takes 40% of what the rail and sidebar leave (chat:side = 6:4) until its edge is dragged. */
.layout.side-open {
  grid-template-columns: var(--rail-width) var(--sidebar-width) minmax(0, 1fr)
    clamp(300px, var(--side-width, calc((100% - var(--rail-width) - var(--sidebar-width)) * .4)), calc(100% - var(--rail-width) - var(--sidebar-width) - 360px));
}
/* The rail on the far left: the workspace (or agents) first, then スキル and コネクタ. */
.rail { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 6px 12px; background: var(--sea); overflow-y: auto; }
.rail button { flex-direction: column; gap: 3px; width: 64px; min-height: 0; padding: 8px 0 6px; border: 0; border-radius: 14px 5px 14px 5px; background: transparent; color: var(--on-sea-muted); font-size: 11px; font-weight: 500; line-height: 1.3; text-align: center; }
.rail button:hover:not(:disabled) { background: var(--sea-hi); color: var(--on-sea); }
.rail button[aria-current="page"], .rail button[aria-current="page"]:hover:not(:disabled) { background: var(--sea-hi); color: var(--on-sea); font-weight: 700; }
.rail-icon { width: 19px; height: 19px; background: currentColor; -webkit-mask: var(--icon-home) center / contain no-repeat; mask: var(--icon-home) center / contain no-repeat; }
.layout.agents .rail-main .rail-icon { -webkit-mask-image: var(--icon-bolt); mask-image: var(--icon-bolt); }
.rail [data-view="skills"] .rail-icon { -webkit-mask-image: var(--icon-snow); mask-image: var(--icon-snow); }
.rail [data-view="connectors"] .rail-icon { -webkit-mask-image: var(--icon-plug); mask-image: var(--icon-plug); }
.rail button.rail-main { margin-bottom: 6px; }
.rail button.rail-main + button { position: relative; margin-top: 6px; }
.rail button.rail-main + button::before { content: ""; position: absolute; top: -7px; left: 12px; right: 12px; height: 1px; background: var(--sea-line); }
/* Administrators: 記録 and 管理 under a label at the bottom of the rail, and a badge beside their name. */
.rail-admin { display: grid; justify-items: center; gap: 2px; margin-top: auto; padding-top: 8px; border-top: 1px solid var(--sea-line); }
.rail-label { color: var(--on-sea-muted); font-size: 9.5px; letter-spacing: .08em; }
.rail [data-view="activity"] .rail-icon, .page-title.activity::before { -webkit-mask-image: var(--icon-activity); mask-image: var(--icon-activity); }
.rail [data-view="admin"] .rail-icon, .page-title.admin::before { -webkit-mask-image: var(--icon-building); mask-image: var(--icon-building); }
.me-name-line { display: flex; align-items: center; gap: 8px; min-width: 0; }
.admin-chip { flex: none; padding: 0 7px; border-radius: 999px; background: var(--sea); color: var(--on-sea); font-size: 10.5px; font-weight: 700; }
.page-card h2.with-tag { display: flex; align-items: center; gap: 8px; }
.policy-dl { display: grid; gap: 10px; margin: 0; font-size: 13px; line-height: 1.6; }
.policy-dl dt { color: var(--faint); font-size: 11.5px; }
.policy-dl dd { margin: 0; }
.log-list { display: grid; grid-template-columns: minmax(0, 1fr); margin: 0; padding: 4px 16px; border: 1px dashed var(--line-strong); border-radius: var(--radius-panel); background: var(--surface); list-style: none; }
.log-list li { display: grid; grid-template-columns: 44px 52px minmax(0, 1fr) auto; align-items: baseline; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.log-list li:last-child { border-bottom: 0; }
.log-list time { color: var(--faint); font-variant-numeric: tabular-nums; }
.log-who { color: var(--muted); font-weight: 600; }
.log-who.member { color: var(--ink); }
.log-text { display: grid; gap: 2px; min-width: 0; }
.log-text code { overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.log-result { color: var(--muted); font-size: 12px; white-space: nowrap; }
.log-result.warn { color: var(--busy); font-weight: 600; }
/* スキルとコネクタ: what they will do, until they are built */
.layout:not(.page-view) .sidebar { border-top-left-radius: 20px; }
.layout.page-view, .layout.page-view.side-open { grid-template-columns: var(--rail-width) minmax(0, 1fr); }
.layout.page-view :is(.sidebar, .sidebar-resizer, .chat, .side) { display: none; }
.page-screen { min-width: 0; min-height: 0; overflow-y: auto; padding: 28px clamp(20px, 4vw, 48px) 40px; border-top-left-radius: 20px; background: var(--bg); }
.page-head { max-width: 860px; margin-bottom: 22px; }
.page-head p { margin: 8px 0 0; color: var(--muted); font-size: 14px; line-height: 1.75; }
.page-title { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 24px; }
.page-title::before { content: ""; width: 22px; height: 22px; background: currentColor; -webkit-mask: var(--icon-snow) center / contain no-repeat; mask: var(--icon-snow) center / contain no-repeat; }
.page-title.connectors::before { -webkit-mask-image: var(--icon-plug); mask-image: var(--icon-plug); }
.page-title.profile::before { -webkit-mask-image: var(--icon-user); mask-image: var(--icon-user); }
.soon-tag { flex: none; padding: 1px 8px; border-radius: 999px; background: color-mix(in srgb, var(--busy) 22%, var(--surface)); color: var(--ink); font-size: 11.5px; font-weight: 600; letter-spacing: 0; }
.page-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; align-items: start; gap: 24px; }
.page-main, .page-side { display: grid; gap: 14px; min-width: 0; }
.page-card { padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius-panel); background: var(--surface); box-shadow: var(--raise); }
.page-card h2, .page-subhead { margin: 0 0 10px; font-size: 15px; }
.page-subhead { margin: 8px 0 0; }
.plan-list { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.plan-list li { display: grid; gap: 2px; font-size: 13.5px; line-height: 1.7; color: var(--muted); }
.plan-list b { color: var(--ink); font-size: 14px; }
.sample-list { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.sample-card { display: grid; gap: 4px; padding: 12px 16px; border: 1px dashed var(--line-strong); border-radius: var(--radius-panel); background: var(--surface); }
.sample-top { display: flex; align-items: center; gap: 8px; }
.sample-card p { margin: 0; font-size: 13.5px; }
.sample-card small { color: var(--faint); font-size: 12px; }
.scope-chip { padding: 0 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: var(--chip-bg); color: var(--muted); }
.scope-chip.org { background: color-mix(in srgb, var(--ws4) 18%, var(--surface)); color: var(--ink); }
.scope-chip.team { background: color-mix(in srgb, var(--ws2) 18%, var(--surface)); color: var(--ink); }
.scope-chip.mine { background: color-mix(in srgb, var(--ws1) 18%, var(--surface)); color: var(--ink); }
.scope-path { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.scope-path li { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: 10px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.connector-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 14px; max-width: 1100px; margin: 0; padding: 0; list-style: none; }
.connector { display: grid; gap: 10px; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius-panel); background: var(--surface); box-shadow: var(--raise); }
.connector-top { display: flex; align-items: center; gap: 10px; }
.connector-top h2 { flex: 1; margin: 0; font-size: 15.5px; }
.c-mark { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px 3px 9px 3px; background: var(--tint); color: var(--accent); font-weight: 700; font-size: 13px; }
.connector dl { display: grid; gap: 6px; margin: 0; font-size: 13px; }
.connector dt { color: var(--faint); font-size: 11.5px; }
.connector dd { margin: 0; }
.layout.resizing { cursor: col-resize; user-select: none; }
.sidebar-resizer { position: absolute; top: 0; bottom: 0; left: calc(var(--rail-width) + var(--sidebar-width) - 5px); z-index: 5; width: 10px; cursor: col-resize; touch-action: none; }
.sidebar-resizer::after { content: ""; position: absolute; top: 0; bottom: 0; left: 4px; width: 2px; background: transparent; transition: background-color .15s; }
.sidebar-resizer:hover::after, .layout.resizing .sidebar-resizer::after, .sidebar-resizer:focus-visible::after { background: var(--accent); }
.sidebar-resizer:focus-visible { outline: none; }
.sidebar { min-height: 0; padding: 18px 14px 24px; background: var(--bg); border-right: 1px solid var(--line); overflow-y: auto; }
.side-section + .side-section { margin-top: 16px; }
.side-section > summary {
  display: flex; align-items: center; gap: 6px; margin-bottom: 6px; padding: 4px 6px; border-radius: var(--radius-control);
  cursor: pointer; list-style: none; user-select: none; transition: background-color .15s;
}
.side-section > summary::-webkit-details-marker { display: none; }
.side-section > summary::before {
  content: ""; flex: none; width: 13px; height: 13px; background: var(--faint); transform: rotate(-90deg); transition: transform .15s;
  -webkit-mask: var(--icon-caret) center / contain no-repeat; mask: var(--icon-caret) center / contain no-repeat;
}
.side-section[open] > summary::before { transform: none; }
.side-section:not([open]) > summary { margin-bottom: 0; }
.side-section > summary:hover { background: var(--chip-bg); }
.sidebar form label { margin-left: 6px; }
.section-title h2 { margin: 0; font-family: var(--font-body); font-size: 12px; font-weight: 500; color: var(--faint); }
.section-title .count, .section-add { margin-left: auto; }
.section-add { width: 26px; min-height: 26px; }
.section-add::before { content: ""; width: 15px; height: 15px; background: currentColor; -webkit-mask: var(--icon-plus) center / contain no-repeat; mask: var(--icon-plus) center / contain no-repeat; }
.nav-list, .file-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; }
#workspaces { max-height: min(32vh, 18rem); overflow-y: auto; overscroll-behavior: contain; }
#sessions, #files { max-height: 30vh; overflow-y: auto; overscroll-behavior: contain; }
.nav-list button, .file-list .file-open {
  width: 100%; min-height: 34px; justify-content: flex-start; gap: 9px; padding: 6px 8px; text-align: left; overflow-wrap: anywhere;
  background: transparent; border-color: transparent; color: var(--ink); font-size: 14px; font-weight: 400;
}
.nav-list button::before, .file-list .file-open::before {
  content: ""; flex: none; width: 15px; height: 15px; background: var(--faint);
  -webkit-mask: var(--icon-folder) center / contain no-repeat; mask: var(--icon-folder) center / contain no-repeat;
}
#sessions button { font-size: 13px; color: var(--muted); }
/* Each chat row carries its delete button on the right, shown while the row is pointed at or focused. */
#sessions li { position: relative; }
#sessions li > button:first-child { padding-right: 36px; }
#sessions .session-delete { position: absolute; top: 50%; right: 4px; width: 28px; min-height: 28px; padding: 0; border-color: transparent; background: transparent; color: var(--faint); opacity: 0; transform: translateY(-50%); }
#sessions .session-delete::before { content: ""; width: 14px; height: 14px; background: currentColor; -webkit-mask: var(--icon-trash) center / contain no-repeat; mask: var(--icon-trash) center / contain no-repeat; }
#sessions li:is(:hover, :focus-within) .session-delete { opacity: 1; }
#sessions .session-delete:hover:not(:disabled) { background: var(--chip-bg); color: var(--error); }
@media (hover: none) { #sessions .session-delete { opacity: 1; } }
#sessions button::before { -webkit-mask-image: var(--icon-chat); mask-image: var(--icon-chat); }
.file-list .file-open::before { -webkit-mask-image: var(--icon-file); mask-image: var(--icon-file); }
.nav-list button:hover:not(:disabled) { background: var(--chip-bg); border-color: transparent; }
.nav-list button[aria-current="true"] { background: var(--tint); color: var(--accent); font-weight: 600; }
.nav-list button[aria-current="true"]::before { background: var(--accent); }
.ws-list button { align-items: center; gap: 10px; }
.ws-list button::before { display: none; }
.ws-list button[aria-current="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--raise); }
.ws-list .ws-my { font-weight: 600; }
.ws-group { margin: 8px 0 2px; }
.ws-list .ws-group button { width: 100%; min-height: 24px; justify-content: flex-start; gap: 4px; padding: 0 8px; border: 0; background: transparent; color: var(--faint); font-size: 11.5px; font-weight: 500; }
.ws-list .ws-group button::before { display: block; content: ""; width: 10px; height: 10px; background: currentColor; -webkit-mask: var(--icon-caret) center / contain no-repeat; mask: var(--icon-caret) center / contain no-repeat; transition: transform .15s; }
.ws-list .ws-group button[aria-expanded="false"]::before { transform: rotate(-90deg); }
.ws-list .ws-group button:hover:not(:disabled) { background: transparent; color: var(--ink); box-shadow: none; }
.ws-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-avatar { flex: none; display: inline-grid; place-items: center; width: 20px; height: 20px; border: 2px solid var(--shelf); border-radius: 50%; background: var(--ws1); color: #fff; font-size: 10px; font-weight: 700; line-height: 1; }
.person-avatar.h2 { background: var(--ws2); }
.person-avatar.h3 { background: var(--ws3); }
.person-avatar.h4 { background: var(--ws4); }
.ws-avatars { flex: none; display: inline-flex; align-items: center; margin-left: auto; }
.ws-avatars .person-avatar + .person-avatar { margin-left: -5px; }
.avatar-more { margin-left: 3px; color: var(--muted); font-size: 11px; font-weight: 600; }
#sessions button.with-avatar::before { display: none; }
#sessions button.with-avatar { gap: 8px; }
.ws-list li { position: relative; }
.ws-list li:has(.ws-gear) > button:first-child { padding-right: 40px; }
.ws-list .ws-gear { position: absolute; top: 50%; right: 6px; width: 28px; min-height: 28px; padding: 0; justify-content: center; color: var(--muted); transform: translateY(-50%); }
.ws-list .ws-gear::before { content: ""; display: block; width: 16px; height: 16px; background: currentColor; -webkit-mask: var(--icon-gear) center / contain no-repeat; mask: var(--icon-gear) center / contain no-repeat; }
.floe { flex: none; width: 24px; height: 24px; }
.floe svg { display: block; width: 100%; height: 100%; overflow: visible; }
.floe-ice { fill: color-mix(in srgb, var(--ws1) 22%, var(--surface)); stroke: var(--ws1); stroke-width: 1.4; stroke-linejoin: round; }
.floe.h2 .floe-ice { fill: color-mix(in srgb, var(--ws2) 22%, var(--surface)); stroke: var(--ws2); }
.floe.h3 .floe-ice { fill: color-mix(in srgb, var(--ws3) 22%, var(--surface)); stroke: var(--ws3); }
.floe.h4 .floe-ice { fill: color-mix(in srgb, var(--ws4) 22%, var(--surface)); stroke: var(--ws4); }
.floe-penguin { fill: var(--ink); }
.floe-belly { fill: var(--surface); }
.area-tabs { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 2px; margin-bottom: 8px; padding: 3px; border-radius: 12px 4px 12px 4px; background: color-mix(in srgb, var(--line) 60%, var(--shelf)); }
.area-tabs button { min-height: 28px; padding: 0; border: 0; border-radius: 9px 3px 9px 3px; background: transparent; color: var(--muted); font-size: 12.5px; }
.area-tabs button:hover:not(:disabled) { background: transparent; color: var(--ink); }
.area-tabs button[aria-selected="true"] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: var(--raise); }
.file-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 2px; border-radius: var(--radius-control); transition: background-color .15s; }
.file-list li:hover { background: var(--chip-bg); }
.file-list .file-open { align-items: flex-start; }
.file-list .file-open::before { margin-top: 3px; }
.file-list .file-open:hover:not(:disabled) { background: transparent; border-color: transparent; }
.file-label { display: grid; min-width: 0; line-height: 1.45; }
.file-name { overflow-wrap: anywhere; }
.file-label small { color: var(--faint); font-size: 12px; font-variant-numeric: tabular-nums; }
.file-badge { margin-left: 8px; color: var(--accent); white-space: nowrap; }
.file-actions { display: flex; gap: 2px; padding-right: 6px; }
.file-actions:empty { display: none; }
.file-actions button { min-height: 26px; padding: 0 8px; gap: 4px; background: transparent; border-color: transparent; color: var(--accent); font-size: 12.5px; }
.file-actions button:hover:not(:disabled) { background: var(--tint); border-color: transparent; }
.file-actions .file-delete { width: 26px; padding: 0; color: var(--faint); }
.file-actions .file-delete:hover:not(:disabled) { background: var(--chip-bg); color: var(--error); }
.file-delete::before { content: ""; width: 14px; height: 14px; background: currentColor; -webkit-mask: var(--icon-trash) center / contain no-repeat; mask: var(--icon-trash) center / contain no-repeat; }
.file-edit::before { content: ""; width: 13px; height: 13px; background: currentColor; -webkit-mask: var(--icon-pencil) center / contain no-repeat; mask: var(--icon-pencil) center / contain no-repeat; }
.file-actions .file-download { width: 26px; padding: 0; }
.file-download::before { content: ""; width: 14px; height: 14px; background: currentColor; -webkit-mask: var(--icon-download) center / contain no-repeat; mask: var(--icon-download) center / contain no-repeat; }
.memory-help { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.7; }

/* Chat */
.chat { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; height: 100%; overflow: hidden; background: var(--surface); }
.chat-head { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px 12px 24px; border-bottom: 1px solid var(--line); }
.chat-head-text { min-width: 0; }
.chat-head h1 { margin: 0; overflow: hidden; font-size: 17px; line-height: 1.4; white-space: nowrap; text-overflow: ellipsis; }
.chat-head p { display: flex; align-items: center; min-width: 0; margin: 2px 0 0; color: var(--muted); font-size: 12.5px; }
.chat-head p > span:last-child { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.kind-chip { flex: none; display: inline-flex; align-items: center; gap: 4px; margin-right: 8px; padding: 0 8px; border-radius: 999px; background: var(--chip-bg); color: var(--muted); font-size: 11.5px; font-weight: 600; }
.kind-chip.agent { background: color-mix(in srgb, var(--action) 16%, var(--surface)); color: var(--ink); }
.kind-chip.team { background: color-mix(in srgb, var(--ok) 16%, var(--surface)); color: var(--ink); }
/* Reading a team member's chat: the bar stands where the composer was. */
.readonly-bar { flex: 0 0 auto; display: flex; align-items: center; gap: 12px; margin: 6px max(20px, calc((100% - 820px) / 2)) 16px; padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--radius-panel); background: var(--bg); }
.readonly-bar p { flex: 1; margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.6; }
.readonly-bar button { flex: none; }
.side-reopen { flex: none; }
.side-reopen::before, .side-close::before { content: ""; width: 18px; height: 18px; background: currentColor; -webkit-mask: var(--icon-panel) center / contain no-repeat; mask: var(--icon-panel) center / contain no-repeat; }

/* Side panel: tabs for the file being shown and the meeting's notes */
.side { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; background: var(--bg); border-left: 1px solid var(--line); }
.side-resizer { position: absolute; top: 0; bottom: 0; left: 0; z-index: 5; width: 7px; cursor: col-resize; touch-action: none; }
.side-resizer::after { content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 2px; background: transparent; transition: background-color .15s; }
.side-resizer:hover::after, .layout.resizing .side-resizer::after, .side-resizer:focus-visible::after { background: var(--accent); }
.side-resizer:focus-visible { outline: none; }
.side-tabs { flex: none; display: flex; gap: 2px; padding: 6px 10px 0 14px; overflow-x: auto; background: var(--surface); border-bottom: 1px solid var(--line); }
.side-tabs [role="tab"] { flex: none; min-height: 40px; margin-bottom: -1px; padding: 0 12px; border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; color: var(--muted); font-size: 13.5px; font-weight: 500; }
.side-tabs [role="tab"]:hover:not(:disabled) { background: transparent; color: var(--ink); }
.side-tabs [role="tab"][aria-selected="true"] { border-bottom-color: var(--accent); color: var(--ink); font-weight: 700; }
.side-close { width: 32px; min-height: 32px; margin: 4px 0 0 auto; }
.side-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: grid; align-content: start; gap: 16px; padding: 18px 20px 28px; }
.session-label { display: grid; min-width: 0; line-height: 1.45; }
.session-label > span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.session-label small { color: var(--faint); font-size: 11.5px; font-weight: 400; }
.session-label small:empty { display: none; }

/* The meeting tab of a meeting chat: the running notes or the minutes, as the facilitator writes them */
.meeting-pane { gap: 10px; }
.meeting-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.meeting-switch { display: inline-flex; gap: 2px; padding: 3px; border-radius: 12px 4px 12px 4px; background: color-mix(in srgb, var(--line) 60%, var(--shelf)); }
.meeting-switch button { min-height: 28px; padding: 0 14px; border: 0; border-radius: 9px 3px 9px 3px; background: transparent; color: var(--muted); font-size: 12.5px; }
.meeting-switch button:hover:not(:disabled) { background: transparent; color: var(--ink); }
.meeting-switch button[aria-pressed="true"] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: var(--raise); }
.meeting-head > button { min-height: var(--control-height-sm); padding: 0 12px; font-size: 12.5px; }
.meeting-name { color: var(--faint); font-size: 12px; overflow-wrap: anywhere; }
.meeting-name:empty { display: none; }
.message.notice.artifact.minutes { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent); }
.meeting-file-list { max-height: 40dvh; overflow-y: auto; }
.meeting-file-list button::before { -webkit-mask-image: var(--icon-file); mask-image: var(--icon-file); }
.meeting-files-empty { padding: 8px; color: var(--faint); font-size: 13px; }
.upload-pick { justify-self: start; display: inline-flex; align-items: center; min-height: var(--control-height); padding: 0 14px; border: 1px dashed var(--accent-line); border-radius: var(--radius-control); color: var(--accent); font-size: 13.5px; font-weight: 600; cursor: pointer; }
.upload-pick:hover { border-color: var(--accent); background: var(--tint); }
.upload-pick:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.upload-pick:has(input:disabled) { opacity: .6; cursor: progress; }
/* The pencil alone says edit; its name is on the label and the tooltip. */
.file-actions .file-edit { width: 26px; padding: 0; }

/* The preview tab: a text file from the workspace, rendered */
.preview-pane { gap: 12px; }
/* The file's name and the close button take the first line; the actions wrap onto the next one. */
.preview-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; min-width: 0; }
.preview-head::after { content: ""; order: 3; flex-basis: 100%; height: 0; }
.preview-head > * { order: 4; }
.preview-head > .file-kind { order: 0; }
.preview-title { order: 1; flex: 1; min-width: 0; display: grid; line-height: 1.45; }
.preview-head > .preview-close { order: 2; }
.preview-title strong { overflow: hidden; font-size: 14px; white-space: nowrap; text-overflow: ellipsis; }
.preview-title small { color: var(--faint); font-size: 12px; }
.preview-head > button:not(.icon-btn) { min-height: var(--control-height-sm); padding: 0 10px; font-size: 12.5px; }
.preview-head .file-edit { width: 30px; padding: 0; border-color: transparent; background: transparent; color: var(--accent); }
.preview-close { width: 30px; min-height: 30px; }
.preview-close::before { content: ""; width: 14px; height: 14px; background: currentColor; -webkit-mask: var(--icon-plus) center / contain no-repeat; mask: var(--icon-plus) center / contain no-repeat; transform: rotate(45deg); }
.preview-body { min-width: 0; padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-panel); font-size: 14px; line-height: 1.8; overflow-wrap: anywhere; }
.preview-markdown > :first-child { margin-top: 0; }
.preview-markdown > :last-child { margin-bottom: 0; }
.preview-markdown :is(h1, h2, h3) { margin: 18px 0 8px; line-height: 1.4; }
.preview-markdown h1 { font-size: 19px; }
.preview-markdown h2 { font-size: 16.5px; }
.preview-markdown h3 { font-size: 15px; }
.preview-markdown :is(p, ul, ol, blockquote) { margin: 0 0 10px; }
.preview-markdown :is(ul, ol) { padding-left: 1.3em; }
.preview-markdown code { font-family: var(--font-mono); font-size: .9em; background: var(--chip-bg); padding: 0 4px; border-radius: 3px; }
.preview-markdown pre { overflow-x: auto; padding: 10px 12px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-control); white-space: pre; font-size: 13px; }
.preview-markdown pre code { background: none; padding: 0; }
.preview-image { display: block; max-width: 100%; height: auto; margin: 0 auto; }
.preview-body:has(.preview-pdf) { padding: 0; overflow: hidden; }
.preview-pdf { display: block; width: 100%; height: max(360px, calc(100dvh - 230px)); border: 0; }
.preview-body .table-scroll { max-width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-control); }
.preview-body table, .preview-markdown table { border-collapse: collapse; min-width: 100%; font-size: 13px; font-variant-numeric: tabular-nums; }
.preview-body th, .preview-body td { padding: 6px 12px; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--line); }
.preview-body th { color: var(--muted); font-weight: 600; background: var(--bg); }
.preview-text { margin: 0; font-family: var(--font-mono); font-size: 13px; line-height: 1.65; white-space: pre-wrap; }
.preview-note { margin: 10px 0 0; color: var(--faint); font-size: 12px; }

/* A chat with nothing in it yet */
.chat-empty { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: grid; place-content: center; justify-items: center; gap: 8px; padding: 24px; text-align: center; }
.chat-empty-idi { position: relative; display: block; width: 56px; height: 56px; }
.chat-empty-idi .idi { position: absolute; left: -7px; top: -14px; width: 70px; height: 74px; }
.chat-empty h2 { margin: 8px 0 0; font-size: 21px; }
.chat-empty p { margin: 0; max-width: 36em; color: var(--muted); font-size: 14px; }
.starters { display: grid; gap: 6px; width: min(100%, 420px); margin-top: 14px; }
.starters button { justify-content: flex-start; min-height: 40px; padding: 8px 14px; border-radius: var(--radius-panel); color: var(--ink); font-weight: 400; text-align: left; white-space: normal; }
.starters button:hover:not(:disabled) { border-color: var(--accent-line); background: var(--tint); }
.new-chat { width: 100%; justify-content: flex-start; margin: 10px 0 14px; border-style: dashed; border-color: var(--accent-line); background: transparent; color: var(--accent); font-weight: 600; }
.new-chat:hover:not(:disabled) { border-color: var(--accent); background: var(--tint); }
#sessions button.meeting::before { -webkit-mask-image: var(--icon-flag); mask-image: var(--icon-flag); }
.new-chat::before { content: ""; width: 15px; height: 15px; background: currentColor; -webkit-mask: var(--icon-plus) center / contain no-repeat; mask: var(--icon-plus) center / contain no-repeat; }
.new-chat.pick-agent::before { -webkit-mask-image: var(--icon-bolt); mask-image: var(--icon-bolt); }
.new-chat.on { border-style: solid; background: var(--surface); }
/* The agents side shows the agents and their runs instead of the workspaces and files.
   While the agents are being chosen, the right side is left out. */
.layout:not(.agents) #agent-section, .layout.agents [data-section="workspaces"], .layout.agents #file-section { display: none; }
.layout.picking :is(.side, .chat-head) { display: none; }
.layout.picking.side-open { grid-template-columns: var(--rail-width) var(--sidebar-width) minmax(0, 1fr); }
.agent-list button { align-items: center; }
.agent-list button::before { width: 18px; height: 18px; background: var(--ws3); -webkit-mask-image: var(--icon-bolt); mask-image: var(--icon-bolt); }
.agent-list .agent-facilitation::before { -webkit-mask-image: var(--icon-flag); mask-image: var(--icon-flag); }
.agent-list button[aria-current="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--raise); }
/* The agents to choose from, shown in the chat's place while no agent run is open */
.agent-gallery { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 32px max(20px, calc((100% - 820px) / 2)) 24px; }
.agent-gallery h2 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 21px; }
.agent-gallery h2::before { content: ""; width: 20px; height: 20px; background: currentColor; -webkit-mask: var(--icon-bolt) center / contain no-repeat; mask: var(--icon-bolt) center / contain no-repeat; }
.agent-gallery-text { margin: 6px 0 14px; color: var(--muted); font-size: 14px; }
.agent-workspace { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-bottom: 18px; font-size: 13px; }
.agent-workspace label { color: var(--muted); }
.agent-workspace select { width: auto; min-width: min(260px, 100%); max-width: 100%; }
.mode-compare { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.mode-compare > div { padding: 12px 14px; border: 1px dashed var(--line-strong); border-radius: var(--radius-panel); }
.mode-compare b { display: inline-flex; align-items: center; gap: 6px; }
.mode-compare b::before { content: ""; width: 14px; height: 14px; background: currentColor; -webkit-mask: var(--icon-home) center / contain no-repeat; mask: var(--icon-home) center / contain no-repeat; }
.mode-compare .mc-agent b::before { -webkit-mask-image: var(--icon-bolt); mask-image: var(--icon-bolt); }
.mode-compare p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.agent-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); gap: 14px; margin: 0; padding: 0; list-style: none; }
.agent-card { display: flex; flex-direction: column; gap: 8px; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius-panel); background: var(--surface); box-shadow: var(--raise); }
.agent-card h3 { margin: 4px 0 0; font-size: 16.5px; }
.agent-card p { flex: 1; margin: 0; color: var(--muted); font-size: 13px; }
.agent-card > button { align-self: flex-start; margin-top: 4px; }
.agent-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px 3px 9px 3px; background: color-mix(in srgb, var(--ws3) 16%, var(--surface)); color: var(--ws3); }
.agent-icon::before { content: ""; width: 20px; height: 20px; background: currentColor; -webkit-mask: var(--icon-bolt) center / contain no-repeat; mask: var(--icon-bolt) center / contain no-repeat; }
.agent-facilitation .agent-icon::before { -webkit-mask-image: var(--icon-flag); mask-image: var(--icon-flag); }
.tool-chips { display: flex; flex-wrap: wrap; gap: 4px; margin: 0; padding: 0; list-style: none; }
.tool-chips li { padding: 0 8px; border-radius: 999px; background: var(--chip-bg); color: var(--muted); font-size: 11.5px; }
.messages { flex: 1 1 auto; min-height: 0; padding: 28px max(20px, calc((100% - 820px) / 2)) 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 24px; }
.message-row { display: flex; align-items: flex-start; gap: 12px; min-width: 0; }
.message-row.user { align-self: flex-end; max-width: min(85%, 640px); }
.message-row.assistant { align-self: stretch; }
.message-avatar { display: grid; place-items: center; flex: 0 0 28px; width: 28px; height: 28px; border-radius: 8px; }
.message-avatar svg { width: 17px; height: 17px; }
.message-avatar.user { display: none; }
.message-avatar.assistant { position: relative; background: var(--tint); }
.message-avatar.assistant .idi { position: absolute; left: -1px; top: -5px; width: 32px; height: 34px; }
.message-avatar .idi > svg { width: 100%; height: 100%; }
.thinking-text { color: var(--muted); }
.message { min-width: 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.8; }
.message.user { padding: 10px 16px; background: var(--tint); border-radius: var(--radius-panel); }
.message.assistant { flex: 1 1 auto; white-space: normal; }
.message-speaker { font-size: 12px; font-weight: 500; color: var(--muted); margin-bottom: 2px; line-height: 1.5; }
.message-time { margin-left: 6px; font-weight: 400; color: var(--faint); font-variant-numeric: tabular-nums; }
.message.user .message-speaker { text-align: right; }
/* A request sent while the chat was still connecting, waiting to go out. */
.message-row.queued .message { opacity: .7; }
.message-row.queued .message-speaker::after { content: "・準備ができたら送ります"; margin-left: 6px; color: var(--accent); }
.message.assistant .message-content > :first-child { margin-top: 0; }
.message.assistant .message-content > :last-child { margin-bottom: 0; }
.message.assistant p, .message.assistant ul, .message.assistant ol, .message.assistant blockquote { margin: 0 0 12px; }
.message.assistant ul, .message.assistant ol { padding-left: 1.3em; }
.message.assistant li + li { margin-top: 4px; }
.message.assistant li::marker { color: var(--faint); }
.message.assistant h1, .message.assistant h2, .message.assistant h3 { line-height: 1.4; margin: 22px 0 8px; }
.message.assistant h1 { font-size: 21px; }
.message.assistant h2 { font-size: 18px; }
.message.assistant h3 { font-size: 16px; }
.message.assistant strong { font-weight: 600; }
.message.assistant a { color: var(--accent); text-underline-offset: 3px; }
.message.assistant code { font-family: var(--font-mono); font-size: .9em; background: var(--chip-bg); padding: 0 4px; border-radius: 3px; }
.message.assistant pre { max-width: 100%; overflow-x: auto; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-control); padding: 12px 14px; white-space: pre; line-height: 1.6; font-size: 13px; }
.message.assistant pre code { background: none; padding: 0; }
.message.assistant blockquote { border-left: 3px solid var(--line-strong); padding-left: 12px; color: var(--muted); }
.message.assistant hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
.message.assistant .table-scroll { max-width: 100%; overflow-x: auto; margin: 14px 0; border: 1px solid var(--line); border-radius: var(--radius-panel); }
.message.assistant table { border-collapse: collapse; min-width: 100%; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.message.assistant th, .message.assistant td { padding: 8px 14px; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--line); }
.message.assistant tr:last-child td { border-bottom: 0; }
.message.assistant th { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.message.notice {
  align-self: center; max-width: min(90%, 560px); padding: 2px 12px; border-radius: 999px;
  background: var(--chip-bg); color: var(--muted); font-size: 12.5px; line-height: 1.6; text-align: center;
}
/* An output saved in this turn: what it is, then preview, open or propose it as the original. */
.message.notice.artifact {
  align-self: flex-start; display: grid; gap: 10px; width: min(100%, 560px); max-width: 100%; margin-left: 40px;
  padding: 12px 14px; border-radius: var(--radius-panel); background: var(--surface); border: 1px solid var(--line);
  color: var(--ink); font-size: 13.5px; text-align: left;
}
.artifact-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.artifact-label { display: grid; min-width: 0; line-height: 1.45; }
.artifact-label strong { font-weight: 600; overflow-wrap: anywhere; }
.artifact-label small { color: var(--faint); font-size: 12px; }
.artifact-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.artifact-actions button { min-height: var(--control-height-sm); padding: 0 12px; font-size: 12.5px; }
.file-kind {
  flex: none; display: grid; place-items: center; min-width: 38px; height: 38px; padding: 0 4px; border-radius: 6px 2px 6px 2px;
  background: var(--tint); color: var(--accent); font-family: var(--font-mono); font-size: 10.5px; font-weight: 700; letter-spacing: .02em;
}

/* Proposals and approvals: what changes where and why, the colored diff, details folded away */
.promotion-form { display: grid; gap: 8px; margin-top: 4px; padding: 14px; background: var(--bg); border-radius: var(--radius-control); }
.promotion-form button { justify-self: start; margin-top: 4px; }
.promotion-card {
  display: grid; gap: 10px; min-width: 0; margin-top: 4px; padding: 16px 18px;
  background: var(--surface); border: 1px solid var(--accent); border-radius: var(--radius-panel); line-height: 1.6;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}
.messages > .promotion-card { margin-left: 40px; }
.approval-kind { justify-self: start; display: inline-flex; align-items: center; gap: 6px; color: var(--accent); font-size: 12px; font-weight: 700; }
.approval-kind::before { content: ""; width: 14px; height: 14px; background: currentColor; -webkit-mask: var(--icon-pencil) center / contain no-repeat; mask: var(--icon-pencil) center / contain no-repeat; }
.approval-title { font-family: var(--font-display); font-size: 17px; font-weight: 700; line-height: 1.45; overflow-wrap: anywhere; }
.approval-reason { margin: 0; color: var(--muted); font-size: 13.5px; white-space: pre-wrap; overflow-wrap: anywhere; }
.approval-target { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 2px 14px; margin: 0; font-size: 12.5px; }
.approval-target dt { color: var(--faint); }
.approval-target dd { margin: 0; overflow-wrap: anywhere; }
.approval-label { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.promotion-diff, .promotion-comparison pre {
  max-height: 340px; overflow: auto; margin: 0; padding: 8px 0; background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--radius-control); font-family: var(--font-mono); font-size: 12.5px; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere;
}
.promotion-comparison pre { padding: 8px 12px; }
.promotion-diff span { display: block; padding: 0 12px; }
.promotion-diff .add { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.promotion-diff .del { background: color-mix(in srgb, var(--error) 12%, transparent); color: var(--error); }
.promotion-diff .same { color: var(--muted); }
.approval-details { font-size: 12.5px; }
.approval-details summary { color: var(--accent); cursor: pointer; }
.approval-details[open] { display: grid; gap: 8px; }
.approval-meta { margin: 6px 0 0; color: var(--faint); font-family: var(--font-mono); font-size: 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.promotion-comparison { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.promotion-comparison section { display: grid; align-content: start; gap: 4px; min-width: 0; }
.promotion-comparison strong { font-size: 12.5px; font-weight: 500; color: var(--muted); }
.approval-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.promotion-card p.promotion-file { margin: 0; font-size: 13px; color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere; }
.promotion-file-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* Composer */
.composer { flex: 0 0 auto; padding: 6px max(20px, calc((100% - 820px) / 2)) 16px; background: var(--surface); }
.composer-row {
  display: flex; align-items: flex-end; gap: 6px; padding: 6px;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 12px; transition: border-color .15s, box-shadow .15s;
}
.composer-row:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--tint); }
/* The message box starts one line tall and grows with its text (app.js sets the height) up to eleven lines,
   or under half of a short screen, then scrolls. */
.composer-row textarea {
  flex: 1 1 0; width: auto; min-width: 0; min-height: 0; max-height: min(calc(11 * 1.7em + 12px), 45dvh); padding: 6px 2px;
  border: 0; background: transparent; resize: none; box-shadow: none; font-size: 15px; line-height: 1.7; overflow-y: auto;
}
.composer-row textarea:focus { box-shadow: none; }
.composer-row button { flex: 0 0 auto; min-height: 34px; padding: 0 14px; white-space: nowrap; }
.composer-row button::before { content: ""; width: 15px; height: 15px; background: currentColor; -webkit-mask: var(--icon-send) center / contain no-repeat; mask: var(--icon-send) center / contain no-repeat; }
.attach-button {
  display: inline-grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: var(--radius-control);
  color: var(--muted); cursor: pointer; transition: background-color .15s, color .15s;
}
.attach-button::before { content: ""; width: 18px; height: 18px; background: currentColor; -webkit-mask: var(--icon-plus) center / contain no-repeat; mask: var(--icon-plus) center / contain no-repeat; }
.attach-button:hover { background: var(--chip-bg); color: var(--ink); }
.drop-overlay { position: fixed; inset: 12px; z-index: 50; display: grid; place-items: center; border: 2px dashed var(--accent); border-radius: var(--radius-panel); background: var(--drop); color: var(--accent); font: 700 18px/1.5 var(--font-display); pointer-events: none; }
#image-attach:focus-visible + .attach-button { outline: 2px solid var(--accent); outline-offset: 2px; }
#image-attach:disabled + .attach-button { opacity: .45; cursor: not-allowed; background: transparent; color: var(--muted); }
.composer-status { display: flex; align-items: center; gap: 10px; min-height: 26px; margin-top: 4px; padding: 0 4px; font-size: 12px; color: var(--faint); }
.model-pick { flex: none; width: auto; min-height: 24px; padding: 0 26px 0 8px; border-color: transparent; background-color: transparent; background-position: right 6px center; background-size: 14px; color: var(--muted); font-size: 12px; font-weight: 600; }
.model-pick:hover, .model-pick:focus-visible { border-color: var(--line); background-color: var(--surface); }
/* What the AI used and did for a reply, above its text */
.message.assistant :is(.steps, .memories-used) { margin-bottom: 10px; border: 1px solid var(--line); border-radius: var(--radius-control); background: var(--bg); font-size: 13px; }
.message.assistant :is(.steps, .memories-used) > summary { padding: 6px 12px; color: var(--muted); cursor: pointer; }
.message.assistant :is(.steps, .memories-used) :is(ol, ul) { display: grid; gap: 2px; margin: 0; padding: 6px 12px 10px 30px; border-top: 1px solid var(--line); }
.memories-used li { color: var(--ink); }
.step { overflow-wrap: anywhere; }
.step.running { color: var(--accent); }
.step.failed { color: var(--error); }
.step::marker { color: var(--faint); }
.message-model { padding: 0 6px; border-radius: 999px; background: var(--chip-bg); color: var(--muted); font-size: 11px; font-weight: 500; }
.check-row { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.check-row input { width: 16px; height: 16px; margin: 0; }
.composer-status #chat-subtitle { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.composer-status #image-status { color: var(--muted); }
.composer-status #status { min-width: 0; overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.composer-status #status[data-state="error"] { color: var(--error); }
.welcome-card .welcome-status { margin: 0; color: var(--error); font-size: 14px; }
.welcome-card .welcome-status:empty { display: none; }
.composer-status #reconnect { min-height: var(--control-height-sm); margin-left: auto; padding: 0 10px; font-size: 12px; border-color: var(--accent-line); color: var(--accent); }

/* Search dialog */
.search-dialog { width: min(640px, calc(100vw - 32px)); max-height: min(560px, calc(100dvh - 96px)); margin: 72px auto auto; padding: 0; border: 1px solid var(--line); border-radius: var(--radius-panel); background: var(--surface); color: var(--ink); box-shadow: 0 16px 48px rgb(12 18 38 / 28%); }
.search-dialog[open] { display: flex; flex-direction: column; }
.search-dialog::backdrop { background: rgb(12 18 38 / 45%); }
.search-input-row { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.search-input-row::before { content: ""; flex: none; width: 17px; height: 17px; background: var(--muted); -webkit-mask: var(--icon-search) center / contain no-repeat; mask: var(--icon-search) center / contain no-repeat; }
.search-input-row input { flex: 1; min-height: 34px; padding: 0; border: 0; background: transparent; font-size: 15.5px; box-shadow: none; }
.search-input-row input:focus { box-shadow: none; }
.search-input-row kbd, .search-trigger kbd { white-space: nowrap; }
.search-input-row kbd { padding: 0 6px; border: 1px solid var(--line); border-radius: 4px; color: var(--faint); font-family: var(--font-mono); font-size: 11px; }
.search-status { margin: 0; padding: 8px 18px 0; color: var(--faint); font-size: 12.5px; }
.search-results { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 4px 8px 8px; }
.search-results section + section { margin-top: 6px; }
.search-results h3 { margin: 8px 10px 4px; font-family: var(--font-body); font-size: 12px; font-weight: 500; color: var(--faint); }
.search-result { width: 100%; min-height: 0; justify-content: flex-start; gap: 10px; padding: 7px 10px; border-color: transparent; background: transparent; text-align: left; font-weight: 400; }
.search-result:hover:not(:disabled), .search-result:focus-visible { background: var(--tint); border-color: transparent; outline: none; }
.search-result-text { flex: 1; min-width: 0; display: grid; line-height: 1.45; }
.search-result-text > span { overflow: hidden; font-size: 14px; white-space: nowrap; text-overflow: ellipsis; }
.search-result-text small { color: var(--faint); font-size: 12px; }
.search-result mark { background: color-mix(in srgb, var(--action) 22%, transparent); color: inherit; border-radius: 2px; }
.search-icon { flex: none; width: 16px; height: 16px; background: var(--faint); -webkit-mask: var(--icon-file) center / contain no-repeat; mask: var(--icon-file) center / contain no-repeat; }
.search-icon.chat { -webkit-mask-image: var(--icon-chat); mask-image: var(--icon-chat); }
.search-result .floe { width: 20px; height: 20px; }
.search-more { margin: 2px 10px 0; color: var(--faint); font-size: 12px; }
.search-note { margin: 0; padding: 8px 18px 10px; border-top: 1px solid var(--line); color: var(--faint); font-size: 12px; }
.conversation-more { margin: 4px 10px 0; min-height: var(--control-height-sm); padding: 0 12px; font-size: 12.5px; }

/* Workspace settings dialog */
.settings-dialog { width: min(560px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); padding: 0; border: 1px solid var(--line); border-radius: var(--radius-panel); background: var(--surface); color: var(--ink); box-shadow: 0 16px 48px rgb(12 18 38 / 28%); }
.settings-dialog::backdrop { background: rgb(12 18 38 / 45%); }
.settings-form { display: grid; gap: 18px; padding: 22px 24px 20px; }
.settings-form h2 { margin: 0; font-size: 19px; line-height: 1.4; }
.settings-part { display: grid; gap: 6px; padding-top: 14px; border-top: 1px solid var(--line); }
.settings-part h3 { margin: 0; font-size: 14.5px; }
.settings-part > button { justify-self: start; }
.settings-row { display: flex; gap: 8px; }
.settings-row input { flex: 1; min-width: 0; }
.settings-note { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.7; }
.settings-note:empty { display: none; }
.settings-footer { display: flex; justify-content: flex-end; gap: 8px; }
.settings-field { display: grid; gap: 6px; }
.kind-pick { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 0; padding: 0; border: 0; }
.kind-pick legend { grid-column: 1 / -1; margin-bottom: 6px; padding: 0; font-size: 14px; }
.kind-option { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-control); cursor: pointer; }
.kind-option:has(input:checked) { border-color: var(--accent); background: var(--tint); }
.kind-option:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.kind-option input { position: absolute; opacity: 0; pointer-events: none; }
.kind-option > span:last-child { display: grid; line-height: 1.45; }
.kind-option small { color: var(--muted); font-size: 12px; }
.member-list { display: grid; margin: 0; padding: 0; list-style: none; }
.member-list li { display: flex; align-items: center; gap: 8px; min-height: 38px; border-top: 1px solid var(--line); font-size: 13.5px; }
.member-list li:first-child { border-top: 0; }
.member-list li > span { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.member-list small { color: var(--muted); font-size: 12px; }
.member-list button { min-height: 28px; padding: 0 10px; font-size: 12.5px; }

/* Text editor dialog */
.editor-dialog { width: min(720px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); padding: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); }
.editor-dialog::backdrop { background: rgb(17 22 27 / 45%); }
.editor-dialog form { display: flex; flex-direction: column; gap: 12px; padding: 22px 24px 20px; max-height: calc(100dvh - 50px); }
.editor-dialog h2 { margin: 0; font-size: 19px; line-height: 1.4; }
.editor-help { margin: 0; color: var(--muted); font-size: 13.5px; }
.editor-example { font-size: 13px; color: var(--muted); }
.editor-example summary { cursor: pointer; color: var(--accent); font-weight: 500; }
.editor-example pre { margin: 8px 0 0; padding: 10px 12px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-control); font-family: var(--font-body); font-size: 13px; line-height: 1.7; white-space: pre-wrap; color: var(--ink); }
.editor-dialog textarea { flex: 1 1 auto; min-height: 220px; height: 45dvh; font-size: 14px; line-height: 1.8; resize: none; }
.editor-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; }
.editor-footer p { margin: 0; color: var(--faint); font-size: 12.5px; }
.editor-footer div { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }

@media (max-width: 1100px) {
  .layout.side-open { grid-template-columns: var(--rail-width) var(--sidebar-width) minmax(0, 1fr); }
  .page-grid { grid-template-columns: minmax(0, 1fr); }
  .side { position: absolute; top: 0; right: 0; bottom: 0; z-index: 20; width: min(480px, 100%); box-shadow: 0 16px 48px rgb(12 18 38 / 28%); }
  .side-resizer { display: none; }
}
@media (max-width: 1100px) {
  .mode-label { display: none; }
  .mode-switch button { gap: 0; padding: 0 9px; }
}
@media (max-width: 900px) {
  .search-label, .search-trigger kbd { display: none; }
  .search-zone { justify-content: flex-end; }
  .search-trigger { flex: none; width: 36px; padding: 0; justify-content: center; border-color: transparent; background: transparent; }
}
@media (max-width: 750px) {
  .kind-pick { grid-template-columns: minmax(0, 1fr); }
  .readonly-bar { flex-wrap: wrap; }
  .layout, .layout.side-open, .layout.picking.side-open { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 38dvh) minmax(0, 1fr); }
  .layout.page-view, .layout.page-view.side-open { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .rail { flex-direction: row; justify-content: center; gap: 4px; padding: 4px 8px; overflow: visible; }
  .rail button { flex-direction: row; width: auto; gap: 6px; padding: 6px 12px; }
  .rail button br { display: none; }
  .rail button.rail-main { margin: 0; }
  .rail button.rail-main + button { margin: 0; }
  .rail button.rail-main + button::before { display: none; }
  .rail { flex-wrap: wrap; }
  .rail-admin { display: flex; gap: 4px; margin: 0; padding: 0; border: 0; }
  .rail-label { display: none; }
  .log-list li { grid-template-columns: 40px minmax(0, 1fr) auto; }
  .log-who { display: none; }
  .page-screen, .layout:not(.page-view) .sidebar { border-top-left-radius: 0; }
  .page-screen { padding: 20px 16px 32px; }
  .sidebar-resizer { display: none; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); }
  .topbar { padding: 8px 16px; }
  .brand strong { font-size: 15px; }
  .messages { padding: 20px 16px 12px; }
  .message-row.user { max-width: 92%; }
  .message.notice.artifact, .messages > .promotion-card { margin-left: 0; }
  .promotion-comparison { grid-template-columns: 1fr; }
  .composer { padding: 4px 12px 12px; }
  .agent-gallery { padding: 20px 16px; }
  .mode-compare { grid-template-columns: 1fr; }
}
@media (max-width: 420px) {
  .brand strong { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before { transition: none !important; animation: none !important; }
}
