/* ============================================================================
 * Skye  ·  AI Studio Live–inspired, dark by default.
 * Calm near-black surfaces, soft borders, one restrained blue accent.
 * ========================================================================== */
:root {
  --font-ui: "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-display: "Inter", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
}

/* ---- DARK (default) — very dark grey, near-black (NOT pure black) ---------- */
:root, [data-theme="dark"] {
  --bg:        #1a1a1c;
  --bg-grad:   #1a1a1c;
  --surface:   #1f1f22;
  --surface-2: #242427;
  --raise:     #2a2a2e;
  --line:      rgba(255,255,255,.09);
  --line-soft: rgba(255,255,255,.055);
  --txt:       #ececed;
  --txt-dim:   #a6a7ab;
  --txt-faint: #6f7075;
  --accent:    #8ba4d8;
  --accent-ink:#16161a;
  --accent-soft: rgba(139,164,216,.15);
  --good:      #6fc89c;
  --warn:      #d9b06a;
  --bad:       #e08585;
  --ext:       #bd9be0;
  --shadow:    0 1px 0 rgba(255,255,255,.02), 0 20px 60px -24px rgba(0,0,0,.75);
  --ring:      0 0 0 3px var(--accent-soft);
}

/* ---- LIGHT ---------------------------------------------------------------- */
[data-theme="light"] {
  --bg:        #f7f7f5;
  --bg-grad:   #f7f7f5;
  --surface:   #ffffff;
  --surface-2: #f4f4f2;
  --raise:     #ffffff;
  --line:      rgba(0,0,0,.1);
  --line-soft: rgba(0,0,0,.06);
  --txt:       #1c1d20;
  --txt-dim:   #5c5e66;
  --txt-faint: #93959d;
  --accent:    #3f5fb8;
  --accent-ink:#ffffff;
  --accent-soft: rgba(63,95,184,.12);
  --good:      #1f9d6b;
  --warn:      #b07a1f;
  --bad:       #c0473f;
  --ext:       #7a4fbf;
  --shadow:    0 1px 2px rgba(0,0,0,.04), 0 22px 48px -24px rgba(20,22,30,.22);
  --ring:      0 0 0 3px var(--accent-soft);
}

* { box-sizing: border-box; }
html { font-size: 14.5px; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 1rem;
  background: var(--bg);
  color: var(--txt);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  letter-spacing: -.005em;
}
::selection { background: var(--accent-soft); }
button { font-family: inherit; cursor: pointer; }
svg { width: 18px; height: 18px; display: block; }
kbd {
  font-family: var(--font-mono); font-size: 11px; padding: 1px 5px;
  border: 1px solid var(--line); border-radius: 5px; background: var(--surface-2);
  color: var(--txt-dim);
}
.muted { color: var(--txt-dim); font-size: 13px; }
.hidden { display: none !important; }

/* Visible focus rings for keyboard users (accessibility) */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button:focus-visible, [role="option"]:focus-visible, [role="tab"]:focus-visible,
[role="searchbox"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.select:focus-visible, .input:focus-visible { outline: none; }

/* ============================================================================
 * App shell — left icon sidebar + main column
 * ========================================================================== */
.app {
  height: 100dvh;
  display: grid;
  grid-template-columns: 56px 1fr;
  background: var(--bg-grad);
}
.app.sidebar-expanded { grid-template-columns: 232px 1fr; }

/* ---- Left icon sidebar ---------------------------------------------------- */
.sidebar {
  display: flex; flex-direction: column; gap: 4px;
  padding: 10px 8px;
  border-right: 1px solid var(--line-soft);
  background: var(--bg);
  overflow: hidden;
}
.sb-top { display: flex; flex-direction: column; gap: 4px; }
.sb-nav { display: flex; flex-direction: column; gap: 2px; margin-top: 14px; }
.sb-bottom { margin-top: auto; display: flex; flex-direction: column; gap: 2px; padding-top: 8px; border-top: 1px solid var(--line-soft); }
.sb-btn {
  display: flex; align-items: center; gap: 11px;
  height: 38px; padding: 0; width: 100%;
  border: 1px solid transparent; border-radius: 9px;
  background: transparent; color: var(--txt-dim);
  font-size: 13.5px; font-weight: 500; white-space: nowrap; overflow: hidden;
  transition: background .14s, color .14s, border-color .14s;
}
.sb-btn > svg { flex: none; width: 19px; height: 19px; margin: 0 9.5px; }
.sb-btn .sb-label { opacity: 0; transition: opacity .14s; pointer-events: none; }
.app.sidebar-expanded .sb-btn .sb-label { opacity: 1; pointer-events: auto; }
.sb-btn:hover { background: var(--surface-2); color: var(--txt); }
.sb-btn.active, .sb-btn[aria-selected="true"] { background: var(--accent-soft); color: var(--accent); }
.sb-new { color: var(--txt); }
.sb-new:hover { border-color: var(--line); }
.sb-collapse { color: var(--txt-faint); }
.sb-user { margin-top: 2px; }
.sb-avatar {
  flex: none; width: 22px; height: 22px; margin: 0 8px; border-radius: 7px;
  display: grid; place-items: center; font-size: 11px; font-weight: 700;
  background: var(--accent-soft); color: var(--accent);
}

/* ---- Main column ---------------------------------------------------------- */
.main {
  min-width: 0;
  /* Fill the app's viewport-height row exactly and bind the middle (workspace)
     track so its children scroll internally instead of overflowing the page. */
  height: 100%; min-height: 0;
  display: grid;
  grid-template-rows: 52px minmax(0, 1fr) auto;
}

/* ---- Topbar --------------------------------------------------------------- */
.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line-soft);
}
.brand { display: flex; align-items: center; gap: 9px; }
.logo {
  width: 20px; height: 20px; border-radius: 6px;
  background:
    radial-gradient(circle at 50% 50%, var(--accent) 0 22%, transparent 23%),
    radial-gradient(circle at 50% 50%, transparent 0 38%, var(--accent) 39% 48%, transparent 49%);
  background-color: var(--surface-2);
  border: 1px solid var(--line);
}
.bname { font-weight: 600; font-size: 14.5px; letter-spacing: -.01em; }
.bname .thin { color: var(--txt-faint); font-weight: 400; }
.spacer { flex: 1; }

.conn {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; color: var(--txt-dim);
  padding: 5px 10px; border-radius: 999px;
  border: 1px solid var(--line-soft); background: var(--surface);
}
.conn .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--txt-faint); }
.conn[data-state="connecting"] .dot { background: var(--warn); animation: pulse 1s infinite; }
.conn[data-state="ready"] .dot, .conn[data-state="live"] .dot { background: var(--good); box-shadow: 0 0 0 3px rgba(95,208,160,.18); }
.conn[data-state="error"] .dot { background: var(--bad); }
@keyframes pulse { 50% { opacity: .35; } }

.ghost-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 11px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--surface);
  color: var(--txt-dim); font-size: 13px; font-weight: 500;
  transition: border-color .15s, color .15s, background .15s;
}
.ghost-btn:hover { color: var(--txt); border-color: var(--accent); }
.ghost-btn svg { width: 15px; height: 15px; }
.chip-count {
  font-family: var(--font-mono); font-size: 11px;
  min-width: 18px; text-align: center; padding: 1px 5px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
}
.icon-btn {
  width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center;
  border: 1px solid var(--line-soft); background: var(--surface); color: var(--txt-dim);
  transition: color .15s, border-color .15s;
}
.icon-btn:hover { color: var(--txt); border-color: var(--line); }
.icon-btn svg { width: 17px; height: 17px; }

/* ============================================================================
 * Stage
 * ========================================================================== */
.stage {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; align-items: center;
}

/* ---- Hero ----------------------------------------------------------------- */
.hero {
  margin: auto; max-width: 620px; text-align: center;
  padding: 32px 24px; opacity: 0;
  animation: rise .7s cubic-bezier(.2,.7,.2,1) .05s forwards;
}
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.hero-orb {
  width: 92px; height: 92px; margin: 0 auto 26px; position: relative;
}
.hero-orb span {
  position: absolute; inset: 0; border-radius: 50%;
  border: 1px solid var(--line);
}
.hero-orb span:nth-child(1) { background: radial-gradient(circle at 38% 34%, var(--accent) 0%, transparent 60%); opacity: .5; filter: blur(6px); animation: float 6s ease-in-out infinite; }
.hero-orb span:nth-child(2) { inset: 16px; border-color: var(--accent); opacity: .35; animation: float 7s ease-in-out infinite reverse; }
.hero-orb span:nth-child(3) { inset: 34px; background: var(--accent); opacity: .85; box-shadow: 0 0 30px -4px var(--accent); animation: pulse 3s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-7px); } }

.hero-title {
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(34px, 5vw, 52px); line-height: 1.04;
  letter-spacing: -.015em; margin: 0 0 12px; color: var(--txt);
}
.hero-sub { color: var(--txt-dim); font-size: 15.5px; line-height: 1.55; margin: 0 auto 28px; max-width: 460px; }

