/* VermiCycle OS — © 2026 Jeffrey Jenson · Mindstorm Software Solutions. All rights reserved. */
/* VermiCycle OS — dark VermiGold theme, mobile-first. */

:root {
    --bg: #0F1110;
    --card: #161A18;
    --text: #F5F5F5;
    --muted: #A8B0AA;
    --green: #143B2D;
    --green-hover: #1E5643;
    --green-deep: #0B2820;
    --gold: #C6A75E;
    --status-good: #4CAF50;
    --status-watch: #FFC107;
    --status-risk: #E53935;

    --radius: 14px;
    --radius-sm: 10px;
    --space: 16px;
    --touch: 48px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

    /* Fluid type ramp — scales smoothly between phone and desktop without
       hard breakpoints. Used by hero numerics on the dashboard + bin cards. */
    --fs-display:  clamp(2.4rem, 7vw + 0.4rem, 3.6rem);  /* health gauge "83" */
    --fs-h1:       clamp(1.4rem, 3.5vw + 0.4rem, 2rem);  /* page titles, walkthrough */
    --fs-h2:       clamp(1.1rem, 2vw + 0.5rem, 1.5rem);
    --fs-metric:   clamp(1.15rem, 2vw + 0.4rem, 1.4rem); /* metric-card values */
    --fs-id:       clamp(1.25rem, 2.6vw + 0.4rem, 1.55rem); /* bin-license id */
}

/* ── A11y: respect users who ask for reduced motion. Animations remain
   technically present for state correctness, but their durations collapse
   so nothing visibly moves. Critical for vestibular sensitivity. */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ── A11y: visible keyboard focus everywhere. Component-specific
   :focus-visible rules below override this where they exist (buttons,
   inputs, etc.) — this is the safety-net for everything else. */
:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
    border-radius: 4px;
}
:focus:not(:focus-visible) { outline: none; }

/* ── Light theme overrides ──────────────────────────────────────── */
body.theme-light {
    --bg:           #F5F3EE;
    --card:         #FFFFFF;
    --text:         #143B2D;
    --muted:        #6B7265;
    --green:        #C6A75E;
    --green-hover:  #D4B874;
    --green-deep:   #B89651;
    --gold:         #143B2D;
}
body.theme-light .app-header {
    background: linear-gradient(180deg, rgba(198,167,94,0.10) 0%, rgba(245,243,238,0) 100%);
    border-bottom-color: rgba(198,167,94,0.20);
}
body.theme-light .app-menu-overlay {
    background: var(--bg);
}
body.theme-light .app-menu-header {
    background: var(--card);
    border-bottom-color: rgba(198,167,94,0.25);
}
body.theme-light .app-menu-link:hover,
body.theme-light .app-menu-link:focus {
    background: rgba(198,167,94,0.08);
}
body.theme-light .card {
    box-shadow: 0 1px 4px rgba(0,0,0,0.07);
}
body.theme-light .btn-ghost {
    border-color: rgba(0,0,0,0.18);
    color: var(--text);
}
body.theme-light .btn-ghost:hover {
    background: rgba(0,0,0,0.05);
}
body.theme-light input,
body.theme-light select,
body.theme-light textarea {
    background: #F8F6F2;
    border-color: rgba(0,0,0,0.18);
    color: var(--text);
}
body.theme-light input:focus,
body.theme-light select:focus,
body.theme-light textarea:focus {
    border-color: var(--gold);
    background: #FFFFFF;
}
body.theme-light .confirm-modal-box,
body.theme-light .upgrade-modal-box,
body.theme-light .feedback-box,
body.theme-light .info-sheet,
body.theme-light .ma-panel {
    background: var(--card);
    border-color: rgba(198,167,94,0.25);
}
body.theme-light .bin-license {
    background: linear-gradient(145deg, #C6A75E 0%, #B89651 100%);
}
body.theme-light .btn-section-toggle {
    background: #C6A75E;
    color: #143B2D;
    border-color: #143B2D;
}
body.theme-light .btn-section-toggle:hover,
body.theme-light .btn-section-toggle[aria-expanded="true"] {
    background: #D4B874;
    border-color: #143B2D;
}
/* Bin / plan license card — raise contrast for gold background in light mode */
body.theme-light .bin-license {
    border-color: rgba(20,59,45,0.45);
}
body.theme-light .bin-license-header {
    background: rgba(20,59,45,0.06);
    border-bottom-color: rgba(20,59,45,0.25);
}
body.theme-light .bin-license-header:hover,
body.theme-light .bin-license-header:focus-visible {
    background: rgba(20,59,45,0.12);
}
body.theme-light .bin-license-eyebrow {
    color: rgba(20,59,45,0.75);
}
body.theme-light .bin-license-header-right {
    color: rgba(20,59,45,0.7);
}
body.theme-light .bin-license-left {
    background: rgba(20,59,45,0.08);
    border-right-color: rgba(20,59,45,0.25);
}
body.theme-light .bin-license-id-box {
    background: #F5F3EE;
    border-color: rgba(20,59,45,0.45);
}
body.theme-light .bin-license-name-row {
    border-bottom-color: rgba(20,59,45,0.22);
}
body.theme-light .bin-license-row {
    border-bottom-color: rgba(20,59,45,0.10);
}
body.theme-light .bin-license-footer {
    background: rgba(20,59,45,0.05);
    border-top-color: rgba(20,59,45,0.22);
}
body.theme-light .bin-license-tagline {
    color: rgba(20,59,45,0.7);
}

/* ── Theme toggle ───────────────────────────────────────────────── */
.theme-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid rgba(198,167,94,0.12);
}
.theme-toggle-row:last-child { border-bottom: none; }
.theme-toggle-label {
    font-size: 0.92rem;
    color: var(--text);
    font-weight: 500;
}
.theme-toggle-sub {
    font-size: 0.75rem;
    color: var(--muted);
    margin-top: 2px;
}
.theme-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    flex-shrink: 0;
}
.theme-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.theme-switch-track {
    width: 48px;
    height: 28px;
    border-radius: 999px;
    background: rgba(198,167,94,0.18);
    border: 1px solid rgba(198,167,94,0.35);
    transition: background 200ms ease, border-color 200ms ease;
    position: relative;
}
.theme-switch input:checked ~ .theme-switch-track {
    background: rgba(198,167,94,0.35);
    border-color: var(--gold);
}
.theme-switch-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--muted);
    transition: transform 200ms ease, background 200ms ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    line-height: 1;
}
.theme-switch input:checked ~ .theme-switch-track .theme-switch-thumb {
    transform: translateX(20px);
    background: var(--gold);
}
.theme-switch-icons {
    font-size: 0.85rem;
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.4;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
    max-width: 720px;
    margin: 0 auto;
    padding: var(--space);
    display: flex;
    flex-direction: column;
    gap: var(--space);
}

/* Header */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px var(--space);
    background: linear-gradient(180deg, rgba(47,93,80,0.15) 0%, rgba(15,17,16,0) 100%);
    border-bottom: 1px solid rgba(198,167,94,0.15);
    position: sticky;
    top: 0;
    z-index: 10;
    backdrop-filter: blur(6px);
    gap: 12px;
    flex-wrap: wrap;
}
.app-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gold);
    letter-spacing: 0.02em;
}
.brand-link {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}
.brand-link:hover { text-decoration: none; }
.brand-mark {
    width: 40px;
    height: 40px;
    object-fit: contain;
    display: block;
}
.brand-mark-sm {
    width: 32px;
    height: 32px;
}
.brand-wordmark {
    height: 56px;
    width: auto;
    max-width: 340px;
    object-fit: contain;
    display: block;
}
.brand-wordmark-sm { height: 44px; max-width: 260px; }
@media (max-width: 600px) {
    .brand-wordmark    { height: 40px; max-width: 200px; }
    .brand-wordmark-sm { height: 32px; max-width: 160px; }
}

/* Farm name — persistent top-bar label */
.farm-name {
    font-size: 0.95rem;
    color: var(--gold);
    font-weight: 600;
    padding: 6px 14px;
    background: rgba(198,167,94,0.1);
    border: 1px solid rgba(198,167,94,0.25);
    border-radius: 999px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 260px;
    letter-spacing: 0.01em;
    text-decoration: none;
    display: inline-block;
    cursor: pointer;
    transition: background 120ms ease, border-color 120ms ease;
}
a.farm-name:hover { background: rgba(198,167,94,0.2); border-color: var(--gold); color: var(--gold); }
a.farm-name:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
@media (max-width: 600px) { .farm-name { font-size: 0.85rem; max-width: 160px; } }

/* Bin page title next to wordmark */
.bin-title {
    margin-left: auto;
    font-size: 1.1rem;
    /* FU-08 follow-up: when the team/owner context chip is appended to the
     * bin name, allow the chip to wrap to a new line rather than fragment
     * the bin name on narrow viewports (iPhone SE 320px). */
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 8px;
    max-width: 100%;
    min-width: 0;
}
.bin-context-chip { white-space: nowrap; }

/* ── FU-08 multi-user trust chips ─────────────────────────────────
 * Surfaces the ownership/team context for every shared bin so the
 * operator never wonders "is this mine?" or "whose action am I about
 * to log?". Two variants:
 *   .bin-team-chip     — small inline chip on dashboard bin rows
 *   .bin-context-chip  — larger chip in the bin detail header
 * The role pill modifier (.bin-role-{viewer,member,admin,owner})
 * surfaces only when the user is NOT the owner of the bin they're
 * looking at, so operators on their own personal bins see no noise.
 */
.bin-team-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 7px;
    margin-left: 6px;
    border-radius: 999px;
    background: rgba(91,164,207,0.14);
    border: 1px solid rgba(91,164,207,0.35);
    color: rgb(174,209,232);
    font-size: 0.7rem;
    font-weight: 600;
    vertical-align: middle;
    white-space: nowrap;
}
.bin-team-chip-icon { font-size: 0.85rem; line-height: 1; }
.bin-team-chip-text { letter-spacing: 0.01em; }

.bin-role-chip {
    display: inline-flex;
    align-items: center;
    padding: 1px 7px;
    margin-left: 6px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.18);
    background: rgba(255,255,255,0.06);
    color: var(--muted);
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.bin-role-viewer {
    background: rgba(229,164,94,0.14);
    border-color: rgba(229,164,94,0.40);
    color: rgb(232,178,122);
}
.bin-role-member {
    background: rgba(91,164,207,0.14);
    border-color: rgba(91,164,207,0.40);
    color: rgb(174,209,232);
}
.bin-role-admin {
    background: rgba(89,168,119,0.14);
    border-color: rgba(89,168,119,0.40);
    color: rgb(140,220,170);
}

/* Header chip on /bin/{id} — bigger, more anchored. */
.bin-context-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    margin-left: 8px;
    border-radius: 999px;
    background: rgba(91,164,207,0.16);
    border: 1px solid rgba(91,164,207,0.45);
    color: rgb(195,222,240);
    font-size: 0.78rem;
    font-weight: 600;
    vertical-align: middle;
}
.bin-context-owner {
    background: rgba(198,167,94,0.14);
    border-color: rgba(198,167,94,0.40);
    color: rgb(214,184,110);
}
.bin-context-icon { font-size: 0.95rem; line-height: 1; }
.bin-context-role {
    padding: 1px 6px;
    border-radius: 999px;
    background: rgba(0,0,0,0.25);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* ── FU-09 viewer-mode banner on /bin/{id} ────────────────────────
 * When the caller is a viewer-role team member, the page hides write
 * forms (Log Visit, Edit, Delete, Photo upload) and renders this
 * banner near the top so the operator understands the limitation is
 * intentional, not broken. */
.viewer-banner {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    background: rgba(229,164,94,0.10);
    border: 1px solid rgba(229,164,94,0.35);
    border-left: 4px solid rgba(229,164,94,0.65);
}
.viewer-banner-icon {
    font-size: 1.4rem;
    line-height: 1;
    padding-top: 1px;
    flex-shrink: 0;
}
.viewer-banner-text {
    font-size: 0.88rem;
    line-height: 1.45;
    color: rgb(214,184,150);
}
.viewer-banner-text strong { color: rgb(232,178,122); font-weight: 700; }

.app-nav { display: flex; gap: 10px; flex-wrap: wrap; }
.nav-link {
    color: var(--muted);
    font-size: 0.9rem;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
}
.nav-link.active { color: var(--text); background: rgba(198,167,94,0.08); }
.back-link { color: var(--muted); font-size: 0.9rem; }

/* Cards */
.card {
    background: var(--card);
    border: 1px solid rgba(255,255,255,0.04);
    border-radius: var(--radius);
    padding: var(--space);
    box-shadow: 0 1px 0 rgba(255,255,255,0.03) inset;
}

.section-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--muted);
    margin-bottom: 10px;
}

.muted { color: var(--muted); margin: 0; }

/* Update section */
.update-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 8px 0 4px;
}

/* Metrics grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}
@media (min-width: 768px) {
    .metrics-grid { grid-template-columns: repeat(4, 1fr); }
}
.metric-card {
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 96px;
}
.metric-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted);
}
.metric-value {
    font-size: var(--fs-metric);
    font-weight: 600;
    color: var(--text);
}
.metric-sub {
    font-size: 0.85rem;
    color: var(--gold);
}

/* Recommendation */
.recommendation-card { border-left: 3px solid var(--gold); }
.recommendation-text {
    font-size: 1.15rem;
    font-weight: 500;
    color: var(--text);
}
/* Protocols v1 — suggested-protocol link under the main recommendation */
.recommendation-protocol {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding: 10px 12px;
    border: 1px solid rgba(198,167,94,0.3);
    border-radius: 10px;
    background: rgba(198,167,94,0.08);
    color: var(--text);
    text-decoration: none;
    font-size: 0.92rem;
    min-height: 44px;
}
.recommendation-protocol:hover {
    background: rgba(198,167,94,0.14);
    border-color: var(--gold);
}
.recommendation-protocol-icon {
    flex: 0 0 auto;
    color: var(--gold);
    font-weight: 700;
}
.recommendation-protocol-text { line-height: 1.35; }
.recommendation-protocol-bin {
    display: block;
    font-size: 0.78rem;
    color: var(--muted);
    margin-top: 2px;
}
.recommendation-why {
    display: inline-block;
    margin-top: 10px;
    font-size: 0.72rem;
    color: var(--gold);
    opacity: 0.7;
    text-decoration: none;
    letter-spacing: 0.04em;
    border-bottom: 1px solid rgba(198,167,94,0.25);
    transition: opacity 0.15s;
}
.recommendation-why:hover { opacity: 1; text-decoration: none; }

/* Lists — elevated card rows (Recent Activity style, applied globally) */
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.list-item {
    background: rgba(255,255,255,0.035);
    border: 1px solid rgba(255,255,255,0.04);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.list-item[hidden] { display: none; }
.list-item:hover { background: rgba(255,255,255,0.05); border-color: rgba(198,167,94,0.15); }
.list-link {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    color: var(--text);
    flex-wrap: wrap;
}
.list-link:hover { text-decoration: none; }
.list-link-locked {
    background: transparent;
    border: none;
    padding: 0;
    text-align: left;
    cursor: pointer;
    opacity: 0.6;
    font-family: var(--font);
    font-size: 1rem;
}
.list-link-locked:hover { opacity: 0.8; }
.list-lock-icon { font-size: 0.9rem; flex-shrink: 0; }
.list-title {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text);
    flex: 1 1 auto;
    letter-spacing: 0.005em;
}
.list-sub {
    color: var(--muted);
    font-size: 0.85rem;
    flex: 1 1 100%;
    margin-top: 2px;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #0F1110;
}
.status-good  { background: var(--status-good); }
.status-watch { background: var(--status-watch); }
.status-risk  { background: var(--status-risk); color: #fff; }
.muted-badge  { background: rgba(168,176,170,0.15); color: var(--muted); }

/* Hamburger button that opens the takeover menu. */
.menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm, 10px);
    background: transparent;
    color: var(--text);
    border: 1px solid rgba(198,167,94,0.35);
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
    margin-right: 8px;
    -webkit-tap-highlight-color: transparent;
    transition: background 120ms ease, border-color 120ms ease;
}
.menu-btn:hover {
    background: rgba(198,167,94,0.12);
    border-color: var(--gold);
}
.menu-btn:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
}

/* Full-screen takeover menu. */
.app-menu-overlay {
    position: fixed;
    inset: 0;
    z-index: 980;
    background: var(--bg, #0F1110);
    color: var(--text);
    display: flex;
    flex-direction: column;
    animation: appMenuFadeIn 160ms ease-out;
}
.app-menu-overlay[hidden] { display: none; }

@keyframes appMenuFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.app-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(47, 93, 80, 0.45);
    background: var(--card, #161A18);
    position: sticky;
    top: 0;
}

.app-menu-title {
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
}

.app-menu-close {
    background: transparent;
    color: var(--text);
    border: 1px solid rgba(198,167,94,0.4);
    border-radius: 999px;
    width: 40px;
    height: 40px;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 120ms ease, border-color 120ms ease;
}
.app-menu-close:hover {
    background: rgba(229, 57, 53, 0.12);
    border-color: var(--status-risk);
}
.app-menu-close:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
}

.app-menu-nav {
    flex: 1;
    overflow-y: auto;
    padding: 8px 14px 32px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overscroll-behavior: contain;
}

.app-menu-link {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 16px 18px;
    background: var(--card, #161A18);
    color: var(--text);
    border: 1px solid rgba(255,255,255,0.04);
    border-radius: var(--radius-sm, 10px);
    text-decoration: none;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    transition: background 120ms ease, border-color 120ms ease, transform 0.05s ease;
}
.app-menu-link:hover {
    background: rgba(198,167,94,0.08);
    border-color: rgba(198,167,94,0.45);
}
.app-menu-link:active { transform: scale(0.99); }
.app-menu-link.active {
    border-color: var(--gold);
    background: rgba(198,167,94,0.12);
}
.app-menu-link:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
}

.app-menu-icon {
    font-size: 1.2rem;
    line-height: 1;
    flex-shrink: 0;
    width: 28px;
    text-align: center;
}
.app-menu-label {
    flex: 1;
}
.app-menu-badge {
    background: var(--status-watch);
    color: #0F1110;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    min-width: 24px;
    text-align: center;
}

.app-menu-signout {
    margin-top: 12px;
    border-color: rgba(229,57,53,0.35);
    color: #ffb4b1;
}
.app-menu-signout:hover {
    background: rgba(229,57,53,0.12);
    border-color: var(--status-risk);
    color: #ffb4b1;
}

/* Prevent body scroll while menu is open. */
body.app-menu-open {
    overflow: hidden;
}

/* Compact health-score pill: the numeric counterpart to status badges. */
.health-pill {
    background: transparent;
    border: 1px solid rgba(198,167,94,0.35);
    color: var(--text);
    min-width: 34px;
    text-align: center;
    padding: 3px 8px;
    font-variant-numeric: tabular-nums;
}
.health-pill.health-good  { border-color: var(--status-good);  color: var(--status-good); }
.health-pill.health-watch { border-color: var(--status-watch); color: var(--status-watch); }
.health-pill.health-risk  { border-color: var(--status-risk);  color: #ff8a87; }

/* "Show all N" reveal button under a collapsed list. */
.list-reveal {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    margin-top: 10px;
    font-weight: 500;
    color: var(--muted);
    border-color: rgba(255,255,255,0.06);
    background: transparent;
}
.list-reveal:hover {
    color: var(--text);
    border-color: rgba(198,167,94,0.4);
}
.list-reveal .chev {
    font-size: 0.9rem;
    opacity: 0.8;
}

/* Empty-state blocks: friendlier than a bare muted paragraph. */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 14px 8px;
    color: var(--muted);
    text-align: center;
}
.empty-state-icon {
    font-size: 1.6rem;
    line-height: 1;
    opacity: 0.85;
}
.empty-state-msg {
    margin: 0;
    font-size: 0.9rem;
}

/* Chips */
.bin-meta { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
    display: inline-block;
    padding: 5px 10px;
    background: rgba(47,93,80,0.25);
    border: 1px solid rgba(47,93,80,0.45);
    color: var(--text);
    border-radius: 999px;
    font-size: 0.8rem;
}
.chip-warm { background: rgba(198,167,94,0.15); border-color: rgba(198,167,94,0.4); color: var(--gold); }

