/* Tagnator Reports dashboard. Colours and type follow tagnator.com (tracks/U1-umbrella-site/public/assets/style.css). */
:root {
  --bg: #f6f7f9; --surface: #ffffff; --surface-2: #f1f3f6; --text: #15181d; --muted: #5b6472; --border: #d9dee6;
  --accent: #0f7a4a; --accent-ink: #ffffff; --accent-soft: #e8f4ee;
  --mark-bg: #fff4d6; --mark-edge: #9a6b00; --mark-ink: #4a3500;
  --danger: #b42318; --danger-ink: #ffffff; --danger-soft: #fdecea;
  --focus: #0f7a4a;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 8px 24px rgba(16, 24, 40, 0.06);
  --radius: 12px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1216; --surface: #171b21; --surface-2: #1e232b; --text: #e7eaee; --muted: #9aa4b2; --border: #2a313b;
    --accent: #3fb27f; --accent-ink: #0f1216; --accent-soft: #16291f;
    --mark-bg: #3a2f10; --mark-edge: #e0b341; --mark-ink: #ffe9a8;
    --danger: #f97066; --danger-ink: #0f1216; --danger-soft: #3a1714;
    --focus: #3fb27f;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.5; color: var(--text); background: var(--bg); overflow-wrap: break-word; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; }
h4 { font-size: 0.95rem; }
p { margin: 0; }
a { color: var(--accent); }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.wrap { max-width: 1280px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .wrap { padding: 0 24px; } }

/* Header */
.top { background: var(--surface); border-bottom: 1px solid var(--border); }
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; }
.brand { display: inline-flex; align-items: center; gap: 12px; }
.brand-logo { display: block; height: 28px; width: auto; }
.brand-sub { font-weight: 600; color: var(--muted); padding-left: 12px; border-left: 1px solid var(--border); line-height: 28px; }

.main { padding-top: 20px; padding-bottom: 48px; }

/* Buttons and fields */
.btn { font: inherit; font-size: 0.95rem; font-weight: 600; line-height: 1.2; border-radius: 8px; padding: 9px 14px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); min-height: 40px; }
.btn:hover { border-color: var(--muted); }
.btn:disabled { opacity: 0.6; cursor: default; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { border-color: var(--accent); filter: brightness(1.08); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: var(--danger-ink); }
.btn-danger-outline { color: var(--danger); border-color: var(--danger); background: transparent; }
.btn-quiet { background: transparent; }
.btn-small { padding: 6px 12px; min-height: 34px; font-size: 0.9rem; }
.field-label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; min-height: 40px; width: 100%; }
textarea { min-height: 96px; resize: vertical; line-height: 1.45; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 0; border-color: var(--focus); }
.error { color: var(--danger); font-weight: 600; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }

/* Sign in */
.field { display: flex; flex-direction: column; }
.sign-in { max-width: 440px; margin: 48px auto 0; padding: 24px; display: flex; flex-direction: column; gap: 12px; }
.sign-in form { display: flex; flex-direction: column; gap: 12px; margin-top: 4px; }
.sign-in input { font-family: var(--mono); }
.sign-in .btn { align-self: flex-start; }

/* States: loading, empty, error */
.state { padding: 14px 0; color: var(--muted); }
.state:empty { display: none; }
.state-error { color: var(--text); background: var(--danger-soft); border-left: 4px solid var(--danger); border-radius: 6px; padding: 12px 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }

