/* ===================================================================
   Kokoco Innovative ERP — design system
   Cold-chain manufacturing tool: navy/steel sidebar, creamline canvas,
   Kokoco-yellow brand accent (--teal var name kept for minimal diff),
   amber for expiry/stock warnings.
   =================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600&family=IBM+Plex+Mono:wght@500;600&display=swap');
:root {
    --ink: #16232E;
    --ink-soft: #4A5A68;
    --navy: #0B1D2E;
    --navy-soft: #16324A;
    --cream: #FAF7F0;
    --panel: #FFFFFF;
    --line: #E7E1D4;
    --teal: #FEC80C;
    --teal-dark: #C69C09;
    --teal-tint: #FEF8E1;
    --amber: #E8A33D;
    --amber-tint: #FBF0DC;
    --red: #C4453A;
    --red-tint: #FBEAE8;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(15, 25, 35, 0.06), 0 6px 20px rgba(15, 25, 35, 0.05);
    --font-ui: 'Inter', system-ui, sans-serif;
    --font-head: 'Space Grotesk', var(--font-ui);
    --font-mono: 'IBM Plex Mono', 'SFMono-Regular', monospace;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        transition-duration: 0.001ms !important;
    }
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-ui);
    margin: 0;
    background: var(--cream);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
    font-family: var(--font-head);
    font-weight: 600;
    letter-spacing: -0.01em;
    margin: 0;
}


/* ---------- App shell: dark sidebar + cream canvas ---------- */

.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 236px;
    flex-shrink: 0;
    background: var(--navy);
    color: #C8D6E0;
    display: flex;
    flex-direction: column;
    padding: 22px 14px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 8px 22px;
}

.brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    animation: brandFloat 3.2s ease-in-out infinite;
}

@keyframes brandFloat {
    0%,
    100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-2px);
    }
}

.brand-mark svg {
    width: 19px;
    height: 19px;
}

.brand-mark img {
    width: 26px;
    height: 26px;
    object-fit: contain;
}

.brand-text {
    line-height: 1.15;
    min-width: 0;
}

.brand-text strong {
    display: block;
    font-family: var(--font-head);
    font-size: 14px;
    color: #fff;
    white-space: nowrap;
}

.brand-text span {
    display: block;
    font-size: 11px;
    color: #7E93A6;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.session-block {
    padding: 10px 12px;
    margin-bottom: 14px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.session-block .who strong {
    display: block;
    font-size: 13px;
    color: #fff;
}

.session-block .who span {
    font-size: 11px;
    color: #7E93A6;
}

#btn-logout {
    background: transparent;
    color: #9FB2C2;
    border: 1px solid #26445E;
    font-size: 11.5px;
    padding: 5px 10px;
    border-radius: 7px;
}

#btn-logout:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
}

nav.side-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

nav.side-nav button {
    display: flex;
    align-items: center;
    gap: 10px;
    background: none;
    border: none;
    color: #A9BAC7;
    padding: 9px 12px;
    font-size: 13.5px;
    font-family: var(--font-ui);
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

nav.side-nav button svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    opacity: 0.85;
    transition: transform 0.15s ease;
}

nav.side-nav button:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    transform: translateX(2px);
}

nav.side-nav button.active {
    background: linear-gradient(155deg, var(--teal) 0%, var(--teal-dark) 100%);
    color: var(--navy);
    font-weight: 600;
    box-shadow: 0 4px 14px rgba(254, 200, 12, 0.35);
}

nav.side-nav button.active svg {
    opacity: 1;
}

.nav-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 10px 4px;
}

.nav-label {
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #5C7186;
    padding: 10px 12px 4px;
}


/* Canvas is its own scroll region — one scrollbar per module, sidebar stays fixed */

html,
body {
    height: 100%;
}

.app-shell {
    height: 100vh;
}

main.canvas {
    flex: 1;
    min-width: 0;
    height: 100vh;
    overflow-y: auto;
    padding: 28px 34px 60px;
}

.page-head {
    margin-bottom: 22px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.page-head .page-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    flex-shrink: 0;
    background: var(--teal-tint);
    color: #7A5E06;
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-head .page-icon svg {
    width: 19px;
    height: 19px;
}

.page-head-text {
    min-width: 0;
}

.page-head h2 {
    font-size: 20px;
}

.page-head p {
    margin: 2px 0 0;
    color: var(--ink-soft);
    font-size: 13.5px;
}

.tab {
    display: none;
}

.tab.active {
    display: block;
    animation: viewIn 0.28s ease both;
}

@keyframes viewIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}


/* ---------- KPI cards ---------- */

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}

.kpi-card {
    background: var(--panel);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px 18px;
    border-left: 3px solid var(--teal);
    transition: transform 0.18s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.18s ease;
    animation: kpiIn 0.35s ease both;
}

.kpi-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 24px rgba(15, 25, 35, 0.1);
}

@keyframes kpiIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

.kpi-card.warn {
    border-left-color: var(--amber);
}

.kpi-card.alert {
    border-left-color: var(--red);
}

.kpi-card.alert .value {
    animation: pulseAlert 1.8s ease-in-out infinite;
}

@keyframes pulseAlert {
    0%,
    100% {
        color: var(--ink);
    }
    50% {
        color: var(--red);
    }
}

.kpi-card .label {
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ink-soft);
}

.kpi-card .value {
    font-family: var(--font-head);
    font-size: 27px;
    font-weight: 700;
    margin-top: 4px;
}

.kpi-card .sub {
    font-size: 12px;
    color: var(--ink-soft);
    margin-top: 2px;
}


/* ---------- Cards & grid (forms) ---------- */

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

.card {
    background: var(--panel);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow);
    transition: box-shadow 0.2s ease;
}

.card:hover {
    box-shadow: 0 10px 26px rgba(15, 25, 35, 0.09);
}

.card h3 {
    margin-top: 0;
    font-size: 15px;
    margin-bottom: 12px;
}


/* ---------- Collapsible "Add / Record" forms — closed by default ---------- */

.form-details {
    border: none;
}

.form-details summary {
    list-style: none;
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-family: var(--font-head);
    font-weight: 600;
    font-size: 15px;
    color: var(--ink);
    padding: 2px 0 2px;
}

.form-details summary::-webkit-details-marker {
    display: none;
}

.form-details summary::after {
    content: '';
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    background: #F3F0E8;
    border-radius: 6px;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2316232E' stroke-width='2'%3E%3Cpath d='M12 5v14M5 12h14'/%3E%3C/svg%3E") center / 60% no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2316232E' stroke-width='2'%3E%3Cpath d='M12 5v14M5 12h14'/%3E%3C/svg%3E") center / 60% no-repeat;
    background-color: var(--ink-soft);
    transition: transform 0.18s ease;
}

.form-details[open] summary::after {
    transform: rotate(45deg);
}

.form-details[open] summary {
    margin-bottom: 12px;
}

.form-details-body {
    animation: viewIn 0.18s ease both;
}

form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

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

.field-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--ink-soft);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding-left: 1px;
}

.ingredient-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 8px;
    background: #FBF9F3;
    border-radius: 8px;
    border: 1px solid var(--line);
}

.ingredient-row .field:first-child {
    flex: 1;
    min-width: 0;
}

.ingredient-row .field:nth-child(2) {
    width: 120px;
    flex-shrink: 0;
}

.ingredient-row .ing-remove {
    flex-shrink: 0;
    padding: 9px 10px;
}

