/* ============================================================
   MOKED (מוקד) — command-deck stylesheet
   near-black base · amber attention accent · per-team accents
   Hebrew-first typography · generous radius · subtle borders
   ============================================================ */

/* local font faces — purely opportunistic, system fallback is the contract.
   NO network fetch: local() sources only. */
@font-face { font-family: 'Heebo'; src: local('Heebo'), local('Heebo-Regular'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Heebo'; src: local('Heebo Bold'), local('Heebo-Bold'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Rubik'; src: local('Rubik'), local('Rubik-Regular'); font-weight: 400; font-display: swap; }

:root {
  --bg: #0b0d12;
  --panel: #10131b;
  --panel-2: #161a25;
  --raise: #1b2030;
  --line: rgba(255,255,255,.07);
  --line-strong: rgba(255,255,255,.14);
  --txt: #e9ebf2;
  --dim: #8a93a6;
  --faint: #5b6375;
  --amber: #e8b84a;
  --amber-soft: rgba(232,184,74,.14);
  --green: #3ecf8e;
  --green-soft: rgba(62,207,142,.12);
  --red: #ff5d5d;
  --red-soft: rgba(255,93,93,.12);
  --blue: #5aa9ff;
  --violet: #b18cff;
  --violet-soft: rgba(177,140,255,.12);
  --radius: 14px;
  --radius-sm: 9px;
  --tap: 44px;
  --font: 'Heebo','Rubik',system-ui,'Segoe UI','Helvetica Neue',sans-serif;
  --mono: ui-monospace,'Cascadia Code','SF Mono',Consolas,monospace;
  --sab: env(safe-area-inset-bottom, 0px);
  --sat: env(safe-area-inset-top, 0px);
  --kb: 0px;          /* keyboard offset, set by visualViewport JS */
  --team: var(--dim); /* per-item team accent override */
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { height: 100%; }
body {
  margin: 0; height: 100%; overflow: hidden;
  background:
    radial-gradient(1200px 500px at 50% -200px, rgba(232,184,74,.05), transparent 60%),
    var(--bg);
  color: var(--txt);
  font-family: var(--font);
  font-size: 15.5px;
  line-height: 1.45;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; color: inherit; }
.noscript { padding: 40px; text-align: center; }

/* ---------- generic bits ---------- */
.linkish {
  background: none; border: none; color: var(--blue);
  cursor: pointer; font-size: .92em; padding: 8px;
}
.iconbtn {
  background: none; border: none; cursor: pointer;
  min-width: var(--tap); min-height: var(--tap);
  font-size: 20px; border-radius: var(--radius-sm);
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .15s ease, opacity .15s ease;
}
.iconbtn:active { background: var(--panel-2); }
.iconbtn[aria-pressed="true"] { color: var(--amber); text-shadow: 0 0 12px rgba(232,184,74,.55); }
.dim { color: var(--dim); }
.empty { color: var(--faint); text-align: center; padding: 48px 24px; font-size: .95em; }
[hidden] { display: none !important; }

/* ============================================================
   pairing
   ============================================================ */
#view-pair {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  padding: 24px; background: var(--bg); z-index: 60;
}
.pair-card {
  width: min(380px, 100%); text-align: center;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 6px); padding: 36px 28px;
  box-shadow: 0 30px 80px rgba(0,0,0,.5);
}
.pair-glyph {
  width: 84px; height: 84px; margin: 0 auto 18px; border-radius: 24px;
  display: flex; align-items: center; justify-content: center;
  font-size: 46px; font-weight: 700; color: var(--amber);
  background: linear-gradient(160deg, #161a25, #0d0f16);
  border: 1px solid var(--line-strong);
  text-shadow: 0 0 22px rgba(232,184,74,.65), 0 0 60px rgba(232,184,74,.3);
}
.pair-card h1 { font-size: 1.3em; margin: 0 0 6px; }
.pair-sub { color: var(--dim); font-size: .9em; margin: 0 0 22px; }
#pair-form, #pair-token-form { display: flex; gap: 10px; }
#pair-code, #pair-token {
  flex: 1; min-width: 0; text-align: center; letter-spacing: .45em; font-size: 1.45em;
  background: var(--bg); color: var(--txt); border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); padding: 12px 8px; outline: none;
}
#pair-token { letter-spacing: normal; font-size: 1em; font-family: var(--mono); }
#pair-code:focus, #pair-token:focus { border-color: var(--amber); box-shadow: 0 0 0 3px var(--amber-soft); }
#pair-form button, #pair-token-form button {
  min-height: var(--tap); padding: 0 18px; border: none; border-radius: var(--radius-sm);
  background: var(--amber); color: #14110a; font-weight: 700; cursor: pointer;
}
.pair-error { color: var(--red); font-size: .9em; }
#pair-token-form { margin-top: 12px; }

