/* =========================================================
   Sovereign Grace Financial — Agent Portal
   Preview build v0.1
   Brand tokens match the main marketing site exactly.
   ========================================================= */

/* ---------- Design tokens ---------- */
:root {
  /* Brand palette */
  --navy: #1C2F6B;
  --navy-700: #182760;
  --navy-900: #0c1430;
  --silver: #C5CCD6;
  --silver-200: #e6eaf0;
  --champagne: #B8924A;
  --champagne-700: #a17d3a;
  --ivory: #faf6ef;
  --cream: #f4ede1;
  --ink: #1a1d24;
  --ink-soft: #4a5060;
  --ink-muted: #6b7180;
  --border: #d8dde4;
  --danger: #a23a3a;

  /* Surfaces (light mode default) */
  --bg: var(--ivory);
  --surface: #ffffff;
  --surface-soft: var(--cream);
  --surface-elev: #ffffff;
  --text: var(--ink);
  --text-soft: var(--ink-soft);
  --text-muted: var(--ink-muted);
  --border-color: var(--border);
  --header-bg: rgba(250, 246, 239, 0.85);
  --shadow-sm: 0 1px 2px rgba(28, 47, 107, 0.04);
  --shadow-md: 0 4px 16px rgba(28, 47, 107, 0.08);
  --shadow-lg: 0 12px 32px rgba(28, 47, 107, 0.12);
  --focus: 0 0 0 3px rgba(184, 146, 74, 0.45);

  /* Typography */
  --font-serif: "Fraunces", Georgia, "Times New Roman", serif;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  /* Radius */
  --r-sm: 4px;
  --r: 8px;
  --r-md: 10px;
  --r-lg: 16px;

  /* Spacing scale */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;
  --s-8: 64px;

  /* Motion */
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --t: 220ms;
}

[data-theme="dark"] {
  --bg: var(--navy-900);
  --surface: #131c3e;
  --surface-soft: #182549;
  --surface-elev: #182549;
  --text: #ecedf2;
  --text-soft: #c5ccd6;
  --text-muted: #8a92a8;
  --border-color: #1f2a4a;
  --header-bg: rgba(12, 20, 48, 0.85);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.32);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.4);
}

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

/* ---------- Base ---------- */
* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4, h5 {
  font-family: var(--font-serif);
  font-weight: 500;
  color: var(--text);
  letter-spacing: -0.01em;
  margin: 0;
  line-height: 1.2;
}

h1 { font-size: clamp(28px, 3.6vw, 38px); font-weight: 400; }
h2 { font-size: 24px; font-weight: 500; }
h3 { font-size: 18px; font-weight: 500; }
h4 { font-size: 15px; font-weight: 500; }

p { margin: 0 0 var(--s-3); color: var(--text-soft); }
em { font-style: italic; }

a {
  color: var(--navy);
  text-decoration: none;
  transition: color var(--t) var(--ease);
}
[data-theme="dark"] a { color: #b9c2e0; }
a:hover { color: var(--champagne); }

:focus-visible {
  outline: none;
  box-shadow: var(--focus);
  border-radius: var(--r-sm);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  padding: 10px 18px;
  border-radius: var(--r);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.01em;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background var(--t) var(--ease), color var(--t) var(--ease),
              border-color var(--t) var(--ease), transform var(--t) var(--ease);
  text-decoration: none;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--navy);
  color: var(--ivory);
  border-color: var(--navy);
}
.btn-primary:hover { background: var(--navy-700); color: var(--ivory); }

.btn-cta {
  background: var(--champagne);
  color: var(--navy);
  border-color: var(--champagne);
}
.btn-cta:hover { background: var(--champagne-700); color: var(--ivory); }

.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border-color);
}
.btn-ghost:hover { border-color: var(--navy); color: var(--navy); }
[data-theme="dark"] .btn-ghost:hover { color: var(--silver); border-color: var(--silver); }

.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-danger {
  background: transparent;
  color: var(--danger);
  border-color: var(--danger);
}
.btn-danger:hover { background: var(--danger); color: white; }

