/* City Alerts admin — House A restrained, cmp palette */
:root {
  --c-primary: #000DA0;
  --c-ink: #060816;
  --c-gold: #C9A961;
  --c-gold-deep: #7F6529;
  --c-magnolia: #FAF7EE;
  --c-paper: #F5F1E6;
  --c-white: #FFFFFF;
  --c-cyan: #0693e3;
  --c-danger: #a01900;
  --f-display: "Fraunces", Georgia, serif;
  --f-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --pad: clamp(1.25rem, 5vw, 2.25rem);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
.card__title:focus, .card__title:focus-visible { outline: none; }
html { overflow-x: clip; }
body {
  margin: 0;
  font-family: var(--f-body);
  color: var(--c-ink);
  background:
    radial-gradient(1200px 400px at 80% -10%, rgba(201, 169, 97, 0.14), transparent 60%),
    var(--c-magnolia);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

::selection { background: var(--c-gold); color: var(--c-ink); }

.test-banner {
  background: #8a6d1f;
  color: #fff;
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  text-align: center;
  padding: 0.55rem var(--pad);
}

/* Topbar */
.topbar { background: var(--c-ink); color: var(--c-white); }
.topbar__in {
  width: 100%; max-width: 72rem; margin-inline: auto;
  padding: 1rem var(--pad);
  display: flex; flex-wrap: wrap; gap: 0.9rem 1.5rem;
  align-items: center; justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 0.8rem; }
.brand__mark {
  width: 12px; height: 44px; border-radius: 2px;
  background: linear-gradient(180deg, var(--c-gold), var(--c-gold-deep));
}
.brand__kicker {
  margin: 0; font-size: 0.68rem; font-weight: 600;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--c-gold);
}
.brand__title {
  margin: 0; font-family: var(--f-display); font-weight: 650;
  font-size: clamp(1.25rem, 3vw, 1.6rem); letter-spacing: -0.02em; line-height: 1.05;
  text-wrap: balance;
}
.nav { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.nav__btn {
  appearance: none; border: 1px solid rgba(255, 255, 255, 0.14);
  background: transparent; color: var(--c-white);
  font: 600 0.82rem var(--f-body); letter-spacing: 0.02em;
  padding: 0.5rem 0.9rem; border-radius: 999px; cursor: pointer;
  transition: background 0.25s var(--ease), color 0.25s var(--ease), transform 0.25s var(--ease);
}
.nav__btn:hover { background: rgba(255, 255, 255, 0.1); transform: translateY(-1px); }
.nav__btn.is-active { background: var(--c-gold); border-color: var(--c-gold); color: var(--c-ink); }
.nav__btn--ghost { opacity: 0.75; }
.nav__btn:focus-visible, .btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .check-line:focus-within {
  outline: 3px solid var(--c-cyan); outline-offset: 2px;
}

/* Main / cards */
.main { flex: 1; width: 100%; max-width: 72rem; margin-inline: auto; padding: clamp(1.25rem, 4vw, 2.5rem) var(--pad) 4rem; }
.screen { animation: rise 0.5s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .screen { animation: none; }
  .nav__btn, .btn { transition: none; }
}
.card {
  background: var(--c-white);
  border: 1px solid rgba(6, 8, 22, 0.08);
  border-radius: 14px;
  box-shadow: 0 18px 40px -28px rgba(6, 8, 22, 0.35);
  padding: clamp(1.4rem, 4vw, 2.4rem);
}
.card--narrow { max-width: 26rem; margin-inline: auto; margin-top: clamp(1rem, 8vh, 4rem); }
.card__title {
  margin: 0 0 0.3rem; font-family: var(--f-display); font-weight: 650;
  font-size: clamp(1.5rem, 4vw, 2.1rem); letter-spacing: -0.02em; line-height: 1.08; text-wrap: balance;
}
.card__subtitle { margin: 2rem 0 0.8rem; font-family: var(--f-display); font-weight: 600; font-size: 1.2rem; }
.card__sub { margin: 0 0 1.6rem; color: rgba(6, 8, 22, 0.65); max-width: 55ch; }

/* Forms */
.field { margin-bottom: 1.1rem; border: 0; padding: 0; min-width: 0; }
fieldset.field legend { padding: 0; font-weight: 600; font-size: 0.85rem; margin-bottom: 0.5rem; }
.field label { display: block; font-weight: 600; font-size: 0.85rem; margin-bottom: 0.35rem; }
.hint { font-weight: 500; color: rgba(6, 8, 22, 0.5); font-size: 0.78rem; }
.field input, .field select, .field textarea {
  width: 100%; font: 400 1rem var(--f-body); color: var(--c-ink);
  background: var(--c-magnolia); border: 1px solid rgba(6, 8, 22, 0.16);
  border-radius: 8px; padding: 0.65rem 0.8rem;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
}
.field input:hover, .field select:hover, .field textarea:hover { border-color: rgba(6, 8, 22, 0.35); }
.field textarea { resize: vertical; min-height: 90px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
@media (max-width: 560px) { .field-row { grid-template-columns: 1fr; gap: 0; } }

.segmented { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.segmented label { position: relative; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; inset: 0; }
.segmented span {
  display: inline-block; padding: 0.5rem 0.95rem; border-radius: 999px;
  border: 1px solid rgba(6, 8, 22, 0.2); font-weight: 600; font-size: 0.85rem;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.segmented input:checked + span { background: var(--c-primary); border-color: var(--c-primary); color: #fff; }
.segmented input:focus-visible + span { outline: 3px solid var(--c-cyan); outline-offset: 2px; }

.ward-picker { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.7rem; }
.ward-picker label { position: relative; cursor: pointer; }
.ward-picker input { position: absolute; opacity: 0; inset: 0; }
.ward-picker span {
  display: inline-block; min-width: 2.6rem; text-align: center;
  padding: 0.45rem 0.6rem; border-radius: 8px;
  border: 1px solid rgba(6, 8, 22, 0.2); font-weight: 600; font-size: 0.85rem;
}
.ward-picker input:checked + span { background: var(--c-gold); border-color: var(--c-gold-deep); }
.ward-picker input:focus-visible + span { outline: 3px solid var(--c-cyan); outline-offset: 2px; }

.reach { margin: 0.9rem 0 0; font-size: 0.9rem; color: var(--c-gold-deep); font-weight: 600; }

.emergency-confirm {
  background: #fdf1ef; border: 1px solid rgba(160, 25, 0, 0.35);
  border-radius: 10px; padding: 0.9rem 1rem;
}
.emergency-confirm label { color: var(--c-danger); }

.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.35rem 1rem; }
.check-line, .check-grid label { display: flex; align-items: center; gap: 0.5rem; font-size: 0.9rem; font-weight: 500; cursor: pointer; }
.check-line { margin: 0.4rem 0 1.1rem; }
.check-grid input, .check-line input { width: 1.05rem; height: 1.05rem; accent-color: var(--c-primary); }

/* Buttons */
.actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 0.4rem; }
.btn {
  appearance: none; cursor: pointer; border-radius: 999px;
  font: 600 0.95rem var(--f-body); letter-spacing: 0.01em;
  padding: 0.7rem 1.5rem; border: 1px solid transparent;
  transition: transform 0.22s var(--ease), box-shadow 0.22s var(--ease), background 0.22s var(--ease);
}
.btn:active { transform: scale(0.98); }
.btn--primary {
  background: linear-gradient(120deg, var(--c-primary), #1a28c8);
  color: #fff; box-shadow: 0 10px 22px -12px rgba(0, 13, 160, 0.7);
}
.btn--primary:hover { transform: translateY(-2px); box-shadow: 0 16px 28px -12px rgba(0, 13, 160, 0.75); }
.btn--ghost { background: transparent; color: var(--c-ink); border-color: rgba(6, 8, 22, 0.25); }
.btn--ghost:hover { background: rgba(6, 8, 22, 0.05); transform: translateY(-1px); }
.btn--full { width: 100%; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; transform: none; }

.form-error { color: var(--c-danger); font-weight: 600; font-size: 0.9rem; margin: 0.9rem 0 0; }
.form-msg { font-weight: 600; font-size: 0.9rem; margin: 0.9rem 0 0; color: var(--c-gold-deep); }
.form-msg.is-error { color: var(--c-danger); }

/* History table */
.table-wrap { overflow-x: auto; margin-inline: -0.2rem; }
.table { width: 100%; border-collapse: collapse; font-size: 0.88rem; min-width: 640px; }
.table th {
  text-align: left; font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: rgba(6, 8, 22, 0.55); padding: 0.5rem 0.6rem; border-bottom: 2px solid var(--c-gold);
}
.table td { padding: 0.65rem 0.6rem; border-bottom: 1px solid rgba(6, 8, 22, 0.08); vertical-align: top; }
.table .t-title { font-weight: 600; }
.table .t-body { color: rgba(6, 8, 22, 0.6); font-size: 0.82rem; max-width: 34ch; }
.badge {
  display: inline-block; padding: 0.15rem 0.6rem; border-radius: 999px;
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
}
.badge--sent { background: #e8f2e5; color: #1e5c2f; }
.badge--sending, .badge--queued { background: #fdf6e2; color: #7F6529; }
.badge--failed { background: #fdf1ef; color: var(--c-danger); }
.badge--test { background: #e8f0fd; color: var(--c-primary); }
.badge--emergency { background: var(--c-danger); color: #fff; }
.badge--warning { background: #8a6d1f; color: #fff; }
.pager { display: flex; align-items: center; justify-content: center; gap: 1rem; margin-top: 1.2rem; }
.pager__label { font-size: 0.85rem; font-weight: 600; color: rgba(6, 8, 22, 0.6); }

/* Senders list */
.senders { display: grid; gap: 0.7rem; }
.sender-row {
  display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; align-items: center; justify-content: space-between;
  border: 1px solid rgba(6, 8, 22, 0.1); border-radius: 10px; padding: 0.85rem 1rem;
  background: var(--c-magnolia);
}
.sender-row.is-inactive { opacity: 0.55; }
.sender-row__who { min-width: 0; }
.sender-row__name { font-weight: 700; }
.sender-row__meta { font-size: 0.8rem; color: rgba(6, 8, 22, 0.6); overflow-wrap: anywhere; }
.sender-row__actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.btn--small { padding: 0.4rem 0.9rem; font-size: 0.8rem; }

/* Config */
#configValue { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 0.85rem; }

/* Footer */
.footer { padding: 1.2rem var(--pad); text-align: center; }
.footer p { margin: 0; font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: rgba(6, 8, 22, 0.4); }
