/* Linkem AI. Apple's quiet surfaces; the one AI touch is the Linkem apostrophe (the agent's mark) and its
   blue-violet-teal light, which moves only while the agent is working. */
:root {
  --canvas: #f5f5f7;
  --surface: #ffffff;
  --surface-2: #fbfbfd;
  --ink: #1d1d1f;
  --ink-2: #6e6e73;
  --ink-3: #86868b;
  --hair: #d2d2d7;
  --hair-soft: rgba(0, 0, 0, 0.07);
  --action: #0071e3;
  --action-press: #0062c4;
  --bubble: #e9e9eb;
  --caution-ink: #9a4a00;
  --caution-bg: #fff4e5;
  --danger: #d70015;
  --ok: #1e8e3e;
  --glass: rgba(246, 246, 248, 0.72);
  --g1: #2997ff;
  --g2: #7d5cff;
  --g3: #1fc8b5;
  --glow: linear-gradient(120deg, var(--g1), var(--g2) 50%, var(--g3));
  --radius: 18px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "SF Arabic", "Segoe UI", Roboto,
          "Noto Sans", "Noto Sans Arabic", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --canvas: #000000;
    --surface: #1c1c1e;
    --surface-2: #161618;
    --ink: #f5f5f7;
    --ink-2: #a1a1a6;
    --ink-3: #8e8e93;
    --hair: #38383a;
    --hair-soft: rgba(255, 255, 255, 0.08);
    --action: #2997ff;
    --action-press: #0a84ff;
    --bubble: #2c2c2e;
    --caution-ink: #ffb340;
    --caution-bg: rgba(255, 159, 10, 0.12);
    --danger: #ff453a;
    --ok: #30d158;
    --glass: rgba(28, 28, 30, 0.72);
  }
}

* { box-sizing: border-box; }
html, body, #root { height: 100%; }
body {
  margin: 0; background: var(--canvas); color: var(--ink); font: 400 16px/1.5 var(--font);
  -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%; text-rendering: optimizeLegibility;
}
:lang(ar) body, [dir="rtl"] body { line-height: 1.7; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--action); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--action) 45%, transparent); outline-offset: 2px; border-radius: 8px; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── the mark: Linkem's apostrophe ───────────────────────────────────── */
.mark { width: 28px; height: 28px; flex: none; position: relative; display: inline-grid; place-items: center; }
.mark svg { width: 100%; height: 100%; display: block; }
.mark .halo { position: absolute; inset: -6px; border-radius: 50%; background: var(--glow); filter: blur(10px);
  opacity: 0; transition: opacity .4s ease; }
.mark.big { width: 56px; height: 56px; }
.thinking .mark .halo, .mark.live .halo { opacity: .45; animation: breathe 2.4s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: .2; transform: scale(.85); } }
#lk-g .s1 { stop-color: var(--g1); } #lk-g .s2 { stop-color: var(--g2); } #lk-g .s3 { stop-color: var(--g3); }

/* ── buttons and fields ──────────────────────────────────────────────── */
.btn { border: 0; border-radius: 980px; padding: 10px 20px; font-weight: 500; font-size: 15px; background: var(--action);
  color: #fff; transition: background .15s ease, transform .1s ease; }
.btn:hover { background: var(--action-press); }
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .45; cursor: default; transform: none; }
.btn.plain { background: transparent; color: var(--action); padding: 10px 14px; }
.btn.plain:hover { background: var(--hair-soft); }
.btn.quiet { background: var(--bubble); color: var(--ink); }
.btn.quiet:hover { background: var(--hair); }
.btn.wide { width: 100%; padding: 13px 20px; font-size: 16px; }
.field { display: block; margin: 0 0 12px; }
.field span { display: block; font-size: 13px; color: var(--ink-2); margin: 0 0 6px; }
.field input { width: 100%; border: 1px solid var(--hair); background: var(--surface); border-radius: 12px; padding: 12px 14px;
  font-size: 16px; transition: border-color .15s ease, box-shadow .15s ease; }
