/* FAB.toys manufaktura — brand theme on top of Pico.css */

/* ---- Brand fonts (vendored locally) ---- */
@font-face { font-family:"UnivaNova"; src:url("../fonts/UnivaNova/UnivaNova-Regular.woff2") format("woff2"); font-weight:400; font-display:swap; }
@font-face { font-family:"UnivaNova"; src:url("../fonts/UnivaNova/UnivaNova-Medium.woff2") format("woff2"); font-weight:500; font-display:swap; }
@font-face { font-family:"UnivaNova"; src:url("../fonts/UnivaNova/UnivaNova-SemiBold.woff2") format("woff2"); font-weight:600; font-display:swap; }
@font-face { font-family:"UnivaNova"; src:url("../fonts/UnivaNova/UnivaNova-Bold.woff2") format("woff2"); font-weight:700; font-display:swap; }
@font-face { font-family:"UnivaNova"; src:url("../fonts/UnivaNova/UnivaNova-Heavy.woff2") format("woff2"); font-weight:800; font-display:swap; }
@font-face { font-family:"Segment"; src:url("../fonts/Segment/segment-regular.woff2") format("woff2"); font-weight:400; font-display:swap; }
@font-face { font-family:"Segment"; src:url("../fonts/Segment/segment-medium.woff2") format("woff2"); font-weight:500; font-display:swap; }
@font-face { font-family:"Segment"; src:url("../fonts/Segment/segment-semibold.woff2") format("woff2"); font-weight:600; font-display:swap; }
@font-face { font-family:"Segment"; src:url("../fonts/Segment/segment-bold.woff2") format("woff2"); font-weight:700; font-display:swap; }
@font-face { font-family:"Segment"; src:url("../fonts/Segment/segment-black.woff2") format("woff2"); font-weight:900; font-display:swap; }

/* ---- Brand tokens + compact Pico overrides (light) ---- */
:root {
    --purple: #ae90c3;
    --purple-ink: #7d5c99;   /* readable purple for text/links on white */
    --purple-deep: #5f4577;
    --yellow: #fcdeb0;
    --smf-radius: 9px;

    --pico-font-family: "UnivaNova", "Roboto", system-ui, -apple-system, sans-serif;
    --pico-font-family-sans-serif: var(--pico-font-family);
    --pico-font-size: 100%;
    --pico-line-height: 1.45;
    --pico-border-radius: var(--smf-radius);

    /* compact spacing */
    --pico-spacing: 0.85rem;
    --pico-block-spacing-vertical: 0.9rem;
    --pico-block-spacing-horizontal: 1rem;
    --pico-form-element-spacing-vertical: 0.45rem;
    --pico-form-element-spacing-horizontal: 0.7rem;
    --pico-typography-spacing-vertical: 0.7rem;

    /* purple accents */
    --pico-primary: var(--purple-ink);
    --pico-primary-hover: var(--purple-deep);
    --pico-primary-focus: rgba(174,144,195,.35);
    --pico-primary-background: var(--purple);
    --pico-primary-hover-background: var(--yellow);
    --pico-primary-inverse: #4a3560;
}

/* Light theme: override Pico's default (blue) primary with brand purple.
   Pico scopes its light palette to :root:not([data-theme=dark]), which
   out-specifies a bare :root, so we match that specificity here. */
:root:not([data-theme="dark"]) {
    --pico-primary: var(--purple-ink);
    --pico-primary-hover: var(--purple-deep);
    --pico-primary-focus: rgba(174, 144, 195, .4);
    --pico-primary-background: var(--purple);
    --pico-primary-hover-background: var(--yellow);
    --pico-primary-inverse: #4a3560;
    --pico-primary-border: var(--purple);
}

h1, h2, h3, .brand { font-family: "Segment", var(--pico-font-family); font-weight: 700; }
body { background: var(--pico-background-color); }

/* headings a touch tighter */
h1 { font-size: 1.75rem; margin-bottom: .3rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }

