/* Alex-Aero dashboard.
 * Warm neutrals, one cream accent, a floating rounded main card with inset
 * wells, sliding segmented indicators and eased motion. No gradients, no glow. */

:root {
  --font: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display: 'Inter', ui-sans-serif, system-ui, sans-serif;
  --mono: 'Geist Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.22, 0.8, 0.24, 1);

  /* cream (dark) */
  --bg: #121110;
  --card: #1a1917;
  --well: #211f1d;
  --well-2: #282624;
  --hover: rgba(236, 220, 191, 0.05);
  --line: rgba(236, 220, 191, 0.08);
  --line-2: rgba(236, 220, 191, 0.14);
  --text: #f1ece3;
  --text-2: #c7bfb2;
  --muted: #8a8378;
  --faint: #5f5a52;
  --ac: #ecdcbf;
  --ac-ink: #1b1915;
  --ac-soft: rgba(236, 220, 191, 0.1);
  --ok: #a9c79b;
  --warn: #e2c38c;
  --err: #e69a8b;
  --ok-soft: rgba(169, 199, 155, 0.12);
  --warn-soft: rgba(226, 195, 140, 0.12);
  --err-soft: rgba(230, 154, 139, 0.12);
  --chart: #d9c7a5;
  --chart-2: #8f8778;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.025) inset, 0 24px 60px -30px rgba(0, 0, 0, 0.7);
  --focus: 0 0 0 3px rgba(236, 220, 191, 0.28);
  --r-card: 18px;
  --r-well: 14px;
  --r: 10px;
  --side-w: 232px;
  color-scheme: dark;
}

/* latte (light) */
:root[data-theme='light'] {
  --bg: #ebe5da;
  --card: #f9f6f1;
  --well: #f1ece4;
  --well-2: #e8e1d6;
  --hover: rgba(60, 45, 25, 0.045);
  --line: rgba(60, 45, 25, 0.09);
  --line-2: rgba(60, 45, 25, 0.16);
  --text: #2a251e;
  --text-2: #4f4639;
  --muted: #857a6b;
  --faint: #b2a897;
  --ac: #2a251e;
  --ac-ink: #f9f6f1;
  --ac-soft: rgba(42, 37, 30, 0.07);
  --ok: #4f7a3f;
  --warn: #9a6a1c;
  --err: #b4503d;
  --ok-soft: rgba(79, 122, 63, 0.1);
  --warn-soft: rgba(154, 106, 28, 0.1);
  --err-soft: rgba(180, 80, 61, 0.09);
  --chart: #8a7656;
  --chart-2: #bfb3a0;
  --shadow: 0 1px 2px rgba(60, 45, 25, 0.05), 0 24px 60px -34px rgba(60, 45, 25, 0.35);
  --focus: 0 0 0 3px rgba(42, 37, 30, 0.18);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.55 var(--font);
  font-feature-settings: 'cv11', 'ss01', 'ss03';
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
code, kbd, pre, .mono { font-family: var(--mono); font-size: 12.5px; }
::selection { background: rgba(236, 220, 191, 0.25); }
:root[data-theme='light'] ::selection { background: rgba(42, 37, 30, 0.15); }
.hidden { display: none !important; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------------------------------------------------------------- shell */
.app { display: grid; grid-template-columns: var(--side-w) 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 18px 12px 14px 14px; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 22px; text-decoration: none; }
.brand-mark { width: 32px; height: 32px; flex: none; display: block; }
.brand-mark .tile { fill: var(--ac); }
.brand-mark .glyph { fill: var(--ac-ink); }
.brand-mark .glyph { stroke: var(--ac-ink); stroke-width: 0.6; }
.brand-mark .shade { opacity: 0.5; }
.brand-name { font: 650 15px/1.15 var(--display); letter-spacing: -0.025em; }
.brand-name em { font-style: normal; color: var(--muted); font-weight: 500; }
.brand-sub { display: block; font-size: 12px; color: var(--muted); font-weight: 400; letter-spacing: 0; margin-top: 2px; }

/* segmented nav with a sliding indicator */
.seg { position: relative; display: flex; flex-direction: column; gap: 2px; }
.seg-ind {
  position: absolute; left: 0; top: 0; border-radius: var(--r); background: var(--well-2); pointer-events: none;
  transition: transform 0.38s var(--ease), width 0.38s var(--ease), height 0.38s var(--ease), opacity 0.2s;
}
.nav-item {
  position: relative; z-index: 1; display: flex; align-items: center; gap: 11px;
  height: 36px; padding: 0 11px; border-radius: var(--r);
  color: var(--text-2); text-decoration: none; font-weight: 500; transition: color 0.2s var(--ease), background 0.2s var(--ease);
}
.nav-item svg { width: 16px; height: 16px; flex: none; opacity: 0.75; }
.nav-item:hover { color: var(--text); }
.nav-item:hover:not(.active) { background: var(--hover); }
.nav-item.active { color: var(--text); }
.nav-item.active svg { opacity: 1; }
.nav-item .count { margin-left: auto; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.nav-label { font-size: 11.5px; color: var(--muted); padding: 22px 11px 8px; }
.nav-worker { height: 32px; font-size: 13.5px; }
.nav-worker .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); flex: none; transition: background 0.3s; }
.nav-worker .dot.live { background: var(--ok); }
.nav-worker .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-foot { margin-top: auto; padding-top: 16px; display: flex; flex-direction: column; gap: 6px; }
.host { display: flex; align-items: center; gap: 9px; padding: 0 11px; height: 34px; font-size: 12.5px; color: var(--muted); }
.host b { font-family: var(--mono); font-weight: 400; font-size: 12px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.host .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); flex: none; }

