/* WBAMS License Server — admin and installer.
   Light and dark are both first-class: the palette is defined on :root and re-declared
   under prefers-color-scheme, so nothing is left borrowing the browser's default. */

:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --ink: #0f172a;
  --ink-2: #475569;
  --ink-3: #94a3b8;
  --line: #dfe5ee;
  --line-soft: #eef2f7;
  --accent: #3b5bfd;
  --accent-ink: #ffffff;
  --accent-soft: #eef2ff;
  --ok: #067647;
  --ok-soft: #ecfdf3;
  --warn: #b45309;
  --warn-soft: #fffbeb;
  --danger: #b42318;
  --danger-soft: #fef3f2;
  --shadow: 0 10px 30px rgba(15, 23, 42, .07);
  --radius: 14px;
  --radius-sm: 10px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1120;
    --surface: #131c30;
    --surface-2: #18233b;
    --ink: #e8edf7;
    --ink-2: #a4b1c8;
    --ink-3: #6f7f9b;
    --line: #26334c;
    --line-soft: #1d2942;
    --accent: #6b86ff;
    --accent-ink: #0b1120;
    --accent-soft: #1c2647;
    --ok: #4ade80;
    --ok-soft: #10281d;
    --warn: #fbbf24;
    --warn-soft: #2a2110;
    --danger: #f87171;
    --danger-soft: #2a1516;
    --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  }
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 Inter, ui-sans-serif, system-ui, "Segoe UI", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 6px; letter-spacing: -.015em; line-height: 1.25; }
h1 { font-size: 25px; }
h2 { font-size: 17px; }
p { margin: 0 0 12px; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .92em; }
.muted { color: var(--ink-2); font-size: 13.5px; }
.warn { color: var(--warn); }

/* ---------- installer ---------- */
.install { width: min(760px, calc(100vw - 32px)); margin: 6vh auto 4vh; }
.install__head { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.install__foot { margin-top: 26px; text-align: center; }
.brand-mark {
  width: 46px; height: 46px; flex: 0 0 46px; display: grid; place-items: center;
  border-radius: 13px; background: var(--accent); color: var(--accent-ink);
  font-weight: 800; font-size: 20px;
}

.steps { display: flex; gap: 8px; margin: 0 0 18px; padding: 0; list-style: none; }
.steps li {
  flex: 1 1 0; display: flex; align-items: center; gap: 9px; min-width: 0;
  padding: 11px 13px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink-2); font-size: 13.5px; font-weight: 600;
}
.steps li span {
  width: 22px; height: 22px; flex: 0 0 22px; display: grid; place-items: center;
  border-radius: 999px; background: var(--surface-2); color: var(--ink-3);
  font-size: 12px; font-weight: 800;
}
.steps li.is-current { border-color: var(--accent); color: var(--ink); box-shadow: 0 0 0 3px var(--accent-soft); }
.steps li.is-current span { background: var(--accent); color: var(--accent-ink); }
.steps li.is-done span { background: var(--ok-soft); color: var(--ok); }

.card {
  margin-bottom: 16px; padding: 22px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow);
}
.card--muted { background: var(--surface-2); box-shadow: none; }
.keyline code {
  display: inline-block; padding: 7px 11px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: var(--surface); user-select: all;
}

