/* ============================================================
   GOC Desk Console — design system
   Layout: dark ink sidebar + light console content
   Type:   Segoe UI stack for UI, monospace for all figures/labels
   Accent: deep teal signature; green/red reserved for P&L
   ============================================================ */

:root {
  /* neutrals */
  --canvas:    #eef1f5;
  --surface:   #ffffff;
  --surface-2: #f7f9fb;
  --line:      #e2e7ee;
  --line-2:    #eef2f6;
  --ink:       #0f1722;
  --ink-2:     #4a5568;
  --ink-3:     #8592a3;

  /* sidebar (dark ink) */
  --nav-bg:    #0c1522;
  --nav-bg-2:  #111d2e;
  --nav-ink:   #aeb9c7;
  --nav-ink-2: #6b7889;
  --nav-line:  #1c2a3d;

  /* brand + semantics */
  --brand:      #0e7490;   /* deep teal */
  --brand-2:    #0b5c72;
  --brand-ink:  #ffffff;
  --brand-soft: #e2f4f8;
  --up:   #067647;
  --down: #b42318;
  --warn: #b54708;

  --radius:  12px;
  --radius-s: 8px;
  --shadow:  0 1px 2px rgba(16,23,34,.04), 0 8px 24px rgba(16,23,34,.06);
  --shadow-s: 0 1px 2px rgba(16,23,34,.06);

  --ui:   -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "Cascadia Code", "Cascadia Mono", ui-monospace, "SF Mono", Consolas, "Roboto Mono", monospace;
}

* { box-sizing: border-box; }

html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--ui);
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.5;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* mono utility for figures, codes, eyebrows */
.mono, .num, .eyebrow, .code, table.data .num, .stat-value, .kpi-value {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

/* ================= App shell (top header nav) ================= */
.app { display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
  background: linear-gradient(90deg, var(--nav-bg) 0%, var(--nav-bg-2) 100%);
  color: var(--nav-ink);
  border-bottom: 1px solid var(--nav-line);
  position: sticky; top: 0; z-index: 50;
}
.topbar-inner {
  display: flex; align-items: center; gap: 22px;
  height: 58px; padding: 0 24px;
  max-width: 1880px; margin: 0 auto;
}
.brand { display: flex; align-items: baseline; gap: 9px; flex: 0 0 auto; }
.brand:hover { text-decoration: none; }
.brand-mark {
  font-family: var(--mono); font-weight: 700; letter-spacing: .14em; font-size: 17px;
  color: #fff; padding: 3px 8px; border: 1px solid var(--brand); border-radius: 6px;
  background: rgba(14,116,144,.18);
}
.brand-sub { font-size: 12px; color: var(--nav-ink-2); letter-spacing: .02em; white-space: nowrap; }

.topnav { display: flex; align-items: center; gap: 4px; flex: 1; min-width: 0; overflow-x: auto; }
.nav-item {
  display: inline-block; white-space: nowrap;
  padding: 8px 14px; border-radius: 999px;
  color: var(--nav-ink); font-size: 13.5px;
  border: 1px solid transparent;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #dfe6ef; text-decoration: none; }
.nav-item.active { background: rgba(14,116,144,.22); color: #fff; border-color: rgba(14,116,144,.55); }

.topbar-user { display: flex; align-items: center; gap: 12px; flex: 0 0 auto; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--brand); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; flex: 0 0 32px;
}
.user-meta { line-height: 1.15; }
.user-name { color: #e7ecf2; font-size: 13px; font-weight: 600; }
.user-role { color: var(--nav-ink-2); font-size: 11px; font-family: var(--mono); letter-spacing: .03em; }
.signout {
  padding: 7px 13px; border-radius: 999px;
  border: 1px solid var(--nav-line); color: var(--nav-ink);
  font-size: 12.5px; white-space: nowrap;
}
.signout:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }

.main { flex: 1; width: 100%; max-width: 1880px; margin: 0 auto; padding: 14px 20px 44px; }

/* ================= Page header (compact) ================= */
.page-head { margin-bottom: 10px; display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.eyebrow {
  font-size: 10px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--brand-2); order: -1; flex-basis: 100%; margin-bottom: 2px;
}
.page-head h1 { margin: 0; font-size: 18px; letter-spacing: -.01em; }
.page-head .lede { margin: 0; color: var(--ink-3); font-size: 12.5px; }

/* ================= KPI tiles ================= */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 22px; }
.kpi {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow-s);
}
.kpi .kpi-label { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); font-family: var(--mono); }
.kpi .kpi-value { font-size: 27px; font-weight: 600; margin-top: 8px; letter-spacing: -.01em; }
.kpi .kpi-sub { font-size: 12px; color: var(--ink-2); margin-top: 3px; }
.kpi.accent { border-color: var(--brand); }
.kpi.accent .kpi-value { color: var(--brand); }

