/* ============================================================
   ChachaHR SaaS — Design System
   Warm editorial palette; brand color overridden per company
   via inline <style> in base.html setting --brand vars.
   ============================================================ */

:root {
  --cream: #FAF7F2;
  --cream-2: #F4EFE6;
  --white: #FFFFFF;
  --ink: #1A1814;
  --ink-soft: #3A352E;
  --muted: #7A7268;
  --line: #E5DDD0;

  /* Brand — overridden per-tenant in base.html */
  --brand: #FF6B35;
  --brand-deep: #E63946;
  --brand-soft: #FFE5DB;
  --brand-tint: #FFF6F1;
  --mono: 'JetBrains Mono', monospace;

  /* Semantic */
  --success: #3D5A41;
  --success-soft: #DCE5D9;
  --warning: #C77800;
  --warning-soft: #FBE8C4;
  --error: #E63946;
  --error-soft: #FEE5E5;
  --info: #5B7C99;
  --info-soft: #DCE5EE;

  --serif: 'Fraunces', 'New York', Georgia, serif;
  --sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Inter', system-ui, sans-serif;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-pill: 999px;

  --shadow-sm: 0 2px 8px rgba(26, 24, 20, 0.04);
  --shadow-md: 0 6px 24px rgba(26, 24, 20, 0.08);
  --shadow-lg: 0 16px 48px rgba(26, 24, 20, 0.12);
}

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

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--sans);
  background: var(--cream);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-deep); }

button, input, textarea, select { font: inherit; color: inherit; }

img { max-width: 100%; display: block; }

/* ---------- Typography ---------- */
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }

h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); }
h3 { font-size: 1.35rem; }
h4 { font-size: 1.05rem; }

.eyebrow {
  display: inline-block;
  font-family: var(--sans);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--brand);
}

.italic-accent { font-style: italic; color: var(--brand); }

.muted { color: var(--muted); }

/* ---------- Layout ---------- */
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 24px; }
.wrap-narrow { max-width: 720px; margin: 0 auto; padding: 0 24px; }
.section { padding: 56px 0; }

/* ---------- App layout (signed-in) ---------- */
.app {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
}

/* ---------- Sidebar ---------- */
.sidebar {
  background: var(--ink);
  color: var(--cream);
  padding: 28px 20px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.2) transparent;
}

.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 3px; }

.sidebar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--serif);
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--cream);
  padding-bottom: 28px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar .brand img {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  object-fit: cover;
  background: white;
  padding: 2px;
}

.sidebar .brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--brand), var(--brand-deep));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-family: var(--sans);
  font-size: 1rem;
}

.sidebar nav {
  margin-top: 24px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 10px;
  color: rgba(250, 247, 242, 0.7);
  font-size: 0.93rem;
  font-weight: 500;
  transition: all 0.15s;
}

.sidebar nav a:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--cream);
}

.sidebar nav a.active {
  background: var(--brand);
  color: white;
  font-weight: 600;
}

/* Locked nav items — plan feature not available */
.sidebar nav a.nav-locked {
  opacity: 0.42;
  cursor: not-allowed;
  pointer-events: none;
  font-style: italic;
}
.sidebar nav a.nav-locked:hover {
  background: transparent;
  color: inherit;
}
.sidebar nav a.nav-locked .lock-icon {
  margin-left: auto;
  font-size: 11px;
  opacity: 0.7;
  flex-shrink: 0;
}
/* Re-enable pointer events so clicking goes to upgrade page */
.sidebar nav a.nav-locked { pointer-events: auto; }

.sidebar nav a svg, .sidebar nav a i {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.sidebar .nav-section {
  margin-top: 24px;
  margin-bottom: 8px;
  padding: 0 14px;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(250, 247, 242, 0.4);
  font-weight: 700;
}

/* Toggle section buttons (#1) */
.sidebar .nav-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: rgba(255,255,255,0.08);
  border: none;
  border-radius: 10px;
  padding: 9px 14px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(250, 247, 242, 0.8);
  cursor: pointer;
  text-align: left;
  margin-bottom: 4px;
  transition: background 0.15s;
}
.sidebar .nav-toggle:hover {
  background: rgba(255,255,255,0.14);
}
.sidebar .nav-toggle--company {
  margin-top: 10px;
  border-left: 3px solid #8B5CF6;
  background: rgba(139,92,246,0.12);
  color: rgba(221, 214, 254, 0.9);
}
.sidebar .nav-toggle--company:hover {
  background: rgba(139,92,246,0.2);
}
.nav-toggle-icon {
  font-size: 0.85rem;
  transition: transform 0.2s;
  flex-shrink: 0;
}
.sidebar .nav-section-body {
  overflow: hidden;
  transition: none;
}
  margin: 16px 0 6px;
  padding: 8px 14px 6px;
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 800;
  color: rgba(250, 247, 242, 0.55);
  background: rgba(255,255,255,0.06);
  border-radius: 8px;
  border-left: 2px solid var(--brand);
}

