/* Maxdata Hub. Colours are tokens so light and dark mode share one set of rules. */
:root {
  --brand: #F4B400;
  --brand-soft: #fff4cc;
  --brand-ink: #1d1d1f;
  --ink: #1d1d1f;
  --muted: #6b6b70;
  --bg: #f7f6f2;
  --card: #ffffff;
  --line: #e6e4dc;
  --well: #f3f1ea;
  --ok: #1f8a4c;
  --ok-soft: #e4f5ea;
  --warn: #b26a00;
  --warn-soft: #fff1d6;
  --bad: #b3261e;
  --bad-soft: #fbe4e2;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.05);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #f2f2f4;
    --muted: #a3a3aa;
    --bg: #111114;
    --card: #1a1a20;
    --line: #2c2c34;
    --well: #22222a;
    --brand-soft: #3a2f07;
    --ok-soft: #113021;
    --warn-soft: #3a2a08;
    --bad-soft: #3a1412;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  --ink: #f2f2f4;
  --muted: #a3a3aa;
  --bg: #111114;
  --card: #1a1a20;
  --line: #2c2c34;
  --well: #22222a;
  --brand-soft: #3a2f07;
  --ok-soft: #113021;
  --warn-soft: #3a2a08;
  --bad-soft: #3a1412;
  --shadow: none;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink); background: var(--bg); line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Header and navigation */
.top {
  position: sticky; top: 0; z-index: 20;
  background: var(--brand); padding: 12px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  box-shadow: 0 1px 0 rgba(0,0,0,.06);
}
.brand { color: var(--brand-ink); font-weight: 800; text-decoration: none; font-size: 1.15rem; letter-spacing: -.01em; }
.top nav { display: flex; align-items: center; gap: 4px; }
.top nav a {
  color: var(--brand-ink); text-decoration: none; font-weight: 600; font-size: .95rem;
  padding: 8px 12px; border-radius: 999px; transition: background .15s;
}
.top nav a:hover, .top nav a[aria-current="page"] { background: rgba(0,0,0,.08); }
.nav-toggle {
  display: none; background: rgba(0,0,0,.08); color: var(--brand-ink);
  padding: 8px 12px; font-size: .95rem; border-radius: 10px;
}
.theme-toggle {
  background: transparent; color: var(--brand-ink); padding: 6px 10px; font-size: 1rem;
  border: 1px solid rgba(0,0,0,.15); border-radius: 999px;
}

main { max-width: 1040px; margin: 0 auto; padding: 28px 16px 56px; }
section { margin: 40px 0; }
h1 { font-size: clamp(1.6rem, 4vw, 2.1rem); margin: 0 0 8px; line-height: 1.2; letter-spacing: -.02em; }
h2 { font-size: 1.25rem; margin: 0 0 14px; letter-spacing: -.01em; }
h3 { font-size: 1.05rem; margin: 6px 0; }
.lead { color: var(--muted); margin-top: 0; font-size: 1.05rem; max-width: 60ch; }
.hero { margin-top: 12px; padding: 40px 0 8px; }
.hero h1 { font-size: clamp(2rem, 6vw, 3rem); }

.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; color: inherit; display: block; box-shadow: var(--shadow);
}
.steps .step {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 50%; background: var(--brand); color: var(--brand-ink);
  font-weight: 800; margin-bottom: 10px;
}
.plain { padding-left: 20px; margin: 0; }
.plain li { margin: 8px 0; }
details.card summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; }
details.card summary::after { content: "+"; color: var(--muted); font-size: 1.2rem; line-height: 1; }
details[open].card summary::after { content: "–"; }
details.card p { color: var(--muted); margin: 10px 0 0; }

/* Buttons */
.button, button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px; font-size: 1rem; font-weight: 700; cursor: pointer;
  background: var(--brand-ink); color: #fff; border: 0; border-radius: 12px; text-decoration: none;
  transition: transform .08s ease, opacity .15s ease, box-shadow .15s ease;
}
.button:hover, button:hover { opacity: .92; box-shadow: 0 4px 14px rgba(0,0,0,.12); }
.button:active, button:active { transform: translateY(1px); }
button:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }
button.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.cta { text-align: center; background: linear-gradient(135deg, var(--brand-soft), var(--card)); }