input,
select,
textarea,
button {
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: 7px;
    font-size: 13.5px;
    font-family: var(--font-ui);
    background: #fff;
    color: var(--ink);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible {
    outline: none;
    border-color: var(--teal);
    box-shadow: 0 0 0 3px rgba(254, 200, 12, 0.18);
}

button {
    background: linear-gradient(155deg, var(--navy-soft) 0%, var(--navy) 100%);
    color: #fff;
    cursor: pointer;
    border: none;
    font-weight: 600;
    transition: transform 0.08s ease, box-shadow 0.2s ease, filter 0.15s ease;
}

button:hover {
    filter: brightness(1.12);
    box-shadow: 0 6px 16px rgba(11, 29, 46, 0.25);
}

button:active {
    transform: scale(0.98);
}

button.secondary {
    background: #fff;
    color: var(--navy);
    border: 1px solid var(--line);
}

button.secondary:hover {
    background: #F3F0E8;
    filter: none;
    box-shadow: none;
}

form button[type="submit"],
.modal-footer button[type="submit"] {
    background: linear-gradient(155deg, var(--teal) 0%, var(--teal-dark) 100%);
    color: var(--navy);
    box-shadow: 0 4px 14px rgba(254, 200, 12, 0.3);
}

form button[type="submit"]:hover,
.modal-footer button[type="submit"]:hover {
    box-shadow: 0 6px 20px rgba(254, 200, 12, 0.4);
}


/* ---------- Toasts (save feedback) ---------- */

#toast-host {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 2100;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-end;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    background: var(--navy);
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    padding: 11px 16px;
    border-radius: 9px;
    box-shadow: 0 12px 30px rgba(11, 29, 46, 0.3);
    max-width: 320px;
    opacity: 0;
    transform: translateX(24px) scale(0.96);
    transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 8px;
}

.toast::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    background: var(--teal);
}

.toast-error::before {
    background: var(--red);
}

.toast-error {
    background: #3A1815;
}

.toast.show {
    opacity: 1;
    transform: none;
}


/* ---------- Tables — internal scrollbar so module data never runs the page away ---------- */

.table-wrap {
    background: var(--panel);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: auto;
    max-height: 420px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    text-align: left;
    padding: 10px 14px;
    border-bottom: 1px solid #F1EEE4;
    font-size: 13.5px;
}

th {
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ink-soft);
    background: #FBF9F3;
    position: sticky;
    top: 0;
    z-index: 1;
}

tr:last-child td {
    border-bottom: none;
}

.mono {
    font-family: var(--font-mono);
    font-size: 12.5px;
}

.badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
}

.badge.ok {
    background: var(--teal-tint);
    color: #7A5E06;
}

.badge.warn {
    background: var(--amber-tint);
    color: #92650E;
}

.badge.alert {
    background: var(--red-tint);
    color: var(--red);
    animation: badgePulse 1.8s ease-in-out infinite;
}

@keyframes badgePulse {
    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(196, 69, 58, 0.35);
    }
    50% {
        box-shadow: 0 0 0 4px rgba(196, 69, 58, 0);
    }
}

pre {
    background: #F3F0E8;
    padding: 12px;
    border-radius: 8px;
    max-height: 320px;
    overflow: auto;
    font-size: 12px;
    font-family: var(--font-mono);
}


/* ---------- Dispatch: scan vs manual entry mode ---------- */

.entry-mode-toggle {
    display: flex;
    gap: 4px;
    background: #F3F0E8;
    border-radius: 8px;
    padding: 3px;
    margin-bottom: 2px;
}

.entry-mode-toggle button {
    flex: 1;
    background: none;
    color: var(--ink-soft);
    border: none;
    box-shadow: none;
    font-size: 12.5px;
    font-weight: 600;
    padding: 7px 8px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.entry-mode-toggle button svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.entry-mode-toggle button:hover {
    background: rgba(15, 25, 35, 0.05);
}

.entry-mode-toggle button.active {
    background: var(--panel);
    color: var(--navy);
    box-shadow: var(--shadow);
}

.entry-mode-hint {
    font-size: 11.5px;
    color: var(--ink-soft);
    margin: 0 0 4px;
}

.manual-entry-row {
    display: flex;
    gap: 6px;
}

.manual-entry-row input {
    flex: 1;
}

.manual-entry-row button {
    flex-shrink: 0;
}


/* ---------- Recipe ingredient rows: scroll instead of growing the card ---------- */

#recipe-ingredients {
    max-height: 220px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}


/* ---------- Dispatch scan cart ---------- */

#scan-input {
    font-family: var(--font-mono);
    letter-spacing: 0.02em;
}

#scan-cart {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 260px;
    overflow-y: auto;
}

#scan-cart li {
    background: var(--teal-tint);
    padding: 8px 12px;
    margin-bottom: 6px;
    border-radius: 8px;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    animation: cartIn 0.18s ease both;
}

@keyframes cartIn {
    from {
        opacity: 0;
        transform: translateX(-6px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}


/* ---------- Expiry watch panel ---------- */

.expiry-panel {
    background: var(--panel);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px;
    margin-bottom: 22px;
}

.expiry-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #F1EEE4;
    font-size: 13.5px;
}

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

.days-left {
    font-family: var(--font-mono);
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 12px;
}

.days-left.crit {
    background: var(--red-tint);
    color: var(--red);
}

.days-left.soon {
    background: var(--amber-tint);
    color: #92650E;
}


/* ---------- Empty state ---------- */

.empty-state {
    text-align: center;
    padding: 30px 20px;
    color: var(--ink-soft);
    font-size: 13.5px;
}


/* ---------- Reports ---------- */

.report-block {
    background: var(--panel);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px 20px;
    margin-bottom: 16px;
}

.report-block-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 4px;
}

.report-block-head h3 {
    font-size: 15px;
}

.report-sub {
    margin: 2px 0 12px;
    color: var(--ink-soft);
    font-size: 12.5px;
}

.report-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.report-controls input,
.report-controls span {
    font-size: 12.5px;
}

.report-controls input[type="date"],
.report-controls input[type="number"] {
    padding: 7px 8px;
    width: 140px;
}

.report-controls span {
    color: var(--ink-soft);
}

.report-controls button {
    padding: 7px 12px;
    font-size: 12.5px;
}

.report-cols {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 16px;
}