.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.pill {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 11px 22px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface);
  color: var(--txt); font-size: 14.5px; font-weight: 500;
  transition: transform .12s, border-color .15s, background .15s, box-shadow .15s;
}
.pill svg { width: 18px; height: 18px; }
.pill:hover:not(:disabled) { border-color: var(--accent); transform: translateY(-1px); box-shadow: var(--ring); }
.pill:active:not(:disabled) { transform: translateY(0); }
.pill:disabled { opacity: .4; cursor: not-allowed; }
.pill.live-on { border-color: var(--accent); color: var(--accent); }
.pill.stop { border-color: var(--bad); color: var(--bad); }

.hero-ctx { margin-top: 26px; font-size: 13px; color: var(--txt-faint); min-height: 20px; }
.hero-ctx b { color: var(--accent); font-weight: 600; }

/* ---- Voice visualiser ----------------------------------------------------- */
.voice-stage {
  display: none; margin: auto; flex-direction: column; align-items: center; gap: 22px;
}
.voice-stage.show { display: flex; }
.halo {
  width: 200px; height: 200px; border-radius: 50%;
  display: grid; place-items: center; position: relative;
  background: radial-gradient(circle, var(--accent-soft) 0%, transparent 68%);
}
.halo::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  border: 1px solid var(--accent); opacity: .4;
  animation: ring 2.4s ease-out infinite;
}
@keyframes ring { 0% { transform: scale(.7); opacity: .5; } 100% { transform: scale(1.25); opacity: 0; } }
.equalizer { display: flex; align-items: center; gap: 5px; height: 60px; }
.equalizer i {
  width: 6px; height: 8px; border-radius: 4px; background: var(--accent);
  transition: height .08s linear;
}
.voice-label { font-size: 14px; color: var(--txt-dim); text-transform: capitalize; }

/* ---- Messages / transcript ------------------------------------------------ */
.messages {
  width: 100%; max-width: 760px; flex: 1; overflow-y: auto;
  padding: 26px 22px 8px; display: none; flex-direction: column; gap: 22px;
}
.messages.show { display: flex; }
.msg { display: flex; gap: 14px; animation: rise .35s ease both; }
.av {
  flex: none; width: 28px; height: 28px; border-radius: 8px;
  display: grid; place-items: center; font-size: 12px; font-weight: 600;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--txt-dim);
}
.msg.assistant .av { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.msg .body { flex: 1; min-width: 0; }
.answer-kind {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: var(--txt-faint); margin-bottom: 8px;
}
.answer-kind .swatch { width: 8px; height: 8px; border-radius: 3px; background: var(--good); }
.answer-kind.external .swatch { background: var(--ext); }
.answer-kind.external { color: var(--ext); }
.bubble { font-size: 15px; line-height: 1.6; color: var(--txt); }
.bubble p { margin: 0 0 10px; }
.bubble p:last-child { margin: 0; }
.bubble code { font-family: var(--font-mono); font-size: 13px; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }
.msg.user .bubble { color: var(--txt); }

.typing { display: inline-flex; gap: 4px; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--txt-faint); animation: blink 1.2s infinite; }
.typing i:nth-child(2){animation-delay:.2s} .typing i:nth-child(3){animation-delay:.4s}
@keyframes blink { 0%,60%,100%{opacity:.25} 30%{opacity:1} }

.tool-activity { display: flex; flex-direction: column; gap: 5px; margin-bottom: 8px; }
.tool-call {
  display: inline-flex; align-items: center; gap: 8px; align-self: flex-start;
  font-family: var(--font-mono); font-size: 12px; color: var(--txt-dim);
  padding: 4px 9px; border-radius: 7px; border: 1px solid var(--line-soft); background: var(--surface);
}
.tool-call.done { color: var(--good); }
.spinner { width: 12px; height: 12px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; }
.tool-call.done .spinner { border: none; animation: none; width: 14px; height: 14px; }
.tool-call.done .spinner svg { width: 14px; height: 14px; color: var(--good); }
@keyframes spin { to { transform: rotate(360deg); } }

.citations { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.cite {
  display: inline-flex; align-items: center; gap: 7px; max-width: 320px;
  padding: 5px 10px; border-radius: 8px; font-size: 12px; text-decoration: none;
  border: 1px solid var(--line); background: var(--surface); color: var(--txt-dim);
  transition: border-color .15s, color .15s;
}
.cite:hover { border-color: var(--accent); color: var(--txt); }
.cite.ext { border-style: dashed; }
.cite .num { font-family: var(--font-mono); color: var(--accent); font-weight: 600; }
.cite.ext .num { color: var(--ext); }
.cite .ci { width: 13px; height: 13px; flex: none; }
.cite .ct { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ============================================================================
 * Prompt bar
 * ========================================================================== */
.promptbar-wrap {
  padding: 0 18px 18px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.promptbar {
  width: 100%; max-width: 820px;
  display: flex; align-items: flex-end; gap: 8px;
  padding: 8px 8px 8px 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  transition: border-color .15s, box-shadow .15s;
}
.promptbar:focus-within { border-color: var(--accent); box-shadow: var(--ring), var(--shadow); }
.pb-left, .pb-right { display: flex; align-items: center; gap: 4px; }
.pb-icon {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  border: 1px solid transparent; background: transparent; color: var(--txt-dim);
  transition: color .15s, background .15s, border-color .15s;
}
.pb-icon:hover:not(:disabled) { color: var(--txt); background: var(--surface-2); }
.pb-icon svg { width: 19px; height: 19px; }
.pb-icon:disabled { opacity: .35; cursor: not-allowed; }
.pb-icon.live-on { color: var(--accent); background: var(--accent-soft); }

#prompt {
  flex: 1; resize: none; border: none; outline: none; background: transparent;
  color: var(--txt); font-family: var(--font-ui); font-size: 15px; line-height: 1.5;
  padding: 8px 4px; max-height: 180px; min-height: 36px;
}
#prompt::placeholder { color: var(--txt-faint); }

.run-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 0 16px; height: 36px; border-radius: 10px; border: none;
  background: var(--accent); color: var(--accent-ink);
  font-size: 14px; font-weight: 600;
  transition: filter .15s, opacity .15s;
}
.run-btn svg { width: 15px; height: 15px; }
.run-btn kbd { background: rgba(0,0,0,.18); border: none; color: inherit; opacity: .8; }
[data-theme="light"] .run-btn kbd { background: rgba(255,255,255,.22); }
.run-btn:hover:not(:disabled) { filter: brightness(1.08); }
.run-btn:disabled { opacity: .45; cursor: not-allowed; }

.pb-foot {
  width: 100%; max-width: 820px;
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--txt-faint); padding: 0 6px;
}
.pb-foot .grow { flex: 1; }
.pb-foot .dotsep { opacity: .5; }
#ctxFoot { color: var(--txt-dim); }
#ctxFoot.on { color: var(--accent); }

/* ============================================================================
 * Sheets (right-slide popovers) — context / tools / settings
 * ========================================================================== */
.sheet-scrim {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(0,0,0,.5); backdrop-filter: blur(3px);
  opacity: 0; pointer-events: none; transition: opacity .22s;
  display: flex; justify-content: flex-end;
}
.sheet-scrim.open { opacity: 1; pointer-events: auto; }
.sheet {
  width: min(420px, 92vw); height: 100%; overflow-y: auto;
  background: var(--surface); border-left: 1px solid var(--line);
  padding: 22px; transform: translateX(24px); transition: transform .25s cubic-bezier(.2,.7,.2,1);
}
.sheet-scrim.open .sheet { transform: none; }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 10px; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--txt-faint); margin-bottom: 4px;
}
.eyebrow svg { color: var(--accent); }
.sheet-head h2 { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: 24px; letter-spacing: -.01em; }
.sheet-note { font-size: 13px; line-height: 1.55; color: var(--txt-dim); margin: 4px 0 16px; }
.sheet-note b { color: var(--accent); font-weight: 600; }
.sheet-divider { height: 1px; background: var(--line-soft); margin: 20px 0; }
.close svg { width: 16px; height: 16px; }