/* Buttons — warm gold ghost base, consistent with Colony Profile card style */
.btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-height: var(--touch);
    padding: 12px 18px;
    background: rgba(198,167,94,0.08);
    color: var(--gold);
    border: 1px solid rgba(198,167,94,0.35);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: transform 0.05s ease, background 0.15s ease, border-color 0.15s ease;
    width: 100%;
}
.btn:active { transform: scale(0.98); }
.btn:hover { background: rgba(198,167,94,0.16); border-color: var(--gold); color: var(--gold); }
.btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
/* Explicit ghost alias — for modal cancel buttons and secondary actions */
.btn-ghost {
    background: rgba(198,167,94,0.06);
    color: var(--muted);
    border-color: rgba(198,167,94,0.2);
}
.btn-ghost:hover { background: rgba(198,167,94,0.12); border-color: rgba(198,167,94,0.4); color: var(--text); }
.btn-primary {
    background: #1a2e24;
    color: #fff;
    border-color: var(--gold);
    border-width: 1.5px;
}
.btn-primary:hover {
    background: var(--green-hover);
    border-color: var(--gold);
    color: #fff;
}
.btn-primary:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
}
.btn-xl {
    min-height: 72px;
    font-size: 1.35rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    background: var(--gold);
    color: #0F1110;
    border-color: var(--gold);
    box-shadow: 0 6px 20px rgba(198,167,94,0.2);
}
.btn-xl:hover { background: #d4b877; border-color: #d4b877; color: #0F1110; }

/* Forms */
.actions-card { display: flex; flex-direction: column; gap: 14px; }
.action-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.04);
    border-radius: var(--radius-sm);
}
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.action-form label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.8rem;
    color: var(--muted);
}
/* Universal dark form controls — applies everywhere (action, manage, mode-toggle, auth) */
select,
input[type="text"],
input[type="number"],
input[type="password"],
input[type="email"],
input[type="search"],
input[type="tel"],
input[type="url"],
input[type="date"],
input[type="datetime-local"],
input[type="time"],
textarea {
    min-height: var(--touch);
    background-color: #0F1110;
    color: var(--text);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    font-size: 1rem;
    font-family: inherit;
    color-scheme: dark;
    box-sizing: border-box;
    width: 100%;
    -webkit-text-fill-color: var(--text);
    caret-color: var(--gold);
}

/* Kill Chrome/Edge yellow autofill background */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 1000px #0F1110 inset !important;
    -webkit-text-fill-color: var(--text) !important;
    caret-color: var(--gold);
    transition: background-color 5000s ease-in-out 0s;
}
select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding-right: 36px;
    background-image: linear-gradient(45deg, transparent 50%, var(--gold) 50%),
                      linear-gradient(135deg, var(--gold) 50%, transparent 50%);
    background-position: calc(100% - 20px) 55%, calc(100% - 14px) 55%;
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat, no-repeat;
    cursor: pointer;
}
select::-ms-expand { display: none; }
select option { background-color: #0F1110; color: var(--text); }
select:focus,
input[type="text"]:focus,
input[type="number"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
input[type="search"]:focus,
input[type="tel"]:focus,
input[type="url"]:focus,
input[type="date"]:focus,
input[type="datetime-local"]:focus,
input[type="time"]:focus,
textarea:focus {
    outline: none;
    border-color: var(--gold);
}

/* Section toggle — big collapsible header button — deep green matches Colony Profile card */
.btn-section-toggle {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    min-height: 64px;
    padding: 14px 20px;
    background: #1a2e24;
    color: #fff;
    border: 1.5px solid var(--gold);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.05s ease;
}
.btn-section-toggle:hover {
    background: var(--green-hover);
    border-color: var(--gold);
}
.btn-section-toggle:active { transform: scale(0.99); }
.btn-section-toggle:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.section-toggle-icon {
    font-size: 1.4rem;
    line-height: 1;
}
.section-toggle-label {
    flex: 1 1 auto;
    text-align: left;
}
.section-toggle-chevron {
    color: var(--gold);
    font-size: 1.2rem;
    line-height: 1;
    transition: transform 0.2s ease;
}
.optimize-current {
    color: var(--gold);
    font-weight: 500;
    margin-left: 4px;
    font-size: 0.95em;
}
.optimize-current:before { content: "· "; color: var(--muted); }
.btn-section-toggle[aria-expanded="true"] {
    background: var(--green-hover);
    border-color: var(--gold);
    box-shadow: 0 0 0 1px var(--gold) inset;
}
.btn-section-toggle[aria-expanded="true"] .section-toggle-chevron {
    transform: rotate(180deg);
}

.section-collapsible[hidden] { display: none; }
.section-collapsible {
    animation: section-fade 0.2s ease;
}
@keyframes section-fade {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Visit form — button-style toggles (tap to highlight) */
.visit-form { gap: 16px; display: flex; flex-direction: column; }
.visit-chips {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}
@media (min-width: 560px) { .visit-chips { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 800px) { .visit-chips { grid-template-columns: repeat(5, 1fr); } }

.visit-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 56px;
    padding: 12px 14px;
    background: rgba(255,255,255,0.04);
    color: var(--muted);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.05s ease, box-shadow 0.15s ease;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}
.visit-btn:hover {
    background: rgba(255,255,255,0.07);
    border-color: rgba(198,167,94,0.35);
    color: var(--text);
}
.visit-btn:active { transform: scale(0.97); }
.visit-btn[aria-pressed="true"] {
    background: var(--green);
    border-color: var(--gold);
    color: var(--text);
    box-shadow: 0 0 0 1px var(--gold) inset, 0 4px 14px rgba(47,93,80,0.35);
}
.visit-btn[aria-pressed="true"]:hover {
    background: var(--green-hover);
}
.visit-btn-icon {
    font-size: 1.2rem;
    line-height: 1;
}
.visit-btn:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
}

/* ── Heat Pad — thermal-state styling ──────────────────────────────
 * Heat Pad controls an environmental modifier (thermal intervention
 * for outdoor or marginal bins). The generic .visit-btn[aria-pressed]
 * green/gold doesn't communicate "this is HEAT." Operators in the
 * field need to recognize at-a-glance that this control affects
 * colony survival via warmth, not generic toggle state.
 *
 * Palette: muted ember red (220,90,50) + warm amber (240,160,80).
 * Stays within the project's dark-mode doctrine — no neon, no glow
 * overpowering hierarchy. The OFF state hints with a faint warm
 * border + icon glow so operators understand the control category
 * before activating. ON state escalates to active ember gradient,
 * stronger glow, slow pulse on the 🔥 icon.
 *
 * prefers-reduced-motion gates all animation.
 */
.visit-btn.heat-pad-toggle {
    border-color: rgba(220, 90, 50, 0.30);
}
.visit-btn.heat-pad-toggle .visit-btn-icon {
    filter: drop-shadow(0 0 3px rgba(240, 160, 80, 0.45));
}
.visit-btn.heat-pad-toggle:hover {
    border-color: rgba(220, 90, 50, 0.55);
    background: rgba(220, 90, 50, 0.06);
}
/* Higher specificity (.visit-btn + .heat-pad-toggle + [aria-pressed])
 * cleanly overrides the generic [aria-pressed="true"] green palette. */
.visit-btn.heat-pad-toggle[aria-pressed="true"] {
    background:
        linear-gradient(135deg,
            rgba(220, 90, 50, 0.32) 0%,
            rgba(240, 160, 80, 0.18) 100%),
        rgba(220, 90, 50, 0.12);
    border-color: rgba(240, 160, 80, 0.65);
    color: rgb(255, 215, 180);
    box-shadow:
        0 0 0 1px rgba(240, 160, 80, 0.45) inset,
        0 4px 14px -4px rgba(220, 90, 50, 0.50),
        0 0 18px -6px rgba(220, 90, 50, 0.55);
}
.visit-btn.heat-pad-toggle[aria-pressed="true"]:hover {
    background:
        linear-gradient(135deg,
            rgba(220, 90, 50, 0.40) 0%,
            rgba(240, 160, 80, 0.24) 100%),
        rgba(220, 90, 50, 0.16);
}
.visit-btn.heat-pad-toggle[aria-pressed="true"] .visit-btn-icon {
    filter: drop-shadow(0 0 5px rgba(240, 160, 80, 0.75));
    animation: heatPadPulse 3.6s ease-in-out infinite;
}
@keyframes heatPadPulse {
    0%, 100% { filter: drop-shadow(0 0 4px rgba(240, 160, 80, 0.55)); }
    50%      { filter: drop-shadow(0 0 9px rgba(220, 90, 50, 0.85)); }
}
@media (prefers-reduced-motion: reduce) {
    .visit-btn.heat-pad-toggle[aria-pressed="true"] .visit-btn-icon {
        animation: none;
    }
}

/* Colony license card — when heat pad is active, the Heat Mat row
 * picks up a subtle warm tint so the operator sees thermal state at
 * a glance without scrolling to the edit form. Off state stays
 * neutral so it doesn't clutter the license card. */
.bin-license-row[data-heat-active="true"] {
    background: linear-gradient(90deg,
        rgba(220, 90, 50, 0.10) 0%,
        rgba(220, 90, 50, 0.02) 100%);
    border-left: 3px solid rgba(240, 160, 80, 0.55);
    padding-left: 9px;
    border-radius: 4px;
}
.bin-license-row[data-heat-active="true"] .bin-license-row-icon {
    filter: drop-shadow(0 0 3px rgba(240, 160, 80, 0.55));
}
.bin-license-row[data-heat-active="true"] .bin-license-row-value {
    color: rgb(255, 200, 150);
    font-weight: 600;
}

.sub-form {
    padding: 12px;
    background: rgba(47,93,80,0.1);
    border: 1px solid rgba(47,93,80,0.25);
    border-radius: var(--radius-sm);
}
.sub-form[hidden] { display: none; }

.visit-inspect {
    padding-top: 14px;
    margin-top: 4px;
    border-top: 1px solid rgba(255,255,255,0.06);
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.visit-inspect .section-label { margin-bottom: 4px; }

.visit-photo-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
    flex-wrap: wrap;
}
.visit-photo-btn {
    flex: 1 1 auto;
    min-width: 220px;
    background: rgba(198,167,94,0.08);
    border-color: rgba(198,167,94,0.3);
    color: var(--text);
    min-height: 56px;
}
.visit-photo-btn:hover { background: rgba(198,167,94,0.14); border-color: var(--gold); }
.visit-photo-clear {
    flex: 0 0 auto;
    min-width: 100px;
}

/* Inline error + toast */
.inline-error {
    background: rgba(229,57,53,0.12);
    border: 1px solid rgba(229,57,53,0.4);
    color: #ffb4b1;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
}
.toast {
    position: fixed;
    left: 50%;
    bottom: 20px;
    transform: translateX(-50%) translateY(20px);
    background: var(--card);
    border: 1px solid rgba(198,167,94,0.35);
    color: var(--text);
    padding: 10px 16px;
    border-radius: 999px;
    font-size: 0.9rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 50;
}
.toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.toast.error { border-color: rgba(229,57,53,0.5); color: #ffb4b1; }
/* SW update banner — gold tint, pointer cursor, no auto-dismiss */
.toast.toast-update {
    border-color: rgba(198,167,94,0.7);
    color: var(--gold);
    cursor: pointer;
    pointer-events: all;
    user-select: none;
}

/* Bin header card */
.bin-header-card { padding: 14px var(--space); }

/* Colony Health meter */
.health-card { padding: 20px var(--space); }
.health-meter {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 100%;
    background: transparent;
    border: 0;
    padding: 4px 0 0;
    color: inherit;
    cursor: pointer;
    font-family: inherit;
}
.health-meter.health-static { cursor: default; }
.health-meter:not(.health-static):active .health-ring { transform: scale(0.97); }

.health-ring {
    --ring-size: 200px;
    --ring-thickness: 16px;
    --health-pct: 0;
    --ring-color: var(--status-good);
    width: var(--ring-size);
    height: var(--ring-size);
    border-radius: 50%;
    background: conic-gradient(
        var(--ring-color) calc(var(--health-pct) * 1%),
        rgba(255,255,255,0.06) 0
    );
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: transform 0.1s ease;
    flex-shrink: 0;
}
.health-ring::before {
    content: "";
    position: absolute;
    inset: var(--ring-thickness);
    background: var(--card);
    border-radius: 50%;
}
.health-ring-inner {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}
.health-score {
    font-size: var(--fs-display);
    font-weight: 700;
    line-height: 1;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}
.health-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}
.health-good  { --ring-color: var(--status-good); }
.health-watch { --ring-color: var(--status-watch); }
.health-risk  { --ring-color: var(--status-risk); }
.health-good  .health-label { color: var(--status-good); }
.health-watch .health-label { color: var(--status-watch); }
.health-risk  .health-label { color: var(--status-risk); }

.health-hint {
    font-size: 0.75rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-top: 4px;
}
.health-meter[aria-expanded="true"] .health-hint { opacity: 0; }

.metrics-detail {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    animation: metricsReveal 0.18s ease-out;
}
.metrics-detail[hidden] { display: none; }
@keyframes metricsReveal {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
@media (prefers-reduced-motion: reduce) {
    .metrics-detail {
        animation: none;
    }
}
.metrics-detail .metric-card {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: var(--radius-sm);
    padding: 12px;
}
.metric-unit {
    font-size: 0.9rem;
    color: var(--muted);
    font-weight: 500;
    margin-left: 3px;
}
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}
@media (min-width: 600px) { .stats-grid { grid-template-columns: repeat(4, 1fr); } }

.trend-card {
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: var(--radius-sm);
    padding: 14px;
}
.trend-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--muted);
    margin-bottom: 8px;
}
.trend-svg {
    width: 100%;
    height: auto;
    display: block;
}
/* ── Temperature chart toggle buttons ──────────────────────────── */
.tc-toggles {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}
.tc-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    border: 1.5px solid var(--tc-color, var(--muted));
    background: transparent;
    color: var(--tc-color, var(--muted));
    opacity: 0.45;
    transition: opacity 0.15s, background 0.15s;
}
.tc-btn.tc-btn-active {
    opacity: 1;
    background: color-mix(in srgb, var(--tc-color, var(--muted)) 15%, transparent);
}
/* Hidden series in the SVG */
.tc-chart g.tc-hidden,
.cc-chart g.tc-hidden { display: none; }

.trend-empty {
    background: rgba(255,255,255,0.02);
    border: 1px dashed rgba(255,255,255,0.1);
    border-radius: var(--radius-sm);
    padding: 18px;
    color: var(--muted);
    font-size: 0.9rem;
    text-align: center;
}

@media (min-width: 600px) {
    .health-ring { --ring-size: 240px; }
    .health-score { font-size: 4rem; }
}

/* Manage forms + danger zone */
.manage-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 10px;
}
/* manage-form layout (inputs styled by the universal rule above) */
.manage-form label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    color: var(--muted);
    font-size: 0.8rem;
}
.manage-form .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

/* action-form labels (inspect selects) */
.action-form label,
.visit-inspect label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.8rem;
    color: var(--muted);
}
.checkbox-label {
    flex-direction: row !important;
    align-items: center;
    gap: 8px !important;
    min-height: var(--touch);
    font-size: 0.9rem !important;
    color: var(--text) !important;
    padding-top: 20px;
}
.checkbox-label input[type="checkbox"] {
    width: 22px;
    height: 22px;
    accent-color: var(--gold);
    margin: 0;
}
.danger-row {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid rgba(255,255,255,0.06);
}
.btn-danger {
    background: transparent;
    color: var(--status-risk);
    border-color: rgba(229,57,53,0.5);
}
.btn-danger:hover {
    background: rgba(229,57,53,0.12);
    border-color: var(--status-risk);
}
.btn-danger:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* Delete confirmation zone */
.delete-zone { display: flex; flex-direction: column; gap: 10px; }
.delete-form {
    padding: 14px;
    background: rgba(229,57,53,0.08);
    border: 1px solid rgba(229,57,53,0.35);
    border-radius: var(--radius-sm);
    gap: 12px;
}
.delete-form[hidden] { display: none; }
.delete-warning {
    margin: 0;
    color: #ffb4b1;
    font-size: 0.9rem;
    line-height: 1.4;
}
.delete-warning strong { color: var(--text); }
.delete-form label strong { color: var(--status-risk); }
.delete-actions {
    display: flex;
    gap: 10px;
}
.delete-actions .btn { flex: 1 1 auto; }

/* Harvest countdown card */
.countdown-card { padding: var(--space); }
.countdown-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.countdown-days {
    font-size: 3rem;
    font-weight: 700;
    color: var(--gold);
    line-height: 1;
    font-variant-numeric: tabular-nums;
}
.countdown-days-unit {
    font-size: 0.9rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-left: 6px;
}
.countdown-milestone {
    font-size: 1.05rem;
    color: var(--text);
    font-weight: 500;
    margin-bottom: 4px;
}
.countdown-target {
    font-size: 0.85rem;
    color: var(--muted);
}
.countdown-explain {
    margin-top: 10px;
    padding: 10px 12px;
    background: rgba(47,93,80,0.15);
    border-left: 3px solid var(--green);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    color: var(--muted);
}

/* ── Delay Harvest — operator override chips ────────────────────
 * Sits below the Harvest Countdown explanation. Surfaces only when
 * countdown <= 7 days or "Ready now" (gated server-side in
 * pages/bin.php). When the bin is currently in a delay window, the
 * label flips to "✓ Delayed N days" so the operator knows the
 * override is active.
 */
.delay-harvest-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
    margin-top: 12px;
    padding: 10px 12px;
    background: rgba(198,167,94,0.08);
    border: 1px solid rgba(198,167,94,0.25);
    border-radius: var(--radius-sm);
}
.delay-harvest-label {
    font-size: 0.85rem;
    color: var(--muted);
    flex: 1 1 auto;
    min-width: 120px;
}
.delay-harvest-label-active {
    color: var(--gold);
    font-weight: 600;
}
.delay-harvest-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.delay-harvest-chip {
    appearance: none;
    background: rgba(198,167,94,0.14);
    border: 1px solid rgba(198,167,94,0.40);
    border-radius: 999px;
    color: var(--text);
    font-size: 0.82rem;
    font-weight: 600;
    padding: 8px 14px;
    min-height: 44px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s, border-color 0.15s;
}
.delay-harvest-chip:hover,
.delay-harvest-chip:focus-visible {
    background: rgba(198,167,94,0.22);
    border-color: rgba(198,167,94,0.65);
    outline: none;
}
.delay-harvest-chip:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: -2px;
}
.delay-harvest-chip.loading {
    opacity: 0.55;
    pointer-events: none;
}

.mode-toggle-row {
    display: flex !important;
    flex-direction: row !important;
    gap: 10px;
    align-items: center;
    margin-top: 10px;
    margin-bottom: 0;
    padding-top: 10px;
    border-top: 1px solid rgba(255,255,255,0.06);
    flex-wrap: wrap;
}
.mode-toggle-row label {
    font-size: 0.8rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.mode-toggle-row select {
    flex: 1 1 140px;
    border-color: rgba(198,167,94,0.3);
}

/* Photos */
.photos-header {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: space-between;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.btn-photo {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: auto;
    min-width: 160px;
    padding: 10px 16px;
    cursor: pointer;
}
.btn-photo.btn-photo-full {
    display: flex;
    width: 100%;
    justify-content: center;
    padding: 16px;
    font-size: 1rem;
    font-weight: 600;
    margin: 6px 0 14px;
}
.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 8px;
}
.photo-thumb {
    display: block;
    aspect-ratio: 1 / 1;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.06);
    transition: transform 0.1s ease, border-color 0.15s ease;
}
.photo-thumb:hover { border-color: rgba(198,167,94,0.5); }
.photo-thumb:active { transform: scale(0.97); }
.photo-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.photo-empty {
    grid-column: 1 / -1;
    padding: 24px;
    text-align: center;
    background: rgba(255,255,255,0.02);
    border: 1px dashed rgba(255,255,255,0.1);
    border-radius: var(--radius-sm);
    color: var(--muted);
    font-size: 0.9rem;
}

/* Lightbox */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.92);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    gap: 14px;
    z-index: 200;
    animation: lightbox-fade 0.15s ease;
}
@keyframes lightbox-fade { from { opacity: 0; } to { opacity: 1; } }
.lightbox img {
    max-width: 100%;
    max-height: 75vh;
    object-fit: contain;
    border-radius: var(--radius-sm);
    box-shadow: 0 8px 40px rgba(0,0,0,0.6);
}
.lightbox-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 44px;
    height: 44px;
    font-size: 1.8rem;
    background: rgba(255,255,255,0.08);
    color: var(--text);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 50%;
    cursor: pointer;
    line-height: 1;
    font-family: inherit;
}
.lightbox-close:hover { background: rgba(255,255,255,0.15); }
.lightbox-caption {
    color: var(--muted);
    font-size: 0.85rem;
}
.lightbox-delete { max-width: 240px; width: 100%; }

