/* ===================================================
   GeniusOne Portal — Human-Crafted Design System
   Aesthetic: Refined Editorial / Legal Document Feel
   Fonts: Lora (display) + Source Sans 3 (body) + JetBrains Mono
   =================================================== */

@import url('https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500&family=Source+Sans+3:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

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

:root {
  /* Core palette — blue / white brand theme (mint kept as a subtle accent) */
  --ink:        #0a0a0a;
  --ink-mid:    #171717;
  --navy:       #106EBE;  /* brand blue (primary) */
  --navy-deep:  #0c5694;  /* darker blue for hover/depth */
  --navy-soft:  #2c8ad4;  /* lighter blue for hover/soft accents */
  --mint:       #0FFCBE;  /* mint — subtle decorative accent only (gradients/stripes) */
  --mint-deep:  #0bc497;  /* deeper mint for text-on-light use */
  --mint-medium: #5FCBA0; /* medium mint green — sidebar background (muted for a professional look) */
  --orange:      #F97316; /* click/tap feedback accent */
  --orange-deep: #C2410C; /* stronger pressed-state orange */
  --crimson:    #b91c1c;  /* true semantic danger/error red — not decorative */
  --rust:       #525252;  /* now neutral gray, decorative accents */
  --amber:      #737373;  /* now neutral gray, decorative accents */

  /* Plain neutrals */
  --parchment:  #ffffff;
  --cream:      #ffffff;
  --linen:      #E8FBF4;
  --sand:       #e5e5e5;
  --stone:      #d4d4d4;
  --slate:      #6b6b6b;
  --ash:        #404040;
  --char:       #171717;

  /* Semantic */
  --border:     1px solid var(--sand);
  --border-mid: 1px solid var(--stone);
  --radius-sm:  4px;
  --radius:     6px;
  --radius-lg:  10px;
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.06);
  --shadow:     0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg:  0 12px 40px rgba(0,0,0,0.14);

  /* Typography */
  --font-display: 'Lora', Georgia, serif;
  --font:         'Source Sans 3', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', 'Courier New', monospace;
}

html, body {
  font-family: var(--font);
  background: var(--cream);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
  height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#app { height: 100vh; display: flex; flex-direction: column; }

/* ── SCREENS ── */
.screen { display: none; flex: 1; height: 100vh; }
.screen.active { display: flex; }
#screen-app.active { position: relative; }

/* ════════════════════════════════════════
   LOGIN — split panel layout
════════════════════════════════════════ */
.login-wrap {
  flex: 1;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  background: var(--cream);
  height: 100vh;
  overflow: hidden;
}

/* ── Left: brand / marketing panel ── */
.login-split-left {
  flex: 0 0 50%;
  max-width: none; 
  min-width: 380px;
  background: linear-gradient(160deg, #063d2c 0%, #0a8f6e 45%, var(--mint) 130%);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3.5rem 3.5rem;
  overflow: hidden;
}
.login-split-left::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 15% 20%, rgba(255,255,255,0.08) 0%, transparent 45%),
    radial-gradient(circle at 85% 85%, rgba(15,252,190,0.18) 0%, transparent 50%);
  pointer-events: none;
}
.login-left-inner {
  position: relative;
  z-index: 1;
  color: #ffffff;
  max-width: 440px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.login-left-logo-top {
  display: none;
}
.login-left-logo-img {
  width: auto;
  max-width: 150px;
  height: auto;
  object-fit: contain;
  mix-blend-mode: multiply;
}
.login-left-brand {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.3px;
  margin-bottom: 2.5rem;
  opacity: 0.95;
}
.login-left-headline {
  font-family: var(--font-display);
  font-size: 42px;
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin: 0 0 0.35rem 0;
  color: #ffffff;
}
.login-left-headline span {
  color: var(--mint);
}
.login-left-tagline {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.2px;
  color: var(--mint);
  margin: 0 0 3.5rem 0;
}
.login-left-sub {
  font-size: 14.5px;
  line-height: 1.6;
  color: rgba(255,255,255,0.82);
  margin-bottom: 2rem;
  max-width: 380px;
}
.login-left-features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 26px;
  margin: 0;
  padding: 0;
}
.login-left-features li {
  position: relative;
  padding-left: 28px;
  font-size: 15.5px;
  line-height: 1.5;
  font-weight: 500;
  color: rgba(255,255,255,0.94);
}
.login-left-features li::before {
  content: '';
  position: absolute;
  left: 0; top: 4px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: rgba(15,252,190,0.2);
  border: 1.5px solid var(--mint);
}
.login-left-features li::after {
  content: '';
  position: absolute;
  left: 5px; top: 9px;
  width: 6px; height: 3px;
  border-left: 1.5px solid var(--mint);
  border-bottom: 1.5px solid var(--mint);
  transform: rotate(-45deg);
}
.login-left-footer {
  font-size: 11px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.55);
  font-weight: 600;
}

