:root {
  --bg: #eef3f8;
  --surface: #ffffff;
  --text: #172033;
  --muted: #6b7280;
  --line: #d8e1ed;
  --primary: #2457d6;
  --primary-dark: #173e9c;
  --secondary: #0f766e;
  --danger: #b42318;
  --warning: #b45309;
  --ok: #047857;
  --shadow: 0 18px 50px rgba(22, 32, 51, .09);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--text); background: radial-gradient(circle at top left, #dfeaff, transparent 34rem), var(--bg); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
.top-nav { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 1rem; padding: .9rem 1.25rem; background: rgba(255,255,255,.92); backdrop-filter: blur(18px); border-bottom: 1px solid var(--line); }
.top-nav a { color: #22314d; font-weight: 700; }
.top-nav .brand { font-size: 1.05rem; color: var(--primary); }
.top-nav .spacer { flex: 1; }
.top-nav .user { color: var(--muted); font-size: .92rem; }
.inline-form { display: inline; margin: 0; }
.inline-form button { border: 0; background: transparent; color: var(--danger); font-weight: 700; cursor: pointer; }
.container { max-width: 1180px; margin: 0 auto; padding: 2rem 1.25rem 4rem; }
.container.narrow { max-width: 520px; }
.page-header { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; margin-bottom: 1.25rem; }
h1 { margin: 0 0 .35rem; font-size: clamp(1.65rem, 3vw, 2.35rem); }
h2 { margin: 0 0 .7rem; font-size: 1.1rem; }
p { line-height: 1.55; }
.muted, .page-header p { color: var(--muted); margin: 0; }
.small, .subtext { color: var(--muted); font-size: .85rem; }
.subtext { display: block; margin-top: .2rem; }
.card { background: rgba(255,255,255,.96); border: 1px solid rgba(216,225,237,.9); border-radius: 22px; box-shadow: var(--shadow); padding: 1.25rem; margin-bottom: 1rem; }
.auth-card { margin-top: 8vh; }
.stats { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .85rem; margin-bottom: 1rem; }
.stat-card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 1rem; box-shadow: var(--shadow); }
.stat-card strong { display: block; font-size: 1.9rem; }
.stat-card span { color: var(--muted); font-weight: 700; }
.grid-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.form-stack { display: flex; flex-direction: column; gap: .95rem; }
.field { display: flex; flex-direction: column; gap: .35rem; font-weight: 700; color: #26344f; }
.field span { font-size: .92rem; }
input, select, textarea { width: 100%; border: 1px solid #c8d3e3; border-radius: 14px; padding: .78rem .9rem; font: inherit; background: #fbfdff; color: var(--text); }
textarea { min-height: 120px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(36, 87, 214, .14); border-color: var(--primary); }
.full { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; align-items: center; gap: .75rem; margin-top: .25rem; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; border: 1px solid transparent; border-radius: 999px; padding: .72rem 1rem; font-weight: 800; cursor: pointer; text-decoration: none !important; background: #edf2f8; color: #24344f; white-space: nowrap; }
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); }
.btn.secondary { background: var(--secondary); color: #fff; }
.btn.ghost { background: #fff; border-color: var(--line); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.small { padding: .42rem .75rem; font-size: .84rem; }
.button-list { display: flex; flex-direction: column; gap: .7rem; align-items: flex-start; }
.button-list.horizontal { flex-direction: row; flex-wrap: wrap; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .85rem .75rem; border-bottom: 1px solid #e2e8f0; vertical-align: top; }
th { color: #42526e; font-size: .82rem; text-transform: uppercase; letter-spacing: .05em; }
tr:last-child td { border-bottom: 0; }
.empty-row { text-align: center; color: var(--muted); padding: 2rem; }
.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: .26rem .55rem; font-size: .78rem; font-weight: 800; background: #e5e7eb; color: #374151; }
.badge.active { background: #dcfce7; color: #166534; }
.badge.expiring, .badge.scheduled { background: #fef3c7; color: #92400e; }
.badge.expired, .badge.revoked { background: #fee2e2; color: #991b1b; }
.badge.unlicensed { background: #e0f2fe; color: #075985; }
.machine { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: .86rem; word-break: break-all; }
.machine.large { font-size: 1rem; background: #f8fafc; border: 1px dashed #cbd5e1; padding: .75rem; border-radius: 14px; }
.flash { border-radius: 16px; padding: .9rem 1rem; margin-bottom: 1rem; font-weight: 750; border: 1px solid; }
.flash.success { background: #ecfdf5; color: #065f46; border-color: #bbf7d0; }
.flash.error { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.flash.info { background: #eff6ff; color: #1e3a8a; border-color: #bfdbfe; }
.filters { display: grid; grid-template-columns: 1fr 180px auto; gap: .75rem; margin-bottom: 1rem; }
.key-status { display: inline-flex; padding: .45rem .8rem; border-radius: 999px; font-weight: 900; margin-bottom: .7rem; }
.key-status.ok { background: #dcfce7; color: #166534; }
.key-status.warn { background: #fef3c7; color: #92400e; }
.alert-note { padding: .9rem 1rem; border-radius: 16px; background: #f0f9ff; border: 1px solid #bae6fd; color: #075985; }
.check-row { display: flex; align-items: flex-start; gap: .65rem; font-weight: 700; }
.check-row input { width: auto; margin-top: .25rem; }
.inline-panel { display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; margin: .6rem 0; }
.inline-panel input { max-width: 380px; }
.danger-zone { border-color: #fecaca; }
code { background: #f1f5f9; padding: .14rem .28rem; border-radius: .3rem; }
@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-two, .form-grid { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; }
  .filters { grid-template-columns: 1fr; }
  .top-nav { flex-wrap: wrap; }
}

.badge.unlimited { background: #ede9fe; color: #5b21b6; }
.hidden { display: none !important; }
.quick-dates { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: .45rem; }
.mode-summary { display: flex; flex-direction: column; gap: .2rem; padding: .8rem 0; border-bottom: 1px solid var(--line); }
.mode-summary:last-child { border-bottom: 0; }
.mode-summary span { color: var(--muted); font-size: .9rem; line-height: 1.45; }
.unlimited-note { background: #f5f3ff; border-color: #ddd6fe; color: #5b21b6; }
.warning-note { background: #fff7ed; border-color: #fed7aa; color: #9a3412; margin-bottom: .8rem; }
