/* ==========================================================================
   STYLE GUIDE — GovNotice Dark Theme Design System
   ==========================================================================
   Reference this section when adding or modifying styles to maintain
   visual consistency across the application. All values below reflect
   the current dark-theme implementation.

   COLOR PALETTE (Dark Theme)
   --------------------------------------------------------------------------
   Primary:
     --primary-color  : #4a7adb  (Justice Blue)    — buttons, headings, links
     --primary-dark   : #0e2350  (Deep Navy)       — nav bg, footer, table headers
     --primary-light  : #5b8def  (Sky Blue)        — hover states, link color

   Accent:
     --accent-gold    : #d4a017  (Capitol Gold)    — borders, highlights, active states
     --accent-dark    : #b8860b  (Dark Gold)       — hover on gold elements

   Semantic:
     --danger         : #e74c3c  (Liberty Red)     — alerts, destructive actions
     --success        : #2ecc71  (Civic Green)     — confirmations, success states

   Surfaces:
     --bg-color       : #0f1923  (Dark Charcoal)   — page background
     --bg-card        : #1a2744  (Navy Card)       — card/panel surfaces
     --surface-color  : #1a2744  (Navy Surface)    — form fields, table bg
     --surface-civic  : #162038  (Deep Civic)      — callouts, filter bars, hover bg

   Text:
     --text-color     : #e0e6f0  (Light Gray)      — body text
     --text-muted     : #8899b4  (Slate Blue)      — secondary/helper text

   Border:
     --border-color   : #2a3a5c  (Muted Navy)      — dividers, input borders

   TYPOGRAPHY
   --------------------------------------------------------------------------
   Font stack:
     --font-body    : 'Segoe UI', system-ui, sans-serif
     --font-display : Georgia, 'Times New Roman', serif (headings)
   Scale:
     h1: 2.05rem  — display weight, serif
     h2: 1.35rem  — gold left-border accent (6px solid --accent-gold)
     h3: 1.14rem  — primary blue color
     body: 1rem (16px base), line-height 1.7

   SHADOWS (3-tier elevation system)
   --------------------------------------------------------------------------
     --shadow-subtle : 0 2px 10px   — cards at rest, inputs
     --shadow-medium : 0 6px 24px   — elevated cards, forms, CTA elements
     --shadow-deep   : 0 16px 48px  — modals, overlays

   BORDER RADIUS
   --------------------------------------------------------------------------
     --radius-sm  : 6px   — pills, badges, small inputs, buttons
     --radius     : 10px  — cards, panels, tables (default)
     --radius-lg  : 18px  — hero sections, modals, glass panels

   RESPONSIVE BREAKPOINTS
   --------------------------------------------------------------------------
   CSS custom properties for breakpoints are defined in :root for reference.
   Note: CSS custom properties cannot be used directly in @media queries
   (per CSS spec), so the raw values are used in @media rules with comments
   referencing the corresponding variable name.

     --bp-sm  : 480px   — small phones (portrait)
     --bp-md  : 700px   — tablets / large phones (landscape)
     --bp-lg  : 1024px  — desktops / laptops
     --bp-xl  : 1280px  — large desktops / wide monitors

   RESPONSIVE LAYOUT VARIABLES
   --------------------------------------------------------------------------
   These variables are overridden per breakpoint so components can adapt
   without writing their own @media rules. Override them in @media blocks
   targeting the --bp-* breakpoints above.

     --container-gutter : 1.25rem  — horizontal padding inside .container
     --card-min-width   : 340px    — minimum column width for card grids
     --grid-gap         : 2.1em    — gap between grid items
     --font-scale       : 1        — multiplier for responsive type sizing
     --hero-height      : 320px    — hero image target height
     --hero-min-height  : 260px    — hero banner minimum height

   Per-breakpoint overrides (defaults → overrides):
     ≥1280px (xl) : gutter 1.5rem, card-min 360px, grid-gap 2.4em
     ≤1024px (lg) : gutter 1rem,   card-min 300px, grid-gap 1.8em, scale 0.97
     ≤700px  (md) : gutter 0.65rem,card-min 240px, grid-gap 1.4em, scale 0.95,
                     hero 165px/110px
     ≤480px  (sm) : gutter 0.22rem,card-min 200px, grid-gap 1.1em, scale 0.92,
                     hero 86px/80px

   SPACING
   --------------------------------------------------------------------------
   Use multiples of 0.5rem for padding/margins (0.5, 1, 1.5, 2, 2.5, 3).
   Container max-width: 1100px (992px at ≤1280px, 92vw at ≤1024px).

   COMPONENT CLASSES
   --------------------------------------------------------------------------
   Layout:
     .container            — centered content wrapper with responsive padding
     .hero-banner          — full-bleed hero with overlay support
     .hero-img             — cover-fit image inside hero (320px tall)
     .hero-overlay-text    — headline text over hero images (gradient overlay)
     .hero-subtitle        — subtitle within hero (--text-muted)

   Navigation:
     .navbar               — sticky top bar, --primary-dark bg, gold bottom border
     .navbar-brand         — gold serif logo text
     .navbar-links         — flex row of nav links (collapses on mobile)
     .navbar-toggle        — hamburger button (hidden on desktop)

   Panels (left-border accent pattern):
     .panel-civic          — blue left-border, civic surface bg
     .panel-notice         — gold left-border, warm transparent bg
     .panel-alert          — red left-border, light red transparent bg
     .panel-success        — green left-border, light green transparent bg
     .panel-info           — light-blue left-border, civic surface bg

   Cards:
     .card / .card-panel   — navy surface, gold top-accent stripe (5px)
     .card-header          — bold 1.14rem title area
     .card-body            — padded content area
     .card-grid            — auto-fit responsive grid (min 340px columns)
     .card-summary         — clickable expand/collapse header
     .card-details         — collapsible detail area
     .quick-action-card    — blue left-border variant, no top stripe
     .card-cta             — gold bg call-to-action card
     .card-cta.info        — navy bg with blue left-border
     .card-cta.highlight   — civic bg with light-blue left-border

   Buttons:
     .btn / .btn-primary   — blue bg (#4a7adb), white text
     .btn-secondary        — transparent, border only, muted text
     .btn-tertiary         — surface bg, gold text
     .btn-cta              — gold bg, dark text, uppercase, bold
     .btn-danger           — red bg for destructive actions
     .btn-success          — green bg for confirmations
     .btn-action           — dark navy bg, gold text
     .btn-link             — transparent, underlined link style
     .btn-sm / .btn-lg     — size variants
     .btn-icon             — compact icon-only button

   Badges:
     .badge                — pill-shaped (999px radius), civic surface bg
     .badge-category       — card bg, primary blue text
     .badge-sent           — green bg
     .badge-draft          — gold bg
     .badge-federal/state/local/agency — blue shade spectrum
     .badge-party          — white bg with primary border
     .badge-party-democrat/republican — party-colored

   Forms:
     .form-section         — grouped form area with bottom margin
     .form-title           — serif heading with icon slot
     .form-input/select/textarea — surface bg, navy border, focus transition
     .form-hint            — small muted help text below inputs
     .form-group           — label + input wrapper
     .input-group          — inline flex row of inputs
     .compose-form         — card-style form wrapper with shadow
     .search-bar           — centered max-width search layout

   Tables:
     .table                — full-width, surface bg, collapsed borders
     .table th             — --primary-dark bg, white text, gold bottom border
     .table tr:hover       — civic surface highlight
     .table-responsive     — horizontal scroll wrapper
     .modern-table         — rounded shadow variant

   Modals:
     .modal-overlay        — fixed full-screen dark backdrop (z-index 1500)
     .modal                — card-bg centered dialog with deep shadow
     .modal-header/footer  — bordered header/footer with flex layout
     .modal-close-btn      — round danger-colored close button

   Filters:
     .filter-bar           — civic surface row with gap spacing
     .filter-btn           — toggle button (surface bg, gold when .active)
     .filter-btn-group     — flex row of filter buttons
     .filter-search-input  — inline text filter

   Utilities:
     .pill                 — rounded pill shape (999px radius)
     .shadow-lg / .shadow-md — elevation via box-shadow
     .sr-only              — screen-reader-only (accessibility)
     .glass-panel          — frosted glass effect (backdrop-filter blur)
     .civic-callout        — pull-quote / callout block (gold text, blue border)
     .action-banner        — urgency/CTA banner (gold bg, dark text)
     .compose-notice       — info notice with blue left-border
     .flex-row, .align-center, .justify-between, .w-100, .mt-5 — layout helpers

   ANIMATION & TRANSITIONS
   --------------------------------------------------------------------------
   - Use 0.12s–0.18s durations for hover/focus transitions.
   - @keyframes spin      — spinner rotation (1.1s linear infinite)
   - @keyframes fadeIn    — opacity 0→1 fade entrance
   - Prefer CSS transitions over animations for interactive states.

   ACCESSIBILITY
   --------------------------------------------------------------------------
   - All interactive elements have :focus-visible outlines (#4f46e5, 2px solid).
   - Minimum contrast ratio: 4.5:1 for normal text, 3:1 for large text.
   - Use .sr-only for visually hidden but screen-reader-accessible content.
   - .skip-link is styled to appear on keyboard focus for skip navigation.
   - .notification-region collapses when empty, visible with ARIA live content.
   - Prefer rem/em units over px for font sizes.

   PRINT
   --------------------------------------------------------------------------
   Print styles reset all backgrounds to white, text to dark, remove shadows.
   Nav, footer, hero, modals, filters, and decorative panels are hidden.

   Z-INDEX SCALE
   --------------------------------------------------------------------------
   Maintain this layering order — never insert arbitrary z-index values.
     Base content    :    0       — default stacking
     Sticky navbar   :  500       — .navbar (sticky top bar)
     Mobile nav menu :  800       — .navbar-links (mobile dropdown)
     Modal overlay   : 1500       — .modal-overlay (backdrop + dialog)
     Skip link       : 10000      — .skip-link:focus (above everything)

   NAMING CONVENTIONS
   --------------------------------------------------------------------------
   Classes follow a flat component-modifier pattern (not strict BEM):
     .component            — base component (.card, .btn, .badge, .panel)
     .component-part       — sub-element (.card-header, .card-body, .modal-footer)
     .component-variant    — visual variant (.btn-danger, .btn-cta, .badge-sent)
     .component.modifier   — state via chained class (.filter-btn.active, .card-cta.info)
   Prefix page-specific wrappers with the page name:
     .dashboard-page, .offices-page, .templates-page, .compose-form
   Utility classes are single-purpose and use short names:
     .w-100, .mt-5, .flex-row, .text-center, .sr-only

   STATE & INTERACTION PATTERNS
   --------------------------------------------------------------------------
   Hover:
     - Use 0.12s-0.18s transitions on background, color, border-color, box-shadow.
     - Cards hover: --surface-civic bg.  Buttons hover: lighter/darker variant.
     - Gold elements hover: --accent-dark.  Blue elements hover: --primary-light.
   Active / Selected:
     - Toggle the .active class.  Active state uses --accent-gold bg with dark text.
     - Active nav links and pagination get --accent-gold color.
   Focus:
     - All interactive elements use :focus-visible (not :focus) with #4f46e5 outline.
     - Buttons add a 4px box-shadow ring.  Inputs use 3px ring with 0 offset.
   Disabled:
     - Inputs get #20272d bg and #606775 text.  Do not change border color.

   DESIGN RULES (Do's and Don'ts)
   --------------------------------------------------------------------------
   Do:
     - Use CSS custom properties (--var) for all colors, radii, and shadows.
     - Use rem/em for font sizes; px only for borders, outlines, and shadows.
     - Add gold top-accent (5px border-top) on standard cards.
     - Add colored left-border (5px-6px) on panels and notice variants.
     - Keep buttons at --radius-sm (6px) and cards at --radius (10px).
     - Test contrast: 4.5:1 minimum for normal text, 3:1 for large text.
     - Wrap new sections in a /* --- SECTION NAME --- */ comment.
   Don't:
     - Don't use raw hex colors — always reference a --var from :root.
     - Don't add new z-index values outside the scale above.
     - Don't use :focus alone — use :focus-visible to avoid mouse outlines.
     - Don't use !important except on utility overrides and print resets.
     - Don't introduce new font families — stick to --font-body and --font-display.
     - Don't use preprocessors or @import — this is a single vanilla CSS file.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Responsive Breakpoint Variables
   Breakpoint custom properties are consolidated into the main :root block
   below. CSS custom properties cannot be used in @media query conditions
   (per CSS spec), so raw values are used in @media rules with comments
   referencing the corresponding variable name.
   -------------------------------------------------------------------------- */