.sidebar .nav-group-header--company {
  margin-top: 20px;
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: 16px;
  border-left-color: #8B5CF6;
}

/* Notification badge on nav items (#10) */
.sidebar nav a {
  position: relative;
}

.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--brand);
  color: white;
  font-size: 0.65rem;
  font-weight: 800;
  line-height: 1;
  margin-left: auto;
  flex-shrink: 0;
}

.nav-badge-warn {
  background: #F59E0B;
}

.sidebar .me {
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar .me .avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--brand-deep));
  color: white; font-weight: 700; font-size: 0.85rem;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.sidebar .me .info {
  font-size: 0.85rem;
  line-height: 1.3;
  flex: 1;
  min-width: 0;
}

.sidebar .me .info .name {
  color: var(--cream);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar .me .info .role {
  color: rgba(250, 247, 242, 0.5);
  font-size: 0.75rem;
  text-transform: capitalize;
}

/* ---------- Main content ---------- */
.main {
  padding: 32px 40px 80px;
  min-width: 0; /* prevent grid overflow */
}

@media (max-width: 700px) {
  .main { padding: 20px 16px 80px; }
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.page-head h1 {
  font-size: clamp(1.8rem, 3.5vw, 2.6rem);
}

.page-head p { color: var(--muted); margin-top: 4px; }

/* ---------- Cards ---------- */
.card {
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.card.elevated { box-shadow: var(--shadow-md); }

.card h3 { margin-bottom: 12px; }

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 16px;
}

/* ---------- Stat tiles ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat {
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.stat .label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 8px;
}

.stat .value {
  font-family: var(--serif);
  font-size: 2.6rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.03em;
}

.stat .value.brand { color: var(--brand); }
.stat .value.success { color: var(--success); }
.stat .value.warning { color: var(--warning); }
.stat .delta {
  margin-top: 6px;
  font-size: 0.8rem;
  color: var(--muted);
}

/* ---------- Hero dark card ---------- */
.hero-dark {
  background: linear-gradient(135deg, var(--ink), var(--ink-soft));
  color: var(--cream);
  border-radius: var(--radius-xl);
  padding: 32px;
  margin-bottom: 32px;
  position: relative;
  overflow: hidden;
}

.hero-dark::before {
  content: '';
  position: absolute;
  top: -100px; right: -100px;
  width: 300px; height: 300px;
  background: radial-gradient(circle, var(--brand) 0%, transparent 70%);
  opacity: 0.18;
  pointer-events: none;
}

.hero-dark h2 {
  color: var(--cream);
  font-size: 2rem;
  position: relative;
}

.hero-dark .eyebrow { color: var(--brand); }

.hero-dark .stats-row {
  display: flex;
  gap: 32px;
  margin-top: 24px;
  flex-wrap: wrap;
  position: relative;
}

.hero-dark .stats-row .item .value {
  font-family: var(--serif);
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--cream);
}

.hero-dark .stats-row .item .label {
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(250, 247, 242, 0.6);
  font-weight: 600;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 22px;
  border-radius: var(--radius-pill);
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn-primary {
  background: var(--ink);
  color: var(--cream);
}

.btn-primary:hover {
  background: var(--ink-soft);
  color: var(--cream);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-brand {
  background: var(--brand);
  color: white;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.btn-brand:hover {
  background: var(--brand-deep);
  color: white;
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--ink);
  color: var(--ink);
}

.btn-outline:hover {
  background: var(--ink);
  color: var(--cream);
}

.btn-ghost {
  background: transparent;
  color: var(--ink);
}

.btn-ghost:hover { background: var(--cream-2); }

.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #2C4530; color: white; }

.btn-danger { background: var(--error); color: white; }
.btn-danger:hover { background: #B82530; color: white; }

.btn-sm { height: 34px; padding: 0 14px; font-size: 0.85rem; }
.btn-lg { height: 54px; padding: 0 32px; font-size: 1.05rem; }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 18px; }

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink-soft);
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  background: white;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-size: 0.95rem;
  color: var(--ink);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(255, 107, 53, 0.1);
}

.form-textarea { min-height: 100px; resize: vertical; font-family: inherit; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 600px) {
  .form-row { grid-template-columns: 1fr; }
}

/* ── Mobile responsiveness for wide tables and dense toolbars ──
   Applies site-wide (not just payroll) since raw <table> tags without a
   scroll wrapper otherwise overflow the viewport on small screens. */
@media (max-width: 760px) {
  table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }
  table thead, table tbody, table tr {
    display: table;
    width: 100%;
    table-layout: auto;
  }
  .page-head {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 12px;
  }
  .page-head > .row,
  .page-head > div:last-child {
    width: 100%;
  }
  .form-row {
    grid-template-columns: 1fr !important;
  }
  .config-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap !important;
  }
  .config-tab-btn {
    white-space: nowrap;
    flex-shrink: 0;
  }
}

