/* SYC-AI Operations — the console an operator lives in all day.
   Quiet by default so the data is what you notice; colour is reserved for the
   two things that matter, state and danger. */

:root {
  color-scheme: light dark;
  --bg: #f4f5f7;
  --panel: #ffffff;
  --panel-soft: #fafbfc;
  --line: #e2e5ea;
  --line-strong: #cfd4dc;
  --text: #141821;
  --muted: #646d7d;
  --accent: #2d5bd7;
  --accent-soft: #eaf0fe;
  --good: #16794a;
  --good-soft: #e6f4ec;
  --warn: #8a5a00;
  --warn-soft: #fdf1dc;
  --danger: #b3261e;
  --danger-soft: #fdecea;
  --shadow: 0 1px 2px rgb(16 24 40 / .05), 0 1px 3px rgb(16 24 40 / .06);
  --shadow-lg: 0 12px 32px rgb(16 24 40 / .16);
  --radius: 10px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1116; --panel: #171a21; --panel-soft: #1c2029;
    --line: #262b35; --line-strong: #333a47;
    --text: #e8eaef; --muted: #949cab;
    --accent: #7ba1ff; --accent-soft: #1b2440;
    --good: #5fd39b; --good-soft: #14291f;
    --warn: #e0b057; --warn-soft: #2b2415;
    --danger: #ff8b82; --danger-soft: #2d1a19;
    --shadow: 0 1px 2px rgb(0 0 0 / .4);
    --shadow-lg: 0 16px 40px rgb(0 0 0 / .55);
  }
}
:root[data-theme="dark"] {
  --bg: #0f1116; --panel: #171a21; --panel-soft: #1c2029;
  --line: #262b35; --line-strong: #333a47;
  --text: #e8eaef; --muted: #949cab;
  --accent: #7ba1ff; --accent-soft: #1b2440;
  --good: #5fd39b; --good-soft: #14291f;
  --warn: #e0b057; --warn-soft: #2b2415;
  --danger: #ff8b82; --danger-soft: #2d1a19;
  --shadow: 0 1px 2px rgb(0 0 0 / .4);
  --shadow-lg: 0 16px 40px rgb(0 0 0 / .55);
}

* { box-sizing: border-box; }
/* `form label { display: block }` below would otherwise beat the hidden
   attribute, so a hidden field would still be drawn. */
[hidden] { display: none !important; }

body {
  margin: 0;
  padding: 0 24px 64px;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
@media (max-width: 640px) { body { padding: 0 16px 48px; } }

/* --- header ------------------------------------------------------------ */

header {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 16px;
  max-width: 1200px; margin: 0 auto 20px;
  padding: 20px 0 16px;
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.mark {
  display: grid; place-items: center;
  width: 40px; height: 40px; flex: none;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 65%, #7b3ff2));
  color: #fff; font-weight: 700; font-size: 13px; letter-spacing: .06em;
  box-shadow: var(--shadow);
}
h1 { font-size: 18px; font-weight: 650; margin: 0; letter-spacing: -.01em; }
.brand p { margin: 1px 0 0; }
h2 { font-size: 16px; font-weight: 650; margin: 0 0 4px; }
h3 { font-size: 14px; font-weight: 650; margin: 22px 0 10px; }
.muted { color: var(--muted); font-size: 13px; }

main { max-width: 1200px; margin: 0 auto; }
/* The sign-in card is its own id, so it must not inherit the page width. */
#signin { max-width: 420px; margin: 8px auto 0; }

/* --- navigation -------------------------------------------------------- */

nav {
  display: flex; flex-wrap: wrap; gap: 4px;
  margin-bottom: 18px; padding: 4px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
nav button {
  background: transparent; border: 0; border-radius: 8px;
  padding: 8px 14px; color: var(--muted);
  font-size: 14px; font-weight: 500;
}
nav button:hover { background: var(--panel-soft); color: var(--text); }
nav button.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

/* --- surfaces ---------------------------------------------------------- */

.card, .tab, #customer-detail > div, #ticket-detail > div, #sighting-detail > div {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  box-shadow: var(--shadow);
}
#customer-detail > div, #ticket-detail > div, #sighting-detail > div { margin-top: 16px; }
#customer-detail > div > div {
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px; margin-top: 12px;
}


/* --- forms ------------------------------------------------------------- */

form label {
  display: block; margin-bottom: 14px;
  font-size: 13px; font-weight: 500; color: var(--muted);
}
input, select, textarea, button {
  font: inherit; color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 8px; padding: 8px 11px;
  transition: border-color .12s, box-shadow .12s, background .12s;
}
form label input, form label select, form label textarea {
  display: block; width: 100%; margin-top: 5px;
  font-weight: 400; color: var(--text);
}
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
textarea { resize: vertical; min-height: 72px; }

button { cursor: pointer; font-weight: 500; }
button:hover { background: var(--panel-soft); }
button[type="submit"], #ask-ok {
  background: var(--accent); border-color: var(--accent); color: #fff;
}
button[type="submit"]:hover, #ask-ok:hover { background: color-mix(in srgb, var(--accent) 88%, #000); }