/* ---- Data store list ------------------------------------------------------ */
.store-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.store {
  display: flex; align-items: center; gap: 12px; text-align: left;
  padding: 13px 14px; border-radius: 12px; width: 100%;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--txt);
  transition: border-color .15s, background .15s;
}
.store:hover { border-color: var(--accent); }
.store[aria-selected="true"] { border-color: var(--accent); background: var(--accent-soft); }
.store .seal {
  flex: none; width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center;
  font-family: var(--font-display); font-size: 17px; color: var(--accent);
  background: var(--surface); border: 1px solid var(--line);
}
.store[aria-selected="true"] .seal { border-color: var(--accent); }
.store .meta { flex: 1; min-width: 0; }
.store .name { font-weight: 600; font-size: 14.5px; display: block; }
.store .sub { font-size: 12px; color: var(--txt-dim); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.store .ck {
  flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  border: 1.5px solid var(--line); color: transparent;
}
.store[aria-selected="true"] .ck { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.store .ck svg { width: 13px; height: 13px; }
.store-empty, .empty {
  text-align: center; color: var(--txt-faint); padding: 30px 10px; font-size: 13px;
  border: 1px dashed var(--line); border-radius: 12px;
}
.store-empty svg, .empty svg { width: 26px; height: 26px; margin: 0 auto 8px; opacity: .5; }
.skel { height: 62px; border-radius: 12px; background: linear-gradient(90deg, var(--surface-2), var(--raise), var(--surface-2)); background-size: 200% 100%; animation: sk 1.3s infinite; }
@keyframes sk { to { background-position: -200% 0; } }

.block-btn {
  width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px; border-radius: 12px; font-size: 14px; font-weight: 600;
  border: 1px dashed var(--line); background: transparent; color: var(--txt-dim);
  transition: border-color .15s, color .15s;
}
.block-btn:hover { border-color: var(--accent); color: var(--accent); }
.block-btn svg { width: 16px; height: 16px; }

/* ---- Tool list ------------------------------------------------------------ */
.tool-list { display: flex; flex-direction: column; gap: 2px; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 2px; }
.tl .t-name { font-size: 14px; font-weight: 500; }
.tl .t-desc { font-size: 12px; color: var(--txt-faint); font-family: var(--font-mono); margin-top: 1px; }
.switch { position: relative; display: inline-block; width: 40px; height: 23px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track { position: absolute; inset: 0; border-radius: 999px; background: var(--raise); border: 1px solid var(--line); transition: background .18s, border-color .18s; }
.switch .track::before { content: ""; position: absolute; left: 3px; top: 2px; width: 17px; height: 17px; border-radius: 50%; background: var(--txt-dim); transition: transform .18s, background .18s; }
.switch input:checked + .track { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .track::before { transform: translateX(17px); background: var(--accent-ink); }

/* ---- Dropzone ------------------------------------------------------------- */
.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 26px 16px; border-radius: 14px; cursor: pointer; text-align: center;
  border: 1.5px dashed var(--line); background: var(--surface-2);
  transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: var(--accent-soft); }
.dropzone svg { width: 24px; height: 24px; color: var(--txt-dim); }
.dz-title { font-weight: 600; font-size: 14px; }
.dz-sub { font-size: 11.5px; color: var(--txt-faint); font-family: var(--font-mono); }
.dropzone input { display: none; }
.upload-prog { height: 4px; border-radius: 4px; background: var(--raise); overflow: hidden; margin-top: 10px; }
.upload-prog i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .25s; }
.result-card { margin-top: 12px; border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: var(--surface-2); }
.rc-head { display: flex; align-items: center; gap: 9px; margin-bottom: 12px; }
.rc-head .ok { width: 22px; height: 22px; border-radius: 50%; background: var(--good); color: var(--bg); display: grid; place-items: center; }
.rc-head .ok svg { width: 13px; height: 13px; }
.rc-name { font-weight: 600; font-size: 13px; word-break: break-all; }
.result-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat .k { font-size: 11px; color: var(--txt-faint); text-transform: uppercase; letter-spacing: .04em; }
.stat .v { font-size: 20px; font-weight: 600; font-family: var(--font-display); }
.stat .v.teal { color: var(--accent); } .stat .v.amber { color: var(--warn); }
.badge-indexed { display: inline-flex; align-items: center; gap: 6px; margin-top: 12px; font-size: 12px; color: var(--good); }
.badge-indexed.no { color: var(--txt-faint); }

/* ---- Settings fields ------------------------------------------------------ */
.field { margin-bottom: 16px; }
.field label { display: flex; align-items: center; justify-content: space-between; font-size: 13px; font-weight: 500; color: var(--txt-dim); margin-bottom: 7px; }
.field label output { font-family: var(--font-mono); color: var(--accent); }
.select, .input {
  width: 100%; padding: 10px 12px; border-radius: 10px; font-size: 14px;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--txt);
  font-family: var(--font-ui); outline: none; transition: border-color .15s, box-shadow .15s;
}
.select:focus, .input:focus { border-color: var(--accent); box-shadow: var(--ring); }
textarea.input { resize: vertical; min-height: 70px; line-height: 1.5; }
.hint { font-size: 12px; color: var(--txt-faint); margin-top: 6px; line-height: 1.45; }
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 4px; border-radius: 4px; background: var(--raise); outline: none; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--accent); cursor: pointer; border: 2px solid var(--surface); }
input[type="range"]::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: var(--accent); cursor: pointer; border: 2px solid var(--surface); }

.seg { display: flex; gap: 4px; padding: 3px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--line); }
.seg button {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px; border-radius: 8px; border: none; background: transparent;
  color: var(--txt-dim); font-size: 13px; font-weight: 500; transition: background .15s, color .15s;
}
.seg button svg { width: 15px; height: 15px; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.seg button:disabled { opacity: .45; cursor: not-allowed; }

/* ============================================================================
 * Parameters panel (AI-Studio-style run settings) + connection tester
 * ========================================================================== */
.sheet-params { width: min(460px, 94vw); }
.sheet-head.sticky {
  position: sticky; top: -22px; z-index: 2; margin: -22px -22px 14px; padding: 22px 22px 12px;
  background: linear-gradient(var(--surface) 78%, transparent);
}

.pgroup { padding: 16px 0; border-top: 1px solid var(--line-soft); }
.pgroup:first-of-type { border-top: none; padding-top: 2px; }
.pgroup-head {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--txt-dim); margin-bottom: 14px;
}
.pgroup-head svg { color: var(--accent); }
.pgroup-note { font-size: 12.5px; line-height: 1.5; color: var(--txt-dim); margin: -8px 0 14px; }
.pgroup-note b { color: var(--accent); font-weight: 600; }
.pgroup .field:last-child, .pgroup .toggle-row:last-child { margin-bottom: 0; }

.range-scale { display: flex; justify-content: space-between; margin-top: 6px; font-size: 11px; font-family: var(--font-mono); color: var(--txt-faint); }
textarea.mono-soft { font-size: 13px; line-height: 1.55; }

/* Auth selector — slightly elevated, with iconography */
.auth-seg button { gap: 8px; padding: 10px 8px; }
.auth-seg button svg { width: 14px; height: 14px; }

/* ---- Connection tester ---- */
.pgroup.tester {
  border: 1px solid var(--line); border-radius: 14px; padding: 16px;
  background: linear-gradient(180deg, var(--surface-2), transparent 80%);
  margin-bottom: 4px;
}
.pgroup.tester .pgroup-head { margin-bottom: 8px; }
.tester-row { margin-bottom: 12px; }
.tester-modes button.testing { opacity: .6; }
.tester-result { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; min-height: 30px; }

.test-badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: 999px;
  font-family: var(--font-mono); font-size: 13px; font-weight: 600;
  border: 1px solid var(--line); background: var(--surface); color: var(--txt-dim);
  transition: background .2s, border-color .2s, color .2s;
}
.test-badge .tb-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--txt-faint); flex: none; }
.test-badge .tb-dot.spin {
  width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid var(--line); border-top-color: var(--accent); background: none;
  animation: spin .7s linear infinite;
}
.test-badge.idle { }
.test-badge.testing { color: var(--txt); border-color: var(--accent); }
.test-badge.ok {
  color: var(--good); border-color: color-mix(in srgb, var(--good) 55%, var(--line));
  background: color-mix(in srgb, var(--good) 14%, var(--surface));
}
.test-badge.ok .tb-dot { background: var(--good); box-shadow: 0 0 0 3px color-mix(in srgb, var(--good) 22%, transparent); }
.test-badge.err {
  color: var(--bad); border-color: color-mix(in srgb, var(--bad) 55%, var(--line));
  background: color-mix(in srgb, var(--bad) 14%, var(--surface));
}
.test-badge.err .tb-dot { background: var(--bad); box-shadow: 0 0 0 3px color-mix(in srgb, var(--bad) 22%, transparent); }

.test-meta { font-size: 12px; color: var(--txt-faint); font-family: var(--font-mono); }
.test-detail { margin-top: 10px; font-size: 12.5px; line-height: 1.5; color: var(--txt-dim); word-break: break-word; }
.test-detail:empty { display: none; }
.test-detail.ok { color: var(--txt-dim); }
.test-detail.err {
  color: var(--bad); font-family: var(--font-mono); font-size: 12px;
  padding: 8px 10px; border-radius: 8px; border: 1px solid color-mix(in srgb, var(--bad) 35%, var(--line));
  background: color-mix(in srgb, var(--bad) 8%, transparent);
}

