/* ==========================================================================
   ODOOM CODE HUB — desktop agent
   Mission-control interface. Industrial, engineered, never playful.
   Everything on an 8px grid. No external fonts, no CDN — works offline.
   ========================================================================== */

:root {
  /* Surfaces */
  --bg:        #090B10;
  --panel:     #11141B;
  --raised:    #171C26;
  --hairline:  rgba(255, 255, 255, 0.05);
  --hairline-strong: rgba(255, 255, 255, 0.09);

  /* Text */
  --text:      #FFFFFF;
  --text-2:    rgba(255, 255, 255, 0.65);
  --text-3:    rgba(255, 255, 255, 0.35);
  --text-4:    rgba(255, 255, 255, 0.18);

  /* Status — the only colour in the interface */
  --online:    #34D399;
  --warning:   #FBBF24;
  --error:     #EF4444;
  --sync:      #3B82F6;
  --locked:    #8B5CF6;
  --offline:   #6B7280;

  /* Accent: electric blue, never dominant. Selection and focus only. */
  --accent:    #3B82F6;
  --accent-dim: rgba(59, 130, 246, 0.12);

  --u: 8px;                       /* the grid unit */
  --nav-w: 232px;
  --tel-w: 296px;
  --top-h: 56px;
  --con-h: 184px;

  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI Variable Display", "Segoe UI",
          Inter, "Helvetica Neue", system-ui, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", "JetBrains Mono", Consolas, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}

::selection { background: var(--accent-dim); color: var(--text); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.07);
  border: 3px solid transparent;
  background-clip: content-box;
  border-radius: 6px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.14); background-clip: content-box; }

/* --------------------------------------------------------------------------
   Shell
   -------------------------------------------------------------------------- */

.shell {
  display: grid;
  grid-template-columns: var(--nav-w) 1fr var(--tel-w);
  grid-template-rows: var(--top-h) 1fr var(--con-h);
  grid-template-areas:
    "nav top top"
    "nav main tel"
    "nav con con";
  height: 100vh;
}
.shell.console-collapsed { grid-template-rows: var(--top-h) 1fr 36px; }

/* --------------------------------------------------------------------------
   Left navigation
   -------------------------------------------------------------------------- */

.nav {
  grid-area: nav;
  background: var(--panel);
  border-right: 1px solid var(--hairline);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.brand {
  height: var(--top-h);
  display: flex;
  align-items: center;
  gap: calc(var(--u) * 1.5);
  padding: 0 calc(var(--u) * 2.5);
  border-bottom: 1px solid var(--hairline);
  flex-shrink: 0;
}
.brand svg { width: 22px; height: 22px; color: var(--text); flex-shrink: 0; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-name {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.brand-sub {
  font-size: 9.5px;
  color: var(--text-3);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.nav-scroll { flex: 1; overflow-y: auto; padding: calc(var(--u) * 2) 0; }

.nav-label {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-4);
  padding: 0 calc(var(--u) * 2.5);
  margin: calc(var(--u) * 2.5) 0 var(--u);
}
.nav-label:first-child { margin-top: 0; }

.nav-item {
  display: flex;
  align-items: center;
  gap: calc(var(--u) * 1.5);
  padding: calc(var(--u) * 1.25) calc(var(--u) * 2.5);
  color: var(--text-2);
  cursor: pointer;
  border-left: 2px solid transparent;
  user-select: none;
  transition: color .12s ease, background .12s ease;
}
.nav-item:hover { color: var(--text); background: rgba(255, 255, 255, 0.02); }
.nav-item.active {
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
  border-left-color: var(--accent);
}
.nav-item svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 1.4; flex-shrink: 0; }
.nav-item .count {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--text-3);
}
.nav-item .count.alert { color: var(--error); }

.nav-foot {
  border-top: 1px solid var(--hairline);
  padding: calc(var(--u) * 2) calc(var(--u) * 2.5);
  flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   Top bar
   -------------------------------------------------------------------------- */

.top {
  grid-area: top;
  background: var(--panel);
  border-bottom: 1px solid var(--hairline);
  display: flex;
  align-items: center;
  gap: calc(var(--u) * 3);
  padding: 0 calc(var(--u) * 3);
}

.search {
  flex: 1;
  max-width: 460px;
  display: flex;
  align-items: center;
  gap: var(--u);
  background: var(--bg);
  border: 1px solid var(--hairline);
  padding: calc(var(--u) * 0.75) calc(var(--u) * 1.5);
  transition: border-color .12s ease;
}
.search:focus-within { border-color: var(--accent); }
.search svg { width: 13px; height: 13px; stroke: var(--text-3); fill: none; stroke-width: 1.5; }
.search input {
  flex: 1; background: none; border: none; outline: none;
  color: var(--text); font-family: var(--sans); font-size: 12px;
}
.search input::placeholder { color: var(--text-4); }

.top-spacer { flex: 1; }

.top-stat {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.3;
}
.top-stat .k {
  font-size: 9px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-4);
}
.top-stat .v { font-size: 12px; color: var(--text-2); font-family: var(--mono); }
.top-divider { width: 1px; height: 24px; background: var(--hairline); }

/* --------------------------------------------------------------------------
   Main
   -------------------------------------------------------------------------- */

.main {
  grid-area: main;
  overflow-y: auto;
  padding: calc(var(--u) * 5) calc(var(--u) * 6);
}

.page-head { margin-bottom: calc(var(--u) * 5); }
.page-title {
  font-size: 30px;
  font-weight: 200;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  line-height: 1.1;
}
.page-sub {
  margin-top: calc(var(--u) * 1.5);
  display: flex;
  align-items: center;
  gap: var(--u);
  font-size: 13px;
  color: var(--text-2);
}

.section-label {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-4);
  margin-bottom: calc(var(--u) * 2);
}

