/*
 * agrimap.css (1 October 2026): the portal's own look over Bootswatch Flatly. Ian: "make agrimap
 * portal look nicer and make the layout optimal and easy on the eye ... visually interesting as
 * well as functional", with light and dark themes as ops has. Everything is colour, type and
 * spacing; no behaviour lives here. The palette is the Tendrone family's: charcoal and gold from
 * the field app, a field green, and a warm paper background in the light theme.
 */

:root {
  --ag-charcoal: #24262b;
  --ag-charcoal-2: #2f3238;
  --ag-gold: #d7c468;
  --ag-gold-deep: #b08f2c;
  --ag-green: #3f7d4e;
  --ag-green-soft: #e4efe3;
  --ag-bg: #f4f2ec;
  --ag-bg-2: #ebe8df;
  --ag-card: #ffffff;
  --ag-ink: #1f2124;
  --ag-muted: #6b6f76;
  --ag-line: #e2dfd5;
  --ag-shadow: 0 1px 2px rgba(30, 28, 20, .05), 0 8px 24px -12px rgba(30, 28, 20, .18);
  --ag-radius: 14px;
  --bs-body-font-family: "Manrope", "Lato", system-ui, -apple-system, "Segoe UI", sans-serif;
}
[data-bs-theme="dark"] {
  --ag-bg: #17181b;
  --ag-bg-2: #1e2024;
  --ag-card: #24262b;
  --ag-ink: #e9e7df;
  --ag-muted: #a3a6ad;
  --ag-line: #363940;
  --ag-green-soft: #24352a;
  --ag-shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 28px -14px rgba(0, 0, 0, .7);
  --bs-body-bg: var(--ag-bg);
  --bs-body-color: var(--ag-ink);
  --bs-secondary-color: var(--ag-muted);
  --bs-tertiary-bg: var(--ag-bg-2);
  --bs-border-color: var(--ag-line);
  --bs-link-color: #e2cf7a;
  --bs-link-hover-color: #f0df95;
  --bs-link-color-rgb: 226, 207, 122;
  --bs-link-hover-color-rgb: 240, 223, 149;
}

html { font-size: 15px; }
@media (min-width: 992px) { html { font-size: 16px; } }