/* ----- Connection / credentials group ----- */
.conn-key-status { display: flex; align-items: center; gap: 6px; }
.conn-key-status svg { color: var(--txt-faint); flex: none; }
.conn-key-status.set { color: var(--txt-dim); }
.conn-key-status.set svg { color: var(--good); }
.conn-key-status.set #connKeyStatusText b,
.conn-key-status.set .key-hint { font-family: var(--font-mono); color: var(--txt); }
.hint.warn { color: color-mix(in srgb, var(--bad) 80%, var(--txt-faint)); }
.conn-actions { display: flex; gap: 8px; align-items: center; margin-top: 4px; }
.conn-actions .btn { display: inline-flex; align-items: center; gap: 7px; }
.conn-actions .btn svg { flex: none; }
.conn-actions .btn:disabled { opacity: .55; cursor: not-allowed; }

/* ============================================================================
 * New-data-store modal
 * ========================================================================== */
.modal-scrim {
  position: fixed; inset: 0; z-index: 60; display: grid; place-items: center;
  background: rgba(0,0,0,.6); backdrop-filter: blur(4px);
  opacity: 0; pointer-events: none; transition: opacity .2s; padding: 20px;
}
.modal-scrim.open { opacity: 1; pointer-events: auto; }
.modal {
  width: min(560px, 100%); background: var(--surface);
  border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow);
  transform: translateY(12px) scale(.98); transition: transform .22s cubic-bezier(.2,.7,.2,1);
}
.modal-scrim.open .modal { transform: none; }
.modal-head { position: relative; padding: 22px 22px 0; }
.modal-head h2 { margin: 2px 0 0; font-family: var(--font-display); font-weight: 400; font-size: 25px; }
.modal-head .close { position: absolute; top: 16px; right: 16px; }
.modal-body { padding: 18px 22px 22px; }

.steps { display: flex; gap: 8px; margin-bottom: 20px; }
.step { flex: 1; }
.step .bar { height: 3px; border-radius: 3px; background: var(--line); transition: background .25s; }
.step .lbl { font-size: 11px; color: var(--txt-faint); margin-top: 6px; text-transform: uppercase; letter-spacing: .04em; }
.step.active .bar, .step.done .bar { background: var(--accent); }
.step.active .lbl { color: var(--accent); }

.step-panel { display: none; animation: rise .3s ease both; }
.step-panel.active { display: block; }
.type-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.type-card {
  text-align: left; padding: 13px; border-radius: 11px;
  border: 1px solid var(--line); background: var(--surface-2); transition: border-color .15s;
}
.type-card:hover { border-color: var(--accent); }
.type-card[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.tc-name { display: block; font-weight: 600; font-size: 14px; color: var(--txt); }
.tc-desc { display: block; font-size: 12px; color: var(--txt-dim); margin-top: 2px; }

.provisioning { text-align: center; padding: 8px 0; }
.prov-title { font-family: var(--font-display); font-size: 20px; }
.orbit { width: 60px; height: 60px; margin: 0 auto 16px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--accent); animation: spin 1s linear infinite; }
.prov-steps { margin-top: 20px; text-align: left; display: flex; flex-direction: column; gap: 8px; }
.prov-step { display: flex; align-items: center; gap: 11px; font-size: 13px; color: var(--txt-faint); }
.prov-step .pic { width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center; }
.prov-step .pic .d { width: 6px; height: 6px; border-radius: 50%; background: var(--line); }
.prov-step.active { color: var(--txt); }
.prov-step.active .pic { border-color: var(--accent); } .prov-step.active .pic .d { background: var(--accent); animation: pulse 1s infinite; }
.prov-step.done { color: var(--good); } .prov-step.done .pic { border-color: var(--good); background: var(--good); } .prov-step.done .pic .d { background: var(--bg); }

.modal-foot { display: flex; justify-content: space-between; margin-top: 22px; }
.btn { padding: 10px 18px; border-radius: 10px; font-size: 14px; font-weight: 600; border: 1px solid transparent; transition: filter .15s, border-color .15s, color .15s; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--txt-dim); }
.btn.ghost:hover { color: var(--txt); border-color: var(--txt-dim); }

/* ============================================================================
 * Model trigger (topbar) + model field (settings)
 * ========================================================================== */
.model-trigger {
  display: inline-flex; align-items: center; gap: 9px;
  max-width: 240px; padding: 5px 6px 5px 7px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); color: var(--txt);
  font-size: 13px; font-weight: 500;
  transition: border-color .15s, background .15s;
}
.model-trigger:hover { border-color: var(--accent); }
.model-trigger .mt-glyph {
  width: 24px; height: 24px; flex: none; border-radius: 7px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent);
}
.model-trigger .mt-glyph svg { width: 15px; height: 15px; }
.model-trigger .mt-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.model-trigger .mt-chev { width: 14px; height: 14px; color: var(--txt-faint); flex: none; }
.model-trigger[data-live="true"] .mt-glyph { background: rgba(95,208,160,.16); color: var(--good); }

.model-field {
  width: 100%; display: flex; align-items: center; gap: 11px; text-align: left;
  padding: 11px 12px; border-radius: 11px;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--txt);
  transition: border-color .15s;
}
.model-field:hover { border-color: var(--accent); }
.model-field .mf-glyph {
  width: 32px; height: 32px; flex: none; border-radius: 9px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent);
}
.model-field .mf-glyph svg { width: 17px; height: 17px; }
.model-field .mf-meta { flex: 1; min-width: 0; }
.model-field .mf-name { display: block; font-weight: 600; font-size: 14px; }
.model-field .mf-sub { display: block; font-size: 12px; color: var(--txt-faint); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.model-field .mf-chev { width: 16px; height: 16px; color: var(--txt-faint); flex: none; }

/* ============================================================================
 * Model selection modal
 * ========================================================================== */
.mdl-scrim {
  position: fixed; inset: 0; z-index: 70; display: grid; place-items: center;
  background: rgba(0,0,0,.62); backdrop-filter: blur(5px);
  opacity: 0; pointer-events: none; transition: opacity .2s; padding: 20px;
}
.mdl-scrim:not([hidden]).open { opacity: 1; pointer-events: auto; }
.mdl-scrim[hidden] { display: none; }
.mdl {
  width: min(680px, 100%); max-height: min(86vh, 760px);
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 20px; box-shadow: var(--shadow);
  transform: translateY(14px) scale(.985); transition: transform .24s cubic-bezier(.2,.7,.2,1);
  overflow: hidden;
}
.mdl-scrim.open .mdl { transform: none; }
.mdl-head { display: flex; align-items: flex-start; justify-content: space-between; padding: 22px 22px 14px; }
.mdl-head h2 { margin: 2px 0 0; font-family: var(--font-display); font-weight: 400; font-size: 25px; letter-spacing: -.01em; }

.mdl-search { position: relative; margin: 0 22px 14px; }
.mdl-search svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--txt-faint); pointer-events: none; }
.mdl-search input {
  width: 100%; padding: 11px 13px 11px 40px; border-radius: 12px; font-size: 14px;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--txt);
  font-family: var(--font-ui); outline: none; transition: border-color .15s, box-shadow .15s;
}
.mdl-search input:focus { border-color: var(--accent); box-shadow: var(--ring); }
.mdl-search input::-webkit-search-cancel-button { -webkit-appearance: none; }

.mdl-chips {
  display: flex; gap: 7px; padding: 0 22px 14px; overflow-x: auto;
  scrollbar-width: none; flex: none;
}
.mdl-chips::-webkit-scrollbar { display: none; }
.mchip {
  flex: none; padding: 6px 13px; border-radius: 999px; font-size: 12.5px; font-weight: 500;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--txt-dim);
  transition: border-color .15s, color .15s, background .15s;
}
.mchip:hover { color: var(--txt); border-color: var(--txt-faint); }
.mchip[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

.mdl-list {
  flex: 1; min-height: 0; overflow-y: auto;
  padding: 4px 22px 22px; display: flex; flex-direction: column; gap: 10px;
}
.mdl-empty { padding: 0 22px 26px; text-align: center; color: var(--txt-faint); font-size: 13.5px; }

/* ---- Model card ---- */
.mcard {
  position: relative; display: grid;
  grid-template-columns: 40px 1fr auto; grid-template-rows: auto auto;
  column-gap: 13px; row-gap: 6px; align-items: start; text-align: left;
  padding: 15px 16px; border-radius: 14px; width: 100%;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--txt);
  transition: border-color .15s, background .15s, transform .1s;
}
.mcard:hover:not(.disabled) { border-color: var(--accent); }
.mcard:active:not(.disabled) { transform: scale(.995); }
.mcard[aria-selected="true"] { border-color: var(--accent); background: var(--accent-soft); }
.mcard .mc-glyph {
  grid-row: 1 / 3; width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--line); color: var(--accent);
}
.mcard .mc-glyph svg { width: 20px; height: 20px; }
.mcard.live .mc-glyph { color: var(--good); }
.mcard.media .mc-glyph { color: var(--ext); }
.mcard .mc-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.mcard .mc-name { font-weight: 600; font-size: 15px; letter-spacing: -.01em; }
.mcard .mc-desc { grid-column: 2 / 3; font-size: 13px; line-height: 1.5; color: var(--txt-dim); }
.mcard .mc-cut {
  grid-column: 2 / 3; display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; color: var(--txt-faint); font-family: var(--font-mono); margin-top: 2px;
}
.mcard .mc-cut svg { width: 13px; height: 13px; }
.mcard .mc-actions { grid-row: 1 / 3; display: flex; align-items: center; gap: 4px; align-self: center; }
.mc-act {
  width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center;
  border: 1px solid transparent; background: transparent; color: var(--txt-faint);
  transition: color .15s, background .15s, border-color .15s;
}
.mc-act:hover { color: var(--txt); background: var(--raise); border-color: var(--line); }
.mc-act svg { width: 16px; height: 16px; }
.mc-act.starred { color: var(--warn); }
.mc-act.starred svg { fill: var(--warn); }
.mcard .mc-current {
  grid-column: 2 / 3; margin-top: 4px; font-size: 11px; font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase; color: var(--accent); display: inline-flex; align-items: center; gap: 6px;
}