/* ---- Primary / save buttons: purple bg, yellow text; invert on hover ---- */
:where(button, input[type=submit], input[type=button], [role=button]):not(.outline):not(.secondary):not(.contrast):not(.pour-btn):not(.toast-x) {
    background: var(--purple);
    border-color: var(--purple);
    color: var(--purple-deep);
    font-weight: 700;
}
:where(button, input[type=submit], [role=button]):not(.outline):not(.secondary):not(.contrast):not(.pour-btn):not(.toast-x):hover {
    background: var(--yellow);
    border-color: var(--yellow);
    color: var(--purple-deep);
}
/* Links: no underline anywhere; react only on hover (color change).
   :not([role=button]) keeps specificity above Pico's own link rules and
   leaves button-styled links (role=button) alone. */
a:not([role=button]), a:not([role=button]):visited { color: var(--purple-ink); text-decoration: none; }
a:not([role=button]):hover, a:not([role=button]):active { color: var(--purple-deep); text-decoration: none; }

/* Outline / transparent buttons: fill yellow on hover so they stay visible. */
:where(button, input[type=submit], input[type=button], [role=button]).outline:hover,
:where(button, input[type=submit], input[type=button], [role=button]).secondary:hover {
    background: var(--yellow);
    border-color: var(--yellow);
    color: var(--purple-deep);
}

/* Delete buttons: hover to red background with black text. */
:where(button, [role=button]).btn-del:hover {
    background: #d32f2f;
    border-color: #d32f2f;
    color: #000;
}

/* Current page in the menu is underlined. */
.app-header a[aria-current="page"],
.mobile-nav a[aria-current="page"] {
    text-decoration: underline;
    text-underline-offset: 5px;
    text-decoration-thickness: 2px;
}

/* ---- Dark mode: near-black with purple highlights ---- */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --pico-background-color: #0c0c0f;
        --pico-color: #e7e3ee;
        --pico-h1-color: #f2eef7;
        --pico-h2-color: #f0ecf5;
        --pico-h3-color: #f0ecf5;
        --pico-muted-color: #9a93a8;
        --pico-muted-border-color: #26232d;
        --pico-card-background-color: #151419;
        --pico-card-sectioning-background-color: #17161c;
        --pico-form-element-background-color: #121116;
        --pico-form-element-border-color: #2c2833;
        --pico-border-color: #26232d;
        --pico-primary: var(--purple);
        --pico-primary-hover: var(--yellow);
        --pico-primary-background: var(--purple);
        --pico-primary-hover-background: var(--yellow);
        --pico-primary-inverse: #17121d;
    }
}
:root[data-theme="dark"] {
    --pico-background-color: #0c0c0f;
    --pico-color: #e7e3ee;
    --pico-h1-color: #f2eef7;
    --pico-h2-color: #f0ecf5;
    --pico-h3-color: #f0ecf5;
    --pico-muted-color: #9a93a8;
    --pico-muted-border-color: #26232d;
    --pico-card-background-color: #151419;
    --pico-card-sectioning-background-color: #17161c;
    --pico-form-element-background-color: #121116;
    --pico-form-element-border-color: #2c2833;
    --pico-border-color: #26232d;
    --pico-primary: var(--purple);
    --pico-primary-hover: var(--yellow);
    --pico-primary-background: var(--purple);
    --pico-primary-hover-background: var(--yellow);
    --pico-primary-inverse: #17121d;
}
/* Dark mode: weave in yellow so it's not purple-only.
   Primary buttons get yellow text on purple (brand btn-fab); hover inverts. */