.checks { margin: 14px 0 18px; padding: 0; list-style: none; display: grid; gap: 7px; }
.checks li {
  display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center;
  padding: 10px 13px; border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm); background: var(--surface-2); font-size: 13.5px;
}
.checks li span { color: var(--ink-2); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.checks li.is-ok { border-left: 3px solid var(--ok); }
.checks li.is-bad { border-left: 3px solid var(--danger); background: var(--danger-soft); }
.checks li.is-warn { border-left: 3px solid var(--warn); }

/* ---------- forms ---------- */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.grid .wide { grid-column: 1 / -1; }
label { display: flex; flex-direction: column; gap: 6px; min-width: 0; font-size: 13px; font-weight: 700; color: var(--ink-2); }

/* A checkbox that reads as a statement rather than a field. The generic label rule above
   stacks its children in a column, which would put a lone checkbox on its own line above
   its text; this puts control and label side by side and hangs the explanation under both. */
label.check { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; align-items: center; }
label.check > input[type="checkbox"] { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
label.check > span { color: var(--ink); font-size: 13.5px; }
label.check > small { grid-column: 2; font-weight: 500; line-height: 1.5; }

/* A field the form is currently ignoring should look ignored, not merely be ignored. */
label.is-inert > select, label.is-inert > input { opacity: .55; }
label.is-inert { color: var(--ink-3); }
label small { font-weight: 500; color: var(--ink-3); font-size: 12px; }
input, select, textarea {
  width: 100%; min-width: 0; padding: 10px 12px; min-height: 40px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink); font: inherit;
}
input:focus, select:focus, textarea:focus {
  outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
input[disabled] { background: var(--surface-2); color: var(--ink-3); }
textarea { min-height: 96px; resize: vertical; }
.actions { display: flex; gap: 9px; align-items: center; }

button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 18px; min-height: 40px;
  border: 1px solid transparent; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink);
  font: inherit; font-weight: 700; cursor: pointer;
  transition: filter .15s ease, transform .15s ease;
}
button:hover, .btn:hover { filter: brightness(1.06); text-decoration: none; }
button:active { transform: translateY(1px); }
button.secondary, .btn.secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
button.danger, .btn.danger { background: var(--danger); color: #fff; }

.alert {
  margin-bottom: 14px; padding: 12px 14px;
  border: 1px solid var(--line); border-left-width: 3px;
  border-radius: var(--radius-sm); font-size: 14px;
}
.alert--success { border-left-color: var(--ok); background: var(--ok-soft); color: var(--ok); }
.alert--error { border-left-color: var(--danger); background: var(--danger-soft); color: var(--danger); }
.alert--warning { border-left-color: var(--warn); background: var(--warn-soft); color: var(--warn); }
.alert--info { border-left-color: var(--accent); background: var(--accent-soft); }

@media (max-width: 640px) {
  .grid { grid-template-columns: 1fr; }
  .steps { flex-direction: column; }
}

/* ---------- admin shell ---------- */
.shell { display: grid; grid-template-columns: 254px minmax(0, 1fr); min-height: 100vh; }
.side {
  position: sticky; top: 0; align-self: start; height: 100vh;
  display: flex; flex-direction: column; gap: 14px;
  padding: 18px 14px; background: var(--surface); border-right: 1px solid var(--line);
}
/* The superseded .side__brand block that used to live here has been removed.
   Its `.side__brand span` rule was the reason the brand mark rendered as a tiny grey
   W in the corner of the blue tile: at (0,1,1) it outranked `.brand-mark` (0,1,0) and
   forced display:block (killing the grid centring), font-size:11.5px and --ink-3 on an
   --accent background. The replacement block further down styles the two text lines by
   their own classes, so the mark keeps its own rules. */
.nav { display: flex; flex-direction: column; gap: 3px; overflow-y: auto; min-height: 0; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 11px; min-height: 38px;
  border-radius: var(--radius-sm); color: var(--ink-2); font-size: 14px; font-weight: 600;
}
.nav a:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.nav a.is-active { background: var(--accent-soft); color: var(--accent); }
.side__foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line-soft); font-size: 13px; }
.side__foot .who { display: block; margin-bottom: 9px; }
.side__foot strong { display: block; }
.side__foot em { font-style: normal; color: var(--ink-3); font-size: 12px; }

.main { min-width: 0; padding: 26px 30px 44px; }
.main__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.eyebrow { display: block; margin-bottom: 3px; color: var(--ink-3); font-size: 11.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.tile { padding: 15px 17px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.tile span { display: block; color: var(--ink-3); font-size: 11.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.tile strong { display: block; margin-top: 5px; font-size: 26px; letter-spacing: -.02em; }

/* A tile that leads somewhere says so on hover and takes keyboard focus like the link it
   is. Colour and underline are reset explicitly: these are anchors inside a surface, and
   the global link styling would otherwise turn every figure blue. */
.tile--link { display: block; color: inherit; text-decoration: none; transition: border-color .12s, box-shadow .12s, transform .12s; }
.tile--link:hover { border-color: var(--accent); box-shadow: var(--shadow); transform: translateY(-1px); text-decoration: none; }
.tile--link:hover strong { color: var(--accent); }
.tile--link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  .tile--link { transition: none; }
  .tile--link:hover { transform: none; }
}

.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; align-items: start; }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table-wrap { width: 100%; overflow-x: auto; }
th, td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
th { color: var(--ink-3); font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }
td.mono, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }

.pill {
  display: inline-block; padding: 3px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 800; letter-spacing: .03em; text-transform: uppercase;
  background: var(--surface-2); color: var(--ink-2);
}
.pill--active, .pill--ok { background: var(--ok-soft); color: var(--ok); }
.pill--suspended, .pill--bad { background: var(--danger-soft); color: var(--danger); }
.pill--warn { background: var(--warn-soft); color: var(--warn); }