/* Auth pages */
.auth-body { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-wrap { width: 100%; max-width: 420px; }
.auth-brand { text-align: center; margin-bottom: 20px; }
.auth-logo  { font-size: 1.6rem; line-height: 1; margin-bottom: 8px; color: var(--gold); font-weight: 600; }
.auth-logo-img {
    display: block;
    width: 280px;
    height: auto;
    max-width: 80vw;
    object-fit: contain;
    margin: 0 auto;
}
.auth-title { font-size: 1.6rem; color: var(--gold); margin: 0 0 6px; font-weight: 600; }
.auth-tag   { color: var(--muted); font-size: 0.9rem; margin: 0; }
.auth-card  { padding: 20px; }
.auth-tabs  {
    display: flex;
    gap: 4px;
    background: rgba(255,255,255,0.03);
    padding: 4px;
    border-radius: var(--radius-sm);
    margin-bottom: 18px;
}
.auth-tab {
    flex: 1 1 auto;
    min-height: 44px;
    padding: 8px 14px;
    background: transparent;
    color: var(--muted);
    border: 0;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
}
.auth-tab.active {
    background: var(--green);
    color: var(--text);
    box-shadow: 0 2px 10px rgba(47,93,80,0.3);
}
.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-form[hidden] { display: none; }

/* OAuth buttons */
.oauth-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}
.oauth-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 11px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    transition: opacity 0.15s, transform 0.1s;
    cursor: pointer;
    font-family: inherit;
    border: none;
}
.oauth-btn:hover { opacity: 0.88; transform: translateY(-1px); text-decoration: none; }
.oauth-btn:active { transform: translateY(0); }
.oauth-btn-google {
    background: #fff;
    color: #3c4043;
    border: 1px solid rgba(0,0,0,0.12);
}
.oauth-btn-apple {
    background: #fff;
    color: #000;
    border: 1px solid rgba(0,0,0,0.12);
}
.oauth-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}
.oauth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    color: var(--muted);
    font-size: 0.78rem;
}
.oauth-divider::before,
.oauth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255,255,255,0.1);
}

.auth-legal {
    font-size: 0.7rem;
    color: var(--muted);
    opacity: 0.6;
    text-align: center;
    margin: 0;
    line-height: 1.4;
}
.auth-form label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.8rem;
    color: var(--muted);
}

/* Nav badge (tasks due today) */
.nav-badge {
    display: inline-block;
    min-width: 20px;
    padding: 0 6px;
    background: var(--status-risk);
    color: #fff;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    text-align: center;
    line-height: 18px;
    vertical-align: middle;
    margin-left: 2px;
}
.logout-link {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.08);
    cursor: pointer;
    font-family: inherit;
}
.logout-link:hover { border-color: rgba(198,167,94,0.4); color: var(--text); }

/* Notice banner (due-today alert) */
.notice {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 720px;
    margin: 0 auto;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    flex-wrap: wrap;
}
.notice-attention {
    background: rgba(255,193,7,0.1);
    border: 1px solid rgba(255,193,7,0.35);
    color: var(--text);
    margin-top: var(--space);
}
.notice-verify {
    background: rgba(198,167,94,0.08);
    border: 1px solid rgba(198,167,94,0.3);
    color: var(--text);
    margin-top: var(--space);
}
.notice-icon { font-size: 1.3rem; }
.notice-cta {
    margin-left: auto;
    background: var(--status-watch);
    color: #0F1110;
    padding: 6px 14px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.85rem;
    text-decoration: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
}
.notice-cta:hover { text-decoration: none; background: #ffd454; }
.notice-verify .notice-cta {
    background: var(--gold);
}
.notice-verify .notice-cta:hover { background: #d4b870; }
.notice-verify { border-left: 4px solid var(--gold); }
.notice-dismiss {
    background: transparent;
    border: none;
    color: var(--muted);
    cursor: pointer;
    font-size: 1.1rem;
    font-family: inherit;
    line-height: 1;
    padding: 4px 6px;
    margin-left: auto;
    flex-shrink: 0;
    opacity: 0.7;
    transition: opacity 0.15s;
}
.notice-dismiss:hover { opacity: 1; }
.notice-dismiss:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* Next service + task-due highlight */
.next-service-card { border-left: 3px solid var(--status-watch); }
.next-service-list .list-item { padding: 10px 12px; }
.list-item.task-due {
    background: rgba(255,193,7,0.08);
    border-color: rgba(255,193,7,0.35);
}

/* ── ⓘ Info buttons ─────────────────────────────────────────────── */
.info-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(198,167,94,0.12);
    border: 1px solid rgba(198,167,94,0.3);
    color: rgba(198,167,94,0.8);
    font-size: 0.65rem;
    cursor: pointer;
    font-family: inherit;
    vertical-align: middle;
    margin-left: 4px;
    padding: 0;
    line-height: 1;
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
}
.info-btn:hover, .info-btn:focus-visible {
    background: rgba(198,167,94,0.28);
    color: var(--gold);
    outline: none;
}
.info-btn-sm { width: 15px; height: 15px; font-size: 0.6rem; margin-left: 3px; }

/* Info bottom sheet */
.info-sheet {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: flex;
    align-items: flex-end;
    pointer-events: none;
}
.info-sheet.is-open { pointer-events: all; }
.info-sheet-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0);
    transition: background 0.25s;
}
.info-sheet.is-open .info-sheet-overlay { background: rgba(0,0,0,0.55); }
.info-sheet-panel {
    position: relative;
    width: 100%;
    max-width: 720px;
    margin: 0 auto;
    background: #1c2820;
    border: 1px solid rgba(198,167,94,0.25);
    border-bottom: 0;
    border-radius: var(--radius) var(--radius) 0 0;
    padding: 20px var(--space) calc(var(--space) + env(safe-area-inset-bottom, 0px));
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.32,0.72,0,1);
}
.info-sheet.is-open .info-sheet-panel { transform: translateY(0); }
.info-sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    gap: 12px;
}
.info-sheet-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--gold);
}
.info-sheet-close {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--muted);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    cursor: pointer;
    font-family: inherit;
    flex-shrink: 0;
    transition: background 0.15s;
}
.info-sheet-close:hover { background: rgba(255,255,255,0.12); }
.info-sheet-body {
    font-size: 0.9rem;
    color: var(--muted);
    line-height: 1.6;
    margin: 0;
}

/* ── Learn page ─────────────────────────────────────────────────── */

/* Legacy article class (keep for any remaining usage) */
.learn-article { line-height: 1.6; color: var(--text); }
.learn-article h2 { color: var(--gold); margin: 24px 0 8px; font-size: 1.1rem; text-transform: uppercase; letter-spacing: 0.1em; }
.learn-article h2:first-child { margin-top: 0; }
.learn-article p { margin: 0 0 12px; color: var(--text); }
.learn-article ul { padding-left: 20px; margin: 0 0 14px; }
.learn-article li { margin-bottom: 6px; color: var(--text); }
.learn-article strong { color: var(--gold); }

/* Page intro */
.learn-intro {
    padding: 20px var(--space);
    background: linear-gradient(135deg, #1a2e24 0%, #0f1a14 100%);
    border: 1px solid rgba(198,167,94,0.25);
    border-radius: var(--radius);
}
.learn-intro-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--gold);
    letter-spacing: 0.04em;
    margin: 0 0 6px;
}
.learn-intro-sub {
    font-size: 0.9rem;
    color: var(--muted);
    margin: 0;
    line-height: 1.5;
}
.learn-principle {
    margin-top: 14px;
    padding: 12px 16px;
    background: rgba(198,167,94,0.07);
    border-left: 3px solid var(--gold);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: 0.95rem;
    color: var(--text);
    font-weight: 500;
}
.learn-principle strong { color: var(--gold); }

/* Topic section: slim section-toggle with tagline */
.learn-topic { padding: 0; overflow: hidden; }
.learn-topic .btn-section-toggle { border-radius: var(--radius); }
.learn-topic .btn-section-toggle[aria-expanded="true"] {
    border-radius: var(--radius) var(--radius) 0 0;
}
.learn-topic-tagline {
    font-size: 0.75rem;
    color: rgba(198,167,94,0.6);
    font-weight: 400;
    letter-spacing: 0.05em;
    margin-left: 4px;
}
.learn-body {
    padding: 0 var(--space) var(--space);
    background: var(--card);
    border: 1px solid rgba(198,167,94,0.15);
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* TLDR / Full depth toggle */
.learn-depth-bar {
    display: flex;
    gap: 8px;
    padding-top: var(--space);
    border-bottom: 1px solid rgba(255,255,255,0.05);
    padding-bottom: 14px;
}
.learn-depth-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 18px;
    min-height: 36px;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    border-radius: 999px;
    cursor: pointer;
    font-family: inherit;
    border: 1px solid rgba(198,167,94,0.25);
    background: transparent;
    color: var(--muted);
    transition: all 0.15s ease;
    width: auto;
    min-height: 36px;
}
.learn-depth-btn.active {
    background: var(--gold);
    color: #0F1110;
    border-color: var(--gold);
}
.learn-depth-btn:hover:not(.active) {
    border-color: var(--gold);
    color: var(--gold);
    background: rgba(198,167,94,0.08);
}

/* Learn pane content */
.learn-pane { display: flex; flex-direction: column; gap: 14px; }
.learn-pane[hidden] { display: none; }

/* State → Meaning → Action table */
.learn-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.learn-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
    min-width: 320px;
}
.learn-table th {
    text-align: left;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--gold);
    padding: 8px 12px;
    border-bottom: 1px solid rgba(198,167,94,0.25);
    font-weight: 700;
    white-space: nowrap;
}
.learn-table td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    color: var(--text);
    vertical-align: top;
    line-height: 1.4;
}
.learn-table tr:last-child td { border-bottom: 0; }
.learn-table tr.row-good  td:first-child { border-left: 3px solid var(--status-good); }
.learn-table tr.row-watch td:first-child { border-left: 3px solid var(--status-watch); }
.learn-table tr.row-risk  td:first-child { border-left: 3px solid var(--status-risk); }
.learn-table tr.row-neutral td:first-child { border-left: 3px solid rgba(198,167,94,0.5); }
.learn-table .action-cell {
    color: var(--gold);
    font-weight: 600;
}
.learn-table .state-cell {
    font-weight: 600;
    white-space: nowrap;
}

/* Phase timeline rows */
.learn-phases { display: flex; flex-direction: column; gap: 0; }
.learn-phase {
    display: flex;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    align-items: flex-start;
}
.learn-phase:last-child { border-bottom: 0; }
.learn-phase-num {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(198,167,94,0.12);
    border: 1px solid rgba(198,167,94,0.4);
    color: var(--gold);
    font-weight: 700;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 2px;
}
.learn-phase-body { flex: 1 1 auto; }
.learn-phase-title {
    font-weight: 700;
    color: var(--text);
    font-size: 0.95rem;
    margin-bottom: 3px;
}
.learn-phase-time {
    font-size: 0.75rem;
    color: var(--gold);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
    margin-bottom: 5px;
}
.learn-phase-desc {
    font-size: 0.87rem;
    color: var(--muted);
    line-height: 1.5;
    margin-bottom: 5px;
}
.learn-phase-action {
    display: inline-block;
    font-size: 0.78rem;
    color: var(--gold);
    background: rgba(198,167,94,0.08);
    border: 1px solid rgba(198,167,94,0.25);
    border-radius: 999px;
    padding: 3px 10px;
    font-weight: 600;
}

/* Bullet list inside panes */
.learn-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.learn-list li {
    padding: 10px 14px;
    background: rgba(255,255,255,0.025);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255,255,255,0.04);
    font-size: 0.88rem;
    color: var(--text);
    line-height: 1.5;
}
.learn-list li strong { color: var(--gold); }
.learn-list.learn-list-good li { border-left: 3px solid var(--status-good); }
.learn-list.learn-list-bad  li { border-left: 3px solid var(--status-risk); }

/* Heading inside pane */
.learn-h {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--gold);
    font-weight: 700;
    margin: 0;
}
.learn-p {
    font-size: 0.88rem;
    color: var(--muted);
    margin: 0;
    line-height: 1.6;
}
.learn-p strong { color: var(--text); }

/* Audit card (Does VermiCycle OS follow its advice?) */
.learn-audit {
    background: linear-gradient(135deg, #1a2e24 0%, #0f1a14 100%);
    border: 1px solid rgba(198,167,94,0.3);
    border-radius: var(--radius);
    padding: var(--space);
}
.learn-audit-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--gold);
    margin: 0 0 14px;
    letter-spacing: 0.04em;
}
.learn-audit-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    font-size: 0.88rem;
}
.learn-audit-row:last-child { border-bottom: 0; }
.learn-audit-icon { font-size: 1rem; flex-shrink: 0; width: 20px; text-align: center; margin-top: 1px; }
.learn-audit-text { flex: 1; color: var(--text); line-height: 1.4; }
.learn-audit-text .muted { font-size: 0.8rem; display: block; margin-top: 2px; }

/* ── Bin License Card ───────────────────────────────────────────── */
.bin-license {
    background: linear-gradient(145deg, #1a2e24 0%, #0f1a14 100%);
    border: 1px solid rgba(198,167,94,0.45);
    border-radius: var(--radius);
    overflow: hidden;
}
/* Header is now a full-width tap button */
.bin-license-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 16px;
    border-bottom: 1px solid rgba(198,167,94,0.2);
    background: rgba(198,167,94,0.07);
    gap: 10px;
    width: 100%;
    cursor: pointer;
    font-family: inherit;
    color: inherit;
    border: none;
    border-bottom: 1px solid rgba(198,167,94,0.2);
    border-radius: var(--radius) var(--radius) 0 0;
    text-align: left;
    transition: background 0.15s;
}
.bin-license-header:hover,
.bin-license-header:focus-visible { background: rgba(198,167,94,0.13); outline: none; }
.bin-license-header-left { display: flex; flex-direction: column; gap: 1px; }
.bin-license-eyebrow {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    color: rgba(198,167,94,0.7);
    font-weight: 600;
}
.bin-license-system {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--gold);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.bin-license-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgba(198,167,94,0.6);
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    flex-shrink: 0;
}
.bin-license-hint { font-weight: 600; }
.bin-license-chevron {
    font-size: 0.85rem;
    transition: transform 0.22s ease;
    display: inline-block;
}
.bin-license.is-expanded .bin-license-chevron { transform: rotate(180deg); }
.bin-license-body {
    display: flex;
    align-items: stretch;
}
.bin-license-left {
    padding: 16px 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    border-right: 1px solid rgba(198,167,94,0.18);
    min-width: 120px;
    flex-shrink: 0;
    background: rgba(0,0,0,0.2);
}
.bin-license-id-box {
    border: 2px solid rgba(198,167,94,0.45);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    text-align: center;
    background: rgba(0,0,0,0.35);
    width: 100%;
}
.bin-license-id-label {
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--gold);
    font-weight: 700;
    display: block;
    margin-bottom: 3px;
}
.bin-license-id-value {
    font-size: var(--fs-id);
    font-weight: 800;
    color: var(--text);
    letter-spacing: 0.04em;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    font-family: 'Courier New', Courier, monospace;
}
.bin-license-wordmark {
    height: 32px;
    width: auto;
    max-width: 90px;
    object-fit: contain;
    opacity: 0.75;
    display: block;
}
.bin-license-right {
    flex: 1 1 auto;
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    gap: 0;
    justify-content: center;
}
.bin-license-name-row {
    padding: 6px 0 8px;
    border-bottom: 1px solid rgba(198,167,94,0.15);
    margin-bottom: 4px;
}
.bin-license-name {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: 0.01em;
    line-height: 1.2;
}
.bin-license-purpose {
    font-size: 0.78rem;
    color: var(--gold);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-top: 2px;
}
.bin-license-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}
.bin-license-row:last-child { border-bottom: 0; }
.bin-license-row-icon {
    font-size: 0.9rem;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
    opacity: 0.8;
}
.bin-license-row-label {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--gold);
    font-weight: 600;
    flex: 0 0 90px;
}
.bin-license-row-value {
    font-size: 0.88rem;
    color: var(--text);
    font-weight: 500;
}
.bin-license-footer {
    padding: 7px 14px;
    background: rgba(198,167,94,0.05);
    border-top: 1px solid rgba(198,167,94,0.18);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 6px;
}
.bin-license-tagline {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: rgba(198,167,94,0.6);
    font-weight: 600;
}
.bin-license-detail { display: none; }
.bin-license.is-expanded .bin-license-detail { display: flex; }

/* Collapsible QR section (default closed). Toggle is the <summary>;
   contents slide open on click. Reduces visual weight in the colony
   profile card — most operators print the QR once and never look at
   it again. */
.bin-qr-details {
    border-top: 1px solid rgba(198,167,94,0.18);
}
.bin-qr-summary {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    list-style: none;
    user-select: none;
    background: rgba(255,255,255,0.015);
    transition: background 0.15s ease;
    min-height: 44px;
}
.bin-qr-summary::-webkit-details-marker { display: none; }
.bin-qr-summary:hover { background: rgba(255,255,255,0.04); }
.bin-qr-summary-icon {
    color: var(--gold);
    font-size: 1rem;
    flex-shrink: 0;
}
.bin-qr-summary-label {
    flex: 1;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--gold);
    font-weight: 700;
}
.bin-qr-summary-chevron {
    color: var(--muted);
    font-size: 0.9rem;
    transition: transform 0.15s ease;
    flex-shrink: 0;
}
.bin-qr-details[open] .bin-qr-summary-chevron {
    transform: rotate(180deg);
}
.bin-qr-preview-failed {
    /* When the API returns 503 or 404, the <img> onerror fires and
       this class flips on. Hide the broken image icon; the hint text
       below explains the failure and points at the download buttons. */
    visibility: hidden;
    width: 0;
    padding: 0;
}
.bin-qr-fail-hint {
    font-size: 0.78rem;
    color: rgb(238, 150, 150);
    margin-bottom: 6px;
    padding: 6px 8px;
    background: rgba(214, 92, 92, 0.10);
    border: 1px solid rgba(214, 92, 92, 0.40);
    border-radius: 6px;
}

.bin-qr-row {
    display: flex;
    gap: 14px;
    align-items: center;
    padding: 12px 14px;
    border-top: 1px solid rgba(198,167,94,0.10);
    background: rgba(255,255,255,0.02);
    flex-wrap: wrap;
}
.bin-qr-preview {
    width: 96px;
    height: 96px;
    border-radius: 8px;
    background: #fff;
    padding: 4px;
    flex-shrink: 0;
}
.bin-qr-actions {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1 1 200px;
    min-width: 0;
}
.bin-qr-label {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--gold);
    font-weight: 700;
}
.bin-qr-hint {
    font-size: 0.78rem;
    color: var(--muted);
    margin-bottom: 4px;
}
.bin-qr-btn {
    width: auto;
    align-self: flex-start;
    min-height: 34px;
    padding: 6px 12px;
    font-size: 0.8rem;
    margin-right: 6px;
}
.bin-license-phase-detail {
    font-size: 0.73rem;
    color: var(--muted);
    line-height: 1.4;
    flex: 1 1 auto;
}
@media (max-width: 420px) {
    .bin-license-left { min-width: 96px; padding: 12px 10px; }
    .bin-license-id-value { font-size: 1.25rem; }
    .bin-license-row-label { flex: 0 0 72px; }
}

/* ── Walkthrough Overlay ─────────────────────────────────────────── */
.walkthrough {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.walkthrough.is-open {
    pointer-events: all;
    opacity: 1;
}
.walkthrough-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.82);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.walkthrough-card {
    position: relative;
    width: 100%;
    max-width: 420px;
    background: linear-gradient(145deg, #1a2e24 0%, #0f1a14 100%);
    border: 1px solid rgba(198,167,94,0.3);
    border-radius: var(--radius);
    padding: 28px var(--space) 24px;
    transform: translateY(24px) scale(0.97);
    transition: transform 0.35s cubic-bezier(0.32,0.72,0,1);
    max-height: 90vh;
    overflow-y: auto;
}
.walkthrough.is-open .walkthrough-card {
    transform: translateY(0) scale(1);
}

/* Progress dots */
.walkthrough-progress {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 24px;
}
.wt-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(198,167,94,0.2);
    border: 1px solid rgba(198,167,94,0.3);
    transition: background 0.25s, transform 0.25s;
}
.wt-dot.active {
    background: var(--gold);
    transform: scale(1.2);
}

