/* ═══════════════════════════════════════════════════════════════════════
   THE PUBLIC TRUST ACT — Shared UI Components
   Used by: admin dashboard + future ops/admin/contact pages.
   Tokens live in styles.css (load that first).
   Marketing site uses v3.css; this file is component-level only.
   ═══════════════════════════════════════════════════════════════════════ */

/* ─── Buttons ──────────────────────────────────────────────────────────
   Base .btn with modifier classes. All buttons inherit consistent height,
   focus ring, and disabled state. Composition: <button class="btn btn-dark">
   ─────────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  line-height: 1;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  user-select: none;
}
.btn:focus-visible {
  outline: 2px solid var(--civic-navy-bright);
  outline-offset: 2px;
}
.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: wait;
}
.btn-sm   { padding: 7px 12px; font-size: 11px; letter-spacing: 0.12em; }
.btn-lg   { padding: 14px 28px; font-size: 13px; }

.btn-primary {
  background: var(--action);
  color: var(--bone);
  border-color: var(--action);
}
.btn-primary:hover:not(:disabled) { background: var(--action-deep); border-color: var(--action-deep); }

.btn-dark {
  background: var(--ink);
  color: var(--bone);
  border-color: var(--ink);
}
.btn-dark:hover:not(:disabled) { background: var(--civic-navy-deep); border-color: var(--civic-navy-deep); }

.btn-navy {
  background: var(--civic-navy);
  color: var(--bone);
  border-color: var(--civic-navy);
}
.btn-navy:hover:not(:disabled) { background: var(--civic-navy-bright); border-color: var(--civic-navy-bright); }

.btn-brass {
  background: var(--brass-bright);
  color: var(--ink);
  border-color: var(--brass-bright);
}
.btn-brass:hover:not(:disabled) { background: var(--brass); border-color: var(--brass); }

.btn-ghost {
  background: var(--bone);
  color: var(--ink);
  border-color: var(--rule);
}
.btn-ghost:hover:not(:disabled) { background: var(--paper-2); }

.btn-ghost-dark {
  background: transparent;
  color: var(--bone);
  border-color: rgba(250, 244, 230, 0.4);
}
.btn-ghost-dark:hover:not(:disabled) { background: rgba(250, 244, 230, 0.08); border-color: rgba(250, 244, 230, 0.7); }

.btn-danger {
  background: transparent;
  color: var(--action-deep);
  border-color: rgba(200, 16, 46, 0.35);
}
.btn-danger:hover:not(:disabled) { background: rgba(200, 16, 46, 0.08); border-color: var(--action-deep); }

/* ─── Form inputs ──────────────────────────────────────────────────────
   Used in admin search, manage-admins form, and any future contact forms.
   Compose: <label class="field-label"> + <input class="field-input">
   ─────────────────────────────────────────────────────────────────────── */
.field-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--brass-deep);
  margin-bottom: 8px;
}

.field-input,
.field-search {
  display: block;
  width: 100%;
  padding: 11px 14px;
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--ink);
  background: var(--bone);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field-input:focus,
.field-search:focus {
  outline: none;
  border-color: var(--civic-navy);
  box-shadow: 0 0 0 3px rgba(0, 40, 104, 0.12);
}
.field-input::placeholder,
.field-search::placeholder { color: var(--muted); }

.field-error {
  margin-top: 12px;
  padding: 12px 14px;
  background: rgba(200, 16, 46, 0.08);
  border: 1px solid rgba(200, 16, 46, 0.3);
  border-radius: var(--radius-sm);
  color: var(--action-deep);
  font-size: 14px;
  line-height: 1.5;
}

/* ─── Cards ────────────────────────────────────────────────────────────
   Generic surface containers. Use as <article class="card card-light">.
   ─────────────────────────────────────────────────────────────────────── */
.card {
  border-radius: var(--radius-md);
  border: 1px solid var(--rule);
  background: var(--bone);
  padding: 28px;
}
.card-paper { background: var(--paper); }
.card-bone  { background: var(--bone); }
.card-dark {
  background: var(--ink);
  color: var(--bone);
  border-color: var(--ink-3);
}
.card-elevated { box-shadow: var(--shadow-md); }
.card-flat     { box-shadow: none; }

