/* Dockify UI: token layers per docs/DESIGN-SYSTEM.md. Layer 2 tokens per palette x theme, layer-1 aliases, then components. */

:root[data-palette=indigo] {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --sunk: #f1f4f9;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --control: #7a8699;
  --ink: #0f172a;
  --ink2: #334155;
  --muted: #5b677a;
  --accent: #4f46e5;
  --accent-fill: #4f46e5;
  --on-accent: #ffffff;
  --accent-soft: #eef0ff;
  --brand2-fill: #6d28d9;
  --on-brand2: #ffffff;
  --brand2: #6d28d9;
  --brand2-soft: #ede9fe;
  --chart: #6366f1;
  --chart-soft: #e3e5fc;
  --ok: #15803d;
  --ok-text: #166534;
  --ok-bg: #dcfce7;
  --warn: #b45309;
  --warn-text: #92400e;
  --warn-bg: #fef3c7;
  --danger: #c81e1e;
  --danger-text: #991b1b;
  --danger-bg: #fee2e2;
  --danger-fill: #c81e1e;
  --shadow: 0 1px 2px rgba(16,24,40,.06),0 1px 3px rgba(16,24,40,.05);
  color-scheme: light;
}

:root[data-palette=indigo][data-theme=dark] {
  --bg: #0b1020;
  --surface: #151b2e;
  --sunk: #0f1426;
  --line: #262e48;
  --line-strong: #36405f;
  --control: #6e7a9c;
  --ink: #e8ebf5;
  --ink2: #c0c7dc;
  --muted: #929bb8;
  --accent: #a5b4fc;
  --accent-fill: #5850ec;
  --on-accent: #ffffff;
  --accent-soft: #252a55;
  --brand2-fill: #6d28d9;
  --on-brand2: #ffffff;
  --brand2: #c4b5fd;
  --brand2-soft: #2a1d55;
  --chart: #818cf8;
  --chart-soft: #252a55;
  --ok: #4ade80;
  --ok-text: #86efac;
  --ok-bg: #10301e;
  --warn: #fbbf24;
  --warn-text: #fcd34d;
  --warn-bg: #33270a;
  --danger: #f87171;
  --danger-text: #fca5a5;
  --danger-bg: #3b1618;
  --danger-fill: #c81e1e;
  --shadow: 0 1px 2px rgba(0,0,0,.45);
  color-scheme: dark;
}

:root[data-palette=navy] {
  --bg: #eef1f8;
  --surface: #ffffff;
  --sunk: #f5f7fc;
  --line: #e1e5f0;
  --line-strong: #c8cede;
  --control: #7c83ad;
  --ink: #141a33;
  --ink2: #3d4566;
  --muted: #656d8c;
  --accent: #2b3486;
  --accent-fill: #2b3486;
  --on-accent: #ffffff;
  --accent-soft: #e7e9f8;
  --brand2-fill: #1e40af;
  --on-brand2: #ffffff;
  --brand2: #1e40af;
  --brand2-soft: #dbeafe;
  --chart: #4a54c9;
  --chart-soft: #e3e5fb;
  --ok: #15803d;
  --ok-text: #166534;
  --ok-bg: #dcfce7;
  --warn: #b45309;
  --warn-text: #92400e;
  --warn-bg: #fef3c7;
  --danger: #c81e1e;
  --danger-text: #991b1b;
  --danger-bg: #fee2e2;
  --danger-fill: #c81e1e;
  --shadow: 0 1px 2px rgba(16,24,40,.06),0 1px 3px rgba(16,24,40,.05);
  color-scheme: light;
}

:root[data-palette=navy][data-theme=dark] {
  --bg: #0c0f1e;
  --surface: #161a2f;
  --sunk: #11142a;
  --line: #272c48;
  --line-strong: #363c5e;
  --control: #6b7399;
  --ink: #e9ebf7;
  --ink2: #bfc4de;
  --muted: #8f95b4;
  --accent: #a9b2ff;
  --accent-fill: #4a54c9;
  --on-accent: #ffffff;
  --accent-soft: #242a5c;
  --brand2-fill: #1e40af;
  --on-brand2: #ffffff;
  --brand2: #93c5fd;
  --brand2-soft: #1a2a55;
  --chart: #8c96ff;
  --chart-soft: #242a5c;
  --ok: #4ade80;
  --ok-text: #86efac;
  --ok-bg: #10301e;
  --warn: #fbbf24;
  --warn-text: #fcd34d;
  --warn-bg: #33270a;
  --danger: #f87171;
  --danger-text: #fca5a5;
  --danger-bg: #3b1618;
  --danger-fill: #c81e1e;
  --shadow: 0 1px 2px rgba(0,0,0,.45);
  color-scheme: dark;
}

