/* ═══════════════════════════════════════════════════════════════════════════
   LibTool Key Server v3.0 — Premium Dark Dashboard
   Inspired by Tabler, shadcn/ui, AdminLTE Dark
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  /* Base colors — zinc/slate inspired */
  --bg-base: #09090b;
  --bg-surface: #0c0c0f;
  --bg-card: #131316;
  --bg-elevated: #1a1a1f;
  --bg-hover: #222228;
  --bg-input: #0e0e12;
  --bg-sidebar: #0c0c0f;

  /* Borders */
  --border: rgba(255,255,255,0.06);
  --border-light: rgba(255,255,255,0.1);
  --border-accent: rgba(99,102,241,0.3);

  /* Text */
  --text-primary: #fafafa;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --text-dim: #52525b;

  /* Accent — Indigo */
  --accent: #6366f1;
  --accent-light: #818cf8;
  --accent-dark: #4f46e5;
  --accent-bg: rgba(99,102,241,0.1);
  --accent-glow: rgba(99,102,241,0.25);

  /* Semantic colors */
  --green: #22c55e;
  --green-bg: rgba(34,197,94,0.1);
  --green-border: rgba(34,197,94,0.2);
  --red: #ef4444;
  --red-bg: rgba(239,68,68,0.1);
  --red-border: rgba(239,68,68,0.2);
  --orange: #f59e0b;
  --orange-bg: rgba(245,158,11,0.1);
  --orange-border: rgba(245,158,11,0.2);
  --blue: #3b82f6;
  --blue-bg: rgba(59,130,246,0.1);
  --blue-border: rgba(59,130,246,0.2);
  --purple: #a855f7;
  --purple-bg: rgba(168,85,247,0.1);
  --purple-border: rgba(168,85,247,0.2);
  --cyan: #06b6d4;
  --yellow: #eab308;

  /* Layout */
  --radius: 10px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --radius-full: 9999px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow: 0 4px 16px rgba(0,0,0,0.3);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.4);
  --shadow-accent: 0 4px 20px var(--accent-glow);
  --transition: all 0.2s cubic-bezier(0.4,0,0.2,1);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'SF Mono', SFMono-Regular, 'Cascadia Code', 'Fira Code', Consolas, monospace;
  --sidebar-width: 260px;
  --sidebar-collapsed: 68px;
  --topbar-height: 56px;
}

/* ═══ RESET ═══ */

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font);
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection { background: var(--accent); color: #fff; }
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 100px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.15); }

/* ═══ LOGIN PAGE ═══ */

.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  position: relative;
  overflow: hidden;
}

.login-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: var(--bg-base);
}

.login-bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse 60% 60% at 50% 50%, black 30%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse 60% 60% at 50% 50%, black 30%, transparent 70%);
}

.login-bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  animation: floatOrb 10s ease-in-out infinite;
}

.orb-1 { width: 400px; height: 400px; background: rgba(99,102,241,0.12); top: 5%; left: 10%; }
.orb-2 { width: 300px; height: 300px; background: rgba(168,85,247,0.08); bottom: 10%; right: 15%; animation-delay: -3s; }
.orb-3 { width: 200px; height: 200px; background: rgba(6,182,212,0.06); top: 60%; left: 55%; animation-delay: -6s; }
.orb-4 { width: 250px; height: 250px; background: rgba(34,197,94,0.05); top: 20%; right: 30%; animation-delay: -4s; }

@keyframes floatOrb {
  0%,100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-40px) scale(1.08); }
}

.login-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  padding: 20px;
}

.login-card {
  background: rgba(19,19,22,0.85);
  backdrop-filter: blur(24px) saturate(150%);
  -webkit-backdrop-filter: blur(24px) saturate(150%);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  padding: 40px 32px;
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(255,255,255,0.03) inset;
}

.login-logo { text-align: center; margin-bottom: 32px; }

.logo-icon-wrap { position: relative; width: 80px; height: 80px; margin: 0 auto 18px; }

.logo-ring {
  position: absolute;
  inset: -4px;
  border-radius: 22px;
  border: 2px solid transparent;
  background: linear-gradient(135deg, var(--accent), var(--purple), var(--cyan)) border-box;
  -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: ringRotate 4s linear infinite;
}

@keyframes ringRotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.logo-glow {
  width: 72px;
  height: 72px;
  margin: 4px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  color: #fff;
  box-shadow: var(--shadow-accent);
}

.login-logo h1 {
  font-size: 26px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.5px;
}

