/* ==========================================================
   Khawaja Tech — Admin panel
   Same palette as the public site (styles.css), self-contained so the
   marketing header/footer rules never leak in.
   ========================================================== */

:root {
  --ink: #0b0d12;
  --ink-soft: #4a5160;
  --gold: #c9a227;
  --gold-light: #e8c85a;
  --blue: #0a4fb8;
  --blue-light: #2874fc;
  --paper: #ffffff;
  --mist: #f6f7fb;
  --line: #e7e9ef;
  --danger: #d93a2b;
  --success: #12966b;
  --radius: 16px;
  --radius-md: 12px;
  --shadow: 0 10px 30px rgba(10, 20, 40, .08);

  /* Names the meeting styles (ported from DevScope) expect. */
  --accent: var(--blue-light);
  --accent-2: #22c3a6;
  --gradient: linear-gradient(135deg, var(--blue) 0%, var(--blue-light) 100%);
  --surface-2: var(--paper);
  --border: var(--line);
  --bg-alt: var(--mist);
  --text-dim: var(--ink-soft);
  --text-faint: #8a91a0;

  --sidebar-w: 248px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--mist);
  line-height: 1.55;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
p { margin: 0; }
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 20px;
  border-radius: 999px;
  border: 1px solid transparent;
  font: inherit; font-weight: 700; font-size: .9rem;
  cursor: pointer; white-space: nowrap;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease, color .15s ease;
}
.btn:disabled { opacity: .6; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--gradient); color: #fff; box-shadow: 0 6px 16px rgba(10, 79, 184, .28); }
.btn-primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(10, 79, 184, .36); }
.btn-ghost, .btn-outline { background: #fff; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover:not(:disabled), .btn-outline:hover:not(:disabled) { border-color: var(--ink); }
.btn-danger { background: #fff; color: var(--danger); border-color: rgba(217, 58, 43, .35); }
.btn-danger:hover:not(:disabled) { background: var(--danger); color: #fff; }
.btn-sm { padding: 7px 14px; font-size: .82rem; }
.btn-block { width: 100%; }

/* ---------- Forms ---------- */

.form { display: flex; flex-direction: column; gap: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 560px) { .form-row { grid-template-columns: 1fr; } }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: .85rem; font-weight: 700; color: var(--ink); }
.field .optional { color: var(--text-faint); font-weight: 400; }
.field input, .field select, .field textarea {
  width: 100%;
  font: inherit; font-size: .95rem;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field textarea { resize: vertical; min-height: 90px; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--blue-light); box-shadow: 0 0 0 3px rgba(40, 116, 252, .15);
}
.field-hint { font-size: .8rem; color: var(--text-faint); }

.form-note { font-size: .88rem; min-height: 1.2em; margin-top: 10px; }
.form-note:empty { display: none; }
.form-note.is-error { color: var(--danger); }
.form-note.is-success { color: var(--success); }

/* ---------- Shell: sidebar + main ---------- */

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

.admin-sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  padding: 22px 16px;
  background: var(--ink);
  color: #fff;
}
.admin-brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 22px; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.admin-brand img { width: 40px; height: 40px; border-radius: 10px; object-fit: cover; background: #fff; }
.admin-brand b { display: block; font-size: 1rem; }
.admin-brand span { display: block; font-size: .68rem; letter-spacing: .14em; color: var(--gold-light); }

.admin-nav { display: flex; flex-direction: column; gap: 4px; margin-top: 18px; flex: 1; }
.admin-nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  color: rgba(255, 255, 255, .72);
  font-weight: 600; font-size: .92rem;
}
.admin-nav a svg { width: 20px; height: 20px; flex-shrink: 0; }
.admin-nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.admin-nav a.active { background: rgba(40, 116, 252, .18); color: #fff; box-shadow: inset 3px 0 0 var(--gold); }
.admin-nav-sep { height: 1px; background: rgba(255, 255, 255, .08); margin: 10px 4px; }

.admin-user { border-top: 1px solid rgba(255, 255, 255, .08); padding-top: 16px; }
.admin-user-row { display: flex; align-items: center; gap: 10px; padding: 0 6px; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  background: var(--gradient); color: #fff; font-weight: 700;
}
.admin-user-meta { min-width: 0; }
.admin-user-name { display: block; font-weight: 700; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.admin-user-actions { display: flex; gap: 6px; margin-top: 12px; }
.admin-user-actions button {
  flex: 1;
  padding: 8px; border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, .12);
  background: transparent; color: rgba(255, 255, 255, .8);
  font: inherit; font-size: .78rem; font-weight: 600; cursor: pointer;
}
.admin-user-actions button:hover { background: rgba(255, 255, 255, .08); color: #fff; }

.admin-topbar { display: none; }

.admin-main { min-width: 0; padding: 32px 36px 60px; }
.admin-container { max-width: 1100px; margin: 0 auto; }
.admin-container.is-narrow { max-width: 820px; }

@media (max-width: 900px) {
  .admin-shell { grid-template-columns: 1fr; }
  .admin-topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    position: sticky; top: 0; z-index: 30;
    padding: 12px 16px;
    background: var(--ink); color: #fff;
  }
  .admin-topbar .admin-brand { padding: 0; border: 0; }
  .admin-menu-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 42px; height: 42px; border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, .15); background: transparent; color: #fff; cursor: pointer;
  }
  .admin-sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 40;
    width: min(82vw, 300px);
    transform: translateX(-100%);
    transition: transform .2s ease;
  }
  body.nav-open .admin-sidebar { transform: none; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .45); }
  .admin-main { padding: 20px 16px 48px; }
}

