/* GreenFort admin chrome.
   Every rule is namespaced under .gf-* so nothing here can reach the finalised
   invoice markup. Everything is hidden when printing. */

:root {
    --gf-green: #07943f;
    --gf-green-dark: #066c31;
    --gf-ink: #1c2321;
    --gf-muted: #64726b;
    --gf-line: #d8e0da;
    --gf-bg: #f4f4f4;
    --gf-danger: #b3261e;
    --gf-warn: #9a6400;

    /* Accent for the admin chrome — toolbar, nav, buttons, table headings.
       Redefined per company below so GreenFort Interiors is never mistaken
       for GreenFort Materials. Deliberately NOT used by anything that renders
       inside the invoice card: the bill looks the same for both companies. */
    --gf-accent: var(--gf-green);
    --gf-accent-dark: var(--gf-green-dark);
    --gf-accent-soft: #eef4f0;
    --gf-accent-glow: rgba(7, 148, 63, .35);

    /* The green of the bill itself, for the few chrome controls that sit
       inside the invoice card. Separate from --gf-accent: the card follows
       the company's invoice theme, not the admin chrome. */
    --gf-bill: var(--gf-green);
    --gf-bill-glow: rgba(7, 148, 63, .35);
}

:root[data-company="interiors"] {
    --gf-accent: #5b4ac4;
    --gf-accent-dark: #4a3ba6;
    --gf-accent-soft: #f0eefb;
    --gf-accent-glow: rgba(91, 74, 196, .35);

    /* Interiors bills are themed in the green of the Interiors logo. */
    --gf-bill: #106034;
    --gf-bill-glow: rgba(16, 96, 52, .35);
}

/* ------------------------------------------------------------ toolbar */

.gf-toolbar {
    background: #fff;
    border-bottom: 1px solid var(--gf-line);
    box-shadow: 0 1px 4px rgba(0, 0, 0, .06);
    padding: 8px 16px;
    margin: -10px -10px 12px;
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    font-family: Arial, sans-serif;
}

.gf-brand {
    font-weight: 700;
    color: var(--gf-accent);
    font-size: 15px;
    letter-spacing: .2px;
}

.gf-nav {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.gf-nav a {
    color: var(--gf-ink);
    text-decoration: none;
    font-size: 13px;
    padding: 6px 12px;
    border-radius: 6px;
}

.gf-nav a:hover { background: var(--gf-accent-soft); }

.gf-nav a[aria-current="page"] {
    background: var(--gf-accent);
    color: #fff;
    font-weight: 600;
}

.gf-spacer { flex: 1; }

.gf-user {
    font-size: 13px;
    color: var(--gf-muted);
}

.gf-user strong { color: var(--gf-ink); }

/* Materials | Interiors switch, built by api.js next to the brand. Interiors
   pages also carry a coloured stripe so the company is obvious at a glance. */
.gf-company-switch {
    display: inline-flex;
    border: 1px solid var(--gf-line);
    border-radius: 999px;
    padding: 2px;
    background: #f6f8f7;
}

.gf-company-switch a {
    color: var(--gf-muted);
    text-decoration: none;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 999px;
}

.gf-company-switch a:hover { color: var(--gf-ink); }

.gf-company-switch a[aria-current="true"] {
    background: var(--gf-accent);
    color: #fff;
}

[data-company="interiors"] .gf-toolbar { border-top: 3px solid var(--gf-accent); }

/* ------------------------------------------------------------- buttons */

.gf-btn {
    background: var(--gf-accent);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 7px 14px;
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    line-height: 1.3;
}

.gf-btn:hover:not(:disabled) { background: var(--gf-accent-dark); }
.gf-btn:disabled { opacity: .55; cursor: not-allowed; }

.gf-btn--ghost {
    background: transparent;
    color: var(--gf-ink);
    border: 1px solid var(--gf-line);
}

.gf-btn--ghost:hover:not(:disabled) { background: var(--gf-accent-soft); }

.gf-btn--danger { background: var(--gf-danger); }
.gf-btn--danger:hover:not(:disabled) { background: #8c1d17; }

.gf-btn--small { padding: 4px 9px; font-size: 12px; }

/* --------------------------------------------------------- page shell */

.gf-page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 16px 48px;
    font-family: Arial, sans-serif;
    color: var(--gf-ink);
}

.gf-page h2 {
    font-size: 19px;
    margin: 20px 0 4px;
}

.gf-page .gf-sub {
    color: var(--gf-muted);
    font-size: 13px;
    margin: 0 0 16px;
}

.gf-card {
    background: #fff;
    border: 1px solid var(--gf-line);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}

.gf-card h3 {
    margin: 0 0 12px;
    font-size: 15px;
    color: var(--gf-accent);
}

/* --------------------------------------------------------------- forms */

.gf-field { margin-bottom: 12px; }

.gf-field label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--gf-muted);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: .4px;
}

