/* ─── Sidebar layout ─────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 64px;
  background: var(--theme-section-bg);
  border-right: 1px solid var(--theme-border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem 0;
  gap: 0.5rem;
  z-index: 10;
}

.sidebar-logo {
  margin-bottom: 0.5rem;
}

.sidebar-logo img {
  height: 50px;
  object-fit: contain;
}

.sidebar-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  color: var(--theme-muted);
  font-size: 1.25rem;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.sidebar-button {
  color: var(--theme-muted);
}

.sidebar-button:hover {
  background: var(--theme-item-hover-bg);
  color: var(--theme-fg);
  text-decoration: none;
}

/* ─── Inline SVG icons ───────────────────────────────────────────── */
.item-actions span.icon svg,
.help-trigger span.icon svg {
  width: 1rem;
  height: 1rem;
}

span.icon {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
}

span.icon svg {
  width: 1em;
  height: 1em;
}

.sidebar-button span.icon svg {
  width: 20px;
  height: 20px;
}

.main-content {
  margin-left: 64px;
}

/* ─── Section overrides ──────────────────────────────────────────── */
section {
  border: none;
}

/* ─── Page header — bleeds to page-main edges ────────────────────── */
.page-header {
  margin: -2rem -2rem 0;
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--theme-border);
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.page-header h1,
.page-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--theme-section-heading-fg);
  margin: 0;
}

/* ─── Breadcrumb nav ─────────────────────────────────────────────── */
.page-meta {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.8rem;
  color: var(--theme-muted);
}

.resource-meta-label a {
  color: var(--theme-muted);
}

.resource-meta-label a:hover {
  color: var(--theme-fg);
}

/* ─── Toolbar ────────────────────────────────────────────────────── */
.toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0;
  margin-bottom: 1em;
}

.toolbar form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ─── Form actions row ───────────────────────────────────────────── */
.form-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-top: 1rem;
}

/* ─── Anchor-as-button (primary/danger/ghost) ────────────────────── */
a.primary, a.btn.primary {
  background: var(--theme-btn-primary-bg);
  color: var(--theme-btn-primary-fg);
  border: 1px solid var(--theme-btn-primary-border);
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  padding: 0.45em 0.85em;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: 5px;
  cursor: pointer;
  text-decoration: none;
  font-family: var(--theme-font-btn);
  text-transform: var(--theme-btn-text-transform);
}
a.primary:hover, a.btn.primary:hover {
  background: var(--theme-btn-primary-hover);
  text-decoration: none;
}

a.ghost {
  background: transparent;
  border: 1px solid transparent;
  color: var(--theme-muted);
  display: inline-flex;
  align-items: center;
  font-size: 0.9rem;
  border-radius: 5px;
  text-decoration: none;
}
a.ghost:hover {
  background: var(--theme-item-hover-bg);
  color: var(--theme-fg);
  text-decoration: none;
}

/* ─── Missing input types from core.css ──────────────────────────── */
input[type="email"],
input[type="password"],
input[type="file"],
input[type="number"],
textarea {
  background: var(--theme-input-bg);
  color: var(--theme-input-fg);
  border: 1px solid var(--theme-input-border);
  border-radius: 5px;
  padding: 0.45em 0.75em;
  font-size: 0.9rem;
  font-family: var(--theme-font-ui);
  width: 100%;
  transition: border-color 0.15s;
}

input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
textarea:focus {
  outline: none;
  border-color: var(--theme-input-focus-border);
  box-shadow: 0 0 0 3px var(--theme-focus-ring);
}

/* ─── Vox status badges ──────────────────────────────────────────── */
.badge-pending {
  background: var(--color-amber-glow);
  color: var(--color-amber);
  border: 1px solid var(--color-amber);
}

.badge-open {
  background: var(--color-forest-glow);
  color: var(--color-forest);
  border: 1px solid var(--color-forest);
}

.badge-closed {
  background: var(--color-navy-glow);
  color: var(--theme-muted);
  border: 1px solid var(--theme-muted);
}

.badge-complete {
  background: var(--color-cobalt-glow);
  color: var(--color-cobalt);
  border: 1px solid var(--color-cobalt);
}

.badge-aborted {
  background: var(--color-crimson-glow);
  color: var(--color-crimson);
  border: 1px solid var(--color-crimson);
}