.form-hint {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 4px;
}

.form-check {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: white;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s;
}

.form-check:hover { border-color: var(--brand); }

.form-check input { width: 18px; height: 18px; accent-color: var(--brand); }

.form-check .label {
  font-weight: 600;
  font-size: 0.9rem;
}

.form-check .help {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 2px;
}

input[type="color"] {
  width: 100%;
  height: 50px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  cursor: pointer;
  padding: 4px;
}

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-error { background: var(--error-soft); color: var(--error); }
.badge-brand { background: var(--brand-soft); color: var(--brand-deep); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-muted { background: var(--cream-2); color: var(--muted); }

/* ---------- Tables ---------- */
.table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--line);
}

.table th {
  background: var(--cream);
  text-align: left;
  padding: 14px 16px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
  color: var(--muted);
}

.table td {
  padding: 14px 16px;
  border-top: 1px solid var(--line);
  font-size: 0.92rem;
  color: var(--ink-soft);
}

.table tbody tr:hover { background: var(--cream); }

.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-lg);
}

/* ---------- Alerts (flash messages) ---------- */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  font-size: 0.92rem;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.alert-success { background: var(--success-soft); color: var(--success); border: 1px solid rgba(61, 90, 65, 0.2); }
.alert-error { background: var(--error-soft); color: var(--error); border: 1px solid rgba(230, 57, 70, 0.2); }
.alert-info { background: var(--info-soft); color: var(--info); border: 1px solid rgba(91, 124, 153, 0.2); }

/* ---------- Avatar ---------- */
.avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--brand-deep));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  flex-shrink: 0;
  object-fit: cover;
}

.avatar-sm { width: 32px; height: 32px; font-size: 0.8rem; }
.avatar-lg { width: 80px; height: 80px; font-size: 1.6rem; }
.avatar-xl { width: 120px; height: 120px; font-size: 2.2rem; }

/* ---------- Tabs ---------- */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
  overflow-x: auto;
}

.tabs a {
  padding: 12px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}

.tabs a.active {
  color: var(--brand);
  border-color: var(--brand);
}

.tabs a:hover { color: var(--ink); }

/* ---------- Leave type tile ---------- */
.leave-tile {
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  overflow: hidden;
}

.leave-tile .icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  color: white;
}

.leave-tile .name {
  font-weight: 700;
  font-size: 0.95rem;
}

.leave-tile .balance {
  font-family: var(--serif);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
}

.leave-tile .balance small {
  font-size: 0.85rem;
  font-family: var(--sans);
  font-weight: 500;
  color: var(--muted);
}

.leave-tile .bar {
  height: 6px;
  background: var(--cream-2);
  border-radius: 3px;
  overflow: hidden;
}

.leave-tile .bar-fill {
  height: 100%;
  border-radius: 3px;
}

.leave-tile .meta {
  font-size: 0.78rem;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
}

/* ---------- Asset card ---------- */
.asset-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  align-items: center;
}

.asset-card .ico {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: var(--cream);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brand);
}

.asset-card .name {
  font-weight: 700;
  font-size: 1.05rem;
}