/* ─── Status pills ─────────────────────────────────────────────────────
   <span class="pill pill-new">new</span>
   ─────────────────────────────────────────────────────────────────────── */
.pill {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: var(--radius-sm);
  border: 1px solid currentColor;
  line-height: 1.4;
}
.pill-new          { color: var(--status-new);    background: rgba(0, 40, 104, 0.08); }
.pill-needs_review { color: var(--status-review); background: rgba(115, 84, 32, 0.10); }
.pill-responded    { color: var(--status-done);   background: rgba(62, 122, 74, 0.08); }
.pill-neutral      { color: var(--muted-deep);    background: var(--bone); border-color: var(--rule); }

/* ─── Tabs ─────────────────────────────────────────────────────────────
   <button class="tab"> / <button class="tab is-active">
   ─────────────────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.tab {
  background: transparent;
  border: 1px solid var(--rule);
  color: var(--muted-deep);
  padding: 8px 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.tab:hover { background: var(--bone); color: var(--ink); }
.tab.is-active {
  background: var(--ink);
  color: var(--bone);
  border-color: var(--ink);
}
.tab .tab-count {
  margin-left: 6px;
  opacity: 0.6;
  font-weight: 600;
}
.tab.is-active .tab-count { opacity: 0.9; }

/* ─── Data table ───────────────────────────────────────────────────────
   <table class="data-table"> with <thead> and clickable rows.
   ─────────────────────────────────────────────────────────────────────── */
.data-table-wrap {
  background: var(--bone);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  /* Horizontal scroll on narrow screens instead of clipping columns.
     A 6-column table can't fit a phone — scroll keeps every column
     reachable (standard responsive-table pattern). overflow-y stays
     hidden so the border-radius still clips top/bottom cleanly. */
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}
.data-table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
  font-size: 14px;
}
.data-table thead th {
  background: var(--paper-2);
  text-align: left;
  padding: 12px 16px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted-deep);
  border-bottom: 1px solid var(--rule);
  font-weight: 500;
}
.data-table tbody tr {
  border-bottom: 1px solid var(--rule);
  transition: background-color 0.1s ease;
}
.data-table tbody tr:last-child { border-bottom: none; }
.data-table.is-clickable tbody tr { cursor: pointer; }
.data-table.is-clickable tbody tr:hover { background: rgba(176, 136, 56, 0.05); }
.data-table td {
  /* Fixed row height + vertical centering so every row is identical regardless
     of cell contents (a status pill vs. the taller per-row action button) —
     keeps the Pledges and Contacts tables visually consistent. */
  height: 52px;
  padding: 0 16px;
  vertical-align: middle;
  color: var(--ink);
}
.data-table td.col-mono { font-family: var(--font-mono); font-size: 13px; color: var(--muted-deep); }
.data-table td.col-muted { color: var(--muted); font-size: 13px; }
.data-table td.col-strong { font-weight: 500; color: var(--ink); }

.data-table-empty {
  padding: 80px 24px;
  text-align: center;
  color: var(--muted-deep);
}
.data-table-empty h3 {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  font-size: 22px;
  color: var(--ink);
  margin: 0 0 8px;
}

/* ─── Modal ────────────────────────────────────────────────────────────
   <div class="modal-backdrop is-open">
     <div class="modal" role="dialog">...</div>
   </div>
   ─────────────────────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 20, 40, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
}
.modal-backdrop.is-open { display: flex; }
.modal {
  background: var(--paper);
  border-radius: var(--radius-md);
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 36px;
  box-shadow: var(--shadow-lg);
}
.modal-wide { max-width: 720px; }
.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
}
.modal-title {
  font-family: var(--font-display);
  font-variation-settings: "SOFT" 60, "opsz" 96;
  font-weight: 500;
  font-size: 24px;
  margin: 0;
  color: var(--ink);
  line-height: 1.2;
}
.modal-close {
  background: transparent;
  border: 1px solid var(--rule);
  color: var(--muted-deep);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.modal-close:hover { background: var(--bone); color: var(--ink); }
.modal-fields {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 10px 16px;
  margin-bottom: 28px;
  font-size: 14px;
}
.modal-fields dt {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brass-deep);
  align-self: center;
}
.modal-fields dd {
  margin: 0;
  color: var(--ink);
  word-break: break-word;
}
.modal-actions {
  border-top: 1px solid var(--rule);
  padding-top: 22px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
@media (max-width: 600px) {
  .modal-fields { grid-template-columns: 1fr; }
  .modal-fields dt { margin-top: 10px; }
  .modal { padding: 28px 20px; }
}

/* ─── Toast (transient feedback) ───────────────────────────────────────
   <div class="toast" id="toast"> -> add .is-shown when displaying
   ─────────────────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 14px 22px;
  background: var(--ink);
  color: var(--bone);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  z-index: 200;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
  max-width: 360px;
  box-shadow: var(--shadow-md);
}
.toast.is-shown {
  opacity: 1;
  transform: translateY(0);
}
.toast.is-error { background: var(--action-deep); }
.toast.is-success { background: var(--status-done); }

/* ─── Surface (page) chrome ────────────────────────────────────────────
   App chrome — used by admin dashboard and other internal tools.
   ─────────────────────────────────────────────────────────────────────── */
