:root {
  --ink: #1a1208; --ink-muted: #5a4a3a; --ink-faint: #9a8a7a;
  --parchment: #f5f0e8; --parchment-dark: #ede8dc; --parchment-border: #d8d0c0;
  --rust: #8b3a1c; --rust-dark: #6b2a0e; --rust-light: #f0e0d8;
  --sage: #3a5a3a; --sage-light: #e0ece0; --gold: #c8962a; --gold-light: #f5e8c8;
  --surface: #ffffff; --shadow: 0 2px 12px rgba(26,18,8,.08);
  --shadow-lg: 0 8px 32px rgba(26,18,8,.12); --radius: 3px; --transition: .18s ease;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Source Sans 3', sans-serif; background: var(--parchment); color: var(--ink); line-height: 1.6; display: flex; flex-direction: column; min-height: 100vh; }
main { flex: 1; }

/* NAV */
.nav { background: var(--ink); color: var(--parchment); padding: 0 2rem; display: flex; align-items: center; justify-content: space-between; height: 60px; position: sticky; top: 0; z-index: 100; box-shadow: 0 2px 8px rgba(0,0,0,.3); }
.nav-brand { font-family: 'Playfair Display', serif; font-size: 1.25rem; font-weight: 700; color: var(--parchment); text-decoration: none; }
.nav-brand span { color: var(--gold); }
.nav-links { display: flex; align-items: center; gap: .25rem; }
.nav-link { color: rgba(245,240,232,.75); text-decoration: none; font-size: .875rem; font-weight: 500; padding: .5rem 1rem; border-radius: var(--radius); transition: var(--transition); background: none; border: none; cursor: pointer; font-family: inherit; }
.nav-link:hover, .nav-link.active { color: var(--parchment); background: rgba(255,255,255,.1); }
.nav-company { font-size: .8rem; color: var(--gold); font-weight: 500; }
.nav-right { display: flex; align-items: center; gap: 1rem; }

/* LAYOUT */
.container { max-width: 1200px; margin: 0 auto; padding: 0 2rem; }
.page { padding: 2.5rem 0; }
.page-header { margin-bottom: 2rem; }
.page-title { font-family: 'Playfair Display', serif; font-size: 2rem; font-weight: 700; color: var(--ink); line-height: 1.2; }
.page-subtitle { color: var(--ink-muted); margin-top: .25rem; font-size: .95rem; }
.page-header-row { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 1rem; }

/* CARDS */
.card { background: var(--surface); border: 1px solid var(--parchment-border); border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow); }
.card-title { font-family: 'Playfair Display', serif; font-size: 1.1rem; font-weight: 600; margin-bottom: 1rem; color: var(--ink); }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.stat-card { background: var(--surface); border: 1px solid var(--parchment-border); border-radius: var(--radius); padding: 1.25rem 1.5rem; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.stat-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--rust); }
.stat-number { font-family: 'Playfair Display', serif; font-size: 2.2rem; font-weight: 700; color: var(--ink); line-height: 1; }
.stat-label { font-size: .8rem; color: var(--ink-muted); text-transform: uppercase; letter-spacing: .8px; margin-top: 4px; font-weight: 600; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 1rem; }
@media (max-width: 768px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* FORMS */
.form-group { margin-bottom: 1.25rem; }
.form-label { display: block; font-size: .85rem; font-weight: 600; color: var(--ink-muted); text-transform: uppercase; letter-spacing: .6px; margin-bottom: .4rem; }
.form-label span { color: var(--rust); }
.form-control { width: 100%; padding: .65rem .875rem; font-family: 'Source Sans 3', sans-serif; font-size: .95rem; color: var(--ink); background: var(--surface); border: 1.5px solid var(--parchment-border); border-radius: var(--radius); transition: var(--transition); appearance: none; }
.form-control:focus { outline: none; border-color: var(--rust); box-shadow: 0 0 0 3px rgba(139,58,28,.1); }
select.form-control { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%235a4a3a' d='M6 8L0 0h12z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .875rem center; padding-right: 2.5rem; }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-hint { font-size: .8rem; color: var(--ink-faint); margin-top: .25rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }
.form-check { display: flex; align-items: center; gap: .5rem; cursor: pointer; }
.form-check input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--rust); cursor: pointer; }
.form-check-label { font-size: .95rem; color: var(--ink); cursor: pointer; }

