/* ==========================================================================
   Saguaro Analytics — Main Stylesheet
   Theme: Warm charcoal, desert sand accent (#D4A574)
   Fonts: DM Sans (body), JetBrains Mono (code/mono)
   ========================================================================== */

:root {
    --bg-primary:    #1E1C1A;
    --bg-secondary:  #252320;
    --bg-tertiary:   #2C2A27;
    --bg-hover:      #333029;
    --bg-surface:    #29271F;
    /* --bg-card was referenced by 2 rules but never defined → silently fell
       through to browser default (transparent). Aliased to --bg-secondary so
       both rules now have a real value. */
    --bg-card:       #252320;

    --border:        #3D3A35;
    --border-subtle: #302D28;

    --text-primary:  #F0EBE4;
    --text-secondary:#9B9590;
    --text-muted:    #6B6660;

    --accent:        #D4A574;
    --accent-soft:   rgba(212, 165, 116, 0.12);
    --accent-hover:  #E0B585;

    --green:         #5cb37a;
    --green-soft:    rgba(92, 179, 122, 0.12);
    --red:           #c75a5a;
    --red-soft:      rgba(199, 90, 90, 0.12);
    --yellow:        #c9a84a;
    --yellow-soft:   rgba(201, 168, 74, 0.12);
    --blue:          #7aaec9;
    --blue-soft:     rgba(122, 174, 201, 0.14);
    --white:         #F0EBE4;
    --white-soft:    rgba(240, 235, 228, 0.08);

    --sidebar-width: 260px;
    --topbar-height: 56px;
    --radius:        8px;
    --radius-lg:     12px;

    --font-sans: 'DM Sans', -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}


/* ==========================================================================
   BUTTONS
   ========================================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: var(--radius);
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    border: none;
    line-height: 1;
}

/* .btn-primary was defined twice — the later definition (color: #fff,
   padding 9px 22px) won in cascade order and was the only one actually
   rendering. Removed the earlier conflicting block. Single definition
   now lives further down in main.css under the dashboard-button section. */

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-ghost:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}


/* ==========================================================================
   ANIMATIONS
   ========================================================================== */

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

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.4; }
}

.animate-in {
    animation: fadeInUp 0.45s ease forwards;
    opacity: 0;
}

.delay-1 { animation-delay: 0.08s; }
.delay-2 { animation-delay: 0.16s; }
.delay-3 { animation-delay: 0.26s; }
.delay-4 { animation-delay: 0.36s; }


/* ==========================================================================
   LANDING — Coming Soon
   ========================================================================== */

.landing-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg-primary);
    position: relative;
    overflow: hidden;
}

.landing-container::before {
    content: '';
    position: absolute;
    width: 700px;
    height: 700px;
    background: radial-gradient(circle, var(--accent-soft) 0%, transparent 65%);
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.landing-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    padding: 18px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 10;
}

.landing-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.landing-brand-text {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.landing-content {
    text-align: center;
    position: relative;
    z-index: 1;
    padding: 0 24px;
}

.landing-content h1 {
    font-size: 52px;
    font-weight: 300;
    letter-spacing: -0.035em;
    color: var(--text-primary);
    margin-bottom: 18px;
    line-height: 1.1;
}

.landing-content h1 span {
    color: var(--accent);
    font-weight: 500;
}

.landing-content p {
    font-size: 17px;
    color: var(--text-secondary);
    max-width: 420px;
    margin: 0 auto;
    line-height: 1.65;
}

.landing-tagline {
    margin-top: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 12px;
    font-family: var(--font-mono);
    color: var(--text-muted);
    letter-spacing: 0.04em;
}

.landing-tagline::before,
.landing-tagline::after {
    content: '';
    width: 32px;
    height: 1px;
    background: var(--border);
}


/* ==========================================================================
   LOGIN — Split layout with Clerk widget
   ========================================================================== */

.login-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 100vh;
}

@media (max-width: 768px) {
    .login-layout { grid-template-columns: 1fr; }
    .login-left   { display: none; }
}

/* Left panel — branding */
.login-left {
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 40px 48px;
    position: relative;
    overflow: hidden;
}

.login-left::before {
    content: '';
    position: absolute;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, var(--accent-soft) 0%, transparent 70%);
    bottom: -100px;
    left: -100px;
    pointer-events: none;
}

.login-left-top {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    z-index: 1;
}

.login-left-brand {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.login-left-body {
    position: relative;
    z-index: 1;
}

.login-left-body h2 {
    font-size: 32px;
    font-weight: 300;
    letter-spacing: -0.03em;
    color: var(--text-primary);
    margin-bottom: 16px;
    line-height: 1.25;
}

.login-left-body h2 span {
    color: var(--accent);
    font-weight: 500;
}

.login-left-body p {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.6;
    max-width: 340px;
}

.login-left-bottom {
    font-size: 12px;
    font-family: var(--font-mono);
    color: var(--text-muted);
    position: relative;
    z-index: 1;
}

/* Right panel — Clerk widget */
.login-right {
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 32px;
}

.login-right-inner {
    width: 100%;
    max-width: 400px;
}

.login-right-header {
    margin-bottom: 28px;
    text-align: center;
}

.login-right-header h3 {
    font-size: 20px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 6px;
    letter-spacing: -0.02em;
}

.login-right-header p {
    font-size: 14px;
    color: var(--text-secondary);
}

#clerk-sign-in {
    display: flex;
    justify-content: center;
}

#clerk-sign-in .cl-rootBox,
#clerk-sign-in .cl-card {
    width: 100%;
    background: var(--bg-surface) !important;
    border: 1px solid var(--border-subtle) !important;
    box-shadow: none !important;
}


/* ==========================================================================
   DASHBOARD — Sidebar
   ========================================================================== */

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.sidebar-header {
    padding: 20px 22px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.sidebar-logo {
    width: 32px;
    height: 32px;
    background: var(--accent);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-logo svg {
    width: 18px;
    height: 18px;
    fill: #1E1C1A;
}

.sidebar-brand {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.sidebar-nav {
    flex: 1;
    padding: 12px 10px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.nav-section {
    margin-bottom: 8px;
}

.nav-section-label {
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
    padding: 8px 12px 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 12px;
    border-radius: var(--radius);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 400;
    transition: background 0.12s ease, color 0.12s ease;
    cursor: pointer;
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 500;
}

.nav-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.65;
    transition: opacity 0.12s ease;
}

.nav-item:hover .nav-icon,
.nav-item.active .nav-icon {
    opacity: 1;
    color: inherit;
}


.nav-spacer { flex: 1; }

.nav-bottom {
    padding: 10px 10px 16px;
    border-top: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.nav-sub {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.2s ease;
}
.nav-sub.open { max-height: 200px; }
.nav-sub-item {
    display: flex;
    align-items: center;
    padding: 6px 10px 6px 44px;
    font-size: 13px;
    font-weight: 400;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 6px;
    transition: background 0.12s, color 0.12s;
    white-space: nowrap;
}
.nav-sub-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-sub-item.active { color: var(--accent); font-weight: 500; }


/* ==========================================================================
   DASHBOARD — Top bar
   ========================================================================== */

.topbar {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--topbar-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 90;
}

.topbar-title {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-family: var(--font-mono);
    color: var(--text-muted);
    background: var(--bg-tertiary);
    padding: 5px 12px;
    border-radius: 20px;
    border: 1px solid var(--border-subtle);
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 6px var(--green);
    flex-shrink: 0;
}

.status-dot.disconnected {
    background: var(--red);
    box-shadow: 0 0 6px var(--red);
    animation: pulse 1.8s ease infinite;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 10px 5px 5px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.12s ease;
}

.topbar-user:hover { background: var(--bg-hover); }

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    color: #1E1C1A;
    flex-shrink: 0;
}

.user-name {
    font-size: 13px;
    color: var(--text-secondary);
}


/* ==========================================================================
   DASHBOARD — Main content area
   ========================================================================== */

.main {
    margin-left: var(--sidebar-width);
    margin-top: var(--topbar-height);
    padding: 28px;
    min-height: calc(100vh - var(--topbar-height));
}

.page-header {
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.025em;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.page-header p {
    font-size: 14px;
    color: var(--text-secondary);
}


/* ==========================================================================
   DASHBOARD — Cards
   ========================================================================== */

.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 20px;
}

.card-title {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 14px;
}

.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
}

.status-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: border-color 0.15s ease;
}

.status-card:hover { border-color: var(--border); }

.status-card-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.status-card-icon.green  { background: var(--green-soft);  color: var(--green); }
.status-card-icon.yellow { background: var(--yellow-soft); color: var(--yellow); }
.status-card-icon.red    { background: var(--red-soft);    color: var(--red); }
.status-card-icon.accent { background: var(--accent-soft); color: var(--accent); }

.status-card-info h3 {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.status-card-info p {
    font-size: 12px;
    font-family: var(--font-mono);
    color: var(--text-muted);
}


/* ==========================================================================
   DASHBOARD — Data tables
   ========================================================================== */

.table-container {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table thead th {
    background: var(--bg-tertiary);
    color: var(--text-muted);
    font-weight: 500;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 10px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-subtle);
    white-space: nowrap;
}

.data-table tbody tr {
    border-bottom: 1px solid var(--border-subtle);
    transition: background 0.1s ease;
}

.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody tr:hover { background: var(--bg-hover); }

.data-table tbody td {
    padding: 11px 16px;
    color: var(--text-secondary);
    vertical-align: middle;
}

.data-table tbody td:first-child {
    color: var(--text-primary);
    font-weight: 500;
}

.data-table .mono {
    font-family: var(--font-mono);
    font-size: 12px;
}


/* ==========================================================================
   BADGES
   ========================================================================== */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.badge-green  { background: var(--green-soft);  color: var(--green); }
.badge-yellow { background: var(--yellow-soft); color: var(--yellow); }
.badge-red    { background: var(--red-soft);    color: var(--red); }
.badge-accent { background: var(--accent-soft); color: var(--accent); }
.badge-muted  { background: var(--bg-tertiary); color: var(--text-muted); border: 1px solid var(--border-subtle); }




/* ==========================================================================
   COLOR UTILITIES — Semantic foreground and background tints
   ========================================================================== */

.color-accent  { color: var(--accent); }
.color-green   { color: var(--green); }
.color-yellow  { color: var(--yellow); }
.color-red     { color: var(--red); }
.color-muted   { color: var(--text-muted); }

.bg-accent       { background: var(--accent); }
.bg-green        { background: var(--green); }
.bg-muted        { background: var(--text-muted); }
.bg-soft-accent  { background: var(--accent-soft); }
.bg-soft-green   { background: var(--green-soft); }
.bg-soft-yellow  { background: var(--yellow-soft); }
.bg-soft-red     { background: var(--red-soft); }


/* ==========================================================================
   FILTERS — Filter bar
   ========================================================================== */

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-end;
    margin-bottom: 20px;
    position: relative;
    z-index: 50;
}

.filter-group { display: flex; flex-direction: column; gap: 6px; }

.filter-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

.period-buttons {
    display: flex;
    gap: 2px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 3px;
}

.period-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 500;
    font-family: var(--font-sans);
    padding: 5px 11px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}

.period-btn:hover  { background: var(--bg-hover); color: var(--text-primary); }
.period-btn.active { background: var(--bg-tertiary); color: var(--text-primary); box-shadow: 0 1px 3px rgba(0,0,0,0.25); }

.filter-dropdown { position: relative; }

.filter-dropdown-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 13px;
    font-family: var(--font-sans);
    padding: 7px 12px;
    cursor: pointer;
    min-width: 140px;
    justify-content: space-between;
    transition: border-color 0.15s;
    white-space: nowrap;
}

.filter-dropdown-btn:hover,
.filter-dropdown.open .filter-dropdown-btn { border-color: var(--accent); }

.filter-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 200px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.35);
    z-index: 500;
    padding: 6px 0;
    max-height: 280px;
    overflow-y: auto;
}

.filter-dropdown.open .filter-dropdown-menu { display: block; }

.filter-option {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 14px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.1s;
}

.filter-option:hover { background: var(--bg-hover); color: var(--text-primary); }
.filter-option input[type=checkbox] { accent-color: var(--accent); width: 14px; height: 14px; cursor: pointer; }
.filter-option-all { color: var(--text-primary); font-weight: 500; }
.filter-divider { border-top: 1px solid var(--border); margin: 4px 0; }