:root[data-theme="dark"] :where(button, input[type=submit], input[type=button], [role=button]):not(.outline):not(.secondary):not(.contrast):not(.pour-btn):not(.toast-x) { color: var(--yellow); }
:root[data-theme="dark"] :where(button, input[type=submit], [role=button]):not(.outline):not(.secondary):not(.contrast):not(.pour-btn):not(.toast-x):hover { background: var(--yellow); color: var(--purple-deep); }
:root[data-theme="dark"] .settings-nav a.active { color: var(--yellow); }
:root[data-theme="dark"] .badge.ok,
:root[data-theme="dark"] .pager .current { color: var(--yellow); }
:root[data-theme="dark"] .stat-card:hover { border-color: var(--yellow); }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) :where(button, input[type=submit], input[type=button], [role=button]):not(.outline):not(.secondary):not(.contrast):not(.pour-btn):not(.toast-x) { color: var(--yellow); }
    :root:not([data-theme="light"]) :where(button, input[type=submit], [role=button]):not(.outline):not(.secondary):not(.contrast):not(.pour-btn):not(.toast-x):hover { background: var(--yellow); color: var(--purple-deep); }
    :root:not([data-theme="light"]) .settings-nav a.active { color: var(--yellow); }
    :root:not([data-theme="light"]) .badge.ok,
    :root:not([data-theme="light"]) .pager .current { color: var(--yellow); }
    :root:not([data-theme="light"]) .stat-card:hover { border-color: var(--yellow); }
}

/* Dark mode links: light text, hover yellow (no underline).
   Use an explicit colour, not var(--pico-color) — Pico redefines that
   variable locally on <a> to the primary colour. */
:root[data-theme="dark"] a:not([role=button]), :root[data-theme="dark"] a:not([role=button]):visited { color: #e7e3ee; }
:root[data-theme="dark"] a:not([role=button]):hover { color: var(--yellow); }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) a:not([role=button]), :root:not([data-theme="light"]) a:not([role=button]):visited { color: #e7e3ee; }
    :root:not([data-theme="light"]) a:not([role=button]):hover { color: var(--yellow); }
}

/* ---- Modal / lightbox ---- */
.modal-overlay {
    position: fixed; inset: 0; z-index: 100;
    background: rgba(0,0,0,.6);
    display: flex; align-items: flex-start; justify-content: center;
    padding: 5vh 1rem; overflow-y: auto;
}
.modal-box {
    position: relative;
    background: var(--pico-card-background-color);
    border: 1px solid var(--pico-muted-border-color);
    border-radius: var(--smf-radius);
    max-width: 460px; width: 100%;
    padding: 1.3rem;
}
.modal-close {
    position: absolute; top: .5rem; right: .5rem;
    width: 2rem; height: 2rem; padding: 0; margin: 0; line-height: 1;
}
.modal-swatch { width: 100%; max-height: 260px; object-fit: cover; border-radius: var(--smf-radius); margin-bottom: .8rem; }
.modal-box h2 { margin-top: 0; }
.modal-box table.data th { width: 40%; }

/* ---- Brand wordmark ---- */
.brand { text-decoration: none; font-size: 1.15rem; }
.brand:hover { text-decoration: none; }
.brand-fab { color: var(--purple); font-weight: 900; }

/* ---- Header (compact, sticky) ---- */
.app-header {
    border-bottom: 1px solid var(--pico-muted-border-color);
    margin-bottom: .9rem;
    position: sticky; top: 0; z-index: 20;
    background: var(--pico-background-color);
}
.app-header nav { padding-block: 0; min-height: 0; }
.app-header nav > ul { align-items: center; margin: 0; padding: 0; }
.app-header nav > ul > li { padding-block: .3rem; display: flex; align-items: center; }
.app-header .brand { font-size: 1.05rem; }
/* Text links and icon buttons share one height, all vertically centred */
.app-header .desktop-nav a:not(.logout-btn) { display: inline-flex; align-items: center; height: 2rem; padding-inline: .5rem; }
.theme-toggle, .logout-btn {
    display: inline-flex; align-items: center; justify-content: center;
    height: 2rem; width: 2.2rem; padding: 0; margin: 0; line-height: 1;
}
.logout-btn svg { display: block; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; }
.icon-btn svg { display: block; }

/* Compact header on mobile */
@media (max-width: 900px) {
    .app-header { margin-bottom: .55rem; }
    .app-header nav > ul > li { padding-block: .2rem; }
    .app-header .brand { font-size: .95rem; }
    .theme-toggle, .mobile-nav-toggle button { height: 1.8rem; }
    .mobile-nav-toggle button { padding: 0 .5rem; }
}