.login-subtitle {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 4px;
  font-weight: 400;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.login-security {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
  padding: 10px 14px;
  background: rgba(255,255,255,0.02);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-muted);
}

.login-security i { color: var(--green); font-size: 12px; }

.login-footer {
  text-align: center;
  color: var(--text-dim);
  font-size: 12px;
  margin-top: 20px;
}

.error-msg {
  margin-top: 14px;
  padding: 12px 16px;
  background: var(--red-bg);
  border: 1px solid var(--red-border);
  border-radius: var(--radius-sm);
  color: var(--red);
  font-size: 13px;
  text-align: center;
}

.shake {
  animation: shakeAnim 0.5s ease-in-out;
}

@keyframes shakeAnim {
  0%,100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  50% { transform: translateX(8px); }
  75% { transform: translateX(-4px); }
}

/* ═══ FORMS ═══ */

.form-group { margin-bottom: 16px; }

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-group label i { margin-right: 6px; font-size: 11px; opacity: 0.6; }
.form-label-sm { font-size: 12px; color: var(--text-muted); margin-bottom: 10px; display: block; font-weight: 500; }

.input-wrap {
  position: relative;
}

.input-icon-btn {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 8px 10px;
  border-radius: var(--radius-xs);
  font-size: 14px;
  transition: var(--transition);
}

.input-icon-btn:hover { color: var(--text-primary); background: rgba(255,255,255,0.05); }

.form-group input, .form-group select, .select-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 14px;
  transition: var(--transition);
  outline: none;
}

.form-group input:focus, .form-group select:focus, .select-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-group input::placeholder { color: var(--text-dim); }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ═══ BUTTONS ═══ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
}

.btn i { font-size: 12px; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }
.btn-full { width: 100%; }
.btn-sm { padding: 7px 14px; font-size: 12px; }
.btn-xs { padding: 5px 10px; font-size: 11px; }

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3), 0 0 0 1px rgba(99,102,241,0.2) inset;
}
.btn-primary:hover { background: var(--accent-dark); transform: translateY(-1px); box-shadow: var(--shadow-accent); }

.btn-glow { animation: pulseGlow 3s ease-in-out infinite; }
@keyframes pulseGlow {
  0%,100% { box-shadow: 0 1px 3px rgba(0,0,0,0.3), 0 0 0 1px rgba(99,102,241,0.2) inset; }
  50% { box-shadow: 0 4px 24px var(--accent-glow), 0 0 0 1px rgba(99,102,241,0.2) inset; }
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg-hover); border-color: var(--border-light); }

.btn-danger {
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid var(--red-border);
}
.btn-danger:hover { background: rgba(239,68,68,0.18); }

.btn-warning {
  background: var(--orange-bg);
  color: var(--orange);
  border: 1px solid var(--orange-border);
}
.btn-warning:hover { background: rgba(245,158,11,0.18); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg-elevated); color: var(--text-primary); border-color: var(--border-light); }

.btn-glass {
  background: rgba(255,255,255,0.04);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-glass:hover { background: rgba(255,255,255,0.08); color: var(--text-primary); border-color: var(--border-light); }

.btn-chip {
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--radius-full);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-chip:hover { border-color: var(--accent); color: var(--accent-light); }
.btn-chip.active {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 2px 8px var(--accent-glow);
}

/* ═══ LAYOUT ═══ */

.app { display: flex; min-height: 100vh; }

/* ─── Sidebar ─── */

.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: width 0.25s ease;
}

.sidebar.collapsed { width: var(--sidebar-collapsed); }

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  height: var(--topbar-height);
  border-bottom: 1px solid var(--border);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}

.sidebar-logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 15px;
  flex-shrink: 0;
}

.logo-text {
  font-size: 18px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent-light), #c084fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  white-space: nowrap;
  transition: opacity 0.2s;
}

.sidebar.collapsed .logo-text { opacity: 0; width: 0; }

.sidebar-collapse-btn {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  transition: var(--transition);
  flex-shrink: 0;
}

.sidebar-collapse-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.sidebar.collapsed .sidebar-collapse-btn i { transform: rotate(180deg); }

.sidebar-menu { flex: 1; overflow-y: auto; padding: 8px 0; }

.menu-label {
  padding: 16px 20px 6px;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-dim);
  letter-spacing: 1.2px;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar.collapsed .menu-label { font-size: 0; padding: 10px 0; }

.nav-links { list-style: none; padding: 0 8px; }

.nav-links li {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: var(--transition);
  margin-bottom: 2px;
  position: relative;
}

.nav-links li:hover { background: rgba(255,255,255,0.04); color: var(--text-primary); }