/* ==========================================================================
   KPI CARD
   ──────────────────────────────────────────────────────────────────────────
   HTML template:
     <div class="kpi-row">
       <div class="kpi-card">
         <div class="kpi-label">Inventory Turnover</div>
         <div class="kpi-value-row">
           <span class="kpi-value" id="kpiTurnover">—</span>
           <span class="kpi-unit">turns / yr</span>
         </div>
         <div class="kpi-delta" id="kpiTurnoverDelta"></div>
       </div>
     </div>
   JS: el.textContent = '↑ +0.8 vs prior'; el.className = 'kpi-delta up';
   ========================================================================== */

.kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.kpi-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.kpi-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
}

.kpi-value-row {
    display: flex;
    align-items: baseline;
    gap: 5px;
}

.kpi-value {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

.kpi-unit {
    font-size: 12px;
    font-weight: 400;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.kpi-delta {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    min-height: 18px;
}

.kpi-delta.up   { color: var(--green); }
.kpi-delta.down { color: var(--red); }


/* ==========================================================================
   CARD HEADER — Title + breadcrumb pattern
   ========================================================================== */

.card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 12px;
    flex-wrap: wrap;
}

.card-header-left {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.card-heading {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.card-subhead { font-size: 12px; color: var(--text-muted); }

.card-breadcrumb {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--text-muted);
    flex-wrap: wrap;
    min-height: 18px;
}

.crumb-btn {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 12px;
    font-family: var(--font-sans);
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.crumb-btn:hover { text-decoration: underline; }
.crumb-sep { color: var(--border); font-size: 11px; }

.chart-empty {
    display: none;
    text-align: center;
    padding: 40px 0;
    color: var(--text-muted);
    font-size: 13px;
    font-style: italic;
}

.chart-canvas { position: relative; height: 260px; }


/* ==========================================================================
   CHART PAIR — Two-column card layout
   ========================================================================== */

.chart-pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

@media (max-width: 1000px) { .chart-pair { grid-template-columns: 1fr; } }


/* ==========================================================================
   PANEL LIST — Icon + metric + aside rows (waste, status, alerts)
   ========================================================================== */

.panel-list { display: flex; flex-direction: column; gap: 8px; }

.panel-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-radius: var(--radius);
    border: 1px solid var(--border-subtle);
    background: var(--bg-tertiary);
}

.panel-row-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.panel-row-icon svg { width: 18px; height: 18px; }

.panel-row-body { flex: 1; min-width: 0; }

.panel-row-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.panel-row-value-big {
    font-size: 20px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}

.panel-row-sub {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.panel-row-aside {
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font-mono);
    color: var(--text-secondary);
    flex-shrink: 0;
    text-align: right;
}


/* ==========================================================================
   SEG BARS — Labeled relative-size bars (ABC, OEE mix, revenue split)
   ========================================================================== */

.seg-bars { display: flex; flex-direction: column; gap: 16px; }

.seg-row { display: flex; flex-direction: column; gap: 6px; }

.seg-label { font-size: 12px; font-weight: 600; color: var(--text-secondary); }

.seg-track {
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
}

.seg-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s ease;
}

.seg-meta {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.seg-legend {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 11px;
    color: var(--text-muted);
    border-top: 1px solid var(--border-subtle);
    padding-top: 12px;
    flex-wrap: wrap;
    row-gap: 6px;
}

.seg-legend-item { display: flex; align-items: center; gap: 5px; }

.seg-legend-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.table-empty-cell {
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    padding: 32px 0;
}

/* ── Distillate batch entry wizard ─────────────────────────────────────────── */

.batch-wizard {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

.batch-step-nav {
    flex: 0 0 220px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    position: sticky;
    top: 24px;
}

.step-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: none;
    background: none;
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    width: 100%;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
}

.step-nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.step-nav-item.active {
    background: var(--bg-card);
    color: var(--text-primary);
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.step-nav-item.done {
    color: var(--text-secondary);
}

.step-nav-num {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--border);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}

.step-nav-item.active .step-nav-num {
    background: var(--accent);
    color: #fff;
}

.step-nav-item.done .step-nav-num {
    background: #10b981;
    color: #fff;
}

.step-nav-label {
    flex: 1;
}

.step-nav-check {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    color: #10b981;
    display: none;
}

.step-nav-check svg {
    width: 14px;
    height: 14px;
}

.step-nav-item.done .step-nav-check {
    display: flex;
}

.batch-step-content {
    flex: 1 1 0;
    min-width: 0;
}

.step-section {
    display: none;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 28px;
}

.step-section.active {
    display: block;
}

.step-section-header {
    margin-bottom: 24px;
}

.step-section-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.step-section-sub {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 3px;
}

.form-group-heading {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.form-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 4px;
}

.form-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 4px;
}

@media (max-width: 900px) {
    .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
    .batch-wizard { flex-direction: column; }
    .batch-step-nav { flex: none; width: 100%; position: static; }
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.form-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-label .req {
    color: #ef4444;
    margin-left: 2px;
}

.form-input, .form-select {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 13px;
    padding: 8px 12px;
    outline: none;
    transition: border-color 0.15s;
    font-family: inherit;
    width: 100%;
    box-sizing: border-box;
}

.form-input:focus, .form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(99,102,241,0.15);
}

.form-input::placeholder {
    color: var(--text-muted);
    opacity: 0.6;
}

.form-hint {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.4;
}

.form-error {
    background: rgba(239,68,68,0.1);
    border: 1px solid rgba(239,68,68,0.35);
    border-radius: 8px;
    color: #ef4444;
    font-size: 13px;
    padding: 10px 14px;
    margin-bottom: 16px;
}

.step-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.btn-primary {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    padding: 9px 22px;
    cursor: pointer;
    transition: opacity 0.15s;
}

.btn-primary:hover { opacity: 0.88; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

/* PAR editor buttons — replaces inline style="..." attrs in distillate.html
   that were also paired with inline onclick handlers (both CSP-blocked). */
.btn-edit-par {
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    cursor: pointer;
}
.btn-edit-par:hover { color: var(--text-secondary); border-color: var(--text-muted); }
.btn-save-par {
    margin-top: 12px;
    width: 100%;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 10px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}
.btn-save-par:hover { background: var(--accent-hover); }

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    padding: 8px 18px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.btn-secondary:hover { background: var(--bg-hover); color: var(--text-primary); }

.batch-status-pill {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    padding: 3px 10px;
    border-radius: 20px;
}

.batch-status-pill.wip         { background: rgba(99,102,241,0.15); color: #6366f1; }
.batch-status-pill.pending_qc  { background: rgba(245,158,11,0.15); color: #f59e0b; }
.batch-status-pill.approved    { background: rgba(16,185,129,0.15); color: #10b981; }
.batch-status-pill.rejected    { background: rgba(239,68,68,0.15);  color: #ef4444; }
.batch-status-pill.quarantine  { background: rgba(239,68,68,0.12);  color: #f97316; }
.batch-status-pill.voided      { background: rgba(107,114,128,0.15); color: #6b7280; }

.contaminant-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    background: rgba(239,68,68,0.12);
    border: 1px solid rgba(239,68,68,0.3);
    color: #ef4444;
    padding: 2px 8px;
    border-radius: 4px;
    margin-left: 8px;
    vertical-align: middle;
}

/* Repeatable row card (bags, sessions, QC cycles) */
.repeat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 18px;
    margin-bottom: 12px;
    position: relative;
}

.repeat-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.repeat-card-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

.repeat-card-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
    transition: color 0.15s;
}

.repeat-card-remove:hover { color: #ef4444; }

/* Batch number assignment table */
.ba-table {
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}

.ba-header {
    display: grid;
    grid-template-columns: 220px 1fr 1fr 32px;
    gap: 0;
    background: var(--bg-secondary);
    padding: 8px 14px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}

.ba-row {
    display: grid;
    grid-template-columns: 220px 1fr 1fr 32px;
    gap: 0;
    align-items: center;
    padding: 7px 14px;
    border-bottom: 1px solid var(--border);
    gap: 10px;
}

.ba-row:last-child { border-bottom: none; }

.ba-col-material {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.ba-col-num {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: var(--text-muted);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 3px 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ba-col-tag .form-input,
.ba-col-tag.form-input {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    padding: 6px 10px;
}

.ba-col-action {
    display: flex;
    align-items: center;
    justify-content: center;
}

.ba-remove-lot {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 2px 4px;
    border-radius: 4px;
    transition: color 0.15s;
}
.ba-remove-lot:hover { color: #ef4444; }

.ba-grade-group {
    border-bottom: 1px solid var(--border);
}

.ba-grade-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    background: var(--bg-secondary);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
}

.ba-add-btn {
    font-size: 12px;
    padding: 4px 12px;
}

.ba-empty-lots {
    padding: 10px 14px;
    font-size: 12px;
    color: var(--text-muted);
    font-style: italic;
}

.rate-lock-btn {
    display: inline-flex;
    align-items: center;
    padding: 2px;
    color: var(--text-muted);
    background: none;
    border: none;
    cursor: pointer;
    transition: color 0.15s;
}
.rate-lock-btn svg {
    width: 15px;
    height: 15px;
    stroke: currentColor;
    fill: none;
}
.rate-lock-btn:hover { color: var(--text-primary); }
.rate-lock-btn.unlocked { color: #f59e0b; }
.rate-input[readonly] { opacity: 0.65; cursor: not-allowed; }

/* ============================================================
   MATERIAL PREP STEP
   ============================================================ */

/* Step section header (title + save status pill) */
.step-section-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}
.step-section-headline { display: flex; flex-direction: column; }
.step-section-headline h2 {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
    margin: 0;
}
.step-section-headline-sub {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}
.save-status {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.save-status::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-muted);
}
.save-status.is-saving::before { background: var(--yellow); }
.save-status.is-saved::before  { background: var(--green); }
.save-status.is-error::before  { background: var(--red); }
.save-status.is-error          { color: var(--red); }

/* Prep session card */
.prep-session {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 20px 22px;
    margin-bottom: 14px;
}
.prep-session:last-of-type { margin-bottom: 16px; }
.prep-session-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 12px;
}
.prep-session-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}
.prep-operator {
    font-size: 12px;
    color: var(--text-secondary);
    margin-left: 12px;
}
.prep-operator-name { color: var(--text-primary); font-weight: 500; }
.prep-session-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: var(--radius);
    transition: color 0.15s, background 0.15s;
}
.prep-session-remove:hover { color: var(--red); background: var(--red-soft); }

/* Timer row */
.prep-timer-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}
.btn-timer {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    font-size: 12px;
    font-weight: 600;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn-timer-start { background: var(--green-soft); color: var(--green); border-color: var(--green); }
.btn-timer-start:hover { background: var(--green); color: #fff; }
.btn-timer-stop  { background: var(--red-soft);   color: var(--red);   border-color: var(--red); }
.btn-timer-stop:hover  { background: var(--red); color: #fff; }
.prep-time-input {
    flex: 1;
    min-width: 0;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 13px;
    padding: 8px 12px;
    outline: none;
    transition: border-color 0.15s;
}
.prep-time-input:focus { border-color: var(--accent); }
.prep-timer-sep { color: var(--text-muted); font-size: 11px; padding: 0 2px; }

/* Bag grid */
.prep-bag-grid {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
    padding: 4px 0 8px;
}
.prep-bag-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    position: relative;
}
.prep-bag-svg { color: var(--text-muted); display: block; }
.prep-bag-num {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}
.prep-bag-weight {
    font-size: 11px;
    color: var(--accent);
    font-weight: 600;
    min-width: 56px;
    text-align: center;
}
.prep-bag-input {
    width: 70px;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    padding: 5px 8px;
    outline: none;
    transition: border-color 0.15s;
}
.prep-bag-input:focus { border-color: var(--accent); }
.prep-bag-remove {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-primary);
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.prep-bag-remove:hover {
    background: var(--red-soft);
    color: var(--red);
    border-color: var(--red);
}
.prep-add-bag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
    background: var(--accent-soft);
    border: 1px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.15s;
    align-self: center;
}
.prep-add-bag:hover { background: rgba(212, 165, 116, 0.2); }

/* Live summary footer per session */
.prep-session-footer {
    display: flex;
    gap: 28px;
    padding-top: 14px;
    margin-top: 14px;
    border-top: 1px solid var(--border-subtle);
    flex-wrap: wrap;
}
.prep-summary-item { display: flex; flex-direction: column; gap: 2px; }
.prep-summary-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}
.prep-summary-value {
    font-family: var(--font-mono);
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.1;
}

/* Add session button */
.prep-add-session {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 600;
    color: var(--accent);
    background: transparent;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    margin-top: 4px;
}
.prep-add-session:hover { background: var(--accent-soft); border-color: var(--accent); }

/* Empty state when no sessions yet */
.prep-empty-state {
    padding: 32px 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    background: var(--bg-secondary);
    border: 1px dashed var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 14px;
}

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */
.toast-stack {
    position: fixed;
    top: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 9999;
    pointer-events: none;
}
.toast {
    pointer-events: auto;
    min-width: 220px;
    max-width: 360px;
    padding: 12px 16px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    box-shadow: 0 6px 24px rgba(0,0,0,0.35);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: toast-in 0.18s ease-out;
}
.toast.is-leaving { animation: toast-out 0.2s ease-in forwards; }
.toast.is-success { border-left-color: var(--green); }
.toast.is-error   { border-left-color: var(--red); color: var(--text-primary); }
.toast.is-info    { border-left-color: var(--accent); }
.toast-icon {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
}
.toast.is-success .toast-icon { background: var(--green-soft); color: var(--green); }
.toast.is-error   .toast-icon { background: var(--red-soft);   color: var(--red); }
.toast.is-info    .toast-icon { background: var(--accent-soft); color: var(--accent); }

@keyframes toast-in {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes toast-out {
    from { opacity: 1; transform: translateY(0); }
    to   { opacity: 0; transform: translateX(20px); }
}

/* Setup footer with two buttons */
.setup-footer-pair {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
}
.setup-footer-pair .btn-secondary { padding: 12px 22px; font-size: 14px; }
.setup-footer-pair .btn-primary   { padding: 12px 32px; font-size: 14px; }

/* ============================================================
   EXTRACTION STEP — bag picker + detail form
   ============================================================ */

.ex-session-row { margin-bottom: 16px; }
.ex-session-row:last-of-type { margin-bottom: 8px; }
.ex-session-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    margin-bottom: 8px;
}
.ex-bag-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.ex-bag-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 7px 4px 6px;
    width: 56px;
    background: var(--bg-primary);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
    user-select: none;
    position: relative;
}
.ex-bag-chip:hover { border-color: var(--text-muted); }
.ex-bag-chip.is-in-progress { border-color: var(--yellow); }
.ex-bag-chip.is-done        { border-color: var(--green); }
.ex-bag-chip.is-selected {
    background: var(--accent-soft);
    box-shadow: 0 0 0 2px var(--accent-soft);
}
.ex-bag-chip.is-selected:not(.is-done):not(.is-in-progress) { border-color: var(--accent); }
.ex-bag-chip-icon { color: var(--text-muted); display: block; }
.ex-bag-chip.is-in-progress .ex-bag-chip-icon { color: var(--yellow); }
.ex-bag-chip.is-done        .ex-bag-chip-icon { color: var(--green); }
.ex-bag-chip.is-selected    .ex-bag-chip-icon { color: var(--accent); }
.ex-bag-chip.is-selected.is-done        .ex-bag-chip-icon { color: var(--green); }
.ex-bag-chip.is-selected.is-in-progress .ex-bag-chip-icon { color: var(--yellow); }
.ex-bag-chip-label {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}
.ex-bag-chip-weight {
    font-size: 9px;
    color: var(--text-muted);
    line-height: 1;
}

/* Required-field marker (asterisk after label) */
.req { color: var(--red); margin-left: 3px; font-weight: 700; }

/* ── Solvent event log (top of extraction step) ──────────── */
.ex-events-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    margin-bottom: 18px;
}
.ex-events-header-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}
.ex-event-add-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 600;
    border-radius: var(--radius);
    border: 1px solid transparent;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.ex-event-add-btn.is-recovery { color: var(--green); background: var(--green-soft); border-color: var(--green); }