/* ── Right: sign-in form panel ── */
.login-split-right {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--cream);
  padding: 2rem;
  overflow-y: auto;
}

.login-card {
  background: transparent;
  padding: 0;
  width: 100%;
  max-width: 460px;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  position: relative;
}

.login-card-logo-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-bottom: 0.25rem;
}
.login-card-logo-img {
  width: auto;
  max-width: 210px;
  height: auto;
  object-fit: contain;
}

.login-welcome-title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.4px;
  text-align: center;
}
.login-welcome-sub {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  text-align: center;
  margin-top: 0;
}

/* ── Login section text sized to 14px ── */
#screen-login .field label {
  font-size: 14px;
}
#screen-login .field input {
  font-size: 14px;
}
#screen-login .login-link-row {
  font-size: 14px;
}
#screen-login .login-pane-sub {
  font-size: 14px;
}
#screen-login .btn-full {
  font-size: 14px;
}

/* ── Sign-in pane: enlarged card ── */
#login-pane-signin .field input {
  font-size: 15.5px;
  padding: 12px 14px;
}
#login-pane-signin .btn-full {
  font-size: 15.5px;
  padding: 13px;
}
#screen-login .login-card .login-title {
  font-size: 21px;
}
#screen-login .login-card .login-welcome-sub {
  font-size: 15.5px;
}

@media (max-width: 840px) {
  .login-split-left { display: none; }
  .login-split-right { flex: 1 1 100%; }
}

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding-bottom: 1.25rem;
  border-bottom: var(--border);
}

.brand-circle {
  width: 46px; height: 46px;
  background: var(--navy);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #fff;
  font-size: 20px;
  font-family: var(--font-display);
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(16,110,190,0.35);
}
.brand-circle.sm { width: 34px; height: 34px; font-size: 14px; }

.brand-text .brand-name {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: -0.3px;
}
.brand-text .brand-name.sm { font-size: 15px; font-weight: 600; }
.brand-text .brand-tag {
  font-size: 10px;
  color: var(--slate);
  letter-spacing: 1.2px;
  text-transform: uppercase;
  font-weight: 600;
  margin-top: 1px;
}

.login-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 500;
  color: var(--ink-mid);
  font-style: italic;
  text-align: center;
}

.login-pane-sub {
  font-size: 12.5px;
  color: var(--slate);
  text-align: center;
  line-height: 1.5;
  margin: -8px 0 4px;
}

.login-link-row {
  text-align: center;
  font-size: 12.5px;
  margin-top: 2px;
}
.login-link-row a {
  color: var(--navy);
  text-decoration: none;
  font-weight: 500;
}
.login-link-row a:hover { text-decoration: underline; }

/* ── Remember-me toggle (login form) ── */
/* Made more visually distinct: bigger box, darker border, a light
   background "chip" so the control doesn't blend into the white card,
   and a bolder label so it reads as an actual choice, not a footnote. */
.remember-me-row {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink, #1f2933);
  text-transform: none;
  letter-spacing: normal;
  margin: 2px 0 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--sand, #f4f6f4);
  border: 1px solid var(--sand-dark, #dfe6e0);
  user-select: none;
  transition: background 0.15s, border-color 0.15s;
}
.remember-me-row:hover {
  background: #eef2ee;
  border-color: var(--sand-dark, #cbd5c9);
}
.remember-me-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.remember-me-box {
  width: 22px;
  height: 22px;
  border: 2px solid var(--slate, #6b7a70);
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: #fff;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.remember-me-box svg { opacity: 0; transition: opacity 0.1s; }
.remember-me-input:checked + .remember-me-box {
  background: var(--navy);
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(20, 60, 110, 0.15);
}
.remember-me-input:checked + .remember-me-box svg { opacity: 1; }
.remember-me-input:focus-visible + .remember-me-box {
  outline: 2px solid var(--navy);
  outline-offset: 2px;
}

/* ── Password field with show/hide eye icon ── */
.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}
.input-with-icon input {
  width: 100%;
  padding-right: 38px;
}
.input-icon-btn {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--slate);
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: color 0.15s;
}
.input-icon-btn:hover { color: var(--navy); }
.input-icon-btn.is-visible { color: var(--navy); }
.input-icon-btn:active { color: var(--orange) !important; }

/* ── Sidebar nav badge (pending count) ── */
.nav-badge {
  margin-left: auto;
  background: var(--crimson);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  padding: 3px 6px;
  border-radius: 999px;
  min-width: 16px;
  text-align: center;
}
.nav-item.active .nav-badge { background: #fff; color: var(--navy); }

/* ── Temp password display ── */
.temp-pw-chip {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--linen);
  border: var(--border);
  border-radius: var(--radius-sm);
  padding: 3px 8px;
  display: inline-block;
  letter-spacing: 0.4px;
}
.temp-pw-display {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-align: center;
  background: var(--linen);
  border: 1px dashed var(--mint-deep);
  color: var(--navy);
  padding: 14px;
  border-radius: var(--radius);
  user-select: all;
  word-break: break-all;
}
.login-card .temp-pw-display { font-size: 19px; padding: 12px; }

/* ════════════════════════════════════════
   SIDEBAR
════════════════════════════════════════ */
.sidebar {
  width: 230px;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  height: 100vh;
  border-right: var(--border);
  position: relative;
  z-index: 1100;
  transition: width 0.2s ease;
}

.sidebar::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 1px; height: 100%;
  background: linear-gradient(180deg, transparent, rgba(0,0,0,0.06) 50%, transparent);
  pointer-events: none;
}

/* ── Collapsed state ── */
.sidebar.collapsed {
  width: 80px;
}

.sidebar.collapsed .sidebar-brand { justify-content: center; padding: 1.4rem 0.5rem; gap: 8px; }
.sidebar.collapsed .sidebar-collapse-btn { display: none; }
.sidebar.collapsed .brand-text,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-badge,
.sidebar.collapsed .user-info-text {
  display: none !important;
}
.sidebar.collapsed .sidebar-brand-logo { justify-content: center; width: 100%; }
.sidebar.collapsed .sidebar-brand-logo img { display: none; }
.sidebar.collapsed #sidebar-logo-fallback { display: flex !important; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 9px; }
.sidebar.collapsed .sidebar-footer { justify-content: center; padding: 1rem 0.5rem; gap: 16px; }
.sidebar.collapsed .user-info { flex: 0; justify-content: center; }
.sidebar.collapsed .sidebar-footer-logout-btn { margin-left: 0; }
.sidebar.collapsed ~ .sidebar-expand-btn { left: 90px; }

.sidebar-brand {
  padding: 1.2rem 0.7rem 1.2rem 1.2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-bottom: var(--border);
  min-height: 80px;
}

.sidebar-brand-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  overflow: hidden;
}