/* ---------- Form ---------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: var(--s-4);
}
.field label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-soft);
  letter-spacing: 0.01em;
}
.field input,
.field select,
.field textarea {
  padding: 10px 12px;
  border-radius: var(--r);
  border: 1px solid var(--border-color);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  transition: border-color var(--t) var(--ease), box-shadow var(--t) var(--ease);
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--champagne);
  box-shadow: var(--focus);
}
.field input[readonly] {
  background: var(--surface-soft);
  color: var(--text-muted);
}

/* ---------- Header / Nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--header-bg);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--t) var(--ease), box-shadow var(--t) var(--ease);
}
.site-header.scrolled {
  border-bottom-color: var(--border-color);
  box-shadow: var(--shadow-sm);
}
.header-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: var(--s-5);
}
.header-logo img {
  height: 38px;
  width: auto;
  display: block;
}
[data-theme="dark"] .header-logo img {
  filter: brightness(0) invert(1) opacity(0.92);
}

.primary-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0 auto;
}
.primary-nav a {
  position: relative;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-soft);
  border-radius: var(--r-sm);
  transition: color var(--t) var(--ease);
}
.primary-nav a:hover { color: var(--text); }
.primary-nav a[aria-current="page"] {
  color: var(--text);
}
.primary-nav a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 14px; right: 14px;
  bottom: 0;
  height: 2px;
  background: var(--champagne);
  border-radius: 2px;
}

/* User menu */
.user-menu {
  position: relative;
}
.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--navy);
  color: var(--ivory);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-size: 14px;
  font-weight: 500;
  border: 1px solid var(--navy);
  cursor: pointer;
  transition: transform var(--t) var(--ease), box-shadow var(--t) var(--ease);
}
.user-avatar:hover { box-shadow: var(--shadow-md); }
.user-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 220px;
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: var(--r);
  box-shadow: var(--shadow-lg);
  padding: var(--s-2);
  display: none;
  z-index: 60;
}
.user-dropdown.open { display: block; }
.user-dropdown .user-info {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 6px;
}
.user-dropdown .user-info .name {
  font-family: var(--font-serif);
  font-size: 15px;
  color: var(--text);
}
.user-dropdown .user-info .email {
  font-size: 12px;
  color: var(--text-muted);
}
.user-dropdown a, .user-dropdown button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  font-size: 14px;
  color: var(--text);
  background: transparent;
  border: none;
  border-radius: var(--r-sm);
  cursor: pointer;
  font: inherit;
  transition: background var(--t) var(--ease);
}
.user-dropdown a:hover, .user-dropdown button:hover {
  background: var(--surface-soft);
  color: var(--text);
}

/* Mobile hamburger */
.menu-toggle {
  display: none;
  background: transparent;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 8px;
  border-radius: var(--r-sm);
}
.menu-toggle svg { display: block; }

@media (max-width: 880px) {
  .menu-toggle { display: inline-flex; }
  .primary-nav {
    position: fixed;
    top: 64px;
    left: 0; right: 0;
    background: var(--surface);
    flex-direction: column;
    align-items: stretch;
    padding: var(--s-3);
    gap: 0;
    margin: 0;
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    transform: translateY(-12px);
    opacity: 0;
    pointer-events: none;
    transition: transform var(--t) var(--ease), opacity var(--t) var(--ease);
  }
  .primary-nav.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }
  .primary-nav a {
    padding: 12px 16px;
    border-radius: var(--r-sm);
  }
  .primary-nav a[aria-current="page"]::after { display: none; }
  .primary-nav a[aria-current="page"] {
    background: var(--surface-soft);
    color: var(--navy);
  }
  .header-logo { margin: 0 auto; }
  .header-inner { padding: 12px 16px; }
}

/* ---------- Layout ---------- */
.page {
  flex: 1;
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: var(--s-7) 24px var(--s-7);
}
@media (max-width: 700px) {
  .page { padding: var(--s-5) 16px var(--s-6); }
}

.page-header {
  margin-bottom: var(--s-6);
}
.page-eyebrow {
  font-family: var(--font-sans);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--champagne);
  font-weight: 500;
  margin-bottom: 8px;
}
.page-title {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(28px, 3.6vw, 36px);
  letter-spacing: -0.015em;
}
.page-subtitle {
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 15px;
}