.ex-event-add-btn.is-fresh    { color: var(--white); background: var(--white-soft); border-color: var(--white); }
.ex-event-add-btn.is-chill    { color: var(--blue);  background: var(--blue-soft);  border-color: var(--blue); }
.ex-event-add-btn:hover { filter: brightness(1.1); }

.ex-event-log { display: flex; flex-direction: column; gap: 8px; }
.ex-event-log-empty {
    font-size: 12px;
    color: var(--text-muted);
    font-style: italic;
    padding: 8px 4px;
}

.ex-event-row {
    display: grid;
    grid-template-columns: 200px 1fr auto auto;
    gap: 14px;
    align-items: center;
    padding: 10px 14px;
    background: var(--bg-primary);
    border: 1px solid var(--border-subtle);
    border-left-width: 3px;
    border-radius: var(--radius);
}
.ex-event-row.is-recovery { border-left-color: var(--green); }
.ex-event-row.is-fresh    { border-left-color: var(--white); }
.ex-event-row.is-chill    { border-left-color: var(--blue); }
@media (max-width: 900px) {
    .ex-event-row { grid-template-columns: 1fr; }
}
.ex-event-row-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
}
.ex-event-row-label-sub {
    display: block;
    font-size: 10px;
    font-weight: 500;
    color: var(--text-muted);
    margin-top: 2px;
}
.ex-event-row-timer {
    display: flex;
    align-items: center;
    gap: 6px;
}
.ex-event-row-timer .prep-time-input { font-size: 12px; padding: 6px 10px; min-width: 0; }
.ex-event-row-timer .btn-timer { padding: 5px 10px; font-size: 11px; }
.ex-event-row-duration {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-secondary);
    min-width: 56px;
    text-align: right;
}
.ex-event-row-duration.is-pending { color: var(--yellow); }
.ex-event-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 4px 8px;
    border-radius: var(--radius);
    transition: color 0.15s, background 0.15s;
}
.ex-event-remove:hover { color: var(--red); background: var(--red-soft); }

/* Cycle timer block label */
.ex-timer-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 7px;
}

/* Filter-swap checkboxes + slowdown event */
.ex-filters-block {
    margin-top: 14px;
    padding: 14px 16px;
    background: var(--bg-primary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
}
.ex-filters-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    margin-bottom: 12px;
}
.ex-filters-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px 16px;
}
@media (max-width: 680px) {
    .ex-filters-grid { grid-template-columns: repeat(2, 1fr); }
}
.ex-check {
    display: flex;
    align-items: center;
    gap: 9px;
    cursor: pointer;
    user-select: none;
    font-size: 13px;
    color: var(--text-secondary);
    transition: color 0.15s;
}
.ex-check:hover { color: var(--text-primary); }
.ex-check input[type=checkbox] {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 1.5px solid var(--border);
    border-radius: 4px;
    background: var(--bg-primary);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    position: relative;
    flex-shrink: 0;
    margin: 0;
}
.ex-check:hover input[type=checkbox]:not(:checked) { border-color: var(--text-muted); }
.ex-check input[type=checkbox]:checked {
    background: var(--accent);
    border-color: var(--accent);
}
.ex-check input[type=checkbox]:checked::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 5px;
    width: 5px;
    height: 9px;
    border: solid #1E1C1A;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}
.ex-check input[type=checkbox]:focus-visible {
    outline: 2px solid var(--accent-soft);
    outline-offset: 1px;
}
.ex-check input[type=checkbox]:checked + span { color: var(--text-primary); font-weight: 500; }

.ex-slowdown-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 12px;
    padding: 14px 16px;
    background: var(--bg-primary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    transition: border-color 0.15s, background 0.15s;
}
.ex-slowdown-row.is-on {
    border-color: var(--yellow);
    background: var(--yellow-soft);
}
.ex-slowdown-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ex-slowdown-label { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.ex-slowdown-desc  { font-size: 11px; color: var(--text-muted); }

/* ============================================================
   RECOVERY STEP
   ============================================================ */

/* Recovery session card — re-uses the prep-session shape but with its own
   identity so future tweaks don't bleed across steps. */
.rec-session {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 18px 20px 18px;
    margin-bottom: 14px;
}
.rec-session:last-of-type { margin-bottom: 8px; }
.rec-session-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}
.rec-session-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}
.rec-session-operator {
    font-size: 12px;
    color: var(--text-secondary);
    margin-left: 10px;
}
.rec-session-operator-name { color: var(--text-primary); font-weight: 500; }
.rec-session-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: var(--radius);
    transition: color 0.15s, background 0.15s;
}
.rec-session-remove:hover { color: var(--red); background: var(--red-soft); }
.rec-session-footer {
    margin-top: 12px;
    font-size: 11px;
    color: var(--text-muted);
}
.rec-session-footer-value {
    font-family: var(--font-mono);
    color: var(--text-primary);
    font-weight: 600;
}

/* Recovery transfers — read-only context pulled from extraction events */
.rec-transfers-block {
    background: var(--bg-secondary);
    border: 1px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 14px 18px;
    margin-bottom: 14px;
}
.rec-transfers-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}
.rec-transfers-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}
.rec-transfers-source {
    font-size: 11px;
    color: var(--text-muted);
    font-style: italic;
}
.rec-transfers-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.rec-transfer-line {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-secondary);
    padding: 4px 0;
}
.rec-transfer-line-time { color: var(--text-secondary); }
.rec-transfer-line-dur  { color: var(--text-muted); }
.rec-transfers-empty {
    font-size: 12px;
    color: var(--text-muted);
    font-style: italic;
}

/* Stock pots — one row per pot */
.rec-pots-block {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    margin-bottom: 14px;
}
.rec-pots-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.rec-pot-row {
    display: grid;
    grid-template-columns: 90px 1fr 1fr 100px 100px 28px;
    gap: 10px;
    align-items: end;
    padding: 12px 14px;
    background: var(--bg-primary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
}
@media (max-width: 900px) {
    .rec-pot-row { grid-template-columns: 1fr 1fr; }
}
.rec-pot-row .bf { margin-bottom: 0; }
.rec-pot-row label { font-size: 10px; }
.rec-pot-row input[type=number],
.rec-pot-row input[type=text] {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 13px;
    padding: 7px 10px;
    width: 100%;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.15s;
}
.rec-pot-row input:focus { border-color: var(--accent); }
.rec-pot-net {
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 600;
    color: var(--accent);
    padding: 7px 4px;
    text-align: right;
}
.rec-pot-labeled {
    display: flex;
    align-items: center;
    justify-content: center;
    padding-bottom: 6px;
}
.rec-pot-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
    padding: 6px 0;
    border-radius: var(--radius);
    transition: color 0.15s, background 0.15s;
    align-self: center;
}
.rec-pot-remove:hover { color: var(--red); background: var(--red-soft); }
.rec-pots-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 10px;
    border-top: 1px solid var(--border-subtle);
    font-size: 12px;
    color: var(--text-muted);
}
.rec-pots-total-value {
    font-family: var(--font-mono);
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.rec-add-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
    background: var(--accent-soft);
    border: 1px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.15s;
}
.rec-add-btn:hover { background: rgba(212, 165, 116, 0.2); }

/* ============================================================
   DECARB STEP
   ============================================================ */

/* Run-timing strip: same timer pattern, no card wrapper needed */
.dec-run-row {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    padding: 16px 18px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    margin-bottom: 14px;
}
.dec-run-operator {
    font-size: 12px;
    color: var(--text-secondary);
    margin-left: auto;
}
.dec-run-operator-name { color: var(--text-primary); font-weight: 500; }
.dec-run-duration {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-left: 8px;
}

/* Charge card — one per "+ Charge vessel" click */
.dec-charge {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 16px 18px 14px;
    margin-bottom: 12px;
}
.dec-charge-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}
.dec-charge-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}
.dec-charge-time {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-secondary);
    margin-left: 8px;
}
.dec-charge-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
    padding: 4px 8px;
    border-radius: var(--radius);
    transition: color 0.15s, background 0.15s;
}
.dec-charge-remove:hover { color: var(--red); background: var(--red-soft); }

/* Header row for the pot table inside a charge */
.dec-pot-header,
.dec-pot-row {
    display: grid;
    grid-template-columns: 1fr 90px 90px 100px 100px 100px 28px;
    gap: 10px;
    align-items: center;
}
.dec-charge-hint {
    font-size: 11px;
    color: var(--text-muted);
    font-style: italic;
    margin-bottom: 8px;
}
.dec-pot-tare {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-secondary);
    text-align: right;
    padding: 0 4px;
}
.dec-pot-post.is-invalid {
    border-color: var(--red);
    background: var(--red-soft);
}
.dec-pot-header {
    padding: 6px 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}
