/* ============================================================
   ND License Server - Admin CSS
   Stage 15 Phase 2 - Full professional design system
   Sticky sidebar + content-only scroll (desktop).
   ============================================================ */

/* ---------- DESIGN TOKENS ---------- */
:root{
  --primary:        #6366f1;
  --primary-hover:  #4f46e5;
  --primary-soft:   rgba(99,102,241,0.08);
  --primary-soft-2: rgba(99,102,241,0.15);
  --primary-ring:   rgba(99,102,241,0.35);
  --secondary:      #8b5cf6;

  --success:        #10b981;
  --success-soft:   rgba(16,185,129,0.12);
  --warning:        #f59e0b;
  --warning-soft:   rgba(245,158,11,0.12);
  --danger:         #ef4444;
  --danger-soft:    rgba(239,68,68,0.12);
  --info:           #3b82f6;
  --info-soft:      rgba(59,130,246,0.12);

  --bg-page:        #f6f7fb;
  --bg-card:        #ffffff;
  --bg-sidebar:     #ffffff;
  --bg-muted:       #f1f3f9;
  --bg-hover:       #eef0f7;
  --bg-input:       #ffffff;

  --text-primary:   #0f172a;
  --text-secondary: #334155;
  --text-muted:     #64748b;
  --text-inverse:   #ffffff;

  --border:         #e5e7eb;
  --border-light:   #f1f2f6;

  --shadow-xs: 0 1px 2px rgba(15,23,42,.04);
  --shadow-sm: 0 1px 2px rgba(15,23,42,.05), 0 1px 3px rgba(15,23,42,.03);
  --shadow-md: 0 4px 12px rgba(15,23,42,.06), 0 1px 3px rgba(15,23,42,.04);
  --shadow-lg: 0 12px 32px rgba(15,23,42,.08), 0 2px 6px rgba(15,23,42,.04);

  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-full: 999px;

  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;

  --sidebar-w:           260px;
  --sidebar-w-collapsed: 76px;
  --topbar-h:            68px;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Courier New", monospace;

  --fs-page-title:    20px;
  --fs-section-title: 15px;
  --fs-card-title:    13px;
  --fs-body:          13.5px;
  --fs-small:         12px;
  --fs-label:         11.5px;
  --fs-table:         13px;
  --fs-badge:         11.5px;

  --bg:       var(--bg-page);
  --panel:    var(--bg-card);
  --panel-2:  var(--bg-muted);
  --text:     var(--text-primary);
  --muted:    var(--text-muted);
  --accent:   var(--primary);
  --accent-2: var(--secondary);
  --ok:       var(--success);
  --warn:     var(--warning);
}

/* ---------- RESET ---------- */
*, *::before, *::after{ box-sizing: border-box; }
html{ -webkit-text-size-adjust: 100%; }
html, body{
  margin: 0; padding: 0;
  background: var(--bg-page);
  color: var(--text-primary);
}
body{
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a{ color: var(--primary); text-decoration: none; }
a:hover{ color: var(--primary-hover); text-decoration: none; }
h1, h2, h3, h4{ color: var(--text-primary); font-weight: 600; margin: 0; }
::selection{ background: var(--primary-soft-2); }

/* ============================================================
   LAYOUT
   ============================================================ */
html, body{ height: 100%; overflow: hidden; }
.layout{
  display: flex;
  width: 100%;
  height: 100vh;
  overflow: hidden;
  background: var(--bg-page);
}
.main{
  flex: 1 1 auto;
  min-width: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-page);
  overflow-y: auto;
  overflow-x: hidden;
}

