/* ─────────────────────────────────────────────────────────────
   DC TradeLab portal — same slate + amber as dctradelab.com, so a
   customer arriving from the site does not feel handed to a stranger.
   Self-hosted system font stack: no webfont means no third-party
   request from a page that is behind a login.
   ───────────────────────────────────────────────────────────── */

:root{
  --bg:#151B25;
  --surface:#1C2431;
  --surface2:#232D3D;
  --border:#33415A;
  --border-soft:#2A3547;
  --text:#E9EEF6;
  --muted:#A5B2C4;
  --dim:#8391A6;

  --accent:#F2BF47;
  --accent-fill:#F0B429;
  --accent-hov:#D69A16;
  --on-accent:#25190A;

  --ok:#3DD9A0;      --ok-bg:#123328;
  --warn:#F2BF47;    --warn-bg:#372B10;
  --bad:#FF7A8E;     --bad-bg:#3A1620;
  --info:#4FC0F0;    --info-bg:#0F2C3C;

  --sans:system-ui,-apple-system,'Segoe UI',Roboto,'Helvetica Neue',Arial,sans-serif;
  --mono:ui-monospace,'Cascadia Mono',Consolas,'Liberation Mono',monospace;
  --wrap:1080px;
  --shadow:0 1px 2px rgba(0,0,0,.4), 0 10px 30px rgba(0,0,0,.3);
}

*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body{
  margin:0;background:var(--bg);color:var(--text);
  font-family:var(--sans);font-size:16px;line-height:1.6;
  -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,textarea:focus-visible{
  outline:2px solid var(--accent);outline-offset:2px;border-radius:4px;
}

.wrap{max-width:var(--wrap);margin:0 auto;padding:0 20px}

/* ── top bar ── */
.top{
  background:rgba(21,27,37,.96);border-bottom:1px solid var(--border);
  position:sticky;top:0;z-index:40;
  -webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);
}
.top-in{max-width:var(--wrap);margin:0 auto;padding:0 20px;display:flex;
  align-items:center;justify-content:space-between;gap:16px;min-height:60px;flex-wrap:wrap}
.brand{display:inline-flex;align-items:center;min-height:44px;font-weight:700;
  font-size:1.03rem;color:var(--text);letter-spacing:-.01em}
.brand:hover{text-decoration:none;color:var(--text)}
.brand span{color:var(--accent)}
.brand em{font-style:normal;font-family:var(--mono);font-size:.78rem;color:var(--dim);
  margin-left:10px;letter-spacing:.1em;text-transform:uppercase}
.top-nav{display:flex;align-items:center;gap:2px;flex-wrap:wrap}
.top-nav a{display:inline-flex;align-items:center;min-height:44px;padding:0 12px;
  border-radius:9px;color:var(--muted);font-size:.94rem;font-weight:500}
.top-nav a:hover{color:var(--text);background:var(--surface2);text-decoration:none}
.top-nav a.on{color:var(--text);background:var(--surface2)}

/* ── page furniture ── */
.page{padding:34px 0 70px}
h1{font-size:1.72rem;letter-spacing:-.02em;margin:0 0 6px;text-wrap:balance}
h2{font-size:1.16rem;letter-spacing:-.01em;margin:34px 0 12px}
.sub{color:var(--muted);margin:0 0 24px;max-width:68ch}
.crumb{font-family:var(--mono);font-size:.78rem;color:var(--dim);margin:0 0 14px}

/* ── cards ── */
.card{background:var(--surface);border:1px solid var(--border);border-radius:12px;
  padding:20px 22px;box-shadow:var(--shadow)}
.card + .card{margin-top:14px}
.card h3{margin:0 0 4px;font-size:1.04rem;letter-spacing:-.01em}
.grid{display:grid;gap:14px}
/* A grid item defaults to min-width:auto, so it refuses to shrink below the
   widest unbreakable thing inside it — one long email address in a table is
   enough to push the whole card past the screen edge on a phone. */
.grid > *,.row > *{min-width:0}
@media(min-width:720px){
  .grid.two{grid-template-columns:1fr 1fr}
  .grid.three{grid-template-columns:repeat(3,1fr)}
  .grid.four{grid-template-columns:repeat(4,1fr)}
}

/* ── stat tiles ── */
/* The 1px rules between tiles are the container's background showing through the gaps, so
   any cell a row leaves empty shows as a filled block. A wrapping flex row cannot leave one:
   a short last row stretches its tiles to the edge. The bases keep six tiles in whole rows -
   two by three on a phone, three by two on a tablet, one row on a desktop - and a tile whose
   figure is too wide for its basis wraps its row early instead of spilling out of it. */
.tiles{display:flex;flex-wrap:wrap;gap:1px;background:var(--border);border:1px solid var(--border);
  border-radius:12px;overflow:hidden}