/* disabled / preview cards */
.mcard.disabled { cursor: not-allowed; opacity: .72; }
.mcard.disabled:hover { border-color: var(--line); }
.mcard.disabled .mc-glyph { opacity: .7; }
.mcard .mc-preview {
  grid-column: 2 / 3; margin-top: 4px; font-size: 11.5px; color: var(--warn);
  display: inline-flex; align-items: center; gap: 6px;
}

/* ---- Badges ---- */
.mbadge {
  display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase;
  border: 1px solid var(--line); background: var(--raise); color: var(--txt-dim);
}
.mbadge.live { background: rgba(95,208,160,.16); border-color: rgba(95,208,160,.4); color: var(--good); }
.mbadge.new  { background: var(--accent-soft); border-color: rgba(122,162,255,.4); color: var(--accent); }
.mbadge.preview { background: rgba(226,177,94,.14); border-color: rgba(226,177,94,.4); color: var(--warn); }
.mbadge.paid, .mbadge.open { background: var(--surface); }

/* ============================================================================
 * Toasts
 * ========================================================================== */
.toasts { position: fixed; bottom: 88px; left: 50%; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 11px 15px; border-radius: 11px; font-size: 13.5px;
  background: var(--raise); border: 1px solid var(--line); color: var(--txt);
  box-shadow: var(--shadow); animation: rise .25s ease;
}
.toast svg { width: 16px; height: 16px; color: var(--accent); }
.toast.ok svg { color: var(--good); } .toast.err svg { color: var(--bad); }
.toast.notif svg { color: var(--ext); }

/* ============================================================================
 * Notifications / Activity panel
 * ========================================================================== */
#activityBtn { position: relative; }
#activityBtn .chip-count {
  position: absolute; top: -3px; right: -3px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 999px; background: var(--ext); color: var(--accent-ink);
  font-size: 10.5px; font-weight: 700; line-height: 16px; text-align: center;
}
.activity-panel {
  position: fixed; top: 60px; right: 14px; z-index: 70;
  width: min(380px, calc(100vw - 28px)); max-height: min(70vh, 560px);
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--shadow); overflow: hidden; animation: rise .2s ease;
}
.activity-panel[hidden] { display: none; }
.activity-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 10px; border-bottom: 1px solid var(--line-soft);
}
.activity-list { overflow-y: auto; padding: 10px 12px 14px; display: flex; flex-direction: column; gap: 9px; }
.activity-empty { padding: 26px 10px; text-align: center; color: var(--txt-faint); font-size: 13px; }
.activity-item {
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2);
  padding: 11px 12px; display: flex; flex-direction: column; gap: 6px;
}
.activity-item.alert { border-color: rgba(199,155,240,.45); }
.ai-top { display: flex; align-items: center; gap: 8px; }
.ai-plat {
  flex: none; font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  padding: 2px 7px; border-radius: 999px; background: var(--raise); border: 1px solid var(--line);
  color: var(--txt-dim);
}
.ai-title { font-weight: 600; font-size: 13.5px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-time { font-size: 11px; color: var(--txt-faint); font-family: var(--font-mono); flex: none; }
.ai-msg { font-size: 13px; color: var(--txt-dim); line-height: 1.45; }
.ai-alert {
  display: flex; gap: 7px; align-items: flex-start; font-size: 12.5px; color: var(--ext);
  background: rgba(199,155,240,.1); border: 1px solid rgba(199,155,240,.28);
  border-radius: 9px; padding: 7px 9px;
}
.ai-alert svg { width: 14px; height: 14px; flex: none; margin-top: 1px; }
.ai-reply {
  display: flex; gap: 7px; align-items: flex-start; font-size: 12.5px; color: var(--txt-dim);
  border-radius: 9px; padding: 7px 9px; background: var(--raise); border: 1px solid var(--line);
}
.ai-reply svg { width: 14px; height: 14px; flex: none; margin-top: 1px; color: var(--accent); }
.ai-reply b { color: var(--txt); font-weight: 600; }

/* ---- Per-platform bot hand-off toggles (inside activity panel) ---- */
.activity-platforms { padding: 11px 16px 12px; border-bottom: 1px solid var(--line-soft); }
.ap-head {
  display: flex; align-items: center; gap: 6px; font-size: 10.5px; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase; color: var(--txt-faint); margin-bottom: 9px;
}
.ap-head svg { color: var(--txt-faint); }
.ap-toggles { display: flex; flex-direction: column; gap: 6px; }
.ap-toggle {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 5px 9px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2);
}
.ap-toggle .ap-name {
  font-size: 12.5px; font-weight: 600; color: var(--txt); text-transform: capitalize;
  display: flex; align-items: center; gap: 7px; min-width: 0;
}
.ap-toggle .ap-state { font-size: 10px; color: var(--txt-faint); font-family: var(--font-mono); letter-spacing: .03em; }
.ap-toggle .switch { width: 36px; height: 21px; flex: none; }
.ap-toggle .switch .track::before { width: 15px; height: 15px; }
.ap-toggle .switch input:checked + .track::before { transform: translateX(15px); }
.ap-add { display: flex; gap: 7px; margin-top: 9px; }
.ap-add .input { flex: 1; min-width: 0; padding: 7px 10px; font-size: 12.5px; }
.ap-add .btn { flex: none; padding: 7px 10px; }

/* ---- Prompt-bar quick actions: New conversation + Ask about a link ---- */
.pb-actions { display: flex; gap: 8px; flex-wrap: wrap; padding: 9px 4px 0; }
.pb-chip {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  font: inherit; font-size: 12px; font-weight: 600; color: var(--txt-dim);
  padding: 5px 11px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-2);
  transition: color .15s, border-color .15s, background .15s;
}
.pb-chip:hover { color: var(--txt); border-color: var(--accent); }
.pb-chip[aria-expanded="true"] { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.pb-chip svg { width: 14px; height: 14px; }
.ask-link-row { display: flex; align-items: center; gap: 8px; padding: 9px 4px 0; flex-wrap: wrap; }
.ask-link-row[hidden] { display: none; }
.alr-glyph { flex: none; display: inline-flex; color: var(--txt-faint); }
.alr-glyph svg { width: 16px; height: 16px; }
.ask-link-row #askLinkUrl { flex: 2 1 220px; min-width: 0; padding: 8px 11px; font-size: 13px; }
.ask-link-row #askLinkQ { flex: 3 1 220px; min-width: 0; padding: 8px 11px; font-size: 13px; }
.ask-link-row .btn { flex: none; }

/* ============================================================================
 * Available to Skye — unified menu (tools / MCP / Context Droplets)
 * ========================================================================== */
.sheet-available { width: min(440px, 94vw); }
.sheet-available .sheet-head.sticky {
  position: sticky; top: -22px; z-index: 2; margin: -22px -22px 12px; padding: 22px 22px 12px;
  background: linear-gradient(var(--surface) 78%, transparent);
}

.avail-section { border-top: 1px solid var(--line-soft); }
.avail-section:first-of-type { border-top: none; }
.avail-head {
  width: 100%; display: flex; align-items: center; gap: 10px;
  padding: 15px 2px; border: none; background: transparent; color: var(--txt);
  text-align: left;
}
.avail-head .ah-icon { color: var(--accent); flex: none; }
.avail-head .ah-title { font-size: 14px; font-weight: 600; letter-spacing: -.01em; flex: 1; }
.avail-head .ah-count {
  font-family: var(--font-mono); font-size: 11px; min-width: 18px; text-align: center;
  padding: 1px 6px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); flex: none;
}
.avail-head .ah-chev { width: 16px; height: 16px; color: var(--txt-faint); flex: none; transition: transform .2s; }
.avail-head[aria-expanded="false"] .ah-chev { transform: rotate(-90deg); }
.avail-body { padding: 0 2px 14px; }
.avail-body.collapsed { display: none; }
.avail-note { font-size: 12.5px; line-height: 1.5; color: var(--txt-dim); margin: 0 0 12px; }
.avail-note b { color: var(--accent); font-weight: 600; }

