/* ============================================
   Admin Panel - Modern Responsive CSS
   Supports: Light / Dark Mode, Mobile / Desktop
   ============================================ */

:root {
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-soft: #eef2ff;
  --success: #16a34a;
  --success-soft: #dcfce7;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --warning: #d97706;
  --warning-soft: #fef3c7;
  --info: #0891b2;
  --info-soft: #e0f2fe;

  --bg: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-tertiary: #f1f5f9;
  --card-bg: #ffffff;
  --sidebar-bg: #1e1b4b;
  --sidebar-text: #c7d2fe;
  --sidebar-active: #6366f1;
  --sidebar-hover: rgba(99,102,241,0.15);
  --topbar-bg: #ffffff;

  --text: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);

  --sidebar-width: 240px;
  --topbar-height: 60px;
  --radius: 10px;
  --radius-sm: 6px;
  --transition: 0.2s ease;
}

[data-theme="dark"] {
  --bg: #0f172a;
  --bg-secondary: #1e293b;
  --bg-tertiary: #334155;
  --card-bg: #1e293b;
  --sidebar-bg: #0f172a;
  --sidebar-text: #94a3b8;
  --sidebar-active: #6366f1;
  --topbar-bg: #1e293b;

  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --border: #334155;
  --shadow: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.4);
  --primary-soft: rgba(99,102,241,0.15);
  --success-soft: rgba(22,163,74,0.15);
  --danger-soft: rgba(220,38,38,0.15);
  --warning-soft: rgba(217,119,6,0.15);
  --info-soft: rgba(8,145,178,0.15);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  transition: background var(--transition), color var(--transition);
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== AUTH PAGES ===== */
.auth-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.auth-wrap { width: 100%; max-width: 400px; }
.auth-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px 36px;
  box-shadow: var(--shadow-lg);
}
.auth-logo { text-align: center; margin-bottom: 32px; }
.auth-logo svg { margin-bottom: 12px; }
.auth-logo h1 { font-size: 22px; font-weight: 700; color: var(--text); }
.auth-logo p { color: var(--text-muted); font-size: 14px; margin-top: 4px; }
.theme-toggle-wrap { text-align: center; margin-top: 20px; }
.theme-btn {
  background: none; border: 1px solid var(--border); color: var(--text-muted);
  padding: 6px 16px; border-radius: 20px; cursor: pointer; font-size: 13px;
  transition: all var(--transition);
}
.theme-btn:hover { background: var(--bg-secondary); }

/* ===== SIDEBAR ===== */
.sidebar {
  position: fixed; top: 0; left: 0; width: var(--sidebar-width);
  height: 100vh; background: var(--sidebar-bg); display: flex;
  flex-direction: column; z-index: 100; transition: transform var(--transition);
  overflow-y: auto;
}

.sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 16px; border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-logo { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; font-size: 16px; }
.sidebar-close { display: none; background: none; border: none; color: var(--sidebar-text); font-size: 18px; cursor: pointer; padding: 4px 8px; }