/* Summary cards ---------------------------------------------------------- */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(216px, 1fr));
  gap: calc(var(--u) * 2);
  margin-bottom: calc(var(--u) * 5);
}
.card {
  background: var(--panel);
  border: 1px solid var(--hairline);
  padding: calc(var(--u) * 2.5);
}
.card-label {
  font-size: 9.5px; font-weight: 600; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--text-4);
  margin-bottom: calc(var(--u) * 2);
}
.card-figure {
  font-size: 38px; font-weight: 200; line-height: 1;
  font-variant-numeric: tabular-nums; letter-spacing: -0.01em;
  margin-bottom: calc(var(--u) * 2);
}
.card-rows { display: flex; flex-direction: column; gap: calc(var(--u) * 0.75); }
.card-row {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 11.5px; color: var(--text-2);
}
.card-row .v { font-family: var(--mono); color: var(--text); }
.card-row .v.muted { color: var(--text-3); }

/* Status lights ---------------------------------------------------------- */

.dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--offline); flex-shrink: 0; display: inline-block;
}
.dot.online  { background: var(--online);  box-shadow: 0 0 6px rgba(52, 211, 153, .45); animation: pulse 3.2s ease-in-out infinite; }
.dot.warning { background: var(--warning); box-shadow: 0 0 6px rgba(251, 191, 36, .45); animation: pulse 3.2s ease-in-out infinite; }
.dot.error   { background: var(--error);   box-shadow: 0 0 6px rgba(239, 68, 68, .5);   animation: pulse 1.9s ease-in-out infinite; }
.dot.sync    { background: var(--sync);    box-shadow: 0 0 6px rgba(59, 130, 246, .45); animation: pulse 2.2s ease-in-out infinite; }
.dot.locked  { background: var(--locked); }
.dot.unknown { background: var(--offline); }

/* Slow, minimal. Never a spinner. */
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .42; } }

.text-online  { color: var(--online); }
.text-warning { color: var(--warning); }
.text-error   { color: var(--error); }
.text-sync    { color: var(--sync); }
.text-muted   { color: var(--text-3); }

/* Table ------------------------------------------------------------------ */

.table { width: 100%; border-collapse: collapse; }
.table thead th {
  text-align: left;
  font-size: 9.5px; font-weight: 600; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--text-4);
  padding: 0 calc(var(--u) * 1.5) calc(var(--u) * 1.5);
  border-bottom: 1px solid var(--hairline);
  white-space: nowrap;
}
.table tbody tr {
  border-bottom: 1px solid var(--hairline);
  cursor: pointer;
  transition: background .1s ease;
}
.table tbody tr:hover { background: rgba(255, 255, 255, 0.02); }
.table tbody tr.expanded { background: rgba(255, 255, 255, 0.03); }
.table td {
  padding: calc(var(--u) * 1.75) calc(var(--u) * 1.5);
  font-size: 12px;
  color: var(--text-2);
  vertical-align: middle;
}
.table td.name { color: var(--text); font-weight: 500; }
.table td .mono { font-family: var(--mono); font-size: 11px; }
.cell-status { display: flex; align-items: center; gap: var(--u); white-space: nowrap; }