:root[data-palette=teal] {
  --bg: #f0f3f5;
  --surface: #ffffff;
  --sunk: #f3f6f8;
  --line: #dde3e8;
  --line-strong: #c5cfd7;
  --control: #74828f;
  --ink: #0f1a22;
  --ink2: #34434f;
  --muted: #5b6975;
  --accent: #0e6e78;
  --accent-fill: #0e6e78;
  --on-accent: #ffffff;
  --accent-soft: #e0f1f2;
  --brand2-fill: #075985;
  --on-brand2: #ffffff;
  --brand2: #075985;
  --brand2-soft: #e0f2fe;
  --chart: #0891b2;
  --chart-soft: #dcf0f6;
  --ok: #15803d;
  --ok-text: #166534;
  --ok-bg: #dcfce7;
  --warn: #b45309;
  --warn-text: #92400e;
  --warn-bg: #fef3c7;
  --danger: #c81e1e;
  --danger-text: #991b1b;
  --danger-bg: #fee2e2;
  --danger-fill: #c81e1e;
  --shadow: 0 1px 2px rgba(16,24,40,.06),0 1px 3px rgba(16,24,40,.05);
  color-scheme: light;
}

:root[data-palette=teal][data-theme=dark] {
  --bg: #0a1116;
  --surface: #131c23;
  --sunk: #0e161c;
  --line: #22303a;
  --line-strong: #314350;
  --control: #687b89;
  --ink: #e6eef2;
  --ink2: #b9c8d1;
  --muted: #8a9ba7;
  --accent: #5fd4dd;
  --accent-fill: #0e6e78;
  --on-accent: #ffffff;
  --accent-soft: #103338;
  --brand2-fill: #075985;
  --on-brand2: #ffffff;
  --brand2: #7dd3fc;
  --brand2-soft: #0f2a3a;
  --chart: #38bdf8;
  --chart-soft: #0f2c3a;
  --ok: #4ade80;
  --ok-text: #86efac;
  --ok-bg: #10301e;
  --warn: #fbbf24;
  --warn-text: #fcd34d;
  --warn-bg: #33270a;
  --danger: #f87171;
  --danger-text: #fca5a5;
  --danger-bg: #3b1618;
  --danger-fill: #c81e1e;
  --shadow: 0 1px 2px rgba(0,0,0,.45);
  color-scheme: dark;
}

/* xterm console chrome stays dark in both themes (matches the xterm theme in the templates) */
:root {
  --term-bg: #090d16;
  --term-bar: #0f172a;
  --term-fg: #cbd5e1;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

code, pre, .mono, .badge, .secret-row input, .secret-row code, td.mono, th.mono {
  font-family: 'JetBrains Mono', ui-monospace, 'SF Mono', 'Cascadia Code', monospace;
}

a { color: var(--accent); text-decoration: none; transition: color 0.15s ease; }
a:hover { color: var(--ink); }

h1, h2, h3, h4 { font-weight: 600; margin: 0 0 0.4em; color: var(--ink); letter-spacing: -0.015em; }
h1 { font-size: 1.5em; font-weight: 700; }
h2 { font-size: 1.15em; color: var(--ink); font-weight: 600; margin-top: 1.8em; margin-bottom: 0.6em; }
hgroup { margin-bottom: 12px; }
hgroup h1 { font-size: 22px; font-weight: 800; margin-bottom: 2px; }
hgroup p { color: var(--muted); margin: 0; font-size: 12.8px; }

/* Shell: sticky header (56px) + main nav (bottom tab bar < 900px, tab row under the header >= 900px) */
.top-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
/* S9: 3px request progress under the header (shown by app.js for requests slower than 150 ms). */
.progress { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--accent-fill); transform-origin: left; animation: progress 8s cubic-bezier(.1,.6,.2,1) forwards; }
.progress[hidden] { display: none; }
@keyframes progress { from { transform: scaleX(0.05); } to { transform: scaleX(0.95); } }
@media (prefers-reduced-motion: reduce) { .progress { animation: none; transform: none; } }
.top-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 56px; padding: 0 16px; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.top-actions form { margin: 0; }
.top-nav .logo { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 17px; color: var(--ink); letter-spacing: -0.02em; }
.top-nav .logo:hover { color: var(--accent); }
.top-nav .logo-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--accent-fill);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--on-accent);
  font-size: 14px;
  font-weight: 800;
}
.main-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  height: calc(56px + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface);
  border-top: 1px solid var(--line);
}
.main-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border-top: 2px solid transparent;
  margin-top: -1px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}
.main-nav a:hover { color: var(--ink); }
.main-nav a[aria-current=page] { color: var(--accent); border-top-color: var(--accent); }
.main-nav .icon { width: 20px; height: 20px; }
body:not(.login-page) { padding-bottom: calc(56px + env(safe-area-inset-bottom)); }
@media (min-width: 900px) {
  body:not(.login-page) { padding-bottom: 0; }
  .top-bar, .main-nav { max-width: 1100px; margin: 0 auto; }
  .top-bar { padding: 0 24px; }
  .main-nav {
    position: static;
    display: flex;
    gap: 4px;
    height: 40px;
    padding: 0 24px;
    background: none;
    border-top: 0;
  }
  .main-nav a { flex-direction: row; gap: 8px; border-top: 0; border-bottom: 2px solid transparent; margin: 0; padding: 0 12px; font-size: 14px; }
  .main-nav a[aria-current=page] { border-bottom-color: var(--accent); }
  .main-nav .icon { width: 16px; height: 16px; }
}