.nav-list { list-style: none; padding: 12px 8px; flex: 1; }
.nav-link {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: var(--radius-sm); color: var(--sidebar-text); font-size: 14px;
  font-weight: 500; cursor: pointer; transition: all var(--transition); margin-bottom: 2px;
}
.nav-link:hover { background: var(--sidebar-hover); color: #fff; text-decoration: none; }
.nav-link.active { background: var(--sidebar-active); color: #fff; }
.nav-logout { color: #f87171 !important; }
.nav-logout:hover { background: rgba(248,113,113,0.15) !important; color: #f87171 !important; }

.sidebar-footer { padding: 12px 8px; border-top: 1px solid rgba(255,255,255,0.08); }

.sidebar-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 99;
}

/* ===== MAIN CONTENT ===== */
.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex; flex-direction: column;
  transition: margin var(--transition);
}

/* ===== TOPBAR ===== */
.topbar {
  height: var(--topbar-height);
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; position: sticky; top: 0; z-index: 50;
  box-shadow: var(--shadow);
}
.menu-btn { display: none; background: none; border: none; cursor: pointer; color: var(--text); padding: 6px; border-radius: var(--radius-sm); }
.menu-btn:hover { background: var(--bg-secondary); }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.icon-btn { background: none; border: 1px solid var(--border); padding: 7px; border-radius: 8px; cursor: pointer; color: var(--text-muted); display: flex; align-items: center; transition: all var(--transition); }
.icon-btn:hover { background: var(--bg-secondary); color: var(--text); }
.admin-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; }
.admin-name { font-size: 14px; font-weight: 500; color: var(--text); }

/* ===== PAGE BODY ===== */
.page-body { flex: 1; padding: 24px; max-width: 1400px; }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.page-header h2 { font-size: 22px; font-weight: 700; }

/* ===== STATS ===== */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; display: flex; align-items: center; gap: 16px; box-shadow: var(--shadow);
}
.stat-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.stat-info { display: flex; flex-direction: column; }
.stat-value { font-size: 24px; font-weight: 800; color: var(--text); }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ===== CARD ===== */
.card { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.card-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap; gap: 10px; }
.card-header h3 { font-size: 15px; font-weight: 600; }

.row-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

/* ===== TABLE ===== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead tr { background: var(--bg-secondary); }
th { padding: 12px 16px; text-align: left; font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; white-space: nowrap; }
td { padding: 12px 16px; font-size: 13.5px; border-bottom: 1px solid var(--border); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--bg-secondary); }
.text-mono { font-family: monospace; }

/* ===== PAGINATION ===== */
.pagination { display: flex; gap: 6px; padding: 16px; flex-wrap: wrap; }
.page-btn { padding: 6px 12px; border-radius: 6px; border: 1px solid var(--border); color: var(--text); font-size: 13px; transition: all var(--transition); }
.page-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); text-decoration: none; }
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ===== BADGES ===== */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11.5px; font-weight: 600; }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-danger  { background: var(--danger-soft); color: var(--danger); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-info    { background: var(--info-soft); color: var(--info); }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px;
  border-radius: var(--radius-sm); font-size: 13.5px; font-weight: 500; cursor: pointer;
  border: 1px solid transparent; transition: all var(--transition); white-space: nowrap;
}
.btn:hover { text-decoration: none; opacity: 0.9; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-outline { background: transparent; border-color: var(--border); color: var(--text); }
.btn-outline:hover { background: var(--bg-secondary); }
.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-danger  { background: var(--danger);  color: #fff; border-color: var(--danger); }
.btn-full { width: 100%; justify-content: center; padding: 11px; }
.btn-sm { padding: 5px 12px; font-size: 12.5px; }
.btn-xs { padding: 3px 8px; font-size: 12px; }
.action-btns { display: flex; gap: 4px; flex-wrap: wrap; }

/* ===== FORMS ===== */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; color: var(--text-muted); margin-bottom: 6px; }
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%; padding: 9px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg);
  color: var(--text); font-size: 14px; transition: border-color var(--transition);
  font-family: inherit;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}
.form-group select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-footer { display: flex; gap: 10px; margin-top: 4px; padding-top: 16px; border-top: 1px solid var(--border); flex-wrap: wrap; }

.input-eye { position: relative; }
.input-eye input { padding-right: 40px; }
.eye-btn { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; color: var(--text-muted); padding: 4px; }

.search-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.search-form input { padding: 7px 12px; }