.keyfacts { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; margin: 14px 0; }
.keyfact { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.keyfact--wide { grid-column: 1 / -1; }
.keyfact > span { color: var(--ink-3); font-size: 11.5px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.keyfact > code {
  display: block; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: var(--surface-2);
  font-size: 12.5px; line-height: 1.5; word-break: break-all; user-select: all;
}
.keyfact > code[data-copy] { cursor: copy; }
.keyfact > code[data-copy]:hover { border-color: var(--accent); }
.keyfact > code.copied { border-color: var(--ok); background: var(--ok-soft); color: var(--ok); }

.list { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.list li {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 12px; border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm); background: var(--surface-2); font-size: 13.5px;
}
.list li code { color: var(--ink-2); }
.inline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.inline input, .inline select { width: auto; min-width: 120px; min-height: 34px; padding: 7px 10px; }
.inline button { min-height: 34px; padding: 7px 14px; font-size: 13.5px; }

.login-wrap { display: grid; place-items: center; min-height: 100vh; padding: 24px; }
.login { width: min(400px, 100%); }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .main { padding: 20px 16px 36px; }
}

/* ---------- sidebar ----------------------------------------------------------
   .side__brand span was written for the tagline, but it also matched the
   .brand-mark span sitting beside it — and at (0,1,1) it outranks the (0,1,0)
   .brand-mark rule. The mark was being rendered display:block, 11.5px, in --ink-3,
   which is why the W sat in the corner of the tile in near-invisible grey. The
   tagline now has its own class and the mark keeps its own styling. */
.side__brand {
  display: flex; align-items: center; gap: 11px;
  padding: 6px 6px 16px; border-bottom: 1px solid var(--line-soft);
  color: inherit; text-decoration: none; border-radius: var(--radius-sm);
}
.side__brand:hover { text-decoration: none; }
.side__brand-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.side__brand-text strong { display: block; font-size: 15px; color: var(--ink); line-height: 1.25; }
.side__brand-sub { display: block; font-size: 11.5px; color: var(--ink-3); line-height: 1.3; }
.brand-mark--sm { width: 38px; height: 38px; flex: 0 0 38px; border-radius: 11px; font-size: 16px; }

.nav__group {
  margin: 14px 0 4px; padding: 0 11px;
  font-size: 10.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-3);
}
.nav__group:first-child { margin-top: 2px; }
.nav a { position: relative; transition: background .15s ease, color .15s ease; }
.nav__icon {
  width: 17px; height: 17px; flex: 0 0 17px;
  fill: none; stroke: currentColor; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round; opacity: .85;
}
.nav a.is-active { font-weight: 700; }
.nav a.is-active .nav__icon { opacity: 1; }
.nav a.is-active::before {
  content: ""; position: absolute; left: -14px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 20px; border-radius: 0 3px 3px 0; background: var(--accent);
}

/* ---------- form controls ---------------------------------------------------
   The browser defaults were showing through for every checkbox, radio and date
   field. These match the WBAMS admin: a 44x24 switch is the checkbox everywhere,
   a radio puts its mark next to the label, and numeric and date inputs stay
   compact instead of stretching the full width of their grid cell. */

/* switch — the checkbox design across the whole product */
label.switch, label:has(> input[type="checkbox"]) {
  flex-direction: row; align-items: center; gap: 10px;
  font-size: 13.5px; font-weight: 600; color: var(--ink); cursor: pointer;
}
label.switch > input[type="checkbox"],
label:has(> input[type="checkbox"]) > input[type="checkbox"] {
  appearance: none; -webkit-appearance: none;
  position: relative; flex: 0 0 44px; width: 44px !important; height: 24px;
  min-height: 0 !important; margin: 0; padding: 0;
  border: 0; border-radius: 999px; background: var(--line);
  cursor: pointer; transition: background .18s ease;
}
label.switch > input[type="checkbox"]::after,
label:has(> input[type="checkbox"]) > input[type="checkbox"]::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(15, 23, 42, .3);
  transition: transform .18s ease;
}
label.switch > input[type="checkbox"]:checked,
label:has(> input[type="checkbox"]) > input[type="checkbox"]:checked { background: var(--accent); }
label.switch > input[type="checkbox"]:checked::after,
label:has(> input[type="checkbox"]) > input[type="checkbox"]:checked::after { transform: translateX(20px); }
label.switch > input[type="checkbox"]:focus-visible,
label:has(> input[type="checkbox"]) > input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; box-shadow: none;
}

/* radio — the mark sits next to its own label, never above it */
label:has(> input[type="radio"]) {
  flex-direction: row; align-items: center; gap: 9px;
  font-size: 13.5px; font-weight: 600; color: var(--ink); cursor: pointer;
}
input[type="radio"] {
  appearance: none; -webkit-appearance: none;
  flex: 0 0 18px; width: 18px !important; height: 18px; min-height: 0 !important;
  margin: 0; padding: 0; border: 1.5px solid var(--line); border-radius: 50%;
  background: var(--surface); cursor: pointer; transition: border-color .15s ease;
}
input[type="radio"]:checked { border-color: var(--accent); border-width: 5px; }
input[type="radio"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; box-shadow: none; }