/* Logo */
.wt-logo-wrap {
    text-align: center;
    margin-bottom: 16px;
}
.wt-logo {
    height: 36px;
    opacity: 0.9;
}

/* Typography */
.wt-title {
    font-size: var(--fs-h1);
    font-weight: 700;
    color: var(--gold);
    text-align: center;
    margin: 0 0 8px;
    letter-spacing: 0.02em;
}
.wt-sub {
    font-size: 0.88rem;
    color: var(--muted);
    text-align: center;
    margin: 0 0 22px;
    line-height: 1.5;
}
.wt-step-icon {
    font-size: 2rem;
    text-align: center;
    margin-bottom: 12px;
}

/* Farm name input */
.wt-field {
    margin-bottom: 22px;
}
.wt-label {
    display: block;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: rgba(198,167,94,0.7);
    font-weight: 600;
    margin-bottom: 6px;
}
.wt-input {
    width: 100%;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(198,167,94,0.3);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: inherit;
    font-size: 1.05rem;
    padding: 10px 12px;
    outline: none;
    transition: border-color 0.15s;
}
.wt-input:focus { border-color: rgba(198,167,94,0.7); }
.wt-field-hint {
    display: block;
    font-size: 0.7rem;
    color: var(--muted);
    margin-top: 5px;
}

/* Bins list */
.wt-bins-list {
    list-style: none;
    margin: 0 0 22px;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 220px;
    overflow-y: auto;
}
.wt-bin-row {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: var(--radius-sm);
    padding: 9px 12px;
}
.wt-bin-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--gold);
    letter-spacing: 0.08em;
    flex-shrink: 0;
    min-width: 62px;
}
.wt-bin-name {
    font-size: 0.88rem;
    color: var(--text);
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.wt-empty-bins {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255,255,255,0.04);
    border: 1px dashed rgba(198,167,94,0.2);
    border-radius: var(--radius-sm);
    padding: 14px;
    color: var(--muted);
    font-size: 0.88rem;
    margin-bottom: 22px;
}
.wt-empty-icon { font-size: 1.3rem; }

/* Features list */
.wt-features {
    list-style: none;
    margin: 0 0 24px;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.wt-feature {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: rgba(255,255,255,0.04);
    border-radius: var(--radius-sm);
    padding: 12px;
}
.wt-feature-icon {
    font-size: 1.3rem;
    flex-shrink: 0;
    margin-top: 1px;
}
.wt-feature strong {
    display: block;
    font-size: 0.9rem;
    color: var(--text);
    margin-bottom: 3px;
}
.wt-feature span {
    font-size: 0.78rem;
    color: var(--muted);
    line-height: 1.4;
}

/* Buttons */
.wt-next-btn,
#wt-finish {
    width: 100%;
    margin-bottom: 10px;
}
.wt-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
}
.wt-actions .btn {
    width: 100%;
}
.wt-skip-btn {
    display: block;
    width: 100%;
    text-align: center;
    background: none;
    border: none;
    color: rgba(198,167,94,0.45);
    font-size: 0.75rem;
    font-family: inherit;
    cursor: pointer;
    padding: 6px 0 0;
    transition: color 0.15s;
}
.wt-skip-btn:hover { color: var(--muted); }

/* ── Settings Open Sections (Tutorial + Integrations) ───────────── */
.settings-open-section {
    padding: 14px var(--space) 6px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.settings-open-section:last-of-type { border-bottom: 0; }
.settings-feature-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0 6px;
}
.settings-feature-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.settings-feature-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
}
.settings-feature-sub {
    font-size: 0.75rem;
    color: var(--muted);
}
.settings-integration-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1 1 auto;
}
.list-sub {
    font-size: 0.72rem;
    color: var(--muted);
    line-height: 1.3;
}

/* ── Confirm Modal ──────────────────────────────────────────────── */
.confirm-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 1050;
    padding: 0 0 env(safe-area-inset-bottom, 0);
    animation: lightbox-fade 0.15s ease;
}
.confirm-modal-box {
    background: var(--card);
    border: 1px solid rgba(198,167,94,0.25);
    border-radius: var(--radius) var(--radius) 0 0;
    padding: 20px 20px 28px;
    width: 100%;
    max-width: 480px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.confirm-modal-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin: 0;
}
.confirm-modal-msg {
    font-size: 0.9rem;
    color: var(--muted);
    margin: 0;
}
.confirm-modal-actions { display: flex; gap: 10px; }
.confirm-modal-actions .btn { flex: 1 1 auto; width: auto; }
.confirm-modal-actions .btn-danger { color: #ffb4b1; background: rgba(229,57,53,0.12); border-color: rgba(229,57,53,0.5); }
.confirm-modal-actions .btn-danger:hover { background: rgba(229,57,53,0.22); border-color: var(--status-risk); }

/* ── Prompt Modal ───────────────────────────────────────────────── */
.prompt-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.75);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 300;
    padding: 0 0 env(safe-area-inset-bottom, 0);
    animation: lightbox-fade 0.15s ease;
}
.prompt-modal-box {
    background: var(--card);
    border: 1px solid rgba(198,167,94,0.25);
    border-top-left-radius: var(--radius);
    border-top-right-radius: var(--radius);
    padding: 20px 20px 28px;
    width: 100%;
    max-width: 480px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.prompt-modal-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin: 0;
}
.prompt-modal-actions { display: flex; gap: 10px; }
.prompt-modal-actions .btn { flex: 1 1 auto; width: auto; }
/* Inline form label/input used inside modals */
.form-label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--muted);
    font-weight: 500;
}
.form-input {
    min-height: var(--touch);
    background: #0F1110;
    color: var(--text);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 1rem;
    font-family: inherit;
    width: 100%;
    caret-color: var(--gold);
}
.form-input:focus { outline: none; border-color: var(--gold); }

/* ── Feedback Admin ────────────────────────────────────────────── */
.feedback-filter-tab {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--muted);
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.feedback-filter-tab:hover { color: var(--text); background: rgba(255,255,255,0.08); text-decoration: none; }
.feedback-filter-tab.active {
    background: rgba(198,167,94,0.1);
    border-color: rgba(198,167,94,0.35);
    color: var(--gold);
    font-weight: 700;
}
.feedback-filter-count {
    background: rgba(255,255,255,0.08);
    border-radius: 20px;
    font-size: 0.7rem;
    padding: 1px 6px;
}
.fb-entry { display: flex; flex-direction: column; gap: 10px; }
.fb-entry-header {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.fb-type-badge {
    font-size: 0.72rem;
    font-weight: 700;
    border: 1px solid;
    border-radius: 20px;
    padding: 2px 9px;
    letter-spacing: 0.03em;
    flex-shrink: 0;
}
.fb-meta {
    font-size: 0.78rem;
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}
.fb-email { color: var(--gold); font-size: 0.75rem; }
.fb-page-url {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.72rem;
    color: var(--muted);
    background: rgba(255,255,255,0.03);
    border-radius: 6px;
    padding: 4px 8px;
    font-family: 'Courier New', monospace;
}
.fb-message {
    font-size: 0.92rem;
    color: var(--text);
    line-height: 1.6;
    margin: 0;
    white-space: pre-wrap;
}
.fb-screenshot-wrap {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.fb-screenshot-img {
    max-width: 100%;
    max-height: 280px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255,255,255,0.1);
    object-fit: contain;
    display: block;
    cursor: zoom-in;
}
.fb-screenshot-label { font-size: 0.72rem; color: var(--muted); }

/* ── BETA badge ────────────────────────────────────────────────── */
.beta-header-badge {
    position: fixed;
    top: 11px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 11;
    background: rgba(198,167,94,0.12);
    border: 1px solid rgba(198,167,94,0.45);
    color: var(--gold);
    font-size: 0.6rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    padding: 3px 8px;
    border-radius: 20px;
    pointer-events: none;
    white-space: nowrap;
}
.beta-pill {
    display: inline-flex;
    align-items: center;
    background: rgba(198,167,94,0.12);
    border: 1px solid rgba(198,167,94,0.3);
    color: var(--gold);
    font-size: 0.58rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    padding: 2px 6px;
    border-radius: 20px;
    white-space: nowrap;
    flex-shrink: 0;
}
.app-menu-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Top-bar notification bell */
.app-header { padding-right: 70px; }
.top-notification-center {
    position: fixed;
    top: 12px;
    right: 16px;
    z-index: 60;
}
.top-notification-btn {
    position: relative;
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    border: 1px solid rgba(198,167,94,0.35);
    background: rgba(15,17,16,0.72);
    color: var(--text);
    font-family: inherit;
    font-size: 1.05rem;
    line-height: 1;
    cursor: pointer;
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.18);
    -webkit-tap-highlight-color: transparent;
    transition: background 120ms ease, border-color 120ms ease, transform 80ms ease;
}
.top-notification-btn:hover,
.top-notification-btn[aria-expanded="true"] {
    background: rgba(198,167,94,0.14);
    border-color: var(--gold);
}
.top-notification-btn:active { transform: scale(0.98); }
.top-notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: var(--status-watch);
    color: #0F1110;
    border: 1px solid rgba(15,17,16,0.8);
    font-size: 0.68rem;
    font-weight: 800;
    line-height: 1;
}
.top-notification-panel {
    position: absolute;
    top: 50px;
    right: 0;
    width: min(360px, calc(100vw - 24px));
    max-height: min(560px, calc(100vh - 84px));
    overflow: auto;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(198,167,94,0.24);
    background: rgba(16,19,17,0.96);
    color: var(--text);
    box-shadow: 0 22px 70px rgba(0,0,0,0.48);
    backdrop-filter: blur(16px);
}
.top-notification-panel[hidden] { display: none; }
.top-notification-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.top-notification-head a {
    color: var(--gold);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: none;
}
.top-notification-list {
    display: flex;
    flex-direction: column;
    padding: 6px;
}
.top-notification-item {
    display: grid;
    grid-template-columns: 10px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    padding: 12px 10px;
    min-height: 54px;
    border-radius: 9px;
    color: var(--text);
    text-decoration: none;
}
.top-notification-item:hover {
    background: rgba(255,255,255,0.045);
    text-decoration: none;
}
.top-notification-dot {
    width: 8px;
    height: 8px;
    margin-top: 6px;
    border-radius: 999px;
    background: var(--muted);
}
.top-notification-risk .top-notification-dot { background: var(--status-risk); }
.top-notification-warn .top-notification-dot { background: var(--status-watch); }
.top-notification-info .top-notification-dot { background: var(--gold); }
.top-notification-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.top-notification-copy strong {
    color: var(--text);
    font-size: 0.91rem;
    line-height: 1.25;
}
.top-notification-copy span {
    color: var(--muted);
    font-size: 0.78rem;
    line-height: 1.35;
}
.top-notification-empty {
    padding: 16px 14px;
    color: var(--muted);
    font-size: 0.86rem;
    line-height: 1.4;
}
body.theme-light .top-notification-btn,
body.theme-light .top-notification-panel {
    background: rgba(255,255,255,0.96);
    border-color: rgba(198,167,94,0.38);
}
@media (max-width: 600px) {
    .app-header { padding-right: 58px; }
    .top-notification-center {
        top: 13px;
        right: 10px;
    }
    .top-notification-btn {
        width: 40px;
        height: 40px;
    }
    .top-notification-panel {
        top: 48px;
        right: 0;
        width: calc(100vw - 20px);
    }
}
@media print {
    .top-notification-center { display: none !important; }
}

/* ── Feedback FAB ───────────────────────────────────────────────── */
.feedback-fab {
    position: fixed;
    bottom: 24px;
    right: 16px;
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--gold);
    color: #111;
    border: none;
    border-radius: 28px;
    padding: 10px 16px;
    font-size: 0.82rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
    transition: transform 0.15s, opacity 0.15s;
    white-space: nowrap;
}
.feedback-fab:hover  { transform: scale(1.04); }
.feedback-fab:active { transform: scale(0.97); opacity: 0.9; }
.feedback-fab-icon   { font-size: 1rem; }
.feedback-fab-label  { font-size: 0.78rem; }

/* ── Feedback modal ─────────────────────────────────────────────── */
.feedback-modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.25s;
}
.feedback-modal.is-open { opacity: 1; }
.feedback-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.72);
}
.feedback-box {
    position: relative;
    width: 100%;
    max-width: 640px;
    background: var(--card);
    border-radius: var(--radius) var(--radius) 0 0;
    border-top: 1px solid rgba(198,167,94,0.25);
    padding-bottom: env(safe-area-inset-bottom, 0);
    transform: translateY(40px);
    transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1);
    max-height: 92vh;
    overflow-y: auto;
}
.feedback-modal.is-open .feedback-box { transform: translateY(0); }
.feedback-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px var(--space) 14px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
}
.feedback-header-left { display: flex; align-items: center; gap: 8px; }
.feedback-title { font-size: 1rem; font-weight: 700; }
.feedback-close {
    background: none; border: none; color: var(--muted);
    font-size: 1.1rem; cursor: pointer; padding: 4px 8px;
    border-radius: 6px; font-family: inherit;
}
.feedback-close:hover { color: var(--text); }
.feedback-body { padding: 16px var(--space); display: flex; flex-direction: column; gap: 14px; }
.feedback-intro { font-size: 0.88rem; color: var(--muted); margin: 0; }

/* Type buttons */
.feedback-type-row { display: flex; gap: 8px; flex-wrap: wrap; }
.feedback-type-btn {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 20px;
    color: var(--muted);
    font-size: 0.82rem;
    font-family: inherit;
    padding: 7px 14px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    font-weight: 500;
}
.feedback-type-btn:hover { background: rgba(255,255,255,0.1); color: var(--text); }
.feedback-type-btn.active {
    background: rgba(198,167,94,0.12);
    border-color: var(--gold);
    color: var(--gold);
    font-weight: 700;
}

/* Label + textarea */
.feedback-label {
    display: flex;
    flex-direction: column;
    gap: 7px;
    font-size: 0.82rem;
    color: var(--muted);
    font-weight: 500;
}
.feedback-required { color: var(--status-risk); }
.feedback-textarea {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: inherit;
    font-size: 0.95rem;
    line-height: 1.5;
    padding: 10px 12px;
    resize: vertical;
    min-height: 100px;
    caret-color: var(--gold);
    transition: border-color 0.15s;
    width: 100%;
}
.feedback-textarea:focus { outline: none; border-color: var(--gold); }
.feedback-textarea::placeholder { color: rgba(168,176,170,0.5); }

/* Screenshot */
.feedback-screenshot-row {
    display: flex;
    align-items: center;
    gap: 10px;
}
.feedback-screenshot-label {
    display: flex;
    align-items: center;
    gap: 7px;
    background: rgba(255,255,255,0.04);
    border: 1px dashed rgba(255,255,255,0.15);
    border-radius: var(--radius-sm);
    padding: 9px 14px;
    cursor: pointer;
    font-size: 0.82rem;
    color: var(--muted);
    flex: 1 1 auto;
    transition: border-color 0.15s, background 0.15s;
}
.feedback-screenshot-label:hover { border-color: rgba(198,167,94,0.4); background: rgba(198,167,94,0.05); color: var(--text); }
.feedback-screenshot-icon { font-size: 1rem; flex-shrink: 0; }
.feedback-file-input { display: none; }
.feedback-clear-btn {
    background: none; border: 1px solid rgba(255,255,255,0.1);
    color: var(--muted); border-radius: var(--radius-sm);
    font-size: 0.75rem; padding: 6px 10px; cursor: pointer;
    font-family: inherit; white-space: nowrap; flex-shrink: 0;
}
.feedback-clear-btn:hover { color: var(--status-risk); border-color: var(--status-risk); }
.feedback-preview { margin-top: -4px; }
.feedback-preview-img {
    max-width: 100%;
    max-height: 180px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255,255,255,0.1);
    object-fit: contain;
    display: block;
}

/* Footer */
.feedback-footer {
    display: flex;
    gap: 10px;
    padding: 12px var(--space) 16px;
    border-top: 1px solid rgba(255,255,255,0.06);
}
.feedback-footer .btn { flex: 1 1 auto; }

/* Success state */
.feedback-success {
    text-align: center;
    padding: 8px 0 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}
.feedback-success-icon { font-size: 2.4rem; }
.feedback-success-title { font-size: 1.1rem; font-weight: 700; }
.feedback-success-msg { font-size: 0.88rem; color: var(--muted); max-width: 340px; margin: 0; line-height: 1.5; }

/* ── Moisture Assist Modal ─────────────────────────────────────── */
.ma-panel { padding-bottom: env(safe-area-inset-bottom, 0); }
.ma-picker-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px var(--space);
    border-bottom: 1px solid rgba(255,255,255,0.07);
    flex-wrap: wrap;
}
.ma-picker-label {
    font-size: 0.78rem;
    color: var(--muted);
    flex-shrink: 0;
}
.ma-picker-btns {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.ma-pick-btn {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 20px;
    color: var(--muted);
    font-size: 0.75rem;
    font-family: inherit;
    padding: 5px 12px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    white-space: nowrap;
}
.ma-pick-btn:hover { background: rgba(255,255,255,0.1); color: var(--text); }
.ma-btn-active {
    background: rgba(198,167,94,0.15) !important;
    border-color: var(--gold) !important;
    color: var(--gold) !important;
    font-weight: 600;
}
.ma-body { padding: 14px var(--space) 0; min-height: 80px; }
.ma-prompt { color: var(--muted); font-size: 0.88rem; margin: 0; }
.ma-bin-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 8px;
}
.ma-bin-label { font-size: 0.9rem; font-weight: 600; }
.ma-size-label { font-size: 0.72rem; color: var(--muted); }
.ma-moisture-row { font-size: 0.88rem; margin-bottom: 12px; color: var(--muted); }
.ma-divider { border: none; border-top: 1px solid rgba(255,255,255,0.07); margin: 12px 0; }
.ma-result-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    margin-bottom: 6px;
}
.ma-result-action {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--gold);
    margin-bottom: 6px;
}
.ma-recheck { font-size: 0.8rem; color: var(--muted); }
.ma-carbon-tip {
    margin-top: 10px;
    font-size: 0.78rem;
    color: var(--muted);
    background: rgba(255,255,255,0.04);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
}
.ma-why-wrap { padding: 0 var(--space); }
.ma-why-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--muted);
    margin-bottom: 6px;
}
.ma-why-body { font-size: 0.85rem; color: var(--muted); line-height: 1.5; margin: 0; }
.ma-actions {
    display: flex;
    gap: 10px;
    padding: 14px var(--space) 16px;
    margin-top: 8px;
}
.ma-actions .btn { flex: 1 1 auto; }

/* ── Plan license card (extends bin-license) ───────────────────── */
.plan-license .bin-license-header { cursor: default; }
.plan-license .bin-license-header:hover,
.plan-license .bin-license-header:focus-visible { background: transparent; }

/* Tier colour overrides on the ID box */
.plan-tier-box { border-color: rgba(198,167,94,0.45); }
.plan-tier-box-operator  { border-color: var(--gold); }
.plan-tier-box-autopilot { border-color: var(--status-good); }
.plan-tier-id {
    font-size: 1.1rem;
    letter-spacing: 0.04em;
}
.plan-tier-box-autopilot .plan-tier-id { color: var(--status-good); }

/* Footer upgrade button — matches the status badge pill */
.plan-upgrade-footer-btn {
    background: var(--gold);
    color: #111;
    font-weight: 700;
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    padding: 5px 14px;
    border-radius: 20px;
    border: none;
    cursor: pointer;
    font-family: inherit;
    transition: opacity 0.15s;
    white-space: nowrap;
}
.plan-upgrade-footer-btn:hover { opacity: 0.85; }
.plan-change-btn {
    background: rgba(255,255,255,0.1) !important;
    color: var(--muted) !important;
    border: 1px solid rgba(255,255,255,0.15) !important;
}

/* ── Plan lock badge (on section toggles) ──────────────────────── */
.plan-lock-badge {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--gold);
    background: rgba(198,167,94,0.12);
    border: 1px solid rgba(198,167,94,0.3);
    border-radius: 20px;
    padding: 2px 8px;
    letter-spacing: 0.04em;
    margin-left: auto;
}