/* Container */
.container { max-width: 1100px; margin: 0 auto; padding: 16px; }
@media (min-width: 900px) { .container { padding: 24px; } }

/* Cards & Elevation */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.25em 1.4em;
  margin-bottom: 1em;
  box-shadow: var(--shadow);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}
.card:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
.card p { font-size: 0.9em; margin: 0.3em 0; }

/* Grid System */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 1em; }
form .grid { gap: 1.2em; margin-bottom: 0.9em; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1em; }

/* Buttons */
[role=button], button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4em;
  padding: 0.45em 0.9em;
  font-size: 0.9em;
  font-family: inherit;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1.45;
  text-decoration: none;
  font-weight: 500;
  box-shadow: var(--shadow);
}
[role=button]:hover, button:hover { border-color: var(--line-strong); background: var(--surface); color: var(--ink); }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4em;
  font-family: inherit;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
  line-height: 1.45;
  text-decoration: none;
  min-height: 40px;
  padding: 0 16px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  background: var(--surface);
  border: 1px solid var(--control);
  color: var(--ink);
  box-shadow: none;
  white-space: nowrap;
}
.btn:hover { background: var(--sunk); border-color: var(--control); color: var(--ink); }
.btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 13px; }
.btn-lg { min-height: 44px; padding: 0 18px; }
.btn-primary, .btn-primary:hover { background: var(--accent-fill); border-color: var(--accent-fill); color: var(--on-accent); }
.btn-primary:hover { filter: brightness(1.1); }
.btn-secondary { background: var(--surface); border-color: var(--control); color: var(--ink); }
.btn-ghost, .btn-ghost:hover { background: transparent; border-color: transparent; color: var(--ink2); }
.btn-ghost:hover { background: var(--accent-soft); color: var(--ink); }
.btn-destructive, .btn-destructive:hover { background: var(--danger-fill); border-color: var(--danger-fill); color: var(--on-accent); }
.btn-destructive:hover { filter: brightness(1.1); }
.btn-destructive-outline { background: transparent; border-color: var(--danger); color: var(--danger-text); }
.btn-destructive-outline:hover { background: var(--danger-bg); border-color: var(--danger); color: var(--danger-text); }
.btn-link, .btn-link:hover { background: none; border: 0; min-height: 0; padding: 0; color: var(--accent); text-decoration: underline; }
.btn-icon { width: 40px; padding: 0; }
.btn-icon-sm { width: 36px; min-height: 36px; padding: 0; }
.icon { display: block; flex-shrink: 0; }