.app-topbar {
  background: var(--ink);
  color: var(--bone);
  padding: 18px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(212, 169, 67, 0.3);
  gap: 16px;
  flex-wrap: wrap;
}
.app-topbar-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 18px;
  color: var(--bone);
  text-decoration: none;
}
.app-topbar-brand em { color: var(--brass-bright); font-style: italic; }
.app-tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--brass-bright);
  padding: 3px 8px;
  border: 1px solid rgba(212, 169, 67, 0.45);
  border-radius: var(--radius-sm);
  font-style: normal;
}
.app-topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 13px;
}
.app-topbar-user { color: rgba(250, 244, 230, 0.78); }
.app-topbar-user strong { color: var(--bone); font-weight: 500; }

.app-shell { padding: 32px 28px; max-width: 1400px; margin: 0 auto; }
.app-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 24px;
  margin-bottom: 32px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--rule);
}
.app-title {
  font-family: var(--font-display);
  font-variation-settings: "SOFT" 60, "opsz" 96;
  font-weight: 500;
  font-size: 36px;
  margin: 0 0 6px;
  color: var(--ink);
  line-height: 1.1;
}
.app-subtitle {
  color: var(--muted-deep);
  font-size: 15px;
  margin: 0;
}
.app-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.app-toolbar > .field-search { flex: 1; min-width: 220px; }

/* ─── Stat counter card ────────────────────────────────────────────────
   Small number + label, used in dashboard headers.
   ─────────────────────────────────────────────────────────────────────── */
.stat-card {
  background: var(--bone);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  padding: 14px 22px;
  display: flex;
  align-items: baseline;
  gap: 14px;
}
.stat-num {
  font-family: var(--font-display);
  font-variation-settings: "SOFT" 30, "opsz" 144;
  font-weight: 500;
  font-size: 36px;
  line-height: 1;
  color: var(--action);
}
.stat-num.is-navy  { color: var(--civic-navy); }
.stat-num.is-brass { color: var(--brass-deep); }
.stat-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--brass-deep);
}

/* ─── Utility classes ──────────────────────────────────────────────────
   Small atoms used across many pages.
   ─────────────────────────────────────────────────────────────────────── */
.u-mono { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.04em; }
.u-visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
.u-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--brass-deep);
}

/* ─── Centered auth card (sign-in / access-denied screens) ─────────────
   <div class="center-wrap"><div class="auth-card">...</div></div>
   ─────────────────────────────────────────────────────────────────────── */
.center-wrap {
  min-height: calc(100vh - 70px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}
.auth-card {
  background: var(--bone);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  padding: 56px 48px;
  max-width: 440px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-md);
}
.auth-card h1 {
  font-family: var(--font-display);
  font-variation-settings: "SOFT" 60, "opsz" 96;
  font-weight: 500;
  font-size: 30px;
  margin: 0 0 12px;
  color: var(--ink);
  line-height: 1.2;
}
.auth-card h1 em {
  font-style: italic;
  color: var(--brass-deep);
  font-variation-settings: "SOFT" 100;
}
.auth-card p {
  color: var(--muted-deep);
  margin: 0 0 32px;
  font-size: 15px;
  line-height: 1.55;
}