/* BUTTONS */
.btn { display: inline-flex; align-items: center; gap: .4rem; padding: .6rem 1.25rem; font-family: 'Source Sans 3', sans-serif; font-size: .9rem; font-weight: 600; border: none; border-radius: var(--radius); cursor: pointer; text-decoration: none; transition: var(--transition); letter-spacing: .3px; white-space: nowrap; }
.btn-primary { background: var(--ink); color: var(--parchment); }
.btn-primary:hover { background: var(--rust-dark); }
.btn-rust { background: var(--rust); color: white; }
.btn-rust:hover { background: var(--rust-dark); }
.btn-outline { background: transparent; color: var(--ink); border: 1.5px solid var(--parchment-border); }
.btn-outline:hover { border-color: var(--ink); background: var(--parchment-dark); }
.btn-ghost { background: transparent; color: var(--ink-muted); padding: .4rem .75rem; font-size: .85rem; }
.btn-ghost:hover { background: var(--parchment-dark); color: var(--ink); }
.btn-danger { background: transparent; color: var(--rust); border: 1.5px solid var(--rust-light); font-size: .85rem; padding: .4rem .75rem; }
.btn-danger:hover { background: var(--rust); color: white; border-color: var(--rust); }
.btn-sm { padding: .35rem .75rem; font-size: .82rem; }
.w-full { width: 100%; justify-content: center; }

/* TABLE */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
thead th { background: var(--parchment-dark); color: var(--ink-muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .8px; font-weight: 600; padding: .75rem 1rem; text-align: left; border-bottom: 2px solid var(--parchment-border); }
tbody td { padding: .85rem 1rem; border-bottom: 1px solid var(--parchment-border); vertical-align: top; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--parchment); }
.td-actions { display: flex; gap: .4rem; flex-wrap: wrap; }

/* BADGES */
.badge { display: inline-block; padding: 2px 10px; border-radius: 10px; font-size: .75rem; font-weight: 600; letter-spacing: .4px; text-transform: uppercase; }
.badge-active { background: var(--sage-light); color: var(--sage); }
.badge-inactive { background: var(--parchment-dark); color: var(--ink-faint); }
.badge-employer { background: var(--gold-light); color: #7a5a10; }
.badge-employee { background: var(--rust-light); color: var(--rust-dark); }

/* ALERTS */
.alert { padding: .875rem 1.25rem; border-radius: var(--radius); margin-bottom: 1.25rem; font-size: .9rem; }
.alert-error { background: #fef2f0; border: 1px solid #f5c6bc; color: #7a2010; }
.alert-success { background: var(--sage-light); border: 1px solid #b0d0b0; color: var(--sage); }
.alert-info { background: var(--gold-light); border: 1px solid #dfc070; color: #6a4a10; }

/* AUTH */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; background: var(--parchment); background-image: repeating-linear-gradient(0deg,transparent,transparent 39px,var(--parchment-border) 39px,var(--parchment-border) 40px); padding: 2rem; }
.auth-box { background: var(--surface); border: 1px solid var(--parchment-border); border-radius: var(--radius); padding: 2.5rem; width: 100%; max-width: 460px; box-shadow: var(--shadow-lg); }
.auth-logo { font-family: 'Playfair Display', serif; font-size: 1.6rem; font-weight: 700; color: var(--ink); text-align: center; margin-bottom: .25rem; }
.auth-logo span { color: var(--rust); }
.auth-tagline { text-align: center; color: var(--ink-muted); font-size: .85rem; margin-bottom: 2rem; }
.auth-divider { border: none; border-top: 1px solid var(--parchment-border); margin: 1.5rem 0; }
.auth-footer-link { text-align: center; font-size: .875rem; color: var(--ink-muted); margin-top: 1.25rem; }
.auth-footer-link a { color: var(--rust); text-decoration: none; font-weight: 600; }

/* INVITE */
.invite-url-box { background: var(--parchment); border: 1.5px dashed var(--parchment-border); border-radius: var(--radius); padding: .75rem 1rem; font-size: .82rem; color: var(--ink-muted); word-break: break-all; display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.invite-url-text { flex: 1; }

/* SESSION CARDS */
.session-card { background: var(--surface); border: 1px solid var(--parchment-border); border-radius: var(--radius); padding: 1.25rem; margin-bottom: .75rem; box-shadow: var(--shadow); display: grid; grid-template-columns: 1fr auto; gap: 1rem; align-items: start; }
.session-date { font-family: 'Playfair Display', serif; font-size: 1rem; font-weight: 600; color: var(--ink); }
.session-time { color: var(--ink); font-weight: 500; }
.session-break-tag { display: inline-block; padding: 1px 8px; background: var(--gold-light); color: var(--gold); border-radius: 10px; font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.material-tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; background: var(--parchment); border: 1px solid var(--parchment-border); border-radius: 10px; font-size: .78rem; color: var(--ink-muted); margin: 2px; }

/* MATERIAL BUILDER */
.material-row { display: grid; grid-template-columns: 2fr 1fr 1.2fr 2fr auto; gap: .5rem; align-items: end; margin-bottom: .5rem; }
@media (max-width: 700px) { .material-row { grid-template-columns: 1fr 1fr; } }

/* SITE CARDS */
.sites-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px,1fr)); gap: 1rem; }
.site-card { background: var(--surface); border: 1px solid var(--parchment-border); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); transition: var(--transition); text-decoration: none; color: inherit; display: block; }
.site-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); border-color: var(--rust-light); }
.site-card-name { font-family: 'Playfair Display', serif; font-size: 1.1rem; font-weight: 600; color: var(--ink); margin-bottom: .25rem; }
.site-card-addr { font-size: .85rem; color: var(--ink-muted); }
.site-card-footer { margin-top: 1rem; display: flex; justify-content: space-between; align-items: center; }