.field input:focus { outline: none; border-color: var(--action); box-shadow: 0 0 0 4px color-mix(in srgb, var(--action) 18%, transparent); }
.code-input { letter-spacing: .5em; font-variant-numeric: tabular-nums; text-align: center; font-size: 24px !important; }
.msg-error { color: var(--danger); font-size: 14px; min-height: 21px; margin: 4px 0 8px; }
.icon-btn { width: 36px; height: 36px; border: 0; border-radius: 10px; background: transparent; display: inline-grid;
  place-items: center; color: var(--ink-2); }
.icon-btn:hover { background: var(--hair-soft); color: var(--ink); }
.icon-btn svg { width: 20px; height: 20px; }

/* ── sign-in ──────────────────────────────────────────────────────────── */
.gate { min-height: 100%; display: grid; place-items: center; padding: 32px 20px calc(32px + env(safe-area-inset-bottom)); }
.gate-box { width: 100%; max-width: 380px; }
.gate-head { text-align: center; margin: 0 0 32px; }
.gate-head .mark { margin: 0 auto 18px; }
.gate h1 { font-size: 32px; line-height: 1.12; font-weight: 600; letter-spacing: -0.02em; margin: 0 0 8px; }
.gate p.lead { color: var(--ink-2); margin: 0; font-size: 17px; }
.gate-foot { text-align: center; margin-top: 18px; font-size: 14px; color: var(--ink-2); }
.gate-brand { display: block; margin: 40px auto 0; height: 22px; opacity: .55; }
.qr { background: #fff; border-radius: 14px; padding: 10px; width: 196px; margin: 0 auto 10px; border: 1px solid var(--hair); }
.qr svg { width: 100%; height: auto; display: block; }
.secret { font-family: var(--mono); font-size: 13px; text-align: center; color: var(--ink-2); word-break: break-all; margin: 0 0 16px; }
.codes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; font-family: var(--mono); font-size: 15px; margin: 12px 0 18px; }
.codes span { background: var(--surface); border: 1px solid var(--hair); border-radius: 10px; padding: 8px; text-align: center; }
.steps { font-size: 14px; color: var(--ink-2); padding-inline-start: 20px; margin: 0 0 16px; }

/* ── the app frame ───────────────────────────────────────────────────── */
.app { display: grid; grid-template-columns: 280px 1fr; height: 100%; height: 100dvh; }
.side { background: var(--glass); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-inline-end: 1px solid var(--hair-soft); display: flex; flex-direction: column; min-height: 0;
  padding: calc(14px + env(safe-area-inset-top)) 12px calc(12px + env(safe-area-inset-bottom)); }