/* ── Plan tier badge (inline upgrade trigger button) ───────────── */
.plan-tier-badge {
    display: inline-flex;
    align-items: center;
    background: rgba(198,167,94,0.08);
    color: var(--gold);
    border: 1px solid rgba(198,167,94,0.25);
    border-radius: 20px;
    font-size: 0.68rem;
    font-weight: 600;
    padding: 3px 9px;
    cursor: pointer;
    font-family: inherit;
    letter-spacing: 0.03em;
    transition: background 0.15s;
    white-space: nowrap;
}
.plan-tier-badge:hover { background: rgba(198,167,94,0.18); }
.plan-tier-badge-autopilot {
    background: rgba(76,175,80,0.08);
    color: var(--status-good);
    border-color: rgba(76,175,80,0.25);
}
.plan-tier-badge-autopilot:hover { background: rgba(76,175,80,0.16); }

/* ── Plan-gated section overlay ────────────────────────────────── */
.plan-gated-section { position: relative; }
.plan-gate-overlay {
    position: absolute;
    inset: 0;
    z-index: 5;
    background: rgba(15,17,16,0.82);
    backdrop-filter: blur(3px);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 24px;
    text-align: center;
}
.plan-gate-icon { font-size: 1.6rem; }
.plan-gate-msg { font-size: 0.9rem; color: var(--muted); }
.plan-gate-btn { width: auto !important; }

/* ── Upgrade modal ─────────────────────────────────────────────── */
.upgrade-modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.25s;
}
.upgrade-modal.is-open { opacity: 1; }
.upgrade-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.7);
}
.upgrade-modal-box {
    position: relative;
    width: 100%;
    max-width: 720px;
    background: var(--card);
    border-radius: var(--radius) var(--radius) 0 0;
    border-top: 1px solid rgba(198,167,94,0.2);
    padding: 0 0 env(safe-area-inset-bottom, 0);
    transform: translateY(40px);
    transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1);
    overflow-y: auto;
    max-height: 92vh;
}
.upgrade-modal.is-open .upgrade-modal-box { transform: translateY(0); }
.upgrade-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px var(--space) 14px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
}
.upgrade-modal-title { font-size: 1rem; font-weight: 700; }
.upgrade-modal-close {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    font-family: inherit;
}
.upgrade-modal-close:hover { color: var(--text); }
.upgrade-trigger-msg {
    margin: 12px var(--space) 0;
    padding: 10px 14px;
    background: rgba(198,167,94,0.08);
    border-left: 3px solid var(--gold);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: 0.88rem;
    color: var(--gold);
}
.upgrade-tiers {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
    padding: 16px var(--space);
}
@media (max-width: 500px) {
    .upgrade-tiers { grid-template-columns: 1fr; }
}
.upgrade-tier {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: var(--radius-sm);
    padding: 16px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: border-color 0.2s;
}
.upgrade-tier.is-highlighted {
    border-color: var(--gold);
    background: rgba(198,167,94,0.05);
}
.upgrade-tier.is-current { opacity: 0.65; }
.upgrade-tier-icon { font-size: 1.4rem; }
.upgrade-tier-name { font-size: 0.9rem; font-weight: 700; }
.upgrade-tier-price { font-size: 1rem; font-weight: 700; color: var(--gold); }
.upgrade-tier-features {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1 1 auto;
}
.upgrade-tier-features li {
    font-size: 0.78rem;
    color: var(--muted);
    padding-left: 14px;
    position: relative;
}
.upgrade-tier-features li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--status-good);
    font-size: 0.7rem;
}
.upgrade-tier-btn {
    margin-top: 8px;
    width: 100% !important;
    font-size: 0.82rem !important;
    padding: 10px !important;
}
.upgrade-tier-current {
    background: rgba(255,255,255,0.05) !important;
    color: var(--muted) !important;
    border: 1px solid rgba(255,255,255,0.1) !important;
    cursor: default;
}
.upgrade-modal-note {
    text-align: center;
    font-size: 0.75rem;
    color: var(--muted);
    padding: 0 var(--space) 18px;
    margin: 0;
}

/* ── Upgrade modal — Activation step (promo OR Stripe) ──────────
   Second screen inside the upgrade modal. Lets the operator choose
   between applying a promo/beta code and paying via Stripe. Both
   paths converge on users.plan flipping to the selected tier. */
.upgrade-activate-back {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.10);
    color: var(--text);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.upgrade-activate-back:hover { background: rgba(255,255,255,0.06); }

.upgrade-activate-body {
    padding: 18px var(--space) 22px;
}
.upgrade-activate-summary {
    text-align: center;
    padding: 16px 12px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 12px;
    margin-bottom: 20px;
}
.upgrade-activate-icon { font-size: 2rem; line-height: 1; margin-bottom: 6px; }
.upgrade-activate-name {
    font-size: 1.05rem; font-weight: 700; color: var(--text); margin-bottom: 2px;
}
.upgrade-activate-price { color: var(--gold); font-weight: 700; font-size: 0.92rem; }

.upgrade-activate-section { margin-bottom: 6px; }
.upgrade-activate-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
}

.upgrade-promo-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
}
.upgrade-promo-input {
    /* flex: 1 1 0% with min-width:0 — overrides default min-width:auto
       (min-content) so the input actually shrinks/grows with the row
       instead of getting squashed when the Apply button's global
       .btn { width:100% } tries to claim the whole row. */
    flex: 1 1 0%;
    min-width: 0;
    min-height: 44px;
    padding: 10px 12px;
    background: rgba(255,255,255,0.04);
    border: 1.5px solid rgba(255,255,255,0.12);
    border-radius: 10px;
    color: var(--text);
    font-family: inherit;
    font-size: 1rem; /* 16px — prevents iOS Safari auto-zoom on focus */
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.upgrade-promo-input:focus {
    outline: none;
    border-color: var(--gold);
}
.upgrade-promo-apply {
    /* Override global .btn { width:100% } so the button is content-sized
       inside the flex row. Without this, the button claims 100% of the
       row width and the input collapses to ~0px. */
    flex: 0 0 auto;
    width: auto;
    min-height: 44px;
    padding: 10px 18px;
    font-size: 0.92rem;
    white-space: nowrap;
}

/* Narrow viewports: stack input over button (each full-width) so the
   promo field stays large and tappable on phones. */
@media (max-width: 480px) {
    .upgrade-promo-row {
        flex-direction: column;
        align-items: stretch;
    }
    .upgrade-promo-apply {
        width: 100%;
    }
}
.upgrade-promo-hint {
    margin: 6px 0 0;
    font-size: 0.74rem;
    color: var(--muted);
}
.upgrade-promo-result {
    margin: 10px 0 0;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 0.86rem;
    line-height: 1.4;
}
.upgrade-promo-result.is-error {
    background: rgba(214, 92, 92, 0.10);
    border: 1px solid rgba(214, 92, 92, 0.40);
    color: rgb(238, 150, 150);
}
.upgrade-promo-result.is-success {
    background: rgba(89, 168, 119, 0.12);
    border: 1px solid rgba(89, 168, 119, 0.40);
    color: rgb(140, 220, 170);
}

/* Finding B-1 — Stripe-replaces-promo confirmation warning.
   Rendered above the "Pay with Stripe" button when the server returns
   409 promo_replacement_confirm. Uses an amber palette distinct from
   .is-error red so the operator reads it as a heads-up, not a failure. */
.upgrade-stripe-warn {
    margin: 0 0 10px;
    padding: 10px 12px;
    border-radius: 8px;
    background: rgba(214, 168, 92, 0.10);
    border: 1px solid rgba(214, 168, 92, 0.45);
    color: rgb(235, 200, 140);
    font-size: 0.86rem;
    line-height: 1.45;
}
.upgrade-stripe-warn strong {
    color: rgb(245, 215, 160);
    font-weight: 600;
}

.upgrade-activate-divider {
    display: flex;
    align-items: center;
    text-align: center;
    color: var(--muted);
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.10em;
    margin: 18px 0;
}
.upgrade-activate-divider::before,
.upgrade-activate-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: rgba(255,255,255,0.08);
}
.upgrade-activate-divider span { padding: 0 10px; }

.upgrade-stripe-btn {
    width: 100%;
    min-height: 52px;
    font-size: 0.98rem;
    font-weight: 700;
}
.upgrade-stripe-btn:disabled { opacity: 0.6; cursor: wait; }
.upgrade-stripe-hint {
    margin: 8px 0 0;
    font-size: 0.74rem;
    color: var(--muted);
    text-align: center;
}

/* ── Environment (weather) card ──────────────────────────────── */
.env-card .section-label {
    margin-bottom: 10px;
}
.env-body {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 4px 0 2px;
}
.env-temp {
    display: flex;
    align-items: baseline;
    gap: 10px;
}
.env-temp-value {
    font-size: 2.4rem;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.01em;
}
.env-state {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.12);
}
.env-state-good  { background: rgba(76,175,80,0.12);  color: var(--status-good); border-color: rgba(76,175,80,0.35); }
.env-state-watch { background: rgba(255,193,7,0.12);  color: var(--status-watch); border-color: rgba(255,193,7,0.35); }
.env-state-risk  { background: rgba(229,57,53,0.14);  color: var(--status-risk); border-color: rgba(229,57,53,0.45); }
.env-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.env-chip {
    background: rgba(198,167,94,0.08);
    border: 1px solid rgba(198,167,94,0.25);
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 0.78rem;
    color: var(--muted);
}
.env-card-freeze {
    border-left: 5px solid rgba(91,164,207,0.85);
    box-shadow:
        0 0 0 1px rgba(91,164,207,0.18),
        -2px 0 18px -6px rgba(91,164,207,0.40);
}
.env-card-heat {
    border-left: 5px solid rgba(229,164,94,0.85);
    box-shadow:
        0 0 0 1px rgba(229,164,94,0.18),
        -2px 0 18px -6px rgba(229,164,94,0.40);
}
.env-chip-forecast {
    opacity: 0.8;
}
.env-chip-freeze {
    color: rgb(91,164,207);
    border-color: rgba(91,164,207,0.45);
    opacity: 1;
}
.env-chip-heat {
    color: rgb(229,164,94);
    border-color: rgba(229,164,94,0.45);
    opacity: 1;
}
.env-empty {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 4px 0;
}
.env-empty-title {
    font-size: 0.88rem;
    color: var(--muted);
}
.env-empty-sub {
    color: var(--muted);
    font-size: 0.78rem;
    margin-top: 3px;
}
.env-empty-cta {
    white-space: nowrap;
}

/* ── Environment: weather emoji in header row ────────────────── */
.env-weather-emoji {
    font-size: 1.5rem;
    line-height: 1;
    flex-shrink: 0;
}

/* ── Environment: freeze / heat alert banners ──────────────────────
 * Alarm-grade UX. These render only when an outdoor colony is at risk,
 * and must feel like operational alarms — not informational chips.
 *
 *   - 3-line structure: HEADLINE / DETAIL / ACTION
 *   - thicker left edge (5px) and larger padding
 *   - subtle attention-pulse on first render (no infinite churn)
 *   - "TONIGHT" / "TODAY" timing tokens get extra emphasis
 *
 * Both freeze and heat use the same shape; only the palette differs.
 */
.env-alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 10px;
    font-size: 0.95rem;
    line-height: 1.45;
    margin-top: 12px;
    animation: envAlertEntry 0.6s ease-out;
}
.env-alert[hidden] {
    display: none;
}
@keyframes envAlertEntry {
    0%   { opacity: 0; transform: translateY(-4px); }
    100% { opacity: 1; transform: translateY(0); }
}
.env-alert-freeze {
    background: rgba(91,164,207,0.22);
    border: 1px solid rgba(91,164,207,0.65);
    border-left: 5px solid rgba(91,164,207,0.95);
    color: #C5E2F3;
    box-shadow: 0 0 22px -10px rgba(91,164,207,0.55);
}
.env-alert-heat {
    background: rgba(229,164,94,0.22);
    border: 1px solid rgba(229,164,94,0.65);
    border-left: 5px solid rgba(229,164,94,0.95);
    color: #F5C589;
    box-shadow: 0 0 22px -10px rgba(229,164,94,0.55);
}
.env-alert-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.env-alert-headline {
    font-weight: 700;
    font-size: 1.0625rem;
    letter-spacing: 0.005em;
    color: var(--text);
    line-height: 1.3;
}
/* "TONIGHT" / "TODAY" timing tokens — uppercase + colored accent.
 * The <em> tag carries no italic-by-default thanks to font-style: normal. */
.env-alert-headline em {
    font-style: normal;
    font-weight: 800;
    letter-spacing: 0.08em;
    padding: 0 4px;
}
.env-alert-freeze .env-alert-headline em { color: #8EC6E6; }
.env-alert-heat   .env-alert-headline em { color: #E5A45E; }
.env-alert-detail {
    font-size: 0.85rem;
    opacity: 0.92;
    font-weight: 500;
}
.env-alert-action {
    font-size: 0.85rem;
    opacity: 0.85;
    margin-top: 4px;
    padding-top: 4px;
    border-top: 1px dashed currentColor;
    font-weight: 500;
}
.env-alert strong { font-weight: 700; }
.env-alert-icon {
    flex-shrink: 0;
    font-size: 1.5rem;
    line-height: 1;
    padding-top: 1px;
    filter: drop-shadow(0 0 4px currentColor);
}

/* ── Alert escalation tiers ──────────────────────────────────────
 * Server- and client-side both emit one of these tier classes:
 *   .env-alert-tier-watch     subtle awareness
 *   .env-alert-tier-warning   action recommended (default visual weight)
 *   .env-alert-tier-critical  action required (thicker edge, stronger glow)
 *   .env-alert-tier-emergency loudest — solid bg + persistent pulse
 *
 * Baseline .env-alert-freeze/.env-alert-heat already styles as 'warning'.
 * Watch tones it down; critical and emergency escalate it.
 */
.env-alert-tier-watch {
    /* Watch is calmer — same hue, less saturation */
    background: rgba(91,164,207,0.10);
    border-left-width: 3px;
}
.env-alert-tier-watch.env-alert-heat {
    background: rgba(229,164,94,0.10);
}
.env-alert-tier-watch .env-alert-headline { font-weight: 600; }

.env-alert-tier-critical {
    border-left-width: 7px;
    box-shadow: 0 0 32px -10px rgba(91,164,207,0.75);
    animation: envAlertEntry 0.6s ease-out, envAlertPulseCritical 2.4s ease-in-out infinite 0.6s;
}
.env-alert-tier-critical.env-alert-heat {
    box-shadow: 0 0 32px -10px rgba(229,164,94,0.75);
}
.env-alert-tier-critical .env-alert-headline { font-size: 1.125rem; }

.env-alert-tier-emergency {
    border-left-width: 8px;
    background: rgba(91,164,207,0.32);
    border-color: rgba(91,164,207,0.85);
    box-shadow:
        0 0 0 1px rgba(91,164,207,0.55),
        0 0 38px -6px rgba(91,164,207,0.85);
    color: #E0F0FA;
    animation: envAlertEntry 0.6s ease-out, envAlertPulseEmergency 1.6s ease-in-out infinite 0.6s;
}
.env-alert-tier-emergency.env-alert-heat {
    background: rgba(229,164,94,0.32);
    border-color: rgba(229,164,94,0.85);
    box-shadow:
        0 0 0 1px rgba(229,164,94,0.55),
        0 0 38px -6px rgba(229,164,94,0.85);
    color: #FBE3C7;
}
.env-alert-tier-emergency .env-alert-headline {
    font-size: 1.25rem;
    letter-spacing: 0.015em;
}
.env-alert-tier-emergency .env-alert-headline em {
    background: currentColor;
    color: #0E1A23;
    padding: 1px 6px;
    border-radius: 3px;
}
@keyframes envAlertPulseCritical {
    0%, 100% { box-shadow: 0 0 24px -10px currentColor; }
    50%      { box-shadow: 0 0 38px -6px currentColor; }
}
@keyframes envAlertPulseEmergency {
    0%, 100% { box-shadow: 0 0 0 1px currentColor, 0 0 28px -6px currentColor; }
    50%      { box-shadow: 0 0 0 2px currentColor, 0 0 48px -2px currentColor; }
}
@media (prefers-reduced-motion: reduce) {
    .env-alert-tier-critical,
    .env-alert-tier-emergency { animation: none; }
}

/* env-card itself gets stronger glow at higher tiers */
.env-card-tier-critical {
    box-shadow:
        0 0 0 1px rgba(91,164,207,0.30),
        -3px 0 28px -6px rgba(91,164,207,0.60);
}
.env-card-tier-critical.env-card-heat {
    box-shadow:
        0 0 0 1px rgba(229,164,94,0.30),
        -3px 0 28px -6px rgba(229,164,94,0.60);
}
.env-card-tier-emergency {
    box-shadow:
        0 0 0 2px rgba(91,164,207,0.55),
        -4px 0 40px -4px rgba(91,164,207,0.85);
}
.env-card-tier-emergency.env-card-heat {
    box-shadow:
        0 0 0 2px rgba(229,164,94,0.55),
        -4px 0 40px -4px rgba(229,164,94,0.85);
}

/* ── Stale weather visual safety net ────────────────────────────
 * When wireWeatherLive flags the card with [data-stale="true"] (Open-Meteo
 * fetch failed and we're serving a cached reading), the temp value alone is
 * too loud to compete with: 38px green vs a 10px pill text. The operator at
 * arm's length will see the number and miss the pill on a freeze night.
 *
 * This rule set makes stale data unmistakable at a glance:
 *   - prepends a full-width orange "STALE READING" banner above the body
 *   - dampens the temp value (opacity, italic, wavy strike-through)
 *   - reskins the state pill ("— STALE") so it no longer reads as "Safe"
 *
 * Together these convert false confidence into clear uncertainty.
 */
.env-card[data-stale="true"] {
    border-left: 5px solid rgba(229,130,94,0.85);
    box-shadow:
        0 0 0 1px rgba(229,130,94,0.30),
        -2px 0 18px -6px rgba(229,130,94,0.50);
}
.env-card[data-stale="true"]::before {
    content: "⚠ Stale reading — do not rely on this temperature";
    display: block;
    margin: -16px -16px 12px;   /* match card padding to span full width */
    padding: 8px 14px;
    background: rgba(229,130,94,0.20);
    border-bottom: 1px solid rgba(229,130,94,0.55);
    color: rgb(232,152,122);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    line-height: 1.3;
}
.env-card[data-stale="true"] [data-weather-temp] {
    opacity: 0.55;
    font-style: italic;
    text-decoration: line-through wavy rgba(229,130,94,0.65) 2px;
    text-decoration-skip-ink: none;
}
.env-card[data-stale="true"] [data-weather-emoji] {
    opacity: 0.55;
    filter: grayscale(0.6);
}
.env-card[data-stale="true"] .env-state-stale,
.env-state-stale {
    background: rgba(229,130,94,0.20);
    border: 1px solid rgba(229,130,94,0.55);
    color: rgb(232,152,122);
    font-weight: 700;
    letter-spacing: 0.04em;
}

/* ── Weather freshness pill ─────────────────────────────────────
 * Lives in the env-card section label. Communicates the difference
 * between live data, slightly delayed data, stale data, and a lost
 * connection — so the operator never falsely trusts cached values.
 *
 * States (set by wireWeatherLive in app.js):
 *   live      — last fetch within 90s   (green dot)
 *   fresh     — < 10 min                 (muted green)
 *   degraded  — 10–30 min                (gold/amber)
 *   stale     — 30 min+                  (orange, "Outdated by X min")
 *   error     — 3+ consecutive failures  (red, "Connection lost")
 */
.weather-freshness {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-left: 8px;
    padding: 2px 8px 2px 6px;
    border-radius: 999px;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    line-height: 1.4;
    border: 1px solid transparent;
    transition: background 0.4s, border-color 0.4s, color 0.4s;
}
.weather-freshness::before {
    content: "";
    width: 6px; height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}
.weather-freshness[data-state="live"] {
    background: rgba(89, 168, 119, 0.16);
    border-color: rgba(89, 168, 119, 0.40);
    color: rgb(140, 220, 170);
}
.weather-freshness[data-state="live"]::before {
    animation: freshnessPulse 1.8s ease-in-out infinite;
}
@keyframes freshnessPulse {
    0%, 100% { opacity: 1;   box-shadow: 0 0 0 0 currentColor; }
    50%      { opacity: 0.7; box-shadow: 0 0 6px 1px currentColor; }
}
.weather-freshness[data-state="fresh"] {
    background: rgba(89, 168, 119, 0.08);
    border-color: rgba(89, 168, 119, 0.25);
    color: rgba(140, 220, 170, 0.80);
}
.weather-freshness[data-state="checking"] {
    background: rgba(255,255,255,0.06);
    border-color: rgba(255,255,255,0.14);
    color: var(--muted);
}
.weather-freshness[data-state="degraded"] {
    background: rgba(198, 167, 94, 0.14);
    border-color: rgba(198, 167, 94, 0.40);
    color: rgb(214, 184, 110);
}
.weather-freshness[data-state="stale"] {
    background: rgba(229, 130, 94, 0.18);
    border-color: rgba(229, 130, 94, 0.55);
    color: rgb(232, 152, 122);
}
.weather-freshness[data-state="error"] {
    background: rgba(220, 86, 86, 0.20);
    border-color: rgba(220, 86, 86, 0.60);
    color: rgb(232, 122, 122);
}
@media (prefers-reduced-motion: reduce) {
    .weather-freshness[data-state="live"]::before { animation: none; }
}

/* ── Environment: expand / details ──────────────────────────── */
.env-details {
    margin-top: 12px;
    border-top: 1px solid rgba(255,255,255,0.06);
    padding-top: 4px;
}
.env-details-toggle {
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.70rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--muted);
    padding: 6px 0;
    user-select: none;
}
.env-details-toggle::-webkit-details-marker { display: none; }
.env-details-toggle::after {
    content: '▼';
    font-size: 0.55rem;
    margin-left: 2px;
    transition: transform 0.2s;
}
details[open] > .env-details-toggle::after {
    transform: rotate(-180deg);
}
.env-details-body {
    padding-top: 14px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.env-weather-graphic {
    display: flex;
    align-items: center;
    gap: 14px;
}
.env-weather-icon-lg {
    font-size: 2.6rem;
    line-height: 1;
    flex-shrink: 0;
}
.env-weather-label {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.3;
}
.env-weather-sublabel {
    font-size: 0.82rem;
    color: var(--muted);
    margin-top: 2px;
}
.env-detail-rows {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.env-detail-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
    font-size: 0.88rem;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}
.env-detail-row-note {
    border-bottom: none;
    padding-bottom: 0;
}
.env-detail-label {
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    flex-shrink: 0;
}
.env-detail-val {
    display: flex;
    align-items: baseline;
    gap: 7px;
    color: var(--text);
    font-weight: 600;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.env-detail-sub {
    font-size: 0.76rem;
    color: var(--muted);
    font-weight: 400;
}
.env-mini-chart {
    padding: 2px 0 4px;
}
.env-mini-chart-label {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--muted);
    font-weight: 600;
    margin-bottom: 6px;
}
.env-mini-chart-empty {
    font-size: 0.78rem;
    color: var(--muted);
    text-align: center;
    padding: 10px 0;
}

/* ── Settings: Location section ──────────────────────────────── */
.location-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 12px;
}
.form-input-label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted);
    font-weight: 600;
}
.location-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
@media (max-width: 420px) {
    .location-row { grid-template-columns: 1fr; }
}