.report-cols h4 {
    margin: 0 0 6px;
    font-size: 12.5px;
    color: var(--ink-soft);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.optional-tag {
    font-weight: 400;
    color: var(--ink-soft);
    font-size: 11.5px;
    margin-left: 6px;
}

.report-block .table-wrap table {
    font-size: 13px;
}

.report-block .table-wrap th,
.report-block .table-wrap td {
    padding: 8px 12px;
}

.report-totals {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 12px;
}

.report-totals .stat {
    background: var(--teal-tint);
    border-radius: var(--radius);
    padding: 8px 14px;
    font-size: 12.5px;
    color: var(--ink-soft);
}

.report-totals .stat strong {
    display: block;
    font-family: var(--font-head);
    font-size: 16px;
    color: var(--ink);
}


/* ---------- Form launchers + Bootstrap modals (vertically centered, scrollable) ----------
   Replaces the old inline <details> forms. Only Bootstrap's modal/close/transition
   styles are loaded (vendor/bootstrap/bootstrap-modal.min.css), so nothing else in
   the app's design system is affected. */

.form-launch {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    background: none;
    border: none;
    box-shadow: none;
    padding: 2px 0;
    text-align: left;
    font-family: var(--font-head);
    font-weight: 600;
    font-size: 15px;
    color: var(--ink);
}

.form-launch:hover {
    filter: none;
    box-shadow: none;
}

.form-launch::after {
    content: '';
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    background-color: var(--ink-soft);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2316232E' stroke-width='2'%3E%3Cpath d='M12 5v14M5 12h14'/%3E%3C/svg%3E") center / 60% no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2316232E' stroke-width='2'%3E%3Cpath d='M12 5v14M5 12h14'/%3E%3C/svg%3E") center / 60% no-repeat;
}

.form-launch:hover::after {
    background-color: var(--ink);
}

.form-modal .modal-content {
    border: none;
    border-radius: var(--radius);
    box-shadow: 0 24px 60px rgba(11, 29, 46, 0.35);
    font-family: var(--font-ui);
    color: var(--ink);
}

.form-modal .modal-header,
.form-modal .modal-footer {
    border-color: var(--line);
    padding: 14px 20px;
}

.form-modal .modal-title {
    font-size: 16px;
}

.form-modal .modal-body {
    padding: 18px 20px;
}

.form-modal .modal-footer {
    gap: 10px;
}

.form-modal .modal-footer button {
    margin: 0;
}

.modal-backdrop {
    --bs-backdrop-bg: #0B1D2E;
    --bs-backdrop-opacity: 0.45;
}


/* ---------- Modal (e.g. FIFO / old-stock confirmation popup) ---------- */

.modal-scrim {
    position: fixed;
    inset: 0;
    background: rgba(11, 29, 46, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 16px;
}

.modal-box {
    background: var(--panel);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    max-width: 480px;
    width: 100%;
    padding: 22px 24px;
    max-height: 86vh;
    overflow-y: auto;
}

.modal-box h3 {
    font-size: 16px;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-box h3 .warn-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--amber);
    flex-shrink: 0;
}

.modal-box p {
    font-size: 13px;
    color: var(--ink-soft);
    margin: 0 0 12px;
}

.modal-box ul.modal-list {
    list-style: none;
    margin: 0 0 16px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
}

.modal-box ul.modal-list li {
    padding: 8px 12px;
    font-size: 12.5px;
    border-bottom: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.modal-box ul.modal-list li:last-child {
    border-bottom: none;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.modal-actions button.secondary {
    background: transparent;
    border: 1px solid var(--line);
    color: var(--ink-soft);
}


/* ---------- Barcode labels ---------- */

.barcode-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
    max-height: 320px;
    overflow-y: auto;
    padding: 2px;
}

.barcode-tile {
    background: #F8F6EF;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px;
    text-align: center;
}

.barcode-tile img {
    display: block;
}

.barcode-caption {
    font-size: 11px;
    color: var(--ink-soft);
    margin-top: 4px;
    font-family: var(--font-mono);
}

.barcode-fail {
    width: 160px;
    padding: 14px 8px;
    font-size: 11px;
    color: var(--red);
    background: var(--red-tint);
    border-radius: 6px;
}


/* ---------- Dispatch register: Action dropdown ---------- */


/* Action dropdown needs to escape its row, so this table opts out of internal scrolling */

.dropdown-table-wrap {
    overflow: visible;
    max-height: none;
}

.dropdown-table-wrap table {
    overflow: visible;
}

.action-cell {
    position: relative;
    text-align: right;
}

.action-btn {
    padding: 6px 10px;
    font-size: 12.5px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.action-btn svg {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
}

.action-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    z-index: 20;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 9px;
    box-shadow: 0 12px 30px rgba(15, 25, 35, 0.18);
    min-width: 190px;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.action-menu button {
    background: none;
    border: none;
    color: var(--ink);
    text-align: left;
    font-size: 13px;
    font-weight: 500;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 9px;
}

.action-menu button svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

.action-menu button:hover {
    background: #F3F0E8;
}

.action-menu button.danger {
    color: var(--red);
}

.action-menu button.danger:hover {
    background: var(--red-tint);
}


/* ---------- Row-level edit/delete (used across every module table) ---------- */

.row-actions {
    display: flex;
    gap: 4px;
    justify-content: flex-end;
    white-space: nowrap;
}

.row-actions button {
    background: none;
    border: 1px solid var(--line);
    color: var(--ink-soft);
    padding: 5px 7px;
    font-size: 12px;
    border-radius: 6px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.row-actions button svg {
    width: 14px;
    height: 14px;
}

.row-actions button:hover {
    background: #F3F0E8;
    color: var(--ink);
}

.row-actions button.danger:hover {
    background: var(--red-tint);
    color: var(--red);
    border-color: var(--red-tint);
}


/* ---------- Polish: table row hover, disabled states, empty state icon ---------- */

tbody tr {
    transition: background 0.1s ease;
}

tbody tr:hover {
    background: #FBF9F3;
}

.dropdown-table-wrap tbody tr:hover {
    background: none;
}

button:disabled,
input:disabled,
select:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.empty-state {
    text-align: center;
    padding: 34px 20px;
    color: var(--ink-soft);
    font-size: 13.5px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.empty-state::before {
    content: '';
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #F3F0E8;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234A5A68' stroke-width='1.8'%3E%3Crect x='3' y='4' width='18' height='16' rx='2'/%3E%3Cpath d='M3 9h18'/%3E%3C/svg%3E") center / 55% no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234A5A68' stroke-width='1.8'%3E%3Crect x='3' y='4' width='18' height='16' rx='2'/%3E%3Cpath d='M3 9h18'/%3E%3C/svg%3E") center / 55% no-repeat;
    background-color: #C7BFA9;
}


/* ---------- Mobile nav toggle (hidden on desktop) ---------- */

#mobile-nav-toggle {
    display: none;
    position: sticky;
    top: 0;
    z-index: 30;
    margin-bottom: 14px;
    width: 38px;
    height: 38px;
    padding: 0;
    border-radius: 9px;
    background: var(--panel);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    color: var(--ink);
    align-items: center;
    justify-content: center;
}

#mobile-nav-toggle svg {
    width: 18px;
    height: 18px;
}

#mobile-nav-scrim {
    display: none;
}


/* ---------- Responsive: collapse sidebar into an off-canvas drawer ---------- */

@media (max-width: 880px) {
    .app-shell {
        position: relative;
        overflow: hidden;
    }
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        z-index: 40;
        width: 250px;
        transform: translateX(-104%);
        transition: transform 0.22s ease;
    }
    .sidebar.open {
        transform: translateX(0);
    }
    main.canvas {
        width: 100%;
        padding: 18px 16px 48px;
    }
    #mobile-nav-toggle {
        display: inline-flex;
    }
    #mobile-nav-scrim {
        display: none;
        position: fixed;
        inset: 0;
        z-index: 35;
        background: rgba(11, 29, 46, 0.4);
    }
    #mobile-nav-scrim.open {
        display: block;
    }
    .kpi-grid,
    .grid,
    .report-cols {
        grid-template-columns: 1fr;
    }
}


/* ---------- Report Print button ---------- */

.report-print-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.report-print-btn svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}


/* ---------- Sidebar brand headings (Ice Cream / Kulfi / Milk Products) ---------- */

.nav-brand {
    margin: 14px 4px 4px;
    padding: 7px 10px;
    border-radius: 7px;
    background: rgba(254, 200, 12, 0.12);
    border-left: 3px solid var(--teal);
    font-family: var(--font-head);
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--teal);
}


/* ---------- Department requests ---------- */

.badge.info {
    background: #E6EEF7;
    color: var(--navy-soft);
}

.badge.muted {
    background: #EEEBE2;
    color: var(--ink-soft);
}

.req-filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.req-filters select {
    flex: 1 1 140px;
    min-width: 0;
}

.stock-info {
    margin-top: 6px;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    background: var(--teal-tint);
    color: var(--ink);
    border: 1px solid var(--line);
}

.stock-info[hidden] {
    display: none;
}

