/* Customer Portal — app styles on top of ui/v1 (tokens come from _brand_style.html). */

.skip-link {
  position: fixed;
  top: 8px;
  left: 12px;
  z-index: 2000;
  padding: 9px 14px;
  border-radius: var(--radius);
  color: var(--color-primary);
  background: #fff;
  box-shadow: var(--shadow-lg);
  font-weight: 700;
  transform: translateY(-160%);
  transition: transform .15s ease;
}
.skip-link:focus { transform: translateY(0); }
#main-content:focus { outline: none; }
a:focus-visible,
summary:focus-visible,
.link-btn:focus-visible,
.tab:focus-visible,
.footer-feedback:focus-visible {
  outline: 2px solid var(--brand-accent);
  outline-offset: 3px;
  border-radius: 4px;
}
.nav a:focus-visible,
.nav .link-btn:focus-visible { outline-color: #fff; }

.nav-brand { display: inline-flex; align-items: center; gap: 8px; }
.nav-logo { height: 28px; width: auto; display: block; }
.nav-logo-light {
  height: 36px;
  background: #fff;
  border-radius: 6px;
  padding: 4px 8px;
}
.staff-tag { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; background: rgba(255,255,255,.16); color: #fff; padding: 2px 6px; border-radius: 4px; }
.nav-form { display: inline; margin: 0; }
.link-btn { background: none; border: 0; color: #cbd5e1; font: inherit; font-size: var(--fs-base); cursor: pointer; padding: 4px 0; }
.link-btn:hover { color: #fff; }

/* Bolder, easier-to-scan top tabs (overrides ui/v1 .nav-links a) */
.nav-links { gap: 6px; }
.nav-links a {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: .01em;
  padding: 6px 10px;
  border-radius: 6px;
  color: #e2e8f0;
}
.nav-links a:hover { color: #fff; background: rgba(255,255,255,.1); }
.nav-links a.active { color: #fff; background: rgba(255,255,255,.18); }
.nav-links a.nav-home { font-weight: 800; }
.nav-links a.nav-updates { display: inline-flex; align-items: center; gap: 6px; }
.nav-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: var(--radius-pill);
  background: var(--brand-accent);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 0 0 2px rgba(255,255,255,.18);
}

body.face-customer { background: #d7ebf6; }
body.face-customer .container { background: transparent; }

.home-brand {
  display: flex;
  align-items: center;
  gap: 20px;
  margin: 8px 0 28px;
  flex-wrap: wrap;
}
.home-logo { max-height: 88px; width: auto; display: block; }
.home-product { font-size: clamp(1.75rem, 3vw, 2.4rem); font-weight: 800; line-height: 1.15; color: var(--color-primary); margin: 0; }
.home-company { font-size: clamp(1.15rem, 2vw, 1.45rem); font-weight: 700; color: var(--color-primary); margin: 4px 0 0; opacity: .85; }
.home-welcome { margin: 8px 0 0; }
.issues-card { border-left: 4px solid var(--color-danger, #dc2626); }
.issues-table td { vertical-align: top; }
.card-secondary { opacity: .92; }
.card-secondary .card-title { font-weight: 600; color: var(--color-text-muted); }

.chip-im { background: #dbeafe; color: #1e3a8a; font-weight: 700; }
.chip-cp { font-weight: 700; }
.chip-cp-galvanic { background: #fef3c7; color: #92400e; }
.chip-cp-impressed { background: #ede9fe; color: #5b21b6; }
.chip-cp-both { background: #fce7f3; color: #9d174d; }

.cp-callout {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 16px;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 15px;
  line-height: 1.4;
  flex-wrap: wrap;
}
.cp-callout-galvanic { background: #fef3c7; color: #78350f; border: 1px solid #f59e0b; }
.cp-callout-impressed { background: #ede9fe; color: #4c1d95; border: 1px solid #7c3aed; }
.cp-callout-both { background: #fce7f3; color: #9d174d; border: 1px solid #db2777; }

th[data-sort] a { color: inherit; text-decoration: none; }
th[data-sort] a:hover { color: var(--color-primary); }

.btn-accent { background: var(--brand-accent); border-color: var(--brand-accent); color: #fff; }
.btn-accent:hover { background: var(--brand-accent-hover); border-color: var(--brand-accent-hover); color: #fff; text-decoration: none; }

.auth-wrap { max-width: 440px; margin: 40px auto; }
.auth-card h1 { font-size: var(--fs-xl); margin: 8px 0 4px; }
.auth-card .brand-mark { font-size: var(--fs-md); font-weight: 700; color: var(--color-primary); }
.auth-card .brand-logo { max-height: 48px; width: auto; display: block; margin-bottom: 12px; }
.brand-logo { max-height: 56px; width: auto; display: block; margin: 6px 0; }

.inline-form { display: inline; margin: 0 4px 0 0; }

.toast-host { position: fixed; top: 72px; right: 16px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, 92vw); }
.toast { padding: 10px 14px; border-radius: 8px; font-size: 13px; line-height: 1.4; color: #0f172a; background: #fff;
  border: 1px solid var(--color-border); border-left: 3px solid #94a3b8; box-shadow: 0 8px 24px rgba(15,23,42,.14);
  cursor: pointer; opacity: 0; transform: translateY(-6px); transition: opacity .2s, transform .2s; }
.toast.is-in { opacity: 1; transform: translateY(0); }
.toast-ok { border-left-color: var(--color-success); }
.toast-warn { border-left-color: var(--color-warning); background: var(--color-warning-bg); }
.toast-error { border-left-color: var(--color-danger); background: var(--color-danger-bg); }

/* --- v0.2: sub-header + site switcher --------------------------------------- */
.subbar { background: var(--color-surface); border-bottom: 1px solid var(--color-border); }
.subbar-inner { max-width: var(--container-max); margin: 0 auto; padding: 8px var(--container-pad-x); display: flex; align-items: center; gap: var(--space-4); flex-wrap: wrap; }
.subbar-account { font-weight: 600; color: var(--color-primary); }
.site-switcher { display: flex; gap: var(--space-2); flex: 1 1 320px; max-width: 640px; margin-left: auto; }
.site-switcher .form-control { height: 36px; padding: 0 10px; font-size: var(--fs-sm); }
.site-switcher .fb-search { flex: 0 1 180px; min-width: 0; }
.site-switcher .fb-search::before { left: 10px; }
.site-switcher .switcher-filter { padding-left: 32px; }
.site-switcher .switcher-select { flex: 1 1 200px; min-width: 0; padding-right: 28px; }
@media (max-width: 768px) {
  .subbar-inner { padding: 8px var(--space-3); }
  .site-switcher { flex: 1 1 100%; margin-left: 0; }
}

/* --- Filter toolbars (list pages, map, calendar) ----------------------------------
   Native <select> / <input type="search"> in .filter-bar have no .form-control class,
   so they render as plain OS widgets. These rules give every toolbar — and every
   select.form-control — the same height, border, chevron and search icon. */
select.form-control:not([multiple]) {
  appearance: none;
  -webkit-appearance: none;
  background-color: var(--color-surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' viewBox='0 0 12 12'%3E%3Cpath stroke='%234b5563' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' d='M2.5 4.5 6 8 9.5 4.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 12px;
  padding-right: 30px;
}
select.form-control:not([multiple])::picker-icon { display: none; }
select.form-control-sm:not([multiple]) {
  padding-right: 22px;
  background-position: right 6px center;
  background-size: 10px;
}
.fb-search {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1 1 200px;
  min-width: 160px;
}
.fb-search::before {
  content: "";
  position: absolute;
  left: 12px;
  width: 16px;
  height: 16px;
  pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' viewBox='0 0 16 16'%3E%3Ccircle cx='6.75' cy='6.75' r='4.25' stroke='%2364748b' stroke-width='1.6'/%3E%3Cpath stroke='%2364748b' stroke-width='1.6' stroke-linecap='round' d='M10.2 10.2 13.25 13.25'/%3E%3C/svg%3E") no-repeat center;
  background-size: 16px;
}
.fb-search > input {
  width: 100%;
  padding-left: 36px;
}
.field .fb-search,
.form-group .fb-search {
  flex: none;
  display: block;
  margin-bottom: var(--space-2);
}

.filter-bar:not(.inline-bar) {
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  margin-bottom: var(--space-4);
  background: color-mix(in srgb, var(--color-primary) 4%, var(--color-surface));
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--brand-accent);
  border-radius: var(--radius-md);
}
.filter-bar:not(.inline-bar) > input:not([type="hidden"]):not([type="checkbox"]):not([type="file"]),
.filter-bar:not(.inline-bar) > select,
.filter-bar:not(.inline-bar) > .form-control,
.filter-bar:not(.inline-bar) > .fb-search > input {
  box-sizing: border-box;
  height: 40px;
  margin: 0;
  padding: 0 12px;
  font-family: inherit;
  font-size: 16px;
  line-height: 1.25;
  color: var(--color-text);
  background-color: var(--color-surface);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius);
  transition: border-color 0.12s, box-shadow 0.12s, background-color 0.12s;
}
.filter-bar:not(.inline-bar) > input:not([type="hidden"]):not([type="checkbox"]):not([type="file"]):focus,
.filter-bar:not(.inline-bar) > select:focus,
.filter-bar:not(.inline-bar) > .form-control:focus,
.filter-bar:not(.inline-bar) > .fb-search > input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: var(--focus-ring);
}
.filter-bar:not(.inline-bar) > select {
  appearance: none;
  -webkit-appearance: none;
  width: auto;
  min-width: 140px;
  padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' viewBox='0 0 12 12'%3E%3Cpath stroke='%234b5563' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' d='M2.5 4.5 6 8 9.5 4.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 12px;
  cursor: pointer;
}
.filter-bar:not(.inline-bar) > select::picker-icon { display: none; }
.filter-bar:not(.inline-bar) > select:has(option:checked:not([value=""])) {
  border-color: color-mix(in srgb, var(--color-primary) 45%, var(--color-border-strong));
  background-color: color-mix(in srgb, var(--color-primary) 6%, var(--color-surface));
}
.filter-bar:not(.inline-bar) > .fb-search {
  flex: 1 1 200px;
  min-width: 160px;
}
.filter-bar:not(.inline-bar) > .fb-search > input[type="search"],
.filter-bar:not(.inline-bar) > .fb-search > input[type="text"] {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  padding-left: 36px;
}
.filter-bar:not(.inline-bar) > input[type="search"],
.filter-bar:not(.inline-bar) > input[type="text"] {
  flex: 1 1 200px;
  min-width: 160px;
}
.filter-bar:not(.inline-bar) > input[type="search"] {
  padding-left: 36px;
}
.filter-bar:not(.inline-bar) > .fb-search > input:not(:placeholder-shown),
.filter-bar:not(.inline-bar) > input[type="search"]:not(:placeholder-shown),
.filter-bar:not(.inline-bar) > input[type="text"]:not(:placeholder-shown) {
  border-color: color-mix(in srgb, var(--color-primary) 45%, var(--color-border-strong));
}
.filter-bar input[type="search"]::-webkit-search-decoration,
.filter-bar input[type="search"]::-webkit-search-results-button {
  -webkit-appearance: none;
}
.filter-bar:not(.inline-bar) > input[type="date"],
.filter-bar:not(.inline-bar) > input.fb-fixed {
  flex: 0 1 auto;
}
.filter-bar:not(.inline-bar) > input[type="file"] {
  display: inline-flex;
  align-items: center;
  box-sizing: border-box;
  min-height: 40px;
  margin: 0;
  padding: 6px 8px;
  font-family: inherit;
  font-size: var(--fs-sm);
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px dashed var(--color-border-strong);
  border-radius: var(--radius);
}
.filter-bar:not(.inline-bar) > input[type="file"]:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: var(--focus-ring);
}
.filter-bar:not(.inline-bar) > .form-control {
  width: auto;
  min-width: 180px;
  flex: 0 1 auto;
}
.filter-bar:not(.inline-bar) > label:not(.fb-check) {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  white-space: nowrap;
}
.filter-bar:not(.inline-bar) > .btn:not(.btn-sm) { height: 40px; min-height: 40px; padding-top: 0; padding-bottom: 0; }
.filter-bar:not(.inline-bar) > .btn-sm,
.filter-bar:not(.inline-bar) > .btn-ghost { align-self: center; }
.filter-bar.inline-bar {
  display: inline-flex;
  margin: 0;
  padding: 0;
  background: none;
  border: 0;
}
.filter-bar.inline-bar > select {
  appearance: none;
  -webkit-appearance: none;
  height: 32px;
  padding: 0 28px 0 10px;
  font: inherit;
  font-size: var(--fs-sm);
  color: var(--color-text);
  background-color: var(--color-surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' viewBox='0 0 12 12'%3E%3Cpath stroke='%234b5563' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' d='M2.5 4.5 6 8 9.5 4.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 10px;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius);
}
.filter-bar.inline-bar > select::picker-icon { display: none; }

.filter-card {
  border-left: 3px solid var(--brand-accent);
}
.filter-card .form-grid { margin-bottom: 0; }
.filter-card .field > label,
.filter-card .form-group label,
.filter-card label.form-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}
.filter-card .form-actions { margin-top: var(--space-3); }

/* --- demo + preview banners ---------------------------------------------------- */
.demo-banner { background: #1e3a5f; color: #e0f2fe; border-bottom: 1px solid #0c4a6e; padding: 8px var(--container-pad-x); display: flex; align-items: center; justify-content: center; gap: var(--space-3); font-size: var(--fs-sm); flex-wrap: wrap; text-align: center; }
.demo-banner strong { letter-spacing: .02em; }
.demo-banner-detail { color: #bae6fd; }
.demo-banner-feedback {
  background: none; border: 0; padding: 0; font: inherit; font-size: inherit;
  color: #fff; text-decoration: underline; text-underline-offset: 2px; cursor: pointer;
}
.demo-banner-feedback:hover { color: #e0f2fe; }
.preview-banner { background: var(--color-warning-bg); color: var(--color-warning-fg); border-bottom: 1px solid #fde68a; padding: 8px var(--container-pad-x); display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); font-size: var(--fs-sm); flex-wrap: wrap; }

/* --- tabs ------------------------------------------------------------------------ */
/* overflow:hidden (not auto): overflow-x:auto forces overflow-y to auto too, and the
   active tab's -2px underline then shows a scrollbar on the nav. Wrap instead of scroll. */
.tabs { display: flex; flex-wrap: wrap; gap: 2px; overflow: hidden; border-bottom: 2px solid var(--color-border); margin-bottom: var(--space-4); }
.tab { padding: 8px 12px; white-space: nowrap; color: var(--color-text-muted); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -2px; font-weight: 500; }
button.tab { background: none; border: 0; cursor: pointer; font: inherit; font-size: inherit; }
.tab:hover { color: var(--color-text); text-decoration: none; }
.tab.active { color: var(--color-primary); border-bottom-color: var(--brand-accent); }
.tab:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.tab-group { display: inline-flex; flex-wrap: wrap; }
.tab-group + .tab-group { margin-left: 6px; padding-left: 8px; border-left: 1px solid var(--color-border); }
.site-tab-picker { display: none; margin: 0 0 var(--space-4); }
.site-tab-picker select { width: 100%; min-height: 44px; }
/* Phones swap only the (long, grouped) site-section tabs for the <select> picker; every other
   .tabs bar (account form, office queues, How it works) stays and scrolls sideways. */
@media (max-width: 768px) {
  .tabs.site-tabs { display: none; }
  .site-tab-picker { display: block; }
}

/* --- accordion (customer equipment) + chips --------------------------------------- */
.acc { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md); margin-bottom: var(--space-3); }
.acc > summary { cursor: pointer; padding: 12px var(--space-4); font-weight: 600; list-style: none; display: flex; align-items: center; gap: var(--space-2); }
.acc > summary::-webkit-details-marker { display: none; }
.acc > summary::before { content: "▸"; color: var(--color-text-subtle); font-size: 12px; transition: transform .15s; }
.acc[open] > summary::before { transform: rotate(90deg); }
.acc .table-wrap { border: 0; border-top: 1px solid var(--color-border); border-radius: 0 0 var(--radius-md) var(--radius-md); }
.count { display: inline-block; min-width: 22px; padding: 1px 7px; border-radius: var(--radius-pill); background: var(--color-info-bg); color: var(--color-info-fg); font-size: var(--fs-xs); font-weight: 600; text-align: center; margin-left: 4px; }
.chip { display: inline-block; padding: 2px 8px; border-radius: var(--radius-pill); background: #f3f4f6; color: var(--color-text-muted); font-size: var(--fs-xs); white-space: nowrap; }
.chip-ok { background: var(--color-success-bg); color: var(--color-success-fg); }
.chip-sample { background: #fff; color: #6b7280; border: 1px dashed #9ca3af; letter-spacing: 0.04em; text-transform: uppercase; font-size: 10px; vertical-align: middle; }

/* --- equipment editor (staff) ------------------------------------------------------- */
.eq-cat { margin-bottom: var(--space-4); }
.eq-table th, .eq-table td { padding: 6px 8px; }
.eq-input { padding: 4px 6px; font-size: var(--fs-sm); min-width: 90px; }
.eq-actions { white-space: nowrap; }
.eq-actions .btn { margin-right: 2px; }
.eq-add { margin-top: var(--space-3); }
.eq-add > summary { list-style: none; display: inline-block; }
.eq-add > summary::-webkit-details-marker { display: none; }

/* --- misc --------------------------------------------------------------------------- */
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.dl dt { color: var(--color-text-muted); font-size: var(--fs-sm); }
.dl dd { margin: 0; }
.prewrap { white-space: pre-wrap; }
.plain-list { list-style: none; padding: 0; margin: 0; }
.plain-list li { padding: 6px 0; border-bottom: 1px solid var(--color-border); }
.plain-list li:last-child { border-bottom: 0; }
.pager { display: flex; align-items: center; gap: var(--space-3); margin-top: var(--space-3); }
/* Dashboard overview tiles: equal columns + equal height. ui/v1 uses
   auto-fit, which stretches leftover tiles on the last row, and some
   tiles are <a class="stat-link"> wrappers so the inner .stat doesn't
   fill the grid cell. Do not set height:100% on the grid items — that
   disables stretch when the percentage can't resolve. */
.stat-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: 1fr;
  align-items: stretch;
}
.stat-grid > * {
  display: flex;
  flex-direction: column;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}
.stat-grid .stat {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}
.stat-label {
  line-height: 1.3;
  min-height: 2.6em; /* two lines so short labels match wrapping ones */
}
.stat-link:hover { text-decoration: none; }
.stat-link:hover .stat { box-shadow: var(--shadow-md); }
@media (max-width: 768px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.section-title { font-size: var(--fs-lg); margin: 0 0 var(--space-3); }
.form-static { padding: 8px 0; }
.text-danger { color: var(--color-danger-fg); }
.row-error td { background: var(--color-danger-bg); }
select.multi { height: auto; }
.map-table select { min-width: 220px; }
.form-grid .scope-block[hidden] { display: none; }

/* --- v0.3: work orders, results, compliance ------------------------------------- */
.chip-bad { background: var(--color-danger-bg); color: var(--color-danger-fg); }
.chip-warn { background: var(--color-warning-bg); color: var(--color-warning-fg); }
.test-list { margin: 0; padding-left: 18px; }
.test-list li { padding: 2px 0; }
.svc-groups { list-style: none; margin: 0; padding: 0; }
.svc-groups > li { padding: 2px 0; }
.svc-group { font-weight: 600; color: var(--color-primary); font-size: var(--fs-sm); }
.svc-items { margin: 0 0 4px; padding-left: 18px; }
.wo-actions { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.wo-actions .btn[aria-disabled="true"] { opacity: .45; cursor: default; }
.menu { position: relative; display: inline-block; }
.menu > summary { list-style: none; cursor: pointer; display: inline-block; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-body { position: absolute; z-index: 20; top: 100%; left: 0; min-width: 220px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md); box-shadow: 0 8px 24px rgba(15,23,42,.14); padding: 6px 0; }
.menu-body a { display: block; padding: 6px 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 320px; }
.menu-body a:hover { background: #f3f4f6; text-decoration: none; }
.results-table td { vertical-align: top; }
.plain-list.compact li { padding: 2px 0; border: 0; }
.flex-wrap { flex-wrap: wrap; }
.w-sm { width: 80px; }
.form-control-sm { padding: 4px 6px; font-size: var(--fs-sm); }
.dl-inline { grid-template-columns: max-content 1fr max-content 1fr; }
@media (max-width: 768px) { .dl-inline { grid-template-columns: max-content 1fr; } }
.wo-summary { display: flex; flex-wrap: wrap; gap: var(--space-4); align-items: flex-start; justify-content: space-between; }
.status-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.complete-box { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 6px 8px; border: 1px dashed var(--color-border); border-radius: var(--radius-md); }
.complete-box .form-control { width: auto; }
.svc-table td { vertical-align: middle; }
.svc-table select.result-pass { border-color: #16a34a; }
.svc-table select.result-fail { border-color: #dc2626; }
.svc-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--space-3); }
.svc-fieldset { border: 1px solid var(--color-border); border-radius: var(--radius-md); padding: 8px 12px 10px; margin: 0; min-width: 0; }
.svc-fieldset legend { font-weight: 600; color: var(--color-primary); font-size: var(--fs-sm); padding: 0 4px; }
.svc-check { display: flex; gap: 8px; align-items: flex-start; padding: 3px 0; margin: 0; }
.svc-check.is-due { background: var(--color-warning-bg); border-radius: 4px; padding-left: 4px; }
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--space-3); }
.doc-card { border: 1px solid var(--color-border); border-radius: var(--radius-md); padding: 8px; background: var(--color-surface); min-width: 0; }
.thumb { display: block; width: 100%; height: 120px; object-fit: cover; border-radius: 4px; background: #f3f4f6; }
.thumb-file { display: flex; align-items: center; justify-content: center; font-weight: 700; color: var(--color-text-muted); text-decoration: none; }
.doc-meta { margin-top: 6px; overflow-wrap: anywhere; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--space-3); }
.photo { margin: 0; }
.photo img { width: 100%; height: 200px; object-fit: cover; border-radius: var(--radius-md); border: 1px solid var(--color-border); display: block; }
.month-grid { table-layout: fixed; min-width: 700px; }
.month-grid th { text-align: center; }
.month-grid td.day { vertical-align: top; height: 92px; padding: 4px 6px; }
.month-grid td.day-out { background: #fafafa; color: var(--color-text-subtle); }
.month-grid td.day-today { outline: 2px solid var(--brand-accent); outline-offset: -2px; }
.day-num { display: block; font-weight: 600; text-decoration: none; margin-bottom: 4px; }
.day-wo { display: block; font-size: var(--fs-xs); padding: 2px 6px; margin: 2px 0; border-radius: 4px; background: var(--color-info-bg); color: var(--color-info-fg); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.day-wo.wo-in_progress { background: var(--color-warning-bg); color: var(--color-warning-fg); }
.day-wo.wo-completed { background: var(--color-success-bg); color: var(--color-success-fg); }
.day-wo.wo-draft, .day-wo.wo-cancelled { background: #f3f4f6; color: var(--color-text-muted); }
.stat-danger .stat-value { color: var(--color-danger-fg); }

@media print {
  .no-print, .subbar, .demo-banner, .preview-banner, .tabs, .acc-toolbar { display: none !important; }
  .acc { break-inside: avoid; border: 1px solid #999; }
  .acc > summary::before { display: none; }
  .chip-ok { border: 1px solid #16a34a; }
}

/* --- v0.4: maps, calendar, timeline, scorecard, print ------------------------------------ */
.map { width: 100%; height: 480px; border-radius: var(--radius-md); border: 1px solid var(--color-border); background: #e5e7eb; position: relative; overflow: hidden; }
.map-dash { height: 320px; }
.map-site { height: 420px; }
.map-schedule { height: 480px; }
.map-unavailable { display: flex; align-items: center; justify-content: center; color: var(--color-text-muted); font-size: var(--fs-sm); height: 160px; }
.map-card { padding: 0; overflow: hidden; }
.map-card .map { border: 0; border-radius: var(--radius-md) var(--radius-md) 0 0; }
.map-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; padding: 8px 12px; }
.map-foot-actions { display: inline-flex; align-items: center; gap: 12px; }
.map-hero-links { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 0; }
.map:fullscreen, .map:-webkit-full-screen { width: 100vw; height: 100vh; border-radius: 0; border: 0; }
.map-card:fullscreen .map, .map-card:-webkit-full-screen .map { height: 100vh; border-radius: 0; }
.map-legend { display: inline-flex; gap: 14px; flex-wrap: wrap; color: var(--color-text-muted); }
.map-legend span { display: inline-flex; align-items: center; gap: 5px; }
.pin-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.25); }
.pin-current { background: #16a34a; } .pin-due_soon { background: #d97706; } .pin-overdue { background: #dc2626; } .pin-unscheduled { background: #6b7280; }
.view-toggle { display: inline-flex; gap: 4px; }
.map-filters { margin-bottom: var(--space-3); }
.map-filters [data-map-counts] { margin-left: auto; }
.mapboxgl-ctrl.mapboxgl-ctrl-group.map-style-toggle > button { font: inherit; font-size: 11px; padding: 4px 8px; width: auto; min-width: 72px; height: auto; line-height: 1.2; color: var(--color-text); background: #fff; white-space: nowrap; }
.mapboxgl-ctrl.mapboxgl-ctrl-group.map-style-toggle > button.is-active { font-weight: 700; color: var(--color-primary); }
.mapboxgl-ctrl.mapboxgl-ctrl-group.map-action-ctrl > button { font: inherit; font-size: 11px; padding: 4px 8px; width: auto; height: auto; line-height: 1.2; white-space: nowrap; color: var(--color-text); background: #fff; }
.map-ctrl-btn { font: inherit; font-size: 12px; padding: 5px 9px; width: auto; height: auto; line-height: 1.2; background: #fff; color: var(--color-text); border: 0; cursor: pointer; }
.map-ctrl-btn.is-active { background: var(--brand-accent); color: #fff; }
.map-popup { font-size: var(--fs-sm); line-height: 1.35; max-width: 240px; }
.map-popup strong { display: block; }
.map-popup .muted { color: var(--color-text-muted); }
.map-popup a { display: inline-block; margin-top: 4px; }
.map-popup ul { margin: 4px 0 0; padding-left: 16px; }
.mapboxgl-popup-content { padding: 10px 12px; border-radius: 8px; box-shadow: 0 8px 24px rgba(15,23,42,.18); }
.unmapped-list { margin-top: var(--space-2); }
.unmapped-list summary { cursor: pointer; font-size: var(--fs-sm); color: var(--color-text-muted); }
.unmapped-list ul { columns: 2; margin: 6px 0 0; padding-left: 18px; font-size: var(--fs-sm); }
@media (max-width: 768px) { .unmapped-list ul { columns: 1; } .map { height: 360px; } .map-site { height: 320px; } }

/* site hero + pins */
.map-hero { margin: 0 0 var(--space-4); display: grid; grid-template-columns: 1fr; gap: var(--space-3); }
.map-hero.is-editing { grid-template-columns: minmax(0, 1fr) 320px; }
@media (max-width: 900px) { .map-hero.is-editing { grid-template-columns: 1fr; } }
.map-hero-empty .map-empty { border: 1px dashed var(--color-border); border-radius: var(--radius-md); padding: 18px; display: flex; flex-direction: column; gap: 4px; background: var(--color-surface); }
.map-pin { position: relative; width: 14px; height: 14px; border-radius: 50%; background: #d97706; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.5); cursor: pointer; }
.map-pin-equipment { background: var(--color-primary); border-radius: 3px; }
.map-pin-label { position: absolute; left: 18px; top: -4px; white-space: nowrap; font-size: 11px; font-weight: 600; color: #fff; background: rgba(15,23,42,.72); padding: 1px 6px; border-radius: 4px; pointer-events: none; }
.map-pin.is-hot { animation: pinpulse 1.2s ease-in-out 3; }
.map-pin.is-dragging { opacity: .7; }
@keyframes pinpulse { 0%,100% { box-shadow: 0 0 0 0 rgba(242,101,34,.9); } 50% { box-shadow: 0 0 0 10px rgba(242,101,34,0); } }
.map.is-editing .mapboxgl-canvas-container { cursor: crosshair; }
.map-editor { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md); padding: 10px 12px; font-size: var(--fs-sm); max-height: 420px; overflow: auto; }
.map-editor h3 { font-size: var(--fs-base); margin: 0 0 6px; }
.map-editor .hint { color: var(--color-text-muted); margin: 0 0 8px; }
.pin-row { border-top: 1px solid var(--color-border); padding: 8px 0; display: grid; gap: 4px; }
.pin-row .form-control { padding: 4px 6px; font-size: var(--fs-sm); }
.pin-row-head { display: flex; gap: 6px; align-items: center; }
.pin-row-head .kind { font-weight: 600; color: var(--color-primary); flex: 1; }
.pin-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.chip-map { background: var(--color-info-bg); color: var(--color-info-fg); border: 0; cursor: pointer; font: inherit; font-size: var(--fs-xs); margin-left: 4px; }
.chip-map:hover { text-decoration: underline; }
.map-chip { background: #fff; border: 1px solid var(--color-border); border-left: 4px solid var(--color-primary); border-radius: 6px; padding: 3px 8px; font-size: 11px; font-weight: 600; white-space: nowrap; box-shadow: 0 2px 6px rgba(0,0,0,.25); cursor: pointer; color: var(--color-text); }
.map-chip .map-chip-date { color: var(--brand-accent); margin-right: 4px; }
.map-chip.wo-in_progress { border-left-color: #d97706; }

/* calendar */
.day-chip { display: block; font-size: var(--fs-xs); padding: 2px 6px; margin: 2px 0; border-radius: 4px; background: var(--color-info-bg); color: var(--color-info-fg); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.day-chip.wo-in_progress { background: var(--color-warning-bg); color: var(--color-warning-fg); }
.day-chip.wo-completed { background: var(--color-success-bg); color: var(--color-success-fg); }
.day-chip.wo-draft, .day-chip.wo-cancelled { background: #f3f4f6; color: var(--color-text-muted); }
.day-chip.due-item { background: #fff7ed; color: #9a3412; border: 1px dashed #fdba74; }
.day-chip.due-item.due-soon { background: #fffbeb; color: #92400e; border-color: #fbbf24; }
.day-chip.due-item.due-overdue { background: #fef2f2; color: #991b1b; border-color: #f87171; }
.day-chip.wo-failed { background: #fef2f2; color: #991b1b; }
.day-chip:hover { text-decoration: none; filter: brightness(.96); }
.legend-line .day-chip { display: inline-block; margin: 0 2px; }
.fail-note { font-size: var(--fs-sm); color: #991b1b; margin-top: 2px; }
.results-how .results-steps { margin: 0 0 8px; padding-left: 20px; }
.results-how .results-steps li { margin: 4px 0; }
.eq-from-test td { background: #f8fafc; }
.eq-update-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin-top: 8px; }
.package-year .card-title { margin-bottom: 12px; }
.fb-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 12px;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--color-text);
  white-space: nowrap;
  background: var(--color-surface);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius);
  cursor: pointer;
}
.fb-check input { width: 16px; height: 16px; accent-color: var(--color-primary); }
.fb-check:has(input:checked) {
  border-color: color-mix(in srgb, var(--color-primary) 45%, var(--color-border-strong));
  background: color-mix(in srgb, var(--color-primary) 6%, var(--color-surface));
}
.ics-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ics-row .form-control { flex: 1 1 320px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: var(--fs-sm); }
.agenda-day .card-title { margin-bottom: 4px; }

/* compliance timeline (inline SVG) */
.timeline-wrap { margin: 0 0 var(--space-4); background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md); padding: 8px 10px 4px; }
.timeline { display: block; max-width: 100%; height: auto; font-family: inherit; }
.tl-future { fill: #f8fafc; }
.tl-tick { stroke: #e5e7eb; stroke-width: 1; }
.tl-month { font-size: 9px; fill: #9ca3af; }
.tl-year { font-size: 11px; font-weight: 700; fill: #374151; }
.tl-track { stroke: #f1f5f9; stroke-width: 1; }
.tl-label { font-size: 11px; fill: #111827; }
.tl-span { stroke: #cbd5e1; stroke-width: 3; stroke-linecap: round; }
.tl-overdue .tl-span { stroke: #fecaca; }
.tl-due_soon .tl-span { stroke: #fde68a; }
.tl-done circle { fill: #16a34a; }
.tl-done path { fill: none; stroke: #fff; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tl-due path { fill: #d97706; stroke: #fff; stroke-width: 1.2; }
.tl-overdue .tl-due path { fill: #dc2626; }
.tl-current .tl-due path { fill: #64748b; }
.tl-today { stroke: var(--brand-accent); stroke-width: 1.5; stroke-dasharray: 3 3; }
.tl-today-label { font-size: 10px; fill: var(--brand-accent); font-weight: 700; }
.tl-legend { display: flex; gap: 14px; flex-wrap: wrap; padding: 4px 2px 2px; }
.tl-legend span { display: inline-flex; align-items: center; gap: 5px; }
.tl-key { display: inline-block; width: 10px; height: 10px; }
.tl-key-done { background: #16a34a; border-radius: 50%; }
.tl-key-due { background: #d97706; transform: rotate(45deg); width: 8px; height: 8px; }
.tl-key-overdue { background: #dc2626; transform: rotate(45deg); width: 8px; height: 8px; }
.tl-key-future { background: #f8fafc; border: 1px solid #e5e7eb; }

/* scorecard */
.sc-grid { display: grid; grid-template-columns: auto 1fr 1fr auto; gap: var(--space-4); align-items: start; }
@media (max-width: 900px) { .sc-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .sc-grid { grid-template-columns: 1fr; } }
.sc-big { font-size: 40px; font-weight: 700; line-height: 1; color: var(--color-success-fg); }
.sc-big-warn { color: var(--color-warning-fg); }
.sc-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }
.sc-current { background: #16a34a; } .sc-due_soon { background: #d97706; } .sc-overdue { background: #dc2626; } .sc-unscheduled { background: #9ca3af; }
.sc-table { font-size: var(--fs-sm); }
.sc-table th, .sc-table td { padding: 2px 8px 2px 0; }
.sparkline { display: block; }
.sp-base { stroke: #e5e7eb; }
.sp-bar rect { fill: #cbd5e1; }
.sp-bar.is-now rect { fill: var(--brand-accent); }
.sp-label { font-size: 8px; fill: #9ca3af; text-anchor: middle; }
.sc-attention { margin-top: var(--space-3); border-top: 1px solid var(--color-border); padding-top: var(--space-3); }

/* customer updates */
.dashboard-updates {
  border-left: 4px solid var(--brand-accent);
  box-shadow: var(--shadow-md);
}
.dashboard-updates .notification-list { margin-top: var(--space-3); }
.notification-section-title {
  margin: var(--space-6) 0 var(--space-3);
  font-size: var(--fs-md);
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}
.updates-status {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 14px 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}
.updates-status p { margin: 2px 0 0; color: var(--color-text-muted); font-size: var(--fs-sm); }
.updates-status-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-size: var(--fs-md);
  font-weight: 800;
}
.updates-status-new { border-left: 4px solid var(--brand-accent); }
.updates-status-new .updates-status-mark { background: var(--color-info-bg); color: var(--color-info-fg); }
.updates-status-clear { border-left: 4px solid var(--color-success); }
.updates-status-clear .updates-status-mark { background: var(--color-success-bg); color: var(--color-success-fg); }
.notification-list { display: grid; gap: 10px; }
.notification-card { margin: 0; }
.notification-open {
  width: 100%;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  color: var(--color-text);
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color .12s, box-shadow .12s, transform .12s, background-color .12s;
}
.notification-open:hover { border-color: var(--color-border-strong); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.notification-open:focus-visible { outline: none; box-shadow: var(--focus-ring), var(--shadow-md); }
.notification-unread .notification-open {
  background: color-mix(in srgb, var(--color-primary) 4%, var(--color-surface));
  border-color: color-mix(in srgb, var(--color-primary) 24%, var(--color-border));
}
.notification-danger .notification-open { border-left-color: var(--color-danger); }
.notification-warning .notification-open { border-left-color: var(--color-warning); }
.notification-info .notification-open { border-left-color: var(--color-info); }
.notification-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: #f3f4f6;
  color: var(--color-text-muted);
  font-size: var(--fs-md);
  font-weight: 800;
}
.notification-danger .notification-icon { color: var(--color-danger-fg); background: var(--color-danger-bg); }
.notification-warning .notification-icon { color: var(--color-warning-fg); background: var(--color-warning-bg); }
.notification-info .notification-icon { color: var(--color-info-fg); background: var(--color-info-bg); }
.notification-copy { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.notification-heading { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.notification-title { font-weight: 700; line-height: 1.35; }
.notification-new {
  padding: 1px 7px;
  border-radius: var(--radius-pill);
  color: var(--color-info-fg);
  background: var(--color-info-bg);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.notification-detail { color: var(--color-text-muted); font-size: var(--fs-sm); overflow-wrap: anywhere; }
.notification-meta { color: var(--color-text-subtle); font-size: var(--fs-xs); }
.notification-arrow { color: var(--color-text-subtle); font-size: var(--fs-lg); }
.notification-list-compact { gap: 6px; }
.notification-list-compact .notification-open { padding: 10px 12px; box-shadow: none; }
.notification-list-compact .notification-icon { width: 34px; height: 34px; }

/* print */
.print-only { display: none; }
.aerial-print-page { display: block; width: 100%; max-width: 100%; height: auto; border: 1px solid #999; margin: 8px 0 12px; }
@media print {
  .no-print, .subbar, .demo-banner, .preview-banner, .tabs, .acc-toolbar, .nav, .footer, .map, .map-editor, .btn, .toast-host, .actions .btn, .palette, .palette-trigger { display: none !important; }
  .print-only { display: block !important; }
  .aerial-print { width: 100%; height: auto; border: 1px solid #999; margin: 8px 0 12px; }
  .map-hero { display: block; }
  .container { max-width: none; padding: 0; }
  .acc { break-inside: avoid; border: 1px solid #999; }
  .acc > summary::before { display: none; }
  .chip-ok { border: 1px solid #16a34a; }
  .timeline-wrap { break-inside: avoid; }
  a { color: inherit; text-decoration: none; }
}

/* --- discussion --------------------------------------------------------------------- */
.discussion-thread { list-style: none; padding: 0; margin: 0; }
.discussion-msg { padding: var(--space-3) 0; border-bottom: 1px solid var(--color-border); }
.discussion-msg:last-child { border-bottom: 0; }
.discussion-msg--internal { background: var(--color-surface-muted, #f8f9fb); margin: 0 calc(-1 * var(--space-4)); padding-left: var(--space-4); padding-right: var(--space-4); border-left: 3px solid var(--color-accent, #f26522); }
.discussion-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 4px; }
.discussion-body { line-height: 1.5; }
.discussion-visibility { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: var(--space-2); }
.discussion-compose textarea { min-height: 4.5rem; }

/* --- command palette (Cmd/Ctrl+K) ------------------------------------------- */
.palette-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 8px 0 0;
  padding: 4px 8px 4px 10px;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.18);
  color: #cbd5e1;
  border-radius: 6px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  flex-shrink: 0;
}
.palette-trigger:hover { color: #fff; background: rgba(255,255,255,.16); }
.palette-trigger kbd {
  font: inherit;
  font-size: 11px;
  letter-spacing: .02em;
  background: rgba(0,0,0,.28);
  color: #e2e8f0;
  padding: 1px 5px;
  border-radius: 4px;
}
body.palette-open { overflow: hidden; }
.palette { position: fixed; inset: 0; z-index: 1100; }
.palette-backdrop { position: absolute; inset: 0; background: rgba(15,23,42,.45); }
.palette-panel {
  position: relative;
  width: min(560px, calc(100% - 24px));
  max-height: min(72vh, 560px);
  margin: 12vh auto 0;
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  box-shadow: 0 24px 60px rgba(15,23,42,.28);
  overflow: hidden;
}
.palette-input {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--color-border);
  border-radius: 0;
  padding: 14px 16px;
  font-size: 16px;
  outline: none;
  background: transparent;
}
.palette-list { overflow: auto; padding: 6px 0 8px; flex: 1 1 auto; }
.palette-group {
  padding: 10px 16px 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}
.palette-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 16px;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}
.palette-item:hover, .palette-item[aria-selected="true"] {
  background: var(--color-info-bg);
  text-decoration: none;
}
.palette-item-main { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.palette-item-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-item-sub { font-size: 12px; color: var(--color-text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-item-hint { font-size: 11px; color: var(--color-text-subtle); flex-shrink: 0; }
.palette-empty { padding: 20px 16px; color: var(--color-text-muted); text-align: center; }
.palette-footer {
  margin: 0;
  padding: 8px 16px;
  border-top: 1px solid var(--color-border);
  font-size: 11px;
  color: var(--color-text-subtle);
}
@media (max-width: 768px) {
  .palette-trigger kbd { display: none; }
  .palette-panel { margin-top: 8vh; max-height: 80vh; }
}


/* --- feedback dialog (both faces; triggers live in the banner and footer) ------ */
.footer-feedback {
  background: none; border: 0; padding: 0; font: inherit; font-size: inherit;
  color: var(--color-text-muted); cursor: pointer; text-decoration: underline;
  text-underline-offset: 2px;
}
.footer-feedback:hover { color: var(--color-text); }
.footer-version {
  color: var(--color-text-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.footer-version:hover { color: var(--color-text); }
.feedback-dialog {
  width: min(440px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: 0 16px 48px rgba(15, 23, 42, .2);
}
.feedback-dialog::backdrop { background: rgba(15, 23, 42, .4); }
.feedback-form { padding: 20px 20px 16px; }
.feedback-form h2 { font-size: var(--fs-lg); margin: 0 0 4px; }
.feedback-form .form-actions { margin-top: 12px; }
@media print {
  .feedback-dialog { display: none !important; }
}


/* --- command palette (Cmd/Ctrl+K) ------------------------------------------- */
.palette-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 8px 0 0;
  padding: 4px 8px 4px 10px;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.18);
  color: #cbd5e1;
  border-radius: 6px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  flex-shrink: 0;
}
.palette-trigger:hover { color: #fff; background: rgba(255,255,255,.16); }
.palette-trigger kbd {
  font: inherit;
  font-size: 11px;
  letter-spacing: .02em;
  background: rgba(0,0,0,.28);
  color: #e2e8f0;
  padding: 1px 5px;
  border-radius: 4px;
}
body.palette-open { overflow: hidden; }
.palette { position: fixed; inset: 0; z-index: 1100; }
.palette-backdrop { position: absolute; inset: 0; background: rgba(15,23,42,.45); }
.palette-panel {
  position: relative;
  width: min(560px, calc(100% - 24px));
  max-height: min(72vh, 560px);
  margin: 12vh auto 0;
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  box-shadow: 0 24px 60px rgba(15,23,42,.28);
  overflow: hidden;
}
.palette-input {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--color-border);
  border-radius: 0;
  padding: 14px 16px;
  font-size: 16px;
  outline: none;
  background: transparent;
}
.palette-list { overflow: auto; padding: 6px 0 8px; flex: 1 1 auto; }
.palette-group {
  padding: 10px 16px 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}
.palette-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 16px;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}
.palette-item:hover, .palette-item[aria-selected="true"] {
  background: var(--color-info-bg);
  text-decoration: none;
}
.palette-item-main { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.palette-item-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-item-sub { font-size: 12px; color: var(--color-text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-item-hint { font-size: 11px; color: var(--color-text-subtle); flex-shrink: 0; }
.palette-empty { padding: 20px 16px; color: var(--color-text-muted); text-align: center; }
.palette-footer {
  margin: 0;
  padding: 8px 16px;
  border-top: 1px solid var(--color-border);
  font-size: 11px;
  color: var(--color-text-subtle);
}
@media (max-width: 768px) {
  .palette-trigger kbd { display: none; }
  .palette-panel { margin-top: 8vh; max-height: 80vh; }
}

.palette-search-row {
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid var(--color-border);
}
.palette-search-row .palette-input {
  flex: 1 1 auto;
  min-width: 0;
  border-bottom: 0;
}
.palette-close-btn {
  flex: 0 0 48px;
  width: 48px;
  border: 0;
  border-left: 1px solid var(--color-border);
  color: var(--color-text-muted);
  background: transparent;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}
.palette-close-btn:hover { color: var(--color-text); background: var(--color-surface-alt); }
.palette-close-btn:focus-visible { outline: 2px solid var(--brand-accent); outline-offset: -4px; }

/* --- State UST register (Alabama ADEM) ------------------------------------ */
.state-ust-banner {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 16px;
  margin-bottom: 16px;
  background: var(--color-info-bg, #eff6ff);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-primary);
  border-radius: 8px;
}
.state-ust-banner .card-title { margin: 0 0 4px; }
.state-ust-counts { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.state-ust .table-wrap { margin-top: 8px; }
.state-ust .section-title { font-size: var(--fs-md); }

/* --- Feedback widget ------------------------------------------------------ */
.footer .link-btn { color: inherit; font-size: inherit; padding: 0; }
.feedback-fab-wrap {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 1050;
}
.feedback-root.is-annotating .feedback-fab-wrap,
.feedback-root.is-annotating .feedback-panel { display: none; }
.feedback-fab {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 3px solid var(--brand-accent, #f26522);
  background: #fff;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .22);
  padding: 6px;
  cursor: pointer;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.feedback-fab:hover { transform: translateY(-1px); }
.feedback-fab-logo { width: 100%; height: 100%; object-fit: contain; display: block; }
.feedback-fab-mark {
  font-weight: 800;
  font-size: 16px;
  letter-spacing: .02em;
  color: var(--color-primary);
}
.feedback-fab-hide {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  background: #fff;
  color: var(--color-text-muted);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(15, 23, 42, .12);
}
.feedback-panel {
  position: fixed;
  right: 18px;
  bottom: 86px;
  z-index: 1051;
  width: min(380px, calc(100vw - 24px));
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  box-shadow: 0 18px 50px rgba(15, 23, 42, .22);
  padding: 14px 16px 16px;
}
.feedback-panel-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 12px; }
.feedback-kinds { display: flex; gap: 8px; margin-bottom: 12px; }
.feedback-kind {
  flex: 1;
  border: 1px solid var(--color-border);
  background: #fff;
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
  cursor: pointer;
}
.feedback-kind.is-on {
  border-color: var(--brand-accent, #f26522);
  background: var(--color-info-bg, #eff6ff);
  font-weight: 600;
}
.feedback-shot { margin: 10px 0; }
.feedback-shot img { display: block; width: 100%; max-height: 140px; object-fit: contain; border: 1px solid var(--color-border); border-radius: 8px; background: #0f172a; }
.feedback-shot-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.feedback-error { color: var(--color-danger-fg); font-size: 13px; margin: 8px 0 0; }
.feedback-annotate {
  position: fixed;
  inset: 0;
  z-index: 1100;
  background: rgba(15, 23, 42, .72);
  display: flex;
  flex-direction: column;
}
.feedback-annotate[hidden] { display: none !important; }
.feedback-annotate-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 10px 14px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}
.feedback-annotate-spacer { flex: 1; }
.feedback-annotate-stage {
  flex: 1;
  overflow: auto;
  display: grid;
  place-items: center;
  padding: 16px;
}
.feedback-annotate-stage canvas {
  max-width: min(1400px, 96vw);
  max-height: calc(100vh - 96px);
  background: #fff;
  cursor: crosshair;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .35);
}
.feedback-preview { max-width: 100%; border: 1px solid var(--color-border); border-radius: 8px; }
.btn.is-on { box-shadow: inset 0 0 0 2px var(--brand-accent, #f26522); }
@media (max-width: 640px) {
  .feedback-panel { right: 12px; left: 12px; width: auto; bottom: 80px; }
}

/* --- How it works (staff schematic) ------------------------------------------ */
.flow-board { display: flex; flex-direction: column; gap: var(--space-4); }
.flow-sheet {
  --flow-rule: color-mix(in srgb, var(--color-primary) 10%, transparent);
  background:
    linear-gradient(var(--flow-rule) 1px, transparent 1px) 0 0 / 100% 12px,
    linear-gradient(90deg, var(--flow-rule) 1px, transparent 1px) 0 0 / 12px 100%,
    var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-primary);
  border-radius: var(--radius-md);
  padding: 14px 16px 18px;
}
.flow-sheet-head {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 10px;
  align-items: baseline;
  margin-bottom: 14px;
}
.flow-sheet-mark {
  grid-row: 1 / span 2;
  align-self: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
  color: var(--color-primary);
  border: 1px solid var(--color-primary);
  padding: 6px 7px;
  line-height: 1;
}
.flow-sheet-title {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: .02em;
}
.flow-sheet-lede { margin: 2px 0 0; color: var(--color-text-muted); font-size: var(--fs-sm); }
.flow-spine {
  display: flex;
  align-items: stretch;
  gap: 0;
  overflow-x: auto;
  padding-bottom: 4px;
}
.flow-col {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 148px;
  flex: 0 0 auto;
}
.flow-col-stack { gap: 18px; justify-content: space-evenly; }
.flow-join {
  position: relative;
  flex: 0 0 32px;
  width: 32px;
  align-self: stretch;
  min-height: 48px;
}
.flow-pipe {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 3px;
  margin-top: -1.5px;
  background: var(--color-border);
  pointer-events: none;
}
.flow-pipe::after {
  content: "";
  position: absolute;
  right: -1px;
  top: 50%;
  width: 0;
  height: 0;
  border: 5px solid transparent;
  border-left-color: var(--color-border);
  transform: translateY(-50%);
}
.flow-pipe.is-on { background: var(--brand-accent); }
.flow-pipe.is-on::after { border-left-color: var(--brand-accent); }
.flow-join-split .flow-pipe-top,
.flow-join-merge .flow-pipe-top { top: 28%; }
.flow-join-split .flow-pipe-bot,
.flow-join-merge .flow-pipe-bot { top: 72%; }
.flow-join-split::before,
.flow-join-merge::before {
  content: "";
  position: absolute;
  left: 0;
  top: 28%;
  bottom: 28%;
  width: 3px;
  background: var(--color-border);
}
.flow-join-split:has(.flow-pipe.is-on)::before,
.flow-join-merge:has(.flow-pipe.is-on)::before { background: var(--brand-accent); }
.flow-node {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 2px 8px;
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
  background: color-mix(in srgb, var(--color-surface) 88%, #fff);
  border: 1px solid var(--color-border);
  border-radius: 2px;
  padding: 8px 10px 9px;
  box-shadow: inset 3px 0 0 var(--color-primary);
}
.flow-node:hover { border-color: var(--color-primary); }
.flow-node:focus-visible { outline: 2px solid var(--brand-accent); outline-offset: 2px; }
.flow-node.is-hop { border-color: color-mix(in srgb, var(--brand-accent) 55%, var(--color-border)); }
.flow-node.is-on {
  border-color: var(--brand-accent);
  box-shadow: inset 3px 0 0 var(--brand-accent), 0 0 0 1px var(--brand-accent);
}
.flow-tag {
  grid-column: 1;
  grid-row: 1;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
}
.flow-label {
  grid-column: 1;
  grid-row: 2;
  font-weight: 600;
  font-size: 13px;
  line-height: 1.25;
}
.flow-count {
  grid-column: 2;
  grid-row: 2;
  align-self: center;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 16px;
  line-height: 1;
  color: var(--color-primary);
  min-width: 1.4ch;
  text-align: right;
}
.flow-warn {
  grid-column: 2;
  grid-row: 1;
  justify-self: end;
  min-width: 14px;
  padding: 0 4px;
  border-radius: 2px;
  background: var(--color-warning-bg);
  color: var(--color-warning-fg);
  font-size: 9px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: center;
  line-height: 1.4;
}
.flow-tabs { margin: 0; }
.flow-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 12px;
  align-items: center;
  margin-top: 12px;
}
.flow-row:first-of-type { margin-top: 0; }
.flow-row-label {
  font-size: 11px;
  font-weight: 650;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}
.flow-row-track {
  display: flex;
  align-items: stretch;
  gap: 0;
  overflow-x: auto;
  min-width: 0;
}
.flow-row-track .flow-node { min-width: 132px; flex: 0 1 180px; }
.flow-row-track .flow-pipe {
  position: relative;
  flex: 0 0 28px;
  width: 28px;
  height: 3px;
  top: auto;
  margin: auto 0;
  align-self: center;
}
.flow-detail { padding: 16px 18px; }
.flow-detail-top { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.flow-detail-top .flow-count { grid-row: auto; font-size: 16px; }
.flow-detail-title { margin: 0 0 8px; font-size: 18px; }
.flow-detail p { margin: 0; max-width: 62ch; }
@media (max-width: 720px) {
  .flow-row { grid-template-columns: 1fr; gap: 6px; }
  .flow-sheet { padding: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .flow-pipe, .flow-node, .flow-join-split::before, .flow-join-merge::before { transition: none; }
}
.flow-pipe, .flow-node, .flow-join-split::before, .flow-join-merge::before {
  transition: background .15s, border-color .15s, box-shadow .15s;
}

/* --- nav groups, compact dashboard, a11y targets (skip link: top of file) ------------------ */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.nav-secondary { display: inline-flex; align-items: center; gap: inherit; opacity: .92; }
.nav-cluster { display: inline-flex; align-items: center; flex-wrap: wrap; gap: inherit; }
.nav-cluster + .nav-cluster { border-left: 1px solid rgba(255,255,255,.22); padding-left: 12px; margin-left: 4px; }
.stat-grid-compact { grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-rows: auto; }
.stat-grid-compact .stat-label { min-height: 0; }
@media (max-width: 900px) { .stat-grid-compact { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.map-dash-compact { height: 220px; }
.filter-applied { margin: 8px 0 12px; font-size: var(--fs-sm); color: var(--color-text); background: var(--color-warning-bg); border-left: 3px solid var(--color-warning); padding: 8px 12px; border-radius: 0 6px 6px 0; }
.action-list { list-style: none; padding: 0; margin: 0; }
.action-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--color-border); }
.action-row:last-child { border-bottom: 0; }
.action-title { font-weight: 600; }
.action-meta { font-size: var(--fs-sm); color: var(--color-text-muted); }
.action-failed .action-title, .action-overdue .action-title { color: var(--color-danger-fg, #b91c1c); }
.site-head-meta { font-size: var(--fs-sm); color: var(--color-text-muted); margin: 4px 0 0; }
.site-hero-fold { margin: 0 0 var(--space-4); border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-surface); }
.site-hero-fold > summary { cursor: pointer; padding: 10px 14px; font-weight: 600; min-height: 44px; display: flex; align-items: center; }
.site-hero-fold[open] > summary { border-bottom: 1px solid var(--color-border); }
.site-hero-fold .map-site { border: 0; border-radius: 0 0 var(--radius-md) var(--radius-md); }
.site-switcher .form-control, .site-switcher .switcher-filter, .site-switcher .switcher-select { min-height: 40px; }
button.tab, .nav-links a, .link-btn { min-height: 32px; }
@media (max-width: 768px) {
  .nav-cluster + .nav-cluster { border-left: 0; padding-left: 0; margin-left: 0; }
  button.tab, .btn, .nav-toggle, .site-switcher .form-control { min-height: 44px; }
}

.walkthrough-qr-row { display: flex; flex-wrap: wrap; gap: var(--space-4); align-items: flex-start; }
.walkthrough-qr { width: 320px; max-width: 100%; background: #fff; padding: 16px; border: 1px solid var(--color-border); border-radius: var(--radius-md); }
.walkthrough-qr img { width: 100%; height: auto; display: block; image-rendering: pixelated; background: #fff; }
.walkthrough-qr-meta { flex: 1; min-width: 220px; }
.walkthrough-qr-actions { justify-content: flex-start; flex-wrap: wrap; }
.walkthrough-callout { background: #fff7ed; border-left: 4px solid var(--color-accent, #f26522); padding: 10px 14px; margin: 0 0 16px; }
.walkthrough-section { font-size: var(--fs-md); margin: 20px 0 8px; color: var(--color-primary); }
.walkthrough-item { border: 1px solid var(--color-border); border-radius: var(--radius-md); padding: 12px 14px; margin: 0 0 12px; }
.walkthrough-item legend { font-weight: 600; padding: 0 4px; }
.walkthrough-item-call { border-color: #fdba74; }
.walkthrough-help { margin: 6px 0 10px; font-size: var(--fs-sm); }
.walkthrough-help p { margin: 8px 0 0; color: var(--color-text-muted); }
.walkthrough-choices { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0; }
.walkthrough-choice { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 12px 20px; border: 2px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-surface); cursor: pointer; font-weight: 700; font-size: 1.05rem; flex: 1 1 30%; }
.walkthrough-choice:has(input:checked) { border-color: var(--color-primary); background: var(--color-info-bg, #eff6ff); }
.walkthrough-choice input { width: 1.15rem; height: 1.15rem; }
.walkthrough-item .form-control { margin-top: 8px; }
.walkthrough-thumbs { display: block; margin-top: 2px; }
.walkthrough-preview { list-style: decimal; padding-left: 1.25rem; margin: 0; }
.walkthrough-preview-item { margin: 0 0 18px; padding-bottom: 14px; border-bottom: 1px solid var(--color-border); }
.walkthrough-guide-staff img { max-width: 180px; max-height: 120px; display: block; margin: 8px 0; border-radius: var(--radius-md); border: 1px solid var(--color-border); }
.walkthrough-guide-upload { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }

/* Full-screen phone walkthrough (QR + signed-in Start). */
body.walkthrough-app nav,
body.walkthrough-app .subbar,
body.walkthrough-app .footer,
body.walkthrough-app .preview-banner,
body.walkthrough-app .demo-banner { display: none; }
body.walkthrough-app { background: #fff; }
body.walkthrough-app .container.walkthrough-app-main {
  max-width: none; width: 100%; margin: 0; padding: 0; background: #fff;
}
.walkthrough-form { display: flex; flex-direction: column; min-height: 100dvh; margin: 0; }
.walkthrough-chrome { padding: 12px 16px 0; display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.walkthrough-progress { font-weight: 700; margin: 0; color: var(--color-primary); }
.walkthrough-step { padding: 8px 16px 120px; flex: 1; }
.walkthrough-form.is-wizard .walkthrough-step[hidden] { display: none; }
.walkthrough-kicker { text-transform: uppercase; letter-spacing: 0.04em; font-size: 0.75rem; font-weight: 700; color: var(--color-primary); margin: 0 0 6px; }
.walkthrough-q { font-size: clamp(1.35rem, 5vw, 1.85rem); line-height: 1.25; margin: 0 0 12px; }
.walkthrough-kit { font-size: 0.95rem; }
.walkthrough-name { display: block; margin: 16px 0; font-weight: 600; }
.walkthrough-name span { display: block; margin-bottom: 6px; }
.walkthrough-notes { margin-top: 12px; }
.walkthrough-guide { margin: 0 0 16px; }
.walkthrough-guide img { width: 100%; max-height: 42vh; object-fit: contain; background: #0f172a; border-radius: var(--radius-md); }
.walkthrough-guide figcaption { font-size: 0.8rem; color: var(--color-text-muted); margin-top: 6px; }
.walkthrough-camera { display: block; margin-top: 16px; }
.walkthrough-camera-label { display: block; font-weight: 700; margin-bottom: 8px; }
.walkthrough-camera input[type="file"] { min-height: 48px; }
.wt-preview { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.wt-preview-img { width: 96px; height: 96px; object-fit: cover; border-radius: var(--radius-md); border: 1px solid var(--color-border); }
.walkthrough-nav {
  position: sticky; bottom: 0; display: flex; gap: 10px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: #fff; border-top: 1px solid var(--color-border); margin-top: auto;
}
.walkthrough-nav-btn { flex: 1; min-height: 48px; font-size: 1.05rem; }
.walkthrough-nav [hidden] { display: none !important; }
.walkthrough-replace { padding: 8px 16px; }
.walkthrough-published { padding: 24px 16px; }
@media (min-width: 720px) {
  .walkthrough-step { max-width: 40rem; margin: 0 auto; padding-bottom: 140px; }
  .walkthrough-chrome { max-width: 40rem; margin: 0 auto; width: 100%; box-sizing: border-box; }
  .walkthrough-nav { max-width: 40rem; margin-left: auto; margin-right: auto; width: 100%; box-sizing: border-box; }
}
.walkthrough-poster { max-width: 40rem; margin: 0 auto; text-align: center; padding: 12px; }
.walkthrough-poster-brand { display: flex; align-items: center; justify-content: center; gap: 16px; margin-bottom: 12px; }
.walkthrough-poster-logo { max-height: 72px; max-width: 240px; }
.walkthrough-poster-co { font-size: 1.25rem; font-weight: 700; color: var(--color-primary); margin: 0; }
.walkthrough-poster-product { margin: 0; color: var(--color-text-muted); }
.walkthrough-poster h1 { margin: 8px 0 4px; }
.walkthrough-poster-site { font-size: 1.15rem; margin: 0 0 4px; }
.walkthrough-poster-qr { width: min(360px, 80vw); margin: 16px auto; background: #fff; padding: 18px; }
.walkthrough-poster-qr img { width: 100%; height: auto; image-rendering: pixelated; }
.walkthrough-poster-scan { font-weight: 700; font-size: 1.05rem; }
.walkthrough-poster-url { word-break: break-all; }
.walkthrough-poster-contact { margin-top: 24px; padding-top: 16px; border-top: 2px solid var(--color-primary); }
@media print {
  .walkthrough-poster { max-width: none; }
  .walkthrough-poster-qr { width: 2.9in; padding: 12px; }
  .walkthrough-poster-logo { max-height: 0.7in; }
}

/* --- mobile / tablet -------------------------------------------------------
   ui/v1 already stacks grids and shows a hamburger below 768px. This layer
   covers iPhone + iPad: the long staff nav, 16px inputs (no iOS zoom), 44px
   targets, card-style tables, a phone calendar, and safe-area insets. */

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { overflow-x: clip; max-width: 100%; }
body.nav-open { overflow: hidden; }

.nav {
  position: sticky;
  top: 0;
  z-index: 200;
  padding-top: max(12px, env(safe-area-inset-top));
  padding-left: max(var(--space-6), env(safe-area-inset-left));
  padding-right: max(var(--space-6), env(safe-area-inset-right));
}
.nav-brand, .palette-trigger, .nav-toggle { position: relative; z-index: 2; }

.nav-toggle {
  width: 44px;
  height: 44px;
  min-width: 44px;
  padding: 0;
  border-radius: 8px;
  flex-shrink: 0;
}
.nav-toggle:hover, .nav-toggle:focus-visible { background: rgba(255,255,255,.12); }
.nav-toggle-bars,
.nav-toggle-bars::before,
.nav-toggle-bars::after {
  display: block;
  width: 20px;
  height: 2px;
  background: #fff;
  border-radius: 1px;
  position: absolute;
  left: 12px;
  transition: transform .15s, top .15s, background-color .15s;
}
.nav-toggle-bars { top: 21px; }
.nav-toggle-bars::before { content: ""; top: -6px; left: 0; }
.nav-toggle-bars::after { content: ""; top: 6px; left: 0; }
body.nav-open .nav-toggle-bars { background: transparent; }
body.nav-open .nav-toggle-bars::before { top: 0; transform: rotate(45deg); }
body.nav-open .nav-toggle-bars::after { top: 0; transform: rotate(-45deg); }

.nav-backdrop { display: none; }
.nav-backdrop:not([hidden]) {
  display: block;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .4);
  z-index: 1;
}

.palette-trigger { min-height: 36px; }

/* Phone calendar: a list of days that have chips. The 7-col grid stays for
   tablet+ (it is min-width 700px and lives in a scroll wrap as fallback). */
.month-list { display: none; list-style: none; margin: 0; padding: 0; }
.month-list-day {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  margin: 0 0 8px;
}
.month-list-day.day-today { outline: 2px solid var(--brand-accent); outline-offset: -2px; }
.month-list-date {
  display: block;
  font-weight: 700;
  margin-bottom: 6px;
  text-decoration: none;
  color: inherit;
}
.month-list-chips { display: flex; flex-direction: column; gap: 4px; }
.month-list-chips .day-chip {
  display: block;
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
  padding: 8px 10px;
  font-size: var(--fs-sm);
}
.month-list-empty { padding: 12px 4px; }

.timeline-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.filter-details { margin-bottom: var(--space-4); }
.filter-details-summary { display: none; list-style: none; cursor: pointer; }
.filter-details-summary::-webkit-details-marker { display: none; }
@media (min-width: 769px) {
  .filter-details { display: block; margin: 0 0 var(--space-4); border: 0; background: none; }
}

/* Hamburger through tablet / small-laptop so the staff nav cannot overflow. */
@media (max-width: 1279px) {
  .nav { padding-left: max(var(--space-4), env(safe-area-inset-left)); padding-right: max(var(--space-4), env(safe-area-inset-right)); }
  .nav-toggle { display: block; }
  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    background: var(--color-primary);
    padding: 4px max(var(--space-5), env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom)) max(var(--space-5), env(safe-area-inset-left));
    gap: 0;
    z-index: 3;
    box-shadow: 0 12px 28px rgba(0,0,0,.28);
    max-height: min(80vh, calc(100dvh - 56px - env(safe-area-inset-top)));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .nav-links.open { display: flex; }
  .nav-links a,
  .nav-links .link-btn {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 10px 4px;
    font-size: var(--fs-md);
    font-weight: 700;
    border-top: 1px solid rgba(255,255,255,0.1);
    color: #e2e8f0;
    text-decoration: none;
  }
  .nav-links a:hover,
  .nav-links a.active,
  .nav-links .link-btn:hover { color: #fff; background: rgba(255,255,255,.1); }
  .nav-links .nav-count { margin-left: auto; }
  .nav-links .nav-form { display: block; margin: 0; }
  .nav-links .link-btn { width: 100%; text-align: left; border-radius: 0; }
  .nav-user {
    margin-left: 0;
    padding: 12px 4px 8px;
    border-top: 1px solid rgba(255,255,255,0.1);
    width: 100%;
    color: #cbd5e1;
  }
}

@media (max-width: 768px) {
  .container { padding: var(--space-4) max(var(--space-3), env(safe-area-inset-left)) max(var(--space-4), env(safe-area-inset-bottom)) max(var(--space-3), env(safe-area-inset-right)); }

  .page-head,
  .page-header { flex-direction: column; align-items: flex-start; }
  .page-head h1,
  .page-header h1 { font-size: 1.35rem; overflow-wrap: anywhere; }
  .page-head .actions,
  .page-header .actions { width: 100%; }
  .page-head .actions .btn,
  .page-header .actions .btn { min-height: 40px; }

  .home-brand { gap: 12px; margin-bottom: 18px; }
  .home-logo { max-height: 56px; }

  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
  .stat-value { font-size: var(--fs-xl); }

  .nav-brand {
    max-width: calc(100% - 120px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .site-switcher { flex-direction: column; }
  .site-switcher .fb-search,
  .site-switcher .switcher-select { width: 100%; flex: 1 1 auto; max-width: none; }

  .filter-details {
    background: color-mix(in srgb, var(--color-primary) 4%, var(--color-surface));
    border: 1px solid var(--color-border);
    border-left: 3px solid var(--brand-accent);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-4);
  }
  .filter-details-summary {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 10px 12px;
    font-weight: 700;
    color: var(--color-primary);
  }
  .filter-details-summary::before {
    content: "▸";
    color: var(--color-text-subtle);
    font-size: 12px;
    margin-right: 8px;
    transition: transform .15s;
  }
  .filter-details[open] > .filter-details-summary::before { transform: rotate(90deg); }
  .filter-details .filter-bar:not(.inline-bar),
  .filter-details .filter-card {
    margin-bottom: 0;
    border: 0;
    background: transparent;
  }
  .filter-details .filter-card { box-shadow: none; }

  .filter-bar:not(.inline-bar) {
    flex-direction: column;
    align-items: stretch;
  }
  .filter-bar:not(.inline-bar) > input:not([type="hidden"]):not([type="checkbox"]):not([type="file"]),
  .filter-bar:not(.inline-bar) > select,
  .filter-bar:not(.inline-bar) > .form-control,
  .filter-bar:not(.inline-bar) > .fb-search,
  .filter-bar:not(.inline-bar) > .fb-search > input,
  .filter-bar:not(.inline-bar) > .fb-fixed,
  .filter-bar:not(.inline-bar) > input.fb-fixed,
  .filter-bar:not(.inline-bar) > .fb-grow,
  .filter-bar:not(.inline-bar) > .btn {
    width: 100%;
    min-width: 0;
    flex: 1 1 auto;
  }
  .filter-bar:not(.inline-bar) > .btn { justify-content: center; }
  .fb-check { width: 100%; justify-content: flex-start; min-height: 44px; height: auto; }

  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: 1 / -1; }
  .form-actions { flex-direction: column; align-items: stretch; }
  .form-actions .btn { width: 100%; min-height: 44px; justify-content: center; }
  .btn:not(.btn-sm):not(.btn-ghost):not(.chip-map):not(.map-ctrl-btn) { min-height: 44px; }
  .form-control,
  .form-control-sm,
  .eq-input,
  select.form-control-sm,
  input[type="date"],
  input[type="search"],
  input[type="text"],
  input[type="email"],
  select {
    font-size: 16px;
  }
  .form-control,
  .form-control-sm,
  .eq-input { min-height: 44px; }
  textarea.form-control { min-height: 8rem; }

  .tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }
  .tab {
    flex: 0 0 auto;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    padding: 10px 14px;
  }

  .footer {
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
    padding-bottom: max(var(--space-4), env(safe-area-inset-bottom));
    padding-left: max(var(--container-pad-x), env(safe-area-inset-left));
    padding-right: max(var(--container-pad-x), env(safe-area-inset-right));
  }

  .toast-host {
    top: auto;
    bottom: max(12px, env(safe-area-inset-bottom));
    left: 12px;
    right: 12px;
    max-width: none;
  }

  .auth-wrap { margin: 16px auto; padding: 0 4px; }
  .auth-card .btn-block { min-height: 48px; }

  .subbar-inner { padding-left: max(var(--space-3), env(safe-area-inset-left)); padding-right: max(var(--space-3), env(safe-area-inset-right)); }
  .preview-banner, .demo-banner { padding-left: max(var(--container-pad-x), env(safe-area-inset-left)); padding-right: max(var(--container-pad-x), env(safe-area-inset-right)); }

  .dl { grid-template-columns: 1fr; gap: 2px 0; }
  .dl dt { margin-top: 8px; }
  .dl dd { margin-bottom: 4px; }

  .wo-summary, .status-actions, .complete-box, .ics-row, .cal-nav { flex-direction: column; align-items: stretch; }
  .complete-box .form-control, .ics-row .form-control { width: 100%; flex: 1 1 auto; }
  .wo-actions { gap: 8px; }
  .wo-actions .btn { min-height: 40px; }

  .view-toggle { display: flex; width: 100%; }
  .view-toggle .btn { flex: 1; justify-content: center; }

  .menu-body { left: auto; right: 0; min-width: min(280px, calc(100vw - 24px)); max-width: calc(100vw - 24px); }

  .map { height: 280px; }
  .map-dash { height: 240px; }
  .map-site { height: 260px; }
  .map-schedule { height: 280px; }
  .mapboxgl-ctrl-group button { width: 40px !important; height: 40px !important; }
  .map-foot { flex-direction: column; align-items: flex-start; }
  .map-hero-links .btn { min-height: 40px; }

  .pager { flex-wrap: wrap; }
  .pager .btn { min-height: 40px; }

  .eq-input { min-width: 0; width: 100%; }
  .eq-actions { white-space: normal; }
  .eq-actions .btn { margin-bottom: 4px; }

  .discussion-visibility { flex-direction: column; }
  .feedback-form { padding: 16px; }
  .updates-status { align-items: flex-start; }
  .notification-open { grid-template-columns: 38px minmax(0, 1fr); padding: 12px; }
  .notification-arrow { display: none; }
  .notification-list-compact .notification-open { padding: 10px; }

  .palette-trigger { min-height: 44px; padding: 8px 12px; }
  .palette-panel {
    width: 100%;
    max-width: none;
    margin: 0;
    max-height: 100dvh;
    border-radius: 0;
    padding-top: env(safe-area-inset-top);
  }
  .palette-item { min-height: 48px; padding: 12px 16px; }

  th, td { padding: 10px 12px; }
}

@media (max-width: 640px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2); }

  .month-grid-wrap { display: none; }
  .month-list { display: block; }

  /* Stack data tables as labeled cards. Labels come from thead via app.js. */
  .table-wrap.is-cards {
    overflow: visible;
    background: transparent;
    border: 0;
    border-radius: 0;
  }
  .table-wrap.is-cards table,
  .table-wrap.is-cards thead,
  .table-wrap.is-cards tbody { display: block; width: 100%; }
  .table-wrap.is-cards thead { display: none; }
  .table-wrap.is-cards tbody tr {
    display: block;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    margin: 0 0 10px;
    padding: 8px 12px;
    box-shadow: var(--shadow-sm);
  }
  .table-wrap.is-cards tbody tr:hover { background: var(--color-surface); }
  .table-wrap.is-cards tbody tr:last-child td { border-bottom: 1px solid var(--color-border); }
  .table-wrap.is-cards tbody tr td:last-child { border-bottom: 0; }
  .table-wrap.is-cards td {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    width: 100%;
    padding: 8px 0;
    border-bottom: 1px solid var(--color-border);
    text-align: right;
    white-space: normal;
  }
  .table-wrap.is-cards td.nowrap { white-space: normal; }
  .table-wrap.is-cards td::before {
    content: attr(data-label);
    font-weight: 600;
    font-size: var(--fs-sm);
    color: var(--color-text-muted);
    text-align: left;
    flex: 0 1 42%;
    text-transform: none;
    letter-spacing: 0;
  }
  .table-wrap.is-cards td:not([data-label])::before,
  .table-wrap.is-cards td[data-label=""]::before { content: none; }
  .table-wrap.is-cards td:not([data-label]),
  .table-wrap.is-cards td[data-label=""] {
    display: block;
    text-align: left;
  }
  .table-wrap.is-cards td.num { text-align: right; }
}

@media (max-width: 480px) {
  .stat-grid { gap: var(--space-2); }
  .stat-value { font-size: var(--fs-lg); }
  .stat-label { font-size: 11px; }
  .nav-logo { height: 24px; }
}

.pending-bar {
  height: 8px;
  margin-top: 12px;
  border-radius: 999px;
  background: #e8edf2;
  overflow: hidden;
}
.pending-bar > span {
  display: block;
  height: 100%;
  width: 40%;
  border-radius: inherit;
  background: var(--color-primary);
  animation: pending-slide 1.1s ease-in-out infinite;
}
.pending-note { margin: 8px 0 0; }
@keyframes pending-slide {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(320%); }
}

@media (prefers-reduced-motion: reduce) {
  .skip-link,
  .toast,
  .nav-toggle-bars,
  .nav-toggle-bars::before,
  .nav-toggle-bars::after,
  .filter-details-summary::before,
  .notification-open { transition: none !important; }
  .map-pin.is-hot { animation: none !important; }
  .pending-bar > span { animation: none !important; transform: none; width: 100%; opacity: .45; }
}

@media print {
  .nav-backdrop, .nav-toggle, .month-list { display: none !important; }
  .month-grid-wrap { display: block !important; }
  .table-wrap.is-cards { overflow: visible; border: 1px solid #ddd; }
  .table-wrap.is-cards table, .table-wrap.is-cards thead, .table-wrap.is-cards tbody, .table-wrap.is-cards tr, .table-wrap.is-cards td {
    display: revert;
  }
  .table-wrap.is-cards td::before { content: none; }
}

/* --- tap target: the FAB's hide "×" gets a 44px hit area on touch screens ------------------ */
@media (pointer: coarse) {
  .feedback-fab-hide::before { content: ""; position: absolute; inset: -10px; }
}

/* --- site picker (type-ahead for large portfolios; shared/_site_picker.html) ---------------- */
.site-picker { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-width: 0; }
.site-picker .site-picker-filter { flex: 1 1 160px; min-width: 0; }
.site-picker select { flex: 1 1 200px; min-width: 0; }

/* --- "Results ▾" menus inside scrolling tables: JS pins them to the viewport --------------- */
.menu-body.is-fixed { position: fixed; z-index: 1000; max-height: min(60vh, 420px); overflow-y: auto; }

/* --- toasts: errors stay until closed ------------------------------------------------------ */
.toast { display: flex; align-items: flex-start; gap: 10px; }
.toast-text { flex: 1 1 auto; }
.toast-close {
  flex: 0 0 auto; min-width: 24px; min-height: 24px; margin: -2px -4px 0 0; padding: 0 4px;
  background: none; border: 0; color: inherit; font-size: 18px; line-height: 1; cursor: pointer; opacity: .8;
}
.toast-close:hover, .toast-close:focus-visible { opacity: 1; }

/* --- brand contrast: text colors come from services/branding.py (contrast-checked) ---------- */
.nav, .nav-brand, .nav-brand:hover, .nav-toggle { color: var(--on-primary, #fff); }
.nav-links a, .nav .link-btn { color: var(--on-primary-soft, #e2e8f0); }
.nav-links a:hover, .nav-links a.active, .nav .link-btn:hover { color: var(--on-primary, #fff); }
.nav-user { color: var(--on-primary-muted, #94a3b8); }
.nav a:focus-visible, .nav .link-btn:focus-visible { outline-color: var(--on-primary, #fff); }
.btn-primary, .btn-primary:hover { color: var(--on-primary, #fff); }
.btn-accent, .btn-accent:hover { color: var(--on-accent, #fff); }
.nav-count, .map-ctrl-btn.is-active { color: var(--on-accent, #fff); }
.map-chip .map-chip-date { color: var(--brand-accent-text, var(--color-link)); }
.tl-today-label { fill: var(--brand-accent-text, var(--color-link)); }
.nav-toggle-bars, .nav-toggle-bars::before, .nav-toggle-bars::after { background-color: var(--on-primary, #fff); }

/* --- Living docs (/staff/docs, /help/guide) --------------------------------------------- */
.docs-search { margin-bottom: 12px; }
.docs-layout { display: grid; grid-template-columns: minmax(200px, 260px) minmax(0, 1fr); gap: 16px; align-items: start; }
.docs-nav { font-size: var(--fs-sm); position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow-y: auto; }
.docs-nav ul { list-style: none; margin: 0 0 12px; padding: 0; }
.docs-nav li { margin: 2px 0; }
.docs-nav a.active { font-weight: 700; }
.docs-nav-title { font-weight: 700; text-transform: uppercase; letter-spacing: .04em; font-size: var(--fs-xs); color: var(--color-text-muted); margin: 8px 0 4px; }
.docs-gen { font-size: 10px; padding: 0 5px; }
.docs-body { min-width: 0; overflow-wrap: anywhere; }
.docs-body h1 { margin-top: 0; }
.docs-body h2 { margin-top: 1.6em; border-bottom: 1px solid var(--color-border); padding-bottom: 4px; }
.docs-body table { border-collapse: collapse; display: block; overflow-x: auto; max-width: 100%; font-size: var(--fs-sm); margin: 8px 0 16px; }
.docs-body th, .docs-body td { border: 1px solid var(--color-border); padding: 4px 8px; vertical-align: top; text-align: left; }
.docs-body th { background: var(--color-surface-alt); }
.docs-body pre { background: var(--color-surface-alt); border: 1px solid var(--color-border); padding: 10px; overflow-x: auto; font-size: var(--fs-sm); }
.docs-body pre.mermaid { background: #fff; text-align: center; }
.docs-body code { font-size: .92em; }
.docs-generated { background: var(--color-info-bg); color: var(--color-info-fg); padding: 6px 10px; border-radius: var(--radius); }
.docs-hits { list-style: none; padding: 0; }
.docs-hits li { margin: 0 0 14px; }
.docs-snippet { color: var(--color-text-muted); border-left: 3px solid var(--color-border); padding-left: 8px; margin-top: 2px; }
.docs-build { margin-top: 12px; }
@media (max-width: 760px) {
  .docs-layout { grid-template-columns: minmax(0, 1fr); }
  .docs-nav { position: static; max-height: none; }
}
