/* Noor admin dashboard.
   One stylesheet, no framework, no build step. Dense by intent: this is a
   review tool, and a reviewer's job is comparing numbers to sentences. */

:root {
  --bg: #f7f7f5;
  --panel: #ffffff;
  --panel-alt: #fafaf8;
  --border: #e3e2dd;
  --border-strong: #cfcec8;
  --text: #1c1b19;
  --muted: #6b6a65;
  --faint: #97968f;
  --accent: #1f5f4f;
  --accent-soft: #e8f1ee;
  --critical: #a8261f;
  --critical-soft: #fbeceb;
  --high: #8a5310;
  --high-soft: #fdf1e2;
  --medium: #1f4d7a;
  --medium-soft: #e9f0f7;
  --low: #5c5b56;
  --low-soft: #efeeea;
  --ok: #1f6b3f;
  --ok-soft: #e7f3ec;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --radius: 8px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16161a;
    --panel: #1d1e22;
    --panel-alt: #212227;
    --border: #2e2f35;
    --border-strong: #3d3e46;
    --text: #e8e7e3;
    --muted: #a3a29c;
    --faint: #77766f;
    --accent: #5fb89c;
    --accent-soft: #1b2f2a;
    --critical: #f08a80;
    --critical-soft: #2f1d1c;
    --high: #e0aa62;
    --high-soft: #2e2418;
    --medium: #7fb0e0;
    --medium-soft: #1a242f;
    --low: #a3a29c;
    --low-soft: #26272c;
    --ok: #6fc48c;
    --ok-soft: #1a2a20;
  }
}

* { box-sizing: border-box; }

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

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

/* --- layout --------------------------------------------------------------- */

.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 216px;
  flex: 0 0 216px;
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 20px 0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  padding: 0 20px 18px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}
.brand strong { font-size: 16px; letter-spacing: -0.01em; display: block; }
.brand span { color: var(--faint); font-size: 11px; font-family: var(--mono); }