.dec-pot-row {
    padding: 8px 4px;
    border-top: 1px solid var(--border-subtle);
}
.dec-pot-row:first-of-type { border-top: none; }
.dec-pot-select {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 13px;
    padding: 7px 10px;
    outline: none;
    transition: border-color 0.15s;
    width: 100%;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
}
.dec-pot-select:focus { border-color: var(--accent); }
.dec-pot-pre,
.dec-pot-calc-charged,
.dec-pot-calc-reclaim {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-secondary);
    text-align: right;
    padding: 0 4px;
}
.dec-pot-calc-charged { color: var(--accent); font-weight: 600; }
.dec-pot-calc-reclaim { color: var(--yellow); font-weight: 600; }
.dec-pot-post {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 12px;
    padding: 7px 10px;
    outline: none;
    transition: border-color 0.15s;
    width: 100%;
    box-sizing: border-box;
    text-align: right;
}
.dec-pot-post:focus { border-color: var(--accent); }
.dec-pot-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    padding: 4px;
    border-radius: var(--radius);
    transition: color 0.15s, background 0.15s;
}
.dec-pot-remove:hover { color: var(--red); background: var(--red-soft); }

.dec-add-pot-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 600;
    color: var(--accent);
    background: transparent;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.dec-add-pot-btn:hover { background: var(--accent-soft); border-color: var(--accent); }

/* Decarb summary footer — totals + yield */
.dec-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    padding: 14px 18px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    margin-top: 6px;
}
@media (max-width: 700px) { .dec-summary { grid-template-columns: 1fr 1fr; } }
.dec-summary-item { display: flex; flex-direction: column; gap: 3px; }
.dec-summary-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}
.dec-summary-value {
    font-family: var(--font-mono);
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.1;
}
.dec-summary-value.is-yield { color: var(--accent); }
.dec-summary-value.is-reclaim { color: var(--yellow); }

/* ============================================================
   DISTILLATION STEP — pass cards, collapsible
   ============================================================ */

.dist-add-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}
.dist-add-row .ex-event-add-btn { padding: 8px 14px; }

.dist-pass {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-left-width: 3px;
    border-radius: var(--radius-lg);
    margin-bottom: 12px;
    overflow: hidden;
}
.dist-pass.is-terp_strip        { border-left-color: var(--blue); }
.dist-pass.is-distillation_pass { border-left-color: var(--accent); }
.dist-pass.is-squeeze_pass      { border-left-color: var(--green); }

.dist-pass-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 18px;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
}
.dist-pass-header:hover { background: var(--bg-hover); }
.dist-pass-chevron {
    color: var(--text-muted);
    font-size: 12px;
    transition: transform 0.2s;
    flex-shrink: 0;
}
.dist-pass.is-expanded .dist-pass-chevron { transform: rotate(90deg); }
.dist-pass-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}
.dist-pass-type {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    margin-left: 4px;
}
.dist-pass-meta {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
    margin-left: auto;
}
.dist-pass-status {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 10px;
    background: var(--bg-primary);
    color: var(--text-muted);
}
.dist-pass-status.is-done       { background: var(--green-soft);  color: var(--green); }
.dist-pass-status.is-progress   { background: var(--yellow-soft); color: var(--yellow); }
.dist-pass-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
    padding: 4px 8px;
    border-radius: var(--radius);
    transition: color 0.15s, background 0.15s;
}
.dist-pass-remove:hover { color: var(--red); background: var(--red-soft); }

.dist-pass-body {
    padding: 4px 22px 20px;
    border-top: 1px solid var(--border-subtle);
}
.dist-pass:not(.is-expanded) .dist-pass-body { display: none; }

.dist-section { margin-top: 18px; }
.dist-section:first-child { margin-top: 8px; }
.dist-section-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 10px;
}

/* Phase timer rows — compact, three stacked */
.dist-phase-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}
.dist-phase-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 70px;
}
.dist-phase-row .prep-time-input { font-size: 12px; padding: 6px 10px; flex: 1; min-width: 140px; }
.dist-phase-row .btn-timer { padding: 5px 12px; font-size: 11px; white-space: nowrap; }
.dist-phase-dur {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-muted);
    min-width: 60px;
    text-align: right;
}

/* Condition grids (6 fields → 3x2; 3 fields → 1x3) */
.dist-cond-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}
@media (max-width: 700px) { .dist-cond-grid { grid-template-columns: repeat(2, 1fr); } }
.dist-cond-grid .bf { margin-bottom: 0; }
.dist-cond-grid label { font-size: 10px; }

/* Compact metric input — for tucked-away numeric fields (temps, vacuum, LN2, etc.) */
.dist-metric { display: flex; flex-direction: column; gap: 4px; }
.dist-metric-label {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dist-metric-input {
    background: var(--bg-primary);
    border: 1px solid var(--border-subtle);
    border-radius: 5px;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 12px;
    padding: 5px 8px;
    outline: none;
    transition: border-color 0.15s;
    width: 100%;
    box-sizing: border-box;
    text-align: right;
}
.dist-metric-input:focus { border-color: var(--accent); }
.dist-metrics-row {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 8px;
    margin-top: 10px;
}
.dist-metrics-row.is-3col { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 900px) {
    .dist-metrics-row,
    .dist-metrics-row.is-3col { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
    .dist-metrics-row,
    .dist-metrics-row.is-3col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Phase cubby — Startup / Process / Cleaning */
.dist-section.is-phase {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    padding: 12px 14px;
    margin-bottom: 10px;
}
.dist-section.is-phase .dist-section-label { margin-bottom: 8px; }
.dist-section.is-phase .dist-phase-row { margin-bottom: 0; }

/* Prominent input / output cubbies — the headlines of the pass */
.dist-section.is-io {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius-lg);
    padding: 16px 20px 18px;
    margin-bottom: 14px;
}
.dist-section.is-io.is-output { border-left-color: var(--green); }
.dist-section.is-io .dist-section-label {
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

/* Tiny inline LN2 + oil-change strip */
.dist-meta-compact {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
    padding: 10px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    margin-bottom: 10px;
}
.dist-meta-compact-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}
.dist-meta-compact .dist-metric { flex-direction: row; align-items: center; gap: 8px; }
.dist-meta-compact .dist-metric-input { width: 90px; }
.dist-meta-compact .ex-check { font-size: 12px; }

/* Compact cleaning-type radio row */
.dist-cleaning-compact { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 10px; }
.dist-cleaning-compact .dist-cleaning-type { margin: 0; gap: 12px; }
.dist-cleaning-compact .dist-metric { max-width: 130px; }
.dist-cleaning-compact .dist-metric-input { width: 90px; }

/* Cleaning type radios */
.dist-cleaning-type {
    display: flex;
    gap: 16px;
    margin-bottom: 12px;
}
.dist-cleaning-type label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 12px;
    color: var(--text-secondary);
}
.dist-cleaning-type input[type=radio] { cursor: pointer; accent-color: var(--accent); }

/* Sub-batch read-only preview */
.dist-subbatch-preview {
    padding: 10px 14px;
    background: var(--bg-primary);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-secondary);
}
.dist-subbatch-preview-strong { color: var(--accent); font-weight: 600; }

/* Source-pot picker — multi-select chips of available pots from a prior step */
.dist-source-pots {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.dist-source-pot {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    user-select: none;
}
.dist-source-pot:hover { border-color: var(--text-muted); }
.dist-source-pot.is-checked {
    border-color: var(--accent);
    background: var(--accent-soft);
}
.dist-source-pot.is-disabled {
    opacity: 0.45;
    cursor: not-allowed;
}
.dist-source-pot input[type=checkbox] {
    accent-color: var(--accent);
    cursor: inherit;
    margin: 0;
}
.dist-source-pot-num {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
}
.dist-source-pot-net {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-secondary);
}
.dist-source-pot-note {
    font-size: 10px;
    font-style: italic;
    color: var(--text-muted);
    margin-left: 4px;
}
.dist-source-empty {
    font-size: 12px;
    font-style: italic;
    color: var(--text-muted);
    padding: 6px 0;
}

/* LN2 + maintenance row */
.dist-meta-row {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
    margin-top: 8px;
}
.dist-meta-row .bf { margin-bottom: 0; min-width: 140px; }

/* ============================================================
   YIELD SUMMARY — manager review dashboard, read-only
   ============================================================ */

.yield-dashboard { display: flex; flex-direction: column; gap: 14px; }
.yield-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 18px 22px;
}
.yield-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.yield-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}
.yield-section-meta {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
}

/* Sankey */
.yield-sankey-wrap { overflow-x: auto; }
.yield-sankey-svg { display: block; min-width: 900px; width: 100%; height: 560px; }
.yield-sankey-headline {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-around;
    gap: 18px;
    flex-wrap: wrap;
}
.yield-headline-item { text-align: center; }
.yield-headline-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}
.yield-headline-value {
    font-family: var(--font-mono);
    font-size: 18px;
    font-weight: 600;
    color: var(--accent);
    display: block;
    margin-top: 2px;
}
.yield-headline-value.is-yield { color: var(--green); }

/* Balance ledger */
.yield-balance { width: 100%; border-collapse: collapse; }
.yield-balance th, .yield-balance td {
    padding: 7px 10px;
    text-align: right;
    font-family: var(--font-mono);
    font-size: 12px;
    border-bottom: 1px solid var(--border-subtle);
}
.yield-balance th {
    text-align: right;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    font-family: var(--font-sans);
    font-size: 10px;
}
.yield-balance th:first-child, .yield-balance td:first-child {
    text-align: left;
    font-family: var(--font-sans);
    color: var(--text-primary);
}
.yield-balance tr.is-total td {
    font-weight: 700;
    border-top: 2px solid var(--border);
    border-bottom: none;
    color: var(--text-primary);
    padding-top: 10px;
}
.yield-balance .is-loss-cell    { color: var(--red); }
.yield-balance .is-reclaim-cell { color: var(--yellow); }
.yield-balance .is-yield-cell   { color: var(--accent); font-weight: 600; }
.yield-balance .is-dash         { color: var(--text-muted); }

/* KPI grid */
.yield-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}
@media (max-width: 800px) { .yield-kpi-grid { grid-template-columns: repeat(2, 1fr); } }
.yield-kpi-card {
    padding: 12px 14px;
    background: var(--bg-primary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
}
.yield-kpi-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.yield-kpi-value {
    font-family: var(--font-mono);
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.1;
}
.yield-kpi-vs {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}
.yield-kpi-vs.is-up   { color: var(--green); }
.yield-kpi-vs.is-down { color: var(--red); }
.yield-kpi-vs.is-target { color: var(--green); }

/* Reclaim breakdown */
.yield-reclaim-list { display: flex; flex-direction: column; gap: 4px; }
.yield-reclaim-row {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: baseline;
    padding: 8px 0;
    font-size: 13px;
    border-bottom: 1px solid var(--border-subtle);
    gap: 12px;
}
.yield-reclaim-row:last-child { border-bottom: none; }
.yield-reclaim-row.is-untracked .yield-reclaim-value { color: var(--text-muted); font-style: italic; }
.yield-reclaim-row.is-total {
    padding-top: 12px;
    margin-top: 4px;
    border-top: 2px solid var(--border);
    border-bottom: none;
}
.yield-reclaim-row.is-total .yield-reclaim-label { font-weight: 700; color: var(--text-primary); }
.yield-reclaim-row.is-total .yield-reclaim-value { color: var(--yellow); font-weight: 700; font-size: 16px; }
.yield-reclaim-label { color: var(--text-secondary); }
.yield-reclaim-formula {
    display: block;
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 3px;
    font-family: var(--font-mono);
}
.yield-reclaim-value {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-primary);
}
.yield-reclaim-row.is-solvent {
    margin-top: 6px;
    padding-top: 10px;
    border-top: 1px dashed var(--border);
    border-bottom: none;
}
.yield-reclaim-row.is-solvent .yield-reclaim-label { color: var(--text-secondary); }
.yield-reclaim-row.is-solvent .yield-reclaim-value { color: var(--accent); }

/* Process speeds + costs share table style with balance */
.yield-speeds, .yield-costs { width: 100%; border-collapse: collapse; }
.yield-speeds th, .yield-speeds td,
.yield-costs  th, .yield-costs  td {
    padding: 7px 10px;
    font-family: var(--font-mono);
    font-size: 12px;
    border-bottom: 1px solid var(--border-subtle);
    text-align: right;
}
.yield-speeds th, .yield-costs th {
    font-family: var(--font-sans);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}