.side-top { display: flex; align-items: center; gap: 10px; padding: 4px 6px 14px; }
.side-top .who { min-width: 0; flex: 1; }
.side-top .who b { display: block; font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.side-top .who small { display: block; font-size: 12px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.new-chat { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; border-radius: 10px; padding: 9px 10px;
  background: transparent; font-weight: 500; font-size: 15px; color: var(--ink); }
.new-chat:hover { background: var(--hair-soft); }
.new-chat svg { width: 18px; height: 18px; color: var(--action); }
.convs { flex: 1; overflow-y: auto; margin: 10px 0; padding: 0; list-style: none; }
.convs h3 { font-size: 12px; font-weight: 600; color: var(--ink-3); margin: 14px 10px 4px; letter-spacing: 0; }
.convs a { display: block; padding: 8px 10px; border-radius: 10px; color: var(--ink); font-size: 14px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; text-decoration: none; }
.convs a:hover { background: var(--hair-soft); }
.convs a[aria-current="page"] { background: color-mix(in srgb, var(--action) 12%, transparent); color: var(--ink); font-weight: 500; }
.side-foot { display: flex; align-items: center; gap: 4px; border-top: 1px solid var(--hair-soft); padding-top: 10px; }
.side-foot .grow { flex: 1; }
.side-foot .lang { font-size: 13px; color: var(--ink-2); border: 0; background: transparent; padding: 6px 8px; border-radius: 8px; }
.side-foot .lang:hover { background: var(--hair-soft); }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; height: 100%; position: relative; }
.topbar { display: none; }
.thread { flex: 1; overflow-y: auto; scroll-behavior: smooth; padding: 32px 24px 24px; }
.col { max-width: 760px; margin: 0 auto; }

/* empty chat */
.hello { min-height: 60vh; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 6px; }
.hello .mark { margin-bottom: 18px; }
.hello h2 { font-size: 32px; line-height: 1.15; font-weight: 600; letter-spacing: -0.02em; margin: 0; }
.hello p { font-size: 19px; color: var(--ink-2); margin: 0 0 22px; }
.ideas { display: flex; flex-wrap: wrap; gap: 8px; }
.ideas button { border: 1px solid var(--hair); background: var(--surface); border-radius: 980px; padding: 9px 16px; font-size: 14px;
  color: var(--ink); text-align: start; }
.ideas button:hover { border-color: var(--ink-3); }

/* messages */
.m { margin: 0 0 22px; }
.m.user { display: flex; justify-content: flex-end; }
.m.user .text { background: var(--bubble); border-radius: 20px; padding: 10px 16px; max-width: min(560px, 85%); white-space: pre-wrap;
  overflow-wrap: anywhere; }
.m.bot { display: grid; grid-template-columns: 28px 1fr; gap: 14px; }
.m.bot .body { min-width: 0; padding-top: 2px; }
.m .status { color: var(--ink-2); font-size: 15px; display: flex; align-items: center; gap: 8px; min-height: 28px; }
.m .status::after { content: ""; width: 44px; height: 3px; border-radius: 3px; background: var(--glow); background-size: 200% 100%;
  animation: flow 1.4s linear infinite; opacity: .8; }
@keyframes flow { to { background-position: -200% 0; } }
.m.error .body { color: var(--danger); }

/* answer text (Markdown) */
.md { overflow-wrap: anywhere; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 12px; }
.md h1, .md h2, .md h3 { font-size: 17px; font-weight: 600; margin: 18px 0 8px; letter-spacing: -0.01em; }
.md ul, .md ol { margin: 0 0 12px; padding-inline-start: 22px; }
.md li { margin: 3px 0; }
.md code { font-family: var(--mono); font-size: .88em; background: var(--hair-soft); padding: 1px 5px; border-radius: 5px; }
.md pre { background: var(--surface); border: 1px solid var(--hair-soft); border-radius: 12px; padding: 12px 14px; overflow-x: auto; }
.md pre code { background: none; padding: 0; }
.md blockquote { margin: 0 0 12px; padding-inline-start: 14px; border-inline-start: 3px solid var(--hair); color: var(--ink-2); }
.tbl { overflow-x: auto; margin: 4px 0 14px; border: 1px solid var(--hair-soft); border-radius: 12px; background: var(--surface); }
.md table { border-collapse: collapse; width: 100%; font-size: 14px; }
.md th, .md td { padding: 8px 12px; text-align: start; border-bottom: 1px solid var(--hair-soft); vertical-align: top; }
.md td { min-width: 6em; }
.md th { font-weight: 600; color: var(--ink-2); font-size: 13px; background: var(--surface-2); }
.md tr:last-child td { border-bottom: 0; }
.md td.num, .md th.num { text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; min-width: 0; }

/* files */
.file { display: inline-flex; align-items: center; gap: 12px; padding: 10px 14px 10px 10px; margin: 6px 0 0; border: 1px solid var(--hair);
  border-radius: 14px; background: var(--surface); color: var(--ink); text-decoration: none; max-width: 100%; }
.file:hover { border-color: var(--ink-3); text-decoration: none; }
.file .ext { width: 38px; height: 44px; border-radius: 8px; display: grid; place-items: center; font-size: 11px; font-weight: 700;
  color: #fff; background: #1d6f42; flex: none; }
.file .ext.pdf { background: #c4302b; }
.file b { display: block; font-weight: 500; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file small { color: var(--ink-2); font-size: 12px; }

/* ── the change card ─────────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--hair); border-radius: var(--radius); margin: 4px 0 0; overflow: hidden; }
.card-head { padding: 16px 18px 6px; display: flex; gap: 12px; align-items: flex-start; }
.card-head svg { width: 22px; height: 22px; flex: none; color: var(--action); margin-top: 2px; }
.card-head h4 { margin: 0; font-size: 17px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.35; }
.card-head p { margin: 2px 0 0; font-size: 13px; color: var(--ink-2); }
.card-ops { margin: 6px 18px 8px; padding: 0; list-style: none; font-size: 15px; }
.card-ops li { padding: 3px 0; }
.chg { margin: 6px 18px 4px; font-size: 13px; border: 1px solid var(--hair-soft); border-radius: 12px; overflow: hidden; }
.chg table { width: 100%; border-collapse: collapse; }
.chg td, .chg th { padding: 7px 10px; border-bottom: 1px solid var(--hair-soft); text-align: start; vertical-align: top; }
.chg th { font-weight: 600; color: var(--ink-2); background: var(--surface-2); font-size: 12px; }
.chg tr:last-child td { border-bottom: 0; }
.chg td.now { color: var(--ink-2); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--ink-2) 50%, transparent); }
.chg td.new { font-weight: 500; }
.chg-more { display: block; margin: 0 18px 8px; font-size: 13px; }
.review { margin: 10px 18px 0; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--hair-soft); font-size: 14px; }
.review b { font-weight: 600; }
.review.ok b { color: var(--ok); }
.review.no b { color: var(--danger); }
.review ul { margin: 6px 0 0; padding-inline-start: 18px; color: var(--ink-2); }
.warn { margin: 10px 18px 0; padding: 10px 14px; border-radius: 12px; background: var(--caution-bg); color: var(--caution-ink); font-size: 14px; }
.card-actions { display: flex; gap: 8px; align-items: center; padding: 14px 18px 16px; flex-wrap: wrap; }
.card-actions .note { font-size: 13px; color: var(--ink-2); margin-inline-start: auto; }
.card-state { display: flex; align-items: center; gap: 8px; padding: 14px 18px 16px; font-size: 15px; font-weight: 500; flex-wrap: wrap; }
.card-state.done { color: var(--ok); }
.card-state.fail { color: var(--danger); }
.card-state.muted { color: var(--ink-2); font-weight: 400; }
.card-state svg { width: 20px; height: 20px; }
.card-state .btn { margin-inline-start: auto; }
.card.working { border-color: transparent; background: linear-gradient(var(--surface), var(--surface)) padding-box, var(--glow) border-box;
  border: 1.5px solid transparent; }

/* ── composer ────────────────────────────────────────────────────────── */
.dock { padding: 10px 24px calc(14px + env(safe-area-inset-bottom)); background: linear-gradient(to top, var(--canvas) 70%, transparent); }
.composer { position: relative; max-width: 760px; margin: 0 auto; background: var(--surface); border-radius: 26px; border: 1px solid var(--hair);
  display: flex; align-items: flex-end; gap: 4px; padding: 6px; transition: border-color .2s ease, box-shadow .2s ease; }
.composer:focus-within { border-color: var(--ink-3); }
.composer::before { content: ""; position: absolute; inset: -1.5px; border-radius: 27.5px; padding: 1.5px; background: conic-gradient(from var(--a, 0deg),
  var(--g1), var(--g2), var(--g3), var(--g1)); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude; opacity: 0; transition: opacity .35s ease; pointer-events: none; }
.composer::after { content: ""; position: absolute; inset: 8px 30px -6px; border-radius: 30px; background: var(--glow); filter: blur(22px);
  opacity: 0; transition: opacity .35s ease; z-index: -1; pointer-events: none; }
.thinking .composer { border-color: transparent; }
.thinking .composer::before { opacity: 1; animation: spin 3.2s linear infinite; }
.thinking .composer::after { opacity: .28; }
@property --a { syntax: "<angle>"; initial-value: 0deg; inherits: false; }
@keyframes spin { to { --a: 360deg; } }
.composer textarea { flex: 1; border: 0; resize: none; background: transparent; padding: 9px 6px; max-height: 200px; min-height: 40px;
  line-height: 1.45; font-size: 16px; }
.composer textarea:focus { outline: none; }
.composer .icon-btn { width: 40px; height: 40px; border-radius: 50%; }
.send { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--ink); color: var(--canvas); display: grid; place-items: center; flex: none; }
.send svg { width: 20px; height: 20px; }
.send[disabled] { opacity: .25; cursor: default; }
.attachments { max-width: 760px; margin: 0 auto 8px; display: flex; gap: 8px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; background: var(--surface); border: 1px solid var(--hair);
  border-radius: 980px; padding: 5px 6px 5px 12px; }
.chip button { border: 0; background: transparent; color: var(--ink-2); width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; }
.chip button:hover { background: var(--hair-soft); }
.fine { text-align: center; font-size: 12px; color: var(--ink-3); margin: 8px 0 0; }
.drop { position: fixed; inset: 0; background: color-mix(in srgb, var(--canvas) 80%, transparent); display: grid; place-items: center;
  font-size: 19px; font-weight: 500; z-index: 50; backdrop-filter: blur(6px); }
.drop div { border: 2px dashed var(--action); border-radius: 24px; padding: 48px 64px; color: var(--action); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .thinking .composer::before { background: var(--glow); }
}

/* ── phones ──────────────────────────────────────────────────────────── */
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: min(86vw, 320px); z-index: 40; transform: translateX(-102%);
    transition: transform .28s cubic-bezier(.2, .8, .2, 1); background: var(--glass); box-shadow: 0 0 0 1px var(--hair-soft); }
  [dir="rtl"] .side { inset: 0 0 0 auto; transform: translateX(102%); }
  .menu-open .side { transform: none; }
  .scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .25); z-index: 30; }
  .topbar { display: flex; align-items: center; gap: 6px; padding: calc(6px + env(safe-area-inset-top)) 8px 6px; background: var(--glass);
    backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); border-bottom: 1px solid var(--hair-soft);
    position: sticky; top: 0; z-index: 10; }
  .topbar .title { flex: 1; display: flex; align-items: center; gap: 8px; justify-content: center; font-weight: 600; font-size: 16px; }
  .topbar .title .mark { width: 22px; height: 22px; }
  .thread { padding: 20px 16px 16px; }
  .dock { padding: 8px 10px calc(10px + env(safe-area-inset-bottom)); }
  .hello h2 { font-size: 28px; }
  .hello p { font-size: 17px; }
  .card-actions .note { margin-inline-start: 0; width: 100%; }
}

