:root {
  color-scheme: light;
  --bg: #ffffff;
  --sidebar: #f7f8fa;
  --rail: #1f2330;            /* dark, calm rail — purple reserved for accents */
  --rail-ink: #aeb4c2;
  --rail-ink-active: #ffffff;
  --panel: #ffffff;
  --panel-soft: #fbfbfc;
  --line: #e2e5ec;
  --line-soft: #eef0f4;
  --text: #1b2230;
  --muted: #667085;
  --muted-2: #98a0b0;
  --brand: #5b62d8;          /* calmer indigo (less hot than #635bff) */
  --brand-2: #4a51c8;
  --brand-soft: #eef0fb;
  --green: #15a05a;
  --green-soft: #e7f6ee;
  --amber: #c2841f;
  --danger: #d64545;
  --shadow: 0 14px 40px rgba(20, 28, 50, .08);
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  /* module accents */
  --c-dash: #5b62d8; --c-files: #2f7ed8; --c-chat: #8257e6; --c-cal: #0d9488;
  --c-vault: #c2841f; --c-db: #4f56c8; --c-cell: #5b6678; --c-voice: #db4f7a;
  --c-assurance: #16806a; --c-signatures: #6842a8;
  --c-ingress: #0e9aa7; --c-research: #7c3aed;
  --c-radar: #d9822b; --c-plots: #2563eb; --c-sales: #16a34a;
  --rail-w: 56px;
  --subnav-w: 230px;
  font-family: "Aptos", "Segoe UI", ui-sans-serif, system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); overflow-x: hidden; }
button, input, select, textarea { font: inherit; }
a { color: inherit; }
svg { fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }

