/* Shared by /partner and /admin — the oztri.com palette (index.html) applied
   to a signed-in console. Tokens first, dark mode as its own selected steps. */
:root {
  --bg: #f3f0eb;
  --bg-2: #ebe6df;
  --surface: #fbfaf7;
  --line: rgba(22, 14, 16, .11);
  --line-strong: rgba(22, 14, 16, .22);
  --ink: #161112;
  --ink-2: #554c4d;
  --ink-3: #8a8081;
  --accent: #d92633;
  --accent-soft: rgba(217, 38, 51, .1);
  --go: #3f8f12;
  --warn: #9a6b00;
  --grid: rgba(22, 14, 16, .07);
  --shadow: 0 20px 40px -24px rgba(40, 10, 14, .28);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c0a0b;
    --bg-2: #120f10;
    --surface: #171314;
    --line: rgba(255, 240, 240, .08);
    --line-strong: rgba(255, 240, 240, .18);
    --ink: #f4efef;
    --ink-2: #aaa0a1;
    --ink-3: #8d8384;
    --accent: #ff3b47;
    --accent-soft: rgba(255, 59, 71, .12);
    --go: #93e64a;
    --warn: #f5c84b;
    --grid: rgba(255, 240, 240, .06);
    --shadow: 0 30px 60px -30px rgba(0, 0, 0, .8), 0 0 0 1px rgba(255, 255, 255, .04);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0c0a0b; --bg-2: #120f10; --surface: #171314;
  --line: rgba(255, 240, 240, .08); --line-strong: rgba(255, 240, 240, .18);
  --ink: #f4efef; --ink-2: #aaa0a1; --ink-3: #8d8384;
  --accent: #ff3b47; --accent-soft: rgba(255, 59, 71, .12);
  --go: #93e64a; --warn: #f5c84b; --grid: rgba(255, 240, 240, .06);
  --shadow: 0 30px 60px -30px rgba(0, 0, 0, .8), 0 0 0 1px rgba(255, 255, 255, .04);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh;
  background: var(--bg); color: var(--ink);
  font-family: "Archivo", system-ui, sans-serif; font-size: 15px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
[hidden] { display: none !important; }
.mono { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 11.5px;
        letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.num { font-variant-numeric: tabular-nums; }
.wrap { width: min(1120px, 100% - 32px - env(safe-area-inset-left) - env(safe-area-inset-right)); margin-inline: auto; }

/* top bar */
.bar { border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 85%, transparent);
       position: sticky; top: 0; z-index: 20; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.bar .wrap { display: flex; align-items: center; gap: 14px; height: 60px; }
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; font-weight: 800;
         font-size: 19px; letter-spacing: -.02em; }
.brand img { width: 26px; height: 26px; }
.brand .mark-dark { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .brand .mark-light { display: none; }
                                      :root:not([data-theme="light"]) .brand .mark-dark { display: block; } }
.bar .tag { padding: 3px 9px; border: 1px solid var(--line-strong); border-radius: 99px; }
.bar .spacer { flex: 1; }
.bar .who { color: var(--ink-2); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
@media (max-width: 560px) { .bar .who { display: none; } }

/* buttons + fields */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px;
       min-height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line-strong);
       background: var(--surface); font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--ink-3); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--accent); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.small { min-height: 32px; padding: 0 11px; font-size: 13.5px; border-radius: 8px; }
label.field { display: grid; gap: 6px; font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
label.field small { font-weight: 400; color: var(--ink-3); }
input[type=text], input[type=password], textarea {
  width: 100%; min-height: 42px; padding: 9px 12px; border-radius: 10px;
  border: 1px solid var(--line-strong); background: var(--bg); outline: none;
  font-size: 16px; /* under 16px, iOS Safari zooms the page on focus */
}
textarea { min-height: 70px; resize: vertical; }
input:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.check { display: flex; gap: 9px; align-items: center; font-weight: 600; font-size: 14px; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.error { color: var(--accent); font-size: 14px; }
.error:empty { display: none; }
.ok { color: var(--go); font-size: 14px; }

/* login */
.login { display: grid; place-items: center; min-height: calc(100vh - 61px); min-height: calc(100svh - 61px); padding: 32px 16px; }
.login form { width: min(380px, 100%); display: grid; gap: 16px; padding: 28px;
              background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); }
.login h1 { margin: 0; font-size: 24px; letter-spacing: -.02em; }
.login p { margin: -8px 0 4px; color: var(--ink-2); font-size: 14px; }
.login .btn.primary { min-height: 46px; }
@media (max-width: 480px) { .login { place-items: start center; padding-top: 8vh; }
                            .login form { padding: 22px 18px; } }

/* page */
/* minmax(0, 1fr): without it a wide table sets the column's minimum width and
   the whole page grows past the screen on a phone. */
main.page { padding: 28px 0 calc(64px + env(safe-area-inset-bottom)); display: grid;
            grid-template-columns: minmax(0, 1fr); gap: 22px; }
.head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 20px; }
.head h1 { margin: 0; font-size: clamp(24px, 4vw, 32px); letter-spacing: -.025em; line-height: 1.15; }
.head .sub { color: var(--ink-2); margin-top: 4px; }
.head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 20px; }
.card h2 { margin: 0 0 14px; font-size: 16px; letter-spacing: -.01em; }
.card h2 .mono { margin-left: 8px; white-space: nowrap; }
@media (max-width: 640px) {
  main.page { padding-top: 20px; gap: 16px; }
  .head .actions { margin-left: 0; width: 100%; }
  .head .actions > .btn { flex: 1; }
  .card { padding: 16px; border-radius: 14px; }
  .card h2 .mono { display: block; margin: 4px 0 0; }
}