/* ---------- Card ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: var(--r);
  padding: var(--s-5);
  transition: box-shadow var(--t) var(--ease), border-color var(--t) var(--ease), transform var(--t) var(--ease);
}
.card:hover { box-shadow: var(--shadow-md); }
.card-tight { padding: var(--s-4); }

.card-title {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin-bottom: var(--s-2);
}
.card-meta {
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

/* ---------- Section heads ---------- */
.section {
  margin-top: var(--s-7);
}
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: var(--s-4);
  gap: var(--s-4);
}
.section-head h2 {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 22px;
  letter-spacing: -0.01em;
}
.section-head a {
  font-size: 13px;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}
.section-head a:hover { color: var(--champagne); }

/* ---------- Date chip ---------- */
.date-chip {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--navy);
  color: var(--ivory);
  border-radius: var(--r-sm);
  padding: 6px 10px;
  min-width: 56px;
  text-align: center;
}
.date-chip .m {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 500;
  opacity: 0.8;
}
.date-chip .d {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 500;
  line-height: 1.1;
}

/* ---------- Tag / pill ---------- */
.tag {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--text-soft);
  background: var(--surface-soft);
  border: 1px solid var(--border-color);
}
.tag-navy {
  background: var(--navy);
  color: var(--ivory);
  border-color: var(--navy);
}
.tag-champagne {
  background: rgba(184, 146, 74, 0.14);
  color: var(--champagne-700);
  border-color: rgba(184, 146, 74, 0.3);
}
[data-theme="dark"] .tag-champagne { color: var(--champagne); }

/* ---------- Footer ---------- */
.site-footer {
  text-align: center;
  padding: var(--s-5) 16px;
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  border-top: 1px solid var(--border-color);
  margin-top: auto;
}

/* ---------- Toast ---------- */
.toast-stack {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 200;
  pointer-events: none;
}
.toast {
  background: var(--navy);
  color: var(--ivory);
  padding: 12px 18px;
  border-radius: var(--r);
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  max-width: 360px;
  pointer-events: auto;
  animation: toast-in var(--t) var(--ease);
}
@keyframes toast-in {
  from { transform: translateY(8px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(12, 20, 48, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
  animation: fade-in var(--t) var(--ease);
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--surface);
  border-radius: var(--r-md);
  border: 1px solid var(--border-color);
  width: 100%;
  max-width: 540px;
  padding: var(--s-6);
  box-shadow: var(--shadow-lg);
  max-height: 85vh;
  overflow-y: auto;
}
.modal h3 {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 22px;
  margin-bottom: var(--s-4);
}
.modal-actions {
  display: flex;
  gap: var(--s-2);
  justify-content: flex-end;
  margin-top: var(--s-5);
  padding-top: var(--s-4);
  border-top: 1px solid var(--border-color);
}
@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* =========================================================
   Page-specific styles
   ========================================================= */

/* ---------- Login ---------- */
.login-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s-6) 16px;
  background: var(--bg);
  position: relative;
}
.back-link {
  position: absolute;
  top: 24px;
  left: 24px;
  font-size: 13px;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}
.back-link:hover { color: var(--champagne); }
.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: var(--r-md);
  padding: var(--s-7) var(--s-6);
  box-shadow: var(--shadow-md);
  text-align: center;
}
.login-logo {
  width: 110px;
  height: auto;
  margin: 0 auto var(--s-4);
  display: block;
}
[data-theme="dark"] .login-logo {
  filter: brightness(0) invert(1) opacity(0.95);
}
.login-card h1 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 28px;
  letter-spacing: -0.01em;
  margin-bottom: 6px;
}
.login-card .login-eyebrow {
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--champagne);
  margin-bottom: var(--s-5);
  display: block;
}
.login-card form {
  text-align: left;
  margin-top: var(--s-5);
}
.login-card .btn { width: 100%; }
.login-card .forgot {
  display: block;
  margin-top: var(--s-3);
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
}
.login-card .forgot:hover { color: var(--champagne); }