.sidebar-brand-logo img { flex-shrink: 0; }

.sidebar-brand-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.sidebar-collapse-btn,
.sidebar-header-logout-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--slate);
  padding: 6px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: color 0.15s, background 0.15s;
}
.sidebar-collapse-btn:hover { color: var(--ink); background: var(--sand); }
.sidebar-header-logout-btn:hover { color: #fff; background: #c0392b; }

.sidebar-footer-logout-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--slate);
  padding: 6px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: color 0.15s, background 0.15s;
  margin-left: auto;
}
.sidebar-footer-logout-btn:hover { color: #fff; background: #c0392b; }

.sidebar-expand-btn {
  position: fixed;
  top: 18px;
  left: 56px;
  width: 26px; height: 26px;
  background: #fff;
  border: var(--border-mid);
  border-radius: 50%;
  cursor: pointer;
  color: var(--slate);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
  z-index: 1100;
  transition: color 0.15s, border-color 0.15s, left 0.2s;
}
.sidebar-expand-btn:hover { color: var(--navy); border-color: var(--navy); }
.sidebar-expand-btn:active { color: var(--orange) !important; border-color: var(--orange) !important; }
.sidebar-expand-btn.hidden { display: none !important; }

.sidebar-nav {
  flex: 1;
  padding: 0.85rem 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  color: var(--ash);
  cursor: pointer;
  border-radius: var(--radius);
  transition: background 0.15s, color 0.15s;
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  letter-spacing: 0.1px;
  border-left: 3px solid transparent;
}

.nav-item svg { color: var(--slate); }

.nav-item:hover {
  background: var(--linen);
  color: var(--ink);
}

.nav-item.active {
  background: var(--linen);
  color: var(--mint-deep);
  font-weight: 700;
  border-left: 3px solid var(--mint-deep);
}

.nav-item.active svg {
  color: var(--mint-deep);
  opacity: 1;
}

/* Dark mint flash on click/tap */
.nav-item:active {
  background: var(--mint-deep) !important;
  color: #fff !important;
}
.nav-item:active svg { color: #fff !important; }

.sidebar-footer {
  padding: 1rem 1.2rem;
  border-top: var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-info { flex: 1; display: flex; align-items: center; gap: 9px; min-width: 0; }

.user-avatar {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--navy), var(--navy-deep));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; color: #fff;
  flex-shrink: 0;
  font-family: var(--font-display);
  box-shadow: 0 1px 4px rgba(16,110,190,0.3);
}

.user-name { font-size: 12.5px; font-weight: 500; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 10px; color: var(--slate); text-transform: uppercase; letter-spacing: 0.7px; font-weight: 500; }

.btn-logout {
  background: none; border: none;
  cursor: pointer; color: var(--slate);
  padding: 7px; border-radius: var(--radius);
  display: flex; transition: color 0.15s, background 0.15s;
}
.btn-logout:hover { color: var(--ink); background: var(--sand); }
.btn-logout:active { color: var(--orange) !important; }

/* ════════════════════════════════════════
   MAIN CONTENT
════════════════════════════════════════ */
.main-content {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  background: var(--cream);
}

.view {
  display: none;
  padding: 1.75rem 2.25rem;
  flex-direction: column;
  gap: 1.5rem;
  flex: 1;
}

.view.active { display: flex; }

/* ── VIEW HEADER ── */
.view-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding-bottom: 1.25rem;
  border-bottom: var(--border);
}