.detail-row td { padding: 0; background: var(--bg); }
.detail-inner {
  padding: calc(var(--u) * 3) calc(var(--u) * 1.5);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: calc(var(--u) * 3);
  border-bottom: 1px solid var(--hairline);
}
.detail-block .section-label { margin-bottom: var(--u); }
.detail-line {
  display: flex; justify-content: space-between; gap: var(--u);
  font-size: 11.5px; padding: 3px 0; color: var(--text-2);
}
.detail-line .v { font-family: var(--mono); color: var(--text); }

/* Buttons ---------------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; gap: var(--u);
  background: var(--raised);
  border: 1px solid var(--hairline-strong);
  color: var(--text-2);
  font-family: var(--sans);
  font-size: 10.5px; font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase;
  padding: calc(var(--u) * 1) calc(var(--u) * 2);
  cursor: pointer;
  transition: all .12s ease;
  white-space: nowrap;
}
.btn:hover { color: var(--text); border-color: rgba(255,255,255,.2); background: #1c2230; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .35; cursor: not-allowed; }
.btn.primary { border-color: rgba(59,130,246,.4); color: #9DC2FB; }
.btn.primary:hover { background: var(--accent-dim); border-color: var(--accent); color: #CFE0FD; }
.btn.danger { border-color: rgba(239,68,68,.35); color: #F79595; }
.btn.danger:hover { background: rgba(239,68,68,.1); border-color: var(--error); }
.btn.lg { padding: calc(var(--u) * 1.75) calc(var(--u) * 3.5); font-size: 11.5px; }

.btn-row { display: flex; gap: var(--u); flex-wrap: wrap; }

/* Progress line — used instead of spinners --------------------------------- */

.progress {
  height: 1px; background: var(--hairline); overflow: hidden; position: relative;
}
.progress::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  animation: sweep 1.4s ease-in-out infinite;
}
@keyframes sweep { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }

/* Empty state ------------------------------------------------------------- */

.empty {
  border: 1px dashed var(--hairline-strong);
  padding: calc(var(--u) * 6);
  text-align: center;
  color: var(--text-3);
}
.empty h3 {
  font-size: 13px; font-weight: 500; color: var(--text-2);
  letter-spacing: 0.06em; margin-bottom: var(--u);
}
.empty p { font-size: 12px; max-width: 46ch; margin: 0 auto calc(var(--u) * 2); line-height: 1.7; }
.empty code {
  font-family: var(--mono); font-size: 11px;
  background: var(--panel); border: 1px solid var(--hairline);
  padding: 2px 6px; color: var(--text-2);
}

/* --------------------------------------------------------------------------
   Right telemetry panel
   -------------------------------------------------------------------------- */

.tel {
  grid-area: tel;
  background: var(--panel);
  border-left: 1px solid var(--hairline);
  overflow-y: auto;
  padding: calc(var(--u) * 3);
}
.tel-section { margin-bottom: calc(var(--u) * 4); }
.tel-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--u); padding: calc(var(--u) * 0.75) 0;
  font-size: 11.5px; color: var(--text-2);
}
.tel-row .v { font-family: var(--mono); color: var(--text); font-size: 11px; }
.tel-row .k { display: flex; align-items: center; gap: var(--u); }

.meter { height: 2px; background: rgba(255,255,255,.06); margin-top: 5px; overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--accent); transition: width .6s ease; }
.meter.warn span { background: var(--warning); }
.meter.crit span { background: var(--error); }

/* --------------------------------------------------------------------------
   Bottom event console
   -------------------------------------------------------------------------- */

