/* =========================================================================
   NAC design system
   A church records office, not a SaaS dashboard: warm paper, chapel-indigo,
   brass accents used sparingly, hairline rules instead of card shadows.
   ========================================================================= */

:root {
  --paper: #F6F3EA;
  --paper-raised: #FCFAF4;
  --ink: #211D2C;
  --ink-soft: #58536A;
  --line: #E3DCC9;
  --line-strong: #CFC6AC;

  --indigo: #2E3A63;
  --indigo-deep: #1F2947;
  --brass: #B07C33;
  --brass-soft: #E4CE9D;
  --sage: #4F7355;
  --sage-bg: #E9F0E7;
  --clay: #A34B3A;
  --clay-bg: #F3E4DF;

  --serif: "Newsreader", "Iowan Old Style", Georgia, serif;
  --sans: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --radius-sm: 3px;
  --radius: 6px;
  --sidebar-w: 248px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 0.4em 0;
  letter-spacing: -0.01em;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.15rem; }

a { color: var(--indigo); text-decoration: none; }
a:hover { text-decoration: underline; }

p { margin: 0 0 1em 0; max-width: 62ch; }

button, input, select, textarea { font-family: var(--sans); font-size: 0.95rem; }

::selection { background: var(--brass-soft); }

:focus-visible {
  outline: 2px solid var(--indigo);
  outline-offset: 2px;
}

/* ---------- App shell ---------- */

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

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--indigo-deep);
  color: #E9E6DC;
  padding: 28px 20px;
  display: flex;
  flex-direction: column;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
}

.brand-mark {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.5rem;
  color: #FCFAF4;
  letter-spacing: 0.02em;
}

.brand-sub {
  font-size: 0.72rem;
  color: var(--brass-soft);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.branch-name {
  font-size: 0.85rem;
  color: #B9B4C8;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
}

.nav-group { margin-bottom: 22px; }

.nav-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: #8B85A0;
  margin-bottom: 8px;
}

.nav-link {
  display: block;
  padding: 7px 10px;
  margin: 0 -10px;
  border-radius: var(--radius-sm);
  color: #D9D5E6;
  font-size: 0.92rem;
}

.nav-link:hover {
  background: rgba(255,255,255,0.06);
  text-decoration: none;
}

.nav-link.active {
  background: rgba(255,255,255,0.09);
  color: #FCFAF4;
  box-shadow: inset 3px 0 0 var(--brass);
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,0.12);
  font-size: 0.85rem;
}

.sidebar-footer .user-name { color: #FCFAF4; }
.sidebar-footer a { color: #B9B4C8; }

/* ---------- Main ---------- */

.main {
  flex: 1;
  min-width: 0;
  padding: 36px 44px 60px;
  max-width: 1100px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  color: var(--ink-soft);
  font-size: 0.85rem;
}

/* ---------- Stats ---------- */

.stat-row {
  display: flex;
  gap: 0;
  margin-bottom: 40px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.stat {
  flex: 1;
  padding: 18px 24px;
  border-right: 1px solid var(--line);
}

.stat:last-child { border-right: none; }

.stat-value {
  font-family: var(--serif);
  font-size: 2.1rem;
  font-weight: 600;
  color: var(--indigo);
  line-height: 1;
  margin-bottom: 6px;
}

.stat-label {
  font-size: 0.82rem;
  color: var(--ink-soft);
}

/* ---------- Lists / tables ---------- */

.record-list { border-top: 1px solid var(--line); }

.record-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}

.record-row:hover { background: var(--paper-raised); }

.record-main { flex: 1; min-width: 0; }
.record-title { font-weight: 600; }
.record-meta { color: var(--ink-soft); font-size: 0.85rem; }

table.data-table {
  width: 100%;
  border-collapse: collapse;
  border-top: 1px solid var(--line);
}

.data-table th {
  text-align: left;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.78rem;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line-strong);
}

.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.data-table tr:hover td { background: var(--paper-raised); }

/* ---------- Badges ---------- */

.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
}

.badge-member { background: var(--sage-bg); color: var(--sage); }
.badge-visitor { background: var(--brass-soft); color: #7A5620; }
.badge-worker { background: #E3E7F3; color: var(--indigo); }
.badge-inactive, .badge-transferred { background: var(--clay-bg); color: var(--clay); }

/* ---------- Forms ---------- */

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px 24px;
  max-width: 720px;
}

.form-grid .span-2 { grid-column: 1 / -1; }

.field { display: flex; flex-direction: column; gap: 6px; }

.field label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.field input[type=text],
.field input[type=email],
.field input[type=date],
.field input[type=tel],
.field input[type=password],
.field select,
.field textarea {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  background: var(--paper-raised);
  color: var(--ink);
}

.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--indigo);
}

.field-checkbox { flex-direction: row; align-items: center; gap: 8px; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
}

.btn-primary { background: var(--indigo); color: #FCFAF4; }
.btn-primary:hover { background: var(--indigo-deep); text-decoration: none; }

.btn-ghost { background: transparent; border-color: var(--line-strong); color: var(--ink); }
.btn-ghost:hover { background: var(--paper-raised); text-decoration: none; }

.btn-row { display: flex; gap: 10px; margin-top: 24px; }

/* ---------- Auth ---------- */

.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--indigo-deep);
  padding: 20px;
}

.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--paper);
  padding: 40px 36px;
  border-radius: var(--radius);
}

.auth-brand { text-align: center; margin-bottom: 28px; }
.auth-brand .brand-mark { color: var(--indigo); font-size: 1.8rem; }
.auth-brand .brand-sub { color: var(--brass); }

/* ---------- Messages ---------- */

.messages { list-style: none; margin: 0 0 20px 0; padding: 0; }
.messages li {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  font-size: 0.9rem;
  background: var(--sage-bg);
  color: var(--sage);
}
.messages li.error { background: var(--clay-bg); color: var(--clay); }

/* ---------- Empty state ---------- */

.empty-state {
  padding: 40px 0;
  color: var(--ink-soft);
  border-top: 1px solid var(--line);
}

.empty-state strong { color: var(--ink); }

@media (max-width: 860px) {
  .app-shell { flex-direction: column; }
  .sidebar { width: 100%; }
  .main { padding: 24px; }
  .form-grid { grid-template-columns: 1fr; }
}
