/* ─────────── Design tokens ─────────── */
:root {
  --bg: hsl(225 30% 6%);
  --bg-2: hsl(225 28% 9%);
  --panel: hsla(225 30% 14% / .55);
  --panel-solid: hsl(225 28% 12%);
  --line: hsla(220 40% 80% / .09);
  --line-2: hsla(220 40% 80% / .16);
  --text: hsl(220 30% 96%);
  --text-2: hsl(220 15% 70%);
  --text-3: hsl(220 12% 50%);
  --cyan: hsl(189 94% 55%);
  --indigo: hsl(239 84% 67%);
  --violet: hsl(262 83% 66%);
  --green: hsl(158 72% 45%);
  --amber: hsl(38 95% 56%);
  --red: hsl(0 84% 63%);
  --grad: linear-gradient(135deg, var(--cyan), var(--indigo) 60%, var(--violet));
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 20px 60px -20px hsla(230 60% 2% / .8), 0 0 0 1px var(--line);
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; max-width: 100vw; overflow-x: hidden; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: radial-gradient(1200px 800px at 10% -10%, hsl(230 50% 12%), transparent 60%), var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
.muted { color: var(--text-2); }
.dim { color: var(--text-3); }
.mono { font-family: var(--mono); letter-spacing: .02em; }
a { color: var(--cyan); text-decoration: none; }
::selection { background: hsla(189 94% 55% / .3); }

/* Background orbs */
.bg-orbs { position: fixed; inset: 0; overflow: hidden; z-index: -1; pointer-events: none; }
.bg-orbs span { position: absolute; border-radius: 50%; filter: blur(90px); opacity: .35; animation: float 22s ease-in-out infinite; }
.bg-orbs span:nth-child(1) { width: 520px; height: 520px; background: hsl(189 94% 40%); top: -160px; right: -120px; }
.bg-orbs span:nth-child(2) { width: 460px; height: 460px; background: hsl(250 80% 50%); bottom: -180px; left: 10%; animation-delay: -8s; }
.bg-orbs span:nth-child(3) { width: 300px; height: 300px; background: hsl(290 70% 45%); top: 40%; right: 30%; opacity: .18; animation-delay: -15s; }
@keyframes float { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(40px,-30px) scale(1.08); } }