/* ---- (a) Tool groups ---- */
.tool-group { margin-bottom: 10px; }
.tool-group:last-child { margin-bottom: 0; }
.tg-cat {
  font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--txt-faint); margin: 4px 0 2px; padding-bottom: 6px; border-bottom: 1px solid var(--line-soft);
}

/* ---- (a.1) Per-capability params (inline, expandable settings tray) ---- */
.capability { border-radius: 10px; }
.capability .toggle-row { gap: 8px; }
.cap-gear {
  width: 28px; height: 28px; flex: none; border-radius: 8px; display: grid; place-items: center;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--txt-faint);
  transition: color .15s, border-color .15s, background .15s;
}
.cap-gear:hover { color: var(--txt); border-color: var(--accent); }
.cap-gear[aria-expanded="true"] { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.cap-gear svg { width: 15px; height: 15px; }
.cap-tray {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px;
  margin: 0 0 10px; padding: 11px 12px; border-radius: 10px;
  border: 1px dashed var(--line); background: var(--surface-2);
}
.cap-tray.collapsed { display: none; }
.cap-param { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.cap-param label { font-size: 12px; font-weight: 500; color: var(--txt-dim); }
.cap-param .cap-input { padding: 7px 9px; font-size: 13px; }
@media (max-width: 480px) { .cap-tray { grid-template-columns: 1fr; } }

/* ---- (b) MCP rows ---- */
.mcp-row {
  display: flex; align-items: center; gap: 12px; padding: 12px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); margin-bottom: 12px;
}
.mcp-meta { flex: 1; min-width: 0; }
.mcp-name { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.mcp-desc { font-size: 12px; color: var(--txt-dim); margin-top: 3px; }
.mcp-tag {
  font-size: 10px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase;
  padding: 2px 7px; border-radius: 999px; border: 1px solid var(--line); color: var(--txt-dim);
}
.mcp-tag.ok { color: var(--good); border-color: color-mix(in srgb, var(--good) 45%, var(--line)); background: color-mix(in srgb, var(--good) 12%, transparent); }
.block-btn[disabled] { cursor: not-allowed; opacity: .55; }
.block-btn[disabled]:hover { border-color: var(--line); color: var(--txt-dim); }
.block-btn .soon {
  font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  margin-left: 6px; padding: 1px 6px; border-radius: 999px; background: var(--raise);
  border: 1px solid var(--line); color: var(--txt-faint);
}
.mcp-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.mcp-row.external { margin-bottom: 0; transition: border-color .15s, background .15s; }
.mcp-row.external.on { border-color: var(--accent); background: var(--accent-soft); }
.mcp-row.external .mcp-desc { font-family: var(--font-mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mcp-row.external .switch { flex: none; }
.mcp-remove {
  flex: none; display: grid; place-items: center; width: 30px; height: 30px;
  border-radius: 8px; border: 1px solid var(--line); background: var(--surface);
  color: var(--txt-dim); cursor: pointer; transition: color .15s, border-color .15s, background .15s;
}
.mcp-remove:hover { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); }
.mcp-empty { padding: 10px 12px; font-size: 12.5px; }
.droplet-new.mcp-new { margin-top: 4px; }

/* ---- (b2) Skills ---- */
.skill-browse { border: 1px dashed var(--line); border-radius: 14px; background: var(--surface-2); overflow: hidden; }
.skill-browse-head { width: 100%; padding: 12px 14px; }
.skill-browse-head .ah-title { font-size: 13px; }
.skill-browse-body { padding: 0 14px 14px; }
.skill-browse-body .mcp-list { margin-bottom: 0; }
.skill-import {
  flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px;
  border-radius: 8px; border: 1px solid var(--line); background: var(--surface);
  color: var(--accent); font-size: 12.5px; font-weight: 600; cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.skill-import:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-soft); }
.skill-import:disabled { color: var(--txt-faint); cursor: default; opacity: .8; }
.skill-import.pending { opacity: .7; cursor: progress; }
.mcp-row.skill .mcp-desc { white-space: normal; font-family: inherit; }

/* Skill row: name is now a toggle button; controls grouped on the right. */
.mcp-row.skill { flex-wrap: wrap; align-items: flex-start; }
.mcp-row.skill .mcp-meta { padding-top: 1px; }
.skill-name-btn {
  display: inline-flex; align-items: center; gap: 4px; padding: 0; margin: 0;
  background: none; border: none; cursor: pointer; color: var(--txt); font: inherit;
  font-size: 14px; font-weight: 600;
}
.skill-name-btn:hover { color: var(--accent); }
.skill-name-chev { color: var(--txt-faint); transition: transform .15s; }
.mcp-row.skill.expanded .skill-name-chev { transform: rotate(180deg); }
.skill-compat {
  font-size: 11.5px; margin-top: 4px; font-family: var(--font-mono);
  color: var(--txt-faint); white-space: normal;
}
.skill-controls { display: inline-flex; align-items: center; gap: 10px; flex: none; }
.skill-exec {
  display: inline-flex; align-items: center; gap: 5px; cursor: pointer;
  font-size: 11.5px; font-weight: 600; color: var(--txt-dim); user-select: none;
}
.skill-exec input { accent-color: var(--warn); width: 13px; height: 13px; cursor: pointer; }
.mcp-row.skill.executable .skill-exec-lbl { color: var(--warn); }

/* "runs code" chip beside an executable skill's name. */
.skill-chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px;
  border-radius: 999px; font-size: 10.5px; font-weight: 700; letter-spacing: .02em;
  text-transform: lowercase; line-height: 1.6;
}
.skill-chip.runs-code {
  color: var(--warn);
  background: color-mix(in srgb, var(--warn) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--warn) 38%, var(--line));
}
.skill-chip svg { fill: currentColor; }
.mcp-row.skill.executable.on { border-color: color-mix(in srgb, var(--warn) 50%, var(--accent)); }

/* Lightweight skill detail (expanded). */
.skill-detail {
  flex-basis: 100%; margin-top: 10px; padding: 10px 12px; border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 7px;
}
.skill-detail-row { display: flex; gap: 10px; font-size: 12px; align-items: flex-start; }
.skill-detail-k { flex: none; width: 92px; color: var(--txt-faint); font-weight: 600; }
.skill-detail-v { flex: 1; min-width: 0; color: var(--txt-dim); word-break: break-word; }
.skill-files { margin: 0; padding-left: 16px; display: flex; flex-direction: column; gap: 2px; }
.skill-files li { font-family: var(--font-mono); font-size: 11.5px; color: var(--txt-dim); }

/* Sandbox runner config. */
.skill-runner {
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2);
  padding: 11px 13px; margin-bottom: 14px;
}
.skill-runner.configured { border-color: color-mix(in srgb, var(--good) 40%, var(--line)); }
.skill-runner-label, .skill-importurl-label {
  display: block; font-size: 11.5px; font-weight: 600; color: var(--txt-dim); margin-bottom: 6px;
}
.skill-runner-row, .skill-importurl-row { display: flex; gap: 8px; align-items: center; }
.skill-runner-row .input, .skill-importurl-row .input { flex: 1; min-width: 0; }
.skill-runner-hint, .skill-importurl-hint { margin-top: 6px; font-size: 11.5px; }
.skill-runner-hint.warn { color: var(--warn); }
.skill-runner-hint.ok { color: var(--good); }

/* Import-from-URL form. */
.skill-importurl {
  border: 1px dashed var(--line); border-radius: 12px; background: var(--surface-2);
  padding: 11px 13px; margin-top: 14px;
}