.stock-info strong {
    font-family: var(--font-head);
}

.stock-info.low {
    background: var(--amber-tint);
}

.stock-info.none {
    background: var(--red-tint);
    color: var(--red);
}

.req-sub {
    display: block;
    font-size: 11.5px;
    color: var(--ink-soft);
}


/* ---------- Roles: department logins ---------- */

.side-nav [hidden],
.side-nav>[hidden] {
    display: none !important;
}


/* a module the department may only look at: no add/edit/delete controls */

.tab.readonly .form-launch,
.tab.readonly .row-actions button {
    display: none !important;
}

.tab.readonly .row-actions {
    display: none;
}

.readonly-note {
    margin: 0 0 12px;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12.5px;
    background: #EEEBE2;
    color: var(--ink-soft);
}


/* the [hidden] attribute must beat component display rules such as .field { display:flex } */

[hidden] {
    display: none !important;
}


/* ---------- Bootstrap 5.3 badge utilities ----------
   vendor/bootstrap/bootstrap-modal.min.css is a modal-only build, so the badge classes are
   declared here with Bootstrap's own names and values. Use as:
   <span class="badge rounded-pill text-bg-danger">3</span>  (also text-bg-warning / -success / -info / -secondary) */

.badge.rounded-pill {
    border-radius: 50rem;
}

.badge.text-bg-danger {
    color: #fff !important;
    background-color: #dc3545 !important;
}

.badge.text-bg-warning {
    color: #000 !important;
    background-color: #ffc107 !important;
}

.badge.text-bg-success {
    color: #fff !important;
    background-color: #198754 !important;
}

.badge.text-bg-info {
    color: #000 !important;
    background-color: #0dcaf0 !important;
}

.badge.text-bg-secondary {
    color: #fff !important;
    background-color: #6c757d !important;
}

.ms-auto {
    margin-left: auto !important;
}

.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}


/* sidebar badge on the Requests item */

.nav-badge {
    min-width: 22px;
    padding: 3px 7px;
    text-align: center;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}

.nav-badge[hidden] {
    display: none !important;
}

.nav-badge.bump {
    animation: navBadgeBump 0.5s ease;
}

@keyframes navBadgeBump {
    0% {
        transform: scale(1);
    }
    40% {
        transform: scale(1.35);
    }
    100% {
        transform: scale(1);
    }
}


/* live-updated request rows flash briefly so a change is noticed */

#request-table tbody tr.row-fresh {
    animation: reqRowFresh 1.6s ease-out;
}

@keyframes reqRowFresh {
    0% {
        background: var(--amber-tint);
    }
    100% {
        background: transparent;
    }
}


/* raw-material-used report: "parties shipping this product" panel */

.rmu-parties {
    margin-top: 18px;
}

.rmu-parties[hidden] {
    display: none !important;
}

.rmu-parties h4 {
    margin: 0 0 6px;
}

#tab-reports .report-controls select {
    max-width: 230px;
}


/* ---- Brand selection (one set of modules, brand chosen by dropdown) ---- */

.brand-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 0 16px;
}

.brand-bar .field-label {
    margin: 0;
}

.brand-bar select {
    max-width: 240px;
}

.brand-pane[hidden],
.brand-form[hidden],
.brand-foot[hidden],
.brand-hint[hidden] {
    display: none !important;
}

.brand-banner {
    display: none;
    margin: 26px 0 14px;
    padding: 8px 14px;
    border-left: 4px solid var(--brand, #fec80c);
    background: rgba(254, 200, 12, 0.12);
    font-weight: 700;
    letter-spacing: .02em;
    border-radius: 6px;
}

.tab[data-view="all"] .brand-banner {
    display: block;
}

.tab[data-view="all"] .brand-pane:first-of-type .brand-banner {
    margin-top: 6px;
}

.brand-foot {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    width: 100%;
}

.brand-hint {
    font-size: 13px;
    color: var(--muted, #666);
    margin: -2px 0 6px;
}

.brand-field {
    margin-bottom: 14px;
}

.modal-body .brand-form>form {
    margin: 0;
}


/* ---- Ledger accounts ---- */

#lg-result td:first-child,
#lg-result td[style*="right"],
#lg-overview-table td[style*="right"] {
    white-space: nowrap;
}

#lg-overview-table .lg-row:hover td {
    background: rgba(254, 200, 12, 0.12);
}


/* ---- Dashboard: Profit / Loss graph ---- */

.pl-card {
    margin-bottom: 22px;
}

.pl-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.pl-head h3 {
    margin: 0;
}

.pl-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.pl-seg {
    display: inline-flex;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
}

.pl-seg button.pl-group {
    background: #fff;
    color: var(--ink-soft);
    border: none;
    border-radius: 0;
    box-shadow: none;
    padding: 7px 14px;
    font-weight: 600;
    filter: none;
}

.pl-seg button.pl-group+button.pl-group {
    border-left: 1px solid var(--line);
}

.pl-seg button.pl-group:hover {
    background: #F3F0E8;
    filter: none;
    box-shadow: none;
}

.pl-seg button.pl-group.active {
    background: var(--navy);
    color: #fff;
}

.pl-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 28px;
    margin-bottom: 10px;
}

.pl-summary .pl-stat .label {
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ink-soft);
}

.pl-summary .pl-stat .value {
    font-family: var(--font-head);
    font-size: 21px;
    font-weight: 700;
    margin-top: 2px;
}

.pl-summary .pl-stat.profit .value {
    color: #1F7A4D;
}

.pl-summary .pl-stat.loss .value {
    color: var(--red);
}

.pl-chart {
    position: relative;
}

.pl-chart svg {
    width: 100%;
    height: auto;
    display: block;
}

.pl-chart .pl-col {
    cursor: pointer;
}

.pl-chart .pl-hit {
    fill: transparent;
}

.pl-chart .pl-col:hover .pl-hit,
.pl-chart .pl-col.on .pl-hit {
    fill: rgba(11, 29, 46, 0.06);
}

.pl-chart .pl-bar-profit {
    fill: #2E9E66;
}

.pl-chart .pl-bar-loss {
    fill: var(--red);
}

.pl-chart text {
    font-family: var(--font-ui);
    font-size: 11px;
    fill: var(--ink-soft);
}

.pl-chart .pl-grid {
    stroke: var(--line);
    stroke-width: 1;
}

.pl-chart .pl-zero {
    stroke: var(--ink-soft);
    stroke-width: 1.2;
}

.pl-tip {
    position: absolute;
    z-index: 5;
    pointer-events: none;
    min-width: 150px;
    background: var(--navy);
    color: #fff;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 12px;
    line-height: 1.5;
    box-shadow: 0 6px 18px rgba(11, 29, 46, 0.3);
}

.pl-tip b {
    font-weight: 700;
}

.pl-tip .pl-tip-p {
    font-weight: 700;
    margin-top: 2px;
}

.pl-note {
    margin-top: 8px;
    font-size: 12px;
    color: var(--ink-soft);
}


/* ---------- Dashboard brand-wise table ---------- */

#dash-brand-card {
    margin-bottom: 22px;
}

#dash-brand-table .total-row td {
    background: var(--teal-tint);
    border-top: 2px solid var(--line);
}


/* ---------- Multi-product requests ---------- */

.req-item-row {
    margin-bottom: 10px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
}

.req-item-grid {
    display: grid;
    grid-template-columns: 1fr 1.6fr 84px 34px;
    gap: 6px;
    align-items: center;
}

.req-item-grid select,
.req-item-grid input {
    min-width: 0;
    width: 100%;
}

.req-it-del {
    padding: 4px 0;
    line-height: 1;
    font-size: 18px;
}