/* ============================================================
   shell layout
   ============================================================ */
#main { display: flex; flex-direction: column; height: 100%; padding-top: var(--sat); }

.sysbanner {
  padding: 8px 14px; font-size: .88em; text-align: center;
  background: var(--red-soft); color: var(--red); border-bottom: 1px solid var(--line);
}
.sysbanner.warn { background: var(--amber-soft); color: var(--amber); }
#offline-banner { /* injected by sw.js into the cached shell */
  padding: 9px 14px; font-size: .9em; text-align: center;
  background: var(--red-soft); color: var(--red);
  position: fixed; top: var(--sat); inset-inline: 0; z-index: 70;
}

#topbar {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 12px; border-bottom: 1px solid var(--line);
  background: rgba(11,13,18,.85); backdrop-filter: blur(10px);
  flex: 0 0 auto;
}
#brand { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.brand-glyph {
  width: 30px; height: 30px; border-radius: 9px; font-size: 17px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--amber); background: var(--panel-2); border: 1px solid var(--line-strong);
  text-shadow: 0 0 10px rgba(232,184,74,.6);
}
#stale-ind { font-size: .85em; opacity: .8; animation: pulse 1.6s ease infinite; }

.gw {
  flex: 1; min-width: 0; text-align: center; font-size: .85em;
  padding: 6px 10px; border-radius: 999px; border: 1px solid var(--line);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: color .25s ease, background .25s ease;
}
.gw-on  { color: var(--green); background: var(--green-soft); }
.gw-on::before { content: '●'; margin-inline-end: 6px; animation: pulse 2.4s ease infinite; }
.gw-off { color: var(--red); background: var(--red-soft); }
.gw-off::before { content: '●'; margin-inline-end: 6px; }

#layout { flex: 1 1 auto; min-height: 0; display: flex; position: relative; }
.pane { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.page { overflow-y: auto; padding: 14px; flex: 1; }
.page h2 { font-size: 1.05em; color: var(--dim); margin: 4px 2px 14px; letter-spacing: .02em; }

/* mobile: panes swap by body[data-tab] + body.in-thread */
#roster-pane, #thread-pane, #view-attention, #view-approvals, #view-settings {
  position: absolute; inset: 0; background: transparent;
}
body[data-tab="chats"]:not(.in-thread) #roster-pane { display: flex; }
body[data-tab="chats"].in-thread #thread-pane { display: flex; }
#roster-pane, #thread-pane { display: none; }
body[data-tab="attention"] #view-attention,
body[data-tab="approvals"] #view-approvals,
body[data-tab="settings"]  #view-settings { display: flex; }

/* ============================================================
   tab bar
   ============================================================ */
