/* Vistapane license dashboard. Colors and type come from brand/tokens.css. */
:root {
  --midnight: #0B2545; --harbor: #13315C; --sky: #8DE0FF; --sunrise: #FFC857;
  --surface: #EEF4ED; --raised: #FFFFFF; --sunken: #E2EAE4; --line: #D3DDD7; --line-strong: #7B8DA1;
  --ink: #0B2545; --muted: #4A5D73; --accent: #0A6A9E; --on-accent: #FFFFFF; --accent-soft: #DDF3FC;
  --ok: #17704A; --ok-soft: #DCF3E7; --warn: #8A5300; --warn-soft: #FDF0D5; --bad: #B42318; --bad-soft: #FDE3E1; --bad-fill: #C8322B;
  --chrome: #0B2545; --chrome-ink: #C9D6E3;
  --display: Sora, "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
  --sans: Figtree, "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Code", Consolas, ui-monospace, monospace;
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(11, 37, 69, .06), 0 1px 3px rgba(11, 37, 69, .05);
  --shadow-lg: 0 20px 50px rgba(11, 37, 69, .22), 0 4px 12px rgba(11, 37, 69, .1);
  --focus: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --surface: #07182E; --raised: #0F2240; --sunken: #0A1C35; --line: #1E3556; --line-strong: #5F7C9E;
    --ink: #E8F0F6; --muted: #9DB2C7; --accent: #8DE0FF; --on-accent: #0B2545; --accent-soft: #0E3A5C;
    --ok: #5EE0A0; --ok-soft: #0F3A2B; --warn: #FFA94D; --warn-soft: #3D2A0E; --bad: #FF8A80; --bad-soft: #3F1518;
    --chrome: #051222;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-lg: 0 24px 60px rgba(0, 0, 0, .55);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--surface); color: var(--ink); font: 14px/1.5 var(--sans); -webkit-font-smoothing: antialiased; min-height: 100vh; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
.boot { padding: 40vh 0; text-align: center; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mono { font-family: var(--mono); }
.grow { flex: 1; min-width: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: none; box-shadow: var(--focus); }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 14px; border-radius: var(--r-md);
  border: 1px solid var(--line-strong); background: var(--raised); color: var(--ink); font-weight: 600; cursor: pointer; white-space: nowrap; text-decoration: none; }
.btn:hover { background: var(--sunken); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { background: var(--bad-fill); border-color: var(--bad-fill); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--sunken); }
.btn.sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: var(--r-sm); gap: 5px; }
.btn:disabled { opacity: .5; cursor: default; filter: none; }
.btn svg, .icon-btn svg { flex: none; }
.icon-btn { width: 34px; height: 34px; display: inline-grid; place-items: center; border-radius: var(--r-sm); border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--sunken); color: var(--ink); }
.linkish { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 600; cursor: pointer; }

input[type=text], input[type=email], input[type=number], input[type=password], input[type=date], input[type=search], textarea, select {
  width: 100%; height: 40px; padding: 0 12px; border-radius: var(--r-md); border: 1px solid var(--line-strong); background: var(--raised); }
textarea { height: auto; padding: 10px 12px; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span:first-child { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.field .hint { font-size: 12.5px; color: var(--muted); }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; }
.form { display: flex; flex-direction: column; gap: 16px; }

.stepper { display: flex; align-items: stretch; height: 40px; border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--raised); overflow: hidden; }
.stepper:focus-within { border-color: var(--accent); box-shadow: var(--focus); }
.stepper input { border: 0; height: 100%; text-align: center; border-radius: 0; font-variant-numeric: tabular-nums; font-weight: 600; box-shadow: none !important; -moz-appearance: textfield; }
.stepper input::-webkit-inner-spin-button { -webkit-appearance: none; }
.stepper button { width: 40px; flex: none; border: 0; background: var(--sunken); cursor: pointer; font-size: 18px; color: var(--muted); }
.stepper button:hover { color: var(--ink); }

.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--sunken); border-radius: var(--r-md); border: 1px solid var(--line); flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 9px; cursor: pointer; font-weight: 600; font-size: 13px; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; }
.seg button.on { background: var(--raised); color: var(--ink); box-shadow: var(--shadow-sm); }
.seg .count { font-size: 11.5px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }

.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 99px; font-size: 12px; font-weight: 700; white-space: nowrap; background: var(--sunken); color: var(--muted); }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.info { background: var(--accent-soft); color: var(--accent); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; background: var(--line-strong); }
.dot.ok { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent); }

/* ---------- sign in ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(1200px 500px at 50% -10%, var(--harbor), var(--midnight) 60%, #051222); }
.auth-card { width: 100%; max-width: 380px; background: var(--raised); border-radius: 20px; padding: 32px 28px 28px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; gap: 14px; }
.auth-card .mark { width: 52px; height: 52px; }
.auth-card h1 { font: 600 22px/1.2 var(--display); letter-spacing: -.02em; margin: 6px 0 0; }
.auth-card p { margin: 0; color: var(--muted); }
.auth-err { color: var(--bad); font-size: 13px; min-height: 18px; }

/* ---------- shell ---------- */
.top { background: var(--chrome); color: var(--chrome-ink); }
.top-in { max-width: 1160px; margin: 0 auto; padding: 0 24px; height: 60px; display: flex; align-items: center; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.brand svg { width: 30px; height: 30px; }
.wordmark { font: 400 20px var(--display); letter-spacing: -.03em; color: #E8F0F6; }
.wordmark b { font-weight: 600; }
.wordmark span { color: var(--sky); }
.top .tag { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--sky); border-left: 1px solid rgba(201, 214, 227, .25); padding-left: 12px; margin-left: 2px; }
.top .btn.ghost { color: var(--chrome-ink); }
.top .btn.ghost:hover { background: rgba(255, 255, 255, .08); }

main { max-width: 1160px; margin: 0 auto; padding: 28px 24px 64px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font: 600 28px/1.15 var(--display); letter-spacing: -.03em; margin: 0 0 4px; }
.page-head p { margin: 0; color: var(--muted); }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.stat { background: var(--raised); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px 18px; box-shadow: var(--shadow-sm); }
.stat-val { font: 600 28px/1.1 var(--display); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.stat-val small { font: 500 14px var(--sans); color: var(--muted); letter-spacing: 0; margin-left: 4px; }
.stat-label { font-size: 12.5px; color: var(--muted); font-weight: 600; margin-top: 4px; }

.toolbar { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.search { position: relative; flex: 1; min-width: 220px; max-width: 360px; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search input { padding-left: 38px; }

/* ---------- license list ---------- */
.list { background: var(--raised); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); overflow: hidden; }
.list-head, .lic { display: grid; grid-template-columns: minmax(180px, 1.6fr) minmax(210px, 1.3fr) minmax(150px, 1.1fr) minmax(130px, 1fr) 110px; gap: 16px; align-items: center; padding: 0 18px; }
.list-head { height: 40px; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; border-bottom: 1px solid var(--line); background: var(--sunken); }
.lic { min-height: 68px; border-top: 1px solid var(--line); cursor: pointer; width: 100%; text-align: left; background: none; border-left: 0; border-right: 0; border-bottom: 0; }
.list-head + .lic { border-top: 0; }
.lic:hover { background: color-mix(in srgb, var(--accent-soft) 45%, transparent); }
.lic-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lic-sub { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.key { font-family: var(--mono); font-size: 13px; font-weight: 500; letter-spacing: .04em; white-space: nowrap; }
.seatbar { display: flex; flex-direction: column; gap: 6px; }
.seatbar .nums { font-size: 13px; font-variant-numeric: tabular-nums; }
.seatbar .nums b { font-weight: 700; }
.bar { height: 6px; border-radius: 99px; background: var(--sunken); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 99px; background: var(--accent); }
.bar.full i { background: var(--warn); }
.seen { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.empty { padding: 56px 24px; text-align: center; }
.empty h2 { font: 600 18px var(--display); margin: 12px 0 4px; }
.empty p { color: var(--muted); margin: 0 0 18px; }
.empty .art { width: 56px; height: 56px; margin: 0 auto; border-radius: 16px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; }

/* ---------- drawer & modal ---------- */
.scrim { position: fixed; inset: 0; background: rgba(5, 18, 34, .45); z-index: 40; animation: fade .15s ease-out; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); background: var(--surface); z-index: 41; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; animation: slide .2s ease-out; }
.drawer-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); background: var(--raised); }
.drawer-head h2 { font: 600 19px/1.25 var(--display); letter-spacing: -.02em; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer-body { overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 16px; flex: 1; }
.drawer-foot { padding: 14px 20px; border-top: 1px solid var(--line); background: var(--raised); display: flex; gap: 10px; justify-content: flex-end; }
.card { background: var(--raised); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px 18px; }
.card h3 { font-size: 15px; font-weight: 700; margin: 0 0 12px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card h3 .muted { font-weight: 500; font-size: 13px; }

.keybox { background: var(--midnight); color: #E8F0F6; border-radius: var(--r-lg); padding: 16px 18px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.keybox .label { font-size: 11.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--sky); width: 100%; }
.keybox .key { font-size: clamp(15px, 3.6vw, 19px); letter-spacing: .08em; font-weight: 600; flex: 1; user-select: all; }
.keybox .btn { background: rgba(255, 255, 255, .08); border-color: rgba(141, 224, 255, .35); color: #E8F0F6; }
.keybox pre.filetext { width: 100%; margin: 0 0 4px; font: 500 11.5px/1.45 var(--mono); color: #C9D6E3; background: rgba(0,0,0,.22); border-radius: 10px; padding: 10px 12px; max-height: 150px; overflow: auto; white-space: pre; }
.keybox .btn:hover { background: rgba(255, 255, 255, .14); }

.server { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--line); }
.server:first-of-type { border-top: 0; padding-top: 0; }
.server .dot { margin-top: 7px; }
.events { list-style: none; margin: 0; padding: 0; }
.events li { display: flex; gap: 12px; padding: 7px 0; font-size: 13px; border-top: 1px solid var(--line); }
.events li:first-child { border-top: 0; padding-top: 0; }
.events time { color: var(--muted); width: 108px; flex: none; font-variant-numeric: tabular-nums; }
.danger-zone { display: flex; flex-direction: column; gap: 12px; }
.danger-row { display: flex; gap: 14px; align-items: center; justify-content: space-between; }

.modal-wrap { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; overflow-y: auto; }
.modal { width: 100%; max-width: 520px; background: var(--raised); border-radius: 20px; box-shadow: var(--shadow-lg); animation: pop .18s ease-out; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px 4px; }
.modal-head h2 { font: 600 19px var(--display); letter-spacing: -.02em; margin: 0; }
.modal-body { padding: 14px 22px 8px; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 22px 20px; }
.done-head { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; }
.done-head .check { width: 40px; height: 40px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); display: grid; place-items: center; flex: none; }
.email-preview { white-space: pre-wrap; font-size: 13px; background: var(--sunken); border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 14px; margin-top: 14px; max-height: 180px; overflow: auto; }

#toasts { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--midnight); color: #E8F0F6; padding: 10px 16px; border-radius: 12px; box-shadow: var(--shadow-lg); font-weight: 600; font-size: 13.5px; animation: pop .18s ease-out; display: flex; gap: 8px; align-items: center; }
.toast.error { background: var(--bad-fill); color: #fff; }

@keyframes fade { from { opacity: 0; } }
@keyframes slide { from { transform: translateX(24px); opacity: 0; } }
@keyframes pop { from { transform: translateY(6px) scale(.98); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- small screens ---------- */
@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .list-head { display: none; }
  .lic { grid-template-columns: 1fr auto; grid-template-areas: "name status" "key key" "seats seen"; row-gap: 8px; padding: 14px 16px; }
  .lic > :nth-child(1) { grid-area: name; }
  .lic > :nth-child(2) { grid-area: key; }
  .lic > :nth-child(3) { grid-area: seats; }
  .lic > :nth-child(4) { grid-area: seen; justify-self: end; }
  .lic > :nth-child(5) { grid-area: status; justify-self: end; }
}
@media (max-width: 560px) {
  .top-in, main { padding-left: 16px; padding-right: 16px; }
  .top .tag { display: none; }
  .page-head h1 { font-size: 24px; }
  .stat { padding: 12px 14px; }
  .stat-val { font-size: 22px; }
  .search { max-width: none; }
  .drawer-body { padding: 16px; }
  .events time { width: 88px; }
}