.req-it-info {
    margin-top: 6px;
    font-size: 12.5px;
    color: var(--ink-soft);
}

.req-it-info.low {
    color: #8a5a10;
}

.req-it-info.none {
    color: var(--red);
}

.req-it-info strong {
    font-family: var(--font-head);
}

#req-add-item {
    margin-top: 2px;
}

.req-line {
    display: block;
    margin-bottom: 2px;
}

.req-short {
    color: var(--red);
    font-weight: 600;
}

#request-table .total-row td,
#req-check-body .total-row td {
    background: var(--teal-tint);
}

#req-check-body .short-row td {
    background: var(--red-tint);
}

.req-check-head {
    margin: 0 0 10px;
}

@media (max-width: 560px) {
    .req-item-grid {
        grid-template-columns: 1fr 1fr;
    }
    .req-item-grid .req-it-product {
        grid-column: 1 / -1;
    }
}


/* ---------- All-brand dispatch order ---------- */

.allbrand-card {
    margin-bottom: 20px;
}

.ab-item-grid {
    display: grid;
    grid-template-columns: 150px 1fr 1.6fr 78px 88px;
    gap: 6px;
    align-items: center;
}

.ab-item-grid .ab-it-barcode {
    grid-column: 2 / 5;
}

.ab-item-grid [hidden] {
    display: none !important;
}

.ab-item-grid select,
.ab-item-grid input {
    min-width: 0;
    width: 100%;
}

.ab-scan-list {
    list-style: none;
    margin: 8px 0 0;
    padding: 0;
    font-size: 12.5px;
}

.ab-scan-list li {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    border-bottom: 1px solid var(--line);
}

.ab-scan-list li button {
    padding: 0 8px;
    font-size: 16px;
}

.ab-scan-list .ab-sc-rate {
    margin-left: auto;
    width: 96px;
    flex: 0 0 96px;
}


/* Dispatch page shows only: All-brand order + Add party (per-brand panes stay in the page but hidden) */

#tab-dispatch>.brand-bar,
#tab-dispatch>.brand-pane {
    display: none !important;
}

.ab-done {
    margin: 12px 0 0;
    padding: 8px 12px;
    border-radius: 8px;
    background: var(--teal-tint);
    border: 1px solid var(--line);
}

#ab-summary div+div {
    margin-top: 2px;
}

@media (max-width: 640px) {
    .ab-item-grid {
        grid-template-columns: 1fr 1fr;
    }
    .ab-item-grid .ab-it-product,
    .ab-item-grid .ab-it-barcode {
        grid-column: 1 / -1;
    }
}


/* Add material: "also add to other brands" checkboxes */

.common-brands {
    margin: 0 0 14px;
    padding: 10px 12px;
    border: 1px solid var(--line, #e2ddd0);
    border-radius: var(--radius);
    background: var(--teal-tint);
    font-size: 13px;
}

.common-brands[hidden] {
    display: none;
}

.common-brands-title {
    font-weight: 600;
    margin-bottom: 6px;
}

.common-brands label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 3px 0;
    cursor: pointer;
}

.common-brands input[type="checkbox"] {
    width: auto;
    margin: 0;
}

.common-brands-list {
    margin-left: 22px;
}

.common-brands-note {
    color: var(--ink-soft);
    font-size: 12px;
    margin-top: 6px;
}


/* Reports: report-type picker */

.report-pick-hint {
    display: none;
    padding: 26px 18px;
    text-align: center;
    color: var(--ink-soft);
    background: var(--panel);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

#tab-reports.report-none .report-pick-hint {
    display: block;
}

#tab-reports.report-none .brand-banner {
    display: none !important;
}


/* multi-brand purchase split + summary */

.split-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 4px 0;
}

.split-row label {
    flex: 1 1 auto;
    margin: 0;
}

.split-row input.split-qty {
    width: 120px;
    margin: 0;
}

.split-summary {
    margin-top: 8px;
    padding: 8px 10px;
    border-radius: var(--radius);
    background: #fff;
    border: 1px dashed var(--line, #e2ddd0);
    font-size: 13px;
    font-weight: 600;
}

.split-summary[hidden] {
    display: none;
}

#lg-overview-table tfoot td {
    font-weight: 700;
    border-top: 2px solid var(--line, #e2ddd0);
    background: var(--teal-tint);
}

.prod-tick {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    font-weight: 600;
    cursor: pointer;
}

.prod-tick input {
    width: 18px;
    height: 18px;
}

#req-dispatch-body h4 {
    margin: 14px 0 6px;
    font-size: 14px;
}


/* ---------- Raw material shortage / borrow-from-another-brand ---------- */

.shortage-panel {
    margin: 4px 0 16px;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: #fff;
    font-size: 13px;
}

.shortage-panel.ok {
    background: var(--teal-tint);
}

.shortage-panel.warn {
    background: var(--amber-tint);
    border-color: var(--amber);
}

.shortage-panel.alert {
    background: var(--red-tint);
    border-color: var(--red);
}

.shortage-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    margin-bottom: 8px;
}

.shortage-item {
    padding: 10px 0;
    border-top: 1px dashed rgba(0, 0, 0, .12);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.shortage-item:first-of-type {
    border-top: 0;
}

.shortage-line {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px 10px;
}

.shortage-sub {
    font-size: 12px;
    color: var(--ink-soft);
}

.shortage-sub.muted {
    font-style: italic;
}

.shortage-opt {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(255, 255, 255, .7);
    border: 1px solid var(--line);
}

.shortage-opt-info {
    flex: 1 1 200px;
    min-width: 0;
}

.shortage-opt .shortage-qty {
    width: 96px;
    margin: 0;
    padding: 6px 8px;
}

.shortage-unit {
    font-size: 12px;
    color: var(--ink-soft);
}

.shortage-opt button,
.shortage-other,
.rm-borrow-btn {
    margin: 0;
    padding: 6px 12px;
    font-size: 12.5px;
}

.shortage-other {
    align-self: flex-start;
    background: none;
    border: 0;
    color: var(--navy);
    text-decoration: underline;
    box-shadow: none;
    padding-left: 0;
}

.shortage-other:hover {
    background: none;
    box-shadow: none;
    filter: none;
}

.rm-alerts .shortage-item {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.rm-alerts .shortage-line {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
}

.tab.readonly #transfer-launch {
    display: none !important;
}


/* Requests page: boxes to create (all open Production requests together) */

.req-needs {
    margin-bottom: 16px;
}

.req-needs[hidden] {
    display: none;
}

.req-needs .need-row td {
    background: rgba(214, 69, 65, 0.06);
}

.req-needs table .total-row td {
    background: var(--teal-tint);
}


/* Scan & dispatch (Dispatch department) */

.ship-bar {
    height: 8px;
    background: var(--line);
    border-radius: 6px;
    overflow: hidden;
    margin-top: 10px;
}

.ship-bar span {
    display: block;
    height: 100%;
    background: var(--teal, #1f7a6d);
    transition: width .15s;
}

#ss-table tr.ship-done td {
    background: rgba(31, 122, 109, 0.08);
}

#ss-input {
    font-size: 16px;
}


/* Related search: rows that are not a direct match but share the party / vendor of a match */

tr.req-related td {
    background: rgba(31, 122, 109, 0.07);
}

.related-tag {
    display: block;
    font-size: 11px;
    color: var(--teal, #1f7a6d);
    font-weight: 600;
    margin-top: 2px;
}

#req-bills .card h3,
#req-needs .card h3 {
    margin-top: 0;
}

.need-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    flex-wrap: wrap;
}