/* ── Accessibility: focus outlines for keyboard navigation ── */

/* Global focus-visible: all interactive elements get a visible outline when focused via keyboard */
:focus-visible {
  outline: 2px solid #4f46e5;
  outline-offset: 2px;
}

/* Navbar toggle: prominent focus ring for mobile menu button */
.navbar-toggle:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.6);
  border-radius: 6px;
}

/* Navbar links: visible focus ring on nav items */
.navbar-links a:focus-visible {
  outline: 2px solid #4f46e5;
  outline-offset: 2px;
  border-radius: 4px;
}

/* Skip link: visible when focused via keyboard */
.skip-link:focus {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 10000;
  background: #4f46e5;
  color: #fff;
  padding: 0.6em 1.2em;
  border-radius: 6px;
  outline: 2px solid #fff;
  outline-offset: 2px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  text-decoration: none;
  font-weight: 600;
}

/* Buttons: consistent focus ring for all button variants */
.btn:focus-visible {
  outline: 2px solid #4f46e5;
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.25);
}

/* Filter and role filter buttons: focus ring when navigating with keyboard */
.filter-btn:focus-visible,
.role-filter-btn:focus-visible {
  outline: 2px solid #4f46e5;
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.2);
}

/* Card summary (expandable office cards): focus ring for keyboard expand/collapse */
.card-summary:focus-visible {
  outline: 2px solid #4f46e5;
  outline-offset: -2px;
  border-radius: 8px;
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.15);
}