.yield-speeds td:first-child, .yield-costs td:first-child,
.yield-speeds th:first-child, .yield-costs th:first-child {
    text-align: left;
    font-family: var(--font-sans);
    color: var(--text-primary);
}
.yield-costs tr.is-total td {
    font-weight: 700;
    border-top: 2px solid var(--border);
    border-bottom: none;
    padding-top: 10px;
    color: var(--text-primary);
}
.yield-costs .is-cost-pending { color: var(--text-muted); font-style: italic; font-size: 11px; }
.yield-costs .yield-cost-label { display: block; }
.yield-costs .yield-cost-formula {
    display: block;
    font-family: var(--font-mono);
    font-size: 10.5px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Verify banner */
.yield-verify-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 22px;
    background: var(--accent-soft);
    border: 1px solid var(--accent);
    border-radius: var(--radius-lg);
    margin-top: 4px;
}
.yield-verify-banner.is-verified {
    background: var(--green-soft);
    border-color: var(--green);
}
.yield-verify-message {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 13px;
    color: var(--text-primary);
}
.yield-verify-message-title { font-weight: 600; }
.yield-verify-message-sub {
    font-size: 11px;
    color: var(--text-muted);
}
.yield-verify-banner.is-verified .yield-verify-message-sub { color: var(--green); }

/* Page status pill */
.yield-status-pill {
    font-size: 11px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 12px;
    background: var(--bg-primary);
    color: var(--text-muted);
}
.yield-status-pill.is-verified { background: var(--green-soft); color: var(--green); }

/* Selected bag detail form */
.ex-bag-form {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 20px 22px;
    margin-bottom: 16px;
}
.ex-bag-form.is-empty {
    padding: 32px 22px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    border-style: dashed;
}
.ex-bag-form-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 12px;
}
.ex-bag-form-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
}
.ex-bag-form-weight {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-secondary);
    background: var(--bg-primary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    padding: 5px 10px;
}

/* ═══════════════════════════════════════════════════════════════════
   Batch Record UI — migrated from batch_record.html inline styles
═══════════════════════════════════════════════════════════════════ */