.nav-links li.active {
  background: var(--accent-bg);
  color: var(--accent-light);
}

.nav-links li.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 50%;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}

.nav-icon { font-size: 15px; width: 20px; text-align: center; flex-shrink: 0; }

.nav-badge {
  margin-left: auto;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 700;
  background: var(--accent-bg);
  color: var(--accent-light);
  border-radius: var(--radius-full);
  border: 1px solid rgba(99,102,241,0.15);
}

.sidebar.collapsed .nav-links li span:not(.nav-icon):not(.nav-badge) { display: none; }
.sidebar.collapsed .nav-links li .nav-badge { display: none; }
.sidebar.collapsed .nav-links li { justify-content: center; padding: 12px; }
.sidebar.collapsed .nav-links li.active::before { display: none; }

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border);
}

.admin-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  margin-bottom: 8px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.02);
}

.admin-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--accent-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-light);
  font-size: 13px;
  flex-shrink: 0;
}

.admin-info { overflow: hidden; }

.admin-name { display: block; font-size: 13px; font-weight: 600; color: var(--text-primary); white-space: nowrap; }
.admin-role { display: block; font-size: 11px; color: var(--text-muted); white-space: nowrap; }

.sidebar.collapsed .admin-info { display: none; }
.sidebar.collapsed .sidebar-footer .btn span { display: none; }

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 99;
}

/* ─── Top Bar ─── */

.topbar {
  display: flex;
  align-items: center;
  height: var(--topbar-height);
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
  margin: 0 0 24px;
  border-radius: 0;
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.topbar-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-xs);
  margin-right: 12px;
}

.topbar-menu-btn:hover { background: rgba(255,255,255,0.05); }

.topbar-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
}

.topbar-breadcrumb i { font-size: 12px; }
.topbar-breadcrumb span { color: var(--text-secondary); font-weight: 500; }

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-time {
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--mono);
  font-weight: 500;
}

/* ─── Main Content ─── */

.content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  transition: margin-left 0.25s ease;
}

.sidebar.collapsed ~ .content { margin-left: var(--sidebar-collapsed); }

/* ═══ PAGES ═══ */

.page { display: none; padding: 0 24px 40px; }
.page.active { display: block; animation: fadeUp 0.3s ease; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 14px;
}

.page-header h2 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text-primary);
}

.page-subtitle {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 2px;
}

.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

/* ═══ CARDS ═══ */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: var(--transition);
}

.card:hover { border-color: rgba(255,255,255,0.08); }

.card-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
}

.card-header h3 i { margin-right: 8px; color: var(--accent); font-size: 13px; }

.card-body { padding: 18px; }
.card-body.no-padding { padding: 0; }

/* ═══ STATS ═══ */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--text-muted);
  opacity: 0.3;
}

.stat-card:hover { transform: translateY(-2px); border-color: var(--border-light); box-shadow: var(--shadow-sm); }

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  background: rgba(255,255,255,0.04);
  color: var(--text-muted);
}

.stat-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; }
.stat-value { font-size: 26px; font-weight: 800; letter-spacing: -0.5px; margin-top: 2px; }

.stat-trend {
  position: absolute;
  top: 12px;
  right: 14px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.stat-card[data-color="green"]::after { background: var(--green); }
.stat-card[data-color="green"] .stat-icon { background: var(--green-bg); color: var(--green); }
.stat-card[data-color="green"] .stat-value { color: var(--green); }

.stat-card[data-color="blue"]::after { background: var(--blue); }
.stat-card[data-color="blue"] .stat-icon { background: var(--blue-bg); color: var(--blue); }
.stat-card[data-color="blue"] .stat-value { color: var(--blue); }

.stat-card[data-color="red"]::after { background: var(--red); }
.stat-card[data-color="red"] .stat-icon { background: var(--red-bg); color: var(--red); }
.stat-card[data-color="red"] .stat-value { color: var(--red); }

.stat-card[data-color="orange"]::after { background: var(--orange); }
.stat-card[data-color="orange"] .stat-icon { background: var(--orange-bg); color: var(--orange); }
.stat-card[data-color="orange"] .stat-value { color: var(--orange); }

.stat-card[data-color="purple"]::after { background: var(--purple); }
.stat-card[data-color="purple"] .stat-icon { background: var(--purple-bg); color: var(--purple); }
.stat-card[data-color="purple"] .stat-value { color: var(--purple); }

.stat-card[data-color="default"]::after { background: var(--accent); }

/* ═══ DASHBOARD GRID ═══ */

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* Quick Actions */
.quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.quick-action-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: var(--transition);
}