/* the floating main card */
.main {
  min-width: 0; margin: 10px 10px 10px 0; background: var(--card); border-radius: var(--r-card);
  box-shadow: var(--shadow); border: 1px solid var(--line); display: flex; flex-direction: column;
  min-height: calc(100vh - 20px);
}
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  height: 60px; padding: 0 26px; border-radius: var(--r-card) var(--r-card) 0 0;
  background: color-mix(in srgb, var(--card) 88%, transparent); backdrop-filter: blur(12px);
}
.crumbs { display: flex; align-items: center; gap: 9px; min-width: 0; font-weight: 500; }
.crumbs a { color: var(--muted); text-decoration: none; transition: color 0.2s; }
.crumbs a:hover { color: var(--text); }
.crumbs .sep { color: var(--faint); }
.crumbs .cur { display: flex; align-items: center; gap: 9px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.menu-btn { display: none; }
#view { animation: viewIn 0.42s var(--ease); }
@keyframes viewIn { from { opacity: 0; transform: translateY(6px); } }
.page { padding: 18px 30px 60px; max-width: 1240px; width: 100%; margin: 0 auto; }

/* ----------------------------------------------------------- primitives */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 15px; border-radius: 999px; border: 1px solid var(--line-2);
  background: transparent; color: var(--text); font-weight: 500; font-size: 13.5px; cursor: pointer;
  text-decoration: none; white-space: nowrap;
  transition: background 0.22s var(--ease), border-color 0.22s var(--ease), color 0.22s, transform 0.12s var(--ease);
}
.btn:hover { background: var(--hover); border-color: var(--muted); }
.btn:active { transform: scale(0.98); }
.btn svg { width: 15px; height: 15px; }
.btn.primary { background: var(--ac); color: var(--ac-ink); border-color: transparent; }
.btn.primary:hover { background: color-mix(in srgb, var(--ac) 88%, var(--text)); }
.btn.ghost { border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { color: var(--text); background: var(--hover); }
.btn.danger { color: var(--err); border-color: color-mix(in srgb, var(--err) 35%, transparent); }
.btn.danger:hover { background: var(--err-soft); border-color: var(--err); }
.btn.sm { height: 30px; padding: 0 12px; font-size: 13px; }
.btn[disabled] { opacity: 0.45; pointer-events: none; }
.icon-btn {
  display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 999px;
  border: 0; background: transparent; color: var(--muted); cursor: pointer; text-decoration: none;
  transition: background 0.2s var(--ease), color 0.2s;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn.sm { width: 26px; height: 26px; }
.icon-btn.sm svg { width: 14px; height: 14px; }
.btn:focus-visible, .icon-btn:focus-visible, .nav-item:focus-visible, .tab:focus-visible, .input:focus-visible, .select:focus-visible, .textarea:focus-visible, .chip:focus-visible, .file:focus-visible, .wcard:focus-visible, .tpl:focus-visible { outline: none; box-shadow: var(--focus); }

.input, .select, .textarea {
  width: 100%; height: 38px; padding: 0 13px; background: var(--well); border: 1px solid transparent;
  border-radius: var(--r); color: var(--text); font-size: 13.5px;
  transition: border-color 0.22s var(--ease), background 0.22s var(--ease);
}
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--line-2); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--muted); background: var(--well-2); }
.card .input, .card .select, .card .textarea, .well .input, .well .select { background-color: var(--card); }
.card .input:focus, .card .select:focus, .card .textarea:focus { background-color: var(--card); }
.input.mono, .textarea.mono { font-family: var(--mono); font-size: 12.5px; }
.textarea { height: auto; min-height: 90px; padding: 10px 13px; resize: vertical; line-height: 1.55; }
.select { appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a8378' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field label, .label { font-size: 13px; font-weight: 500; color: var(--text-2); }
.hint { font-size: 12.5px; color: var(--muted); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }

/* wells: inset surfaces inside the main card */
.card, .well { background: var(--well); border-radius: var(--r-well); }
.card-pad { padding: 20px 22px; }
.card-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px 6px; }
.card-head h3 { margin: 0; font-size: 14px; font-weight: 600; }
.card-head .sub { font-size: 12.5px; color: var(--muted); }
.card-head .tools { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.card-body { padding: 12px 20px 20px; }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin: 10px 0 26px; flex-wrap: wrap; }
.page-head .tools { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
h1.page-title { margin: 0; font: 600 30px/1.15 var(--display); letter-spacing: -0.028em; }
.page-sub { margin: 8px 0 0; color: var(--muted); max-width: 60ch; }

.tag { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.tag .d { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tag.ok { color: var(--ok); } .tag.warn { color: var(--warn); } .tag.err { color: var(--err); }
.badge { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 500; background: var(--ac-soft); color: var(--text-2); }
.kbd { font-family: var(--mono); font-size: 11px; padding: 1px 6px; border-radius: 6px; background: var(--well-2); color: var(--muted); }
.empty { padding: 44px 20px; text-align: center; color: var(--muted); }
.empty h4 { margin: 0 0 4px; color: var(--text); font: 600 16px/1.3 var(--display); letter-spacing: -0.01em; }
.empty p { margin: 0 auto; max-width: 42ch; }
.empty .btn { margin-top: 16px; }

/* tabs: segmented, with the same sliding indicator */
.tabs { position: relative; display: inline-flex; gap: 2px; padding: 4px; background: var(--well); border-radius: 999px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.tabs .seg-ind { border-radius: 999px; background: var(--card); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18); }
:root[data-theme='light'] .tabs .seg-ind { box-shadow: 0 1px 3px rgba(60, 45, 25, 0.14); }
.tab {
  position: relative; z-index: 1; display: inline-flex; align-items: center; height: 32px; padding: 0 15px;
  border: 0; background: none; border-radius: 999px; cursor: pointer; color: var(--muted);
  font-weight: 500; font-size: 13.5px; text-decoration: none; white-space: nowrap; transition: color 0.25s var(--ease);
}
.tab:hover { color: var(--text-2); }
.tab.active { color: var(--text); }
.tab .n { margin-left: 7px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tab .n.err { color: var(--err); }

.switch { position: relative; display: inline-block; width: 38px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--well-2); transition: background 0.3s var(--ease); cursor: pointer; }
.switch span::before { content: ''; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--muted); transition: transform 0.35s var(--ease), background 0.3s; }
.switch input:checked + span { background: var(--ac); }
.switch input:checked + span::before { transform: translateX(16px); background: var(--ac-ink); }
.switch input:focus-visible + span { box-shadow: var(--focus); }

/* -------------------------------------------------------------- figures */
.figures { display: flex; flex-wrap: wrap; gap: 1px; background: var(--line); border-radius: var(--r-well); overflow: hidden; margin-bottom: 28px; }
.fig { flex: 1 1 170px; padding: 18px 22px 20px; min-width: 0; background: var(--well); }
.fig .k { font-size: 12.5px; color: var(--muted); }
.fig .v { font: 600 26px/1.2 var(--display); letter-spacing: -0.03em; margin-top: 8px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fig .v small { font: 400 13px var(--font); color: var(--muted); margin-left: 4px; }
.fig .v.err { color: var(--err); }
.fig .f { font-size: 12.5px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meter { height: 3px; border-radius: 3px; background: var(--well-2); overflow: hidden; margin-top: 10px; }
.meter i { display: block; height: 100%; background: var(--chart); border-radius: 3px; transition: width 0.6s var(--ease); }

/* ------------------------------------------------------------- workers */
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.search { position: relative; flex: 1; min-width: 200px; max-width: 340px; }
.search svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--muted); pointer-events: none; }
.search .input { padding-left: 37px; border-radius: 999px; }
.toolbar .select { width: auto; border-radius: 999px; }
.workers { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.wcard {
  display: flex; flex-direction: column; gap: 16px; padding: 18px 20px; text-decoration: none; background: var(--well);
  border-radius: var(--r-well); transition: background 0.3s var(--ease), transform 0.3s var(--ease);
}
.wcard:hover { background: var(--well-2); transform: translateY(-2px); }
.wcard-top { display: flex; align-items: center; gap: 12px; min-width: 0; }
.lang-ico { width: 34px; height: 34px; border-radius: 11px; background: var(--card); display: grid; place-items: center; flex: none; }
.lang-ico svg, .lang-ico img { width: 17px; height: 17px; }
.lang-ico.sm { width: 22px; height: 22px; border-radius: 7px; background: transparent; }
.lang-ico.sm svg, .lang-ico.sm img { width: 14px; height: 14px; }
.wname { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wname .def { font-weight: 400; font-size: 12px; color: var(--muted); margin-left: 6px; }
.wlink { font-family: var(--mono); font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wcard-top .tag { margin-left: auto; }
.wnums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.wnums div { font-size: 12px; color: var(--muted); }
.wnums b { display: block; font: 600 17px/1.3 var(--display); letter-spacing: -0.02em; color: var(--text); font-variant-numeric: tabular-nums; }
.wnums b.err { color: var(--err); }
.wfoot { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }
.wfoot .acts { margin-left: auto; display: flex; gap: 2px; opacity: 0; transition: opacity 0.25s var(--ease); }
.wcard:hover .acts, .wcard:focus-within .acts { opacity: 1; }
.new-card {
  display: grid; place-items: center; align-content: center; gap: 6px; min-height: 206px; border-radius: var(--r-well);
  border: 1px dashed var(--line-2); color: var(--muted); background: transparent; cursor: pointer; text-align: center;
  transition: border-color 0.3s var(--ease), color 0.3s, background 0.3s var(--ease);
}
.new-card:hover { border-color: var(--muted); color: var(--text); background: var(--hover); }
.new-card b { font: 600 15px/1.3 var(--display); color: var(--text); }

/* 24-hour strip */
.spark { display: grid; grid-template-columns: repeat(24, 1fr); gap: 3px; }
.spark i { height: 22px; border-radius: 4px; background: var(--chart); opacity: var(--o, 0.1); transition: opacity 0.5s var(--ease); }
.spark i.zero { background: var(--well-2); opacity: 1; }
.spark i.err { background: var(--err); }
.spark-axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--faint); margin-top: 6px; }

/* ---------------------------------------------------------------- charts */
.chart { width: 100%; display: block; overflow: visible; }
.chart-wrap { position: relative; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart text { fill: var(--muted); font: 10.5px var(--mono); }
.chart .bar { fill: var(--chart); }
.chart .bar.err { fill: var(--err); }
.chart .line { fill: none; stroke: var(--chart-2); stroke-width: 1.6; stroke-linejoin: round; stroke-dasharray: 3 3; }
.chart-tip {
  position: absolute; pointer-events: none; padding: 7px 11px; border-radius: 10px; font-size: 12.5px;
  background: var(--card); border: 1px solid var(--line-2); box-shadow: var(--shadow); white-space: nowrap; z-index: 5;
}
.legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--muted); }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 7px; }

/* ---------------------------------------------------------------- tables */
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12.5px; padding: 8px 20px; white-space: nowrap; }
.table td { padding: 10px 20px; border-top: 1px solid var(--line); vertical-align: middle; }
.table tbody tr { transition: background 0.2s; }
.table tbody tr:hover { background: var(--hover); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--mono); font-size: 12px; }
.table-scroll { overflow-x: auto; padding-bottom: 6px; }
.status { font-family: var(--mono); font-size: 12px; font-weight: 500; }
.status.s2 { color: var(--ok); } .status.s3 { color: var(--text-2); } .status.s4 { color: var(--warn); } .status.s5 { color: var(--err); }