/* Modal close button: visible focus indicator */
.modal-close-btn:focus-visible {
  outline: 2px solid #4f46e5;
  outline-offset: 2px;
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.3);
}

/* Form inputs and textareas: focus ring for compose form fields */
.form-input:focus-visible,
.form-select:focus-visible,
.form-textarea:focus-visible,
.search-input:focus-visible,
.filter-search-input:focus-visible {
  outline: 2px solid #4f46e5;
  outline-offset: 0;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

/* Pagination links and buttons: focus ring for page navigation */
.pagination-container a:focus-visible,
.pagination-container button:focus-visible {
  outline: 2px solid #4f46e5;
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.2);
  border-radius: 4px;
}

/* Table action links: focus ring for dashboard letter actions */
.table a:focus-visible,
.table .btn:focus-visible {
  outline: 2px solid #4f46e5;
  outline-offset: 2px;
}

/* ── ARIA live regions: notification panels for screen readers ── */

/* Notification regions collapse when empty so they don't affect layout */
.notification-region:empty {
  display: none;
}

/* When populated, notification regions display with appropriate spacing */
.notification-region {
  margin-bottom: 0.75rem;
}

/* Ensure notification content inside live regions is clearly visible */
.notification-region .compose-notice {
  padding: 0.75em 1em;
  border-radius: 8px;
  font-size: 0.97rem;
  line-height: 1.5;
}