.demo-creds {
  margin-top: var(--s-6);
  padding: var(--s-4);
  background: var(--surface-soft);
  border: 1px dashed var(--border-color);
  border-radius: var(--r);
  text-align: left;
  font-size: 12.5px;
  color: var(--text-soft);
  line-height: 1.5;
}
.demo-creds .label {
  font-family: var(--font-serif);
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--text);
  display: block;
  margin-bottom: 6px;
}
.demo-creds code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11.5px;
  color: var(--navy);
  background: var(--surface);
  border: 1px solid var(--border-color);
  padding: 1px 4px;
  border-radius: 3px;
}
[data-theme="dark"] .demo-creds code { color: var(--silver); }
.demo-creds .note {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-color);
  font-style: italic;
  color: var(--text-muted);
  font-size: 11.5px;
}

/* ---------- Dashboard ---------- */
.welcome-strip {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-4);
  margin-bottom: var(--s-6);
  padding-bottom: var(--s-5);
  border-bottom: 1px solid var(--border-color);
}
.welcome-strip h1 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(26px, 3.5vw, 34px);
  letter-spacing: -0.015em;
}
.welcome-strip h1 em {
  color: var(--champagne);
  font-style: italic;
}
.welcome-strip .date {
  font-size: 13px;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
@media (max-width: 600px) {
  .welcome-strip { flex-direction: column; align-items: flex-start; gap: 4px; }
}

.dash-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: var(--s-6);
}
@media (max-width: 880px) { .dash-grid { grid-template-columns: 1fr; } }

/* Announcements list (used on dashboard + full page) */
.announcement-list {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}
.announcement {
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: var(--r);
  padding: var(--s-5);
  transition: box-shadow var(--t) var(--ease);
}
.announcement:hover { box-shadow: var(--shadow-md); }
.announcement .ann-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}
.announcement h3 {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 19px;
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}
.announcement p { margin: 0; }
.announcement .author {
  color: var(--navy);
  font-weight: 500;
}
[data-theme="dark"] .announcement .author { color: var(--silver); }

/* Events list */
.events-list {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}
.event {
  display: flex;
  gap: var(--s-4);
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: var(--r);
  padding: var(--s-4);
  align-items: center;
  transition: box-shadow var(--t) var(--ease);
}
.event:hover { box-shadow: var(--shadow-sm); }
.event .event-body { flex: 1; min-width: 0; }
.event h4 {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 4px;
}
.event .meta {
  font-size: 12.5px;
  color: var(--text-muted);
  display: flex;
  gap: var(--s-3);
  flex-wrap: wrap;
}
.event .meta .dot { color: var(--silver); }
.event .ics-btn {
  font-size: 12px;
  padding: 5px 10px;
}

/* Quick links / carrier tiles */
.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--s-4);
}
.tile-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.tile-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 880px) {
  .tile-grid.cols-3, .tile-grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .tile-grid.cols-3, .tile-grid.cols-4 { grid-template-columns: 1fr; }
}

.tile {
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: var(--r);
  padding: var(--s-4);
  transition: box-shadow var(--t) var(--ease), border-color var(--t) var(--ease), transform var(--t) var(--ease);
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-decoration: none;
  color: var(--text);
}
.tile:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--silver);
}
.tile h4 {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 500;
  margin: 0;
}
.tile p {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
}

/* Carrier card (detailed) */
.carrier-card {
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: var(--r);
  padding: var(--s-5);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  transition: box-shadow var(--t) var(--ease), border-color var(--t) var(--ease);
}
.carrier-card:hover { box-shadow: var(--shadow-md); border-color: var(--silver); }
.carrier-card h3 {
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 500;
  letter-spacing: -0.01em;
}
.carrier-card .desc {
  font-size: 13.5px;
  color: var(--text-soft);
  line-height: 1.5;
}
.carrier-card .open {
  font-size: 13px;
  font-weight: 500;
  color: var(--navy);
  margin-top: 4px;
}
[data-theme="dark"] .carrier-card .open { color: var(--silver); }
.carrier-card .sub-links {
  display: flex;
  gap: var(--s-3);
  flex-wrap: wrap;
  font-size: 12.5px;
  margin-top: var(--s-2);
  padding-top: var(--s-3);
  border-top: 1px solid var(--border-color);
}
.carrier-card .sub-links a {
  color: var(--text-muted);
}
.carrier-card .sub-links a:hover { color: var(--champagne); }

