/* RSC Memory Core — premium refined dark */
:root {
  --bg: #0B0D10; --bg-2: #0E1116;
  --surface: rgba(20, 24, 30, 0.72); --surface-solid: #14181E; --surface-2: #1A1F27; --surface-3: #212833;
  --border: rgba(255,255,255,0.075); --border-2: rgba(255,255,255,0.14);
  --text: #E8ECF1; --text-2: rgba(232,236,241,0.64); --text-3: rgba(232,236,241,0.42);
  --accent: #00ADB5; --accent-2: #22D3EE; --accent-soft: rgba(0,173,181,0.14); --accent-glow: rgba(0,173,181,0.35);
  --good: #4CAF50; --warn: #FFB020; --bad: #FF5A5F; --info: #7B8FFF;
  --s-claude-code: #0891B2; --s-chatgpt: #BD7E0C; --s-claude-desktop: #5A6BE0; --s-codex: #2F9A4B; --s-jarvis: #A33FA3; --s-other: #6b7280;
  --sans: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --r: 14px; --r-sm: 10px; --r-lg: 20px;
  --ease: cubic-bezier(.2,.8,.2,1); --fast: 140ms; --med: 220ms;
  --rail: 232px; --topbar: 60px;
  --shadow: 0 1px 0 rgba(255,255,255,0.03) inset, 0 10px 30px -18px rgba(0,0,0,0.8);
}
* { box-sizing: border-box; }
html { height: 100%; -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100%; background: radial-gradient(1200px 600px at 20% -10%, rgba(0,173,181,0.08), transparent 60%), radial-gradient(900px 500px at 100% 100%, rgba(123,143,255,0.06), transparent 60%), var(--bg); color: var(--text); font: 14px/1.5 var(--sans); -webkit-font-smoothing: antialiased; overscroll-behavior-y: none; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
::selection { background: var(--accent-soft); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }
.only-mobile { display: none !important; }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: var(--rail) 1fr; grid-template-rows: var(--topbar) 1fr; min-height: 100dvh; }
.rail { grid-row: 1 / span 2; position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; padding: 14px 12px; border-right: 1px solid var(--border); background: linear-gradient(180deg, rgba(14,17,22,0.9), rgba(11,13,16,0.9)); backdrop-filter: blur(14px); }
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 16px; }
.brand .core { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: linear-gradient(160deg, rgba(0,173,181,0.35), rgba(0,173,181,0.08)); border: 1px solid rgba(0,173,181,0.35); box-shadow: 0 0 24px -8px var(--accent-glow); }
.brand .core img { width: 20px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text b { font-weight: 700; letter-spacing: .04em; }
.brand-text small { color: var(--text-3); font-size: 11px; }
.rail-items { display: flex; flex-direction: column; gap: 2px; }
.rail-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--r-sm); color: var(--text-2); border: 1px solid transparent; transition: background var(--fast) var(--ease), color var(--fast), transform var(--fast); }
.rail-item i { font-style: normal; width: 20px; text-align: center; color: var(--text-3); font-size: 15px; }
.rail-item:hover { background: rgba(255,255,255,0.04); color: var(--text); }
.rail-item:active { transform: scale(.985); }
.rail-item.active { background: var(--accent-soft); color: var(--text); border-color: rgba(0,173,181,0.25); }
.rail-item.active i { color: var(--accent-2); }
.rail-item.ghost { background: transparent; border: 1px dashed var(--border); width: 100%; text-align: left; }
.rail-item .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); display: inline-block; }
.rail-item.on .dot { background: var(--accent-2); box-shadow: 0 0 10px var(--accent-2); }
.rail-item.armed .dot { animation: pulse 2s infinite; }
.rail-item.speaking .dot { animation: speak .45s infinite alternate; }
.rail-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.rail-status { display: flex; align-items: center; gap: 8px; padding: 6px 10px; color: var(--text-3); font-size: 11px; }
.pip { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); }
.pip.ok { background: var(--good); box-shadow: 0 0 8px rgba(76,175,80,.6); }
.pip.bad { background: var(--bad); box-shadow: 0 0 8px rgba(255,90,95,.6); }
#rail-clock { margin-left: auto; font-family: var(--mono); }

