/* yudochat console — one dark theme, no toggle. This is an ops tool that
   lives on a second monitor at 2am; density and contrast beat versatility. */

:root {
  --bg: #0f0c17;
  --panel: #18132a;
  --panel-2: #1e1834;
  --line: #262038;
  --line-soft: #201a34;
  --text: #f7f5fb;
  --muted: #a79fbd;
  --dim: #6e6688;
  --brand: #7c5cff;
  --brand-soft: #3a2f5c;
  --ok: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;
  --info: #60a5fa;
  --radius: 12px;
  --radius-sm: 8px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

[hidden] { display: none !important; }

.boot {
  display: grid;
  place-items: center;
  min-height: 100vh;
  color: var(--dim);
}

/* ---------------- sign-in ---------------- */

.signin {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
}

.signin-card {
  width: 100%;
  max-width: 380px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 32px;
}

.signin-card h1 {
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.signin-card h1 span { color: var(--brand); }
.signin-card .sub { margin: 0 0 24px; color: var(--muted); font-size: 13px; }

/* ---------------- shell ---------------- */

.shell {
  display: grid;
  grid-template-columns: 216px 1fr;
  min-height: 100vh;
}

.sidebar {
  border-right: 1px solid var(--line);
  background: #130f20;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.02em;
  padding: 4px 10px 16px;
}
.brand span { color: var(--brand); }

.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  cursor: pointer;
  font-size: 13.5px;
  border: 0;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
}
.nav-item:hover { background: var(--panel-2); color: var(--text); }
.nav-item.active { background: var(--brand-soft); color: var(--text); font-weight: 600; }
.nav-group {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--dim);
  padding: 16px 10px 6px;
}

.sidebar-foot {
  margin-top: auto;
  padding: 12px 10px 0;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--dim);
  word-break: break-all;
}

.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(15, 12, 23, 0.92);
  backdrop-filter: blur(8px);
}

.topbar h2 { margin: 0; font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.topbar .spacer { flex: 1; }

.search-wrap { position: relative; width: min(340px, 40vw); }
.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  max-height: 60vh;
  overflow: auto;
  padding: 6px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
}
.search-results .sr-group { font-size: 10.5px; text-transform: uppercase; color: var(--dim); padding: 8px 8px 4px; letter-spacing: 0.06em; }
.search-results button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  color: var(--text);
  padding: 7px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font: inherit;
}
.search-results button:hover { background: var(--panel-2); }
.search-results .sr-sub { color: var(--dim); font-size: 12px; }

.content { padding: 20px; display: flex; flex-direction: column; gap: 16px; }

/* ---------------- primitives ---------------- */

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}

