/* Custom styles to complement the base theme (Bootstrap) */

:root {
  /* Theme variables (polyfills for previous Pico-based vars) */
  --pico-primary: #2563eb; /* blue-600 */
  --pico-primary-hover: #1d4ed8;
  --pico-muted-color: #6b7280; /* gray-500 */
  --pico-muted-border-color: #e5e7eb; /* gray-200 */
  --pico-muted-background-color: #f3f4f6; /* gray-100 */
  --pico-background-color: #ffffff;
  --pico-border-radius: 8px;
  --app-surface: #f8fafc;
  --app-surface-strong: #eef4ff;
  --app-active: #2563eb;
  --app-active-text: #ffffff;
  --app-row-warning: #fff3e0;
  --app-row-info: #e5f0ff;
  --app-row-highlight: #fff8d6;
}

html[data-theme="dark"] {
  --pico-primary: #60a5fa; /* blue-400 */
  --pico-primary-hover: #93c5fd;
  --pico-muted-color: #9ca3af;
  --pico-muted-border-color: #374151; /* gray-700 */
  --pico-muted-background-color: #1f2937; /* gray-800 */
  --pico-background-color: #0f172a; /* slate-950 */
  --app-surface: #182235;
  --app-surface-strong: #1b2a43;
  --app-active: #60a5fa;
  --app-active-text: #08111f;
  --app-row-warning: #3a2b18;
  --app-row-info: #162c4a;
  --app-row-highlight: #3a3218;
}

html[data-theme="light"] {
  --bs-body-bg: #ffffff;
  --bs-body-color: #212529;
  --bs-border-color: #e5e7eb;
  --bs-secondary-bg: #f3f4f6;
  --bs-tertiary-bg: #f8fafc;
}

html[data-theme="dark"] {
  --bs-body-bg: #0f172a;
  --bs-body-color: #e5e7eb;
  --bs-border-color: #374151;
  --bs-secondary-bg: #1f2937;
  --bs-tertiary-bg: #182235;
}

.lendra-status-swatch {
  width: 14px;
  height: 14px;
  border: 1px solid #ccc;
  border-radius: 2px;
  display: inline-block;
}