.gf-field input,
.gf-field select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--gf-line);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
    color: var(--gf-ink);
    box-sizing: border-box;
}

.gf-field input:focus,
.gf-field select:focus {
    outline: 2px solid var(--gf-accent-glow);
    border-color: var(--gf-accent);
}

.gf-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0 12px;
}

.gf-hint { font-size: 12px; color: var(--gf-muted); }

/* -------------------------------------------------------------- tables */

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

.gf-table th {
    background: var(--gf-accent);
    color: #fff;
    text-align: left;
    padding: 8px 10px;
    font-size: 12px;
    white-space: nowrap;
}

.gf-table td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--gf-line);
    vertical-align: middle;
}

.gf-table tbody tr:hover { background: #f7faf8; }
.gf-table .gf-num { text-align: right; font-variant-numeric: tabular-nums; }
.gf-scroll { overflow-x: auto; }

.gf-row-inactive { opacity: .55; }

.gf-tag {
    display: inline-block;
    font-size: 11px;
    padding: 2px 7px;
    border-radius: 999px;
    background: var(--gf-accent-soft);
    color: var(--gf-muted);
}

.gf-tag--low { background: #fdf1dd; color: var(--gf-warn); font-weight: 700; }
.gf-tag--off { background: #f0eeee; color: #7a6a6a; }

/* A proforma or estimate: saved, but no stock taken and not counted as a sale
   until its copy type is changed to a real invoice. */
.gf-tag--quote { background: #e8eefc; color: #2a4b8d; font-weight: 700; }

/* ------------------------------------------------- filters & stat tiles

   The filter row sits above everything it scopes, date range first, so every
   panel below reads the same slice. */

.gf-filters {
    display: flex;
    gap: 14px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.gf-filter { font-size: 12px; }

.gf-filter > span {
    display: block;
    font-weight: 700;
    color: var(--gf-muted);
    text-transform: uppercase;
    letter-spacing: .4px;
    margin-bottom: 4px;
}

.gf-filter select,
.gf-filter input {
    padding: 7px 9px;
    border: 1px solid var(--gf-line);
    border-radius: 6px;
    font: inherit;
    font-size: 13px;
    background: #fff;
    color: var(--gf-ink);
}

.gf-filter select:focus,
.gf-filter input:focus {
    outline: 2px solid var(--gf-accent-glow);
    border-color: var(--gf-accent);
}

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

.gf-tile {
    background: #fff;
    border: 1px solid var(--gf-line);
    border-radius: 8px;
    padding: 12px 14px;
}

.gf-tile-label {
    display: block;
    font-size: 12px;
    color: var(--gf-muted);
}

/* Proportional figures: tabular-nums loosens a big standalone number. */
.gf-tile-value {
    display: block;
    font-size: 24px;
    font-weight: 600;
    line-height: 1.25;
    color: var(--gf-ink);
}

.gf-tile-value small { font-size: 14px; font-weight: 600; color: var(--gf-muted); }

.gf-tile-sub {
    display: block;
    font-size: 12px;
    color: var(--gf-muted);
    min-height: 16px;
}

/* ------------------------------------------------------ most sold list

   One meter per product, measured against the biggest seller in its own unit.
   Every bar wears the same hue: the length carries the magnitude already, and
   products have no natural order to put on a ramp. */

.gf-ranks { list-style: none; margin: 10px 0 0; padding: 0; }
.gf-rank { margin-bottom: 11px; }
.gf-rank:last-child { margin-bottom: 0; }

.gf-rank-head {
    display: flex;
    align-items: baseline;
    gap: 8px;
    font-size: 12px;
    margin-bottom: 4px;
}

.gf-rank-name { flex: 1; color: var(--gf-ink); }

.gf-rank-qty {
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    color: var(--gf-ink);
}

.gf-rank-value { font-variant-numeric: tabular-nums; color: var(--gf-muted); }

.gf-rank-track {
    position: relative;
    height: 7px;
    background: #e8effa;          /* a lighter step of the bar's own hue */
    border-radius: 4px;
    overflow: hidden;
}

.gf-rank-fill { height: 100%; border-radius: 4px; background: var(--series-1); }

/* ------------------------------------------------------- daily sales

   One collapsible block per day on the Saved Bills page, listing what was
   sold. Days with no sales stay as a muted line so a gap reads as "nothing
   sold" rather than quietly closing up. */

.gf-day-sales {
    border: 1px solid var(--gf-line);
    border-radius: 6px;
    margin-bottom: 6px;
}

.gf-day-sales summary {
    cursor: pointer;
    padding: 8px 10px;
    font-size: 13px;
}

.gf-day-sales[open] summary { border-bottom: 1px solid var(--gf-line); }
.gf-day-sales summary:hover { background: var(--gf-accent-soft); }

/* Inline-flex on a wrapper, not on <summary> itself: making the summary a
   flex container removes the disclosure triangle in Chrome and Safari. */
.gf-day-sales .gf-day-head {
    display: inline-flex;
    width: calc(100% - 24px);
    gap: 10px;
    align-items: baseline;
    flex-wrap: wrap;
}

.gf-day-sales .gf-day-qty {
    margin-left: auto;
    color: var(--gf-accent);
    font-weight: 700;
}

.gf-day-sales .gf-table { border-top: 0; }
.gf-day-sales--total { border-color: var(--gf-accent); }

.gf-day-none {
    font-size: 12px;
    color: var(--gf-muted);
    padding: 3px 10px 3px 24px;
}

/* -------------------------------------------------- stock overview chart

   Categorical slots are the validated default palette, assigned in fixed order
   and never cycled. Light surface only, matching the rest of the admin UI. On
   the light surface aqua/yellow/magenta sit below 3:1, so every slice carries a
   visible label and the legend repeats the figures — colour never carries
   identity on its own. */

.gf-viz {
    --surface-1: #ffffff;
    --text-primary: #1c2321;
    --text-secondary: #64726b;
    --series-1: #2a78d6;
    --series-2: #eb6834;
    --series-3: #1baf7a;
    --series-4: #eda100;
    --series-5: #e87ba4;
    --series-6: #008300;
    --series-7: #4a3aa7;
    --series-8: #e34948;
    --status-good: #0ca30c;
    --status-warning: #fab219;
    --status-critical: #d03b3b;
}

.gf-viz-head {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.gf-viz-head select {
    margin-left: 5px;
    padding: 4px 7px;
    border: 1px solid var(--gf-line);
    border-radius: 5px;
    font-size: 12px;
    font-family: inherit;
}

/* Three tiles that answer "is anything wrong?" at a glance. */
.gf-stats { display: flex; gap: 6px; flex-wrap: wrap; }

.gf-stat {
    display: flex;
    align-items: baseline;
    gap: 5px;
    background: #f2f5f3;
    border: 1px solid transparent;
    border-radius: 999px;
    padding: 3px 11px;
    font-family: inherit;
    font-size: 11px;
    color: var(--gf-muted);
    cursor: pointer;
    line-height: 1.6;
}

.gf-stat:hover { border-color: var(--gf-line); background: #e9efeb; }
.gf-stat b { font-size: 14px; color: var(--gf-ink); font-variant-numeric: tabular-nums; }
.gf-stat--warn { background: #fdf1dd; }
.gf-stat--warn b { color: var(--gf-warn); }
.gf-stat--bad { background: #fdecea; }
.gf-stat--bad b { color: var(--gf-danger); }

.gf-viz-layout {
    display: grid;
    grid-template-columns: 170px 1fr;
    gap: 18px;
    align-items: center;
}

@media (max-width: 720px) {
    .gf-viz-layout { grid-template-columns: 1fr; }
}

/* ------------------------------------------------- monthly sales columns */

.gf-bars-scroll { overflow-x: auto; padding-bottom: 2px; }
.gf-bars { display: block; }

.gf-bar { transition: opacity .12s ease; }
.gf-bars:hover .gf-bar { opacity: .5; }
.gf-bars .gf-bar:hover { opacity: 1; }

/* Values and labels wear ink, never the series colour. */
.gf-bar-value {
    font: 700 11px Arial, sans-serif;
    fill: var(--gf-ink);
}

.gf-bar-label {
    font: 11px Arial, sans-serif;
    fill: var(--gf-muted);
}

.gf-bar-label--empty { opacity: .5; }

.gf-breakdown {
    display: flex;
    gap: 8px 22px;
    flex-wrap: wrap;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--gf-line);
    font-size: 12px;
    color: var(--gf-muted);
}

.gf-breakdown b {
    color: var(--gf-ink);
    font-size: 14px;
    font-variant-numeric: tabular-nums;
    margin-right: 4px;
}

.gf-breakdown-total b { color: var(--gf-accent); }
.gf-breakdown:empty { display: none; }

.gf-levels-head {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
    padding-top: 12px;
    margin-top: 12px;
    border-top: 1px solid var(--gf-line);
    font-size: 13px;
}

.gf-levels-clear {
    color: var(--gf-muted);
    font-size: 13px;
    padding: 10px 0 2px;
    list-style: none;
}

.gf-levels-more { list-style: none; padding-top: 4px; }

.gf-linkish {
    background: none;
    border: 0;
    padding: 0;
    font: inherit;
    font-size: 12px;
    color: var(--gf-accent);
    cursor: pointer;
    text-decoration: underline;
}

.gf-donut-wrap { position: relative; justify-self: center; }
.gf-donut { display: block; overflow: visible; }
.gf-donut-seg { transition: opacity .12s ease; cursor: default; }
.gf-donut-wrap:hover .gf-donut-seg { opacity: .45; }
.gf-donut-wrap .gf-donut-seg:hover { opacity: 1; }

.gf-donut-centre {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    text-align: center;
}

.gf-donut-total {
    font-size: 19px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

.gf-donut-unit { font-size: 9px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .5px; }

/* Slice labels use ink, never the series colour. */
.gf-slice-label {
    font: 700 9.5px Arial, sans-serif;
    fill: var(--text-primary);
    paint-order: stroke;
    stroke: #fff;
    stroke-width: 3px;
    stroke-linejoin: round;
}

.gf-legend { list-style: none; margin: 0; padding: 0; }

.gf-legend li {
    display: flex;
    align-items: baseline;
    gap: 9px;
    padding: 4px 0;
    border-bottom: 1px solid var(--gf-line);
    font-size: 12.5px;
}

.gf-legend li:last-child { border-bottom: 0; }

.gf-swatch {
    width: 11px;
    height: 11px;
    border-radius: 3px;
    flex-shrink: 0;
    transform: translateY(1px);
}

.gf-legend-name { flex: 1; color: var(--text-primary); }
.gf-legend-value { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--text-primary); }
.gf-legend-share { font-variant-numeric: tabular-nums; color: var(--text-secondary); min-width: 42px; text-align: right; }

/* Per-product level bars: how much is left against the low-stock level. */
.gf-levels { list-style: none; margin: 10px 0 0; padding: 0; }
.gf-level { margin-bottom: 9px; }
.gf-level:last-child { margin-bottom: 0; }

.gf-level-head {
    display: flex;
    align-items: baseline;
    gap: 8px;
    font-size: 12px;
    margin-bottom: 4px;
}

.gf-level-name { flex: 1; color: var(--text-primary); }
.gf-level-qty { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--text-primary); }

.gf-level-track {
    position: relative;
    height: 7px;
    background: #eef1ef;
    border-radius: 4px;
    overflow: hidden;
}

.gf-level-fill { height: 100%; border-radius: 4px; }
.gf-level-fill--good { background: var(--status-good); }
.gf-level-fill--warning { background: var(--status-warning); }
.gf-level-fill--critical { background: var(--status-critical); }

/* Threshold tick sits above the fill, in ink so it reads on any fill colour. */
.gf-level-mark {
    position: absolute;
    top: -2px;
    bottom: -2px;
    width: 2px;
    background: var(--text-primary);
    opacity: .55;
}

.gf-state {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 700;
}

.gf-state--good { color: var(--status-good); }
.gf-state--warning { color: #8a5d00; }
.gf-state--critical { color: var(--status-critical); }

/* ---------------------------------------------------- stock timeline */

.gf-timeline {
    list-style: none;
    margin: 0;
    padding: 0;
}

.gf-timeline-day {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .5px;
    text-transform: uppercase;
    color: var(--gf-muted);
    padding: 9px 0 3px;
    border-bottom: 1px solid var(--gf-line);
    margin-bottom: 2px;
}

.gf-timeline-day:first-child { padding-top: 0; }

.gf-timeline-row {
    display: grid;
    grid-template-columns: 8px 84px 1fr auto;
    gap: 8px;
    align-items: baseline;
    padding: 2px 0;
    font-size: 12px;
    line-height: 1.45;
}

.gf-timeline-row:hover { background: #f7faf8; }

@media (max-width: 640px) {
    .gf-timeline-row { grid-template-columns: 10px 80px 1fr; }
    .gf-timeline-meta { grid-column: 2 / -1; }
}

.gf-timeline-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    align-self: center;
}

.gf-timeline-dot--in { background: #0ca30c; }
.gf-timeline-dot--out { background: #d03b3b; }

.gf-timeline-qty {
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    white-space: nowrap;
}

/* Direction is carried by the sign and the word, not colour alone. */
.gf-timeline-qty--in { color: #0a7d0a; }
.gf-timeline-qty--out { color: #b02f2f; }

.gf-timeline-text { color: var(--gf-ink); }
.gf-timeline-meta { color: var(--gf-muted); font-size: 11px; white-space: nowrap; }

.gf-viz-tooltip {
    position: fixed;
    z-index: 1200;
    background: #1c2321;
    color: #fff;
    font-size: 12px;
    padding: 6px 9px;
    border-radius: 5px;
    pointer-events: none;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
}

.gf-viz-tooltip[hidden] { display: none; }

/* ------------------------------------------------------------- notices */

.gf-notice {
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 12px;
    border: 1px solid transparent;
}

.gf-notice--error { background: #fdecea; color: var(--gf-danger); border-color: #f5c6c2; }
.gf-notice--ok { background: #e8f5ec; color: var(--gf-green-dark); border-color: #bfe3cc; }
.gf-notice--warn { background: #fdf1dd; color: var(--gf-warn); border-color: #f0dcb4; }
.gf-notice[hidden] { display: none; }

.gf-empty {
    text-align: center;
    color: var(--gf-muted);
    padding: 28px 12px;
    font-size: 14px;
}

/* ---------------------------------------------------------- auth pages */

.gf-auth {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    font-family: Arial, sans-serif;
    box-sizing: border-box;
}

.gf-auth-card {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 18px rgba(0, 0, 0, .1);
    padding: 28px;
    width: 100%;
    max-width: 380px;
}

.gf-auth-card h1 {
    color: var(--gf-accent);
    font-size: 20px;
    margin: 0 0 2px;
}

.gf-auth-card .gf-sub {
    color: var(--gf-muted);
    font-size: 13px;
    margin: 0 0 20px;
}

.gf-auth-card .gf-btn { width: 100%; padding: 10px; font-size: 14px; }

.gf-auth-foot {
    margin-top: 16px;
    font-size: 13px;
    text-align: center;
    color: var(--gf-muted);
}

.gf-auth-foot a { color: var(--gf-accent); }

/* ------------------------------------------------- billing page extras */

.gf-billing-status {
    margin: 0 auto 10px;
    max-width: 800px;
    font-family: Arial, sans-serif;
}

.gf-stock-strip {
    max-width: 800px;
    margin: 0 auto 14px;
    font-family: Arial, sans-serif;
    font-size: 12px;
    color: var(--gf-muted);
    display: flex;
    gap: 6px 14px;
    flex-wrap: wrap;
}

.gf-stock-strip span { white-space: nowrap; }
.gf-stock-strip b { color: var(--gf-ink); }
.gf-stock-strip .gf-low { color: var(--gf-warn); }

/* Product dropdown.

   The original textarea is kept in the cell and is what actually prints, so
   the table's column widths and row heights are exactly what they were. The
   dropdown is laid over it for on-screen use only and is removed when
   printing, leaving the untouched textarea behind. position:relative on the
   cell changes no geometry. */
.gf-product-cell { position: relative; }

.gf-product-cell textarea[name="product-name"] {
    cursor: default;
}

.gf-product-cell .gf-product-select {
    position: absolute;
    top: 5px;
    left: 5px;
    right: 5px;
    bottom: 5px;
    width: auto;
    height: auto;
    box-sizing: border-box;
    font-size: 12px;
    font-family: Arial, sans-serif;
    padding: 2px 4px;
    border: 1px solid #cfd8d2;
    border-radius: 3px;
    background: #fff;
    color: #1c2321;
}

.gf-product-cell .gf-product-select:focus {
    outline: 2px solid var(--gf-bill-glow);
    border-color: var(--gf-bill);
}

/* ------------------------------------------- room for long product names

   Names like "9mm S Side Alupet Foil XPE Foam Roof Cool Insulation" did not
   fit the product box while billing. Quantity, CGST and SGST never hold more
   than a few characters, so the width is taken from them and given to the
   product column.

   Everything here is inside @media screen, so the printed invoice keeps its
   original auto-laid-out columns exactly — print fidelity is the one thing
   this file must never touch. Scoped to thead/tbody so the tfoot totals rows,
   which span six columns, are left alone.

   The .invoice-body prefix is load-bearing, not decoration. The Saved Bills
   page has a table with the SAME id="invoice-table", and this stylesheet is
   loaded on both, so a bare #invoice-table applies these widths there too:
   "Invoice #" is column 1 and was squeezed to the 5% meant for "SL. No",
   overlapping the date beside it. .invoice-body exists only on the billing
   page. Anything added here must keep that prefix.

   table-layout:fixed makes the percentages authoritative; under the default
   auto layout the long "CGST Rate (%)" heading would hold that column open
   and the product column would not actually widen. */
@media screen {
    .invoice-body #invoice-table { table-layout: fixed; }

    /* Totals 100%: under fixed layout the Action column would otherwise be
       squeezed to whatever is left over, which is not enough for its button. */
    .invoice-body #invoice-table thead th:nth-child(1),
    .invoice-body #invoice-table tbody td:nth-child(1) { width: 5%; }    /* SL. No */
    .invoice-body #invoice-table thead th:nth-child(2),
    .invoice-body #invoice-table tbody td:nth-child(2) { width: 36%; }   /* Product Name */
    .invoice-body #invoice-table thead th:nth-child(3),
    .invoice-body #invoice-table tbody td:nth-child(3) { width: 8%; }    /* Quantity */
    .invoice-body #invoice-table thead th:nth-child(4),
    .invoice-body #invoice-table tbody td:nth-child(4) { width: 10%; }   /* Price */
    .invoice-body #invoice-table thead th:nth-child(5),
    .invoice-body #invoice-table tbody td:nth-child(5) { width: 8%; }    /* CGST Rate */
    .invoice-body #invoice-table thead th:nth-child(6),
    .invoice-body #invoice-table tbody td:nth-child(6) { width: 8%; }    /* SGST Rate */
    .invoice-body #invoice-table thead th:nth-child(7),
    .invoice-body #invoice-table tbody td:nth-child(7) { width: 11%; }   /* Subtotal */
    .invoice-body #invoice-table thead th:nth-child(8),
    .invoice-body #invoice-table tbody td:nth-child(8) { width: 14%; }   /* Action */

    /* Number inputs carry an intrinsic minimum width and would otherwise
       refuse to shrink into the narrower columns. */
    .invoice-body #invoice-table tbody td input[type="number"] { min-width: 0; }

    /* The headings are what force those columns wide; let them wrap now that
       the column is narrow. */
    .invoice-body #invoice-table thead th { white-space: normal; overflow-wrap: break-word; }

    /* Beats the element's inline height:30px. Three lines on screen, so a long
       name is readable while billing. The inline 30px is untouched and is what
       print still uses. */
    .gf-product-cell textarea[name="product-name"] {
        height: 46px !important;
    }
}

.gf-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    z-index: 1000;
}

.gf-modal-backdrop[hidden] { display: none; }

.gf-modal {
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    width: 100%;
    max-width: 460px;
    max-height: 85vh;
    overflow: auto;
    font-family: Arial, sans-serif;
}

.gf-modal h3 { margin: 0 0 14px; font-size: 16px; color: var(--gf-accent); }

.gf-modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 16px;
}

/* -----------------------------------------------------------------------
   Nothing in this file may ever reach paper. The invoice prints exactly as
   it did before the backend existed.
   -------------------------------------------------------------------- */
@media print {
    .gf-toolbar,
    .gf-no-print,
    .gf-billing-status,
    .gf-stock-strip,
    .gf-modal-backdrop {
        display: none !important;
    }
}

/* ------------------------------------------- stock timeline PDF export

   Only ever active on the Stock page, and only while its PDF button is
   printing: the body class is added immediately before window.print() and
   removed on afterprint. The invoice page never sets it, so its print output
   is untouched. */
@media print {
    body.gf-print-timeline .gf-toolbar,
    body.gf-print-timeline .gf-page > h2,
    body.gf-print-timeline .gf-page > .gf-sub,
    body.gf-print-timeline .gf-page > .gf-notice,
    body.gf-print-timeline .gf-card:not(#timeline-card) {
        display: none !important;
    }

    body.gf-print-timeline #timeline-card {
        border: 0;
        padding: 0;
        margin: 0;
    }

    body.gf-print-timeline .gf-timeline-row {
        padding: 1px 0;
        font-size: 10px;
        break-inside: avoid;
    }

    body.gf-print-timeline .gf-timeline-day {
        break-after: avoid;
        font-size: 9px;
    }

    body.gf-print-timeline .gf-timeline-dot { display: none; }
    body.gf-print-timeline .gf-timeline-row { grid-template-columns: 80px 1fr auto; }
}

/* Empty stock: collapse the chart area rather than leave a blank ring. */
.gf-viz-nostock .gf-viz-layout { display: block; }
.gf-viz-nostock .gf-donut-wrap { display: none; }

/* Admin-only controls. Presentation only — the server enforces the real rule. */
.gf-admin-only { display: none; }
:root[data-role="admin"] .gf-admin-only { display: inline-block; }
:root[data-role="admin"] td.gf-admin-only { display: table-cell; }

/* "Showing N of M" and the button that fetches the next page of bills. */
.gf-load-more {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 14px 0 4px;
}
.gf-load-more[hidden] { display: none; }