/* ── Stage progress rail ── */
.stage-rail {
    display: flex; align-items: center;
    background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 12px;
    padding: 12px 16px; margin-bottom: 24px; overflow-x: auto; gap: 0;
}
/* stage-step used as a button — reset browser defaults */
.stage-step {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    flex: 1; min-width: 64px;
    background: none; border: none; padding: 0; cursor: pointer;
}
.stage-dot {
    width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--border);
    background: var(--bg-secondary); display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700; color: var(--text-muted); position: relative; z-index: 1;
    transition: all 0.2s;
}
/* JS adds .done / .active to the .step-nav-item (the button), cascade to children */
.step-nav-item.done        .stage-dot { background: var(--green);  border-color: var(--green);  color: #fff; }
.step-nav-item.in-progress .stage-dot { background: var(--yellow); border-color: var(--yellow); color: #1E1C1A; }
.step-nav-item.active      .stage-dot { background: var(--accent); border-color: var(--accent); color: #1E1C1A; box-shadow: 0 0 0 4px var(--accent-soft); }
.step-nav-item:hover       .stage-dot { border-color: var(--accent); color: var(--accent); }
.step-nav-item.active:hover .stage-dot,
.step-nav-item.done:hover   .stage-dot,
.step-nav-item.in-progress:hover .stage-dot { color: inherit; }
.stage-label { font-size: 10px; color: var(--text-muted); font-weight: 500; text-align: center; line-height: 1.2; }
.step-nav-item.active      .stage-label { color: var(--accent); font-weight: 600; }
.step-nav-item.in-progress .stage-label { color: var(--yellow); }
.step-nav-item.done        .stage-label { color: var(--green); }
.stage-connector { flex: 1; height: 2px; background: var(--border); min-width: 8px; }
.stage-connector.in-progress { background: var(--yellow); }
.stage-connector.done        { background: var(--green); }

/* ── Section card title ── */
.section-title {
    font-size: 16px; font-weight: 700; color: var(--text-primary); margin-bottom: 4px;
    display: flex; align-items: center; gap: 10px;
}
.section-title .snum {
    background: #6366f1; color: #fff; font-size: 11px; font-weight: 700;
    width: 22px; height: 22px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.section-sub { font-size: 12px; color: var(--text-muted); margin-bottom: 20px; }

/* ── Form fields (bf = batch field) ── */
.bf { margin-bottom: 16px; }
.bf label {
    display: block; font-size: 11px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 7px;
}
.bf input, .bf select {
    width: 100%; background: var(--bg-primary); border: 1px solid var(--border); border-radius: 10px;
    color: var(--text-primary); font-size: 16px; padding: 12px 14px;
    outline: none; transition: border-color 0.15s; -webkit-appearance: none; box-sizing: border-box;
}
.bf input:focus, .bf select:focus { border-color: #6366f1; }
.bf input[type=number] { font-variant-numeric: tabular-nums; }
.bf .hint { font-size: 11px; color: var(--text-muted); margin-top: 5px; }
.bf-row  { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.bf-row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.bf-flex-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }

/* ── "Now" button ── */
.with-now { display: flex; gap: 8px; align-items: center; }
.with-now input { flex: 1; }
.btn-now {
    background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 8px;
    color: var(--text-muted); font-size: 11px; font-weight: 600; padding: 8px 11px;
    cursor: pointer; white-space: nowrap; transition: background 0.15s;
}
.btn-now:hover { background: var(--bg-hover); color: var(--text-primary); }

/* ── Chip row ── */
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.chip {
    display: inline-flex; align-items: center; gap: 5px;
    background: var(--bg-secondary); border-radius: 6px; padding: 4px 9px;
    font-size: 12px; color: var(--text-secondary);
}

/* ── Process sub-card ── */
.proc-card {
    background: var(--bg-primary); border: 1px solid var(--border); border-radius: 10px;
    padding: 14px 16px; margin-bottom: 10px;
}
.proc-card .pc-title {
    font-size: 13px; font-weight: 700; color: var(--text-secondary);
    margin-bottom: 12px; display: flex; align-items: center; gap: 8px;
}
.pc-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* ── LN2 counter ── */
.ln2-row {
    display: flex; align-items: center; gap: 10px;
    margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border);
}
.ln2-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: #a78bfa; flex: 1; }
.ln2-label span { font-size: 10px; color: var(--text-muted); font-weight: 400; text-transform: none; letter-spacing: 0; }
.ln2-btn {
    width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--border);
    background: var(--bg-secondary); color: var(--text-primary); font-size: 18px; font-weight: 600;
    cursor: pointer; display: flex; align-items: center; justify-content: center; line-height: 1;
    transition: background 0.15s;
}
.ln2-btn:hover { background: var(--bg-hover); }
.ln2-btn.add { background: #a78bfa22; border-color: #a78bfa55; color: #a78bfa; font-size: 20px; }
.ln2-btn.add:hover { background: #a78bfa33; }
.ln2-count { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text-primary); min-width: 28px; text-align: center; }
.ln2-unit { font-size: 12px; color: var(--text-muted); }

/* ── Sub-batch / METRC grid ── */
.sbt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 20px; }
.sbt-cell { background: var(--bg-primary); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; display: flex; flex-direction: column; gap: 5px; }
.sbt-cell-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.sbt-label-sm { font-size: 11px; color: var(--text-muted); font-weight: 500; }
.sbt-num { font-size: 10px; font-family: monospace; font-weight: 700; color: #6366f1; background: #6366f115; border: 1px solid #6366f130; border-radius: 4px; padding: 2px 6px; white-space: nowrap; flex-shrink: 0; }
.sbt-num.empty { color: var(--text-muted); background: var(--bg-secondary); border-color: var(--border); }
.sbt-input { width: 100%; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 6px; color: var(--text-primary); font-size: 12px; font-family: monospace; padding: 6px 8px; outline: none; box-sizing: border-box; }
.sbt-input:focus { border-color: #6366f1; }

/* ── Session start/stop ── */
.btn-session-start {
    width: 100%; background: #10b981; color: #fff; border: none;
    border-radius: 12px; font-size: 18px; font-weight: 700;
    padding: 18px; cursor: pointer; transition: background 0.15s; letter-spacing: 0.02em;
}
.btn-session-start:hover { background: #059669; }
.btn-session-stop {
    width: 100%; background: #ef444420; color: #f87171; border: 1px solid #ef444450;
    border-radius: 12px; font-size: 15px; font-weight: 700;
    padding: 14px; cursor: pointer; transition: all 0.15s; margin-top: 12px;
}
.btn-session-stop:hover { background: #ef444435; }

/* ── Running indicator ── */
.session-running-bar {
    display: flex; align-items: center; gap: 10px;
    background: #10b98115; border: 1px solid #10b98140;
    border-radius: 10px; padding: 10px 14px;
    font-size: 13px; font-weight: 600; color: #10b981;
}
.session-pulse {
    width: 10px; height: 10px; border-radius: 50%; background: #10b981; flex-shrink: 0;
    animation: session-pulse-anim 1.4s ease-in-out infinite;
}
@keyframes session-pulse-anim {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.8); }
}

/* ── Bag chip (inside active session) ── */
.bag-chip {
    display: inline-flex; align-items: center; gap: 5px;
    background: var(--bg-secondary); border: 1px solid var(--border);
    border-radius: 6px; padding: 4px 9px; font-size: 12px;
    color: var(--text-secondary); font-variant-numeric: tabular-nums;
}
.bag-chip .bc-num { font-weight: 700; color: #a5b4fc; }

/* ── Completed session card ── */
.session-card { background: var(--bg-primary); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
.session-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.session-card-title { font-size: 13px; font-weight: 700; color: var(--text-secondary); display: flex; align-items: center; gap: 8px; }
.session-card-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.session-bags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

/* ── Bag icon grid (extraction) ── */
.ex-bag-grid { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 4px; }
.ex-bag-icon { display: flex; flex-direction: column; align-items: center; gap: 5px; cursor: pointer; transition: transform 0.15s; user-select: none; }
.ex-bag-icon:hover:not(.ex-done) { transform: translateY(-2px); }
.ex-bag-icon.ex-active .ex-cylinder { border-color: #6366f1; box-shadow: 0 0 0 3px #6366f130; }
.ex-cylinder {
    width: 46px; height: 54px; position: relative;
    border: 2px solid var(--border); border-radius: 6px 6px 8px 8px;
    background: var(--bg-secondary); display: flex; align-items: center; justify-content: center;
    transition: all 0.15s;
}
.ex-cylinder::before {
    content: ''; position: absolute; top: -6px; left: -2px; right: -2px;
    height: 10px; background: var(--bg-secondary); border: 2px solid var(--border); border-radius: 4px 4px 0 0;
}
.ex-bag-icon.ex-done .ex-cylinder { background: transparent; border-color: #2a2d3a; opacity: 0.45; }
.ex-bag-icon.ex-done .ex-cylinder::before { border-color: #2a2d3a; background: transparent; }
.ex-bag-num { font-size: 15px; font-weight: 800; color: #a5b4fc; line-height: 1; font-variant-numeric: tabular-nums; position: relative; z-index: 1; }
.ex-bag-icon.ex-done .ex-bag-num { color: #3a3d4a; }
.ex-bag-label { font-size: 10px; color: var(--text-muted); font-weight: 500; }
.ex-bag-icon.ex-done .ex-bag-label { color: #2a2d3a; }
.ex-bag-stat { font-size: 9px; color: #64748b; text-align: center; line-height: 1.4; max-width: 52px; word-break: break-word; }

/* ── Output summary box ── */
.output-summary {
    background: var(--bg-primary); border: 1px solid var(--border); border-radius: 10px;
    padding: 14px 16px; margin-bottom: 16px;
    display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.os-item .os-lbl { font-size: 11px; color: var(--text-muted); }
.os-item .os-val { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ── Yes/No toggle ── */
.yn-toggle { display: flex; gap: 0; }
.yn-option { cursor: pointer; }
.yn-option input[type=radio] { display: none; }
.yn-btn { display: block; padding: 11px 22px; font-size: 14px; font-weight: 600; background: var(--bg-primary); border: 1px solid var(--border); color: var(--text-muted); transition: all 0.15s; user-select: none; }
.yn-option:first-child .yn-btn { border-radius: 10px 0 0 10px; }
.yn-option:last-child  .yn-btn { border-radius: 0 10px 10px 0; border-left: none; }
.yn-option input:checked + .yn-btn { background: var(--bg-secondary); color: var(--text-primary); }
.yn-option input:checked + .yn-yes { background: #ef444420; color: #f87171; border-color: #ef444450; }

/* ── btn-save (secondary action) ── */
.btn-save {
    width: 100%; background: var(--bg-secondary); color: var(--text-muted);
    border: 1px solid var(--border); border-radius: 12px; font-size: 14px; font-weight: 600;
    padding: 12px; cursor: pointer; transition: all 0.15s; margin-top: 8px;
}
.btn-save:hover { background: var(--bg-hover); color: var(--text-primary); }

/* ── Add-bag inline form ── */
.add-bag-row { background: var(--bg-primary); border: 1px dashed #6366f150; border-radius: 10px; padding: 14px 16px; margin-bottom: 12px; }
.add-bag-row .abl { font-size: 11px; font-weight: 700; color: #6366f1; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 10px; }

/* ── br-view show/hide (reused for step-section) ── */
.step-section { display: none; }
.step-section.active { display: block; }

/* ── Batch landing list ── */
.bl-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 18px;
    transition: border-color 0.15s, background 0.15s;
}
.bl-card:hover { border-color: var(--accent); background: var(--bg-hover); }
.bl-num {
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    min-width: 140px;
}
.bl-farm {
    font-size: 13px;
    color: var(--text-secondary);
    flex: 1;
}
.bl-date {
    font-size: 12px;
    color: var(--text-muted);
    min-width: 90px;
    text-align: right;
}
.bl-empty {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
    font-size: 14px;
}
.bl-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}

/* ============================================================
   BATCH ENTRY — SETUP STEP
   Brand: warm charcoal + tan accent (var(--accent))
   ============================================================ */

/* utility — hidden initial state for elements JS reveals later */
.u-hidden { display: none; }

/* page-header layout helpers */
.batch-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}
.batch-header-meta {
    display: flex;
    align-items: center;
    gap: 10px;
}
.batch-number-display {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

/* Setup card wrapper + section grouping inside it */
.setup-card { padding: 28px; margin-bottom: 16px; }
.setup-group { margin-bottom: 28px; }
.setup-group:last-child { margin-bottom: 0; }
.setup-group-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    margin-bottom: 16px;
}

/* Hero batch number input */
.batch-number-hero {
    font-family: var(--font-mono);
    font-size: 24px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    padding: 16px 18px;
    width: 100%;
    outline: none;
    transition: border-color 0.15s;
}
.batch-number-hero:focus { border-color: var(--accent); }
.batch-number-hero::placeholder { color: var(--text-muted); opacity: 0.4; }

/* Deal type cards */
.deal-type-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}
@media (max-width: 680px) { .deal-type-cards { grid-template-columns: repeat(2, 1fr); } }
.deal-card {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 12px;
    cursor: pointer;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    transition: border-color 0.15s, background 0.15s;
    user-select: none;
}
.deal-card:hover { border-color: var(--text-muted); }
.deal-card.selected {
    background: var(--accent-soft);
    border-color: var(--accent);
}
.deal-card-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
}
.deal-card.selected .deal-card-label { color: var(--accent); }
.deal-card-desc {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.3;
}
.deal-conditional { margin-top: 16px; max-width: 260px; }

/* Contaminant toggle row — flat, no inner card */
.contaminant-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}
.contaminant-text { flex: 1; min-width: 0; }
.contaminant-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    transition: color 0.2s;
}
.contaminant-row.on .contaminant-label { color: var(--red); }
.contaminant-desc {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
    max-width: 540px;
    line-height: 1.45;
}

/* Custom toggle switch */
.toggle-switch {
    position: relative;
    width: 40px;
    height: 22px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 11px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    flex-shrink: 0;
    outline: none;
}
.toggle-switch:focus-visible { box-shadow: 0 0 0 2px var(--accent-soft); }
.toggle-switch.on { background: var(--red-soft); border-color: var(--red); }
.toggle-knob {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: transform 0.2s, background 0.2s;
    pointer-events: none;
}
.toggle-switch.on .toggle-knob { transform: translateX(18px); background: var(--red); }

/* METRC tags card */
.metrc-card { padding: 24px 28px 26px; margin-bottom: 20px; }
.metrc-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}
.metrc-header-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
}
.metrc-header-sub { font-size: 12px; color: var(--text-muted); margin-top: 4px; max-width: 420px; }
.metrc-sequencer { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.metrc-first-tag {
    font-family: var(--font-mono);
    font-size: 12px;
    width: 220px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    padding: 8px 12px;
    outline: none;
    transition: border-color 0.15s;
}
.metrc-first-tag:focus { border-color: var(--accent); }
.metrc-first-tag::placeholder { color: var(--text-muted); opacity: 0.45; }

.metrc-table {
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.metrc-table-header {
    display: grid;
    grid-template-columns: 200px 1fr 1fr;
    gap: 20px;
    background: var(--bg-secondary);
    padding: 10px 16px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-subtle);
}
.metrc-group-divider {
    background: transparent;
    padding: 14px 16px 6px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-secondary);
}
.metrc-group-divider:first-of-type { padding-top: 8px; }
.metrc-row {
    display: grid;
    grid-template-columns: 200px 1fr 1fr;
    gap: 20px;
    align-items: center;
    padding: 8px 16px;
    transition: background 0.1s;
}
.metrc-row:hover { background: var(--bg-secondary); }
.metrc-row.is-last { padding-bottom: 14px; }
.metrc-product { font-size: 13px; color: var(--text-secondary); font-weight: 500; }
.metrc-product.grade-a { color: var(--green); font-weight: 600; }
.metrc-product.grade-b { color: var(--yellow); font-weight: 600; }
.metrc-product.grade-c { color: var(--red); font-weight: 600; }

.metrc-batch-label {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-secondary);
    background: var(--bg-primary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    padding: 5px 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    justify-self: start;
    min-width: 0;
    max-width: 100%;
}
.metrc-tag-input {
    font-family: var(--font-mono);
    font-size: 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    padding: 8px 12px;
    outline: none;
    width: 100%;
    box-sizing: border-box;
    transition: border-color 0.15s;
}
.metrc-tag-input:focus { border-color: var(--accent); }
.metrc-tag-input::placeholder { color: var(--text-muted); opacity: 0.45; }

/* Setup footer with primary Create Batch button */
.setup-footer {
    display: flex;
    justify-content: flex-end;
}
.setup-footer-spaced { margin-top: 24px; }
.setup-footer .btn-primary { padding: 12px 32px; font-size: 14px; }

/* Mono input modifier (used on parent BIO batch field) */
.bf input.mono { font-family: var(--font-mono); }

/* Read-only .bf inputs — structural batch fields (batch number, planned qty,
   output product) and the QC overlay line on the generic ops batch-entry
   Setup step. Same dimming treatment as .rate-input[readonly]. */
.bf input[readonly] { opacity: 0.65; cursor: not-allowed; background: var(--bg-secondary); }

/* ============================================================
   GENERIC OPS BATCH ENTRY — config-driven field renderer
   (shared/manufacturing ops_batch_entry.html / ops_batch_entry.js)
   Single-step fields render via .bf inside this grid; sessions steps
   render a .data-table with these cell-input variants.
   ============================================================ */
.ops-field-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}
.ops-table-input, .ops-table-select {
    width: 100%;
    min-width: 100px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 13px;
    padding: 6px 8px;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.15s;
}
.ops-table-input:focus, .ops-table-select:focus { border-color: var(--accent); }
.ops-table-input[readonly] { opacity: 0.6; cursor: not-allowed; background: var(--bg-secondary); }
.ops-row-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.15s, color 0.15s;
}
.ops-row-remove:hover { color: var(--red); background: var(--red-soft); }

/* ============================================================
   FINANCE PAGE
   ============================================================ */

.finance-chart-wrap {
    position: relative;
    height: 420px;
    margin-top: 4px;
}

/* Empty state shown when an API returns no data (or no QBO is connected).
   Replaces the previous mock-data fallback that showed fabricated revenue. */
.finance-no-data {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    font-style: italic;
    padding: 24px;
}
.finance-legend {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* Cash/Accrual basis toggle under the chart heading. */
.finance-basis-toggle { margin-top: 10px; }

.finance-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    letter-spacing: 0.01em;
}

.finance-legend-line {
    display: inline-block;
    width: 22px;
    height: 2px;
    border-radius: 1px;
}

.finance-legend-bar {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 2px;
    background: rgba(160, 155, 150, 0.4);
    border: 1px solid rgba(160, 155, 150, 0.6);
}

/* ── P&L detail (account-level statement, current vs previous period) ── */
.finance-pl-row {
    display: grid;
    grid-template-columns: 1fr 320px;   /* statement + top-movers rail */
    gap: 16px;
    align-items: start;
    margin-top: 16px;
}
@media (max-width: 1100px) {
    .finance-pl-row { grid-template-columns: 1fr; }
}
.finance-pl-rail { display: flex; flex-direction: column; gap: 16px; }
.finance-customers-card { margin-top: 16px; }

/* ── Revenue Breakdown donut (right rail) ── */
.finance-donut-wrap { position: relative; height: 200px; margin: 8px 0 12px; }
.finance-donut-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}
.donut-center-val {
    font-family: 'JetBrains Mono', monospace;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.1;
}
.donut-center-val.pos { color: var(--green); }
.donut-center-val.neg { color: var(--red); }
.donut-center-lbl {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}
.donut-legend { display: flex; flex-direction: column; gap: 7px; }
.donut-legend-item { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.donut-swatch { width: 10px; height: 10px; border-radius: 2px; flex-shrink: 0; }
.donut-legend-label { color: var(--text-secondary); flex: 1; }
.donut-legend-val { font-family: 'JetBrains Mono', monospace; color: var(--text-primary); }

.pld-table {
    display: flex;
    flex-direction: column;
    margin-top: 4px;
    font-size: 13px;
}

.pld-row {
    display: grid;
    grid-template-columns: 64px minmax(150px, 1.4fr) 100px 100px 1.1fr 1.1fr;
    align-items: center;
    gap: 10px;
    padding: 5px 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.pld-head {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
}
.pld-head .pld-amt, .pld-head .pld-var-head { text-align: right; }

.pld-acct-num {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: var(--text-muted);
}

.pld-acct-name {
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
}
.pld-name-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Collapsible parent accounts */
.pld-children[hidden] { display: none; }
.pld-row.pld-has-kids { cursor: pointer; }
.pld-toggle, .pld-toggle-spacer {
    display: inline-block;
    width: 12px;
    flex-shrink: 0;
    font-size: 9px;
    color: var(--text-muted);
}
.pld-toggle { transition: transform 0.15s; }
.pld-row.pld-has-kids:hover .pld-name-text { color: var(--text-primary); }
.pld-row.open > .pld-acct-name .pld-toggle { transform: rotate(90deg); }

.pld-amt {
    font-family: 'JetBrains Mono', monospace;
    text-align: right;
    color: var(--text-primary);
}

.pld-var-head { text-align: right; }

.pld-var {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pld-var-num {
    width: 84px;
    text-align: right;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    flex-shrink: 0;
}
.pld-var-num.fav   { color: var(--green); }
.pld-var-num.unfav { color: var(--red); }
.pld-var-num.flat  { color: var(--text-muted); }

/* Center-anchored variance bar (axis at 50%; grows right for +, left for −). */
.pld-bar {
    position: relative;
    flex: 1;
    height: 12px;
    min-width: 36px;
}
.pld-bar::before {
    content: '';
    position: absolute;
    left: 50%;
    top: -1px;
    bottom: -1px;
    width: 1px;
    background: var(--border);
}
.pld-bar-fill {
    position: absolute;
    top: 2px;
    height: 8px;
    border-radius: 1px;
}
.pld-bar-fill.fav   { background: var(--green); }
.pld-bar-fill.unfav { background: var(--red); }
.pld-bar-fill.flat  { background: var(--text-muted); }

/* COGS / Operating Expenses subtotal rows */
.pld-subtotal { border-top: 1px solid var(--border); }
.pld-subtotal .pld-acct-name,
.pld-subtotal .pld-amt { font-weight: 600; color: var(--text-primary); }

/* Revenue / Gross Profit / Net Income — the emphasized totals */
.pld-total { border-top: 1px solid var(--border); }
.pld-total .pld-acct-name,
.pld-total .pld-amt { font-weight: 700; color: var(--text-primary); }
.pld-emphasis { padding: 9px 4px; }
.pld-emphasis .pld-acct-name { font-size: 15px; font-weight: 700; }
.pld-emphasis .pld-amt { font-size: 15px; font-weight: 700; }

/* ── Top Movers rail ── */
.movers { display: flex; flex-direction: column; gap: 16px; margin-top: 4px; }
.mover-group-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.mover-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 5px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.mover-name {
    font-size: 13px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.mover-delta {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}
.mover-delta.fav   { color: var(--green); }
.mover-delta.unfav { color: var(--red); }
.mover-empty { font-size: 12px; color: var(--text-muted); font-style: italic; padding: 4px 0; }

/* ── Top Customers ── */
.cust-table { display: flex; flex-direction: column; margin-top: 4px; }
.cust-row {
    display: grid;
    grid-template-columns: minmax(160px, 2fr) 120px 64px 1fr;
    align-items: center;
    gap: 12px;
    padding: 6px 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.cust-name { color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cust-amt {
    font-family: 'JetBrains Mono', monospace;
    text-align: right;
    color: var(--text-primary);
}
.cust-pct {
    font-family: 'JetBrains Mono', monospace;
    text-align: right;
    font-size: 12px;
    color: var(--text-muted);
}
.cust-bar { position: relative; height: 10px; background: rgba(255, 255, 255, 0.04); border-radius: 2px; }
.cust-bar-fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent); border-radius: 2px; }


/* ==========================================================================
   FINANCE > CASHFLOW — working capital + AR/AP aging
   ========================================================================== */
.cf-aging-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    align-items: start;
}
@media (max-width: 1100px) {
    .cf-aging-row { grid-template-columns: 1fr; }
}

.aging-buckets { margin: 10px 0 14px; }
.aging-bar {
    display: flex;
    height: 14px;
    border-radius: 3px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.04);
}
.aging-seg { height: 100%; }
.aging-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    margin-top: 8px;
    font-size: 11px;
    color: var(--text-muted);
}
.aging-legend-item { display: flex; align-items: center; gap: 5px; }
.aging-legend-item b { color: var(--text-secondary); font-weight: 600; font-family: 'JetBrains Mono', monospace; }
.aging-swatch { width: 10px; height: 10px; border-radius: 2px; flex-shrink: 0; }

/* Age ramp: green (current) → red (90+) */
.aging-current  { background: #5cb37a; }
.aging-1_30     { background: #9DB36A; }
.aging-31_60    { background: #C8A96E; }
.aging-61_90    { background: #CF8A5A; }
.aging-90_plus  { background: #C75A5A; }

.aging-table { display: flex; flex-direction: column; font-size: 12px; }
.aging-row {
    display: grid;
    grid-template-columns: minmax(110px, 1.6fr) repeat(6, 1fr);
    gap: 6px;
    align-items: center;
    padding: 5px 2px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.aging-head {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}
.aging-head span:not(:first-child) { text-align: right; }
.aging-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-secondary); }
.aging-amt { font-family: 'JetBrains Mono', monospace; text-align: right; color: var(--text-primary); }
.aging-amt.strong { font-weight: 600; }
.aging-amt.warn { color: #CF8A5A; }
.aging-amt.bad  { color: var(--red); }
.aging-foot {
    border-top: 1px solid var(--border);
    border-bottom: none;
    margin-top: 3px;
    padding-top: 7px;
}
.aging-foot .aging-name { color: var(--text-primary); font-weight: 600; }
.aging-foot .aging-amt  { font-weight: 600; }


/* ==========================================================================
   CASHFLOW — Inventory cost vs realizable value + realizable coverage
   ========================================================================== */

.cf-realizable { margin-top: 16px; }

/* Coverage punchline: book WC vs realizable coverage, side by side. */
.rz-coverage {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin: 6px 0 18px;
}
@media (max-width: 800px) { .rz-coverage { grid-template-columns: 1fr; } }
.rz-cov-cell {
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.015);
}
.rz-cov-cell.is-headline { border-color: var(--accent); }
.rz-cov-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}
.rz-cov-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 22px;
    font-weight: 600;
    margin-top: 4px;
}
.rz-cov-value.pos { color: var(--green); }
.rz-cov-value.neg { color: var(--red); }
.rz-cov-sub { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* Chart (left) beside the tier/item table (right). */
.rz-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
    gap: 22px;
    align-items: start;
}
@media (max-width: 1000px) { .rz-body { grid-template-columns: 1fr; } }
.rz-chart-wrap { position: relative; min-height: 240px; }
.rz-chart-wrap canvas { max-height: 260px; }
.rz-chart-note { font-size: 11px; color: var(--text-muted); margin-top: 10px; line-height: 1.5; }

/* Per-tier rows: label + cost/realizable bar + figures. */
.rz-tier { padding: 12px 0; border-top: 1px solid rgba(255, 255, 255, 0.05); }
.rz-tier-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    cursor: pointer;
}
.rz-tier-title { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.rz-chevron {
    display: inline-block;
    margin-right: 6px;
    color: var(--text-muted);
    font-size: 12px;
    transition: transform 0.15s;
}
.rz-tier.is-collapsed .rz-chevron { transform: rotate(-90deg); }
.rz-tier.is-collapsed .rz-items   { display: none; }
.rz-tier-note  { font-size: 11px; color: var(--text-muted); font-weight: 400; margin-left: 6px; }
.rz-tier-figs  { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--text-secondary); white-space: nowrap; }
.rz-tier-figs b { color: var(--text-primary); }
.rz-tier-figs .rz-uplift { color: var(--green); }

/* The cost vs realizable bar — cost as a filled base, realizable extends it. */
.rz-bar {
    position: relative;
    height: 12px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.04);
    margin: 8px 0 4px;
    overflow: hidden;
}
.rz-bar-realizable { position: absolute; left: 0; top: 0; height: 100%; background: var(--green); opacity: 0.55; }
.rz-bar-cost       { position: absolute; left: 0; top: 0; height: 100%; background: var(--accent); }

.rz-items { display: flex; flex-direction: column; font-size: 12px; margin-top: 6px; }
.rz-item {
    display: grid;
    grid-template-columns: minmax(140px, 2.4fr) 1fr 1fr 1fr;
    gap: 8px;
    align-items: center;
    padding: 4px 2px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.rz-item-head { font-size: 10px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
.rz-item-head span:not(:first-child) { text-align: right; }
.rz-item-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-secondary); }
.rz-item-amt  { font-family: 'JetBrains Mono', monospace; text-align: right; color: var(--text-primary); }
.rz-item-amt.muted { color: var(--text-muted); }
.rz-item-amt.pos   { color: var(--green); }
.rz-tag {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 1px 5px;
    border-radius: 4px;
    margin-left: 6px;
    background: var(--bg-hover);
    color: var(--text-muted);
}
.rz-tag.is-pooled { background: var(--red-soft); color: var(--red); }
.rz-tag.is-est    { background: rgba(200,169,110,0.16); color: #C8A96E; }   /* list price, not yet sold */
.rz-collapsed { display: none; }


/* ==========================================================================
   INVENTORY > HEALTH page — bar chart with PAR line + drill-down sidebar
   ========================================================================== */

.page-subhead {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 6px;
}

.health-card {
    padding: 22px 24px;
    margin-bottom: 16px;
}

/* Header: breadcrumb + growth slider on one row */
.health-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.health-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.health-breadcrumb-item {
    background: none;
    border: 1px solid transparent;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.health-breadcrumb-item:hover { color: var(--text-secondary); background: var(--bg-hover); }
.health-breadcrumb-item.is-current {
    color: var(--text-primary);
    border-color: var(--border);
    background: var(--bg-secondary);
    cursor: default;
}
.health-breadcrumb-sep { color: var(--border); font-size: 14px; }

/* Controls cluster — Days-of-supply buttons + growth slider sit together */
.health-controls {
    display: flex;
    align-items: flex-end;
    gap: 24px;
    flex-wrap: wrap;
}

/* Days-of-supply target — three-button group (30 / 60 / 90) */
.health-dos-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.health-dos-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.health-dos-buttons {
    display: inline-flex;
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    background: var(--bg-tertiary);
}
.health-dos-btn {
    background: none;
    border: none;
    border-right: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 12px;
    font-family: var(--font-mono);
    font-weight: 600;
    padding: 7px 14px;
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
}
.health-dos-btn:last-child { border-right: none; }
.health-dos-btn:hover { color: var(--text-primary); background: var(--bg-hover); }
.health-dos-btn.is-active {
    color: #1E1C1A;
    background: var(--accent);
}

/* Growth-factor slider */
.health-slider-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 240px;
}
.health-slider-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.health-slider-label span { color: var(--accent); font-family: var(--font-mono); font-weight: 700; text-transform: none; letter-spacing: 0; }
.health-slider {
    width: 100%;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--bg-tertiary);
    border-radius: 2px;
    outline: none;
}
.health-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px; height: 16px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid var(--bg-primary);
}
.health-slider::-moz-range-thumb {
    width: 16px; height: 16px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid var(--bg-primary);
}
.health-slider-ticks {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

/* Body: chart on left, drill-down sidebar on right */
.health-body {
    display: grid;
    grid-template-columns: 1fr 220px;
    gap: 24px;
    align-items: stretch;
}
@media (max-width: 900px) {
    .health-body { grid-template-columns: 1fr; }
}
.health-chart-wrap {
    position: relative;
    height: 440px;
    min-width: 0;  /* allow chart to shrink in grid */
}
.health-no-data {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    font-style: italic;
    padding: 24px;
}

/* Drill-down sidebar */
.health-drilldown {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 440px;
    overflow-y: auto;
}
.health-drilldown-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    margin-bottom: 4px;
}
.health-drill-btn {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: border-color 0.15s, background 0.15s;
}
.health-drill-btn:hover { background: var(--bg-hover); border-color: var(--accent); }
.health-drill-btn-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}
.health-drill-btn-dev {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}

/* Color the drill button border-left by zone to mirror the chart bar color */
.health-drill-btn.is-green  { border-left: 3px solid #5cb37a; }
.health-drill-btn.is-yellow { border-left: 3px solid #c9a84a; }
.health-drill-btn.is-orange { border-left: 3px solid #d67f2e; }
.health-drill-btn.is-red    { border-left: 3px solid #c75a5a; }

.health-back-btn {
    margin-top: 12px;
    padding: 6px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 12px;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}
.health-back-btn:hover { color: var(--text-primary); border-color: var(--text-muted); }

/* Legend strip */
.health-legend {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border-subtle);
    flex-wrap: wrap;
}
.health-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-muted);
}
.health-legend-spacer { flex: 1; }
.health-legend-swatch {
    width: 12px; height: 12px;
    border-radius: 2px;
    display: inline-block;
}
.health-legend-swatch.is-green  { background: rgba(92, 179, 122, 0.6); border: 1px solid #5cb37a; }
.health-legend-swatch.is-yellow { background: rgba(201, 168, 74, 0.6); border: 1px solid #c9a84a; }
.health-legend-swatch.is-orange { background: rgba(214, 127, 46, 0.6); border: 1px solid #d67f2e; }
.health-legend-swatch.is-red    { background: rgba(199, 90, 90, 0.6);  border: 1px solid #c75a5a; }
.health-legend-line {
    width: 16px; height: 2px;
    background: var(--text-primary);
    display: inline-block;
}


/* ==========================================================================
   Inventory Health — view toggle (Finished Goods / Raw Materials)
   ========================================================================== */

.health-view-toggle {
    display: flex;
    gap: 2px;
    padding: 16px 20px 0;
}
.health-view-btn {
    padding: 6px 16px;
    border-radius: 4px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.health-view-btn.is-active {
    background: var(--accent);
    color: #1E1C1A;
    border-color: var(--accent);
    font-weight: 600;
}
.health-no-bom {
    margin: 0 20px 12px;
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    font-size: 13px;
    color: var(--text-muted);
}
.health-no-bom a {
    color: var(--accent);
    text-decoration: none;
}
.health-no-bom a:hover { text-decoration: underline; }

/* ==========================================================================
   Product Configurator — sectioned row list
   (Formerly "BOM Builder"; the standalone "Production Configurator" page is
   retired — planning params now live in this page's per-product modal.)
   ========================================================================== */

.bom-empty {
    padding: 40px 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
}

/* Product-line sections, separated by a visual break */
.pc-line-section {
    padding-top: 20px;
    margin-top: 20px;
}
.pc-line-section:first-child {
    padding-top: 0;
    margin-top: 0;
}
.pc-line-section + .pc-line-section {
    border-top: 1px solid var(--border-subtle);
}
.pc-line-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 10px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border-subtle);
}
.pc-line-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.pc-line-count {
    font-size: 11px;
    color: var(--text-muted);
    background: var(--bg-hover);
    padding: 2px 7px;
    border-radius: 10px;
}

/* Subcategory subgroups within a line */
.pc-subgroup {
    margin-bottom: 14px;
}
.pc-subgroup:last-child { margin-bottom: 0; }
.pc-subgroup-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin: 0 0 4px;
}

/* Compact product rows — click opens the product modal */
.pc-row-list {
    display: flex;
    flex-direction: column;
}
.pc-product-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.12s;
}
.pc-product-row:hover { background: var(--bg-hover); }
.pc-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 1.5px solid var(--text-muted);
    background: transparent;
    flex-shrink: 0;
}
.pc-dot.is-configured {
    background: var(--green);
    border-color: var(--green);
}
.pc-product-name {
    font-size: 13px;
    color: var(--text-primary);
    flex: 1;
    min-width: 0;
}

/* Per-row "Ignore" action — right-aligned, outside the row's modal-open
   click target (stopPropagation in JS). */
.pc-row-ignore-btn {
    background: none;
    border: 1px solid transparent;
    border-radius: 4px;
    color: var(--text-muted);
    font-size: 11px;
    line-height: 1;
    padding: 4px 6px;
    cursor: pointer;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.12s, color 0.12s, border-color 0.12s;
}
.pc-product-row:hover .pc-row-ignore-btn { opacity: 1; }
.pc-row-ignore-btn:hover {
    color: var(--red);
    border-color: var(--border);
}

/* Subcategory header row — title + bulk "Ignore all" */
.pc-subgroup-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
}
.pc-subgroup-ignore-all-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 11px;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
    flex-shrink: 0;
}
.pc-subgroup-ignore-all-btn:hover { color: var(--accent); }

/* Collapsed "Ignored (N)" section at the bottom of each line */
.pc-ignored-section {
    margin-top: 14px;
    padding-top: 10px;
    border-top: 1px dashed var(--border-subtle);
}
.pc-ignored-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    cursor: pointer;
    padding: 0;
}
.pc-ignored-toggle:hover { color: var(--text-primary); }
.pc-ignored-chevron {
    display: inline-block;
    font-size: 10px;
    transition: transform 0.15s ease;
}
.pc-ignored-section:not(.is-collapsed) .pc-ignored-chevron {
    transform: rotate(90deg);
}
.pc-ignored-list {
    display: flex;
    flex-direction: column;
    margin-top: 8px;
}
.pc-ignored-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 6px 10px;
}
.pc-ignored-row .pc-product-name { color: var(--text-muted); }
.pc-unignore-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--accent);
    font-size: 11px;
    padding: 3px 8px;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.12s;
}
.pc-unignore-btn:hover { background: var(--bg-hover); }

/* ==========================================================================
   Product Configurator — shared field primitives (used both by the recipe
   section, reusing bom-* classes below, and the Planning/VSM sections)
   ========================================================================== */

.pc-field-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}
.pc-field-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.pc-input {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 13px;
    padding: 8px 10px;
    width: 100%;
}
.pc-input:focus {
    outline: none;
    border-color: var(--accent);
}
.pc-field-hint {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
}