.quick-action-btn:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--border-light); transform: translateY(-1px); }

.quick-action-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

/* Distribution Chart */
.distribution-chart {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dist-bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
}

.dist-bar-label {
  width: 70px;
  color: var(--text-muted);
  font-weight: 500;
  flex-shrink: 0;
}

.dist-bar-track {
  flex: 1;
  height: 8px;
  background: rgba(255,255,255,0.04);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.dist-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.6s cubic-bezier(0.4,0,0.2,1);
  min-width: 2px;
}

.dist-bar-value {
  width: 32px;
  text-align: right;
  font-weight: 700;
  font-size: 13px;
  color: var(--text-primary);
}

/* ═══ KEYS TOOLBAR ═══ */

.keys-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.keys-count {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-box > i {
  position: absolute;
  left: 12px;
  color: var(--text-dim);
  font-size: 13px;
  pointer-events: none;
}

.search-box input {
  padding: 9px 32px 9px 36px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 13px;
  width: 260px;
  transition: var(--transition);
  outline: none;
}

.search-box input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.search-box input::placeholder { color: var(--text-dim); }

.search-clear {
  position: absolute;
  right: 6px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: var(--radius-xs);
  font-size: 12px;
}

.search-clear:hover { color: var(--text-primary); background: rgba(255,255,255,0.05); }

.select-input {
  padding: 9px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 13px;
  cursor: pointer;
  outline: none;
}

.select-input:focus { border-color: var(--accent); }

/* ═══ BULK BAR ═══ */

.bulk-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--accent-bg);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
  animation: fadeUp 0.2s ease;
}

.bulk-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--accent-light);
}

.bulk-info i { font-size: 14px; }

.bulk-actions {
  display: flex;
  gap: 6px;
}

/* ═══ TABLE ═══ */

.table-responsive { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  padding: 12px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  background: rgba(255,255,255,0.01);
}

.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table tbody tr { transition: background 0.15s; }
.data-table-hover tbody tr:hover { background: rgba(255,255,255,0.02); }
.data-table tbody tr:last-child td { border-bottom: none; }

.data-table tbody tr.selected { background: var(--accent-bg) !important; }

.th-check { width: 40px; padding-left: 16px !important; }

.empty-state {
  text-align: center;
  padding: 40px !important;
  color: var(--text-muted);
  font-size: 13px;
}

.empty-state i { margin-right: 6px; }

/* Checkbox */
.checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border-light);
  border-radius: 4px;
  background: var(--bg-input);
  cursor: pointer;
  position: relative;
  transition: var(--transition);
  vertical-align: middle;
}

.checkbox:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.checkbox:checked::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 1px;
  width: 4px;
  height: 8px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.checkbox:hover { border-color: var(--accent); }

.key-text {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  background: var(--accent-bg);
  color: var(--accent-light);
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  user-select: all;
  transition: var(--transition);
  letter-spacing: 0.3px;
  display: inline-block;
}

.key-text:hover { background: rgba(99,102,241,0.18); }

.udid-text {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-muted);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
  cursor: pointer;
}

.udid-text:hover { color: var(--text-secondary); }

.note-text {
  font-size: 11px;
  color: var(--text-muted);
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
}

/* ═══ BADGES ═══ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge::before { content: ''; width: 5px; height: 5px; border-radius: 50%; }

.badge-active { background: var(--green-bg); color: var(--green); border: 1px solid var(--green-border); }
.badge-active::before { background: var(--green); }
.badge-used { background: var(--blue-bg); color: var(--blue); border: 1px solid var(--blue-border); }
.badge-used::before { background: var(--blue); }
.badge-expired { background: rgba(113,113,122,0.1); color: var(--text-muted); border: 1px solid rgba(113,113,122,0.2); }
.badge-expired::before { background: var(--text-muted); }
.badge-revoked { background: var(--red-bg); color: var(--red); border: 1px solid var(--red-border); }
.badge-revoked::before { background: var(--red); }
.badge-accent { background: var(--accent-bg); color: var(--accent-light); border: 1px solid rgba(99,102,241,0.2); }
.badge-accent::before { display: none; }

/* ═══ ACTION ICONS ═══ */

.action-icons { display: flex; gap: 2px; }

.action-btn {
  width: 30px;
  height: 30px;
  border: none;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: var(--transition);
}

.action-btn:hover { background: rgba(255,255,255,0.06); color: var(--text-primary); }
.action-btn.btn-view:hover { color: var(--blue); background: var(--blue-bg); }
.action-btn.btn-copy:hover { color: var(--cyan); background: rgba(6,182,212,0.1); }
.action-btn.btn-revoke:hover { color: var(--orange); background: var(--orange-bg); }
.action-btn.btn-delete:hover { color: var(--red); background: var(--red-bg); }

