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

:root {
  --color-bg: #f5f6fa;
  --color-surface: #ffffff;
  --color-border: #d1d5db;
  --color-text: #1f2937;
  --color-text-muted: #6b7280;
  --color-primary: #1d4ed8;
  --color-primary-hover: #1e40af;
  --color-error-bg: #fee2e2;
  --color-error-text: #b91c1c;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--color-text);
  background: var(--color-bg);
  min-height: 100vh;
}

/* ── Header ──────────────────────────────────────────────── */
.site-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 0.75rem 1.5rem;
}

.header-inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.firm-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--color-text);
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  font-size: 0.9rem;
}

.header-nav .user-name {
  color: var(--color-text-muted);
}

.header-nav a {
  color: var(--color-primary);
  text-decoration: none;
}

.header-nav a:hover { text-decoration: underline; }

/* ── Main ────────────────────────────────────────────────── */
.main-content {
  max-width: 960px;
  margin: 2rem auto;
  padding: 0 1.5rem;
}

/* ── Card ────────────────────────────────────────────────── */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem;
}

.card--centered {
  max-width: 420px;
  margin: 3rem auto;
  text-align: center;
}

.card h1 { font-size: 1.75rem; margin-bottom: 0.25rem; }
.card h2 { font-size: 1.4rem; margin-bottom: 1rem; }

/* ── Button ──────────────────────────────────────────────── */
.btn {
  display: inline-block;
  padding: 0.625rem 1.5rem;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: background 0.15s;
}

.btn--primary {
  background: var(--color-primary);
  color: #fff;
  margin-top: 1.5rem;
}

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

/* ── Alert ───────────────────────────────────────────────── */
.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.9rem;
  text-align: left;
}

.alert--error {
  background: var(--color-error-bg);
  color: var(--color-error-text);
}

.alert--warning {
  background: #fef9c3;
  color: #854d0e;
}

.alert--warning code {
  font-family: monospace;
  background: rgba(0,0,0,.06);
  padding: 1px 4px;
  border-radius: 3px;
}

/* ── Call Card ───────────────────────────────────────────── */
.call-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem;
  max-width: 640px;
  margin: 0 auto;
}

.call-card__heading {
  font-size: 1.1rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--color-text-muted);
  margin-bottom: 1.5rem;
}

.call-card__fields { margin-bottom: 1.5rem; }

.field-row {
  display: flex;
  gap: 1rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--color-border);
}

.field-row:last-child { border-bottom: none; }

.field-label {
  width: 80px;
  flex-shrink: 0;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--color-text-muted);
  padding-top: 2px;
}

.field-value { flex: 1; }

/* ── Email Edit ──────────────────────────────────────────── */
.btn-edit {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0 0.25rem;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  vertical-align: middle;
}

.btn-edit:hover { color: var(--color-primary); }

.email-corrected { font-style: italic; }

.sync-badge {
  display: inline-block;
  font-size: 0.7rem;
  background: #fef9c3;
  color: #854d0e;
  border: 1px solid #fde68a;
  border-radius: 4px;
  padding: 1px 5px;
  margin-left: 4px;
  vertical-align: middle;
  cursor: help;
}

.email-edit-form { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }

/* ── Admin Layout ────────────────────────────────────────── */
.admin-nav {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 0.75rem;
}

.admin-nav a {
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid transparent;
}

.admin-nav a:hover { color: var(--color-primary); }
.admin-nav a.active { color: var(--color-primary); border-bottom-color: var(--color-primary); }

/* ── Stat Grid ───────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.25rem 1rem;
  text-align: center;
  box-shadow: var(--shadow);
}

.stat-card__value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 0.25rem;
}

.stat-card__label {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.stat-card--warning .stat-card__value { color: #b45309; }
.stat-card--danger  .stat-card__value { color: #b91c1c; }
.stat-card--ok      .stat-card__value { color: #15803d; }

/* ── Data Table ──────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  margin-bottom: 2rem;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table th {
  text-align: left;
  padding: 0.5rem 0.75rem;
  background: var(--color-bg);
  border-bottom: 2px solid var(--color-border);
  font-weight: 600;
  white-space: nowrap;
}

.data-table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--color-border);
  vertical-align: top;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #f9fafb; }

/* ── Filter Bar ──────────────────────────────────────────── */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-end;
  margin-bottom: 1.25rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1rem;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.filter-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.filter-group select,
