:root {
  --navy: #1f2937;
  --blue: #2c5282;
  --blue-dark: #234169;
  --grey: #6b7280;
  --border: #e2e8f0;
  --bg: #f7f9fb;
  --white: #ffffff;
  --green: #15803d;
  --red: #b91c1c;
  --amber: #b45309;
}

* { box-sizing: border-box; }

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

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

.topbar { background: var(--navy); color: white; }
.topbar-inner {
  max-width: 1200px; margin: 0 auto; padding: 0 24px;
  display: flex; align-items: center; gap: 32px; height: 52px;
}
.brand { color: white; font-weight: 700; font-size: 16px; }
.brand:hover { text-decoration: none; }
.topbar nav { display: flex; gap: 20px; flex: 1; }
.topbar nav a { color: #cbd5e1; font-size: 13px; }
.topbar nav a:hover { color: white; text-decoration: none; }
.topbar-user { display: flex; gap: 14px; align-items: center; font-size: 13px; color: #cbd5e1; }
.topbar-user a { color: #cbd5e1; }

.container { max-width: 1200px; margin: 0 auto; padding: 28px 24px 60px; }

h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 17px; margin: 0 0 12px; }
.subtitle { color: var(--grey); margin: 0 0 20px; font-size: 13px; }

.card {
  background: var(--white); border: 1px solid var(--border); border-radius: 8px;
  padding: 20px; margin-bottom: 20px;
}

.page-header { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 18px; flex-wrap: wrap; gap: 12px; }

.filters { display: flex; gap: 16px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.filters .status-tabs { display: flex; gap: 4px; }
.status-tabs a {
  padding: 6px 12px; border-radius: 6px; font-size: 13px; color: var(--grey);
  border: 1px solid transparent;
}
.status-tabs a.active { background: var(--blue); color: white; }
.status-tabs a:hover { text-decoration: none; border-color: var(--border); }

input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], select, textarea {
  border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; font-size: 13px;
  font-family: inherit; background: white; color: var(--navy);
}
textarea { width: 100%; resize: vertical; }
label { display: block; font-size: 12px; font-weight: 600; color: var(--grey); margin-bottom: 4px; margin-top: 12px; }

.btn {
  display: inline-block; padding: 8px 16px; border-radius: 6px; font-size: 13px; font-weight: 600;
  border: 1px solid var(--blue); background: var(--blue); color: white; cursor: pointer;
}
.btn:hover { background: var(--blue-dark); text-decoration: none; }
.btn-secondary { background: white; color: var(--navy); border-color: var(--border); }
.btn-secondary:hover { background: #f1f5f9; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; padding: 10px 12px; background: #f1f5f9; color: var(--grey); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .02em; }
td { padding: 10px 12px; border-top: 1px solid var(--border); }
tr:hover td { background: #fafbfc; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-active { background: #dcfce7; color: var(--green); }
.badge-archived { background: #f1f5f9; color: var(--grey); }
.badge-suspended { background: #fef3c7; color: var(--amber); }
.badge-pending { background: #fef3c7; color: var(--amber); }
.badge-approved { background: #dcfce7; color: var(--green); }

.pagination { display: flex; gap: 6px; margin-top: 16px; align-items: center; font-size: 13px; color: var(--grey); flex-wrap: wrap; }
.pagination a, .pagination span.current { padding: 4px 10px; border-radius: 6px; border: 1px solid var(--border); }
.pagination span.current { background: var(--blue); color: white; border-color: var(--blue); }
.pagination span.pagination-ellipsis { padding: 4px 2px; }

/* Briefly highlights whichever table row a #entry-<id> link/redirect
   lands on -- e.g. after "Use this wording" in the Technician Log --
   so it's obvious at a glance which row you were brought back to. */
tr:target { background: #eff6ff; }

.flash-stack { margin-bottom: 16px; }
.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 8px; font-size: 13px; }
.flash-success { background: #dcfce7; color: var(--green); }
.flash-error { background: #fee2e2; color: var(--red); }

.stat-row { display: flex; gap: 24px; margin-bottom: 20px; flex-wrap: wrap; }
.stat { background: white; border: 1px solid var(--border); border-radius: 8px; padding: 14px 20px; min-width: 140px; }
.stat .value { font-size: 22px; font-weight: 700; }
.stat .label { font-size: 12px; color: var(--grey); }

.login-wrap { max-width: 360px; margin: 80px auto; }
.login-wrap h1 { text-align: center; margin-bottom: 24px; }
form.stacked input { width: 100%; }

.muted { color: var(--grey); }
.text-right { text-align: right; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.form-actions { margin-top: 20px; display: flex; gap: 10px; }

.delta-up { color: var(--green); }
.delta-down { color: var(--red); }

.bar-row { display: flex; align-items: center; gap: 12px; padding: 6px 0; }
.bar-row .bar-label { width: 90px; flex-shrink: 0; font-size: 13px; }
.bar-row .bar-track { flex: 1; background: var(--bg); border-radius: 4px; height: 18px; overflow: hidden; }
.bar-row .bar-fill { background: var(--blue); height: 100%; border-radius: 4px; }
.bar-row .bar-value { width: 110px; flex-shrink: 0; text-align: right; font-size: 12px; color: var(--grey); }

/* System Health (watchdog) */
.health-banner { display: block; color: white; font-size: 13px; }
.health-banner:hover { text-decoration: none; filter: brightness(1.08); }
.health-banner-error { background: var(--red); }
.health-banner-warn { background: var(--amber); }
.health-banner-inner { display: flex; gap: 12px; align-items: center; max-width: 1200px; margin: 0 auto; padding: 9px 24px; flex-wrap: wrap; }
.health-banner-link { margin-left: auto; text-decoration: underline; }
.health-summary { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.health-good { border-left: 4px solid var(--green); }
.health-bad { border-left: 4px solid var(--red); }
.health-warn { border-left: 4px solid var(--amber); }
.health-email-error { flex-basis: 100%; color: var(--red); font-size: 13px; }
.health-row-bad td { background: #fef2f2; }
.health-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
.health-dot.ok { background: var(--green); }
.health-dot.bad { background: var(--red); }