/* ═══ PAGINATION ═══ */

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 16px;
  padding: 8px 0;
}

.page-btn {
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.page-btn:hover { background: var(--bg-elevated); color: var(--text-primary); border-color: var(--border-light); }
.page-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.page-btn:disabled { opacity: 0.3; cursor: not-allowed; }

.page-info {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0 8px;
}

/* ═══ GENERATE PAGE ═══ */

.generate-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  max-width: 1000px;
}

.duration-presets { display: flex; gap: 6px; margin-bottom: 20px; flex-wrap: wrap; }

.gen-keys-list { display: flex; flex-direction: column; }

.gen-key-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
}

.gen-key-item:last-child { border-bottom: none; }
.gen-key-item:hover { background: rgba(255,255,255,0.02); }
.gen-key-item .key-text { background: transparent; padding: 0; }

.gen-key-item .copy-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px 8px;
  border-radius: var(--radius-xs);
  font-size: 13px;
  transition: var(--transition);
}

.gen-key-item .copy-btn:hover { background: var(--bg-hover); color: var(--accent); }

/* ═══ DEVICES + SETTINGS ═══ */

.info-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--blue-bg);
  border: 1px solid var(--blue-border);
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 12px;
  color: var(--blue);
}

.info-banner code {
  background: rgba(0,0,0,0.2);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 11px;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.info-row:last-child { border-bottom: none; }
.info-label { color: var(--text-muted); font-weight: 500; }
.info-value { font-weight: 600; text-align: right; word-break: break-all; }
.info-mono { font-family: var(--mono); font-size: 11px; color: var(--text-secondary); }

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  animation: blink 2s ease infinite;
}

.status-dot.green { background: var(--green); box-shadow: 0 0 8px rgba(34,197,94,0.4); }

@keyframes blink {
  0%,100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ═══ MODAL ═══ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeUp 0.15s ease;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 14px;
  width: 90%;
  max-width: 540px;
  max-height: 85vh;
  overflow: auto;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg-card);
  z-index: 1;
}

.modal-header h3 { font-size: 15px; font-weight: 700; }

.modal-close {
  width: 30px;
  height: 30px;
  border: none;
  border-radius: var(--radius-xs);
  background: rgba(255,255,255,0.04);
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.modal-close:hover { background: var(--red-bg); color: var(--red); }

.modal-body { padding: 20px; }

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.detail-row:last-child { border-bottom: none; }
.detail-label { color: var(--text-muted); font-weight: 500; }
.detail-value { font-weight: 600; text-align: right; word-break: break-all; max-width: 60%; }

/* ═══ TOAST ═══ */

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
}

.toast {
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow);
  animation: toastIn 0.3s cubic-bezier(0.4,0,0.2,1);
  max-width: 380px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid;
}

.toast-success { background: rgba(34,197,94,0.12); color: var(--green); border-color: var(--green-border); }
.toast-error { background: rgba(239,68,68,0.12); color: var(--red); border-color: var(--red-border); }
.toast-info { background: rgba(99,102,241,0.12); color: var(--accent-light); border-color: rgba(99,102,241,0.2); }

@keyframes toastIn {
  from { transform: translateY(20px) scale(0.95); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

/* ═══ RESPONSIVE ═══ */

.hide-mobile { }

@media (max-width: 1024px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .generate-layout { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-width) !important;
    z-index: 200;
  }
  .sidebar.mobile-open { transform: translateX(0); }
  .sidebar.mobile-open ~ .sidebar-overlay { display: block; }
  .content { margin-left: 0 !important; }
  .topbar-menu-btn { display: block; }
  .hide-mobile { display: none !important; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .quick-actions { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .search-box input { width: 100%; }
  .toolbar-left { width: 100%; }
  .toolbar-left .search-box { flex: 1; }
  .toolbar-left .select-input { min-width: 120px; }
  .settings-grid { grid-template-columns: 1fr; }
  .bulk-bar { flex-direction: column; gap: 10px; text-align: center; }
  .page { padding: 0 16px 30px; }
  .topbar { padding: 0 16px; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .stat-card { padding: 14px; }
  .stat-value { font-size: 22px; }
  .page-header h2 { font-size: 18px; }
  .toolbar-left { flex-direction: column; }
  .toolbar-left .search-box { width: 100%; }
  .toolbar-left .select-input { width: 100%; }
}