.asset-card .meta {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 4px;
}

.asset-card .serial {
  font-family: 'SF Mono', 'Menlo', monospace;
  font-size: 0.82rem;
  color: var(--ink-soft);
  margin-top: 6px;
  display: inline-block;
  padding: 2px 8px;
  background: var(--cream);
  border-radius: 4px;
}

/* ---------- Payslip row ---------- */
.payslip-row {
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.payslip-row .month {
  font-family: var(--serif);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.payslip-row .amount {
  font-family: var(--serif);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--brand);
}

/* ---------- Benefit card ---------- */
.benefit-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: 100%;
}

.benefit-card .ico {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--brand-soft);
  color: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
}

.benefit-card .title {
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 700;
}

.benefit-card .category {
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--brand);
  font-weight: 700;
}

.benefit-card .desc {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
  flex: 1;
}

/* ---------- Color picker preview ---------- */
.color-swatches {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.color-swatch {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.15s;
}

.color-swatch:hover { transform: scale(1.08); }
.color-swatch.active { border-color: var(--ink); }

/* ---------- Login / signup pages ---------- */
.auth-page {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
}

@media (max-width: 800px) {
  .auth-page { grid-template-columns: 1fr; }
  .auth-page .auth-art { display: none; }
}

.auth-form-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}

.auth-form {
  width: 100%;
  max-width: 420px;
}

.auth-form .brand-link {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--serif);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 40px;
}

.auth-art {
  background: linear-gradient(135deg, var(--ink), var(--ink-soft));
  color: var(--cream);
  padding: 60px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  position: relative;
  overflow: hidden;
}

.auth-art::before {
  content: '';
  position: absolute;
  top: -200px; right: -200px;
  width: 500px; height: 500px;
  background: radial-gradient(circle, var(--brand) 0%, transparent 70%);
  opacity: 0.3;
}

.auth-art h2 {
  font-size: 2.4rem;
  color: var(--cream);
  position: relative;
  z-index: 2;
  margin-bottom: 16px;
}

.auth-art p { color: rgba(250, 247, 242, 0.8); position: relative; z-index: 2; }

/* ---------- Helpers ---------- */
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.row-tight { display: flex; align-items: center; gap: 6px; }
.col { display: flex; flex-direction: column; gap: 12px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

.mb-sm { margin-bottom: 12px; } .mb-md { margin-bottom: 20px; } .mb-lg { margin-bottom: 32px; }
.mt-sm { margin-top: 12px; } .mt-md { margin-top: 20px; } .mt-lg { margin-top: 32px; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--muted); }
.text-small { font-size: 0.85rem; }
.text-bold { font-weight: 700; }

.divider { height: 1px; background: var(--line); margin: 24px 0; }

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}

.empty-state .ico { font-size: 3rem; margin-bottom: 12px; }

/* ---------- Public landing ---------- */
.landing-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 0;
}

.landing-hero {
  text-align: center;
  padding: 60px 0 80px;
}

.landing-hero h1 {
  font-size: clamp(2.4rem, 6vw, 4.2rem);
  margin-bottom: 24px;
}

.landing-hero p {
  font-size: 1.2rem;
  color: var(--muted);
  max-width: 600px;
  margin: 0 auto 32px;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 40px;
}

.feature-grid .card {
  text-align: left;
}

.feature-grid .ico {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--brand-soft);
  color: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}

/* ── Modal dialog (used by data-open-modal / data-close-modal, main.js) ──
   The markup + JS toggle for this already existed in a few templates
   (document upload/sign, etc.) but had no actual CSS, so it rendered as an
   unstyled inline block instead of a real overlay dialog. This is the
   missing piece — a proper centered, dimmed, responsive modal. */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal.show {
  display: flex;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(30, 26, 20, 0.45);
  backdrop-filter: blur(2px);
}
.modal-card {
  position: relative;
  background: white;
  border-radius: var(--radius-lg, 16px);
  padding: 28px;
  max-width: 560px;
  width: 100%;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  animation: modal-pop 0.15s ease-out;
}
.modal-card.modal-card-wide {
  max-width: 760px;
}
@keyframes modal-pop {
  from { transform: scale(0.97); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
@media (max-width: 600px) {
  .modal { padding: 0; }
  .modal-card { max-width: 100%; height: 100%; max-height: 100%; border-radius: 0; }
}
