/* ============================================================
   R. Bodota Law — Record Management System
   Design tokens follow the firm's approved wireframes:
   deep forest green + gold crest, cream content background.
   ============================================================ */

:root {
  --brand-dark: #16281c;
  --brand-dark-hover: #1c3324;
  --brand-dark-active: #10160f;
  --ink-black: #10160f;
  --brand-gold: #c9a24a;
  --brand-gold-light: #e0bf72;
  --brand-gold-dark: #a9822f;

  --bg-page: #f6f2e8;
  --bg-page-2: #efe9da;
  --surface: #ffffff;
  --border: #e6e0d0;
  --border-strong: #d8cfb8;

  --text-primary: #262922;
  --text-secondary: #5c6157;
  --text-muted: #82877c;
  --text-on-dark: #f6f2e8;
  --text-on-dark-muted: #b8b6a8;

  --danger: #a32d2d;
  --danger-bg: #fceaea;
  --success: #1f7a43;
  --success-bg: #e7f5ea;
  --info: #1a5aa0;
  --info-bg: #e8f1fb;
  --warning: #92670c;
  --warning-bg: #fdf3e0;
  --purple: #5b3fa0;
  --purple-bg: #f1edfb;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 3px rgba(16, 22, 15, 0.08);
  --shadow-soft: 0 20px 60px -20px rgba(16, 22, 15, 0.35);

  --font-serif: 'Playfair Display', Georgia, serif;
  --font-brand: 'Playfair Display', Georgia, serif;
  --font-sans: 'Jost', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

/* Self-hosted (no CDN) — matches the elegant serif used in the firm's logo artwork. */
@font-face {
  font-family: 'Playfair Display';
  src: url('../fonts/playfair-display-latin-400-normal.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Playfair Display';
  src: url('../fonts/playfair-display-latin-600-normal.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Playfair Display';
  src: url('../fonts/playfair-display-latin-700-normal.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Jost';
  src: url('../fonts/jost-latin-400-normal.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Jost';
  src: url('../fonts/jost-latin-500-normal.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Jost';
  src: url('../fonts/jost-latin-600-normal.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  background: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.5;
  font-size: 14px;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3 { font-family: var(--font-serif); font-weight: 400; margin: 0 0 4px; }
p { margin: 0 0 8px; }

/* ---------------- Brand mark ---------------- */
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-crest {
  width: 34px; height: 34px;
  flex-shrink: 0;
}
.brand-crest img { width: 100%; height: 100%; object-fit: contain; display: block; }
.brand-name {
  font-family: var(--font-brand);
  color: var(--brand-gold);
  line-height: 1.15;
}
.brand-name strong { display: block; font-size: 17px; font-weight: 600; letter-spacing: 0.6px; }
.brand-name span { display: block; font-size: 10px; letter-spacing: 2px; opacity: 0.85; }

/* Full lockup (mark + wordmark in one image) — used on the login card and public nav */
.brand-lockup { display: block; height: 48px; width: auto; }
.brand-lockup-lg { display: block; height: 92px; width: auto; margin: 0 auto; }
.sidebar-brand-lockup { display: block; height: 92px; width: auto; margin: 0 auto; }

/* ---------------- App shell ---------------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--brand-dark);
  color: var(--text-on-dark);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar .brand { padding: 6px 8px 22px; border-bottom: 1px solid rgba(255,255,255,0.1); margin-bottom: 14px; }
.sidebar nav { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-on-dark-muted);
  font-size: 13.5px;
}
.nav-link svg { width: 17px; height: 17px; flex-shrink: 0; }
.nav-link:hover { background: rgba(255,255,255,0.06); color: var(--text-on-dark); }
.nav-link.active { background: var(--brand-gold); color: var(--brand-dark-active); font-weight: 600; }
.sidebar-footer { border-top: 1px solid rgba(255,255,255,0.1); padding-top: 12px; margin-top: 12px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 28px;
  display: flex; align-items: center; justify-content: space-between;
}
.topbar h1 { font-size: 21px; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.user-menu { position: relative; }
.user-chip {
  display: flex; align-items: center; gap: 10px;
  background: none; border: none; cursor: pointer; padding: 4px; border-radius: var(--radius-sm);
  font-family: inherit;
  color: var(--text-primary);
}
.user-chip:hover { background: var(--bg-page); }
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--bg-page); border: 1px solid var(--border-strong);
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; color: var(--brand-dark); font-size: 13px;
  flex-shrink: 0;
}
.user-avatar-photo { object-fit: cover; }
.user-chip .who { line-height: 1.25; text-align: left; }
.user-chip .who strong { display: block; font-size: 13.5px; }
.user-chip .who small { color: var(--text-muted); font-size: 11.5px; }
.user-menu-chevron { width: 14px; height: 14px; color: var(--text-muted); transition: transform 0.2s ease; flex-shrink: 0; }
.user-menu.open .user-menu-chevron { transform: rotate(180deg); }

.user-menu-dropdown {
  display: none; position: absolute; top: calc(100% + 8px); right: 0; z-index: 60;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-soft); min-width: 190px; padding: 6px; overflow: hidden;
}
.user-menu.open .user-menu-dropdown { display: block; }
.user-menu-dropdown a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 6px; font-size: 13.5px; color: var(--text-primary);
}
.user-menu-dropdown a:hover { background: var(--bg-page); }
.user-menu-dropdown a svg { width: 16px; height: 16px; color: var(--text-muted); flex-shrink: 0; }

.content { padding: 26px 28px; flex: 1; }

/* ---------------- Cards / grid ---------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.stat-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.stat-card { display: flex; flex-direction: column; gap: 6px; }
.stat-card .num { font-size: 26px; font-weight: 600; color: var(--brand-dark); }
.stat-card .label { color: var(--text-muted); font-size: 12.5px; }
.stat-card a { font-size: 12.5px; color: var(--brand-gold-dark); font-weight: 600; }

/* ---------------- Icon badges (stat cards, activity rows, quick access) ---------------- */
.icon-badge {
  width: 40px; height: 40px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.icon-badge svg { width: 19px; height: 19px; }
.icon-badge-sm { width: 30px; height: 30px; border-radius: 8px; }
.icon-badge-sm svg { width: 15px; height: 15px; }
.icon-badge-success { background: var(--success-bg); color: var(--success); }
.icon-badge-info { background: var(--info-bg); color: var(--info); }
.icon-badge-warning { background: var(--warning-bg); color: var(--warning); }
.icon-badge-purple { background: var(--purple-bg); color: var(--purple); }
.icon-badge-danger { background: var(--danger-bg); color: var(--danger); }
.icon-badge-neutral { background: var(--bg-page); color: var(--text-muted); }

.grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; }

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 13.5px; font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: linear-gradient(180deg, var(--brand-dark-hover), var(--brand-dark)); color: #fff; }
.btn-primary:hover { box-shadow: 0 10px 22px -10px rgba(16,22,15,0.5); }
.btn-gold { background: linear-gradient(180deg, var(--brand-gold-light), var(--brand-gold)); color: var(--brand-dark-active); }
.btn-gold:hover { box-shadow: 0 10px 22px -10px rgba(201,162,74,0.5); }
.btn-outline { background: var(--surface); border-color: var(--border-strong); color: var(--text-primary); }
.btn-outline:hover { border-color: var(--brand-dark); }
.btn-danger { background: var(--danger-bg); color: var(--danger); }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }

/* Dashboard search row: scope dropdown + text input + icon submit button */
.dash-search { display: flex; gap: 10px; margin-bottom: 20px; }
.dash-search select { max-width: 150px; flex-shrink: 0; }
.dash-search input { flex: 1; min-width: 160px; }
.dash-search button { flex-shrink: 0; padding: 0 16px; }
.dash-search button svg { width: 17px; height: 17px; }

/* Quick access buttons with a colored icon beside the label */
.qa-btn { display: inline-flex; align-items: center; gap: 9px; }
.qa-btn svg { width: 17px; height: 17px; flex-shrink: 0; }
.qa-success svg { color: var(--success); }
.qa-info svg { color: var(--info); }
.qa-warning svg { color: var(--warning); }

/* ---------------- Forms ---------------- */
.form-group { margin-bottom: 16px; }
label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 6px; color: var(--text-secondary); }
input, select, textarea {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  font-size: 13.5px; font-family: inherit; background: var(--surface); color: var(--text-primary);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand-dark); box-shadow: 0 0 0 3px rgba(14,59,42,0.1); }
.field-error { color: var(--danger); font-size: 12px; margin-top: 4px; }

/* ---------------- Tables ---------------- */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--text-muted); padding: 10px 12px; border-bottom: 1px solid var(--border); }
td { padding: 13px 12px; border-bottom: 1px solid var(--border); font-size: 13.5px; }
tr:last-child td { border-bottom: none; }
.table-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.search-box { flex: 1; max-width: 340px; }
.actions-cell { display: flex; gap: 6px; }

/* ---------------- Status pills ---------------- */
.pill { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.pill-success { background: var(--success-bg); color: var(--success); }
.pill-info { background: var(--info-bg); color: var(--info); }
.pill-warning { background: var(--warning-bg); color: var(--warning); }
.pill-purple { background: var(--purple-bg); color: var(--purple); }
.pill-danger { background: var(--danger-bg); color: var(--danger); }
.pill-neutral { background: var(--bg-page); color: var(--text-muted); border: 1px solid var(--border-strong); }

/* ---------------- Alerts / flash ---------------- */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); font-size: 13.5px; margin-bottom: 18px; border: 1px solid transparent; }
.alert-success { background: var(--success-bg); color: var(--success); border-color: #cfe9d6; }
.alert-danger { background: var(--danger-bg); color: var(--danger); border-color: #f3d2d2; }
.alert-warning { background: var(--warning-bg); color: var(--warning); border-color: #f3e3bd; }

/* ---------------- Auth pages (login / forgot / reset password) ---------------- */
.auth-body {
  min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 60px 24px; position: relative; overflow: hidden; background: var(--bg-page);
}
.auth-watermark { position: absolute; bottom: -60px; left: 50%; transform: translateX(-50%); width: 380px; opacity: 0.05; pointer-events: none; z-index: 0; }
.auth-brand { text-align: center; margin-bottom: 30px; z-index: 1; position: relative; }
.auth-brand .brand-crest { width: 74px; height: 74px; margin: 0 auto 14px; }
.auth-brand .brand-name strong { font-size: 1.35rem; letter-spacing: 0.16em; }

.auth-card {
  z-index: 1; position: relative; width: 100%; max-width: 430px; background: var(--surface);
  border-radius: var(--radius); box-shadow: var(--shadow-soft); padding: 44px 40px 40px; border: 1px solid rgba(22,40,28,0.06);
}
.auth-card h2 { font-family: var(--font-serif); text-align: center; font-size: 1.6rem; margin: 0 0 8px; }
.auth-card .subtitle { text-align: center; color: var(--text-secondary); font-size: 0.88rem; line-height: 1.55; margin: 0 0 28px; }
.auth-links { text-align: center; margin-top: 16px; font-size: 13px; color: var(--text-muted); position: relative; z-index: 1; }
.auth-footer { margin-top: 28px; font-size: 0.8rem; color: var(--text-muted); text-align: center; z-index: 1; position: relative; }

/* Icon-in-field inputs */
.field-input { position: relative; display: flex; align-items: center; }
.field-input svg.icon-left { position: absolute; left: 14px; width: 17px; height: 17px; color: var(--text-secondary); opacity: 0.7; pointer-events: none; }
.field-input input { padding-left: 40px; }
.toggle-pw { position: absolute; right: 12px; background: none; border: none; cursor: pointer; color: var(--text-secondary); display: flex; padding: 4px; }
.toggle-pw svg { width: 18px; height: 18px; }

.field-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; font-size: 0.85rem; }
.remember { display: flex; align-items: center; gap: 8px; color: var(--text-secondary); cursor: pointer; }
.remember input { width: 16px; height: 16px; accent-color: var(--brand-dark); cursor: pointer; }
.forgot-link { color: var(--brand-dark); font-weight: 500; }
.forgot-link:hover { color: var(--brand-gold); text-decoration: underline; }

.auth-divider { display: flex; align-items: center; gap: 14px; margin: 22px 0; color: var(--text-muted); font-size: 0.8rem; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--border-strong); }

.btn-back-site {
  width: 100%; background: var(--surface); border: 1px solid rgba(201,162,74,0.5); color: var(--brand-dark);
  padding: 14px; border-radius: var(--radius-sm); font-size: 0.94rem; font-weight: 500; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 10px; text-decoration: none;
}
.btn-back-site:hover { background: var(--bg-page-2); }
.btn-back-site svg { width: 17px; height: 17px; color: var(--brand-gold); }

/* ---------------- Pagination ---------------- */
.pagination { display: flex; gap: 6px; align-items: center; justify-content: flex-end; margin-top: 16px; }
.pagination a, .pagination span { padding: 6px 11px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); font-size: 12.5px; }
.pagination .current { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }

.empty-state { text-align: center; padding: 48px 20px; color: var(--text-muted); }
.text-muted { color: var(--text-muted); }
.mb-0 { margin-bottom: 0; }

/* ---------------- Settings page ---------------- */
.settings-layout { display: grid; grid-template-columns: 220px 1fr; gap: 18px; align-items: start; }
.settings-tabs { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px; display: flex; flex-direction: column; gap: 2px; }
.settings-tab-link { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 8px; font-size: 13.5px; color: var(--text-secondary); }
.settings-tab-link svg { width: 16px; height: 16px; flex-shrink: 0; }
.settings-tab-link.active { background: var(--bg-page); color: var(--brand-dark); font-weight: 600; }
.settings-tab-link:hover:not(.active) { background: var(--bg-page); }

.settings-profile-grid { display: grid; grid-template-columns: 1fr 220px; gap: 24px; align-items: start; }
.settings-photo-box { background: var(--bg-page); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; text-align: center; }
.settings-photo-preview {
  width: 110px; height: 110px; border-radius: 50%; margin: 0 auto 14px; overflow: hidden;
  background: var(--surface); display: flex; align-items: center; justify-content: center; border: 1px solid var(--border-strong);
}
.settings-photo-preview img { width: 100%; height: 100%; object-fit: cover; }

.theme-choice {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); cursor: pointer; font-size: 13.5px;
}
.theme-choice input { accent-color: var(--brand-dark); }
.theme-choice:has(input:checked) { border-color: var(--brand-dark); background: var(--bg-page); font-weight: 600; }

/* ---------------- Reusable layout helpers (also used for responsive breakpoints) ---------------- */
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.detail-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 18px; }
.list-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 9px 0; border-bottom: 1px solid var(--border); }
.list-row:last-child { border-bottom: none; }
.donut-row { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-scroll table { min-width: 640px; }

/* ---------------- Mobile menu toggle (hidden on desktop) ---------------- */
.menu-toggle {
  display: none;
  align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  cursor: pointer;
  flex-shrink: 0;
  color: var(--text-primary);
}
.menu-toggle svg { width: 19px; height: 19px; }
.sidebar-backdrop { display: none; }

/* ---------------- Responsive breakpoints ---------------- */
@media (max-width: 900px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .stat-grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .menu-toggle { display: inline-flex; }
  .sidebar {
    position: fixed; left: 0; top: 0; z-index: 50;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    box-shadow: 2px 0 16px rgba(0,0,0,0.2);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop {
    display: block;
    position: fixed; inset: 0;
    background: rgba(10, 20, 15, 0.4);
    z-index: 40;
    opacity: 0; pointer-events: none;
    transition: opacity 0.22s ease;
  }
  .sidebar-backdrop.show { opacity: 1; pointer-events: auto; }
  .main { width: 100%; }
}

@media (max-width: 640px) {
  .content { padding: 18px 16px; }
  .topbar { padding: 12px 16px; flex-wrap: wrap; row-gap: 8px; }
  .topbar h1 { font-size: 17px; }
  .form-row-2, .detail-grid-4 { grid-template-columns: 1fr; }
  .table-toolbar { align-items: stretch; }
  .search-box { max-width: none; }
  .auth-card { padding: 30px 22px; }
  .card { padding: 16px; }
  .dash-search { flex-wrap: wrap; }
  .dash-search select, .dash-search input { flex: 1 1 100%; max-width: none; }
  .settings-layout { grid-template-columns: 1fr; }
  .settings-tabs { flex-direction: row; overflow-x: auto; }
  .settings-profile-grid { grid-template-columns: 1fr; }
  .settings-profile-grid { grid-auto-flow: row; }
}

@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr; }
  .stat-grid-3 { grid-template-columns: 1fr; }
  .user-chip .who small { display: none; }
  .user-chip .who strong { max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
}

.lp-contact-grid { padding: 46px 32px; }
.lp-cta-info, .lp-cta-form { padding: 0; }
.lp-contact-details { display: flex; flex-direction: column; gap: 14px; margin-top: 20px; }
.lp-contact-item { display: flex; align-items: flex-start; gap: 14px; color: rgba(246,242,232,0.85); font-size: 0.92rem; line-height: 1.55; }
.lp-contact-item small { display: block; color: rgba(246,242,232,0.5); font-size: 0.75rem; }
a.lp-contact-item:hover { color: var(--brand-gold-light); }
.lp-contact-icon { width: 36px; height: 36px; flex-shrink: 0; border-radius: 50%; border: 1px solid rgba(201,162,74,0.5); display: flex; align-items: center; justify-content: center; color: var(--brand-gold-light); }
.lp-contact-icon svg { width: 17px; height: 17px; }
.lp-cta-form { background: rgba(246,242,232,0.04); border: 1px solid rgba(246,242,232,0.1); border-radius: var(--radius); padding: 26px; }
.lp-cta-form label { color: rgba(246,242,232,0.75); }
.lp-cta-form input, .lp-cta-form select, .lp-cta-form textarea { background: rgba(246,242,232,0.06); border-color: rgba(246,242,232,0.18); color: var(--text-on-dark); }
.lp-cta-form select option { color: #1a1a1a; background: #ffffff;}
.lp-cta-form input::placeholder, .lp-cta-form textarea::placeholder { color: rgba(246,242,232,0.4); }
.lp-cta-form input:focus, .lp-cta-form select:focus, .lp-cta-form textarea:focus { border-color: var(--brand-gold); box-shadow: 0 0 0 3px rgba(201,162,74,0.15); }
.lp-map-wrap-full { min-height: 320px; }
@media (max-width: 720px) {
  .lp-contact-grid { grid-template-columns: 1fr; padding: 36px 22px; }
  .lp-cta-form { padding: 20px; }
}

/* ============================================================
   Dark theme — overrides the light tokens when
   <html data-theme="dark"> is set (see includes/header.php)
   ============================================================ */
html[data-theme="dark"] {
  --bg-page: #171b14;
  --bg-page-2: #1d2318;
  --surface: #1c2117;
  --border: #2c3326;
  --border-strong: #3b4433;

  --text-primary: #f1efe4;
  --text-secondary: #c7cabb;
  --text-muted: #90948a;

  --shadow: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-soft: 0 20px 60px -20px rgba(0,0,0,0.6);

  --danger-bg: rgba(163,45,45,0.22);
  --success-bg: rgba(31,122,67,0.22);
  --info-bg: rgba(26,90,160,0.22);
  --warning-bg: rgba(146,103,12,0.24);
  --purple-bg: rgba(91,63,160,0.24);

  --danger: #e08078;
  --success: #4fbd82;
  --info: #6badf0;
  --warning: #e2b458;
  --purple: #a48ef0;
}

/* Auth pages: input borders read poorly on very dark surfaces otherwise */
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea {
  background: var(--surface);
  color: var(--text-primary);
}
html[data-theme="dark"] .settings-tab-link.active {
  color: var(--brand-gold-light);
}

/* ---------------- Reports ---------------- */
.card-link-btn {
  background: none; border: none; padding: 0; cursor: pointer;
  font-family: inherit; font-size: 12.5px; font-weight: 600; color: var(--brand-gold-dark);
}
.card-link-btn:hover { text-decoration: underline; }

.report-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.report-tile { background: var(--bg-page); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; }
.report-tile .k { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--text-muted); }
.report-tile .v { font-size: 20px; font-weight: 600; color: var(--text-primary); margin-top: 2px; }

.report-bar { height: 8px; min-width: 120px; border-radius: 99px; background: var(--bg-page-2); overflow: hidden; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.report-bar > span { display: block; height: 100%; border-radius: 99px; background: var(--brand-gold); -webkit-print-color-adjust: exact; print-color-adjust: exact; }

/* Print: show only the report, always in light colors (even if the user is in dark mode) */
@media print {
  .sidebar, .topbar, .no-print, .sidebar-backdrop, .back-to-top { display: none !important; }
  .app-shell { display: block; }
  .content { padding: 0; }
  html, html[data-theme="dark"] {
    --bg-page: #ffffff; --bg-page-2: #eeeeee; --surface: #ffffff;
    --text-primary: #000000; --text-secondary: #333333; --text-muted: #555555;
    --border: #cccccc; --border-strong: #bbbbbb;
  }
  body { background: #ffffff; }
  .card { box-shadow: none; border: none; }
}