/* ===== MODAL ===== */
.modal { display: none; position: fixed; inset: 0; z-index: 200; align-items: center; justify-content: center; padding: 16px; }
.modal.open { display: flex; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.5); }
.modal-box {
  background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  width: 100%; max-width: 600px; position: relative; z-index: 1;
  max-height: 90vh; overflow-y: auto;
  animation: modalIn 0.2s ease;
}
@keyframes modalIn { from { opacity:0; transform: scale(0.95) translateY(-10px); } to { opacity:1; transform: scale(1) translateY(0); } }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--card-bg); z-index: 1; }
.modal-header h3 { font-size: 16px; font-weight: 600; }
.modal-header button { background: none; border: none; font-size: 18px; cursor: pointer; color: var(--text-muted); padding: 2px 8px; border-radius: 4px; }
.modal-header button:hover { background: var(--bg-secondary); }
.modal-box form, .modal-box > div:not(.modal-header):not(.modal-footer) { padding: 22px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--border); }

/* ===== ALERTS ===== */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); font-size: 13.5px; }
.alert-success { background: var(--success-soft); color: var(--success); border: 1px solid #86efac; }
.alert-danger  { background: var(--danger-soft);  color: var(--danger);  border: 1px solid #fca5a5; }
.alert-warning { background: var(--warning-soft); color: var(--warning); border: 1px solid #fcd34d; }

/* ===== TOAST ===== */
.toast {
  position: fixed; bottom: 24px; right: 24px; padding: 12px 20px;
  border-radius: var(--radius-sm); color: #fff; font-size: 14px; font-weight: 500;
  box-shadow: var(--shadow-lg); z-index: 9999; transform: translateY(80px);
  transition: transform 0.3s ease, opacity 0.3s ease; opacity: 0; pointer-events: none;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.success { background: var(--success); }
.toast.error   { background: var(--danger); }

/* ===== SETTINGS ===== */
.settings-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 20px; }
.quick-actions { display: flex; gap: 12px; flex-wrap: wrap; padding: 16px 20px; }
.quick-action-btn {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 20px 28px; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--bg-secondary); cursor: pointer; color: var(--text); font-size: 13px;
  transition: all var(--transition); font-family: inherit;
}
.quick-action-btn span:first-child { font-size: 24px; }
.quick-action-btn:hover { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); text-decoration: none; }

/* ===== UTILITY ===== */
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.text-mono { font-family: 'Courier New', monospace; }
hr { border: none; border-top: 1px solid var(--border); }

code {
  background: var(--bg-tertiary); padding: 2px 6px; border-radius: 4px;
  font-family: 'Courier New', monospace; font-size: 12px; color: var(--primary);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .row-2col { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close { display: block; }
  .sidebar-overlay.open { display: block; }
  .main-content { margin-left: 0; }
  .menu-btn { display: flex; }
  .admin-name { display: none; }
  .page-body { padding: 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .stat-card { padding: 14px; }
  .stat-value { font-size: 20px; }
  .form-grid-2 { grid-template-columns: 1fr; }
  .topbar { padding: 0 16px; }
  .card-header { flex-direction: column; align-items: flex-start; }
  .search-form { width: 100%; }
  .search-form input { flex: 1; min-width: 0; }
  th:nth-child(n+5) { display: none; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .auth-card { padding: 28px 20px; }
  .modal-box { border-radius: 12px 12px 0 0; position: fixed; bottom: 0; left: 0; right: 0; max-height: 85vh; margin: 0; max-width: 100%; }
  .modal { align-items: flex-end; padding: 0; }
}

/* =========================================================
   ColokTool Professional Admin UI
   Shared visual system for every admin page
   ========================================================= */
:root {
  --primary: #6d5dfc;
  --primary-hover: #5948f3;
  --primary-soft: #eeecff;
  --success: #0f9f6e;
  --success-soft: #dcfcef;
  --danger: #e5484d;
  --danger-soft: #ffebec;
  --warning: #d98312;
  --warning-soft: #fff4d6;
  --info: #168aad;
  --info-soft: #e1f6fc;
  --bg: #f3f6fb;
  --bg-secondary: #f8faff;
  --bg-tertiary: #edf1f8;
  --card-bg: rgba(255,255,255,.94);
  --input-bg: #fbfcff;
  --sidebar-bg: #11172b;
  --sidebar-text: #aab3ce;
  --sidebar-active: #6d5dfc;
  --sidebar-hover: rgba(118,105,255,.13);
  --topbar-bg: rgba(255,255,255,.88);
  --text: #182033;
  --text-muted: #71809c;
  --border: #dde4ef;
  --border-strong: #cbd5e3;
  --shadow: 0 8px 28px rgba(31,43,74,.07);
  --shadow-lg: 0 24px 70px rgba(17,24,39,.22);
  --sidebar-width: 264px;
  --topbar-height: 70px;
  --radius: 16px;
  --radius-sm: 10px;
  --transition: .2s ease;
}

[data-theme="dark"] {
  --bg: #0b1020;
  --bg-secondary: #11182b;
  --bg-tertiary: #182137;
  --card-bg: rgba(18,25,44,.95);
  --input-bg: #0e1528;
  --sidebar-bg: #080d1b;
  --sidebar-text: #919cb9;
  --sidebar-active: #7668ff;
  --sidebar-hover: rgba(118,104,255,.14);
  --topbar-bg: rgba(12,18,34,.88);
  --text: #edf2ff;
  --text-muted: #8996b3;
  --border: #26314a;
  --border-strong: #34415e;
  --shadow: 0 12px 35px rgba(0,0,0,.2);
  --shadow-lg: 0 28px 85px rgba(0,0,0,.55);
  --primary-soft: rgba(109,93,252,.16);
  --success-soft: rgba(15,159,110,.16);
  --danger-soft: rgba(229,72,77,.16);
  --warning-soft: rgba(217,131,18,.16);
  --info-soft: rgba(22,138,173,.16);
}

html { scroll-behavior: smooth; }

body {
  line-height: 1.5;
  background:
    radial-gradient(circle at 85% -10%, rgba(109,93,252,.12), transparent 30rem),
    radial-gradient(circle at 5% 95%, rgba(22,138,173,.08), transparent 28rem),
    var(--bg);
}

button, input, select, textarea { font: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(109,93,252,.22);
  outline-offset: 2px;
}

a:hover { text-decoration: none; }

/* Authentication */
.auth-body {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 10%, rgba(109,93,252,.28), transparent 28rem),
    radial-gradient(circle at 90% 90%, rgba(22,138,173,.18), transparent 30rem),
    var(--bg);
}
.auth-body::before,
.auth-body::after {
  content: "";
  position: fixed;
  width: 280px;
  height: 280px;
  border: 1px solid rgba(109,93,252,.22);
  border-radius: 44% 56% 54% 46%;
  pointer-events: none;
}
.auth-body::before { top: -145px; right: -85px; transform: rotate(28deg); }
.auth-body::after { bottom: -170px; left: -90px; transform: rotate(-18deg); }
.auth-wrap { max-width: 430px; position: relative; z-index: 1; }
.auth-card {
  border-radius: 24px;
  padding: 44px 40px;
  border: 1px solid rgba(133,148,180,.22);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(18px);
}
.auth-logo svg {
  width: 56px;
  height: 56px;
  filter: drop-shadow(0 10px 18px rgba(109,93,252,.28));
}
.auth-logo h1 { font-size: 25px; letter-spacing: -.025em; }
.auth-logo p { margin-top: 6px; }

/* Sidebar */
.sidebar {
  background:
    linear-gradient(180deg, rgba(118,104,255,.09), transparent 28%),
    var(--sidebar-bg);
  border-right: 1px solid rgba(148,163,184,.09);
  box-shadow: 12px 0 35px rgba(0,0,0,.08);
}
.sidebar-header { min-height: var(--topbar-height); padding: 15px 18px; }
.sidebar-logo { gap: 12px; }
.sidebar-logo svg {
  width: 38px;
  height: 38px;
  filter: drop-shadow(0 8px 16px rgba(109,93,252,.3));
  flex: 0 0 auto;
}
.sidebar-brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.sidebar-brand-text strong { color: #fff; font-size: 16px; letter-spacing: -.01em; }
.sidebar-brand-text small { color: #7783a2; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .12em; margin-top: 3px; }
.nav-list { padding: 16px 12px; }
.nav-section-title {
  padding: 5px 12px 9px;
  color: #596481;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
  list-style: none;
}
.nav-link {
  min-height: 44px;
  padding: 11px 13px;
  border-radius: 11px;
  gap: 12px;
  margin-bottom: 4px;
  font-weight: 600;
}
.nav-link svg { opacity: .84; flex: 0 0 auto; }
.nav-link:hover { transform: translateX(2px); }
.nav-link.active {
  background: linear-gradient(135deg, var(--sidebar-active), #887bff);
  box-shadow: 0 9px 22px rgba(109,93,252,.24);
}
.nav-link.active svg { opacity: 1; }
.sidebar-footer { padding: 13px 12px 18px; }
.sidebar-system {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 13px 12px;
  color: #6f7a98;
  font-size: 11px;
  font-weight: 600;
}
.sidebar-system span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #25c58b;
  box-shadow: 0 0 0 4px rgba(37,197,139,.11);
}

/* Topbar */
.topbar {
  min-height: var(--topbar-height);
  height: auto;
  padding: 10px 30px;
  backdrop-filter: blur(18px);
  box-shadow: 0 1px 0 rgba(148,163,184,.04);
}
.topbar-left, .topbar-right { display: flex; align-items: center; }
.topbar-left { gap: 12px; min-width: 0; }
.topbar-context { display: flex; flex-direction: column; min-width: 0; }
.topbar-context span { font-size: 14px; font-weight: 750; color: var(--text); white-space: nowrap; }
.topbar-context small { font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.topbar-right { gap: 10px; }
.icon-btn {
  width: 38px;
  height: 38px;
  padding: 0;
  justify-content: center;
  border-radius: 11px;
  background: var(--input-bg);
}
.admin-avatar {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, #6d5dfc, #1d9ac0);
  box-shadow: 0 7px 18px rgba(109,93,252,.22);
}
.admin-name { font-weight: 650; }

/* Page structure */
.page-body {
  width: 100%;
  max-width: 1580px;
  margin: 0 auto;
  padding: 30px;
}
.page-header { margin-bottom: 25px; align-items: flex-end; }
.page-heading { min-width: 0; }
.page-eyebrow {
  display: block;
  color: var(--primary);
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: .15em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.page-header h2 {
  font-size: clamp(23px, 2vw, 30px);
  line-height: 1.15;
  letter-spacing: -.035em;
}
.page-subtitle {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 7px;
  max-width: 700px;
}
.welcome-pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card-bg);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  padding: 8px 13px;
  box-shadow: var(--shadow);
}

/* Cards and statistics */
.card {
  border-radius: var(--radius);
  border-color: rgba(130,146,177,.18);
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}
.card-header {
  min-height: 62px;
  padding: 17px 20px;
  background: linear-gradient(180deg, rgba(123,135,169,.035), transparent);
}
.card-header h3 { font-size: 14px; font-weight: 750; letter-spacing: -.01em; }
.card > form { padding: 22px; }
.stats-grid { gap: 18px; }
.stat-card {
  position: relative;
  overflow: hidden;
  min-height: 110px;
  border-radius: var(--radius);
  border-color: rgba(130,146,177,.18);
  padding: 21px;
  box-shadow: var(--shadow);
}
.stat-card::after {
  content: "";
  position: absolute;
  width: 95px;
  height: 95px;
  right: -42px;
  top: -44px;
  border-radius: 50%;
  background: var(--primary-soft);
  opacity: .55;
}
.stat-icon {
  width: 50px;
  height: 50px;
  border-radius: 15px;
  box-shadow: inset 0 0 0 1px rgba(128,142,170,.09);
}
.stat-value { font-size: 27px; letter-spacing: -.04em; }
.stat-label { font-size: 11px; font-weight: 650; letter-spacing: .025em; text-transform: uppercase; }

/* Tables */
.table-wrap {
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
.table-wrap table { min-width: 620px; }
.table-wrap::-webkit-scrollbar { height: 7px; }
.table-wrap::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; }
thead tr { background: var(--bg-secondary); }
th {
  padding: 13px 17px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .095em;
}
td { padding: 14px 17px; font-size: 13px; vertical-align: middle; }
tbody tr { transition: background var(--transition); }
tbody tr:hover { background: var(--primary-soft); }
.table-user { display: flex; align-items: center; gap: 10px; min-width: 190px; }
.table-user-avatar {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary-soft), var(--info-soft));
  color: var(--primary);
  font-weight: 800;
}
.table-user > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.table-user small, .cell-note { display: block; color: var(--text-muted); font-size: 10.5px; margin-top: 2px; }
.empty-state { text-align: center; color: var(--text-muted); padding: 42px !important; }

/* Badges and buttons */
.badge {
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 750;
  letter-spacing: .015em;
  border: 1px solid currentColor;
  border-color: color-mix(in srgb, currentColor 18%, transparent);
}
.btn {
  min-height: 38px;
  justify-content: center;
  padding: 8px 15px;
  border-radius: 10px;
  font-weight: 700;
  box-shadow: 0 1px 2px rgba(15,23,42,.05);
}
.btn:hover { opacity: 1; transform: translateY(-1px); }
.btn-primary {
  background: linear-gradient(135deg, var(--primary), #7c70ff);
  box-shadow: 0 8px 18px rgba(109,93,252,.2);
}
.btn-outline { background: var(--input-bg); border-color: var(--border); }
.btn-xs { min-height: 31px; padding: 5px 9px; border-radius: 8px; font-size: 11.5px; }
.btn-sm { min-height: 33px; }
.action-btns { gap: 6px; }

/* Forms */
.form-group { margin-bottom: 18px; }
.form-group label {
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 750;
  letter-spacing: .015em;
  margin-bottom: 7px;
}
.label-optional {
  display: inline-block;
  margin-left: 5px;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--bg-tertiary);
  color: var(--text-muted);
  font-size: 9px;
  text-transform: uppercase;
}
.form-group input,
.form-group select,
.form-group textarea,
.search-form input,
.search-form select {
  min-height: 44px;
  padding: 10px 13px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background-color: var(--input-bg);
  color: var(--text);
}
.form-group textarea { min-height: 86px; resize: vertical; }
.form-group input:hover,
.form-group select:hover,
.form-group textarea:hover,
.search-form input:hover,
.search-form select:hover { border-color: var(--border-strong); }
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
.search-form input:focus,
.search-form select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(109,93,252,.12);
  outline: none;
}
.form-group input:disabled,
.form-group select:disabled { opacity: .62; cursor: not-allowed; }
.form-grid-2 { column-gap: 18px; }
.form-footer { padding-top: 18px; }
.package-preview {
  position: relative;
  margin-top: 8px;
  padding: 9px 11px 9px 30px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--bg-secondary);
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.45;
}
.package-preview::before {
  content: "i";
  position: absolute;
  left: 10px;
  top: 9px;
  width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
}
.search-form { gap: 9px; }
.search-form input { min-width: 240px; }

/* Modals and feedback */
.modal-backdrop {
  background: rgba(4,8,18,.68);
  backdrop-filter: blur(5px);
}
.modal-box {
  max-width: 680px;
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
}
.modal-header {
  min-height: 68px;
  padding: 19px 25px;
  background: color-mix(in srgb, var(--card-bg) 94%, transparent);
  backdrop-filter: blur(14px);
}
.modal-header h3 { font-size: 17px; font-weight: 780; letter-spacing: -.02em; }
.modal-header button {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
}
.modal-box > form { padding: 24px 25px 0; }
.modal-box form .modal-footer {
  margin: 8px -25px 0;
  padding: 17px 25px;
  background: var(--bg-secondary);
  position: sticky;
  bottom: 0;
}
.modal-footer { gap: 9px; }
@keyframes modalIn {
  from { opacity: 0; transform: scale(.975) translateY(12px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.alert { border-radius: 12px; padding: 13px 15px; font-weight: 550; box-shadow: 0 4px 16px rgba(0,0,0,.04); }
.toast { border-radius: 12px; padding: 13px 18px; box-shadow: var(--shadow-lg); }

/* Settings and utilities */
.settings-grid { align-items: start; }
.quick-action-btn {
  min-width: 150px;
  border-radius: 13px;
  background: var(--input-bg);
}
.pagination { gap: 7px; }
.page-btn { min-width: 34px; text-align: center; padding: 7px 10px; border-radius: 9px; background: var(--input-bg); }
code { border: 1px solid var(--border); }

/* Responsive refinements */
@media (max-width: 1100px) {
  .page-body { padding: 24px; }
}

@media (max-width: 768px) {
  .sidebar { width: min(86vw, 290px); }
  .sidebar-overlay.open { display: block; backdrop-filter: blur(3px); }
  .topbar { min-height: 62px; padding: 8px 15px; }
  .topbar-context small { display: none; }
  .topbar-context span { font-size: 13px; max-width: 42vw; overflow: hidden; text-overflow: ellipsis; }
  .page-body { padding: 20px 15px 28px; }
  .page-header { align-items: flex-start; margin-bottom: 20px; }
  .page-header > .btn, .page-header > .action-btns { width: 100%; }
  .page-header > .btn { justify-content: center; }
  .page-header > .action-btns .btn { flex: 1; }
  .page-header h2 { font-size: 25px; }
  .page-subtitle { font-size: 12px; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
  .stat-card { min-height: 96px; padding: 15px; gap: 12px; }
  .stat-icon { width: 43px; height: 43px; border-radius: 12px; }
  .card-header { flex-direction: column; align-items: stretch; min-height: auto; padding: 15px; }
  .card-header > .text-muted { font-size: 11px; }
  .table-wrap table { min-width: 680px; }
  th:nth-child(n+5) { display: table-cell; }
  th, td { padding-left: 14px; padding-right: 14px; }
  .search-form { width: 100%; }
  .search-form input { flex: 1 1 100%; min-width: 0; width: 100%; }
  .search-form select { flex: 1; min-width: 130px; }
  .search-form .btn { flex: 1; }
  .form-grid-2 { grid-template-columns: 1fr; }
  .modal { padding: 12px; }
  .modal-box { max-height: 92dvh; }
  .toast { left: 15px; right: 15px; bottom: max(15px, env(safe-area-inset-bottom)); text-align: center; }
  .quick-actions { padding: 15px; }
  .quick-action-btn { flex: 1 1 145px; }
}

@media (max-width: 520px) {
  .stats-grid { grid-template-columns: 1fr; }
  .stat-card { min-height: 92px; }
  .admin-name { display: none; }
  .topbar-right { gap: 7px; }
  .page-header { gap: 16px; }
  .welcome-pill { width: 100%; justify-content: center; }
  .modal {
    padding: 0;
    align-items: flex-end;
  }
  .modal-box {
    position: relative;
    inset: auto;
    margin: 0;
    max-width: 100%;
    width: 100%;
    max-height: 94dvh;
    border-radius: 20px 20px 0 0;
    border-bottom: 0;
  }
  .modal-header { min-height: 62px; padding: 16px 18px; }
  .modal-box > form { padding: 20px 18px 0; }
  .modal-box form .modal-footer {
    margin: 7px -18px 0;
    padding: 14px 18px calc(14px + env(safe-area-inset-bottom));
  }
  .modal-footer .btn { flex: 1; }
  .auth-card { padding: 34px 23px; border-radius: 20px; }
  .auth-body { padding: 15px; }
}