/* Documents table */
.doc-toolbar {
  display: flex;
  gap: var(--s-4);
  margin-bottom: var(--s-5);
  flex-wrap: wrap;
  align-items: center;
}
.search-input {
  flex: 1;
  min-width: 240px;
  position: relative;
}
.search-input input {
  width: 100%;
  padding: 10px 14px 10px 38px;
  border: 1px solid var(--border-color);
  border-radius: var(--r);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  transition: border-color var(--t) var(--ease), box-shadow var(--t) var(--ease);
}
.search-input input:focus {
  border-color: var(--champagne);
  outline: none;
  box-shadow: var(--focus);
}
.search-input::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  border: 1.5px solid var(--text-muted);
  border-radius: 50%;
}
.search-input::after {
  content: "";
  position: absolute;
  left: 25px;
  top: 60%;
  width: 8px;
  height: 1.5px;
  background: var(--text-muted);
  transform: rotate(45deg);
}

.chip-filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.chip {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-soft);
  padding: 6px 12px;
  font-size: 12.5px;
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  font-size: 12.5px;
  letter-spacing: 0.02em;
  transition: all var(--t) var(--ease);
}
.chip:hover { border-color: var(--silver); color: var(--text); }
.chip.active {
  background: var(--navy);
  color: var(--ivory);
  border-color: var(--navy);
}

.doc-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.doc-row {
  display: grid;
  grid-template-columns: 36px 1fr auto auto auto;
  gap: var(--s-4);
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: var(--r);
  padding: var(--s-3) var(--s-4);
  transition: box-shadow var(--t) var(--ease), border-color var(--t) var(--ease);
}
.doc-row:hover { box-shadow: var(--shadow-sm); border-color: var(--silver); }
.doc-icon {
  width: 36px; height: 36px;
  background: var(--surface-soft);
  color: var(--navy);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-sm);
  font-family: var(--font-serif);
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--border-color);
}
[data-theme="dark"] .doc-icon { color: var(--silver); }
.doc-info { min-width: 0; }
.doc-info .title {
  font-family: var(--font-serif);
  font-size: 15.5px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.doc-info .meta {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  gap: var(--s-3);
  align-items: center;
}
@media (max-width: 700px) {
  .doc-row {
    grid-template-columns: 36px 1fr;
    gap: var(--s-3);
  }
  .doc-row .tag, .doc-row .date-col { display: none; }
  .doc-row .doc-actions { grid-column: 1 / -1; justify-self: end; }
}
.doc-actions { display: flex; gap: 6px; }
.date-col { font-size: 12.5px; color: var(--text-muted); white-space: nowrap; }

/* Calendar (list) */
.month-group { margin-bottom: var(--s-6); }
.month-label {
  font-family: var(--font-serif);
  font-size: 13px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--champagne);
  margin-bottom: var(--s-3);
  font-weight: 500;
}

/* Team */
.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--s-4);
}
.team-card {
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: var(--r);
  padding: var(--s-5);
  text-align: center;
  transition: box-shadow var(--t) var(--ease), border-color var(--t) var(--ease);
}
.team-card:hover { box-shadow: var(--shadow-md); border-color: var(--silver); }
.team-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--navy);
  color: var(--ivory);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 500;
  margin-bottom: var(--s-3);
}
.team-card.is-admin .team-avatar {
  background: var(--champagne);
  color: var(--navy);
}
.team-card h3 {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 500;
  margin-bottom: 2px;
}
.team-card .role {
  font-size: 11.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--champagne);
  margin-bottom: var(--s-3);
}
.team-card .contact {
  font-size: 13px;
  color: var(--text-soft);
  line-height: 1.6;
  word-break: break-word;
}
.team-card .contact a {
  color: var(--text-soft);
  word-break: break-word;
}
.team-card .contact a:hover { color: var(--navy); }
[data-theme="dark"] .team-card .contact a:hover { color: var(--silver); }

/* Admin */
.admin-banner {
  background: rgba(184, 146, 74, 0.12);
  border: 1px solid rgba(184, 146, 74, 0.3);
  color: var(--champagne-700);
  border-radius: var(--r);
  padding: 12px 18px;
  margin-bottom: var(--s-5);
  font-size: 13.5px;
  display: flex;
  align-items: center;
  gap: var(--s-3);
}
[data-theme="dark"] .admin-banner { color: var(--champagne); }
.admin-banner .badge {
  background: var(--champagne);
  color: var(--navy);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 3px;
  font-weight: 600;
}

