:root {
  --bg: #f6f5f1;
  --panel: #ffffff;
  --panel-2: #fbfaf7;
  --ink: #1d1c1a;
  --ink-2: #5d5a54;
  --ink-3: #8f8b83;
  --line: #e7e4dc;
  --line-2: #efece5;
  --accent: #6d5efc;
  --accent-ink: #ffffff;
  --accent-soft: #eeebff;
  --ok: #1f9d63;
  --ok-soft: #e3f5ec;
  --warn: #c27a06;
  --warn-soft: #fdf1dc;
  --bad: #d14343;
  --bad-soft: #fbe7e7;
  --user-bubble: #1d1c1a;
  --user-ink: #f6f5f1;
  --shadow: 0 1px 2px rgba(30, 25, 10, .05), 0 8px 24px rgba(30, 25, 10, .06);
  --radius: 14px;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131312; --panel: #1b1b19; --panel-2: #20201e; --ink: #edebe6; --ink-2: #b3afa6; --ink-3: #7f7b73;
    --line: #2c2b28; --line-2: #262523; --accent: #8b7fff; --accent-soft: #2a2647; --ok-soft: #173225;
    --warn-soft: #3a2c12; --bad-soft: #3d1d1d; --user-bubble: #edebe6; --user-ink: #161614;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #131312; --panel: #1b1b19; --panel-2: #20201e; --ink: #edebe6; --ink-2: #b3afa6; --ink-3: #7f7b73;
  --line: #2c2b28; --line-2: #262523; --accent: #8b7fff; --accent-soft: #2a2647; --ok-soft: #173225;
  --warn-soft: #3a2c12; --bad-soft: #3d1d1d; --user-bubble: #edebe6; --user-ink: #161614;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25); color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 15px/1.5 "Instrument Sans", "Noto Sans Tamil", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--accent); }
[hidden] { display: none !important; }

#app { display: grid; grid-template-columns: 264px minmax(0, 1fr); height: 100vh; }

/* ---------- rail ---------- */
#rail {
  border-right: 1px solid var(--line); padding: 18px 14px; display: flex; flex-direction: column;
  gap: 6px; overflow-y: auto; background: var(--panel-2);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; padding: 4px 8px 14px; letter-spacing: -.01em; }
