/* Zync Console dashboard — operator tool. Dark, dense, no external assets. */

:root {
  --bg:        #0e1013;
  --surface:   #16191e;
  --surface-2: #1c2027;
  --border:    #2a3038;
  --border-hi: #3a4250;
  --text:      #e6e9ee;
  --muted:     #8b95a5;
  --accent:    #4da3ff;
  --accent-dk: #1d5fa8;
  --ok:        #3ecf8e;
  --warn:      #f5a623;
  --danger:    #ff5c5c;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --r: 4px;
}

* { box-sizing: border-box; }

/* Must outrank our own display rules: several elements below set display on a
   class (.throttle-banner, .btn-row) and would otherwise ignore [hidden]. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1 { font-size: 18px; margin: 0 0 2px; font-weight: 600; letter-spacing: .2px; }
h2 { font-size: 14px; margin: 0 0 10px; font-weight: 600; color: var(--text); }
h3 { font-size: 12px; margin: 0 0 8px; font-weight: 600; color: var(--muted);
     text-transform: uppercase; letter-spacing: .08em; }
p  { margin: 0 0 10px; }

.boot { padding: 40px 20px; color: var(--muted); text-align: center; }

/* ---------- chrome ---------- */

.chrome {
  position: sticky; top: 0; z-index: 40;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.chrome-row {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 16px;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 600; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 14px; height: 14px; border-radius: 3px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dk));
  flex: none;
}
.brand-name { font-size: 13px; letter-spacing: .3px; }

.chrome-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.who { color: var(--muted); font-size: 12px; }