/* ─── Item list — archived state ─────────────────────────────────── */
ul.item-list li.item.archived {
  opacity: 0.6;
}

/* ─── Empty state ────────────────────────────────────────────────── */
.empty-state {
  color: var(--theme-muted);
  font-size: 0.9rem;
  padding: 1rem 0;
}

/* ─── Error / info banners ───────────────────────────────────────── */
.error-banner {
  background: var(--color-crimson-glow);
  border: 1px solid var(--color-crimson);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  color: var(--color-crimson);
}

/* ─── Voter / results tables ─────────────────────────────────────── */
.results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.results-table th,
.results-table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--theme-border);
  text-align: left;
}

.results-table th {
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  color: var(--theme-muted);
}

/* ─── Code / pre blocks ──────────────────────────────────────────── */
pre.info-box {
  background: var(--theme-item-bg);
  border: 1px solid var(--theme-border);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  overflow-x: auto;
}

/* ─── Filter dropdown (uses <details>/<summary> for native toggle) ── */
details.filter-dropdown {
  position: relative;
}

details.filter-dropdown > summary {
  list-style: none;
}
details.filter-dropdown > summary::-webkit-details-marker {
  display: none;
}

.filter-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--theme-popup-bg);
  border: 1px solid var(--theme-popup-border);
  border-radius: 6px;
  padding: 0.5rem;
  min-width: 160px;
  z-index: 50;
}

details.filter-dropdown[open] .filter-dropdown-menu {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.filter-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.7rem;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
}

.filter-checkbox {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.7rem;
  cursor: pointer;
}

/* ─── Pagination ─────────────────────────────────────────────────── */
.pagination-controls {
  display: flex;
  gap: 0.25rem;
  align-items: center;
}

/* ─── ID display / copy ──────────────────────────────────────────── */
.id-display {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}

.id-copy-btn {
  background: transparent;
  border: none;
  padding: 0.1em 0.25em;
  cursor: pointer;
  color: var(--theme-muted);
  font-size: 0.8rem;
}

.id-copy-btn:hover {
  color: var(--theme-fg);
}

/* ─── Resource meta in items ─────────────────────────────────────── */
.resource-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--theme-muted);
}

/* ─── Voter count ────────────────────────────────────────────────── */
.voter-count {
  font-size: 0.85rem;
  color: var(--theme-muted);
  margin-bottom: 0.5rem;
}

/* ─── Normalize control height (body line-height 1.5 inflates all form controls) */
button, .btn, select,
input[type="text"], input[type="email"], input[type="password"],
input[type="search"], input[type="number"] {
  line-height: 1;
}

select {
  font-size: 0.9rem;
  padding: 0.45em 0.85em;
}

/* ─── Section heading stacked with a badge beneath ──────────────── */
.section-title-stack {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

/* ─── Form row spacing ───────────────────────────────────────────── */
.form-row + .form-row {
  margin-top: 1rem;
}

/* Buttons inside a field column should not stretch to full width */
.field > button {
  align-self: flex-start;
}

/* ─── Choice inputs ──────────────────────────────────────────────── */
.choice-input-row {
  margin-bottom: 0.5rem;
}

.choice-inputs {
  display: flex;
  gap: 0.5rem;
}

/* ─── About / markdown content ───────────────────────────────────── */
.about-content {
  max-width: 700px;
  margin: 2rem auto;
  padding: 0 2rem;
  line-height: 1.7;
}

.about-content h1, .about-content h2, .about-content h3 {
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

.about-content p {
  margin-bottom: 1rem;
  text-align: justify;
}

/* ─── Error pages ────────────────────────────────────────────────── */
.error-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  padding: 2rem;
}

.error-content {
  text-align: center;
  max-width: 500px;
}

.error-title {
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

/* ─── Inline edit ────────────────────────────────────────────────── */
.inline-edit-form {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.inline-edit-form .inline-edit-input {
  width: 100%;
}

.inline-edit-buttons {
  display: flex;
  align-self: flex-start;
  gap: 0.5rem;
  margin-top: 1ch;
}

/* Clickable placeholder when editable element is empty */
[data-editable-type="textarea"]:empty {
  min-height: 2.5rem;
  cursor: pointer;
}

[data-editable-type="textarea"]:empty::before {
  content: "Click to add a description…";
  color: var(--theme-input-placeholder);
  font-style: italic;
}