.card > h3 {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.grid { display: grid; gap: 12px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid.stats { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }

.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.stat .label { font-size: 11.5px; color: var(--dim); text-transform: uppercase; letter-spacing: 0.05em; }
.stat .value { font-size: 24px; font-weight: 750; letter-spacing: -0.02em; margin-top: 4px; }
.stat .hint { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat.alert { border-color: #4a2530; background: #1f1420; }
.stat.alert .value { color: var(--bad); }
.stat.good .value { color: var(--ok); }
.stat.action { border-color: var(--brand-soft); background: #1c1633; cursor: pointer; }
.stat.action:hover { border-color: var(--brand); }

.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.small { font-size: 12px; }
.mono { font-family: var(--mono); font-size: 12px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.grow { flex: 1; min-width: 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pre-wrap { white-space: pre-wrap; word-break: break-word; }

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

button.btn, .btn {
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  padding: 8px 12px;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { border-color: var(--brand-soft); background: #241d3e; }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover:not(:disabled) { background: #6a4bef; }
.btn.danger { background: #2a1520; border-color: #4a2530; color: #fca5a5; }
.btn.danger:hover:not(:disabled) { background: #3a1a2a; border-color: var(--bad); }
.btn.ok { background: #10251f; border-color: #1d4d3d; color: #6ee7b7; }
.btn.ok:hover:not(:disabled) { border-color: var(--ok); }
.btn.ghost { background: none; }
.btn.sm { padding: 5px 9px; font-size: 12px; }
.btn.block { width: 100%; }

input, select, textarea {
  font: inherit;
  font-size: 13.5px;
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 9px 11px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
textarea { resize: vertical; min-height: 76px; }
label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filters input, .filters select { width: auto; min-width: 130px; }
.filters .search { min-width: 220px; flex: 1; }

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

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--dim);
  font-weight: 600;
  padding: 10px 12px;
  background: #130f20;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  white-space: nowrap;
}
tbody td { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover { background: var(--panel-2); }
tbody tr.dulled td { opacity: 0.55; }

.empty { padding: 32px; text-align: center; color: var(--dim); }

/* ---------------- pills ---------------- */

.pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 650;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--muted);
  white-space: nowrap;
}
.pill.ok { color: #6ee7b7; border-color: #1d4d3d; background: #10251f; }
.pill.warn { color: #fcd34d; border-color: #4d3d15; background: #241d10; }
.pill.bad { color: #fca5a5; border-color: #4a2530; background: #2a1520; }
.pill.info { color: #93c5fd; border-color: #1e3a5f; background: #101b2b; }
.pill.brand { color: #c4b5fd; border-color: var(--brand-soft); background: #1c1633; }

/* ---------------- drawer ---------------- */

.scrim {
  position: fixed;
  inset: 0;
  background: rgba(6, 4, 12, 0.72);
  z-index: 50;
  display: flex;
  justify-content: flex-end;
}
.drawer {
  width: min(720px, 100vw);
  background: var(--bg);
  border-left: 1px solid var(--line);
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.drawer-head { display: flex; align-items: flex-start; gap: 12px; }
.drawer-head h3 { margin: 0; font-size: 18px; letter-spacing: -0.01em; }

.modal-card {
  width: min(480px, calc(100vw - 32px));
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px;
  margin: auto;
}
.scrim.center { align-items: center; justify-content: center; }
.modal-card h3 { margin: 0 0 6px; font-size: 17px; }
.modal-card .why { margin: 0 0 16px; color: var(--muted); font-size: 13px; }

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

.kv { display: grid; grid-template-columns: 132px 1fr; gap: 6px 12px; font-size: 13px; }
.kv dt { color: var(--dim); }
.kv dd { margin: 0; word-break: break-word; }

/* ---------------- charts ---------------- */

.spark { display: flex; align-items: flex-end; gap: 2px; height: 56px; }
.spark .bar { flex: 1; background: var(--brand-soft); border-radius: 2px 2px 0 0; min-height: 2px; position: relative; }
.spark .bar.hot { background: var(--brand); }
.spark .bar:hover::after {
  content: attr(data-tip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 3px 7px;
  font-size: 11px;
  white-space: nowrap;
  z-index: 5;
}

/* ---------------- review queue ---------------- */

.brief {
  display: grid;
  grid-template-columns: 132px 1fr;
  gap: 16px;
}
.brief-img {
  width: 132px;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  border: 1px solid var(--line);
}
.brief-img.placeholder { display: grid; place-items: center; color: var(--dim); font-size: 11px; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.dos-donts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dos-donts ul { margin: 4px 0 0; padding-left: 18px; }
.dos-donts li { margin-bottom: 2px; }

.trust { display: flex; gap: 6px; flex-wrap: wrap; }

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

.toasts {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 380px;
}
.toast {
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 3px solid var(--brand);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-size: 13px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}
.toast.bad { border-left-color: var(--bad); }
.toast.ok { border-left-color: var(--ok); }

.banner {
  border: 1px solid #4d3d15;
  background: #241d10;
  color: #fcd34d;
  border-radius: var(--radius);
  padding: 11px 14px;
  font-size: 13px;
}
.banner.bad { border-color: #4a2530; background: #2a1520; color: #fca5a5; }
.banner.info { border-color: #1e3a5f; background: #101b2b; color: #93c5fd; }

/* ---------------- responsive ---------------- */

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    align-items: center;
  }
  .brand, .nav-group, .sidebar-foot { display: none; }
  .nav-item { width: auto; white-space: nowrap; }
  .search-wrap { width: 100%; }
  .kv { grid-template-columns: 1fr; gap: 2px 0; }
  .kv dt { margin-top: 8px; }
  .brief { grid-template-columns: 1fr; }
  .dos-donts { grid-template-columns: 1fr; }
}
