/* Pil Central licence manager — the look.
   The idea: this is a registry. The screens are a plain register (hairlines, no cards); the one thing that is drawn with care is the
   licence itself, shown as the paper the customer receives, with the vendor's seal. One accent (the seal's green) for the action that
   issues and for the seal; the other colours only say where a licence stands. */
@font-face { font-family: 'Public Sans'; src: url('/fonts/public-sans.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'Source Serif 4'; src: url('/fonts/source-serif-4.woff2') format('woff2'); font-weight: 200 900; font-display: swap; }
:root {
  color-scheme: light;
  --ink: #12263a; --ink-2: #43566a; --ink-3: #6b7b8b;
  --paper: #f3f6f4; --surface: #ffffff; --line: #d3ddd8; --line-2: #e6ece9;
  --seal: #0e6b5c; --seal-deep: #0a5146; --seal-wash: #e2efeb;
  --amber: #8f5a06; --amber-wash: #faefd8; --red: #a3261d; --red-wash: #fae8e5; --mute-wash: #e9edef;
  --serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --sans: 'Public Sans', 'Segoe UI', system-ui, -apple-system, Tahoma, sans-serif;
  --mono: ui-monospace, 'Cascadia Mono', Consolas, 'SF Mono', Menlo, monospace;
}
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 15px; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); line-height: 1.5; -webkit-font-smoothing: antialiased; }
h1, h2, h3, p, dl, dd, dt, ul, figure { margin: 0; padding: 0; }
ul { list-style: none; }
h1 { font-family: var(--serif); font-weight: 600; font-size: 1.9rem; line-height: 1.15; letter-spacing: -0.01em; }
h2 { font-family: var(--serif); font-weight: 600; font-size: 1.27rem; line-height: 1.25; }
h3 { font-size: 0.93rem; font-weight: 650; }
a { color: var(--seal-deep); text-underline-offset: 2px; }
a:hover { color: var(--ink); }
:focus-visible { outline: 2px solid var(--seal); outline-offset: 2px; border-radius: 3px; }
.starting { padding: 3rem; color: var(--ink-3); }
.muted { color: var(--ink-3); }
.small { font-size: 0.87rem; }
.num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }

/* ---------- the frame: a rail and the page ---------- */
.shell { display: grid; grid-template-columns: 218px minmax(0, 1fr); min-height: 100vh; }
.rail { background: var(--surface); border-inline-end: 1px solid var(--line); padding: 22px 0 16px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; gap: 10px; align-items: center; padding: 0 20px 20px; }
.brand svg { width: 34px; height: 34px; flex: none; }
.brand b { display: block; font-family: var(--serif); font-size: 1.07rem; font-weight: 600; line-height: 1.1; }
.brand span { font-size: 0.8rem; color: var(--ink-3); }
.rail nav { display: flex; flex-direction: column; }
.rail nav a { padding: 9px 20px 9px 17px; border-inline-start: 3px solid transparent; color: var(--ink-2); text-decoration: none; font-weight: 500; }
.rail nav a:hover { color: var(--ink); background: var(--paper); }
.rail nav a[aria-current="page"] { border-inline-start-color: var(--seal); color: var(--ink); font-weight: 650; background: var(--paper); }
.rail .foot { margin-top: auto; padding: 14px 20px 0; border-top: 1px solid var(--line-2); font-size: 0.82rem; color: var(--ink-3); display: grid; gap: 8px; }
.rail .foot code { font-family: var(--mono); font-size: 0.78rem; color: var(--ink-2); }
.page { padding: 34px 44px 70px; max-width: 1240px; width: 100%; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.head p { color: var(--ink-2); margin-top: 6px; max-width: 68ch; }
.tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.crumb { font-size: 0.87rem; margin-bottom: 8px; }
section + section { margin-top: 34px; }
section > h2 { margin-bottom: 10px; }
.lead { max-width: 68ch; color: var(--ink-2); }

/* ---------- buttons and fields ---------- */
.btn { font: inherit; font-weight: 600; color: var(--ink); background: var(--surface); border: 1px solid #b9c6c0; border-radius: 5px; padding: 7px 14px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 7px; line-height: 1.35; }
.btn:hover { border-color: var(--ink-2); color: var(--ink); }
.btn.primary { background: var(--seal); border-color: var(--seal); color: #fff; }
.btn.primary:hover { background: var(--seal-deep); border-color: var(--seal-deep); color: #fff; }
.btn.danger { color: var(--red); border-color: #dcb1ab; }
.btn.danger:hover { border-color: var(--red); }
.btn.quiet { border-color: transparent; background: none; color: var(--seal-deep); padding-inline: 6px; }
.btn.quiet:hover { text-decoration: underline; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn.big { padding: 11px 20px; font-size: 1.02rem; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font: inherit; font-size: 0.87rem; font-weight: 550; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); border-radius: 999px; padding: 4px 12px; cursor: pointer; }
.chip:hover { border-color: var(--ink-2); color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
label, .label { display: block; font-size: 0.87rem; font-weight: 600; color: var(--ink-2); margin-bottom: 4px; }
input[type="text"], input[type="password"], input[type="number"], input[type="date"], input[type="email"], input[type="search"], select, textarea {
  font: inherit; color: var(--ink); background: var(--surface); border: 1px solid #b9c6c0; border-radius: 5px; padding: 7px 10px; width: 100%; min-height: 37px; }
textarea { resize: vertical; line-height: 1.45; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--seal); outline-offset: 0; border-color: var(--seal); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--seal); width: 16px; height: 16px; margin: 0; flex: none; }
.field { margin-bottom: 14px; }
.hint { max-width: 78ch; overflow-wrap: anywhere; }
.field .hint { font-size: 0.83rem; color: var(--ink-3); margin-top: 4px; }
code { font-family: var(--mono); font-size: 0.92em; }
.step > .inline { margin-top: 16px; }
.row { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.inline { display: flex; align-items: center; gap: 8px; font-weight: 500; color: var(--ink); font-size: 0.95rem; margin: 0; }
.err { color: var(--red); font-weight: 550; font-size: 0.92rem; }
.err:empty { display: none; }

/* ---------- the register: tables with hairlines ---------- */
.reg { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); }
.reg th { text-align: start; font-size: 0.82rem; font-weight: 600; color: var(--ink-3); padding: 9px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; background: #fafcfb; }
.reg td { padding: 11px 14px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.reg tr:last-child td { border-bottom: 0; }
.reg tbody tr.go { cursor: pointer; }
.reg tbody tr.go:hover td { background: #f7faf8; }
.reg td.end, .reg th.end { text-align: end; }
.reg td a.main { font-weight: 650; color: var(--ink); text-decoration: none; }
.reg td a.main:hover { text-decoration: underline; }
.reg .sub { display: block; font-size: 0.85rem; color: var(--ink-3); }
.scroll { overflow-x: auto; }
.empty { background: var(--surface); border: 1px dashed #b9c6c0; padding: 26px; color: var(--ink-2); max-width: 70ch; }
.empty p + p { margin-top: 8px; }
.st { display: inline-flex; align-items: center; gap: 6px; font-size: 0.87rem; font-weight: 600; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.st::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.st.active { color: var(--seal-deep); background: var(--seal-wash); }
.st.expiring { color: var(--amber); background: var(--amber-wash); }
.st.expired, .st.cancelled { color: var(--red); background: var(--red-wash); }
.st.suspended { color: var(--red); background: transparent; box-shadow: inset 0 0 0 1.5px var(--red); }
.sub.late { color: var(--amber); }
.facts2.tight { margin: 0; font-size: 0.92rem; }
.note .btn.quiet { margin-inline-start: 6px; }
#touchMore { margin-top: 12px; }
.st.replaced, .st.upcoming { color: var(--ink-2); background: var(--mute-wash); }
.filters { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.filters input[type="search"] { max-width: 300px; }

/* ---------- the overview's figures: a line of the register, not a row of cards ---------- */
.figures { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--line); margin-bottom: 30px; }
.figures div { padding: 18px 22px; border-inline-start: 1px solid var(--line-2); }
.figures div:first-child { border-inline-start: 0; }
.figures dd { font-family: var(--serif); font-size: 2.3rem; font-weight: 600; line-height: 1.05; font-variant-numeric: tabular-nums; }
.figures dt { color: var(--ink-2); margin-top: 4px; }
.figures .warn dd { color: var(--amber); }
.todo { background: var(--surface); border: 1px solid var(--line); border-inline-start: 4px solid var(--seal); padding: 18px 22px; margin-bottom: 26px; max-width: 880px; }
.todo h2 { margin-bottom: 4px; }
.todo ol { margin: 12px 0 0; padding-inline-start: 1.3rem; display: grid; gap: 12px; }
.todo li.done { color: var(--ink-3); }
.todo li.done b { text-decoration: line-through; font-weight: 500; }
.todo li .btn { margin-top: 6px; }

/* ---------- the licence as paper ---------- */
.paper { position: relative; background: var(--surface); border: 1px solid var(--line); padding: 34px 36px 30px; box-shadow: 0 1px 0 #c5d1cb, 0 18px 34px -24px rgba(18, 38, 58, 0.45); }
.paper::before { content: ''; position: absolute; inset: 9px; border: 1px solid var(--line-2); pointer-events: none; }
.paper .product { font-size: 0.9rem; color: var(--ink-2); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.paper .who { font-family: var(--serif); font-size: 1.85rem; font-weight: 600; line-height: 1.15; margin: 14px 0 2px; overflow-wrap: anywhere; }
.paper .who.none { color: var(--ink-3); font-style: italic; font-weight: 400; }
.paper .plan { color: var(--ink-2); }
.paper .sold { display: flex; gap: 34px; margin: 22px 0 20px; padding: 16px 0; border-block: 1px solid var(--line-2); flex-wrap: wrap; }
.paper .sold b { display: block; font-family: var(--serif); font-size: 2rem; font-weight: 600; line-height: 1.05; font-variant-numeric: tabular-nums; }
.paper .sold span { color: var(--ink-2); font-size: 0.9rem; }
.paper dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; font-size: 0.95rem; }
.paper dl.facts dt { color: var(--ink-3); }
.paper .mods { margin-top: 16px; font-size: 0.93rem; color: var(--ink-2); max-width: 62ch; }
.paper .mods b { color: var(--ink); font-weight: 600; }
.paper .signed { display: flex; align-items: center; gap: 14px; margin-top: 24px; }
.paper .signed svg { width: 76px; height: 76px; flex: none; }
.paper .signed p { font-size: 0.85rem; color: var(--ink-2); }
.paper .signed code { font-family: var(--mono); font-size: 0.82rem; color: var(--ink); }
.seal-ring, .seal-mark { transition: opacity .2s; }
.draft .seal-ring { stroke: #a9b6b0; }
.draft .seal-mark { fill: #a9b6b0; }
@media (prefers-reduced-motion: no-preference) {
  .stamp svg { animation: stamp .5s cubic-bezier(.2, 1.5, .4, 1) both; }
  @keyframes stamp { from { transform: scale(1.7) rotate(-14deg); opacity: 0; } to { transform: none; opacity: 1; } }
}
.keybox { font-family: var(--mono); font-size: 0.8rem; line-height: 1.5; background: #f7f9f8; border: 1px solid var(--line); padding: 10px 12px; overflow-wrap: anywhere; max-height: 7.6em; overflow-y: auto; color: var(--ink-2); user-select: all; }
.onpaper { display: none; }

/* ---------- issuing: the form beside the paper ---------- */
.issue { display: grid; grid-template-columns: minmax(0, 1fr) minmax(330px, 420px); gap: 40px; align-items: start; }
.issue .side { position: sticky; top: 24px; display: grid; gap: 14px; }
.issue .side .paper { padding: 28px 28px 24px; }
.issue .side .paper .who { font-size: 1.5rem; }
.step { padding: 20px 0; border-top: 1px solid var(--line); }
.step:first-child { border-top: 0; padding-top: 0; }
.step > h2 { margin-bottom: 12px; display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.step > h2 small { font-family: var(--sans); font-size: 0.9rem; font-weight: 500; color: var(--ink-2); }
.pick { display: flex; gap: 8px; flex-wrap: wrap; }
.pick label { display: inline-flex; align-items: center; gap: 8px; border: 1px solid #b9c6c0; background: var(--surface); border-radius: 5px; padding: 8px 14px; cursor: pointer; margin: 0; font-size: 0.95rem; color: var(--ink); font-weight: 550; }
.pick label:has(input:checked) { border-color: var(--seal); box-shadow: inset 0 0 0 1px var(--seal); background: var(--seal-wash); }
.pick small { color: var(--ink-3); font-weight: 400; }
.users { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.users input[type="number"] { width: 130px; font-family: var(--serif); font-size: 1.5rem; font-weight: 600; padding: 4px 10px; min-height: 46px; font-variant-numeric: tabular-nums; }
details.more { margin-top: 14px; }
details.more summary { cursor: pointer; color: var(--seal-deep); font-weight: 550; font-size: 0.93rem; width: max-content; }
details.more .row { margin-top: 12px; max-width: 560px; }
.group { margin-top: 16px; }
.group h3 { color: var(--ink-3); font-weight: 600; font-size: 0.85rem; padding-bottom: 5px; border-bottom: 1px solid var(--line-2); margin-bottom: 2px; }
.mod { display: grid; grid-template-columns: 18px 26px minmax(0, 1fr); gap: 10px; align-items: start; padding: 8px 6px; margin: 0; cursor: pointer; font-weight: 400; color: var(--ink); font-size: 0.95rem; border-radius: 4px; }
.mod:hover { background: #eaf1ee; }
.mod input { margin-top: 3px; }
.mod b { font-weight: 600; }
.mod .d { display: block; color: var(--ink-3); font-size: 0.86rem; }
.mod.off { cursor: not-allowed; color: var(--ink-3); }
.mod.off:hover { background: none; }
.mod .tag { font-size: 0.8rem; color: var(--ink-2); background: var(--mute-wash); border-radius: 3px; padding: 0 6px; margin-inline-start: 6px; font-weight: 500; white-space: nowrap; }
.missing { font-size: 0.9rem; color: var(--ink-2); }
.missing li { padding-inline-start: 16px; position: relative; }
.missing li::before { content: ''; position: absolute; inset-inline-start: 2px; top: 0.62em; width: 6px; height: 6px; border-radius: 50%; background: var(--amber); }

/* ---------- one licence, one customer ---------- */
.sheet { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 36px; align-items: start; }
.acts { display: grid; gap: 8px; }
.acts .btn { justify-content: center; }
.acts hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; width: 100%; }
.acts form { display: grid; gap: 6px; }
.acts form .field { margin-bottom: 0; }
.acts p { font-size: 0.86rem; color: var(--ink-3); }
.facts2 { display: grid; grid-template-columns: max-content 1fr; gap: 7px 22px; background: var(--surface); border: 1px solid var(--line); padding: 18px 22px; max-width: 760px; }
.facts2 dt { color: var(--ink-3); }
.note { background: var(--surface); border: 1px solid var(--line); border-inline-start: 4px solid var(--amber); padding: 12px 16px; max-width: 760px; margin-bottom: 18px; }
.note.red { border-inline-start-color: var(--red); }
.note.ok { border-inline-start-color: var(--seal); }
#ckText { font-family: var(--mono); font-size: 0.85rem; overflow-wrap: anywhere; }
.check-out { margin-top: 22px; }
.check-out .note { margin-bottom: 12px; }

/* ---------- the door: first start, unlock ---------- */
.door { min-height: 100vh; display: grid; place-items: center; padding: 30px 20px; }
.door .box { width: 100%; max-width: 480px; background: var(--surface); border: 1px solid var(--line); padding: 34px 36px; box-shadow: 0 18px 34px -24px rgba(18, 38, 58, 0.45); }
.door .brand { padding: 0 0 22px; }
.door h1 { font-size: 1.6rem; margin-bottom: 8px; }
.door p { color: var(--ink-2); margin-bottom: 14px; }
.door .btn.primary { width: 100%; justify-content: center; padding: 10px; }
.door .alt { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line-2); font-size: 0.93rem; }
.door .alt .btn { margin-top: 6px; }

/* ---------- dialog and toast ---------- */
dialog { border: 1px solid var(--line); padding: 0; width: min(520px, calc(100vw - 30px)); color: var(--ink); background: var(--surface); box-shadow: 0 30px 60px -30px rgba(18, 38, 58, 0.6); }
dialog::backdrop { background: rgba(18, 38, 58, 0.42); }
dialog form { padding: 26px 28px 22px; }
dialog h2 { margin-bottom: 10px; }
dialog p { color: var(--ink-2); margin-bottom: 14px; }
dialog .foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
#toast { position: fixed; inset-inline: 0; bottom: 26px; display: grid; place-items: center; pointer-events: none; z-index: 40; }
#toast span { background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 6px; font-weight: 550; box-shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.5); max-width: min(560px, 92vw); }
#toast span.bad { background: var(--red); }

@media (max-width: 1020px) {
  .issue, .sheet { grid-template-columns: minmax(0, 1fr); gap: 26px; }
  .issue .side { position: static; }
}
@media (max-width: 780px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .rail { position: static; height: auto; padding: 14px 0 0; border-inline-end: 0; border-bottom: 1px solid var(--line); }
  .rail nav { flex-direction: row; overflow-x: auto; }
  .rail nav a { border-inline-start: 0; border-bottom: 3px solid transparent; padding: 8px 14px; white-space: nowrap; }
  .rail nav a[aria-current="page"] { border-bottom-color: var(--seal); }
  .rail .foot { display: none; }
  .brand { padding-bottom: 10px; }
  .page { padding: 22px 16px 60px; }
  .figures { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .figures div:nth-child(3) { border-inline-start: 0; }
  .figures div:nth-child(n+3) { border-top: 1px solid var(--line-2); }
  .paper { padding: 26px 22px 22px; }
}

/* ---------- the certificate on paper: only the licence is printed ---------- */
@media print {
  @page { margin: 16mm; }
  html { font-size: 12.5px; }
  body { background: #fff; }
  .rail, .head, .note, .acts, .crumb, #toast, dialog { display: none !important; }
  .shell, .sheet { display: block; }
  .page { padding: 0; max-width: none; }
  .paper { box-shadow: none; border-color: #999; }
  .onpaper { display: block; margin-top: 22px; }
  .onpaper h3 { margin-bottom: 6px; }
  .onpaper ol { padding-inline-start: 1.2rem; margin: 0 0 14px; }
  .onpaper .keybox { max-height: none; overflow: visible; font-size: 0.72rem; user-select: auto; }
}