.glass {
  background: var(--panel);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ─────────── Icons (CSS masks) ─────────── */
.ic { display: inline-block; width: 18px; height: 18px; background: currentColor; flex: none;
  -webkit-mask: var(--i) center / contain no-repeat; mask: var(--i) center / contain no-repeat; }
.ic-grid  { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Crect x='3' y='3' width='7' height='7' rx='2'/%3E%3Crect x='14' y='3' width='7' height='7' rx='2'/%3E%3Crect x='3' y='14' width='7' height='7' rx='2'/%3E%3Crect x='14' y='14' width='7' height='7' rx='2'/%3E%3C/svg%3E"); }
.ic-plus  { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 8v8M8 12h8'/%3E%3C/svg%3E"); }
.ic-key   { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='8' cy='15' r='4'/%3E%3Cpath d='m10.8 12.2 9.2-9.2M17 6l3 3M14 9l2 2'/%3E%3C/svg%3E"); }
.ic-users { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='9' cy='8' r='4'/%3E%3Cpath d='M2 21c0-4 3-6 7-6s7 2 7 6M16 4a4 4 0 0 1 0 8M22 21c0-3-1.5-5-4-5.6'/%3E%3C/svg%3E"); }
.ic-check { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 2 4 5v6c0 5 3.4 9.7 8 11 4.6-1.3 8-6 8-11V5l-8-3Z'/%3E%3Cpath d='m9 12 2 2 4-4'/%3E%3C/svg%3E"); }
.ic-clock { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v5l3 2'/%3E%3C/svg%3E"); }
.ic-dl    { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3v12m0 0-4-4m4 4 4-4M4 19h16'/%3E%3C/svg%3E"); }
.ic-copy  { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Crect x='9' y='9' width='12' height='12' rx='2'/%3E%3Cpath d='M5 15V5a2 2 0 0 1 2-2h10'/%3E%3C/svg%3E"); }
.ic-renew { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 12a9 9 0 0 1 15.5-6.3L21 8M21 3v5h-5M21 12a9 9 0 0 1-15.5 6.3L3 16M3 21v-5h5'/%3E%3C/svg%3E"); }
.ic-x     { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6 6 18'/%3E%3C/svg%3E"); }
.ic-search{ --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E"); }
.ic-hourglass { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 2h12M6 22h12M7 2v4a5 5 0 0 0 10 0V2M7 22v-4a5 5 0 0 1 10 0v4'/%3E%3C/svg%3E"); }
.ic-alert { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10.3 3.9 1.8 18a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0Z'/%3E%3Cpath d='M12 9v4M12 17h.01'/%3E%3C/svg%3E"); }
.ic-ban { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='m5.6 5.6 12.8 12.8'/%3E%3C/svg%3E"); }
.ic-chart { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M3 3v18h18'/%3E%3Cpath d='M8 16v-4M13 16V8M18 16v-7'/%3E%3C/svg%3E"); }
.ic-history { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 12a9 9 0 1 0 3-6.7L3 8'/%3E%3Cpath d='M3 3v5h5M12 7v5l4 2'/%3E%3C/svg%3E"); }
.ic-phone { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Crect x='6' y='2' width='12' height='20' rx='2.5'/%3E%3Cpath d='M11 18h2'/%3E%3C/svg%3E"); }
.ic-sparkle { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round'%3E%3Cpath d='M12 3l1.9 5.1L19 10l-5.1 1.9L12 17l-1.9-5.1L5 10l5.1-1.9L12 3Z'/%3E%3Cpath d='M19 15l.8 2.2L22 18l-2.2.8L19 21l-.8-2.2L16 18l2.2-.8L19 15Z'/%3E%3C/svg%3E"); }
.ic-ok { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='m8 12 3 3 5-6'/%3E%3C/svg%3E"); }
.ic-fail { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='m9 9 6 6M15 9l-6 6'/%3E%3C/svg%3E"); }
.ic-upload { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 15V3m0 0L8 7m4-4 4 4M4 15v4a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-4'/%3E%3C/svg%3E"); }
.ic-file { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8l-6-6Z'/%3E%3Cpath d='M14 2v6h6M9 13h6M9 17h4'/%3E%3C/svg%3E"); }
.ic-timer { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='14' r='8'/%3E%3Cpath d='M12 10v4l2 2M10 2h4'/%3E%3C/svg%3E"); }
.ic-infinity { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M12 12c-2-2.7-4-4-6-4a4 4 0 0 0 0 8c2 0 4-1.3 6-4Zm0 0c2 2.7 4 4 6 4a4 4 0 0 0 0-8c-2 0-4 1.3-6 4Z'/%3E%3C/svg%3E"); }
.ic-login { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4M10 17l5-5-5-5M15 12H3'/%3E%3C/svg%3E"); }
.ic-user-plus { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='9' cy='8' r='4'/%3E%3Cpath d='M2 21c0-4 3-6 7-6s7 2 7 6M19 8v6M16 11h6'/%3E%3C/svg%3E"); }
.ic-edit { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 20h9M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z'/%3E%3C/svg%3E"); }
.ic-trash { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 6h18M8 6V4h8v2M6 6l1 14a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2l1-14M10 11v6M14 11v6'/%3E%3C/svg%3E"); }
.ic-save { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2Z'/%3E%3Cpath d='M17 21v-8H7v8M7 3v5h8'/%3E%3C/svg%3E"); }
.ic.sm { width: 14px; height: 14px; }
.ic.lg { width: 22px; height: 22px; }
.ic.xl { width: 40px; height: 40px; }
.c-green { color: var(--green); } .c-amber { color: var(--amber); } .c-red { color: var(--red); } .c-cyan { color: var(--cyan); } .c-violet { color: hsl(262 90% 78%); } .c-dim { color: var(--text-3); }
.card h2 .ic { color: var(--cyan); }
.alert.has-ic { display: flex; gap: 10px; align-items: flex-start; }
.alert.has-ic > .ic { margin-top: 1px; }
.seg button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.seg button .ic { width: 16px; height: 16px; }
.key-chip { display: flex; align-items: center; justify-content: center; gap: 6px; }
.success h3 .ic { color: var(--green); }
.success.bad { background: linear-gradient(135deg, hsla(0 84% 63% / .1), hsla(0 84% 63% / .03)); border-color: hsla(0 84% 63% / .3); }
.success.bad h3, .success.bad h3 .ic { color: var(--red); }
.drop .ic.xl { color: var(--cyan); }
.empty .ic.xl { opacity: .8; }
.audit-act { display: inline-flex; align-items: center; gap: 8px; }

/* ─────────── Login ─────────── */
.login { min-height: 100%; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(400px, 100%); padding: 40px 32px; text-align: center; animation: rise .5s cubic-bezier(.2,.8,.2,1); }
.login-card h1 { margin: 18px 0 4px; font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.login-card .muted { margin: 0 0 28px; }
.login-card .field { text-align: left; }
@keyframes rise { from { opacity: 0; transform: translateY(16px) scale(.98); } to { opacity: 1; transform: none; } }

.brand-mark { width: 38px; height: 38px; border-radius: 11px; background: var(--grad); display: grid; place-items: center; box-shadow: 0 8px 24px -6px hsla(220 90% 60% / .6); flex: none; }
.brand-mark svg { width: 22px; height: 22px; fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.brand-mark.lg { width: 64px; height: 64px; border-radius: 18px; margin: 0 auto; }
.brand-mark.lg svg { width: 34px; height: 34px; }

/* ─────────── Shell ─────────── */
.shell { display: grid; grid-template-columns: 252px 1fr; min-height: 100vh; gap: 0; }
.sidebar { position: sticky; top: 12px; margin: 12px; height: calc(100vh - 24px); display: flex; flex-direction: column; padding: 18px 14px; }
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 6px 22px; }
.brand strong { display: block; font-size: 15px; letter-spacing: -.01em; }
.brand small { color: var(--text-3); font-size: 12px; }
#nav { display: flex; flex-direction: column; gap: 4px; }
#nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--text-2); font-weight: 500; transition: .18s; position: relative; }
#nav a:hover { color: var(--text); background: hsla(220 40% 80% / .06); }
#nav a.active { color: var(--text); background: linear-gradient(90deg, hsla(189 94% 55% / .16), hsla(239 84% 67% / .08)); }
#nav a.active::before { content: ''; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--grad); }
#nav a.active .ic { color: var(--cyan); }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.key-chip { font-family: var(--mono); font-size: 11px; color: var(--text-3); padding: 8px 10px; border: 1px dashed var(--line-2); border-radius: 8px; text-align: center; }

.content { padding: 28px 32px 60px 20px; min-width: 0; animation: fade .35s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 26px; font-weight: 800; letter-spacing: -.025em; }
.page-head p { margin: 4px 0 0; color: var(--text-2); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

/* ─────────── Cards / stats ─────────── */
.grid { display: grid; gap: 16px; }
.stats { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin-bottom: 20px; }
.stat { padding: 18px 20px; position: relative; overflow: hidden; transition: transform .2s, border-color .2s; }
.stat:hover { transform: translateY(-2px); border-color: var(--line-2); }
.stat .label { color: var(--text-2); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; }
.stat .value { font-size: 30px; font-weight: 800; letter-spacing: -.03em; margin-top: 6px; }
.stat .glow { position: absolute; right: -30px; top: -30px; width: 110px; height: 110px; border-radius: 50%; filter: blur(30px); opacity: .35; background: var(--c, var(--cyan)); }
.stat .value small { font-size: 13px; color: var(--text-3); font-weight: 600; margin-left: 6px; letter-spacing: 0; }

.card { padding: 20px; }
.card h2 { margin: 0 0 14px; font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.two-col { grid-template-columns: 1.4fr 1fr; }
@media (max-width: 1100px) { .two-col { grid-template-columns: 1fr; } }

/* Chart */
.chart { display: flex; align-items: flex-end; gap: 14px; height: 170px; padding: 10px 4px 0; }
.bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }
.bar .fill { width: 100%; max-width: 46px; border-radius: 8px 8px 4px 4px; background: var(--grad); min-height: 4px; transition: height .6s cubic-bezier(.2,.8,.2,1); box-shadow: 0 6px 20px -6px hsla(220 90% 60% / .6); position: relative; }
.bar .fill span { position: absolute; top: -20px; left: 0; right: 0; text-align: center; font-size: 11px; font-weight: 700; color: var(--text-2); }
.bar small { color: var(--text-3); font-size: 11px; }

/* ─────────── Tables ─────────── */
/* ─────────── Tables ─────────── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; min-width: max-content; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 14px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
tbody tr { transition: background .15s; }
tbody tr:hover { background: hsla(220 40% 80% / .04); }
tbody tr.clickable { cursor: pointer; }
tr:last-child td { border-bottom: 0; }
.empty { text-align: center; padding: 40px 12px; color: var(--text-3); white-space: normal; }
.cell-main { font-weight: 600; font-size: 14.5px; }
.cell-sub { color: var(--text-3); font-size: 13px; margin-top: 4px; }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.b-active     { color: var(--green); background: hsla(158 72% 45% / .12); border-color: hsla(158 72% 45% / .25); }
.b-expiring   { color: var(--amber); background: hsla(38 95% 56% / .12); border-color: hsla(38 95% 56% / .25); }
.b-expired    { color: var(--red);   background: hsla(0 84% 63% / .12);  border-color: hsla(0 84% 63% / .25); }
.b-revoked    { color: hsl(0 0% 65%); background: hsla(0 0% 60% / .1); border-color: hsla(0 0% 60% / .2); text-decoration: line-through; }
.b-superseded { color: var(--text-3); background: hsla(220 20% 60% / .08); border-color: var(--line); }
.b-none, .b-invalid { color: var(--text-3); background: transparent; border-color: var(--line-2); }
.b-invalid { color: var(--red); }
.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 700; letter-spacing: .04em; }
.tag-perm { background: hsla(262 83% 66% / .15); color: hsl(262 90% 78%); }
.tag-exp  { background: hsla(189 94% 55% / .12); color: var(--cyan); }
.tag-imp  { background: hsla(220 20% 60% / .12); color: var(--text-2); }

/* ─────────── Forms ─────────── */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: 12px; font-weight: 600; color: var(--text-2); letter-spacing: .02em; }
.field .hint { font-size: 12px; color: var(--text-3); }
input, select, textarea {
  font: inherit; color: var(--text); background: hsla(225 30% 6% / .6); border: 1px solid var(--line-2);
  border-radius: var(--radius-sm); padding: 11px 13px; outline: none; transition: border-color .15s, box-shadow .15s; width: 100%;
}
textarea { resize: vertical; min-height: 80px; }
input:focus, select:focus, textarea:focus { border-color: hsla(189 94% 55% / .6); box-shadow: 0 0 0 4px hsla(189 94% 55% / .12); }
input.device-input { font-family: var(--mono); font-size: 18px; letter-spacing: .12em; text-transform: uppercase; text-align: center; padding: 14px; }
.search { position: relative; min-width: 260px; }
.search .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); width: 16px; height: 16px; }
.search input { padding-left: 36px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 720px) { .form-grid { grid-template-columns: 1fr; } }
.checkbox { display: flex; align-items: center; gap: 10px; cursor: pointer; color: var(--text-2); margin: 4px 0 14px; }
.checkbox input { width: 18px; height: 18px; accent-color: var(--cyan); }
.error-text { color: var(--red); min-height: 20px; margin: 0 0 10px; font-size: 13px; }

/* Segmented control */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; padding: 5px; background: hsla(225 30% 6% / .6); border: 1px solid var(--line-2); border-radius: 12px; }
.seg button { font: inherit; border: 0; background: transparent; color: var(--text-2); padding: 10px 8px; border-radius: 8px; cursor: pointer; font-weight: 600; transition: .18s; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--grad); color: #fff; box-shadow: 0 6px 18px -6px hsla(220 90% 60% / .7); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { font: inherit; font-size: 13px; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line-2); background: transparent; color: var(--text-2); cursor: pointer; transition: .15s; font-weight: 500; }
.chip:hover { border-color: hsla(189 94% 55% / .5); color: var(--text); }
.chip.on { border-color: var(--cyan); color: var(--cyan); background: hsla(189 94% 55% / .1); }

/* Buttons */
.btn { font: inherit; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; border-radius: var(--radius-sm); border: 1px solid var(--line-2); background: hsla(220 40% 80% / .05); color: var(--text); cursor: pointer; transition: transform .12s, background .15s, border-color .15s, box-shadow .2s; white-space: nowrap; }
.btn:hover { background: hsla(220 40% 80% / .1); border-color: hsla(220 40% 80% / .25); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--grad); border: 0; color: #fff; box-shadow: 0 10px 30px -10px hsla(220 90% 60% / .8); }
.btn.primary:hover { box-shadow: 0 14px 36px -10px hsla(220 90% 60% / 1); filter: brightness(1.08); }
.btn.danger { color: var(--red); border-color: hsla(0 84% 63% / .3); background: hsla(0 84% 63% / .06); }
.btn.danger:hover { background: hsla(0 84% 63% / .14); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 6px 10px; font-size: 12px; border-radius: 8px; }
.btn.icon { padding: 7px; }
.btn.block { width: 100%; }
.btn .ic { width: 16px; height: 16px; }

/* Token box */
.token { font-family: var(--mono); font-size: 11.5px; word-break: break-all; padding: 14px; border-radius: var(--radius-sm); background: hsla(225 30% 4% / .7); border: 1px solid var(--line); color: var(--text-2); max-height: 140px; overflow: auto; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 10px 16px; margin: 0; }
.kv dt { color: var(--text-3); font-size: 13px; }
.kv dd { margin: 0; font-weight: 500; }

/* Success panel */
.success { padding: 24px; border-radius: var(--radius); background: linear-gradient(135deg, hsla(158 72% 45% / .12), hsla(189 94% 55% / .06)); border: 1px solid hsla(158 72% 45% / .3); animation: rise .4s cubic-bezier(.2,.8,.2,1); }
.success h3 { margin: 0 0 14px; color: var(--green); display: flex; align-items: center; gap: 8px; }

/* Drop zone */
.drop { border: 2px dashed var(--line-2); border-radius: var(--radius); padding: 28px; text-align: center; color: var(--text-2); transition: .2s; cursor: pointer; }
.drop:hover, .drop.over { border-color: var(--cyan); background: hsla(189 94% 55% / .06); color: var(--text); }
.drop strong { color: var(--text); }

/* ─────────── Modal ─────────── */
.modal-back { position: fixed; inset: 0; background: hsla(225 40% 3% / .65); backdrop-filter: blur(6px); display: grid; place-items: center; padding: 20px; z-index: 50; animation: fadeIn .2s; }
.modal { width: min(560px, 100%); max-height: 90vh; overflow: auto; background: var(--panel-solid); border: 1px solid var(--line-2); border-radius: 20px; box-shadow: 0 40px 100px -20px #000; animation: pop .25s cubic-bezier(.2,.9,.3,1.2); display: flex; flex-direction: column; }
.modal.wide { width: min(880px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel-solid); z-index: 1; flex: none; }
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-body { padding: 22px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--line); flex: none; position: sticky; bottom: 0; background: var(--panel-solid); }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.94) translateY(10px); } }

/* Toast */
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 100; }
.toast { padding: 12px 16px; border-radius: 12px; background: var(--panel-solid); border: 1px solid var(--line-2); box-shadow: var(--shadow); min-width: 240px; max-width: 380px; animation: slideIn .3s cubic-bezier(.2,.8,.2,1); border-left: 3px solid var(--cyan); }
.toast.ok { border-left-color: var(--green); }
.toast.err { border-left-color: var(--red); }
.toast.out { animation: slideOut .25s forwards; }
@keyframes slideIn { from { opacity: 0; transform: translateX(30px); } }
@keyframes slideOut { to { opacity: 0; transform: translateX(30px); } }

.alert { padding: 12px 14px; border-radius: 10px; font-size: 13px; margin-bottom: 14px; border: 1px solid; }
.alert.warn { color: hsl(38 95% 70%); background: hsla(38 95% 56% / .08); border-color: hsla(38 95% 56% / .25); }
.alert.info { color: hsl(189 80% 75%); background: hsla(189 94% 55% / .06); border-color: hsla(189 94% 55% / .2); }

.skeleton { height: 14px; border-radius: 6px; background: linear-gradient(90deg, var(--line) 25%, var(--line-2) 50%, var(--line) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ─────────── Responsive ─────────── */
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; margin: 10px; padding: 14px; }
  #nav { flex-direction: row; overflow-x: auto; -ms-overflow-style: none; scrollbar-width: none; scroll-snap-type: x mandatory; }
  #nav::-webkit-scrollbar { display: none; }
  #nav a { white-space: nowrap; scroll-snap-align: start; }
  #nav a.active::before { display: none; }
  .sidebar-foot { flex-direction: row; margin-top: 12px; }
  .content { padding: 10px 16px 40px; }
  .search { min-width: 0; flex: 1; }
  .page-head { flex-direction: column; align-items: flex-start; gap: 12px; }
}
@media (max-width: 600px) {
  .modal-back { padding: 0; align-items: flex-end; }
  .modal { border-radius: 24px 24px 0 0; border-bottom: 0; max-height: 85vh; animation: slideUp .3s cubic-bezier(.2,.8,.2,1); }
  .toasts { right: 10px; left: 10px; bottom: 10px; align-items: stretch; }
  .toast { max-width: none; min-width: 0; }
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { padding: 14px 16px; }
  .stat .value { font-size: 24px; }
  .card { padding: 16px; border-radius: 12px; }
  .page-head h1 { font-size: 22px; }
  .badge { font-size: 11.5px; padding: 4px 10px; }
  input, select, textarea { padding: 13px 14px; font-size: 15px; } /* Prevents iOS auto-zoom */
  .lite-strip { flex-wrap: wrap !important; gap: 10px !important; }
  .lite-strip > span { flex: 1 1 40%; }
  .lite-strip .spacer { display: none; }

  /* Transform tables into beautiful cards on mobile */
  .table-wrap { overflow-x: visible; }
  table, thead, tbody, th, td, tr { display: block; width: 100%; min-width: 0; }
  thead { display: none; }
  tbody tr { 
    margin-bottom: 14px; 
    border: 1px solid var(--line); 
    border-radius: 14px; 
    background: hsla(220 40% 80% / .02); 
    padding: 14px; 
    box-shadow: 0 4px 16px -4px hsla(230 60% 2% / .5);
  }
  tbody tr:hover { background: hsla(220 40% 80% / .05); transform: translateY(-1px); }
  td { 
    padding: 8px 0; 
    border-bottom: 1px dashed var(--line); 
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
    text-align: right; 
    white-space: normal; 
    gap: 12px;
  }
  td:last-child { border-bottom: none; padding-bottom: 0; justify-content: flex-end; }
  /* Emphasize the first column as the card header */
  td:first-child { 
    padding-top: 0; 
    display: block; 
    text-align: left; 
    border-bottom: 1px solid var(--line-2); 
    margin-bottom: 4px; 
    padding-bottom: 12px;
  }
  td:first-child .cell-main { font-size: 16px; color: var(--cyan); }
  td:first-child .cell-sub { font-size: 13.5px; opacity: .8; }
}
@keyframes slideUp { from { opacity: 0; transform: translateY(100px); } }

/* ───────── Lite ───────── */
.b-unused { color: var(--cyan); background: hsla(189 94% 55% / .1); border-color: hsla(189 94% 55% / .25); }
.tag-lite { background: hsla(280 85% 65% / .15); color: hsl(280 90% 80%); }
.ic-bolt { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M13 2 3 14h9l-1 8 10-12h-9l1-8Z'/%3E%3C/svg%3E"); }
.ic-unlink { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='5' y='2' width='14' height='20' rx='2'/%3E%3Cpath d='M9 9l6 6M15 9l-6 6'/%3E%3C/svg%3E"); }
.ic-undo { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 14 4 9l5-5'/%3E%3Cpath d='M4 9h10.5a5.5 5.5 0 0 1 0 11H11'/%3E%3C/svg%3E"); }
.lite-key { font-family: 'JetBrains Mono', monospace; font-weight: 600; letter-spacing: .06em; font-size: 14px; color: var(--text); }
.lite-key.big { font-size: 20px; letter-spacing: .1em; }
.key-list { display: grid; gap: 8px; margin: 14px 0; }
.key-list .key-row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; background: hsla(222 40% 8% / .5); }
.key-list .key-row .lite-key { flex: 1; }
.mini-stats { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.mini-stats .ms { padding: 10px 16px; border: 1px solid var(--line); border-radius: 12px; background: hsla(222 40% 10% / .5); min-width: 120px; }
.mini-stats .ms b { display: block; font-size: 22px; color: var(--c, var(--text)); }
.mini-stats .ms span { font-size: 12px; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; }
/* Lite requests */
.nav-badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--amber); color: #1a1205; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; animation: pulseBadge 2s infinite; }
@keyframes pulseBadge { 0%,100% { box-shadow: 0 0 0 0 hsla(38 95% 56% / .5); } 50% { box-shadow: 0 0 0 6px hsla(38 95% 56% / 0); } }
.b-pending  { color: var(--amber); background: hsla(38 95% 56% / .12); border-color: hsla(38 95% 56% / .3); }
.b-approved { color: var(--green); background: hsla(158 72% 45% / .12); border-color: hsla(158 72% 45% / .25); }
.b-rejected { color: var(--red); background: hsla(0 84% 63% / .1); border-color: hsla(0 84% 63% / .25); }
.req-list { display: grid; gap: 12px; }
.req { display: grid; grid-template-columns: 44px 1fr auto; gap: 14px; align-items: center; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line); background: hsla(220 40% 80% / .03); transition: .18s; }
.req:hover { border-color: var(--line-2); background: hsla(220 40% 80% / .05); }
.req.pending { border-color: hsla(38 95% 56% / .35); background: linear-gradient(90deg, hsla(38 95% 56% / .08), transparent 60%); }
.req-av { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; font-size: 17px; color: #fff; background: linear-gradient(135deg, hsl(262 83% 60%), hsl(280 85% 55%)); }
.req-main .cell-main { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.req-msg { margin-top: 6px; font-size: 13px; color: var(--text-2); font-style: italic; }
.req-act { display: flex; gap: 8px; align-items: center; }
.tabs-line { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin: 6px 0 16px; }
.tabs-line button { background: none; border: 0; color: var(--text-2); padding: 10px 14px; font: inherit; font-weight: 600; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; display: inline-flex; gap: 8px; align-items: center; }
.tabs-line button.on { color: var(--text); border-bottom-color: var(--cyan); }
.tabs-line .cnt { font-size: 11px; padding: 1px 7px; border-radius: 9px; background: hsla(220 40% 80% / .1); }
.tabs-line .cnt.hot { background: var(--amber); color: #1a1205; }
@media (max-width: 720px) { .req { grid-template-columns: 1fr; } .req-av { display: none; } }
.ic-inbox { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 12h-6l-2 3h-4l-2-3H2'/%3E%3Cpath d='M5.5 5h13l3.5 7v6a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-6z'/%3E%3C/svg%3E"); }