.gpu-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}
.pill-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); flex: none; }
.pill-dot[data-state="ok"]      { background: var(--ok); }
.pill-dot[data-state="warn"]    { background: var(--warn); }
.pill-dot[data-state="bad"]     { background: var(--danger); }
.pill-dot[data-state="unknown"] { background: #4a5260; }
.gpu-pill[data-state="bad"] { border-color: var(--danger); color: var(--danger); }

.nav { display: flex; gap: 2px; padding: 0 10px; overflow-x: auto; }
.nav a {
  padding: 7px 12px 8px;
  color: var(--muted);
  font-size: 13px;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.nav a:hover { color: var(--text); text-decoration: none; }
.nav a.active { color: var(--text); border-bottom-color: var(--accent); }

.throttle-banner {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 16px;
  background: #3a1113;
  border-bottom: 1px solid var(--danger);
  color: #ffd7d7;
  font-size: 13px;
  font-weight: 600;
  position: sticky; top: 0; z-index: 39;
}
.throttle-icon { color: var(--danger); font-size: 15px; }

.view { padding: 16px; max-width: 1240px; margin: 0 auto; outline: none; }
.view-head {
  display: flex; align-items: flex-end; gap: 12px;
  flex-wrap: wrap; margin-bottom: 14px;
}
.view-head .sub { color: var(--muted); font-size: 12px; }
.view-head .spacer { margin-left: auto; }

/* ---------- panels ---------- */

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 14px;
  margin-bottom: 14px;
}
.panel.tight { padding: 0; overflow: hidden; }
.panel-head {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.panel-head h2 { margin: 0; }
.panel-head .spacer { margin-left: auto; }
.panel-body { padding: 12px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 780px) { .grid-2 { grid-template-columns: 1fr; } }

/* ---------- controls ---------- */

.btn {
  appearance: none;
  font: inherit;
  font-size: 13px;
  padding: 7px 13px;
  border-radius: var(--r);
  border: 1px solid var(--border-hi);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { border-color: #4b566a; background: #232833; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent-dk); border-color: #2a72c4; color: #fff; }
.btn-primary:hover:not(:disabled) { background: #246fbe; border-color: #3d86d6; }
.btn-danger { border-color: #6b2b2b; color: #ff9d9d; background: #241618; }
.btn-danger:hover:not(:disabled) { background: #33191c; border-color: #9a3a3a; }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--muted); }
.btn-ghost:hover:not(:disabled) { color: var(--text); border-color: var(--border-hi); background: transparent; }
.btn-sm { padding: 4px 9px; font-size: 12px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

label.fl { display: block; margin-bottom: 12px; }
label.fl > .lbl {
  display: block; font-size: 12px; color: var(--muted);
  margin-bottom: 4px; letter-spacing: .02em;
}
label.fl > .hint { display: block; font-size: 11px; color: var(--muted); margin-top: 4px; }

input[type=text], input[type=password], input[type=number], select, textarea {
  width: 100%;
  font: inherit;
  font-size: 13px;
  padding: 7px 9px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border-hi);
  border-radius: var(--r);
}
textarea { resize: vertical; min-height: 68px; font-family: var(--sans); }
input:focus, select:focus, textarea:focus, .btn:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
input::placeholder, textarea::placeholder { color: #5c6675; }

.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.filters select { width: auto; min-width: 130px; }

/* ---------- table ---------- */

.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted);
  font-weight: 600;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  white-space: nowrap;
}
table.tbl td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.tbl tbody tr:hover { background: #1a1e25; }
table.tbl tbody tr.clickable { cursor: pointer; }
.mono { font-family: var(--mono); font-size: 12px; }
.num { font-family: var(--mono); font-size: 12px; text-align: right; }
.dim { color: var(--muted); }

.thumb {
  width: 44px; height: 44px;
  object-fit: cover;
  border-radius: 3px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: block;
}
.thumb-none {
  width: 44px; height: 44px; border-radius: 3px;
  border: 1px dashed var(--border-hi);
  display: grid; place-items: center;
  color: #4a5260; font-size: 10px;
}

/* ---------- status + flags ---------- */

.badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 3px;
  font-size: 11px;
  font-family: var(--mono);
  letter-spacing: .03em;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge[data-status="queued"]  { background: #1d2430; color: #9fb6d4; border-color: #2d3a4c; }
.badge[data-status="running"] { background: #12304a; color: #7fc4ff; border-color: #1d5fa8; }
.badge[data-status="done"]    { background: #123026; color: var(--ok);    border-color: #1e5a44; }
.badge[data-status="failed"]  { background: #331416; color: var(--danger); border-color: #6b2b2b; }
.badge[data-status="flagged"] { background: #352509; color: var(--warn);  border-color: #6b4c14; }
.badge[data-status="cancelled"] { background: #23262c; color: #9aa4b2; border-color: #39404a; }
/* interrupted: needs a human, but is NOT a failure — violet, not red */
.badge[data-status="interrupted"] { background: #2a2140; color: #c3b0f0; border-color: #4a3b73; }
.badge[data-status="unknown"] { background: var(--surface-2); color: var(--muted); border-color: var(--border); }

.flag {
  display: inline-block;
  padding: 1px 6px;
  margin: 1px 3px 1px 0;
  border-radius: 3px;
  font-size: 11px;
  font-family: var(--mono);
  background: #352509;
  color: var(--warn);
  border: 1px solid #6b4c14;
}

/* ---------- notices ---------- */

.notice {
  border: 1px solid var(--border-hi);
  border-left-width: 3px;
  border-radius: var(--r);
  padding: 10px 12px;
  margin-bottom: 12px;
  font-size: 13px;
  background: var(--surface-2);
}
.notice-title { font-weight: 600; margin-bottom: 3px; }
.notice-err  { border-left-color: var(--danger); background: #241618; color: #ffcfcf; }
.notice-warn { border-left-color: var(--warn);   background: #251c09; color: #ffe2b0; }
.notice-ok   { border-left-color: var(--ok);     background: #10241d; color: #bff0da; }
.notice-info { border-left-color: var(--accent); background: #121c28; color: #cfe3f8; }

/* the single most important warning in the product — do not let it read as chrome */
.notice-loud {
  border-width: 2px;
  border-left-width: 6px;
  padding: 14px;
  font-size: 14px;
}
.notice-loud .notice-title { font-size: 15px; margin-bottom: 6px; }

.empty { padding: 28px 12px; text-align: center; color: var(--muted); font-size: 13px; }

/* ---------- key/value blocks ---------- */

.kv { display: grid; grid-template-columns: minmax(110px, auto) 1fr; gap: 4px 14px; font-size: 13px; }
.kv dt { color: var(--muted); font-size: 12px; }
.kv dd { margin: 0; font-family: var(--mono); font-size: 12px; word-break: break-word; }

.copyrow { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.copyrow code {
  font-family: var(--mono); font-size: 12px;
  background: var(--bg); border: 1px solid var(--border);
  padding: 3px 7px; border-radius: 3px;
  word-break: break-all;
}

pre.block {
  margin: 0;
  padding: 11px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 340px;
  overflow: auto;
}

/* ---------- image compare ---------- */

.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 780px) { .compare { grid-template-columns: 1fr; } }
.shot { background: var(--bg); border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; }
.shot figcaption {
  padding: 6px 10px; font-size: 11px; color: var(--muted);
  border-bottom: 1px solid var(--border); background: var(--surface-2);
  display: flex; gap: 8px; align-items: center;
}
.shot figcaption .spacer { margin-left: auto; }
.shot img { display: block; width: 100%; height: auto; background: #08090b; }
.shot .missing { padding: 40px 12px; text-align: center; color: var(--muted); font-size: 12px; }

/* ---------- upload dropzone ---------- */

.drop {
  border: 2px dashed var(--border-hi);
  border-radius: var(--r);
  padding: 26px 16px;
  text-align: center;
  color: var(--muted);
  background: var(--surface-2);
  cursor: pointer;
}
.drop:hover, .drop.over { border-color: var(--accent); color: var(--text); background: #16202c; }
.drop.over { background: #17263a; }
.drop strong { color: var(--text); display: block; margin-bottom: 3px; font-size: 14px; }
.drop .small { font-size: 11px; }

.progress {
  height: 4px; background: var(--surface-2);
  border-radius: 2px; overflow: hidden; margin-top: 10px;
}
.progress > i { display: block; height: 100%; background: var(--accent); width: 0; }

.preview { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.preview img {
  width: 128px; height: 128px; object-fit: cover;
  border: 1px solid var(--border); border-radius: var(--r); background: var(--bg);
}

/* ---------- GPU ---------- */

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); gap: 10px; }
.stat {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 10px 12px;
}
.stat .k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; }
.stat .v { font-family: var(--mono); font-size: 22px; line-height: 1.25; margin-top: 2px; }
.stat .u { font-size: 12px; color: var(--muted); }
.stat[data-level="warn"] { border-color: #6b4c14; }
.stat[data-level="warn"] .v { color: var(--warn); }
.stat[data-level="bad"] { border-color: var(--danger); background: #241618; }
.stat[data-level="bad"] .v { color: var(--danger); }

.spark { display: block; width: 100%; height: 54px; }
.spark-card { padding: 10px 12px; }
.spark-card .k {
  font-size: 11px; color: var(--muted); text-transform: uppercase;
  letter-spacing: .07em; display: flex; gap: 8px;
}
.spark-card .k .spacer { margin-left: auto; }
.spark-card .k b { font-family: var(--mono); color: var(--text); font-weight: 600; }

.throttle-list { display: flex; gap: 8px; flex-wrap: wrap; }
.thr {
  font-family: var(--mono); font-size: 12px;
  padding: 4px 9px; border-radius: 3px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--muted);
}
.thr[data-on="true"] { background: #3a1113; border-color: var(--danger); color: #ffb3b3; font-weight: 600; }

.stream-state { font-size: 11px; color: var(--muted); font-family: var(--mono); }

/* ---------- login ---------- */

.login-wrap { max-width: 340px; margin: 8vh auto 0; padding: 0 16px; }
.login-brand { text-align: center; margin-bottom: 18px; }
.login-brand .brand-mark { width: 26px; height: 26px; margin: 0 auto 8px; border-radius: 6px; display: block; }
.login-brand h1 { font-size: 16px; }
.login-brand .sub { color: var(--muted); font-size: 12px; }

/* ---------- modal ---------- */

.modal-back {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(0,0,0,.62);
  display: grid; place-items: center;
  padding: 16px;
}
.modal {
  background: var(--surface);
  border: 1px solid var(--border-hi);
  border-radius: var(--r);
  padding: 16px;
  width: 100%;
  max-width: 460px;
  max-height: 90vh;
  overflow: auto;
}
.modal h2 { margin-bottom: 10px; }

/* ---------- toasts ---------- */

.toasts {
  position: fixed; right: 12px; bottom: 12px; z-index: 80;
  display: flex; flex-direction: column; gap: 8px;
  max-width: min(380px, calc(100vw - 24px));
}
.toast {
  background: var(--surface);
  border: 1px solid var(--border-hi);
  border-left: 3px solid var(--accent);
  border-radius: var(--r);
  padding: 9px 12px;
  font-size: 13px;
  box-shadow: 0 6px 18px rgba(0,0,0,.45);
  word-break: break-word;
}
.toast[data-kind="err"] { border-left-color: var(--danger); }
.toast[data-kind="ok"]  { border-left-color: var(--ok); }
.toast[data-kind="warn"]{ border-left-color: var(--warn); }

/* ---------- phone ---------- */

@media (max-width: 640px) {
  .view { padding: 12px; }
  .chrome-row { padding: 8px 12px; gap: 8px; }
  .brand-name { display: none; }
  .who { display: none; }

  /* jobs table collapses to cards */
  table.tbl.stack thead { display: none; }
  table.tbl.stack, table.tbl.stack tbody, table.tbl.stack tr, table.tbl.stack td { display: block; width: 100%; }
  table.tbl.stack tr {
    border: 1px solid var(--border);
    border-radius: var(--r);
    margin-bottom: 8px;
    padding: 6px 4px;
    background: var(--surface);
  }
  table.tbl.stack td {
    border: none;
    padding: 3px 10px;
    display: flex; gap: 10px; align-items: center;
  }
  table.tbl.stack td::before {
    content: attr(data-label);
    flex: none; width: 88px;
    font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
    color: var(--muted);
  }
  table.tbl.stack td.num { text-align: left; }
  .kv { grid-template-columns: 1fr; gap: 1px 0; }
  .kv dd { margin-bottom: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