.brand-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.rail-label { font-size: 12px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; padding: 6px 8px; }
#dot-list { display: flex; flex-direction: column; gap: 2px; }
.dot-item {
  display: flex; gap: 11px; align-items: center; padding: 9px 10px; border-radius: 10px; cursor: pointer;
  border: 1px solid transparent; background: none; text-align: left; width: 100%;
}
.dot-item:hover { background: var(--line-2); }
.dot-item.active { background: var(--panel); border-color: var(--line); box-shadow: var(--shadow); }
.dot-item .meta { min-width: 0; flex: 1; }
.dot-item .name { font-weight: 600; display: flex; align-items: center; gap: 6px; }
.dot-item .sub { font-size: 12.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.new-dot { margin-top: 6px; justify-content: flex-start; }
.rail-foot { margin-top: auto; display: flex; flex-direction: column; gap: 2px; padding-top: 14px; border-top: 1px solid var(--line); }
.rail-link { background: none; border: 0; text-align: left; padding: 9px 10px; border-radius: 10px; cursor: pointer; display: flex; align-items: center; justify-content: space-between; color: var(--ink-2); font-weight: 500; }
.rail-link:hover { background: var(--line-2); color: var(--ink); }
.badge { background: var(--bad); color: #fff; border-radius: 999px; font-size: 11.5px; font-weight: 700; padding: 1px 7px; }

/* ---------- avatar ---------- */
.av { --c: var(--accent); width: 30px; height: 30px; border-radius: 50%; background: var(--c); flex: none; position: relative; }
.av::after { content: ""; position: absolute; inset: 9px; border-radius: 50%; background: rgba(255,255,255,.35); }
.av.lg { width: 46px; height: 46px; }
.av.lg::after { inset: 14px; }
.av.working { animation: breathe 1.6s ease-in-out infinite; }
.av.working::before { content: ""; position: absolute; inset: -5px; border-radius: 50%; border: 2px solid var(--c); opacity: .4; animation: ring 1.6s ease-out infinite; }
@keyframes breathe { 50% { transform: scale(.9); } }
@keyframes ring { from { transform: scale(.85); opacity: .6; } to { transform: scale(1.35); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .av.working, .av.working::before { animation: none; } }

/* ---------- main ---------- */
#main { display: flex; flex-direction: column; min-width: 0; height: 100vh; }
.head { display: flex; align-items: center; gap: 14px; padding: 18px 28px 0; }
.head h1 { margin: 0; font-size: 22px; letter-spacing: -.02em; }
.head .status { color: var(--ink-3); font-size: 13.5px; }
.head .actions { margin-left: auto; display: flex; gap: 8px; }
.tabs { display: flex; gap: 2px; padding: 14px 24px 0; border-bottom: 1px solid var(--line); overflow-y: hidden; scrollbar-width: none; flex: none; }
.tab { white-space: nowrap; background: none; border: 0; padding: 9px 12px 11px; cursor: pointer; color: var(--ink-3); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); border-bottom-color: var(--ink); }
.tab .badge { margin-left: 6px; }
.pane { flex: 1; overflow-y: auto; padding: 22px 28px 28px; min-height: 0; }
.pane.chat { display: flex; flex-direction: column; padding: 0; }
.narrow { max-width: 820px; margin: 0 auto; width: 100%; }

/* ---------- buttons & inputs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; font-weight: 600; font-size: 14px; white-space: nowrap; }
.btn:hover { border-color: var(--ink-3); }
a.btn { text-decoration: none; color: var(--ink); }
.btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn.primary:hover { opacity: .9; }
.btn.accent { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.ghost { background: none; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--line-2); }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: default; }
input[type=text], input[type=password], input[type=number], textarea, select {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; min-height: 70px; }
label.f { display: block; font-weight: 600; font-size: 13.5px; margin: 14px 0 6px; }
.hint { color: var(--ink-3); font-size: 13px; margin-top: 4px; }
.row { display: flex; gap: 10px; align-items: center; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }

/* ---------- chat ---------- */
.msgs { flex: 1; overflow-y: auto; padding: 24px 28px 8px; }
.msgs .narrow { display: flex; flex-direction: column; gap: 14px; }
.msg { display: flex; gap: 10px; max-width: 100%; }
.msg > div:last-child { min-width: 0; max-width: min(640px, 85%); }
.msg .bubble { padding: 10px 14px; border-radius: 16px; overflow-wrap: break-word; word-break: break-word; }
.msg.dot .bubble { background: var(--panel); border: 1px solid var(--line); border-top-left-radius: 6px; }
.msg.user { justify-content: flex-end; }
.msg.user .bubble { background: var(--user-bubble); color: var(--user-ink); border-top-right-radius: 6px; white-space: pre-wrap; }
.msg .time { font-size: 11.5px; color: var(--ink-3); margin-top: 3px; }
.msg.user .time { text-align: right; }
.msg .av { width: 22px; height: 22px; margin-top: 6px; }
.msg .av::after { inset: 6px; }
.bubble p { margin: 0 0 8px; } .bubble p:last-child { margin-bottom: 0; }
.bubble ul, .bubble ol { margin: 4px 0 8px; padding-left: 20px; }
.bubble pre { background: var(--panel-2); border: 1px solid var(--line); padding: 10px; border-radius: 8px; overflow-x: auto; font: 12.5px/1.5 var(--mono); }
.bubble code { font: 12.5px var(--mono); background: var(--line-2); padding: 1px 5px; border-radius: 5px; }
.bubble pre code { background: none; padding: 0; }
.bubble h3, .bubble h4 { margin: 10px 0 4px; font-size: 15px; }
.typing { display: inline-flex; gap: 4px; padding: 14px; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-3); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.composer { padding: 10px 28px 20px; }
.composer .box { display: flex; gap: 8px; align-items: flex-end; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 8px 8px 8px 14px; box-shadow: var(--shadow); }
.composer textarea { border: 0; box-shadow: none !important; padding: 6px 0; min-height: 24px; max-height: 200px; resize: none; background: none; }
.empty { text-align: center; color: var(--ink-3); padding: 60px 20px; }
.empty .big { font-size: 18px; color: var(--ink); font-weight: 600; margin-bottom: 6px; }
.suggest { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 16px; }
.chip { border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 6px 12px; cursor: pointer; font-size: 13.5px; color: var(--ink-2); }
.chip:hover { border-color: var(--accent); color: var(--ink); }

/* ---------- cards ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.card + .card { margin-top: 12px; }
.card h3 { margin: 0; font-size: 15.5px; }
.pill { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; text-transform: uppercase; letter-spacing: .04em; }
.pill.active { background: var(--ok-soft); color: var(--ok); }
.pill.paused { background: var(--warn-soft); color: var(--warn); }
.pill.done { background: var(--line-2); color: var(--ink-3); }
.goal-head { display: flex; gap: 10px; align-items: center; }
.goal-head .acts { margin-left: auto; display: flex; gap: 4px; }
.goal-details { color: var(--ink-2); margin: 8px 0 0; white-space: pre-wrap; }
.progress { margin-top: 10px; background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 10px; padding: 10px 12px; font-size: 13.5px; white-space: pre-wrap; color: var(--ink-2); max-height: 220px; overflow-y: auto; }
.section-title { font-size: 13px; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; margin: 26px 0 10px; }

/* approval */
.approval { border-left: 3px solid var(--warn); }
.approval .what { font-weight: 600; }
.approval pre { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px; font: 12.5px/1.5 var(--mono); max-height: 240px; overflow: auto; white-space: pre-wrap; margin: 10px 0; }
.approval-strip { padding: 0 28px; }
.approval-strip .card { padding: 12px 14px; }

/* computer */
.computer { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(260px, 1fr); gap: 18px; height: 100%; }
.computer > div { min-height: 0; display: flex; flex-direction: column; }
.screen { background: #0f0f0e; color: #d9d6cf; border-radius: var(--radius); padding: 6px 0; overflow-y: auto; flex: 1; font: 12.5px/1.55 var(--mono); border: 1px solid #262522; }
.screen .bar { display: flex; gap: 6px; padding: 6px 14px 10px; border-bottom: 1px solid #262522; margin-bottom: 4px; position: sticky; top: -6px; background: #0f0f0e; }
.screen .bar i { width: 10px; height: 10px; border-radius: 50%; background: #3a3936; }
.screen .bar span { margin-left: 8px; color: #7f7b73; font-size: 11.5px; }
.act { padding: 3px 14px; cursor: pointer; display: flex; gap: 10px; }
.act:hover { background: #1a1a18; }
.act .t { color: #6b6862; flex: none; }
.act .k { flex: none; width: 74px; }
.act .ti { min-width: 0; overflow-wrap: anywhere; }
.k-tool { color: #8fb8ff; } .k-tool-result { color: #9ad3a8; } .k-web { color: #d6a8ff; } .k-web-result { color: #b59ad8; }
.k-thought { color: #8f8b83; font-style: italic; } .k-error { color: #ff8a8a; } .k-session { color: #e0c070; }
.k-summary { color: #fff; } .k-info { color: #9ec7c7; }
.act-detail { margin: 2px 14px 8px 98px; padding: 8px 10px; background: #1a1a18; border-radius: 6px; white-space: pre-wrap; color: #bdb9b0; max-height: 360px; overflow: auto; }
.files { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); flex: 1; overflow-y: auto; }
.file { display: flex; justify-content: space-between; gap: 10px; padding: 9px 14px; border-bottom: 1px solid var(--line-2); cursor: pointer; font-size: 13.5px; }
.file:hover { background: var(--panel-2); }
.file .p { font-family: var(--mono); font-size: 12.5px; overflow-wrap: anywhere; }
.file .s { color: var(--ink-3); font-size: 12px; flex: none; }
.pane-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; font-weight: 700; }

/* memory */
.mem { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.mem .txt { flex: 1; }
.mem .src { font-size: 12px; color: var(--ink-3); }

/* boundaries */
.perm { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line-2); }
.seg { display: inline-flex; background: var(--line-2); border-radius: 10px; padding: 3px; flex: none; }
.seg button { border: 0; background: none; padding: 6px 12px; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 13px; color: var(--ink-2); }
.seg button.on { background: var(--panel); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.seg button.on[data-v=allow] { color: var(--ok); } .seg button.on[data-v=ask] { color: var(--warn); } .seg button.on[data-v=never] { color: var(--bad); }
.colors { display: flex; gap: 8px; }
.colors button { width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; }
.colors button.on { border-color: var(--ink); }

/* modal & toast */
.modal { position: fixed; inset: 0; background: rgba(15, 14, 10, .45); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal-card { background: var(--panel); border-radius: 18px; width: min(620px, 100%); max-height: 90vh; overflow-y: auto; padding: 26px; position: relative; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal-card.wide { width: min(980px, 100%); }
.modal-card h2 { margin: 0 0 6px; font-size: 20px; letter-spacing: -.01em; }
.modal-x { position: absolute; top: 14px; right: 16px; border: 0; background: none; font-size: 24px; cursor: pointer; color: var(--ink-3); }
.modal pre.file-view { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 14px; font: 12.5px/1.55 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 65vh; overflow: auto; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; z-index: 60; font-weight: 500; box-shadow: var(--shadow); max-width: calc(100% - 32px); }

/* welcome */
.welcome { max-width: 560px; margin: 8vh auto; padding: 0 16px; }
.welcome h1 { font-size: 34px; letter-spacing: -.03em; margin: 18px 0 8px; line-height: 1.15; }
.welcome p { color: var(--ink-2); }
.dots-hero { display: flex; gap: 10px; }
.dots-hero span { width: 18px; height: 18px; border-radius: 50%; }
.feature-list { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 22px 0; }
.feature-list div { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font-size: 13.5px; color: var(--ink-2); }
.feature-list b { display: block; color: var(--ink); margin-bottom: 2px; }

/* login */
body.logged-out #app { grid-template-columns: minmax(0, 1fr); }
body.logged-out #rail { display: none; }
.welcome.login { max-width: 420px; }
.welcome.wide { max-width: 760px; }
.whoami { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 8px 10px 0; font-size: 12.5px; color: var(--ink-3); }

/* templates */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; margin: 18px 0 6px; }
.tpl { text-align: left; background: var(--panel); border: 1.5px solid var(--line); border-radius: 14px; padding: 14px; cursor: pointer; display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; color: var(--ink-2); }
.tpl b { color: var(--ink); font-size: 15px; }
.tpl:hover { border-color: var(--ink-3); }
.tpl.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.tpl .av { width: 22px; height: 22px; } .tpl .av::after { inset: 6px; }

/* composer extras */
.icon-btn { border: 0; background: none; cursor: pointer; font-size: 18px; padding: 6px; border-radius: 10px; position: relative; line-height: 1; flex: none; }
.icon-btn:hover { background: var(--line-2); }
.icon-btn small { position: absolute; right: 0; bottom: 0; font-size: 9px; font-weight: 700; color: var(--ink-3); }
.icon-btn.rec { background: var(--bad-soft); animation: blink 1.2s infinite; }
.attached { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.linkish { border: 0; background: none; cursor: pointer; padding: 0; font-size: 12px; opacity: .6; }
.linkish:hover { opacity: 1; }

/* routines */
.routine { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.routine .rt { flex: 1; min-width: 0; }
.routine .rt .hint { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.routine-add { display: flex; flex-direction: column; gap: 8px; padding-top: 14px; }
.routine-add select, .routine-add input[type=time] { width: auto; }
.switch { position: relative; width: 36px; height: 20px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--line); border-radius: 999px; cursor: pointer; transition: .2s; }
.switch span::before { content: ""; position: absolute; width: 14px; height: 14px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::before { transform: translateX(16px); }
input[type=time] { padding: 9px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); }

/* settings */
.mtabs { padding: 6px 0 0; margin-bottom: 8px; }
.integ { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-top: 10px; }
.integ summary { cursor: pointer; display: flex; align-items: center; gap: 10px; list-style: none; }
.integ summary::-webkit-details-marker { display: none; }
.integ summary .hint { margin: 0 0 0 auto; }
.integ[open] summary { margin-bottom: 8px; }
.dotflag { width: 10px; height: 10px; border-radius: 50%; background: var(--line); flex: none; }
.dotflag.on { background: var(--ok); }
.hook { margin-top: 8px; font-size: 13px; }
.hook code { font: 12px var(--mono); background: var(--line-2); padding: 2px 6px; border-radius: 6px; overflow-wrap: anywhere; }
.usage { padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.usage .bar { height: 6px; background: var(--line-2); border-radius: 99px; margin-top: 6px; overflow: hidden; }
.usage .bar span { display: block; height: 100%; border-radius: 99px; }
.file-img { max-width: 100%; max-height: 65vh; border-radius: 10px; display: block; }
.lead-contact { margin-top: 6px; font-size: 13.5px; }
.lead .l-status { width: auto; min-width: 140px; }

/* reports (palette validated: scripts/validate_palette.js, light + dark) */
:root { --series-1: #2a78d6; --series-2: #eb6834; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --series-1: #3987e5; --series-2: #d95926; } }
:root[data-theme="dark"] { --series-1: #3987e5; --series-2: #d95926; }
.reports { max-width: 1100px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.reports .card + .card { margin-top: 0; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.tile-v { font-size: 30px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.tile-l { color: var(--ink-2); font-size: 13.5px; margin-top: 2px; }
.legend { display: flex; gap: 14px; font-size: 13px; color: var(--ink-2); margin-left: 14px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.colchart { position: relative; height: 220px; margin-top: 14px; }
.cc-grid { position: absolute; inset: 0 0 22px 0; display: flex; flex-direction: column; justify-content: space-between; }
.cc-grid div { border-top: 1px solid var(--line-2); height: 0; position: relative; }
.cc-grid span { position: absolute; left: 0; top: -9px; font-size: 11px; color: var(--ink-3); background: var(--panel); padding-right: 6px; }
.cc-cols { position: absolute; inset: 0 0 0 28px; display: flex; gap: 2px; align-items: stretch; }
.cc-day { flex: 1; min-width: 0; display: flex; flex-direction: column; cursor: default; border-radius: 6px; position: relative; }
.cc-day.hover { background: var(--line-2); }
.cc-pair { flex: 1; display: flex; align-items: flex-end; justify-content: center; gap: 2px; padding: 0 1px; margin-bottom: 22px; }
.cc-bar { flex: 1; max-width: 14px; border-radius: 4px 4px 0 0; }
.cc-bar.s1 { background: var(--series-1); } .cc-bar.s2 { background: var(--series-2); }
.cc-x { position: absolute; bottom: 0; left: 0; font-size: 11px; color: var(--ink-3); white-space: nowrap; }
.hbars { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.hb { display: grid; grid-template-columns: minmax(80px, 34%) 1fr 36px; gap: 10px; align-items: center; font-size: 13.5px; padding: 2px 4px; border-radius: 6px; }
.hb.hover { background: var(--line-2); }
.hb-l { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.hb-track { height: 12px; }
.hb-bar { display: block; height: 100%; background: var(--series-1); border-radius: 0 4px 4px 0; }
.hb-v { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink); }
.rep-grid { gap: 14px; }
.rep-table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 13.5px; }
.rep-table th { text-align: left; color: var(--ink-3); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.rep-table td { padding: 8px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.viz-tip { position: fixed; z-index: 70; background: var(--ink); color: var(--bg); padding: 6px 10px; border-radius: 8px; font-size: 12.5px; pointer-events: none; box-shadow: var(--shadow); max-width: 320px; }
@media (max-width: 860px) { .legend { display: none; } .colchart { height: 180px; } }

.setup-banner { margin: 14px 28px 0; padding: 12px 16px; border-radius: 12px; background: var(--warn-soft); border: 1px solid var(--warn); font-size: 14px; }
.setup-banner ul { margin: 8px 0; padding-left: 4px; list-style: none; }
.setup-banner li { margin: 3px 0; }
.file-edit { width: 100%; min-height: 60vh; font: 13px/1.55 var(--mono); }
@media (max-width: 860px) { .setup-banner { margin: 12px 16px 0; } }

/* mobile */
.menu-btn { display: none; }
@media (max-width: 860px) {
  #app { grid-template-columns: minmax(0, 1fr); }
  #rail { position: fixed; inset: 0 25% 0 0; z-index: 40; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  #rail.open { transform: none; }
  .menu-btn { display: inline-flex; }
  .head { padding: 14px 16px 0; flex-wrap: wrap; }
  .head .actions { margin-left: 0; width: 100%; }
  .tabs { padding: 10px 8px 0; overflow-x: auto; }
  .pane { padding: 16px; }
  .msgs { padding: 16px; } .composer { padding: 8px 16px 16px; } .approval-strip { padding: 0 16px; }
  .computer { grid-template-columns: 1fr; height: auto; }
  .screen { max-height: 60vh; }
  .grid2, .feature-list { grid-template-columns: 1fr; }
  .perm { flex-direction: column; align-items: flex-start; }
}
