:root {
  --primary: #0B2545;
  --primary-hover: #1a3a6e;
  --danger: #C0392B;
  --success: #27AE60;
  --warning: #E67E22;
  --bg: #FFFFFF;
  --surface: #F8F9FA;
  --border: #D1D5DB;
  --text: #1F2937;
  --text-muted: #6B7280;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
}

/* Nav */
.nav {
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 52px;
}
.nav-title { color: #fff; text-decoration: none; font-weight: 600; font-size: 16px; }
.nav-user { display: flex; align-items: center; gap: 12px; }
.nav-email { font-size: 13px; opacity: 0.85; }

/* Main */
.main-content { max-width: 1100px; margin: 0 auto; padding: 24px 16px; }

/* Page header */
.page-header { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.page-header h1 { font-size: 22px; font-weight: 600; flex: 1; }

/* Cards */
.card { border: 1px solid var(--border); border-radius: 6px; margin-bottom: 20px; overflow: hidden; }
.card-header { background: var(--surface); padding: 10px 16px; font-weight: 600; border-bottom: 1px solid var(--border); }
.card-body { padding: 16px; }

/* Detail list */
.detail-list { display: grid; grid-template-columns: 160px 1fr; gap: 6px 12px; }
.detail-list dt { font-weight: 600; color: var(--text-muted); }

/* Table */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--border); }
.table th { background: var(--surface); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
.table tr:last-child td { border-bottom: none; }
.empty-state { color: var(--text-muted); text-align: center; padding: 20px; }

/* Buttons */
.btn {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  line-height: 1.4;
  transition: background 0.15s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-outline { background: transparent; color: var(--primary); border-color: var(--primary); }
.btn-outline:hover { background: var(--surface); }
.btn-sm { padding: 3px 9px; font-size: 12px; }
.btn-block { display: block; width: 100%; text-align: center; padding: 10px; }

/* Badges */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}
.badge-not_started { background: #E5E7EB; color: #374151; }
.badge-email_sent { background: #FEF3C7; color: #92400E; }
.badge-cleared { background: #D1FAE5; color: #065F46; }
.badge-status-open { background: #DBEAFE; color: #1E3A8A; }
.badge-status-in_progress { background: #FEF3C7; color: #92400E; }
.badge-status-cleared { background: #D1FAE5; color: #065F46; }
.badge-status-closed { background: #E5E7EB; color: #374151; }

/* Age flag */
.age-flag { color: var(--danger); font-weight: 600; }

/* Flash */
.flash { padding: 10px 16px; border-radius: 4px; margin-bottom: 12px; font-size: 13px; }
.flash-success { background: #D1FAE5; color: #065F46; border: 1px solid #6EE7B7; }
.flash-error { background: #FEE2E2; color: #991B1B; border: 1px solid #FCA5A5; }

/* Alert */
.alert { padding: 12px 16px; border-radius: 4px; margin-bottom: 16px; }
.alert-error { background: #FEE2E2; color: #991B1B; border: 1px solid #FCA5A5; }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 4px; }
.form-control {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 14px;
  font-family: inherit;
}
.form-control:focus { outline: none; border-color: var(--primary); }
.form-actions { display: flex; gap: 10px; margin-top: 20px; }

/* Contact typeahead */
.contact-suggestions {
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  max-height: 200px;
  overflow-y: auto;
}
.contact-item {
  padding: 8px 10px;
  cursor: pointer;
}
.contact-item:hover { background: var(--surface); }

/* Login */
.login-container { display: flex; justify-content: center; align-items: center; min-height: 60vh; }
.login-card { width: 360px; padding: 32px; border: 1px solid var(--border); border-radius: 8px; text-align: center; }
.login-title { font-size: 22px; font-weight: 700; color: var(--primary); margin-bottom: 8px; }
.login-subtitle { color: var(--text-muted); margin-bottom: 24px; font-size: 13px; }

/* HTMX indicator */
.htmx-indicator { display: none; color: var(--text-muted); font-size: 13px; }
.htmx-request .htmx-indicator { display: inline; }
