/* Civic red/white/blue theme -- deliberately NOT tied to party affiliation:
   party_cd/party_represented values are never color-coded (see people/
   list.html, assignments/list.html) specifically so red/blue here reads
   as "USA civic" branding, not a partisan signal. Semantic colors below
   (badges, status, danger buttons) use green/amber/red/navy the same way
   any admin UI would -- success/warning/danger -- not a red-vs-blue binary. */

:root {
  --color-navy:       #1B3A6B;
  --color-navy-dark:  #122A4D;
  --color-navy-tint:  #E4ECF7;
  --color-red:        #B22234;
  --color-red-dark:   #8C1B29;
  --color-red-tint:   #FBE4E6;
  --color-white:      #FFFFFF;
  --color-offwhite:   #F7F8FA;
  --color-gray-100:   #EEF1F5;
  --color-gray-300:   #D7DEE7;
  --color-gray-600:   #55606E;
  --color-text:       #1E2430;
  --color-green:      #1F7A46;
  --color-green-tint: #E1F3E8;
  --color-amber:      #A6720C;
  --color-amber-tint: #FCEFD9;
  --radius: 6px;
}

* { box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  margin: 0;
  padding: 0 0 2em;
  color: var(--color-text);
  background: var(--color-offwhite);
  line-height: 1.5;
}

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2em;
}

.suite-copyright {
  text-align: center;
  color: var(--color-gray-600);
  font-size: 0.75em;
  margin-top: 2em;
  padding: 0 2em;
}

h1 {
  color: var(--color-navy);
  font-size: 1.5em;
  margin: 0.8em 0 0.6em;
}

/* --- Page header row: title + search box side by side, right-aligned
   -- opt in per list page with .page-header wrapping <h1> + the search
   box, so the box sits level with the title instead of its own line. --- */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5em 1.5em;
}
.page-header h1 { margin: 0; }
.page-header .search-box { margin: 0; }
.page-header .search-box label { font-weight: normal; }
.page-header .search-box input { margin-top: 0; min-width: 220px; }

a { color: var(--color-navy); }
a:hover { color: var(--color-navy-dark); }

/* --- Nav: navy bar with a thin red top stripe -- the "flag" touch,
   kept subtle (one line, not a banner) so it doesn't compete with the
   content below. --- */
nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25em 0.5em;
  background: var(--color-navy);
  border-top: 3px solid var(--color-red);
  padding: 0.7em 1.5em;
  margin-bottom: 1.5em;
}

nav a.brand {
  display: flex;
  align-items: center;
  gap: 0.55em;
  padding: 0.25em 1em 0.25em 0.35em;
  margin-right: 0.5em;
  border-right: 1px solid rgba(255, 255, 255, 0.25);
}
nav a.brand:hover { background: transparent; }
.brand-icon { width: 2em; height: 2em; display: block; }
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-title { font-weight: 700; font-size: 1.05em; }
.brand-subtitle { font-size: 0.8em; color: rgba(255, 255, 255, 0.75); }

nav a {
  color: var(--color-white);
  text-decoration: none;
  padding: 0.35em 0.7em;
  border-radius: var(--radius);
  font-size: 0.95em;
}

nav a:hover { background: rgba(255, 255, 255, 0.12); }

nav a.active {
  background: var(--color-red);
  color: var(--color-white);
}

nav .current-user {
  margin-left: auto;
  color: var(--color-white);
  opacity: 0.85;
  font-size: 0.9em;
  padding: 0.35em 0.5em;
}

nav form { display: inline; }
nav button {
  background: transparent;
  color: var(--color-white);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: var(--radius);
  padding: 0.3em 0.7em;
  cursor: pointer;
  font-size: 0.9em;
}
nav button:hover { background: rgba(255, 255, 255, 0.12); }

/* --- Flash messages --- */
.flash {
  max-width: 1200px;
  margin: 0 auto 1em;
  padding: 0.7em 1em;
  background: var(--color-white);
  border: 1px solid var(--color-gray-300);
  border-left: 4px solid var(--color-navy);
  border-radius: var(--radius);
  color: var(--color-text);
}