/* ---- (c) Context Droplets ---- */
.droplet-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.droplet {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface-2);
  transition: border-color .15s, background .15s;
}
.droplet.on { border-color: var(--accent); background: var(--accent-soft); }
.droplet .seal {
  flex: none; width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center;
  font-family: var(--font-display); font-size: 17px; color: var(--accent);
  background: var(--surface); border: 1px solid var(--line);
}
.droplet.on .seal { border-color: var(--accent); }
.droplet .meta { flex: 1; min-width: 0; }
.droplet .name { font-weight: 600; font-size: 14.5px; display: block; }
.droplet .sub { font-size: 12px; color: var(--txt-dim); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.droplet .dstatus { font-size: 11px; color: var(--warn); font-family: var(--font-mono); display: block; margin-top: 2px; }
.droplet .switch { flex: none; }

.droplet-new {
  border: 1px dashed var(--line); border-radius: 14px; padding: 14px; background: var(--surface-2);
}
.droplet-new .dn-head {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--txt-dim); margin-bottom: 12px;
}
.droplet-new .dn-head svg { color: var(--accent); }
.droplet-new .field { margin-bottom: 12px; }
.droplet-new .dn-submit { width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.droplet-new .dn-submit svg { flex: none; }
.droplet-new .dn-submit.pending { opacity: .7; cursor: progress; }
.droplet-new .dn-submit:disabled { opacity: .6; cursor: not-allowed; }

/* ============================================================================
 * Agents (saved presets) — header trigger + list rows
 * ========================================================================== */
.agent-trigger[data-active="true"] { border-color: var(--accent); }
.agent-trigger[data-active="true"] .mt-glyph { background: var(--accent-soft); color: var(--accent); }

.droplet.agent { gap: 12px; }
.droplet.agent .agent-summary {
  display: block; margin-top: 3px;
  font-size: 11px; color: var(--txt-faint); font-family: var(--font-mono);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.agent-actions { flex: none; display: inline-flex; align-items: center; gap: 6px; }
.agent-actions .agent-apply { padding: 6px 13px; font-size: 13px; }
.droplet.agent.on .agent-apply { color: var(--accent); border-color: var(--accent); }
.agent-actions .agent-apply:disabled { cursor: default; }
.agent-actions .agent-del { width: 30px; height: 30px; }
.agent-actions .agent-del:hover { color: var(--bad, #e05a5a); border-color: var(--bad, #e05a5a); }

/* ============================================================================
 * Responsive
 * ========================================================================== */
@media (max-width: 640px) {
  .ghost-btn span:not(.chip-count) { display: none; }
  .run-btn kbd { display: none; }
  .pb-foot { font-size: 11px; }
}

/* ---- Wake word ---------------------------------------------------------- */
.wake-ind { position: relative; display: inline-flex; align-items: center; gap: 6px; border: none; background: transparent; color: var(--muted, #888); cursor: pointer; padding: 4px; }
.wake-ind .wake-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; opacity: .35; }
.wake-ind[data-state="armed"] { color: var(--accent, #4ea1ff); }
.wake-ind[data-state="armed"] .wake-dot { opacity: 1; animation: wakePulse 1.6s ease-in-out infinite; }
.wake-ind[data-state="live"]  { color: var(--accent, #4ea1ff); }
.wake-ind[data-state="muted"] { color: #e0a23c; }
.wake-ind[data-state="error"] { color: #e05a5a; }
@keyframes wakePulse { 0%,100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.6); opacity: .4; } }
.wake-detect-flash { animation: wakeFlash .5s ease-out; }
@keyframes wakeFlash { 0% { box-shadow: 0 0 0 0 var(--accent, #4ea1ff); } 100% { box-shadow: 0 0 0 14px transparent; } }
.pill.mute[aria-pressed="true"] { background: #e0a23c22; color: #e0a23c; }
.voice-stage.muted #equalizer { opacity: .3; }

/* ============================================================================
 * Workspace (stage + artifact side-panel) + scaled chat
 * ========================================================================== */
.workspace { min-height: 0; display: flex; overflow: hidden; }
.stage { flex: 1; min-width: 0; }
.hero { max-width: 600px; }
.hero-orb { width: 76px; height: 76px; margin: 0 auto 22px; }
.hero-title { font-size: clamp(26px, 3.4vw, 36px); font-weight: 600; letter-spacing: -.02em; }
.hero-sub { font-size: 14.5px; max-width: 440px; }
.messages { max-width: 720px; padding: 24px 24px 8px; }

/* ---- Assistant working steps (humanized tool_calls) ---- */
.work-steps { display: flex; flex-direction: column; gap: 2px; margin-bottom: 12px; }
.work-step {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px; border-radius: 9px;
  font-size: 13px; color: var(--txt-dim);
  border: 1px solid var(--line-soft); background: var(--surface);
}
.work-step .ws-ic { flex: none; width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; background: var(--surface-2); color: var(--accent); }
.work-step .ws-ic svg { width: 14px; height: 14px; }
.work-step .ws-lbl { flex: 1; min-width: 0; }
.work-step .ws-tick { flex: none; color: var(--good); opacity: .85; }
.work-step .ws-tick svg { width: 15px; height: 15px; }
.work-step.done { color: var(--txt); }
/* Live: the currently-running step pulses subtly and shows a spinner. */
.work-step.running { color: var(--txt); border-color: var(--accent-soft); }
.work-step.running .ws-ic { background: var(--accent-soft); color: var(--accent); }
.work-step .ws-spin { flex: none; display: grid; place-items: center; width: 15px; height: 15px; }
.work-step.working-hint .ws-lbl { color: var(--txt-dim); }
@keyframes ws-pulse { 0%,100% { opacity: 1; } 50% { opacity: .55; } }
.work-step.running .ws-lbl { animation: ws-pulse 1.4s ease-in-out infinite; }

/* ============================================================================
 * Artifact / document preview side-panel
 * ========================================================================== */
.artifact-panel {
  flex: none; width: min(440px, 42vw);
  /* Panel = full height of the workspace (viewport minus topbar + promptbar);
     its body scrolls internally rather than overflowing the page. */
  height: 100%; min-height: 0;
  display: flex; flex-direction: column;
  border-left: 1px solid var(--line); background: var(--surface);
  animation: rise .2s ease;
}
.artifact-panel[hidden] { display: none; }
/* The live preview window: a fixed-size region (fills the panel below the head)
   that contains the scrolling document. The corner download icon pins here. */
.ap-window { position: relative; flex: 1; min-height: 0; display: flex; }
.ap-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 16px 12px; border-bottom: 1px solid var(--line-soft); }
.ap-title { display: flex; align-items: center; gap: 11px; min-width: 0; }
.ap-glyph { flex: none; width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.ap-glyph svg { width: 18px; height: 18px; }
.ap-meta { min-width: 0; }
.ap-name { font-weight: 600; font-size: 14px; word-break: break-word; }
.ap-kind { font-size: 11px; color: var(--txt-faint); text-transform: uppercase; letter-spacing: .05em; font-family: var(--font-mono); margin-top: 2px; }
.ap-actions { flex: none; display: flex; align-items: center; gap: 8px; }
/* Document scrolls INSIDE the fixed-height preview window (no page overflow). */
.ap-body { flex: 1; width: 100%; min-height: 0; height: 100%; overflow-y: auto; padding: 18px; }

/* Subtle icon-only download, pinned to the top-right corner of the preview
   window. Stays put while the document scrolls beneath it. */
.ap-corner-dl {
  position: absolute; top: 12px; right: 14px; z-index: 5;
  width: 30px; height: 30px; border-radius: 8px;
  display: grid; place-items: center;
  color: var(--txt-dim); background: var(--surface-2);
  border: 1px solid var(--line-soft);
  box-shadow: 0 1px 6px rgba(0,0,0,.28);
  text-decoration: none; opacity: .82;
  transition: opacity .14s, color .14s, border-color .14s, background .14s;
}
.ap-corner-dl:hover { opacity: 1; color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.ap-corner-dl svg { width: 16px; height: 16px; }
.ap-loading { display: inline-flex; align-items: center; gap: 9px; font-size: 13px; color: var(--txt-dim); }
.ap-image { max-width: 100%; border-radius: 10px; border: 1px solid var(--line); display: block; }
.ap-doc {
  font-size: 14px; line-height: 1.65; color: var(--txt);
  background: var(--surface-2); border: 1px solid var(--line-soft); border-radius: 12px; padding: 22px 26px;
}
.ap-doc h1, .ap-doc h2, .ap-doc h3 { font-weight: 600; letter-spacing: -.01em; margin: 1.1em 0 .5em; }
.ap-doc h1 { font-size: 1.45em; } .ap-doc h2 { font-size: 1.25em; } .ap-doc h3 { font-size: 1.1em; }
.ap-doc p { margin: 0 0 .8em; } .ap-doc ul, .ap-doc ol { margin: 0 0 .8em; padding-left: 1.3em; }
.ap-doc table { border-collapse: collapse; width: 100%; font-size: 13px; margin: .6em 0; }
.ap-doc td, .ap-doc th { border: 1px solid var(--line); padding: 6px 9px; text-align: left; }

/* Rendered .docx — a clean white "paper" page sitting on the dark panel,
 * mirroring Claude's inline document preview. */
.ap-paper-wrap { display: flex; justify-content: center; padding: 4px 0 24px; }
.ap-paper {
  width: 100%; max-width: 760px;
  background: #fff; color: #1a1a1a;
  border-radius: 6px; box-shadow: var(--shadow, 0 6px 30px rgba(0,0,0,.45));
  padding: 48px 56px 56px;
  font-family: Georgia, "Times New Roman", "Iowan Old Style", serif;
  font-size: 15px; line-height: 1.7;
  word-wrap: break-word; overflow-wrap: anywhere;
}
.ap-paper > :first-child { margin-top: 0; }
.ap-paper p { margin: 0 0 1em; }
.ap-paper h1, .ap-paper h2, .ap-paper h3, .ap-paper h4 {
  font-family: -apple-system, "Segoe UI", system-ui, sans-serif;
  font-weight: 700; line-height: 1.25; color: #111; margin: 1.4em 0 .5em; letter-spacing: -.01em;
}
.ap-paper h1 { font-size: 1.7em; } .ap-paper h2 { font-size: 1.35em; } .ap-paper h3 { font-size: 1.15em; }
.ap-paper ul, .ap-paper ol { margin: 0 0 1em; padding-left: 1.5em; }
.ap-paper li { margin: .25em 0; }
.ap-paper a { color: #1a56db; }
.ap-paper strong { color: #111; }
.ap-paper em { color: #333; }
.ap-paper table { border-collapse: collapse; width: 100%; margin: 1em 0; font-size: .92em; }
.ap-paper td, .ap-paper th { border: 1px solid #d4d4d4; padding: 8px 11px; text-align: left; vertical-align: top; }
.ap-paper th { background: #f3f4f6; font-weight: 600; }
.ap-paper img { max-width: 100%; height: auto; }
@media (max-width: 880px) { .ap-paper { padding: 32px 28px 40px; } }

/* ---- xlsx spreadsheet preview (white paper, sheet tabs + scrollable table) -- */
.ap-paper.ap-sheet { padding: 22px 24px 28px; font-family: -apple-system, "Segoe UI", system-ui, sans-serif; }
.ap-sheet-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; border-bottom: 1px solid #e3e3e3; padding-bottom: 10px; }
.ap-sheet-tab {
  font: inherit; font-size: 12.5px; font-weight: 600; color: #555;
  background: #f1f2f4; border: 1px solid #dcdee1; border-radius: 7px;
  padding: 5px 12px; cursor: pointer; transition: background .14s, color .14s, border-color .14s;
  max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ap-sheet-tab:hover { background: #e7e9ec; }
.ap-sheet-tab.active { background: #1a56db; color: #fff; border-color: #1a56db; }
.ap-sheet-scroll { overflow-x: auto; max-width: 100%; }
.ap-sheet-scroll table { border-collapse: collapse; font-size: 13px; color: #1a1a1a; min-width: 100%; }
.ap-sheet-scroll td, .ap-sheet-scroll th { border: 1px solid #d4d4d4; padding: 6px 11px; text-align: left; vertical-align: top; white-space: nowrap; }
/* SheetJS emits no <thead>; emphasise the first row as a header instead. */
.ap-sheet-scroll tr:first-child td, .ap-sheet-scroll th { background: #f3f4f6; font-weight: 600; color: #111; position: sticky; top: 0; }

/* ---- pptx slide-by-slide content preview (stacked 16:9 cards) -------------- */
.ap-paper.ap-deck { padding: 22px 24px 28px; background: #f4f5f7; font-family: -apple-system, "Segoe UI", system-ui, sans-serif; }
.ap-deck-note { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: #8a8f98; margin-bottom: 14px; }
.ap-slide {
  position: relative; background: #fff; border: 1px solid #e0e2e6; border-radius: 8px;
  box-shadow: 0 3px 14px rgba(0,0,0,.10); margin-bottom: 18px; overflow: hidden;
  aspect-ratio: 16 / 9; display: flex;
}
.ap-slide-no { position: absolute; top: 8px; right: 12px; font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: #aab; }
.ap-slide-inner { padding: 28px 34px; overflow-y: auto; width: 100%; }
.ap-slide-title { font-size: 20px; font-weight: 700; color: #15171c; line-height: 1.25; margin-bottom: 12px; letter-spacing: -.01em; }
.ap-slide-body { margin: 0; padding-left: 20px; }
.ap-slide-body li { font-size: 14px; line-height: 1.55; color: #2a2d33; margin: 4px 0; }
.ap-slide-media { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.ap-slide-img { max-width: 100%; max-height: 180px; height: auto; border-radius: 6px; border: 1px solid #e0e2e6; }

.ap-card {
  display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
  padding: 36px 22px; border: 1px dashed var(--line); border-radius: 14px; background: var(--surface-2);
}
.ap-card-glyph { width: 52px; height: 52px; border-radius: 13px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.ap-card-glyph svg { width: 26px; height: 26px; }
.ap-card-name { font-weight: 600; font-size: 14.5px; word-break: break-word; }
.ap-card-kind { font-size: 11px; color: var(--txt-faint); text-transform: uppercase; letter-spacing: .05em; }
.ap-card-note { font-size: 12.5px; color: var(--txt-dim); }
.ap-card-dl { margin-top: 8px; display: inline-flex; align-items: center; gap: 7px; text-decoration: none; padding: 9px 16px; }
.ap-card-dl svg { flex: none; }
.ap-more { margin-top: 18px; border-top: 1px solid var(--line-soft); padding-top: 12px; }
.ap-more-h { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--txt-faint); margin-bottom: 8px; }
.ap-more-row { display: flex; align-items: center; gap: 10px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); text-decoration: none; color: var(--txt); margin-bottom: 7px; transition: border-color .15s; }
.ap-more-row:hover { border-color: var(--accent); }
.ap-more-row .amr-glyph { flex: none; color: var(--accent); } .ap-more-row .amr-glyph svg { width: 16px; height: 16px; }
.ap-more-row .amr-name { flex: 1; min-width: 0; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ap-more-row .amr-dl { flex: none; width: 15px; height: 15px; color: var(--txt-faint); }

/* In-chat artifact download chips — a compact one-line affordance on the
   assistant message that produced the artifact(s). Minimal, not a big card. */
.chat-artifacts { display: flex; flex-direction: column; gap: 5px; margin: 8px 0 2px; }
.chat-artifact {
  display: inline-flex; align-items: center; gap: 8px;
  align-self: flex-start; max-width: 100%;
  padding: 5px 10px; border-radius: 8px;
  border: 1px solid var(--line-soft); background: var(--surface-2);
  color: var(--txt-dim); text-decoration: none; font-size: 12.5px;
  transition: border-color .14s, color .14s, background .14s;
}
.chat-artifact:hover { border-color: var(--accent); color: var(--txt); background: var(--accent-soft); }
.chat-artifact .ca-file { flex: none; color: var(--accent); display: inline-flex; }
.chat-artifact .ca-file svg { width: 14px; height: 14px; }
.chat-artifact .ca-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-artifact .ca-dl { flex: none; width: 14px; height: 14px; color: var(--txt-faint); }
.chat-artifact:hover .ca-dl { color: var(--accent); }

@media (max-width: 880px) {
  .artifact-panel { position: fixed; inset: 52px 0 0 auto; width: min(440px, 92vw); z-index: 50; box-shadow: var(--shadow); }
}

/* ============================================================================
 * Customize — tabbed surface
 * ========================================================================== */
.cz-scrim {
  position: fixed; inset: 0; z-index: 60; display: grid; place-items: center;
  background: rgba(0,0,0,.55); backdrop-filter: blur(4px);
  opacity: 0; pointer-events: none; transition: opacity .2s; padding: 24px;
}
.cz-scrim[hidden] { display: none; }
.cz-scrim:not([hidden]).open { opacity: 1; pointer-events: auto; }
.cz {
  width: min(920px, 100%); height: min(82vh, 720px);
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 18px; box-shadow: var(--shadow);
  transform: translateY(12px) scale(.99); transition: transform .22s cubic-bezier(.2,.7,.2,1);
}
.cz-scrim.open .cz { transform: none; }
.cz-head { display: flex; align-items: flex-start; justify-content: space-between; padding: 20px 22px 16px; border-bottom: 1px solid var(--line-soft); }
.cz-head h2 { margin: 2px 0 0; font-weight: 600; font-size: 20px; letter-spacing: -.015em; }
.cz-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 220px 1fr; }
.cz-rail { border-right: 1px solid var(--line-soft); padding: 12px 10px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.cz-tab {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 9px 11px; border: 1px solid transparent; border-radius: 9px;
  background: transparent; color: var(--txt-dim); font-size: 13.5px; font-weight: 500;
  transition: background .14s, color .14s;
}
.cz-tab svg { flex: none; width: 17px; height: 17px; }
.cz-tab span:not(.cz-count) { flex: 1; min-width: 0; }
.cz-tab:hover { background: var(--surface-2); color: var(--txt); }
.cz-tab[aria-selected="true"] { background: var(--accent-soft); color: var(--accent); }
.cz-count {
  flex: none; font-family: var(--font-mono); font-size: 11px; min-width: 18px; text-align: center;
  padding: 1px 6px; border-radius: 999px; background: var(--raise); color: var(--txt-dim);
}
.cz-tab[aria-selected="true"] .cz-count { background: var(--accent-soft); color: var(--accent); }
.cz-panes { min-width: 0; position: relative; }
.cz-pane { display: none; position: absolute; inset: 0; overflow-y: auto; padding: 22px 26px 28px; }
.cz-pane.active { display: block; }
.cz-note { font-size: 13px; line-height: 1.55; color: var(--txt-dim); margin: 0 0 18px; max-width: 620px; }
.cz-note b { color: var(--accent); font-weight: 600; }
.cz-pane .pgroup:first-of-type { padding-top: 0; }

@media (max-width: 720px) {
  .cz-body { grid-template-columns: 1fr; }
  .cz-rail { flex-direction: row; overflow-x: auto; border-right: none; border-bottom: 1px solid var(--line-soft); }
  .cz-tab { white-space: nowrap; }
  .cz-tab span:not(.cz-count) { flex: none; }
}