/* Production page-head: Back and Print equal height */
.prod-actions [role=button], .prod-actions button { height: 2.4rem; display: inline-flex; align-items: center; }
.prod-actions .icon-btn { width: auto; padding: 10px; }

.mobile-nav-toggle { display: none; }
.mobile-nav ul { flex-direction: column; align-items: stretch; width: 100%; }
.mobile-nav a { display: block; padding: .55rem .2rem; border-bottom: 1px solid var(--pico-muted-border-color); }
@media (max-width: 900px) {
    .desktop-nav { display: none; }
    .mobile-nav-toggle { display: flex; }
}

.app-footer { margin-top: 2.2rem; opacity: .7; display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.app-version { font-variant-numeric: tabular-nums; }

/* subtabs (orders Active/Completed) */
.subtabs { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.subtabs [role=button] { padding: .3rem .8rem; }

/* Settings: left vertical tab list (Bootstrap list-group look) + content */
.settings-layout { display: grid; grid-template-columns: 200px 1fr; gap: 1.5rem; align-items: start; }
.settings-nav { display: flex; flex-direction: column; }
.settings-nav a {
    display: block;
    padding: .55rem .9rem;
    color: var(--pico-color);
    text-decoration: none;
    border-bottom: 1px solid var(--pico-muted-border-color);
    font-weight: 500;
}
.settings-nav a:first-child { border-top-left-radius: var(--smf-radius); border-top-right-radius: var(--smf-radius); }
.settings-nav a:last-child { border-bottom: 0; border-bottom-left-radius: var(--smf-radius); border-bottom-right-radius: var(--smf-radius); }
.settings-nav a:hover { background: var(--pico-card-sectioning-background-color); text-decoration: none; }
.settings-nav a.active {
    background: var(--purple);
    color: #2a1e38;
    font-weight: 700;
}
.settings-content > article:first-child { margin-top: 0; }
@media (max-width: 700px) {
    .settings-layout { grid-template-columns: 1fr; }
    .settings-nav { flex-direction: row; flex-wrap: wrap; }
    .settings-nav a { border: 0; border-radius: 6px; padding: .4rem .7rem; }
    .settings-nav a.active { border-radius: 6px; }
}

/* ---- Flash ---- */
/* Toast notifications (top-right, auto-dismiss) */
.toast-wrap { position: fixed; top: 3.75rem; right: 1rem; z-index: 200; display: flex; flex-direction: column; gap: .5rem; max-width: min(340px, calc(100vw - 2rem)); }
.toast { display: flex; align-items: center; gap: .6rem; padding: .7rem .7rem .7rem .95rem; border-radius: var(--smf-radius); color: #fff; box-shadow: 0 6px 20px rgba(0,0,0,.28); animation: toast-in .2s ease; }
.toast-msg { flex: 1; }
.toast-success { background: #2e7d32; }
.toast-error   { background: #c62828; }
.toast-info    { background: var(--purple); color: #2a1e38; }
.toast-x {
    flex: 0 0 auto;
    width: 26px; height: 26px; padding: 0; margin: 0;
    border: 0; border-radius: 50%;
    background: rgba(0,0,0,.18); color: inherit; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: .85rem; line-height: 1;
}
.toast-x:hover { background: rgba(0,0,0,.32); }
.toast.hide { opacity: 0; transform: translateX(12px); transition: opacity .3s, transform .3s; }
@keyframes toast-in { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }

/* Flash messages (login page uses these inline) */
.flash { padding: .6rem .9rem; border-radius: var(--smf-radius); margin-bottom: .9rem; border: 1px solid transparent; }
.flash-success { background: #2e7d32; color: #fff; }
.flash-error   { background: #c62828; color: #fff; }
.flash-info    { background: var(--purple); color: #2a1e38; }

/* ---- Page head ---- */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: .8rem; flex-wrap: wrap; margin-bottom: .9rem; }
.page-head h1, .page-head h2 { margin: 0; }
.page-head .actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.page-head .actions button, .page-head .actions [type=submit] { width: auto; margin: 0; }

/* ---- Tables (compact) ---- */
.table-wrap { overflow-x: auto; }
table.data { margin-bottom: .5rem; }
table.data td, table.data th { padding: .45rem .6rem; vertical-align: middle; }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; }
table.data thead th { font-family: "UnivaNova"; font-weight: 700; font-size: .8rem; text-transform: uppercase; letter-spacing: .02em; opacity: .8; }
.row-actions { white-space: nowrap; display: flex; gap: .35rem; justify-content: flex-end; }
table.data th:last-child, table.data td.row-actions { text-align: right; }
.row-actions a, .row-actions button { padding: .18rem .5rem; margin: 0; font-size: .82rem; }

/* ---- Swatches ---- */
.swatch { width: 30px; height: 30px; border-radius: 6px; border: 1px solid var(--pico-muted-border-color); object-fit: cover; display: inline-block; vertical-align: middle; }
.swatch-lg { width: 60px; height: 60px; }
.swatch-placeholder { display: inline-flex; align-items: center; justify-content: center; background: var(--pico-muted-border-color); color: var(--pico-muted-color); font-size: .7rem; }

/* ---- Badges ---- */
.badge { display: inline-flex; align-items:center; gap:.25rem; padding: .1rem .5rem; border-radius: 999px; font-size: .72rem; background: var(--pico-muted-border-color); color: var(--pico-color); }
.badge.status-processing { background: #1565c0; color: #fff; }
.badge.status-on-hold    { background: #ef6c00; color: #fff; }
.badge.status-completed  { background: #2e7d32; color: #fff; }
.badge.ok   { background: var(--purple); color: #2a1e38; }
.badge.warn { background: #c62828; color: #fff; }
.badge.addon { background: #ffcf47; color: #4a3500; font-weight: 700; border: 1px solid #e0a900; }
.badge.stock { background: var(--pico-muted-border-color); color: var(--pico-color); }
.badge.unknown { background: #d32f2f; color: #fff; }

/* SKU-based item states */
.item-card.status-stock { opacity: .6; }
.item-card.status-unknown { border: 2px solid #d32f2f; }
.prod-card.status-stock { opacity: .6; }
.prod-card.status-unknown { border-color: #d32f2f; border-left-color: #d32f2f; }
.pour-banner { padding: .7rem 1rem; border-radius: var(--smf-radius); margin-bottom: 1rem; font-weight: 600; }
.pour-banner.stock { background: var(--pico-card-sectioning-background-color); border: 1px solid var(--pico-muted-border-color); }
.pour-banner.unknown { background: rgba(211,47,47,.14); border: 1px solid #d32f2f; }
.pour-banner small { font-weight: 400; opacity: .8; }
.prod-addons { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; margin: -0.4rem 0 1rem; }

/* ---- Stat cards ---- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .8rem; }
.stat-card { border: 1px solid var(--pico-muted-border-color); border-radius: var(--smf-radius); padding: .8rem .9rem; text-decoration: none; }
.stat-card:hover { border-color: var(--purple); }
.stat-card .n { font-size: 1.7rem; font-weight: 800; line-height: 1; color: var(--purple-ink); }
:root[data-theme="dark"] .stat-card .n { color: var(--pico-color); }
.stat-card .l { opacity: .75; font-size: .85rem; }

/* ---- Model parts editor ---- */
.parts-table input, .parts-table select { margin-bottom: 0; }
.parts-table td { padding: .25rem; }
.parts-table .addon-cell, table.data th.addon-cell { background: rgba(255, 207, 71, .1); }
.parts-table .addon-cell input { max-width: 5rem; }
.muted { opacity: .68; }
.nowrap { white-space: nowrap; }
.inline-form { display: inline; }

/* ---- Order item split card ---- */
.item-card { border: 1px solid var(--pico-muted-border-color); border-radius: var(--smf-radius); padding: 0; margin-bottom: 1rem; overflow: hidden; }
.item-card > header { padding: .6rem .9rem; border-bottom: 1px solid var(--pico-muted-border-color); background: var(--pico-card-sectioning-background-color); }
.item-card-head { display: flex; align-items: center; justify-content: space-between; gap: .8rem; }
.item-card-title { display: flex; align-items: center; flex-wrap: wrap; gap: .4rem; }
.item-card-head > button { margin: 0; white-space: nowrap; width: auto; }
.item-split { display: grid; grid-template-columns: 1fr 1fr; }
.item-split > div { padding: .8rem .9rem; }
.item-split .left { border-right: 1px solid var(--pico-muted-border-color); }
.item-split .right { background: var(--pico-card-sectioning-background-color); }
@media (max-width: 800px) { .item-split { grid-template-columns: 1fr; } .item-split .left { border-right: 0; border-bottom: 1px solid var(--pico-muted-border-color); } }
.pour-mini td, .pour-mini th { padding: .25rem .4rem; font-size: .85rem; }

/* ================= Production (tablet) ================= */
.prod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.prod-card {
    display: block; text-decoration: none;
    border: 1px solid var(--pico-muted-border-color);
    border-left: 6px solid var(--purple);
    border-radius: var(--smf-radius);
    padding: 1rem 1.1rem; background: var(--pico-card-background-color);
}
.prod-card:hover { border-color: var(--purple); text-decoration: none; }
.prod-card.due-soon { border-left-color: #e0a900; }
.prod-card.due-overdue { border-left-color: #d32f2f; }
.prod-card.is-disabled { opacity: .6; border-left-color: var(--pico-muted-border-color); }
.prod-card-top { display: flex; justify-content: space-between; align-items: center; }
.prod-order { font-size: 1.4rem; font-weight: 800; font-family: "Segment", sans-serif; }
.prod-cust { font-size: 1.05rem; margin-top: .2rem; }
.prod-model { font-size: 1.25rem; font-weight: 700; font-family: "Segment", sans-serif; }
.prod-qty { font-size: 1.05rem; opacity: .8; margin: .1rem 0 .5rem; }
.prod-meta { display: flex; justify-content: space-between; margin-top: .6rem; font-size: .9rem; opacity: .85; flex-wrap: wrap; gap: .3rem; }
.prod-go { margin-top: .7rem; font-weight: 700; color: var(--purple-ink); }
:root[data-theme="dark"] .prod-go { color: var(--yellow); }
.prod-swatches { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .3rem; }
.prod-swatch { display: flex; flex-direction: column; align-items: center; width: 62px; }
.prod-swatch img { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; border: 1px solid var(--pico-muted-border-color); }
.prod-swatch em { font-style: normal; font-size: .72rem; text-align: center; margin-top: .2rem; line-height: 1.1; }

/* Production screen */
.prod-screen { max-width: 1000px; }
.prod-title { font-size: 2rem; }
.prod-summary { display: flex; flex-wrap: wrap; gap: 1.5rem; padding: .9rem 1.1rem; margin-bottom: 1.2rem;
    border: 1px solid var(--pico-muted-border-color); border-radius: var(--smf-radius); background: var(--pico-card-sectioning-background-color); }
.prod-summary .l { display: block; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; opacity: .6; }
.prod-summary .v { font-size: 1.25rem; font-weight: 700; }
.prod-screen h2 { margin: 1.4rem 0 .7rem; }

.pour-colors { display: flex; flex-wrap: wrap; gap: 1rem; }
.pour-color { text-align: center; width: 130px; }
.pour-color img, .pour-color-ph { width: 120px; height: 120px; border-radius: 12px; object-fit: cover; border: 1px solid var(--pico-muted-border-color); }
.pour-color-ph { display: inline-flex; align-items: center; justify-content: center; }
.pour-color-name { font-size: 1.15rem; font-weight: 700; margin-top: .35rem; }

.pour-part { border: 1px solid var(--pico-muted-border-color); border-radius: var(--smf-radius); padding: .9rem 1rem; margin-bottom: 1rem; }
.pour-part-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .3rem 1rem; margin-bottom: .8rem; }
.pour-role { font-size: 1.25rem; font-weight: 800; font-family: "Segment", sans-serif; }
.pour-sil { opacity: .85; }
.pour-total { margin-left: auto; font-size: 1.15rem; }
.pour-btns { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
@media (max-width: 640px) { .pour-btns { grid-template-columns: 1fr; } }
.pour-btn {
    display: flex; align-items: center; gap: .7rem;
    padding: 1rem 1.1rem; margin: 0;
    border: 2px solid var(--purple); background: transparent; color: inherit;
    border-radius: 12px; cursor: pointer; text-align: left; width: 100%;
    font-size: 1.05rem;
}
.pour-btn .pb-label { font-weight: 700; }
.pour-btn .pb-grams { margin-left: auto; font-size: 1.5rem; font-weight: 800; font-family: "Segment", sans-serif; }
.pour-btn .pb-check {
    width: 32px; height: 32px; flex: 0 0 32px; border-radius: 50%;
    border: 2px solid var(--purple); display: inline-flex; align-items: center; justify-content: center;
    color: transparent; font-weight: 900;
}
.pour-btn:hover { background: rgba(174,144,195,.12); }
.pour-btn.done { background: #2e7d32; border-color: #2e7d32; color: #fff; }
.pour-btn.done .pb-check { background: #fff; border-color: #fff; color: #2e7d32; }
.pour-grand { display: flex; justify-content: space-between; align-items: center; font-size: 1.3rem;
    padding: .8rem 1.1rem; border-radius: var(--smf-radius); background: var(--pico-card-sectioning-background-color); }
.pour-grand strong { font-size: 1.6rem; font-family: "Segment", sans-serif; }

/* Print layout */
@media print {
    .app-header, .app-footer, .no-print { display: none !important; }
    body { background: #fff; color: #000; }
    .prod-screen { max-width: none; }
    .pour-btn { border-color: #666 !important; color: #000 !important; background: #fff !important; }
    .pour-btn.done { background: #fff !important; }
    .pour-btn.done .pb-check { color: #000 !important; border-color: #000 !important; background: #fff !important; }
    .pour-part, .prod-summary, .pour-grand { border-color: #999 !important; background: #fff !important; }
    a { color: #000 !important; }
}

/* Order-detail assigned colors */
.oc-colors { display: flex; flex-wrap: wrap; gap: .7rem; }
.oc-color { display: inline-flex; align-items: center; gap: .45rem; font-weight: 600; }
.oc-color .swatch { width: 34px; height: 34px; }

/* Section divider headings (readable separation) */
h2.sec, h3.sec {
    border-top: 1px solid var(--pico-muted-border-color);
    margin-top: 1.9rem;
    padding-top: 1.3rem;
}

/* Model view: per-pour reference cards (compact, ~3 across, 2/1 when narrow) */
.pour-card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1rem; }
.pour-card { border: 1px solid var(--pico-muted-border-color); border-radius: var(--smf-radius); padding: .8rem .9rem; }
.pour-card-title { font-weight: 700; font-family: "Segment", sans-serif; margin-bottom: .6rem; }
.pcp-colors { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: .4rem; }
.pcp-cchip { display: inline-flex; align-items: center; gap: .3rem; font-size: .8rem; padding: .1rem .5rem; border-radius: 999px; border: 1px solid var(--pico-muted-border-color); }
.pcp-cdot { width: 12px; height: 12px; border-radius: 50%; border: 1px solid var(--pico-muted-border-color); background: repeating-linear-gradient(45deg, var(--pico-muted-border-color), var(--pico-muted-border-color) 2px, transparent 2px, transparent 4px); }
.pcp { padding: .6rem 0; border-top: 1px solid var(--pico-muted-border-color); }
.pcp:first-of-type { border-top: 0; }
.pcp-head { display: flex; flex-direction: column; margin-bottom: .4rem; }
.pcp-head strong { font-size: 1.05rem; }
.pcp-head .muted { font-size: .88rem; }
.pcp-lines { display: flex; flex-direction: column; gap: .2rem; }
.pcp-line { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; }
.pcp-line span { color: var(--pico-muted-color); }
.pcp-line b { font-variant-numeric: tabular-nums; }
.pcp-line.total b { font-family: "Segment", sans-serif; font-weight: 800; font-size: 1.35rem; }
.pcp-grand { display: flex; justify-content: space-between; align-items: baseline; margin-top: .6rem; padding-top: .6rem; border-top: 1px dashed var(--pico-muted-border-color); }
.pcp-grand strong { font-family: "Segment", sans-serif; font-size: 1.25rem; }

/* Production: one card per unit */
.pour-unit { border: 1px solid var(--pico-muted-border-color); border-radius: var(--smf-radius); padding: 1rem 1.1rem; margin-bottom: 1.2rem; }
.pour-unit-head { display: flex; justify-content: space-between; align-items: baseline; gap: .6rem; margin-bottom: .7rem; flex-wrap: wrap; }
.pour-unit-n { font-size: 1.3rem; font-weight: 800; font-family: "Segment", sans-serif; }
.pour-colors.compact { gap: .6rem; margin-bottom: .9rem; }
.pour-colors.compact .pour-color { width: 90px; }
.pour-colors.compact .pour-color img, .pour-colors.compact .pour-color-ph { width: 80px; height: 80px; }
.pour-colors.compact .pour-color-name { font-size: .9rem; font-weight: 600; }
.pour-unit-total { display: flex; justify-content: space-between; align-items: center; margin-top: .5rem; padding-top: .6rem; border-top: 1px dashed var(--pico-muted-border-color); font-size: 1.1rem; }
.pour-unit-total strong { font-family: "Segment", sans-serif; font-size: 1.3rem; }

/* Raw JSON debug viewer */
.raw-json { margin-top: 1.5rem; }
.raw-json summary { cursor: pointer; }
.raw-json pre { overflow: auto; max-height: 460px; font-size: .78rem; line-height: 1.4; padding: .8rem; border: 1px solid var(--pico-muted-border-color); border-radius: var(--smf-radius); background: var(--pico-card-sectioning-background-color); }

/* ---- Login ---- */
.login-container { max-width: 420px; margin-top: 8vh; }
.login-container h1 { font-size: 1.6rem; }

/* toolbar for search/sort */
.toolbar { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; margin-bottom: .9rem; }
.toolbar input[type=search], .toolbar select { margin-bottom: 0; }
.toolbar .grow { flex: 1 1 220px; }

/* order urgency row highlight (ship-before) */
table.data tr.row-due-soon td { background: rgba(252, 222, 176, .28); }
table.data tr.row-overdue td  { background: rgba(211, 47, 47, .20); }
:root[data-theme="dark"] table.data tr.row-due-soon td { background: rgba(252, 222, 176, .14); }
:root[data-theme="dark"] table.data tr.row-overdue td  { background: rgba(211, 47, 47, .28); }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) table.data tr.row-due-soon td { background: rgba(252, 222, 176, .14); }
    :root:not([data-theme="light"]) table.data tr.row-overdue td  { background: rgba(211, 47, 47, .28); }
}

/* bulk edit bar */
.bulk-bar {
    display: flex; gap: .5rem; align-items: center; flex-wrap: wrap;
    padding: .6rem .8rem; margin-bottom: .8rem;
    border: 1px solid var(--pico-muted-border-color);
    border-radius: var(--smf-radius);
    background: var(--pico-card-sectioning-background-color);
}
.bulk-bar select, .bulk-bar input, .bulk-bar button { margin-bottom: 0; }
.bulk-bar input[name="bulk_suppliers"] { flex: 1 1 220px; }

/* pagination */
.pager { display: flex; gap: .4rem; align-items: center; justify-content: center; margin-top: 1rem; flex-wrap: wrap; }
.pager a, .pager span { padding: .25rem .6rem; border-radius: 6px; }
.pager .current { background: var(--purple); color: #2a1e38; }