/* ── QR-pair row (camera shortcut for sensor pairing) ──────── */
.qr-pair-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.qr-pair-row .btn { white-space: nowrap; }
.link-gold { color: var(--gold); text-decoration: underline; }
.btn-link-inline { background: none; border: none; padding: 0; color: var(--muted); font-size: 0.8rem; text-decoration: underline; cursor: pointer; }
.btn-link-inline:hover { color: var(--gold); }

/* ── QR scan camera overlay ────────────────────────────────── */
.qr-scan-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: #000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.qr-scan-overlay video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.qr-scan-overlay-close {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1001;
    min-width: 160px;
}
.qr-scan-overlay-hint {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1001;
    color: #fff;
    background: rgba(0,0,0,0.55);
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 0.85rem;
}

/* ── Expandable integration row ────────────────────────────── */
.integration-item { padding: 0 !important; flex-direction: column; align-items: stretch; }
.integration-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    padding: 12px 0;
    background: none;
    border: none;
    color: inherit;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.integration-head:hover,
.integration-head:focus-visible { outline: none; }
.integration-head:hover .list-title,
.integration-head:focus-visible .list-title { color: var(--gold); }
.integration-chevron {
    color: var(--gold);
    font-size: 1rem;
    line-height: 1;
    transition: transform 180ms ease;
    flex-shrink: 0;
    padding: 0 4px;
}
.integration-head[aria-expanded="true"] .integration-chevron { transform: rotate(180deg); }
.integration-body {
    padding: 4px 0 14px;
    border-top: 1px dashed rgba(198,167,94,0.15);
    margin-top: 0;
}

/* ── SwitchBot device rows ─────────────────────────────────── */
.sb-device-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border: 1px solid rgba(198,167,94,0.15);
    border-radius: var(--radius-sm);
    background: rgba(198,167,94,0.04);
    margin-bottom: 8px;
}
.sb-device-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.sb-device-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sb-device-type {
    font-size: 0.7rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}
.sb-bin-select { min-width: 160px; }
@media (max-width: 520px) {
    .sb-device-row { grid-template-columns: 1fr; }
    .sb-bin-select { width: 100%; min-width: 0; }
}

/* ── Walkthrough tier chooser (step 0) ───────────────────────── */
.wt-tier-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 18px 0 14px;
}
.wt-tier-row {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 14px 16px;
    border: 1px solid rgba(198,167,94,0.25);
    border-radius: var(--radius-sm);
    background: rgba(198,167,94,0.05);
    color: var(--text);
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    transition: background 0.15s, border-color 0.15s, transform 0.05s;
}
.wt-tier-row:hover,
.wt-tier-row:focus-visible {
    background: rgba(198,167,94,0.10);
    border-color: var(--gold);
    outline: none;
}
.wt-tier-row:active { transform: scale(0.99); }
.wt-tier-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    width: 100%;
    gap: 12px;
}
.wt-tier-name {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}
.wt-tier-price {
    font-size: 0.95rem;
    color: var(--gold);
    font-weight: 700;
}
.wt-tier-note {
    font-size: 0.78rem;
    color: var(--muted);
}
.wt-tier-starter { border-color: rgba(255,255,255,0.18); }
.wt-tier-starter .wt-tier-price { color: var(--status-good); }
.wt-tier-autopilot {
    border-color: var(--gold);
    background: rgba(198,167,94,0.12);
}

/* ── Button size modifier ─────────────────────────────────────── */
.btn-sm {
    padding: 4px 10px;
    font-size: 0.78rem;
    min-height: 0;
}

/* ── Badge colour variants ───────────────────────────────────── */
.badge-gold  { background: rgba(198,167,94,0.18); color: var(--gold); }
.badge-blue  { background: rgba(100,149,237,0.18); color: #6495ed; }
.badge-warn  { background: rgba(255,193,7,0.18);  color: var(--status-watch); }
.badge-muted { background: rgba(168,176,170,0.12); color: var(--muted); }

/* ── Team cards (Settings › Teams) ──────────────────────────── */
.teams-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px var(--space);
}
.teams-panel-label {
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}
.team-card,
.team-invite-card {
    background: rgba(255,255,255,0.035);
    border: 1px solid rgba(255,255,255,0.075);
    border-radius: 8px;
    padding: 12px;
    min-width: 0;
}
.team-invite-card {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    border-color: rgba(198,167,94,0.22);
    background: rgba(198,167,94,0.07);
}
.team-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 12px;
    gap: 10px;
}
.team-card-title {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
    min-width: 0;
}
.team-card-name {
    font-weight: 600;
    font-size: 1rem;
    min-width: 0;
}
.team-card-count {
    color: var(--muted);
    font-size: 0.78rem;
    line-height: 1.4;
    white-space: nowrap;
}
.team-members-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.team-member-row {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    background: rgba(255,255,255,0.026);
    border: 1px solid rgba(255,255,255,0.055);
    border-radius: 6px;
    font-size: 0.85rem;
    min-width: 0;
}
.team-member-avatar {
    align-items: center;
    background: rgba(198,167,94,0.13);
    border: 1px solid rgba(198,167,94,0.22);
    border-radius: 50%;
    color: var(--gold);
    display: inline-flex;
    font-size: 0.78rem;
    font-weight: 800;
    height: 32px;
    justify-content: center;
    width: 32px;
}
.team-member-avatar-pending {
    background: rgba(168,176,170,0.10);
    border-color: rgba(168,176,170,0.18);
    color: var(--muted);
}
.team-member-main {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.team-member-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 650;
}
.team-member-meta,
.team-assignment-count {
    color: var(--muted);
    display: block;
    font-size: 0.74rem;
    font-weight: 500;
    line-height: 1.25;
}
.team-role-pill {
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 999px;
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    line-height: 1;
    padding: 5px 8px;
    text-transform: uppercase;
    white-space: nowrap;
}
.team-role-owner { background: rgba(198,167,94,0.14); border-color: rgba(198,167,94,0.32); color: var(--gold); }
.team-role-admin { background: rgba(100,149,237,0.13); border-color: rgba(100,149,237,0.28); color: #8fb0ff; }
.team-role-member { background: rgba(76,175,80,0.12); border-color: rgba(76,175,80,0.24); color: #9bd49e; }
.team-role-viewer { background: rgba(168,176,170,0.09); border-color: rgba(168,176,170,0.18); color: var(--muted); }
.team-member-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    grid-column: 1 / -1;
}
.team-member-actions .btn-sm {
    min-height: 36px;
}
.team-role-select {
    min-height: 36px;
    min-width: 108px;
    padding: 5px 8px;
    width: auto;
}
.team-invite-form,
.team-card-actions {
    border-top: 1px solid rgba(255,255,255,0.06);
    margin-top: 12px;
    padding-top: 10px;
}
.team-form-label {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
    margin-bottom: 7px;
}
.team-invite-fields,
.team-create-row {
    display: grid;
    gap: 8px;
    grid-template-columns: 1fr;
}
.team-invite-fields .form-input,
.team-create-row .form-input {
    min-width: 0;
    width: 100%;
}
.team-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.team-danger-btn { color: var(--status-risk); }
.team-warn-btn { color: var(--status-watch); }
.team-help-text {
    color: var(--muted);
    font-size: 0.8rem;
    line-height: 1.5;
}
@media (min-width: 560px) {
    .team-member-row,
    .team-invite-card {
        grid-template-columns: 36px minmax(0, 1fr) auto auto;
    }
    .team-member-actions {
        grid-column: auto;
    }
    .team-invite-fields {
        grid-template-columns: minmax(0, 1fr) 128px auto;
    }
    .team-create-row {
        grid-template-columns: minmax(0, 1fr) auto;
    }
}
@media (max-width: 420px) {
    .team-card-head {
        flex-direction: column;
    }
    .team-card-count {
        white-space: normal;
    }
}

/* ── API Keys ─────────────────────────────────────────────────────────── */
.apikey-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    flex-wrap: wrap;
}
.apikey-row:last-child { border-bottom: none; }
.apikey-row.apikey-revoked { opacity: 0.45; }
.apikey-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    flex: 1 1 auto;
}
.apikey-name {
    font-weight: 600;
    font-size: 0.9rem;
}
.apikey-prefix {
    font-size: 0.78rem;
    color: var(--color-muted);
    background: rgba(255,255,255,0.06);
    padding: 2px 6px;
    border-radius: 4px;
    letter-spacing: 0.02em;
}
.apikey-scopes { display: flex; gap: 4px; flex-wrap: wrap; }
.apikey-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 0.78rem;
    color: var(--color-muted);
    flex-shrink: 0;
}
.settings-toast {
    display: block;
    margin-top: 10px;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
}
.settings-toast.toast-ok    { background: rgba(76,175,80,.25); color: #a5d6a7; }
.settings-toast.toast-error { background: rgba(229,57,53,.25);  color: #ef9a9a; }

/* ── Dashboard Quick Actions ──────────────────────────────────────────── */
/* Wraps the list-link + toggle button in a single flex row on each bin card. */
.bin-card-row {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 6px;
}
/* Override list-link's width:100% so the toggle can sit beside it. */
.bin-card-row .list-link {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
}
/* Small chevron toggle at the right edge of each bin card. */
.bin-actions-toggle {
    flex-shrink: 0;
    background: rgba(198,167,94,0.07);
    border: 1px solid rgba(198,167,94,0.2);
    border-radius: var(--radius-sm);
    color: var(--gold);
    cursor: pointer;
    font-family: inherit;
    font-size: 1rem;
    min-width: var(--touch);
    min-height: var(--touch);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    transition: background 0.15s ease, transform 0.2s ease;
    line-height: 1;
    user-select: none;
}
.bin-actions-toggle:hover { background: rgba(198,167,94,0.14); }
.bin-actions-toggle:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.bin-actions-toggle[aria-expanded="true"] {
    background: rgba(198,167,94,0.14);
    transform: rotate(180deg);
}
/* Expandable action row — hidden by default, revealed on toggle. */
.bin-action-row {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 12px 2px 2px;
    border-top: 1px solid rgba(255,255,255,0.06);
    margin-top: 6px;
}
.bin-action-row[hidden] { display: none; }
.bin-procedure-head {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 2px 0 8px;
}
.bin-procedure-kicker {
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}
.bin-procedure-name {
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 650;
}
.bin-procedure-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    width: 100%;
    min-height: 48px;
    padding: 10px 0;
    border-top: 1px solid rgba(255,255,255,0.045);
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    font: inherit;
    text-decoration: none;
    text-align: left;
}
.bin-procedure-link:hover,
.bin-procedure-link:focus-visible {
    color: var(--gold);
    text-decoration: none;
}
.bin-procedure-main {
    min-width: 0;
    font-size: 0.94rem;
    font-weight: 600;
    overflow-wrap: anywhere;
}
.bin-procedure-note {
    color: var(--muted);
    flex: 0 0 auto;
    font-size: 0.78rem;
    text-align: right;
    white-space: nowrap;
}
.bin-procedure-full {
    align-self: flex-start;
    margin-top: 8px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    color: var(--gold);
    font-size: 0.88rem;
    font-weight: 650;
    text-decoration: none;
}
.bin-procedure-full:hover,
.bin-procedure-full:focus-visible { text-decoration: underline; }
@media (max-width: 420px) {
    .bin-procedure-link {
        align-items: flex-start;
        flex-direction: column;
        gap: 2px;
    }
    .bin-procedure-note {
        text-align: left;
        white-space: normal;
    }
}
/* The 4 quick-action buttons — equal width in a 4-up grid. */
.bin-quick-btn {
    flex: 1 1 calc(25% - 5px);
    min-width: 60px;
    min-height: 54px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: var(--radius-sm);
    color: var(--text);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 500;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 8px 4px;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.05s ease;
}
.bin-quick-btn span { font-size: 0.78rem; }
.bin-quick-btn:hover {
    background: rgba(255,255,255,0.09);
    border-color: rgba(255,255,255,0.18);
}
.bin-quick-btn:active { transform: scale(0.95); }
.bin-quick-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.bin-quick-btn.active {
    background: rgba(198,167,94,0.12);
    border-color: rgba(198,167,94,0.4);
    color: var(--gold);
}
.bin-quick-btn.loading {
    opacity: 0.45;
    pointer-events: none;
}
.bin-quick-btn.success {
    background: rgba(76,175,80,0.14);
    border-color: rgba(76,175,80,0.35);
    color: #a5d6a7;
    pointer-events: none;
}
/* Feed type + amount inline picker — appears below the 4 quick buttons. */
.bin-feed-picker {
    flex: 0 0 100%;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-top: 4px;
}
.bin-feed-picker[hidden] { display: none; }
.bin-feed-label {
    font-size: 0.78rem;
    color: var(--muted);
    letter-spacing: 0.03em;
    text-transform: uppercase;
}
.bin-feed-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.bin-feed-row[hidden] { display: none; }
.bin-feed-amount-row { padding-top: 2px; }
.bin-feed-chip {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 20px;
    color: var(--muted);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 500;
    min-height: 36px;
    padding: 5px 14px;
    transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.bin-feed-chip:hover {
    background: rgba(255,255,255,0.09);
    color: var(--text);
    border-color: rgba(255,255,255,0.2);
}
.bin-feed-chip:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.bin-feed-chip.selected {
    background: rgba(198,167,94,0.18);
    border-color: var(--gold);
    color: var(--gold);
}
.bin-feed-chip.loading {
    opacity: 0.45;
    pointer-events: none;
}

/* ── OAuth login prominence ───────────────────────────────────────────── */
.oauth-lead {
    font-size: 0.78rem;
    color: var(--muted);
    margin: 0 0 8px;
    text-align: center;
    letter-spacing: 0.02em;
}
.oauth-btn {
    font-size: 1rem;
    padding: 14px 16px;
}
.oauth-buttons {
    box-shadow: 0 2px 14px rgba(255,255,255,0.05);
    border-radius: var(--radius-sm);
    padding: 4px 0;
}

/* ── Bulk Actions Panel (Phase 2 Sprint 2A) ─────────────────────────── */
.bulk-help {
    color: var(--muted);
    font-size: 0.8125rem;
    margin: 0 0 12px 0;
}
.bulk-target-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}
.bulk-target-chip {
    padding: 8px 16px;
    min-height: 44px;           /* dirty-hands minimum — meets iOS/Material touch target */
    display: inline-flex;
    align-items: center;
    border-radius: 20px;
    border: 1px solid var(--border, rgba(255,255,255,0.12));
    background: transparent;
    color: var(--muted);
    font-size: 0.8125rem;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    -webkit-tap-highlight-color: transparent;
}
.bulk-target-chip.active,
.bulk-target-chip[aria-pressed="true"],
.bulk-target-chip:hover {
    background: var(--green);
    border-color: var(--green);
    color: var(--text);
}
.bulk-target-chip.loading {
    opacity: 0.5;
    pointer-events: none;
}
.bulk-target-chip:disabled,
.bulk-action-btn:disabled,
.morning-feed-chip:disabled {
    opacity: 0.55;
    pointer-events: none;
}
.bulk-action-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}
.bulk-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 14px 8px;
    border-radius: 10px;
    border: 1px solid var(--border, rgba(255,255,255,0.12));
    background: var(--card);
    color: var(--text);
    font-size: 0.8125rem;
    min-height: 64px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, opacity 0.15s;
    -webkit-tap-highlight-color: transparent;
}
.bulk-action-btn:hover {
    background: var(--surface-hover, #1f2421);
    border-color: var(--green);
}
.bulk-action-btn.active,
.bulk-action-btn[aria-pressed="true"] {
    background: rgba(198,167,94,0.14);
    border-color: rgba(198,167,94,0.55);
    color: var(--gold);
    box-shadow: 0 0 0 1px rgba(198,167,94,0.18) inset;
}
.bulk-action-btn.loading {
    opacity: 0.5;
    pointer-events: none;
}
.bulk-action-btn.loading::after {
    content: '…';
    display: block;
    font-size: 0.75rem;
    color: var(--muted);
}
/* Narrow viewport: reflow to 2-column grid below 400px (iPhone SE, foldables) */
@media (max-width: 400px) {
    .bulk-action-row {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
}

/* ── Bulk Actions — high-leverage primary action surface ─────────────
 * The operator's daily-rounds entry point. Must feel heavier than
 * neighboring cards on dashboard load:
 *   - 5px green left edge (was 3px)
 *   - subtle green-tint gradient background + outer glow
 *   - 72px trigger height + larger icon and label
 *   - slow ambient pulse on the left edge for peripheral attention
 *   - bin count badge so scope is obvious before the tap
 */
.bulk-actions-card {
    border-left: 5px solid var(--green);
    padding: 0;
    background:
        linear-gradient(90deg,
            rgba(31, 74, 61, 0.16) 0%,
            rgba(31, 74, 61, 0.04) 50%,
            rgba(0, 0, 0, 0) 100%),
        var(--card);
    box-shadow:
        0 0 0 1px rgba(89, 168, 119, 0.18),
        0 4px 14px -8px rgba(89, 168, 119, 0.35);
    position: relative;
    overflow: hidden;
}
/* Slow ambient glow on the green edge — peripheral cue, not annoying. */
.bulk-actions-card::before {
    content: "";
    position: absolute;
    top: 0; bottom: 0; left: -5px;
    width: 5px;
    background: var(--green);
    animation: bulkEdgePulse 4.2s ease-in-out infinite;
    pointer-events: none;
}
@keyframes bulkEdgePulse {
    0%, 100% { opacity: 0.55; box-shadow: 0 0 0 0 rgba(89, 168, 119, 0); }
    50%      { opacity: 1;    box-shadow: 0 0 14px 2px rgba(89, 168, 119, 0.45); }
}
@media (prefers-reduced-motion: reduce) {
    .bulk-actions-card::before { animation: none; opacity: 0.85; }
}
.bulk-actions-card .section-collapsible {
    padding: 0 16px 16px;
}
.bulk-actions-trigger {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    min-height: 72px;           /* was 64 — heavier surface */
    padding: 16px 18px;
    background: transparent;
    border: none;
    color: var(--text);
    cursor: pointer;
    text-align: left;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s;
}
.bulk-actions-trigger:hover,
.bulk-actions-trigger:focus-visible {
    background: rgba(31, 74, 61, 0.30);
    outline: none;
}
.bulk-actions-trigger:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: -2px;
}
.bulk-trigger-icon {
    font-size: 1.7rem;          /* was 1.4 */
    flex-shrink: 0;
    line-height: 1;
    filter: drop-shadow(0 0 6px rgba(89, 168, 119, 0.45));
}
.bulk-trigger-text {
    flex: 1;
    min-width: 0;
}
.bulk-trigger-label {
    display: block;
    font-size: 1.0625rem;       /* was 0.9375 */
    font-weight: 700;           /* was 600 */
    color: var(--text);
    line-height: 1.3;
    letter-spacing: 0.005em;
}
.bulk-trigger-sub {
    display: block;
    font-size: 0.8125rem;       /* was 0.75 */
    color: var(--muted);
    margin-top: 3px;
    line-height: 1.4;
}
/* Bin count badge — communicates scope at a glance before the tap. */
.bulk-trigger-count {
    display: inline-flex;
    align-items: baseline;
    gap: 1px;
    flex-shrink: 0;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(89, 168, 119, 0.18);
    border: 1px solid rgba(89, 168, 119, 0.40);
    color: rgb(140, 220, 170);
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}
.bulk-trigger-count-unit {
    font-size: 0.7rem;
    font-weight: 600;
    opacity: 0.85;
    margin-left: 2px;
}
.bulk-trigger-chev {
    font-size: 0.95rem;
    color: var(--muted);
    flex-shrink: 0;
    transition: transform 0.2s ease;
}
.bulk-actions-trigger[aria-expanded="true"] .bulk-trigger-chev {
    transform: rotate(180deg);
}

/* ── Quick Actions — primary dashboard workflow ───────────────────── */
.morning-rounds-card {
    position: relative;
    border-left: 5px solid var(--gold);
    box-shadow: 0 18px 42px rgba(0,0,0,0.28), 0 0 0 1px rgba(198,167,94,0.14) inset;
    overflow: hidden;
}
.morning-rounds-card::before {
    content: '';
    position: absolute;
    inset: 0 0 auto;
    height: 3px;
    background: linear-gradient(90deg, var(--green), var(--gold));
    pointer-events: none;
}
.morning-rounds-trigger {
    min-height: 76px;
    background: linear-gradient(135deg, rgba(31,74,61,0.24), rgba(198,167,94,0.08));
}
.morning-rounds-trigger:hover,
.morning-rounds-trigger:focus-visible,
.morning-rounds-trigger[aria-expanded="true"] {
    background: linear-gradient(135deg, rgba(31,74,61,0.34), rgba(198,167,94,0.14));
}
.morning-rounds-icon {
    display: inline-grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(198,167,94,0.16);
    color: var(--gold);
    box-shadow: 0 0 22px rgba(198,167,94,0.18);
}
.morning-rounds-title {
    font-size: 1.08rem;
    font-weight: 800;
}
.morning-rounds-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0 10px;
    border-radius: 999px;
    background: rgba(198,167,94,0.16);
    border: 1px solid rgba(198,167,94,0.32);
    color: var(--gold);
    font-size: 0.78rem;
    font-weight: 700;
    white-space: nowrap;
}
.morning-rounds-body {
    display: grid;
    gap: 12px;
}
.morning-rounds-stats {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.morning-rounds-stats span {
    display: inline-flex;
    gap: 5px;
    min-height: 36px;
    align-items: center;
    justify-content: center;
    flex: 1 1 86px;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    color: var(--muted);
    font-size: 0.75rem;
}
.morning-rounds-stats strong {
    color: var(--text);
    font-size: 0.98rem;
}
.morning-rounds-group {
    display: grid;
    gap: 7px;
}
.morning-rounds-label {
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}
.morning-target-row {
    margin-bottom: 0;
}
.morning-target-row .bulk-target-chip {
    flex: 1 1 30%;
    justify-content: center;
    min-height: 56px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    background: rgba(255,255,255,0.025);
    opacity: 0.68;
}
.morning-target-row .bulk-target-chip.active,
.morning-target-row .bulk-target-chip[aria-pressed="true"] {
    opacity: 1;
    background: linear-gradient(135deg, rgba(89,168,119,0.34), rgba(198,167,94,0.18));
    border-color: rgba(89,168,119,0.62);
    box-shadow: 0 8px 18px rgba(0,0,0,0.20), 0 0 0 1px rgba(89,168,119,0.24) inset;
}
.morning-action-row {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}
.morning-action-row .bulk-action-btn {
    min-height: 62px;
    font-weight: 700;
    opacity: 0.78;
}
.morning-action-row .bulk-action-btn.active,
.morning-action-row .bulk-action-btn[aria-pressed="true"] {
    opacity: 1;
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(0,0,0,0.26), 0 0 0 1px rgba(198,167,94,0.30) inset;
}
.bulk-action-feed small {
    color: var(--gold);
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.morning-feed-options {
    display: grid;
    gap: 7px;
    padding: 10px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(198,167,94,0.18);
    background: rgba(198,167,94,0.06);
}
.morning-feed-options[hidden] {
    display: none;
}
.morning-feed-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.morning-feed-chip {
    flex: 1 1 120px;
    min-height: 48px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border, rgba(255,255,255,0.12));
    background: rgba(255,255,255,0.035);
    color: var(--muted);
    font-weight: 700;
    cursor: pointer;
}
.morning-feed-chip.active,
.morning-feed-chip[aria-pressed="true"],
.morning-feed-chip:hover {
    border-color: rgba(198,167,94,0.5);
    background: rgba(198,167,94,0.14);
    color: var(--gold);
}
.morning-feed-chip.loading {
    opacity: 0.5;
    pointer-events: none;
}
.morning-run-btn {
    width: 100%;
    min-height: 62px;
    font-size: 1rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--gold), var(--green));
    border-color: rgba(255,255,255,0.18);
    color: #12140f;
    box-shadow: 0 14px 28px rgba(0,0,0,0.28), 0 0 22px rgba(198,167,94,0.22);
}
.morning-run-btn.loading {
    opacity: 0.68;
}
.morning-rounds-result {
    min-height: 20px;
    margin: 0;
    color: var(--muted);
    font-size: 0.85rem;
    line-height: 1.45;
}