.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; padding: 0 18px; background: linear-gradient(180deg, rgba(11,13,16,0.92), rgba(11,13,16,0.75)); backdrop-filter: blur(14px); border-bottom: 1px solid var(--border); }
.cmd { flex: 1; max-width: 640px; display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 12px; border: 1px solid var(--border); background: rgba(255,255,255,0.03); color: var(--text-3); text-align: left; transition: border-color var(--fast), background var(--fast), box-shadow var(--fast); }
.cmd:hover { border-color: var(--border-2); background: rgba(255,255,255,0.05); }
.cmd:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.cmd-glyph { font-family: var(--mono); font-size: 11px; padding: 2px 6px; border-radius: 6px; background: rgba(255,255,255,0.06); color: var(--text-2); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.live-pill { display: inline-flex; align-items: center; gap: 7px; padding: 6px 10px; border-radius: 999px; border: 1px solid var(--border); font-size: 12px; color: var(--text-2); }
.live-pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); }
.live-pill.on i { background: var(--good); box-shadow: 0 0 8px rgba(76,175,80,.7); animation: pulse 2.4s infinite; }
.live-pill.off i { background: var(--bad); }
.icon-btn { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--border); background: rgba(255,255,255,0.03); color: var(--text-2); display: inline-grid; place-items: center; transition: background var(--fast), color var(--fast), transform var(--fast); }
.icon-btn:hover { background: rgba(255,255,255,0.06); color: var(--text); }
.icon-btn:active { transform: scale(.96); }

.view-host { padding: 22px 24px 40px; min-width: 0; }
.view { animation: viewin var(--med) var(--ease); }
@keyframes viewin { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .45; } }
@keyframes speak { from { transform: scale(.7); opacity: .6; } to { transform: scale(1.5); opacity: 1; } }

/* ---------- primitives ---------- */
.page-head { display: flex; align-items: flex-end; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 22px; font-weight: 600; letter-spacing: -0.01em; }
.page-head .sub { color: var(--text-3); font-size: 13px; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--border); background: rgba(255,255,255,0.04); color: var(--text); font-weight: 500; transition: background var(--fast), border-color var(--fast), transform var(--fast), box-shadow var(--fast); }
.btn:hover { background: rgba(255,255,255,0.07); border-color: var(--border-2); }
.btn:active { transform: scale(.97); }
.btn.primary { background: linear-gradient(180deg, var(--accent-2), var(--accent)); color: #04181A; border-color: transparent; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.sm { padding: 6px 10px; font-size: 12px; }
.btn[disabled] { opacity: .5; cursor: default; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow); backdrop-filter: blur(10px); }
.card-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); font-weight: 600; font-size: 13px; }
.card-head .sub { color: var(--text-3); font-weight: 400; font-size: 12px; }
.card-head .spacer { flex: 1; }
.card-body { padding: 16px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px; border-radius: 999px; border: 1px solid var(--border); font-size: 11px; color: var(--text-2); }
.chip.good { color: var(--good); border-color: rgba(76,175,80,.35); background: rgba(76,175,80,.08); }
.chip.warn { color: var(--warn); border-color: rgba(255,176,32,.35); background: rgba(255,176,32,.08); }
.chip.bad { color: var(--bad); border-color: rgba(255,90,95,.35); background: rgba(255,90,95,.08); }
.chip.accent { color: var(--accent-2); border-color: rgba(0,173,181,.35); background: var(--accent-soft); }
.field { display: flex; align-items: center; gap: 8px; }
.input, select.input { padding: 8px 10px; border-radius: 10px; border: 1px solid var(--border); background: rgba(0,0,0,0.25); color: var(--text); min-width: 0; transition: border-color var(--fast), box-shadow var(--fast); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.skeleton { position: relative; overflow: hidden; background: rgba(255,255,255,0.05); border-radius: 8px; color: transparent !important; }
.skeleton::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,0.07), transparent); animation: shimmer 1.4s infinite; }
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
.empty { padding: 28px; text-align: center; color: var(--text-3); }
.err { color: var(--bad); font-size: 12px; }