:root {
  --si-text:         var(--ink);
  --si-text-muted:   var(--ink-muted);
  --si-accent:       var(--rust);
  --si-accent-dark:  var(--rust-dark);
  --si-border:       var(--parchment-border);
  --si-heading-font: 'Playfair Display', serif;
  --si-footer-bg:    var(--ink);
  --si-footer-text:  rgba(245, 240, 232, .6);
  --si-footer-link:  rgba(245, 240, 232, .75);
}

/* UTILITY */
.text-muted { color: var(--ink-muted); } .text-sm { font-size: .85rem; }
.mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: 1rem; } .mb-3 { margin-bottom: 1.5rem; }
.flex { display: flex; } .gap-1 { gap: .5rem; } .gap-2 { gap: 1rem; }
.items-center { align-items: center; } .justify-between { justify-content: space-between; }
.divider { border: none; border-top: 1px solid var(--parchment-border); margin: 1.5rem 0; }
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--ink-muted); }
.empty-state-icon { font-size: 3rem; margin-bottom: 1rem; opacity: .4; }
.empty-state-text { font-size: 1rem; margin-bottom: 1.25rem; }
.section-title { font-family: 'Playfair Display', serif; font-size: 1.2rem; font-weight: 600; margin-bottom: 1rem; padding-bottom: .5rem; border-bottom: 2px solid var(--parchment-border); }