/* Sheet: popup >= 700px, bottom panel below (DESIGN-SYSTEM §5) */
.sheet {
  border: 0;
  padding: 0;
  width: 100%;
  max-width: 560px;
  margin: auto auto 0;
  max-height: 92dvh;
  background: var(--surface);
  color: var(--ink);
  border-radius: 16px 16px 0 0;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.sheet[open] { display: flex; flex-direction: column; animation: sheet-up 0.22s ease-out; }
.sheet::backdrop { background: rgb(0 0 0 / 0.5); }
.sheet::before { content: ""; display: block; width: 40px; height: 4px; border-radius: 2px; background: var(--line-strong); margin: 8px auto 0; flex-shrink: 0; }
.sheet > form { display: flex; flex-direction: column; min-height: 0; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 8px 0 20px; }
.sheet-head h2 { margin: 0; font-size: 18px; font-weight: 800; color: var(--ink); }
.sheet-body { padding: 8px 20px 12px; overflow-y: auto; min-height: 0; }
.sheet-text { margin: 0 0 12px; color: var(--ink2); }
.sheet-note { font-size: 12.8px; color: var(--muted); margin: 4px 0 0; }
.sheet-textarea { width: 100%; font-size: 16px; resize: vertical; }
.sheet-opts { display: flex; flex-direction: column; gap: 12px; margin-bottom: 12px; }
.sheet-opt { display: flex; align-items: flex-start; gap: 8px; cursor: pointer; }
.sheet-opt input { margin-top: 4px; }
.sheet-suboptions { margin-left: 28px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.sheet-foot {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 12px 20px calc(16px + env(safe-area-inset-bottom));
}
@media (min-width: 700px) {
  .sheet { margin: auto; border-radius: 16px; max-height: 86dvh; }
  .sheet::before { display: none; }
  .sheet-head { padding-top: 16px; }
  .sheet[open] { animation: sheet-pop 0.18s ease-out; }
  .sheet-foot { padding-bottom: 16px; }
}
@keyframes sheet-up { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes sheet-pop { from { transform: scale(0.98); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .sheet[open] { animation: none; } }

[hidden] { display: none !important; }

/* List rows: one table, card rows below 700px (static/list.js for filter/sort) */
.listbar { margin-bottom: 12px; }
.search { position: relative; margin-bottom: 8px; }
.search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.search input { padding-left: 40px; }
.chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(to right, black calc(100% - 24px), transparent);
  mask-image: linear-gradient(to right, black calc(100% - 24px), transparent);
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 9999px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink2);
  font-size: 12px;
  font-weight: 600;
  text-transform: capitalize;
}
.chip[aria-pressed=true] { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-soft); }
.list-meta { margin: 8px 0 0; font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.list-meta .btn-link { font-size: 12px; }
.empty-note { color: var(--muted); text-align: center; padding: 24px 0; }
.empty-icon { display: inline-flex; color: var(--muted); margin-bottom: 8px; }
.empty-icon .icon { width: 32px; height: 32px; }
.section-head { display: flex; align-items: center; gap: 8px; margin: 12px 0 8px; }
.section-head h2 { margin: 0; font-size: 16px; font-weight: 800; }
.section-head .count { background: var(--sunk); color: var(--ink2); border-radius: 9999px; padding: 0 8px; font-size: 12px; font-weight: 700; }
.section-head .btn-link { margin-left: auto; font-size: 13px; font-weight: 700; }
.stat-ok { color: var(--ok); }
.group-head { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; margin: 12px 0 8px; font-size: 13px; }
.group-head .group-count { font-size: 12px; color: var(--muted); }
.group-head h3 { margin: 0; font-size: 13px; font-weight: 700; text-transform: none; letter-spacing: 0; color: var(--ink); }
.group-head .mono { font-size: 12px; color: var(--muted); }
.group-count { font-size: 12px; color: var(--muted); }
table.rows { border-collapse: separate; border-spacing: 0; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: var(--surface); box-shadow: var(--shadow); margin-bottom: 12px; }
.rows thead th { padding: 0 12px; font-size: 11px; font-weight: 800; text-transform: uppercase; color: var(--muted); background: var(--sunk); letter-spacing: 0.04em; }
.th-sort { display: inline-flex; align-items: center; gap: 4px; width: 100%; min-height: 36px; padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; color: inherit; font: inherit; text-transform: inherit; letter-spacing: inherit; cursor: pointer; }
.th-sort:hover { background: none; color: var(--ink); }
.th-sort .icon { width: 12px; height: 12px; opacity: 0; transition: transform 0.15s; }
th[aria-sort=ascending] .icon, th[aria-sort=descending] .icon { opacity: 1; }
th[aria-sort=ascending] .icon { transform: rotate(180deg); }
.rows tbody td { padding: 10px 12px; vertical-align: middle; font-size: 14px; border-bottom: 1px solid var(--line); }
.rows tbody tr:last-child td { border-bottom: 0; }
.rows tbody tr:hover td { background-color: var(--sunk); }
.rows .c-name > a:first-child { font-size: 15px; font-weight: 700; display: block; }
.rows .c-name small { display: block; font-size: 12px; color: var(--muted); }
.rows .c-name small a { font-weight: 400; color: var(--muted); }
.rows .c-name small a.ext::after { content: " \2197"; }
.rows .c-num { font-size: 12px; white-space: nowrap; }
.rows .badge { white-space: nowrap; }
@media (max-width: 699px) {
  table.rows, .rows tbody { display: block; border: 0; background: none; box-shadow: none; border-radius: 0; overflow: visible; }
  .rows thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .rows tbody tr {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px 12px;
    padding: 12px 14px;
    margin-bottom: 8px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: var(--shadow);
  }
  .rows tbody td { display: block; padding: 0; border: 0; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .rows tbody tr:hover td { background: none; }
  .rows td.c-name { grid-column: 1 / span 2; }
  .rows td.c-status { justify-self: end; }
  .rows td[data-label]::before { content: attr(data-label); display: block; font-size: 11px; font-weight: 800; text-transform: uppercase; color: var(--muted); }
  .col-sm-hide { display: none !important; }
}
table { width: 100%; border-collapse: collapse; text-align: left; }
thead th {
  padding: 0.65em 0.85em;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink2);
  font-weight: 600;
  font-size: 0.78em;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
tbody td { padding: 0.65em 0.85em; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: 0.9em; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--accent-soft); }
table a { font-weight: 500; color: var(--accent); }
table a:hover { color: var(--ink); text-decoration: underline; }

/* Form elements (DESIGN-SYSTEM §4, §5): 16px controls on phones (14px at >= 700px), 40px high, radius 12, border `control` */
input, textarea, select {
  font-family: inherit;
  font-size: 16px;
  min-height: 40px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid var(--control);
  background: var(--surface);
  color: var(--ink);
  width: 100%;
  outline: none;
  transition: border-color 0.15s ease;
}
textarea { padding: 10px 12px; resize: vertical; min-height: 96px; line-height: 1.5; }
textarea.mono, input.mono { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 13px; }
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
input[type=radio], input[type=checkbox] { width: 20px; height: 20px; min-height: 0; padding: 0; accent-color: var(--accent-fill); cursor: pointer; flex-shrink: 0; }
input[type=file] { padding: 8px 12px; }
input[readonly] { background: var(--sunk); }
.field, label { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; font-size: 15px; color: var(--ink); }
.field-label { font-size: 12.8px; font-weight: 600; color: var(--ink2); }
.field-hint, small { font-size: 12px; color: var(--muted); display: block; margin-top: 0; }
.field-error { font-size: 12.8px; color: var(--danger-text); }
.field-error[hidden] { display: none; }
.check { flex-direction: row; align-items: flex-start; gap: 8px; cursor: pointer; font-size: 15px; }
.select-wrap { position: relative; display: block; }
.select-wrap select { appearance: none; -webkit-appearance: none; padding-right: 40px; }
.select-wrap .icon { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
fieldset { border: none; padding: 0; margin: 0 0 16px; }
legend { font-size: 12.8px; color: var(--ink2); margin-bottom: 8px; font-weight: 600; }
details { margin-bottom: 12px; }
summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--accent); padding: 8px 0; }
.card-sub { font-size: 12.8px; color: var(--muted); margin: -8px 0 12px; }
.form-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
@media (min-width: 700px) { .form-actions { display: flex; } }
.row-grid { display: grid; gap: 8px; margin-bottom: 8px; align-items: start; }
.row-grid > * { min-width: 0; }
.row-domain { grid-template-columns: minmax(0, 1fr) 40px; }
.row-env { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) 36px 36px; }
.row-file { grid-template-columns: minmax(0, 1fr) auto 36px; }
.row-grid input, .row-grid textarea { margin: 0; }
.row-env textarea { min-height: 40px; }
.inline-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.opt-group { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.opt-group legend { margin-bottom: 4px; }
.secret-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.secret-row input { flex: 1 1 200px; min-width: 0; font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 13px; }
.kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 12px; }
@media (min-width: 700px) { .kpi-grid { grid-template-columns: repeat(4, 1fr); } }

