:root {
  color-scheme: dark;
  --bg: #07101c;
  --sidebar: #0b1523;
  --panel: #0f1b2b;
  --panel-2: #142336;
  --line: #263a52;
  --text: #f1f6fc;
  --muted: #8fa4bb;
  --accent: #5ca7ff;
  --accent-strong: #2e7cf6;
  --good: #47d18b;
  --warn: #f0bc58;
  --bad: #ff6c78;
  --radius: 14px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", sans-serif;
}
* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; background: radial-gradient(circle at 90% -10%, #173658 0, transparent 35%), var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.muted { color: var(--muted); }
.eyebrow { margin: 0 0 5px; color: var(--accent); font-size: 10px; line-height: 1.4; font-weight: 800; letter-spacing: .18em; }
h1, h2, p { margin-top: 0; }
h1 { font-size: 28px; line-height: 1.2; letter-spacing: -.025em; }
h2 { margin-bottom: 4px; font-size: 17px; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

.boot-view { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.boot-card { display:flex; align-items:center; gap:13px; border:1px solid var(--line); border-radius:16px; padding:18px 22px; background:rgba(15,27,43,.95); box-shadow:0 24px 70px rgba(0,0,0,.28); }
.boot-card > div:last-child { display:grid; gap:2px; }
.boot-card strong { font-size:13px; }
.boot-card span:last-child { color:var(--muted); font-size:11px; }
.boot-spinner { width:18px; height:18px; border:2px solid #294464; border-top-color:var(--accent); border-radius:50%; animation:boot-spin .75s linear infinite; }
@keyframes boot-spin { to { transform:rotate(360deg); } }

.login-view { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(410px, 100%); padding: 38px; border: 1px solid var(--line); background: rgba(15,27,43,.95); border-radius: 20px; box-shadow: 0 30px 80px rgba(0,0,0,.35); }
.login-card h1 { margin: 12px 0 8px; }
.login-card > .muted { margin-bottom: 28px; }
.login-card .field + .field { margin-top: 16px; }
.current-account { margin-bottom: 10px; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.current-account strong { color: var(--text); font-weight: 650; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; color: #eaf3ff; background: linear-gradient(145deg, #4d91f2, #265ca7); font-weight: 900; letter-spacing: -.04em; box-shadow: inset 0 1px rgba(255,255,255,.28); }
.brand-mark.small { width: 34px; height: 34px; border-radius: 9px; font-size: 12px; }
.field { display: grid; align-content: start; gap: 7px; color: #bac9d9; font-size: 12px; font-weight: 650; }
.field > label { color: inherit; font: inherit; }
.field small { color: var(--muted); font-weight: 400; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 9px; background: #0a1420; color: var(--text); padding: 10px 11px; outline: none; }
input:not([type="checkbox"]):not([type="radio"]), select { height: 42px; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(92,167,255,.15); }
textarea { resize: vertical; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 38px; border: 1px solid var(--line); border-radius: 9px; padding: 8px 14px; background: var(--panel-2); color: var(--text); font-weight: 650; white-space: nowrap; }
.button:hover { border-color: #45688f; background: #192b3f; }
.button:disabled { opacity: .5; cursor: not-allowed; }
.button.primary { border-color: #4f89df; background: var(--accent-strong); }
.button.primary:hover { background: #4489ec; }
.button.ghost { background: transparent; }
.button.wide { width: 100%; margin-top: 18px; }
.button.danger { color: var(--bad); border-color: #64303b; background: #29171e; }
.button.small { min-height: 30px; padding: 5px 9px; font-size: 12px; border-radius: 7px; }
.form-error { min-height: 20px; margin: 10px 0 0; color: var(--bad); font-size: 12px; }

.app-view { min-height: 100vh; display: grid; grid-template-columns: 228px minmax(0,1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 24px 18px; border-right: 1px solid #1f3042; background: rgba(11,20,31,.94); }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 5px 26px; }
.brand div:last-child { display: grid; }
.brand strong { font-size: 14px; }
.brand span { color: var(--muted); font-size: 10px; letter-spacing: .04em; }
nav { display: grid; gap: 5px; }
.nav-item { border: 0; border-radius: 9px; padding: 10px 12px; text-align: left; color: var(--muted); background: transparent; font-weight: 600; }
.nav-item:hover { color: var(--text); background: #121f2d; }
.nav-item.active { color: #eaf2ff; background: #173151; box-shadow: inset 3px 0 var(--accent); }
.sidebar-footer { margin-top: auto; padding: 18px 5px 0; border-top: 1px solid #1f3042; }
.health { display: flex; align-items: center; gap: 8px; margin-bottom: 13px; color: var(--muted); font-size: 12px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--good); box-shadow: 0 0 8px rgba(71,209,139,.5); }
.text-button { padding: 0; border: 0; background: transparent; color: var(--muted); }
.text-button:hover { color: var(--text); }
.content { min-width: 0; max-width: 1460px; width: 100%; margin: 0 auto; padding: 30px 34px 50px; }
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 25px; }
.page-header p:last-child { margin-bottom: 0; }
.header-actions { display: flex; gap: 9px; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 13px; margin-bottom: 15px; }
.metric-card { position: relative; min-height: 138px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; background: linear-gradient(145deg, #122033, #0f1925); }
.metric-card::after { content:""; position:absolute; width:90px; height:90px; right:-30px; bottom:-40px; border-radius:50%; background:#2f6db6; filter:blur(32px); opacity:.16; }
.metric-card span { color: var(--muted); font-size: 12px; }
.metric-card strong { display:block; margin: 10px 0 4px; font-size: 35px; line-height:1; }
.metric-card small { color: var(--muted); }
.metric-card.good strong { color: var(--good); }
.metric-card.warn strong { color: var(--warn); }
.metric-card.bad strong { color: var(--bad); }
.split-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, .8fr); gap: 15px; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: rgba(15,27,43,.9); padding: 19px; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 16px; }
.panel-head p { margin-bottom: 0; color: var(--muted); font-size: 12px; }
.accent-panel { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; background: linear-gradient(145deg, #142a44, #0f1b29); }
.accent-panel .muted { margin-bottom: 20px; }
.accent-panel .muted strong { color: var(--text); }
.button-group { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.expiry-list { display: grid; }
.expiry-row { display: grid; grid-template-columns: 1fr auto; gap: 14px; padding: 10px 0; border-bottom: 1px solid #1f2e3e; }
.expiry-row:last-child { border-bottom: 0; }
.expiry-row strong { display:block; font-size:13px; }
.expiry-row span { color: var(--muted); font-size: 11px; }
.days-badge { align-self:center; border-radius:999px; padding:4px 9px; color:var(--warn); background:#362b15; font-size:11px; font-weight:700; }

.toolbar { display: flex; align-items: center; gap: 9px; margin-bottom: 14px; }
.search-field { flex:1; }
.toolbar select { width: 150px; }
.activation-code-cell { display:flex; align-items:center; gap:7px; min-width:230px; }
.activation-code-cell code { font-size:12px; white-space:nowrap; }
.copy-code { border:1px solid var(--line); border-radius:6px; padding:3px 7px; color:var(--accent); background:transparent; font-size:11px; }
.copy-code:disabled { color:var(--muted); cursor:default; opacity:.65; }
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 980px; }
th { padding: 10px; color: var(--muted); font-size: 11px; text-align: left; text-transform: uppercase; letter-spacing: .05em; border-bottom: 1px solid var(--line); }
td { padding: 13px 10px; border-bottom: 1px solid #1e2c3c; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: rgba(30,50,72,.35); }
.select-column { width: 38px; padding-right: 0; }
.row-checkbox { width: 16px; height: 16px; margin: 0; accent-color: var(--accent-strong); vertical-align: middle; }
.user-cell { display:grid; gap:2px; }
.user-cell strong { font-size:13px; }
.user-cell span { color:var(--muted); font-size:11px; }
.machine-code { display:inline-block; max-width:300px; color:#c7d9ee; font-size:11px; line-height:1.4; overflow-wrap:anywhere; }
.machine-code.unbound { color:var(--muted); font-family:inherit; }
.actions-column { text-align:right; }
.row-actions { display:flex; justify-content:flex-end; gap:5px; flex-wrap:wrap; }
.status-stack { display:flex; flex-direction:column; align-items:flex-start; gap:4px; }
.status-pill { display:inline-flex; align-items:center; border-radius:999px; padding:4px 8px; font-size:11px; font-weight:700; }
.status-pill.active { color:var(--good); background:#123426; }
.status-pill.expiring { color:var(--warn); background:#382d14; }
.status-pill.expired,.status-pill.disabled { color:var(--bad); background:#3b1a22; }
.status-pill.unlicensed { color:var(--muted); background:#202e3e; }
.duration-badge { display:inline-block; padding:2px 8px; border-radius:999px; font-size:11px; line-height:1.4; color:#cfe3ff; background:rgba(92,167,255,0.14); border:1px solid rgba(92,167,255,0.3); }
.empty-state { padding: 38px 10px; color:var(--muted); text-align:center; }
.bulk-toolbar { display:flex; align-items:center; justify-content:space-between; gap:12px; margin:14px 0 4px; padding:9px 11px; border:1px solid #29425d; border-radius:9px; background:#0d1a29; }
.selection-summary { color:#c7d9ee; font-size:12px; font-weight:650; }
.bulk-actions { display:flex; align-items:center; gap:7px; flex-wrap:wrap; }
.pagination { display:flex; align-items:center; justify-content:space-between; gap:14px; margin-top:15px; padding-top:14px; border-top:1px solid #1f2e3e; }
.pagination-summary,.pagination-controls label,.page-label { color:var(--muted); font-size:12px; }
.pagination-controls { display:flex; align-items:center; gap:8px; }
.pagination-controls label { display:flex; align-items:center; gap:7px; white-space:nowrap; }
.pagination-controls select { width:auto; min-width:88px; padding:6px 28px 6px 9px; }
.page-label { min-width:76px; text-align:center; }

.form-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); align-items:start; gap:14px; }
.field.full { grid-column:1/-1; }
.dialog-stack { display:grid; gap:16px; }
.form-callout { margin:0; padding:11px 13px; border:1px solid #22354a; border-left:3px solid var(--accent); border-radius:9px; background:#0b1622; color:var(--muted); font-size:12px; line-height:1.6; }
dialog { max-width: calc(100vw - 28px); padding:0; border:1px solid var(--line); border-radius:16px; color:var(--text); background:var(--panel); box-shadow:0 30px 100px rgba(0,0,0,.65); }
dialog::backdrop { background:rgba(3,8,13,.76); backdrop-filter:blur(4px); }
.dialog-card { width:min(580px,calc(100vw - 28px)); padding:23px; }
.dialog-card.compact { width:min(420px,calc(100vw - 28px)); }
.dialog-head { display:flex; align-items:flex-start; justify-content:space-between; gap:20px; margin-bottom:19px; }
.dialog-head h2 { font-size:22px; }
.icon-button { width:32px; height:32px; border:1px solid var(--line); border-radius:8px; color:var(--muted); background:transparent; font-size:20px; line-height:1; }
.dialog-actions { display:flex; justify-content:flex-end; gap:8px; margin-top:20px; }
.generated-codes { display:grid; gap:8px; max-height:55vh; overflow:auto; }
.generated-code { display:flex; align-items:center; justify-content:space-between; gap:12px; border:1px solid var(--line); border-radius:9px; padding:10px 12px; background:#0b1622; }
.generated-code code { font-size:13px; letter-spacing:.04em; }
.generated-code button { border:0; padding:4px; color:var(--accent); background:transparent; }
.duration-presets { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:8px; margin-top:2px; }
.duration-presets.compact { gap:6px; }
.preset-chip { display:inline-flex; align-items:center; justify-content:center; min-height:32px; padding:5px 8px; border-radius:8px; border:1px solid var(--line); background:#0c1724; color:var(--muted); font-size:12px; font-weight:600; white-space:nowrap; }
.preset-chip:hover { border-color:#45688f; background:#142436; color:var(--text); }
.preset-chip.active { background:rgba(46,124,246,0.2); border-color:var(--accent); color:#e6f0ff; box-shadow:inset 0 0 0 1px rgba(92,167,255,0.25); }
.checkbox-inline { display:flex; align-items:center; gap:9px; font-weight:500; cursor:pointer; }
.checkbox-inline input[type="checkbox"] { width:16px; height:16px; margin:0; accent-color:var(--accent-strong); flex:0 0 auto; }
.gitlab-banner { display:flex; flex-wrap:wrap; align-items:center; gap:10px; padding:10px 12px; border:1px solid #243b55; border-radius:10px; background:#0d1a29; font-size:13px; color:#c8daf0; }
.gitlab-banner code { color:#9ed0ff; font-family:ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size:12px; }
.delivery-summary { display:grid; gap:6px; margin-bottom:12px; padding:12px 14px; border:1px solid #243b55; border-radius:10px; background:#0d1a29; font-size:12.5px; color:#c8daf0; line-height:1.5; word-break:break-all; }
.delivery-summary code { color:#9ed0ff; font-family:ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size:12px; }
.manifest-preview { margin:0; padding:14px; border:1px solid #22354a; border-radius:10px; background:#09131e; color:#c9dbf0; font-family:ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size:12px; line-height:1.55; max-height:520px; overflow:auto; white-space:pre-wrap; word-break:break-all; }
.toast { position:fixed; z-index:20; right:24px; bottom:24px; max-width:410px; border:1px solid #356186; border-radius:10px; padding:11px 14px; background:#172c41; color:var(--text); box-shadow:0 12px 30px rgba(0,0,0,.35); }
.toast.error { border-color:#713842; background:#351b24; }

@media (max-width: 1000px) {
  .app-view { grid-template-columns: 172px minmax(0,1fr); }
  .sidebar { padding: 20px 12px; }
  .brand div:last-child span { display: none; }
  .content { padding: 24px 20px; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .split-grid { grid-template-columns: 1fr; }
}
@media (max-width: 650px) {
  .app-view { display: block; }
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center; gap: 12px; padding: 12px; }
  .brand { padding: 0; }
  nav { display: flex; flex: 1; overflow: auto; }
  .sidebar-footer { margin: 0; padding: 0; border: 0; }
  .content { padding: 18px 13px 40px; }
  .page-header { display: block; }
  .header-actions { margin-top: 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
  .pagination { align-items: flex-start; flex-direction: column; }
}