.tile{background:var(--surface);padding:16px 18px;flex:1 1 calc(50% - 1px)}
@media(min-width:640px){.tile{flex-basis:calc(33.333% - 1px)}}
@media(min-width:960px){.tile{flex-basis:calc(16.666% - 1px)}}
.tile b{display:block;font-family:var(--mono);font-size:1.5rem;font-weight:600;
  font-variant-numeric:tabular-nums;letter-spacing:-.02em;line-height:1.15}
.tile span{display:block;font-family:var(--mono);font-size:.78rem;font-weight:500;
  letter-spacing:.09em;text-transform:uppercase;color:var(--dim);margin-top:3px}
.tile.ok b{color:var(--ok)} .tile.warn b{color:var(--warn)} .tile.bad b{color:var(--bad)}

/* ── status pills ── */
.pill{display:inline-flex;align-items:center;font-family:var(--mono);font-size:.78rem;
  font-weight:600;letter-spacing:.06em;text-transform:uppercase;padding:4px 9px;border-radius:6px;
  white-space:nowrap}
.pill.active,.pill.trial{color:var(--ok);background:var(--ok-bg)}
.pill.past_due{color:var(--warn);background:var(--warn-bg)}
.pill.expired,.pill.revoked,.pill.unbound{color:var(--bad);background:var(--bad-bg)}
.pill.neutral{color:var(--info);background:var(--info-bg)}

/* ── tables ── */
.tablewrap{overflow-x:auto;border:1px solid var(--border);border-radius:12px;background:var(--surface)}
.tablewrap::-webkit-scrollbar{height:10px}
.tablewrap::-webkit-scrollbar-track{background:var(--surface);border-radius:5px}
.tablewrap::-webkit-scrollbar-thumb{background:var(--border);border-radius:5px}
table{width:100%;border-collapse:collapse;font-size:.94rem}
th,td{text-align:left;padding:12px 14px;border-bottom:1px solid var(--border-soft);vertical-align:middle}
th{font-family:var(--mono);font-size:.78rem;font-weight:600;letter-spacing:.07em;
  text-transform:uppercase;color:var(--dim);white-space:nowrap}
tr:last-child td{border-bottom:0}
tbody tr:hover{background:var(--surface2)}
td.num,th.num{font-family:var(--mono);font-variant-numeric:tabular-nums}
.key{font-family:var(--mono);font-size:.9rem;letter-spacing:.02em}
/* A key broken at every hyphen reads as five codes. In a table it stays on one line and the table
   scrolls sideways inside .tablewrap instead. */
td.key{white-space:nowrap}
.nowrap{white-space:nowrap}

/* ── forms ── */
label{display:block;font-size:.9rem;font-weight:600;margin:0 0 6px;color:var(--text)}
.hint{font-size:.86rem;color:var(--dim);margin:6px 0 0;font-weight:400}
input[type=text],input[type=email],input[type=password],input[type=number],select,textarea{
  width:100%;min-height:46px;padding:11px 13px;border-radius:10px;
  border:1px solid var(--border);background:var(--surface2);color:var(--text);
  font-family:var(--sans);font-size:1rem;
}
textarea{min-height:96px;resize:vertical}
input::placeholder,textarea::placeholder{color:var(--dim)}
.field{margin:0 0 16px}
.row{display:grid;gap:14px}
@media(min-width:640px){.row.two{grid-template-columns:1fr 1fr}.row.three{grid-template-columns:repeat(3,1fr)}}

.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;
  min-height:46px;padding:0 20px;border-radius:10px;border:1px solid var(--border);
  background:var(--surface2);color:var(--text);font-family:var(--sans);
  font-size:.97rem;font-weight:600;cursor:pointer;transition:background .15s,border-color .15s}
.btn:hover{background:var(--border-soft);text-decoration:none}
.btn.pri{background:var(--accent-fill);border-color:var(--accent-fill);color:var(--on-accent)}
.btn.pri:hover{background:var(--accent-hov);border-color:var(--accent-hov)}
.btn.danger{color:var(--bad);border-color:var(--bad-bg)}
.btn.danger:hover{background:var(--bad-bg)}
.btn.small{min-height:38px;padding:0 13px;font-size:.88rem;font-weight:500}
/* A finger is not a mouse pointer: on touch the compact button goes back up
   to a 44px target, which is the smallest thing a thumb hits reliably. */
@media(pointer:coarse){.btn.small{min-height:44px;padding:0 16px}}
.btns{display:flex;gap:10px;flex-wrap:wrap;margin-top:18px}

/* ── notices ── */
.notice{border-radius:10px;padding:13px 16px;margin:0 0 18px;font-size:.95rem;
  border:1px solid var(--border)}