/* Status Badges with Pulse Effects */
@keyframes pulse-ring {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.15); opacity: 0.4; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  padding: 0.2em 0.6em;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1.3;
}
.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
  flex-shrink: 0;
}
.badge-online .badge-dot, .badge-running .badge-dot, .badge-success .badge-dot {
  animation: pulse-ring 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.badge-online, .badge-running, .badge-success { background: var(--ok-bg); color: var(--ok-text); border: 1px solid color-mix(in srgb, var(--ok) 25%, transparent); }
.badge-offline, .badge-error, .badge-failed { background: var(--danger-bg); color: var(--danger-text); border: 1px solid color-mix(in srgb, var(--danger) 25%, transparent); }
.badge-pending, .badge-created, .badge-initializing, .badge-deploying { background: var(--warn-bg); color: var(--warn-text); border: 1px solid color-mix(in srgb, var(--warn) 25%, transparent); }
.badge-stopped, .badge-draft { background: var(--sunk); color: var(--ink2); border: 1px solid var(--line); }

/* Disabled States */

/* Stat Cards */
.stat { text-align: left; padding: 12px 14px; margin: 0; display: flex; flex-direction: column; }
.stat h2 { font-size: 24px; line-height: 30px; font-weight: 800; margin: 0; color: var(--ink); letter-spacing: -0.02em; text-transform: none; }
.stat small { font-size: 11px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.stat .cap { font-size: 12px; color: var(--muted); }

/* Breadcrumbs */
.breadcrumb a { color: var(--ink2); font-weight: 500; }
.breadcrumb a:hover { color: var(--accent); }

/* Code blocks & Log viewer */
pre, code { font-size: 0.88em; }
pre {
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 0.85em 1em;
  border-radius: 8px;
  overflow-x: auto;
  line-height: 1.5;
  box-shadow: var(--shadow);
}
.log-content {
  background: var(--term-bg);
  border: 1px solid var(--line);
  padding: 0.8em 1em;
  border-radius: 8px;
  max-height: 420px;
  overflow: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82em;
  line-height: 1.5;
  color: var(--term-fg);
  box-shadow: var(--shadow);
}

/* Empty state */
.empty-state { text-align: center; padding: 3.5em 1.5em; color: var(--ink2); background: var(--surface); border: 1px dashed var(--line); border-radius: 10px; margin: 1em 0; }
.empty-state p { margin-bottom: 1em; font-size: 0.95em; }

/* Dev Mock Bar */
.dev-mock-bar {
  background: var(--warn-bg);
  color: var(--warn-text);
  text-align: center;
  padding: 0.4em 1em;
  font-size: 0.82em;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  box-shadow: var(--shadow);
}

.toast {
  position: fixed;
  top: 72px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  max-width: calc(100% - 28px);
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--line);
  padding: 0.7em 1.1em;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--shadow);
  animation: toast-life 4s ease-in forwards;
}
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } }
@keyframes toast-life { 0%, 85% { opacity: 1; } 100% { opacity: 0; visibility: hidden; } }