/* ---------- home ---------- */
.home-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.tile { position: relative; padding: 14px 16px 14px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); transition: transform var(--fast) var(--ease), border-color var(--fast), background var(--fast); cursor: pointer; overflow: hidden; min-height: 108px; }
.tile:hover { transform: translateY(-2px); border-color: var(--border-2); background: rgba(24,29,36,0.85); }
.tile:active { transform: scale(.985); }
.tile::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--tone, var(--accent)); opacity: .9; }
.tile .label { color: var(--text-2); font-size: 12px; font-weight: 500; }
.tile .value { margin-top: 8px; font-size: 26px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.tile .value.text { font-size: 17px; font-weight: 600; }
.tile .unit { color: var(--text-3); font-size: 13px; font-weight: 500; margin-left: 4px; }
.tile .sub { margin-top: 6px; color: var(--text-3); font-size: 12px; }
.tile.good { --tone: var(--good); } .tile.warn { --tone: var(--warn); } .tile.bad { --tone: var(--bad); } .tile.err { --tone: var(--bad); opacity: .8; }
.brief { position: sticky; top: calc(var(--topbar) + 16px); }
.brief-text { font-size: 15px; line-height: 1.65; color: var(--text); white-space: pre-wrap; }
.brief-text.muted { color: var(--text-3); font-style: italic; }
.brief-actions { display: flex; gap: 8px; margin-top: 14px; }
.updated { color: var(--text-3); font-size: 12px; font-family: var(--mono); }

/* ---------- talk ---------- */
.talk { display: grid; grid-template-rows: auto 1fr auto; height: calc(100dvh - var(--topbar) - 44px); gap: 12px; }
.talk-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.state { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 999px; border: 1px solid var(--border); font-size: 12px; color: var(--text-2); font-family: var(--mono); letter-spacing: .06em; }
.state i { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); }
.state.listening i { background: var(--accent-2); box-shadow: 0 0 10px var(--accent-2); animation: pulse 1.4s infinite; }
.state.thinking i { background: var(--warn); animation: pulse .8s infinite; }
.state.speaking i { background: var(--good); animation: speak .45s infinite alternate; }
.state.offline i { background: var(--bad); }
.transcript { overflow-y: auto; padding: 4px 4px 12px; display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.msg { max-width: min(760px, 92%); padding: 12px 14px; border-radius: 16px; line-height: 1.55; animation: viewin var(--med) var(--ease); }
.msg.you { align-self: flex-end; background: var(--accent-soft); border: 1px solid rgba(0,173,181,0.25); border-bottom-right-radius: 6px; }
.msg.jarvis { align-self: flex-start; background: var(--surface-solid); border: 1px solid var(--border); border-bottom-left-radius: 6px; }
.msg.jarvis.speaking::after { content: "▍"; color: var(--accent-2); animation: pulse .6s infinite; }
.msg.sys { align-self: center; font-size: 12px; color: var(--text-3); background: transparent; border: 1px dashed var(--border); }
.msg .tools { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.msg .meta { display: block; margin-top: 6px; color: var(--text-3); font-size: 11px; font-family: var(--mono); }
.composer { display: flex; align-items: center; gap: 8px; padding: 8px; border-radius: 16px; border: 1px solid var(--border); background: var(--surface-solid); box-shadow: var(--shadow); }
.composer input { flex: 1; min-width: 0; background: transparent; border: 0; padding: 10px 12px; font-size: 15px; }
.composer input:focus { outline: none; }
.mic { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--border); background: rgba(255,255,255,0.04); color: var(--text-2); display: grid; place-items: center; transition: all var(--fast); }
.mic:hover { color: var(--text); border-color: var(--border-2); }
.mic.on { color: var(--accent-2); border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 4px rgba(0,173,181,0.12); }
.mic.listening { animation: pulse 1.2s infinite; }
.vu { display: flex; align-items: flex-end; gap: 3px; height: 26px; width: 84px; }
.vu i { flex: 1; height: 3px; background: var(--accent); border-radius: 2px; transition: height .09s linear; opacity: .9; }
.vu.speaking i { background: var(--good); }

/* ---------- memory ---------- */
.memory { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 16px; height: calc(100dvh - var(--topbar) - 44px); }
.notes-list { display: flex; flex-direction: column; min-height: 0; }
.notes-list .card-body { padding: 10px; overflow-y: auto; flex: 1; }
.folder { font-family: var(--mono); font-size: 10px; letter-spacing: .16em; color: var(--text-3); padding: 10px 8px 4px; text-transform: uppercase; }
.note-row { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; cursor: pointer; color: var(--text-2); transition: background var(--fast), color var(--fast); }
.note-row:hover { background: rgba(255,255,255,0.04); color: var(--text); }
.note-row.active { background: var(--accent-soft); color: var(--text); }
.note-row i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.note-row small { margin-left: auto; color: var(--text-3); font-family: var(--mono); font-size: 10px; }
.note-view { display: flex; flex-direction: column; min-height: 0; }
.note-view .card-body { overflow-y: auto; flex: 1; }
.note-md h1 { display: none; }
.note-md h2 { font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--accent-2); margin: 20px 0 8px; }
.note-md ul { list-style: none; padding: 0; margin: 0; }
.note-md li { padding: 7px 0; border-bottom: 1px solid var(--border); }
.note-md .cat { font-family: var(--mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--accent-2); background: var(--accent-soft); padding: 2px 6px; border-radius: 5px; margin-right: 8px; }
.note-md .rel { color: var(--text-3); font-family: var(--mono); font-size: 11px; margin-right: 8px; }
.note-md a[data-note] { color: var(--accent-2); border-bottom: 1px dotted var(--accent-2); cursor: pointer; }
#graph { width: 100%; height: 100%; display: block; cursor: grab; }
.node circle { stroke: rgba(0,0,0,.6); stroke-width: 1px; }
.node text { font-family: var(--mono); font-size: 10px; fill: var(--text-2); pointer-events: none; paint-order: stroke; stroke: rgba(11,13,16,.9); stroke-width: 3px; }
.node.focus circle { stroke: #fff; stroke-width: 2px; }
.node.ghost circle { fill: transparent; stroke: var(--text-3); stroke-dasharray: 2 2; }
.link { stroke: rgba(0,173,181,0.22); }
.link.hot { stroke: var(--accent-2); stroke-width: 1.5px; }
.cluster-label { font-family: var(--mono); font-size: 10px; letter-spacing: .3em; fill: rgba(0,173,181,.55); text-transform: uppercase; }

/* ---------- ops ---------- */
.tabs { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: rgba(255,255,255,0.03); border: 1px solid var(--border); width: max-content; max-width: 100%; overflow-x: auto; }
.tab { padding: 7px 12px; border-radius: 9px; color: var(--text-2); font-weight: 500; white-space: nowrap; transition: background var(--fast), color var(--fast); }
.tab:hover { color: var(--text); }
.tab.active { background: var(--surface-3); color: var(--text); box-shadow: 0 1px 0 rgba(255,255,255,.04) inset; }
.ops-grid { display: grid; gap: 14px; margin-top: 14px; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.toolbar .spacer { flex: 1; }
.table-wrap { overflow: auto; max-height: 62vh; }
table.data { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
table.data th { position: sticky; top: 0; background: var(--surface-solid); text-align: left; padding: 9px 12px; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); border-bottom: 1px solid var(--border); cursor: pointer; user-select: none; white-space: nowrap; }
table.data th.sorted { color: var(--accent-2); }
table.data td { padding: 9px 12px; border-bottom: 1px solid var(--border); color: var(--text); vertical-align: top; }
table.data td.num { font-family: var(--mono); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
table.data th.num { text-align: right; }
table.data tr:hover td { background: rgba(255,255,255,0.025); }
table.data td .status { font-family: var(--mono); font-size: 11px; padding: 2px 7px; border-radius: 6px; background: rgba(255,255,255,.06); }
table.data td a { color: var(--accent-2); }
.kpis { display: flex; gap: 10px; flex-wrap: wrap; padding: 12px 16px; }
.kpi { min-width: 150px; }
.kpi .k { font-size: 11px; color: var(--text-3); letter-spacing: .06em; text-transform: uppercase; }
.kpi .v { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; margin-top: 2px; }

/* ---------- feed ---------- */
.feed-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 16px; align-items: start; }
.events { list-style: none; margin: 0; padding: 4px 0; max-height: 70vh; overflow-y: auto; }
.events li { display: grid; grid-template-columns: 10px 1fr auto; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); animation: viewin var(--med) var(--ease); }
.events li i { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; }
.events li .who { font-weight: 600; }
.events li .verb { color: var(--text-2); }
.events li .what { color: var(--accent-2); word-break: break-word; }
.events li .what.write { color: var(--good); }
.events li .sub { display: block; color: var(--text-3); font-size: 11px; font-family: var(--mono); margin-top: 2px; }
.events li time { color: var(--text-3); font-size: 11px; font-family: var(--mono); white-space: nowrap; margin-top: 4px; }
.events li.hist { opacity: .55; }
#chart { width: 100%; height: auto; display: block; }
#chart .grid-line { stroke: var(--border); }
#chart .axis-text { font-family: var(--mono); font-size: 10px; fill: var(--text-3); }
#chart .total { font-family: var(--mono); font-size: 10px; fill: var(--text-2); text-anchor: middle; }
#chart rect.hit { fill: transparent; }
#chart rect.hit:hover { fill: rgba(255,255,255,0.04); }
.legend { display: flex; flex-wrap: wrap; gap: 12px; padding: 10px 2px 0; font-size: 12px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.tip { position: fixed; z-index: 60; pointer-events: none; background: var(--surface-solid); border: 1px solid var(--border-2); border-radius: 10px; padding: 8px 10px; font-size: 12px; box-shadow: 0 12px 40px rgba(0,0,0,.6); display: none; min-width: 160px; }
.tip b { display: block; font-family: var(--mono); font-size: 10px; color: var(--text-3); margin-bottom: 4px; }
.tip div { display: flex; justify-content: space-between; gap: 14px; }
.tip i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; margin-right: 6px; }

/* ---------- integrations ---------- */
.int-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.int { display: flex; flex-direction: column; gap: 8px; padding: 16px; }
.int .name { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.int .desc { color: var(--text-3); font-size: 12px; }
.int .row { display: flex; align-items: center; gap: 8px; margin-top: auto; }

/* ---------- palette / drawer / toasts ---------- */
.palette { position: fixed; inset: 0; z-index: 80; background: rgba(5,7,9,0.6); backdrop-filter: blur(6px); display: grid; place-items: start center; padding-top: 12vh; animation: fade var(--fast); }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.palette-card { width: min(680px, calc(100% - 32px)); background: var(--surface-solid); border: 1px solid var(--border-2); border-radius: 16px; box-shadow: 0 30px 80px rgba(0,0,0,.7), 0 0 60px -20px var(--accent-glow); overflow: hidden; animation: viewin var(--med) var(--ease); }
.palette-card input { width: 100%; padding: 16px 18px; background: transparent; border: 0; font-size: 16px; }
.palette-card input:focus { outline: none; }
#palette-list { list-style: none; margin: 0; padding: 6px; border-top: 1px solid var(--border); max-height: 50vh; overflow-y: auto; }
#palette-list li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--text-2); cursor: pointer; }
#palette-list li i { font-style: normal; width: 22px; text-align: center; color: var(--text-3); }
#palette-list li.active, #palette-list li:hover { background: var(--accent-soft); color: var(--text); }
#palette-list li small { margin-left: auto; color: var(--text-3); font-family: var(--mono); font-size: 11px; }
.palette-foot { display: flex; gap: 16px; padding: 8px 14px; border-top: 1px solid var(--border); color: var(--text-3); font-size: 11px; font-family: var(--mono); }
.drawer { position: fixed; inset: 0; z-index: 70; background: rgba(5,7,9,0.5); backdrop-filter: blur(4px); display: flex; justify-content: flex-end; animation: fade var(--fast); }
.drawer-card { width: min(560px, 100%); height: 100%; background: var(--bg-2); border-left: 1px solid var(--border-2); overflow-y: auto; animation: slidein var(--med) var(--ease); }
@keyframes slidein { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-card header { position: sticky; top: 0; display: flex; align-items: flex-start; gap: 10px; padding: 18px 20px; background: var(--bg-2); border-bottom: 1px solid var(--border); }
.drawer-card h2 { margin: 0; font-size: 18px; }
.drawer-card .meta { color: var(--text-3); font-size: 12px; margin-top: 4px; font-family: var(--mono); }
.drawer-body { padding: 8px 20px 40px; }
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 90; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 10px 14px; border-radius: 12px; background: var(--surface-solid); border: 1px solid var(--border-2); box-shadow: 0 12px 40px rgba(0,0,0,.6); font-size: 13px; animation: viewin var(--med) var(--ease); max-width: 360px; }
.toast.bad { border-color: rgba(255,90,95,.5); }
.toast.good { border-color: rgba(76,175,80,.5); }

/* ---------- mobile ---------- */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: flex; justify-content: space-around; padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); background: rgba(11,13,16,0.92); backdrop-filter: blur(14px); border-top: 1px solid var(--border); }
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 10px; border-radius: 10px; color: var(--text-3); font-size: 11px; }
.tabbar a i { font-style: normal; font-size: 18px; }
.tabbar a.active { color: var(--accent-2); }
.fab { position: fixed; right: 16px; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 45; width: 60px; height: 60px; border-radius: 50%; border: 0; background: linear-gradient(180deg, var(--accent-2), var(--accent)); color: #04181A; box-shadow: 0 12px 30px -8px var(--accent-glow), 0 0 0 6px rgba(0,173,181,0.12); display: grid; place-items: center; transition: transform var(--fast); }
.fab:active { transform: scale(.94); }
.fab.on { animation: pulse 1.4s infinite; }
@media (max-width: 900px) {
  .only-mobile { display: inline-flex !important; }
  .app { grid-template-columns: 1fr; }
  .rail { position: fixed; z-index: 50; left: 0; top: 0; width: 260px; transform: translateX(-100%); transition: transform var(--med) var(--ease); box-shadow: 0 0 60px rgba(0,0,0,.6); }
  .rail.open { transform: none; }
  .view-host { padding: 14px 14px calc(96px + env(safe-area-inset-bottom)); }
  .home-grid, .feed-grid, .memory { grid-template-columns: 1fr; }
  .memory { height: auto; }
  .notes-list .card-body { max-height: 40vh; }
  .brief { position: static; }
  .talk { height: calc(100dvh - var(--topbar) - 110px); }
  .tile .value { font-size: 24px; }
  .cmd-text { font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .001s !important; transition-duration: .001s !important; } }

/* ---- settings ---- */
.set-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; align-items: start; }
.set-body { padding: 16px; display: flex; flex-direction: column; gap: 18px; }
.setting { display: flex; flex-direction: column; gap: 8px; }
.setting > label { font-size: 12px; color: var(--text-2); font-weight: 600; letter-spacing: .01em; }
.setting > label b { color: var(--accent-2); font-weight: 500; }
.set-hint { margin: 0; font-size: 12px; color: var(--text-3); line-height: 1.5; }
.set-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; background: var(--surface-solid); border: 1px solid var(--border); border-radius: 10px; padding: 4px; }
.seg button { padding: 8px 6px; line-height: 1.25; font: inherit; font-size: 12px; color: var(--text-2); background: transparent; border: 0; border-radius: 7px; cursor: pointer; transition: background .14s ease, color .14s ease; }
.seg button:hover { color: var(--text); background: rgba(255,255,255,.04); }
.seg button.on { background: var(--accent-dim); color: var(--accent-2); font-weight: 600; }
.seg button:focus-visible, .setting select:focus-visible, .setting input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.setting select { appearance: none; width: 100%; padding: 9px 12px; font: inherit; font-size: 13px; color: var(--text); background: var(--surface-solid); border: 1px solid var(--border); border-radius: 9px; cursor: pointer; }
.setting input[type=range] { width: 100%; accent-color: var(--accent); height: 22px; cursor: pointer; }

/* ---- speak control on an answer ---- */
.msg { position: relative; }
.msg.jarvis { padding-right: 38px; }
.speak-btn { position: absolute; top: 8px; right: 8px; width: 24px; height: 24px; display: grid; place-items: center; font-size: 10px; line-height: 1; color: var(--text-3); background: transparent; border: 1px solid var(--border); border-radius: 50%; cursor: pointer; opacity: 0; transition: opacity .14s ease, color .14s ease, border-color .14s ease; }
.msg:hover .speak-btn, .speak-btn:focus-visible { opacity: 1; }
.speak-btn:hover { color: var(--accent-2); border-color: var(--accent); }
body.speaking .msg .speak-btn { opacity: 1; }
@media (hover: none) { .speak-btn { opacity: 1; } }
