@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,600;9..144,700&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --ink: #1B2420;
  --ink-light: #2A362F;
  --paper: #F6F2E9;
  --paper-dim: #EAE3D3;
  --brass: #B98A3B;
  --brass-light: #D8AE6C;
  --line: #3C4A41;
  --line-soft: #DAD2BC;
  --good: #4C7A5A;
  --warn: #B9542F;
  --text-muted: #7A8781;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--paper);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
}

h1, h2, h3 { font-family: 'Fraunces', serif; font-weight: 600; margin: 0 0 0.4em; letter-spacing: -0.01em; }
h1 { font-size: 1.9rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }

a { color: var(--ink); }

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

.sidebar {
  width: 220px;
  background: var(--ink);
  color: var(--paper);
  padding: 28px 20px;
  flex-shrink: 0;
}

.sidebar .brand {
  font-family: 'Fraunces', serif;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--paper);
  margin-bottom: 4px;
}
.sidebar .brand-sub {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--brass-light);
  margin-bottom: 32px;
  display: block;
}

.sidebar nav a {
  display: block;
  text-decoration: none;
  color: var(--paper);
  opacity: 0.75;
  padding: 9px 10px;
  border-radius: 3px;
  margin-bottom: 2px;
  font-size: 0.92rem;
  border-left: 3px solid transparent;
}
.sidebar nav a:hover { opacity: 1; background: rgba(255,255,255,0.06); }
.sidebar nav a.active {
  opacity: 1;
  background: rgba(185,138,59,0.16);
  border-left: 3px solid var(--brass);
  font-weight: 500;
}

.main { flex: 1; padding: 32px 40px; max-width: 1180px; }

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--ink);
  padding-bottom: 14px;
}
.page-header .subtitle { color: var(--text-muted); font-size: 0.9rem; margin-top: 2px; }

.btn {
  display: inline-block;
  background: var(--ink);
  color: var(--paper);
  padding: 9px 18px;
  border-radius: 3px;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  border: none;
  cursor: pointer;
  font-family: inherit;
}
.btn:hover { background: var(--ink-light); }
.btn-brass { background: var(--brass); color: var(--ink); }
.btn-brass:hover { background: var(--brass-light); }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--line-soft); }
.btn-ghost:hover { background: var(--paper-dim); }
.btn-sm { padding: 5px 12px; font-size: 0.8rem; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 32px; }
.stat-card {
  background: white;
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  padding: 18px 20px;
}
.stat-card .label { font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 6px; }
.stat-card .value { font-family: 'Fraunces', serif; font-size: 1.7rem; font-weight: 600; }
.stat-card .value.brass { color: var(--brass); }
.stat-card .value.warn { color: var(--warn); }

.card {
  background: white;
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  padding: 22px 24px;
  margin-bottom: 24px;
}

table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 600;
  padding: 8px 10px;
  border-bottom: 2px solid var(--ink);
}
td { padding: 10px 10px; border-bottom: 1px solid var(--line-soft); font-size: 0.9rem; }
tr:last-child td { border-bottom: none; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:hover { background: var(--paper-dim); }

.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 3px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.badge-active, .badge-paid { background: rgba(76,122,90,0.15); color: var(--good); }
.badge-prospect, .badge-draft { background: rgba(122,135,129,0.15); color: var(--text-muted); }
.badge-lapsed, .badge-overdue { background: rgba(185,84,47,0.15); color: var(--warn); }
.badge-sent { background: rgba(185,138,59,0.18); color: var(--brass); }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; }
.form-group { margin-bottom: 16px; }
.form-group.full { grid-column: 1 / -1; }
label { display: block; font-size: 0.82rem; font-weight: 500; margin-bottom: 5px; color: var(--ink-light); }
input, select, textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line-soft);
  border-radius: 3px;
  font-family: inherit;
  font-size: 0.92rem;
  background: white;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brass-light); border-color: var(--brass); }

.flash { padding: 12px 18px; border-radius: 3px; margin-bottom: 20px; font-size: 0.9rem; }
.flash-success { background: rgba(76,122,90,0.12); color: var(--good); border: 1px solid rgba(76,122,90,0.3); }
.flash-error { background: rgba(185,84,47,0.12); color: var(--warn); border: 1px solid rgba(185,84,47,0.3); }

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

.alert-box {
  border-left: 3px solid var(--warn);
  background: rgba(185,84,47,0.06);
  padding: 14px 18px;
  margin-bottom: 20px;
  border-radius: 0 4px 4px 0;
}
.alert-box.brass { border-left-color: var(--brass); background: rgba(185,138,59,0.06); }
.alert-box h3 { font-size: 0.95rem; margin-bottom: 8px; }
.alert-box ul { margin: 0; padding-left: 18px; font-size: 0.88rem; }
.alert-box li { margin-bottom: 3px; }

.two-col { display: grid; grid-template-columns: 1.4fr 1fr; gap: 24px; align-items: start; }

.checkline { display: flex; align-items: center; gap: 8px; }
.checkline input { width: auto; }

@media print {
  .sidebar, .no-print { display: none !important; }
  .main { padding: 0; max-width: none; }
}