/* ── admin ───────────────────────────────────────────────────────────── */
.admin { flex: 1; overflow-y: auto; padding: calc(16px + env(safe-area-inset-top)) 24px 40px; }
.admin-head { max-width: 980px; margin: 0 auto 20px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.admin-head h2 { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; margin: 0; flex: 1; }
.admin-head .btn.plain { padding-inline: 0; margin-inline-end: 8px; }
.admin-body { max-width: 980px; margin: 0 auto; }
.seg { display: inline-flex; background: var(--bubble); border-radius: 10px; padding: 2px; gap: 2px; }
.seg button { border: 0; background: transparent; border-radius: 8px; padding: 6px 14px; font-size: 14px; color: var(--ink); }
.seg button[aria-selected="true"] { background: var(--surface); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); font-weight: 500; }
.seg.small button { padding: 5px 11px; font-size: 13px; }
.rows { list-style: none; margin: 0 0 28px; padding: 0; background: var(--surface); border: 1px solid var(--hair-soft); border-radius: var(--radius); }
.row { display: flex; align-items: center; gap: 16px; padding: 14px 18px; border-bottom: 1px solid var(--hair-soft); flex-wrap: wrap; }
.row:last-child { border-bottom: 0; }
.row-main { flex: 1; min-width: 200px; }
.row-main b { font-weight: 600; margin-inline-end: 8px; }
.row-main small { color: var(--ink-2); font-size: 13px; }
.row-num { text-align: center; min-width: 56px; }
.row-num b { display: block; font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }
.row-num small { font-size: 12px; color: var(--ink-2); }
.row-act { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.tags { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.pill { font-size: 12px; padding: 2px 9px; border-radius: 980px; background: var(--bubble); color: var(--ink-2); }
.pill.active { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.pill.invited { background: var(--caution-bg); color: var(--caution-ink); }
.pill.disabled { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.btn.plain.danger { color: var(--danger); }
.select { font-size: 14px; border: 1px solid var(--hair); border-radius: 9px; padding: 6px 10px; background: var(--surface); color: var(--ink); }
.search { font-size: 14px; border: 1px solid var(--hair); border-radius: 9px; padding: 6px 10px; background: var(--surface); min-width: 180px; }
.switch-label { display: inline-flex; align-items: center; gap: 10px; font-size: 14px; color: var(--ink-2); }
.switch { width: 51px; height: 31px; border-radius: 16px; border: 0; background: var(--hair); position: relative; padding: 0; transition: background .2s ease; }
.switch span { position: absolute; top: 2px; inset-inline-start: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, .2); transition: transform .2s ease; }
.switch.on { background: var(--ok); }
.switch.on span { transform: translateX(20px); }
[dir="rtl"] .switch.on span { transform: translateX(-20px); }
.add { background: var(--surface); border: 1px solid var(--hair-soft); border-radius: var(--radius); padding: 18px; }
.add h3 { margin: 0 0 12px; font-size: 17px; font-weight: 600; }
.add-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 14px; }
.add .field select { width: 100%; padding: 11px 12px; border-radius: 12px; font-size: 16px; }
.linkbox { background: var(--surface); border: 1.5px solid var(--action); border-radius: var(--radius); padding: 16px 18px; margin: 0 0 20px; }
.linkbox p { margin: 0 0 8px; font-weight: 500; }
.linkbox code { display: block; font-family: var(--mono); font-size: 13px; word-break: break-all; margin: 0 0 12px; color: var(--ink-2); }
.flash { max-width: 980px; margin: 0 auto 14px; padding: 10px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--hair); font-size: 14px; }
.flash.bad { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.muted { color: var(--ink-2); font-size: 14px; }
.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 0 0 12px; }
.filters .btn.quiet { padding: 6px 14px; font-size: 14px; margin-inline-start: auto; }
table.grid { border-collapse: collapse; width: 100%; font-size: 13px; }
table.grid th, table.grid td { padding: 8px 10px; border-bottom: 1px solid var(--hair-soft); text-align: start; vertical-align: top; }
table.grid th { font-weight: 600; color: var(--ink-2); background: var(--surface-2); white-space: nowrap; font-size: 12px; }
table.grid td.num, table.grid th.num { text-align: end; font-variant-numeric: tabular-nums; }
table.audit td { max-width: 360px; overflow-wrap: anywhere; }
.sheet { border: 0; border-radius: 22px; padding: 22px; width: min(92vw, 360px); background: var(--surface); color: var(--ink);
  box-shadow: 0 30px 60px rgba(0, 0, 0, .25); }
.sheet::backdrop { background: rgba(0, 0, 0, .3); backdrop-filter: blur(4px); }
.sheet h3 { margin: 0 0 6px; font-size: 17px; font-weight: 600; }
.sheet p { margin: 0 0 14px; color: var(--ink-2); font-size: 14px; }
.sheet-actions { display: flex; justify-content: flex-end; gap: 8px; }
@media (max-width: 820px) { .admin { padding: 12px 14px 32px; } .row { gap: 10px; } .row-act { width: 100%; } }

/* ── voice mode: a full-screen call with the agent. The apostrophe's light follows your voice while it listens and
   its own voice while it speaks (--in / --out, 0..1, set by voice.js); it slowly breathes while it thinks. ── */
[hidden] { display: none !important; }
.composer .mic svg { width: 21px; height: 21px; }
.voice { position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; padding: max(24px, env(safe-area-inset-top)) 24px max(28px, env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--canvas) 94%, transparent); backdrop-filter: blur(24px) saturate(1.2);
  -webkit-backdrop-filter: blur(24px) saturate(1.2); --in: 0; --out: 0; }