/* ---------- SIDEBAR ---------- */
.sidebar{
  flex: 0 0 var(--sidebar-w);
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: flex-basis .22s ease, width .22s ease;
  position: relative;
  z-index: 30;
}
.sidebar-header{
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
  min-height: 68px;
}
.brand{
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
  text-decoration: none;
  min-width: 0;
}
.brand:hover{ color: var(--text-primary); }
.logo{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  border-radius: 10px;
  font-weight: 700;
  font-size: 13px;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(99,102,241,.28);
}
.brand-name{
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-toggle{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px; height: 30px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  transition: background .15s, color .15s, border-color .15s;
  flex-shrink: 0;
}
.sidebar-toggle:hover{ background: var(--primary-soft); color: var(--primary); border-color: var(--primary-soft-2); }
.sidebar-toggle svg{ width: 14px; height: 14px; transition: transform .22s ease; }

.sidebar-nav{
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 10px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.sidebar-nav::-webkit-scrollbar{ width: 6px; }
.sidebar-nav::-webkit-scrollbar-thumb{ background: var(--border); border-radius: 6px; }

.nav-group{ display: flex; flex-direction: column; gap: 2px; margin-bottom: 10px; }
.nav-group + .nav-group{ padding-top: 10px; border-top: 1px solid var(--border-light); margin-top: 4px; }
.nav-section-title{
  display: block;
  padding: 10px 12px 4px;
  color: var(--text-muted);
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .09em;
  white-space: nowrap;
  overflow: hidden;
}
.nav-item{
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  transition: background .14s, color .14s;
  white-space: nowrap;
  cursor: pointer;
}
.nav-item:hover{ background: var(--bg-hover); color: var(--text-primary); text-decoration: none; }
.nav-item.active{ background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav-item.active .nav-icon{ color: var(--primary); }
.nav-icon{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px; height: 20px;
  flex-shrink: 0;
  color: var(--text-muted);
  transition: color .14s;
}
.nav-icon svg{ width: 18px !important; height: 18px !important; display: block; }
.nav-item:hover .nav-icon{ color: var(--text-primary); }
.nav-label{ flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.nav-disabled{
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 500;
  opacity: .55;
  cursor: not-allowed;
  pointer-events: none;
  white-space: nowrap;
}
.nav-disabled .nav-icon svg{ width: 18px !important; height: 18px !important; }

.sidebar-footer{ flex-shrink: 0; padding: 12px 10px; border-top: 1px solid var(--border-light); }
.user-card{
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--bg-muted);
  transition: background .15s;
  overflow: hidden;
}
.user-card:hover{ background: var(--bg-hover); }
.user-avatar{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: #fff;
  font-weight: 600;
  font-size: 13px;
  flex-shrink: 0;
  text-transform: uppercase;
}
.user-info{ flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
.user-name{ font-size: 13px; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role{ font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-logout{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  border-radius: 8px;
  color: var(--text-muted);
  background: transparent;
  flex-shrink: 0;
  transition: background .15s, color .15s;
}
.user-logout:hover{ background: var(--danger-soft); color: var(--danger); text-decoration: none; }
.user-logout svg{ width: 15px !important; height: 15px !important; }

/* ---------- TOPBAR ---------- */
.topbar{
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 24px;
  height: var(--topbar-h);
  background: rgba(255,255,255,0.92);
  backdrop-filter: saturate(180%) blur(8px);
  -webkit-backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.topbar-left{ display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1 1 auto; }
.topbar-right{ display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.page-heading{ min-width: 0; display: flex; flex-direction: column; }
.page-heading h1{
  font-size: var(--fs-page-title);
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.page-heading .crumb{
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 1px;
}
.menu-toggle{
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px; height: 38px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
  padding: 0;
}
.menu-toggle:hover{ background: var(--bg-muted); color: var(--primary); }
.topbar-user{
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 6px 5px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 13px;
}
.topbar-user .name{
  color: var(--text-primary);
  font-weight: 500;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topbar-user .avatar{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: #fff;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
}
.btn-logout{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 500;
  transition: background .15s, color .15s, border-color .15s;
}
.btn-logout:hover{
  background: var(--danger-soft);
  color: var(--danger);
  border-color: rgba(239,68,68,.25);
  text-decoration: none;
}
.btn-logout svg{ width: 14px; height: 14px; }

/* ---------- CONTENT ---------- */
.content{
  flex: 1 1 auto;
  padding: var(--sp-6);
  background: var(--bg-page);
  min-height: 0;
}

/* ---------- PAGE HEADER (optional) ---------- */
.page-header{
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-4);
  margin-bottom: var(--sp-6);
  flex-wrap: wrap;
}
.page-header .page-title{
  font-size: var(--fs-page-title);
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
}
.page-header .page-subtitle{
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}
.page-header .page-actions{
  display: flex;
  gap: var(--sp-2);
  align-items: center;
  flex-wrap: wrap;
}

/* ---------- KPI CARDS ---------- */
.cards{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--sp-4);
  margin-bottom: var(--sp-6);
}
.card{
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  box-shadow: var(--shadow-sm);
  transition: box-shadow .18s, transform .18s;
  min-width: 0;
}
.card:hover{ box-shadow: var(--shadow-md); transform: translateY(-1px); }
.card .label{
  display: block;
  color: var(--text-muted);
  font-size: var(--fs-label);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: var(--sp-2);
}
.card .value{
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.15;
  letter-spacing: -0.01em;
}
.card .card-icon{
  position: absolute;
  top: var(--sp-4);
  right: var(--sp-4);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary);
}
.card .card-icon svg{ width: 18px; height: 18px; }

/* ---------- PANELS ---------- */
.panel{
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  margin-bottom: var(--sp-5);
  box-shadow: var(--shadow-sm);
  min-width: 0;
}
.panel h2{
  font-size: var(--fs-section-title);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--sp-4);
}
.panel-head{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
  flex-wrap: wrap;
}
.panel-head h2{ margin: 0; }
.panel-head .panel-actions{ display: flex; gap: var(--sp-2); flex-wrap: wrap; }

/* ---------- EMPTY STATE ---------- */
.empty-state{
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--sp-10) var(--sp-4);
  color: var(--text-muted);
}
.empty-state .empty-icon{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 60px; height: 60px;
  border-radius: 50%;
  background: var(--bg-muted);
  color: var(--text-muted);
  margin-bottom: var(--sp-4);
}
.empty-state .empty-icon svg{ width: 26px; height: 26px; }
.empty-state .empty-title{
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--sp-1);
}
.empty-state .empty-subtitle{
  font-size: 13px;
  color: var(--text-muted);
  max-width: 340px;
  margin-bottom: var(--sp-4);
  line-height: 1.55;
}

/* ---------- TABLES ---------- */
.table-wrap{
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-md);
}
.table-wrap table{ min-width: 640px; }
table{ width: 100%; border-collapse: collapse; font-size: var(--fs-table); }
th, td{
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-light);
  text-align: left;
  vertical-align: middle;
}
th{
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .07em;
  background: var(--bg-muted);
  white-space: nowrap;
}
th:first-child{ border-top-left-radius: var(--radius-md); }
th:last-child { border-top-right-radius: var(--radius-md); }
tr:last-child td{ border-bottom: 0; }
tbody tr{ transition: background .12s; }
tbody tr:hover td{ background: var(--bg-hover); }
td.actions{ text-align: right; white-space: nowrap; }

/* ---------- BUTTONS ---------- */
.btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  background: var(--primary);
  color: #fff;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background .15s, box-shadow .15s, transform .05s;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.2;
}
.btn:hover{ background: var(--primary-hover); color: #fff; text-decoration: none; box-shadow: 0 4px 12px rgba(99,102,241,.24); }
.btn:active{ transform: translateY(1px); }
.btn:focus-visible{ outline: 2px solid var(--primary-ring); outline-offset: 2px; }
.btn:disabled, .btn[disabled]{ opacity: .55; cursor: not-allowed; box-shadow: none; }
.btn-secondary{ background: var(--bg-card); color: var(--text-secondary); border-color: var(--border); }
.btn-secondary:hover{ background: var(--bg-muted); color: var(--text-primary); box-shadow: none; }
.btn-success{ background: var(--success); }
.btn-success:hover{ background: #059669; box-shadow: 0 4px 12px rgba(16,185,129,.24); }
.btn-warning{ background: var(--warning); }
.btn-warning:hover{ background: #d97706; box-shadow: 0 4px 12px rgba(245,158,11,.24); }
.btn-danger{ background: var(--danger); }
.btn-danger:hover{ background: #dc2626; box-shadow: 0 4px 12px rgba(239,68,68,.24); }
.btn-ghost{ background: transparent; color: var(--text-secondary); border-color: transparent; }
.btn-ghost:hover{ background: var(--bg-muted); color: var(--text-primary); box-shadow: none; }
.btn-outline{ background: transparent; color: var(--primary); border-color: var(--primary-soft-2); }
.btn-outline:hover{ background: var(--primary-soft); box-shadow: none; }
.btn-small{ padding: 6px 12px; font-size: 12px; border-radius: 7px; }
.btn-icon{ width: 34px; height: 34px; padding: 0; border-radius: 8px; }
.btn-icon svg{ width: 15px; height: 15px; }

/* ---------- FORMS ---------- */
label{
  display: block;
  font-size: var(--fs-small);
  font-weight: 500;
  color: var(--text-secondary);
  margin: 14px 0 6px;
}
input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="date"], input[type="search"],
input[type="url"], input[type="tel"], input:not([type]),
select, textarea{
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 13.5px;
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
  line-height: 1.4;
}
input::placeholder, textarea::placeholder{ color: #94a3b8; }
input:hover, select:hover, textarea:hover{ border-color: #cbd5e1; }
input:focus, select:focus, textarea:focus{
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft-2);
}
textarea{ min-height: 90px; resize: vertical; }
select{
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
}
input[type="checkbox"], input[type="radio"]{ width: auto; accent-color: var(--primary); margin-right: 6px; }
input[type="file"]{ padding: 8px; background: var(--bg-muted); cursor: pointer; }

.form-grid{ display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--sp-4); }
.form-grid > div{ min-width: 0; }
.form-actions{ margin-top: var(--sp-5); display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.field{ display: flex; flex-direction: column; gap: 4px; }
.field label{ margin: 0; }

.toolbar{
  display: flex;
  gap: var(--sp-3);
  flex-wrap: wrap;
  align-items: end;
  margin-bottom: var(--sp-4);
  padding: var(--sp-4);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.toolbar .field{ flex: 1; min-width: 180px; }
.toolbar .btn, .toolbar .btn-secondary{ margin-top: auto; }

/* ---------- BADGES ---------- */
.badge{
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: var(--fs-badge);
  font-weight: 600;
  text-transform: capitalize;
  line-height: 1.6;
  white-space: nowrap;
}
.badge-active, .badge-paid, .badge-completed, .badge-approved{ background: var(--success-soft); color: #047857; }
.badge-expired, .badge-warning, .badge-past_due{ background: var(--warning-soft); color: #b45309; }
.badge-suspended, .badge-disabled, .badge-inactive, .badge-cancelled{ background: rgba(100,116,139,.12); color: #475569; }
.badge-revoked, .badge-failed, .badge-rejected{ background: var(--danger-soft); color: #b91c1c; }
.badge-pending, .badge-processing{ background: var(--info-soft); color: #1d4ed8; }

/* ---------- FLASH / ALERTS ---------- */
.flash{
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  margin-bottom: var(--sp-4);
  font-size: 13.5px;
  border: 1px solid transparent;
  line-height: 1.5;
}
.flash-success{ background: var(--success-soft); color: #065f46; border-color: rgba(16,185,129,.25); }
.flash-error{ background: var(--danger-soft); color: #991b1b; border-color: rgba(239,68,68,.25); }
.flash-warning{ background: var(--warning-soft); color: #92400e; border-color: rgba(245,158,11,.25); }
.flash-info{ background: var(--info-soft); color: #1e40af; border-color: rgba(59,130,246,.25); }

/* ---------- MISC ---------- */
.muted{ color: var(--text-muted); font-size: var(--fs-small); }
code{
  background: var(--bg-muted);
  color: var(--text-primary);
  padding: 2px 6px;
  border-radius: 5px;
  font-family: var(--font-mono);
  font-size: 12px;
}
pre{
  background: #0f172a;
  color: #e2e8f0;
  border-radius: var(--radius-md);
  padding: 16px;
  font-size: 12px;
  overflow: auto;
  line-height: 1.55;
  font-family: var(--font-mono);
}
.copy-btn{
  cursor: pointer;
  background: var(--bg-muted);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 11.5px;
  font-weight: 500;
  font-family: inherit;
}
.copy-btn:hover{ background: var(--primary-soft); color: var(--primary); border-color: var(--primary-soft-2); }
.copy-btn.copied{ background: var(--success-soft); color: #047857; border-color: rgba(16,185,129,.25); }

.pagination{ display: flex; gap: 6px; margin-top: 18px; align-items: center; flex-wrap: wrap; }
.pagination a, .pagination span{
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 12.5px;
  color: var(--text-secondary);
  background: var(--bg-card);
  font-weight: 500;
}
.pagination a:hover{ background: var(--bg-muted); color: var(--text-primary); text-decoration: none; }
.pagination .current{ background: var(--primary); color: #fff; border-color: var(--primary); }

.license-key-section{ margin-bottom: 8px; }
.license-key-box{
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-family: var(--font-mono);
  font-size: 13px;
  max-width: 100%;
}
.license-key-value{ flex: 1 1 auto; min-width: 0; word-break: break-all; color: var(--text-primary); }

/* ---------- COLLAPSED SIDEBAR (desktop) ---------- */
body.sidebar-collapsed .sidebar{
  flex: 0 0 var(--sidebar-w-collapsed);
  width: var(--sidebar-w-collapsed);
}
body.sidebar-collapsed .sidebar-header{ padding: 18px 8px 14px; justify-content: center; }
body.sidebar-collapsed .brand{ justify-content: center; }
body.sidebar-collapsed .brand-name{ display: none; }
body.sidebar-collapsed .sidebar-toggle{
  position: absolute;
  top: 50%;
  right: -15px;
  transform: translateY(-50%);
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  z-index: 40;
}
body.sidebar-collapsed .sidebar-toggle svg{ transform: rotate(180deg); }
body.sidebar-collapsed .sidebar-nav{ padding: 12px 10px; }
body.sidebar-collapsed .nav-item,
body.sidebar-collapsed .nav-disabled{ justify-content: center; padding: 9px 0; gap: 0; }
body.sidebar-collapsed .nav-label{ display: none; }
body.sidebar-collapsed .nav-section-title{
  text-align: center;
  padding: 10px 0 4px;
  font-size: 0;
  height: 20px;
  position: relative;
}
body.sidebar-collapsed .nav-section-title::before{
  content: '';
  display: block;
  width: 20px; height: 1px;
  background: var(--border);
  margin: 8px auto 0;
}
body.sidebar-collapsed .sidebar-footer{ padding: 12px 8px; }
body.sidebar-collapsed .user-card{ padding: 8px 4px; background: transparent; justify-content: center; }
body.sidebar-collapsed .user-info{ display: none; }
body.sidebar-collapsed .user-logout{ display: none; }
body.sidebar-collapsed .nav-item{ position: relative; }
body.sidebar-collapsed .nav-item::after{
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  background: #0f172a;
  color: #fff;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s ease;
  z-index: 200;
  box-shadow: var(--shadow-md);
}
body.sidebar-collapsed .nav-item:hover::after{ opacity: 1; }

/* ---------- AUTH PAGES ---------- */
.auth-page{
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  background:
    radial-gradient(900px 600px at 15% -10%, rgba(99,102,241,.35), transparent 55%),
    radial-gradient(800px 500px at 95% 20%, rgba(139,92,246,.30), transparent 55%),
    radial-gradient(700px 500px at 50% 110%, rgba(236,72,153,.22), transparent 55%),
    linear-gradient(135deg, #1e1b4b 0%, #0f172a 100%);
  position: relative;
  overflow: hidden;
}
.auth-card{
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 440px;
  padding: 38px 34px 32px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 22px;
  backdrop-filter: blur(22px) saturate(160%);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
  box-shadow: 0 24px 60px rgba(0,0,0,0.45), 0 0 0 1px rgba(255,255,255,0.04) inset;
  color: #e2e8f0;
}
.auth-logo{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px; height: 56px;
  border-radius: 18px;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #ec4899 100%);
  color: #fff;
  font-weight: 700;
  font-size: 18px;
  margin: 0 auto 18px;
  box-shadow: 0 10px 30px rgba(139,92,246,.45);
}
.auth-title{ font-size: 24px; font-weight: 700; text-align: center; color: #fff; margin: 0 0 6px; letter-spacing: -0.01em; }
.auth-subtitle{ font-size: 13.5px; text-align: center; color: rgba(226,232,240,.72); margin: 0 0 26px; }
.auth-field{ margin-bottom: 16px; }
.auth-field label{ display: block; font-size: 12.5px; color: rgba(226,232,240,.80); margin: 0 0 7px; font-weight: 500; }
.auth-input{
  width: 100%;
  padding: 12px 15px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 11px;
  color: #fff;
  font-size: 14px;
  font-family: inherit;
}
.auth-input::placeholder{ color: rgba(226,232,240,.40); }
.auth-input:focus{ outline: none; border-color: rgba(139,92,246,.85); background: rgba(255,255,255,0.10); box-shadow: 0 0 0 4px rgba(139,92,246,.20); }
.auth-row{ display: flex; align-items: center; justify-content: space-between; margin: 4px 0 18px; font-size: 12.5px; gap: 8px; flex-wrap: wrap; }
.auth-row .remember{ display: flex; align-items: center; gap: 7px; color: rgba(226,232,240,.80); cursor: pointer; }
.auth-row input[type="checkbox"]{ width: auto; margin: 0; accent-color: #8b5cf6; }
.auth-link{ color: #c4b5fd; font-size: 12.5px; text-decoration: none; }
.auth-link:hover{ color: #e9d5ff; text-decoration: underline; }
.auth-button{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 13px 18px;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
  color: #fff;
  border: 0;
  border-radius: 11px;
  font-size: 14.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(139,92,246,.35);
}
.auth-button:hover{ filter: brightness(1.06); box-shadow: 0 10px 28px rgba(139,92,246,.45); }
.auth-button:active{ transform: translateY(1px); }
.auth-message{ padding: 11px 14px; border-radius: 10px; margin-bottom: 16px; font-size: 13px; line-height: 1.5; }
.auth-message.error{ background: rgba(239,68,68,.16); color: #fecaca; border: 1px solid rgba(239,68,68,.32); }
.auth-message.success{ background: rgba(16,185,129,.16); color: #a7f3d0; border: 1px solid rgba(16,185,129,.32); }
.auth-message.info{ background: rgba(59,130,246,.16); color: #bfdbfe; border: 1px solid rgba(59,130,246,.32); }
.auth-footer{ text-align: center; margin-top: 22px; font-size: 13px; color: rgba(226,232,240,.72); }
.auth-footer a{ color: #c4b5fd; font-weight: 500; }
.auth-footer a:hover{ color: #e9d5ff; }

/* ---------- LOGIN (light fallback) ---------- */
.login-wrap{
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(1200px 500px at 80% -10%, rgba(99,102,241,.08), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(139,92,246,.06), transparent 60%),
    var(--bg-page);
}
.login-card{
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 34px 30px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
}
.login-card h1{ margin: 0 0 6px; font-size: 21px; font-weight: 700; }
.login-card p.sub{ margin: 0 0 22px; color: var(--text-muted); font-size: 13.5px; }
.login-card .forgot-link{ display: block; text-align: right; font-size: 12.5px; margin-top: 8px; color: var(--text-muted); }
.login-card .forgot-link:hover{ color: var(--primary); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px){
  .content{ padding: 20px; }
  .topbar{ padding: 0 20px; }
}

@media (max-width: 900px){
  html, body{ height: auto; overflow: auto; }
  .layout{ height: auto; overflow: visible; }
  .main{ height: auto; overflow: visible; }

  .sidebar{
    position: fixed;
    left: 0; top: 0;
    height: 100vh;
    width: var(--sidebar-w);
    flex-basis: var(--sidebar-w);
    transform: translateX(-100%);
    transition: transform .24s ease;
    z-index: 50;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
  }
  .sidebar.open{ transform: translateX(0); }
  body.sidebar-collapsed .sidebar{ flex-basis: var(--sidebar-w); width: var(--sidebar-w); }
  body.sidebar-collapsed .sidebar .brand-name{ display: inline; }
  body.sidebar-collapsed .sidebar .nav-label{ display: inline; }
  body.sidebar-collapsed .sidebar .nav-item{ justify-content: flex-start; padding: 9px 12px; gap: 11px; }
  body.sidebar-collapsed .sidebar .nav-item::after{ display: none; }
  body.sidebar-collapsed .sidebar .user-info{ display: flex; }
  body.sidebar-collapsed .sidebar .user-logout{ display: inline-flex; }
  body.sidebar-collapsed .sidebar .nav-section-title{ font-size: 10.5px; text-align: left; padding: 10px 12px 4px; height: auto; }
  body.sidebar-collapsed .sidebar .nav-section-title::before{ display: none; }
  body.sidebar-collapsed .sidebar-toggle{ position: static; transform: none; border-radius: 8px; }
  body.sidebar-collapsed .sidebar-toggle svg{ transform: none; }

  .sidebar-toggle{ display: none; }
  .menu-toggle{ display: inline-flex; }
  .topbar{ position: sticky; top: 0; padding: 0 16px; }
  .page-heading h1{ font-size: 16px; }
  .content{ padding: 16px; }
  .cards{ grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
  .card{ padding: 16px; }
  .card .value{ font-size: 22px; }
  .panel{ padding: 18px; }
  .form-grid{ grid-template-columns: 1fr; }
  .toolbar{ flex-direction: column; align-items: stretch; padding: 14px; }
  .toolbar .field{ width: 100%; }
  .topbar-user .name{ display: none; }
  .topbar-user{ padding: 5px 5px; }
}

@media (max-width: 640px){
  .content{ padding: 12px; }
  .panel{ padding: 16px; border-radius: var(--radius-md); }
  .card{ border-radius: var(--radius-md); }
  .auth-card{ padding: 30px 22px 26px; border-radius: 18px; }
  .page-header{ margin-bottom: var(--sp-5); }
}

@media (max-width: 420px){
  .content{ padding: 10px; }
  .topbar{ padding: 0 12px; gap: 8px; }
  .cards{ grid-template-columns: 1fr; }
  .auth-page{ padding: 14px 10px; }
  .auth-card{ padding: 26px 18px 22px; }
}