/* Bundle picker */
.pkg-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.pkg {
  position: relative; display: flex; flex-direction: column; gap: 6px; cursor: pointer;
  padding: 16px; border-radius: 14px; transition: border-color .15s, box-shadow .15s, transform .08s;
}
.pkg:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.pkg input[type="radio"] {
  position: absolute; top: 14px; right: 14px; margin: 0; width: 18px; height: 18px; accent-color: var(--brand);
}
.pkg-name { font-weight: 700; font-size: 1.05rem; }
.pkg:has(input:checked) { border: 2px solid var(--brand-ink); padding: 15px; box-shadow: var(--shadow); }
.pkg:has(input:focus-visible) { outline: 3px solid var(--brand); outline-offset: 2px; }
.price { font-size: 1.15rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.pkg .price { color: var(--ink); }
.soon { opacity: .6; }

/* Sticky order summary on the buy page */
.summary {
  position: sticky; bottom: 12px; margin-top: 24px; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: var(--brand-ink); color: #fff; border-radius: 16px; padding: 14px 18px; box-shadow: 0 10px 30px rgba(0,0,0,.2);
}
.summary .sum-label { font-size: .85rem; opacity: .75; }
.summary .sum-total { font-size: 1.25rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.summary button { background: var(--brand); color: var(--brand-ink); }

/* Forms */
.details { margin-top: 24px; }
.details label, .addform label {
  display: block; margin: 14px 0; font-size: .9rem; color: var(--muted); font-weight: 600;
}
.details input, .details select, .addform input, .addform select {
  display: block; width: 100%; margin-top: 6px; padding: 12px 14px; font-size: 1rem; color: var(--ink);
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; transition: border-color .15s, box-shadow .15s;
}
.details input:focus, .details select:focus, .addform input:focus, .addform select:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(244,180,0,.25);
}
.details textarea {
  display: block; width: 100%; margin-top: 6px; padding: 12px 14px; font-size: .95rem; color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; line-height: 1.7;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; resize: vertical; min-height: 160px;
}
.details textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(244,180,0,.25); }
.details input.invalid, .addform input.invalid { border-color: var(--bad); }
.field-hint { display: block; font-size: .8rem; color: var(--muted); margin-top: 4px; font-weight: 400; min-height: 1em; }
.field-hint.error { color: var(--bad); }
.details button { width: 100%; margin-top: 10px; padding: 14px; font-size: 1.02rem; }
.addform { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-bottom: 10px; }
.addform label { display: flex; flex-direction: column; font-size: .85rem; color: var(--muted); gap: 4px; margin: 0; }
.addform input, .addform select { padding: 9px 12px; font-size: .95rem; margin-top: 0; }
button.is-loading { position: relative; color: transparent !important; }
button.is-loading::after {
  content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Status badges and order progress */
.status { font-weight: 700; }
.badge {
  display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: .8rem; font-weight: 700;
  background: var(--well); color: var(--ink); white-space: nowrap;
}
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.progress { display: flex; gap: 6px; margin: 18px 0 6px; }
.progress span { flex: 1; height: 6px; border-radius: 6px; background: var(--line); transition: background .3s; }
.progress span.on { background: var(--brand); }
.progress-labels { display: flex; justify-content: space-between; font-size: .75rem; color: var(--muted); }
.order-meta { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); margin-top: 16px; }
.order-meta div { background: var(--well); border-radius: 12px; padding: 12px 14px; }
.order-meta dt { font-size: .78rem; color: var(--muted); }
.order-meta dd { margin: 2px 0 0; font-weight: 700; }

/* Tables */
.tablewrap { overflow-x: auto; background: var(--card); border-radius: 14px; border: 1px solid var(--line); box-shadow: var(--shadow); }
table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: .9rem; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
tr:last-child td { border-bottom: 0; }
th { background: var(--well); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); position: sticky; top: 0; }
td form, .card form { margin: 0 0 8px; }
td button { padding: 6px 10px; font-size: .85rem; border-radius: 10px; }
td.actions { min-width: 280px; }
td.actions form { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0 0 8px; }
td.actions input {
  padding: 8px 10px; font-size: .9rem; color: var(--ink); background: var(--card);
  border: 1px solid var(--line); border-radius: 10px; width: auto; margin: 0;
}
td.actions input[name="pct"], td.actions input[name="amount"] { width: 96px; }
td.actions input[name="note"] { min-width: 170px; flex: 1; }
td.actions button { padding: 8px 12px; font-size: .85rem; }
.notice.ok { border-color: var(--ok); background: var(--ok-soft); }
.table-search { width: 100%; max-width: 320px; margin: 0 0 12px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--ink); font-size: .95rem; }

/* Footer and helpers */
.foot { text-align: center; color: var(--muted); font-size: .85rem; padding: 28px 16px; border-top: 1px solid var(--line); margin-top: 32px; }
.foot p { margin: 4px 0; }
.muted { color: var(--muted); font-size: .9rem; }
.inline { display: inline; }
.notice { border-color: var(--brand); background: var(--brand-soft); word-break: break-all; }
pre { background: var(--well); padding: 14px; border-radius: 12px; overflow-x: auto; font-size: .85rem; }
code { font-size: .9em; background: var(--well); padding: 1px 6px; border-radius: 6px; }
pre code { background: none; padding: 0; }
.copy-btn { margin-left: 8px; padding: 6px 10px; font-size: .8rem; }
h2 + .card, h2 + .tablewrap { margin-bottom: 24px; }
.empty { text-align: center; color: var(--muted); padding: 28px; }

/* Toasts */
.toast-wrap { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 50; display: grid; gap: 8px; width: min(92vw, 420px); }
.toast {
  background: var(--brand-ink); color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.25);
  font-weight: 600; animation: rise .25s ease;
}
.toast.bad { background: var(--bad); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Mobile */
@media (max-width: 720px) {
  .top { flex-wrap: wrap; }
  .nav-toggle { display: inline-block; }
  .top nav { display: none; width: 100%; flex-direction: column; align-items: stretch; padding-top: 8px; }
  .top nav.open { display: flex; }
  .top nav a { margin: 0; }
  .hero { padding-top: 20px; }
  section { margin: 28px 0; }
  .card { padding: 16px; }
  .pkg-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .summary { bottom: 8px; }
  .addform > * { width: 100%; }
  th, td { font-size: .85rem; }
  td.actions { min-width: 0; width: 100%; }
  td.actions form { width: 100%; }
  td.actions input { flex: 1 1 110px; min-width: 0; }
  td.actions input[name="note"] { flex: 1 1 100%; min-width: 0; }
  td.actions button { flex: 0 0 auto; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