button {
  align-items: center; background: var(--brand); border: 1px solid var(--brand); border-radius: 8px;
  color: #fff; cursor: pointer; display: inline-flex; font-size: 14px; font-weight: 600; gap: 8px;
  justify-content: center; min-height: 34px; padding: 0 14px;
}
button:hover { background: var(--brand-2); border-color: var(--brand-2); }
button:disabled { cursor: default; opacity: .5; }
button svg, .button svg { width: 17px; height: 17px; flex-shrink: 0; }
button.secondary { background: #fff; border-color: #d2d7e2; color: var(--text); }
button.secondary:hover { background: #f5f6f9; border-color: #c2c8d6; }
button.ghost { background: transparent; border-color: transparent; color: var(--muted); }
button.ghost:hover { background: #eef0f4; color: var(--text); }
button.danger { background: #fff; border-color: #f0c9c5; color: var(--danger); }
button.danger:hover { background: #fdf2f1; }
button.sm { min-height: 28px; padding: 0 11px; font-size: 13px; border-radius: 7px; }

input, select, textarea {
  background: #fff; border: 1px solid #d2d7e2; border-radius: 8px; color: var(--text);
  min-height: 38px; padding: 9px 11px; width: 100%;
}
textarea { resize: vertical; line-height: 1.45; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible {
  outline: 3px solid rgba(91, 98, 216, .2); outline-offset: 1px; border-color: var(--brand);
}
label.field { display: grid; gap: 5px; font-size: 13px; color: var(--muted); }

/* ============================ shell ============================ */
.shell { display: grid; grid-template-columns: var(--rail-w) var(--subnav-w) 1fr; height: 100vh; height: 100dvh; }

/* 1) host rail — slim, icon-only, dark */
.rail {
  background: var(--rail); display: flex; flex-direction: column; align-items: center;
  justify-content: space-between; padding: 10px 0; gap: 6px;
}
.rail-top, .rail-bottom { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 100%; }
.rail .home {
  width: 34px; height: 34px; border-radius: 9px; background: linear-gradient(135deg, var(--brand), #7b81e8);
  color: #fff; display: grid; place-items: center; margin-bottom: 8px; text-decoration: none;
}
.rail .home svg { width: 19px; height: 19px; }
.rail-btn {
  position: relative; width: 40px; height: 40px; border: 0; border-radius: 11px; background: transparent;
  color: var(--rail-ink); cursor: pointer; display: grid; place-items: center; min-height: auto;
  text-decoration: none; transition: background .12s, color .12s;
}
.rail-btn svg { width: 21px; height: 21px; }
.rail-btn:hover { background: rgba(255, 255, 255, .08); color: var(--rail-ink-active); }
.rail-btn.active { background: rgba(255, 255, 255, .14); color: var(--rail-ink-active); }
.rail-btn.active::before {
  content: ""; position: absolute; left: -10px; top: 9px; bottom: 9px; width: 3px; border-radius: 3px;
  background: #fff;
}
.rail .avatar {
  width: 34px; height: 34px; border-radius: 50%; background: #394050; color: #fff; border: 0;
  display: grid; place-items: center; font-size: 13px; font-weight: 600; cursor: pointer; min-height: auto;
}

/* 2) module sub-sidebar */
.subnav { background: var(--sidebar); border-right: 1px solid var(--line); padding: 14px 12px; overflow-y: auto; }
.modhead { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; padding: 2px 4px; }
.modhead .ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; color: #fff; }
.modhead .ic svg { width: 16px; height: 16px; }
.modhead b { font-size: 14px; }
.modhead small { color: var(--muted-2); font-weight: 600; font-size: 11px; display: block; margin-top: -1px; }
.nav-title { color: var(--muted-2); font-size: 11px; font-weight: 700; letter-spacing: .04em; margin: 0 0 7px; padding: 0 6px; }
.nav-item {
  align-items: center; border-radius: 8px; color: #313a4b; display: flex; gap: 10px; min-height: 36px;
  padding: 7px 10px; text-decoration: none; cursor: pointer; font-size: 14px; border: 0; background: transparent;
  width: 100%; text-align: left;
}
.nav-item svg { height: 17px; width: 17px; color: var(--muted); flex-shrink: 0; }
.nav-item:hover { background: #eceef2; }
.nav-item.active { background: #e6e8ef; color: #131722; font-weight: 650; }
.nav-item.active svg { color: var(--brand); }
.nav-item .count { margin-left: auto; color: var(--muted-2); font-size: 12px; font-weight: 600; }
.nav-item .lock { margin-left: auto; color: var(--green); display: inline-flex; }
.nav-item .lock svg { color: var(--green); height: 14px; width: 14px; }
.nav-item .label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-section { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 14px; }
.subnav .new-btn { width: 100%; justify-content: flex-start; margin-bottom: 14px; }

/* 3) main */
.main { min-width: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.topbar {
  align-items: center; border-bottom: 1px solid var(--line-soft); display: flex; min-height: 58px;
  justify-content: space-between; padding: 9px 18px; gap: 14px; flex-wrap: wrap;
}
.topbar .left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar .left h2, .topbar .left strong { font-size: 15px; }
.hamburger { display: none; }
.switcher { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.switcher .label { color: var(--muted-2); font-size: 12px; font-weight: 700; margin-right: 3px; }
.prov {
  position: relative; width: 38px; height: 38px; border-radius: 9px; border: 1px solid var(--line);
  background: #fff; display: grid; place-items: center; cursor: pointer; min-height: auto; padding: 0;
  color: #737a87; transition: border-color .12s, box-shadow .12s;
}
.prov:hover { border-color: #c3c8d4; }
.prov svg { width: 17px; height: 17px; }
.prov .mark { font-weight: 700; font-size: 11px; color: #737a87; }
.prov.active { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(91, 98, 216, .16); }
.prov.active .mark { color: var(--text); }
.prov.active .dot { position: absolute; top: -4px; right: -4px; width: 10px; height: 10px; border-radius: 99px; background: var(--green); border: 2px solid #fff; }
.prov.add { border-style: dashed; color: var(--muted-2); }
.top-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.search { display: flex; align-items: center; gap: 8px; border: 1px solid #d2d7e2; border-radius: 8px; padding: 0 10px; height: 36px; color: var(--muted); background: #fff; }
.search svg { width: 16px; height: 16px; }
.search input { border: 0; outline: 0; min-height: auto; height: 34px; width: 150px; background: transparent; padding: 0; }
.account-wrap { position: relative; }
.account-menu {
  position: absolute; left: 8px; bottom: 48px; background: #fff; border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow); padding: 12px; min-width: 200px; display: none; z-index: 40;
}
.account-menu.open { display: block; }
.account-menu .nm { font-weight: 700; }
.account-menu .em { color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.account-menu a { display: block; padding: 8px 6px; border-radius: 7px; text-decoration: none; color: var(--text); }
.account-menu a:hover { background: #f3f4f8; }
.status-pill { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 99px; }
.status-pill.active { color: var(--green); background: var(--green-soft); }
.status-pill.locked { color: var(--amber); background: #fbf3e3; }

.content { padding: 22px 24px; overflow-y: auto; flex: 1; }
.content.flush { padding: 0; }
.crumbs { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 13px; margin-bottom: 4px; flex-wrap: wrap; }
.crumbs b { color: var(--text); }
.head { margin-bottom: 16px; }
.head h1 { font-size: 21px; margin: 6px 0 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.head p { margin: 5px 0 0; color: var(--muted); font-size: 13px; max-width: 64ch; }
.e2e-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--green); background: var(--green-soft); border: 1px solid #bfe6cf; padding: 3px 9px; border-radius: 99px; }
.e2e-pill svg { height: 13px; width: 13px; }

/* ---- aerp-style tiles (dashboard) ---- */
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(228px, 1fr)); gap: 14px; }
.tile {
  position: relative; display: block; text-align: left; text-decoration: none; cursor: pointer;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 15px;
  box-shadow: var(--shadow-sm); transition: border-color .12s, box-shadow .12s, transform .12s; color: inherit;
  border-top: 3px solid var(--tile-c, var(--brand));
}
.tile:hover { box-shadow: var(--shadow); transform: translateY(-2px); border-color: #cfd4e0; }
.tile .chip {
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; color: #fff;
  background: var(--tile-c, var(--brand)); margin-bottom: 11px; font-weight: 800; font-size: 13px;
}
.tile .chip svg { width: 20px; height: 20px; }
.tile b { display: block; font-size: 15px; }
.tile small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 3px; line-height: 1.4; }
.tile .pages { display: flex; gap: 6px; margin-top: 11px; flex-wrap: wrap; }
.tile .pages span { font-size: 11px; color: var(--muted-2); background: #f1f3f7; border-radius: 6px; padding: 2px 7px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { border: 1px solid var(--line); border-radius: 13px; padding: 14px; background: #fff; box-shadow: var(--shadow-sm); }
.stat .k { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 600; }
.stat .k .sq { width: 9px; height: 9px; border-radius: 3px; background: var(--tile-c, var(--brand)); }
.stat .v { font-size: 26px; font-weight: 700; margin-top: 6px; }
.section-title { font-size: 13px; font-weight: 700; color: var(--muted-2); letter-spacing: .03em; margin: 22px 0 10px; }

/* ---- files: dropzone + grid ---- */
.drop {
  border: 1.5px dashed #ccd2df; border-radius: 12px; background: var(--panel-soft); padding: 20px; text-align: center;
  color: var(--muted); margin-bottom: 20px; display: flex; flex-direction: column; align-items: center; gap: 7px; cursor: pointer;
}
.drop.over { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.drop b { color: var(--text); }
.drop .ic { width: 40px; height: 40px; border-radius: 11px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; }
.drop .ic svg { height: 19px; width: 19px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.card { border: 1px solid var(--line); border-radius: 12px; background: #fff; padding: 13px; cursor: pointer; transition: border-color .12s, box-shadow .12s, transform .12s; box-shadow: var(--shadow-sm); position: relative; }
.card:hover { border-color: #c3c8d4; box-shadow: var(--shadow); transform: translateY(-1px); }
.card .thumb { height: 72px; border-radius: 9px; display: grid; place-items: center; margin-bottom: 10px; color: #fff; }
.card .thumb svg { height: 25px; width: 25px; }
.card .name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .meta { color: var(--muted-2); font-size: 12px; margin-top: 2px; display: flex; justify-content: space-between; gap: 6px; }
.card .lock { color: var(--green); }
.card .x { position: absolute; top: 8px; right: 8px; width: 24px; height: 24px; border-radius: 7px; background: rgba(255,255,255,.92); border: 1px solid var(--line); color: var(--muted); display: none; place-items: center; min-height: auto; padding: 0; }
.card:hover .x { display: grid; }
.card .x:hover { color: var(--danger); border-color: #f0c9c5; }
.card.folder .thumb { background: linear-gradient(135deg, #eef0f6, #e2e5ef); color: var(--muted); }
.empty { color: var(--muted); padding: 38px 8px; text-align: center; border: 1px dashed var(--line); border-radius: 12px; }
.empty svg { width: 30px; height: 30px; color: var(--muted-2); margin-bottom: 8px; }

/* ---- generic panels / lists ---- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 13px; padding: 16px; display: grid; gap: 11px; box-shadow: var(--shadow-sm); }
.panel h3 { margin: 0; font-size: 15px; }
.panel p { margin: 0; color: var(--muted); font-size: 13px; }
.ops { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 16px; }


.status-box { background: #161a27; color: #d6def0; border-radius: 11px; padding: 13px; overflow: auto; font-size: 12px; line-height: 1.55; }
.list { display: grid; gap: 8px; margin-top: 14px; }
.row { border: 1px solid var(--line); border-radius: 11px; background: #fff; padding: 12px 14px; display: flex; justify-content: space-between; gap: 12px; align-items: center; box-shadow: var(--shadow-sm); }
.row strong { display: block; font-size: 14px; }
.row span { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.row em { color: var(--muted-2); font-size: 12px; font-style: normal; white-space: nowrap; }
.row .ra { display: flex; gap: 7px; align-items: center; }
.check-row { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); }
.check-row input { width: auto; min-height: auto; }
.keyout { background: #f5f6f9; border: 1px solid var(--line); border-radius: 9px; padding: 10px; font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; font-size: 11px; white-space: pre-wrap; word-break: break-all; max-height: 150px; overflow: auto; }
.code { font-family: ui-monospace, Menlo, monospace; background: #eef0f4; border-radius: 6px; padding: 1px 6px; font-size: 12px; }
.dim { color: var(--muted); font-size: 13px; margin: 0; }

/* Commons stays dense enough for the history view, while its grids collapse cleanly on phones. */
.commons-panel { margin: 14px 0 18px; }
.commons-heading { display:flex; justify-content:space-between; gap:12px; align-items:start; }
.commons-headlines { display:grid; grid-template-columns:repeat(4, minmax(0, 1fr)); gap:8px; }
.commons-metric { background:var(--panel-soft); border:1px solid var(--line-soft); border-radius:9px; padding:9px; min-width:0; }
.commons-metric b { display:block; font-size:21px; font-variant-numeric:tabular-nums; }
.commons-metric span, .commons-details > div > span { display:block; color:var(--muted); font-size:12px; margin-top:2px; }
.commons-details { display:grid; grid-template-columns:repeat(2, minmax(0, 1fr)); gap:12px; }
.commons-details > div { border-top:1px solid var(--line-soft); padding-top:9px; font-size:13px; }
.commons-small { display:flex; flex-wrap:wrap; gap:5px 9px; margin-top:8px; }
.commons-small span { color:var(--muted); font-size:11px; white-space:nowrap; }
.commons-small b { color:var(--text); margin-right:3px; }
.commons-feed { display:grid; gap:6px; border-top:1px solid var(--line-soft); padding-top:10px; font-size:13px; }
.commons-recent { display:flex; justify-content:space-between; align-items:baseline; gap:12px; }
.commons-recent div { min-width:0; }
.commons-recent strong { margin-right:6px; }
.commons-recent span { color:var(--muted); }
.commons-recent em { color:var(--muted-2); font-size:12px; font-style:normal; white-space:nowrap; }
@media (max-width:640px) { .commons-headlines { grid-template-columns:repeat(2, minmax(0, 1fr)); } .commons-details { grid-template-columns:1fr; } .commons-heading { align-items:start; } }

/* Fleet catalog: compact metadata remains legible as the list collapses on phones. */
.central-summary { display:flex; gap:22px; align-items:baseline; flex-wrap:wrap; margin-bottom:12px; }
.central-summary div { display:grid; gap:2px; }.central-summary strong, .central-signals strong { font-size:22px; font-variant-numeric:tabular-nums; }.central-summary span, .central-signals span { color:var(--muted); font-size:12px; }
.central-grid { display:grid; grid-template-columns:repeat(2, minmax(0, 1fr)); gap:12px; margin-bottom:12px; }.central-grid h3, .central-catalog h3 { margin-top:0; }
.central-mothers { display:grid; gap:7px; }.central-mother { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }.central-mother em { color:var(--muted-2); font-size:12px; font-style:normal; }
.central-signals { display:flex; gap:20px; flex-wrap:wrap; }.central-signals div { display:grid; gap:2px; }
.central-catalog-head { display:flex; align-items:start; justify-content:space-between; gap:12px; flex-wrap:wrap; }.central-controls { display:flex; gap:8px; align-items:center; flex-wrap:wrap; }.central-catalog-list { display:grid; margin-top:10px; border-top:1px solid var(--line-soft); }
.central-catalog-row { display:grid; grid-template-columns:minmax(130px, 1fr) minmax(120px, 1fr) minmax(100px, .7fr); gap:8px; align-items:center; padding:9px 0; border-bottom:1px solid var(--line-soft); min-width:0; }.central-catalog-row > strong { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.central-tags { display:flex; gap:5px; flex-wrap:wrap; }.central-tags span { color:var(--muted); background:var(--panel-soft); border:1px solid var(--line-soft); border-radius:99px; font-size:11px; padding:2px 6px; }.central-tags.versions span { color:var(--text); }
@media (max-width:640px) { .central-grid { grid-template-columns:1fr; }.central-catalog-row { grid-template-columns:1fr; gap:5px; }.central-summary { gap:14px; } }

/* ---- digital signatures ---- */
.signature-page { max-width: 980px; }
.signature-form { max-width: 720px; }
.signature-row { text-decoration: none; }
.signature-status { display:inline-block; border-radius:99px; padding:3px 9px; font-size:12px; font-weight:700; background:#eef0f4; color:#596273; text-transform:capitalize; }
.signature-status.signed { background:var(--green-soft); color:var(--green); }
.signature-status.pending { background:#fbf3e3; color:var(--amber); }
.signature-status.cancelled, .signature-status.declined, .signature-status.expired { background:#f7eaea; color:var(--danger); }
.signature-trust { border:1px solid var(--line); border-left:4px solid var(--brand); border-radius:10px; padding:13px 15px; margin:14px 0; display:grid; gap:3px; }
.signature-trust span { color:var(--muted); font-size:13px; }
.signature-trust.valid { border-left-color:var(--green); background:var(--green-soft); }
.signature-trust.invalid { border-left-color:var(--danger); background:#fdf2f1; }
.signature-trust.warning { border-left-color:var(--amber); background:#fffaf0; }
.signature-meta { display:grid; grid-template-columns:minmax(90px,120px) minmax(0,1fr); gap:9px 14px; align-items:start; font-size:13px; }
.signature-meta .code { overflow-wrap:anywhere; }
.signature-code { font:700 22px/1 ui-monospace,Menlo,monospace; letter-spacing:.08em; color:var(--c-signatures); }

/* ---- assurance ---- */
.assurance-page { max-width: 1080px; }
.assurance-readiness { margin-bottom: 4px; }
.assurance-fraction { font-size: 30px; font-weight: 750; font-variant-numeric: tabular-nums; }
.assurance-fraction span { color: var(--c-assurance); font-size: 20px; margin-left: 8px; }
.assurance-reference { font-family: ui-monospace, Menlo, monospace; font-size: 12px; color: var(--muted); }
.assurance-status { display: inline-block; padding: 1px 7px; border-radius: 99px; font-weight: 700; font-size: 11px; text-transform: capitalize; background: #eef0f4; color: #596273; }
.assurance-status.met { background: var(--green-soft); color: var(--green); }
.assurance-status.in-progress { background: #fbf3e3; color: var(--amber); }
.assurance-evidence b, .assurance-expired { color: var(--danger); }
.assurance-gap { border-left: 4px solid var(--amber); }
.assurance-gap.overdue { border-color: var(--danger); background: #fff7f6; }
.assurance-gap.overdue span { color: var(--danger); font-weight: 700; }

/* ---- modal + toast ---- */
.scrim { position: fixed; inset: 0; background: rgba(18, 24, 40, .4); display: grid; place-items: center; z-index: 60; padding: 18px; }
.modal { background: #fff; border-radius: 16px; box-shadow: var(--shadow); width: min(460px, 100%); padding: 20px; display: grid; gap: 13px; max-height: 90vh; overflow: auto; }
.modal h3 { margin: 0; font-size: 17px; }
.modal .row-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 4px; }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: #161a27; color: #fff; padding: 11px 16px; border-radius: 10px; font-size: 13px; box-shadow: var(--shadow); z-index: 80; max-width: 90vw; }
.toast.err { background: var(--danger); }

/* ============================ chat ============================ */
.chat { display: flex; flex: 1 1 auto; flex-direction: column; min-height: 0; }
.chat-stage { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; }
.welcome { margin: auto; width: min(720px, 100%); padding: 24px; text-align: center; }
.welcome .greet { font-size: 29px; font-weight: 600; display: inline-flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.welcome .greet svg { width: 29px; height: 29px; color: var(--brand); }
.msgs { width: min(760px, 100%); margin: 0 auto; padding: 22px 18px 8px; flex: 1; }
.msg { margin-bottom: 22px; }
.msg.user { display: flex; justify-content: flex-end; }
.msg.user .bubble { background: var(--brand-soft); border-radius: 16px; padding: 11px 15px; max-width: 80%; white-space: pre-wrap; word-wrap: break-word; }
.msg.bot { display: flex; gap: 11px; }
.msg.bot .mark { width: 27px; height: 27px; flex-shrink: 0; border-radius: 8px; background: var(--brand); color: #fff; display: grid; place-items: center; }
.msg.bot .mark svg { width: 16px; height: 16px; }
.msg.bot .text { padding-top: 3px; line-height: 1.62; white-space: pre-wrap; word-wrap: break-word; min-width: 0; }
.msg.bot .text .cursor { display: inline-block; width: 8px; height: 16px; background: var(--brand); border-radius: 1px; vertical-align: -2px; margin-left: 2px; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.composer-wrap { flex: 0 0 auto; padding: 12px 18px 20px; }
.composer { width: min(760px, 100%); margin: 0 auto; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 12px 12px 10px; box-shadow: 0 6px 24px rgba(20,28,50,.06); }
.composer textarea { border: 0; outline: 0; resize: none; background: transparent; width: 100%; font-size: 15px; line-height: 1.5; max-height: 200px; min-height: 26px; padding: 2px 4px; }
.composer .bar { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; gap: 8px; }
.composer .model { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.composer .model select { width: auto; min-height: 30px; padding: 4px 26px 4px 10px; border-radius: 8px; }
.send { width: 36px; height: 36px; border-radius: 50%; padding: 0; min-height: auto; }
.send svg { width: 17px; height: 17px; }
.chat-recents { display: grid; gap: 2px; }
.chat-recents .nav-item { font-weight: 500; color: #344054; }
.chat-recents .nav-item.active { font-weight: 700; }

/* ============================ calendar (ai-pad style) ============================ */
.cal { display: flex; flex-direction: column; height: 100%; }
.cal-toolbar { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--line-soft); flex-wrap: wrap; }
.cal-toolbar .range { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.cal-nav { display: inline-flex; gap: 4px; }
.cal-nav button { min-height: 30px; padding: 0 9px; background: #fff; border: 1px solid var(--line); color: var(--muted); border-radius: 8px; font-weight: 600; }
.cal-nav button:hover { background: #f3f4f8; color: var(--text); }
.cal-toggle { display: inline-flex; background: #eceef3; border-radius: 9px; padding: 2px; margin-left: auto; }
.cal-toggle button { min-height: 28px; padding: 0 13px; background: transparent; border: 0; color: var(--muted); border-radius: 7px; font-weight: 700; font-size: 13px; }
.cal-toggle button.active { background: #fff; color: var(--brand); box-shadow: var(--shadow-sm); }
.cal-body { flex: 1; overflow: auto; padding: 16px 20px; }
.cal-list { display: grid; gap: 12px; margin-top: 2px; }
.cal-list-group { display: grid; gap: 7px; }
.cal-list-day { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: #8a91a1; }
.cal-list-item { display: flex; gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: 11px; background: #fff; box-shadow: var(--shadow-sm); padding: 10px 12px; cursor: pointer; }
.cal-list-main { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.cal-list-time { font-variant-numeric: tabular-nums; font-size: 12.5px; font-weight: 700; color: #3a4250; }
.cal-list-title { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-list-notes { font-size: 12px; color: var(--muted-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-list-item .del { margin-left: auto; width: 28px; height: 28px; border-radius: 7px; padding: 0; min-height: auto; background: transparent; border: 1px solid transparent; color: var(--muted-2); }
.cal-list-item .del:hover { background: #fdf2f1; color: var(--danger); border-color: #f0c9c5; }
.wk { min-width: 660px; }
.wk-head, .wk-grid { display: grid; grid-template-columns: 52px repeat(7, minmax(0, 1fr)); }
.wk-head { position: sticky; top: 0; background: #fff; z-index: 2; border-bottom: 1px solid var(--line); }
.wk-dh { padding: 8px 4px; text-align: center; font-size: 11px; font-weight: 700; color: #8a91a1; border-left: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: 1px; }
.wk-dh .d { font-size: 15px; font-weight: 800; color: #3a4250; }
.wk-dh.today, .wk-dh.today .d { color: var(--brand); }
.wk-col { position: relative; border-left: 1px solid var(--line-soft); background-image: repeating-linear-gradient(to bottom, transparent, transparent calc(var(--hpx) - 1px), var(--line-soft) calc(var(--hpx) - 1px), var(--line-soft) var(--hpx)); }
.wk-col.today { background-color: #f7f8ff; }
.wk-hour { position: absolute; right: 6px; transform: translateY(-50%); font-size: 10px; color: var(--muted-2); font-variant-numeric: tabular-nums; }
.wk-ev { position: absolute; left: 3px; right: 3px; border-radius: 7px; padding: 3px 6px; color: #fff; overflow: hidden; box-shadow: 0 1px 2px rgba(0,0,0,.15); background: var(--c-cal); }
.wk-ev .t { display: block; font-size: 11px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wk-ev .h { display: block; font-size: 10px; opacity: .9; }

/* ============================ db explorer ============================ */
.db-wrap { display: grid; gap: 16px; }
.tablebox { border: 1px solid var(--line); border-radius: 12px; overflow: auto; background: #fff; box-shadow: var(--shadow-sm); }
table.data { border-collapse: collapse; width: 100%; font-size: 13px; }
table.data th { text-align: left; background: #f5f6f9; color: var(--muted); font-weight: 700; padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; }
table.data td { padding: 8px 12px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; max-width: 360px; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
table.data tr:hover td { background: #fafbfd; }
table.data td.null { color: var(--muted-2); font-style: italic; }
.cols { display: flex; gap: 7px; flex-wrap: wrap; margin: 4px 0 4px; }
.cols span { font-size: 11.5px; background: #eef0f4; border-radius: 6px; padding: 3px 8px; color: #475067; }
.cols span b { color: var(--muted-2); font-weight: 600; margin-left: 5px; }
.querybox { display: grid; gap: 9px; }
.querybox textarea { font-family: ui-monospace, Menlo, monospace; font-size: 13px; min-height: 84px; }
.metrics-summary { grid-template-columns: repeat(4, auto); align-items: baseline; margin-bottom: 16px; }
.metrics-summary strong { font-size: 18px; }
.metrics-summary span { color: var(--muted); font-size: 13px; }
.metrics-bar { width: 132px; height: 5px; margin-top: 5px; border-radius: 99px; background: #e8eaf0; overflow: hidden; }
.metrics-bar > div { height: 100%; border-radius: inherit; background: var(--brand); }
.metrics-top td { background: #f4f5ff; }
@media (max-width: 520px) { .metrics-summary { grid-template-columns: 1fr 1fr; } .metrics-bar { width: 96px; } }

/* Fleet analytics stays scan-friendly on a wall display and collapses to cards on phones. */
.analytics-head { display:flex; justify-content:space-between; align-items:end; gap:12px; flex-wrap:wrap; }
.analytics-tabs { margin-left:0; }
.analytics-live { margin-bottom:12px; background:linear-gradient(135deg, #18213c, #263b73); color:#fff; border:0; }
.analytics-live-heading { display:flex; align-items:center; gap:7px; font-size:11px; font-weight:800; letter-spacing:.08em; color:#c8d5ff; }
.analytics-live-dot { width:8px; height:8px; border-radius:50%; background:#65e2a3; box-shadow:0 0 0 4px rgba(101,226,163,.16); }
.analytics-live > strong { display:block; margin:13px 0 7px; font-size:clamp(30px, 6vw, 52px); line-height:1; font-variant-numeric:tabular-nums; }
.analytics-live > strong small { font-size:15px; font-weight:650; color:#c8d5ff; }.analytics-live .dim { color:#b9c6e9; }
.analytics-burn { display:flex; align-items:baseline; gap:9px; }.analytics-burn span { color:#c8d5ff; }.analytics-burn b { font-variant-numeric:tabular-nums; }
.analytics-quick, .analytics-summary { display:grid; grid-template-columns:repeat(3, minmax(0, 1fr)); gap:12px; margin-bottom:18px; }.analytics-summary { grid-template-columns:repeat(4, minmax(0, 1fr)); }
.analytics-quick .panel, .analytics-summary div { display:grid; gap:3px; }.analytics-quick strong, .analytics-summary strong { font-size:22px; font-variant-numeric:tabular-nums; }.analytics-quick span, .analytics-summary span { color:var(--muted); font-size:12px; }
.analytics-table td span.dim { display:block; margin-top:2px; font-size:11px; }.analytics-cache-bar > div { background:var(--green); }
@media (max-width:640px) { .analytics-quick { grid-template-columns:1fr; }.analytics-summary { grid-template-columns:1fr 1fr; } }

/* ============================ responsive ============================ */
@media (max-width: 860px) {
  html, body { max-width: 100%; overflow-x: hidden; }
  .shell { grid-template-columns: 1fr; width: 100%; max-width: 100%; }
  .main { width: 100%; max-width: 100%; min-width: 0; height: 100vh; height: 100dvh; padding-bottom: 60px; }
  .chat, .chat-stage, .msgs, .composer-wrap { max-width: 100%; min-width: 0; }
  .welcome, .welcome .greet { max-width: 100%; }
  .rail {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 50; height: 60px; width: 100%;
    flex-direction: row; padding: 0 8px; justify-content: flex-start; align-items: center;
    gap: 4px; overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .rail::-webkit-scrollbar { display: none; }
  .rail-top, .rail-bottom { flex-direction: row; gap: 4px; width: auto; flex: 0 0 auto; }
  .rail-top { flex: 1 0 auto; }
  .rail-btn, .rail .home { flex: 0 0 auto; }
  .rail .home { width: 40px; height: 44px; border-radius: 11px; margin: 0; background: transparent; color: var(--rail-ink); }
  .rail .home.active { background: rgba(255, 255, 255, .14); color: #fff; }
  .rail .home svg { width: 21px; height: 21px; }
  .rail-btn { width: 40px; height: 44px; }
  .rail-btn.active::before { left: 9px; right: 9px; top: auto; bottom: -8px; width: auto; height: 3px; }
  .account-menu { left: auto; right: 6px; bottom: 66px; }
  .subnav {
    position: fixed; top: 0; bottom: 60px; left: 0; width: 272px; max-width: 84vw; z-index: 55;
    transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow);
  }
  .subnav.open { transform: translateX(0); }
  .scrim.nav { z-index: 54; background: rgba(18,24,40,.3); }
  .hamburger { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 9px; background: #fff; border: 1px solid var(--line); color: var(--text); padding: 0; min-height: auto; }
  .content { padding: 16px 14px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 10px; }
  .search input { width: 104px; }
  .topbar { padding: 8px 12px; }
  .composer-wrap { padding: 10px 12px calc(16px + env(safe-area-inset-bottom)); }
}
@media (max-width: 520px) {
  .switcher .label { display: none; }
  .search { display: none; }
  .head h1 { font-size: 19px; }
  .welcome .greet { font-size: 23px; }
  .top-actions button span { display: none; }
  .top-actions button { padding: 0 11px; }
  .cal-ev .time { min-width: 92px; }
}
.nav-note{padding:6px 14px;font-size:12px;color:var(--muted,#8b8798);line-height:1.4}

/* ---- Runtime agent: chat-style panel ---- */
.content.ag-panel { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.ag-thread { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 22px 24px 8px; display: flex; flex-direction: column; gap: 12px; }
.ag-msg { display: flex; }
.ag-msg.user { justify-content: flex-end; }
.ag-msg.agent { justify-content: flex-start; }
.ag-bubble { max-width: 74%; padding: 11px 15px; border-radius: 16px; font-size: 14.5px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.ag-msg.user .ag-bubble { background: var(--brand); color: #fff; border-bottom-right-radius: 5px; }
.ag-msg.agent .ag-bubble { background: var(--panel-soft); color: var(--text); border: 1px solid var(--line-soft); border-bottom-left-radius: 5px; }
.ag-bubble.final { border-color: var(--brand-soft); background: var(--brand-soft); color: var(--text); font-weight: 500; }
.ag-bubble.final.failed { border-color: var(--danger); background: var(--panel-soft); color: var(--text); }
.ag-bubble.thinking { color: var(--muted); display: inline-flex; align-items: center; gap: 8px; }
.ag-bubble.thinking svg { width: 15px; height: 15px; animation: agpulse 1.1s ease-in-out infinite; }
@keyframes agpulse { 0%,100%{opacity:.35} 50%{opacity:1} }
@media (prefers-reduced-motion: reduce){ .ag-bubble.thinking svg{ animation: none } }
.ag-step { max-width: 78%; background: var(--panel-soft); border: 1px solid var(--line-soft); border-left: 3px solid var(--c-chat); border-radius: 10px; padding: 9px 12px; font-size: 13px; }
.ag-step .ag-tool { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.ag-step .ag-toolname { font-family: ui-monospace, Menlo, monospace; font-weight: 600; color: var(--brand); font-size: 12.5px; }
.ag-step .ag-args { font-family: ui-monospace, Menlo, monospace; font-size: 11.5px; color: var(--muted); }
.ag-step .ag-obs { margin-top: 5px; font-family: ui-monospace, Menlo, monospace; font-size: 12px; color: var(--muted-2); white-space: pre-wrap; word-break: break-word; }
.ag-step.rej { border-left-color: var(--danger); color: var(--text); }
.ag-step.perm { border-left-color: var(--amber); }
.ag-step.ok { border-left-color: var(--green); color: var(--muted-2); }
.ag-permcard { align-self: flex-start; max-width: 78%; background: var(--panel); border: 1px solid var(--amber); border-radius: 12px; padding: 13px 15px; font-size: 14px; }
.ag-permcard .ag-obs { color: var(--muted); font-size: 12.5px; margin: 4px 0 10px; }
.ag-permbtns { display: flex; gap: 8px; }
.ag-empty { margin: auto; text-align: center; max-width: 420px; color: var(--muted); }
.ag-empty svg { width: 34px; height: 34px; color: var(--brand); opacity: .8; }
.ag-empty h3 { margin: 12px 0 6px; color: var(--text); font-size: 18px; }
.ag-empty p { font-size: 13.5px; line-height: 1.6; }
.ag-composer { flex: 0 0 auto; border-top: 1px solid var(--line); background: var(--panel); padding: 12px 20px 16px; }
.ag-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 10px; }
.ag-chip { font-size: 12.5px; padding: 6px 11px; border-radius: 20px; border: 1px solid var(--line); background: var(--panel-soft); color: var(--text); cursor: pointer; transition: background .12s, border-color .12s; }
.ag-chip:hover:not(:disabled) { background: var(--brand-soft); border-color: var(--brand); }
.ag-chip:disabled { opacity: .5; cursor: default; }
.ag-inputrow { display: flex; align-items: center; gap: 9px; }
.ag-inputrow select { flex: 0 0 auto; width: auto; min-height: 42px; border: 1px solid var(--line); background: var(--panel-soft); color: var(--text); border-radius: 10px; padding: 10px 9px; font-size: 12.5px; font-family: ui-monospace, monospace; }
.ag-input { flex: 1 1 auto; width: auto; min-width: 0; border: 1px solid var(--line); background: var(--panel-soft); color: var(--text); border-radius: 12px; padding: 12px 15px; font-size: 14.5px; font-family: inherit; }
.ag-input:focus { outline: none; border-color: var(--brand); }
.ag-send { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px; border-radius: 12px; border: none; background: var(--brand); color: #fff; cursor: pointer; }
.ag-send svg { width: 17px; height: 17px; }
.ag-send:disabled { opacity: .5; cursor: default; }

/* watchdog: capability build promises */
.ag-builds { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.ag-build { font-size: 11.5px; font-family: ui-monospace, Menlo, monospace; padding: 4px 9px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel-soft); color: var(--muted); }
.ag-build.repairing { border-color: var(--amber); }
.ag-build.failed { border-color: var(--danger); color: var(--danger); }
.rail .cellmark{display:flex;align-items:center;justify-content:center;margin-bottom:8px;padding:2px;border-radius:9px}

/* logged-out login wall */
.loginwall { min-height: 100vh; display: grid; place-items: center; background: var(--bg); padding: 24px; }
.loginwall-card { max-width: 380px; width: 100%; text-align: center; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 40px 30px; box-shadow: var(--shadow); }
.loginwall-logo { width: 46px; height: 46px; margin: 0 auto 18px; border-radius: 12px; background: linear-gradient(135deg, var(--brand), #8f7bff); color: #fff; display: grid; place-items: center; font-weight: 700; letter-spacing: .5px; }
.loginwall-card h1 { font-size: 22px; margin: 0 0 6px; }
.loginwall-tag { color: var(--muted); font-size: 14px; margin: 0 0 22px; }
.loginwall-cta { width: 100%; justify-content: center; }
.loginwall-note { color: var(--muted-2); font-size: 12px; margin: 16px 0 0; line-height: 1.5; }

.lw-code { font-size: 44px; font-weight: 700; letter-spacing: .12em; color: var(--brand); margin: 14px 0 4px; font-variant-numeric: tabular-nums; }
#lw-actions { display: grid; gap: 8px; }

.lw-member { display: flex; gap: 8px; margin-top: 10px; }
.lw-member input { flex: 1 1 auto; min-width: 0; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line, #d9d5e6); background: var(--card, #fff); color: inherit; font: inherit; }
.lw-member button { flex: 0 0 auto; }
.lw-waiting { opacity: .75; }
@media (max-width: 420px) { .lw-member { flex-direction: column; } }

.mail-row { cursor: pointer; }
.mail-view { max-width: 760px; }
.mail-view h1 { font-size: 20px; margin: 12px 0; }
.mail-meta { display: flex; flex-direction: column; gap: 2px; font-size: 13px; color: var(--muted, #6b6580); margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--line, #e6e2f0); }
.mail-body { white-space: pre-wrap; word-break: break-word; font: inherit; margin: 0; }

.mail-toolbar { display: flex; gap: 8px; margin-bottom: 12px; }
.mail-search { flex: 1 1 auto; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line, #d9d5e6); background: var(--card, #fff); color: inherit; font: inherit; }
.mail-actions { display: flex; gap: 8px; margin-bottom: 8px; }

.corner { position: fixed; right: 22px; bottom: 22px; z-index: 60; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.cb-fab { width: 56px; height: 56px; border-radius: 50%; border: 0; background: var(--accent, #7b5cff); color: #fff; box-shadow: 0 6px 20px rgba(0,0,0,.28); cursor: pointer; display: grid; place-items: center; position: relative; transition: transform .12s; }
.cb-fab:hover { transform: translateY(-2px); }
.cb-fab svg { width: 24px; height: 24px; }
.cb-badge { position: absolute; top: -3px; right: -3px; min-width: 20px; height: 20px; border-radius: 10px; background: #f23f43; color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; padding: 0 5px; border: 2px solid var(--panel, #fff); animation: cbpulse 1.6s ease-in-out infinite; }
@keyframes cbpulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.15); } }
.cb-pop { width: 240px; background: var(--panel, #fff); border: 1px solid var(--line, #e2e5ec); border-radius: 14px; padding: 10px; box-shadow: 0 12px 34px rgba(0,0,0,.4); display: flex; flex-direction: column; gap: 6px; }
.cb-head { font-size: 12px; font-weight: 700; color: var(--muted, #667085); padding: 4px 6px 6px; }
.cb-room { text-align: left; background: transparent; border: 0; border-radius: 8px; padding: 9px 10px; color: var(--text, #1b2230); font: inherit; font-weight: 500; cursor: pointer; }
.cb-room:hover { background: var(--accent, #7b5cff); color: #fff; }
.cb-new { text-align: left; background: transparent; border: 1px dashed var(--line, #e2e5ec); border-radius: 8px; padding: 8px 10px; color: var(--muted, #667085); font: inherit; cursor: pointer; margin-top: 2px; }
.cb-new:hover { color: var(--text, #fff); border-color: var(--accent, #7b5cff); }
.cb-empty { color: var(--muted, #667085); font-size: 13px; padding: 6px 8px; margin: 0; }

/* Modules decided in onboarding that the cell is still writing. The shimmer says
   "something is happening here" without claiming it works yet - a tile that
   looked finished but did nothing would be worse than an empty dashboard. */
.tile.coming{position:relative;overflow:hidden;cursor:default;border-style:dashed}
.tile.coming h3,.tile.coming p{opacity:.62}
.tile.coming .soon{font-size:11px;font-weight:650;letter-spacing:.04em;text-transform:uppercase;
  color:var(--c-cell,#635bff);background:color-mix(in srgb,var(--c-cell,#635bff) 12%,transparent);
  padding:3px 8px;border-radius:999px;white-space:nowrap}
.tile.coming .tile-head{display:flex;align-items:center;gap:10px;justify-content:space-between}
.tile.coming .shimmer{position:absolute;inset:0;pointer-events:none;
  background:linear-gradient(100deg,transparent 20%,color-mix(in srgb,var(--c-cell,#635bff) 14%,transparent) 45%,
    color-mix(in srgb,var(--c-cell,#635bff) 6%,transparent) 55%,transparent 80%);
  background-size:220% 100%;animation:sola-shimmer 2.4s ease-in-out infinite}
@keyframes sola-shimmer{0%{background-position:180% 0}100%{background-position:-60% 0}}
@media (prefers-reduced-motion:reduce){
  .tile.coming .shimmer{animation:none;
    background:color-mix(in srgb,var(--c-cell,#635bff) 7%,transparent)}
}


/* ---- repositories -------------------------------------------------------
   Cards rather than one-line rows: a repository is a name, what it is for, and
   when it last moved, and none of that fits on a line on a phone. The grid
   collapses to a single column on its own, so the mobile view is the same
   markup and not a second layout to keep in step. */
.repo-grid{display:grid;gap:12px;margin:0 0 22px;
  grid-template-columns:repeat(auto-fill,minmax(280px,1fr))}
.repo-card{background:var(--panel,#fff);border:1px solid var(--line,#e6e2f0);border-radius:12px;
  padding:14px 15px;display:flex;flex-direction:column;gap:8px;min-width:0}
.repo-card header{display:flex;align-items:center;gap:8px;min-width:0}
.repo-card .repo-name{font-weight:650;font-size:15px;text-decoration:none;color:inherit;
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.repo-card .repo-name:hover{text-decoration:underline}
.repo-tag{font-size:11px;letter-spacing:.04em;text-transform:uppercase;padding:1px 7px;border-radius:999px;
  border:1px solid var(--line,#e6e2f0);color:var(--dim,#6b6780);flex:none}
.repo-desc{margin:0;font-size:13px;color:var(--dim,#6b6780);
  display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.repo-card footer{display:flex;align-items:center;justify-content:space-between;gap:10px;
  margin-top:auto;flex-wrap:wrap}
.repo-source{margin:0 0 28px}
.repo-source-head{display:flex;align-items:baseline;justify-content:space-between;gap:12px;margin:0 0 10px}
.repo-source-head h3{margin:0}.repo-source-head span{color:var(--muted);font-size:12px}
.repo-genomes{margin:0 0 22px}.repo-genomes summary{cursor:pointer;color:var(--muted);margin:-8px 0 14px}
.repo-when{font-size:12px;color:var(--dim,#6b6780)}
.repo-actions{display:flex;gap:6px;flex-wrap:wrap}
.repo-actions .sm{font-size:12px;padding:5px 9px}
@media (max-width:640px){
  .repo-grid{grid-template-columns:1fr;gap:10px}
  .repo-card footer{align-items:flex-start}
  .repo-actions{width:100%}
  .repo-actions .button,.repo-actions button{flex:1;justify-content:center}
}

/* ===== Ingress + Research modules ===== */
.src-list { display: flex; flex-direction: column; gap: 10px; }
.src { border: 1px solid var(--line); border-radius: 12px; background: var(--panel); overflow: hidden; }
.src.open { box-shadow: var(--shadow-sm); }
.src-head { width: 100%; display: flex; align-items: center; gap: 12px; padding: 13px 14px; background: none; border: 0; cursor: pointer; text-align: left; min-height: auto; }
.src-head .ic { width: 34px; height: 34px; flex-shrink: 0; border-radius: 9px; display: grid; place-items: center; background: var(--panel-soft); border: 1px solid var(--line); color: var(--muted); }
.src.on .src-head .ic { color: var(--acc, var(--c-ingress)); border-color: color-mix(in srgb, var(--c-ingress) 40%, var(--line)); }
.src-t { flex: 1; min-width: 0; }
.src-t b { display: block; font-size: 14px; }
.src-t small { color: var(--muted); font-size: 12px; }
.src-state { display: inline-flex; align-items: center; gap: 6px; color: var(--muted-2); font-size: 12px; font-weight: 600; white-space: nowrap; }
.src-state .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted-2); }
.src.on .src-state { color: var(--green); }
.src.on .src-state .dot { background: var(--green); }
.src-chev { color: var(--muted-2); display: inline-flex; transition: transform .15s; }
.src-chev svg { width: 16px; height: 16px; }
.src.open .src-chev { transform: rotate(90deg); }
.src-body { display: none; padding: 0 14px 14px; border-top: 1px solid var(--line-soft); }
.src.open .src-body { display: block; padding-top: 12px; }
.keyout { display: block; background: var(--panel-soft); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 12.5px; color: var(--text); word-break: break-all; }
.mono, pre.keyout { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; }
.keyline { display: flex; gap: 8px; align-items: stretch; }
.keyline .keyout { flex: 1; }
.token-row { display: flex; gap: 8px; }
.token-row input { flex: 1; }
.token-ok { display: flex; gap: 8px; align-items: center; }
.token-ok .keyout { flex: 1; }
.hint { color: var(--muted); font-size: 12.5px; margin: 8px 0 0; line-height: 1.45; }
.hint code { background: var(--panel-soft); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; font-size: 12px; }
.src-body .field { margin-top: 2px; }
.src-body .sm.secondary { margin-top: 8px; }

.inb-list { display: flex; flex-direction: column; gap: 8px; }
.inb { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel); text-decoration: none; color: inherit; }
a.inb:hover { border-color: color-mix(in srgb, var(--c-research) 45%, var(--line)); box-shadow: var(--shadow-sm); }
.via { flex-shrink: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; font-weight: 600; color: var(--muted); background: var(--panel-soft); border: 1px solid var(--line); border-radius: 6px; padding: 2px 7px; text-transform: lowercase; }
.inb-main { flex: 1; min-width: 0; }
.inb-main b { display: block; font-size: 14px; }
.inb-main span { display: block; color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inb-side { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.inb-side em { color: var(--muted-2); font-size: 12px; font-style: normal; }
.inb-side .sm { text-decoration: none; }

.art-grid { display: grid; grid-template-columns: minmax(0,1.6fr) minmax(0,1fr); gap: 16px; align-items: start; }
.art .meta { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; color: var(--muted-2); font-size: 12px; margin-bottom: 8px; }
.art .meta a { color: var(--c-research); text-decoration: none; word-break: break-all; }
.art h2 { margin: 4px 0 10px; font-size: 18px; }
.art p { color: var(--text); font-size: 13.5px; line-height: 1.55; }
.slot { border: 1.5px dashed var(--line); border-radius: 10px; padding: 11px 12px; margin-top: 10px; color: var(--muted-2); font-size: 12.5px; }
.slot b { display: block; color: var(--text); font-size: 12px; margin-bottom: 3px; }
.slot.filled { border-style: solid; border-color: var(--line); background: var(--panel-soft); color: var(--text); }
.slot.filled > span { color: var(--text); font-size: 13px; line-height: 1.5; }
.claims { list-style: none; margin: 2px 0 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.claims li { font-size: 12.5px; }
.claims li b { display: block; margin-bottom: 1px; }
.claims li span { color: var(--muted); }
@media (max-width: 760px) { .art-grid { grid-template-columns: 1fr; } }

/* ===== Radar + Plots modules ===== */
.plot { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.plot svg { max-width: 100%; height: auto; }
.legend { display: flex; flex-wrap: wrap; gap: 10px 16px; justify-content: center; font-size: 12.5px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--panel-soft); border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; font-size: 12px; color: var(--text); }
.dim-list { display: flex; flex-direction: column; gap: 7px; margin-top: 4px; }
.dim { display: flex; align-items: center; justify-content: space-between; border: 1px solid var(--line); border-radius: 8px; padding: 7px 11px; font-size: 13px; font-weight: 600; }
.dim em { color: var(--muted-2); font-style: normal; font-weight: 600; font-size: 12px; }
.score-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.score-chips span { display: inline-flex; align-items: center; gap: 4px; background: var(--panel-soft); border: 1px solid var(--line); border-radius: 6px; padding: 1px 7px; font-size: 11px; color: var(--muted); }
.score-chips span b { color: var(--text); font-size: 12px; }
.swatch { width: 12px; height: 12px; border-radius: 4px; flex-shrink: 0; align-self: center; }
.fn-card { border: 1px solid color-mix(in srgb, var(--c-radar) 40%, var(--line)); border-radius: 10px; background: var(--panel-soft); padding: 11px 12px; margin-top: 10px; }
.fn-head { display: flex; align-items: center; gap: 7px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; font-weight: 600; color: var(--c-radar); margin-bottom: 8px; }
.fn-head svg { width: 15px; height: 15px; }
.fn-card pre.keyout { max-height: 190px; overflow: auto; font-size: 11.5px; margin: 0 0 8px; }
.fn-card .actions { display: flex; }
.plots-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.panel.editor { display: flex; flex-direction: column; }
.panel.editor textarea { width: 100%; box-sizing: border-box; min-height: 300px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; line-height: 1.5; border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; background: var(--panel-soft); color: var(--text); }
.panel.editor textarea:focus { outline: 2px solid color-mix(in srgb, var(--c-plots) 45%, transparent); outline-offset: 1px; }
.panel.editor .bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; }
@media (max-width: 760px) { .plots-grid { grid-template-columns: 1fr; } .panel.editor textarea { min-height: 200px; } }

/* Calendar "Sync to phone" card — buttons on their own wrapping row, URL full-width */
.sub-card .sub-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 2px; }
.sub-card .sub-actions .button { text-decoration: none; }
.sub-card .keyline .keyout { flex: 1 1 100%; word-break: break-all; }
@media (max-width: 640px) {
  .sub-card .sub-actions { display: grid; grid-template-columns: 1fr; }
  .sub-card .sub-actions .button { justify-content: center; }
  /* any keyed URL row wraps rather than squishing on narrow screens */
  .keyline { flex-wrap: wrap; }
  .keyline .keyout { flex: 1 1 100%; }
}