#tabbar {
  flex: 0 0 auto; display: flex; align-items: stretch;
  border-top: 1px solid var(--line);
  background: rgba(13,15,22,.92); backdrop-filter: blur(12px);
  padding-bottom: var(--sab);
}
body.kb-open #tabbar { display: none; }
.tab {
  flex: 1; min-height: 54px; background: none; border: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--faint); position: relative; transition: color .18s ease;
}
.tab .ticon { font-size: 19px; filter: grayscale(1) opacity(.75); transition: filter .18s ease, transform .18s ease; }
.tab .tlabel { font-size: .68em; letter-spacing: .02em; }
.tab.active { color: var(--txt); }
.tab.active .ticon { filter: none; transform: translateY(-1px); }
.tab.active::after {
  content: ''; position: absolute; top: 0; inset-inline: 28%;
  height: 2px; border-radius: 2px; background: var(--amber);
  box-shadow: 0 0 10px rgba(232,184,74,.7);
}
.badge {
  position: absolute; top: 6px; inset-inline-end: calc(50% - 26px);
  min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px;
  background: var(--blue); color: #06121f; font-size: .62em; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.badge.amber { background: var(--amber); color: #14110a; box-shadow: 0 0 10px rgba(232,184,74,.5); }

/* ============================================================
   roster
   ============================================================ */
#roster { overflow-y: auto; flex: 1; padding: 6px 10px calc(20px + var(--sab)); }
.team-head {
  display: flex; align-items: center; gap: 8px;
  margin: 16px 6px 6px; font-size: .72em; font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase; color: var(--faint);
}
.team-head::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.team-head .team-chip { width: 8px; height: 8px; border-radius: 3px; background: var(--team); }

.agent-row {
  width: 100%; display: flex; align-items: center; gap: 12px; text-align: start;
  background: none; border: none; cursor: pointer;
  padding: 9px 8px; min-height: 60px; border-radius: var(--radius);
  border-inline-start: 3px solid transparent;
  transition: background .15s ease, border-color .15s ease;
}
.agent-row:active, .agent-row.sel { background: var(--panel-2); border-inline-start-color: var(--team); }
.avatar {
  width: 44px; height: 44px; flex: 0 0 44px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center; font-size: 22px;
  background: linear-gradient(160deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line); position: relative;
}
.pdot {
  position: absolute; bottom: -2px; inset-inline-end: -2px;
  width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid var(--bg); background: var(--faint);
  transition: background .25s ease;
}
.pdot.listening { background: var(--green); animation: pulse 2.2s ease infinite; }
.pdot.working   { background: var(--blue);  animation: pulse 1.1s ease infinite; }
.pdot.offline   { background: var(--faint); animation: none; }
body.stale .pdot { animation: none; opacity: .45; }
body.stale .tick { opacity: .45; }

.agent-main { flex: 1; min-width: 0; }
.agent-line1 { display: flex; align-items: baseline; gap: 8px; }
.agent-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agent-state { font-size: .72em; color: var(--team); white-space: nowrap; }
.agent-prev {
  color: var(--dim); font-size: .84em; margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  unicode-bidi: plaintext;
}
.agent-side { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; flex: 0 0 auto; }
.agent-time { font-size: .7em; color: var(--faint); }
.unread {
  min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px;
  background: var(--amber); color: #14110a; font-weight: 700; font-size: .72em;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 12px rgba(232,184,74,.45);
}

/* ============================================================
   thread
   ============================================================ */
#thread-head {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px; border-bottom: 1px solid var(--line);
  background: rgba(13,15,22,.9); backdrop-filter: blur(10px); flex: 0 0 auto;
}
#thread-head .avatar { width: 38px; height: 38px; flex-basis: 38px; font-size: 19px; }
#back-btn { font-size: 26px; }
.thread-titles { min-width: 0; flex: 1; }
#thread-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#thread-presence { font-size: .78em; }

#msgs {
  flex: 1 1 auto; overflow-y: auto; padding: 14px 12px 8px;
  display: flex; flex-direction: column; gap: 2px;
  scroll-behavior: smooth; overscroll-behavior: contain;
}
.day-sep {
  align-self: center; margin: 14px 0 8px; font-size: .72em; color: var(--faint);
  background: var(--panel); border: 1px solid var(--line);
  padding: 3px 12px; border-radius: 999px;
}