.lendra-status-unsynced { background: #ffd5d5; }
.lendra-status-draft { background: #fff9c4; }

html[data-theme="dark"] .lendra-status-swatch { border-color: #64748b; }
html[data-theme="dark"] .lendra-status-unsynced { background: #542530; }
html[data-theme="dark"] .lendra-status-draft { background: #5c4811; }

.row-highlight-danger,
.lendra-row-unsynced {
  --bs-table-bg: #ffd5d5;
  --bs-table-color: #212529;
  --bs-table-hover-bg: #ffbfbf;
  background-color: #ffd5d5 !important;
}

.row-highlight-warning,
.lendra-row-draft {
  --bs-table-bg: #fff3cd;
  --bs-table-color: #212529;
  --bs-table-hover-bg: #ffe69c;
  background-color: #fff3cd !important;
}

.row-highlight-info {
  --bs-table-bg: #cce5ff;
  --bs-table-color: #212529;
  --bs-table-hover-bg: #b6dcfe;
  background-color: #cce5ff !important;
}

.row-highlight-violet {
  --bs-table-bg: #f3e8ff;
  --bs-table-color: #212529;
  --bs-table-hover-bg: #e9d5fd;
  background-color: #f3e8ff !important;
}

.row-highlight-success {
  --bs-table-bg: #d1e7dd;
  --bs-table-color: #212529;
  --bs-table-hover-bg: #badbcc;
  background-color: #d1e7dd !important;
}

html[data-theme="dark"] .row-highlight-danger,
html[data-theme="dark"] .lendra-row-unsynced {
  --bs-table-bg: #542530;
  --bs-table-color: #f8fafc;
  --bs-table-hover-bg: #6f2f3e;
  background-color: #542530 !important;
}

html[data-theme="dark"] .row-highlight-warning,
html[data-theme="dark"] .lendra-row-draft {
  --bs-table-bg: #5c4811;
  --bs-table-color: #f8fafc;
  --bs-table-hover-bg: #755c16;
  background-color: #5c4811 !important;
}

html[data-theme="dark"] .row-highlight-info {
  --bs-table-bg: #163d5c;
  --bs-table-color: #f8fafc;
  --bs-table-hover-bg: #1c4d73;
  background-color: #163d5c !important;
}

html[data-theme="dark"] .row-highlight-violet {
  --bs-table-bg: #3d2c5d;
  --bs-table-color: #f8fafc;
  --bs-table-hover-bg: #4c3675;
  background-color: #3d2c5d !important;
}

html[data-theme="dark"] .row-highlight-success {
  --bs-table-bg: #1e4d38;
  --bs-table-color: #f8fafc;
  --bs-table-hover-bg: #286248;
  background-color: #1e4d38 !important;
}

.task-check { font-weight: 700; }
.task-check-done { color: #15803d; }
.task-check-none { color: #6b7280; }

.task-check svg { vertical-align: middle; }

html[data-theme="dark"] .task-check-done { color: #ffffff; }
html[data-theme="dark"] .task-check-none { color: #ffffff; }

.lendra-tracking-table-header {
  background: #f8f9fa;
  color: #212529;
}

.lendra-tracking-edit-row {
  background: #fff8e1;
  color: #212529;
}

.lendra-assigned-task-note { color: #664d03; }

html[data-theme="dark"] .lendra-tracking-table-header {
  background: #1f2937;
  color: #f8fafc;
}

html[data-theme="dark"] .lendra-tracking-edit-row {
  background: #5c4811;
  color: #f8fafc;
}

html[data-theme="dark"] .lendra-assigned-task-note { color: #fef3c7; }

/* Utility classes for display */
.d-none { display: none !important; }
.d-flex { display: flex !important; }

/* Slightly larger default font for readability */
body { font-size: 16.5px; }

/* Layout */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--pico-muted-border-color);
  backdrop-filter: saturate(180%) blur(8px);
}

/* Make nav horizontal */
.topbar nav { display: flex; align-items: center; justify-content: space-between; padding: .4rem 1rem; }
.topbar nav ul { display: flex; gap: .75rem; align-items: center; margin: 0; padding: 0; list-style: none; }
.topbar nav ul li { display: inline-flex; align-items: center; }
.topbar nav a { text-decoration: none; }

/* Nav dropdowns */
.nav-dropdown { position: relative; }
.nav-dropdown-btn {
  background: none; border: none; padding: 0; margin: 0;
  font: inherit; color: inherit; cursor: pointer; white-space: nowrap;
  text-decoration: none;
}
.nav-dropdown-btn:hover { text-decoration: underline; }
.nav-submenu {
  display: none !important;
  position: absolute;
  top: calc(100% + .35rem);
  left: 0;
  background: var(--pico-background-color, #fff);
  border: 1px solid var(--pico-muted-border-color, #ddd);
  border-radius: .375rem;
  padding: .25rem 0;
  min-width: 170px;
  z-index: 200;
  box-shadow: 0 4px 14px rgba(0,0,0,.12);
  flex-direction: column !important;
  gap: 0 !important;
}
.nav-submenu li { display: block !important; width: 100%; }
.nav-submenu a { display: block; padding: .35rem .85rem; white-space: nowrap; font-size: .9rem; }
.nav-submenu a:hover { background: var(--pico-muted-background-color, #f5f5f5); }
.nav-dropdown.open .nav-submenu,
.nav-dropdown:hover .nav-submenu { display: flex !important; }
.nav-submenu-label {
  color: var(--pico-muted-color);
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .04em;
  padding: .55rem .85rem .2rem;
  text-transform: uppercase;
}
.project-dropdown .nav-submenu {
  display: none !important;
  left: auto;
  min-width: 520px;
  min-height: 310px;
  overflow: visible;
  right: 0;
}
.nav-dropdown.open.project-dropdown .nav-submenu,
.nav-dropdown.project-dropdown:hover .nav-submenu {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.project-submenu {
  height: 100%;
  position: static;
  width: auto;
}
.project-dropdown .nav-submenu > .project-submenu {
  width: auto !important;
}
.project-dropdown .nav-submenu > .project-common {
  grid-column: 1 / -1;
  width: auto !important;
  border-bottom: 1px solid var(--pico-muted-border-color, #333);
}
.project-dropdown .nav-submenu > .project-common a {
  text-align: center;
}
.project-submenu-btn {
  align-items: center;
  background: none;
  border: 0;
  color: inherit;
  cursor: pointer;
  display: flex;
  font: inherit;
  color: var(--pico-muted-color);
  cursor: default;
  font-size: .75rem;
  font-weight: 700;
  justify-content: flex-start;
  letter-spacing: .04em;
  padding: .55rem .85rem .3rem;
  text-transform: uppercase;
  width: 100%;
}
.project-submenu-btn span { display: none; }
.project-submenu-btn:hover { background: none; }
.project-submenu-panel {
  background: var(--pico-background-color);
  border: 0;
  border-radius: 0;
  box-shadow: none;
  display: block;
  bottom: auto;
  left: auto;
  list-style: none;
  margin: 0;
  min-width: 0;
  overflow: visible;
  padding: .25rem 0;
  position: static;
  right: auto;
  top: auto;
  z-index: 210;
}
.topbar nav .project-submenu-panel {
  display: block !important;
}
.project-submenu-panel li { display: block !important; width: 100%; }
.project-submenu-panel a { display: block; padding: .35rem .85rem; white-space: nowrap; }
.theme-toggle { min-width: 4.5rem; }

.container.content { max-width: min(1800px, 98vw); margin: 1rem auto 0; overflow-x: hidden; }

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: .5rem;
}

.right-actions { display: flex; gap: .5rem; align-items: center; }

.hide-on-mobile { display: none; }
@media (min-width: 640px) {
  .hide-on-mobile { display: inline; }
}

@media (max-width: 900px) {
  .topbar nav { gap: .5rem; padding-inline: .6rem; }
  .topbar nav > ul:last-child {
    flex: 1 1 auto;
    min-width: 0;
    overflow-x: auto;
    padding-bottom: .2rem;
    scrollbar-width: thin;
  }
  .topbar nav ul { gap: .55rem; }
}

/* Cards grid on index */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .75rem; }
.card {
  display: flex;
  flex-direction: column;
  min-height: 110px;
}
.card .card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
}
.card-right { display: inline-flex; align-items: center; gap: .5rem; }
.count-badge {
  font-size: .8rem;
  padding: .15rem .5rem;
  border-radius: 999px;
  background: var(--pico-muted-background-color);
  color: var(--pico-muted-color);
}
.card .card-header h3 { font-size: 1rem; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .muted { color: var(--pico-muted-color); margin: 0; }

.list-toolbar {
  display: flex;
  justify-content: space-between;
  gap: .5rem;
  margin: 0 auto 1rem;
  max-width: 900px;
}

/* Simple table list (homepage) */
.panel {
  border: 1px solid var(--pico-muted-border-color);
  border-radius: var(--pico-border-radius);
  padding: .5rem .75rem;
  max-width: 900px;
  margin: 0 auto;
}

.badge {
  display: inline-block;
  font-size: .75rem;
  padding: .15rem .5rem;
  border-radius: 999px;
  background: var(--pico-muted-background-color);
  color: var(--pico-muted-color);
  font-weight: 600;
  line-height: 1.2;
}

.badge-success {
  background: #198754;
  color: #ffffff;
}

.badge-warning {
  background: #ffc107;
  color: #212529;
}

.badge-secondary {
  background: #6c757d;
  color: #ffffff;
}

.simple-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .9rem; }
.simple-table th, .simple-table td { padding: .5rem .6rem; }
.simple-table thead th { border-bottom: 1px solid var(--pico-muted-border-color); }
.simple-table tbody tr + tr td { border-top: 1px solid var(--pico-muted-border-color); }
.simple-table td.actions { text-align: right; white-space: nowrap; }

/* Table */
.table-container {
  overflow: auto;
  border: 1px solid var(--pico-muted-border-color);
  border-radius: var(--pico-border-radius);
  width: fit-content;       /* shrink to table content width */
  max-width: min(1800px, 98vw);
  margin: 0 auto;
  max-height: 70vh; /* allow inner scroll with sticky header */
}

table.data-table {
  width: 100%;
  font-size: 0.86rem; /* bumped for readability */
  border-collapse: separate;
  border-spacing: 0;
}

table.data-table thead th {
  position: sticky;
  top: 0;
  background: var(--pico-background-color);
  z-index: 3;
  box-shadow: 0 1px 0 var(--pico-muted-border-color);
}

/* Inline sort layout: title and arrow on one row */
table.data-table thead th a {
  text-decoration: none;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: .25rem;
  white-space: nowrap;
}
table.data-table thead th a .th-title { line-height: 1.1; font-size: .92em; white-space: nowrap; }
table.data-table thead th a .sort-vertical { font-size: .75em; line-height: 1; opacity: .75; }

/* tighter table padding to reduce width */
table.data-table th, table.data-table td { padding: .25rem .4rem; white-space: nowrap; border-right: 1px solid var(--pico-muted-border-color); }
table.data-table th:last-child, table.data-table td:last-child { border-right: none; }
table.data-table input[type="search"] { padding: .25rem .4rem; font-size: .8rem; }
table.data-table .filters-row th { padding: .25rem .4rem; }
table.data-table td, table.data-table th { line-height: 1.35; }

.filters-row th { background: var(--pico-muted-background-color); }
.filters-apply { margin: .5rem; }

/* Zebra striping */
table.data-table tbody tr:nth-child(even) {
  background: color-mix(in oklab, var(--pico-muted-background-color), transparent 50%);
}
table.data-table tbody tr:hover { background: color-mix(in oklab, var(--pico-muted-background-color), transparent 35%); }
table.data-table tbody tr.row-not-published { background: color-mix(in oklab, #f59e0b, transparent 80%); }
table.data-table tbody tr.row-not-published:hover { background: color-mix(in oklab, #f59e0b, transparent 65%); }

/* Cell styles */
table.data-table th { white-space: nowrap; }
table.data-table td { white-space: nowrap; max-width: 28ch; overflow: hidden; text-overflow: ellipsis; }

/* Numeric alignment — left-aligned like all other columns */
table.data-table th.num, table.data-table td.num { text-align: left; font-variant-numeric: tabular-nums; width: 1%; }

/* Narrow text columns (date, status, short identifiers) — shrink to content width */
table.data-table th.col-narrow { width: 1%; white-space: nowrap; }
table.data-table td.col-narrow { white-space: nowrap; }

.muted { color: var(--pico-muted-color); }

/* Pagination spacing */
.pagination { margin-top: 1rem; }
.pagination.numbers ul { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.pagination.numbers a, .pagination.numbers span {
  display: inline-block; padding: .3rem .55rem; border-radius: .5rem; border: 1px solid var(--pico-muted-border-color);
}
.pagination.numbers span.current { background: var(--pico-muted-background-color); color: var(--pico-muted-color); border-color: transparent; }

/* Toolbar compactness */
/* Compact toolbar like the reference screenshot */
.toolbar.compact { 
  display: flex; 
  flex-direction: column; 
  gap: .4rem; 
  margin: .5rem 0 .75rem; 
}
.toolbar.compact .row { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.toolbar.compact .row .spacer { flex: 1 1 auto; }
.toolbar.compact label { margin: 0; font-size: .82rem; color: var(--pico-muted-color); }
.toolbar.compact .muted { font-size: .85rem; }
.toolbar.compact select,
.toolbar.compact input[type="search"],
.toolbar.compact input[type="number"],
.toolbar.compact input[type="date"] { padding: .25rem .4rem; font-size: .82rem; }
.toolbar.compact button,
.toolbar.compact a[role="button"] { padding: .28rem .5rem; font-size: .82rem; }
.toolbar.compact .linklike { background: transparent; border: none; padding: 0 .25rem; color: var(--pico-muted-color); }
.toolbar.compact .checkbox.small { display: inline-flex; align-items: center; gap: .4rem; }
.toolbar.compact .checkbox.small input { margin: 0; }
/* Force controls inline, not full-width */
.toolbar.compact .row a[role="button"],
.toolbar.compact .row button,
.toolbar.compact .row input,
.toolbar.compact .row select { width: auto !important; display: inline-flex; }

/* Table views keep every route available without turning navigation into a button wall. */
.project-nav {
  background: var(--app-surface) !important;
  border: 1px solid var(--pico-muted-border-color);
  border-radius: 6px !important;
  flex-wrap: nowrap !important;
  gap: .35rem !important;
  margin-bottom: .75rem !important;
  overflow-x: auto;
  padding: .45rem .6rem !important;
  scrollbar-width: thin;
}
.project-nav > strong {
  flex: 0 0 auto;
  margin-right: .2rem !important;
}
.project-nav a[role="button"],
.project-nav > span {
  flex: 0 0 auto;
  font-size: .8rem !important;
  padding: .26rem .5rem !important;
  white-space: nowrap;
}
.project-nav > span {
  background: var(--app-active) !important;
  border-radius: 4px !important;
  color: var(--app-active-text) !important;
}
.project-nav > div:last-child {
  flex: 0 0 auto;
  margin-left: .25rem !important;
  padding-left: .5rem !important;
}

.toolbar.compact .row-years {
  background: var(--app-surface);
  border: 1px solid var(--pico-muted-border-color);
  border-radius: 6px;
  flex-wrap: nowrap !important;
  overflow-x: auto;
  padding: .45rem .55rem;
  scrollbar-width: thin;
}
.toolbar.compact .row-years > .muted,
.toolbar.compact .row-years > div {
  flex: 0 0 auto;
  width: auto !important;
}
.toolbar.compact .row-years > :last-child {
  margin-left: auto;
}
.toolbar.compact .row-years a[role="button"] {
  align-items: center;
  background: var(--pico-muted-background-color);
  color: var(--bs-body-color, #212529);
  flex: 0 0 auto;
  white-space: nowrap;
}
html[data-theme="dark"] .toolbar.compact input,
html[data-theme="dark"] .toolbar.compact select {
  background: var(--bs-secondary-bg);
  border-color: var(--bs-border-color);
  color: var(--bs-body-color);
}

.visit-tools,
.phrase-summary {
  background: var(--app-surface);
  border: 1px solid var(--pico-muted-border-color);
  border-radius: 6px;
  margin: .4rem 0;
  padding: .45rem .6rem;
}
.phrase-summary { background: var(--app-surface-strong); border-left: 3px solid var(--app-active); }
.phrase-summary h4 { font-size: 1.1rem; margin: 0 0 .75rem; }
.phrase-summary-content { display: flex; flex-wrap: wrap; gap: .5rem; }
.phrase-summary p { font-size: .85rem; margin: .75rem 0 0; }
.phrase-chip {
  background: var(--pico-background-color);
  border: 1px solid var(--pico-muted-border-color);
  border-radius: 999px;
  font-size: .85rem;
  padding: .3rem .65rem;
}

/* Button-like styling for anchors with role=button and utility classes used before */
a[role="button"] {
  display: inline-block;
  padding: .35rem .6rem;
  border: 1px solid var(--pico-muted-border-color);
  border-radius: var(--pico-border-radius);
  background: var(--pico-muted-background-color);
  color: inherit;
  text-decoration: none;
}
a[role="button"].secondary { background: var(--pico-muted-background-color); }
a[role="button"].outline { background: transparent; }
button.secondary.outline { background: transparent; }
button.secondary { background: var(--pico-muted-background-color); border-color: var(--pico-muted-border-color); }
button.secondary:hover, a[role="button"].secondary:hover { filter: brightness(0.98); }

/* Toast banner for post-refresh cue */
.toast-banner {
  position: fixed;
  bottom: 16px;
  right: 16px;
  background: #16a34a; /* green */
  color: white;
  padding: .5rem .75rem;
  border-radius: .5rem;
  box-shadow: 0 6px 20px rgba(0,0,0,.15);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .2s ease, transform .2s ease;
  z-index: 9999;
}
.toast-banner.show { opacity: 1; transform: translateY(0); }

/* Image Documentation */
.evidence-page { max-width: 1240px; margin: 0 auto; }
.evidence-messages { margin: 0 0 1rem; }
.evidence-message {
  border: 1px solid var(--pico-muted-border-color);
  border-radius: 4px;
  margin: 0 0 .5rem;
  padding: .55rem .75rem;
}
.evidence-message-success { background: #d1e7dd; border-color: #badbcc; color: #0a3622; }
.evidence-message-error { background: #f8d7da; border-color: #f5c2c7; color: #842029; }
.evidence-message-warning { background: #fff3cd; border-color: #ffecb5; color: #664d03; }

.evidence-capture-layout,
.evidence-detail-layout {
  display: grid;
  grid-template-columns: minmax(300px, .9fr) minmax(340px, 1.1fr);
  gap: 1.25rem;
  align-items: start;
}

.evidence-image-frame {
  border: 1px solid var(--pico-muted-border-color);
  border-radius: var(--pico-border-radius);
  margin: 0;
  overflow: hidden;
  background: var(--pico-muted-background-color);
}
.evidence-image-frame img {
  background: #ffffff;
  display: block;
  height: auto;
  max-height: 72vh;
  object-fit: contain;
  width: 100%;
}
.evidence-image-frame figcaption {
  color: var(--pico-muted-color);
  font-size: .82rem;
  overflow-wrap: anywhere;
  padding: .5rem .65rem;
}

.evidence-capture-form { min-width: 0; }
.evidence-detail-sidebar { display: flex; flex-direction: column; min-width: 0; }
.evidence-metadata {
  border-left: 1px solid var(--pico-muted-border-color);
  border-top: 1px solid var(--pico-muted-border-color);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
}
.evidence-metadata > div {
  border-bottom: 1px solid var(--pico-muted-border-color);
  border-right: 1px solid var(--pico-muted-border-color);
  min-width: 0;
  padding: .55rem .65rem;
}
.evidence-metadata dt {
  color: var(--pico-muted-color);
  font-size: .75rem;
  font-weight: 600;
  margin: 0 0 .15rem;
  text-transform: uppercase;
}
.evidence-metadata dd {
  margin: 0;
  overflow-wrap: anywhere;
}
.evidence-source-link { margin: .75rem 0; }
.evidence-notes-form label { display: block; font-weight: 600; margin-bottom: .35rem; }
.evidence-notes-form textarea {
  box-sizing: border-box;
  display: block;
  resize: vertical;
  width: 100%;
}
.evidence-form-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .75rem; }
.gig-evidence-capture-form { display: inline; margin: 0; }
.gig-evidence-capture-link {
  background: transparent;
  border: 0;
  color: var(--pico-primary);
  cursor: pointer;
  font: inherit;
  margin: 0;
  max-width: 100%;
  overflow: hidden;
  padding: 0;
  text-align: left;
  text-decoration: underline;
  text-overflow: ellipsis;
  vertical-align: baseline;
  white-space: nowrap;
}
.gig-evidence-capture-link:hover { color: var(--pico-primary-hover); }
.evidence-table-container { width: 100%; }
.evidence-empty { color: var(--pico-muted-color); padding: 1.25rem; text-align: center; }
.documentation-part { margin-bottom: 2.5rem; }
.documentation-tabs { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.25rem; }
.documentation-tabs a[role="button"] { margin: 0; width: auto; }
.documentation-part h3 { margin-bottom: .25rem; }
.documentation-hint { color: var(--pico-muted-color); margin: 0; }
.documentation-filter { align-items: center; display: flex; gap: .5rem; margin-bottom: .75rem; }
.documentation-filter label { margin: 0; }
.documentation-filter select { margin: 0; width: auto; }
.documentation-categories { margin-bottom: .75rem; }
.documentation-categories ul { list-style: none; margin: .5rem 0 0; padding: 0; }
.documentation-categories li { align-items: center; display: flex; gap: .75rem; padding: .2rem 0; }
.documentation-categories li form { margin: 0; }
.documentation-categories li button { margin: 0; padding: .15rem .6rem; width: auto; }
.documentation-image-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  margin-bottom: 1rem;
}
.evidence-notes {
  border-top: 1px solid var(--pico-muted-border-color);
  margin-top: 1.25rem;
  padding-top: 1rem;
}
.evidence-notes h3 { font-size: 1rem; margin: 0 0 .5rem; }
.evidence-notes > div { line-height: 1.55; overflow-wrap: anywhere; white-space: pre-wrap; }
.evidence-detail-notes {
  border: 1px solid var(--pico-muted-border-color);
  border-top: 0;
  margin: 0;
  padding: .8rem .9rem;
}
.evidence-source-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: .75rem;
}
.evidence-source-actions form { margin: 0; }
.evidence-comparison-status {
  border: 1px solid var(--pico-muted-border-color);
  border-left: 4px solid #2563eb;
  display: flex;
  flex-direction: column;
  gap: .2rem;
  margin-bottom: 1rem;
  padding: .7rem .85rem;
}
.evidence-comparison-status-match { border-left-color: #198754; }
.evidence-comparison-status-changed { border-left-color: #b45309; }
.evidence-comparison-layout {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.evidence-image-label {
  border-bottom: 1px solid var(--pico-muted-border-color);
  color: var(--pico-muted-color);
  font-size: .78rem;
  font-weight: 600;
  padding: .45rem .65rem;
  text-transform: uppercase;
}
.evidence-comparison-hashes {
  border-left: 1px solid var(--pico-muted-border-color);
  border-top: 1px solid var(--pico-muted-border-color);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 1.25rem 0 0;
}
.evidence-comparison-hashes > div {
  border-bottom: 1px solid var(--pico-muted-border-color);
  border-right: 1px solid var(--pico-muted-border-color);
  min-width: 0;
  padding: .55rem .65rem;
}
.evidence-comparison-hashes dt {
  color: var(--pico-muted-color);
  font-size: .75rem;
  font-weight: 600;
  margin: 0 0 .15rem;
  text-transform: uppercase;
}
.evidence-comparison-hashes dd { margin: 0; overflow-wrap: anywhere; }
.evidence-hash { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: .8rem; }

html[data-theme="dark"] .evidence-image-frame img { background: #ffffff; }
html[data-theme="dark"] .evidence-message-success { background: #163d2a; border-color: #276749; color: #d1fae5; }
html[data-theme="dark"] .evidence-message-error { background: #4a1f25; border-color: #7f303b; color: #fee2e2; }
html[data-theme="dark"] .evidence-message-warning { background: #4a3b16; border-color: #806b22; color: #fef3c7; }

@media (max-width: 760px) {
  .evidence-capture-layout,
  .evidence-detail-layout,
  .evidence-comparison-layout { grid-template-columns: minmax(0, 1fr); }
  .evidence-metadata,
  .evidence-comparison-hashes { grid-template-columns: minmax(0, 1fr); }
  .evidence-image-frame img { max-height: 54vh; }
}

/* Compact density toggle (persisted in localStorage, applied to <html data-compact="1">) */
html[data-compact="1"] table.data-table { font-size: 0.75rem; }
html[data-compact="1"] table.data-table th, 
html[data-compact="1"] table.data-table td { padding: .22rem .4rem; }
html[data-compact="1"] table.data-table input[type="search"] { font-size: .75rem; padding: .2rem .35rem; }

/* Progress page status colours */
.status-revision      { color: #dc2626; font-weight: 600; }
.status-coord_approved { color: #16a34a; }
.status-waiting_qc    { color: #2563eb; }
.status-waiting       { color: #854d0e; }
html[data-theme="dark"] .status-revision       { color: #f87171; }
html[data-theme="dark"] .status-coord_approved  { color: #4ade80; }
html[data-theme="dark"] .status-waiting_qc     { color: #60a5fa; }
html[data-theme="dark"] .status-waiting        { color: #fbbf24; }

/* Keyword Analyzer Styles */
.keyword-analyzer-container {
  max-width: 900px;
  margin: 1.5rem auto;
  padding: 1.25rem;
  background: var(--pico-background-color);
  border: 1px solid var(--pico-muted-border-color);
  border-radius: var(--pico-border-radius);
}

.keyword-analyzer-container h1 {
  margin: 0 0 1rem;
  font-size: 1.4rem;
}

.keyword-analyzer-container .controls {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.project-selector {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.project-selector .radio-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  cursor: pointer;
}

.data-source-tabs {
  display: flex;
  gap: 0.5rem;
  border-bottom: 2px solid var(--pico-muted-border-color);
}

.tab-btn {
  padding: 0.5rem 1rem;
  border: none;
  background: transparent;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  color: var(--pico-muted-color);
}

.tab-btn.active {
  border-bottom-color: var(--pico-primary);
  color: var(--pico-primary);
  font-weight: 500;
}

.tab-content {
  padding: 0.75rem 0;
}

.url-params {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.url-params label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
}

.url-params input[type="number"] {
  width: 80px;
}

.file-label {
  display: block;
}

.file-label span {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  color: var(--pico-muted-color);
}

.analysis-options {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.analysis-options label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
}

.analysis-options input[type="number"] {
  width: 70px;
}

.analysis-options select {
  min-width: 200px;
}

.date-filter {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.75rem;
  background: var(--pico-muted-background-color);
  border-radius: var(--pico-border-radius);
}

.date-filter label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
}

.date-filter input[type="date"] {
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--pico-muted-border-color);
  border-radius: var(--pico-border-radius);
  background: var(--pico-background-color);
}

.date-filter button {
  white-space: nowrap;
}

.date-filter .hint {
  width: 100%;
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
}

.export-buttons {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.summary {
  display: flex;
  gap: 2rem;
  padding: 0.75rem;
  background: var(--pico-muted-background-color);
  border-radius: var(--pico-border-radius);
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.summary div {
  color: var(--pico-muted-color);
}

.summary span {
  font-weight: 600;
  color: inherit;
}

.search-container {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.search-container input {
  flex: 1;
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--pico-muted-border-color);
  border-radius: var(--pico-border-radius);
  font-size: 1rem;
  background: var(--pico-background-color);
}

.search-container input:focus {
  outline: none;
  border-color: var(--pico-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.search-count {
  font-size: 0.9rem;
  color: var(--pico-muted-color);
  white-space: nowrap;
}

.results h2 {
  font-size: 1.2rem;
  margin: 0 0 1rem;
}

.keyword-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.keyword-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem;
  border-radius: var(--pico-border-radius);
  background: hsl(var(--kw-hue, 0deg) 100% 95%);
  color: hsl(var(--kw-hue, 0deg) 60% 18%);
}

[data-theme="dark"] .keyword-row {
  background: hsl(var(--kw-hue, 0deg) 40% 20%);
  color: hsl(var(--kw-hue, 0deg) 30% 92%);
}

.keyword-label {
  flex: 0 0 250px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.keyword-bar-wrap {
  flex: 1;
  height: 16px;
  position: relative;
}

.keyword-bar {
  height: 100%;
  border-radius: 6px;
  transition: width 0.3s ease;
  background: hsl(var(--kw-hue, 0deg) 85% 45%);
}

[data-theme="dark"] .keyword-bar {
  background: hsl(var(--kw-hue, 0deg) 75% 60%);
}

.keyword-count {
  width: 70px;
  text-align: right;
  font-weight: 600;
  font-size: 0.9rem;
}

.chart-wrap {
  margin-top: 1.5rem;
  height: 400px;
  position: relative;
}

.chart-wrap canvas {
  max-height: 100%;
}

.hint {
  margin: 0.5rem 0 0;
  color: var(--pico-muted-color);
}

.toast-notification {
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@media (max-width: 640px) {
  .keyword-label {
    flex-basis: 160px;
  }
  
  .export-buttons {
    flex-direction: column;
  }
  
  .export-buttons button {
    width: 100%;
  }
}

/* Visits all-time / compare pages: theme-aware panels */
.hits-panel {
  background: var(--app-surface);
  color: var(--bs-body-color, inherit);
  border: 1px solid var(--pico-muted-border-color);
  padding: 1rem;
  border-radius: 4px;
  margin-bottom: 1.5rem;
}
.hits-panel .muted { color: var(--pico-muted-color); }
.hits-panel-strong {
  background: var(--app-surface-strong);
  border-left: 3px solid var(--pico-primary);
}
.hits-panel-empty {
  text-align: center;
  padding: 1.5rem;
  border-style: dashed;
}
.hits-panel-warn {
  background: var(--app-row-warning);
  border-left: 3px solid #f0a500;
}
.hits-panel-error {
  background: #fee;
  border-left: 3px solid #c00;
  color: #5c1010;
}
html[data-theme="dark"] .hits-panel-error {
  background: #3b1820;
  border-left-color: #f87171;
  color: #fecaca;
}
.hits-chip {
  background: var(--pico-background-color);
  color: var(--bs-body-color, inherit);
  border: 1px solid var(--pico-muted-border-color);
  padding: 0.4rem 0.8rem;
  border-radius: 20px;
  font-size: 0.9rem;
}
.hits-year-stat {
  border-left: 3px solid var(--pico-primary);
  padding-left: 0.6rem;
  min-width: 7rem;
}
.hits-input {
  background: var(--pico-background-color);
  color: var(--bs-body-color, inherit);
  border: 1px solid var(--pico-muted-border-color);
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
}
.hits-input::placeholder { color: var(--pico-muted-color); opacity: 1; }
.hits-input:focus { outline: 2px solid var(--pico-primary); outline-offset: 0; }

/* CTA Pinterest recap: full width, wrapped text so IDs and titles stay readable */
.table-container.cta-table-container { width: 100%; max-width: 100%; max-height: none; }
table.data-table.cta-table { table-layout: auto; font-size: 0.95rem; }
table.data-table.cta-table th,
table.data-table.cta-table td { white-space: normal; max-width: none; overflow: visible; text-overflow: clip; vertical-align: middle; }
table.data-table.cta-table th.cta-col-id,
table.data-table.cta-table td.cta-col-id { width: 8rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.data-table.cta-table th.cta-col-project,
table.data-table.cta-table td.cta-col-project { width: 6rem; white-space: nowrap; }
table.data-table.cta-table th.cta-col-title,
table.data-table.cta-table td.cta-col-title { width: 45%; overflow-wrap: anywhere; }
table.data-table.cta-table th.cta-col-image,
table.data-table.cta-table td.cta-col-image { width: 200px; }
table.data-table.cta-table th.cta-col-uploaded,
table.data-table.cta-table td.cta-col-uploaded { width: 12rem; white-space: nowrap; }
table.data-table.cta-table th.cta-col-status,
table.data-table.cta-table td.cta-col-status { width: 7rem; white-space: nowrap; }
table.data-table.cta-table th.cta-col-pinterest,
table.data-table.cta-table td.cta-col-pinterest { width: 8rem; text-align: center; }
.cta-counters { display: flex; gap: 0.5rem; align-items: center; }
.cta-pinterest-check { width: 1.3rem; height: 1.3rem; cursor: pointer; margin: 0; }
.cta-pinterest-meta { display: block; color: #6b7280; white-space: nowrap; }
.cta-akey-toggle { display: inline-block; margin: 0; cursor: pointer; }
.cta-akey-toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.cta-akey-pill { display: inline-block; padding: 0.4rem 0.9rem; border-radius: 999px; font-size: 0.85rem; font-weight: 600; border: 2px solid #9ca3af; background: transparent; color: #6b7280; white-space: nowrap; user-select: none; transition: background .15s, color .15s, border-color .15s; }
.cta-akey-pill::before { content: attr(data-off); }
.cta-akey-toggle:hover .cta-akey-pill { border-color: #f59e0b; }
.cta-akey-toggle input:focus-visible + .cta-akey-pill { outline: 3px solid #f59e0b; outline-offset: 2px; }
.cta-akey-toggle input:checked + .cta-akey-pill { background: #fff3cd; border-color: #f59e0b; color: #664d03; }
.cta-akey-toggle input:checked + .cta-akey-pill::before { content: attr(data-on); }
.cta-akey-toggle input:disabled + .cta-akey-pill { opacity: .6; cursor: wait; }
.cta-akey-done { display: block; margin-top: 0.3rem; font-size: 0.75rem; font-weight: 600; color: #0a3622; background: #d1e7dd; border-radius: 999px; padding: 0.1rem 0.5rem; text-align: center; }
table.data-table.cta-table th.cta-col-akey,
table.data-table.cta-table td.cta-col-akey { width: 9rem; text-align: center; }
.cta-status { display: inline-block; padding: 0.1rem 0.55rem; border-radius: 999px; font-size: 0.8rem; font-weight: 600; background: #e5e7eb; color: #374151; }
.cta-status-published { background: #d1e7dd; color: #0a3622; }
.cta-status-draft { background: #fff3cd; color: #664d03; }
.cta-status-unsynced { background: #f8d7da; color: #842029; }

/* CTA Pinterest upload form */
.cta-upload-card { padding: 1.25rem 1.5rem; margin: 1rem 0 1.5rem; }
.cta-upload-grid { display: grid; grid-template-columns: minmax(260px, 380px) 1fr; gap: 1.5rem; align-items: stretch; }
.cta-fields { display: flex; flex-direction: column; gap: 1rem; }
.cta-field { display: flex; flex-direction: column; gap: 0.35rem; }
.cta-field > label { font-weight: 600; font-size: 0.9rem; }
.cta-field select, .cta-field input[type="text"] { margin: 0; width: 100%; font-size: 1.05rem; padding: 0.6rem 0.75rem; }
.cta-submit { margin-top: auto; width: 100%; padding: 0.7rem 1rem; font-size: 1rem; }
.cta-drop-field { height: 100%; }
.cta-dropzone {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.75rem;
  flex: 1; min-height: 200px; padding: 1rem; text-align: center; cursor: pointer;
  border: 2px dashed var(--pico-muted-border-color); border-radius: var(--pico-border-radius);
  color: var(--pico-muted-color); transition: border-color .15s, background .15s;
}
.cta-dropzone:hover, .cta-dropzone:focus-within, .cta-dropzone.is-dragover {
  border-color: var(--pico-primary); background: color-mix(in oklab, var(--pico-primary), transparent 92%);
}
.cta-dropzone.has-file { border-style: solid; }
.cta-dropzone input[type="file"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.cta-dropzone img { max-height: 220px; max-width: 100%; object-fit: contain; border-radius: 4px; }
.cta-drop-text { line-height: 1.5; }
@media (max-width: 800px) { .cta-upload-grid { grid-template-columns: 1fr; } }

/* Lendra duplicates table header: theme-aware colors, centered both ways */
.dup-table thead th {
  background: #f8f9fa;
  color: #212529;
  text-align: center;
  vertical-align: middle;
}
html[data-theme="dark"] .dup-table thead th {
  background: var(--app-surface-strong);
  color: #f8fafc;
  border-color: var(--pico-muted-border-color);
}

/* Answer Key */
.ak-find-form { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end; }
.ak-find-form .cta-field { min-width: 180px; }
.ak-find-form button { margin: 0; }
.ak-step { font-size: 1rem; margin: .25rem 0 .75rem; }
.ak-group-title { font-weight: 600; font-size: .9rem; margin: .75rem 0 .4rem; }
.ak-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .6rem; margin-bottom: 1rem; }
.ak-option {
  display: flex; align-items: center; gap: .6rem; margin: 0; padding: .55rem .65rem; cursor: pointer;
  border: 1px solid var(--pico-muted-border-color); border-radius: var(--pico-border-radius);
}
.ak-option:hover { border-color: var(--pico-primary); }
.ak-option:has(input:checked) { border-color: var(--pico-primary); box-shadow: 0 0 0 2px color-mix(in oklab, var(--pico-primary), transparent 70%); }
.ak-option input[type="radio"] { margin: 0; flex: none; }
.ak-option-thumb { width: 48px; height: 48px; object-fit: cover; border-radius: 4px; background: #fff; flex: none; }
.ak-option-text { display: flex; flex-direction: column; gap: .15rem; min-width: 0; overflow-wrap: anywhere; }
.ak-option-text small { color: var(--pico-muted-color); }
.ak-selected { font-weight: 600; }
.ak-list { display: flex; flex-direction: column; gap: .5rem; margin-bottom: 1.25rem; }
.ak-item { border: 1px solid var(--pico-muted-border-color); border-radius: var(--pico-border-radius); margin: 0; }
.ak-item > summary {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: .35rem 1rem; align-items: center;
  padding: .55rem .75rem; cursor: pointer;
}
.ak-item[open] > summary { border-bottom: 1px solid var(--pico-muted-border-color); }
.ak-item.ak-highlight { border-color: var(--pico-primary); box-shadow: 0 0 0 2px color-mix(in oklab, var(--pico-primary), transparent 70%); }
.ak-summary-main { display: inline-flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.ak-summary-meta { color: var(--pico-muted-color); font-size: .85rem; }
.ak-kind { font-size: .75rem; font-weight: 600; padding: .1rem .5rem; border-radius: 999px; background: #e7f1ff; color: #084298; }
.ak-kind-new { background: #d1e7dd; color: #0a3622; }
.ak-kind-repl { background: #fff3cd; color: #664d03; }
.ak-body { padding: .75rem; }
.ak-post-title { color: var(--pico-muted-color); font-size: .9rem; margin-bottom: .6rem; }
.ak-compare .evidence-image-frame img { max-height: 60vh; }
.ak-placeholder { display: flex; align-items: center; justify-content: center; min-height: 220px; color: var(--pico-muted-color); font-style: italic; }
.ak-log { margin-top: .75rem; }
.ak-log-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: .35rem; }
.ak-pagination { display: flex; gap: .75rem; align-items: center; justify-content: center; margin: 1rem 0; }
.answer-key-badge, .answer-key-badge:hover { color: #fff !important; text-decoration: none; }
.ak-filters { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .5rem; width: 100%; }
.ak-filters label { margin: 0; }
.ak-filters input, .ak-filters select, .ak-filters button, .ak-filters a[role="button"] { width: auto; margin: 0; }
.ak-filters .spacer { flex: 1 1 auto; }
.ak-find-hint { display: block; margin-top: .75rem; }
.ak-matches { margin: .5rem 0 0; padding-left: 1.25rem; }
.ak-unique-id { font-size: .75rem; overflow-wrap: anywhere; }
.ak-caution {
  display: flex; align-items: center; gap: .75rem; margin: 0 0 1rem; padding: .75rem 1rem;
  background: #fff3cd; border: 2px solid #ffc107; border-left-width: 8px; border-radius: var(--pico-border-radius);
  color: #664d03; font-size: 1.1rem; line-height: 1.35;
}
.ak-caution-icon { font-size: 1.8rem; line-height: 1; }
.ak-caution-label {
  display: inline-block; margin-right: .5rem; padding: .05rem .5rem; border-radius: 4px;
  background: #664d03; color: #fff; font-size: .8rem; font-weight: 700; letter-spacing: .06em; vertical-align: middle;
}
[data-theme="dark"] .ak-caution { background: #3d3000; border-color: #ffc107; color: #ffe08a; }
[data-theme="dark"] .ak-caution-label { background: #ffc107; color: #212529; }

/* The selected gig card shows its source image large; the other cards stack to its right */
.ak-picker:has(.ak-option.has-thumb input:checked) {
  grid-template-columns: minmax(0, 520px) minmax(0, 1fr);
  align-items: start;
}
.ak-option.has-thumb:has(input:checked) {
  grid-column: 1; grid-row: 1 / span var(--ak-count, 1);
  display: grid; grid-template-columns: auto 1fr; align-items: start; gap: .6rem .75rem;
}
.ak-option.has-thumb:has(input:checked) input[type="radio"] { grid-area: 1 / 1; margin-top: .3rem; }
.ak-option.has-thumb:has(input:checked) .ak-option-text { grid-area: 1 / 2; font-size: 1.05rem; }
.ak-option.has-thumb:has(input:checked) .ak-option-thumb {
  grid-area: 2 / 1 / 3 / 3; width: min(100%, 480px); height: auto; max-height: 75vh; object-fit: contain;
  border: 1px solid var(--pico-muted-border-color); border-radius: var(--pico-border-radius);
}
.ak-picker:has(.ak-option.has-thumb input:checked) .ak-option:not(:has(input:checked)) { grid-column: 2; }
@media (max-width: 800px) {
  .ak-picker:has(.ak-option.has-thumb input:checked) { grid-template-columns: minmax(0, 1fr); }
  .ak-option.has-thumb:has(input:checked), .ak-picker:has(.ak-option.has-thumb input:checked) .ak-option:not(:has(input:checked)) {
    grid-column: 1; grid-row: auto;
  }
}
.ak-open-full { display: none; font-size: .85rem; }
.ak-option:has(input:checked) .ak-open-full { display: inline-block; margin-top: .35rem; }
.ak-no-source { font-style: italic; }

/* ===================== Homepage ===================== */
.home {
  --home-pbl: #2563eb;
  --home-wks: #0d9488;
  --home-other: #64748b;
  --home-tile-bg: #ffffff;
  --home-shadow: 0 6px 18px rgba(15, 23, 42, .08);
  max-width: 1200px;
  margin: 0 auto 2rem;
}
html[data-theme="dark"] .home {
  --home-pbl: #60a5fa;
  --home-wks: #2dd4bf;
  --home-other: #94a3b8;
  --home-tile-bg: #131c2e;
  --home-shadow: 0 6px 18px rgba(0, 0, 0, .35);
}
.home [hidden] { display: none !important; }

/* Buttons */
.home-btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: .38rem .8rem; margin: 0; width: auto;
  font-size: .85rem; font-weight: 500; line-height: 1.2; white-space: nowrap;
  color: var(--bs-body-color); text-decoration: none;
  background: var(--home-tile-bg);
  border: 1px solid var(--pico-muted-border-color);
  border-radius: 8px;
  transition: border-color .15s, background-color .15s;
}
.home-btn:hover { border-color: var(--pico-primary); color: var(--bs-body-color); }
.home-btn:disabled { opacity: .55; cursor: not-allowed; }
.home-btn-primary, .home-btn-primary:hover {
  background: var(--app-active); border-color: var(--app-active); color: var(--app-active-text);
}
.home-btn-primary:hover:not(:disabled) { filter: brightness(1.08); }

/* Hero */
.home-hero {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
  gap: .75rem 1.25rem;
  padding: 1rem 1.25rem; margin-bottom: .75rem;
  background: linear-gradient(135deg, var(--app-surface-strong), var(--app-surface));
  border: 1px solid var(--pico-muted-border-color);
  border-radius: 12px;
}
.home-hero h2 { margin: 0 0 .15rem; font-size: 1.5rem; font-weight: 700; display: flex; align-items: center; gap: .5rem; }
.home-hero-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; }
.home-hero-actions #refreshStatus { margin-right: .25rem; }
.home-error { margin-bottom: .75rem; }

/* PBL live check strip */
.home-live {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem 1rem;
  padding: .5rem .9rem; margin-bottom: .75rem;
  font-size: .85rem; color: var(--pico-muted-color);
  background: var(--app-surface);
  border: 1px solid var(--pico-muted-border-color);
  border-radius: 10px;
}
.home-live strong { color: var(--bs-body-color); }
.home-live-status { display: inline-flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.home-live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--home-pbl); flex: none; }
.live-actions { display: flex; gap: .5rem; align-items: center; }
.live-tip { position: relative; margin: 0; }
.live-scan-btn { font-size: .78rem; padding: .25rem .65rem; }
.live-scan-danger, .live-scan-danger:hover, .live-scan-danger:focus {
  background: #c62828; border-color: #8e0000; color: #fff; font-weight: 600;
}
.live-scan-danger:hover { filter: brightness(1.1); }
.live-tip-text {
  display: none; position: absolute; right: 0; top: 100%; margin-top: .3rem; z-index: 50;
  width: 20rem; padding: .5rem .65rem; text-align: left; font-size: .78rem; line-height: 1.35;
  background: #222; color: #f2f2f2; border-radius: 6px; box-shadow: 0 4px 14px rgba(0,0,0,.3);
}
.live-tip-text strong { color: inherit; }
.live-tip-danger { background: #5c0f0f; border: 1px solid #c62828; }
.live-tip:hover .live-tip-text, .live-tip:focus-within .live-tip-text { display: block; }

/* Summary stats */
.home-stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .75rem;
  margin-bottom: 1.25rem;
}
.home-stat {
  display: flex; flex-direction: column; gap: .15rem;
  padding: .8rem 1rem;
  background: var(--home-tile-bg);
  border: 1px solid var(--pico-muted-border-color);
  border-left: 4px solid var(--home-other);
  border-radius: 10px;
}
.home-stat-pbl { border-left-color: var(--home-pbl); }
.home-stat-wks { border-left-color: var(--home-wks); }
.home-stat-label { font-size: .72rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--pico-muted-color); }
.home-stat-value { font-size: 1.6rem; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
.home-stat-value small { font-size: .8rem; font-weight: 500; color: var(--pico-muted-color); }
.home-stat-value-sm { font-size: 1.15rem; padding: .2rem 0; }
.home-stat-sub { font-size: .8rem; color: var(--pico-muted-color); }

/* Toolbar */
.home-toolbar { display: flex; align-items: center; gap: .5rem; margin-bottom: 1.25rem; }
.home-search {
  flex: 1 1 auto; position: relative; display: flex; align-items: center; margin: 0;
  color: var(--pico-muted-color);
}
.home-search svg { position: absolute; left: .75rem; pointer-events: none; }
.home-search input {
  width: 100%; margin: 0;
  padding: .5rem .8rem .5rem 2.2rem;
  font-size: .95rem; color: var(--bs-body-color);
  background: var(--home-tile-bg);
  border: 1px solid var(--pico-muted-border-color);
  border-radius: 8px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.home-search input::placeholder { color: var(--pico-muted-color); }
.home-search input:focus {
  border-color: var(--pico-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--pico-primary) 25%, transparent);
}

/* Groups */
.home-group { margin-bottom: 1.5rem; --home-accent: var(--home-other); }
.home-group-pbl { --home-accent: var(--home-pbl); }
.home-group-wks { --home-accent: var(--home-wks); }
.home-group-title {
  display: flex; align-items: center; gap: .5rem;
  margin: 0 0 .6rem; font-size: 1rem; font-weight: 700; letter-spacing: .02em;
}
.home-group-dot { width: 10px; height: 10px; border-radius: 3px; background: var(--home-accent); }
.home-group-count { font-weight: 600; }

.home-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .75rem; }

/* Tiles */
.home-tile {
  position: relative;
  display: flex; flex-direction: column; gap: .3rem;
  min-height: 104px;
  padding: .85rem 1rem .75rem;
  background: var(--home-tile-bg);
  border: 1px solid var(--pico-muted-border-color);
  border-top: 3px solid var(--home-accent);
  border-radius: 10px;
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.home-tile:hover, .home-tile:focus-within {
  transform: translateY(-2px);
  box-shadow: var(--home-shadow);
  border-color: var(--home-accent);
}
.home-tile-name {
  font-weight: 600; font-size: .95rem; color: var(--bs-body-color); text-decoration: none;
  overflow-wrap: anywhere;
}
.home-tile-name::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.home-tile-name:focus-visible { outline: none; }
.home-tile:has(.home-tile-name:focus-visible) { outline: 2px solid var(--home-accent); outline-offset: 2px; }
.home-tile:hover .home-tile-name { color: var(--home-accent); }
.home-tile-count { font-size: 1.3rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; }
.home-tile-count small { font-size: .75rem; font-weight: 500; color: var(--pico-muted-color); }
.home-tile-meta { font-size: .75rem; color: var(--pico-muted-color); line-height: 1.3; }
.home-tile-csv {
  position: relative; z-index: 2;
  align-self: flex-end; margin-top: auto;
  padding: .15rem .5rem;
  font-size: .75rem; font-weight: 600; color: var(--pico-muted-color); text-decoration: none;
  border: 1px solid var(--pico-muted-border-color); border-radius: 6px;
  transition: color .15s, border-color .15s, background-color .15s;
}
.home-tile-csv:hover, .home-tile-csv:focus-visible {
  color: var(--home-accent); border-color: var(--home-accent);
  background: color-mix(in srgb, var(--home-accent) 10%, transparent);
}
.home-empty { text-align: center; padding: 2rem 0; }

@media (max-width: 640px) {
  .home-hero { flex-direction: column; align-items: flex-start; }
  .home-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-stat-value { font-size: 1.3rem; }
  .home-toolbar { flex-wrap: wrap; }
  .home-search { flex-basis: 100%; }
  .home-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .live-tip-text { right: auto; left: 0; width: min(20rem, 80vw); }
}