body {
  background: var(--ag-bg);
  color: var(--ag-ink);
  font-family: var(--bs-body-font-family);
  margin-bottom: 0;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 { font-weight: 700; letter-spacing: -.01em; color: var(--ag-ink); }
h1, .h1 { font-size: 2rem; }
.text-muted { color: var(--ag-muted) !important; }
.lead { font-weight: 400; }

/* ── Navbar: brand charcoal with the gold rule, same in both themes ─────────────────── */
.navbar.bg-primary {
  background: linear-gradient(180deg, var(--ag-charcoal-2), var(--ag-charcoal)) !important;
  border-bottom: 3px solid var(--ag-gold);
  padding-top: .55rem;
  padding-bottom: .55rem;
}
.navbar .navbar-brand { font-weight: 800; letter-spacing: -.01em; color: #fff; }
.navbar .navbar-brand .text-white-50 { color: var(--ag-gold) !important; font-weight: 600; }
.navbar .nav-link { color: rgba(255, 255, 255, .78); font-weight: 600; padding: .45rem .8rem; border-radius: 8px; }
.navbar .nav-link:hover, .navbar .nav-link:focus { color: #fff; background: rgba(255, 255, 255, .08); }
.navbar .nav-link.active { color: var(--ag-gold); }
.navbar .btn-outline-light { border-color: rgba(255, 255, 255, .35); font-weight: 600; border-radius: 8px; }
.navbar .btn-outline-light:hover { background: var(--ag-gold); border-color: var(--ag-gold); color: var(--ag-charcoal); }
.ag-user { color: rgba(255, 255, 255, .7) !important; font-size: .85rem; }
.ag-user:hover { color: #fff !important; }
.ag-theme-toggle {
  color: #fff; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .3);
  border-radius: 8px; width: 2.1rem; height: 2.1rem; display: inline-flex; align-items: center; justify-content: center; padding: 0;
}
.ag-theme-toggle:hover { background: rgba(255, 255, 255, .18); color: #fff; }

/* ── Cards, tables, forms, buttons ──────────────────────────────────────────────────── */
.card {
  background: var(--ag-card);
  border: 1px solid var(--ag-line);
  border-radius: var(--ag-radius);
  box-shadow: var(--ag-shadow);
  color: var(--ag-ink);
}
.card.shadow-sm { box-shadow: var(--ag-shadow) !important; }
.card-header {
  background: transparent;
  border-bottom: 1px solid var(--ag-line);
  padding: .8rem 1.1rem;
  font-weight: 700;
  color: var(--ag-ink);
}
.card-header.fw-semibold, .card-header .fw-semibold { font-weight: 700 !important; }
.card-body { padding: 1.1rem; }
.card .card { box-shadow: none; }
.card-header-tabs { margin-bottom: -.8rem; }

.table { --bs-table-bg: transparent; --bs-table-color: var(--ag-ink); --bs-table-border-color: var(--ag-line); --bs-table-hover-bg: var(--ag-bg-2); }
.table > :not(caption) > * > * { padding: .8rem .9rem; }
.table thead.table-light, .table .table-light { --bs-table-bg: var(--ag-bg-2); --bs-table-color: var(--ag-muted); }
.table thead th { font-size: .74rem; letter-spacing: .08em; text-transform: uppercase; font-weight: 700; color: var(--ag-muted); border-bottom: 1px solid var(--ag-line); }
.list-group { --bs-list-group-bg: transparent; --bs-list-group-color: var(--ag-ink); --bs-list-group-border-color: var(--ag-line); }
.list-group-item { background: transparent; color: var(--ag-ink); }

.form-control, .form-select { border-radius: 9px; border-color: var(--ag-line); background: var(--ag-card); color: var(--ag-ink); }
.form-control:focus, .form-select:focus { border-color: var(--ag-gold-deep); box-shadow: 0 0 0 .2rem rgba(215, 196, 104, .35); }
.form-control::placeholder { color: var(--ag-muted); opacity: .8; }
.form-label { font-weight: 600; font-size: .9rem; }
.input-group-text { background: var(--ag-bg-2); border-color: var(--ag-line); color: var(--ag-muted); }

.btn { border-radius: 9px; font-weight: 600; }
.btn-sm { border-radius: 8px; }
.btn-primary { --bs-btn-bg: var(--ag-charcoal); --bs-btn-border-color: var(--ag-charcoal); --bs-btn-hover-bg: #000; --bs-btn-hover-border-color: #000; --bs-btn-active-bg: #000; }
.btn-outline-primary { --bs-btn-color: var(--ag-charcoal); --bs-btn-border-color: #a9a69c; --bs-btn-hover-bg: var(--ag-charcoal); --bs-btn-hover-border-color: var(--ag-charcoal); --bs-btn-hover-color: #fff; --bs-btn-active-bg: var(--ag-charcoal); }
[data-bs-theme="dark"] .btn-primary { --bs-btn-bg: var(--ag-gold); --bs-btn-border-color: var(--ag-gold); --bs-btn-color: var(--ag-charcoal); --bs-btn-hover-bg: #e6d57f; --bs-btn-hover-border-color: #e6d57f; --bs-btn-hover-color: var(--ag-charcoal); --bs-btn-active-bg: #e6d57f; --bs-btn-active-color: var(--ag-charcoal); }
[data-bs-theme="dark"] .btn-outline-primary { --bs-btn-color: var(--ag-ink); --bs-btn-border-color: #5a5e66; --bs-btn-hover-bg: var(--ag-gold); --bs-btn-hover-border-color: var(--ag-gold); --bs-btn-hover-color: var(--ag-charcoal); --bs-btn-active-bg: var(--ag-gold); --bs-btn-active-color: var(--ag-charcoal); }
.btn-secondary { --bs-btn-bg: var(--ag-charcoal-2); --bs-btn-border-color: var(--ag-charcoal-2); --bs-btn-hover-bg: var(--ag-charcoal); --bs-btn-hover-border-color: var(--ag-charcoal); }
/* Dark theme: a "selected" secondary button (the map's view and picture buttons) is gold, as the primary is. */
[data-bs-theme="dark"] .btn-secondary, [data-bs-theme="dark"] .ag-toolbar .btn-group .btn-secondary { --bs-btn-bg: var(--ag-gold); --bs-btn-border-color: var(--ag-gold); --bs-btn-color: var(--ag-charcoal); --bs-btn-hover-bg: #e6d57f; --bs-btn-hover-border-color: #e6d57f; --bs-btn-hover-color: var(--ag-charcoal); --bs-btn-active-bg: #e6d57f; --bs-btn-active-color: var(--ag-charcoal); }
/* Text links in gold; :where keeps the specificity at a bare "a", so buttons, nav links and Leaflet's own links keep theirs. */
a:where(:not(.btn, .nav-link, .navbar-brand, .guide-info, .ag-user, .badge, .leaflet-container *)) { color: var(--ag-gold-deep); }
a:where(:not(.btn, .nav-link, .navbar-brand, .guide-info, .ag-user, .badge, .leaflet-container *)):hover { color: #8f7320; }
[data-bs-theme="dark"] a:where(:not(.btn, .nav-link, .navbar-brand, .guide-info, .ag-user, .badge, .leaflet-container *)) { color: #e2cf7a; }
[data-bs-theme="dark"] a:where(:not(.btn, .nav-link, .navbar-brand, .guide-info, .ag-user, .badge, .leaflet-container *)):hover { color: #f0df95; }
.btn-outline-secondary { --bs-btn-color: var(--ag-ink); --bs-btn-border-color: var(--ag-line); --bs-btn-hover-bg: var(--ag-bg-2); --bs-btn-hover-border-color: #b9b5aa; --bs-btn-hover-color: var(--ag-ink); --bs-btn-active-bg: var(--ag-charcoal-2); --bs-btn-active-border-color: var(--ag-charcoal-2); }
[data-bs-theme="dark"] .btn-outline-secondary { --bs-btn-border-color: #4a4e56; --bs-btn-hover-border-color: #6a6e76; }
.btn-success, .btn-outline-success { --bs-btn-bg: var(--ag-green); --bs-btn-border-color: var(--ag-green); --bs-btn-hover-bg: #336840; --bs-btn-hover-border-color: #336840; --bs-btn-active-bg: #336840; }
.btn-outline-success { --bs-btn-bg: transparent; --bs-btn-color: var(--ag-green); --bs-btn-hover-color: #fff; }
.btn-group-sm > .btn { padding: .3rem .7rem; }
.badge { border-radius: 999px; font-weight: 600; padding: .4em .7em; }
.badge.bg-success { background: var(--ag-green) !important; }
.badge.bg-secondary { background: #8a8e95 !important; }
.badge.bg-info { background: var(--ag-gold-deep) !important; }
.alert { border-radius: 12px; }
.nav-tabs { --bs-nav-tabs-border-color: var(--ag-line); --bs-nav-tabs-link-active-bg: var(--ag-card); --bs-nav-tabs-link-active-color: var(--ag-ink); --bs-nav-tabs-link-active-border-color: var(--ag-line) var(--ag-line) var(--ag-card); }
.nav-tabs .nav-link { color: var(--ag-muted); font-weight: 600; }
.modal-content { background: var(--ag-card); color: var(--ag-ink); border: 1px solid var(--ag-line); border-radius: var(--ag-radius); }
.modal-header, .modal-footer { border-color: var(--ag-line); }
.dropdown-menu { background: var(--ag-card); border-color: var(--ag-line); }
hr { border-color: var(--ag-line); opacity: 1; }
dl.row dt { color: var(--ag-muted); font-weight: 600; font-size: .9rem; }

/* ── Page headers and the stat strip ────────────────────────────────────────────────── */
.ag-page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 1rem; margin: 1.6rem 0 1.2rem; }
.ag-page-head h1 { margin-bottom: .25rem; }
.ag-page-head .ag-sub { color: var(--ag-muted); margin: 0; }
.ag-eyebrow { font-size: .74rem; letter-spacing: .12em; text-transform: uppercase; font-weight: 700; color: var(--ag-gold-deep); margin-bottom: .35rem; }
.ag-stats { display: flex; flex-wrap: wrap; gap: 0; background: var(--ag-card); border: 1px solid var(--ag-line); border-radius: var(--ag-radius); box-shadow: var(--ag-shadow); overflow: hidden; }
.ag-stat { padding: .7rem 1.2rem; min-width: 8.5rem; border-left: 1px solid var(--ag-line); }
.ag-stat:first-child { border-left: 0; }
.ag-stat .ag-stat-label { font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ag-muted); font-weight: 700; }
.ag-stat .ag-stat-value { font-size: 1.25rem; font-weight: 800; color: var(--ag-ink); line-height: 1.25; }
.ag-stat .ag-stat-value.small { font-size: 1rem; }

/* ── Survey list: a calendar tile per row ───────────────────────────────────────────── */
.ag-date { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; width: 3.2rem; padding: .3rem 0; border-radius: 10px; background: var(--ag-bg-2); border: 1px solid var(--ag-line); line-height: 1.05; }
.ag-date .d { font-size: 1.15rem; font-weight: 800; color: var(--ag-ink); }
.ag-date .m { font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ag-muted); font-weight: 700; }
.ag-date .y { font-size: .66rem; color: var(--ag-muted); }
.ag-title { font-weight: 700; }
.ag-row-sub { color: var(--ag-muted); font-size: .85rem; }

/* ── Survey page ────────────────────────────────────────────────────────────────────── */
.ag-meta { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .4rem; }
.ag-chip { display: inline-flex; align-items: center; gap: .35rem; padding: .25rem .7rem; border-radius: 999px; background: var(--ag-card); border: 1px solid var(--ag-line); font-size: .85rem; color: var(--ag-ink); }
.ag-chip .ag-chip-k { color: var(--ag-muted); }
.ag-toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .6rem 1.1rem; padding: .6rem 1rem .55rem; }
.ag-tool { display: flex; flex-direction: column; gap: .2rem; }
.ag-tool-label { font-size: .66rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ag-muted); font-weight: 700; padding-left: .1rem; }
.ag-tool .btn-group-sm > .btn, .ag-tool > .btn { padding: .32rem .75rem; }
.ag-tool-right { margin-left: auto; display: flex; align-items: flex-end; gap: .6rem; }
.ag-toolbar .btn-group .btn-secondary { --bs-btn-bg: var(--ag-charcoal); --bs-btn-border-color: var(--ag-charcoal); }
.ag-toolbar .btn-success { --bs-btn-bg: var(--ag-green); --bs-btn-border-color: var(--ag-green); }
.ag-toolbar input[type="range"] { accent-color: var(--ag-gold-deep); }
#map { height: 72vh !important; min-height: 420px; }
.ag-side .nav-pills { background: var(--ag-bg-2); border-radius: 11px; padding: .3rem; gap: .25rem; margin: 0 0 .25rem; }
.ag-side .nav-pills .nav-link { color: var(--ag-muted); font-weight: 700; border-radius: 8px; padding: .5rem .6rem; font-size: .92rem; text-align: center; }
.ag-side .nav-pills .nav-link:hover { color: var(--ag-ink); }
.ag-side .nav-pills .nav-link.active { background: var(--ag-card); color: var(--ag-ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.ag-side .card-header { padding: .8rem .8rem .55rem; border-bottom: 0; }
.ag-side .text-uppercase.fw-semibold { font-size: .72rem !important; letter-spacing: .1em; color: var(--ag-gold-deep) !important; padding-left: .55rem; border-left: 3px solid var(--ag-gold); line-height: 1.3; margin-bottom: .45rem !important; }
.ag-side .card-body > .card { border-radius: 11px; margin-bottom: 1rem !important; }
.ag-side .card-body > .card .card-header { border-bottom: 1px solid var(--ag-line); padding: .7rem .9rem; }
.ag-side .card-body > .card:last-child { margin-bottom: 0 !important; }
#coords { border-radius: 6px !important; }
#ndvi-legend, #vegetation-legend { border-radius: 10px !important; background: rgba(36, 38, 43, .82) !important; backdrop-filter: blur(3px); }
.leaflet-container { font-family: var(--bs-body-font-family); background: var(--ag-bg-2); }
.leaflet-bar a { color: var(--ag-charcoal); }
.leaflet-popup-content-wrapper { border-radius: 10px; }
.also-available .card { opacity: .85; background: var(--ag-bg-2); }
.also-available .card:hover { opacity: 1; }

/* ── Home and sign-in: the field-pattern hero ───────────────────────────────────────── */
.ag-hero {
  position: relative; overflow: hidden; border-radius: var(--ag-radius); margin-top: 1.5rem;
  background: linear-gradient(135deg, #1f2a22 0%, #2a3a2c 55%, #3a4a30 100%);
  color: #fff; padding: 4.5rem 1.5rem; text-align: center; box-shadow: var(--ag-shadow);
}
.ag-hero::before {
  content: ""; position: absolute; inset: 0;
  background: repeating-linear-gradient(118deg, rgba(255, 255, 255, 0) 0 22px, rgba(215, 196, 104, .12) 22px 24px, rgba(255, 255, 255, 0) 24px 54px, rgba(255, 255, 255, .05) 54px 56px);
  pointer-events: none;
}
.ag-hero::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 120vw; height: 120vw; max-width: 1400px; max-height: 1400px;
  transform: translate(-50%, -50%); border-radius: 50%;
  background: radial-gradient(closest-side, rgba(215, 196, 104, .18), rgba(215, 196, 104, 0) 70%);
  pointer-events: none;
}
.ag-hero > * { position: relative; z-index: 1; }
.ag-hero .ag-eyebrow { color: var(--ag-gold); }
.ag-hero h1 { color: #fff; font-size: clamp(2rem, 4.5vw, 3.2rem); font-weight: 800; letter-spacing: -.02em; }
.ag-hero .lead { color: rgba(255, 255, 255, .8); max-width: 38rem; margin: 0 auto 1.6rem; }
.ag-hero .btn-primary { --bs-btn-bg: var(--ag-gold); --bs-btn-border-color: var(--ag-gold); --bs-btn-color: var(--ag-charcoal); --bs-btn-hover-bg: #e6d57f; --bs-btn-hover-border-color: #e6d57f; --bs-btn-hover-color: var(--ag-charcoal); padding: .8rem 2rem; font-size: 1.05rem; }
.ag-features { margin: 1.6rem 0 2rem; }
.ag-feature { height: 100%; padding: 1.4rem 1.3rem; }
.ag-feature .ag-ico { width: 2.9rem; height: 2.9rem; border-radius: 12px; background: var(--ag-green-soft); color: var(--ag-green); display: inline-flex; align-items: center; justify-content: center; margin-bottom: .8rem; }
.ag-feature .ag-ico svg { width: 1.4rem; height: 1.4rem; }
.ag-feature h6 { font-weight: 700; margin-bottom: .3rem; }
.ag-signin { max-width: 26rem; margin: 2.5rem auto; }
.ag-signin .ag-mark { width: 3.2rem; height: 3.2rem; border-radius: 12px; background: var(--ag-charcoal); color: var(--ag-gold); display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1.1rem; margin-bottom: .8rem; border-bottom: 3px solid var(--ag-gold); }

/* ── Footer ─────────────────────────────────────────────────────────────────────────── */
footer.footer { border-top: 1px solid var(--ag-line) !important; margin-top: 2.5rem !important; font-size: .85rem; color: var(--ag-muted) !important; }
footer.footer .container { padding-top: 1rem !important; padding-bottom: 1.2rem !important; }

/* ── Guides and odds and ends ───────────────────────────────────────────────────────── */
.guide-info { border-color: var(--ag-gold-deep); color: var(--ag-gold-deep); background: var(--ag-card); }
.guide-info:hover, .guide-info:focus-visible { background: var(--ag-gold-deep); color: #fff; }
.guide-toc .list-group-item a { color: var(--ag-ink); text-decoration: none; }
.guide-toc .list-group-item a:hover { color: var(--ag-gold-deep); }
.btn-close { filter: none; }
[data-bs-theme="dark"] .btn-close { filter: invert(1) grayscale(100%) brightness(200%); }
[data-bs-theme="dark"] .form-control, [data-bs-theme="dark"] .form-select { background: var(--ag-bg-2); }
[data-bs-theme="dark"] .text-dark { color: var(--ag-ink) !important; }
[data-bs-theme="dark"] .bg-light { background: var(--ag-bg-2) !important; }
[data-bs-theme="dark"] .border-top { border-color: var(--ag-line) !important; }
[data-bs-theme="dark"] .table thead.table-light th { color: var(--ag-muted); }
[data-bs-theme="dark"] .vc-hist { filter: invert(1) hue-rotate(180deg); }
@media (max-width: 991.98px) {
  #map { height: 60vh !important; }
  .ag-stat { min-width: 7rem; padding: .55rem .9rem; }
}

/* ── Full screen (3 October 2026): the survey block with its toolbar and side panel ── */
.ag-survey:fullscreen { background: var(--ag-bg); margin: 0; padding: .75rem; overflow: auto; width: 100%; height: 100%; }
.ag-survey:fullscreen > .col-lg-8 { flex: 0 0 auto; width: calc(100% - 380px); }
.ag-survey:fullscreen > .ag-side { flex: 0 0 auto; width: 380px; max-height: calc(100vh - 1.5rem); overflow: auto; order: 2; }
.ag-survey:fullscreen #map { height: calc(100vh - 6.5rem) !important; min-height: 0; }
.ag-survey:fullscreen #btn-exit-fullscreen { display: none !important; }
@media (max-width: 991.98px) {
  .ag-survey:fullscreen > .col-lg-8, .ag-survey:fullscreen > .ag-side { width: 100%; max-height: none; }
  .ag-survey:fullscreen #map { height: 60vh !important; }
}

/* ── Photo annotations (15 November 2026, work spec 22): boxes drawn in ops, shown over the
      photo in the job page's lightbox with their numbered list. --ag-box is set per box by the
      script: Urgent red, Monitor amber, Info grey, no severity the brand yellow. ── */
.gallery-link { position: relative; display: block; }
.ag-marked {
  position: absolute; top: .5rem; left: .5rem;
  background: var(--ag-charcoal); color: var(--ag-gold); border: 1px solid var(--ag-gold);
  border-radius: 999px; padding: .15rem .6rem; font-size: .75rem; font-weight: 700; line-height: 1.4;
}
.lightbox-body { display: flex; align-items: center; justify-content: center; gap: 1rem; max-width: 96vw; }
.lightbox-stage { position: relative; line-height: 0; flex: 0 1 auto; min-width: 0; }
.lightbox.has-notes .lightbox-stage img { max-width: calc(94vw - 350px); max-height: 80vh; }
.lightbox-boxes { position: absolute; inset: 0; }
.lightbox-boxes[hidden] { display: none; }

.lightbox .ag-box {
  position: absolute; box-sizing: border-box; padding: 0; margin: 0; width: auto; height: auto;
  background: transparent; border: 3px solid var(--ag-box, #FFD600); border-radius: 0; cursor: pointer;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .75), inset 0 0 0 1px rgba(0, 0, 0, .75);
  font-size: 1rem; line-height: 1;
}
.lightbox .ag-box:hover { background: rgba(255, 255, 255, .08); }
.lightbox .ag-box.is-active { background: rgba(255, 255, 255, .16); box-shadow: 0 0 0 1px rgba(0, 0, 0, .75), inset 0 0 0 1px rgba(0, 0, 0, .75), 0 0 0 5px rgba(255, 255, 255, .7); }
.ag-box-num {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 1.6rem; height: 1.6rem; padding: 0 .3rem; border-radius: 1rem;
  background: var(--ag-box, #FFD600); color: #fff; font-weight: 700; font-size: .9rem; line-height: 1;
  border: 1.5px solid rgba(0, 0, 0, .85);
  text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000, 0 0 2px #000;
}
.ag-box > .ag-box-num { position: absolute; left: 0; top: 0; transform: translate(-50%, -50%); pointer-events: none; }

.lightbox-notes {
  flex: 0 0 330px; max-width: 330px; max-height: 80vh; overflow-y: auto; text-align: left; line-height: 1.4;
  background: var(--ag-card); color: var(--ag-ink); border: 1px solid var(--ag-line); border-radius: var(--ag-radius); padding: .9rem;
}
.lightbox-notes[hidden] { display: none; }
.lightbox-notes-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .6rem; }
.lightbox .lightbox-toggle, .lightbox .lightbox-toggle:hover {
  background: transparent; color: var(--ag-ink); border: 1px solid var(--ag-line); border-radius: 8px;
  font-size: .8rem; font-weight: 600; padding: .2rem .6rem; cursor: pointer;
}
.lightbox .lightbox-toggle:hover { background: var(--ag-bg-2); }
.lightbox-notes-list { list-style: none; margin: 0; padding: 0; }
.lightbox-notes-list li {
  display: flex; gap: .6rem; align-items: flex-start; padding: .5rem; border-radius: 10px; cursor: pointer;
  border-left: 4px solid var(--ag-box, #FFD600); margin-bottom: .35rem; background: var(--ag-bg-2);
}
.lightbox-notes-list li.is-active { background: var(--ag-green-soft); outline: 2px solid var(--ag-gold-deep); }
.lightbox-notes-list .ag-box-num { flex: 0 0 auto; }
.lightbox-notes-sev { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ag-muted); }
.lightbox-notes-text { font-size: .9rem; color: var(--ag-muted); white-space: pre-line; overflow-wrap: anywhere; }
.lightbox .lightbox-caption form[hidden] { display: none !important; }

/* The photo's stage is positioned for the boxes, so the round buttons need lifting above it. */
.lightbox .lightbox-close, .lightbox .lightbox-prev, .lightbox .lightbox-next { z-index: 3; }

/* On a phone the list goes below the photo, and both share the height. */
@media (max-width: 767.98px) {
  .lightbox.has-notes .lightbox-prev, .lightbox.has-notes .lightbox-next { top: 34%; }
  .lightbox.has-notes .lightbox-body { flex-direction: column; gap: .5rem; }
  .lightbox.has-notes .lightbox-stage img { max-width: 96vw; max-height: 44vh; }
  .lightbox-notes { flex: 0 1 auto; width: 96vw; max-width: 96vw; max-height: 30vh; padding: .6rem; }
  .lightbox.has-notes .lightbox-caption { font-size: .8rem; bottom: 6px; }
}