.msg {
  max-width: 84%; padding: 9px 13px; border-radius: var(--radius);
  position: relative; margin-bottom: 6px;
  unicode-bidi: plaintext; word-wrap: break-word; overflow-wrap: break-word;
  animation: msg-in .22s ease;
  border: 1px solid var(--line);
}
@keyframes msg-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.msg.in  { align-self: flex-start; background: var(--panel-2); border-start-start-radius: 4px; }
.msg.out { align-self: flex-end; background: #1f2740; border: 1px solid rgba(90,169,255,.18); border-start-end-radius: 4px; }

.msg .m-agent { font-size: .72em; color: var(--team); font-weight: 700; margin-bottom: 2px; }
.msg .m-body  { unicode-bidi: plaintext; }
.msg .m-body p { margin: 0 0 6px; } .msg .m-body p:last-child { margin: 0; }
.msg .m-body h1, .msg .m-body h2, .msg .m-body h3 { font-size: 1.02em; margin: 8px 0 4px; color: var(--amber); }
.msg .m-body h1 { font-size: 1.1em; }
.msg .m-body ul, .msg .m-body ol { margin: 4px 0; padding-inline-start: 20px; }
.msg .m-body code { font-family: var(--mono); font-size: .86em; background: rgba(0,0,0,.35); padding: 1px 5px; border-radius: 5px; }
.msg .m-body pre { background: rgba(0,0,0,.4); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 9px 11px; overflow-x: auto; direction: ltr; text-align: left; }
.msg .m-body pre code { background: none; padding: 0; }
.md-link { color: var(--blue); border-bottom: 1px dotted var(--blue); cursor: default; }
.md-url { color: var(--faint); font-family: var(--mono); font-size: .82em; direction: ltr; unicode-bidi: isolate; }

.m-meta-url {
  display: inline-block; margin-top: 6px; font-family: var(--mono); font-size: .78em;
  color: var(--dim); background: rgba(0,0,0,.3); border: 1px solid var(--line);
  border-radius: 7px; padding: 3px 8px; cursor: pointer; direction: ltr; unicode-bidi: isolate;
}
.m-foot {
  display: flex; align-items: center; gap: 6px; justify-content: flex-end;
  margin-top: 3px; font-size: .68em; color: var(--faint);
}
.msg.in .m-foot { justify-content: flex-start; }
.m-speak {
  background: none; border: none; cursor: pointer; padding: 4px 6px;
  font-size: 13px; opacity: .55; border-radius: 6px; min-width: 30px; min-height: 26px;
  transition: opacity .15s ease;
}
.m-speak:active { opacity: 1; background: rgba(255,255,255,.06); }
.m-offline-mark { color: var(--amber); }

/* type styling */
.msg.t-action_needed {
  background: linear-gradient(160deg, rgba(232,184,74,.16), rgba(232,184,74,.05));
  border: 1px solid rgba(232,184,74,.45);
  box-shadow: 0 0 18px rgba(232,184,74,.1);
}
.msg.t-action_needed .m-typetag { color: var(--amber); }
.msg.t-question {
  background: linear-gradient(160deg, var(--violet-soft), rgba(177,140,255,.04));
  border: 1px solid rgba(177,140,255,.4);
}
.msg.t-question .m-typetag { color: var(--violet); }
.msg.t-result { border-inline-start: 3px solid var(--green); }
.msg.t-result .m-typetag { color: var(--green); }
.m-typetag { font-size: .7em; font-weight: 700; letter-spacing: .06em; margin-bottom: 3px; display: flex; gap: 5px; align-items: center; }

.msg.t-system {
  align-self: center; max-width: 92%; text-align: center;
  background: none; border: none; color: var(--faint); font-size: .8em; padding: 3px 10px;
  animation: none;
}
.ack-chip {
  align-self: flex-end; margin: -4px 8px 8px 0; font-size: .75em; color: var(--dim);
  background: var(--panel); border: 1px solid var(--line);
  padding: 3px 11px; border-radius: 999px; max-width: 75%;
  unicode-bidi: plaintext; animation: msg-in .22s ease;
}

/* ---------- ticks (7-state alphabet) ---------- */
.tick { display: inline-flex; align-items: center; gap: 3px; transition: color .3s ease, transform .3s ease; }
.tick.st-sent      { color: var(--faint); }
.tick.st-delivered { color: var(--faint); }
.tick.st-acked     { color: var(--blue); animation: tick-pop .3s ease; }
.tick.st-working   { color: var(--blue); }
.tick.st-done      { color: var(--green); cursor: pointer; animation: tick-pop .3s ease; }
.tick.st-failed    { color: var(--red); font-weight: 700; }
.tick.st-stuck     { color: var(--amber); }
@keyframes tick-pop { 0% { transform: scale(.6); } 60% { transform: scale(1.25); } 100% { transform: scale(1); } }
.spinner {
  width: 11px; height: 11px; border-radius: 50%;
  border: 2px solid rgba(90,169,255,.25); border-top-color: var(--blue);
  display: inline-block; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

#new-pill {
  position: absolute; bottom: calc(86px + var(--sab) + var(--kb)); inset-inline-start: 50%;
  transform: translateX(50%);
  background: var(--amber); color: #14110a; font-weight: 700; font-size: .82em;
  border: none; border-radius: 999px; padding: 8px 16px; cursor: pointer;
  box-shadow: 0 6px 20px rgba(0,0,0,.45), 0 0 14px rgba(232,184,74,.4); z-index: 5;
}
html[dir="ltr"] #new-pill { transform: translateX(-50%); }

/* ============================================================
   composer
   ============================================================ */
#composer-wrap {
  flex: 0 0 auto; border-top: 1px solid var(--line);
  background: rgba(13,15,22,.94); backdrop-filter: blur(12px);
  padding: 8px 10px calc(8px + var(--sab));
  transform: translateY(calc(-1 * var(--kb)));
  transition: transform .12s ease-out;
  position: relative; z-index: 4;
}
body.kb-open #composer-wrap { padding-bottom: 8px; }
#composer { display: flex; align-items: flex-end; gap: 8px; }
#input {
  flex: 1; min-width: 0; max-height: 130px; resize: none;
  background: var(--panel-2); color: var(--txt);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 11px 14px; font: inherit; outline: none;
  unicode-bidi: plaintext;
}
#input:focus { border-color: rgba(90,169,255,.4); }
.roundbtn {
  width: var(--tap); height: var(--tap); flex: 0 0 var(--tap);
  border-radius: 50%; border: 1px solid var(--line-strong);
  background: var(--panel-2); font-size: 19px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s ease, transform .1s ease, opacity .15s ease;
  touch-action: none; user-select: none; -webkit-user-select: none;
}
.roundbtn:active { transform: scale(.93); }
.roundbtn.send { background: var(--amber); color: #14110a; border: none; }
.roundbtn.send:disabled { opacity: .35; }
#mic-btn.rec { background: var(--red); color: #fff; border: none; box-shadow: 0 0 0 6px var(--red-soft); }
#mic-btn.mic-denied { opacity: .4; }

#rec-ui, #stt-progress {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 6px 10px; font-size: .9em;
}
.rec-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--red); animation: pulse 1s ease infinite; }
.rec-dot.small { width: 9px; height: 9px; background: var(--blue); }
#rec-timer { font-family: var(--mono); color: var(--red); min-width: 44px; }
#rec-hint { color: var(--dim); flex: 1; animation: hint-slide 1.6s ease infinite; }
@keyframes hint-slide { 0%,100% { opacity: .9; transform: none; } 50% { opacity: .4; transform: translateX(6px); } }
html[dir="ltr"] #rec-hint { animation-name: hint-slide-ltr; }
@keyframes hint-slide-ltr { 0%,100% { opacity: .9; transform: none; } 50% { opacity: .4; transform: translateX(-6px); } }
.rec-lock, .rec-stop, .rec-trash {
  min-width: var(--tap); min-height: var(--tap); border-radius: 50%; cursor: pointer;
  border: 1px solid var(--line-strong); background: var(--panel-2); font-size: 18px;
}
.rec-lock { border-color: var(--amber); box-shadow: 0 0 12px rgba(232,184,74,.35); animation: msg-in .25s ease; }
.rec-stop { background: var(--amber); color: #14110a; border: none; }
#stt-stage { color: var(--blue); }
#stt-elapsed { font-family: var(--mono); color: var(--faint); font-size: .85em; }

#unspoken-chip {
  position: fixed; bottom: calc(64px + var(--sab)); inset-inline-start: 12px; z-index: 30;
  background: var(--panel-2); color: var(--amber); border: 1px solid rgba(232,184,74,.5);
  border-radius: 999px; padding: 9px 16px; font-size: .85em; font-weight: 600; cursor: pointer;
  box-shadow: 0 8px 22px rgba(0,0,0,.5);
  animation: msg-in .25s ease;
}

