/* gst-bridge
   Portal structure, our own styling. Figures use tabular numerals throughout so
   columns line up; the ledger green marks derived values, amber marks anything
   a person entered by hand. */

:root {
  --paper:      #f7f8f6;
  --surface:    #ffffff;
  --surface-2:  #eef0ea;
  --ink:        #171b21;
  --ink-2:      #59616b;
  --ink-3:      #838b95;
  --rule:       #dce0d9;
  --rule-2:     #bcc3b9;
  --accent:     #0f6b57;
  --accent-bg:  #e4efea;
  --warn:       #8a6100;
  --warn-bg:    #f7efdb;
  --crit:       #a3282b;
  --crit-bg:    #f7e5e4;
  --radius:     4px;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper:     #12151a;
    --surface:   #1a1e25;
    --surface-2: #21262e;
    --ink:       #e8eae5;
    --ink-2:     #9aa3ad;
    --ink-3:     #79828c;
    --rule:      #2b313a;
    --rule-2:    #3b434e;
    --accent:    #4fbfa3;
    --accent-bg: #16302a;
    --warn:      #d6a73a;
    --warn-bg:   #2e2716;
    --crit:      #e0736f;
    --crit-bg:   #331e1e;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px; border-radius: 2px;
}

/* ------------------------------------------------------------------ chrome */

.topbar {
  display: flex; align-items: center; gap: 24px;
  padding: 0 20px; height: 52px;
  background: var(--surface); border-bottom: 1px solid var(--rule);
  position: sticky; top: 0; z-index: 20;
}
.brand { font-weight: 650; letter-spacing: -0.01em; font-size: 15px; color: var(--ink); }
.brand span { color: var(--accent); }
.topbar nav { display: flex; gap: 18px; margin-left: auto; align-items: center; }
.topbar nav a { color: var(--ink-2); font-size: 13.5px; }
.topbar nav a.on { color: var(--ink); font-weight: 600; }

.wrap { max-width: 1360px; margin: 0 auto; padding: 22px 20px 80px; }

.pagehead { display: flex; align-items: flex-start; gap: 20px; margin-bottom: 20px; flex-wrap: wrap; }
.pagehead h1 { margin: 0; font-size: 21px; letter-spacing: -0.015em; font-weight: 650; }
.pagehead .sub { color: var(--ink-2); font-size: 13.5px; margin-top: 3px; }
.pagehead .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

.crumb { font-size: 12.5px; color: var(--ink-3); margin-bottom: 10px; }
.crumb a { color: var(--ink-2); }

/* ------------------------------------------------------------------ pieces */

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 13px; border: 1px solid var(--rule-2); border-radius: var(--radius);
  background: var(--surface); color: var(--ink); font-size: 13px; font-family: inherit;
  cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 550; }
.btn-primary:hover { filter: brightness(1.08); background: var(--accent); }
.btn-danger { color: var(--crit); border-color: var(--crit); }

.pill {
  display: inline-block; font-family: var(--mono); font-size: 10.5px;
  letter-spacing: 0.04em; padding: 2px 6px; border-radius: 3px; white-space: nowrap;
  background: var(--surface-2); color: var(--ink-2);
}
.pill-derived { background: var(--accent-bg); color: var(--accent); }
.pill-manual  { background: var(--warn-bg);   color: var(--warn); }
.pill-edited  { background: var(--warn-bg);   color: var(--warn); }
.pill-excluded{ background: var(--crit-bg);   color: var(--crit); }
.pill-cancel  { background: var(--crit-bg);   color: var(--crit); }

.flash { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 14px; font-size: 13.5px; }
.flash-ok    { background: var(--accent-bg); color: var(--accent); }
.flash-error { background: var(--crit-bg);   color: var(--crit); }
.flash-warn  { background: var(--warn-bg);   color: var(--warn); }

/* ---------------------------------------------------- portal box structure */

/* One box per GSTR-1 table, in the portal's order and with the portal's own
   codes and captions, so a figure can be read straight across against it. */
.boxes { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 12px; }

.box {
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius);
  padding: 14px 16px; display: flex; flex-direction: column; gap: 10px;
  color: inherit;
}
a.box:hover { border-color: var(--accent); text-decoration: none; }
.box-head { display: flex; align-items: baseline; gap: 8px; }
.box-code {
  font-family: var(--mono); font-size: 11px; color: var(--accent);
  background: var(--accent-bg); padding: 2px 6px; border-radius: 3px; white-space: nowrap;
}
.box-title { font-weight: 600; font-size: 13.5px; line-height: 1.3; }
.box-figs { display: flex; gap: 18px; margin-top: auto; }
.box-fig { display: flex; flex-direction: column; }
.box-fig .lbl { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--ink-3); }
.box-fig .val { font-family: var(--mono); font-size: 16px; font-variant-numeric: tabular-nums; font-weight: 550; }
.box-fig .val.neg { color: var(--crit); }

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

.tablewrap {
  overflow-x: auto; background: var(--surface);
  border: 1px solid var(--rule); border-radius: var(--radius);
}
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--rule); }
thead th {
  position: sticky; top: 52px; background: var(--surface-2);
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--ink-2); font-weight: 600; white-space: nowrap;
  border-bottom: 1px solid var(--rule-2);
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }
tfoot td {
  background: var(--surface-2); font-weight: 650;
  border-top: 2px solid var(--rule-2); border-bottom: none;
}
td.n, th.n, tfoot td.n {
  text-align: right; font-family: var(--mono);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
td.n.neg { color: var(--crit); }
td.mono { font-family: var(--mono); font-size: 12px; }
.muted { color: var(--ink-3); }

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

.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.field label { font-size: 12px; color: var(--ink-2); font-weight: 550; }
.field input, .field select, .field textarea {
  padding: 7px 10px; border: 1px solid var(--rule-2); border-radius: var(--radius);
  background: var(--surface); color: var(--ink); font-family: inherit; font-size: 13.5px;
}
.field input.n { font-family: var(--mono); text-align: right; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 14px; }

.card {
  background: var(--surface); border: 1px solid var(--rule);
  border-radius: var(--radius); padding: 18px;
}
.card h2 { margin: 0 0 14px; font-size: 15px; font-weight: 650; }

.login { max-width: 360px; margin: 12vh auto; }

/* ---------------------------------------------------------------- 3B boxes */

.b3-section { margin-bottom: 22px; }
.b3-section h2 {
  font-size: 14px; font-weight: 650; margin: 0 0 4px;
  display: flex; align-items: baseline; gap: 8px;
}
.b3-section .note { font-size: 12.5px; color: var(--ink-3); margin: 0 0 8px; }

.recon { display: flex; gap: 22px; flex-wrap: wrap; align-items: center;
         padding: 12px 16px; border-radius: var(--radius); margin-bottom: 18px; }
.recon.ok   { background: var(--accent-bg); color: var(--accent); }
.recon.bad  { background: var(--crit-bg);   color: var(--crit); }
.recon b { font-family: var(--mono); font-variant-numeric: tabular-nums; }

@media (max-width: 700px) {
  .wrap { padding: 16px 12px 60px; }
  thead th { position: static; }
}

.inline-input, .mono-input {
  padding: 7px 10px; border: 1px solid var(--rule-2); border-radius: var(--radius);
  background: var(--surface); color: var(--ink); font-family: inherit; font-size: 13px;
}
.mono-input { font-family: var(--mono); }
td input { width: 100%; min-width: 60px; }