/* Counts per app */
.counts { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 440px), 1fr)); gap: 12px; margin-bottom: 20px; }
.count-card { padding: 14px 16px; container-type: inline-size; }
.count-app { font-size: 1rem; margin-bottom: 10px; display: flex; align-items: baseline; gap: 8px; }
.count-code { font-weight: 400; font-size: 0.85rem; color: var(--muted); font-family: var(--mono); }
.count-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
@container (min-width: 400px) { .count-row { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.count { font: inherit; text-align: left; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); border-radius: 8px; padding: 8px 10px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.count:hover { border-color: var(--muted); }
.count-n { font-size: 1.35rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.count-label { font-size: 0.8rem; color: var(--muted); line-height: 1.2; white-space: nowrap; }

/* Layout: list beside the report on wide screens, above it on narrow ones */
.layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
@media (min-width: 960px) {
  .layout { grid-template-columns: minmax(340px, 400px) minmax(0, 1fr); align-items: start; }
  .detail-pane { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow-y: auto; }
}
.list-pane, .detail-pane { min-width: 0; }
@media (max-width: 959px) { .detail-pane .idle { display: none; } }

.pane-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 8px; }
.filter { display: block; min-width: 0; }

/* The list */
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.item { width: 100%; text-align: left; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; }
.item:hover { border-color: var(--muted); }
.item[aria-current="true"] { border-color: var(--accent); box-shadow: inset 4px 0 0 var(--accent); background: var(--accent-soft); }
.item-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.item-subject { font-weight: 600; overflow-wrap: anywhere; min-width: 0; }
.item-meta, .item-rows { font-size: 0.875rem; color: var(--muted); overflow-wrap: anywhere; }
.item-rows strong { color: var(--text); }
.more { width: 100%; margin-top: 10px; }

/* Status badges: words, not colour alone */
.badge { display: inline-block; font-size: 0.78rem; font-weight: 700; line-height: 1; padding: 5px 8px; border-radius: 999px; white-space: nowrap; border: 1px solid transparent; flex: none; }
.badge-new { background: #e6efff; color: #1d3f8f; border-color: #b9cdf5; }
.badge-reproduced { background: #fff1db; color: #7a4100; border-color: #f3cf96; }
.badge-fixed { background: #e3f4ea; color: #0b5c37; border-color: #a9dcbf; }
.badge-not-a-fault { background: #eceef1; color: #3d4450; border-color: #cfd4db; }
@media (prefers-color-scheme: dark) {
  .badge-new { background: #172544; color: #b9cdf5; border-color: #2c4377; }
  .badge-reproduced { background: #3a2a10; color: #f6cf8f; border-color: #6a4c1c; }
  .badge-fixed { background: #133022; color: #9fdcba; border-color: #24583d; }
  .badge-not-a-fault { background: #252b33; color: #c3cad4; border-color: #3a424e; }
}

/* The open report */
.detail { padding: 20px; display: flex; flex-direction: column; gap: 22px; }
@media (max-width: 480px) { .detail { padding: 16px; } }
.detail-head { display: flex; flex-direction: column; gap: 6px; }
.detail-head h2 { font-size: 1.3rem; overflow-wrap: anywhere; }
.back { align-self: flex-start; margin-bottom: 4px; }
@media (min-width: 960px) { .back { display: none; } }
.block { display: flex; flex-direction: column; gap: 10px; }
.block > h3 { padding-bottom: 6px; border-bottom: 1px solid var(--border); }

.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px 16px; margin: 0; }
.facts div { min-width: 0; }
.facts dt { font-size: 0.8rem; color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }

.pair { display: flex; flex-direction: column; gap: 4px; }
.pair-label { font-size: 0.85rem; font-weight: 600; color: var(--muted); }
.pair-value { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; min-width: 0; }
.rt { unicode-bidi: isolate; }
.mono { font-family: var(--mono); font-size: 0.9rem; overflow-wrap: anywhere; min-width: 0; }
.url-text { word-break: break-all; }
.copied { font-size: 0.85rem; color: var(--accent); font-weight: 600; }
.comment { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--surface-2); border-radius: 8px; padding: 10px 12px; }
.none { color: var(--muted); font-style: italic; }

.section { display: flex; flex-direction: column; gap: 8px; }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.section-head h4 { overflow-wrap: anywhere; }
.section-count { font-size: 0.85rem; color: var(--muted); }
.table-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: 8px; max-width: 100%; }
table { border-collapse: collapse; width: 100%; min-width: 100%; font-size: 0.9rem; }
th, td { text-align: left; vertical-align: top; padding: 8px 10px; border-bottom: 1px solid var(--border); }
th { background: var(--surface-2); font-size: 0.8rem; color: var(--muted); font-weight: 700; white-space: nowrap; }
td { min-width: 16ch; max-width: 36ch; overflow-wrap: anywhere; }
td.num, th.num { min-width: 0; width: 1%; white-space: nowrap; color: var(--muted); font-variant-numeric: tabular-nums; }
td.num { display: table-cell; }
.row-n { display: block; }
.scroll-hint { font-size: 0.85rem; color: var(--muted); }
tbody tr:last-child td { border-bottom: 0; }
tr.marked td { background: var(--mark-bg); color: var(--mark-ink); }
tr.marked td:first-child { box-shadow: inset 4px 0 0 var(--mark-edge); }
.mark { display: inline-block; margin-top: 4px; font-size: 0.75rem; font-weight: 700; padding: 2px 6px; border-radius: 4px; border: 1px solid var(--mark-edge); color: var(--mark-ink); background: transparent; }

/* Our decision */
.decide { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.decide .wide { grid-column: 1 / -1; }
@media (max-width: 480px) { .decide { grid-template-columns: 1fr; } }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; }
.saved { font-weight: 600; color: var(--accent); }
.danger-zone { border-top: 1px solid var(--border); padding-top: 16px; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.confirm { background: var(--danger-soft); border-left: 4px solid var(--danger); border-radius: 6px; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