/* Modern pill-style filter/search button */
.pill {
  border-radius: 999px;
  padding-left: 1.4em;
  padding-right: 1.4em;
}

/* Soft dropshadow for notification/empty state panels */
.shadow-lg {
  box-shadow: 0 8px 32px 0 rgba(26,58,122,0.16), 0 1.5px 7px rgba(13,27,62,0.10);
}
.shadow-md {
  box-shadow: 0 4px 16px rgba(26,58,122,0.10);
}


/* Responsive improvements for hero overlays — var(--bp-md): 700px */
@media (max-width: 700px) {
  .hero-img {
    height: var(--hero-height);
    min-height: 120px;
  }
  .hero-banner {
    min-height: var(--hero-min-height);
    padding-bottom: 2em;
  }
  .hero-overlay-text {
    padding: 1.5em 0.6em 1em 0.6em;
    font-size: calc(1.19rem * var(--font-scale));
  }
}

/* Small phone adjustments — var(--bp-sm): 480px */
@media (max-width: 480px) {
  .hero-img {
    height: var(--hero-height);
  }
  .hero-banner {
    min-height: var(--hero-min-height);
  }
}

/* ==========================================================================
   Responsive Breakpoint Scaffolding
   Use these @media blocks when adding responsive rules. Each block
   corresponds to a --bp-* variable defined in :root.
   ========================================================================== */

/* Large desktops — var(--bp-xl): 1280px */
@media (min-width: 1280px) {
  :root {
    --container-gutter: 1.5rem;
    --card-min-width: 360px;
    --grid-gap: 2.4em;
  }
}

/* Desktops / laptops — var(--bp-lg): 1024px */
@media (max-width: 1024px) {
  :root {
    --container-gutter: 1rem;
    --card-min-width: 300px;
    --grid-gap: 1.8em;
    --font-scale: 0.97;
  }
}


/* --- GOVNOTICE DARK THEME DESIGN SYSTEM (ADDED) --- */
:root {
  --primary-color: #4a7adb;
  --primary-dark: #0e2350;
  --primary-light: #5b8def;
  --accent-gold: #d4a017;
  --accent-dark: #b8860b;
  --danger: #e74c3c;
  --success: #2ecc71;
  --bg-color: #0f1923;
  --bg-card: #1a2744;
  --surface-color: #1a2744;
  --surface-civic: #162038;
  --text-color: #e0e6f0;
  --text-muted: #8899b4;
  --border-color: #2a3a5c;
  --font-body: 'Segoe UI', system-ui, sans-serif;
  --font-display: Georgia, 'Times New Roman', serif;
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 18px;
  --shadow-subtle: 0 2px 10px 0 rgba(25,31,61,0.10);
  --shadow-medium: 0 6px 24px 0 rgba(25,31,61,0.19);
  --shadow-deep: 0 16px 48px 0 rgba(14,35,80,0.36);
  /* Responsive breakpoints (reference only — cannot be used in @media conditions) */
  --bp-sm: 480px;   /* Small phones (portrait) */
  --bp-md: 700px;   /* Tablets / large phones (landscape) */
  --bp-lg: 1024px;  /* Desktops / laptops */
  --bp-xl: 1280px;  /* Large desktops / wide monitors */

  /* Responsive layout variables — overridden per breakpoint in @media blocks */
  --container-gutter: 1.25rem;   /* Horizontal padding inside .container */
  --card-min-width: 340px;       /* Minimum column width for card grids */
  --grid-gap: 2.1em;             /* Gap between grid/card items */
  --font-scale: 1;               /* Multiplier for responsive type sizing */
  --hero-height: 320px;          /* Hero image target height */
  --hero-min-height: 260px;      /* Hero banner minimum height */
}

html, body {
  height: 100%;
  min-height: 100%;
}

body {
  background: var(--bg-color);
  color: var(--text-color);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.7;
  box-sizing: border-box;
  scroll-behavior: smooth;
}
*, *::before, *::after {
  box-sizing: inherit;
}