.con {
  grid-area: con;
  background: var(--panel);
  border-top: 1px solid var(--hairline);
  display: flex; flex-direction: column; overflow: hidden;
}
.con-head {
  height: 35px; flex-shrink: 0;
  display: flex; align-items: center; gap: calc(var(--u) * 1.5);
  padding: 0 calc(var(--u) * 3);
  border-bottom: 1px solid var(--hairline);
  cursor: pointer; user-select: none;
}
.con-head .section-label { margin: 0; }
.con-body {
  flex: 1; overflow-y: auto;
  padding: var(--u) calc(var(--u) * 3);
  font-family: var(--mono); font-size: 10.5px; line-height: 1.85;
}
.shell.console-collapsed .con-body { display: none; }
.con-line { display: flex; gap: calc(var(--u) * 2); white-space: nowrap; }
.con-line .t { color: var(--text-4); flex-shrink: 0; }
.con-line .p { color: var(--text-3); flex-shrink: 0; min-width: 132px; }
.con-line .m { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; }
.con-line.warn .m { color: var(--warning); }
.con-line.error .m { color: var(--error); }

/* --------------------------------------------------------------------------
   Plan / diff view
   -------------------------------------------------------------------------- */

.op-line {
  display: grid;
  grid-template-columns: 18px 84px 1fr auto;
  gap: calc(var(--u) * 1.5);
  align-items: center;
  padding: calc(var(--u) * 0.9) 0;
  border-bottom: 1px solid var(--hairline);
  font-size: 11.5px;
}
.op-line .glyph { text-align: center; font-family: var(--mono); }
.op-line .kind {
  font-size: 9.5px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase;
}
.op-line .path { font-family: var(--mono); color: var(--text-2); overflow: hidden; text-overflow: ellipsis; }
.op-line .meta { font-family: var(--mono); font-size: 10.5px; color: var(--text-4); }
.op-line.conflict .path { color: var(--text); }

.plan-summary {
  display: flex; gap: calc(var(--u) * 3); flex-wrap: wrap;
  padding: calc(var(--u) * 2) 0;
  font-size: 11.5px;
}
.plan-summary b { font-family: var(--mono); font-weight: 500; }

.banner {
  border: 1px solid;
  padding: calc(var(--u) * 2);
  margin-bottom: calc(var(--u) * 3);
  font-size: 12px;
  display: flex; gap: calc(var(--u) * 1.5); align-items: flex-start;
}
.banner.error   { border-color: rgba(239,68,68,.3);  background: rgba(239,68,68,.05);  color: #F7B5B5; }
.banner.warning { border-color: rgba(251,191,36,.3); background: rgba(251,191,36,.05); color: #F5D68A; }
.banner.info    { border-color: rgba(59,130,246,.3); background: rgba(59,130,246,.05); color: #B6D2FB; }
.banner b { display: block; margin-bottom: 3px; color: inherit; }

/* Timeline --------------------------------------------------------------- */

.timeline { position: relative; padding-left: calc(var(--u) * 3); }
.timeline::before {
  content: ''; position: absolute; left: 3px; top: 6px; bottom: 6px;
  width: 1px; background: var(--hairline-strong);
}
.tl-item { position: relative; padding: calc(var(--u) * 1.25) 0; }
.tl-item::before {
  content: ''; position: absolute; left: calc(var(--u) * -3 + 1px); top: 15px;
  width: 5px; height: 5px; border-radius: 50%; background: var(--text-4);
}
.tl-item.ai::before { background: var(--locked); }
.tl-item.sync::before { background: var(--sync); }
.tl-time { font-family: var(--mono); font-size: 10.5px; color: var(--text-4); }
.tl-label { font-size: 12px; color: var(--text); margin: 2px 0; }
.tl-meta { font-family: var(--mono); font-size: 10.5px; color: var(--text-3); }

/* Device cards ------------------------------------------------------------ */

.devices { display: grid; grid-template-columns: repeat(auto-fit, minmax(292px, 1fr)); gap: calc(var(--u) * 2); }
.device {
  background: var(--panel);
  border: 1px solid var(--hairline);
  padding: calc(var(--u) * 3);
}
.device-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--u); margin-bottom: calc(var(--u) * 2.5); }
.device-name { font-size: 13px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; }
.device-kind { font-size: 9.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-4); margin-top: 2px; }
.device-badge {
  font-size: 9px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase;
  padding: 3px 7px; border: 1px solid;
}
.device-badge.online  { border-color: rgba(52,211,153,.35); color: var(--online); }
.device-badge.unknown { border-color: var(--hairline-strong); color: var(--text-3); }

.safe-remove {
  margin-top: calc(var(--u) * 2.5);
  padding: calc(var(--u) * 2);
  border: 1px solid rgba(52,211,153,.3);
  background: rgba(52,211,153,.05);
  text-align: center;
  font-size: 11px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--online);
}

