/* Shared chrome for the admin pages (admin.html, admin-users.html): reset,
   theme tokens, top nav, account avatar/menu, and the few layout primitives
   both pages share. Page-specific styling (KPIs, cards, roster, charts, map)
   stays in each page's own <style>. Link this BEFORE the inline <style> so a
   page can still override a shared rule. Paired with admin-chrome.js. */

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

/* ===== V2 "Ledger" — payroll/finance gravitas ===== */
:root {
  --font: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --display: "IBM Plex Sans", var(--font);
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --radius: 8px;
  --radius-sm: 5px;
}
:root[data-theme="light"] {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #eef2f7;
  --text: #15233b;
  --muted: #5a6b85;
  --border: #dfe5ec;
  --hover: #eef2f7;
  --chrome: #0f1e3d;
  --accent: #b8893b;
  --accent-hover: #a37a31;
  --accent-tint: #f7efe2;
  --positive: #15803d;
  --positive-tint: #eaf5ee;
  --negative: #b91c1c;
  --negative-tint: #fbeaea;
  --danger: #b91c1c;
  --amber: #b8893b;
  --amber-tint: #f7efe2;
  --shadow: 0 1px 2px rgba(15, 35, 61, 0.04), 0 1px 3px rgba(15, 35, 61, 0.06);
  --ring: rgba(184, 137, 59, 0.4);
}
:root[data-theme="dark"] {
  --bg: #0c1622;
  --surface: #11202f;
  --surface-2: #18293a;
  --text: #e6edf5;
  --muted: #8da3bd;
  --border: rgba(255, 255, 255, 0.09);
  --hover: rgba(255, 255, 255, 0.05);
  --chrome: #0a1420;
  --accent: #cda04e;
  --accent-hover: #d9b066;
  --accent-tint: rgba(205, 160, 78, 0.14);
  --positive: #34d399;
  --positive-tint: rgba(52, 211, 153, 0.14);
  --negative: #f87171;
  --negative-tint: rgba(248, 113, 113, 0.14);
  --danger: #f87171;
  --amber: #cda04e;
  --amber-tint: rgba(205, 160, 78, 0.14);
  --shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  --ring: rgba(205, 160, 78, 0.45);
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Top nav (navy chrome, gold active rule) ---------- */
.topnav {
  background: var(--chrome);
  position: sticky;
  top: 0;
  z-index: 50;
}
.topnav__inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 28px;
  height: 60px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  flex-shrink: 0;
}
.brand__mark {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  flex: none;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #0f1e3d;
  font-family: var(--display);
  font-weight: 700;
  font-size: 16px;
}
.brand__name {
  font-family: var(--display);
  font-weight: 700;
  font-size: 16px;
  color: #fff;
  letter-spacing: -0.3px;
}
.nav-tabs {
  display: flex;
  align-items: center;
  height: 100%;
  margin-left: auto;
}
.nav-tab {
  display: flex;
  align-items: center;
  height: 60px;
  padding: 0 16px;
  font-size: 14px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition:
    color 0.15s,
    border-color 0.15s;
  white-space: nowrap;
}
.nav-tab:hover {
  color: #fff;
}
.nav-tab--active {
  color: #fff;
  border-bottom-color: var(--accent);
  font-weight: 600;
}
.nav-tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  border-radius: 3px;
}
.section-badge {
  font-size: 12px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.72);
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 4px;
  padding: 3px 10px;
  white-space: nowrap;
}
.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition:
    background 0.15s,
    color 0.15s,
    border-color 0.15s,
    transform 0.05s;
}
.icon-btn:hover {
  background: var(--hover);
  color: var(--text);
  border-color: var(--accent);
}
.icon-btn:active {
  transform: translateY(1px);
}
.icon-btn:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}
.topnav .icon-btn {
  border-color: rgba(255, 255, 255, 0.22);
  color: rgba(255, 255, 255, 0.85);
}
.topnav .icon-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.45);
}

/* ---------- Account avatar + menu (mirrors the main app) ---------- */
.avatar-wrap {
  position: relative;
}
.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: var(--accent);
  color: #0f1e3d;
  font-family: var(--display);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    box-shadow 0.15s,
    transform 0.05s;
}
.avatar:hover {
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.18);
}
.avatar:active {
  transform: translateY(1px);
}
.avatar:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}
.menu {
  position: absolute;
  top: 48px;
  right: 0;
  min-width: 180px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  padding: 6px 0;
  z-index: 60;
}
.menu__email {
  padding: 8px 14px;
  font-size: 12px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
  word-break: break-all;
}
.menu__item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 14px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  transition: background 0.15s;
}
.menu__item:hover {
  background: var(--hover);
}

.wrap {
  padding: 32px 24px 64px;
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.banner {
  background: var(--accent-tint);
  color: var(--text);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 14px;
}

.loading {
  color: var(--muted);
  font-size: 14px;
  padding: 60px 0;
  text-align: center;
}

/* Must beat inline display on #loginGate, else the hidden attr is ignored. */
[hidden] {
  display: none !important;
}

/* Narrow screens: tighten the nav and drop the section badge. */
@media (max-width: 600px) {
  .topnav__inner {
    padding: 0 16px;
    gap: 14px;
  }
  .nav-tab {
    padding: 0 12px;
    font-size: 13px;
  }
  .section-badge {
    display: none;
  }
  .wrap {
    padding: 20px 16px 48px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}