/* ------------------------------------------------------------------ logs */
.logbox { font-family: var(--mono); font-size: 12px; line-height: 1.65; overflow: auto; padding: 6px 0; }
.logline { display: grid; grid-template-columns: 70px 50px 1fr; gap: 12px; padding: 2px 20px; transition: background 0.2s; }
.logline:hover { background: var(--hover); }
.logline .t { color: var(--faint); }
.logline .lv { font-size: 11px; padding-top: 1px; color: var(--muted); }
.logline .lv.warn { color: var(--warn); }
.logline .lv.error { color: var(--err); }
.logline .m { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text-2); }
.logline .w { color: var(--text); margin-right: 8px; }
.logline.new { animation: lineIn 0.6s var(--ease); }
@keyframes lineIn { from { opacity: 0; transform: translateY(3px); } }
.chips { display: inline-flex; gap: 2px; padding: 3px; background: var(--well-2); border-radius: 999px; }
.chip { height: 28px; padding: 0 12px; border-radius: 999px; border: 0; background: transparent; color: var(--muted); font-size: 12.5px; font-weight: 500; cursor: pointer; transition: background 0.25s var(--ease), color 0.25s; }
.chip.on { background: var(--card); color: var(--text); }
.live { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); }
.live::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--ok); animation: breathe 2.4s var(--ease) infinite; }
.live.off::before { background: var(--faint); animation: none; }
@keyframes breathe { 50% { opacity: 0.35; } }