/* Print buttons inside the Requests sections: small icon, button sized to its text */

#req-needs button,
#req-bills button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: auto;
}

#req-needs button svg,
#req-bills button svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.need-head>button {
    align-self: flex-start;
    padding: 8px 12px;
    font-size: 13px;
}


/* Type-to-search box above a long dropdown */

.select-search {
    margin-bottom: 6px;
}


/* ---------- Field Sales (salesman stock, bills, report) ---------- */

.sm-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 4px 0 14px;
}

.sm-h {
    font-size: 15px;
    margin: 22px 0 8px;
}

.sm-form {
    max-width: 920px;
}

.sm-two,
.sm-three {
    display: grid;
    gap: 10px;
    grid-template-columns: 1fr 1fr;
}

.sm-three {
    grid-template-columns: 1fr 1.4fr 1fr;
}

.sm-line {
    display: grid;
    grid-template-columns: 1fr 110px auto auto;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

.sm-line .ln-a {
    font-weight: 600;
    white-space: nowrap;
    min-width: 70px;
    text-align: right;
}

.sm-gline {
    display: grid;
    grid-template-columns: 1.6fr 1.2fr 90px 110px 110px auto auto;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

.sm-gline .g-q {
    white-space: nowrap;
    color: var(--ink-soft);
    font-size: 12.5px;
    min-width: 70px;
}

.sm-total {
    margin: 14px 0;
    padding: 10px 12px;
    background: #FEF8E1;
    border-radius: 8px;
    line-height: 1.6;
}

.sm-total strong {
    font-size: 1.15em;
}

.sm-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
    margin-bottom: 14px;
}

.sm-filters .field {
    margin: 0;
}

.sm-fbtn {
    display: flex;
    gap: 8px;
}

.sm-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin-bottom: 6px;
}

.sm-kpis div {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px 12px;
}

.sm-kpis span {
    display: block;
    font-size: 12px;
    color: var(--ink-soft);
}

.sm-kpis strong {
    font-size: 18px;
}

.sm-rem {
    font-size: 20px;
    font-weight: 700;
}

tr.sm-zero td {
    opacity: .55;
}

.sm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(22, 35, 46, .55);
    z-index: 2000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    overflow-y: auto;
    padding: 16px;
}

.sm-card {
    background: #fff;
    border-radius: 12px;
    padding: 14px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, .3);
}

.sm-card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.sm-paper {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    background: #fffef9;
    border: 1px dashed #bbb;
    padding: 10px;
    margin: 0 auto 12px;
    color: #000;
}

.sm-paper.w58 {
    max-width: 260px;
}

.sm-paper.w80 {
    max-width: 340px;
}

.sm-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.sm-width {
    display: block;
    font-size: 12.5px;
    margin-bottom: 6px;
}

@media (max-width: 720px) {
    .sm-two,
    .sm-three {
        grid-template-columns: 1fr;
    }
    .sm-line {
        grid-template-columns: 1fr 90px;
    }
    .sm-line .ln-a {
        grid-column: 1;
        text-align: left;
    }
    .sm-gline {
        grid-template-columns: 1fr 1fr;
    }
    .sm-form button[type="submit"],
    #my-go-bill {
        width: 100%;
        padding: 13px;
        font-size: 15px;
    }
}


/* ---- Field Sales: delivery reminders + tap chips ---- */

.sm-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.sm-chip {
    padding: 7px 12px;
    border-radius: 999px;
    background: #fff;
    color: var(--ink);
    border: 1px solid var(--line);
    font-size: 13px;
    cursor: pointer;
}

.sm-chip.on {
    background: var(--navy);
    border-color: var(--navy);
    color: #fff;
}

.ch-days,
.ch-date {
    max-width: 220px;
    margin-bottom: 6px;
}

.rem-list {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.rem-card {
    background: #fff;
    border: 1px solid var(--line);
    border-left: 4px solid #8aa;
    border-radius: 10px;
    padding: 10px 12px;
}

.rem-card.overdue {
    border-left-color: #d64545;
    background: #fff7f7;
}

.rem-card.today {
    border-left-color: #e6a100;
    background: #fffbea;
}

.rem-card.tomorrow {
    border-left-color: #2c8fbf;
}

.rem-card.upcoming {
    border-left-color: #3a9d5d;
}

.rem-top {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: flex-start;
}

.rem-top .req-sub,
.rem-when .req-sub {
    display: block;
}

.rem-when {
    text-align: right;
    white-space: nowrap;
}

.rem-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.rem-actions button,
.rem-actions .btn-link {
    padding: 7px 11px;
    font-size: 13px;
}

.btn-link {
    display: inline-block;
    border-radius: 8px;
    text-decoration: none;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    line-height: 1.2;
}

.rem-edit {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed var(--line);
}

.rem-edit-btns {
    display: flex;
    gap: 8px;
    margin-top: 6px;
}

.sm-kpis .rem-kpi-red strong {
    color: #d64545;
}

.sm-kpis .rem-kpi-amber strong {
    color: #b97d00;
}

@media (max-width: 720px) {
    .rem-list {
        grid-template-columns: 1fr;
    }
    .rem-actions button,
    .rem-actions .btn-link {
        flex: 1 1 auto;
        text-align: center;
    }
}


/* ---- Field Sales: salesman dashboard + products ---- */

.dash-kpis {
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    margin-bottom: 14px;
}

.dash-kpis .kpi-profit strong {
    color: #1f8a4c;
}

.dash-kpis .kpi-loss strong {
    color: #d64545;
}

.dash-rounds {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

.dash-round {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px;
}

.dash-round-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 8px;
}

.dash-round-head h3 {
    margin: 0;
    font-size: 15px;
}

.dash-stop {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    align-items: flex-start;
    padding: 8px 0;
    border-top: 1px solid var(--line);
}

.dash-stop:first-of-type {
    border-top: 0;
}

.dash-stop .req-sub {
    display: block;
}

.dash-stop.delivered strong {
    text-decoration: line-through;
    opacity: .6;
}

.dash-note {
    margin: 6px 0 0;
}

@media (max-width: 720px) {
    .dash-rounds {
        grid-template-columns: 1fr;
    }
    .sm-gline {
        grid-template-columns: 1fr 1fr;
    }
}


/* ---- Customers module ---- */

.cu-map {
    height: 300px;
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 10px;
    overflow: hidden;
    z-index: 0;
}

#cu-weekdays .sm-chip {
    display: inline-flex;
    gap: 6px;
    align-items: center;
}

#cu-weekdays .sm-chip input {
    width: auto;
    margin: 0;
}

#cu-table td .req-sub {
    display: block;
}

#cu-table .row-actions {
    text-align: right;
}

@media (max-width: 880px) {
    .cu-map {
        height: 240px;
    }
}


/* ---- Customers: mobile-style card list, tap a card for the action sheet ---- */

.cu-part-off {
    display: none !important;
}

.cu-top {
    margin-bottom: 12px;
    padding: 14px 16px;
}

.cu-searchrow {
    display: flex;
    gap: 10px;
    align-items: center;
}

.cu-searchrow input {
    flex: 1;
    margin: 0;
}

.cu-filter-btn {
    padding: 9px 11px;
    line-height: 0;
}

.cu-filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: flex-end;
    margin-top: 12px;
}

.cu-tabs {
    display: flex;
    gap: 10px;
    margin: 0 0 12px;
    flex-wrap: wrap;
}

.cu-pill {
    border: 0;
    border-radius: 999px;
    padding: 10px 22px;
    font-size: 15px;
    background: #ebebeb;
    color: var(--ink);
    cursor: pointer;
}

