/* HostPane license server — one self-contained stylesheet, light + dark. */
:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f8f9fc;
  --border: #e3e7ef;
  --text: #1b2333;
  --muted: #5d6879;
  --brand: #4f46e5;
  --brand-ink: #ffffff;
  --brand-soft: #eef0ff;
  --ok: #047857;
  --ok-soft: #e7f7f0;
  --warn: #b45309;
  --warn-soft: #fff4e0;
  --bad: #be123c;
  --bad-soft: #fde8ee;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 12px rgba(16, 24, 40, .05);
  --radius: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e121b;
    --surface: #161c28;
    --surface-2: #1b2232;
    --border: #283146;
    --text: #e5e9f2;
    --muted: #97a1b5;
    --brand: #8b85ff;
    --brand-ink: #0e121b;
    --brand-soft: #232a4a;
    --ok: #4fd1a1;
    --ok-soft: #12302a;
    --warn: #f5b454;
    --warn-soft: #34270f;
    --bad: #fb7192;
    --bad-soft: #3a1621;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92em; }
h1 { font-size: 1.5rem; margin: 0 0 .25rem; letter-spacing: -.01em; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 1rem 0 .5rem; }
p { margin: .25rem 0 .75rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* ---- shell */
.top {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 5;
}
.top-inner {
  max-width: 1200px; margin: 0 auto; padding: .5rem 16px;
  display: flex; align-items: center; gap: 1rem;
}
.brand { font-weight: 700; color: var(--text); white-space: nowrap; }
.brand span { color: var(--brand); }
.nav { display: flex; gap: .25rem; overflow-x: auto; flex: 1; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  padding: .4rem .7rem; border-radius: 8px; color: var(--muted); white-space: nowrap; font-weight: 500;
}
.nav a:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.nav a.on { background: var(--brand-soft); color: var(--brand); }
.top form { margin: 0; }
main { max-width: 1200px; margin: 0 auto; padding: 1.25rem 16px 3rem; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }

/* ---- surfaces */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1rem 1.1rem; margin-bottom: 1rem;
}
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.stats { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); margin-bottom: 1rem; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .85rem 1rem; box-shadow: var(--shadow); }
.stat .label { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.stat .value { font-size: 1.6rem; font-weight: 700; line-height: 1.2; margin-top: .15rem; }
.stat .value.sm { font-size: 1.05rem; }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; margin: 0; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; overflow-wrap: anywhere; }

/* ---- tables */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .55rem .6rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; white-space: nowrap; }
tbody tr:hover { background: var(--surface-2); }
td.num, th.num { text-align: right; white-space: nowrap; }
.table-wrap table { min-width: max-content; }
@media (min-width: 900px) { .table-wrap table { min-width: 0; } }

/* ---- forms */
label { display: block; font-weight: 500; margin: .6rem 0 .25rem; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date],
input[type=search], select, textarea {
  width: 100%; padding: .5rem .65rem; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface-2); color: var(--text); font: inherit;
}
textarea { min-height: 5rem; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
.check { display: flex; align-items: center; gap: .5rem; font-weight: 400; }
.row { display: grid; gap: 0 1rem; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.inline { display: flex; flex-wrap: wrap; gap: .5rem; align-items: flex-end; }
.inline > * { margin: 0; }
.inline label { margin: 0 0 .25rem; }
form.stack > :last-child { margin-top: .9rem; }
.btn {
  display: inline-flex; align-items: center; gap: .4rem; padding: .5rem .9rem; border-radius: 8px;
  border: 1px solid transparent; background: var(--brand); color: var(--brand-ink);
  font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.btn:hover { filter: brightness(1.07); text-decoration: none; }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn.danger { background: var(--bad); color: #fff; }
.btn.sm { padding: .3rem .6rem; font-size: .88rem; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.actions form { margin: 0; }

/* ---- badges + notices */
.badge { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .78rem; font-weight: 600; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); white-space: nowrap; }
.b-active, .b-paid, .b-applied { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.b-suspended, .b-open, .b-grace, .b-mismatch { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.b-expired, .b-cancelled, .b-overdue, .b-void, .b-bound_elsewhere, .b-rejected { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.b-draft { background: var(--brand-soft); color: var(--brand); border-color: transparent; }
.flash { padding: .7rem 1rem; border-radius: 10px; margin-bottom: 1rem; border: 1px solid transparent; }
.flash.ok { background: var(--ok-soft); color: var(--ok); }
.flash.error { background: var(--bad-soft); color: var(--bad); }
.notice { background: var(--warn-soft); color: var(--warn); padding: .7rem 1rem; border-radius: 10px; margin-bottom: 1rem; }
.keybox {
  font: 600 1.25rem/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .03em;
  background: var(--surface-2); border: 1px dashed var(--brand); border-radius: 10px;
  padding: 1rem; text-align: center; overflow-wrap: anywhere; user-select: all;
}
.tabs { display: flex; gap: .25rem; flex-wrap: wrap; margin-bottom: 1rem; }
.tabs a { padding: .35rem .7rem; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); background: var(--surface); }
.tabs a.on { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }

/* ---- chart */
.chart { width: 100%; height: auto; display: block; }
.chart rect { fill: var(--brand); }
.chart text { fill: var(--muted); font-size: 11px; }

/* ---- sign-in + public */
.center { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.auth { width: 100%; max-width: 380px; }
.public { max-width: 820px; margin: 0 auto; padding: 1.5rem 16px 3rem; }
.paybar { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; justify-content: space-between; }

/* ---- printable invoice */
.invoice-doc { background: #fff; color: #111; max-width: 820px; margin: 0 auto; padding: 2rem; border-radius: 8px; }
.invoice-doc th { color: #555; }
.invoice-doc td, .invoice-doc th { border-color: #ddd; }
.invoice-doc .logo { font-size: 1.6rem; font-weight: 800; color: #4f46e5; }
.doc-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.totals { margin-left: auto; max-width: 340px; }
.totals td { border: 0; padding: .25rem .5rem; }
.totals tr.grand td { font-weight: 700; border-top: 2px solid #111; }
.no-print { margin-bottom: 1rem; }
@media print {
  body { background: #fff; }
  .top, .no-print { display: none !important; }
  main { padding: 0; }
  .invoice-doc { padding: 0; }
}
@media (max-width: 600px) {
  .top-inner { flex-wrap: wrap; }
  .nav { order: 3; flex-basis: 100%; }
  h1 { font-size: 1.3rem; }
  .invoice-doc { padding: 1rem; }
}
.accent { color: var(--brand); }
.grow { flex: 1; min-width: 200px; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1rem 0; }