.nav { flex: 1; display: flex; flex-direction: column; gap: 1px; padding: 0 10px; }
.nav a {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 10px; border-radius: 6px; color: var(--muted);
  font-size: 13.5px;
}
.nav a:hover { background: var(--panel-alt); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav .count {
  font-family: var(--mono); font-size: 11px; padding: 1px 6px;
  border-radius: 10px; background: var(--border); color: var(--muted);
}
.nav a.active .count { background: var(--accent); color: var(--panel); }
.nav .count.alert { background: var(--critical); color: #fff; }

.sidebar footer { padding: 14px 20px 0; border-top: 1px solid var(--border); font-size: 12px; color: var(--faint); }
.sidebar footer form { margin-top: 8px; }
.sidebar footer button { width: 100%; }

.main { flex: 1; min-width: 0; padding: 26px 32px 60px; max-width: 1180px; }

.page-head { margin-bottom: 22px; }
.page-head h1 { margin: 0 0 4px; font-size: 21px; letter-spacing: -0.02em; }
.page-head p { margin: 0; color: var(--muted); max-width: 70ch; }

/* --- panels and tables ---------------------------------------------------- */

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 20px;
  overflow: hidden;
}
.panel > h2 {
  margin: 0; padding: 12px 16px; font-size: 13px; font-weight: 600;
  letter-spacing: 0.02em; text-transform: uppercase; color: var(--muted);
  border-bottom: 1px solid var(--border); background: var(--panel-alt);
  display: flex; justify-content: space-between; align-items: center;
}
.panel > h2 .sub { text-transform: none; letter-spacing: 0; font-weight: 400; }
.panel-body { padding: 16px; }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th {
  text-align: left; font-weight: 600; font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.03em; color: var(--faint); padding: 9px 16px;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
td { padding: 10px 16px; border-bottom: 1px solid var(--border); vertical-align: top; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--panel-alt); }
td.num, th.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
td.mono, .mono { font-family: var(--mono); font-size: 12px; }
td.tight { white-space: nowrap; }

.empty { padding: 32px 16px; text-align: center; color: var(--faint); }
.empty strong { display: block; color: var(--muted); margin-bottom: 4px; }

/* --- stat tiles ----------------------------------------------------------- */

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 13px 15px;
}
.stat .label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.03em; color: var(--faint); }
.stat .value { font-size: 25px; font-weight: 600; letter-spacing: -0.02em; margin-top: 3px; font-variant-numeric: tabular-nums; }
.stat .note { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat.alert { border-color: var(--critical); }
.stat.alert .value { color: var(--critical); }
.stat.warn { border-color: var(--high); }
.stat.warn .value { color: var(--high); }

/* --- badges --------------------------------------------------------------- */

.badge {
  display: inline-block; padding: 2px 8px; border-radius: 11px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.02em;
  font-family: var(--mono); white-space: nowrap;
}
.badge.critical { background: var(--critical-soft); color: var(--critical); }
.badge.high     { background: var(--high-soft);     color: var(--high); }
.badge.medium   { background: var(--medium-soft);   color: var(--medium); }
.badge.low      { background: var(--low-soft);      color: var(--low); }
.badge.ok       { background: var(--ok-soft);       color: var(--ok); }

/* --- confidence meter ----------------------------------------------------- */

.meter { display: flex; align-items: center; gap: 8px; }
.meter .track { width: 54px; height: 5px; border-radius: 3px; background: var(--border); overflow: hidden; }
.meter .fill { height: 100%; background: var(--ok); }
.meter .fill.warn { background: var(--high); }
.meter .fill.bad { background: var(--critical); }
.meter .pct { font-family: var(--mono); font-size: 12px; color: var(--muted); }

/* --- provenance ----------------------------------------------------------- */

.provenance {
  border-left: 3px solid var(--border-strong);
  padding: 10px 0 10px 14px;
  margin: 10px 0;
  background: var(--panel-alt);
  border-radius: 0 6px 6px 0;
}
.provenance blockquote {
  margin: 0 0 8px; font-size: 14px; line-height: 1.6;
}
.provenance blockquote:before { content: "“"; color: var(--faint); }
.provenance blockquote:after { content: "”"; color: var(--faint); }
.provenance .meta { font-size: 12px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 14px; }
.provenance .meta .mono { font-size: 11.5px; }

/* --- diffs ---------------------------------------------------------------- */

.diff { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.diff .old, .diff .new {
  font-family: var(--mono); font-size: 12.5px; padding: 3px 8px; border-radius: 5px;
}
.diff .old { background: var(--critical-soft); color: var(--critical); text-decoration: line-through; }
.diff .new { background: var(--ok-soft); color: var(--ok); }
.diff .arrow { color: var(--faint); }

/* --- forms and buttons ---------------------------------------------------- */

button, .button {
  font: inherit; font-size: 13px; font-weight: 500;
  padding: 7px 14px; border-radius: 6px; cursor: pointer;
  border: 1px solid var(--border-strong); background: var(--panel); color: var(--text);
}
button:hover, .button:hover { background: var(--panel-alt); text-decoration: none; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover { filter: brightness(1.08); }
button.danger { background: var(--critical); border-color: var(--critical); color: #fff; }
button.danger:hover { filter: brightness(1.08); }
button.small { padding: 4px 10px; font-size: 12px; }

.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

input[type=text], input[type=email], input[type=password], textarea, select {
  font: inherit; font-size: 13.5px; padding: 8px 10px;
  border: 1px solid var(--border-strong); border-radius: 6px;
  background: var(--panel); color: var(--text); width: 100%;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
.field { margin-bottom: 14px; }
.hint { font-size: 12px; color: var(--faint); margin-top: 5px; }

.filters { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.filters .field { margin-bottom: 0; min-width: 150px; }

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

.login-shell { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.login { width: 100%; max-width: 380px; }
.login .panel-body { padding: 22px; }
.login h1 { margin: 0 0 4px; font-size: 20px; }
.login p.intro { margin: 0 0 20px; color: var(--muted); font-size: 13px; }
.login .divider {
  display: flex; align-items: center; gap: 10px; margin: 18px 0;
  color: var(--faint); font-size: 12px;
}
.login .divider:before, .login .divider:after {
  content: ""; flex: 1; height: 1px; background: var(--border);
}

.notice {
  padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; font-size: 13px;
  background: var(--critical-soft); color: var(--critical); border: 1px solid var(--critical);
}
.notice.info { background: var(--medium-soft); color: var(--medium); border-color: var(--medium); }
.notice.ok { background: var(--ok-soft); color: var(--ok); border-color: var(--ok); }

/* --- misc ----------------------------------------------------------------- */

.crumb { font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }
.crumb a { color: var(--muted); }

.kv { display: grid; grid-template-columns: 190px 1fr; gap: 8px 18px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

.rule {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 12px; background: var(--panel);
}
.rule header { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 6px; }
.rule header h4 { margin: 0; font-size: 14.5px; }
.rule .terms { font-size: 13px; color: var(--muted); margin-bottom: 2px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.tabs a { padding: 8px 14px; color: var(--muted); border-bottom: 2px solid transparent; font-size: 13.5px; }
.tabs a.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.tabs a:hover { text-decoration: none; color: var(--text); }

.warning-row td { background: var(--high-soft); }

pre.snapshot {
  margin: 0; padding: 16px; overflow-x: auto; font-family: var(--mono);
  font-size: 12px; line-height: 1.6; white-space: pre-wrap; word-break: break-word;
  max-height: 70vh; overflow-y: auto;
}

@media (max-width: 800px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; flex: none; height: auto; position: static; flex-direction: column; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .main { padding: 20px 16px 40px; }
  .kv { grid-template-columns: 1fr; gap: 2px 0; }
  .kv dt { margin-top: 8px; }
}

/* Artwork queue: two pictures side by side, a decision underneath. */
.artwork-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 16px; }
.artwork-item { background: var(--panel, #fff); border: 1px solid var(--line, #e3e3e3); border-radius: 12px; padding: 14px; }
.artwork-head { display: flex; gap: 10px; align-items: baseline; margin-bottom: 10px; }
.artwork-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.artwork-pair figure { margin: 0; }
.artwork-pair figcaption { font-size: 12px; color: var(--muted, #666); margin-bottom: 6px; }
.artwork-pair img, .artwork-none { width: 100%; aspect-ratio: 1.586; object-fit: contain; border-radius: 10px;
  background: repeating-conic-gradient(#f2f2f2 0 25%, #fafafa 0 50%) 0 0 / 16px 16px; }
.artwork-none { display: flex; align-items: center; justify-content: center; color: rgba(255,255,255,.8); font-size: 13px; }
.artwork-meta { display: flex; flex-direction: column; gap: 2px; margin: 10px 0; font-size: 12px; overflow-wrap: anywhere; }
.artwork-actions { display: flex; gap: 8px; align-items: center; }
.artwork-actions form { display: flex; gap: 6px; }
.artwork-actions input[type=text] { min-width: 180px; }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: middle; border: 1px solid rgba(0,0,0,.15); }

.artwork-card { display: grid; grid-template-columns: 260px 1fr; gap: 20px; align-items: start; }
.artwork-card figure { margin: 0; }
.artwork-card img, .artwork-card .artwork-none { width: 100%; aspect-ratio: 1.586; object-fit: contain; border-radius: 10px; background: #1c1c1e; }
.artwork-card figcaption { font-size: 12px; color: var(--muted, #666); margin-top: 6px; }
.artwork-card label { display: block; font-weight: 600; margin-bottom: 6px; }
.artwork-card input[type=url] { width: 100%; box-sizing: border-box; margin-bottom: 10px; }
@media (max-width: 700px) { .artwork-card { grid-template-columns: 1fr; } }

/* Entering an offer by hand: two columns of short fields, and the source on a
   line of its own because a URL is long and getting it right is the point. */
.offer-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 18px; }
.offer-form .field.wide { grid-column: 1 / -1; }
.offer-form .field.wide input { width: 100%; }
.offer-form .field.wide button { margin-right: 12px; }
.req { color: var(--critical); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