/* ==========================================================================
   Recipe (BOM) fields — UNCHANGED styling, now embedded in the product modal
   instead of the retired slide-in editor / collapsible card list.
   ========================================================================== */

.bom-field-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.bom-field-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.bom-select {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 13px;
    padding: 8px 10px;
    width: 100%;
}
.bom-input {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 13px;
    padding: 8px 10px;
    width: 100%;
}
.bom-input:focus, .bom-select:focus {
    outline: none;
    border-color: var(--accent);
}
.bom-btn-delete {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 4px;
    border: 1px solid var(--border);
    background: transparent;
    cursor: pointer;
    transition: background 0.15s;
    color: #c75a5a;
}
.bom-btn-delete:hover { background: rgba(199, 90, 90, 0.12); }

/* Yield */
.bom-yield-status {
    font-size: 12px;
    color: var(--text-muted);
    min-height: 16px;
}
.bom-yield-override-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.bom-yield-override-label {
    font-size: 12px;
    color: var(--text-muted);
    flex: 1;
    min-width: 160px;
}
.bom-yield-override-input-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
}
.bom-yield-input {
    width: 80px;
    text-align: right;
}
.bom-yield-pct-sym {
    color: var(--text-muted);
    font-size: 13px;
}

/* Component rows in the recipe editor */
.bom-component-row {
    display: grid;
    grid-template-columns: 1fr 90px 48px 24px;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}