/* -------------------------------------------------------------------- IDE */
.ide-wrap { padding: 0 14px 14px; }
.ide-top { display: flex; align-items: center; gap: 12px; padding: 4px 16px 14px; flex-wrap: wrap; }
.ide {
  display: grid; grid-template-columns: 210px minmax(0, 1fr) minmax(320px, 38%); gap: 10px;
  height: calc(100vh - 146px); min-height: 520px;
}
.files, .editor-col, .side-panel { background: var(--well); border-radius: var(--r-well); min-height: 0; overflow: hidden; display: flex; flex-direction: column; }
.files-head { display: flex; align-items: center; padding: 12px 8px 8px 16px; font-size: 12.5px; color: var(--muted); }
.files-head .tools { margin-left: auto; display: flex; }
.files-list { overflow-y: auto; padding: 0 6px 10px; }
.file {
  display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 10px 0 8px; border-radius: 9px; cursor: pointer;
  font-size: 13.5px; color: var(--text-2); transition: background 0.2s var(--ease), color 0.2s;
}
.file:hover { background: var(--hover); color: var(--text); }
.file.active { background: var(--well-2); color: var(--text); }
.file .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file .entry { margin-left: auto; font-size: 11px; color: var(--muted); }
.file .dirty { width: 7px; height: 7px; border-radius: 50%; background: var(--warn); margin-left: auto; flex: none; }
.file .acts { display: none; margin-left: auto; }
.file:hover .acts { display: flex; }
.file:hover .entry, .file:hover .dirty { display: none; }
.file-input { margin: 2px 0; height: 32px; font-size: 13px; }
.file .chev { flex: none; width: 14px; height: 14px; margin-right: -4px; color: var(--muted); transition: transform 0.2s var(--ease); }
.file.folder.closed .chev { transform: rotate(-90deg); }
.file .ficon { flex: none; width: 16px; height: 16px; color: var(--muted); }
.file.folder .nm { color: var(--text-2); }
.file .bin { margin-left: auto; font-size: 11px; color: var(--muted); }
.file:hover .bin { display: none; }
.files.drop { box-shadow: inset 0 0 0 2px var(--chart); }
.file.drop-target { background: var(--well-2); box-shadow: inset 0 0 0 1px var(--chart); }
.files-hint { padding: 6px 10px 2px; font-size: 11.5px; color: var(--muted); }
.upload-progress { padding: 6px 10px; font-size: 12px; color: var(--muted); }
.bin-preview { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.bin-preview img { max-width: 100%; max-height: 60vh; border-radius: 10px; background: repeating-conic-gradient(#8882 0 25%, transparent 0 50%) 0 0 / 16px 16px; }

.editor-tabs { display: flex; align-items: center; gap: 2px; padding: 6px 6px 0; overflow-x: auto; scrollbar-width: none; min-height: 40px; flex: none; }
.etab {
  display: flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px; border-radius: 9px;
  font-size: 13px; color: var(--muted); cursor: pointer; white-space: nowrap; background: none; border: 0;
  transition: background 0.2s var(--ease), color 0.2s;
}
.etab:hover { color: var(--text-2); }
.etab.active { background: var(--well-2); color: var(--text); }
.etab .dirty { width: 7px; height: 7px; border-radius: 50%; background: var(--warn); }
.editor-host { position: relative; flex: 1; min-height: 0; margin: 6px; border-radius: 10px; overflow: hidden; background: var(--card); }
.ace-host { position: absolute; inset: 0; }
.ace-host.ace_editor { font-variant-ligatures: none; line-height: 21px; }
/* Ace's autocomplete and tooltips live on <body>, outside the editor */
.ace_editor.ace_autocomplete { width: 320px; font-family: 'Geist Mono', ui-monospace, monospace; font-size: 12.5px; line-height: 24px; padding: 4px; }
.ace_tooltip { background: var(--well-2); color: var(--text); border: 1px solid var(--line-2); border-radius: 8px; padding: 6px 9px; font: 12px/1.45 'Geist Mono', ui-monospace, monospace; box-shadow: 0 12px 30px -14px rgba(0, 0, 0, 0.6); }
.fallback-editor { position: absolute; inset: 0; display: flex; overflow: auto; }
.fallback-editor .gutter { padding: 14px 10px 14px 16px; text-align: right; color: var(--faint); font: 12.5px/1.6 var(--mono); user-select: none; background: var(--card); position: sticky; left: 0; z-index: 1; }
.fallback-editor .stage { position: relative; flex: 1; min-width: max-content; }
.fallback-editor pre, .fallback-editor textarea { margin: 0; padding: 14px 16px; font: 12.5px/1.6 var(--mono); white-space: pre; tab-size: 2; border: 0; }
.fallback-editor pre { pointer-events: none; color: var(--text); }
.fallback-editor textarea { position: absolute; inset: 0; width: 100%; height: 100%; resize: none; background: transparent; color: transparent; caret-color: var(--text); outline: none; overflow: hidden; }

.console { flex: none; height: 190px; display: flex; flex-direction: column; min-height: 0; margin: 0 6px 6px; border-radius: 10px; background: var(--card); transition: height 0.4s var(--ease); }
.console.collapsed { height: 38px; }
.console-head { display: flex; align-items: center; gap: 10px; padding: 0 6px 0 14px; height: 38px; flex: none; font-size: 12.5px; color: var(--muted); }
.console-head b { font-weight: 500; color: var(--text-2); }
.console-head .tools { margin-left: auto; display: flex; gap: 2px; align-items: center; }
.console .logbox { flex: 1; padding-top: 0; }
.console .logline { padding: 1px 14px; }

.side-panel .panel-tabs { padding: 8px 8px 0; flex: none; }
.panel-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.urlbar { display: flex; gap: 6px; padding: 8px; align-items: center; }
.urlbar .input { height: 32px; font-family: var(--mono); font-size: 12px; border-radius: 999px; background: var(--card); }
.urlbar .select { height: 32px; width: 96px; font-size: 12.5px; font-weight: 500; border-radius: 999px; background-color: var(--card); }
/* The frame is always white, so its page must render light even in dark mode:
   otherwise a plain-text response inherits the dark scheme (light text on white). */
.preview-frame { flex: 1; width: calc(100% - 12px); margin: 0 6px 6px; border: 0; border-radius: 10px; background: #fff; color-scheme: light; }
.req-section { padding: 6px 12px 10px; display: flex; flex-direction: column; gap: 8px; }
.kv-edit { display: grid; grid-template-columns: 1fr 1fr 26px; gap: 6px; align-items: center; }
.kv-edit .input { height: 30px; font-size: 12px; font-family: var(--mono); background: var(--card); }
.req-section .textarea { background: var(--card); }
.resp { flex: 1; min-height: 0; display: flex; flex-direction: column; margin: 0 6px 6px; border-radius: 10px; background: var(--card); }
.resp-meta { display: flex; gap: 14px; align-items: center; padding: 10px 14px; font-size: 12.5px; color: var(--muted); border-bottom: 1px solid var(--line); }
.resp-body { flex: 1; margin: 0; padding: 12px 14px; overflow: auto; font: 12px/1.6 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text-2); }
.resp-headers { font: 11.5px/1.65 var(--mono); padding: 8px 14px; color: var(--muted); border-bottom: 1px solid var(--line); max-height: 140px; overflow: auto; }
.resp-headers summary { cursor: pointer; font-family: var(--font); font-size: 12.5px; }
.resp-headers b { color: var(--text-2); font-weight: 400; }
.save-state { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 7px; white-space: nowrap; min-width: 0; }
.save-state svg { width: 14px; height: 14px; }
.save-state.dirty { color: var(--warn); }
.save-state.err { color: var(--err); }
.save-state a { color: var(--text-2); }

/* ------------------------------------------------------------- versions */
.timeline { list-style: none; margin: 0; padding: 4px 0 8px; }
.timeline li { display: grid; grid-template-columns: 16px 1fr auto; gap: 14px; padding: 12px 20px; align-items: center; transition: background 0.2s; }
.timeline li + li { border-top: 1px solid var(--line); }
.timeline li:hover { background: var(--hover); }
.timeline .node { width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid var(--faint); margin: 0 auto; }
.timeline li.current .node { border-color: var(--ok); background: var(--ok); }
.timeline .id { font-family: var(--mono); font-size: 13px; }
.timeline .meta { font-size: 12.5px; color: var(--muted); }

/* ------------------------------------------------------------- settings */
.set-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px; align-items: center; padding: 16px 20px; }
.set-row + .set-row { border-top: 1px solid var(--line); }
.set-row h4 { margin: 0; font-size: 14px; font-weight: 500; }
.set-row p { margin: 3px 0 0; font-size: 13px; color: var(--muted); }
.env-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) auto; gap: 8px; align-items: center; padding: 4px 0; }
.env-row .input { background: var(--card); }
.danger-zone h4 { color: var(--err); }
.section-title { font: 600 18px/1.3 var(--display); letter-spacing: -0.015em; margin: 34px 0 12px; }
.section-title:first-child { margin-top: 4px; }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 10px 22px; margin: 0; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-family: var(--mono); font-size: 12.5px; overflow-wrap: anywhere; color: var(--text-2); }
.steps { counter-reset: s; list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 16px; }
.steps li { counter-increment: s; display: grid; grid-template-columns: 30px 1fr; gap: 10px; font-size: 13.5px; color: var(--text-2); }
.steps li::before { content: counter(s); width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--card); font: 600 11.5px/1 var(--display); color: var(--text-2); }
.copy-line { display: flex; align-items: center; gap: 6px; padding: 5px 5px 5px 14px; border-radius: 999px; background: var(--card); font-family: var(--mono); font-size: 12.5px; }
.copy-line span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* -------------------------------------------------------- modal, palette */
.overlay { position: fixed; inset: 0; z-index: 100; background: rgba(10, 9, 8, 0.45); backdrop-filter: blur(6px); display: grid; place-items: start center; padding: 11vh 16px 16px; animation: fade 0.25s var(--ease); }
:root[data-theme='light'] .overlay { background: rgba(60, 45, 25, 0.18); }
@keyframes fade { from { opacity: 0; } }
.modal {
  width: 100%; max-width: 520px; background: var(--card); border: 1px solid var(--line); border-radius: 20px;
  box-shadow: 0 40px 100px -30px rgba(0, 0, 0, 0.6); animation: rise 0.38s var(--ease); max-height: 80vh; display: flex; flex-direction: column;
}
.modal.wide { max-width: 880px; }
@keyframes rise { from { transform: translateY(10px) scale(0.985); opacity: 0; } }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 20px 22px 4px; }
.modal-head h3 { margin: 0; font: 600 18px/1.3 var(--display); letter-spacing: -0.02em; }
.modal-head .icon-btn { margin-left: auto; }
.modal-body { padding: 14px 22px 22px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 0 22px 20px; }
.tpl-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tpl { display: flex; flex-direction: column; gap: 6px; padding: 13px; border-radius: 12px; border: 1px solid transparent; background: var(--well); cursor: pointer; text-align: left; transition: background 0.25s var(--ease), border-color 0.25s var(--ease); }
.tpl:hover { background: var(--well-2); }
.tpl.on { border-color: var(--muted); background: var(--well-2); }
.tpl b { font-size: 13.5px; font-weight: 600; }
.tpl span { font-size: 12px; color: var(--muted); line-height: 1.4; }
.palette { max-width: 580px; }
.palette .input { height: 54px; border-radius: 20px 20px 0 0; background: transparent; font-size: 16px; padding: 0 22px; border: 0; border-bottom: 1px solid var(--line); }
.palette .input:focus { background: transparent; }
.palette-list { max-height: 50vh; overflow-y: auto; padding: 8px; }
.pitem { display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 12px; border-radius: 10px; cursor: pointer; color: var(--text-2); transition: background 0.15s; }
.pitem svg { width: 16px; height: 16px; color: var(--muted); flex: none; }
.pitem .lang-ico { width: 22px; height: 22px; background: transparent; }
.pitem .sec { margin-left: auto; font-size: 12px; color: var(--muted); }
.pitem.sel { background: var(--well-2); color: var(--text); }
.code-view { margin: 0; padding: 16px; background: var(--well); border-radius: 12px; font: 12px/1.6 var(--mono); overflow: auto; max-height: 52vh; white-space: pre; }