.view-header h1 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: -0.3px;
  line-height: 1.2;
}

.view-sub {
  font-size: 12px;
  color: var(--slate);
  margin-top: 3px;
  font-family: var(--font-mono);
}

/* ════════════════════════════════════════
   STATS GRID
════════════════════════════════════════ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.stat-card {
  background: #fff;
  border: var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.4rem;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: box-shadow 0.2s, transform 0.15s;
}

.stat-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--navy), var(--mint));
}

.stat-label {
  font-size: 10.5px;
  color: var(--slate);
  text-transform: uppercase;
  letter-spacing: 0.7px;
  font-weight: 600;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 30px;
  font-weight: 700;
  color: var(--navy);
  font-family: var(--font-display);
  letter-spacing: -1px;
  line-height: 1;
}

/* ════════════════════════════════════════
   CARDS / SECTIONS
════════════════════════════════════════ */
.section-card {
  background: #fff;
  border: var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.section-header-bar {
  background: var(--linen);
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: var(--border-mid);
}

.section-header-bar h2 {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--ash);
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* ════════════════════════════════════════
   SEARCH & FILTERS
════════════════════════════════════════ */
.search-bar {
  display: flex;
  gap: 10px;
  background: #fff;
  border: var(--border);
  border-radius: var(--radius-lg);
  padding: 6px 8px;
  box-shadow: var(--shadow-sm);
}

.log-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  position: sticky;
  top: 44px;
  z-index: 15;
  background: var(--cream);
  padding: 10px 0;
}
.log-toolbar select {
  padding: 8px 12px;
  border: var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  background: #fff;
  color: var(--ink-mid);
}
.log-toolbar-actions {
  display: flex;
  gap: 8px;
}
.log-toolbar-actions .btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.search-bar input {
  flex: 1;
  background: transparent;
  border: none;
  padding: 6px 10px;
  font-family: var(--font);
  font-size: 13.5px;
  color: var(--ink);
  outline: none;
}

.search-bar input::placeholder { color: var(--stone); }

.search-bar select {
  background: var(--linen);
  border: var(--border);
  border-radius: var(--radius);
  padding: 6px 28px 6px 10px;
  font-family: var(--font);
  font-size: 13px;
  color: var(--ash);
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='7' fill='none'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%235c5852' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}

/* ════════════════════════════════════════
   TABLE
════════════════════════════════════════ */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  background: #ffffff;
  border-bottom: 2px solid var(--stone);
  padding: 10px 16px;
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  color: var(--slate);
  text-transform: uppercase;
  letter-spacing: 0.7px;
  white-space: nowrap;
}

#activity-logs-table .data-table th {
  position: sticky;
  top: 98px;
  z-index: 10;
}

.data-table td {
  padding: 12px 16px;
  border-bottom: var(--border);
  vertical-align: middle;
  color: var(--char);
}

.data-table tr:last-child td { border-bottom: none; }

.data-table tr:hover td {
  background: var(--linen);
}

.data-table .order-num {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--navy);
  background: var(--linen);
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  border: var(--border);
  white-space: nowrap;
}

.data-table .actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

/* ════════════════════════════════════════
   STATUS BADGES
════════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: capitalize;
  white-space: nowrap;
}

.badge::before {
  content: '';
  display: inline-block;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.7;
}

.badge-draft       { background: #f0efec; color: var(--slate); border: 1px solid var(--sand); }
.badge-hold        { background: #fdecea; color: #b3261e; border: 1px solid #f5c2be; }
.badge-in_progress { background: #fff4e6; color: #b45309; border: 1px solid #fcd9a0; }
.badge-completed   { background: #e6fdf7; color: var(--mint-deep); border: 1px solid #9bf3de; }
.badge-reviewed    { background: #e8f3fc; color: var(--navy); border: 1px solid #aed6f5; }

/* ════════════════════════════════════════
   PAGINATION
════════════════════════════════════════ */
.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  justify-content: center;
  padding: 1rem 0;
}

.page-btn {
  background: #fff;
  border: var(--border);
  border-radius: var(--radius);
  padding: 5px 11px;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  color: var(--ash);
  transition: background 0.15s, color 0.15s;
}