.container {
  max-width: 1100px;
  margin-left: auto;
  margin-right: auto;
  padding: 2.3rem var(--container-gutter) 2.5rem var(--container-gutter);
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  color: var(--text-color);
  margin-bottom: 0.25em;
}
h1 { font-size: 2.05rem; font-weight: 700; }
h2 { font-size: 1.35rem; font-weight: 600; border-left: 6px solid var(--accent-gold); padding-left: 0.7em; }
h3 { font-size: 1.14rem; font-weight: 600; color: var(--primary-color); text-transform: none; }
.text-center { text-align: center !important; }
.section-highlight-bar { border-left: 5px solid var(--primary-color); padding-left: 0.85em; color: var(--accent-gold);}
.section-icon { color: var(--accent-gold); font-size: 1.34em; vertical-align: middle; margin-right: 0.24em; }

a { color: var(--primary-light); text-decoration: underline; transition: color 0.18s; }
a:hover { color: var(--accent-gold); }
.active { color: var(--accent-gold) !important; }

.navbar {
  position: sticky; top: 0; z-index: 500;
  background: var(--primary-dark);
  border-bottom: 3.5px solid var(--accent-gold);
  padding: 0.85rem 0 0.6rem 0;
  display: flex; align-items: center; justify-content: space-between;
}
.navbar-brand {
  font-family: var(--font-display); font-size: 1.28rem; font-weight: 700;
  color: var(--accent-gold); text-decoration: none;
}
.navbar-links { display: flex; gap: 1.1em; }
.navbar-toggle { display: none; background: none; border: none; color: var(--text-color); }
.navbar-toggle-icon::before { content: '\2630'; font-size: 1.7em; color: var(--accent-gold); }

@media (max-width: 700px) {
  .navbar-links { flex-direction: column; gap: 0.8em; background: var(--primary-dark); position: absolute; top: 56px; left: 0; right: 0; z-index: 800; box-shadow: 0 6px 28px rgba(14,35,80,0.19); border-radius: 0 0 12px 12px; display: none; }
  .navbar-links.open { display: flex; }
  .navbar-toggle { display: block; }
}