/* ------------------------------------------------------------------ toast */
.toasts { position: fixed; right: 22px; bottom: 22px; z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.toast {
  display: flex; align-items: center; gap: 10px; max-width: 420px; padding: 11px 16px 11px 14px; border-radius: 999px;
  background: var(--ac); color: var(--ac-ink); box-shadow: 0 16px 40px -16px rgba(0, 0, 0, 0.55); font-size: 13.5px; font-weight: 500;
  animation: toastIn 0.45s var(--ease);
}
.toast svg { width: 15px; height: 15px; flex: none; }
.toast.err { background: var(--err); color: #1b1915; border-radius: 16px; }
.toast.out { animation: toastOut 0.3s var(--ease) forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px) scale(0.96); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(6px) scale(0.98); } }

.skel { background: var(--well); border-radius: var(--r-well); animation: breathe 1.6s var(--ease) infinite; }

/* -------------------------------------------------------------- responsive */
@media (max-width: 1180px) {
  .ide { grid-template-columns: 190px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) 46vh; height: auto; }
  .ide .side-panel { grid-column: 1 / -1; }
  .ide .editor-col { height: 64vh; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 60; left: 0; top: 0; width: 272px; background: var(--bg); transform: translateX(-100%); transition: transform 0.4s var(--ease); }
  .side.open { transform: none; box-shadow: 0 0 60px rgba(0, 0, 0, 0.4); }
  .scrim { position: fixed; inset: 0; z-index: 55; background: rgba(10, 9, 8, 0.4); }
  .menu-btn { display: inline-grid; }
  .main { margin: 0; border-radius: 0; border: 0; min-height: 100vh; }
  .topbar { padding: 0 12px; border-radius: 0; }
  .page { padding: 10px 16px 48px; }
  h1.page-title { font-size: 26px; }
  .fig { flex-basis: 140px; padding: 14px 16px 16px; }
  .fig .v { font-size: 28px; }
  .grid2 { grid-template-columns: 1fr; }
  .workers { grid-template-columns: 1fr; }
  .tpl-grid { grid-template-columns: repeat(2, 1fr); }
  .ide-wrap { padding: 0 8px 8px; }
  .ide { grid-template-columns: 1fr; grid-template-rows: auto 62vh 52vh; }
  .ide .files { max-height: 160px; }
  .ide .editor-col { height: auto; }
  .set-row { grid-template-columns: 1fr; }
  .topbar .hide-sm { display: none; }
  .logline { grid-template-columns: 58px 1fr; padding: 2px 14px; }
  .logline .lv { display: none; }
  .wfoot .acts { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
.scrim.hidden { display: none; }
.hide-lg { display: none; }
@media (max-width: 860px) { .hide-sm { display: none !important; } .hide-lg { display: inline; } }