.cu-pill.on {
    background: var(--navy);
    color: #fff;
}

.cu-cards {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
}

.cu-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: var(--shadow);
    padding: 14px 16px;
}

.cu-card.is-deleted {
    opacity: .8;
}

.cu-card-top {
    display: flex;
    gap: 12px;
    align-items: center;
    cursor: pointer;
}

.cu-avatar {
    flex: 0 0 auto;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #efefef;
    color: #8a8a8a;
    display: grid;
    place-items: center;
}

.cu-avatar.due {
    background: var(--red-tint);
    color: var(--red);
}

.cu-info {
    flex: 1;
    min-width: 0;
}

.cu-name {
    font-size: 17px;
    font-weight: 700;
    color: var(--ink);
    overflow-wrap: anywhere;
}

.cu-addr {
    font-size: 13.5px;
    color: var(--ink-soft);
    margin-top: 2px;
    overflow-wrap: anywhere;
}

.cu-sched {
    font-size: 12px;
    color: var(--ink-soft);
    margin-top: 3px;
}

.cu-amt {
    text-align: right;
    flex: 0 0 auto;
}

.cu-amt b {
    display: block;
    font-size: 20px;
    color: #8a8a8a;
}

.cu-amt.due b {
    color: var(--red);
}

.cu-amt.adv b {
    color: #2e7d4f;
}

.cu-amt em {
    font-style: normal;
    display: inline-block;
    margin-top: 3px;
    padding: 2px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    background: var(--red-tint);
    color: var(--red);
}

.cu-amt.adv em {
    background: #e7f4ec;
    color: #2e7d4f;
}

.cu-dots {
    flex: 0 0 auto;
    border: 0;
    background: transparent;
    font-size: 22px;
    line-height: 1;
    padding: 6px 4px;
    color: var(--ink-soft);
    cursor: pointer;
}

.cu-card-actions {
    display: flex;
    gap: 10px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

.cu-card-actions .cu-ic {
    flex: 0 0 auto;
    width: 46px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: #f1f1f1;
    color: #555;
    text-decoration: none;
    padding: 10px 0;
}

.cu-card-actions .cu-wa {
    flex: 0 0 auto;
    display: inline-flex;
    gap: 8px;
    align-items: center;
    padding: 10px 18px;
    border-radius: 10px;
    background: #e8f8ee;
    color: #25764a;
    font-weight: 600;
    text-decoration: none;
}

.cu-card-actions .cu-cash {
    flex: 1;
    border-radius: 10px;
    font-weight: 700;
}

.cu-end {
    text-align: center;
    color: #9a9a9a;
    letter-spacing: .06em;
    padding: 22px 0 16px;
}

.cu-fab {
    position: sticky;
    bottom: 20px;
    margin: 0 6px 12px auto;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    padding: 0;
    display: grid;
    place-items: center;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .25);
    z-index: 20;
}


/* sticks to the bottom-right while scrolling, rests after the list (never covers a card) */

.cu-act-list {
    display: grid;
    gap: 8px;
}

.cu-act-list button {
    text-align: left;
    display: flex;
    gap: 12px;
    align-items: center;
    width: 100%;
    padding: 13px 14px;
    border-radius: 12px;
    background: #f6f4ee;
    color: var(--ink);
    border: 1px solid var(--line);
    font-size: 15px;
}

.cu-act-list button small {
    display: block;
    color: var(--ink-soft);
    font-size: 12px;
    font-weight: 400;
}

.cu-act-list button.danger {
    background: var(--red-tint);
    color: var(--red);
    border-color: #f1c9c5;
}

.cu-act-list button .ico {
    flex: 0 0 auto;
    width: 22px;
    text-align: center;
    font-size: 18px;
}


/* ---- Customer groups (areas): chip row above the list, a bar with group actions, and the "pick customers" list ---- */

.cu-groups {
    display: flex;
    gap: 8px;
    margin: 0 0 12px;
    flex-wrap: wrap;
}

.cu-groups[hidden],
.cu-group-bar[hidden] {
    display: none;
}

.cu-gpill {
    padding: 8px 16px;
    font-size: 14px;
}

.cu-gpill.add {
    background: transparent;
    border: 1.5px dashed #b9b9b9;
    color: var(--ink-soft);
}

.cu-group-bar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    background: #fff;
    border-radius: 14px;
    box-shadow: var(--shadow);
    padding: 10px 14px;
    margin: 0 0 12px;
}

.cu-group-bar .cu-gb-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--ink);
    overflow-wrap: anywhere;
}

.cu-group-bar .cu-gb-title small {
    display: block;
    font-size: 12px;
    font-weight: 400;
    color: var(--ink-soft);
}

.cu-group-bar .cu-gb-btns {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.cu-group-bar .cu-gb-btns button {
    padding: 8px 14px;
    font-size: 13.5px;
}

.cu-group-bar .cu-gb-btns .danger {
    background: var(--red-tint);
    color: var(--red);
    border: 1px solid #f1c9c5;
}

.cu-mem-list {
    display: grid;
    gap: 8px;
}

.cu-mem-row {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 10px 12px;
    border-radius: 12px;
    background: #f6f4ee;
    border: 1px solid var(--line);
    cursor: pointer;
}

.cu-mem-row[hidden] {
    display: none;
}

.cu-mem-row input {
    width: auto;
    margin: 0;
    flex: 0 0 auto;
    transform: scale(1.25);
}

.cu-mem-row span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.cu-mem-row small {
    display: block;
    color: var(--ink-soft);
    font-size: 12px;
}

@media (max-width: 640px) {
    .cu-groups {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 4px;
        -webkit-overflow-scrolling: touch;
    }
    .cu-gpill {
        flex: 0 0 auto;
        white-space: nowrap;
    }
}

@media (max-width: 640px) {
    .cu-cards {
        grid-template-columns: 1fr;
    }
    .cu-fab {
        bottom: 16px;
        margin-right: 0;
    }
}


/* =====================================================================
   HOME screen (field-sales login on a phone) + GROUPS module
   ===================================================================== */


/* the Home entry in the menu and the Home button in the top bar only exist on a phone */

nav.side-nav button.nav-home {
    display: none;
}

#mobile-home-btn {
    display: none;
}

@media (max-width: 880px) {
    nav.side-nav button.nav-home:not([hidden]) {
        display: flex;
    }
    body.has-home:not(.on-home) #mobile-home-btn {
        display: inline-flex;
    }
}

#mobile-home-btn {
    position: sticky;
    top: 0;
    z-index: 30;
    margin: 0 0 14px 8px;
    width: 38px;
    height: 38px;
    padding: 0;
    border-radius: 9px;
    background: var(--panel);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    color: var(--ink);
    align-items: center;
    justify-content: center;
    vertical-align: top;
}

#mobile-home-btn svg {
    width: 18px;
    height: 18px;
}

#mobile-nav-toggle {
    vertical-align: top;
}

.home-hello {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 10px;
}

.home-hello strong {
    font-family: var(--font-head);
    font-size: 18px;
    color: var(--ink);
}


/* Today's sale / profit / received / deliveries: one row you swipe sideways */

.home-kpis {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding: 2px 2px 10px;
    margin: 0 -2px;
    scrollbar-width: thin;
}

.home-kpi {
    flex: 0 0 152px;
    scroll-snap-align: start;
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px 14px;
    box-shadow: var(--shadow);
}

.home-kpi .hk-l {
    font-size: 12px;
    color: var(--ink-soft);
}

.home-kpi strong {
    font-family: var(--font-head);
    font-size: 20px;
    line-height: 1.15;
    color: var(--ink);
}