.bom-comp-qty-input { text-align: right; }
.bom-comp-uom-label {
    font-size: 11px;
    color: var(--text-muted);
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.bom-comp-remove {
    background: none;
    border: none;
    color: #c75a5a;
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    text-align: center;
}
.bom-comp-remove:hover { color: #e07070; }
.bom-add-component-btn {
    background: none;
    border: 1px dashed var(--border);
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 13px;
    padding: 8px;
    width: 100%;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
    margin-top: 4px;
}
.bom-add-component-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* ==========================================================================
   Product modal (userform) — recipe + planning + value stream, one product
   at a time. Centered dialog (distinct from the old right-slide editors).
   ========================================================================== */

.pcm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 200;
}
.pcm-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 640px;
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 64px);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 10px;
    z-index: 201;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.pcm-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
}
.pcm-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}
.pcm-subtitle {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}
.pcm-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
}

fieldset.pcm-fieldset {
    border: 0;
    padding: 0;
    margin: 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex: 1;
}
fieldset.pcm-fieldset[disabled] { opacity: 0.55; }

.pcm-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 22px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}
.pcm-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding-bottom: 6px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border-subtle);
}
.pcm-section-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0;
}
.pcm-field-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 14px;
}
.pcm-field-grid-spaced { margin-top: 14px; }

.pcm-footer {
    padding: 14px 22px;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-shrink: 0;
}
.pcm-save-status {
    font-size: 12px;
    color: var(--text-muted);
    margin-right: auto;
}
.pcm-save-status.is-saved { color: var(--green); }
.pcm-save-status.is-error { color: var(--red); }
.pcm-retry-btn {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 12px;
    text-decoration: underline;
    cursor: pointer;
    padding: 0;
    margin-left: 2px;
}
.pcm-retry-btn:hover { color: var(--text-primary); }

/* Production-line (value stream) step rows */
.pcm-step-row {
    display: grid;
    grid-template-columns: 1.4fr 90px 110px 92px 24px;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}
.pcm-step-variable-label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
}
.pcm-step-remove {
    background: none;
    border: none;
    color: #c75a5a;
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    text-align: center;
}
.pcm-step-remove:hover { color: #e07070; }

/* hidden-attribute overrides — author display rules beat UA [hidden] */
.pcm-modal[hidden] { display: none; }
.pcm-overlay[hidden] { display: none; }

/* ── No PAR target section ───────────────────────────────────────────────── */
.no-target-header {
    padding: 0 0 16px;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 4px;
}
.no-target-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 4px;
}
.no-target-subhead {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0;
}
.no-target-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-subtle);
}
.no-target-row:last-child { border-bottom: none; }
.no-target-product {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.no-target-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.no-target-cat {
    font-size: 11px;
    color: var(--text-muted);
}
.no-target-qty {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.no-target-set-btn {
    font-size: 12px;
    padding: 5px 12px;
    border-radius: 4px;
    border: 1px solid var(--accent);
    background: transparent;
    color: var(--accent);
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s;
    flex-shrink: 0;
}
.no-target-set-btn:hover { background: var(--bg-hover); }

/* ── PAR editor slide-in panel ───────────────────────────────────────────── */
.par-editor-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 200;
}
.par-editor {
    position: fixed;
    top: 0;
    right: 0;
    width: 420px;
    max-width: 100vw;
    height: 100vh;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border);
    z-index: 201;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.par-editor[hidden]         { display: none; }
.par-editor-overlay[hidden] { display: none; }
.par-editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
}
.par-editor-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}
.par-editor-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
}
.par-editor-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.par-product-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
}
.par-velocity-info {
    font-size: 12px;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    border-radius: 6px;
    padding: 10px 12px;
    line-height: 1.5;
}
.par-field-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.par-field-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.par-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.par-input {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 14px;
    padding: 9px 12px;
    flex: 1;
}
.par-input:focus {
    outline: none;
    border-color: var(--accent);
}
.par-input-uom {
    font-size: 13px;
    color: var(--text-muted);
    white-space: nowrap;
}
.par-field-hint {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
}
.par-editor-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-between;
    gap: 10px;
    flex-shrink: 0;
}

/* Edit pencil hint in drilldown buttons at SKU level */
.health-drill-edit-hint {
    font-size: 10px;
    opacity: 0.6;
    margin-left: 3px;
}

/* ==========================================================================
   Inventory ▸ Scheduling
   ========================================================================== */

.sched-header-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}
.sched-asof {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 8px;
}

/* Horizon toggle — mirrors Inventory Health's days-of-supply button group */
.sched-horizon-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
}
.sched-horizon-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.sched-horizon-buttons {
    display: inline-flex;
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    background: var(--bg-tertiary);
}
.sched-horizon-btn {
    background: none;
    border: none;
    border-right: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 12px;
    font-family: var(--font-mono);
    font-weight: 600;
    padding: 7px 14px;
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
}
.sched-horizon-btn:last-child { border-right: none; }
.sched-horizon-btn:hover { color: var(--text-primary); background: var(--bg-hover); }
.sched-horizon-btn.is-active {
    color: #1E1C1A;
    background: var(--accent);
}

/* Per-line sections */
.sched-section {
    margin-bottom: 20px;
}
.sched-section:last-child { margin-bottom: 0; }
.sched-section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 10px;
    margin-bottom: 14px;
    border-bottom: 1px solid var(--border-subtle);
}

.sched-warn {
    color: #d67f2e;
    cursor: help;
    font-size: 12px;
    margin-left: 2px;
}
.sched-deficit { color: var(--red); font-weight: 600; }
.sched-surplus { color: var(--text-muted); }

/* "Make next" queue — plain table (reuses .table-container/.data-table);
   the only new styling is the per-week subheader row inside it. */
.sched-week-row td {
    background: var(--bg-tertiary);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.sched-week-heavy {
    color: #d67f2e;
    font-weight: 700;
    text-transform: none;
    letter-spacing: normal;
}

/* Capacity controls (shared facility pool + per-line employee inputs) and
   leveled-run flags for the consolidated Production schedule. */
.sched-capacity-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.sched-line-emp {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
}
.sched-line-emp-input,
#schedFacilityEmployees {
    width: 60px;
    padding: 4px 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 13px;
}
.sched-run-late td,
.sched-run-late .mono { color: var(--red); }
.is-over { color: var(--red); font-weight: 600; }

/* ==========================================================================
   Inventory ▸ Scheduling — trajectory chart (burn-down + thresholds)
   Nested per-subcategory: sub-header → KPI strip + chart (this block) →
   table, all inside one .pc-subgroup. KPI strip reuses the platform's
   .kpi-row/.kpi-card primitives.
   ========================================================================== */

.sched-traj {
    margin-bottom: 14px;
    padding: 14px 16px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
}
.sched-traj-kpis { margin-bottom: 16px; }

/* Surplus/Deficit KPI coloring — green ≥ 0, red < 0 (distinct from the
   table's muted-surplus convention; this is the at-a-glance hero number). */
.kpi-value.is-positive { color: var(--green); }
.kpi-value.is-negative { color: var(--red); }

.sched-traj-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}
.sched-traj-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}
.sched-traj-scope {
    color: var(--accent);
    font-weight: 700;
}
.sched-traj-reset-btn {
    font-size: 12px;
    padding: 5px 12px;
}

.sched-traj-axis-hint {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.sched-traj-chart-wrap {
    position: relative;
    height: 260px;
    min-width: 0;
}

.sched-traj-note {
    margin-top: 8px;
}

.sched-traj-empty {
    padding: 24px 16px;
    border: 1px dashed var(--border);
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 13px;
    text-align: center;
}

/* Drillable SKU rows in the schedule tables (trajectory hero chart drill) */
.sched-sku-row { cursor: pointer; }
.sched-sku-row.is-selected {
    background: var(--bg-hover);
    box-shadow: inset 3px 0 0 var(--accent);
}