@media (max-width: 520px) {
    .morning-rounds-trigger {
        align-items: flex-start;
        gap: 10px;
    }
    .morning-rounds-count {
        margin-left: auto;
    }
    .morning-action-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .morning-target-row .bulk-target-chip {
        flex-basis: 100%;
    }
}

/* ── Build info footer ────────────────────────────────────────── */
.app-build-info {
    text-align: center;
    padding: 12px 16px 24px;
    font-size: 0.7rem;
    color: var(--muted);
    opacity: 0.5;
    letter-spacing: 0.02em;
}
.app-build-info code {
    font-family: monospace;
    color: var(--gold);
    opacity: 0.8;
}

/* ── SOP Workflow Engine (Phase 3-4) ─────────────────────────────────
 * Guided multi-step operational procedure UI. Mobile-first one-step-
 * at-a-time layout — operator sees ONE active step, taps Mark Done,
 * page reloads to the next step. Visual language is calm/operational,
 * matching the Quick Actions thermal palette (gold/green accent on
 * dark mode) without competing with the freeze/heat alert palette.
 */

/* Assigned procedures list on dashboard */
.sop-runs-card { border-left: 3px solid var(--gold); }
.sop-run-link { position: relative; padding-bottom: 18px; }
.sop-run-link-bin { color: var(--muted); font-weight: 500; }
.sop-run-link-progress {
    color: rgb(140, 220, 170);
    font-weight: 600;
}
.sop-run-link-pending {
    color: rgb(214, 184, 110);
    font-weight: 600;
}
.sop-run-link-bar {
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: 8px;
    height: 4px;
    background: rgba(255,255,255,0.08);
    border-radius: 2px;
    overflow: hidden;
}
.sop-run-link-bar-fill {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--green), var(--gold));
    transition: width 0.3s ease;
}

/* SOP run page layout */
.sop-run-title { font-size: 1rem; }
.sop-run-bin { color: var(--muted); font-weight: 500; }
.sop-run-card { padding: var(--space); }
.sop-run-progress { margin-bottom: 18px; }
.sop-run-progress-bar {
    height: 6px;
    background: rgba(255,255,255,0.08);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 6px;
}
.sop-run-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--green), var(--gold));
    transition: width 0.3s ease;
}
.sop-run-progress-text {
    font-size: 0.82rem;
    color: var(--muted);
}
.sop-run-complete-tag {
    color: rgb(140, 220, 170);
    font-weight: 700;
}

/* Active step card — the one-thing-at-a-time focal point */
.sop-step-active {
    background: rgba(31, 74, 61, 0.18);
    border: 1px solid rgba(89, 168, 119, 0.30);
    border-left: 4px solid var(--green);
    border-radius: var(--radius-sm);
    padding: 16px 18px;
    margin-bottom: 12px;
}
.sop-step-badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 999px;
    background: rgba(89, 168, 119, 0.18);
    border: 1px solid rgba(89, 168, 119, 0.40);
    color: rgb(140, 220, 170);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
}
.sop-step-badge-optional {
    background: rgba(198, 167, 94, 0.14);
    border-color: rgba(198, 167, 94, 0.40);
    color: rgb(214, 184, 110);
}
.sop-step-instruction {
    font-size: 1.1rem;
    line-height: 1.5;
    color: var(--text);
    margin-bottom: 14px;
}
.sop-step-note-label {
    display: block;
    font-size: 0.8rem;
    color: var(--muted);
    margin-bottom: 12px;
}
.sop-step-note {
    width: 100%;
    margin-top: 6px;
    padding: 10px 12px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: inherit;
    font-size: 0.92rem;
    resize: vertical;
}
.sop-step-note:focus {
    outline: 2px solid var(--gold);
    outline-offset: -2px;
}
.sop-step-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
}
.sop-step-done {
    flex: 1 1 auto;
    min-height: 56px;
    font-size: 1rem;
}
.sop-step-skip {
    min-height: 56px;
}
.sop-step-done.loading,
.sop-step-skip.loading,
.sop-run-complete.loading { opacity: 0.6; pointer-events: none; }

/* All-done / complete-prompt panel */
.sop-step-complete-prompt {
    text-align: center;
    padding: 28px 18px;
    background: rgba(89, 168, 119, 0.10);
    border: 1px solid rgba(89, 168, 119, 0.35);
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
}
.sop-step-complete-icon {
    font-size: 2.4rem;
    color: rgb(140, 220, 170);
    line-height: 1;
    margin-bottom: 12px;
}
.sop-step-complete-icon-done { font-size: 3rem; }
.sop-step-complete-title {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text);
}
.sop-step-final-note {
    margin-top: 10px;
    padding: 10px 12px;
    background: rgba(0,0,0,0.20);
    border-left: 3px solid var(--green);
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    color: var(--muted);
    text-align: left;
}
.sop-run-complete {
    margin-top: 12px;
    min-height: 56px;
    min-width: 200px;
}
/* Finish-line actions: Back to bin (primary) + View today's report (ghost).
   Side-by-side on tablets, stacked on phones — both >= 44px touch targets. */
.sop-run-finish-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-top: 14px;
}
.sop-run-finish-actions .btn { min-height: 48px; }

/* All-steps disclosure */
.sop-run-step-list {
    margin-top: 14px;
    border-top: 1px solid rgba(255,255,255,0.08);
    padding-top: 10px;
}
.sop-run-step-list summary {
    cursor: pointer;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    padding: 4px 0;
    user-select: none;
}
.sop-run-step-list summary::-webkit-details-marker { display: none; }
.sop-run-step-row {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 8px 0;
    border-bottom: 1px dashed rgba(255,255,255,0.06);
}
.sop-run-step-check {
    flex-shrink: 0;
    width: 22px;
    text-align: center;
    color: var(--muted);
    font-size: 1rem;
}
.sop-run-step-done .sop-run-step-check {
    color: rgb(140, 220, 170);
}
.sop-run-step-done .sop-run-step-text { color: var(--muted); }
.sop-run-step-text { flex: 1; font-size: 0.92rem; line-height: 1.45; }
.sop-run-step-optional {
    color: rgb(214, 184, 110);
    font-size: 0.78rem;
}
.sop-run-step-note-display {
    display: block;
    margin-top: 4px;
    font-size: 0.82rem;
    color: var(--muted);
    font-style: italic;
}

/* ── SOP per-step photo capture ────────────────────────────── */
.sop-step-photo-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.sop-step-photo-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 8px 14px;
    border: 1px dashed rgba(255,255,255,0.18);
    background: rgba(255,255,255,0.04);
    color: var(--text);
    border-radius: var(--radius-sm);
    font-size: 0.92rem;
    cursor: pointer;
}
.sop-step-photo-btn:hover { background: rgba(255,255,255,0.07); }
.sop-step-photo-btn.loading { opacity: 0.6; pointer-events: none; }
.sop-step-photo-btn-has {
    border-style: solid;
    border-color: rgba(89, 168, 119, 0.45);
    background: rgba(89, 168, 119, 0.10);
}
.sop-step-photo-icon { font-size: 1.1rem; }
.sop-step-photo-flag {
    font-size: 0.82rem;
    color: rgb(140, 220, 170);
    font-weight: 600;
}

/* ── Task Card → Action Popup trigger styling ──────────────── */
.task-popup-trigger {
    /* Inherits .list-link layout. We just need to make it look tappable
       and visually mirror an anchor (which it replaced for write-capable users). */
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    cursor: pointer;
    color: inherit;
    font: inherit;
    padding: inherit;
    position: relative;
}
.task-popup-trigger:hover { background: rgba(255,255,255,0.03); }
.task-popup-hint {
    display: block;
    margin-top: 4px;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--gold);
    font-weight: 600;
}
.task-source-chip {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 7px;
    border-radius: 999px;
    background: rgba(198,167,94,0.12);
    border: 1px solid rgba(198,167,94,0.30);
    color: var(--gold);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    vertical-align: middle;
}

/* ── Action Popup modal ────────────────────────────────────── */
body.action-popup-open { overflow: hidden; }
.action-popup {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.18s ease;
    pointer-events: none;
}
.action-popup.is-open {
    opacity: 1;
    pointer-events: auto;
}
.action-popup[hidden] { display: none; }
.action-popup-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}
.action-popup-panel {
    position: relative;
    width: 100%;
    max-width: 520px;
    max-height: 92vh;
    overflow-y: auto;
    background: var(--bg-card, #15201b);
    border: 1px solid rgba(255,255,255,0.10);
    border-bottom: none;
    border-radius: 18px 18px 0 0;
    padding: 20px 18px 24px;
    box-shadow: 0 -12px 40px rgba(0,0,0,0.5);
    transform: translateY(20px);
    transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.action-popup.is-open .action-popup-panel { transform: translateY(0); }
@media (min-width: 640px) {
    .action-popup { align-items: center; }
    .action-popup-panel {
        border-radius: 16px;
        border-bottom: 1px solid rgba(255,255,255,0.10);
        padding: 24px;
    }
}
.action-popup-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 6px;
}
.action-popup-eyebrow {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.10em;
    color: var(--gold);
    font-weight: 700;
    margin-bottom: 4px;
}
.action-popup-title {
    margin: 0;
    font-size: 1.25rem;
    line-height: 1.2;
    color: var(--text);
}
.action-popup-close {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.04);
    color: var(--text);
    font-size: 1.05rem;
    cursor: pointer;
}
.action-popup-close:hover { background: rgba(255,255,255,0.10); }
.action-popup-sub {
    margin: 4px 0 16px;
    color: var(--muted);
    font-size: 0.88rem;
}
.action-popup-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
@media (min-width: 480px) {
    .action-popup-grid { grid-template-columns: 1fr 1fr 1fr; }
}
/* The [hidden] attribute is a UA-stylesheet rule with the lowest possible
   specificity. Class rules with explicit `display:` values (grid, flex,
   etc.) override it — which is why grid.hidden=true from JS was leaving
   the launcher visible *underneath* the run shell. Re-assert hidden for
   these three so setLauncherVisible() actually toggles the view. */