/* compact fields — a seat count or a date should not span the whole column */
input[type="number"] { width: 100%; max-width: 160px; }
input[type="date"] { width: 100%; max-width: 200px; }
input[type="date"]::-webkit-calendar-picker-indicator {
  padding: 2px; border-radius: 5px; cursor: pointer; opacity: .55;
  transition: opacity .15s ease, background .15s ease;
}
input[type="date"]::-webkit-calendar-picker-indicator:hover { opacity: 1; background: var(--surface-2); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(1) brightness(1.6); }
}

/* select — the default arrow is the browser's; give it ours */
select {
  appearance: none; -webkit-appearance: none;
  padding-right: 34px; cursor: pointer;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--ink-3) 50%),
    linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
select:focus { background-image: linear-gradient(45deg, transparent 50%, var(--accent) 50%), linear-gradient(135deg, var(--accent) 50%, transparent 50%); }

/* Release row actions: withdraw is the reversible one and stays plain; delete is folded away
   behind a disclosure so the destructive control is never the thing under a stray click. */
.row-actions { white-space: nowrap; text-align: right; }
.row-actions form { display: inline-block; margin: 0; }
.row-delete { display: inline-block; margin-left: 6px; }
.row-delete[open] { display: block; }
.row-delete > summary { cursor: pointer; list-style: none; color: var(--danger); font-size: 13px; }
.row-delete > summary::-webkit-details-marker { display: none; }
.row-delete[open] > summary { opacity: .6; }
/* Laid out in the cell rather than floated over it: the table sits in an overflow container,
   which clipped an absolutely positioned panel so the confirm field could not be reached at
   all on the lower rows. The row grows instead. */
.row-delete > form { display: block; width: 240px; margin: 8px 0 2px auto; padding: 12px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2);
  text-align: left; white-space: normal; }
.row-delete > form p { margin: 0 0 8px; }
.row-delete > form input { width: 100%; margin-bottom: 8px; }

/* Upload progress.
   A 190 MB package takes long enough that a line of text reading "4%" is indistinguishable
   from a stall. The bar carries the state: it moves as each part lands, and a sheen crosses
   it while a request is actually in flight, so a stalled upload looks stalled. */
.upload-progress { display: flex; flex-direction: column; gap: 9px; width: 100%; }
.upload-progress__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; }
.upload-progress__head strong { font-weight: 700; }
.upload-progress__meta { color: var(--ink-2); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.upload-progress__track { position: relative; overflow: hidden; height: 8px; border-radius: 999px; background: var(--line); }
.upload-progress__bar { position: relative; width: 0; height: 100%; border-radius: 999px; background: var(--accent);
  transition: width .35s cubic-bezier(.4, 0, .2, 1); }
/* The sheen only runs while a part is in flight; it stops the moment progress does. */
.upload-progress.is-active .upload-progress__bar::after { position: absolute; inset: 0; content: "";
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .55), transparent);
  animation: uploadSheen 1.15s linear infinite; }
/* Before the first part lands there is no width to animate, so the track carries the motion. */
.upload-progress.is-indeterminate .upload-progress__track::after { position: absolute; top: 0; bottom: 0; left: 0; width: 40%; content: "";
  border-radius: 999px; background: var(--accent); opacity: .85; animation: uploadSlide 1.25s ease-in-out infinite; }
@keyframes uploadSheen { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
@keyframes uploadSlide { 0% { left: -40%; } 100% { left: 100%; } }

@media (prefers-reduced-motion: reduce) {
    .upload-progress__bar { transition: none; }
    .upload-progress.is-active .upload-progress__bar::after,
    .upload-progress.is-indeterminate .upload-progress__track::after { animation: none; }
    .upload-progress.is-indeterminate .upload-progress__track::after { left: 0; width: 100%; opacity: .35; }
}

/* Licence types (products/types): one card per type */
.lt-cols { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); align-items: start; }
.lt-card { margin: 0; }
.lt-card--off { background: var(--surface-2); }
.lt-card__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.lt-card__head h2 { margin: 0; }
.lt-switches { display: flex; flex-direction: column; gap: 10px; grid-column: 1 / -1; }
.lt-options { margin: 18px 0 10px; padding-top: 14px; border-top: 1px solid var(--line-soft); font-size: 12px;
  color: var(--ink-3); font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.lt-save { margin-top: 18px; flex-wrap: wrap; }
.type-note { margin: 0; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--accent-soft);
  color: var(--ink); font-size: 13px; line-height: 1.5; }
.type-note:empty { display: none; }