/* ================= Cards / panels ================= */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-s); margin: 18px 0; }
.panel-head { padding: 16px 20px; border-bottom: 1px solid var(--line-2); display: flex; align-items: center; justify-content: space-between; }
.panel-head h2 { margin: 0; font-size: 15px; }
.panel-body { padding: 18px 20px; }
h2.section { margin: 30px 0 10px; font-size: 15px; letter-spacing: -.01em; }

/* ================= Clearance meter (signature) ================= */
.meter-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow-s); margin: 4px 0 22px; }
.meter-title { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); font-family: var(--mono); margin-bottom: 12px; }
.meter {
  display: flex; height: 30px; border-radius: 7px; overflow: hidden;
  background: var(--surface-2); border: 1px solid var(--line);
}
.meter .seg-open { background: linear-gradient(180deg, var(--brand) 0%, var(--brand-2) 100%); }
.meter .seg-closed { background: repeating-linear-gradient(45deg, #cbd5e1, #cbd5e1 6px, #dbe2ea 6px, #dbe2ea 12px); }
.meter-legend { display: flex; gap: 22px; margin-top: 12px; flex-wrap: wrap; }
.meter-legend .lg { display: flex; align-items: baseline; gap: 8px; font-size: 13px; }
.meter-legend .dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; position: relative; top: 1px; }
.meter-legend .dot.open { background: var(--brand); }
.meter-legend .dot.closed { background: #cbd5e1; }
.meter-legend .lg-val { font-family: var(--mono); font-weight: 600; font-variant-numeric: tabular-nums; }
.meter-legend .lg-lbl { color: var(--ink-2); }

/* ================= Data tables ================= */
table.data { width: 100%; border-collapse: collapse; background: var(--surface); font-size: 13px; }
.table-card { border: 1px solid var(--line); border-radius: var(--radius-s); overflow: hidden; box-shadow: var(--shadow-s); margin: 6px 0 16px; }
.table-scroll { overflow: auto; max-height: calc(100vh - 150px); }
/* dense, gridded, spreadsheet-style cells */
table.data th, table.data td {
  padding: 5px 10px; text-align: left;
  border-right: 1px solid var(--line-2);
  border-bottom: 1px solid var(--line-2);
}
table.data th:last-child, table.data td:last-child { border-right: 0; }
table.data thead th {
  position: sticky; top: 0; z-index: 3;
  background: #eef2f6; color: var(--ink-2);
  font-size: 10.5px; letter-spacing: .04em; text-transform: uppercase; font-weight: 700;
  /* box-shadow draws the header borders so they stay put as rows scroll under (collapsed borders) */
  box-shadow: inset 0 -1px 0 var(--line), inset -1px 0 0 var(--line-2);
  white-space: nowrap;
}
table.data:not(.tree) tbody tr:nth-child(even) td { background: #fafbfc; }
table.data tbody tr:hover td { background: #eef7f9; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data .num { text-align: right; white-space: nowrap; }
table.data th.num { text-align: right; }
table.data .strong { font-weight: 700; color: var(--ink); }
table.data .muted { color: var(--ink-3); }
table.data .code { color: var(--brand-2); font-size: 12px; }
table.data .script-name { font-weight: 500; }
table.data .lot-tag { font-family: var(--mono); font-size: 11px; color: var(--ink-3); font-weight: 400; }
/* keep the First Name column compact (2nd column of the users table) */
#users-table th:nth-child(2), #users-table td:nth-child(2) { max-width: 110px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; font-family: var(--mono); letter-spacing: .02em; }
.badge-gtapaid { background: var(--brand-soft); color: var(--brand-2); }
.badge-gocpaid { background: #eef2f6; color: var(--ink-2); }
.badge-free    { background: #fef6e7; color: var(--warn); }
.cat-lgtgelowsalpaid { background: #e6f6ec; color: var(--up); }
.cat-inrecoveryalgo  { background: var(--brand-soft); color: var(--brand-2); }
table.data .pnl-neg { color: var(--down); font-weight: 600; }
table.data .pnl-pos { color: var(--up); font-weight: 600; }
table.data tbody tr.emphasis td { background: #eef2f6; font-weight: 600; }

/* summary table stays compact */
.table-card.narrow { max-width: 520px; }

/* footer totals */
table.data tfoot td {
  padding: 6px 10px; background: #eef2f6; border-top: 2px solid var(--line);
  border-right: 1px solid var(--line-2); font-weight: 700;
}
table.data tfoot td:last-child { border-right: 0; }
table.data tfoot .num { text-align: right; }

/* sortable headers */
table.sortable th.th-sort { cursor: pointer; user-select: none; }
table.sortable th.th-sort:hover { background: #eaf0f4; color: var(--ink); }
table.sortable th.sorted-asc::after  { content: " \25B2"; font-size: 9px; color: var(--brand); }
table.sortable th.sorted-desc::after { content: " \25BC"; font-size: 9px; color: var(--brand); }

/* ================= Tree table ================= */
tr.seg-row { cursor: pointer; }
tr.seg-row > td { background: var(--surface-2); font-weight: 700; border-bottom: 1px solid var(--line); }
tr.seg-row:hover > td { background: #eef3f6; }
tr.seg-row .seg-users { font-weight: 400; color: var(--ink-3); font-family: var(--mono); font-size: 12px; }
.twisty { display: inline-block; width: 13px; color: var(--brand); transition: transform .12s ease; }
tr.seg-row.open .twisty { transform: rotate(90deg); }
tr.script-row { display: none; }
tr.script-row.show { display: table-row; }
tr.script-row .script-name { padding-left: 34px; }
tr.grand td { font-weight: 700; background: var(--surface-2); border-top: 2px solid var(--line); }

/* ================= Filter bar ================= */
.filter { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 12px; box-shadow: var(--shadow-s); }
.filter .filter-label { font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.filter .chk { position: relative; }
.filter .chk input { position: absolute; opacity: 0; pointer-events: none; }
.filter .chk span {
  display: inline-block; padding: 7px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface-2);
  font-size: 13px; color: var(--ink-2); cursor: pointer; transition: all .12s ease;
}
.filter .chk input:checked + span { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-2); font-weight: 600; }
.filter .chk input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
.filter button { background: var(--brand); color: #fff; border: 0; padding: 8px 18px; border-radius: 999px; font-weight: 600; cursor: pointer; font-size: 13px; }
.filter button:hover { background: var(--brand-2); }
.filter .filter-select { padding: 7px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-2); font-size: 13px; color: var(--ink); cursor: pointer; }
.filter .filter-select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(14,116,144,.15); }
.filter .reset { font-size: 13px; color: var(--ink-3); margin-left: auto; }
.hint { font-size: 12.5px; color: var(--ink-3); margin: 2px 0 14px; }

/* ================= Report list (dashboard) ================= */
.report-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.report-card { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-s); color: inherit; transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease; }
.report-card:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--brand); }
.report-card .rc-index { font-family: var(--mono); font-size: 12px; color: var(--brand-2); }
.report-card .rc-title { font-size: 16px; font-weight: 600; margin: 10px 0 6px; }
.report-card .rc-desc { color: var(--ink-2); font-size: 13px; }
.report-card .rc-go { margin-top: 14px; font-size: 13px; color: var(--brand); font-weight: 600; }
.empty { background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); padding: 44px; text-align: center; color: var(--ink-2); }

/* ================= Reconcile / definitions ================= */
.note { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 20px; margin: 16px 0; box-shadow: var(--shadow-s); max-width: 900px; }
.note .note-title { font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 10px; }
.note ul { margin: 0; padding-left: 18px; }
.note li { margin: 5px 0; color: var(--ink-2); font-size: 13px; }
.note li b { color: var(--ink); }
.note .num, .note strong { font-family: var(--mono); }

.back { display: inline-block; font-family: var(--mono); font-size: 12px; letter-spacing: .04em; color: var(--ink-3); margin-bottom: 12px; }
.back:hover { color: var(--brand); text-decoration: none; }

/* ================= Login (split screen) ================= */
.login-page { display: grid; grid-template-columns: 1.05fr .95fr; min-height: 100vh; }
.login-brand {
  background: linear-gradient(160deg, #0c1522 0%, #103040 100%);
  color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between;
  position: relative; overflow: hidden;
}
.login-brand::before {
  content: ""; position: absolute; inset: 0;
  background-image: linear-gradient(var(--nav-line) 1px, transparent 1px), linear-gradient(90deg, var(--nav-line) 1px, transparent 1px);
  background-size: 44px 44px; opacity: .35; mask-image: radial-gradient(circle at 70% 30%, #000 0%, transparent 70%);
}
.login-brand > * { position: relative; z-index: 1; }
.lb-mark { font-family: var(--mono); font-weight: 700; letter-spacing: .18em; font-size: 22px; }
.lb-mark span { border: 1px solid var(--brand); background: rgba(14,116,144,.25); padding: 4px 10px; border-radius: 8px; }
.lb-headline { font-size: 34px; line-height: 1.18; letter-spacing: -.01em; max-width: 16ch; margin: 0; }
.lb-headline em { color: #56c7dc; font-style: normal; }
.lb-foot { font-size: 12.5px; color: var(--nav-ink); font-family: var(--mono); letter-spacing: .02em; }

.login-form-wrap { display: flex; align-items: center; justify-content: center; padding: 40px; background: var(--canvas); }
.login-card { width: 100%; max-width: 380px; }
.login-card h1 { margin: 0 0 4px; font-size: 22px; }
.login-card .subtitle { margin: 0 0 24px; color: var(--ink-2); font-size: 14px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; letter-spacing: .02em; }
.field input {
  width: 100%; padding: 11px 13px; font-size: 15px; font-family: var(--ui);
  border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--surface); color: var(--ink);
}
.field input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(14,116,144,.15); }
.btn-primary { width: 100%; background: var(--brand); color: #fff; border: 0; padding: 12px; border-radius: var(--radius-s); font-size: 15px; font-weight: 600; cursor: pointer; }
.btn-primary:hover { background: var(--brand-2); }
.alert { background: #fef3f2; color: var(--down); border: 1px solid #fecdca; padding: 10px 13px; border-radius: var(--radius-s); font-size: 13.5px; margin-bottom: 18px; }

/* Goal filter banner on the users report */
.goal-banner { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; background: var(--brand-soft); border: 1px solid var(--brand); border-radius: var(--radius-s); padding: 10px 16px; margin-bottom: 12px; font-size: 14px; }
.goal-banner .back { margin: 0; }
.goal-banner .reset { margin-left: auto; }

/* Upload data */
.upload-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow-s); max-width: 820px; margin: 6px 0 8px; }
.upload-box form { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.upload-label { font-weight: 600; font-size: 13px; }
.upload-box input[type=file] { font-size: 13px; }
.upload-ok { background: #e6f6ec; border: 1px solid #b7e4c7; color: var(--ink); border-radius: var(--radius-s); padding: 14px 18px; max-width: 820px; margin-bottom: 12px; }
.upload-ok ul { margin: 8px 0; padding-left: 18px; }

/* ================= Goals ================= */
.goals { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 18px; }
.goal-card { display: block; color: inherit; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; box-shadow: var(--shadow-s); transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease; }
a.goal-card:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--brand); }
.goal-go { margin-top: 14px; font-size: 13px; font-weight: 600; color: var(--brand); }
.goal-head { display: flex; align-items: baseline; justify-content: space-between; }
.goal-index { font-family: var(--mono); font-size: 11px; letter-spacing: .14em; color: var(--brand-2); }
.goal-pct { font-family: var(--mono); font-size: 34px; font-weight: 700; color: var(--brand); font-variant-numeric: tabular-nums; }
.goal-pct.done { color: var(--up); }
.goal-title { margin: 10px 0 4px; font-size: 18px; }
.goal-desc { margin: 0 0 16px; color: var(--ink-2); font-size: 13.5px; }
.goal-bar { height: 12px; border-radius: 999px; background: #e9eef3; overflow: hidden; }
.goal-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--brand) 0%, var(--brand-2) 100%); border-radius: 999px; }
.goal-stats { display: flex; gap: 26px; margin-top: 16px; }
.goal-stats .gs { display: flex; flex-direction: column; }
.goal-stats .gs-val { font-family: var(--mono); font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.goal-stats .gs-lbl { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }

/* ================= Error page ================= */
.error-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--canvas); }
.error-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 44px 52px; text-align: center; box-shadow: var(--shadow); }
.error-box h1 { font-family: var(--mono); font-size: 52px; margin: 0; color: var(--brand); }
.error-box p { color: var(--ink-2); }

/* ================= Focus + motion ================= */
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ================= Responsive ================= */
@media (max-width: 900px) {
  .topbar-inner { flex-wrap: wrap; height: auto; padding: 10px 16px; gap: 12px; }
  .topnav { order: 3; flex-basis: 100%; }
  .topbar-user { margin-left: auto; }
  .main { padding: 18px 16px 44px; }
  .login-page { grid-template-columns: 1fr; }
  .login-brand { padding: 32px; min-height: 220px; }
  .lb-headline { font-size: 26px; }
}