.action-popup-grid[hidden],
.action-popup-footer[hidden],
.action-popup-run[hidden] { display: none !important; }
.action-popup-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 100px;
    padding: 14px 8px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 14px;
    color: var(--text);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.12s ease, background 0.18s ease, border-color 0.18s ease;
}
.action-popup-btn:hover,
.action-popup-btn:focus-visible {
    background: rgba(89, 168, 119, 0.15);
    border-color: rgba(89, 168, 119, 0.45);
    outline: none;
}
.action-popup-btn:active { transform: scale(0.97); }
.action-popup-btn.loading { opacity: 0.55; pointer-events: none; }
.action-popup-btn-suggested {
    background: rgba(198,167,94,0.16);
    border-color: rgba(198,167,94,0.58);
}
.action-popup-suggested {
    margin-top: 2px;
    color: var(--gold);
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
/* Sibling-mute applied to non-loading buttons during in-flight category
   tap so the operator visually understands one action is in motion. JS
   adds + removes this class around the start_run_by_category fetch. */
.action-popup-btn-muted {
    opacity: 0.45;
    filter: saturate(0.6);
    pointer-events: none;
    transition: opacity 0.15s ease, filter 0.15s ease;
}
.action-popup-icon {
    font-size: 1.8rem;
    line-height: 1;
}
.action-popup-label { text-align: center; line-height: 1.15; }
.action-popup-footer {
    margin-top: 16px;
    text-align: center;
}
.action-popup-binlink {
    display: inline-block;
    padding: 8px 12px;
    color: var(--muted);
    text-decoration: none;
    font-size: 0.86rem;
}
.action-popup-binlink:hover { color: var(--text); text-decoration: underline; }
.action-popup-run {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.action-popup-run[hidden] { display: none; }
.action-popup-steps {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.action-popup-step button {
    width: 100%;
    min-height: 48px;
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    text-align: left;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.10);
    background: rgba(255,255,255,0.045);
    color: var(--text);
    cursor: pointer;
}
.action-popup-step button:focus-visible {
    outline: 2px solid rgba(198,167,94,0.75);
    outline-offset: 2px;
}
.action-popup-step-done button {
    background: rgba(198,167,94,0.10);
    border-color: rgba(198,167,94,0.32);
}
.action-popup-step-done .action-popup-step-text {
    color: var(--muted);
    text-decoration: line-through;
    text-decoration-thickness: 2px;
}
.action-popup-step-mark {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.22);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--gold);
    font-weight: 800;
}
.action-popup-step-text {
    min-width: 0;
    overflow-wrap: anywhere;
    line-height: 1.25;
}
.action-popup-step-state {
    color: var(--muted);
    font-size: 0.78rem;
    white-space: nowrap;
}
.action-popup-step-loading {
    padding: 12px;
    color: var(--muted);
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 10px;
}
.action-popup-empty {
    padding: 14px;
    color: var(--muted);
    border: 1px dashed rgba(198,167,94,0.30);
    border-radius: 10px;
    background: rgba(198,167,94,0.06);
    font-size: 0.88rem;
    line-height: 1.45;
    list-style: none;
}
.action-popup-empty a { color: var(--gold); text-decoration: underline; }
.action-popup-photo,
.action-popup-notes {
    display: flex;
    flex-direction: column;
    gap: 7px;
    color: var(--muted);
    font-size: 0.82rem;
}
.action-popup-notes textarea {
    width: 100%;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 10px;
    background: rgba(0,0,0,0.18);
    color: var(--text);
    padding: 10px;
    resize: vertical;
    min-height: 86px;
}
.action-popup-photo-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
    flex-wrap: wrap;
}
.action-popup-photo-btn {
    flex: 1 1 auto;
    min-width: 200px;
    justify-content: center;
    background: rgba(198,167,94,0.08);
    border-color: rgba(198,167,94,0.3);
    color: var(--text);
    min-height: 48px;
}
.action-popup-photo-btn:hover {
    background: rgba(198,167,94,0.14);
    border-color: var(--gold);
}
.action-popup-photo-clear {
    flex: 0 0 auto;
    min-width: 90px;
}
.action-popup-submit {
    min-height: 48px;
    border: 0;
    border-radius: 10px;
    background: var(--gold);
    color: #1b160a;
    font-weight: 800;
    cursor: pointer;
}
.action-popup-submit:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* ═══════════════════════════════════════════════════════════════════
   SOP Field Journal (cream theme)
   ───────────────────────────────────────────────────────────────────
   Scoped via body.theme-cream-sop so the dashboard + every other page
   keep the dark theme. This file IS the entire opt-in mechanism for
   the field-journal palette.

   Palette tokens (intentionally hardcoded rather than CSS vars so the
   dark-mode variables on other pages don't bleed into the journal):
     paper        #f4ead4   — warm cream page background
     paper-card   #fbf6e9   — lighter cream for the sheet itself
     paper-fade   #efe5cf   — faded variant for completed step cards
     ink          #1f1d18   — dark charcoal text
     ink-muted    #6b6657   — warm gray for muted copy
     gold         #c89a3a   — accent for checks, eyebrows, progress
     gold-soft    rgba(200,154,58,0.15) — gold tint backgrounds
     line         rgba(31, 29, 24, 0.12) — hairline divider on ink
   ═══════════════════════════════════════════════════════════════════ */

body.theme-cream-sop {
    background: #f4ead4;
    color: #1f1d18;
    margin: 0;
    /* Footer is sticky and 96px tall; leave breathing room so the last
       notes textarea isn't pinned under the button on short viewports. */
    padding-bottom: 112px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
body.theme-cream-sop a { color: inherit; }
body.theme-cream-sop .toast {
    /* Inherit the existing .toast positioning but recolor to the cream
       palette so success / error messaging reads against the paper. */
    background: #1f1d18;
    color: #fbf6e9;
}

/* ── Header bar ─────────────────────────────────────────────── */
.sop-journal-header {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 14px 16px;
    background: rgba(244, 234, 212, 0.92);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(31, 29, 24, 0.08);
}
.sop-journal-back,
.sop-journal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 1.3rem;
    text-decoration: none;
    color: #1f1d18;
    background: rgba(31, 29, 24, 0.04);
    flex-shrink: 0;
}
.sop-journal-back:hover,
.sop-journal-close:hover { background: rgba(31, 29, 24, 0.08); }
.sop-journal-header-title {
    flex: 1;
    text-align: center;
    font-size: 0.86rem;
    font-weight: 600;
    color: #6b6657;
    letter-spacing: 0.02em;
    /* Truncate long template names on narrow screens — full title is
       visible in the .sop-journal-title block immediately below. */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 0 4px;
}

/* ── Page layout / cream sheet ──────────────────────────────── */
.sop-journal-wrap {
    max-width: 640px;
    margin: 0 auto;
    padding: 18px 14px 24px;
}
.sop-journal-sheet {
    background: #fbf6e9;
    border-radius: 18px;
    padding: 22px 18px 24px;
    box-shadow:
        0 1px 0 rgba(31, 29, 24, 0.04),
        0 12px 32px rgba(31, 29, 24, 0.08);
    border: 1px solid rgba(31, 29, 24, 0.06);
}

/* ── Meta eyebrow row (BIN · EST · PRIORITY) ────────────────── */
.sop-journal-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    font-size: 0.72rem;
    letter-spacing: 0.10em;
    text-transform: uppercase;
}
.sop-journal-meta-chip {
    color: #c89a3a;
    font-weight: 700;
}
.sop-journal-meta-sep {
    color: rgba(31, 29, 24, 0.30);
}
.sop-journal-priority { font-weight: 700; }
.sop-journal-priority-critical { color: #b8351c; }
.sop-journal-priority-high     { color: #c4621b; }
.sop-journal-priority-medium   { color: #c89a3a; }
.sop-journal-priority-routine  { color: #6b6657; }

/* ── Title ──────────────────────────────────────────────────── */
.sop-journal-title {
    margin: 0;
    font-family: ui-serif, Georgia, "Times New Roman", Cambria, serif;
    font-size: 1.85rem;
    line-height: 1.15;
    font-weight: 700;
    color: #1f1d18;
    letter-spacing: -0.005em;
}
@media (min-width: 480px) {
    .sop-journal-title { font-size: 2.15rem; }
}
.sop-journal-subtitle {
    margin-top: 4px;
    margin-bottom: 18px;
    color: #6b6657;
    font-size: 0.95rem;
}

/* ── Progress bar ───────────────────────────────────────────── */
.sop-journal-progress {
    margin-bottom: 22px;
}
.sop-journal-progress-bar {
    height: 5px;
    background: rgba(31, 29, 24, 0.08);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 8px;
}
.sop-journal-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #c89a3a, #d6b35e);
    transition: width 0.35s ease;
}
.sop-journal-progress-text {
    font-size: 0.78rem;
    color: #6b6657;
    letter-spacing: 0.02em;
}

/* ── Step cards ─────────────────────────────────────────────── */
.sop-journal-steps {
    list-style: none;
    margin: 0 0 22px;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.sop-journal-step {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 14px 14px 12px;
    background: #fffaee;
    border: 1.5px solid rgba(31, 29, 24, 0.10);
    border-radius: 14px;
    min-height: 64px;
    transition: background 0.18s ease, border-color 0.18s ease, transform 0.10s ease, opacity 0.18s ease;
    cursor: default;
    -webkit-tap-highlight-color: rgba(200, 154, 58, 0.12);
}
.sop-journal-step[data-sop-step-click] {
    cursor: pointer;
}
.sop-journal-step[data-sop-step-click]:hover {
    border-color: rgba(31, 29, 24, 0.20);
    background: #fff6e0;
}
.sop-journal-step[data-sop-step-click]:active {
    transform: scale(0.995);
}
.sop-journal-step.is-loading {
    opacity: 0.55;
    pointer-events: none;
}
/* Active step: darker outline + subtle raised feel via stronger shadow.
   Subtle continuous pulse on the outline so the eye lands here even on
   sun-washed screens. prefers-reduced-motion respects the OS setting. */
.sop-journal-step-active {
    border-color: #1f1d18;
    background: #fbf6e9;
    box-shadow: 0 2px 0 rgba(31, 29, 24, 0.05), 0 6px 14px rgba(31, 29, 24, 0.06);
    animation: sopActivePulse 2.4s ease-in-out infinite;
}
@keyframes sopActivePulse {
    0%, 100% { box-shadow: 0 2px 0 rgba(31, 29, 24, 0.05), 0 6px 14px rgba(31, 29, 24, 0.06); }
    50%      { box-shadow: 0 2px 0 rgba(31, 29, 24, 0.05), 0 8px 22px rgba(200, 154, 58, 0.20); }
}
@media (prefers-reduced-motion: reduce) {
    .sop-journal-step-active { animation: none; }
}

/* Optimistic check-fill when the operator taps an incomplete step. The
   .is-loading class is added synchronously on click before the server
   round-trip + reload — gives the eye an immediate "yes, registered". */
.sop-journal-step.is-loading {
    background: rgba(200, 154, 58, 0.18);
    border-color: #c89a3a;
}
.sop-journal-step.is-loading .sop-journal-step-check {
    background: #c89a3a;
    border-color: #c89a3a;
    color: #fbf6e9;
    animation: sopCheckPop 0.25s ease-out;
}
.sop-journal-step.is-loading .sop-journal-step-check::after {
    content: "✓";
    font-weight: 700;
    font-size: 1.05rem;
    line-height: 1;
}
@keyframes sopCheckPop {
    0%   { transform: scale(0.6); }
    60%  { transform: scale(1.12); }
    100% { transform: scale(1.0); }
}
/* Completed step: faded background + strikethrough on the instruction. */
.sop-journal-step-done {
    background: #efe5cf;
    border-color: rgba(31, 29, 24, 0.08);
    opacity: 0.75;
}
.sop-journal-step-done .sop-journal-step-text {
    text-decoration: line-through;
    text-decoration-color: rgba(31, 29, 24, 0.45);
    text-decoration-thickness: 1.5px;
    color: #6b6657;
}
.sop-journal-step-done .sop-journal-step-eyebrow {
    color: rgba(200, 154, 58, 0.7);
}
.sop-journal-step-skipped {
    background: #f3ead7;
    border-color: rgba(123, 105, 78, 0.18);
    opacity: 0.84;
}
.sop-journal-step-skipped .sop-journal-step-text {
    color: #756a56;
}
.sop-journal-step-skipmark {
    color: #7b694e;
    font-size: 1.2rem;
    font-weight: 900;
    line-height: 1;
}

/* Big checkbox (28px target inside a 36px tap area, lined up with text). */
.sop-journal-step-check {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    margin-top: 2px;
    border: 2px solid rgba(31, 29, 24, 0.28);
    border-radius: 7px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #c89a3a;
    transition: border-color 0.18s ease, background 0.18s ease;
}
.sop-journal-step-active .sop-journal-step-check {
    border-color: #1f1d18;
}
.sop-journal-step-done .sop-journal-step-check {
    background: #c89a3a;
    border-color: #c89a3a;
    color: #fbf6e9;
}
.sop-journal-step-skipped .sop-journal-step-check {
    background: #f8f0df;
    border-color: rgba(123, 105, 78, 0.42);
}
.sop-journal-step-checkmark {
    width: 18px;
    height: 18px;
    display: block;
}

.sop-journal-step-body {
    flex: 1;
    min-width: 0; /* allow long instruction text to wrap inside flex */
}
.sop-journal-step-eyebrow {
    font-size: 0.70rem;
    text-transform: uppercase;
    letter-spacing: 0.10em;
    color: #c89a3a;
    font-weight: 700;
    margin-bottom: 4px;
}
.sop-journal-step-optional-tag {
    color: rgba(31, 29, 24, 0.45);
    font-weight: 500;
    text-transform: lowercase;
    letter-spacing: 0.02em;
}
.sop-journal-step-text {
    font-size: 1.02rem;
    line-height: 1.40;
    color: #1f1d18;
    word-wrap: break-word;
    overflow-wrap: break-word;
}
.sop-journal-step-note {
    margin-top: 8px;
    padding: 8px 10px;
    background: rgba(31, 29, 24, 0.04);
    border-left: 2px solid #c89a3a;
    border-radius: 6px;
    font-size: 0.88rem;
    font-style: italic;
    color: #6b6657;
}

/* Active-step expandable note input. Collapsed by default so the
   journal stays calm; opens to a small textarea when the operator
   taps the summary. */
.sop-journal-step-note-edit {
    margin-top: 10px;
}
.sop-journal-step-note-edit > summary,
.sop-journal-step-note-toggle {
    list-style: none;
    cursor: pointer;
    display: inline-block;
    font-size: 0.78rem;
    color: #c89a3a;
    font-weight: 600;
    letter-spacing: 0.04em;
    padding: 4px 0;
    user-select: none;
    -webkit-tap-highlight-color: rgba(200, 154, 58, 0.12);
}
.sop-journal-step-note-edit > summary::-webkit-details-marker { display: none; }
.sop-journal-step-note-edit[open] > summary {
    color: #6b6657;
    font-weight: 700;
    margin-bottom: 6px;
}
.sop-journal-step-note-input {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    background: #fffaee;
    border: 1.5px solid rgba(31, 29, 24, 0.12);
    border-radius: 10px;
    color: #1f1d18;
    font-family: inherit;
    font-size: 0.95rem;
    line-height: 1.4;
    resize: vertical;
    min-height: 64px;
}
.sop-journal-step-note-input:focus {
    outline: none;
    border-color: #1f1d18;
    background: #fffdf7;
}
.sop-journal-step-note-input::placeholder {
    color: rgba(31, 29, 24, 0.42);
}
.sop-journal-skip-btn {
    background: rgba(123,105,78,0.10);
    border: 1px solid rgba(123,105,78,0.24);
    border-radius: 6px;
    color: #5d503d;
    cursor: pointer;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 800;
    margin-top: 8px;
    min-height: 38px;
    padding: 8px 10px;
    text-transform: uppercase;
}
.sop-journal-skip-btn:focus-visible {
    outline: 2px solid rgba(118,85,43,0.35);
    outline-offset: 2px;
}
.sop-journal-skip-btn.is-loading {
    opacity: 0.55;
    pointer-events: none;
}

/* ── Photo capture block ───────────────────────────────────── */
.sop-journal-photo {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 100%;
    min-height: 110px;
    padding: 20px 14px;
    background: rgba(200, 154, 58, 0.06);
    border: 2px dashed rgba(31, 29, 24, 0.20);
    border-radius: 14px;
    color: #1f1d18;
    font-family: inherit;
    cursor: pointer;
    margin-bottom: 18px;
    transition: border-color 0.18s ease, background 0.18s ease;
    -webkit-tap-highlight-color: rgba(200, 154, 58, 0.12);
}
.sop-journal-photo:hover {
    border-color: #1f1d18;
    background: rgba(200, 154, 58, 0.10);
}
.sop-journal-photo:active { transform: scale(0.995); }
.sop-journal-photo-icon {
    font-size: 2rem;
    font-weight: 300;
    line-height: 1;
    color: #c89a3a;
    margin-bottom: 2px;
}
.sop-journal-photo-label {
    font-size: 0.82rem;
    letter-spacing: 0.10em;
    text-transform: uppercase;
    font-weight: 700;
    color: #1f1d18;
}
.sop-journal-photo-sub {
    font-size: 0.78rem;
    color: #6b6657;
}
.sop-journal-photo-has {
    background: rgba(200, 154, 58, 0.14);
    border-style: solid;
    border-color: #c89a3a;
}
.sop-journal-photo-has .sop-journal-photo-icon::before { content: "✓"; }

/* Inline preview state: full-bleed thumbnail with a dark overlay strip
   that carries the "TAP TO REPLACE" label. The button stays the SAME
   trigger (data-sop-step-photo-trigger) so the operator can re-shoot
   without learning new UI. */
.sop-journal-photo-preview {
    padding: 0;
    overflow: hidden;
    position: relative;
    min-height: 0; /* let the image dictate height up to a max */
    border-style: solid;
    border-color: #c89a3a;
}
.sop-journal-photo-thumb {
    display: block;
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: rgba(31, 29, 24, 0.04);
}
.sop-journal-photo-overlay {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    padding: 10px 12px;
    background: linear-gradient(to top, rgba(31, 29, 24, 0.78), rgba(31, 29, 24, 0));
    color: #fbf6e9;
    text-align: center;
    pointer-events: none;
}
.sop-journal-photo-overlay .sop-journal-photo-label {
    color: #fbf6e9;
    font-size: 0.72rem;
}

/* Per-step thumbnail (only rendered on completed-run view) — small
   inline image so the journal entry shows which step had the photo. */
.sop-journal-step-thumb {
    display: block;
    width: 100%;
    max-width: 280px;
    height: auto;
    margin-top: 10px;
    border-radius: 8px;
    border: 1px solid rgba(31, 29, 24, 0.10);
    background: rgba(31, 29, 24, 0.04);
}

/* ── Notes block ───────────────────────────────────────────── */
.sop-journal-notes-block {
    display: block;
    margin-bottom: 8px;
}
.sop-journal-notes-label {
    display: block;
    font-size: 0.74rem;
    letter-spacing: 0.10em;
    text-transform: uppercase;
    color: #c89a3a;
    font-weight: 700;
    margin-bottom: 6px;
}
.sop-journal-notes-input {
    width: 100%;
    box-sizing: border-box;
    padding: 14px 14px;
    background: #fffaee;
    border: 1.5px solid rgba(31, 29, 24, 0.12);
    border-radius: 12px;
    color: #1f1d18;
    font-family: inherit;
    font-size: 1.0rem;
    line-height: 1.45;
    min-height: 96px;
    resize: vertical;
    transition: border-color 0.18s ease, background 0.18s ease;
}
.sop-journal-notes-input:focus {
    outline: none;
    border-color: #1f1d18;
    background: #fffdf7;
}
.sop-journal-notes-input::placeholder {
    color: rgba(31, 29, 24, 0.40);
}

/* ── Sticky completion footer ──────────────────────────────── */
.sop-journal-footer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100;
    padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
    background: rgba(244, 234, 212, 0.96);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    border-top: 1px solid rgba(31, 29, 24, 0.10);
}
.sop-journal-complete-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    width: 100%;
    min-height: 64px;
    padding: 14px;
    background: #1f1d18;
    color: #fbf6e9;
    border: none;
    border-radius: 14px;
    font-family: inherit;
    font-size: 1.0rem;
    font-weight: 700;
    letter-spacing: 0.10em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.18s ease, transform 0.10s ease, opacity 0.18s ease;
    -webkit-tap-highlight-color: rgba(200, 154, 58, 0.12);
}
.sop-journal-complete-btn:hover {
    background: #2a2620;
}
.sop-journal-complete-btn:active { transform: scale(0.995); }
.sop-journal-complete-btn[aria-busy="true"] { opacity: 0.70; pointer-events: none; }
.sop-journal-complete-sub {
    font-size: 0.74rem;
    letter-spacing: 0.08em;
    color: rgba(251, 246, 233, 0.65);
    font-weight: 600;
}
/* Disabled state: muted but still informative — shows "N steps remaining". */
.sop-journal-complete-btn-disabled {
    background: rgba(31, 29, 24, 0.18);
    color: #1f1d18;
    cursor: not-allowed;
}
.sop-journal-complete-btn-disabled:hover { background: rgba(31, 29, 24, 0.18); }
.sop-journal-complete-btn-disabled .sop-journal-complete-sub { color: rgba(31, 29, 24, 0.55); }

/* ── Completion view (read-only logged state) ──────────────── */
.sop-journal-done {
    margin: 18px 0 22px;
    text-align: center;
    padding: 30px 18px;
    background:
        radial-gradient(ellipse at top, rgba(200, 154, 58, 0.16), rgba(200, 154, 58, 0.06) 60%, transparent),
        rgba(200, 154, 58, 0.04);
    border: 1.5px solid rgba(200, 154, 58, 0.35);
    border-radius: 14px;
    animation: sopDoneRise 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes sopDoneRise {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
.sop-journal-done-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 12px;
    border-radius: 50%;
    background: linear-gradient(135deg, #c89a3a, #d6b35e);
    color: #fbf6e9;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 700;
    box-shadow: 0 6px 16px rgba(200, 154, 58, 0.30);
    animation: sopDonePop 0.55s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes sopDonePop {
    0%   { transform: scale(0.4); opacity: 0; }
    60%  { transform: scale(1.12); opacity: 1; }
    100% { transform: scale(1.0); }
}
@media (prefers-reduced-motion: reduce) {
    .sop-journal-done,
    .sop-journal-done-icon { animation: none; }
}
.sop-journal-done-title {
    font-family: ui-serif, Georgia, "Times New Roman", Cambria, serif;
    font-size: 1.4rem;
    font-weight: 700;
    color: #1f1d18;
    margin-bottom: 6px;
}
.sop-journal-done-quality {
    color: #6b6657;
    font-size: 0.92rem;
    margin-bottom: 10px;
}
/* EW-405: step-count transparency on the completion stamp. Muted vs
   the quality score so it reads as supporting detail, not headline. */
.sop-journal-done-summary {
    color: #6b6657;
    font-size: 0.82rem;
    letter-spacing: 0.02em;
    margin-bottom: 8px;
}
.sop-journal-done-notes {
    margin: 12px auto 0;
    padding: 10px 12px;
    background: #fbf6e9;
    border-left: 3px solid #c89a3a;
    border-radius: 6px;
    font-size: 0.92rem;
    color: #1f1d18;
    text-align: left;
    max-width: 480px;
}
.sop-journal-done-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-top: 16px;
}
.sop-journal-btn-primary,
.sop-journal-btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 10px 18px;
    border-radius: 12px;
    font-family: inherit;
    font-size: 0.94rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    letter-spacing: 0.02em;
}
.sop-journal-btn-primary {
    background: #1f1d18;
    color: #fbf6e9;
}
.sop-journal-btn-primary:hover { background: #2a2620; }
.sop-journal-btn-ghost {
    background: transparent;
    color: #1f1d18;
    border: 1.5px solid rgba(31, 29, 24, 0.20);
}
.sop-journal-btn-ghost:hover {
    border-color: #1f1d18;
    background: rgba(31, 29, 24, 0.04);
}
