/* ───────────────────────────────────────────────────────────────
   Caldwell County Admin Portal — unified design system.
   Used by every page under /admin/. Layered on top of site.css for
   public-side overlaps, but specific enough to shape the admin look.
   ─────────────────────────────────────────────────────────────── */

:root {
  /* Brand */
  --cc-navy:        #102a43;
  --cc-navy-dark:   #0a1c2e;
  --cc-navy-light:  #1c4587;
  --cc-gold:        #c19b30;
  --cc-gold-light:  #e6c97a;
  --cc-gold-soft:   #fbeec0;

  /* Surfaces */
  --bg:             #f1f4f8;
  --surface:        #ffffff;
  --surface-alt:    #f8fafc;
  --surface-hover:  #f4f7fa;
  --border:         #e0e6ed;
  --border-strong:  #c8d2dd;

  /* Text */
  --text:           #1f2733;
  --text-secondary: #4a5567;
  --text-muted:     #6a7588;
  --text-faint:     #a0aec0;

  /* Status */
  --good:           #1e7a3a;
  --good-bg:        #d9efdf;
  --warn:           #b15c00;
  --warn-bg:        #fbeec0;
  --bad:            #b23021;
  --bad-bg:         #f6d5d0;
  --info:           #1c4587;
  --info-bg:        #e8f0fa;

  /* Layout */
  --sidebar-w:      256px;
  --topbar-h:       60px;
  --radius:         6px;
  --radius-lg:      8px;
  --radius-xl:      12px;
  --shadow-xs:      0 1px 2px rgba(15, 30, 55, 0.05);
  --shadow-sm:      0 1px 3px rgba(15, 30, 55, 0.08), 0 1px 2px rgba(15, 30, 55, 0.04);
  --shadow-md:      0 4px 12px rgba(15, 30, 55, 0.08);
  --shadow-lg:      0 8px 32px rgba(15, 30, 55, 0.12);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--cc-navy-light); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─── Layout: sidebar + main ───────────────────────────────────────── */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--cc-navy) 0%, var(--cc-navy-dark) 100%);
  color: rgba(255, 255, 255, 0.92);
  display: flex;
  flex-direction: column;
  z-index: 50;
  border-right: 1px solid rgba(0, 0, 0, 0.15);
}
.sidebar-brand {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 18px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.sidebar-brand .seal {
  width: 40px; height: 40px;
  background: var(--cc-gold);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--cc-navy-dark);
  font-weight: 800; font-size: 14px;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}
.sidebar-brand .text {
  font-size: 13px; line-height: 1.25;
}
.sidebar-brand .text strong {
  display: block; color: #fff; font-weight: 600;
}
.sidebar-brand .text span {
  color: rgba(255,255,255,0.55); font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.6px;
}

.sidebar-user {
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.sidebar-user .avatar {
  width: 32px; height: 32px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 600; color: #fff; font-size: 12px;
  margin-right: 10px;
  vertical-align: middle;
}
.sidebar-user .info { display: inline-block; vertical-align: middle; max-width: calc(100% - 50px); }
.sidebar-user .info strong { display: block; color: #fff; font-size: 13px; font-weight: 600; }
.sidebar-user .info .role { display: inline-block; font-size: 10px; color: var(--cc-gold-light); text-transform: uppercase; letter-spacing: 0.5px; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 8px 0; }
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 4px; }

.nav-group-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.8px;
  color: rgba(255, 255, 255, 0.4); padding: 12px 18px 4px; font-weight: 700;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 18px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 13.5px; font-weight: 500;
  cursor: pointer; user-select: none;
  border-left: 3px solid transparent;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  text-decoration: none;
}
.nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  text-decoration: none;
}
.nav-item.active {
  background: rgba(193, 155, 48, 0.12);
  color: #fff;
  border-left-color: var(--cc-gold);
}
.nav-item .icon { font-size: 16px; line-height: 1; opacity: 0.9; flex-shrink: 0; }
.nav-item .badge-pill {
  margin-left: auto;
  font-size: 10px; font-weight: 700;
  background: var(--cc-gold); color: var(--cc-navy-dark);
  padding: 2px 6px; border-radius: 999px;
}
.nav-item .ext-icon { margin-left: auto; opacity: 0.5; font-size: 11px; }