.home-kpi small {
    font-size: 11.5px;
    color: var(--ink-soft);
}

.home-kpi.profit strong {
    color: #1f8a4c;
}

.home-kpi.loss strong {
    color: #d64545;
}

.home-kpi.amber {
    background: var(--amber-tint);
    border-color: #F0D9A8;
}

.home-h {
    margin: 8px 0 10px;
}


/* every module as a tile */

.home-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.home-tile {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 96px;
    padding: 12px 6px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--shadow);
    color: var(--ink);
    font-family: var(--font-ui);
    cursor: pointer;
}

.home-tile:active {
    transform: scale(0.97);
}

.home-ico {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: var(--teal-tint);
    color: var(--navy);
}

.home-ico svg {
    width: 22px;
    height: 22px;
}

.home-lbl {
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
}

.home-badge {
    position: absolute;
    top: 6px;
    right: 8px;
    min-width: 20px;
    padding: 2px 6px;
    border-radius: 999px;
    background: var(--red);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    text-align: center;
}

.home-badge[hidden] {
    display: none;
}

@media (max-width: 340px) {
    .home-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 560px) {
    .home-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}


/* Groups page */

.gp-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.gp-list>.empty-state {
    grid-column: 1 / -1;
}

.gp-card {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 14px;
    background: var(--panel);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.gp-name {
    font-family: var(--font-head);
    font-size: 16px;
    font-weight: 600;
    color: var(--ink);
}

.gp-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.gp-chip {
    padding: 3px 9px;
    border-radius: 999px;
    background: var(--teal-tint);
    font-size: 12px;
    color: var(--ink);
}

.gp-chip.more {
    background: #F3F0E8;
    color: var(--ink-soft);
}

.gp-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

@media (max-width: 640px) {
    .gp-list {
        grid-template-columns: 1fr;
    }
    .gp-btns button {
        flex: 1 1 auto;
    }
}


/* =====================================================================
   PRODUCT REQUESTS (salesman -> admin -> salesman)   js/sales-requests.js
   ===================================================================== */

.rq-tabcount {
    margin-left: 6px;
    animation: none;
}


/* ---- salesman: product picker ---- */

.rq-card {
    margin-bottom: 12px;
}

.rq-listhead {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin: 6px 0 8px;
    font-size: 13px;
}

.rq-all {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 600;
}

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

.rq-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
    transition: border-color .15s, background .15s;
}

.rq-item.on {
    border-color: var(--teal-dark);
    background: var(--teal-tint);
}

.rq-pick {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    min-width: 0;
}

.rq-pick input[type="checkbox"],
.rq-all input[type="checkbox"],
.rq-give input[type="checkbox"] {
    width: 20px;
    height: 20px;
    flex: none;
    accent-color: var(--teal-dark);
}

.rq-name {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.rq-stock {
    font-size: 12px;
    font-weight: 600;
    padding: 2px 9px;
    border-radius: 999px;
    white-space: nowrap;
    background: #F3F0E8;
    color: var(--ink-soft);
}

.rq-stock.in {
    background: #E6F4EA;
    color: #1E6B35;
}

.rq-stock.low {
    background: var(--amber-tint);
    color: #92650E;
}

.rq-stock.out {
    background: var(--red-tint);
    color: var(--red);
}

.rq-qty {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.rq-qty.off {
    opacity: .4;
    pointer-events: none;
}

.rq-qty button {
    width: 36px;
    height: 36px;
    padding: 0;
    font-size: 18px;
    line-height: 1;
}

.rq-qty .rq-n {
    width: 72px;
    text-align: center;
}

.rq-bar {
    position: sticky;
    bottom: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    margin-top: 12px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 -4px 16px rgba(15, 25, 35, .08);
}

.rq-sum {
    flex: 1;
    font-size: 14px;
}

.rq-bar button:disabled {
    opacity: .5;
    cursor: not-allowed;
}


/* ---- request cards (salesman + admin) ---- */

.rq-req {
    margin-bottom: 12px;
}

.rq-req.is-ready {
    border-left: 4px solid #2E9E5B;
}

.rq-req.is-urgent {
    border-left: 4px solid var(--red);
}

.rq-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    flex-wrap: wrap;
}

.rq-head .req-sub {
    display: block;
}

.rq-badges {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.rq-meta {
    margin: 8px 0;
}

.rq-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.rq-note {
    margin: 10px 0;
    padding: 9px 12px;
    border-radius: 8px;
    font-size: 13.5px;
    background: #F3F0E8;
}

.rq-note .req-sub {
    display: block;
}

.rq-note.ok {
    background: #E6F4EA;
    color: #1E6B35;
}

.rq-note.info {
    background: #E8F1FB;
    color: #1F4E8C;
}

.rq-note.bad {
    background: var(--red-tint);
    color: var(--red);
}


/* progress: Sent -> Accepted -> Ready -> Received */

.rq-track {
    display: flex;
    list-style: none;
    margin: 12px 0;
    padding: 0;
    gap: 0;
}

.rq-track li {
    position: relative;
    flex: 1;
    text-align: center;
    font-size: 12px;
    color: var(--ink-soft);
    padding-top: 20px;
}

.rq-track li::before {
    content: "";
    position: absolute;
    top: 6px;
    left: -50%;
    width: 100%;
    height: 3px;
    background: var(--line);
}

.rq-track li:first-child::before {
    display: none;
}

.rq-track .dot {
    position: absolute;
    top: 0;
    left: calc(50% - 7px);
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid var(--line);
    z-index: 1;
}

.rq-track li.done {
    color: var(--ink);
    font-weight: 600;
}

.rq-track li.done::before {
    background: #2E9E5B;
}

.rq-track li.done .dot {
    background: #2E9E5B;
    border-color: #2E9E5B;
}

.rq-track li.now {
    color: var(--ink);
    font-weight: 600;
}

.rq-track li.now::before {
    background: #2E9E5B;
}

.rq-track li.now .dot {
    border-color: var(--amber);
}

.rq-track li.bad {
    color: var(--red);
    font-weight: 600;
}

.rq-track li.bad::before {
    background: var(--red);
}

.rq-track li.bad .dot {
    background: var(--red);
    border-color: var(--red);
}

.rq-table {
    margin-top: 4px;
}

.rq-hist {
    margin-top: 10px;
    font-size: 13px;
}

.rq-hist summary {
    cursor: pointer;
    color: var(--ink-soft);
}

.rq-hist ul {
    margin: 8px 0 0;
    padding-left: 18px;
}

.rq-hist li {
    margin-bottom: 4px;
}


/* ---- admin: Mark ready dialog ---- */

.sm-card.rq-modal {
    max-width: 720px;
}

.rq-give {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    margin-bottom: 10px;
    border-radius: 8px;
    background: var(--teal-tint);
    font-weight: 600;
    cursor: pointer;
}

.rqm-line {
    padding: 10px 0;
    border-top: 1px solid var(--line);
}

.rqm-name {
    display: flex;
    flex-direction: column;
    margin-bottom: 6px;
}

.rqm-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 8px;
}

.rqm-fields label {
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-size: 12px;
    color: var(--ink-soft);
}

.rqm-warn {
    margin-top: 6px;
    font-size: 12.5px;
    color: var(--red);
}

@media (max-width: 640px) {
    .rq-item {
        grid-template-columns: 1fr;
    }
    .rq-item .rq-qty {
        justify-content: flex-end;
    }
    .rq-bar {
        flex-wrap: wrap;
    }
    .rq-bar .rq-sum {
        flex-basis: 100%;
    }
    .rq-bar button {
        flex: 1;
    }
    .rq-track li {
        font-size: 11px;
    }
}