:root {
  color-scheme: light;
  --navy: #111827;
  --muted: #667085;
  --line: #e7eaf0;
  --surface: #ffffff;
  --canvas: #f4f6fa;
  --primary: #5b5bd6;
  --primary-dark: #4747b8;
  --green: #16a36a;
  --red: #d43f52;
  --amber: #c67a06;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--canvas); color: var(--navy); }
button, input { font: inherit; }
button { cursor: pointer; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 245px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 24px 16px; background: linear-gradient(175deg, #171827, #10111e); color: #fff; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; background: linear-gradient(145deg, #7778f3, #5151ca); color: white; font-size: 30px; line-height: 1; box-shadow: 0 10px 30px #5b5bd64a; }
.brand strong, .brand span { display: block; }
.brand strong { font-size: 17px; }
.brand span { margin-top: 2px; color: #969bad; font-size: 11px; }
nav { margin-top: 42px; display: grid; gap: 8px; }
.nav-item { border: 0; border-radius: 10px; padding: 12px 14px; background: transparent; color: #a8adbd; text-align: left; }
.nav-item:hover, .nav-item.active { background: #ffffff12; color: #fff; }
.sidebar-footer { margin-top: auto; padding: 18px 12px 4px; border-top: 1px solid #ffffff16; display: grid; gap: 7px; }
.sidebar-footer span { font-weight: 650; margin-bottom: 5px; }
.link-button { padding: 0; border: 0; background: transparent; color: #a8adbd; text-align: left; font-size: 13px; }
.link-button:hover { color: #fff; }
.danger-text { color: #f08a97; }
main { min-width: 0; padding: 34px clamp(20px, 4vw, 52px) 60px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.eyebrow { margin: 0 0 6px; color: var(--primary); font-size: 11px; font-weight: 800; letter-spacing: .12em; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(24px, 3vw, 34px); letter-spacing: -.04em; }
h2 { margin-bottom: 0; font-size: 20px; letter-spacing: -.02em; }
.primary, .secondary, .danger-outline { min-height: 40px; border-radius: 9px; padding: 9px 15px; font-weight: 700; }
.primary { border: 1px solid var(--primary); background: var(--primary); color: white; box-shadow: 0 6px 18px #5b5bd62c; }
.primary:hover { background: var(--primary-dark); }
.secondary { border: 1px solid var(--line); background: white; color: #34384a; }
.secondary:hover { border-color: #c8ccd8; background: #fafbfc; }
.danger-outline { border: 1px solid #efb2ba; color: var(--red); background: #fff8f9; }
button:disabled { opacity: .55; cursor: wait; }
.warning-banner { margin-top: 24px; padding: 13px 16px; border: 1px solid #f2d497; border-radius: 10px; background: #fff9e9; color: #8a5708; font-size: 13px; }
.stats-grid { margin: 24px 0; display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 16px; }
.stat-card { position: relative; overflow: hidden; min-height: 150px; padding: 21px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); box-shadow: 0 8px 28px #1b21330a; }
.stat-card::after { content: ''; position: absolute; width: 90px; height: 90px; right: -30px; top: -30px; border-radius: 50%; background: currentColor; opacity: .08; }
.stat-card span, .stat-card small, .stat-card strong { display: block; }
.stat-card span { color: var(--muted); font-size: 13px; font-weight: 650; }
.stat-card strong { margin: 12px 0 6px; color: var(--navy); font-size: 37px; line-height: 1; }
.stat-card small { color: #9298a8; }
.stat-card.blue { color: #4776d8; } .stat-card.green { color: var(--green); } .stat-card.amber { color: var(--amber); } .stat-card.purple { color: #8b5bd6; }
.panel { overflow: hidden; border: 1px solid var(--line); border-radius: 15px; background: white; box-shadow: 0 8px 28px #1b21330a; }
.panel-heading { padding: 20px 22px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); }
.toolbar { display: flex; gap: 9px; }
input { width: 100%; min-height: 41px; border: 1px solid #d8dce5; border-radius: 9px; padding: 9px 11px; outline: 0; color: var(--navy); background: white; }
input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px #5b5bd61a; }
.toolbar input { width: min(300px, 28vw); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
th { padding: 12px 15px; background: #fafbfc; color: #7a8091; font-size: 11px; text-align: left; letter-spacing: .04em; text-transform: uppercase; }
td { padding: 15px; border-top: 1px solid #eff1f5; vertical-align: top; font-size: 13px; }
tbody tr:hover { background: #fbfbfd; }
.customer-name { font-weight: 750; }
.customer-meta { margin-top: 4px; color: var(--muted); font-size: 11px; }
code { display: inline-block; border: 1px solid #e3e5ec; border-radius: 6px; padding: 5px 7px; background: #f6f7fa; color: #33384c; font: 600 12px/1.2 ui-monospace, SFMono-Regular, Consolas, monospace; }
.mini-copy { margin-left: 5px; padding: 3px 6px; border: 0; background: transparent; color: var(--primary); font-size: 11px; }
.badge { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 5px 8px; font-weight: 700; font-size: 11px; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.active { background: #eaf8f1; color: #15855a; }
.badge.blocked { background: #fff0f2; color: #c83247; }
.badge.expired { background: #fff5e4; color: #aa6400; }
.backup-version { color: var(--primary); font-weight: 750; }
.muted { color: var(--muted); }
.action-menu { display: flex; flex-wrap: wrap; gap: 5px; max-width: 180px; }
.action-menu button { padding: 4px 7px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: #50566a; font-size: 11px; }
.action-menu button:hover { border-color: #b9becc; color: var(--navy); }
.empty-state { padding: 65px 20px; text-align: center; color: var(--muted); }
.empty-icon { width: 48px; height: 48px; margin: 0 auto 14px; display: grid; place-items: center; border-radius: 14px; background: #eeeefd; color: var(--primary); font-size: 30px; }
dialog { width: min(610px, calc(100vw - 30px)); border: 0; border-radius: 17px; padding: 25px; color: var(--navy); box-shadow: 0 30px 90px #11182755; }
dialog::backdrop { background: #11182780; backdrop-filter: blur(3px); }
.dialog-heading { margin-bottom: 22px; display: flex; justify-content: space-between; gap: 15px; }
.icon-button { width: 34px; height: 34px; border: 0; border-radius: 8px; background: #f1f2f6; color: #6a7080; font-size: 23px; }
label { display: grid; gap: 7px; margin-bottom: 17px; color: #444a5b; font-size: 12px; font-weight: 700; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-note { padding: 11px 13px; border-radius: 9px; background: #f5f5fd; color: #62677b; font-size: 12px; line-height: 1.55; }
.dialog-actions { margin-top: 22px; display: flex; justify-content: flex-end; gap: 9px; }
.copy-field { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.copy-field code { display: flex; align-items: center; overflow-x: auto; }
.device-list { display: grid; gap: 9px; max-height: 360px; overflow-y: auto; }
.device-card { padding: 13px; border: 1px solid var(--line); border-radius: 10px; }
.device-card strong, .device-card span { display: block; }
.device-card span { margin-top: 4px; color: var(--muted); font-size: 11px; }
.toast { position: fixed; right: 25px; bottom: 25px; max-width: 360px; padding: 13px 17px; border-radius: 10px; background: #171827; color: white; box-shadow: 0 15px 45px #1118274f; transform: translateY(25px); opacity: 0; pointer-events: none; transition: .22s ease; }
.toast.visible { transform: translateY(0); opacity: 1; }
.toast.error { background: #b92f42; }
.login-page { min-height: 100vh; padding: 25px; display: grid; place-items: center; background: radial-gradient(circle at 15% 10%, #7778f326, transparent 30%), radial-gradient(circle at 90% 90%, #16a36a16, transparent 35%), #f3f4f8; }
.login-card { width: min(440px, 100%); padding: 38px; border: 1px solid var(--line); border-radius: 20px; background: #fff; box-shadow: 0 30px 80px #20253b1a; }
.login-brand { margin-bottom: 34px; }
.login-card h1 { margin-bottom: 10px; }
.login-copy { margin-bottom: 26px; color: var(--muted); line-height: 1.55; }
.full-width { width: 100%; }
.field-error { margin: -4px 0 14px; color: var(--red); font-size: 12px; }
.login-footnote { margin: 18px 0 0; color: #8a90a0; font-size: 11px; text-align: center; }
@media (max-width: 1050px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { position: static; width: 100%; height: auto; padding: 16px; flex-direction: row; align-items: center; gap: 12px; }
  .sidebar nav { display: none; } .sidebar-footer { margin: 0 0 0 auto; padding: 0; border: 0; } .sidebar-footer span, .sidebar-footer button:not(#logoutButton) { display: none; }
  main { padding: 24px 14px 45px; } .topbar { align-items: flex-end; } .topbar h1 { font-size: 24px; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; } .stat-card { min-height: 130px; padding: 16px; }
  .panel-heading { align-items: stretch; flex-direction: column; } .toolbar input { width: 100%; }
  .field-row { grid-template-columns: 1fr; gap: 0; }
}
@media (max-width: 480px) { .stats-grid { grid-template-columns: 1fr; } .brand span { display: none; } .topbar { align-items: stretch; flex-direction: column; } }