/* stat tiles */
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 720px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; }
.tile .value { font-size: clamp(28px, 5vw, 38px); font-weight: 800; letter-spacing: -.03em; line-height: 1.1;
               font-variant-numeric: tabular-nums; margin-top: 6px; }
.tile .hint { color: var(--ink-3); font-size: 12.5px; margin-top: 2px; }
@media (max-width: 640px) { .tiles { gap: 10px; } .tile { padding: 13px 14px; }
                            .tile .mono { font-size: 10.5px; letter-spacing: .06em; } }
.tile.hero .value { color: var(--accent); }

/* code pill */
.code { display: inline-flex; align-items: center; gap: 10px; padding: 8px 8px 8px 14px; border-radius: 12px;
        border: 1px dashed var(--line-strong); background: var(--surface); }
.code b { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 18px; letter-spacing: .06em; }

/* bar chart */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: 200px; overflow: visible; }
.chart .grid line { stroke: var(--grid); stroke-width: 1; }
.chart .axis text { fill: var(--ink-3); font-size: 11px; font-family: "JetBrains Mono", ui-monospace, monospace; }
.chart .bars path { fill: var(--accent); }
.chart .bars .hit { fill: transparent; cursor: default; }
.chart .bars g:hover path.mark { fill: color-mix(in srgb, var(--accent) 80%, var(--ink)); }
.chart .tip { position: absolute; pointer-events: none; transform: translate(-50%, -100%);
              background: var(--ink); color: var(--bg); font-size: 12.5px; padding: 6px 9px; border-radius: 8px;
              white-space: nowrap; box-shadow: var(--shadow); }
.chart .tip b { font-variant-numeric: tabular-nums; }
.chart-empty { display: grid; place-items: center; min-height: 140px; color: var(--ink-3); font-size: 14px;
               border: 1px dashed var(--line-strong); border-radius: 12px; text-align: center; padding: 16px; }

/* tables */
.table-wrap { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 600; color: var(--ink-3); font-size: 12px; text-transform: uppercase;
     letter-spacing: .06em; padding: 0 12px 10px 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 11px 12px 11px 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }
/* Phones: each row of a .stack table becomes a small card — a lead line, then
   label-over-value cells on a 4-column grid (.w2 spans two, .w4 four). */
@media (max-width: 640px) {
  .table-wrap:has(table.stack) { overflow: visible; margin: 0; padding: 0; }
  table.stack thead { display: none; }
  table.stack, table.stack tbody { display: block; }
  table.stack tr { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 12px;
                   padding: 14px 0; border-bottom: 1px solid var(--line); }
  table.stack tr:last-child { border-bottom: 0; padding-bottom: 2px; }
  table.stack tr.row { margin: 0 -10px; padding-inline: 10px; border-radius: 10px; }
  table.stack td { display: grid; align-content: start; gap: 1px; padding: 0; border: 0;
                   white-space: normal; overflow-wrap: anywhere; text-align: left; }
  table.stack td.n { text-align: left; font-size: 17px; font-weight: 700; }
  table.stack td.w2 { grid-column: span 2; }
  table.stack td[data-label]::before { content: attr(data-label); font: 600 11px/1.4 "Archivo", system-ui, sans-serif;
                   letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
  table.stack td.lead { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; font-size: 16px; }
  table.stack td.lead .badge, table.stack td.lead .chev { margin-left: auto; }
  table.stack td.lead .chev { font-size: 20px; line-height: 1; }
  table.stack td.hide-sm { display: none; }
  table.stack td.w4 { grid-column: 1 / -1; }
  table.stack.compact tr { gap: 2px; padding: 11px 0; }
  table.stack.compact td.lead { font-size: 15px; }
  table.stack.compact td.w4 { color: var(--ink-3); font-size: 13.5px; }
  table.stack td > .badge { justify-self: start; }
  tr.row:hover td { background: none; }
  tr.row:hover, tr.row:active { background: var(--accent-soft); }
}
.chev { display: none; color: var(--ink-3); }
@media (max-width: 640px) { .chev { display: inline; } }
@media (min-width: 641px) { .sm-only { display: none !important; } }
.more { margin-top: 14px; width: 100%; }
tr.row { cursor: pointer; }
tr.row:hover td { background: var(--accent-soft); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 12px; font-weight: 600;
         border: 1px solid var(--line-strong); color: var(--ink-2); }
.badge.on { border-color: color-mix(in srgb, var(--go) 50%, transparent); color: var(--go); }
.badge.off { color: var(--ink-3); }
.badge.pending { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, transparent); }

/* forms */
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: end; }
@media (max-width: 640px) { .grid-2 { grid-template-columns: 1fr; } }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row-actions input { min-width: 0; }
@media (max-width: 640px) {
  .form-actions > .btn { flex: 1; }
  .form-actions > .ok { order: -1; width: 100%; }
  .form-actions > .spacer { display: none; }
  .code { width: 100%; justify-content: space-between; }
}
.note { color: var(--ink-3); font-size: 13px; }
.share { white-space: pre-wrap; font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 13px;
         background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