/* File browser ------------------------------------------------------------ */

.browse-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: calc(var(--u) * 2);
  align-items: start;
}
@media (max-width: 1240px) { .browse-grid { grid-template-columns: 1fr; } }

.crumbs {
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px;
  font-family: var(--mono); font-size: 11.5px;
}
.crumb { color: var(--text-2); cursor: pointer; padding: 2px 4px; }
.crumb:hover { color: var(--accent); text-decoration: underline; }
.crumb:last-child { color: var(--text); }
.crumb-sep { color: var(--text-4); }

.file-row {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) 88px 72px;
  gap: var(--u);
  align-items: center;
  padding: calc(var(--u) * 1) calc(var(--u) * 2);
  border-bottom: 1px solid var(--hairline);
  cursor: pointer;
  font-size: 12px;
  transition: background .1s ease;
}
.file-row:hover { background: rgba(255, 255, 255, 0.03); }
.file-row.selected { background: var(--accent-dim); }
/* Ignored entries are DIMMED, never hidden — a browser that silently omits things
   teaches you not to trust it. */
.file-row.ignored { opacity: .38; }
.file-row .fg { font-family: var(--mono); color: var(--text-4); text-align: center; }
.file-row .fn { font-family: var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row .fs,
.file-row .fd { font-family: var(--mono); font-size: 10.5px; color: var(--text-4); text-align: right; }

.file-text {
  background: var(--bg);
  border: 1px solid var(--hairline);
  padding: calc(var(--u) * 2);
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.65;
  color: var(--text-2);
  max-height: 480px;
  overflow: auto;
  white-space: pre;
  tab-size: 2;
}

.preview-log {
  margin-top: var(--u);
  background: var(--bg);
  border: 1px solid var(--hairline);
  padding: var(--u) calc(var(--u) * 1.5);
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.6;
  color: var(--text-3);
  max-height: 132px;
  overflow: auto;
  white-space: pre-wrap;
}

/* Utility ---------------------------------------------------------------- */

.hidden { display: none !important; }
.mono { font-family: var(--mono); }
.stack { display: flex; flex-direction: column; gap: calc(var(--u) * 3); }
.row { display: flex; align-items: center; gap: calc(var(--u) * 1.5); }
.between { display: flex; align-items: center; justify-content: space-between; gap: calc(var(--u) * 2); }

.panel {
  background: var(--panel);
  border: 1px solid var(--hairline);
  padding: calc(var(--u) * 3);
}

@media (max-width: 1500px) { :root { --tel-w: 0px; } .tel { display: none; } }
@media (max-width: 1120px) { :root { --nav-w: 60px; } .brand-text, .nav-item span, .nav-label { display: none; } }

/* Setup ------------------------------------------------------------------- */

.tabs {
  display: flex; gap: 2px;
  border-bottom: 1px solid var(--hairline);
  margin-bottom: calc(var(--u) * 3);
}
.tab {
  padding: calc(var(--u) * 1.25) calc(var(--u) * 2.5);
  font-size: 11px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--text-3); cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color .12s ease, border-color .12s ease;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }

.step { display: flex; gap: calc(var(--u) * 2); padding: calc(var(--u) * 2) 0; }
.step + .step { border-top: 1px solid var(--hairline); }
.step-n {
  flex-shrink: 0;
  width: 22px; height: 22px;
  border: 1px solid var(--hairline-strong);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 11px; color: var(--text-3);
}
.step-body { min-width: 0; flex: 1; }
.step-title { font-size: 12.5px; color: var(--text); margin-bottom: calc(var(--u) * 0.75); }
.muted-p { font-size: 11.5px; color: var(--text-2); line-height: 1.7; margin-bottom: var(--u); }
.muted-p code {
  font-family: var(--mono); font-size: 10.5px;
  background: var(--bg); border: 1px solid var(--hairline); padding: 1px 5px; color: var(--text-2);
}

.snippet {
  background: var(--bg);
  border: 1px solid var(--hairline);
  border-left: 2px solid var(--accent);
  padding: calc(var(--u) * 1.5) calc(var(--u) * 2);
  font-family: var(--mono); font-size: 10.5px; line-height: 1.8;
  color: var(--text-2);
  overflow-x: auto;
  white-space: pre;
  user-select: all;   /* one click selects the whole command */
}