.sidebar-footer {
  padding: 10px 12px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.sidebar-footer .nav-item { padding: 6px 14px; font-size: 12.5px; }

/* ─── Topbar + content ─────────────────────────────────────────────── */
.main { margin-left: var(--sidebar-w); flex: 1; min-width: 0; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px;
}
.topbar .breadcrumb { font-size: 13px; color: var(--text-muted); }
.topbar .breadcrumb a { color: var(--text-muted); }
.topbar .breadcrumb a:hover { color: var(--cc-navy); text-decoration: none; }
.topbar .breadcrumb .sep { margin: 0 6px; color: var(--text-faint); }
.topbar .breadcrumb .current { color: var(--text); font-weight: 600; }

.topbar-right { display: flex; align-items: center; gap: 10px; }

.content {
  padding: 28px;
  max-width: 1400px;
}
@media (max-width: 900px) {
  .content { padding: 18px; }
  .sidebar { transform: translateX(-100%); transition: transform 0.2s; }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
}

/* ─── Page header ──────────────────────────────────────────────────── */
.page-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 22px; gap: 16px; flex-wrap: wrap;
}
.page-header h1 {
  margin: 0 0 4px;
  font-size: 22px; font-weight: 700; color: var(--cc-navy);
  letter-spacing: -0.2px;
}
.page-header .lede { color: var(--text-muted); font-size: 14px; margin: 0; }
.page-header .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ─── Cards ────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  padding: 20px 22px;
  margin-bottom: 18px;
}
.card.flush { padding: 0; overflow: hidden; }
.card h2 { margin: 0 0 6px; font-size: 16px; color: var(--cc-navy); font-weight: 600; }
.card h3 { margin: 0 0 8px; font-size: 14px; color: var(--cc-navy); font-weight: 600; }
.card .card-head {
  padding: 14px 20px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.card .card-head h2 { margin: 0; font-size: 15px; }
.card .card-head .small { font-size: 12px; color: var(--text-muted); }
.card .card-body { padding: 16px 20px; }

/* ─── Stats grid ───────────────────────────────────────────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-xs);
  position: relative;
  overflow: hidden;
}
.stat::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--cc-gold);
}
.stat .label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.6px;
  color: var(--text-muted); font-weight: 600;
}
.stat .value {
  font-size: 28px; font-weight: 700; color: var(--cc-navy);
  line-height: 1.1; margin: 4px 0 2px;
  font-variant-numeric: tabular-nums;
}
.stat .trend {
  font-size: 12px; color: var(--text-muted);
}
.stat .trend.up { color: var(--good); }
.stat .trend.down { color: var(--bad); }
.stat.alert::before { background: var(--bad); }
.stat.warn::before { background: var(--warn); }
.stat.info::before { background: var(--info); }

/* ─── Buttons ──────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: var(--radius);
  font: inherit; font-size: 13px; font-weight: 600;
  background: var(--cc-navy); color: #fff;
  border: 1px solid var(--cc-navy);
  cursor: pointer; user-select: none; text-decoration: none;
  transition: background 0.12s, border-color 0.12s, transform 0.05s;
}
.btn:hover { background: var(--cc-navy-dark); border-color: var(--cc-navy-dark); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn.secondary { background: var(--surface); color: var(--cc-navy); border-color: var(--border-strong); }
.btn.secondary:hover { background: var(--surface-hover); color: var(--cc-navy-dark); }
.btn.gold { background: var(--cc-gold); color: #fff; border-color: var(--cc-gold); }
.btn.gold:hover { background: #a78122; border-color: #a78122; }
.btn.danger { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn.danger:hover { background: #952818; }
.btn.ghost { background: transparent; color: var(--text-muted); border-color: transparent; }
.btn.ghost:hover { background: var(--surface-hover); color: var(--text); }
.btn.sm { padding: 4px 10px; font-size: 12px; }
.btn.lg { padding: 10px 20px; font-size: 14px; }
.btn .icon { font-size: 14px; }

.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; }
.btn-group .btn:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.btn-group .btn:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.btn-group .btn + .btn { border-left-width: 0; }

/* ─── Form controls ────────────────────────────────────────────────── */
label {
  display: block; font-size: 12px; font-weight: 600; color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: 0.5px;
  margin: 14px 0 5px;
}
input[type=text], input[type=email], input[type=password], input[type=date],
input[type=time], input[type=number], input[type=datetime-local], input[type=url],
input[type=search], textarea, select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font: inherit; font-size: 14px;
  background: var(--surface); color: var(--text);
  transition: border-color 0.12s, box-shadow 0.12s;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--cc-navy-light);
  box-shadow: 0 0 0 3px rgba(28, 69, 135, 0.12);
}
textarea { min-height: 80px; resize: vertical; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 0; }
.field-help { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ─── Badges ───────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px;
  padding: 2px 8px; border-radius: 999px;
  background: var(--info-bg); color: var(--info);
  white-space: nowrap;
}
.badge.green   { background: var(--good-bg); color: var(--good); }
.badge.gold    { background: var(--warn-bg); color: var(--warn); }
.badge.red     { background: var(--bad-bg);  color: var(--bad); }
.badge.gray    { background: #e2e6ec;        color: var(--text-muted); }
.badge.navy    { background: var(--info-bg); color: var(--cc-navy); }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; vertical-align: middle; margin-right: 6px; }
.dot.live { background: var(--bad); box-shadow: 0 0 0 0 rgba(178, 48, 33, 0.7); animation: pulse 2s infinite; }
@keyframes pulse { 0%{box-shadow:0 0 0 0 rgba(178,48,33,.7);} 70%{box-shadow:0 0 0 8px rgba(178,48,33,0);} 100%{box-shadow:0 0 0 0 rgba(178,48,33,0);} }