.hero-banner {
  position: relative; overflow: hidden; width: 100%; background: var(--primary-dark);
  margin-bottom: 2rem; margin-top: 0.73rem;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  min-height: var(--hero-min-height);
  box-shadow: 0 8px 44px rgba(13,27,62,0.12);
}
.hero-img {
  width: 100%; height: var(--hero-height); object-fit: cover; border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.hero-overlay-text {
  position: absolute; bottom: 0; left: 0; width: 100%; padding: 2.6em 1.5em 2.3em 2.1em; background: linear-gradient(to top, rgba(15,25,35,0.91) 65%, rgba(15,25,35,0.18) 98%); color: var(--text-color);
}
.hero-subtitle { font-size: 1.1rem; color: var(--text-muted); }

/* --- BUTTONS --- */
.btn {
  display: inline-block; font-family: inherit; border-radius: var(--radius-sm); border: none; padding: 0.62em 1.45em; font-size: 1rem; font-weight: 600; text-align: center; cursor: pointer; background: var(--primary-color); color: #fff; box-shadow: var(--shadow-subtle); transition: background 0.16s, color 0.16s, box-shadow 0.14s;
}
.btn-primary { background: var(--primary-color); color: #fff; }
.btn-primary:hover, .btn-primary:focus { background: var(--primary-light); color: #fff; }
.btn-secondary { background: transparent; border: 1.5px solid var(--border-color); color: var(--text-muted); }
.btn-secondary:hover, .btn-secondary:focus { color: var(--accent-gold); border-color: var(--accent-gold); }
.btn-tertiary { background: var(--surface-color); color: var(--accent-gold); border: 1.5px solid var(--surface-civic); }
.btn-tertiary:hover, .btn-tertiary:focus { background: var(--bg-card); color: var(--primary-light); }
.btn-cta { background: var(--accent-gold); color: #181c32; text-transform: uppercase; letter-spacing: 0.01em; font-weight: 700; box-shadow: var(--shadow-medium); }
.btn-cta:hover, .btn-cta:focus { background: var(--accent-dark); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover, .btn-danger:focus { background: #b2231d; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover, .btn-success:focus { background: #249657; }
.btn-sm { font-size: 0.875em; padding: 0.45em 1.1em; }
.btn-lg { font-size: 1.13em; padding: 0.86em 2.2em; border-radius: var(--radius-lg); }
.btn-icon { padding: 0.51em 0.77em; min-width: 32px; }
.btn-link { background: transparent; color: var(--primary-light); box-shadow: none; text-decoration: underline; padding: 0.4em 0.7em; border: none; }
.btn-action { background: var(--primary-dark); color: var(--accent-gold); }
.btn-action:hover, .btn-action:focus { color: var(--primary-light); }

.card, .card-panel {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-subtle);
  margin-bottom: 2rem;
  border-top: 5px solid var(--accent-gold);
  color: var(--text-color);
  overflow: hidden;
}
.card-header { font-size: 1.14rem; font-weight: 600; margin-bottom: 0.46em; }
.card-title { font-family: var(--font-display); font-size: 1.11rem; color: var(--primary-color); }
.card-body { padding: 1.25em 1.05em; }
.card-desc { color: var(--text-muted); font-size: 1.01em; }
.card-actions { display: flex; gap: 0.95em; margin-top: 0.8em; }
.card-grid { display: grid; gap: var(--grid-gap) 2.5em; grid-template-columns: repeat(auto-fit,minmax(var(--card-min-width),1fr)); }
.card-summary { cursor: pointer; padding: 1.1rem 1.4rem; border-bottom: 1px solid var(--border-color); transition: background 0.17s; }
.card-summary:hover, .card-summary:focus { background: var(--surface-civic); }
.card-details { background: var(--surface-color); border-radius: 0 0 14px 14px; padding: 1.1rem 1.4rem; }
.quick-action-card { background: var(--surface-civic); border-left: 6px solid var(--primary-color); border-top: none; }
.office-card { box-shadow: var(--shadow-medium); }
.template-card { background: var(--surface-civic); }
.card-cta { background: var(--accent-gold); color: #232323; box-shadow: var(--shadow-medium); }
.card-cta.info { background: var(--bg-card); color: var(--accent-gold); border-left: 6px solid var(--primary-color); }
.card-cta.highlight { background: var(--surface-civic); color: var(--accent-gold); border-left: 6px solid var(--primary-light); }
.card-summary, .card-details { border-radius: 0 0 var(--radius) var(--radius); }

.panel-info { border-left: 5px solid var(--primary-light); background: var(--surface-civic); color: var(--text-color); padding: 1.16em 0.87em; }
.panel-alert { border-left: 5px solid var(--danger); background: rgba(231, 76, 60, 0.07); color: #ee7d72; }
.panel-success { border-left: 5px solid var(--success); background: rgba(46,204,113,0.08); color: #63e09b; }
.panel-civic { border-left: 5px solid var(--primary-color); background: var(--surface-civic); color: var(--text-color); }
.panel-notice { border-left: 5px solid var(--accent-gold); background: rgba(212, 160, 23, 0.07); color: var(--accent-gold); }
.prefilled-info { background: var(--surface-civic); color: var(--text-color); border-left: 5px solid var(--primary-light); padding: 0.88em 1.1em; }

.form-section { margin-bottom: 2.2em; }
.form-title { font-size: 1.25rem; font-family: var(--font-display); font-weight: 600; color: var(--primary-color); display: flex; align-items: center; gap: 0.55em; margin-bottom: 0.68em; }
.form-title-icon { color: var(--accent-gold); font-size: 1.22em; margin-right: 0.12em; display: inline-block; vertical-align: middle; }
.form-input, .form-select, .form-textarea {
  background: var(--surface-color); color: var(--text-color); border: 1.5px solid var(--border-color); border-radius: var(--radius-sm); font-size: 1.01rem; padding: 0.67em 0.84em; margin-bottom: 0.44em; outline: none; transition: border-color 0.15s, background 0.15s;
}
.form-input:disabled, .form-select:disabled { background: #20272d; color: #606775; }
.form-hint { display: block; font-size: 0.92em; color: var(--text-muted); margin-top: -0.4em; margin-bottom: 0.7em; }
.form-group { margin-bottom: 1.29em; }
.input-group { display: flex; gap: 0.7em; align-items: center; }
.input-outline { border: 2.1px solid var(--primary-dark); }
.compose-form { background: var(--bg-card); padding: 2em 1.3em 2.2em 1.3em; border-radius: var(--radius); box-shadow: var(--shadow-medium); }
.split-form-group { display: flex; gap: 3.2em; }
.letter-content-section { margin-bottom: 1.7em; }
.flex-actions { display: flex; gap: 1em; justify-content: end; }
.search-form { display: flex; gap: 0.6em; }
.search-input { width: 100%; background: var(--surface-civic); color: var(--text-color); border: 1.5px solid var(--border-color); border-radius: var(--radius-sm); height: 2.2em; font-size: 1em; }
.search-bar { margin: 2.8em auto 1.2em auto; display: flex; justify-content: center; align-items: center; max-width: 680px; gap: 2em; }

.table { width: 100%; background: var(--surface-color); color: var(--text-color); border-radius: var(--radius); overflow: hidden; border-collapse: collapse; margin-bottom: 2.3em; }
.table th {
  background: var(--primary-dark); color: #fff; border-bottom: 2.5px solid var(--accent-gold); font-weight: 700; padding: 0.77em 1.05em; text-align: left;
}
.table td { padding: 0.78em 1.05em; border-bottom: 1px solid var(--border-color); }
.table tr:hover { background: var(--surface-civic); }
.table-responsive { width: 100%; overflow-x: auto; }
.modern-table { border-radius: var(--radius); box-shadow: var(--shadow-subtle); }

.modal-overlay { position: fixed; left: 0; top: 0; width: 100vw; height: 100vh; background: rgba(16,24,34,0.76); z-index: 1500; display: flex; align-items: center; justify-content: center; }
.modal { background: var(--bg-card); color: var(--text-color); border-radius: var(--radius-lg); box-shadow: var(--shadow-deep); min-width: 340px; min-height: 120px; padding: 2.2em 2.1em 1.7em 2.1em; max-width: 98vw; }
.modal-header { border-bottom: 2px solid var(--border-color); padding-bottom: 1em; margin-bottom: 1em; display: flex; align-items: start; justify-content: space-between; }
.modal-footer { padding-top: 1em; display: flex; gap: 1.3em; justify-content: end; border-top: 1px solid var(--border-color); }
.modal-title-lg { font-size: 1.18rem; font-weight: 700; color: var(--primary-color); }
.modal-description-text { color: var(--text-muted); font-size: 1.03em; }
.modal-close-btn { font-size: 1.3em; background: none; border: none; color: var(--danger); cursor: pointer; padding: 0.2em 0.55em; border-radius: 50%; }

.filter-bar { display: flex; align-items: center; gap: 1.5em; background: var(--surface-civic); border-radius: var(--radius); padding: 0.8em 1.05em; margin-bottom: 1.7em; }
.filter-btn, .role-filter-btn { background: var(--surface-color); color: var(--text-muted); border: 1.5px solid var(--border-color); border-radius: var(--radius-sm); font-size: 1em; font-weight: 500; padding: 0.57em 1.34em; margin-right: .35em; cursor: pointer; transition: all 0.12s; }
.filter-btn.active, .role-filter-btn.active { background: var(--accent-gold); color: #181c32; border-color: var(--accent-gold); box-shadow: 0 2px 10px 0 #2a3a5c22; }
.filter-btn-group { display: flex; gap: 0.7em; }
.filter-search-input { background: var(--surface-color); color: var(--text-color); border: 1.5px solid var(--border-color); border-radius: var(--radius-sm); font-size: 1em; padding: 0.51em 1em; margin-right: 0.8em; }
.filter-search-label { color: var(--text-muted); font-size: 0.97em; margin-right: 0.5em; }
.prominent-filters { background: var(--bg-card); }
.filter-bar-inner { display: flex; align-items: center; gap: 1.1em; }

.badge { display: inline-block; padding: 0.21em 0.85em; border-radius: 999px; font-size: 0.93em; font-weight: 600; background: var(--surface-civic); color: var(--accent-gold); margin-right: 0.35em; border: 1.2px solid var(--border-color); }
.badge-category { background: var(--bg-card); color: var(--primary-color); }
.badge-sent { background: var(--success); color: #fff; }
.badge-draft { background: var(--accent-gold); color: #fff; }
.badge-federal { background: #293f7d; color: #fff; }
.badge-state { background: #30608e; color: #fff; }
.badge-local { background: #4a7adb; color: #fff; }
.badge-agency { background: #5b8def; color: #fff; }
.badge-party { background: #fff; color: #1f2947; border: 1.2px solid var(--primary-color); }
.badge-party-democrat { background: #446ad3; color: #fff; }
.badge-party-republican { background: #df4a4a; color: #fff; }
.badge-category-modal { background: var(--surface-color); color: var(--primary-color); }

.loading { color: var(--accent-gold); font-size: 1.14em; text-align: center; margin: 1.5em auto; padding: .95em 0 0.75em 0; }
.spinner { display: inline-block; width: 1.8em; height: 1.8em; border: 0.21em solid var(--surface-civic); border-top: 0.21em solid var(--accent-gold); border-radius: 50%; animation: spin 1.1s linear infinite; margin-right: 0.65em; vertical-align: middle; }
@keyframes spin { 0% { transform: rotate(0deg);} 100% { transform: rotate(360deg);} }
.empty-state { text-align: center; color: var(--text-muted); font-size: 1.09em; padding: 1.71em 0 1.8em 0; }

.pagination-container { display: flex; gap: 0.45em; align-items: center; justify-content: center; margin-top: 2.1em; background: transparent; }
.pagination-container a, .pagination-container button { background: var(--surface-civic); color: var(--text-muted); border: 1.2px solid var(--border-color); border-radius: var(--radius-sm); font-size: .98em; padding: 0.42em 1em; margin: 0 2px; cursor: pointer; text-decoration: none; transition: all 0.15s; }
.pagination-container a.active, .pagination-container button.active { background: var(--accent-gold); color: #181c32; border-color: var(--accent-gold); }

footer, .offices-footer, .visually-footer { background: var(--primary-dark); color: var(--text-muted); font-size: 0.97em; padding: 2.5em 0 2em 0; text-align: center; border-top: 2px solid var(--border-color); }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.flex-row { display: flex; flex-direction: row; }
.align-center { align-items: center !important; }
.justify-between { justify-content: space-between !important; }
.w-100 { width: 100% !important; }
.mt-5 { margin-top: 2.5rem !important; }
.glass-panel { background: rgba(20,30,54,0.45); backdrop-filter: blur(9px); border-radius: var(--radius-lg); box-shadow: var(--shadow-subtle); }
.civic-callout { background: var(--surface-civic); color: var(--accent-gold); border-left: 6px solid var(--primary-color); font-size: 1.09em; padding: 1.3em 2em; margin: 1.6em 0; border-radius: var(--radius); }
.action-banner { background: var(--accent-gold); color: #232323; font-weight: 600; padding: 1.15em 2.5em; border-radius: var(--radius); box-shadow: var(--shadow-medium); margin-bottom: 2em; }
.compose-notice { background: var(--surface-civic); border-left: 5px solid var(--primary-light); color: var(--text-color); font-size: 1.05em; }

.compose-main-content { background: var(--surface-color); border-radius: var(--radius-lg); box-shadow: var(--shadow-medium); padding: 2.1em 1.6em 2.7em 1.9em; margin-top: 2.5em; }
.modern-form-page { background: transparent; box-shadow: none; padding: 0 }
.dashboard-page, .offices-page, .templates-page { background: transparent; box-shadow: none; }
.recent-letters { background: var(--surface-color); border-radius: var(--radius); box-shadow: var(--shadow-medium); padding: 1.3em 1.05em 2.4em 1.05em; }
.recent-letters-header { background: none; border-bottom: 1.3px solid var(--border-color); margin-bottom: 1.18em; padding-bottom: 0.24em; }
.dashboard-cta-cards { display: flex; gap: 2em; justify-content: space-between; margin: 2.3em 0 1.7em 0; }
.grid-actions { display: grid; gap: 2.1em 2.5em; grid-template-columns: repeat(auto-fit,minmax(340px,1fr)); }

.template-body, .enhanced-template-body { background: var(--surface-civic); color: var(--text-color); border-radius: var(--radius-sm); font-family: var(--font-body); font-size: 1em; line-height: 1.52; padding: 1.35em; margin-top: 1em; overflow-x: auto; }
.template-body-header { color: var(--accent-gold); font-size: 1.05em; margin-bottom: 0.6em; }
mark.placeholder { background: var(--primary-dark); color: var(--accent-gold); border-radius: 3px; padding: 0.04em 0.27em; }

.office-dept { color: var(--accent-gold); margin-left: 0.57em; font-size: 0.96em; }
.office-address { color: var(--text-muted); font-size: 0.99em; display: block; margin-top: 2px; }
.office-phone { color: var(--primary-light); font-size: 0.96em; margin-left: 0.67em; }
.office-website { color: var(--primary-light); margin-left: 0.52em; }
.office-district { color: var(--primary-light); font-size: 0.92em; margin-left: 0.43em; }
.write-to-btn, .contact-btn { margin-top: 1.05em; }

/* --- Responsive overrides using breakpoint variables --- */

/* var(--bp-xl): 1280px */
@media (max-width: 1280px) {
  .container { max-width: 992px; }
}

/* var(--bp-lg): 1024px */
@media (max-width: 1024px) {
  .container { max-width: 92vw; }
  .dashboard-cta-cards { flex-direction: column; gap: 1em; }
}

/* var(--bp-md): 700px */
@media (max-width: 700px) {
  :root {
    --container-gutter: 0.65rem;
    --card-min-width: 240px;
    --grid-gap: 1.4em;
    --font-scale: 0.95;
    --hero-height: 165px;
    --hero-min-height: 110px;
  }
  .container { padding: 1.1rem var(--container-gutter) 1.15rem var(--container-gutter); }
  .dashboard-cta-cards { flex-direction: column; gap: 1em; }
}

/* var(--bp-sm): 480px */
@media (max-width: 480px) {
  :root {
    --container-gutter: 0.22rem;
    --card-min-width: 200px;
    --grid-gap: 1.1em;
    --font-scale: 0.92;
    --hero-height: 86px;
    --hero-min-height: 80px;
  }
  .container { padding: 0.35rem var(--container-gutter) 0.45rem var(--container-gutter); }
}

@media print {
  body, .navbar, .hero-banner, .footer, .offices-footer, .templates-page, .dashboard-page, .compose-main-content, .quick-action-card, .recent-letters, .panel-info, .panel-alert, .panel-success, .panel-notice, .panel-civic, .action-banner, .action-banner, .card, .modal, .modal-overlay,.card-panel, .card-grid { background: #fff !important; color: #181c32 !important; box-shadow: none !important; }
  nav, .navbar, .footer, .offices-footer, .recent-letters-header, .dashboard-cta-cards, .action-banner, .hero-banner, .modal, .modal-overlay, .modern-modal, .modern-modal-overlay, .filter-bar, .panel-info, .panel-alert, .panel-success, .panel-notice, .panel-civic, .glass-panel { display: none !important; }
  a, a:visited { color: #222 !important; text-decoration: underline !important; }
}

@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }

/* --- END DARK THEME --- */