.filter-group input[type="date"],
.filter-group input[type="text"] {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.375rem 0.5rem;
  font-size: 0.875rem;
  font-family: inherit;
  background: var(--color-surface);
}

/* ── Status Badge ────────────────────────────────────────── */
.badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
}

.badge--pending            { background: #dbeafe; color: #1e40af; }
.badge--callback_scheduled { background: #fef9c3; color: #854d0e; }
.badge--completed          { background: #dcfce7; color: #166534; }
.badge--archived           { background: #f3f4f6; color: #6b7280; }
.badge--dnc                { background: #fee2e2; color: #991b1b; }

/* ── Section Heading ─────────────────────────────────────── */
.section-heading {
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--color-text-muted);
  margin: 1.75rem 0 0.75rem;
}

.section-heading:first-child { margin-top: 0; }

/* ── VA Stats ────────────────────────────────────────────── */
.va-stat-row td:first-child { font-weight: 600; }

/* ── Priority input ──────────────────────────────────────── */
.priority-form { display: flex; gap: 0.4rem; align-items: center; }
.priority-input {
  width: 56px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.25rem 0.4rem;
  font-size: 0.875rem;
  text-align: center;
}

/* ── Danger button ───────────────────────────────────────── */
.btn--danger {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
}
.btn--danger:hover { background: #fecaca; }

.email-input {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.25rem 0.5rem;
  font-size: 0.95rem;
  flex: 1;
  min-width: 180px;
}

/* ── Notes ───────────────────────────────────────────────── */
.notes-section { margin-bottom: 1.25rem; }

.notes-input {
  width: 100%;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
  font-size: 0.95rem;
  font-family: inherit;
  resize: vertical;
  margin-top: 0.25rem;
}

/* ── Checkboxes ──────────────────────────────────────────── */
.checkboxes {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  padding: 0.75rem 1rem;
  background: #f8fafc;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* ── Outcome Buttons ─────────────────────────────────────── */
.outcome-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.btn-outcome {
  display: block;
  width: 100%;
  padding: 0.75rem 1rem;
  border: none;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: opacity 0.15s;
}

.btn-outcome:hover { opacity: 0.85; }

.btn-outcome--spoke      { background: #dcfce7; color: #166534; }
.btn-outcome--message    { background: #dbeafe; color: #1e40af; }
.btn-outcome--voicemail  { background: #e0e7ff; color: #3730a3; }
.btn-outcome--invalid    { background: #fee2e2; color: #991b1b; }
.btn-outcome--completed  { background: #f0fdf4; color: #14532d; border: 2px solid #16a34a; }
.btn-outcome--dnc        { background: #1f2937; color: #f9fafb; }

/* ── Small button variant ────────────────────────────────── */
.btn--sm { padding: 0.3rem 0.75rem; font-size: 0.875rem; }
.btn--ghost {
  background: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-text);
}
.btn--ghost:hover { background: var(--color-bg); }

/* ── Misc ────────────────────────────────────────────────── */
.subtitle   { color: var(--color-text-muted); margin-bottom: 1.5rem; }
.hint       { color: var(--color-text-muted); font-size: 0.875rem; margin-top: 1rem; }
.notice     { color: var(--color-text-muted); font-size: 0.875rem; line-height: 1.5; margin-bottom: 1.5rem; }
.login-footer { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--color-border, #e2e2e2); color: var(--color-text-muted); font-size: 0.8125rem; }
.login-footer p { margin: 0.25rem 0; }
.next-open  { margin-top: 1rem; }
.icon-lg    { font-size: 2.5rem; margin-bottom: 1rem; }