/* SITE FOOTER */
.site-footer { background: var(--si-footer-bg); color: var(--si-footer-text); font-size: .8rem; padding: 1.5rem 2rem; }
.site-footer a { color: var(--si-footer-link); text-decoration: none; }
.site-footer a:hover { color: #fff; }
.site-footer__inner { max-width: 1200px; margin: 0 auto; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: .75rem 2rem; }
.site-footer__links { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; }

/* LEGAL PAGES */
.legal-page { max-width: 720px; margin: 3rem auto; padding: 0 1rem; }
.legal-page h1 { font-family: var(--si-heading-font); font-size: 2rem; font-weight: 700; margin-bottom: 1.5rem; color: var(--si-text); }
.legal-page h2 { font-size: 1.1rem; font-weight: 600; margin-top: 2rem; margin-bottom: .5rem; color: var(--si-accent); border-bottom: 1px solid var(--si-border); padding-bottom: .25rem; }
.legal-page h3 { font-size: 1rem; font-weight: 600; margin-top: 1rem; margin-bottom: .25rem; color: var(--si-text-muted); }
.legal-page p, .legal-page address, .legal-page li { color: var(--si-text-muted); font-size: .95rem; margin-bottom: .75rem; }
.legal-page ul { padding-left: 1.25rem; }
.legal-page .lead-text { font-size: 1.05rem; color: var(--si-text); }
.legal-page a { color: var(--si-accent); }
.legal-page a:hover { color: var(--si-accent-dark); }

/* ── FILTER GRID HELPERS ─────────────────────────────────────── */
/* Used by Sessions views instead of inline grid styles */
.filter-grid      { display: grid; grid-template-columns: 1fr 1fr 1fr auto;      gap: .75rem; align-items: end; }
.filter-grid-wide { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr auto;  gap: .75rem; align-items: end; }

/* ── HAMBURGER BUTTON ──────────────────────────────────────────── */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: .4rem .35rem;
  flex-shrink: 0;
  align-self: stretch;
}
.nav-toggle-bar {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--parchment);
  border-radius: 1px;
  transition: transform .18s ease, opacity .18s ease;
  transform-origin: center;
}
.nav-toggle.open .nav-toggle-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open .nav-toggle-bar:nth-child(2) { opacity: 0; transform: scaleX(0); }
.nav-toggle.open .nav-toggle-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── BREAKPOINT: tablet / small desktop ─────────────────────────── */
@media (max-width: 768px) {
  /* Nav: hamburger layout */
  .nav {
    padding: 0 1rem;
    flex-wrap: wrap;
    height: auto;
    min-height: 60px;
    justify-content: flex-start;
    gap: 0;
  }
  .nav-brand {
    flex: 1;
    height: 60px;
    display: flex;
    align-items: center;
  }
  .nav-toggle { display: flex; }
  .nav-right {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: .25rem 0 .75rem;
    border-top: 1px solid rgba(255,255,255,.1);
  }
  .nav-right.open { display: flex; }
  .nav-company {
    padding: .65rem 1rem;
    font-size: .85rem;
    border-bottom: 1px solid rgba(255,255,255,.08);
  }
  .nav-links {
    flex-direction: column;
    width: 100%;
    gap: 0;
  }
  .nav-link {
    padding: .875rem 1rem;
    font-size: .95rem;
    border-radius: 0;
    display: flex;
    align-items: center;
    width: 100%;
  }
}

/* ── BREAKPOINT: mobile ──────────────────────────────────────────── */
@media (max-width: 640px) {
  /* Container */
  .container { padding: 0 .875rem; }
  .page { padding: 1.25rem 0; }

  /* Typography */
  .page-title { font-size: 1.4rem; }
  .page-header { margin-bottom: 1.25rem; }

  /* Cards */
  .card { padding: 1.1rem; }
  .stat-card { padding: 1rem 1.1rem; }
  .stat-number { font-size: 1.75rem; }
  .stats-grid { grid-template-columns: 1fr 1fr; }

  /* Filter grids collapse to 1 column */
  .filter-grid,
  .filter-grid-wide { grid-template-columns: 1fr; }

  /* Tables */
  thead th { font-size: .7rem; padding: .6rem .75rem; }
  tbody td { font-size: .82rem; padding: .65rem .75rem; }

  /* Session card */
  .session-card { grid-template-columns: 1fr; }

  /* Sites grid: fewer minimum width so 2 up still fits */
  .sites-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }

  /* Footer */
  .site-footer { padding: 1.25rem .875rem; }
  .site-footer__inner { flex-direction: column; align-items: flex-start; gap: .5rem; }
}

/* ── BREAKPOINT: small phone ─────────────────────────────────────── */
@media (max-width: 480px) {
  .container { padding: 0 .75rem; }

  /* Material row: single column on small phones */
  .material-row { grid-template-columns: 1fr; }

  /* Auth pages */
  .auth-wrap { padding: 1.25rem .75rem; align-items: flex-start; padding-top: 2rem; }
  .auth-box { padding: 1.5rem 1.1rem; }

  /* Minimum touch targets */
  .btn { min-height: 44px; }
  .btn-sm { min-height: 38px; }

  /* Page header: stack title + action button vertically */
  .page-header-row { flex-direction: column; align-items: flex-start; }

  /* Stats: single column on very small phones */
  .stats-grid { grid-template-columns: 1fr; }
}

/* ── BREAKPOINT: tiny (360 px and below) ────────────────────────── */
@media (max-width: 360px) {
  .page-title { font-size: 1.2rem; }
  .nav-brand { font-size: 1.05rem; }
}

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

.profile-avatar {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 1rem;
  align-items: center;
  margin-bottom: 1rem;
}
.profile-avatar__preview {
  width: 76px;
  height: 76px;
  border-radius: 999px;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: #2563eb;
  color: #fff;
  font-size: 1.5rem;
  font-weight: 800;
}
.profile-avatar__preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
@media (max-width: 560px) {
  .profile-avatar { grid-template-columns: 1fr; }
}