.voice-orb { flex: 1; display: grid; place-items: center; width: 100%; min-height: 200px; }
.mark.orb { width: 132px; height: 132px; transition: transform .12s ease-out; }
.mark.orb .halo { inset: -38px; filter: blur(34px); opacity: .5; transition: transform .12s ease-out, opacity .3s ease; }
.voice[data-state="listening"] .mark.orb .halo, .voice[data-state="muted"] .mark.orb .halo { animation: breathe 4.8s ease-in-out infinite; opacity: .35; }
.voice[data-state="muted"] .mark.orb { filter: grayscale(1); opacity: .55; }
.voice[data-state="hearing"] .mark.orb .halo { opacity: calc(.35 + var(--in) * .45); transform: scale(calc(.9 + var(--in) * .35)); }
.voice[data-state="hearing"] .mark.orb { transform: scale(calc(1 + var(--in) * .06)); }
.voice[data-state="thinking"] .mark.orb .halo, .voice[data-state="starting"] .mark.orb .halo { animation: breathe 1.8s ease-in-out infinite, hue 6s linear infinite; opacity: .6; }
.voice[data-state="speaking"] .mark.orb .halo { opacity: calc(.4 + var(--out) * 1.2); transform: scale(calc(.92 + var(--out) * .8)); }
.voice[data-state="speaking"] .mark.orb { transform: scale(calc(1 + var(--out) * .12)); }
@keyframes hue { to { filter: blur(34px) hue-rotate(360deg); } }
.voice-state { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -.01em; }
.voice-cap { margin: 0; max-width: 34rem; min-height: 3.2em; text-align: center; color: var(--ink-2); font-size: 17px; line-height: 1.6; }
.voice-cap.you { color: var(--ink-3); }
.voice-cap.bot { color: var(--ink); }
.voice-cap.err { color: var(--caution-ink); }
.voice-change { border: 1.5px solid var(--action); color: var(--action); background: transparent; border-radius: 980px; padding: 9px 18px; font-weight: 500; }
.voice-bar { display: flex; gap: 14px; margin-top: 8px; }
.voice-btn { min-width: 120px; padding: 13px 22px; border: 0; border-radius: 980px; background: var(--bubble); color: var(--ink); font-weight: 600; }
.voice-btn[aria-pressed="true"] { background: var(--ink); color: var(--canvas); }
.voice-btn.end { background: var(--danger); color: #fff; }
.voice-btn:focus-visible, .voice-change:focus-visible { outline: 3px solid color-mix(in srgb, var(--action) 55%, transparent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  .voice .mark.orb, .voice .mark.orb .halo { animation: none !important; transition: none; transform: none !important; }
}