.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.row input, .row select { flex: 1 1 220px; }
.row button { flex: none; }
label.inline {
  display: inline-flex; align-items: center; gap: 9px;
  margin: 0; color: var(--text); font-weight: 500; cursor: pointer;
}
/* `.row input { flex: 1 1 220px }` would stretch a checkbox across the row. */
label.inline input, input[type="checkbox"] {
  flex: none; margin: 0; width: 16px; height: 16px; accent-color: var(--accent);
}

/* --- tables ------------------------------------------------------------ */

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: start; padding: 11px 12px; vertical-align: middle; }
th {
  color: var(--muted); font-weight: 600; font-size: 11px;
  text-transform: uppercase; letter-spacing: .06em;
  border-bottom: 1px solid var(--line-strong);
  white-space: nowrap;
}
tbody tr { border-bottom: 1px solid var(--line); }
tbody tr:last-child { border-bottom: 0; }
tbody tr:hover { background: var(--panel-soft); }
td code {
  font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--muted);
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 5px; padding: 2px 6px;
}
td button { padding: 5px 10px; font-size: 13px; }
td button + button { margin-inline-start: 6px; }
td select { padding: 5px 9px; font-size: 13px; }

/* State reads as a word, not a colour alone. */
.pill {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
  background: var(--panel-soft); border: 1px solid var(--line-strong); color: var(--muted);
}
.pill.good { background: var(--good-soft); border-color: transparent; color: var(--good); }
.pill.warn { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.pill.bad { background: var(--danger-soft); border-color: transparent; color: var(--danger); }

.flag {
  display: inline-block;
  background: var(--danger-soft); color: var(--danger);
  border-radius: 6px; padding: 2px 8px;
  font-size: 12px; font-weight: 600; margin: 0 5px 5px 0;
}

/* --- status line, threads, dialog -------------------------------------- */

.status { min-height: 20px; font-size: 13px; color: var(--muted); margin: 0 0 14px; }
.status.bad { color: var(--danger); font-weight: 500; }
.error { color: var(--danger); font-size: 13px; min-height: 18px; margin: 10px 0 0; }

.messages { margin: 14px 0; display: grid; gap: 10px; }
.messages article { border-inline-start: 3px solid var(--line-strong); padding: 2px 0 2px 12px; }
.messages article.admin { border-color: var(--accent); }
.messages article > div:first-child { font-size: 12px; color: var(--muted); margin-bottom: 2px; }

/* A real dialog instead of window.prompt: it does not block the page, it can
   ask for a value and the reason at once, and it can be styled. */
dialog#ask {
  border: 1px solid var(--line); border-radius: 14px;
  background: var(--panel); color: var(--text);
  padding: 24px; min-width: min(440px, calc(100vw - 32px));
  box-shadow: var(--shadow-lg);
}
dialog#ask::backdrop { background: rgb(8 11 18 / .5); }
dialog#ask h2 { margin-bottom: 4px; }
dialog#ask #ask-note { margin: 0 0 16px; }
dialog#ask .row { margin: 18px 0 0; }
dialog#ask #ask-cancel { border-color: var(--line-strong); color: var(--muted); }

/* --- narrow screens ---------------------------------------------------- */

@media (max-width: 720px) {
  table, thead, tbody, tr, th, td { display: block; }
  thead { display: none; }
  tbody tr {
    border: 1px solid var(--line); border-radius: var(--radius);
    padding: 10px 12px; margin-bottom: 10px; background: var(--panel-soft);
  }
  td { border: 0; padding: 3px 0; }
  td::before {
    content: attr(data-label); display: inline-block;
    min-width: 110px; color: var(--muted); font-size: 12px;
  }
}
