﻿/* =====================================================================
   Paper Trade - common styles
   Works on desktop Chrome, tablets and mobiles (menu slides in below 900px)
   Colours are kept in variables so the look can be changed in one place.
   ===================================================================== */
:root {
    --kraft: #9a6a3a;          /* main accent (kraft paper brown) */
    --kraft-dark: #7b5129;     /* accent on hover */
    --ink: #1f2328;            /* main text */
    --muted: #6b7178;          /* secondary text */
    --line: #e3dfd8;           /* borders */
    --page: #f6f4f0;           /* page background */
    --card: #ffffff;           /* card background */
    --side: #23262b;           /* left menu background */
    --side-text: #c9ccd1;      /* left menu text */
    --ok: #1f7a4d;             /* success green */
    --err: #b42318;            /* error red */
    --side-w: 236px;           /* left menu width */
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    color: var(--ink);
    background: var(--page);
}
a { color: var(--kraft); }
h1 { font-size: 22px; margin: 0; font-weight: 600; }
h2 { font-size: 17px; margin: 0 0 8px; }
.muted { color: var(--muted); font-size: 13px; }

/* ---------------- Left vertical menu ---------------- */
.sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: var(--side-w);
    background: var(--side);
    overflow-y: auto;
    padding: 0 0 24px;
    z-index: 30;
    transition: transform .2s ease;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; border-bottom: 1px solid #33373d; }