/* ---------- Page pieces ---------- */

.breadcrumb { display: inline-block; font-size: .85rem; font-weight: 600; color: var(--ink-soft); margin-bottom: 14px; }
.breadcrumb:hover { color: var(--blue); }

.eyebrow {
  display: inline-block;
  font-size: .72rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  color: var(--gold-light);
  background: rgba(201, 162, 39, .14);
  padding: 5px 12px; border-radius: 999px;
}

/* Dark hero card at the top of each page. */
.admin-hero {
  position: relative; overflow: hidden;
  padding: 28px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--ink) 0%, #12203d 55%, var(--blue) 130%);
  color: #fff;
}
.admin-hero::after {
  content: ''; position: absolute; right: -80px; top: -80px;
  width: 260px; height: 260px; border-radius: 50%;
  background: radial-gradient(circle, rgba(201, 162, 39, .28), transparent 70%);
  pointer-events: none;
}
.admin-hero-head { position: relative; z-index: 1; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.admin-hero h1 { font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 800; letter-spacing: -.02em; margin: 10px 0 6px; }
.admin-hero p { color: rgba(255, 255, 255, .72); }
.admin-hero .meeting-hero-stats { position: relative; z-index: 1; }

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.card-head h2 { font-size: 1.1rem; }
.card-head p { font-size: .85rem; color: var(--ink-soft); }
.stack { margin-top: 22px; }

.step-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); margin-top: 18px; box-shadow: var(--shadow); }
.step-head { display: flex; align-items: center; gap: 14px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.step-num {
  width: 38px; height: 38px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(10, 79, 184, .08); color: var(--blue); font-weight: 800;
}
.step-head h2 { font-size: 1rem; }
.step-head p { font-size: .82rem; color: var(--ink-soft); }
.step-body { padding: 22px; }

.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; flex-wrap: wrap; }

/* ---------- Badges ---------- */

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  padding: 4px 10px; border-radius: 999px;
  background: var(--mist); color: var(--ink-soft);
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.is-active { background: rgba(18, 150, 107, .1); color: var(--success); }
.badge.is-expired { background: rgba(217, 58, 43, .08); color: var(--danger); }
.badge.is-admin { background: rgba(201, 162, 39, .14); color: #8a6d0f; }
.badge.is-staff { background: rgba(10, 79, 184, .08); color: var(--blue); }
.badge.is-plain::before { display: none; }

/* ---------- Dashboard ---------- */

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-top: 22px; }
.stat-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.stat-card-label { font-size: .8rem; font-weight: 600; color: var(--ink-soft); }
.stat-card-value { font-size: 1.9rem; font-weight: 800; letter-spacing: -.02em; margin-top: 4px; }