/* Embedded in the portal --------------------------------------------------- */

.embed-bar {
  display: block;
  background: var(--raised);
  border-bottom: 1px solid var(--hairline);
  padding: calc(var(--u) * 1.25) calc(var(--u) * 3);
  font-size: 11px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--text-2); text-decoration: none;
}
.embed-bar:hover { color: var(--text); background: #1c2230; }
/* The shell is 100vh; inside an iframe the bar must come out of that or the
   event console is pushed below the fold. */
/* The shell is 100vh; the return bar has to come out of that or the event console
   is pushed below the fold. Keyed on the bar being present, not on framing —
   after a hand-off the hub is top-level but the bar is still there. */
body.has-bar .shell { height: calc(100vh - 38px); }

/* Drive onboarding wizard --------------------------------------------------- */

.drive-row {
  display: flex; align-items: center; justify-content: space-between; gap: var(--u);
  padding: calc(var(--u) * 1.5) 0;
  border-bottom: 1px solid var(--hairline);
}
.drive-row:last-child { border-bottom: none; }

.wiz-steps {
  display: flex; gap: calc(var(--u) * 3);
  padding: calc(var(--u) * 2) 0 calc(var(--u) * 3);
}
.wiz-step {
  display: flex; align-items: center; gap: var(--u);
  font-size: 11px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--text-4);
}
.wiz-step.active { color: var(--text); }
.wiz-step.done { color: var(--online); }
.wiz-dot {
  width: 20px; height: 20px; border-radius: 50%;
  border: 1px solid currentColor;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 10px;
}

.pick-row {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) 84px 88px;
  gap: var(--u); align-items: center;
  padding: calc(var(--u) * 1) 0;
  border-bottom: 1px solid var(--hairline);
  cursor: pointer;
  font-size: 12px;
}
.pick-row:hover { background: rgba(255, 255, 255, 0.02); }
.pick-row input { accent-color: var(--accent); cursor: pointer; }
.pick-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-meta { font-size: 10.5px; color: var(--text-4); text-align: right; }

.run-log { display: flex; flex-direction: column; }
.run-line {
  display: grid;
  grid-template-columns: 16px minmax(0, 240px) 1fr;
  gap: calc(var(--u) * 1.5); align-items: center;
  padding: calc(var(--u) * 0.9) 0;
  border-bottom: 1px solid var(--hairline);
  font-size: 12px;
}
.run-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.run-detail { font-size: 10.5px; color: var(--text-3); }

/* Transfers ---------------------------------------------------------------- */

.xfer { padding: calc(var(--u) * 2) 0; border-bottom: 1px solid var(--hairline); }
.xfer:last-child { border-bottom: none; }
.xfer-sub { font-size: 10.5px; color: var(--text-4); margin-top: 3px; }
.xfer-pct {
  font-size: 20px; font-weight: 200; line-height: 1;
  font-variant-numeric: tabular-nums; letter-spacing: -0.01em;
}

.xfer-bar {
  height: 2px; background: rgba(255, 255, 255, .06);
  margin: calc(var(--u) * 1.5) 0 var(--u);
  overflow: hidden; position: relative;
}
.xfer-bar span {
  display: block; height: 100%; background: var(--sync);
  transition: width .4s ease;
}
/* A faint sweep over the filled portion: the bar reads as live even between the
   discrete jumps you get when a single large file is mid-flight. */
.xfer-bar.live::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(59,130,246,.5), transparent);
  animation: sweep 1.8s ease-in-out infinite;
}

.xfer-foot {
  font-size: 10.5px; color: var(--text-3);
  min-height: 20px; align-items: center;
}
.xfer-foot .mono { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Folder picker ------------------------------------------------------------ */

.folder-current {
  background: var(--bg);
  border: 1px solid var(--hairline);
  border-left: 2px solid var(--accent);
  padding: calc(var(--u) * 1.25) calc(var(--u) * 2);
  font-size: 11.5px; color: var(--text);
  margin-bottom: calc(var(--u) * 2);
  word-break: break-all;
}
.folder-list {
  border: 1px solid var(--hairline);
  max-height: 280px; overflow-y: auto;
  min-height: 60px;
}

/* Sync --------------------------------------------------------------------- */

.sync-headline { border-left: 2px solid var(--accent); }

.sync-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  gap: calc(var(--u) * 1.5);
  align-items: center;
  padding: calc(var(--u) * 1.75) 0;
  border-bottom: 1px solid var(--hairline);
}
.sync-row:last-child { border-bottom: none; }
.sync-row.muted { opacity: .5; padding: calc(var(--u) * 0.75) 0; }
.sync-glyph { font-family: var(--mono); font-size: 14px; text-align: center; }
.sync-name { font-size: 12.5px; color: var(--text); }
.sync-summary { font-size: 11.5px; color: var(--text-2); margin-top: 3px; }
.sync-tag {
  font-size: 9px; letter-spacing: .12em; margin-left: 8px;
  padding: 1px 5px; border: 1px solid var(--hairline-strong); color: var(--text-4);
}