/* Console Section */
.console-section { margin-top: 1.2em; }
.console-container {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--term-bg);
  box-shadow: var(--shadow);
}
.console-toolbar {
  display: flex;
  align-items: center;
  gap: 0.6em;
  padding: 0.5em 0.8em;
  border-bottom: 1px solid var(--line);
  background: var(--term-bar);
}
#terminal { padding: 0.4em; }

/* Gauges & Live Charts */

.stats-gauges { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.8em 1.5em; margin-bottom: 0.85em; }
.stat-gauge { min-width: 0; }
.stat-gauge-label { font-size: 0.7em; color: var(--ink2); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.stat-gauge-value { font-size: 0.85em; font-weight: 600; font-family: 'JetBrains Mono', monospace; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-gauge-net { font-size: 0.85em; font-weight: 400; color: var(--ink); line-height: 1.4; word-break: break-word; font-family: 'JetBrains Mono', monospace; }
.stats-divider { border: none; border-top: 1px solid var(--line); margin: 1.2em 0 1em 0; }

.chart-section { margin-top: 1em; }
.chart-title { display: flex; align-items: center; justify-content: space-between; font-size: 0.75em; color: var(--ink2); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; margin-bottom: 0.4em; }
.chart-title-val { font-size: 1.15em; font-weight: 700; text-transform: none; letter-spacing: normal; font-family: 'JetBrains Mono', monospace; }
.chart-title-val--cpu { color: var(--ink2); }
.chart-title-val--mem { color: var(--ok); }
.chart-title-val--net { color: var(--accent); }
.chart-title-val--disk { color: var(--accent); }
.chart-svg { width: 100%; height: 100px; display: block; background: var(--surface); border-radius: 6px; border: 1px solid var(--line); }
.live-badge--hidden { opacity: 0; visibility: hidden; }

/* Responsive Media Queries */
@media (max-width: 680px) {
  .grid:not(.kpi-grid) { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .stats-gauges { grid-template-columns: 1fr 1fr; }
}

/* Login page (body.login-page) */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 16px; }
.login-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 28px 24px; width: 360px; max-width: 100%; box-shadow: var(--shadow); }
.brand-header { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.brand-icon { width: 32px; height: 32px; border-radius: 8px; background: var(--accent-fill); display: inline-flex; align-items: center; justify-content: center; color: var(--on-accent); font-weight: 800; }
.login-card h1 { font-size: 20px; font-weight: 800; margin: 0; }
.login-card p { color: var(--ink2); margin: 0 0 20px; font-size: 14px; }
.login-card .alert { margin-bottom: 16px; }
.login-card .btn-primary { width: 100%; }
.login-page .theme-btn { position: fixed; top: 12px; right: 12px; }

/* Detail pages (DESIGN-SYSTEM §6) */
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 12.8px; color: var(--muted); margin-bottom: 8px; }
.page-head { margin-bottom: 12px; }
.page-head h1 { font-size: 22px; font-weight: 800; margin: 0 0 2px; display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.page-head .meta { margin: 0; font-size: 12.8px; color: var(--muted); }
.alert { display: flex; align-items: flex-start; gap: 10px; padding: 12px; border-radius: 12px; border: 1px solid var(--line); margin-bottom: 12px; font-size: 13px; }
.alert .icon { margin-top: 1px; }
.alert-title { font-size: 13px; font-weight: 700; }
.alert-sub { font-size: 12.8px; opacity: 0.9; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.alert-text { min-width: 0; }
.alert-ok { background: var(--ok-bg); color: var(--ok-text); border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.alert-warn { background: var(--warn-bg); color: var(--warn-text); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
.alert-danger { background: var(--danger-bg); color: var(--danger-text); border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.alert-neutral { background: var(--sunk); color: var(--ink2); }
.actgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.actgrid form { display: contents; }
.actgrid .btn-primary { grid-column: 1 / -1; }
.actgrid > :nth-child(2):last-child { grid-column: 1 / -1; } /* satu-satunya aksi selain primary: selebar kartu juga */
.actgrid .btn .icon { width: 17px; height: 17px; }
@media (min-width: 700px) {
  .actgrid { display: flex; flex-wrap: wrap; }
  .actgrid .btn-primary { order: -1; }
}
.seg { display: inline-flex; gap: 2px; padding: 3px; background: var(--sunk); border-radius: 12px; max-width: 100%; overflow-x: auto; }
.seg-btn { min-height: 32px; padding: 0 12px; border: 0; border-radius: 10px; background: none; box-shadow: none; color: var(--ink2); font-size: 12.8px; font-weight: 600; white-space: nowrap; }
.seg-btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 1px; }
@media (max-width: 699px) { .seg-btn { min-height: 38px; } }
.seg-btn[aria-pressed=true] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.stats-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.stats-header h3 { margin: 0; display: flex; align-items: center; gap: 8px; }
.card h3 { font-size: 15px; font-weight: 700; text-transform: none; letter-spacing: 0; color: var(--ink); margin: 0 0 12px; }
.card h3 .count { background: var(--sunk); color: var(--ink2); border-radius: 9999px; padding: 0 8px; font-size: 12px; font-weight: 700; }
.gauges { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 700px) { .gauges { grid-template-columns: repeat(3, 1fr); } }
.gauge-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.gauge-label { font-size: 11px; font-weight: 800; text-transform: uppercase; color: var(--muted); letter-spacing: 0.04em; }
.gauge-val { font-size: 13px; font-weight: 600; font-family: 'JetBrains Mono', monospace; }
.gauge-detail { font-size: 12px; color: var(--muted); font-weight: 400; }
div.bar { height: 6px; background: var(--chart-soft); border-radius: 3px; overflow: hidden; }
div.bar > span { display: block; height: 100%; width: var(--w, 0); background: var(--chart); border-radius: 3px; transition: width 0.5s ease; }
div.bar-warn > span { background: var(--warn); }
div.bar-danger > span { background: var(--danger); }
.stats-body { margin-top: 12px; }
.muted-note { color: var(--muted); font-size: 12.8px; margin: 0 0 8px; }
.muted { color: var(--muted); }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; margin: 0; }
.detail-grid > div { min-width: 0; }
.detail-grid .wide { grid-column: 1 / -1; }
.detail-grid dt { font-size: 11px; font-weight: 800; text-transform: uppercase; color: var(--muted); letter-spacing: 0.06em; margin-bottom: 2px; }
.detail-grid dd { margin: 0; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.detail-grid dd.wrap { white-space: normal; overflow-wrap: anywhere; }
.detail-grid dd.mono, .mono { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 13px; }
.wrap { overflow-wrap: anywhere; word-break: break-all; }
pre.code { margin: 0; padding: 12px; background: var(--sunk); border: 1px solid var(--line); border-radius: 12px; font-size: 12.5px; overflow-x: auto; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink); }
.code-block { position: relative; margin-bottom: 8px; }
.code-block pre.code { padding-right: 84px; }
.code-copy { position: absolute; top: 6px; right: 6px; gap: 4px; }
.code-copy .icon { width: 14px; height: 14px; }
.file-list { list-style: none; margin: 0; padding: 0; }
.file-list li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.file-list li:last-child { border-bottom: 0; }
.log-cell { max-width: 420px; white-space: normal !important; overflow-wrap: anywhere; font-size: 12.5px; }
.danger-zone { box-shadow: none; }
.danger-zone h3 { color: var(--danger); font-size: 12.8px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 2px; }
.dz-sub { font-size: 12.8px; color: var(--muted); margin: 0; }
.dz-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; margin-top: 10px; }
.dz-grid .btn { padding: 0 8px; }
@media (min-width: 700px) { .dz-grid { display: flex; flex-wrap: wrap; } }
.t-ok { color: var(--ok); }
.t-info { color: var(--accent); }
.t-warn { color: var(--warn-text); }
.t-danger { color: var(--danger-text); }
/* rows: left-aligned headers, numeric columns right at >= 700px */
.rows th { text-align: left; }
.rows .wrap { white-space: normal; }
@media (min-width: 700px) {
  .rows th.num .th-sort { justify-content: flex-end; }
  .rows td.num { text-align: right; }
  .rows td.c-act { text-align: right; width: 1%; white-space: nowrap; }
}
@media (max-width: 699px) {
  .rows-kv tbody tr { grid-template-columns: minmax(0, 1fr); }
  .rows-dep tbody tr { grid-template-columns: minmax(0, 1fr) auto; }
  .rows-dep td.c-wide { grid-column: 1 / -1; }
  .rows-dep td:nth-child(3) { grid-column: 1 / -1; }
  .rows-apps tbody tr { grid-template-columns: minmax(0, 1fr) auto; }
  .rows-apps td.c-name { grid-column: 1; }
  .rows-apps td.c-act { grid-column: 1 / -1; }
}

/* Forms: segmented radios, page actions */
.seg-form { margin-bottom: 16px; }
.seg-radio { position: relative; display: block; margin: 0; flex-direction: row; }
.seg-radio input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; min-height: 0; cursor: pointer; }
.seg-radio span { display: flex; align-items: center; min-height: 32px; padding: 0 16px; border-radius: 10px; font-size: 12.8px; font-weight: 600; color: var(--ink2); }
.seg-radio input:checked + span { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.seg-radio input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 1px; }
@media (max-width: 699px) { .seg-radio span { min-height: 38px; } }
.group-title { font-size: 12.8px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink2); margin: 16px 0 4px; }
.page-actions { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 0; }
hgroup .page-actions { margin-top: 4px; }
@media (min-width: 700px) { input, select, textarea { font-size: 14px; } }
/* iOS zooms inputs below 16px: keep mono fields at 16px on phones */
@media (max-width: 699px) { input.mono, textarea.mono, .secret-row input { font-size: 16px; } }
.row-domain > input:only-child { grid-column: 1 / -1; }

/* Usage cells: the bar is the cell background (no extra DOM nodes), sub-text from data-sub */
.bar-cell {
  --bar: var(--chart);
  background-image: linear-gradient(var(--bar), var(--bar)), linear-gradient(var(--chart-soft), var(--chart-soft));
  background-repeat: no-repeat;
  background-position: left bottom;
  background-size: var(--w, 0) 4px, 100% 4px;
}
.bar-cell.bar-warn { --bar: var(--warn); }
.bar-cell.bar-danger { --bar: var(--danger); }
.c-num[data-sub]::after { content: attr(data-sub); display: block; font-size: 11px; color: var(--muted); }
@media (max-width: 699px) { .rows .bar-cell { padding-bottom: 8px; } }
@media (min-width: 700px) { .rows-applist .c-name small { display: none; } }
.rows tbody tr { content-visibility: auto; contain-intrinsic-size: 0 64px; }

/* Kalibrasi HP ke mockup S0 (docs/design/preview-warna.html): jarak 12, KPI 12/14, baris apps dalam satu kartu per grup */
.btn { font-size: 14px; }
.badge { font-size: 10.5px; padding: 4px 7px; line-height: 1; }
.list-meta { margin-top: 6px; }
.dash .listbar { display: none; } /* ponytail: dashboard tanpa filter seperti mockup; filter tetap ada di /servers dan /apps */
@media (max-width: 699px) {
  .chips { margin: 0 -16px; padding: 0 16px; }
  .rows tbody tr { gap: 12px; padding: 14px; margin-bottom: 12px; }
  .rows td.bar-cell { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; background: none; padding: 0; font-size: 13px; font-weight: 800; color: var(--ink); }
  .rows td.bar-cell::before { display: inline; }
  .rows td.bar-cell::after { content: attr(data-sub); width: 100%; margin-top: 4px; padding-top: 10px; font-size: 11px; font-weight: 400; color: var(--muted);
    background-image: linear-gradient(var(--bar), var(--bar)), linear-gradient(var(--chart-soft), var(--chart-soft)); background-repeat: no-repeat; background-position: left top; background-size: var(--w, 0) 6px, 100% 6px; }
  table.rows-applist { display: block; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); padding: 0 14px; margin-bottom: 12px; }
  .rows-applist tbody tr { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 12px 0; margin: 0; border: 0; border-top: 1px solid var(--line); border-radius: 0; background: none; box-shadow: none; }
  .rows-applist tbody tr:first-child { border-top: 0; }
  .rows-applist tbody tr::after { content: ""; flex-basis: 100%; height: 0; order: 1; }
  .rows-applist td.c-name { flex: 1 1 0; min-width: 0; }
  .rows-applist td.c-status { flex: 0 0 auto; }
  .rows-applist td.c-num { order: 2; flex: 0 0 auto; display: inline-flex; gap: 6px; align-items: baseline; font-size: 12px; font-weight: 700; color: var(--ink); }
  .rows-applist td.c-num::before { display: inline; }
}