.brand-mark { width: 32px; height: 32px; border-radius: 6px; background: var(--kraft); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.brand-name { color: #fff; font-weight: 600; font-size: 16px; }
.nav-group { color: #8a8f96; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; padding: 18px 18px 6px; }
.nav-link { display: block; padding: 9px 18px; color: var(--side-text); text-decoration: none; border-left: 3px solid transparent; }
.nav-link:hover { background: #2c3036; color: #fff; }
.nav-link.active { background: #2f2a24; color: #fff; border-left-color: var(--kraft); }
.nav-link.soon { color: #5f646b; cursor: default; }
.nav-link.soon::after { content: "soon"; font-size: 10px; margin-left: 6px; padding: 1px 5px; border: 1px solid #4a4e55; border-radius: 3px; }
.nav-link.soon:hover { background: none; }

/* Top bar only used on small screens */
.topbar { display: none; }
.overlay { display: none; }

/* ---------------- Page content ---------------- */
.content { margin-left: var(--side-w); padding: 24px 28px 40px; max-width: 1200px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 18px; margin-bottom: 16px; }
.card.empty { color: var(--muted); text-align: center; padding: 32px; }

/* ---------------- Messages ---------------- */
.alert { padding: 10px 14px; border-radius: 6px; margin-bottom: 14px; }
.alert-ok { background: #e7f5ee; color: var(--ok); border: 1px solid #b9e2cc; }
.alert-warn { background: #fff8e1; color: #7a5600; border: 1px solid #f0d68a; }           /* saved, but please check (e.g. reel no. repeated) */
.alert-err, .validation-summary-errors { background: #fdecea; color: var(--err); border: 1px solid #f5c2bd; padding: 10px 14px; border-radius: 6px; margin-bottom: 14px; }
.validation-summary-errors ul { margin: 0; padding-left: 18px; }
.field-validation-error { color: var(--err); font-size: 13px; display: block; margin-top: 4px; }
.input-validation-error { border-color: var(--err) !important; }

/* ---------------- Buttons ---------------- */
.btn {
    display: inline-block; padding: 8px 14px; border-radius: 6px;
    border: 1px solid var(--line); background: #fff; color: var(--ink);
    text-decoration: none; font-size: 14px; cursor: pointer; line-height: 1.2;
}
.btn:hover { background: #f1eee9; }
.btn-primary { background: var(--kraft); border-color: var(--kraft); color: #fff; }
.btn-primary:hover { background: var(--kraft-dark); }
.btn-danger { color: var(--err); border-color: #f0c9c4; }
.btn-danger:hover { background: #fdecea; }
.btn-sm { padding: 5px 10px; font-size: 13px; }
form.inline { display: inline; }

/* ---------------- Search bar ---------------- */
.searchbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.searchbar input[type=search] { flex: 1 1 260px; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; }

/* ---------------- Forms ---------------- */
input[type=text], input[type=password], input[type=number], input[type=search], input[type=email], input[type=date], input[type=datetime-local], input[type=tel], select, textarea {
    width: 100%; padding: 9px 10px; font-size: 15px;
    border: 1px solid #cfcac2; border-radius: 6px; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--kraft); box-shadow: 0 0 0 3px rgba(154,106,58,.15); }
.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; }
.field .check { font-weight: 400; }
.full { grid-column: 1 / -1; }
.segmented { display: inline-flex; border: 1px solid #cfcac2; border-radius: 6px; overflow: hidden; margin-bottom: 6px; }
.segmented label { margin: 0; padding: 8px 14px; font-weight: 400; cursor: pointer; display: flex; align-items: center; gap: 6px; }
.segmented label + label { border-left: 1px solid #cfcac2; }
.form-actions { display: flex; gap: 10px; padding-top: 4px; }
.audit { margin: 0; }

/* ---------------- Tables ---------------- */
.table-card { padding: 0; overflow-x: auto; }
.grid { width: 100%; border-collapse: collapse; }
.grid th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: #faf8f5; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.grid td { padding: 10px 12px; border-bottom: 1px solid #efece7; vertical-align: middle; }
.grid tbody tr:hover { background: #fcfbf9; }
.grid .num { text-align: right; font-variant-numeric: tabular-nums; }
.grid .actions { text-align: right; white-space: nowrap; }
.badge { font-size: 12px; padding: 2px 8px; border-radius: 10px; }
.badge-ok { background: #e7f5ee; color: var(--ok); }
.badge-off { background: #eee; color: var(--muted); }
.count { margin-top: -6px; }

/* ---------------- Dashboard tiles ---------------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 18px; text-decoration: none; color: var(--ink); display: flex; flex-direction: column; gap: 4px; }
.tile:hover { border-color: var(--kraft); }
.tile-num { font-size: 30px; font-weight: 700; color: var(--kraft); }
.tile-label { color: var(--muted); }

/* =====================================================================
   Tablet & mobile (below 900px): menu hides and slides in from the left
   ===================================================================== */
@media (max-width: 900px) {
    .topbar {
        display: flex; align-items: center; gap: 12px;
        position: sticky; top: 0; z-index: 20;
        background: var(--side); color: #fff; padding: 10px 14px;
    }
    .menu-btn { background: none; border: 0; color: #fff; font-size: 22px; cursor: pointer; padding: 2px 6px; }
    .topbar-title { font-weight: 600; }
    .sidebar { transform: translateX(-100%); }
    body.menu-open .sidebar { transform: translateX(0); }
    body.menu-open .overlay { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 25; }
    .content { margin-left: 0; padding: 16px; }
}

/* Mobile (below 640px): one column forms, table rows become cards */
@media (max-width: 640px) {
    .form { grid-template-columns: 1fr; }
    .grid thead { display: none; }
    .grid, .grid tbody, .grid tr, .grid td { display: block; width: 100%; }
    .grid tr { border-bottom: 1px solid var(--line); padding: 8px 4px; }
    .grid td { border: 0; padding: 4px 12px; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
    .grid td::before { content: attr(data-label); color: var(--muted); font-size: 13px; text-align: left; }
    .grid td.actions { justify-content: flex-end; padding-top: 8px; }
    .grid td.actions::before { content: none; }
    .btn { padding: 10px 14px; }   /* bigger touch targets */
}

/* ---------------- Added in Part 02: party forms, rate panel ---------------- */
textarea { font-family: inherit; resize: vertical; }
.upper { text-transform: uppercase; }                     /* GSTIN, PAN, print label shown in capitals */
.readonly { background: #f3f1ed !important; color: var(--muted); }
.hint { display: block; font-size: 12px; margin-top: 4px; min-height: 0; }
.hint.warn { color: #b54708; }                            /* orange warning, e.g. GSTIN / state mismatch */

.panel-toggle { font-size: 15px; flex-wrap: wrap; }
.rate-panel { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 14px; }
.rate-panel[hidden] { display: none; }
.rate-tools { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.rate-tools input[type=search] { flex: 1 1 220px; width: auto; }
.segmented.small label { padding: 6px 10px; font-size: 13px; }
.rate-grid { border: 1px solid var(--line); border-radius: 6px; }
.rate-grid .rate-input { width: 130px; text-align: right; margin-left: auto; display: block; }
.rate-grid td { padding: 6px 12px; }

/* Save / Cancel bar stays visible at the bottom while scrolling long rate lists */
.sticky-actions {
    position: sticky; bottom: 0; z-index: 5;
    background: var(--page); padding: 12px 0; margin-top: 4px;
    border-top: 1px solid var(--line); align-items: center; flex-wrap: wrap;
}

@media (max-width: 640px) {
    .rate-grid .rate-input { width: 120px; }
    .grid td .field-validation-error { text-align: right; }
}

/* ---------------- Added in Part 03: login, users, Purchase Order ---------------- */
.badge-warn { background: #fff4e5; color: #b54708; }
.btn-ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-ok:hover { background: #17633e; }
.btn-block { width: 100%; padding: 11px; font-size: 15px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.form.narrow { max-width: 480px; }

/* Login page */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 16px; background: var(--side); }
.login-box { width: 100%; max-width: 360px; padding: 24px; display: grid; gap: 14px; }
.login-box form { display: grid; gap: 14px; }
.login-brand { border: 0; padding: 0 0 6px; }
.login-title { font-weight: 700; font-size: 20px; }

/* Logged-in user box at bottom of left menu */
.user-box { margin: 18px 18px 0; padding-top: 12px; border-top: 1px solid #33373d; color: var(--side-text); font-size: 13px; }
.user-box b { color: #fff; display: block; margin-bottom: 6px; }
.user-box a { color: var(--side-text); margin-right: 10px; }
.user-box a:hover { color: #fff; }

/* PO list filters */
.filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; align-items: end; }
.filters .field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; }
.filters .custom-dates { grid-column: span 2; }
.filters .custom-dates[hidden] { display: none; }
.date-pair { display: flex; gap: 6px; }
.filter-btn .btn { width: 100%; }

/* PO view page */
.action-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.print-now { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; border-color: var(--kraft); background: #fbf6f0; }
/* "Saved. Print now?" (2026-11-13): only the message - it sits on top of the action bar, whose print buttons are used (no repeated buttons) */
.print-now:has(+ .action-bar) { margin-bottom: 0; border-bottom: 0; border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.print-now + .action-bar { border-color: var(--kraft); background: #fbf6f0; border-top: 1px dashed #e2cdb4; border-top-left-radius: 0; border-top-right-radius: 0; }
.info-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px 20px; }
.info-grid span, .totals span { display: block; font-size: 12px; color: var(--muted); }
.info-grid .full { grid-column: 1 / -1; }
.totals { display: flex; flex-wrap: wrap; gap: 12px 28px; justify-content: flex-end; padding-top: 12px; border-top: 1px solid var(--line); }
.card.totals { border-top: 1px solid var(--line); }
.totals .grand b { color: var(--kraft); font-size: 18px; }

/* PO entry line grid */
.lines-head { display: flex; justify-content: flex-start; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 10px; }   /* "+ Add Line" right after the title (left side) */
.table-scroll { overflow-x: auto; }
.line-grid { min-width: 980px; }
.line-grid td { padding: 6px 6px; vertical-align: top; }
.line-grid input[type=number] { width: 92px; text-align: right; }
.line-grid input[type=text] { min-width: 120px; }
.line-grid select { min-width: 90px; }
.line-grid .item-cell select { min-width: 220px; }
.line-grid select.item-sel { min-width: 260px; }                          /* Purchase Entry: full "Quality GSM BF" visible */
.line-grid select.hsn-sel { min-width: 240px; }                           /* full "Chapter Heading - HSN" visible */
.gst.warn { color: #b54708; font-weight: 600; }

@media (max-width: 640px) {
    .filters .custom-dates { grid-column: auto; }
    .line-grid { min-width: 0; }
    .line-grid input[type=number], .line-grid .item-cell select, .line-grid select, .line-grid input[type=text] { width: 60%; min-width: 0; }
    .line-grid select.item-sel, .line-grid select.hsn-sel { width: 60%; min-width: 0; }   /* phone: card layout, no wide boxes */
    .totals { justify-content: space-between; }
}

/* ---------------- Added in Part 04: Purchase Entry, Stock ---------------- */
.form.form3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
.add-rows { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; font-size: 14px; }
.add-rows input[type=number] { width: 80px; }
.add-rows select { width: auto; max-width: 420px; }
.locked { pointer-events: none; background: #f3f1ed !important; color: var(--muted); }   /* value fixed (from PO / already sold) */
.mono { font-family: Consolas, "Courier New", monospace; }
.section-title { font-size: 16px; margin: 18px 0 8px; }
.warn { color: #b54708; }
.pack-grid { min-width: 760px; }
.pack-grid .line-sel { min-width: 260px; }

@media (max-width: 900px) {
    .form.form3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
    .form.form3 { grid-template-columns: 1fr; }
    .span2 { grid-column: auto; }
    .pack-grid { min-width: 0; }
    .pack-grid .line-sel { min-width: 0; width: 60%; }
}

/* ---------------- Part 05: PO approve checkbox on the form ---------------- */
.approve-box { margin-right: auto; padding: 8px 12px; border: 1px solid var(--ok); border-radius: 6px; background: #e7f5ee; color: var(--ok); font-weight: 600; }
.approve-box.disabled { border-color: var(--line); background: #f3f1ed; color: var(--muted); font-weight: 400; cursor: not-allowed; }

/* ---------------- Part 06: user rights ---------------- */
.admin-toggle { font-size: 15px; padding-bottom: 12px; border-bottom: 1px solid var(--line); margin-bottom: 14px; display: flex; }
.templates { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 14px; }
.rights-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.right-group { border: 1px solid var(--line); border-radius: 6px; padding: 8px 12px 10px; margin: 0; }
.right-group legend { font-weight: 600; font-size: 13px; padding: 0 4px; color: var(--kraft-dark); }
.right-item { display: flex; align-items: flex-start; gap: 8px; padding: 4px 0; }
.right-item input { margin-top: 3px; }
.right-item small { display: inline; }
#rightsPanel[hidden] { display: none; }
.alert-info { background: #eef4fb; color: #1d4f91; border: 1px solid #c7dbf2; }
.readonly-form main input:disabled, .readonly-form main select:disabled, .readonly-form main textarea:disabled { background: #f7f5f1; color: var(--ink); opacity: 1; }
.hide-rates .rate-col { display: none !important; }      /* user without "See Rates & Amounts" */

/* ---------------- Purchase Entry: invoice vs packing slip check ---------------- */
.chk { display: block; font-size: 11.5px; margin-top: 3px; white-space: nowrap; }
.chk.ok { color: var(--ok); }
.chk.bad { color: var(--err); font-weight: 600; }
/* Purchase against PO: PO cell (FIFO split) and "Select PO" popup */
.po-cell { min-width: 150px; }
.po-sum { font-size: 12.5px; margin-top: 4px; line-height: 1.4; }
.bad-txt { color: var(--err); font-weight: 600; }
.ok-txt { color: var(--ok); }
.modal { position: fixed; inset: 0; background: rgba(20, 20, 20, .45); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 16px; }
.modal[hidden] { display: none; }
.modal-box { background: var(--card); border-radius: 8px; width: 100%; max-width: 860px; max-height: 90vh; overflow: auto; padding: 18px; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.modal-box h3 { margin: 0 0 12px; font-size: 17px; }
.modal-box input.pick { width: 20px; height: 20px; }
.mode-badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; font-weight: 600; background: #e8eef8; color: #2a4a7a; vertical-align: middle; }
.mode-badge.direct { background: #f8efe2; color: #7a4f12; }
#tSlip.ok { color: var(--ok); }
#tSlip.warn { color: var(--err); }
.line-grid .pcs-in { width: 70px; }
.line-grid .kg-total { width: 110px; }

/* ---------------- Stock reports ---------------- */
.print-only { display: none; }
.report-grid tfoot td { border-top: 2px solid var(--line); background: #faf8f4; }
@media print {
    /* report prints without menu, filters and buttons */
    .sidebar, .topbar, .no-print, .alert { display: none !important; }
    .content { margin: 0 !important; padding: 0 !important; max-width: none !important; }
    .print-only { display: inline; }
    .card { border: none; padding: 0; box-shadow: none; }
    .table-scroll { overflow: visible !important; }
    table.report-grid { font-size: 10px; }
    table.report-grid a { color: inherit; text-decoration: none; }
    @page { size: A4 landscape; margin: 10mm; }
    /* credit line right under the printed report (no empty gap above it) - same text as print.css */
    .content::after { content: "Software designed, developed and maintained by Oasys Technology \00B7  oasystechnology.in";
        display: block; text-align: center; font: 7pt Arial, sans-serif; color: #666; margin-top: 3mm; }
}
.pre-line { white-space: pre-line; }                 /* multi-line text (delivery address) */
.error-summary b { display: block; margin-bottom: 4px; }          /* "Please correct the following:" */
.error-summary ul { margin: 0; padding-left: 18px; }
/* ---- Sales Bill entry */
.scan-box { font-family: Consolas, monospace; font-size: 16px; }
.stock-scroll { max-height: 360px; overflow: auto; margin-top: 10px; }
.cancelled-row td { color: var(--muted); text-decoration: line-through; }
.cancel-box { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.cancel-box input[type=text] { flex: 1; min-width: 220px; }
.logo-preview { max-width: 240px; max-height: 90px; display: block; margin: 6px 0; border: 1px solid var(--line); padding: 4px; background: #fff; }

/* ---------------- Added in Part 16: Purchase Return ---------------- */
.span3 { grid-column: 1 / -1; }                                         /* full row of a 3-column form */
.reason-all { margin-bottom: 8px; }
.line-grid .p-reason { min-width: 170px; width: 100%; }                 /* reason box wide enough to read */
.rev-po { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; font-size: 13px; }
.rev-po.disabled { color: var(--muted); }
.po-note { display: block; font-size: 12px; color: var(--muted); }
.part-tag { display: inline-block; font-size: 11px; padding: 1px 5px; border-radius: 4px; background: #fff3e0; color: #b54708; margin-left: 4px; }
@media (max-width: 640px) {
    .line-grid .p-reason { width: 60%; min-width: 0; }
}

/* ---------------- Added in Part 20: From - To stock report, Opening Stock ---------------- */
.check-list { display: flex; flex-wrap: wrap; gap: 6px 14px; }                 /* godown tick boxes */
.move-grid th, .move-grid td { white-space: nowrap; }
.move-grid th.sub { font-size: 11px; font-weight: 500; }
.move-grid .col-key { background: #f4f7fb; font-weight: 600; }               /* Opening / Balance columns */
.move-grid tfoot td { border-top: 2px solid var(--line, #ccc); }

/* ---- Sales Bill: E-Invoice / E-Way Bill box */
.einv-box .action-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 6px; }
.einv-box .small, .small { font-size: 12px; }
.einv-box textarea.mono { font-family: Consolas, "Courier New", monospace; word-break: break-all; }
.einv-box ol { margin: 6px 0 0 18px; padding: 0; }
.einv-qr { margin-top: 10px; }
.einv-qr svg { width: 160px; height: 160px; max-width: 100%; }

/* ---- PC: hide / show the left menu (☰ button at top-left); remembered per browser */
.menu-toggle { display: none; }
@media (min-width: 901px) {
    .menu-toggle {
        display: block; position: fixed; top: 10px; left: calc(var(--side-w) - 44px); z-index: 40;
        width: 34px; height: 34px; border: 0; border-radius: 6px; cursor: pointer;
        background: #2c3036; color: #fff; font-size: 18px; line-height: 34px; padding: 0;
        transition: left .2s ease;
    }
    .menu-toggle:hover { background: var(--kraft); }
    .brand { padding-right: 52px; }                                  /* room for the button */
    body.menu-min .sidebar { transform: translateX(-100%); }
    body.menu-min .content { margin-left: 0; padding-left: 60px; max-width: none; }
    body.menu-min .menu-toggle { left: 10px; background: var(--side); }
    .content { transition: margin-left .2s ease; }
}
@media print { .menu-toggle { display: none !important; } }

/* ---- Sales Bill picker: pending SO line of the chosen paper; Un-Approved SO rows greyed */
.pending-info { margin: 4px 0 10px; padding: 8px 12px; background: #fff7e6; border: 1px solid #f0d9a8; border-radius: 6px; font-size: 13px; }
tr.row-off td { color: #9a9a9a; background: #f6f6f6; }
.line-grid input.l-po { min-width: 110px; }
.line-grid input.l-podate { min-width: 130px; }
.move-grid td.amt-col { color: #5a4630; }                         /* From-To stock: value columns */
.tick-col { width: 34px; text-align: center; }                    /* list tick boxes (print selected) */
.print-many { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* ---- Save popup with the return number (Purchase / Sales Return) */
.modal-box.no-box { max-width: 460px; }
.no-row { display: flex; align-items: center; gap: 8px; }
.no-row input { max-width: 140px; font-size: 18px; font-weight: 600; }
.no-pfx, .no-fy { font-weight: 600; color: var(--muted); }
.no-full { margin: 10px 0 4px; }
.no-status { min-height: 22px; margin-bottom: 8px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }                    /* e.g. Save in the return-number popup while the number is taken */

/* ---- SO / PO Status Report: click a line to open its deliveries / receipts */
.badge-info { background: #e8f0fb; color: #1d4f91; }
.track-grid tr.track-row { cursor: pointer; }
.track-grid tr.track-row:hover td { background: #faf6f0; }
.track-grid tr.track-detail > td { background: #fbfaf7; padding: 6px 10px 12px 40px; }
.sub-grid { font-size: 13px; }
.sub-grid th { background: #f1ede6; }
.sub-grid tr.move-return td { color: #b54708; }
@media print { .track-grid tr.track-detail[hidden] { display: none; } }
.rec-grid tr.rec-line td { background: #f6f1e9; border-top: 2px solid #e4dccf; }   /* PO / SO page: line heading above its receipts */

/* ---- Purchase Entry: other charges (Freight, Loading, Packing, Insurance ...) */
.charge-grid select.chg-sel { min-width: 170px; }
.charge-grid select.basis-sel { min-width: 120px; }
.charge-grid input.chg-amt.typed { background: #fff7e6; border-color: #e0a84a; }   /* amount typed (not rate x base) */
.charge-grid input:disabled { background: #f1ede6; }
.link-btn { background: none; border: 0; padding: 2px 4px; color: #1d5fa8; text-decoration: underline; cursor: pointer; font-size: 12px; }
.link-btn[hidden] { display: none; }
.chg-row td { color: #4a3f30; }                        /* details / print: charge lines under the paper lines */
.cash-box { margin-top: 12px; padding-top: 10px; border-top: 1px dashed #d8cfc0; }   /* cash paid / received outside the bill */
.cash-title { font-size: 15px; margin: 4px 0 8px; }                   /* "Cash paid outside the bill" heading */
.cash-box .totals { margin-top: 6px; }

/* ---------------- Searchable dropdown panel (Scripts/select-search.js) - used by every <select> ---------------- */
select:not([multiple]) { cursor: pointer; }
.ss-panel { position: fixed; z-index: 3000; background: #fff; border: 1px solid #cfcac2; border-radius: 8px;
    box-shadow: 0 8px 28px rgba(0,0,0,.18); display: flex; flex-direction: column; max-height: 380px; overflow: hidden; }
.ss-panel[hidden] { display: none; }
.ss-head { display: flex; gap: 6px; padding: 8px; border-bottom: 1px solid var(--line); background: #faf8f5; }
.ss-head .ss-input { flex: 1; padding: 8px 10px; font-size: 15px; }
.ss-close { border: 0; background: none; font-size: 22px; line-height: 1; padding: 0 6px; color: var(--muted); cursor: pointer; display: none; }
.ss-list { overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.ss-opt { padding: 8px 12px; font-size: 14px; cursor: pointer; border-bottom: 1px solid #f3f0eb; }
.ss-opt b { color: var(--kraft-dark); }                                /* typed words in bold */
.ss-opt.ss-act { background: #f4ebe0; }                               /* keyboard / mouse highlight */
.ss-opt.ss-sel { font-weight: 600; }                                  /* current value */
.ss-opt.ss-sel::after { content: "  \2713"; color: var(--kraft); }
.ss-opt.ss-empty { color: var(--muted); }                             /* "-- Select --" row */
.ss-opt.ss-dis { color: #aaa; cursor: not-allowed; }
.ss-grp { color: var(--muted); }
.ss-none { padding: 12px; color: var(--muted); font-size: 14px; }
.ss-info { padding: 6px 12px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); background: #faf8f5; }
.ss-info[hidden] { display: none; }
@media (hover: hover) { .ss-opt:hover { background: #f8f1e8; } }
/* mobile / tablet narrow screen: full-screen sheet with big rows for fingers */
.ss-panel.ss-mobile { left: 0; right: 0; top: 0; bottom: 0; width: auto; max-height: none; border-radius: 0; border: 0; }
.ss-panel.ss-mobile .ss-head { padding: 10px; }
.ss-panel.ss-mobile .ss-input { font-size: 16px; padding: 11px 12px; }   /* 16px: phone does not zoom in */
.ss-panel.ss-mobile .ss-close { display: block; }
.ss-panel.ss-mobile .ss-opt { padding: 14px 14px; font-size: 16px; }

/* ---------------- Excel-style header filter / sort (Scripts/table-filter.js) - tables with data-tf ---------------- */
table[data-tf] tbody tr[hidden] { display: none !important; }        /* filtered-out rows (also in mobile card view) */
.tf-th { white-space: nowrap; }
.tf-th .tf-name { cursor: pointer; user-select: none; }
.tf-th .tf-name:hover { text-decoration: underline; }
.tf-arrow { font-size: 10px; margin-left: 2px; color: var(--kraft); }
.tf-btn { border: 1px solid transparent; background: none; cursor: pointer; padding: 0 4px; margin-left: 2px; font-size: 13px; color: var(--muted); border-radius: 4px; line-height: 1.4; }
.tf-btn:hover { border-color: #d8cfc0; background: #fff; }
.tf-th.tf-on { background: #f4e6d4; }                                 /* column has a filter on */
.tf-th.tf-on .tf-btn { color: #fff; background: var(--kraft); }
.tf-bar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 4px 0 6px; min-height: 0; }
.tf-bar .tf-open { display: none; }                                   /* PC: filters are on the headers */
.tf-chip { display: inline-flex; align-items: center; gap: 4px; background: #f4ebe0; border: 1px solid #e3d3bf; border-radius: 14px; padding: 2px 4px 2px 10px; font-size: 13px; }
.tf-chip button { border: 0; background: none; cursor: pointer; font-size: 16px; line-height: 1; color: var(--muted); padding: 0 4px; }
.tf-clear { border: 0; background: none; color: #1d5fa8; text-decoration: underline; cursor: pointer; font-size: 13px; }
.tf-panel { position: fixed; z-index: 3000; width: 290px; max-height: 420px; display: flex; flex-direction: column; background: #fff; border: 1px solid #cfcac2;
    border-radius: 8px; box-shadow: 0 8px 28px rgba(0,0,0,.18); font-size: 14px; font-weight: normal; text-align: left; }
.tf-panel[hidden] { display: none; }
.tf-head { display: flex; align-items: center; gap: 6px; padding: 8px 10px; border-bottom: 1px solid var(--line); background: #faf8f5; }
.tf-head b { flex: 1; }
.tf-close, .tf-back { border: 0; background: none; font-size: 20px; line-height: 1; cursor: pointer; color: var(--muted); padding: 0 4px; }
.tf-head .tf-close { font-size: 22px; }
.tf-sort { display: flex; gap: 6px; padding: 8px 10px 0; }
.tf-sort .btn { flex: 1; font-size: 12px; }
.tf-sort .btn.tf-act { background: var(--kraft); color: #fff; border-color: var(--kraft); }
.tf-body { padding: 8px 10px; overflow: auto; flex: 1; }
.tf-body input[type=search], .tf-body input[type=number] { width: 100%; }
.tf-links { margin: 6px 0; font-size: 13px; }
.tf-links a { margin-right: 10px; }
.tf-list { max-height: 230px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.tf-item { display: flex; align-items: center; gap: 8px; padding: 5px 2px; cursor: pointer; border-bottom: 1px solid #f3f0eb; }
.tf-item span { flex: 1; }
.tf-item small { color: var(--muted); }
.tf-range { display: flex; gap: 8px; }
.tf-range label { flex: 1; font-size: 13px; color: var(--muted); }
.tf-foot { display: flex; justify-content: space-between; gap: 6px; padding: 8px 10px; border-top: 1px solid var(--line); background: #faf8f5; }
.tf-cols { overflow: auto; }
.tf-col { display: flex; width: 100%; justify-content: space-between; border: 0; border-bottom: 1px solid #f3f0eb; background: #fff; padding: 14px; font-size: 16px; text-align: left; cursor: pointer; }
.tf-col.tf-on { font-weight: 600; color: var(--kraft-dark); }
@media (max-width: 640px) {
    .tf-bar .tf-open { display: inline-block; }                       /* mobile: cards have no headers -> Filter / Sort button */
    .tf-panel.tf-mobile { left: 0 !important; right: 0; top: 0 !important; bottom: 0; width: auto; max-height: none; border-radius: 0; border: 0; }
    .tf-panel.tf-mobile .tf-list { max-height: none; }
    .tf-panel.tf-mobile .tf-item { padding: 12px 4px; font-size: 16px; }
    .tf-panel.tf-mobile input { font-size: 16px; }
}

/* ---- Sales Return: one grid (tick = comes back; KG / reason in the same row) */
.ret-grid tbody tr.tk td { background: #fbf4ea; }                     /* ticked = on this return */
.ret-grid tbody tr:not(.tk) input:disabled { background: #f3f1ed; border-color: #e6e1d8; }
.ret-grid .p-kg { width: 92px; }
.ret-grid .p-reason { min-width: 170px; width: 100%; }
.ret-grid tbody tr.found td { background: #fff0b3 !important; transition: background .4s; }   /* row found by reel no. */
table.only-ticked tbody tr:not(.tk) { display: none !important; }    /* "Show only ticked" */
.inline-pair { display: flex; gap: 6px; }
.inline-pair input { flex: 1; min-width: 0; }
.part-tag[hidden] { display: none !important; }                     /* "part" tag only when part of the reel / lot comes back */

/* ---- Left menu search box (dark, same look as the menu) */
.nav-search { padding: 10px 14px 4px; position: sticky; top: 0; background: var(--side); z-index: 2; }
.nav-search input { background: #2c3036; border: 1px solid #3b4047; color: #fff; font-size: 14px; padding: 7px 10px; border-radius: 6px; }
.nav-search input::placeholder { color: #8a8f96; }
.nav-search input:focus { border-color: var(--kraft); box-shadow: none; background: #33373d; }
.nav-none { color: #8a8f96; font-size: 13px; padding: 10px 18px; }
.nav-none[hidden], .sidebar .nav-link[hidden], .sidebar .nav-group[hidden] { display: none; }
.nav-link mark { background: none; color: #f0c48a; font-weight: 600; }   /* typed words in the menu */
.nav-link.nav-hit { background: #2c3036; color: #fff; }                  /* Enter opens this one */

/* ---- Company Master: letterhead style, ISO table, API box */
.radio-list { display: flex; flex-direction: column; gap: 6px; }
.letterhead-preview { display: block; max-width: 100%; max-height: 90px; border: 1px solid var(--line); margin: 6px 0; background: #fff; }
.iso-grid input[type=text], .iso-grid input[type=date] { min-width: 120px; }
.iso-grid .iso-rev { max-width: 90px; }
.iso-help { padding: 8px 14px; margin: 0; }
.api-box { border-left: 4px solid #c26ad3; }                         /* e-invoice API settings stand out */

/* ---- Number prefix editable dropdown (Sales Invoice / Sales Return) ---- */
.pfx-wrap { position: relative; }
.pfx-wrap input.prefix-box { text-transform: uppercase; font-weight: 600; letter-spacing: 1px; }
.pfx-list { position: absolute; left: 0; right: 0; top: 100%; z-index: 2500; background: #fff; border: 1px solid #cfcac2;
            border-radius: 6px; box-shadow: 0 6px 18px rgba(0,0,0,.12); max-height: 220px; overflow-y: auto; }
.pfx-list[hidden] { display: none; }
.pfx-opt { padding: 9px 12px; cursor: pointer; font-weight: 600; border-bottom: 1px solid #f3f0eb; }
.pfx-opt.pfx-act, .pfx-opt:hover { background: #f4ebe0; }
.pfx-opt.pfx-sel::after { content: "  \2713"; color: var(--kraft); }
.pfx-none { padding: 9px 12px; color: var(--muted); font-size: 13px; }
.pfx-hint { display: block; color: var(--kraft-dark); font-size: 12px; min-height: 0; }

/* ---- Accordion left menu: group heading = button, its links open below; one group open at a time ---- */
.nav-sec { border-bottom: 1px solid #2c3036; }
.nav-sec[hidden] { display: none; }
button.nav-group { display: flex; width: 100%; align-items: center; justify-content: space-between; background: none; border: 0;
                   cursor: pointer; text-align: left; font-family: inherit; padding: 13px 18px; font-size: 12px; color: #aeb3ba; }
button.nav-group::after { content: "\25B8"; font-size: 12px; transition: transform .15s; color: #6f747b; }   /* ▸ closed */
.nav-sec.open > button.nav-group { color: #fff; }
.nav-sec.open > button.nav-group::after { transform: rotate(90deg); color: var(--kraft); }                   /* ▾ open */
button.nav-group:hover { color: #fff; background: #2c3036; }
.nav-items { display: none; padding-bottom: 6px; }
.nav-sec.open > .nav-items, .sidebar.nav-searching .nav-items { display: block; }
.nav-items .nav-link { padding-left: 26px; font-size: 14px; }
.nav-link.nav-reports { font-weight: 600; }

/* ---- footer on every page: Oasys Technology ---- */
.app-footer { margin-top: 36px; padding: 14px 0 6px; border-top: 1px solid var(--line); text-align: center; font-size: 12px; }
.app-footer a { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); text-decoration: none; }
.app-footer a:hover { color: var(--kraft-dark); }
.app-footer a:hover b { text-decoration: underline; }
.app-footer img { border-radius: 50%; }

/* ---- Reports page: cards by group + search ---- */
.rep-search { max-width: 420px; margin-bottom: 14px; }
.rep-group h2 { font-size: 15px; margin: 18px 0 8px; color: var(--kraft-dark); text-transform: uppercase; letter-spacing: .05em; }
.rep-group[hidden], .rep-card[hidden] { display: none; }
.rep-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.rep-card { display: block; padding: 14px 16px; background: #fff; border: 1px solid var(--line); border-radius: 8px; text-decoration: none;
            color: inherit; transition: border-color .15s, box-shadow .15s; }
.rep-card:hover, .rep-card:focus { border-color: var(--kraft); box-shadow: 0 3px 10px rgba(0,0,0,.06); outline: none; }
.rep-card b { display: block; color: var(--text, #222); margin-bottom: 4px; }
.rep-card small { color: var(--muted); line-height: 1.35; }
.rep-none { color: var(--muted); padding: 12px 0; }

/* ---- Pending E-Invoice / E-Way Bill screen ---- */
.einv-bar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin: 0 0 10px; }
.warn-txt { color: #b54708; font-weight: 600; }
.d-block { display: block; }
tr.row-done td { background: #f2faf5; }
.mono { font-family: Consolas, monospace; }
.inline-form { display: inline; }
details.einv-cancel, details.einv-manual { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
details.einv-cancel > summary, details.einv-manual > summary { cursor: pointer; font-weight: 600; padding: 4px 0; }
details.einv-cancel > summary { color: var(--err); }
details.einv-cancel form, details.einv-manual form { margin-top: 10px; }
.einv-status { margin-bottom: 10px; }

/* ---- Sales Bill: Direct Sale (whole purchase entry) ---- */
details.direct-sale { margin: 0 0 14px; padding: 10px 12px; border: 1px dashed #d9c7b0; border-radius: 8px; background: #fffaf3; }
details.direct-sale > summary { cursor: pointer; font-weight: 600; color: var(--kraft-dark); }
details.direct-sale .form { margin-top: 10px; }

/* keep the box being typed in clear of the fixed bottom bar (Save / Approve) and the top bar on phones */
html { scroll-padding-bottom: 100px; scroll-padding-top: 70px; }

/* ---- PO: Delivery At (our godown / direct to customer) - boxes of the other choice are hidden */
.form .field[hidden] { display: none; }
/* ---- PO line: last PO rate of this supplier under the item */
.last-rate { display: block; font-size: 11px; color: #6b6358; margin-top: 3px; line-height: 1.3; }
.line-grid tr.dup-line td { background: #fdecea; }

/* ---- Rate Revision: party tick list + change boxes */
.rr-party-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.rr-party-tools input[type=search] { flex: 1 1 220px; max-width: 360px; }
.rr-party-list { max-height: 260px; overflow-y: auto; border: 1px solid #e3ded5; border-radius: 6px; padding: 6px 10px;
                 display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 2px 16px; background: #fff; }
.rr-party-list label.check { margin: 2px 0; }
.rr-pair { display: flex; gap: 8px; }
.rr-pair select { flex: 0 0 auto; width: auto; }
.rr-pair input { flex: 1 1 100px; min-width: 0; }
.field[hidden] { display: none; }

.rr-say { display: block; font-size: 15px; color: #0f7a3c; }        /* plain-words change line (green = increase) */
.rr-say.down { color: #b42318; }                                     /* red = decrease */
.rr-up { display: block; color: #0f7a3c; font-size: 11px; }          /* preview: increase */
.rr-down { display: block; color: #b42318; font-size: 11px; }        /* preview: decrease */

/* =====================================================================
   MODULE COLOURS - Purchase = navy, Sales = purple, Stock = kraft, Masters / Admin = grey
   body gets mod-purchase / mod-sales / mod-stock / mod-masters (from _Layout); prints are not affected
   ===================================================================== */
body { --mod: var(--kraft); --mod-dark: var(--kraft-dark); --mod-tint: #faf8f5; }
body.mod-purchase { --mod: #0C447C; --mod-dark: #042C53; --mod-tint: #E6F1FB; }
body.mod-sales    { --mod: #534AB7; --mod-dark: #3C3489; --mod-tint: #EEEDFE; }
body.mod-stock    { --mod: #9a6a3a; --mod-dark: #7b5129; --mod-tint: #f6efe6; }
body.mod-masters  { --mod: #0F6E6E; --mod-dark: #0A4F4F; --mod-tint: #E3F2F1; }   /* teal (was grey: Save looked disabled) */
.mod-strip { background: var(--mod); color: #fff; font-size: 11px; font-weight: 600; letter-spacing: .14em; padding: 5px 12px; border-radius: 6px; margin-bottom: 12px; }
.page-head h1 { border-left: 5px solid var(--mod); padding-left: 10px; }
.grid th { background: var(--mod-tint); color: var(--mod-dark); }
.card h2, .card > .lines-head h2 { color: var(--mod-dark); }
.btn-primary { background: var(--mod); border-color: var(--mod); }
.btn-primary:hover { background: var(--mod-dark); border-color: var(--mod-dark); }

/* ---- left menu: each group in its own colour (lighter shades, readable on the dark menu) */
.nav-sec[data-sec=purchase]  { --mc: #85B7EB; }
.nav-sec[data-sec=sales]     { --mc: #AFA9EC; }
.nav-sec[data-sec=inventory] { --mc: #E0B07A; }
.nav-sec[data-sec=masters], .nav-sec[data-sec=admin] { --mc: #6CC3BE; }   /* teal, lighter on the dark menu */
.nav-sec > button.nav-group { border-left: 3px solid var(--mc, transparent); }
.nav-sec.open > button.nav-group { color: var(--mc, #fff); }
.nav-sec.open > button.nav-group::after { color: var(--mc, var(--kraft)); }
.nav-sec .nav-link.active { border-left-color: var(--mc, var(--kraft)); color: #fff; }
.nav-sec .nav-link:hover { border-left-color: var(--mc, var(--kraft)); }

/* ---- SO line "Stock" popup */
.line-grid .stock-btn { margin-top: 4px; display: block; }
.st-sum { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 10px; }
.st-sum > div { background: #f6f4f0; border-radius: 8px; padding: 10px 12px; }
.st-sum span { display: block; font-size: 12px; color: var(--muted); }
.st-sum b { display: block; font-size: 18px; }
.st-sum small { display: block; font-size: 12px; color: var(--muted); }
.st-sum .ok { background: #e7f5ee; } .st-sum .ok b { color: var(--ok); }
.st-sum .part { background: #fff4e5; } .st-sum .part b { color: #b54708; }
.st-sum .none { background: #fdecea; } .st-sum .none b { color: var(--err); }
.modal-box h4 { margin: 14px 0 6px; font-size: 14px; }

/* ---- Sales Bill stock picker window */
.pick-box { max-width: 1100px; display: flex; flex-direction: column; }
.pick-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.pick-top h3 { margin: 0; }
.pick-godown { min-width: 220px; margin: 0; }
.pick-box .stock-scroll { max-height: 55vh; overflow: auto; }
.pick-foot { position: sticky; bottom: -18px; background: var(--card); border-top: 1px solid var(--line); padding: 10px 0 0; margin-top: 10px;
             display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.pick-btns { display: flex; gap: 8px; }
.pick-ask { width: 100%; background: #fff4e5; border: 1px solid #f5c98b; border-radius: 6px; padding: 10px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pick-ask[hidden] { display: none; }
body.modal-open { overflow: hidden; }                                    /* page behind does not scroll */
@media (max-width: 640px) {
    .pick-modal { padding: 0; }
    .pick-box { max-width: none; max-height: none; height: 100%; border-radius: 0; }
    .pick-box .stock-scroll { max-height: none; flex: 1; }
}

.rate-from { display: block; font-size: 11px; }                        /* Sales Bill: where the sale rate came from */

/* ---- Back Date stock report: one colour per column group (heading + Sheets / KG / Amount below it) */
.move-grid th.mg-c0, .move-grid td.mg-c0 { background: #E6F1FB; }  .move-grid thead th.mg-c0 { background: #B5D4F4; color: #0C447C; }   /* Opening */
.move-grid th.mg-c1, .move-grid td.mg-c1 { background: #EAF3DE; }  .move-grid thead th.mg-c1 { background: #C0DD97; color: #27500A; }   /* Inward */
.move-grid th.mg-c2, .move-grid td.mg-c2 { background: #E1F5EE; }  .move-grid thead th.mg-c2 { background: #9FE1CB; color: #085041; }   /* Modification + */
.move-grid th.mg-c3, .move-grid td.mg-c3 { background: #FAEEDA; }  .move-grid thead th.mg-c3 { background: #FAC775; color: #633806; }   /* Modification - */
.move-grid th.mg-c4, .move-grid td.mg-c4 { background: #FAECE7; }  .move-grid thead th.mg-c4 { background: #F5C4B3; color: #712B13; }   /* Purchase Return */
.move-grid th.mg-c5, .move-grid td.mg-c5 { background: #EEEDFE; }  .move-grid thead th.mg-c5 { background: #CECBF6; color: #3C3489; }   /* Sales */
.move-grid th.mg-c6, .move-grid td.mg-c6 { background: #FCEBEB; }  .move-grid thead th.mg-c6 { background: #F7C1C1; color: #791F1F; }   /* Discard */
.move-grid th.mg-c7, .move-grid td.mg-c7 { background: #E0F3F7; }  .move-grid thead th.mg-c7 { background: #8FD0DE; color: #0B4F5C; }   /* Sales Return: cyan (was pink, too close to Discard red) */
.move-grid th.mg-c8, .move-grid td.mg-c8 { background: #F1EFE8; }  .move-grid thead th.mg-c8 { background: #D3D1C7; color: #2C2C2A; }   /* Closing Stock */
.move-grid thead tr + tr th { filter: brightness(1.06); }              /* Sheets / KG / Amount row a shade lighter than the group name */
.move-grid .mg-first { border-left: 2px solid #8a8780; }               /* line where each group starts */

/* ---- PO: Billing Rate column only on a PO direct to a customer */
table.no-bill .bill-col { display: none !important; }   /* also on the phone cards (they force td display) */

/* ---- hint text inside boxes: very light + italic so it never looks like a typed value */
input::placeholder, textarea::placeholder { color: #c4c8ce; opacity: 1; font-style: italic; }
input::-webkit-input-placeholder, textarea::-webkit-input-placeholder { color: #c4c8ce; font-style: italic; }   /* older Chrome / Android */
.nav-search input::placeholder { color: #8a8f96; font-style: normal; }   /* menu search on dark menu stays readable */

/* =====================================================================
   COMPACT LAYOUT (2026-11-04): less vertical space on every page = less scrolling.
   Only spacing / padding is reduced here; colours and layout stay the same.
   To go back to the old roomy look, delete this whole block.
   ===================================================================== */
.content { padding-top: 14px; padding-bottom: 24px; }                    /* page top / bottom gap */
.mod-strip { padding: 3px 10px; margin-bottom: 8px; font-size: 10px; }  /* PURCHASE / SALES strip */
.page-head { margin-bottom: 10px; }                                      /* title row */
h1 { font-size: 20px; }
h2 { margin-bottom: 4px; font-size: 16px; }
.card { padding: 12px 14px; margin-bottom: 10px; }                       /* white boxes */
.card.empty { padding: 18px; }
.alert, .alert-err, .validation-summary-errors { padding: 7px 12px; margin-bottom: 10px; }   /* messages */
.form { gap: 8px 16px; }                                                 /* space between boxes in a form */
.field label, .filters .field label { margin-bottom: 2px; font-size: 12.5px; }   /* label right above its box */
input[type=text], input[type=password], input[type=number], input[type=search], input[type=email],
input[type=date], input[type=datetime-local], input[type=tel], select, textarea { padding: 6px 9px; font-size: 14px; }   /* boxes ~32px high */
.btn { padding: 6px 12px; }
.btn-sm { padding: 4px 9px; }
.segmented { margin-bottom: 0; }
.segmented label { padding: 6px 12px; }
.form-actions { padding-top: 0; }
.searchbar, .add-rows { margin-bottom: 8px; }
.filters { gap: 8px; }
.grid th { padding: 7px 10px; }                                          /* list headers */
.grid td { padding: 6px 10px; }                                          /* list rows */
.line-grid td { padding: 3px 4px; }                                      /* entry lines (PO / SO / bill) */
.lines-head { margin-bottom: 6px; }
.section-title { margin: 10px 0 4px; }
.info-grid { gap: 6px 18px; }                                            /* view pages */
.totals { padding-top: 8px; gap: 8px 24px; }
.tiles { gap: 10px; }
.tile { padding: 12px 14px; }
.field-validation-error { margin-top: 2px; }

@media (max-width: 900px) {
    .content { padding: 10px 12px 20px; }                               /* tablet / mobile page gap */
}
@media (max-width: 640px) {
    .grid tr { padding: 4px 2px; }                                       /* phone: list row cards */
    .grid td { padding: 2px 10px; }
    input[type=text], input[type=password], input[type=number], input[type=search], input[type=email],
    input[type=date], input[type=datetime-local], input[type=tel], select, textarea { padding: 8px 9px; font-size: 16px; }   /* phone: 16px stops zoom-in, still easy to tap */
    .btn { padding: 8px 12px; }                                          /* phone: touch-friendly buttons */
}

/* =====================================================================
   SMART FORM GRID (2026-11-04) - add class "g12" to a ".form" card.
   PC: 12 parts per row; each box takes only the space it needs:
       c2 = small (PIN, GST %, state code), c3, c4, c5, c6 = half, c8, c9, c12 = full row.
   Mobile (below 760px): 6 parts per row: m2 = one third, m3 = half, m4 = two thirds, m6 = full row.
   A box with no c / m class takes half a row on PC (one third in "form3") and the full row on mobile.
   ===================================================================== */
.form.g12 { grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 8px 14px; }
.form.g12 > * { grid-column: 1 / -1; }                                   /* headings, notes, buttons: full row */
.form.g12 > .field { grid-column: span 6; }                              /* default box = half row */
.form.form3.g12 > .field { grid-column: span 4; }                        /* default box in 3-column forms = one third */
.form.g12 > .field.span2 { grid-column: span 8; }
.form.g12 > .field.full { grid-column: 1 / -1; }
.form.g12 > .field.c2 { grid-column: span 2; }
.form.g12 > .field.c3 { grid-column: span 3; }
.form.g12 > .field.c4 { grid-column: span 4; }
.form.g12 > .field.c5 { grid-column: span 5; }
.form.g12 > .field.c6 { grid-column: span 6; }
.form.g12 > .field.c8 { grid-column: span 8; }
.form.g12 > .field.c9 { grid-column: span 9; }
.form.g12 > .field.c12 { grid-column: 1 / -1; }
.form.g12 > .f-last { order: 99; }                                       /* e.g. "Active" tick always at the end */
.form.g12 .field label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }   /* label never pushes boxes out of line */
.form.g12 .field label.check { white-space: normal; }                    /* tick-box text may wrap */
@media (max-width: 760px) {
    .form.g12 { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px 10px; }
    .form.g12 > .field, .form.form3.g12 > .field, .form.g12 > .field.span2 { grid-column: 1 / -1; }   /* default: full row on mobile */
    .form.g12 > .field.m2 { grid-column: span 2; }
    .form.g12 > .field.m3 { grid-column: span 3; }
    .form.g12 > .field.m4 { grid-column: span 4; }
    .form.g12 > .field.m6 { grid-column: 1 / -1; }
    .form.g12 > .field.m12 { grid-column: 1 / -1; }                       /* full row on mobile even when c3 / c4 on PC */
    .form.g12 .segmented { display: flex; }                              /* option buttons share the width */
    .form.g12 .segmented label { flex: 1; justify-content: center; }
}

/* =====================================================================
   SIZE IN 3 UNITS (2026-11-04): Inch | CM | MM columns on Purchase Entry (Scripts/size3.js)
   ===================================================================== */
th.szh { text-align: center; }                                           /* Inch / CM / MM headings */
.szc { white-space: nowrap; }
.line-grid .szc input.sz-box { width: 84px; min-width: 0; text-align: right; }
.sz-row { display: flex; align-items: center; gap: 3px; }                 /* sheet: W over L */
.sz-row + .sz-row { margin-top: 3px; }
.sz-l { font-size: 11px; color: var(--muted); width: 10px; }
input.sz-box.sz-main { border-color: var(--mod); background: #eef4fb; font-weight: 600; }   /* the purchased unit */
input.sz-box.sz-po { background: #eef2f6; }                               /* filled from the PO: locked */
input.sz-box.bad { border-color: var(--err); background: #fdecea; }       /* more than one last digit off */
.sz-na { color: var(--muted); display: inline-block; width: 84px; text-align: center; }   /* direct delivery: unit not needed */
.sz-na[hidden] { display: none; }
.sz-note { display: block; max-width: 300px; white-space: normal; }
.p-size { white-space: nowrap; }
.fill-box { max-width: 1100px; }                                          /* Fill from PO popup */
@media (max-width: 640px) {
    .sz3-grid tbody tr { display: flex !important; flex-wrap: wrap; }      /* phone: Inch / CM / MM side by side */
    .sz3-grid tbody td { flex: 0 0 100%; }
    .sz3-grid tbody td.szc { flex: 0 0 33.33%; flex-direction: column; align-items: stretch; justify-content: flex-start; padding: 2px 4px; text-align: center; }
    .sz3-grid tbody td.szc::before { text-align: center; font-weight: 600; font-size: 12px; }
    .sz3-grid .szc input.sz-box { width: 100%; font-size: 16px; }
    .sz3-grid .sz-row { width: 100%; }
    .sz3-grid .sz-row input.sz-box { flex: 1; }
    .sz-na { width: auto; }
}
/* Fill from PO: PO heading rows (tick = whole PO) and their lines */
.fill-grid tr.po-head td { background: #e9f0f8; border-top: 2px solid #c7d6e8; }
.fill-grid tr.po-head .muted { font-weight: 400; }
.fill-grid tr.po-line td:nth-child(2) { padding-left: 28px; }
.fill-grid .po-cnt { font-size: 12px; color: var(--mod-dark); font-weight: 600; }
@media (max-width: 640px) { .fill-grid tr.po-line td:nth-child(2) { padding-left: 12px; } }
/* Sales Return: direct-delivery reel coming into our godown - missing sizes */
.ret-size { margin-top: 4px; display: block; }                         /* label line, then the size grid under it */
.ret-size > small { display: block; }
.ret-sz { font-size: 12px; white-space: nowrap; }
.ret-sz input.p-sz { width: 76px; padding: 4px 6px; }
.btn-locked { opacity: .6; }                                              /* locked action: tap explains why */

/* ---- Purchase Entry invoice lines: information behind ▸ (detail row under the line) */
.more-btn { border: 1px solid var(--line); background: #fff; border-radius: 6px; width: 30px; height: 30px; font-size: 14px; cursor: pointer; color: var(--mod); padding: 0; }
.more-btn.on { background: var(--mod); color: #fff; border-color: var(--mod); }
.more-btn.bad { border-color: var(--err); color: var(--err); background: #fdecea; }   /* problem inside the details */
.more-btn.on.bad { background: var(--err); color: #fff; }
.line-grid tr.det td { background: #f6f9fd; border-top: 0; }
.det-grid { display: flex; flex-wrap: wrap; gap: 6px 26px; padding: 4px 6px 6px 36px; font-size: 13.5px; }
.det-grid > div > span { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.det-grid b { font-weight: 600; }
.sz3-grid td.szc .sz-note:empty, .sz-note:empty { display: none; }
@media (max-width: 640px) {
    .sz3-grid tbody tr.det { display: block !important; }
    .sz3-grid tbody tr.det[hidden] { display: none !important; }
    .sz3-grid tbody tr.det td { display: block; }
    .sz3-grid tbody tr.det td::before { content: none; }
    .det-grid { padding-left: 6px; }
    /* item / HSN: full width with the label above (whole item name visible) */
    .sz3-grid tbody td[data-label="Item"], .sz3-grid tbody td[data-label="Chapter / HSN"] { flex-direction: column; align-items: stretch; text-align: left; }
    .sz3-grid tbody td[data-label="Item"]::before, .sz3-grid tbody td[data-label="Chapter / HSN"]::before { margin-bottom: 3px; }
    .sz3-grid select.item-sel, .sz3-grid select.hsn-sel { width: 100% !important; min-width: 0; }
    .sz3-grid td .chk { flex-basis: 100%; text-align: right; }
    .sz3-grid tbody td { flex-wrap: wrap; }
}

/* ---- narrower line columns on the entry screens (PO, SO, Purchase, Sales Bill, Returns) - PC / tablet only */
@media (min-width: 641px) {
    .line-grid input[type=number] { width: 80px; }                       /* KG, rate, reels, size ... */
    .line-grid input[type=text] { min-width: 100px; }
    .line-grid select.item-sel, .line-grid .item-cell select { min-width: 210px; }   /* Quality / GSM / BF */
    .line-grid select.hsn-sel { min-width: 170px; }                       /* Chapter - HSN */
    .line-grid .szc input.sz-box { width: 72px; }                         /* Inch / CM / MM */
    .line-grid td { padding: 3px 3px; }
}

/* Select / Change PO (Purchase Entry) and Select / Change SO (Sales Bill): coloured so they stand out from white boxes */
.btn.po-btn, .btn.so-btn { background: var(--mod-tint); border-color: var(--mod); color: var(--mod-dark); font-weight: 600; }
.btn.po-btn:hover, .btn.so-btn:hover { background: var(--mod); color: #fff; }

/* Phone: the small check texts under a box ("Packing slip: 0 KG", "pending ... max ...") go on their own line,
   so they can never squeeze the box itself (Total KG box was squeezed to nothing on the Purchase Entry) */
@media (max-width: 640px) {
    .line-grid tbody td { flex-wrap: wrap; }
    .line-grid tbody td > .chk, .line-grid tbody td > small.chk { flex-basis: 100%; text-align: right; margin-top: 2px; }
    .line-grid tbody td > input[type=number], .line-grid tbody td > input[type=text] { flex: 0 0 55%; min-width: 0; }
}
@media (max-width: 640px) {
    .sz3-grid tbody td[data-label="Item"], .sz3-grid tbody td[data-label="Chapter / HSN"], .sz3-grid tbody td.szc { flex-wrap: nowrap; }   /* stacked cells: no gaps */
}
.btn.add-bottom { margin-top: 8px; }                                      /* "+ Add Line" repeated under the last line */
/* new entry: last number saved (for information - the new number is given on Save) */
.last-no { margin: -4px 0 8px; font-size: 13px; color: var(--muted); }

/* Phone cards (all grids / entry lines): the label sits in the MIDDLE of its box's height, not at the top */
@media (max-width: 640px) {
    .grid tbody td { align-items: center; }
    .grid tbody td::before { align-self: center; }
    .grid tbody td > .chk { align-self: auto; }                        /* check messages keep their own line */
}

/* =====================================================================
   PO / SO LINES ON A PHONE (2026-11-05): label ABOVE its box, two short boxes side by side,
   Item / HSN / Remarks full width, Amount / GST % as plain text, "Line 1, Line 2 ..." on top of each card.
   (PC keeps the normal table.)
   ===================================================================== */
@media (max-width: 640px) {
    table.m2col tbody { counter-reset: ln; }
    table.m2col tbody tr { display: grid !important; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px 10px;
                           padding: 10px 8px 12px; border-bottom: 6px solid var(--page); }
    table.m2col tbody tr::before { counter-increment: ln; content: "Line " counter(ln); grid-column: 1 / -1;
                                   font-weight: 700; font-size: 13px; color: var(--mod-dark); }        /* Line 1, Line 2 ... */
    table.m2col tbody td { display: block !important; width: auto !important; padding: 0 !important; border: 0 !important; text-align: left !important; }
    table.m2col tbody td::before { display: block; content: attr(data-label); font-size: 12px; color: var(--muted); margin: 0 0 3px; text-align: left; }
    table.m2col tbody td[data-label="Item"], table.m2col tbody td[data-label="Chapter / HSN"],
    table.m2col tbody td[data-label="Remarks"], table.m2col tbody td.actions { grid-column: 1 / -1; }   /* full width */
    table.m2col tbody td input, table.m2col tbody td select { width: 100% !important; min-width: 0 !important; }
    table.m2col tbody td.num { font-weight: 600; padding-top: 2px !important; }                      /* Amount / GST %: text, not a box */
    table.m2col tbody td .btn.stock-btn { width: 100%; margin-top: 4px; }                             /* SO: Check Stock under the unit */
    table.m2col tbody td.actions { text-align: right !important; }
    table.m2col tbody td.actions::before { content: none; }
    table.m2col tbody td small, table.m2col tbody td .chk { display: block; text-align: left; }
}

/* Purchase against PO: "Fill lines from PO" after the header - highlighted, module colour */
.fill-po-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.btn.fill-po-btn { background: var(--mod); border-color: var(--mod); color: #fff; font-weight: 700; font-size: 15px; padding: 9px 18px;
                   box-shadow: 0 0 0 4px var(--mod-tint), 0 2px 6px rgba(0,0,0,.18); }
.btn.fill-po-btn:hover { background: var(--mod-dark); }
.btn.fill-po-btn:disabled { box-shadow: none; }
@media (max-width: 640px) { .btn.fill-po-btn { width: 100%; } }

/* =====================================================================
   PURCHASE INVOICE LINES ON A PHONE (2026-11-05): same style as PO / SO lines -
   "Line 1, Line 2 ..." on top, label ABOVE its box, Item / HSN / PO full width,
   Inch | CM | MM three in one row, Reels | KG and Rate | Close PO two per row, Details | Remove at the bottom.
   (6-column grid: a span of 3 = half width, 2 = one third.) PC keeps the normal table.
   ===================================================================== */
@media (max-width: 640px) {
    table.pe2col tbody { counter-reset: ln; }
    table.pe2col tbody tr.inv-line { display: grid !important; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px 10px;
                                     padding: 10px 8px 12px; border-bottom: 6px solid var(--page); }
    table.pe2col tbody tr.inv-line::before { counter-increment: ln; content: "Line " counter(ln); grid-column: 1 / -1;
                                             font-weight: 700; font-size: 13px; color: var(--mod-dark); }      /* Line 1, Line 2 ... */
    table.pe2col tbody tr.inv-line > td { display: block !important; grid-column: span 3; width: auto !important; padding: 0 !important;
                                          border: 0 !important; text-align: left !important; }                 /* default: half width */
    table.pe2col tbody tr.inv-line > td::before { display: block; content: attr(data-label); font-size: 12px; color: var(--muted);
                                                  margin: 0 0 3px; text-align: left; font-weight: 400; }        /* label above the box */
    table.pe2col tbody tr.inv-line > td.ln { display: none !important; }                                      /* "#" replaced by "Line n" */
    table.pe2col tbody tr.inv-line > td[data-label="Item"],
    table.pe2col tbody tr.inv-line > td[data-label="Chapter / HSN"],
    table.pe2col tbody tr.inv-line > td.po-cell { grid-column: 1 / -1; }                                       /* full width */
    table.pe2col tbody tr.inv-line > td.szc { grid-column: span 2; text-align: center !important; }           /* Inch | CM | MM in one row */
    table.pe2col tbody tr.inv-line > td.szc::before { text-align: center; font-weight: 600; }
    table.pe2col tbody tr.inv-line > td.actions { grid-column: -4 / -1; align-self: end; text-align: right !important; } /* Remove: right half */
    table.pe2col tbody tr.inv-line > td.actions::before { content: none; }
    table.pe2col tbody tr.inv-line > td input:not([type=checkbox]),
    table.pe2col tbody tr.inv-line > td select { width: 100% !important; min-width: 0 !important; flex: none !important; }
    table.pe2col tbody tr.inv-line > td input[type=checkbox] { width: 22px; height: 22px; margin: 6px 0 0; }   /* Close PO tick */
    table.pe2col tbody tr.inv-line > td small, table.pe2col tbody tr.inv-line > td .chk { display: block; text-align: left !important;
                                                                                          margin-top: 2px; font-size: 12px; }  /* "Packing slip: 0 KG" under the box */
    table.pe2col tbody tr.inv-line > td.po-cell .po-btn { width: 100%; }                                      /* Select PO: full width */
    table.pe2col tbody tr.inv-line > td.po-cell .po-sum:not(:empty) { margin-top: 4px; font-size: 13px; }
    table.pe2col tbody tr.inv-line > td .sz-na { display: block; padding-top: 8px; }
    table.pe2col tbody tr.inv-line > td .sz-na[hidden] { display: none; }
    table.pe2col tbody tr.inv-line .sz-row { display: flex; align-items: center; gap: 3px; }                   /* sheet: W / L boxes */
    /* details row (▸) stays one block right under its line */
    table.pe2col tbody tr.det { margin-top: -6px; border-bottom: 6px solid var(--page); }
    table.pe2col tbody tr.det .det-grid > div { text-align: left; }                                           /* details read left to right */
}

/* Sales Bill "Sale From" (2026-11-05): the stock-picker card shows only the chosen way - never both */
#pickCard[data-mode="STOCK"] .direct-only, #pickCard[data-mode="DIRECT"] .stock-only { display: none !important; }
#pickCard .direct-sale { margin: 4px 0 0; }

/* PC: option buttons (Reel / Sheet, Sale From ...) never spill into the next box - they shrink to their cell */
@media (min-width: 761px) {
    .form.g12 .segmented { max-width: 100%; }
    .form.g12 .segmented label { white-space: nowrap; padding: 6px 10px; }
}

/* =====================================================================
   MASTER LISTS ON A PHONE (2026-11-05, Layout B): Customer, Supplier, Delivery Location, Godown, Paper, Transporter.
   Each row = a card: name big on top with the status chip at the right, details below with the label ABOVE the value,
   two per row (long ones like Address full width), Edit | Delete as two equal buttons at the bottom.
   PC keeps the normal table with the header filters (nothing changes there).
   ===================================================================== */
@media (max-width: 640px) {
    .table-card:has(> table.mcard), .table-card:has(table.mcard) { background: transparent; border: 0; padding: 0; }   /* cards sit on the page */
    table.mcard tbody tr { display: grid !important; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px 12px; position: relative;
                           background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px 12px 10px; margin: 0 0 10px;
                           grid-auto-flow: row dense; }   /* dense: a short box fills the gap next to another short one */
    table.mcard tbody tr[hidden] { display: none !important; }                                        /* rows hidden by a header filter */
    table.mcard tbody td { display: block !important; width: auto !important; padding: 0 !important; border: 0 !important;
                           text-align: left !important; font-size: 14px; min-width: 0; overflow-wrap: anywhere; }
    table.mcard tbody td::before { display: block; content: attr(data-label); font-size: 11.5px; color: var(--muted); margin: 0 0 1px; }   /* label above */
    /* name: full width, big, no label; room on the right for the status chip */
    table.mcard tbody td:first-child { grid-column: 1 / -1; font-size: 16px; padding-right: 76px !important; }
    table.mcard tbody td:first-child::before { content: none; }
    /* status chip: top-right corner of the card */
    table.mcard tbody td[data-label="Status"] { position: absolute; top: 12px; right: 12px; }
    table.mcard tbody td[data-label="Status"]::before { content: none; }
    /* long values: full width */
    table.mcard tbody td[data-label="Address"], table.mcard tbody td[data-label="Consignee"], table.mcard tbody td[data-label="Chapter"] { grid-column: 1 / -1; }
    /* Edit | Delete: two equal buttons */
    table.mcard tbody td.actions { grid-column: 1 / -1; display: flex !important; gap: 10px; margin-top: 4px; }
    table.mcard tbody td.actions::before { content: none; }
    table.mcard tbody td.actions > .btn, table.mcard tbody td.actions > form { flex: 1; margin: 0; }
    table.mcard tbody td.actions > form .btn { width: 100%; }
    table.mcard tbody td.actions .btn { text-align: center; justify-content: center; padding: 8px 10px; }
}
@media (max-width: 640px) {
    table.mcard tbody td:first-child .muted { display: block; font-size: 13px; font-weight: 400; margin-top: 1px; }   /* contact person / mobile under the name */
}

/* =====================================================================
   DETAIL (view) PAGES ON A PHONE (2026-11-05): same card style as the master lists. PC unchanged.
   .m2info  = header details two per row (.m-full = full width on the phone only)
   .dcard   = each table row a card: "Line n" on top, Item full width, label above value two per row, .m-hi = highlighted (Balance KG)
   ===================================================================== */
@media (max-width: 640px) {
    .info-grid.m2info { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important; gap: 8px 12px !important; }
    .info-grid.m2info .m-full, .info-grid.m2info .full { grid-column: 1 / -1; }
    .info-grid.m2info span { font-size: 11.5px; }
    .table-card:has(table.dcard) { background: transparent; border: 0; padding: 0; }                 /* cards sit on the page */
    table.dcard tbody tr { display: grid !important; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px 12px; grid-auto-flow: row dense;
                           background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin: 0 0 10px; }
    table.dcard tbody tr[hidden] { display: none !important; }
    table.dcard tbody td { display: block !important; width: auto !important; padding: 0 !important; border: 0 !important;
                           text-align: left !important; font-size: 14px; min-width: 0; overflow-wrap: anywhere; }
    table.dcard tbody td::before { display: block; content: attr(data-label); font-size: 11.5px; color: var(--muted); margin: 0 0 1px; }
    table.dcard tbody td[data-label="#"] { grid-column: 1 / -1; font-weight: 700; font-size: 13px; color: var(--mod-dark); }   /* Line 1, Line 2 ... */
    table.dcard tbody td[data-label="#"]::before { content: "Line"; display: inline; font-size: 13px; color: var(--mod-dark); margin-right: 4px; }
    table.dcard tbody td[data-label="Item"] { grid-column: 1 / -1; font-size: 15.5px; }                 /* item name full width, no label */
    table.dcard tbody td[data-label="Item"]::before { content: none; }
    table.dcard tbody td.m-hi { grid-column: 1 / -1; background: var(--mod-tint); border-radius: 6px; padding: 6px 8px !important; }   /* Balance KG */
    table.dcard.hide-rates tbody td.rate-col { display: none !important; }                          /* no "See Rates" right */
    /* buttons of a card (2026-11-13): full width row at the bottom, equal-width buttons, words never broken letter by letter */
    table.dcard tbody td.actions { grid-column: 1 / -1; display: flex !important; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
    table.dcard tbody td.actions::before { content: none; display: none; }
    table.dcard tbody td.actions > .btn, table.dcard tbody td.actions > form { flex: 1 1 0; margin: 0; white-space: nowrap; text-align: center; }
    table.dcard tbody td.actions > form .btn { width: 100%; }
}

/* a dropdown locked by the page (e.g. Purchase Entry Direct Delivery: item from the PO, godown): shown and saved, cannot be changed */
select[data-locked] { pointer-events: none; background: #f3f1ed; color: #555; }
.btn.po-btn:disabled { opacity: .55; cursor: not-allowed; }

/* =====================================================================
   PHONE LINE CARDS - clear separation (2026-11-05): every line is a framed card with a coloured left edge,
   a "Line n" header strip and a gap before the next card (PO / SO lines, Purchase invoice lines).
   ===================================================================== */
@media (max-width: 640px) {
    table.m2col tbody tr, table.pe2col tbody tr.inv-line {
        background: #fff; border: 1px solid #d9d4cb !important; border-left: 5px solid var(--mod) !important; border-radius: 10px;
        margin: 0 0 16px; padding: 0 10px 12px !important; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
    table.m2col tbody tr::before, table.pe2col tbody tr.inv-line::before {
        margin: 0 -10px 4px; padding: 6px 10px; background: var(--mod-tint); border-bottom: 1px solid #e3ded6;
        border-radius: 0 9px 0 0; font-size: 13.5px; }                                              /* "Line 1" header strip */
    /* Purchase: details row (▸) open -> it hangs under its card as part of it */
    table.pe2col tbody tr.inv-line:has(+ tr.det:not([hidden])) { margin-bottom: 0; border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
    table.pe2col tbody tr.det:not([hidden]) { display: block !important; margin: 0 0 16px !important; background: #f6f9fd;
        border: 1px solid #d9d4cb; border-top: 0; border-left: 5px solid var(--mod); border-radius: 0 0 10px 10px; }
    table.pe2col tbody tr.det td { background: transparent !important; }
    .line-grid.m2col, .line-grid.pe2col { background: transparent; }
}

/* busy screen while a form is being saved (site.js showBusy) */
.busy-layer { position: fixed; inset: 0; z-index: 9999; background: rgba(255,255,255,.65); display: flex; align-items: center; justify-content: center; }
.busy-layer[hidden] { display: none; }
.busy-box { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 22px 30px; box-shadow: 0 6px 24px rgba(0,0,0,.18);
            display: flex; flex-direction: column; align-items: center; gap: 12px; }
.busy-spin { width: 42px; height: 42px; border-radius: 50%; border: 4px solid var(--mod-tint); border-top-color: var(--mod); animation: busySpin .8s linear infinite; }
.busy-text { font-weight: 600; color: var(--mod-dark); }
@keyframes busySpin { to { transform: rotate(360deg); } }
@media print { .busy-layer { display: none !important; } }

/* =====================================================================
   PURCHASE ENTRY - INVOICE LINES AS CARDS (PC + phone, 2026-11-05)
   Heading strip: "Line n . item", size / HSN / PO, packing slip badge, ▸ details / ✎ change / ✕ remove.
   A complete line is FOLDED (class .folded): item / HSN / size boxes hidden, shown as text in the heading (the PO cell stays: pending KG + Change PO);
   only No. of Reels / Total KG / Rate / Amount / Close PO stay. A new or incomplete line is an orange card (.new-line).
   PC: 12-part grid. Phone: 6-part grid (size 3 in a row, Reels | KG | Rate in a row, Amount in ▸ details).
   ===================================================================== */
table.pecard, table.pkcard { display: block; width: 100%; min-width: 0 !important; }
table.pecard > tbody, table.pkcard > tbody { display: block; }
table.pecard > thead, table.pkcard > thead { display: none !important; }
/* line buttons with words + colour (2026-11-13: the small grey icons were hardly noticeable) - ▸ Details / ✎ Edit / ✕ Remove */
.ic { border: 1.5px solid #c7d6e8; background: #fff; border-radius: 7px; height: 34px; min-width: 34px; padding: 0 12px; font-size: 13.5px; font-weight: 600;
      color: var(--mod-dark); cursor: pointer; line-height: 1; white-space: nowrap; }
.ic.x { border-color: #e8a29b; color: var(--err, #b3261e); background: #fdecea; }                     /* ✕ Remove: light red */
.ic[hidden] { display: none; }
.lh-right .ic.more-btn { width: auto; border-color: var(--mod); color: var(--mod); background: #fff; padding: 0 12px; }   /* ▸ Details: outline */
.lh-right .ic.more-btn.on { background: var(--mod); color: #fff; }
.lh-right .ic.more-btn.bad { border-color: var(--err); color: var(--err); background: #fdecea; }        /* problem inside the details */
.lh-right .ic.more-btn.on.bad { background: var(--err); color: #fff; }
.lh-right .ic.edit-btn { background: #1f5fa8; border-color: #1f5fa8; color: #fff; }                   /* ✎ Edit / ✓ Done: the main action */
.ic.del-pack { padding: 0; width: 34px; font-size: 15px; }                                              /* packing slip row: ✕ only (narrow column) */
table.pecard tbody tr.inv-line { display: grid !important; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 8px 10px; align-items: start;
    background: #fff; border: 1px solid #d9d4cb !important; border-left: 5px solid var(--mod) !important; border-radius: 10px;
    margin: 0 0 14px; padding: 0 12px 12px !important; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
table.pecard tbody tr.inv-line::before { content: none !important; display: none !important; }
.hide-rates table.pecard tbody tr.inv-line > td.rate-col { display: none !important; }                 /* no "See Rates": rate / amount cells hidden in the line card too */
table.pecard tbody tr.inv-line > td { display: block !important; grid-column: span 2; width: auto !important; min-width: 0; padding: 0 !important;
    border: 0 !important; text-align: left !important; background: transparent !important; }
table.pecard tbody tr.inv-line > td::before { display: block; content: attr(data-label); font-size: 11.5px; color: var(--muted); margin: 0 0 2px;
    text-align: left; font-weight: 400; }
table.pecard tbody tr.inv-line > td input:not([type=checkbox]), table.pecard tbody tr.inv-line > td select { width: 100% !important; min-width: 0 !important; flex: none !important; }
/* heading strip */
table.pecard tbody tr.inv-line > td.lh { grid-column: 1 / -1; display: flex !important; justify-content: space-between; align-items: center; gap: 6px 12px;
    flex-wrap: wrap; margin: 0 -12px; padding: 8px 12px !important; background: var(--mod-tint) !important; border-bottom: 1px solid #e3ded6 !important;
    border-radius: 0 9px 0 0; }
table.pecard tbody tr.inv-line > td.lh::before { content: none; }
.lh-main { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; min-width: 0; }
.lh-title { font-size: 14.5px; color: var(--mod-dark); }
.lh-sub { font-size: 12.5px; color: #444; }
.lh-right { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.lh-chk, .pk-chk { font-size: 12px; font-weight: 700; border-radius: 10px; padding: 2px 8px; white-space: nowrap; }
.lh-chk.ok, .pk-chk.ok { background: #e6f4ea; color: #1e7b34; }
.lh-chk.bad, .pk-chk.bad { background: #fdecea; color: #b3261e; }
/* open part: item / HSN / size / PO */
table.pecard tbody tr.inv-line > td[data-label="Item"] { grid-column: span 4; }
table.pecard tbody tr.inv-line > td[data-label="Chapter / HSN"] { grid-column: span 3; }
table.pecard tbody tr.inv-line > td.szc { grid-column: span 1; }
table.pecard tbody tr.inv-line > td.szc::before { text-align: center; font-weight: 600; }
table.pecard tbody tr.inv-line > td.po-cell { grid-column: span 2; }
table.pecard tbody tr.inv-line > td.po-cell .po-btn { width: 100%; }
table.pecard tbody tr.inv-line > td.po-cell .po-sum:not(:empty) { margin-top: 3px; font-size: 12.5px; }
table.pecard tbody tr.inv-line.folded > td[data-label="Item"], table.pecard tbody tr.inv-line.folded > td[data-label="Chapter / HSN"],
table.pecard tbody tr.inv-line.folded > td.szc { display: none !important; }
/* PO cell stays visible on a folded line (2026-11-13): pending PO KG + "Change PO" button on every line, not only the open one */
table.pecard tbody tr.inv-line.new-line { border-left-color: #c58a2a !important; }
table.pecard tbody tr.inv-line.new-line > td.lh { background: #fff4e0 !important; }
/* typed part */
table.pecard tbody tr.inv-line > td .pcs-chk, table.pecard tbody tr.inv-line > td .kg-chk, table.pecard tbody tr.inv-line > td .qty-chk { display: none !important; }  /* badge shows it */
table.pecard tbody tr.inv-line > td .max-chk:not(:empty) { display: block; font-size: 12px; margin-top: 2px; }
table.pecard tbody tr.inv-line > td.amt-cell b { display: block; padding-top: 7px; font-size: 15px; }
table.pecard tbody tr.inv-line > td.close-cell .tick { display: flex; align-items: center; gap: 6px; padding-top: 7px; font-weight: 400; margin: 0; cursor: pointer; }
table.pecard tbody tr.inv-line > td.close-cell .tick input { width: 18px; height: 18px; margin: 0; }
table.pecard tbody tr.inv-line > td.close-cell::before { visibility: hidden; }                      /* keep the row aligned */
/* ▸ details hang under their card */
table.pecard tbody tr.det { display: block !important; }
table.pecard tbody tr.det[hidden] { display: none !important; }
table.pecard tbody tr.inv-line:has(+ tr.det:not([hidden])) { margin-bottom: 0; border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
table.pecard tbody tr.det:not([hidden]) { margin: 0 0 14px; background: #f6f9fd; border: 1px solid #d9d4cb; border-top: 1px dashed #c7d6e8;
    border-left: 5px solid var(--mod); border-radius: 0 0 10px 10px; }
table.pecard tbody tr.det td { display: block; border: 0 !important; background: transparent !important; padding: 0 !important; }
table.pecard tbody tr.det td::before { content: none; }
table.pecard .det-grid { padding: 8px 12px; }

@media (max-width: 640px) {
    table.pecard tbody tr.inv-line { grid-template-columns: repeat(6, minmax(0, 1fr)); padding: 0 10px 10px !important; }
    table.pecard tbody tr.inv-line > td.lh { margin: 0 -10px; padding: 8px 10px !important; }
    table.pecard tbody tr.inv-line > td[data-label="Item"], table.pecard tbody tr.inv-line > td[data-label="Chapter / HSN"],
    table.pecard tbody tr.inv-line > td.po-cell { grid-column: 1 / -1; }
    table.pecard tbody tr.inv-line > td.szc { grid-column: span 2; }
    table.pecard tbody tr.inv-line > td.amt-cell { display: none !important; }                    /* phone: amount in ▸ details */
    table.pecard tbody tr.inv-line > td.close-cell { grid-column: 1 / -1; }
    table.pecard.is-sheet tbody tr.inv-line > td.rate-col:not(.amt-cell) { grid-column: span 3; }
    table.pecard.is-sheet tbody tr.inv-line > td.close-cell { grid-column: span 3; }
    table.pecard tbody tr.inv-line > td.close-cell::before { display: none; }
    .lh-main { flex-direction: column; gap: 1px; }
    .lh-right { width: 100%; flex-wrap: wrap; }                                                    /* badge on top, buttons below */
    .lh-right .lh-chk:not(:empty) { width: 100%; text-align: center; }
    .lh-right .ic { flex: 1 1 0; }                                                                 /* Phone Card: equal-width buttons */
}

/* =====================================================================
   PURCHASE ENTRY - PACKING SLIP GROUPED BY INVOICE LINE (PC + phone, 2026-11-05)
   tr.pk-head = heading of a group (Line n . item, size, PO, badge + column names), tr.pk-row = one reel / lot.
   Item and Size are in the heading, so they are not repeated on every row.
   ===================================================================== */
table.pkcard { --pkcols: 34px minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) 40px; }
table.pkcard.is-sheet { --pkcols: 34px minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) 40px; }
table.pkcard tbody tr.pk-head { display: block !important; margin-top: 12px; border: 1px solid #d9d4cb; border-left: 5px solid var(--mod); border-bottom: 0;
    border-radius: 10px 10px 0 0; overflow: hidden; padding: 0 !important; }
table.pkcard tbody tr.pk-head:first-child { margin-top: 4px; }
table.pkcard tbody tr.pk-head > td { display: block !important; padding: 0 !important; border: 0 !important; width: auto !important; text-align: left !important; }
table.pkcard tbody tr.pk-head > td::before { content: none !important; }
.pk-h1 { display: flex; justify-content: space-between; align-items: center; gap: 4px 12px; flex-wrap: wrap; padding: 7px 12px; background: var(--mod-tint); }
.pk-title { color: var(--mod-dark); font-size: 14.5px; }
.pk-sub { font-size: 12.5px; color: #444; }
.pk-h2 { display: grid; grid-template-columns: var(--pkcols); gap: 10px; padding: 5px 12px; background: #fff; border-bottom: 1px solid #eee;
    font-size: 11.5px; font-weight: 600; color: #666; }
table.pkcard tbody tr.pk-row { display: grid !important; grid-template-columns: var(--pkcols); gap: 10px; align-items: center; padding: 4px 12px !important;
    background: #fff; border: 0 !important; border-left: 5px solid var(--mod) !important; border-right: 1px solid #d9d4cb !important;
    border-bottom: 1px solid #f1eee9 !important; margin: 0; }
table.pkcard tbody tr.pk-row.pk-last { border-bottom: 1px solid #d9d4cb !important; border-radius: 0 0 10px 10px; }
table.pkcard tbody tr.pk-row > td { display: block !important; padding: 0 !important; border: 0 !important; width: auto !important; min-width: 0;
    text-align: left !important; background: transparent !important; }
table.pkcard tbody tr.pk-row > td::before { content: none !important; }
table.pkcard tbody tr.pk-row > td[data-label="Item"], table.pkcard tbody tr.pk-row > td.p-size { display: none !important; }   /* in the heading */
table.pkcard tbody tr.pk-row > td.pn { color: #999; }
table.pkcard tbody tr.pk-row > td input { width: 100% !important; min-width: 0 !important; flex: none !important; }
table.pkcard tbody tr.pk-row > td.mono { font-size: 12.5px; color: #888; }
table.pkcard tbody tr.pk-row > td.actions { text-align: right !important; }
@media (max-width: 640px) {
    table.pkcard { --pkcols: 24px minmax(0, 1fr) minmax(0, 1fr) 34px; }
    table.pkcard.is-sheet { --pkcols: 24px minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) 34px; }
    table.pkcard tbody tr.pk-row > td[data-label="Barcode"], .pk-h2 .pk-bc,
    table.pkcard tbody tr.pk-row > td.f-kg, .pk-h2 .pk-fkg { display: none !important; }        /* barcode / formula KG: PC only */
    table.pkcard tbody tr.pk-row, .pk-h2, .pk-h1 { padding-left: 8px !important; padding-right: 8px !important; }
}
@media (max-width: 640px) {
    /* master card where the name is NOT the first column (Invoice Copy: Order first): .m-name goes on top, .m-plain is a normal box */
    table.mcard tbody td.m-name { order: -1; grid-column: 1 / -1; font-size: 16px; padding-right: 76px !important; }
    table.mcard tbody td.m-name::before { content: none; }
    table.mcard tbody td.m-plain:first-child { grid-column: auto; font-size: 14px; padding-right: 0 !important; }
    table.mcard tbody td.m-plain:first-child::before { content: attr(data-label); }
    table.mcard tbody td[data-label="Basis"] { grid-column: 1 / -1; }                                 /* Other Charges: basis text is long */
}
@media (max-width: 640px) {
    /* detail-page cards: .m-title = name on top of the card (no label), .m-full = full width; Status chip top-right */
    table.dcard tbody tr { position: relative; }
    table.dcard tbody td.m-title { order: -1; grid-column: 1 / -1; font-size: 15.5px; font-weight: 700; padding-right: 90px !important; }
    table.dcard tbody td.m-title::before { content: none; }
    table.dcard tbody td.m-full { grid-column: 1 / -1; }
    table.dcard tbody td[data-label="Status"] { position: absolute; top: 12px; right: 12px; }
    table.dcard tbody td[data-label="Status"]::before { content: none; }
}

/* Back Date Stock report on a phone: SAME table as on PC (no cards) - scroll left / right; the Quality column stays fixed on the left */
@media (max-width: 640px) {
    .table-scroll:has(> table.move-grid) { overflow-x: auto !important; -webkit-overflow-scrolling: touch; }
    table.move-grid { display: table !important; width: max-content !important; min-width: 100%; font-size: 13px; }
    table.move-grid > thead { display: table-header-group !important; }
    table.move-grid > tbody { display: table-row-group !important; }
    table.move-grid > tfoot { display: table-footer-group !important; }
    table.move-grid tr { display: table-row !important; padding: 0 !important; border: 0 !important; }
    table.move-grid th, table.move-grid td { display: table-cell !important; width: auto !important; padding: 5px 7px !important;
        border-bottom: 1px solid var(--line) !important; }
    table.move-grid td::before { content: none !important; }
    table.move-grid td:not(.num) { text-align: left !important; }
    table.move-grid td.num, table.move-grid th.num { text-align: right !important; }
    /* Quality column fixed while scrolling sideways */
    table.move-grid thead tr:first-child th:first-child, table.move-grid tbody td:first-child {
        position: sticky; left: 0; z-index: 2; background: #fff; box-shadow: 1px 0 0 var(--line); }
    table.move-grid thead tr:first-child th:first-child { background: var(--mod-tint); z-index: 3; }
}

/* =====================================================================
   PHONE CARDS EVERYWHERE (2026-11-06). PC unchanged.
   Detail pages (.dcard): .m-l = starts a new row on the left (keeps pairs like Order KG | Order Qty together),
   .m-hi2 = highlighted half box (Bal KG | Bal Qty). Pack tables (.dpack): reel / lot no. on top, no "Line n".
   Document lists (.lcard): document no. (.m-title) big on top, one status chip (.m-chip) top-right,
   tick box (.tick-col) top-left, details 2 per row (.m-full = full width), buttons at the bottom.
   Wide lists (.xscroll): same table as PC, scroll sideways, first column fixed.
   ===================================================================== */
@media (max-width: 640px) {
    /* KG + Qty pairs (Duplex): every pair on its own row, KG left | Qty right, at the end of the card:
       m-kg | m-qty (Order), m-kg2 | m-qty2 (Received / Dispatched), m-kg3 | m-qty3 (Balance).
       Reel: Order KG | No. of Reels, Recd KG | Bal KG (Bal KG carries m-qty2). */
    table.dcard tbody tr { grid-auto-flow: row !important; }                                  /* no gap filling: pairs stay together */
    table.dcard tbody td.m-kg  { order: 11; grid-column: 1; }
    table.dcard tbody td.m-qty { order: 12; grid-column: 2; }
    table.dcard tbody td.m-kg2 { order: 13; grid-column: 1; }
    table.dcard tbody td.m-qty2 { order: 14; grid-column: 2; }
    table.dcard tbody td.m-kg3 { order: 15; grid-column: 1; }
    table.dcard tbody td.m-qty3 { order: 16; grid-column: 2; }
    table.dcard tbody td.m-hi2 { background: var(--mod-tint); border-radius: 6px; padding: 6px 8px !important; }
    table.dcard.dpack tbody td[data-label="#"] { display: none !important; }
    table.dcard.dpack tbody td[data-label="Item"] { font-size: 14px; }

    .table-card:has(table.lcard) { background: transparent; border: 0; padding: 0; }
    table.lcard tbody tr { display: grid !important; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px 12px; grid-auto-flow: row dense;
        position: relative; background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--mod); border-radius: 10px;
        padding: 12px 12px 10px; margin: 0 0 10px; }
    table.lcard tbody tr[hidden] { display: none !important; }
    table.lcard tbody td { display: block !important; width: auto !important; padding: 0 !important; border: 0 !important;
        text-align: left !important; font-size: 14px; min-width: 0; overflow-wrap: anywhere; }
    table.lcard tbody td::before { display: block; content: attr(data-label); font-size: 11.5px; color: var(--muted); margin: 0 0 1px; }
    table.lcard tbody td.m-title { order: -2; grid-column: 1 / -1; font-size: 16.5px; padding-right: 130px !important; }
    table.lcard tbody td.m-title::before { content: none; }
    table.lcard tbody td.m-chip { position: absolute; top: 12px; right: 12px; }
    table.lcard tbody td.m-chip::before { content: none; }
    table.lcard tbody td.tick-col { position: absolute; top: 13px; left: 12px; }
    table.lcard tbody td.tick-col::before { content: none; }
    table.lcard tbody tr:has(td.tick-col) td.m-title { padding-left: 30px !important; }
    table.lcard tbody td.m-full { grid-column: 1 / -1; }
    table.lcard tbody td.actions { grid-column: 1 / -1; display: flex !important; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
    table.lcard tbody td.actions::before { content: none; }
    table.lcard tbody td.actions > .btn, table.lcard tbody td.actions > form { flex: 1 1 auto; margin: 0; }
    table.lcard tbody td.actions .btn { text-align: center; justify-content: center; padding: 8px 10px; }
    table.lcard tbody td.actions > form .btn { width: 100%; }
    table.lcard.hide-rates tbody td.rate-col { display: none !important; }

    /* wide lists: same table as PC, scroll sideways, first column fixed (Current Stock) */
    .table-scroll:has(> table.xscroll), .table-card:has(> table.xscroll) { overflow-x: auto !important; -webkit-overflow-scrolling: touch; }
    table.xscroll { display: table !important; width: max-content !important; min-width: 100%; font-size: 13px; }
    table.xscroll > thead { display: table-header-group !important; }
    table.xscroll > tbody { display: table-row-group !important; }
    table.xscroll > tfoot { display: table-footer-group !important; }
    table.xscroll tr { display: table-row !important; padding: 0 !important; border: 0 !important; }
    table.xscroll tr[hidden] { display: none !important; }
    table.xscroll th, table.xscroll td { display: table-cell !important; width: auto !important; padding: 5px 7px !important;
        border-bottom: 1px solid var(--line) !important; white-space: nowrap; }
    table.xscroll td::before { content: none !important; }
    table.xscroll td:not(.num) { text-align: left !important; }
    table.xscroll td.num, table.xscroll th.num { text-align: right !important; }
    table.xscroll thead th:first-child, table.xscroll tbody td:first-child { position: sticky; left: 0; z-index: 2; background: #fff; box-shadow: 1px 0 0 var(--line); }
    table.xscroll thead th:first-child { background: var(--mod-tint); z-index: 3; }
}
/* Purchase Entry line: typing order No. of Lots | Sheet Qty as per Invoice | KG as per Invoice on PC and phone (user, 2026-11-06) */
/* Purchase Duplex size: W / L only once (left of the Inch column); a bit bolder so the rows read W x L */
.sz-l { font-weight: 600; min-width: 12px; }
.szc .sz-row { min-height: 34px; }
/* Sales Return "type size" for a direct-delivery reel / lot: small grid, unit headings once, W / L once on the left */
.ret-szgrid { display: grid; grid-template-columns: repeat(var(--n, 2), minmax(64px, 96px)); gap: 4px 6px; align-items: center; margin-top: 3px; }
.ret-szgrid.sheet { grid-template-columns: 14px repeat(var(--n, 2), minmax(64px, 96px)); }
.ret-szgrid .ret-h { font-size: 11.5px; color: var(--muted); font-weight: 600; text-align: center; }
.ret-szgrid input.p-sz { width: 100%; padding: 5px 6px; }
@media (max-width: 640px) { .ret-szgrid { grid-template-columns: repeat(var(--n, 2), minmax(0, 1fr)); } .ret-szgrid.sheet { grid-template-columns: 14px repeat(var(--n, 2), minmax(0, 1fr)); } }
@media (max-width: 640px) {
    td:has(> .ret-size) { flex-wrap: wrap !important; }                          /* phone: size grid on its own full-width line under the godown */
    td > .ret-size { flex: 0 0 100%; width: 100%; text-align: left; }
    td > .ret-size .ret-szgrid { max-width: 320px; margin-left: auto; }
}

/* =====================================================================
   SALES / PURCHASE RETURN tick grid on a phone (2026-11-06): each reel / lot is a card like the other phone cards.
   Tick top-left, Reel / Lot No. big on top, Barcode | Invoice, Item, Width | Length (or Size), godown (+ size grid),
   Sheets | KG sold (or in stock), Sheets | KG returned, Reason, Reverse SO / PO. PC unchanged.
   ===================================================================== */
@media (max-width: 640px) {
    .table-card:has(table.ret-grid) { background: transparent; border: 0; padding: 0; }
    table.ret-grid tbody tr { display: grid !important; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px 12px; grid-auto-flow: row;
        position: relative; background: #fff; border: 1px solid var(--line); border-left: 4px solid #c9c3b8; border-radius: 10px;
        padding: 12px 12px 10px; margin: 0 0 10px; }
    table.ret-grid tbody tr.tk { border-left-color: var(--mod); background: #fbf4ea; }                          /* ticked = coming back */
    table.ret-grid tbody tr[hidden] { display: none !important; }
    table.ret-grid tbody tr td { display: block !important; width: auto !important; padding: 0 !important; border: 0 !important;
        text-align: left !important; background: transparent !important; font-size: 14px; min-width: 0; order: 9; }
    table.ret-grid tbody tr td::before { display: block; content: attr(data-label); font-size: 11.5px; color: var(--muted); margin: 0 0 1px; }
    table.ret-grid tbody tr td input:not([type=checkbox]), table.ret-grid tbody tr td select { width: 100% !important; min-width: 0 !important; }
    table.ret-grid tbody tr td[colspan] { grid-column: 1 / -1; }                                                 /* "select the customer first" */
    table.ret-grid td[data-label="Return?"] { position: absolute; top: 13px; left: 12px; }
    table.ret-grid td[data-label="Return?"]::before { content: none; }
    table.ret-grid td[data-label="Return?"] input { width: 22px; height: 22px; }
    table.ret-grid td[data-label="Lot No."], table.ret-grid td[data-label="Reel No."] { order: 0; grid-column: 1 / -1; font-size: 16.5px; font-weight: 700; padding-left: 34px !important; min-height: 24px; }
    table.ret-grid td[data-label="Lot No."]::before, table.ret-grid td[data-label="Reel No."]::before { content: attr(data-label) " "; display: inline; font-size: 16.5px; color: var(--muted); font-weight: 400; }   /* "Lot No. 1" */
    table.ret-grid td[data-label="Lot ID"], table.ret-grid td[data-label="Barcode"] { order: 1; grid-column: 1; }
    table.ret-grid td[data-label="Our Invoice"], table.ret-grid td[data-label="Supplier Invoice"] { order: 1; grid-column: 2; }
    table.ret-grid td[data-label="Item"] { order: 2; grid-column: 1 / -1; font-weight: 600; }
    table.ret-grid td[data-label="Width"] { order: 3; grid-column: 1; }
    table.ret-grid td[data-label="Length"] { order: 3; grid-column: 2; }
    table.ret-grid td[data-label="Size"] { order: 3; grid-column: 1 / -1; }
    table.ret-grid td[data-label="Back into Godown"], table.ret-grid td[data-label="Godown"] { order: 4; grid-column: 1 / -1; }
    table.ret-grid td[data-label="Sheets sold"], table.ret-grid td[data-label="Sheets in stock"] { order: 5; grid-column: 1; }
    table.ret-grid td[data-label="KG sold"], table.ret-grid td[data-label="KG in stock"] { order: 5; }
    table.ret-grid td[data-label="Sheets Returned"] { order: 6; grid-column: 1; }
    table.ret-grid td[data-label="KG Returned"] { order: 6; }
    table.ret-grid td[data-label="Reason"] { order: 7; grid-column: 1 / -1; }
    table.ret-grid td[data-label="Reverse SO?"], table.ret-grid td[data-label="Reverse PO?"] { order: 8; grid-column: 1 / -1; }
    table.ret-grid .p-kg { width: 100% !important; }
    table.ret-grid td > .ret-size .ret-szgrid { margin-left: 0; max-width: none; }
}

/* filter panels: a From - To date pair never spills into the next box (PC: takes 2 boxes' width, both dates shrink to fit) */
.date-pair input { min-width: 0; flex: 1 1 0; }
.filters .dates-field { grid-column: span 2; }
@media (max-width: 640px) { .filters .dates-field { grid-column: auto; } }

/* Stock list size units: tick the units to see; hidden units' columns disappear; bold = unit the reel / lot was bought in */
.unit-pick { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin: 0 0 8px; }
.unit-pick .check { margin: 0; font-weight: 600; }
body.hide-u-INCH .u-INCH, body.hide-u-CM .u-CM, body.hide-u-MM .u-MM { display: none !important; }
td.pu { font-weight: 700; }

/* =====================================================================
   ORDER TRACK (SO / PO Status Report) - Phone Card style (2026-11-06). PC unchanged.
   Level 1 = order card (SO / PO no. on top, status chip top-right, Ordered | Delivered, Balance | Late, "Show n lines" button).
   Level 2 = line card inside it (item + size on top, KG | Qty pairs for Duplex, "deliveries / receipts" button).
   Level 3 = small card per Sales Bill / Purchase Entry / return (document no. on top, date top-right).
   .m-only = cell shown only on the phone (Duplex Qty boxes); .pc-only = text shown only on PC.
   ===================================================================== */
.m-only { display: none; }
@media (max-width: 640px) {
    .pc-only { display: none !important; }
    .table-card:has(table.tcard) { background: transparent; border: 0; padding: 0; box-shadow: none; }
    table.tcard, table.tcard table { background: transparent; }
    /* every card (3 levels): 2 boxes per row, label above value */
    table.tcard > tbody > tr.ord-row, table.tcard tr.track-row, table.tcard tr.track-detail > td > table > tbody > tr {
        display: grid !important; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px 12px; grid-auto-flow: row;
        position: relative; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px 12px 10px; margin: 0 0 10px; }
    table.tcard > tbody > tr.ord-row { border-left: 4px solid var(--mod); }
    table.tcard tr.track-row { border-left: 4px solid var(--mod-tint); margin: 0 0 8px; }
    table.tcard tr.track-detail > td > table > tbody > tr { padding: 9px 10px 8px; margin: 0 0 6px; background: #fbfaf7; }
    table.tcard tr.track-detail > td > table > tbody > tr.move-return { background: #fff7ed; }
    table.tcard tr[hidden] { display: none !important; }
    table.tcard :where(tr.ord-row > td, tr.track-row > td, tr.track-detail > td > table > tbody > tr > td) {   /* :where = low weight, so the classes below win */
        display: block !important; width: auto !important; padding: 0 !important; border: 0 !important; background: transparent !important;
        text-align: left !important; font-size: 14px; min-width: 0; overflow-wrap: anywhere; }
    table.tcard :where(tr.ord-row > td, tr.track-row > td, tr.track-detail > td > table > tbody > tr > td)::before {
        display: block; content: attr(data-label); font-size: 11.5px; color: var(--muted); margin: 0 0 1px; text-align: left; }
    /* heading on top (no label), status chip / date top-right */
    table.tcard td.m-title { order: -2; grid-column: 1 / -1; font-size: 16px; padding-right: 120px !important; }
    table.tcard tr.track-row > td.m-title { font-size: 15px; }
    table.tcard tr.track-detail td.m-title { font-size: 14.5px; padding-right: 90px !important; }
    table.tcard td.m-title::before, table.tcard td.m-chip::before, table.tcard td.m-btn::before, table.tcard td.m-note::before { content: none !important; }
    table.tcard td.m-title .muted { display: inline; font-size: 13px; font-weight: 400; }
    table.tcard td.m-chip { position: absolute; top: 12px; right: 12px; font-size: 13px; }
    table.tcard tr.track-detail td.m-chip { top: 9px; right: 10px; color: var(--muted); }
    table.tcard td.m-full, table.tcard td.m-note { grid-column: 1 / -1; }
    table.tcard td.m-note:empty { display: none !important; }
    table.tcard td.m-note { font-size: 12.5px; color: var(--ok); font-weight: 600; }
    table.tcard td.m-lines { display: none !important; }                                    /* count is in the "Show n lines" button */
    table.tcard td.m-only { display: block !important; }
    /* KG | Qty pairs (Duplex) and other pairs, always left | right on their own row */
    table.tcard td.m-kg  { order: 11; grid-column: 1; }  table.tcard td.m-qty  { order: 12; grid-column: 2; }
    table.tcard td.m-kg2 { order: 13; grid-column: 1; }  table.tcard td.m-qty2 { order: 14; grid-column: 2; }
    table.tcard td.m-kg3 { order: 15; grid-column: 1; }  table.tcard td.m-qty3 { order: 16; grid-column: 2; }
    table.tcard td.m-kg4 { order: 17; grid-column: 1; }  table.tcard td.m-qty4 { order: 18; grid-column: 2; }
    table.tcard td.m-kg5 { order: 19; grid-column: 1; }  table.tcard td.m-qty5 { order: 20; grid-column: 2; }
    table.tcard td.m-hi2 { background: var(--mod-tint) !important; border-radius: 6px; padding: 6px 8px !important; }
    /* open / close button = full-width button at the bottom of the card, with words */
    table.tcard td.m-btn { order: 30; grid-column: 1 / -1; display: block !important; margin-top: 2px; }
    table.tcard td.m-btn .track-btn { width: 100%; justify-content: center; text-align: center; padding: 8px 10px; }
    table.tcard td.m-btn .track-btn::after { content: attr(data-m); }
    /* opened order: its lines hang under the order card */
    table.tcard > tbody > tr.ord-row:has(+ tr.ord-detail:not([hidden])) { margin-bottom: 0; border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
    table.tcard > tbody > tr.ord-detail:not([hidden]), table.tcard tr.track-detail:not([hidden]) { display: block !important; border: 0 !important; padding: 0 !important; }
    table.tcard > tbody > tr.ord-detail > td.m-sub { display: block !important; padding: 10px 8px 2px !important; margin: 0 0 12px; background: #f6f4f0 !important;
        border: 1px solid var(--line); border-top: 0; border-left: 4px solid var(--mod); border-radius: 0 0 10px 10px; }
    table.tcard tr.track-detail > td.m-sub { display: block !important; padding: 0 0 4px 12px !important; margin: -4px 0 10px; border: 0 !important; background: transparent !important; }
    table.tcard td.m-sub::before { content: none !important; }
    table.tcard td.m-sub > table, table.tcard td.m-sub > table > tbody { display: block !important; width: 100% !important; }
    table.tcard td.m-sub > table > thead { display: none !important; }
    table.tcard tr.track-row:has(+ tr.track-detail:not([hidden])) { margin-bottom: 8px; }
}
@media (max-width: 640px) { table.tcard tr.track-row > td.m-title .muted { display: block; margin-top: 1px; } }   /* line card: size under the item */

/* =====================================================================
   SALES BILL LINES + PACKING SLIP - Phone Card style (2026-11-06). PC unchanged.
   Lines (.sbcard): "Line n" strip, Item / HSN full width, Size | No. of Reels, (Duplex: Qty | KG), KG | GST % (Reel),
   Sale Rate | Amount (highlighted), Sale Order full width, Close SO, Customer PO No. | PO Date.
   Packing (.sbpack): reel / lot no. on top, Item, Size | Godown, Barcode | KG (Duplex: Qty | KG), Remove at the bottom.
   ===================================================================== */
@media (max-width: 640px) {
    .line-grid.sbcard, .line-grid.sbpack { background: transparent; min-width: 0; }
    table.sbcard tbody { counter-reset: ln; }
    table.sbcard tbody tr:not(.empty-row), table.sbpack tbody tr:not(.empty-row) {
        display: grid !important; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px 10px; grid-auto-flow: row; position: relative;
        background: #fff; border: 1px solid #d9d4cb !important; border-left: 5px solid var(--mod) !important; border-radius: 10px;
        margin: 0 0 14px; padding: 0 10px 12px !important; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
    table.sbcard tbody tr:not(.empty-row)::before { counter-increment: ln; content: "Line " counter(ln); order: -9; grid-column: 1 / -1;
        margin: 0 -10px 4px; padding: 6px 10px; background: var(--mod-tint); border-bottom: 1px solid #e3ded6; border-radius: 0 9px 0 0;
        font-weight: 700; font-size: 13.5px; color: var(--mod-dark); }                                          /* "Line 1" header strip */
    table.sbpack tbody tr:not(.empty-row) { padding-top: 10px !important; margin-bottom: 10px; }
    table.sbcard tbody tr.empty-row td::before, table.sbpack tbody tr.empty-row td::before { content: none; }
    table.sbcard :where(tbody tr:not(.empty-row) > td), table.sbpack :where(tbody tr:not(.empty-row) > td) {
        display: block !important; width: auto !important; padding: 0 !important; border: 0 !important; text-align: left !important; min-width: 0; overflow-wrap: anywhere; }
    table.sbcard :where(tbody tr:not(.empty-row) > td)::before, table.sbpack :where(tbody tr:not(.empty-row) > td)::before {
        display: block; content: attr(data-label); font-size: 12px; color: var(--muted); margin: 0 0 3px; text-align: left; }
    table.sbcard td input:not([type=checkbox]), table.sbpack td input:not([type=checkbox]) { width: 100% !important; min-width: 0 !important; }
    table.sbcard td input[type=checkbox] { width: 22px; height: 22px; margin: 4px 0 0; }
    table.sbcard td.num { font-weight: 600; }
    table.sbcard td small, table.sbpack td small { display: block; text-align: left; }
    /* lines: place of every box */
    table.sbcard td.sb-no { display: none !important; }                                             /* "#" replaced by "Line n" */
    table.sbcard td.sb-item { order: 1; grid-column: 1 / -1; font-size: 15.5px; }
    table.sbcard td.sb-item::before { content: none !important; }
    table.sbcard td.sb-hsn { order: 2; grid-column: 1 / -1; }
    table.sbcard td.sb-size { order: 3; grid-column: 1; }    table.sbcard td.sb-pcs { order: 4; grid-column: 2; }
    table.sbcard td.sb-qty  { order: 5; grid-column: 1; }    table.sbcard td.sb-kg  { order: 6; }
    table.sbcard td.sb-gst-r { order: 7; grid-column: 2; }                                          /* Reel: KG | GST % */
    table.sbcard td.sb-rate { order: 8; grid-column: 1; }    table.sbcard td.sb-amt { order: 9; grid-column: 2; }
    table.sbcard td.sb-amt { background: var(--mod-tint); border-radius: 6px; padding: 6px 8px !important; align-self: start; }
    table.sbcard td.sb-so { order: 10; grid-column: 1 / -1; }
    table.sbcard td.sb-so .so-btn { width: 100%; padding: 8px 10px; }
    table.sbcard td.sb-close-r { order: 11; grid-column: 1 / -1; }
    table.sbcard td.sb-close-s { order: 11; grid-column: 1; }  table.sbcard td.sb-gst-s { order: 12; grid-column: 2; }   /* Duplex: Close SO | GST % */
    table.sbcard td.sb-po { order: 13; grid-column: 1; }     table.sbcard td.sb-pod { order: 14; grid-column: 2; }
    /* packing slip: place of every box */
    table.sbpack td.pk-n { display: none !important; }
    table.sbpack td.pk-no { order: 1; grid-column: 1 / -1; font-size: 16px; font-weight: 700; }
    table.sbpack td.pk-no::before { display: inline !important; margin-right: 6px !important; font-size: 12px; font-weight: 400; }   /* "Reel No. 1234" */
    table.sbpack td.pk-item { order: 2; grid-column: 1 / -1; }
    table.sbpack td.pk-item::before { content: none !important; }
    table.sbpack td.pk-size { order: 3; grid-column: 1; }    table.sbpack td.pk-gd { order: 4; grid-column: 2; }
    table.sbpack td.pk-bc   { order: 5; grid-column: 1; font-size: 13px; }
    table.sbpack td.pk-qty  { order: 5; grid-column: 1; }    table.sbpack td.pk-kg { order: 6; grid-column: 2; }
    table.sbpack tbody tr:has(td.pk-qty) td.pk-bc { order: 7; grid-column: 1 / -1; }             /* Duplex: Lot ID under Qty | KG */
    table.sbpack td.pk-hi { background: var(--mod-tint); border-radius: 6px; padding: 6px 8px !important; font-weight: 700; }
    table.sbpack td.pk-del { order: 20; grid-column: 1 / -1; }
    table.sbpack td.pk-del::before { content: none !important; }
    table.sbpack td.pk-del .btn { width: 100%; padding: 8px 10px; }
}
@media (max-width: 640px) {
    /* Close SO line: tick box with its words on one row */
    table.sbcard td.sb-close-r, table.sbcard td.sb-close-s { display: flex !important; flex-direction: row-reverse; justify-content: flex-end; align-items: center; gap: 8px; align-self: center; }
    table.sbcard td.sb-close-r::before, table.sbcard td.sb-close-s::before { margin: 0 !important; font-size: 13.5px !important; color: var(--text, #222) !important; }
    table.sbcard td.sb-close-r input, table.sbcard td.sb-close-s input { margin: 0 !important; }
    table.sbpack td.mono::before { font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }   /* label in normal font, value stays mono */
}

/* =====================================================================
   CUSTOMER / SUPPLIER RATE PANEL - Phone Card style (2026-11-06). PC unchanged.
   Each paper = small card: Quality / GSM / BF on top, Reel / Duplex chip top-right, rate box under it (label above).
   ===================================================================== */
@media (max-width: 640px) {
    table.rate-grid.rcard { border: 0; background: transparent; }
    table.rcard tbody tr { display: grid !important; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 6px 12px; position: relative;
        background: #fff; border: 1px solid var(--line) !important; border-left: 4px solid var(--mod) !important; border-radius: 10px;
        padding: 10px 12px !important; margin: 0 0 8px; }
    table.rcard tbody tr[hidden] { display: none !important; }
    table.rcard :where(tbody td) { display: block !important; width: auto !important; padding: 0 !important; border: 0 !important; text-align: left !important; min-width: 0; }
    table.rcard :where(tbody td)::before { display: block; content: attr(data-label); font-size: 12px; color: var(--muted); margin: 0 0 3px; text-align: left; }
    table.rcard td.m-title { order: -1; grid-column: 1 / -1; font-size: 15.5px; font-weight: 700; padding-right: 76px !important; }
    table.rcard td.m-title::before, table.rcard td.m-chip::before { content: none !important; }
    table.rcard td.m-chip { position: absolute; top: 10px; right: 12px; font-size: 12px; font-weight: 600; padding: 2px 9px !important;
        border-radius: 999px; background: #f1ede6; color: #6b5a45; }
    table.rcard td.m-chip.t-sheet { background: #e8f1fb; color: #1f5f9e; }
    table.rcard td.m-rate { grid-column: 1; }
    table.rcard td.m-rate .rate-input { width: 100% !important; margin: 0; }
}

/* =====================================================================
   STOCK ADJUST (Stock Modification / Discard) - Phone Card style (2026-11-06). PC unchanged.
   Picker (.sapick): tick top-left, reel / lot no. on top, Item, Size | Godown, Barcode | KG (Duplex: Sheets | KG); tap the card to tick.
   Rows (.sarows): reel / lot no. on top, Item, Size | Godown, Barcode | Now in Stock, (New Sheets |) New KG | Difference, Reason, Remove.
   ===================================================================== */
.m-tickall { display: none; }
@media (max-width: 640px) {
    .m-tickall { display: flex; align-items: center; gap: 8px; padding: 4px 2px 10px; font-weight: 600; }
    .m-tickall input { width: 22px; height: 22px; margin: 0; }
    .line-grid.sacard { background: transparent; min-width: 0; }
    table.sacard tbody tr:not(.empty-row) {
        display: grid !important; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px 10px; grid-auto-flow: row; position: relative;
        background: #fff; border: 1px solid #d9d4cb !important; border-left: 5px solid var(--mod) !important; border-radius: 10px;
        margin: 0 0 10px; padding: 10px 10px 12px !important; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
    table.sacard tbody tr[hidden] { display: none !important; }
    table.sacard tbody tr.empty-row td::before { content: none; }
    table.sacard :where(tbody tr:not(.empty-row) > td) { display: block !important; width: auto !important; padding: 0 !important; border: 0 !important;
        text-align: left !important; min-width: 0; overflow-wrap: anywhere; }
    table.sacard :where(tbody tr:not(.empty-row) > td)::before { display: block; content: attr(data-label); font-size: 12px; color: var(--muted); margin: 0 0 3px; text-align: left; }
    table.sacard td.mono::before { font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
    table.sacard td input:not([type=checkbox]) { width: 100% !important; min-width: 0 !important; }
    /* rows */
    table.sarows td.sa-n { display: none !important; }
    table.sarows td.sa-no { order: 1; grid-column: 1 / -1; font-size: 16px; font-weight: 700; }
    table.sarows td.sa-no::before, table.sapick td.sp-no::before { display: inline !important; margin-right: 6px !important; font-size: 12px; font-weight: 400; }
    table.sarows td.sa-item { order: 2; grid-column: 1 / -1; }
    table.sarows td.sa-item::before, table.sapick td.sp-item::before { content: none !important; }
    table.sarows td.sa-size { order: 3; } table.sarows td.sa-gd { order: 4; }
    table.sarows td.sa-bc { order: 5; font-size: 13px; } table.sarows td.sa-now { order: 6; }
    table.sarows td.sa-qty { order: 7; } table.sarows td.sa-kg { order: 8; }
    table.sarows td.sa-diff { order: 9; font-weight: 700; background: var(--mod-tint); border-radius: 6px; padding: 6px 8px !important; align-self: end; }
    table.sarows td.sa-reason { order: 10; grid-column: 1 / -1; }
    table.sarows td.sa-del { order: 11; grid-column: 1 / -1; }
    table.sarows td.sa-del::before { content: none !important; }
    table.sarows td.sa-del .btn { width: 100%; padding: 8px 10px; }
    /* picker */
    table.sapick tbody tr:not(.empty-row) { cursor: pointer; padding-top: 11px !important; }
    table.sapick tbody tr:has(.s-tick:checked) { background: var(--mod-tint); border-color: var(--mod) !important; }
    table.sapick td.tick-col { position: absolute; top: 11px; left: 10px; }
    table.sapick td.tick-col::before { content: none !important; }
    table.sapick td.tick-col input { width: 22px; height: 22px; margin: 0; }
    table.sapick td.sp-no { order: 1; grid-column: 1 / -1; font-size: 16px; font-weight: 700; padding-left: 32px !important; }
    table.sapick td.sp-item { order: 2; grid-column: 1 / -1; }
    table.sapick td.sp-size { order: 3; } table.sapick td.sp-gd { order: 4; }
    table.sapick td.sp-bc { order: 5; font-size: 13px; } table.sapick td.sp-qty { order: 6; } table.sapick td.sp-kg { order: 7; font-weight: 700; }
    table.sapick tbody tr:has(td.sp-qty) td.sp-bc { order: 8; grid-column: 1 / -1; }            /* Duplex: Sheets | KG, Lot ID below */
}

/* =====================================================================
   STOCK SUMMARY report (2026-11-09): one row per paper + size; the whole row opens its reels / lots.
   PC = normal table (row highlights on hover). Phone = Phone Card style: paper on top, size under it,
   Reels | KG (highlighted), Godowns | Oldest, Avg Rate | Amount, full-width "View n reels" button.
   ===================================================================== */
.type-tabs { display: flex; gap: 6px; }
.type-tabs .btn { flex: 1; text-align: center; white-space: nowrap; }
table.ssum tbody tr.row-link { cursor: pointer; }
table.ssum tbody tr.row-link:hover td { background: var(--mod-tint); }
.hint-line { margin: 4px 2px 8px; font-size: 13px; }
@media (max-width: 640px) {
    .table-card:has(table.ssum) { background: transparent; border: 0; padding: 0; box-shadow: none; }
    table.ssum { background: transparent; }
    table.ssum tfoot { display: none !important; }                                   /* totals card above shows them */
    table.ssum tbody tr {
        display: grid !important; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px 12px; grid-auto-flow: row; position: relative;
        background: #fff; border: 1px solid var(--line) !important; border-left: 4px solid var(--mod) !important; border-radius: 10px;
        padding: 12px 12px 10px !important; margin: 0 0 10px; }
    table.ssum tbody tr[hidden] { display: none !important; }
    table.ssum :where(tbody td) { display: block !important; width: auto !important; padding: 0 !important; border: 0 !important;
        background: transparent !important; text-align: left !important; min-width: 0; overflow-wrap: anywhere; font-size: 14px; }
    table.ssum :where(tbody td)::before { display: block; content: attr(data-label); font-size: 11.5px; color: var(--muted); margin: 0 0 1px; text-align: left; }
    table.ssum td.pc-cell { display: none !important; }                             /* Quality / GSM / BF -> one heading */
    table.ssum td.m-only { display: block !important; }
    table.ssum td.m-title { order: -3; grid-column: 1 / -1; font-size: 16px; font-weight: 700; }
    table.ssum td.m-size { order: -2; grid-column: 1 / -1; font-size: 15px; margin-top: -6px; }
    table.ssum td.m-title::before, table.ssum td.m-size::before, table.ssum td.m-btn::before { content: none !important; }
    table.ssum td.m-kg  { order: 11; grid-column: 1; }  table.ssum td.m-qty  { order: 12; grid-column: 2; }
    table.ssum td.m-kg2 { order: 13; grid-column: 1; }  table.ssum td.m-qty2 { order: 14; grid-column: 2; }
    table.ssum td.m-kg3 { order: 15; grid-column: 1; }  table.ssum td.m-qty3 { order: 16; grid-column: 2; }
    table.ssum td.m-kg4 { order: 17; grid-column: 1; }
    table.ssum td.m-hi2 { background: var(--mod-tint) !important; border-radius: 6px; padding: 6px 8px !important; }
    table.ssum td.m-btn { order: 30; grid-column: 1 / -1; }
    table.ssum td.m-btn .btn { display: block; width: 100%; text-align: center; padding: 9px 10px; font-weight: 600; }
    table.ssum.hide-rates td.rate-col { display: none !important; }
}
.filters .from-summary { grid-column: 1 / -1; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }   /* Stock list opened from Stock Summary */
.filters .type-field { grid-column: span 2; min-width: 250px; }   /* Paper Reel | Duplex Sheet buttons need 2 filter widths on PC */
@media (max-width: 640px) { .filters .type-field { grid-column: 1 / -1; min-width: 0; } }
table.ssum td.m-btn .btn { white-space: nowrap; }

/* "Rate pending" mark (2026-11-09): Against PO entry saved without the invoice rate -> reel valued at the PO Agreed Rate until the rate is typed */
.rate-pend { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px; background: #fdecea; color: #b42318; font-size: 11.5px; font-weight: 700; white-space: nowrap; vertical-align: middle; }
.totals .pend-note { flex-basis: 100%; font-size: 13px; color: #7a271a; display: block; }
.totals .pend-note.ret-note { color: #344054; background: #f2f4f7; border-radius: 6px; padding: 6px 10px; }   /* return-month note (2026-11-13) */
.totals .pend-note .rate-pend { margin: 0 6px 0 0; }
.totals .pend-note .rate-pend { display: inline-block; font-size: 11.5px; color: #b42318; }

/* =====================================================================
   PROFIT REPORT (2026-11-09): wide table (sideways scroll on phone, first column fixed); minus figures red;
   Net Profit / Net after Returns columns tinted; stock loss boxes in the totals card.
   ===================================================================== */
.neg { color: var(--err) !important; }
table.profit-grid td.p-name small { display: block; font-size: 11.5px; white-space: normal; max-width: 260px; }
table.profit-grid td.p-net, table.profit-grid td.p-key { background: var(--mod-tint); }
table.profit-grid td.p-key { font-size: 14.5px; }
table.profit-grid th { white-space: normal; min-width: 78px; }
.profit-tot .loss-box { border-left: 1px solid var(--line); padding-left: 14px; }
@media (max-width: 640px) { .profit-tot .loss-box { border-left: 0; padding-left: 0; } }
table.profit-grid td.p-name { min-width: 190px; }
.profit-tot { justify-content: flex-start; }

/* Profit Report help box ("How is this profit worked out?") - closed by default, tap to open */
.profit-help { padding: 10px 14px; }
.profit-help summary { cursor: pointer; list-style: none; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.profit-help summary::before { content: "\25B8"; color: var(--mod); font-weight: 700; }
.profit-help[open] summary::before { content: "\25BE"; }
.profit-help .ph-body { margin-top: 10px; font-size: 13.5px; line-height: 1.5; }
.profit-help h4 { margin: 14px 0 6px; font-size: 14px; color: var(--mod-dark); }
.profit-help .ph-table { border-collapse: collapse; width: 100%; }
.profit-help .ph-table td { border-bottom: 1px solid var(--line); padding: 5px 8px; vertical-align: top; }
.profit-help .ph-table td:first-child { white-space: nowrap; width: 1%; }
.profit-help .ph-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; }
.profit-help ul { margin: 4px 0; padding-left: 20px; }
@media (max-width: 640px) {
    .profit-help .ph-cols { grid-template-columns: 1fr; }
    .profit-help .ph-table td:first-child { white-space: normal; width: 38%; }
}

/* =====================================================================
   SUMMARY REPORTS (2026-11-09): Day to Day Sales, Customer-Day, Monthly, Vehicle, Cash Expense - group / total rows
   ===================================================================== */
table.report-grid tr.grp-head td { background: var(--mod-tint) !important; color: var(--mod-dark); padding-top: 8px !important; }
table.report-grid tr.sub-tot td { background: #f6f4f0; border-top: 1px solid var(--line); }
table.report-grid tr.code-tot td { background: #ece8f6; border-top: 2px solid var(--line); }
table.report-grid tr.grand-tot td { background: #e4dff3; border-top: 2px solid var(--mod); font-size: 14px; }
table.monthly td.m-tot, table.monthly th:last-child { background: var(--mod-tint); }
table.daybook td, table.cday td, table.monthly td, table.vehicle-grid td, table.cash-grid td { white-space: nowrap; }

/* =====================================================================
   GRAPHS page (2026-11-09): bar charts drawn with HTML / CSS. Series colours = validated categorical slots 1 (blue) and 2 (orange);
   loss = red. Figures always in normal text colour; hover / focus a bar for its tooltip; "Show figures" = table view.
   ===================================================================== */
.chart-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 14px; }
.chart-card { padding: 14px 16px; min-width: 0; }
.chart-card.wide { grid-column: 1 / -1; }
.chart-card h3 { margin: 0 0 8px; font-size: 15px; }
.legend { display: flex; align-items: center; gap: 6px 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.legend .key { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: -8px; }
.s1 { background: #2a78d6; } .s2 { background: #eb6834; } .vbar.loss { background: #e34948; border-radius: 0 0 4px 4px; }
.vchart { position: relative; display: flex; align-items: stretch; gap: 4px; height: 230px; padding: 18px 0 0; border-bottom: 1px solid #c9c4ba; overflow-x: auto; }
.vchart .v-max { position: absolute; top: 0; left: 0; font-size: 11px; color: var(--muted); }
.vcol { flex: 1 0 34px; display: flex; flex-direction: column; min-width: 34px; }
.vbars { flex: 1; display: flex; align-items: flex-end; justify-content: center; gap: 2px; border-top: 1px dashed #ebe7df; }
.vbar { position: relative; width: 42%; max-width: 22px; min-height: 0; border-radius: 4px 4px 0 0; cursor: pointer; outline: none; }
.v-lab { font-size: 11px; color: var(--muted); text-align: center; padding-top: 4px; white-space: nowrap; }
/* profit chart: part above the 0 line and part below */
.pchart .vcol { justify-content: flex-end; }
.pchart .p-up { display: flex; align-items: flex-end; justify-content: center; border-bottom: 1px solid #8a857c; flex: 0 0 auto; }
.pchart .p-down { flex: 1; display: flex; align-items: flex-start; justify-content: center; }
.pchart .vbar { width: 50%; }
/* tooltip */
.vbar:hover::after, .vbar:focus::after { content: attr(data-tip); position: absolute; bottom: 100%; left: 50%; transform: translate(-50%, -6px);
    background: #222; color: #fff; font-size: 12px; padding: 4px 8px; border-radius: 5px; white-space: nowrap; z-index: 5; pointer-events: none; }
.vbar.loss:hover::after, .vbar.loss:focus::after { bottom: auto; top: 100%; transform: translate(-50%, 6px); }
/* horizontal bars */
.hchart { display: grid; gap: 6px; }
.hrow { display: grid; grid-template-columns: minmax(90px, 34%) 1fr auto; gap: 8px; align-items: center; font-size: 13px; }
.h-lab { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.h-track { height: 14px; background: #f1eee8; border-radius: 4px; overflow: hidden; }
.hbar { height: 100%; border-radius: 0 4px 4px 0; }
.h-val { font-weight: 600; white-space: nowrap; font-size: 12.5px; }
.figs { margin-top: 8px; font-size: 13px; }
.figs summary { cursor: pointer; color: var(--mod-dark); }
.figs table { margin-top: 6px; }
@media (max-width: 640px) {
    .chart-grid { grid-template-columns: 1fr; }
    .vchart { height: 200px; }
    .hrow { grid-template-columns: minmax(80px, 38%) 1fr auto; }
    .figs table.report-grid { display: table !important; }
}
@media print { .vbar, .hbar, .key { -webkit-print-color-adjust: exact; print-color-adjust: exact; } .figs { display: none; } }
/* graphs fine-tuning: one grid for all rows of a horizontal chart (bars start / end at the same place); month labels never collide */
.hchart { grid-template-columns: minmax(90px, 34%) 1fr auto; gap: 6px 8px; align-items: center; }
.hchart .hrow { display: contents; }
.vcol { flex: 1 0 44px; min-width: 44px; }
@media (max-width: 640px) { .hchart { grid-template-columns: minmax(80px, 38%) 1fr auto; } .v-lab { font-size: 10.5px; } }
/* graphs: hover / tap labels must stay inside the chart box (the box scrolls sideways, so anything outside it is cut off):
   room for the label above the tallest bar; first / last months' labels open towards the inside; loss label also above its bar */
.vchart { padding-top: 40px; }
.vchart .v-max { top: 2px; }
.vbar.loss:hover::after, .vbar.loss:focus::after { top: auto; bottom: 100%; transform: translate(-50%, -6px); }
.vchart .vcol:nth-child(-n+3) .vbar:hover::after, .vchart .vcol:nth-child(-n+3) .vbar:focus::after { left: 0; transform: translate(0, -6px); }
.vchart .vcol:nth-last-child(-n+2) .vbar:hover::after, .vchart .vcol:nth-last-child(-n+2) .vbar:focus::after { left: auto; right: 0; transform: translate(0, -6px); }

/* =====================================================================
   CUSTOMER PORTAL - Customer Master parts (2026-11-11)
   .rate-help = two-line note above the rate panel; .rate-copy = Copy Sale -> Portal buttons; .tick-list = godown ticks
   ===================================================================== */
.rate-help { font-size: 13px; line-height: 1.5; margin: 0 0 10px; }
.rate-help b { color: var(--ink); }
.rate-copy { display: inline-flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.tick-list { display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 4px 0; }
.tick-list label.check { margin: 0; }
@media (max-width: 640px) {
    table.rcard td.m-rate2 { grid-column: 2; }
    table.rcard td.m-rate2 .rate-input { width: 100% !important; margin: 0; }
    .rate-copy { width: 100%; }
    .rate-copy .btn { flex: 1 1 auto; }
}

/* =====================================================================
   CUSTOMER PORTAL pages (2026-11-11) - prefix pp- ; phone first, cards, sticky bottom bar on the stock page
   ===================================================================== */
.pp-body { background: var(--page); min-height: 100vh; display: flex; flex-direction: column; }
.pp-top { background: var(--side); color: #fff; padding: 10px 16px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; position: sticky; top: 0; z-index: 20; }
.pp-brand { display: flex; align-items: center; gap: 10px; }
.pp-brand b { display: block; font-size: 16px; }
.pp-brand small { color: var(--side-text); font-size: 12.5px; }
.pp-logo { height: 38px; width: auto; max-width: 120px; background: #fff; border-radius: 6px; padding: 3px; object-fit: contain; }
.pp-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.pp-nav a { color: var(--side-text); text-decoration: none; padding: 7px 12px; border-radius: 6px; font-size: 14px; }
.pp-nav a.on, .pp-nav a:hover { background: rgba(255,255,255,.12); color: #fff; }
.pp-main { width: 100%; max-width: 1100px; margin: 0 auto; padding: 16px 14px 150px; flex: 1; }
.pp-foot { text-align: center; color: var(--muted); font-size: 12.5px; padding: 14px; }
.pp-h1 { margin: 0 0 12px; }
.pp-narrow { max-width: 420px; display: grid; gap: 12px; }
.pp-login .pp-login-brand { display: flex; align-items: center; gap: 10px; }
.pp-login .pp-login-brand b { display: block; font-size: 17px; }
.pp-login .pp-login-brand small { color: var(--muted); }
.pp-hint { font-size: 12.5px; margin: 0; }
.pp-pick { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-bottom: 10px; }
.pp-pick .field { flex: 1 1 220px; margin: 0; }
.pp-limit { margin: 0 0 10px; font-size: 13.5px; }
.pp-tools { display: flex; gap: 10px; align-items: center; margin: 0 0 10px; }
.pp-tools input[type=search] { flex: 1 1 auto; }
.pp-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.pp-card { position: relative; display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--kraft);
    border-radius: 10px; padding: 10px 12px 10px 40px; cursor: pointer; user-select: none; }
.pp-card.on { border-color: var(--kraft); background: #fbf6ef; box-shadow: 0 0 0 1px var(--kraft) inset; }
.pp-card .pp-tick { position: absolute; left: 12px; top: 12px; width: 18px; height: 18px; margin: 0; }
.pp-card .pp-title { grid-column: 1 / -1; font-weight: 700; font-size: 15px; }
.pp-card .pp-size { color: var(--ink); }
.pp-card .pp-no { color: var(--muted); text-align: right; font-size: 13px; }
.pp-card .pp-kg { font-weight: 600; }
.pp-card .pp-rate { text-align: right; color: var(--kraft-dark); font-weight: 600; }
.pp-card .pp-qty { grid-column: 1 / -1; font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.pp-card .pp-qtyin { width: 110px; padding: 5px 8px; }
.pp-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: #fff; border-top: 1px solid var(--line); box-shadow: 0 -4px 14px rgba(0,0,0,.08);
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); display: grid; gap: 6px; }
.pp-bar .pp-sum { font-size: 14px; }
.pp-bar .pp-sum .warn { color: var(--err); }
.pp-send { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pp-send label { display: flex; align-items: center; gap: 6px; font-size: 13.5px; }
.pp-send input[type=text] { flex: 1 1 200px; }
.pp-send .btn { flex: 0 0 auto; }
.pp-req { margin-bottom: 12px; display: grid; gap: 6px; }
.pp-req-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pp-req-head b { font-size: 16px; }
.pp-exp { font-size: 12.5px; color: #b54708; font-weight: 600; }
.pp-req-info { font-size: 13.5px; }
.pp-req-info.warn { color: var(--err); }
.pp-items { display: grid; gap: 4px; border-top: 1px solid #efece7; padding-top: 6px; }
.pp-item { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 12px; font-size: 13.5px; }
.pp-item.off { color: var(--muted); text-decoration: line-through; }
.pp-item.off small { text-decoration: none; }
.pp-req-foot { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; align-items: center; border-top: 1px solid #efece7; padding-top: 8px; }
@media (max-width: 640px) {
    .pp-top { padding: 8px 12px; }
    .pp-nav { width: 100%; }
    .pp-nav a { flex: 1 1 auto; text-align: center; padding: 7px 6px; }
    .pp-main { padding: 12px 10px 190px; }
    .pp-list { grid-template-columns: 1fr; }
    .pp-send input[type=date] { width: 150px; }
    .pp-send .btn { width: 100%; }
}

/* ---- Sales > Portal Requests (2026-11-11): status tabs, approval list, hold marks in stock / Sales Bill picker */
.pr-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.pr-tabs a { padding: 6px 12px; border: 1px solid #cfcac2; border-radius: 999px; text-decoration: none; color: var(--ink); background: #fff; font-size: 13.5px; }
.pr-tabs a.on { background: var(--mod, var(--kraft)); border-color: var(--mod, var(--kraft)); color: #fff; }
.pr-items td .pr-keep { width: 18px; height: 18px; }
.pr-items tr.off td { color: var(--muted); text-decoration: line-through; }
.pr-box { display: grid; gap: 10px; }
.pr-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.pr-actions .field { margin: 0; }
.hold-mark { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 1px 7px; border-radius: 999px; background: #fff4e5; color: #b54708; margin-top: 2px; }
.hold-mark.held { background: #e8f0fb; color: #1d4f91; }
.hold-mark.late { background: #fdecea; color: var(--err); }
.nav-badge { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 6px; border-radius: 9px; background: #e34948; color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
.nav-badge[hidden] { display: none; }
/* Customer Master: portal boxes greyed out while "Customer Portal login allowed" is not ticked */
#portalPanel.pp-off { opacity: .55; }
#portalPanel.pp-off input:disabled { background: #f1efeb; cursor: not-allowed; }

/* =====================================================================
   SALES BILL - Select Reels / Lots window (2026-11-11): Phone Card style on phones (uses .sacard .sapick of Stock Adjust).
   Reel: Reel no. on top | Size, KG | Godown, Chapter (HSN) | Barcode full width.
   Duplex: Lot no. on top | Width, Length | Sheets, KG | Godown, Chapter (HSN) | Lot ID full width.
   ===================================================================== */
@media (max-width: 640px) {
    table.sbpick thead { display: none; }
    table.sbpick td.sp-no { order: 1; }
    table.sbpick td.sp-no .hold-mark { font-size: 11.5px; }
    table.sbpick td.sp-size { order: 2; } table.sbpick td.sp-kg { order: 3; }
    table.sbpick td.sp-w { order: 2; } table.sbpick td.sp-l { order: 3; }
    table.sbpick td.sp-qty { order: 4; } table.sbpick tbody tr:has(td.sp-qty) td.sp-kg { order: 5; }
    table.sbpick td.sp-gd { order: 6; } table.sbpick td.sp-hsn { order: 7; }
    table.sbpick td.sp-bc { order: 8; grid-column: 1 / -1; font-size: 13px; }
    table.sbpick td.sp-kg { font-weight: 700; background: var(--mod-tint); border-radius: 6px; padding: 6px 8px !important; }
    table.sbpick tbody tr.empty-row td { display: block; padding: 14px 4px; }
    .pick-box .stock-scroll { overflow-x: hidden; }
}
@media (max-width: 640px) {
    /* Select Reels window: bottom buttons equal width (Phone Card style) */
    .pick-foot .pick-btns { display: flex; gap: 8px; width: 100%; }
    .pick-foot .pick-btns .btn { flex: 1 1 0; }
}

/* Sales Bill: fold / open arrow on the Packing Slip heading (2026-11-11) */
.fold-btn { border: 1px solid #d9d4cb; background: #fff; color: var(--mod-dark, var(--ink)); width: 28px; height: 28px; border-radius: 6px; padding: 0;
    font-size: 12px; line-height: 26px; cursor: pointer; vertical-align: middle; margin-right: 4px; transition: transform .15s; }
.fold-btn:hover { background: var(--mod-tint, #f4efe8); }
.fold-btn.folded { transform: rotate(-90deg); }

/* Portal stock page: unit switch + size dropdown next to the search box */
.pp-tools { flex-wrap: wrap; }
.pp-tools #ppSize { flex: 0 1 220px; min-width: 160px; }
@media (max-width: 640px) {
    .pp-tools .pp-units { flex: 1 1 100%; }
    .pp-tools #ppSize { flex: 1 1 100%; }
}
/* Portal bottom bar: labelled PO No. / Remark boxes */
.pp-send .pp-po { flex: 0 1 230px; }
.pp-send .pp-po input { width: 130px; }
.pp-send .pp-rem { flex: 1 1 220px; }
.pp-send .pp-rem input { flex: 1 1 auto; min-width: 0; }
@media (max-width: 640px) {
    .pp-send label { width: 100%; justify-content: space-between; }
    .pp-send .pp-po input, .pp-send .pp-rem input, .pp-send input[type=date] { flex: 1 1 auto; width: auto; max-width: 62%; }
}
@media (max-width: 640px) {
    /* portal bottom bar on phones: label text above its box, box full width */
    .pp-send label { flex-direction: column; align-items: stretch; gap: 3px; }
    .pp-send .pp-po input, .pp-send .pp-rem input, .pp-send input[type=date] { max-width: none; width: 100%; }
}
/* portal My Requests: status word at the end of each reel / lot row */
.pp-item .pp-ist { font-weight: 600; font-size: 12.5px; color: var(--ink); background: #f1efeb; border-radius: 999px; padding: 1px 8px; }

/* =====================================================================
   RECEIPTS / PAYMENTS (2026-11-11)
   .paybills = bills on the entry screen (Phone Card style on phones: tick top-left, bill no. on top, Still Open | Amount, Discount | Balance after)
   .os-* = Outstanding report: summary boxes, red = crossed credit days, orange = due soon
   ===================================================================== */
.paybills tr.on td { background: var(--mod-tint, #f6f1ea); }
.paybills td.pb-due.late { color: var(--err); font-weight: 600; }
.paybills input.b-amt, .paybills input.b-disc { width: 120px; text-align: right; }
.pay-foot .pay-sum { flex: 1 1 260px; }
.os-boxes { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin: 0 0 12px; }
.os-box { background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--mod, var(--kraft)); border-radius: 8px; padding: 10px 12px; display: grid; gap: 2px; }
.os-box span { color: var(--muted); font-size: 12.5px; }
.os-box b { font-size: 18px; }
.os-box small { color: var(--muted); }
.os-box.late { border-left-color: #e34948; }
.os-box.late b { color: #e34948; }
.os-box.soon { border-left-color: #e8a33d; }
.os-box.soon b { color: #b54708; }
.os-box.age { border-left-color: #cfcac2; }
table.os-grid tr.os-late td { color: #b42318; }
table.os-grid tr.os-soon td { color: #b54708; }
table.os-grid tr.grp-total td { background: #f6f4f0; border-top: 1px solid var(--line); }
@media (max-width: 640px) {
    table.paybills thead { display: none; }
    table.paybills tbody tr:not(.empty-row) { display: grid !important; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px 10px; position: relative;
        background: #fff; border: 1px solid #d9d4cb !important; border-left: 5px solid var(--mod) !important; border-radius: 10px; margin: 0 0 10px; padding: 11px 10px 12px !important; }
    table.paybills tbody tr.on { background: var(--mod-tint); }
    table.paybills tbody tr:not(.empty-row) > td { display: block !important; padding: 0 !important; border: 0 !important; text-align: left !important; min-width: 0; background: transparent !important; }
    table.paybills tbody tr:not(.empty-row) > td::before { display: block; content: attr(data-label); font-size: 12px; color: var(--muted); margin: 0 0 3px; }
    table.paybills td.tick-col { position: absolute; top: 11px; left: 10px; }
    table.paybills td.tick-col::before { content: none !important; }
    table.paybills td.tick-col input { width: 22px; height: 22px; margin: 0; }
    table.paybills td.pb-no { grid-column: 1 / -1; padding-left: 32px !important; font-size: 16px; }
    table.paybills td.pb-no::before { content: none !important; }
    table.paybills td.pb-open { background: var(--mod-tint) !important; border-radius: 6px; padding: 6px 8px !important; }
    table.paybills input.b-amt, table.paybills input.b-disc { width: 100%; }
    .os-boxes { grid-template-columns: 1fr 1fr; }
}
/* document number as a link (opens the document) */
a.doc-link { color: var(--link, #1d4f91); text-decoration: none; }
a.doc-link:hover { text-decoration: underline; }
/* Sales Bill / Purchase Entry details: payment history box at the bottom */
.pay-hist-sum { display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 10px 2px 2px; border-top: 1px solid var(--line); margin-top: 8px; font-size: 14px; }

/* Sales Bill approval box (2026-11-11) */
.appr-box { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; border-left: 4px solid #e8a33d; }
.appr-box.appr-done { border-left-color: var(--ok); }
.appr-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.appr-reject { display: inline-flex; gap: 6px; align-items: center; }
.appr-reject input { width: 200px; }
@media (max-width: 640px) {
    .appr-actions, .appr-reject { width: 100%; }
    .appr-reject input { flex: 1 1 auto; width: auto; }
}

/* =====================================================================
   SALES ORDER - Check Stock popup: reel-wise / lot-wise list (2026-11-11), biggest first with running KG.
   PC: normal table, scrolls inside the popup. Phone Card style (uses .sacard): Reel / Lot no. on top | Godown, KG | Running KG, (Sheets) | Barcode full width.
   ===================================================================== */
.st-pieces { max-height: 320px; overflow-y: auto; border: 1px solid #e6e1d8; border-radius: 6px; }
.st-pieces table { margin: 0; }
.st-pieces thead th { position: sticky; top: 0; background: #f6f4f0; z-index: 1; }
table.stpiece td.sp-run { color: var(--muted); }
@media (max-width: 640px) {
    .st-pieces { max-height: none; border: 0; overflow: visible; }
    table.stpiece thead { display: none; }
    table.stpiece td.sp-n { display: none !important; }
    table.stpiece td.sp-no { order: 1; grid-column: 1 / -1; font-size: 16px; font-weight: 700; }
    table.stpiece td.sp-no::before { display: inline !important; margin-right: 6px !important; font-size: 12px; font-weight: 400; }
    table.stpiece td.sp-gd { order: 2; }
    table.stpiece td.sp-kg { order: 3; font-weight: 700; background: var(--mod-tint); border-radius: 6px; padding: 6px 8px !important; }
    table.stpiece td.sp-qty { order: 4; } table.stpiece td.sp-run { order: 5; }
    table.stpiece td.sp-bc { order: 6; grid-column: 1 / -1; font-size: 13px; }
}

/* Other charges copied from the SO / PO onto a bill (2026-11-12): small note under the charge grid */
.chg-note { margin: 6px 0 0; padding: 6px 10px; background: #fff7e6; border-left: 3px solid #e0a84a; border-radius: 4px; font-size: 13px; }

/* =====================================================================
   PORTAL REQUEST TRACKING report (2026-11-12): request rows + reel rows with their invoices
   ===================================================================== */
.ptrack .pp-ist { display: inline-block; font-weight: 600; font-size: 12.5px; background: #f1efeb; border-radius: 999px; padding: 1px 8px; white-space: nowrap; }
.ptrack .pp-ist.st-billed { background: #e3f4e8; color: #1f6b3a; }
.ptrack .pp-ist.st-held, .ptrack .pp-ist.st-reserved { background: #e6eefc; color: #234a8c; }
.ptrack .pt-bill { white-space: nowrap; }
.ptrack .pt-bill + .pt-bill { margin-top: 2px; }
@media (max-width: 640px) { .ptrack .pt-bill { white-space: normal; } }
@media print { .ptrack .ord-detail[hidden] { display: none; } }

/* Customer Portal - My Requests tracking (2026-11-12): Sent -> Confirmed -> Billed steps, invoice list, invoice under each reel */
.pp-steps { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 4px; }
.pp-step { flex: 1 1 120px; padding: 6px 10px; border-radius: 8px; background: #f1efeb; color: var(--muted); font-weight: 600; font-size: 13px; }
.pp-step small { display: block; font-weight: 400; font-size: 12px; }
.pp-step.done { background: #e3f4e8; color: #1f6b3a; }
.pp-step.now { background: #fff3d6; color: #8a5a00; }
.pp-invs { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.pp-inv { white-space: nowrap; background: #f7f5f1; border-radius: 6px; padding: 1px 8px; }
.pp-item .pp-ibill { flex-basis: 100%; font-size: 12.5px; }

/* ---- Admin > Clear All Entries (2026-11-12): deleted counts | kept + stock in hand, side by side (one column on phones) */
.ce-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.ce-grid table.grid { width: 100%; }
.ce-keep { margin: 0 0 12px 18px; padding: 0; line-height: 1.7; }
@media (max-width: 760px) { .ce-grid { grid-template-columns: 1fr; } }

/* ---- Excel download menu (2026-11-12): "Excel ▾" button -> .xlsx / .csv (Views/Shared/_ExcelMenu) */
.xl-menu { position: relative; display: inline-block; }
.xl-menu > summary { list-style: none; cursor: pointer; }
.xl-menu > summary::-webkit-details-marker { display: none; }
.xl-list { position: absolute; right: 0; top: calc(100% + 4px); z-index: 50; min-width: 190px; background: #fff;
           border: 1px solid var(--line, #ddd); border-radius: 8px; box-shadow: 0 6px 18px rgba(0,0,0,.12); padding: 4px 0; }
.xl-list a { display: block; padding: 9px 14px; color: inherit; text-decoration: none; white-space: nowrap; }
.xl-list a:hover { background: #f3f6fa; }
@media print { .xl-menu { display: none; } }

/* =====================================================================
   PHONE CARD STYLE (2026-11-12) for two tables that were still the PC table scrolled sideways. PC unchanged.
   1) Other Charges on entry screens (SO, PO, Purchase Entry, Sales Bill, Sales / Purchase Return - table.charge-grid):
      "Charge n" strip, Charge full width, Basis | Rate, On | Amount, GST % | GST, Total highlighted, Remove full width at the bottom.
   2) Portal Request Tracking: each reel / lot inside a request (tr.pt-reel) = small card (also used for the order lines of Pending SO / PO Summary):
      reel / lot no. + barcode on top, status top-right, Paper / Size full width, KG (| Sheets), invoices full width.
   ===================================================================== */
@media (max-width: 640px) {
    /* ---- 1) Other Charges */
    .line-grid.charge-grid { min-width: 0; background: transparent; }
    table.charge-grid thead { display: none; }
    table.charge-grid tbody { counter-reset: chg; }
    table.charge-grid tbody tr { display: grid !important; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px 10px;
                                 background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--mod); border-radius: 10px;
                                 padding: 10px 10px 12px; margin: 0 0 10px; }
    table.charge-grid tbody tr::before { counter-increment: chg; content: "Charge " counter(chg); grid-column: 1 / -1;
                                         font-weight: 700; font-size: 13px; color: var(--mod-dark); }              /* Charge 1, Charge 2 ... */
    table.charge-grid tbody td { display: block !important; width: auto !important; padding: 0 !important; border: 0 !important; text-align: left !important; }
    table.charge-grid tbody td::before { display: block; content: attr(data-label); font-size: 12px; color: var(--muted); margin: 0 0 3px; }
    table.charge-grid tbody td.cn { display: none !important; }                                                    /* # column: the strip shows the number */
    table.charge-grid tbody td[data-label="Charge"], table.charge-grid tbody td.chg-act { grid-column: 1 / -1; }   /* full width */
    table.charge-grid tbody td input, table.charge-grid tbody td select { width: 100% !important; min-width: 0 !important; }
    table.charge-grid tbody td.num { font-weight: 600; padding-top: 2px !important; }                              /* On / GST / Total: text */
    table.charge-grid tbody td.chg-total { grid-column: 1 / -1; background: var(--mod-tint); border-radius: 8px; padding: 6px 10px !important; font-size: 15px; }
    table.charge-grid tbody td.chg-act::before { content: none; }
    table.charge-grid tbody td.chg-act .btn { width: 100%; }
    table.charge-grid tbody td .chg-calc { margin-top: 4px; }

    /* ---- 2) Portal tracking: reel / lot cards inside the request */
    table.tcard tr.pt-reel { display: grid !important; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 6px 12px; position: relative;
                             background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--mod-tint); border-radius: 10px;
                             padding: 9px 10px 8px; margin: 0 0 8px; }
    table.tcard tr.pt-reel > td { display: block !important; width: auto !important; padding: 0 !important; border: 0 !important; background: transparent !important;
                                  text-align: left !important; font-size: 14px; min-width: 0; overflow-wrap: anywhere; }
    table.tcard tr.pt-reel > td::before { display: block; content: attr(data-label); font-size: 11.5px; color: var(--muted); margin: 0 0 1px; }
    table.tcard tr.pt-reel > td.m-title { grid-column: 1 / -1; font-size: 15px; padding-right: 96px !important; }
    table.tcard tr.pt-reel > td.m-title::before, table.tcard tr.pt-reel > td.m-chip::before { content: none; }
    table.tcard tr.pt-reel > td.m-title .muted { display: block; font-size: 12.5px; font-weight: 400; }
    table.tcard tr.pt-reel > td.m-chip { position: absolute; top: 9px; right: 10px; }
    table.tcard tr.pt-reel > td.m-full { grid-column: 1 / -1; }
    table.tcard tr.pt-reel > td.m-full:empty { display: none !important; }                       /* no note -> no empty box */
}

/* ---- GST registers (2026-11-12, Views/Reports/GstRegister): totals row, credit / debit notes tinted, 2nd rate row of a document lighter */
table tr.gst-tot td { border-top: 2px solid var(--mod); background: var(--mod-tint); }
table.gst-reg tr.gst-note td { background: #fffaf3; }
table.gst-reg tr.gst-more td.m-title a { color: var(--muted); }                 /* same document, next GST rate */
table.gst-reg td[data-label="Date"], table.gst-reg td.m-title a, table.gst-reg td.mono { white-space: nowrap; }   /* PC: no broken dates / numbers */
@media (max-width: 640px) {
    /* register card: section chip top-right, notes tinted as a whole card, empty Invoice Value (2nd GST rate row) hidden */
    table.gst-reg tbody tr { position: relative; }
    table.gst-reg tbody td.m-chip { position: absolute; top: 12px; right: 12px; }
    table.gst-reg tbody td.m-chip::before { content: none !important; }
    table.gst-reg tbody td.m-title { padding-right: 70px !important; }
    table.gst-reg tbody tr.gst-note { background: #fffaf3 !important; }
    table.gst-reg tbody tr.gst-note td { background: transparent !important; }
    table.gst-reg tbody td:empty { display: none !important; }
    table.dcard tfoot { display: block !important; width: 100%; }
    /* totals = one more card at the end, highlighted (Phone Card style) */
    table.dcard tfoot tr.gst-tot { display: grid !important; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px 12px;
                                   background: var(--mod-tint); border: 1px solid var(--line); border-left: 4px solid var(--mod); border-radius: 10px; padding: 12px; margin: 4px 0 10px; }
    table.dcard tfoot tr.gst-tot td { display: block !important; border: 0 !important; padding: 0 !important; background: transparent !important; text-align: left !important; }
    table.dcard tfoot tr.gst-tot td::before { display: block; content: attr(data-label); font-size: 11.5px; color: var(--muted); }
    table.dcard tfoot tr.gst-tot td.m-title { grid-column: 1 / -1; font-size: 16px; }
    table.dcard tfoot tr.gst-tot td.gst-blank { display: none !important; }
}

/* ---- Sales Export for Tally (2026-11-12): preview table; Other Charge rows tinted. Phone: same wide table scrolled sideways (xscroll) */
table.tally-grid td { white-space: nowrap; }
table.tally-grid tr.tally-chg td { background: #fff7e0; }

/* ---- Payments phase 2 (2026-11-12): credits (returned after payment / on account) green, Dues Summary colours, Reminder button,
        credit rows on the receipt screen, returns table in the bill's payment box. Phone: dcard / paybills cards as before. */
table.os-grid tr.os-credit td { color: #067647; }
table.os-grid td a { color: inherit; text-decoration: underline dotted; }
.os-rem { margin-left: 8px; }
table.dues-grid tr.os-late td.m-hi { color: #b42318; }
table.dues-grid tr.os-soon td.m-hi { color: #b54708; }
table.dues-grid td.actions { white-space: nowrap; }
.paybills tr.pb-credit td { background: #ecfdf3; }
.paybills tr.pb-credit td.pb-open { color: #067647; }
table.pay-ret { margin-bottom: 10px; }
@media (max-width: 640px) {
    table.dues-grid td.actions { white-space: normal; display: flex !important; gap: 6px; }
    table.dues-grid td.actions .btn { flex: 1; }
}

/* ---- Company Master: Test Mail inside the Email Gateway box (2026-11-13); phone: box above, button full width below */
.test-mail-row { display: flex; gap: 8px; }
.test-mail-row input { flex: 1; min-width: 0; }
@media (max-width: 640px) {
    .test-mail-row { flex-direction: column; }
    .test-mail-row .btn { width: 100%; }
}

/* ---- Company Master letterhead (2026-11-13): choose | upload | preview side by side; phone: one under the other */
.lh-row { display: grid !important; grid-template-columns: 1.1fr 1fr 1.3fr; gap: 16px; align-items: start; }
.lh-col { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.lh-col .radio-list .check { margin: 0 0 6px; }
.lh-preview { max-height: 120px; width: 100%; object-fit: contain; margin: 0; }
@media (max-width: 760px) { .lh-row { grid-template-columns: 1fr; } }

/* ---- Purchase against PO (2026-11-13): search box in the "Fill from PO" popup; rows hidden by the search (PC table and phone cards) */
.fill-search { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 6px 0 10px; }
.fill-search .fill-q { flex: 1 1 260px; min-width: 0; }
.fill-grid tbody tr[hidden] { display: none !important; }
#addLineBtn[hidden], #addLineBtnBottom[hidden] { display: none !important; }   /* against PO: lines only from Fill lines from PO */
@media (max-width: 700px) { .fill-search .fill-q { flex-basis: 100%; } }

/* ---- Print preview on report pages (2026-11-13, site.js): the page shown as it prints, with [Print again] [Close preview] on top.
        Same on PC and phone. The bar itself is never printed (no-print). */
body.pt-printview .sidebar, body.pt-printview .topbar, body.pt-printview .overlay, body.pt-printview .alert,
body.pt-printview .content .no-print:not(.pv-bar) { display: none !important; }
body.pt-printview .content { margin: 0 !important; max-width: none !important; padding: 0 16px 24px !important; }
body.pt-printview { background: #fff; }
body.pt-printview .print-only { display: inline; }
.pv-bar { position: sticky; top: 0; z-index: 60; display: flex; gap: 10px; justify-content: center; flex-wrap: wrap;
          margin: 0 -16px 12px; padding: 10px 12px; background: #f1f4f8; border-bottom: 1px solid #d9dee6; }
@media (max-width: 640px) { .pv-bar .btn { flex: 1 1 0; } }

/* ---- Customer / Supplier Master: outstanding next to the Active tick (2026-11-13). PC side by side, phone below (full width). */
.active-row { display: flex; align-items: center; gap: 10px 18px; flex-wrap: wrap; }
.party-dues { display: flex; align-items: center; gap: 4px 12px; flex-wrap: wrap; padding: 6px 12px; border-radius: 8px; border: 1px solid #d9dee6; background: #f6f8fb; font-size: 14px; }
.party-dues span { color: var(--muted); }
.party-dues.pd-late { border-color: #f5c2bd; background: #fdecea; }
.party-dues.pd-late b { color: #b42318; }
.party-dues.pd-clear { border-color: #b9e2cc; background: #e7f5ee; }
.party-dues.pd-clear b { color: #067647; }
@media (max-width: 640px) { .party-dues { width: 100%; } }

/* ---- Search / Filter box on phones (2026-11-13, site.js): starts folded as one bar; open = 2 boxes per row */
.ff-toggle { display: none; }
@media (max-width: 640px) {
    form.filters { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 8px 10px; }
    form.filters .ff-toggle { display: flex; grid-column: 1 / -1; justify-content: center; align-items: center; gap: 8px; width: 100%; font-weight: 600; }
    form.filters .ff-count { background: var(--mod, #1f5fa8); color: #fff; border-radius: 10px; padding: 1px 8px; font-size: 12px; font-weight: 700; }
    form.filters.ff-folded > *:not(.ff-toggle):not(.from-summary):not([type=hidden]) { display: none !important; }
    form.filters > .from-summary, form.filters > .form-actions, form.filters > .filter-actions, form.filters > .filter-btn,
    form.filters > .dates-field, form.filters > .custom-dates { grid-column: 1 / -1; }
    form.filters > .filter-btn > label { display: none; }                                         /* empty label above Show / Clear */
}

/* ---- Goods Receipt by photo (2026-11-13, pe-photo.js on Purchase against PO) - PC table, phone cards (dcard) */
/* choice Manual entry / Photo of Packing Slip: two big buttons side by side (phone: one under the other) */
.pe-choice { display: flex; gap: 12px; margin: 4px 0 14px; }
.pe-choice button { flex: 1 1 0; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; text-align: left; cursor: pointer;
                    padding: 12px 16px; border: 2px solid var(--border, #d9d4cb); border-radius: 10px; background: #fff; font: inherit; color: inherit; }
.pe-choice button b { font-size: 15.5px; }
.pe-choice button small { color: var(--muted, #6b6b6b); font-size: 12.5px; }
.pe-choice button.on { border-color: var(--mod, #1f5fa8); background: #eef4fb; box-shadow: inset 0 0 0 1px var(--mod, #1f5fa8); }   /* chosen */
.pe-choice-ro button { cursor: default; }                                                   /* Edit: shows how it was entered, cannot change */
.pe-choice-ro button:not(.on) { opacity: .5; background: #f6f6f6; }
.pe-choice button:focus-visible { outline: 2px solid var(--mod, #1f5fa8); outline-offset: 2px; }
.pe-photo-only[hidden], .pe-manual-only[hidden] { display: none !important; }                 /* parts of the other choice (buttons / Fill from PO are display:flex) */
.card-title { font-size: 16px; margin: 0 0 2px; grid-column: 1 / -1; }                           /* heading inside a form card (Invoice Detail) */
#pePhotoCard .gr-papers { width: 100%; margin-top: 4px; }
@media (max-width: 640px) {
    .pe-choice { flex-direction: column; gap: 8px; }
    .pe-choice button { padding: 10px 14px; }
}
.gr-photo-btns { display: flex; gap: 10px; flex-wrap: wrap; }
.gr-thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 4px; }
.gr-thumb { position: relative; width: 84px; height: 110px; border: 1px solid var(--border, #d9d4cb); border-radius: 6px; overflow: hidden; background: #f6f6f6;
            display: flex; align-items: center; justify-content: center; font-size: 11px; text-align: center; padding: 2px; }
.gr-thumb img { width: 100%; height: 100%; object-fit: cover; }
.gr-thumb.bad { border: 2px solid #b42318; }                                                 /* photo failed the check on the phone: not sent */
.gr-thumb.bad img { opacity: .55; }
.gr-thumb .gr-bad { position: absolute; left: 0; right: 0; bottom: 0; background: #b42318; color: #fff; font-size: 10.5px; font-style: normal;
                    font-weight: 600; padding: 2px 3px; line-height: 1.2; }
.gr-thumb .ic { position: absolute; top: 3px; right: 3px; height: 24px; min-width: 24px; padding: 0; font-size: 12px; }
.gr-ok { color: #067647; font-weight: 600; }
.gr-warn { color: #8a5a00; font-weight: 600; }
.gr-err { color: #b42318; font-weight: 600; }
.gr-check { padding: 8px 12px; display: flex; flex-direction: column; gap: 4px; }
table.gr-rows input, table.gr-rows select, table.gr-papers select { width: 100%; min-width: 70px; }
table.gr-rows td input[data-f=reelNo] { min-width: 110px; }
tr.gr-miss > td { background: #fff4e5; }                                                    /* paper not chosen yet */
.gr-sheet { display: none; }
body.gr-is-sheet .gr-sheet { display: table-cell; }
@media (max-width: 640px) {
    .gr-photo-btns .btn { flex: 1 1 0; }
    body.gr-is-sheet table.dcard tbody td.gr-sheet { display: block; }
    tr.gr-miss { border-left-color: #f79009 !important; }
    table.dcard tbody tr.gr-miss { background: #fff4e5 !important; }                                 /* phone card: whole card orange, not each box */
    table.dcard tbody tr.gr-miss > td { background: transparent !important; }
}
.mode-badge.pending { background: #fff4e5; color: #8a5a00; }                                 /* store goods receipt pending for approval (2026-11-13) */
/* Sales Bill reel picker: reel of a store goods receipt pending for approval (2026-11-13) - greyed, cannot be ticked */
tr.sp-pendappr > td { background: #f4f4f4; color: #777; }
.hold-mark.pend-appr { background: #fff4e5; color: #8a5a00; border: 1px solid #f0d68a; }
body:not(.gr-is-sheet) table.dcard tbody td.gr-sheet, body:not(.gr-is-sheet) table.dcard thead th.gr-sheet { display: none !important; }   /* reels: no Length / Sheets */
table.gr-rows select[data-f=itemId] { min-width: 220px; }
.irn-cxl[hidden] { display: none !important; }                                                 /* bill page Manual entry: IRN cancel date / reason / remark only for "Cancelled on portal" */

/* ---------------- Customer Complaints (2026-11-14): office + portal ---------------- */
.badge-open { background: #fdecea; color: var(--err); font-weight: 600; }                       /* Open = nobody on it yet */
.pre-text { white-space: pre-wrap; font-weight: normal; }                                     /* typed text keeps its lines */
.cmp-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }                       /* ready complaint types: one tap */
.chip { border: 1px solid var(--line); background: #faf8f5; color: var(--ink); border-radius: 999px; padding: 4px 12px; font-size: 13px; cursor: pointer; }
.chip:hover, .chip:focus { border-color: var(--kraft); color: var(--kraft-dark); }
.cmp-reels { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 6px; }
.cmp-reels > p { grid-column: 1 / -1; margin: 4px 0; }
#reelBox .cmp-reel, .cmp-reels .cmp-reel { display: grid; grid-template-columns: 22px 1fr auto; gap: 2px 8px; align-items: center; border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; cursor: pointer; background: #fff;
    margin: 0; font-size: 14px; font-weight: 400; white-space: normal; overflow: visible; text-overflow: clip; }   /* not the form-label look */
#reelBox .cmp-reel:has(input:checked), .cmp-reels .cmp-reel:has(input:checked) { border-color: var(--err); background: #fff6f5; }        /* ticked = bad reel */
.cmp-reels .cmp-reel input { grid-column: 1; grid-row: 1 / span 3; width: 18px; height: 18px; margin: 0; }
.cmp-reels .cmp-reel .cr-main { grid-column: 2; grid-row: 1; }
.cmp-reels .cmp-reel .cr-kg { grid-column: 3; grid-row: 1; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cmp-reels .cmp-reel .cr-item, .cmp-reels .cmp-reel .cr-mill { grid-column: 2 / span 2; font-size: 13px; color: var(--muted); }
.cmp-reels .cmp-reel .cr-mill { color: #5b4a36; }
.cmp-list td.cmp-text { max-width: 320px; }
.cmp-list td.cmp-text { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }   /* long text: 2 lines in the list */
.cmp-resolved { background: #eef8f2; border-radius: 6px; padding: 8px 10px; }
.cmp-resolved span { color: var(--ok) !important; }
.cmp-status textarea { width: 100%; }
.cmp-onbill .badge { margin-left: 4px; }
.cmp-status .action-bar { margin-top: 10px; }
.cmp-file-list { list-style: none; margin: 6px 0 10px; padding: 0; }
.cmp-file-list li { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid #efece7; }
.cmp-file-list li > a:first-child { font-weight: 600; word-break: break-all; }
.cmp-upload { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.cmp-log { list-style: none; margin: 6px 0 0; padding: 0 0 0 14px; border-left: 2px solid var(--line); }
.cmp-log li { position: relative; padding: 0 0 12px 6px; }
.cmp-log li::before { content: ""; position: absolute; left: -21px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--kraft); border: 2px solid #fff; }
.cmp-log li.act-reopen::before { background: var(--err); }
.cmp-log li.act-status::before { background: var(--ok); }
.cmp-log li.by-cust::before { background: #1d4f91; }                                             /* customer's own lines: blue */
.cmp-log .cl-head { font-size: 14px; }
.cmp-log .cl-text { font-size: 14px; margin-top: 2px; }
.pp-head-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.pp-head-row .pp-h1 { margin: 0; }
.pp-cmp .pp-log { margin-top: 10px; }
.pp-cmp-msg { margin-top: 8px; border-top: 1px dashed var(--line); padding-top: 8px; }
.pp-cmp-msg textarea { width: 100%; }
.pp-cmp-btns { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; margin-top: 6px; }
@media (max-width: 640px) {
    .cmp-reels { grid-template-columns: 1fr; }
    .cmp-reels .cmp-reel { padding: 10px; }                                                                   /* bigger tap area */
    .chip { padding: 7px 14px; font-size: 14px; }
    .cmp-list td.cmp-text { max-width: none; display: block; }
    .cmp-upload input[type=file], .pp-cmp-btns input[type=file] { width: 100%; }
    .cmp-file-list li .btn { margin-left: auto; }
}
@media print {
    .cmp-status, .cmp-upload, .cmp-file-list .btn, .cmp-file-list form { display: none !important; }
}
.cmp-status.form, .cmp-mill.form { display: block; }                                           /* one column: remark / tick / buttons under each other */
.cmp-status.form > * + *, .cmp-mill.form > * + * { margin-top: 8px; }

/* ---------------- Credit / Debit Notes (2026-11-14): entry, page ---------------- */
.ro-box { padding: 7px 10px; border: 1px dashed var(--line); border-radius: 6px; background: #faf8f5; }   /* fixed value shown as text */
.note-type { display: inline-flex; }
.note-find { max-width: 260px; margin-left: auto; }
table.note-reels td.nr-in input { width: 96px; text-align: right; }
table.note-reels .nr-full { margin-left: 4px; }
table.note-reels tr.on td { background: #fff8e1; }                                           /* reels in the note */
table.note-reels tr.bad td { background: #fdecea; }                                          /* more KG than left */
table.note-reels tr.bad .nr-kg { border-color: var(--err); }
.note-other { display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(0, 1.6fr) 100px 100px 120px auto; gap: 8px; align-items: end;
    padding: 8px 0; border-bottom: 1px solid #efece7; }
.note-other .no-f label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 2px; }
.note-other .no-f input, .note-other .no-f select { width: 100%; }
.note-other .no-f[hidden] { display: none; }
.note-other .no-amt[readonly] { background: #f5f3ef; }
#addOther { margin-top: 8px; }
.note-foot { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap-reverse; }
.note-tot { border-collapse: collapse; min-width: 260px; margin-left: auto; }
.note-tot td { padding: 3px 8px; }
.note-tot tr[hidden] { display: none; }
.note-tot .grand-row td { border-top: 2px solid var(--ink); font-weight: 700; font-size: 1.1em; }
.note-tot-r { margin-top: 10px; }
details.inline-cancel { display: inline-block; }
details.inline-cancel > summary { list-style: none; display: inline-block; }
details.inline-cancel > summary::-webkit-details-marker { display: none; }
details.inline-cancel[open] { display: block; width: 100%; }
details.inline-cancel[open] .cancel-box { margin-top: 8px; }
.note-einv .einv-row { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: flex-start; }
.note-actions .inline-form { display: inline; }
@media (max-width: 640px) {
    /* reels = Phone Card style: heading reel no., paper full width, Billed KG | Amount, Note KG | Rate side by side */
    table.note-reels, table.note-reels tbody { display: block; }
    table.note-reels thead { display: none; }
    table.note-reels tr.nr-row { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; border: 1px solid var(--line); border-left: 4px solid var(--mod, #5b4bb7);
        border-radius: 0; padding: 8px 10px; margin-bottom: 8px; background: #fff; }
    table.note-reels tr.nr-row[hidden] { display: none; }
    table.note-reels tr.nr-row td { display: block; padding: 0; border: 0; background: none !important; text-align: left; }
    table.note-reels tr.nr-row td::before { content: attr(data-label); display: block; font-size: 11.5px; color: var(--muted); }
    table.note-reels tr.nr-row td.m-hide { display: none; }
    table.note-reels tr.nr-row td.m-title, table.note-reels tr.nr-row td.m-full { grid-column: 1 / -1; }
    table.note-reels tr.nr-row td.m-title::before { display: none; }
    table.note-reels tr.nr-row.on { background: #fff8e1; border-left-color: #d4a017; }
    table.note-reels tr.nr-row.bad { background: #fdecea; border-left-color: var(--err); }
    table.note-reels td.nr-in input { width: 100%; }
    table.note-reels td.nr-in { display: flex !important; flex-wrap: wrap; align-items: center; gap: 4px; }
    table.note-reels td.nr-in::before { width: 100%; }
    table.note-reels td.nr-in input { flex: 1; }
    .note-other { grid-template-columns: 1fr 1fr; border: 1px solid var(--line); border-radius: 6px; padding: 8px; margin-bottom: 8px; }
    .note-other .no-against, .note-other .no-desc { grid-column: 1 / -1; }
    .note-other .no-del { grid-column: 1 / -1; }
    .note-find { max-width: none; width: 100%; margin-left: 0; }
    .form.g12 .field .note-type { display: flex; width: 100%; }
    .form.g12 .field .note-type label { flex: 1 1 0; display: flex; justify-content: center; overflow: visible; margin: 0; }
    .note-foot.sticky-actions { position: static; }                                          /* totals box too tall to stick on a phone */
    .note-tot { width: 100%; }
    .note-foot .action-bar { width: 100%; }
}

/* ---------------- TAX BOX (2026-11-14): vertical totals on every entry screen (Views/Shared/_TaxBox.vbhtml + Scripts/tax-box.js) ---------------- */
.totals-wrap { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px 28px; flex-wrap: wrap; padding-top: 12px; border-top: 1px solid var(--line); }
.totals-wrap > .totals-left { border-top: 0; padding-top: 4px; justify-content: flex-start; flex: 1 1 260px; }
.tax-box { border-collapse: collapse; min-width: 280px; margin-left: auto; font-variant-numeric: tabular-nums; }
.tax-box td { padding: 3px 8px; }
.tax-box td.num { text-align: right; min-width: 110px; }
.tax-box tr[hidden] { display: none; }
.tax-box tr.tb-sub td { border-top: 1px dashed var(--line); font-weight: 600; }               /* taxable = amount before GST */
.tax-box tr.grand-row td { border-top: 2px solid var(--ink); font-weight: 700; font-size: 1.12em; padding-top: 6px; }
.tax-box tr.grand-row td.num { color: var(--kraft); }
.hide-rates .totals-wrap .rate-col { display: none !important; }
@media (max-width: 640px) {
    .totals-wrap > .totals-left { flex-basis: 100%; }
    .tax-box { width: 100%; min-width: 0; }
}
.tax-box tr.tb-after td { font-size: 0.92em; color: var(--muted); }                       /* cash outside the bill, under the total */
.tax-box tr.tb-after:first-of-type td, .tax-box tr.grand-row + tr.tb-after td { padding-top: 10px; }
.tax-box tr.tb-after-total td { font-weight: 700; border-top: 1px solid var(--line); }
.card > .totals-wrap:first-child, .card.totals-wrap { border-top: 0; padding-top: 0; }    /* totals box as the first thing in its own card: no extra line */
.tax-box tr.tb-ro input { width: 110px; text-align: right; padding: 3px 6px; }                  /* Purchase Entry: round off typed as on the supplier's bill */
.tax-box tr.tb-ro input.typed { border-color: var(--kraft); background: #fff8ec; }               /* typed = not the worked-out figure */
.tax-box tr.tb-ro label { font-weight: 400; margin: 0; display: inline; }

/* =====================================================================
   SCREEN GUIDE (2026-11-26, Scripts/screen-guide.js) - only on forms with a step bar (class fg-on)
   yellow = select only, green = typed by the user, white = filled by the system;
   field numbers + step numbers: red circle, yellow number
   ===================================================================== */
form.fg-on select:not([disabled]):not([data-locked]):not([multiple]) { background-color: #fff3b0; border-color: #e2c84a; }   /* select only */
form.fg-on input:not([type=checkbox]):not([type=radio]):not([type=hidden]):not([type=button]):not([type=submit]):not([type=file]):not([type=search]):not([readonly]):not([disabled]):not(.readonly),
form.fg-on textarea:not([readonly]):not([disabled]) { background-color: #dff3e4; border-color: #9fd3ad; }                   /* typed by the user */
form.fg-on .input-validation-error, form.fg-on input.bad, form.fg-on input.sz-box.bad { background-color: #fdecea !important; }   /* errors stay red */
.fno { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 3px; box-sizing: border-box;
       border-radius: 9px; background: #c62828; color: #ffeb3b; font-size: 11px; font-weight: 700; line-height: 1; margin-right: 5px; vertical-align: middle; }
table tbody tr > td.fg-lbl::before { content: none !important; display: none !important; }   /* card grid: our label (with the number) replaces the page's label */
.fg-lab { display: flex; align-items: center; font-size: 11.5px; color: var(--muted); margin: 0 0 2px; white-space: nowrap; }
.pk-c .fno { margin-right: 4px; }                                               /* number on the packing slip title row */
/* step bar */
.stepbar { display: flex; align-items: center; gap: 4px; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px;
           margin-bottom: 12px; position: sticky; top: 0; z-index: 15; overflow-x: auto; }
.stepbar .st { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 3px; border: 0; border-radius: 16px; background: none;
               font: inherit; font-size: 13px; white-space: nowrap; cursor: pointer; color: var(--muted); }
.stepbar .st small { color: var(--muted); font-size: 11px; }
.stepbar .no { width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 22px;
               background: #c62828; color: #ffeb3b; font-weight: 700; font-size: 12px; }
.stepbar .done .no { opacity: .55; }                                            /* done: faded, with a tick */
.stepbar .next { background: #fdecea; color: #c62828; font-weight: 600; }       /* do this now */
.stepbar .next .no { box-shadow: 0 0 0 3px #f5b5b0; transform: scale(1.1); }
.stepbar .sep { color: #c8c2b8; }
.stepbar .hint { margin-left: auto; padding-left: 12px; font-size: 12px; color: var(--muted); white-space: nowrap; }
/* status strip on Details pages (Views/Shared/_StatusStrip.vbhtml) */
.statstrip { display: flex; background: #fff; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin-bottom: 12px; }
.statstrip .s { flex: 1; padding: 7px 10px; font-size: 13px; border-right: 1px solid var(--line); min-width: 0; }
.statstrip .s:last-child { border-right: 0; }
.statstrip .s b { display: flex; align-items: center; gap: 5px; font-size: 13px; }
.statstrip .s small { color: var(--muted); display: block; margin-top: 2px; }
.statstrip .s .no { width: 20px; height: 20px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 20px;
                    background: #c62828; color: #ffeb3b; font-size: 11px; font-weight: 700; }
.statstrip .ok { background: #f2f3f4; } .statstrip .ok .no { opacity: .55; } .statstrip .ok b { color: #6b7178; }
.statstrip .now { background: #fdecea; } .statstrip .now b { color: #c62828; }
.statstrip .later b { color: #6b7178; font-weight: 600; }
@media (max-width: 900px) { .stepbar { top: 46px; } }                          /* below the phone top bar */
@media (max-width: 700px) {
    .stepbar .st:not(.next) .lbl { display: none; }                             /* phone: numbers only, the current step with its name */
    .stepbar .st { padding: 2px; } .stepbar .st.next { padding: 3px 10px 3px 3px; }
    .stepbar .hint { display: none; }
    .statstrip { flex-wrap: wrap; } .statstrip .s { flex: 1 1 33%; border-bottom: 1px solid var(--line); }
}
@media print { .stepbar, .statstrip { display: none !important; } .fno { display: none !important; } }

/* number boxes (2026-11-26): no ▲▼ arrows - values change only by typing (the mouse wheel is blocked in site.js) */
input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; appearance: textfield; }
.statstrip .st-links:empty { display: none; }
.statstrip .st-links { display: flex; gap: 12px; margin-top: 4px; flex-wrap: wrap; }       /* links inside a status box (Make Payment | History) */
.statstrip .st-links a { font-size: 12px; font-weight: 600; color: #1d4f91; text-decoration: underline; }
.statstrip .st-links a.st-locked { color: var(--muted); text-decoration: none; }
.fno.fno-btn { margin: 0 6px 0 0; box-shadow: 0 0 0 1px rgba(255,255,255,.7); }     /* number on a Save / Update button */

/* ===================================================================== PURCHASE AGAINST PO IN TABS (2026-11-26, Scripts/pe-tabs.js)
   1 Supplier | 2 Invoice | 3 Packing List | 4 Total - one tab shown at a time; green tick = done, red = something missing */
form[data-tabs] .tab-off { display: none !important; }                       /* sections of the other tabs */
.pe-tabwrap { position: sticky; top: 0; z-index: 30; background: var(--page); padding-top: 4px; margin-bottom: 12px; }
.pe-tabs { display: flex; gap: 4px; border-bottom: 2px solid #a0673a; }
.pe-tabs button { display: flex; align-items: center; gap: 7px; border: 1px solid #d9cfc2; border-bottom: 0; background: #ece6dd; color: #555;
    padding: 9px 18px; border-radius: 8px 8px 0 0; font: 600 14px inherit; cursor: pointer; }
.pe-tabs button.on { background: #fff; color: #7a4a22; border-color: #a0673a; position: relative; top: 2px; padding-bottom: 11px; }
.pe-tabs .tn { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: #bbb; color: #fff; font-size: 12px; flex: 0 0 20px; }
.pe-tabs .ok .tn { background: #2e7d32; }                                    /* done: green tick */
.pe-tabs .on .tn { background: #a0673a; }
.pe-tabs .err { color: #c62828; background: #fdecec; border-color: #e3a5a5; }  /* something missing: red tab (no count) */
.pe-tabs .err.on { background: #fff; border-color: #c62828; color: #c62828; }
.pe-tabs .err.on .tn { background: #c62828; }
.pe-sum { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; background: #fff; border: 1px solid var(--line); border-top: 0;
    border-radius: 0 0 8px 8px; padding: 7px 14px; font-size: 13px; color: #555; }
.pe-sum b { color: #222; }
.pe-sum .sum-go { color: #c62828; font-weight: 600; }
.pe-sum .sum-ok { color: #2e7d32; font-weight: 600; }
@media (max-width: 900px) { .pe-tabwrap { top: 46px; } }                     /* below the phone top bar */
@media (max-width: 600px) {
    .pe-tabs { gap: 2px; }
    .pe-tabs button { flex: 1 1 0; justify-content: center; padding: 8px 4px; font-size: 13px; gap: 4px; text-align: center; line-height: 1.15; }
    .pe-tabs button.on { padding-bottom: 10px; }
    .pe-sum { gap: 4px 10px; font-size: 12px; padding: 6px 10px; }
}
/* missing box: red only after the user was in it or pressed Save (option B) */
form[data-tabs].tried .tab-miss, form[data-tabs] .tab-miss.touched { background-color: #fdecec !important; border-color: #c62828 !important; }
form[data-tabs] button.tab-miss.po-btn { border-color: #c62828; color: #c62828; }
form[data-tabs] .tab-msg { display: block; color: #c62828; font-size: 12px; margin-top: 2px; }
/* Supplier tab: + More */
form[data-tabs] .more-off { display: none !important; }
.more-row { margin-top: -4px; }
.pe-more-btn { color: var(--muted); font-size: 13px; display: block; width: 100%; max-width: none; text-align: left; white-space: normal; }
/* Total tab: check with the supplier's bill */
form[data-tabs] .totals-left { display: none; }                               /* reels / KG are in the line under the tabs */
form[data-tabs] .totals-wrap { display: block; }
.pe-check { margin-bottom: 14px; }
.pe-check .pe-lbl { font-size: 14px; margin: 0 0 6px; }
.pe-check .big2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; max-width: 560px; }
.pe-check .bx { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; background: #fff; }
.pe-check .bx .field { margin: 0; }
.pe-check .bx label, .pe-check .bx small { display: block; color: #777; font-size: 12px; font-weight: 400; margin-bottom: 4px; }
.pe-check .bx b { font-size: 22px; }
.pe-check .bx input { font-size: 18px; font-weight: 700; width: 100%; }
.pe-check .verdict { margin-top: 8px; max-width: 560px; border-radius: 10px; padding: 9px 12px; font-weight: 700; font-size: 14px; }
.pe-check .verdict.ok { background: #e8f5e9; color: #2e7d32; border: 1px solid #a5d6a7; }
.pe-check .verdict.bad { background: #fdecec; color: #c62828; border: 1px solid #e3a5a5; }
.pe-check .verdict.none { background: #f7f4ef; color: #777; font-weight: 400; }
.chg-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 2px 0 10px; }
.chg-chips button { border: 1px dashed #a0673a; background: #fffaf2; color: #7a4a22; border-radius: 18px; padding: 6px 12px; font: 600 13px inherit; cursor: pointer; }
.tab-help { font-size: 12px; }
.howcalc { border: 1px solid var(--line); border-radius: 10px; background: #fff; max-width: 460px; margin-left: auto; }
.howcalc summary { padding: 8px 12px; cursor: pointer; font-weight: 600; color: #7a4a22; }
.howcalc .tax-box { width: 100%; margin: 0; border: 0; }
.cash-fold { margin-top: 12px; }
.cash-fold summary { cursor: pointer; color: var(--muted); font-size: 13px; }
@media (max-width: 600px) {
    .pe-check .big2 { grid-template-columns: 1fr 1fr; }
    .pe-check .bx b { font-size: 18px; }
    .howcalc { max-width: none; }
}
@media print { .pe-tabwrap { display: none; } form[data-tabs] .tab-off { display: block !important; } }
form[data-tabs] #chgTable.chg-empty { display: none; }                      /* Total tab: no charge yet -> only the + buttons */
form[data-tabs] .howcalc { margin-left: 0; }
.pe-choice[hidden] { display: none !important; }                             /* store user: photo only, the choice is not shown (2026-11-26) */
.switch-link { font-size: 13px; margin-left: 12px; white-space: nowrap; }      /* Purchase against PO: Enter by photo instead / Fill lines from PO instead (2026-11-27) */
.gr-photo > .switch-link { display: inline-block; margin: 0 0 8px; }
/* Purchase: Direct Delivery PO sets the godown (2026-11-28) */
.pe-sum .sum-dd { color: #1565c0; font-weight: 600; }
.dd-note { display: block; color: #1565c0; font-size: 12px; margin-top: 2px; }
/* status strip with 4 steps (Sales Bill, 2026-11-28): 2 x 2 on phones instead of 3 + 1 */
@media (max-width: 640px) { .statstrip .s:first-child:nth-last-child(4), .statstrip .s:first-child:nth-last-child(4) ~ .s { flex: 1 1 50%; } }