.notice.err{color:var(--bad);background:var(--bad-bg);border-color:transparent}
.notice.ok{color:var(--ok);background:var(--ok-bg);border-color:transparent}
.notice.info{color:var(--muted);background:var(--surface2)}
.notice.warn{color:var(--warn);background:var(--warn-bg);border-color:transparent}

/* ── auth pages ── */
.auth{max-width:430px;margin:56px auto;padding:0 20px}
.auth .card{padding:28px 26px}
.auth h1{font-size:1.36rem;margin-bottom:4px}
.auth .sub{font-size:.95rem;margin-bottom:22px}
.auth-foot{text-align:center;margin-top:20px;font-size:.92rem;color:var(--dim)}

/* ── machine rows ── */
.machine{display:flex;align-items:center;justify-content:space-between;gap:14px;
  padding:14px 0;border-bottom:1px solid var(--border-soft);flex-wrap:wrap}
.machine:last-child{border-bottom:0}
.machine .mid{font-family:var(--mono);font-size:.86rem;color:var(--muted);
  word-break:break-all;max-width:100%}
.machine .mname{font-weight:600}
.slots{font-family:var(--mono);font-size:.86rem;color:var(--dim);
  font-variant-numeric:tabular-nums}

/* ── empty state ── */
.empty{text-align:center;padding:44px 20px;color:var(--muted)}
.empty b{display:block;color:var(--text);font-size:1.06rem;margin-bottom:6px}

/* ── footer ── */
.foot{border-top:1px solid var(--border);padding:22px 0 44px;color:var(--dim);font-size:.87rem}
.foot a{color:var(--muted)}

.mono{font-family:var(--mono)}
.right{text-align:right}
.dim{color:var(--dim)}
.muted{color:var(--muted)}

/* ── releases ── */
.release{margin-top:16px;padding-top:14px;border-top:1px solid var(--border-soft)}
.release-head{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}
.release-head b{font-weight:600}
/* A SHA-256 is 64 characters with no break opportunity; without break-all it pushes the
   card past the edge of a phone screen. */
.hash{font-family:var(--mono);font-size:.78rem;color:var(--dim);word-break:break-all;margin:8px 0 0}
.notes{white-space:pre-line;margin:6px 0 0}
.notes-box{margin-top:10px}
.notes-box summary{cursor:pointer;color:var(--muted);font-size:.9rem;min-height:32px}
input[type=file]{width:100%;min-height:46px;padding:10px 12px;border-radius:10px;
  border:1px dashed var(--border);background:var(--surface2);color:var(--muted);
  font-family:var(--sans);font-size:.95rem}
.check{display:flex;align-items:center;gap:10px;font-weight:500;cursor:pointer}
.check input{width:18px;height:18px;margin:0;accent-color:var(--accent-fill)}

/* ── upgrades ── */
/* Two lists and three numbers per offer: what would arrive, what is credited, and the
   arithmetic between them. A customer told to pay 350 instead of 899 reads the lines that
   got him there, and the owner reads the same ones when he is asked why. */
.plain{list-style:none;margin:8px 0 0;padding:0}
.plain li{display:flex;justify-content:space-between;gap:14px;padding:6px 0;
  border-bottom:1px solid var(--border-soft)}
.plain li:last-child{border-bottom:0}
.card h4{margin:18px 0 0;font-family:var(--mono);font-size:.78rem;font-weight:600;
  letter-spacing:.07em;text-transform:uppercase;color:var(--dim)}
.sum{margin-top:18px;padding-top:14px;border-top:1px solid var(--border-soft);
  font-variant-numeric:tabular-nums}
.sum > div{display:flex;justify-content:space-between;gap:16px;padding:5px 0}
.sum span{color:var(--muted)}
.sum b{font-family:var(--mono);font-weight:600}
.sum .due{margin-top:6px;padding-top:11px;border-top:1px solid var(--border-soft)}
.sum .due span{color:var(--text);font-weight:600}
.sum .due b{color:var(--accent);font-size:1.2rem}

/* The amount the owner retypes into Stripe, and the two metadata values he pastes beside
   it. user-select:all so one click takes the whole value: a half-selected dc_offer is a
   Payment Link the webhook refuses, after the customer has paid. */
.amount{font-family:var(--mono);font-size:1.6rem;font-weight:600;letter-spacing:-.02em;
  font-variant-numeric:tabular-nums;margin:8px 0 0}
.amount span{font-size:.9rem;font-weight:500;color:var(--dim);letter-spacing:.06em}
.keyname{font-family:var(--mono);font-size:.82rem;color:var(--muted);margin:0 0 6px}
.copy{display:block;font-family:var(--mono);font-size:.95rem;background:var(--surface2);
  border:1px solid var(--border);border-radius:10px;padding:11px 13px;word-break:break-all;
  -webkit-user-select:all;user-select:all}

@media(prefers-reduced-motion:reduce){*{transition:none!important;animation:none!important}}