/* ===========================================================================
   Modal
   ---------------------------------------------------------------------------
   The first dialog in this interface. It exists because `alert()` cannot be
   styled, cannot hold a button, and on several browsers cannot even be selected
   from — which made "copy this token, it is shown once" a genuinely impossible
   instruction to follow.

   Deliberately quiet: same near-black surfaces, same hairlines, no colour
   except where something is a status. A dialog that arrives shouting is a
   dialog people dismiss without reading, and the things shown here are shown
   exactly once.
   =========================================================================== */

.modal-backdrop {
  position: fixed; inset: 0; z-index: 200;
  display: grid; place-items: center;
  padding: calc(var(--u) * 3);
  background: rgba(4, 6, 10, 0.72);
  /* Blur rather than dim alone: the interface behind stays legible as context
     without competing for attention. */
  backdrop-filter: blur(3px);
  animation: modal-in 140ms ease-out;
}

@keyframes modal-in { from { opacity: 0 } to { opacity: 1 } }

.modal {
  width: min(560px, 100%);
  max-height: min(80vh, 720px);
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--hairline-strong);
  /* One soft shadow. It is the only elevation in the product, so it can afford
     to be the only one that reads as lifted. */
  box-shadow: 0 24px 64px -12px rgba(0, 0, 0, 0.7);
  animation: modal-rise 160ms cubic-bezier(0.2, 0.7, 0.3, 1);
}

@keyframes modal-rise {
  from { transform: translateY(8px); opacity: 0 }
  to   { transform: none; opacity: 1 }
}

@media (prefers-reduced-motion: reduce) {
  .modal-backdrop, .modal { animation: none }
}

.modal-head {
  padding: calc(var(--u) * 3) calc(var(--u) * 3) calc(var(--u) * 2);
  border-bottom: 1px solid var(--hairline);
}
.modal-title { font-size: 15px; font-weight: 500; letter-spacing: -0.01em; }
.modal-body { padding: calc(var(--u) * 3); }
.modal-foot {
  display: flex; justify-content: flex-end; gap: var(--u);
  padding: calc(var(--u) * 2) calc(var(--u) * 3) calc(var(--u) * 3);
}

/* A value shown once and meant to be taken away. */
.copyfield {
  display: flex; align-items: stretch; gap: 0;
  border: 1px solid var(--hairline-strong);
  background: var(--bg);
}
.copyfield input {
  flex: 1; min-width: 0;
  background: transparent; border: 0;
  color: var(--text);
  font-family: var(--mono); font-size: 12px;
  letter-spacing: 0.02em;
  padding: calc(var(--u) * 1.5) calc(var(--u) * 2);
}
.copyfield input:focus { outline: none; }
.copyfield input::selection { background: var(--accent-dim); }
.copyfield .btn {
  border: 0; border-left: 1px solid var(--hairline-strong);
  border-radius: 0;
  min-width: 92px; justify-content: center;
}
/* Confirmation is the label changing, not a toast. The answer to "did that
   work" should be where you just looked, not somewhere else on screen. */
.copyfield .btn.copied { color: var(--online); }

/* A plain text input. There was none: the interface had a search box and a
   read-only copy field and nothing you type a value into, because until relocation
   existed nothing needed one. */
.input {
  background: var(--bg);
  border: 1px solid var(--hairline-strong);
  color: var(--text);
  font-family: var(--mono);
  font-size: 11.5px;
  padding: calc(var(--u) * 1.25) calc(var(--u) * 1.5);
  min-width: 0;
}
.input::placeholder { color: var(--text-4); }
.input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--accent-dim);
}