/* ============================================================
   attention
   ============================================================ */
.att-item {
  width: 100%; text-align: start; cursor: pointer;
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--panel); border: 1px solid var(--line);
  border-inline-start: 3px solid var(--team);
  border-radius: var(--radius); padding: 12px; margin-bottom: 10px;
  transition: background .15s ease;
}
.att-item:active { background: var(--panel-2); }
.att-item .avatar { width: 38px; height: 38px; flex-basis: 38px; font-size: 19px; }
.att-body { flex: 1; min-width: 0; }
.att-top { display: flex; gap: 8px; align-items: baseline; }
.att-agent { font-weight: 700; font-size: .9em; color: var(--team); }
.att-time { font-size: .72em; color: var(--faint); margin-inline-start: auto; }
.att-text { font-size: .9em; margin-top: 3px; unicode-bidi: plaintext; color: var(--txt);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.att-kind { font-size: .72em; font-weight: 700; margin-top: 6px; display: inline-block; padding: 2px 9px; border-radius: 999px; }
.att-kind.action_needed { color: var(--amber); background: var(--amber-soft); }
.att-kind.question { color: var(--violet); background: var(--violet-soft); }
.att-outbound-link {
  width: 100%; text-align: center; cursor: pointer;
  background: var(--amber-soft); color: var(--amber); font-weight: 700;
  border: 1px dashed rgba(232,184,74,.5); border-radius: var(--radius);
  padding: 13px; margin-bottom: 12px; font-size: .92em;
}

/* ============================================================
   approvals (anti-rubber-stamp card)
   ============================================================ */
.appr-card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px; margin-bottom: 14px;
}
.appr-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.appr-head .avatar { width: 38px; height: 38px; flex-basis: 38px; font-size: 19px; }
.appr-agent { font-weight: 700; }
.appr-sendas {
  margin-inline-start: auto; font-size: .75em; font-weight: 700; color: var(--amber);
  background: var(--amber-soft); border: 1px solid rgba(232,184,74,.4);
  padding: 3px 10px; border-radius: 999px;
}
.appr-flags { margin-bottom: 10px; }
.appr-flag {
  display: block; font-size: .82em; color: #ffb6b6;
  background: var(--red-soft); border: 1px solid rgba(255,93,93,.35);
  border-radius: var(--radius-sm); padding: 7px 11px; margin-bottom: 6px;
}
.appr-grid { display: grid; grid-template-columns: auto 1fr; gap: 5px 14px; font-size: .88em; margin-bottom: 10px; }
.appr-grid dt { color: var(--faint); }
.appr-grid dd { margin: 0; min-width: 0; overflow-wrap: break-word; unicode-bidi: plaintext; }
.appr-key { font-family: var(--mono); font-size: .9em; color: var(--blue); }
.appr-chan { text-transform: uppercase; font-size: .82em; letter-spacing: .08em; color: var(--violet); }
.appr-prov {
  font-size: .82em; color: var(--dim); background: rgba(0,0,0,.25);
  border-inline-start: 3px solid var(--line-strong);
  padding: 8px 12px; border-radius: var(--radius-sm); margin-bottom: 10px;
  unicode-bidi: plaintext; white-space: pre-wrap;
}
.appr-prov .lbl { color: var(--faint); font-size: .85em; display: block; margin-bottom: 3px; }
.appr-body {
  white-space: pre-wrap; font-size: .92em; unicode-bidi: plaintext;
  background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 11px 13px; margin-bottom: 12px;
  max-height: 300px; overflow-y: auto;
}
.appr-actions { display: flex; gap: 10px; }
.appr-approve, .appr-reject {
  flex: 1; min-height: var(--tap); border-radius: var(--radius-sm);
  font-weight: 700; cursor: pointer; font-size: .95em;
  transition: transform .1s ease, opacity .2s ease;
}
.appr-approve:active, .appr-reject:active { transform: scale(.97); }
.appr-approve { background: var(--green); color: #06140d; border: none; }
.appr-reject  { background: none; color: var(--red); border: 1px solid rgba(255,93,93,.45); }
.appr-approve:disabled, .appr-reject:disabled { opacity: .4; }
.appr-note-row { display: flex; gap: 8px; margin-top: 10px; }
.appr-note-row input {
  flex: 1; min-width: 0; background: var(--bg); color: var(--txt);
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 10px 12px; font: inherit;
}
.appr-state { font-size: .85em; font-weight: 700; padding: 8px 0; text-align: center; }
.appr-state.approved, .appr-state.sent { color: var(--green); }
.appr-state.rejected, .appr-state.failed { color: var(--red); }

/* ============================================================
   settings
   ============================================================ */
.set-group {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 4px 14px; margin-bottom: 14px;
}
.set-row {
  display: flex; align-items: center; gap: 12px; min-height: 52px;
  padding: 8px 0; border-bottom: 1px solid var(--line);
}
.set-row:last-child { border-bottom: none; }
.set-label { flex: 1; min-width: 0; }
.set-label .sub { display: block; font-size: .78em; color: var(--faint); margin-top: 1px; }
.set-val { font-family: var(--mono); font-size: .82em; color: var(--dim); direction: ltr; unicode-bidi: isolate;
  max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.set-btn {
  min-height: 38px; padding: 0 14px; border-radius: var(--radius-sm); cursor: pointer;
  background: var(--panel-2); border: 1px solid var(--line-strong); color: var(--txt); font-size: .85em;
}
.set-btn.primary { background: var(--amber); color: #14110a; border: none; font-weight: 700; }
.set-btn.danger { color: var(--red); border-color: rgba(255,93,93,.4); }
.seg { display: flex; border: 1px solid var(--line-strong); border-radius: 999px; overflow: hidden; }
.seg button { min-height: 38px; padding: 0 16px; background: none; border: none; cursor: pointer; color: var(--dim); font-size: .88em; }
.seg button.on { background: var(--amber); color: #14110a; font-weight: 700; }
.switch { position: relative; width: 50px; height: 30px; flex: 0 0 50px; border-radius: 15px;
  background: var(--panel-2); border: 1px solid var(--line-strong); cursor: pointer; transition: background .2s ease; }
.switch::after { content: ''; position: absolute; top: 3px; inset-inline-start: 3px;
  width: 22px; height: 22px; border-radius: 50%; background: var(--faint); transition: transform .2s ease, background .2s ease; }
.switch.on { background: var(--amber-soft); border-color: var(--amber); }
.switch.on::after { background: var(--amber); transform: translateX(-20px); }
html[dir="ltr"] .switch.on::after { transform: translateX(20px); }
.rate-row input[type="range"] { flex: 1; accent-color: var(--amber); min-height: 30px; }
.rate-val { font-family: var(--mono); font-size: .82em; color: var(--dim); min-width: 42px; text-align: center; }

/* ============================================================
   toasts
   ============================================================ */
#toast-root { position: fixed; bottom: calc(74px + var(--sab)); inset-inline: 0; z-index: 80;
  display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast {
  background: var(--raise); color: var(--txt); border: 1px solid var(--line-strong);
  border-radius: 999px; padding: 10px 20px; font-size: .88em;
  box-shadow: 0 10px 30px rgba(0,0,0,.5); animation: msg-in .25s ease;
  max-width: 88%; text-align: center; unicode-bidi: plaintext;
}
.toast.err { border-color: rgba(255,93,93,.5); color: #ffc2c2; }
.toast.ok { border-color: rgba(62,207,142,.5); color: #b8f0d8; }

/* ============================================================
   desktop ≥900px: sidebar + thread
   ============================================================ */
@media (min-width: 900px) {
  body { font-size: 15px; }
  #layout { max-width: 1280px; width: 100%; margin: 0 auto; }
  #roster-pane {
    position: relative; display: flex !important; flex: 0 0 340px;
    border-inline-end: 1px solid var(--line);
  }
  #thread-pane { position: relative; display: flex !important; flex: 1; }
  body[data-tab="attention"] #view-attention,
  body[data-tab="approvals"] #view-approvals,
  body[data-tab="settings"]  #view-settings {
    position: relative; flex: 1;
  }
  body[data-tab="attention"] #thread-pane,
  body[data-tab="approvals"] #thread-pane,
  body[data-tab="settings"]  #thread-pane { display: none !important; }
  .page { max-width: 760px; }
  #back-btn { display: none; }
  #tabbar { justify-content: center; }
  .tab { max-width: 140px; }
  .msg { max-width: 66%; }
}