.page-btn:hover { background: var(--linen); color: var(--ink); }
.page-btn.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.page-btn:active { background: var(--orange) !important; color: #fff !important; border-color: var(--orange) !important; }

/* ════════════════════════════════════════
   BUTTONS
════════════════════════════════════════ */
.btn {
  padding: 8px 18px;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  white-space: nowrap;
  letter-spacing: 0.2px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.btn:active { transform: scale(0.97); box-shadow: 0 0 0 3px rgba(249,115,22,0.4); }

.btn-primary {
  background: var(--navy);
  color: #fff;
  box-shadow: 0 1px 3px rgba(16,110,190,0.35);
}
.btn-primary:hover { background: var(--navy-deep); }

.btn-secondary {
  background: #fff;
  color: var(--char);
  border: var(--border-mid);
  box-shadow: var(--shadow-sm);
}
.btn-secondary:hover { background: var(--linen); border-color: var(--stone); }

.btn-danger {
  background: var(--crimson);
  color: #fff;
  box-shadow: 0 1px 3px rgba(185,28,28,0.3);
}
.btn-danger:hover { background: #991616; }

.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-full { width: 100%; padding: 11px; justify-content: center; }

/* Download format dropdown (PDF / Word) — used on every "PDF" button.
   position:fixed + JS-calculated coords (not position:absolute inside the
   button) because .section-card has overflow:hidden and would otherwise
   clip the menu for any row near the bottom of a table. */
.dl-dropdown-wrap { display: inline-block; }
.dl-dropdown-menu {
  position: fixed;
  z-index: 500;
  background: #fff;
  border: 1px solid var(--sand);
  border-radius: var(--radius);
  box-shadow: 0 6px 18px rgba(0,0,0,0.12);
  min-width: 170px;
  overflow: hidden;
  padding: 4px;
}
.dl-dropdown-menu button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  background: none;
  text-align: left;
  font-size: 13px;
  color: var(--ink);
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
}
.dl-dropdown-menu button:hover { background: var(--sand); }
.dl-dropdown-menu svg { flex-shrink: 0; color: var(--slate); }
.btn-group { display: flex; gap: 8px; align-items: center; }

/* ════════════════════════════════════════
   FORM FIELDS
════════════════════════════════════════ */
.field { display: flex; flex-direction: column; gap: 5px; }

.field label {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--slate);
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  background: var(--parchment);
  border: var(--border);
  border-radius: var(--radius);
  padding: 7px 10px;
  font-family: var(--font);
  font-size: 13.5px;
  color: var(--ink);
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
  outline: none;
}

.field textarea[readonly] {
  background: var(--sand);
  color: var(--slate);
  cursor: not-allowed;
}
.field textarea[readonly]:focus {
  border-color: var(--sand);
  background: var(--sand);
  box-shadow: none;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--orange);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(249,115,22,0.18);
}

/* ── Date inputs: kept visually identical to the plain text/select fields
   beside them (same border, padding, background, font) — no calendar icon
   overlay. Clicking anywhere in the field opens the native date picker;
   the date can also be typed directly. Browsers will still render a small
   default disclosure indicator on the right of an empty date field. ── */
/* ── Custom USA Date Picker (MM/DD/YYYY) ── */
.dp-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
}