.quick-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.quick-link {
  display: flex; align-items: center; gap: 14px;
  padding: 18px; border-radius: var(--radius-md);
  border: 1px solid var(--line); background: #fff;
  transition: border-color .15s ease, transform .15s ease;
}
.quick-link:hover { border-color: var(--blue-light); transform: translateY(-1px); }
.quick-link-icon {
  width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(10, 79, 184, .08); color: var(--blue);
}
.quick-link b { display: block; }
.quick-link span { font-size: .82rem; color: var(--ink-soft); }

/* ---------- Table (members) ---------- */

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th {
  text-align: left; font-size: .74rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-faint); padding: 10px 12px; border-bottom: 1px solid var(--line);
}
.table td { padding: 14px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.member-cell { display: flex; align-items: center; gap: 12px; }
.member-cell .avatar { width: 34px; height: 34px; font-size: .85rem; }
.member-cell small { display: block; color: var(--ink-soft); font-size: .8rem; }
.table-actions { display: flex; justify-content: flex-end; gap: 6px; flex-wrap: wrap; }
.muted { color: var(--text-faint); }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toolbar input, .toolbar select {
  font: inherit; font-size: .88rem;
  padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff;
}
.toolbar input:focus, .toolbar select:focus { outline: none; border-color: var(--blue-light); }

.segmented { display: inline-flex; padding: 4px; background: var(--mist); border: 1px solid var(--line); border-radius: 999px; }
.segmented button {
  border: 0; background: transparent; font: inherit; font-size: .82rem; font-weight: 700;
  padding: 6px 14px; border-radius: 999px; color: var(--ink-soft); cursor: pointer;
}
.segmented button.active { background: #fff; color: var(--ink); box-shadow: 0 1px 4px rgba(10, 20, 40, .1); }

/* ---------- Dialogs ---------- */

.admin-dialog {
  width: min(520px, calc(100vw - 32px));
  border: 0; border-radius: var(--radius);
  padding: 26px;
  box-shadow: 0 30px 80px rgba(10, 20, 40, .3);
}
.admin-dialog::backdrop { background: rgba(11, 13, 18, .5); }
.admin-dialog h2 { font-size: 1.2rem; margin-bottom: 18px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; flex-wrap: wrap; }

.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 100;
  transform: translateX(-50%);
  padding: 10px 18px; border-radius: 999px;
  background: var(--ink); color: #fff; font-size: .88rem; font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
}

/* ---------- Auth pages (sign in / setup) ---------- */

.auth-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px 16px;
  background:
    radial-gradient(circle at 15% 10%, rgba(40, 116, 252, .25), transparent 45%),
    radial-gradient(circle at 90% 90%, rgba(201, 162, 39, .18), transparent 40%),
    var(--ink);
}
.auth-card { width: 100%; max-width: 420px; background: #fff; border-radius: 20px; padding: 32px 28px; box-shadow: 0 30px 80px rgba(0, 0, 0, .35); }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.auth-brand img { width: 46px; height: 46px; border-radius: 12px; object-fit: cover; }
.auth-brand b { display: block; font-size: 1.05rem; }
.auth-brand span { display: block; font-size: .7rem; letter-spacing: .14em; color: var(--ink-soft); }
.auth-card h1 { font-size: 1.45rem; font-weight: 800; letter-spacing: -.02em; }
.auth-card > p { color: var(--ink-soft); font-size: .92rem; margin: 6px 0 22px; }
.auth-foot { margin-top: 18px; text-align: center; font-size: .85rem; color: var(--ink-soft); }
.auth-foot a { color: var(--blue); font-weight: 600; }
