/* Shared styles for the signed-in pages. One copy, so a change to the shell is one edit. */
:root {
  --bg: #f6f7f9; --panel: #fff; --ink: #1c1f23; --muted: #666d75;
  --line: #e3e6ea; --accent: #0a6ed1; --head: #eef1f4;
  --warn-bg: #fff6e5; --warn-ink: #7a4b00; --warn-line: #f0d9a8;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15181c; --panel: #1d2126; --ink: #eceff2; --muted: #9aa3ac;
    --line: #2c3239; --accent: #4da3ff; --head: #242a30;
    --warn-bg: #2e2513; --warn-ink: #f0cd8a; --warn-line: #4a3c1c;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
button, input { font: inherit; }
a { color: var(--accent); }

/* centred card, used by login */
.centre { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 28px; width: 100%; max-width: 22rem;
}
.card h1 { margin: 0 0 4px; font-size: 1.35rem; }
.card .sub { margin: 0 0 20px; color: var(--muted); font-size: 0.9rem; }
label { display: block; font-size: 0.8rem; color: var(--muted); margin: 12px 0 4px; }
input {
  width: 100%; padding: 9px 11px; color: var(--ink);
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
}
.primary {
  width: 100%; margin-top: 20px; padding: 10px; border: 0; border-radius: 8px;
  background: var(--accent); color: #fff; font-weight: 600; cursor: pointer;
}
.primary:disabled { opacity: 0.55; cursor: default; }
.error { margin-top: 14px; color: #b3261e; font-size: 0.875rem; }
@media (prefers-color-scheme: dark) { .error { color: #ff8a80; } }

/* signed-in shell */
.shell { padding: 20px 16px 48px; max-width: 72rem; margin: 0 auto; }
header.bar { display: flex; flex-wrap: wrap; gap: 12px; align-items: baseline; margin-bottom: 4px; }
header.bar h1 { margin: 0; font-size: 1.2rem; }
.spacer { flex: 1 1 auto; }
.muted, .count { color: var(--muted); font-size: 0.85rem; }
.ghost {
  padding: 9px 14px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel); color: var(--ink); cursor: pointer; text-decoration: none;
  display: inline-block;
}
.banner {
  background: var(--warn-bg); color: var(--warn-ink); border: 1px solid var(--warn-line);
  border-radius: 10px; padding: 10px 12px; margin: 12px 0; font-size: 0.875rem;
}

/* dashboard */
.cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); margin-top: 20px; }
.tile {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 20px; text-decoration: none; color: var(--ink); display: block;
}
.tile:hover { border-color: var(--accent); }
.tile h2 { margin: 0 0 6px; font-size: 1.05rem; }
.tile p { margin: 0; color: var(--muted); font-size: 0.875rem; }
.tile.disabled { opacity: 0.55; }
.badge {
  display: inline-block; margin-top: 10px; padding: 2px 8px; border-radius: 999px;
  background: var(--warn-bg); color: var(--warn-ink); border: 1px solid var(--warn-line);
  font-size: 0.78rem;
}

/* tables */
.scroll { overflow: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
table { border-collapse: collapse; width: 100%; font-size: 0.875rem; white-space: nowrap; }
th, td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: left; }
th { position: sticky; top: 0; background: var(--head); font-weight: 600; user-select: none; }
tbody tr:hover { background: var(--bg); }

/* reference-table editor */
.controls { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 14px 0; }
.controls input[type="search"] { width: auto; flex: 1 1 14rem; max-width: 24rem; }
label.inline { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-size: 0.875rem; color: var(--ink); }
label.inline input { width: auto; }

/* The row header stays put while 36 columns scroll past it — a cell with no code beside it is unidentifiable. */
.rowhead {
  position: sticky; left: 0; z-index: 1; background: var(--head);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.rowhead .tiny {
  margin-left: 8px; padding: 1px 7px; border-radius: 999px; cursor: pointer;
  background: var(--warn-bg); color: var(--warn-ink); border: 1px solid var(--warn-line);
  font: inherit; font-size: 0.72rem;
}
.rowhead .tiny:disabled { opacity: 0.5; cursor: default; }

/* An editable cell has to look editable; an empty one still has to be clickable. */
td.cell { cursor: text; min-width: 3rem; }
td.cell:empty::after { content: "—"; color: var(--muted); }
td.cell:hover, td.cell:focus { outline: 1px solid var(--accent); outline-offset: -1px; }
td.cell input { width: 100%; min-width: 6rem; padding: 2px 4px; border-radius: 4px; }
td.cell.saving { background: var(--warn-bg); }

.pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin: 16px 0; }
.pager button:disabled { opacity: 0.45; cursor: default; }

#missing { margin-top: 32px; }
#missing h2 { font-size: 1.05rem; margin: 0 0 6px; }
.chip {
  display: inline-block; margin: 0 6px 6px 0; padding: 3px 9px; border-radius: 999px;
  background: var(--panel); border: 1px solid var(--line); font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}