/* ─── Tables ───────────────────────────────────────────────────────── */
table.data {
  width: 100%; border-collapse: separate; border-spacing: 0;
  background: var(--surface);
}
table.data th, table.data td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 14px; vertical-align: middle;
}
table.data th {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.6px;
  color: var(--text-muted); background: var(--surface-alt); font-weight: 700;
}
table.data tr:hover td { background: var(--surface-hover); }
table.data tr:last-child td { border-bottom: 0; }

/* ─── Avatars ──────────────────────────────────────────────────────── */
.avatar-sm {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--cc-navy); color: #fff;
  font-weight: 600; font-size: 12px; flex-shrink: 0;
}
.avatar-md { width: 40px; height: 40px; font-size: 14px; }
.avatar-lg { width: 56px; height: 56px; font-size: 18px; }
.avatar-sm.gold { background: var(--cc-gold); }
.avatar-sm.green { background: var(--good); }
.avatar-sm.red { background: var(--bad); }

/* ─── Meeting list rows ───────────────────────────────────────────── */
.meeting-row {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  transition: background 0.12s;
  text-decoration: none;
  color: inherit;
}
.meeting-row:hover { background: var(--surface-hover); text-decoration: none; }
.meeting-row:last-child { border-bottom: 0; }
.meeting-row .date-block {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
  padding: 6px 12px;
  min-width: 64px;
}
.meeting-row .date-block .month { font-size: 10px; color: var(--cc-navy); font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px; }
.meeting-row .date-block .day { font-size: 22px; font-weight: 700; color: var(--cc-navy); line-height: 1; }
.meeting-row .date-block .year { font-size: 10px; color: var(--text-muted); }
.meeting-row .info { flex: 1; min-width: 0; }
.meeting-row .info .title { font-weight: 600; color: var(--cc-navy); font-size: 15px; }
.meeting-row .info .meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.meeting-row .actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ─── Dialogs ──────────────────────────────────────────────────────── */
dialog {
  border: 0;
  border-radius: var(--radius-xl);
  padding: 0;
  min-width: 440px;
  max-width: 90vw;
  max-height: 92vh;
  box-shadow: var(--shadow-lg);
  background: var(--surface);
  color: var(--text);
}
dialog::backdrop { background: rgba(15, 30, 55, 0.42); backdrop-filter: blur(2px); }
dialog .dlg-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 22px; border-bottom: 1px solid var(--border);
}
dialog .dlg-head h3 { margin: 0; font-size: 16px; color: var(--cc-navy); }
dialog .dlg-body { padding: 18px 22px; max-height: 70vh; overflow-y: auto; }
dialog .dlg-actions {
  padding: 14px 22px; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 8px; align-items: center;
}
dialog .dlg-actions .left { margin-right: auto; }
dialog .close-x {
  background: none; border: 0; font-size: 22px; line-height: 1;
  color: var(--text-muted); cursor: pointer; padding: 4px 8px;
}
dialog .close-x:hover { color: var(--text); }

/* ─── Toasts ───────────────────────────────────────────────────────── */
.toast {
  position: fixed; right: 16px; bottom: 16px;
  background: var(--cc-navy); color: #fff;
  padding: 10px 18px; border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: 13px; opacity: 0; pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  transform: translateY(10px);
  max-width: 360px;
  z-index: 9000;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: var(--bad); }
.toast.success { background: var(--good); }

/* ─── Utility ──────────────────────────────────────────────────────── */
.muted { color: var(--text-muted); }
.small { font-size: 12px; }
.tiny  { font-size: 11px; }
.right { text-align: right; }
.hidden { display: none !important; }
.flex { display: flex; }
.flex.gap-4 { gap: 4px; } .flex.gap-8 { gap: 8px; } .flex.gap-12 { gap: 12px; }
.items-center { align-items: center; }
.between { justify-content: space-between; }
.w-full { width: 100%; }
.mt-0 { margin-top: 0; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-0 { margin-bottom: 0; }
.mb-16 { margin-bottom: 16px; }

/* Empty states */
.empty-state {
  text-align: center; padding: 36px 20px;
  color: var(--text-muted);
}
.empty-state .icon { font-size: 36px; opacity: 0.5; margin-bottom: 10px; }
.empty-state h3 { color: var(--text-secondary); margin: 0 0 4px; font-size: 15px; }
.empty-state p { margin: 0 0 14px; font-size: 13px; }