.dp-field-wrap {
  display: flex;
  align-items: center;
  border: 1px solid var(--stone, #c9c4bc);
  border-radius: var(--radius, 6px);
  background: #fff;
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.dp-field-wrap:focus-within {
  border-color: var(--navy, #1B2B4B);
  box-shadow: 0 0 0 2.5px rgba(27,43,75,.10);
}

.dp-text {
  flex: 1;
  border: none !important;
  box-shadow: none !important;
  outline: none;
  background: transparent;
  padding: 8px 10px;
  font-family: var(--font);
  font-size: 13.5px;
  color: var(--ink, #1a1816);
  min-width: 0;
  cursor: text;
}
.dp-text::placeholder { color: var(--stone, #a09a93); }

.dp-cal-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 100%;
  min-height: 36px;
  background: none;
  border: none;
  border-left: 1px solid var(--stone, #c9c4bc);
  color: var(--slate, #5c5852);
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition: background 0.12s, color 0.12s;
}
.dp-cal-btn:hover { background: var(--linen, #f5f1eb); color: var(--navy, #1B2B4B); }

/* Popup calendar */
.dp-popup {
  position: fixed;
  z-index: 9999;
  background: #fff;
  border: 1px solid var(--stone, #c9c4bc);
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.14);
  width: 260px;
  padding: 10px;
  user-select: none;
}

.dp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.dp-month-year {
  font-size: 13px;
  font-weight: 600;
  color: var(--navy, #1B2B4B);
  font-family: var(--font);
}
.dp-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--slate, #5c5852);
  transition: background 0.12s;
}
.dp-nav:hover { background: var(--linen, #f5f1eb); color: var(--navy, #1B2B4B); }

.dp-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.dp-wday {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--slate, #5c5852);
  text-align: center;
  padding: 4px 0;
  font-family: var(--font);
  letter-spacing: 0.02em;
}
.dp-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-family: var(--font);
  color: var(--ink, #1a1816);
  background: none;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
  padding: 0;
  width: 100%;
}
.dp-day:hover { background: var(--linen, #f5f1eb); }
.dp-day.dp-other { color: #c0bbb5; }
.dp-day.dp-today {
  font-weight: 700;
  color: var(--mint-deep, #1a7a6e);
  border: 1.5px solid var(--mint-deep, #1a7a6e);
}
.dp-day.dp-selected {
  background: var(--navy, #1B2B4B) !important;
  color: #fff !important;
  font-weight: 600;
}

.dp-footer {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--linen, #f0ece6);
}
.dp-foot-btn {
  background: none;
  border: none;
  font-size: 12px;
  font-family: var(--font);
  color: var(--navy, #1B2B4B);
  cursor: pointer;
  padding: 3px 6px;
  border-radius: 4px;
  transition: background 0.1s;
  font-weight: 500;
}
.dp-foot-btn:hover { background: var(--linen, #f5f1eb); }
.dp-today-btn { color: var(--mint-deep, #1a7a6e); }

/* Meta-bar date pickers match the meta-field style */
.meta-field .dp-text {
  font-size: 14px;
}

.field textarea {
  resize: vertical;
  min-height: 72px;
  line-height: 1.55;
}

.field select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='7' fill='none'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%235c5852' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
  cursor: pointer;
}

.grid   { display: grid; gap: 12px 16px; }
.g1     { grid-template-columns: 1fr; }
.g2     { grid-template-columns: 1fr 1fr; }
.g3     { grid-template-columns: 1fr 1fr 1fr; }
.g4     { grid-template-columns: 1fr 1fr 1fr 1fr; }
.span2  { grid-column: span 2; }
.span3  { grid-column: span 3; }
.span4  { grid-column: span 4; }

/* ════════════════════════════════════════
   PORTAL / RECORD FORM
════════════════════════════════════════ */
.meta-bar {
  background: var(--linen);
  border: var(--border);
  border-top: none;
  border-bottom: none;
  border-radius: 0;
  padding: 14px 20px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 14px;
  margin-bottom: 0;
  position: relative;
  overflow: hidden;
}

.meta-bar::before { display: none; }

.meta-field label {
  font-size: 9.5px;
  font-weight: 700;
  color: var(--slate);
  letter-spacing: 0.8px;
  text-transform: uppercase;
  display: block;
  margin-bottom: 5px;
}

.meta-field input,
.meta-field select {
  width: 100%;
  background: #fff;
  border: var(--border-mid);
  border-radius: var(--radius);
  padding: 7px 10px;
  font-family: var(--font);
  font-size: 13px;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.meta-field input::placeholder { color: var(--stone); }

.meta-field input:focus,
.meta-field select:focus {
  border-color: var(--orange);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(249,115,22,0.18);
}

.meta-field select option { background: #fff; }

/* ════════════════════════════════════════
   PORTAL TAB BAR
════════════════════════════════════════ */
/* Tab bar wrapper with scroll arrows */
.portal-tabbar-wrap {
  display: flex;
  align-items: stretch;
  background: #fff;
  border: var(--border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  border-bottom: none;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.tab-scroll-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 34px;
  background: #fff;
  border: none;
  border-bottom: 2.5px solid transparent;
  cursor: pointer;
  color: var(--slate);
  transition: background 0.15s, color 0.15s;
  z-index: 2;
  padding: 0;
}
.tab-scroll-btn:hover {
  background: var(--linen);
  color: var(--navy);
}
.tab-scroll-left {
  border-right: var(--border);
  border-radius: var(--radius-lg) 0 0 0;
}
.tab-scroll-right {
  border-left: var(--border);
  border-radius: 0 var(--radius-lg) 0 0;
}

.portal-tabbar {
  display: flex;
  align-items: stretch;
  gap: 0;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  scroll-behavior: smooth;
  margin-bottom: 0;
}
.portal-tabbar::-webkit-scrollbar { display: none; }

.portal-tab {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 13px 18px 11px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--slate);
  background: none;
  border: none;
  border-bottom: 2.5px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  font-family: var(--font);
  flex-shrink: 0;
  position: relative;
}
.portal-tab svg { opacity: 0.6; transition: opacity 0.15s; flex-shrink: 0; }
.portal-tab:hover { color: var(--navy); background: var(--linen); }
.portal-tab:hover svg { opacity: 0.85; }
.portal-tab.active {
  color: var(--navy);
  border-bottom-color: var(--navy);
  font-weight: 600;
  background: #fff;
}
.portal-tab.active svg { opacity: 1; }
.portal-tab:active { color: var(--mint-deep) !important; border-bottom-color: var(--mint-deep) !important; }

.portal-tabpanel {
  display: none;
  background: var(--linen);
  border: var(--border);
  border-top: var(--border);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.portal-tabpanel.active { display: block; }

/* Portal form sections */
.portal-section {
  background: #fff;
  border: var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 1rem;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s;
}

.portal-section:focus-within {
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
  border-color: var(--stone);
}

.portal-section-head {
  background: var(--linen);
  padding: 10px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: var(--border-mid);
}

.portal-section-head h2 {
  font-size: 10px;
  font-weight: 700;
  color: var(--ash);
  letter-spacing: 1px;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 8px;
}

.portal-section-head h2::before {
  content: '';
  display: inline-block;
  width: 5px; height: 5px;
  background: var(--ink);
  border-radius: 50%;
}

.portal-section-body { padding: 20px; }

/* ════════════════════════════════════════
   BLOCK ITEMS (deeds, mortgages, etc.)
════════════════════════════════════════ */
.block-list { display: flex; flex-direction: column; gap: 10px; }

.block-item {
  border: var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.15s;
}

.block-item:hover { border-color: var(--stone); }

.block-item-head {
  background: var(--linen);
  border-bottom: var(--border);
  padding: 8px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: var(--navy);
  letter-spacing: 0.2px;
}

.block-item-body { padding: 14px; background: var(--parchment); }

/* ── TAX ROWS ── */
.tax-row {
  display: grid;
  grid-template-columns: 26px 160px 130px 140px 120px 140px;
  gap: 8px;
  align-items: start;
  margin-bottom: 8px;
}

.tax-row-num {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  border-radius: 50%;
  background: var(--linen);
  border: var(--border);
  color: var(--ash);
  font-size: 11px;
  font-weight: 700;
}

.tax-type-wrap, .tax-status-wrap { display: flex; flex-direction: column; gap: 6px; }

.tax-row input,
.tax-row select {
  width: 100%;
  background: #fff;
  border: var(--border);
  border-radius: var(--radius);
  padding: 6px 9px;
  font-family: var(--font);
  font-size: 13px;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s;
}

.tax-row input:focus,
.tax-row select:focus { border-color: var(--orange); }

.tax-row select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='7' fill='none'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%235c5852' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
  padding-right: 22px;
  cursor: pointer;
}

/* ── SUBSECTIONS ── */
.subsection {
  border: var(--border);
  border-radius: var(--radius);
  margin-top: 14px;
  overflow: hidden;
}

.subsection-head {
  background: var(--linen);
  border-bottom: var(--border);
  padding: 6px 12px;
}

.subsection-head h3 {
  font-size: 10px;
  font-weight: 700;
  color: var(--ash);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.subsection-body { padding: 12px; }

/* ── ADD ROW BUTTON ── */
.add-row-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--cream);
  border: 1px dashed var(--stone);
  border-radius: var(--radius);
  padding: 6px 13px;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  color: var(--slate);
  cursor: pointer;
  margin-top: 8px;
  position: sticky;
  bottom: 12px;
  z-index: 5;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.add-row-btn:hover {
  border-color: var(--navy-soft);
  color: var(--navy);
  background: var(--linen);
}

.rm-btn {
  display: inline-flex; align-items: center; gap: 4px;
  background: #fef2f2; border: 1px solid #fecaca; cursor: pointer;
  color: var(--crimson); padding: 5px 10px; border-radius: var(--radius-sm);
  font-family: var(--font); font-size: 12px; font-weight: 600;
  white-space: nowrap;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.rm-btn:hover { color: #fff; background: var(--crimson); border-color: var(--crimson); }
.tax-row .rm-btn { width: 100%; justify-content: center; }

/* ════════════════════════════════════════
   ALERTS
════════════════════════════════════════ */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
}

.alert-error {
  background: #fef2f2;
  color: var(--crimson);
  border: 1px solid #fecaca;
}

.alert-success {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.hidden { display: none !important; }

/* ════════════════════════════════════════
   MODAL
════════════════════════════════════════ */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(2px);
}

/* Create-order backdrop: leave sidebar (230px) visible on left */
.modal-backdrop.create-order {
  left: 230px;
  align-items: stretch;
  padding: 0;
}

/* When sidebar is collapsed (80px) */
.sidebar.collapsed ~ * .modal-backdrop.create-order,
body.sidebar-collapsed .modal-backdrop.create-order {
  left: 80px;
}

.modal {
  background: #fff;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  margin: 1rem;
  overflow: hidden;
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(0,0,0,0.06);
}

.modal.wide { max-width: 920px; }

.modal.fullscreen {
  width: 96vw;
  height: 92vh;
  max-width: none;
  max-height: none;
  margin: 0;
  display: flex;
  flex-direction: column;
}
.modal.fullscreen .modal-body {
  flex: 1;
  overflow-y: auto;
}

/* Create-order modal: fills the entire content area */
.modal-backdrop.create-order .modal {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  border-radius: 0;
  display: flex;
  flex-direction: column;
}
.modal-backdrop.create-order .modal-body {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 3rem;
}
.modal-backdrop.create-order .modal-body > * {
  width: 100%;
  max-width: 760px;
}
.modal-backdrop.create-order .modal-header {
  padding: 18px 3rem;
  border-radius: 0;
}
.modal-backdrop.create-order .modal-actions {
  justify-content: flex-end;
  padding-top: 20px;
  margin-top: 2rem;
  width: 100%;
  max-width: 760px;
  align-self: center;
}

.modal-header {
  background: var(--linen);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  font-family: var(--font-display);
}

.modal-close {
  background: none; border: none;
  color: var(--slate);
  font-size: 22px; cursor: pointer;
  line-height: 1; padding: 0 4px;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}
.modal-close:hover { color: var(--ink); background: var(--sand); }

.modal-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 0.5rem;
}

/* ════════════════════════════════════════
   STATUS SELECT
════════════════════════════════════════ */
.status-select {
  background: #fff;
  border: var(--border-mid);
  border-radius: var(--radius);
  padding: 7px 28px 7px 10px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  color: var(--char);
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='7' fill='none'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%235c5852' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  box-shadow: var(--shadow-sm);
}

/* ════════════════════════════════════════
   SETTINGS TABS
════════════════════════════════════════ */
.settings-tabs {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0;
  margin-bottom: 1.5rem;
  border-bottom: var(--border-mid);
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--cream);
  padding-top: 6px;
}

.settings-tabs-left { display: flex; }

.settings-topbar-save {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 8px;
}

.stab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 9px 20px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  color: var(--slate);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  margin-bottom: -1px;
  letter-spacing: 0.1px;
}

.stab:hover { color: var(--navy); }
.stab.active { color: var(--navy); border-bottom-color: var(--navy); font-weight: 600; }
.stab:active { color: var(--mint-deep) !important; border-bottom-color: var(--mint-deep) !important; }

.stab-panel { display: block; }
.stab-panel.hidden { display: none !important; }

/* ════════════════════════════════════════
   PERMISSIONS
════════════════════════════════════════ */
.perm-group {
  background: #fff;
  border: var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 14px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.perm-group-title {
  background: var(--linen);
  color: var(--ash);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  padding: 8px 16px;
  border-bottom: var(--border-mid);
}

.perm-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: var(--border);
  transition: background 0.1s;
}
.perm-row:last-child { border-bottom: none; }
.perm-row:hover { background: var(--parchment); }

.perm-label { font-size: 13px; font-weight: 500; color: var(--char); }
.perm-desc  { font-size: 11px; color: var(--slate); margin-top: 2px; }

.perm-select {
  background: var(--parchment);
  border: var(--border);
  border-radius: var(--radius);
  padding: 5px 24px 5px 9px;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  color: var(--char);
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='6' fill='none'%3E%3Cpath d='M1 1l3 3 3-3' stroke='%235c5852' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
}

/* Toggle switch */
.toggle { position: relative; display: inline-block; width: 38px; height: 22px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
  position: absolute;
  cursor: pointer; inset: 0;
  background: var(--sand);
  border-radius: 22px;
  transition: background 0.2s;
}

.toggle-slider:before {
  position: absolute; content: '';
  height: 16px; width: 16px;
  left: 3px; bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle input:checked + .toggle-slider { background: var(--navy); }
.toggle input:checked + .toggle-slider:before { transform: translateX(16px); }

/* ════════════════════════════════════════
   EMPTY STATE
════════════════════════════════════════ */
.empty-state {
  text-align: center;
  padding: 3.5rem 1rem;
  color: var(--slate);
}

.empty-state p {
  font-size: 14px;
  margin-bottom: 1rem;
  font-family: var(--font-display);
  font-style: italic;
}

/* ════════════════════════════════════════
   SCROLLBAR
════════════════════════════════════════ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--sand); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--stone); }

/* ════════════════════════════════════════
   RESPONSIVE
════════════════════════════════════════ */
@media (max-width: 700px) {
  .sidebar { width: 64px; }
  .sidebar-collapse-btn, .sidebar-expand-btn { display: none; }
  .sidebar-brand { justify-content: center; padding: 1.2rem 0.5rem 1.1rem; }
  .sidebar-brand-logo { justify-content: center; width: 100%; }
  .sidebar-brand-logo img { display: none; }
  #sidebar-logo-fallback { display: flex !important; }
  .brand-text, .user-info-text, .nav-label, .nav-badge { display: none; }
  .nav-item { justify-content: center; padding: 9px; }
  .sidebar-footer { justify-content: center; padding: 1rem 0.5rem; }
  .user-info { flex: 0; justify-content: center; }
  .btn-logout { display: none; }
  .view { padding: 1.25rem 1rem; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .g4 { grid-template-columns: 1fr 1fr; }
  .g3 { grid-template-columns: 1fr 1fr; }
  .span4 { grid-column: span 2; }
  .meta-bar { grid-template-columns: 1fr 1fr; }
}