/* Lencana di tabel/daftar lebih kecil dari lencana judul (umpan balik produksi 2026-10-15) */
/* Konstruksi sama dengan lencana judul (line-height 1 + padding): di Android line-height tinggi membuat teks naik */
.rows .badge, .group-head .badge { font-size: 8px; font-weight: 700; line-height: 1; padding: 4.5px 5px 3.5px; letter-spacing: 0.02em; } /* +0,5px: diukur dari foto HP, teks kapital mono duduk 0,25-0,6px terlalu tinggi di Android */

/* Desktop density (>= 700px), sizes follow Coolify: controls 32px, buttons 13px, body 14px, cards p-4.
   Phones keep 40px controls / 16px inputs (touch target, iOS zoom). DESIGN-SYSTEM §4. */
@media (min-width: 700px) {
  body { font-size: 14px; }
  .btn { min-height: 32px; padding: 0 10px; border-radius: 8px; font-size: 13px; }
  .btn-sm { min-height: 28px; padding: 0 8px; font-size: 12px; }
  .btn-lg { min-height: 36px; padding: 0 14px; }
  .btn-link, .btn-link:hover { min-height: 0; padding: 0; }
  .btn-icon { width: 32px; padding: 0; }
  .btn-icon-sm { width: 28px; min-height: 28px; padding: 0; }
  .actgrid .btn .icon { width: 15px; height: 15px; }
  input, select, textarea { min-height: 32px; padding: 0 10px; border-radius: 8px; }
  textarea { min-height: 72px; padding: 6px 10px; }
  .row-env textarea { min-height: 32px; }
  .search input { padding-left: 36px; }
  .search .icon { left: 10px; width: 16px; height: 16px; }
  .select-wrap select { padding-right: 34px; }
  .select-wrap .icon { right: 10px; width: 16px; height: 16px; }
  .field, label, .check { font-size: 14px; }
  .seg-btn, .seg-radio span { min-height: 26px; font-size: 12px; }
  .chip { min-height: 28px; }
  .card { padding: 16px; }
  .row-domain { grid-template-columns: minmax(0, 1fr) 32px; }
  .row-env { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) 28px 28px; }
  .row-file { grid-template-columns: minmax(0, 1fr) auto 28px; }
}
@media (min-width: 900px) {
  .main-nav { height: 36px; }
  .main-nav a { font-size: 13px; }
}
