/* =========================================================================
   Skill IT BD Admin panel
   ========================================================================= */
:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-hover: #f1f5f9;
  --border: #e6eaf1;
  --border-strong: #d3dae6;

  --text: #101728;
  --text-muted: #5b6b85;
  --text-subtle: #8a97ad;

  --accent: #0284c7;
  --accent-hover: #0369a1;
  --accent-soft: #e0f2fe;

  --success: #0f9d58;
  --success-soft: #e3f6ec;
  --warning: #b7791f;
  --warning-soft: #fdf3e0;
  --danger: #e02424;
  --danger-soft: #fdecec;

  --ring: rgba(2, 132, 199, 0.28);
  --shadow-sm: 0 1px 2px rgba(16, 23, 40, 0.06);
  --shadow: 0 4px 16px rgba(16, 23, 40, 0.08);
  --shadow-lg: 0 18px 48px rgba(16, 23, 40, 0.18);

  --radius: 12px;
  --radius-sm: 9px;
  --sidebar-w: 248px;

  --font: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.5;
}
[hidden] { display: none !important; }
button { font: inherit; cursor: pointer; }
input { font: inherit; }
svg { display: block; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-weight: 600;
  white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, opacity .15s;
}
.btn:disabled { opacity: .6; cursor: default; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-ghost { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-hover); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #c81e1e; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 38px; height: 38px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-muted);
}
.icon-btn:hover { background: var(--surface-hover); }

/* ---------- form fields ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--text-muted); }
.field-hint { font-weight: 400; color: var(--text-subtle); font-size: 12px; }

.expiry-presets { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.preset {
  height: 28px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 600;
  transition: background .15s, color .15s, border-color .15s;
}
.preset:hover { background: var(--surface-hover); color: var(--text); }
.preset.is-active { background: var(--accent-soft); color: var(--accent-hover); border-color: var(--accent-soft); }
.field input {
  height: 40px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
.form-error {
  margin: 0;
  color: var(--danger);
  background: var(--danger-soft);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
}

/* ---------- login ---------- */
.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(1100px 500px at 50% -10%, #e6f2fb 0%, transparent 60%),
    var(--bg);
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 40px; height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), #0ea5e9);
  color: #fff;
  font-weight: 700;
  letter-spacing: .5px;
  flex: none;
}
.brand-logo {
  width: 40px; height: 40px;
  border-radius: 10px;
  object-fit: contain;
  background: #fff;
  flex: none;
}
.brand-logo-sm { width: 30px; height: 30px; border-radius: 8px; }
.brand-name { font-weight: 700; font-size: 16px; }
.brand-sub, .who-email { color: var(--text-subtle); font-size: 12px; }

/* ---------- layout ---------- */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* ---------- sidebar ---------- */
.sidebar {
  grid-column: 1;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 18px; }
.nav { flex: 1; }
.nav-label {
  margin: 8px 8px 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .6px;
  text-transform: uppercase;
  color: var(--text-subtle);
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-weight: 600;
  text-align: left;
}
.nav-item:hover { background: var(--surface-hover); color: var(--text); }
.nav-item.is-active { background: var(--accent-soft); color: var(--accent-hover); }
.nav-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }

.sidebar-foot {
  border-top: 1px solid var(--border);
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.who-name { font-weight: 600; font-size: 13px; }

.sidebar-scrim {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(16, 23, 40, 0.45);
  z-index: 30;
}

/* ---------- main ---------- */
.main { grid-column: 2; padding: 22px 26px 40px; min-width: 0; }
.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}
.page-title { margin: 0; font-size: 20px; font-weight: 700; }
.page-sub { margin: 0; color: var(--text-subtle); font-size: 13px; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-subtle);
}
.search input { border: none; outline: none; background: transparent; width: 200px; color: var(--text); }

/* ---------- stats ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.stat-num { font-size: 26px; font-weight: 700; line-height: 1.1; }
.stat-label { color: var(--text-subtle); font-size: 13px; }

/* ---------- table ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; min-width: 720px; }
.table thead th {
  text-align: left;
  font-size: 12px;
  letter-spacing: .4px;
  text-transform: uppercase;
  color: var(--text-subtle);
  font-weight: 700;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  white-space: nowrap;
}
.table tbody td { padding: 14px 18px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--surface-2); }
.col-actions { text-align: right; }

.u-name { font-weight: 600; }
.u-email { color: var(--text-subtle); font-size: 13px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-pending { color: var(--warning); background: var(--warning-soft); }
.badge-approved { color: var(--success); background: var(--success-soft); }
.badge-banned { color: var(--danger); background: var(--danger-soft); }
.badge-expired { color: var(--text-muted); background: var(--surface-hover); }
.badge-device { color: var(--accent-hover); background: var(--accent-soft); }

.expiry-cell { white-space: nowrap; }
.expiry-warn { color: var(--danger); font-weight: 600; }
.muted { color: var(--text-subtle); }

.row-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.link-btn {
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  height: 30px;
  padding: 0 10px;
  border-radius: 7px;
  font-size: 12.5px;
  font-weight: 600;
}
.link-btn:hover { background: var(--surface-hover); }
.link-btn.danger { color: var(--danger); border-color: var(--danger-soft); }
.link-btn.danger:hover { background: var(--danger-soft); }
.link-btn.approve { color: #fff; background: var(--accent); border-color: var(--accent); }
.link-btn.approve:hover { background: var(--accent-hover); }

.empty { padding: 40px; text-align: center; color: var(--text-subtle); }
.loading { padding: 40px; text-align: center; color: var(--text-subtle); }

/* ---------- modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(16, 23, 40, 0.5);
  display: grid;
  place-items: center;
  padding: 24px;
  z-index: 50;
}
.modal-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.modal-card h3 { margin: 0; font-size: 17px; }
.modal-desc { margin: 0; color: var(--text-muted); font-size: 13px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }

/* ---------- toast ---------- */
.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: #101728;
  color: #fff;
  padding: 11px 18px;
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  font-size: 13.5px;
  font-weight: 500;
  z-index: 60;
  max-width: 90vw;
}
.toast.error { background: var(--danger); }

.only-mobile { display: none; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .only-mobile { display: inline-grid; }
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    z-index: 40;
    left: 0; top: 0;
    width: 264px;
    transform: translateX(-100%);
    transition: transform .22s ease;
  }
  .layout.nav-open .sidebar { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .layout.nav-open .sidebar-scrim { display: block; }
  .main { grid-column: 1; padding: 16px; }
  .topbar-actions { flex-wrap: wrap; }
  .search input { width: 130px; }
}
@media (max-width: 480px) {
  .stats { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .topbar-actions .search { flex: 1; }
  .search input { width: 100%; }
}