/* --- Tables --- */
table {
  border-collapse: collapse;
  width: 100%;
  margin-top: 1em;
  background: var(--color-white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(30, 36, 48, 0.08);
}

th, td {
  padding: 0.55em 0.9em;
  text-align: left;
  border-bottom: 1px solid var(--color-gray-100);
}

th {
  background: var(--color-navy);
  color: var(--color-white);
  font-weight: 600;
  font-size: 0.9em;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

tbody tr:nth-child(even) { background: var(--color-gray-100); }
tbody tr:hover { background: var(--color-navy-tint); }

td form { margin: 0; }

/* Keeps a short, fixed-format value (e.g. a phone number) from
   soft-wrapping onto a second line inside its cell when the table gets
   squeezed by its many other columns. */
.nowrap { white-space: nowrap; }

/* --- Buttons --- */
button, input[type="submit"] {
  font-family: inherit;
  font-size: 0.95em;
  background: var(--color-navy);
  color: var(--color-white);
  border: none;
  border-radius: var(--radius);
  padding: 0.5em 1.1em;
  cursor: pointer;
}
button:hover, input[type="submit"]:hover { background: var(--color-navy-dark); }

.btn-danger { background: var(--color-red); }
.btn-danger:hover { background: var(--color-red-dark); }

/* --- Forms --- */
form label {
  display: block;
  margin: 0.6em 0;
  font-weight: 600;
  font-size: 0.92em;
  color: var(--color-gray-600);
}

input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="date"], input[type="time"],
input[type="file"], select, textarea {
  font-family: inherit;
  font-size: 1em;
  font-weight: normal;
  color: var(--color-text);
  border: 1px solid var(--color-gray-300);
  border-radius: var(--radius);
  padding: 0.4em 0.6em;
  margin-top: 0.25em;
  background: var(--color-white);
}

input:not([type="checkbox"]):not([type="radio"]), select, textarea {
  min-width: 260px;
  max-width: 100%;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--color-navy);
  box-shadow: 0 0 0 3px var(--color-navy-tint);
}

/* --- Badges (semantic: success/warning/danger/info -- never used for
   party_cd/party_represented, see note at top of file) --- */
.badge {
  display: inline-block;
  padding: 0.15em 0.65em;
  border-radius: 999px;
  font-size: 0.85em;
  font-weight: 600;
}
.badge-yes, .badge-status-confirmed, .badge-status-completed { background: var(--color-green-tint); color: var(--color-green); }
.badge-no, .badge-status-cancelled { background: var(--color-gray-100); color: var(--color-gray-600); }
.badge-status-scheduled { background: var(--color-navy-tint); color: var(--color-navy); }
.badge-status-no_show { background: var(--color-amber-tint); color: var(--color-amber); }
.badge-info { background: var(--color-navy-tint); color: var(--color-navy); }

/* --- Map legend swatches --- */
.legend-swatch { display: inline-block; width: 0.9em; height: 0.9em; border-radius: 50%; vertical-align: middle; }
.legend-green { background: #2e8b2e; }
.legend-yellow { background: #d4a017; }
.legend-red { background: #c0392b; }
.legend-gray { background: #888; }

/* --- Staffing report --- */
.report-location { margin-bottom: 1.5em; padding-bottom: 1em; border-bottom: 1px solid var(--color-gray-300); }
.report-meta { color: var(--color-gray-600); font-size: 0.9em; }

/* Unfilled-positions-by-precinct summary tiles -- compact chips (value +
   label on one line), not cards, so a county with a couple dozen
   precincts doesn't push the report itself below the fold. Amber is
   this app's existing "needs attention" status color (see
   badge-status-no_show), reused here rather than introducing a new one
   for the same meaning. */
.stat-tile-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4em;
  margin: 0.4em 0 1.25em;
}
.stat-tile {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35em;
  background: var(--color-white);
  border: 1px solid var(--color-gray-300);
  border-left: 3px solid var(--color-amber);
  border-radius: var(--radius);
  padding: 0.2em 0.6em;
}
.stat-tile-value {
  font-size: 1em;
  font-weight: 700;
  line-height: 1.4;
  color: var(--color-amber);
  font-variant-numeric: tabular-nums;
}
.stat-tile-label {
  margin-top: 0;
  font-size: 0.85em;
  color: var(--color-gray-600);
  white-space: nowrap;
}

/* --- Election county picker --- */
.county-checkboxes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.2em 1em;
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid var(--color-gray-300);
  border-radius: var(--radius);
  padding: 0.5em;
  margin: 0.5em 0;
  background: var(--color-white);
}
.county-checkboxes label { margin: 0; font-weight: normal; }

/* --- Login page: brand now comes from the always-rendered nav bar --- */
.login-form { max-width: 320px; margin-top: 1em; }

/* --- Portal home: app picker cards --- */
.app-links {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1em;
  margin-top: 1.5em;
}
.app-card {
  display: flex;
  flex-direction: column;
  gap: 0.4em;
  background: var(--color-white);
  border: 1px solid var(--color-gray-300);
  border-left: 3px solid var(--color-navy);
  border-radius: var(--radius);
  padding: 1em 1.2em;
  text-decoration: none;
  box-shadow: 0 1px 3px rgba(30, 36, 48, 0.08);
}
.app-card:hover { border-left-color: var(--color-red); }
.app-card-title { font-weight: 700; color: var(--color-navy); font-size: 1.05em; }
.app-card-desc { color: var(--color-gray-600); font-size: 0.9em; }