.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: var(--s-5);
  overflow-x: auto;
}
.tab {
  background: transparent;
  border: none;
  padding: 10px 18px;
  font: inherit;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  transition: all var(--t) var(--ease);
}
.tab:hover { color: var(--text); }
.tab.active {
  color: var(--text);
  border-bottom-color: var(--champagne);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.admin-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--s-4);
}
.admin-toolbar h2 {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 20px;
}

table.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: var(--r);
  overflow: hidden;
}
.admin-table th, .admin-table td {
  text-align: left;
  padding: 12px 16px;
  font-size: 13.5px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}
.admin-table th {
  background: var(--surface-soft);
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table td.actions { text-align: right; white-space: nowrap; }
.admin-table .icon-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-soft);
  padding: 4px 10px;
  font-size: 12px;
  border-radius: var(--r-sm);
  cursor: pointer;
  margin-left: 4px;
  font: inherit;
  font-size: 12px;
  transition: all var(--t) var(--ease);
}
.admin-table .icon-btn:hover { color: var(--navy); border-color: var(--navy); }
.admin-table .icon-btn.danger:hover { color: var(--danger); border-color: var(--danger); }
[data-theme="dark"] .admin-table .icon-btn:hover { color: var(--silver); border-color: var(--silver); }

/* Account */
.account-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-5);
}
@media (max-width: 880px) { .account-grid { grid-template-columns: 1fr; } }

.profile-summary {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  margin-bottom: var(--s-5);
  padding-bottom: var(--s-5);
  border-bottom: 1px solid var(--border-color);
}
.profile-summary .big-avatar {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: var(--navy);
  color: var(--ivory);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-size: 26px;
}
.profile-summary .name {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 500;
}
.profile-summary .role-tag {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--champagne);
  margin-top: 4px;
}

/* Utilities */
.hidden { display: none !important; }
.mt-4 { margin-top: var(--s-4); }
.mt-5 { margin-top: var(--s-5); }
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.empty-state {
  text-align: center;
  padding: var(--s-7);
  color: var(--text-muted);
  font-size: 14px;
}

/* =========================================================
   Production additions: skeletons, error states, file inputs,
   pinned announcements, signed-out hint
   ========================================================= */

.skeleton {
  background: linear-gradient(90deg, var(--surface-soft) 0%, var(--silver-200) 50%, var(--surface-soft) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
  border-radius: var(--r);
  color: transparent !important;
}
[data-theme="dark"] .skeleton {
  background: linear-gradient(90deg, #182549 0%, #233361 50%, #182549 100%);
  background-size: 200% 100%;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.skeleton-row { height: 72px; margin-bottom: 8px; }
.skeleton-card { height: 140px; margin-bottom: 12px; }
.skeleton-line { height: 14px; margin-bottom: 8px; border-radius: 4px; }

.error-state {
  background: rgba(162, 58, 58, 0.06);
  border: 1px solid rgba(162, 58, 58, 0.25);
  color: var(--danger);
  padding: var(--s-4);
  border-radius: var(--r);
  font-size: 13.5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  flex-wrap: wrap;
}
.error-state .btn { white-space: nowrap; }

.pin-badge {
  display: inline-block;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--champagne);
  margin-right: 8px;
  font-weight: 600;
}

.field input[type="file"] {
  padding: 8px;
  background: var(--surface-soft);
  cursor: pointer;
}

.form-error {
  color: var(--danger);
  font-size: 12.5px;
  margin-top: 6px;
}

.text-link {
  color: var(--navy);
  text-decoration: underline;
  text-decoration-color: rgba(28,47,107,0.3);
  text-underline-offset: 2px;
}
[data-theme="dark"] .text-link { color: var(--silver); }

.signup-hint {
  margin-top: var(--s-5);
  padding: var(--s-3) var(--s-4);
  background: var(--surface-soft);
  border-radius: var(--r);
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.55;
  text-align: center;
  border: 1px solid var(--border-color);
}

.tab-panel .empty-state {
  background: var(--surface);
  border: 1px dashed var(--border-color);
  border-radius: var(--r);
  margin-top: var(--s-3);
}

.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
  vertical-align: -2px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.btn[disabled] { opacity: 0.6; cursor: not-allowed; }
