/* ============================================================
   Lone Star Feed Ordering — site styles
   Palette from the Lone Star mark:
     --ls-blue  #1B4B9B  (LONE STAR letterforms)
     --ls-red   #C41230  (triangle)
     --ink      #1C2434
     --paper    #F5F6F8  (cool light gray — not cream)
     --line     #DDE1E8
   Type: Barlow (UI) / Barlow Condensed (numbers & display)
   ============================================================ */

:root {
    --ls-blue: #1B4B9B;
    --ls-blue-dark: #123A7D;
    --ls-red: #C41230;
    --ink: #1C2434;
    --muted: #5B6472;
    --paper: #F5F6F8;
    --card: #FFFFFF;
    --line: #DDE1E8;
    --ok: #1E7B34;
    --radius: 10px;
    --loadbar-h: 118px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: "Barlow", system-ui, -apple-system, "Segoe UI", sans-serif;
    font-size: 16px;
    color: var(--ink);
    background: var(--paper);
}

/* ---------- Header ---------- */
.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px 16px;
    padding: 10px 16px;
    background: var(--card);
    border-bottom: 3px solid var(--ls-red);
    /* Four nav links plus the logo overflow a phone screen; let them wrap
       to a second row instead of sliding off the right edge. */
    flex-wrap: wrap;
}

.brand img { display: block; height: 44px; width: auto; }

.header-links {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px 14px;
    flex: 1 1 auto;
}


@media (max-width: 460px) {
    .nav-link { padding: 9px 4px; font-size: 15px; }
    .brand img { height: 38px; }
}

/* ---------- Page shell ---------- */
main { max-width: 860px; margin: 0 auto; padding: 16px; }

.order-head h1 {
    font-family: "Barlow Condensed", "Barlow", sans-serif;
    font-weight: 700;
    font-size: 32px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--ls-blue);
    margin: 4px 0 2px;
}

.ordering-as { margin: 0 0 14px; color: var(--muted); }
.ordering-as .acct { color: var(--muted); font-size: 14px; }

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

.card h2 {
    font-family: "Barlow Condensed", sans-serif;
    font-size: 20px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin: 0 0 12px;
    color: var(--ink);
}

/* ---------- Fields ---------- */
.field { margin-bottom: 12px; }
.field label {
    display: block;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 6px;
}
.field .hint { font-weight: 400; color: var(--muted); }

input[type="text"], input[type="search"], input[type="date"],
input[type="number"], input:not([type]), select, textarea {
    width: 100%;
    font: inherit;
    padding: 12px;
    border: 1.5px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    color: var(--ink);
    min-height: 48px; /* touch target */
}
input:focus, select:focus, textarea:focus, button:focus-visible {
    outline: 3px solid rgba(27, 75, 155, 0.35);
    outline-offset: 1px;
    border-color: var(--ls-blue);
}

.input-error { border-color: var(--ls-red) !important; background: #FFF3F5; }

/* ---------- Add items ---------- */
.add-row { display: flex; flex-direction: column; gap: 12px; }
.code-field input {
    font-family: "Barlow Condensed", sans-serif;
    font-size: 22px;
    letter-spacing: 2px;
}

.search-field { position: relative; }
.search-results {
    position: absolute;
    z-index: 30;
    top: calc(100% + 4px);
    left: 0; right: 0;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(28, 36, 52, 0.14);
    overflow: hidden;
}
.search-hit {
    display: grid;
    grid-template-columns: 56px 1fr auto;
    gap: 10px;
    align-items: center;
    width: 100%;
    text-align: left;
    padding: 12px;
    background: none;
    border: 0;
    border-bottom: 1px solid var(--line);
    font: inherit;
    cursor: pointer;
    min-height: 48px;
}
.search-hit:last-child { border-bottom: 0; }
.search-hit:active { background: var(--paper); }
.hit-no { font-family: "Barlow Condensed", sans-serif; font-weight: 700; color: var(--ls-blue); font-size: 18px; }
.hit-lbs { color: var(--muted); font-size: 13px; white-space: nowrap; }
.search-none { padding: 12px; color: var(--muted); }

/* ---------- Chips ---------- */
.chip-group h3 {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--muted);
    margin: 14px 0 8px;
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
    font: inherit;
    font-size: 14px;
    padding: 10px 14px;
    min-height: 44px;
    border: 1.5px solid var(--line);
    border-radius: 999px;
    background: #fff;
    cursor: pointer;
    color: var(--ink);
}
.chip:active { border-color: var(--ls-blue); background: #EDF2FB; }
.chip-no { font-family: "Barlow Condensed", sans-serif; font-weight: 700; color: var(--ls-blue); margin-right: 4px; }

/* ---------- Order lines ---------- */
.empty-state { color: var(--muted); padding: 8px 0; }

.line {
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}
.line:last-child { border-bottom: 0; }
.line-main { display: flex; gap: 10px; align-items: baseline; margin-bottom: 8px; }
.line-no { font-family: "Barlow Condensed", sans-serif; font-weight: 700; font-size: 18px; color: var(--ls-blue); }
.line-desc { font-weight: 500; }

.line-controls { display: flex; align-items: center; gap: 8px; }
.qty-btn {
    width: 48px; height: 48px;
    font-size: 24px;
    font-weight: 600;
    border: 1.5px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    color: var(--ls-blue);
    cursor: pointer;
    flex: 0 0 auto;
}
.qty-btn:active { background: #EDF2FB; }
.line-controls input[type="number"] {
    width: 76px;
    text-align: center;
    font-family: "Barlow Condensed", sans-serif;
    font-size: 20px;
    flex: 0 0 auto;
}
.line-lbs {
    margin-left: auto;
    font-family: "Barlow Condensed", sans-serif;
    font-size: 17px;
    color: var(--muted);
    white-space: nowrap;
}
.line-remove {
    width: 44px; height: 44px;
    border: 0;
    background: none;
    color: var(--muted);
    font-size: 18px;
    cursor: pointer;
    flex: 0 0 auto;
}
.line-remove:active { color: var(--ls-red); }

/* ---------- Alerts ---------- */
.alert-error {
    background: #FDECEF;
    border: 1px solid var(--ls-red);
    color: #8E0E23;
    border-radius: var(--radius);
    padding: 12px 14px;
    margin-bottom: 14px;
    font-weight: 500;
}

/* ---------- Load bar (signature element) ---------- */
.loadbar-spacer { height: calc(var(--loadbar-h) + 24px); }

.loadbar {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 50;
    background: var(--card);
    border-top: 1px solid var(--line);
    box-shadow: 0 -6px 20px rgba(28, 36, 52, 0.12);
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
}

.loadbar-track {
    position: relative;
    height: 14px;
    border-radius: 999px;
    background: var(--paper);
    border: 1px solid var(--line);
    overflow: visible;
    margin: 6px 8px 12px;
}
.loadbar-fill {
    height: 100%;
    width: 0%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--ls-blue), var(--ls-blue-dark));
    transition: width 0.25s ease;
}
.loadbar-fill.over { background: var(--ls-red); }

.loadbar-star {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -54%);
    font-size: 22px;
    line-height: 1;
    color: var(--line);
    text-shadow: 0 1px 0 #fff;
    pointer-events: none;
    transition: color 0.25s ease;
}
.loadbar-star.lit { color: var(--ls-red); }

.loadbar-info {
    display: flex;
    align-items: center;
    gap: 12px;
}
.loadbar-weight { display: flex; align-items: baseline; gap: 6px; }
.loadbar-weight .big {
    font-family: "Barlow Condensed", sans-serif;
    font-weight: 700;
    font-size: 28px;
    color: var(--ink);
    min-width: 64px;
}
.loadbar-weight .small { color: var(--muted); font-size: 13px; white-space: nowrap; }

.loadbar-status { color: var(--muted); font-size: 13px; flex: 1; }
.loadbar-status.over { color: var(--ls-red); font-weight: 600; }

.btn-primary {
    font: inherit;
    font-weight: 700;
    padding: 12px 18px;
    min-height: 48px;
    border: 0;
    border-radius: var(--radius);
    background: var(--ls-red);
    color: #fff;
    cursor: pointer;
    white-space: nowrap;
}
.btn-primary:disabled { background: var(--line); color: var(--muted); cursor: not-allowed; }
.btn-primary:not(:disabled):active { background: #A50E28; }

.discount-banner {
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: var(--radius);
    background: #FDF3E3;
    border: 1px solid #E8B54D;
    color: #7A5410;
    font-size: 14px;
}

/* ---------- Confirmation page ---------- */
.confirm-hero {
    text-align: center;
    padding: 26px 16px 8px;
}
.confirm-hero .check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px; height: 56px;
    border-radius: 50%;
    background: var(--ok);
    color: #fff;
    font-size: 28px;
    margin-bottom: 10px;
}
.confirm-hero h1 {
    font-family: "Barlow Condensed", sans-serif;
    text-transform: uppercase;
    color: var(--ls-blue);
    margin: 0 0 4px;
}
.confirm-hero p { color: var(--muted); margin: 0 0 16px; }

.summary-table { width: 100%; border-collapse: collapse; }
.summary-table th, .summary-table td {
    text-align: left;
    padding: 10px 8px;
    border-bottom: 1px solid var(--line);
}
.summary-table th { font-size: 13px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--muted); }
.summary-table td.num, .summary-table th.num { text-align: right; font-family: "Barlow Condensed", sans-serif; font-size: 17px; }

/* ---------- Wider screens ---------- */
@media (min-width: 700px) {
    .brand img { height: 54px; }
    .add-row { flex-direction: row; }
    .code-field { flex: 0 0 180px; }
    .search-field { flex: 1; }
    .order-head h1 { font-size: 40px; }
    .loadbar { padding-left: max(16px, calc((100% - 860px) / 2 + 16px)); padding-right: max(16px, calc((100% - 860px) / 2 + 16px)); }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    .loadbar-fill, .loadbar-star { transition: none; }
}

/* Pallet/bags readout under each line */
.line-sub {
    margin-top: 6px;
    font-size: 13px;
    color: var(--muted);
    font-family: "Barlow Condensed", sans-serif;
    letter-spacing: 0.3px;
}

/* Just-added line highlight — flashes once, then settles */
@keyframes just-added-flash {
    0%   { background: #EDF4FF; box-shadow: inset 3px 0 0 var(--ls-blue); }
    70%  { background: #EDF4FF; box-shadow: inset 3px 0 0 var(--ls-blue); }
    100% { background: transparent; box-shadow: none; }
}
.line.just-added {
    animation: just-added-flash 1.6s ease-out 1;
    border-radius: 6px;
}

/* Small FEED discount-eligibility badge on lines */
.feed-badge {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 999px;
    background: #FDF3E3;
    border: 1px solid #E8B54D;
    color: #7A5410;
    font-size: 11.5px;
    font-family: "Barlow", sans-serif;
    letter-spacing: 0.2px;
    vertical-align: 1px;
}

@media (prefers-reduced-motion: reduce) {
    .line.just-added { animation: none; }
}

/* ---------- Auth pages ---------- */
.auth-card { max-width: 420px; margin: 32px auto; }
.btn-block { width: 100%; }
.auth-alt { text-align: center; margin-top: 14px; }
.auth-alt a { color: var(--ls-blue); }

/* ---------- Sales rep bits ---------- */
.switch-link { margin-left: 8px; font-size: 14px; color: var(--ls-blue); }
.customer-results { margin-top: 14px; }
.customer-hit {
    display: grid;
    grid-template-columns: 80px 1fr;
    gap: 10px;
    align-items: center;
    width: 100%;
    text-align: left;
    padding: 12px;
    min-height: 48px;
    background: none;
    border: 0;
    border-bottom: 1px solid var(--line);
    font: inherit;
    cursor: pointer;
}
.customer-hit:active { background: var(--paper); }

/* ---------- Edit banner ---------- */
.edit-banner {
    background: #EDF4FF;
    border: 1px solid var(--ls-blue);
    color: var(--ls-blue-dark);
    border-radius: var(--radius);
    padding: 10px 14px;
    margin-bottom: 12px;
    font-weight: 500;
}

/* ---------- Orders page ---------- */
.order-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
    flex-wrap: wrap;
}
.order-row:last-child { border-bottom: 0; }
.order-row-main { display: flex; flex-direction: column; gap: 2px; }
.order-row-title { font-weight: 600; }
.order-row-date { color: var(--muted); font-size: 14px; }
.order-row-detail { color: var(--muted); font-size: 14px; }
.order-row-actions { display: flex; gap: 8px; }

.btn-secondary {
    font: inherit;
    font-weight: 600;
    font-size: 14px;
    padding: 10px 14px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    border: 1.5px solid var(--ls-blue);
    border-radius: var(--radius);
    background: #fff;
    color: var(--ls-blue);
    text-decoration: none;
    cursor: pointer;
}
.btn-secondary:active { background: #EDF2FB; }

.status-badge {
    display: inline-block;
    margin-top: 4px;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 600;
    width: fit-content;
}
.status-badge.pending { background: #EDF4FF; color: var(--ls-blue-dark); border: 1px solid var(--ls-blue); }
.status-badge.done { background: #E8F5EC; color: var(--ok); border: 1px solid var(--ok); }

.nav-link {
    font-weight: 600;
    color: var(--ls-blue);
    text-decoration: none;
    padding: 10px 6px;
    white-space: nowrap;
}

/* ---------- Step hint + special badges ---------- */
.step-hint {
    font-size: 12px;
    color: var(--muted);
    font-family: "Barlow Condensed", sans-serif;
    letter-spacing: 0.3px;
    white-space: nowrap;
}
.special-badge { background: #FDECEF; border-color: var(--ls-red); color: #8E0E23; }
.bulk-badge { background: #EDF4FF; border-color: var(--ls-blue); color: var(--ls-blue-dark); }
.req { color: var(--ls-red); }
.special-note {
    margin-top: 8px;
    padding: 8px 12px;
    border-radius: var(--radius);
    background: #FDECEF;
    border: 1px solid var(--ls-red);
    color: #8E0E23;
    font-size: 14px;
}

/* ---------- Bulk 11/22 ton toggle ---------- */
.ton-toggle { display: flex; gap: 8px; }
.ton-btn {
    font: inherit;
    font-weight: 600;
    padding: 8px 14px;
    min-height: 52px;
    border: 1.5px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    color: var(--ink);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.15;
}
.ton-btn span { font-size: 11.5px; font-weight: 400; color: var(--muted); }
.ton-btn.on { border-color: var(--ls-blue); background: #EDF2FB; color: var(--ls-blue-dark); }
.ton-btn.on span { color: var(--ls-blue-dark); }

/* ---------- Browse overlay ---------- */
.browse-open { margin: 10px 0 4px; }
.browse-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: var(--paper);
    display: flex;
    flex-direction: column;
}
.browse-overlay[hidden] { display: none; }
.browse-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: var(--card);
    border-bottom: 3px solid var(--ls-red);
}
.browse-head h2 {
    font-family: "Barlow Condensed", sans-serif;
    text-transform: uppercase;
    color: var(--ls-blue);
    margin: 0;
    font-size: 22px;
}
.browse-close {
    width: 44px; height: 44px;
    border: 0; background: none;
    font-size: 20px; color: var(--muted);
    cursor: pointer;
}
.browse-body { overflow-y: auto; padding: 12px 16px 40px; }
.browse-big {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    margin-bottom: 10px;
}
.browse-big summary {
    font-family: "Barlow Condensed", sans-serif;
    font-size: 19px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 14px 16px;
    cursor: pointer;
    color: var(--ink);
    list-style-position: inside;
}
.browse-small { padding: 0 12px 10px; }
.browse-small h4 {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    color: var(--muted);
    margin: 10px 4px 6px;
}
.browse-item {
    display: grid;
    grid-template-columns: 56px 1fr auto;
    gap: 10px;
    align-items: center;
    width: 100%;
    text-align: left;
    padding: 12px 8px;
    min-height: 48px;
    background: none;
    border: 0;
    border-bottom: 1px solid var(--line);
    font: inherit;
    cursor: pointer;
}
.browse-item:last-child { border-bottom: 0; }
.browse-item:active { background: var(--paper); }
.browse-add {
    font-weight: 700;
    color: var(--ls-blue);
    border: 1.5px solid var(--ls-blue);
    border-radius: 999px;
    padding: 6px 14px;
}

/* ---------- Bestseller one-tap button ---------- */
.bestseller-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    margin: 10px 0 4px;
    padding: 12px 14px;
    min-height: 56px;
    font: inherit;
    text-align: left;
    background: #FDF3E3;
    border: 1.5px solid #E8B54D;
    border-radius: var(--radius);
    cursor: pointer;
}
.bestseller-btn:active { background: #FAE8C8; }
.bestseller-star { font-size: 24px; color: var(--ls-red); }
.bestseller-text { display: flex; flex-direction: column; line-height: 1.25; }
.bestseller-text strong { color: #7A5410; }
.bestseller-text span:last-child { font-size: 13px; color: #9A7530; }

/* History rows are tappable links */
.order-row-link { text-decoration: none; color: inherit; }
.order-row-link:active .order-row-title { color: var(--ls-blue); }

/* ---------- Statement ---------- */
.statement-cta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    margin-bottom: 14px;
    min-height: 60px;
    background: var(--card);
    border: 1.5px solid var(--ls-blue);
    border-left-width: 6px;
    border-radius: var(--radius);
    text-decoration: none;
    color: inherit;
}
.statement-cta:active { background: #EDF2FB; }
.statement-cta-text { display: flex; flex-direction: column; line-height: 1.3; }
.statement-cta-text strong { color: var(--ls-blue-dark); }
.statement-cta-text span:last-child { font-size: 13px; color: var(--muted); }
.statement-cta-go { font-size: 26px; color: var(--ls-blue); line-height: 1; }

.statement-totals { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.stat-box {
    flex: 1 1 160px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 14px 16px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}
.stat-box.past-due { border-color: var(--ls-red); background: #FDECEF; }
.stat-label { font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.7px; color: var(--muted); }
.stat-value { font-family: "Barlow Condensed", sans-serif; font-size: 30px; font-weight: 700; color: var(--ink); }
.stat-box.past-due .stat-value { color: var(--ls-red); }

.summary-table a { color: var(--ls-blue); font-weight: 600; }
.row-past-due td { background: #FDECEF; }

/* ---------- Document header facts ---------- */
.doc-facts {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 26px;
    padding: 12px 0 4px;
}
.doc-fact { display: flex; flex-direction: column; gap: 1px; }
.doc-fact span {
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    color: var(--muted);
}
.doc-fact strong { font-weight: 600; font-size: 15px; line-height: 1.35; }
.doc-fact-wide { flex-basis: 100%; }

/* ---------- Under Contract ---------- */
.contract-section {
    margin: 12px 0 4px;
    padding: 14px;
    border: 1.5px solid var(--ls-blue);
    border-radius: var(--radius);
    background: #F7FAFF;
}
.contract-head {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
    margin: 0 0 10px;
    font-family: "Barlow Condensed", sans-serif;
    font-size: 18px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--ls-blue-dark);
}
.contract-until {
    font-family: "Barlow", sans-serif;
    font-size: 12.5px;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    color: var(--muted);
}
.contract-items { display: flex; flex-direction: column; gap: 8px; }
.contract-item {
    display: grid;
    grid-template-columns: 56px 1fr auto;
    gap: 10px;
    align-items: center;
    width: 100%;
    text-align: left;
    padding: 12px;
    min-height: 52px;
    background: #fff;
    border: 1.5px solid var(--line);
    border-radius: var(--radius);
    font: inherit;
    cursor: pointer;
}
.contract-item:active { border-color: var(--ls-blue); background: #EDF2FB; }
.contract-no { font-family: "Barlow Condensed", sans-serif; font-weight: 700; font-size: 18px; color: var(--ls-blue); }
.contract-desc { font-weight: 500; }
.contract-qty {
    font-family: "Barlow Condensed", sans-serif;
    font-size: 15px;
    color: var(--ok);
    white-space: nowrap;
}
.contract-qty.used-up { color: var(--muted); }
.contract-note { margin: 10px 0 0; font-size: 12.5px; }

/* Payments on the statement */
.stat-box.paid { border-color: var(--ok); background: #E8F5EC; }
.stat-box.paid .stat-value { color: var(--ok); }
.pay-status { font-size: 13px; font-weight: 600; }
.pay-status.applied { color: var(--muted); }
.pay-status.unapplied { color: var(--ok); }

/* Page heading with an action button beside it */
.head-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.head-row h1 { margin-bottom: 0; }
.head-action {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    white-space: nowrap;
}

/* Header nav has to wrap once there are several links on a phone */
.header-links { flex-wrap: wrap; row-gap: 8px; }

/* Statement / insights cards sit side by side once there's room */
.cta-row { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.cta-row .statement-cta { margin-bottom: 0; flex: 1; }
.insights-cta { border-color: var(--ok); }
.insights-cta:active { background: #E8F5EC; }
.insights-cta .statement-cta-text strong { color: var(--ok); }
.insights-cta .statement-cta-go { color: var(--ok); }

@media (min-width: 700px) {
    .cta-row { flex-direction: row; }
}

/* ============================================================
   Purchase Insights
   ============================================================ */

/* ---------- Period / rank segmented controls ---------- */
.period-bar {
    display: flex;
    gap: 6px;
    margin-bottom: 14px;
    padding: 4px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}
.period-btn {
    flex: 1 1 0;
    font: inherit;
    font-weight: 600;
    font-size: 14px;
    padding: 10px 6px;
    min-height: 44px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    white-space: nowrap;
}
.period-btn:active { background: var(--paper); }
.period-btn.on { background: var(--ls-blue); color: #fff; }

.rank-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.rank-head h2 { margin: 0; }
.rank-toggle {
    display: flex;
    gap: 4px;
    padding: 3px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 999px;
}
.rank-btn {
    font: inherit;
    font-weight: 600;
    font-size: 13.5px;
    padding: 8px 14px;
    min-height: 40px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    white-space: nowrap;
}
.rank-btn.on { background: var(--ls-blue); color: #fff; }

/* ---------- Trend chips ---------- */
.delta {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}
.delta.up { background: #E8F5EC; color: var(--ok); border: 1px solid #B9DEC5; }
.delta.down { background: #FDF3E3; color: #9A6B10; border: 1px solid #E8B54D; }
.delta.flat { background: var(--paper); color: var(--muted); border: 1px solid var(--line); }
.stat-box .delta { margin-top: 6px; align-self: flex-start; }

/* ---------- Reorder radar ---------- */
.radar-list { display: flex; flex-direction: column; gap: 8px; }
.radar-row {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
        "main add"
        "meta add";
    gap: 2px 12px;
    align-items: center;
    padding: 12px;
    min-height: 56px;
    background: #fff;
    border: 1.5px solid var(--line);
    border-radius: var(--radius);
    text-decoration: none;      /* it's an <a> — don't let it read as a link */
    color: inherit;
}
.radar-row:active { border-color: var(--ls-blue); background: #EDF2FB; }
.radar-main { grid-area: main; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.radar-meta { grid-area: meta; font-size: 13px; color: var(--muted); }
.radar-add {
    grid-area: add;
    font-weight: 700;
    font-size: 14px;
    color: var(--ls-blue);
    border: 1.5px solid var(--ls-blue);
    border-radius: 999px;
    padding: 8px 16px;
    white-space: nowrap;
}

/* ---------- Ranked items ---------- */
.rank-list { display: flex; flex-direction: column; gap: 14px; }
.rank-row { display: flex; flex-direction: column; gap: 5px; }
.rank-line { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.rank-no {
    font-family: "Barlow Condensed", sans-serif;
    font-weight: 700;
    font-size: 17px;
    color: var(--ls-blue);
    flex: 0 0 auto;
}
.rank-desc { font-weight: 500; flex: 1 1 auto; min-width: 0; }
.rank-value {
    font-family: "Barlow Condensed", sans-serif;
    font-size: 17px;
    font-weight: 700;
    white-space: nowrap;
    flex: 0 0 auto;
}
.rank-bar {
    height: 8px;
    border-radius: 999px;
    background: var(--paper);
    border: 1px solid var(--line);
    overflow: hidden;
}
.rank-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--ls-blue), var(--ls-blue-dark));
    border-radius: 999px;
}
.rank-meta { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* ---------- Month-by-month chart ----------
   inline-block columns so the strip scrolls sideways when a long period is
   selected, with the key sitting below on its own line. */
.month-chart {
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
}
.month-col {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    width: 34px;
    vertical-align: bottom;
}
.month-bars {
    position: relative;
    width: 24px;
    height: 130px;
    margin-bottom: 6px;
}
.bar-ly {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    background: var(--line);
    border-radius: 3px 3px 0 0;
    min-height: 2px;
}
.bar-now {
    position: absolute;
    bottom: 0; left: 5px; right: 5px;
    background: var(--ls-blue);
    border-radius: 3px 3px 0 0;
    min-height: 2px;
}
.month-label {
    font-size: 11px;
    color: var(--muted);
    font-family: "Barlow Condensed", sans-serif;
    letter-spacing: 0.3px;
}
.month-year { font-size: 10.5px; color: var(--ink); font-weight: 600; }

.chart-key {
    display: block;
    white-space: normal;
    margin-top: 12px;
    font-size: 12.5px;
    color: var(--muted);
}
.chart-key span { margin-right: 16px; white-space: nowrap; }
.chart-key i {
    display: inline-block;
    width: 11px; height: 11px;
    border-radius: 2px;
    margin-right: 5px;
    vertical-align: -1px;
}
.key-now { background: var(--ls-blue); }
.key-ly { background: var(--line); }

@media (max-width: 460px) {
    .period-btn { font-size: 13px; padding: 10px 2px; }
    .month-col { width: 30px; }
    .month-bars { width: 21px; height: 110px; }
}

/* "What you might be missing" group headings */
.miss-group-head {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    color: var(--muted);
    margin: 16px 0 8px;
}
#missOverdue .miss-group-head { margin-top: 4px; }

/* ---------- Suggested Products drop-down ----------
   The summary IS the button: shaded, bordered, rounded, with a chevron
   badge. When open it becomes the header of the panel, so the bottom
   corners square off and the body appears attached underneath. */
.suggest-panel {
    margin: 10px 0 14px;
    border-radius: 10px;
}
.suggest-panel summary {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 14px 14px 16px;
    min-height: 58px;
    cursor: pointer;
    list-style: none;
    background: linear-gradient(180deg, #F2F6FD 0%, #E7EEFA 100%);
    border: 1.5px solid #B9CBEA;
    border-radius: 10px;
    box-shadow: 0 1px 2px rgba(27, 75, 155, 0.10);
}
.suggest-panel summary::-webkit-details-marker { display: none; }
.suggest-panel summary:active {
    background: #DCE6F7;
    box-shadow: inset 0 1px 3px rgba(27, 75, 155, 0.16);
}
.suggest-panel[open] summary {
    border-radius: 10px 10px 0 0;
    box-shadow: none;
}

.suggest-text { display: flex; flex-direction: column; gap: 1px; flex: 1 1 auto; min-width: 0; }
.suggest-title {
    font-family: "Barlow Condensed", sans-serif;
    font-size: 19px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    color: var(--ls-blue-dark);
    line-height: 1.1;
}
.suggest-sub { font-size: 12.5px; color: var(--muted); line-height: 1.25; }

/* Chevron sits in its own round badge so it reads as a control, not text. */
.suggest-chev {
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--ls-blue);
    color: #fff;
    font-size: 13px;
    line-height: 30px;
    text-align: center;
    transition: transform 0.18s ease;
}
.suggest-panel[open] .suggest-chev { transform: rotate(180deg); }

/* Body hangs off the bottom of the button when open. */
.suggest-body {
    border: 1.5px solid #B9CBEA;
    border-top: 0;
    border-radius: 0 0 10px 10px;
    background: var(--paper);
    padding: 4px 14px 14px;
}
.suggest-body .contract-section { margin-top: 12px; }
.suggest-body .chip-group:last-of-type { margin-bottom: 0; }

@media (max-width: 460px) {
    .suggest-title { font-size: 17px; }
    .suggest-sub { font-size: 12px; }
}

.cutoff-note {
    margin-top: 8px;
    padding: 8px 12px;
    border-radius: var(--radius);
    background: #EDF2FB;
    border: 1px solid var(--ls-blue);
    color: var(--ls-blue-dark);
    font-size: 14px;
}

/* ============================================================
   Contracts
   ============================================================ */
.contract-banner {
    display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
    justify-content: space-between;
    background: #FFF7E6; border: 1.5px solid var(--amber-edge, #E8B54D);
    border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px;
}
.contract-banner .cb-text { display: flex; flex-direction: column; gap: 2px; }
.contract-banner .cb-text strong { color: #7A5410; font-size: 16px; }
.contract-banner .cb-text span { color: #8a6a2f; font-size: 13.5px; }

.contract-row {
    display: flex; align-items: center; justify-content: space-between; gap: 14px;
    flex-wrap: wrap;
    padding: 14px; border: 1.5px solid var(--line); border-radius: var(--radius);
    margin-top: 10px; text-decoration: none; color: inherit;
}
.contract-row.needs-sign { border-color: var(--ls-blue); background: #EDF2FB; }
.contract-row.needs-sign:active { background: #DCE6F7; }
.contract-row.muted { opacity: 0.75; }
.contract-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1 1 auto; }
.contract-title { font-weight: 700; font-size: 16px; color: var(--ink); }
.contract-meta { font-size: 13px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.contract-cta { font-weight: 700; color: var(--ls-blue); white-space: nowrap; }
.contract-dl { font-weight: 600; color: var(--ls-blue); white-space: nowrap; text-decoration: none; }
.sign-badge { padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.sign-badge.ok { background: #E8F5EC; color: var(--ok, #1E7A3C); border: 1px solid #B9DEC5; }

.contract-facts { display: flex; gap: 26px; flex-wrap: wrap; margin-bottom: 14px; }
.contract-facts .cf-label { display: block; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.contract-facts .cf-val { font-weight: 700; font-size: 15px; color: var(--ink); }

.contract-table { width: 100%; border-collapse: collapse; margin: 6px 0 4px; }
.contract-table th, .contract-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); font-size: 14px; }
.contract-table th { background: var(--paper); font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--muted); }
.contract-table .num { text-align: right; }

.contract-terms { margin-top: 16px; }
.contract-terms h3 { font-size: 15px; margin-bottom: 8px; color: var(--ls-blue-dark); }
.contract-terms p { font-size: 13.5px; color: #333; line-height: 1.5; margin-bottom: 10px; }

.sign-label { display: block; font-weight: 600; margin-bottom: 6px; }
.sign-input {
    width: 100%; max-width: 420px; padding: 12px 14px; font-size: 20px;
    font-family: "Segoe Script", "Brush Script MT", cursive;
    border: 1.5px solid var(--line); border-radius: var(--radius); margin-bottom: 14px;
}
.sign-agree { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 16px; font-size: 14px; }
.sign-agree input { margin-top: 3px; width: 18px; height: 18px; flex: 0 0 auto; }
.sign-actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.sign-fineprint { margin-top: 10px; }
.form-error { color: var(--ls-red); font-weight: 600; margin-bottom: 10px; }

.sign-done { text-align: center; }
.sign-check {
    width: 64px; height: 64px; border-radius: 50%; background: #E8F5EC; color: var(--ok, #1E7A3C);
    font-size: 36px; line-height: 64px; margin: 6px auto 10px; font-weight: 700;
}
.sign-done .sign-actions { justify-content: center; margin-top: 16px; }

/* Full back-page terms on the sign screen */
.terms-scroll {
    max-height: 340px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--paper);
    padding: 12px 14px;
}
.terms-scroll p { font-size: 12.5px; line-height: 1.5; margin-bottom: 9px; }
.terms-scroll p:last-child { margin-bottom: 0; }

/* ---------- Ship-date chips (Orders & History) ---------- */
.ship-badge {
    display: inline-block;
    margin-top: 4px;
    margin-right: 6px;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 600;
    background: #EDF4FF;
    color: var(--ls-blue-dark);
    border: 1px solid var(--ls-blue);
}
.ship-badge.shipped {
    background: var(--paper);
    color: var(--muted);
    border-color: var(--line);
}
.ship-badge.updated {
    background: #FDF3E3;
    color: #9A6B10;
    border-color: #E8B54D;
}
.ship-badge-icon { font-size: 12px; margin-right: 2px; }

/* ---------- Payment application detail ---------- */
.applied-detail { display: inline-block; }
.applied-detail summary {
    list-style: none;
    cursor: pointer;
    white-space: nowrap;
}
.applied-detail summary::-webkit-details-marker { display: none; }
.applied-caret { color: var(--ls-blue); font-size: 12px; }
.applied-detail[open] .applied-caret { display: inline-block; transform: rotate(180deg); }
.applied-link { color: var(--ls-blue); font-size: 12.5px; font-weight: 600; }
.applied-list {
    margin: 8px 0 4px;
    padding: 8px 10px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 8px;
    min-width: 220px;
}
.applied-row {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    padding: 3px 0;
    font-size: 13px;
    white-space: nowrap;
}
.applied-doc a { font-weight: 600; }
.applied-type { color: var(--muted); font-size: 12px; margin-left: 6px; }
.applied-amt { font-weight: 600; }

/* Comments character counter */
.char-count { display: block; text-align: right; margin-top: 4px; }
.char-count.low { color: var(--ls-red); font-weight: 600; }

/* Admin password-link tool */
.reset-result { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.reset-result textarea { width: 100%; font-family: Consolas, monospace; font-size: 12.5px; word-break: break-all; }

/* ============================================================
   Staff accounts (My Accounts list + account page)
   ============================================================ */
.acct-page .neg { color: var(--ls-red); }
.acct-page .strong { font-weight: 700; }
.acct-page .up { color: var(--ok); }
.acct-page .down { color: #B5651D; }
.acct-page .acct-sub { font-size: 12.5px; color: var(--muted); }
.acct-page .acct-sub.up { color: var(--ok); }
.acct-page .acct-sub.down { color: #B5651D; }
.acct-page .acct-no { font-size: 12px; color: var(--muted); font-weight: 600; margin-left: 4px; }

.acct-toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 6px; }
.acct-toggle { display: inline-flex; border: 1.5px solid var(--ls-blue); border-radius: 999px; overflow: hidden; }
.acct-toggle a { padding: 7px 16px; font-weight: 600; color: var(--ls-blue); text-decoration: none; }
.acct-toggle a.on { background: var(--ls-blue); color: #fff; }
.acct-search { display: flex; gap: 6px; flex: 1 1 260px; }
.acct-search input { flex: 1; min-width: 0; padding: 9px 12px; border: 1.5px solid var(--line); border-radius: var(--radius); font-size: 15px; }
.acct-totals { margin-top: 8px; color: var(--muted); }

.acct-attention { border-left: 4px solid #E8B54D; }
.attn-list { display: flex; flex-direction: column; }
.attn-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.attn-row:last-child { border-bottom: 0; }
.attn-name { font-weight: 700; color: var(--ink); text-decoration: none; }
.attn-bal { grid-row: 1 / span 2; grid-column: 2; align-self: center; font-weight: 700; color: var(--ls-blue); white-space: nowrap; }
.attn-flags { display: flex; flex-wrap: wrap; gap: 6px; }
.attn-flag { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
             background: #FDF3E3; color: #9A6B10; border: 1px solid #E8B54D; }
.attn-flag.due { background: #FCE8EB; color: var(--ls-red); border-color: #EBA3AE; }

.acct-list-card { padding: 0; overflow-x: auto; }
.acct-table { width: 100%; border-collapse: collapse; }
.acct-table th, .acct-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.acct-table th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); background: var(--paper); }
.acct-table th a { color: inherit; text-decoration: none; }
.acct-table .num { text-align: right; white-space: nowrap; }
.acct-name { font-weight: 700; color: var(--ink); text-decoration: none; }
.acct-bal { font-weight: 700; color: var(--ls-blue); font-size: 16px; }
@media (max-width: 700px) {
    .acct-table .col-sp, .acct-table .col-ytd, .acct-table .col-90 { display: none; }
}
@media (max-width: 460px) {
    .acct-table .col-pd, .acct-table .col-last { display: none; }
}

/* ---- account page ---- */
.acct-back { margin: 4px 0 8px; }
.acct-back a { color: var(--ls-blue); font-weight: 600; text-decoration: none; }
.acct-head { display: flex; gap: 18px; flex-wrap: wrap; justify-content: space-between; }
.acct-head h1 { font-size: 24px; margin: 0 0 2px; }
.acct-addr { font-style: normal; margin: 8px 0; line-height: 1.4; }
.acct-reach { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 4px; }
.acct-reach a { color: var(--ls-blue); font-weight: 600; text-decoration: none; }
.acct-money { display: flex; flex-direction: column; gap: 10px; min-width: 230px; }
.acct-money-bal { display: flex; flex-direction: column; padding: 12px 16px; border: 1.5px solid var(--ls-blue);
                  border-radius: var(--radius); background: #EDF2FB; text-decoration: none; color: var(--ink); }
.acct-money-bal .big, .acct-tiles .big { font-family: "Barlow Condensed", sans-serif; font-size: 30px; font-weight: 700; line-height: 1.1; }
.acct-terms { display: grid; gap: 3px; font-size: 14px; }
.acct-terms .cf-label { display: inline-block; min-width: 96px; }
.acct-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.acct-flagbar { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }

.acct-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 14px; }
.acct-tiles .tile { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; }

.acct-chart { display: flex; align-items: flex-end; gap: 6px; height: 170px; padding-top: 10px; }
.acct-bar { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; min-width: 0; }
.acct-bar-pair { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 2px; }
.acct-bar-pair .ly, .acct-bar-pair .cy { width: 42%; border-radius: 3px 3px 0 0; min-height: 0; }
.acct-bar-pair .ly { background: #CBD2DC; }
.acct-bar-pair .cy { background: var(--ls-blue); }
.acct-bar-val { font-size: 11px; color: var(--ink); height: 15px; }
.acct-bar-lbl { font-size: 11px; color: var(--muted); }

.acct-two { display: grid; grid-template-columns: 1fr; gap: 0 16px; }
@media (min-width: 900px) { .acct-two { grid-template-columns: 1fr 1fr; } }

.acct-contact { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.acct-edit { color: var(--ls-blue); font-weight: 600; text-decoration: none; white-space: nowrap; }
.acct-contact-form { padding: 10px 0; }
.acct-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; }
.acct-form-grid label { display: flex; flex-direction: column; font-size: 13px; font-weight: 600; color: var(--muted); }
.acct-form-grid label.wide { grid-column: 1 / -1; }
.acct-form-grid input { padding: 8px 10px; border: 1.5px solid var(--line); border-radius: 8px; font-size: 15px; color: var(--ink); }
.acct-form-actions { display: flex; gap: 8px; margin-top: 10px; }
.acct-page .card > .btn-secondary { margin-top: 10px; display: inline-block; }

.acct-inline { display: inline; }
.link-btn { background: none; border: 0; padding: 0; color: var(--ls-blue); font-weight: 600; cursor: pointer; font-size: 13px; }
.link-btn.danger { color: var(--ls-red); }

.acct-note-form textarea { width: 100%; padding: 10px; border: 1.5px solid var(--line); border-radius: var(--radius); font-size: 15px; font-family: inherit; }
.acct-note-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 8px 0 12px; flex-wrap: wrap; }
.acct-note-row label { font-size: 13px; font-weight: 600; color: var(--muted); }
.acct-note-row input[type=date] { padding: 6px 8px; border: 1.5px solid var(--line); border-radius: 8px; margin-left: 6px; }
.acct-note { padding: 10px 0; border-top: 1px solid var(--line); }
.acct-note-meta { font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.acct-note-body { white-space: pre-wrap; margin: 4px 0; }


/* ---------- Statement (Report 50019 layout) ---------- */
.stmt-aging { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 14px; }
.stmt-aging > div { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
.stmt-aging .amt { font-family: "Barlow Condensed", sans-serif; font-size: 21px; font-weight: 700; }
.stmt-aging > div.late { border-color: var(--ls-red); }
.stmt-aging > div.late .amt { color: var(--ls-red); }

.stmt-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.stmt-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stmt-period { display: inline-flex; flex-wrap: wrap; border: 1.5px solid var(--ls-blue); border-radius: 8px; overflow: hidden; }
.stmt-period a { padding: 6px 11px; font-weight: 600; font-size: 14px; color: var(--ls-blue); text-decoration: none; white-space: nowrap; }
.stmt-period a + a { border-left: 1px solid var(--line); }
.stmt-period a.on { background: var(--ls-blue); color: #fff; }

/* Four columns, fixed widths - the document column takes what's left and wraps. */
.stmt-table { width: 100%; border-collapse: collapse; table-layout: fixed; margin-top: 6px; }
.stmt-table col.c-date { width: 76px; }
.stmt-table col.c-due { width: 92px; }
.stmt-table col.c-amt { width: 104px; }
.stmt-table th, .stmt-table td { padding: 9px 6px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.stmt-table thead th, .stmt-table thead th.num { font-family: inherit; font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--muted); }
.stmt-table .num { text-align: right; font-family: "Barlow Condensed", sans-serif; font-size: 17px; white-space: nowrap; }
.stmt-table tfoot th { border-bottom: 0; border-top: 2px solid var(--ink); font-size: 15px; }
.stmt-table tfoot th.num { font-size: 19px; }
.stmt-table a { color: var(--ls-blue); font-weight: 600; }
.stmt-table td.credit { color: var(--ok); }
.stmt-date { font-size: 14px; color: var(--muted); white-space: nowrap; }
.stmt-bal { font-weight: 600; }

.stmt-doc { min-width: 0; overflow-wrap: break-word; }
.stmt-doc-main { display: flex; flex-wrap: wrap; gap: 0 6px; align-items: baseline; }
.stmt-type { font-weight: 600; }
.stmt-meta { display: flex; flex-wrap: wrap; gap: 2px 10px; align-items: center; font-size: 13px; color: var(--muted); margin-top: 2px; }
.stmt-meta:empty { display: none; }
.stmt-chip { display: inline-block; padding: 1px 7px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.stmt-chip.paid { background: #E8F5EC; color: var(--ok); }
.stmt-chip.open { background: #EDF2FB; color: var(--ls-blue-dark); }
.stmt-chip.late { background: #FDECEF; color: var(--ls-red); }

.stmt-links { list-style: none; margin: 5px 0 0; padding: 0 0 0 10px; border-left: 2px solid var(--line); }
.stmt-links li { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; line-height: 1.45; color: var(--muted); }
.stmt-links-what { min-width: 0; }
.stmt-links-date { margin-left: 4px; white-space: nowrap; }
.stmt-links-amt { white-space: nowrap; font-weight: 600; color: var(--ink); }

.stmt-forward td { background: var(--paper); font-style: italic; color: var(--muted); }
.stmt-sub td { background: #FAFBFC; }
.stmt-sub .stmt-doc { font-size: 14px; color: var(--muted); }
.stmt-sub .stmt-type { font-weight: 600; color: var(--ink); }
.stmt-late { font-size: 12px; color: var(--ls-red); font-weight: 600; }
.stmt-foot-date { font-weight: 400; color: var(--muted); font-size: 13px; margin-left: 6px; }
.stmt-due-label { display: none; }
.stmt-period .sm { display: none; }

/* Phones: each line becomes a small stacked block instead of a 4-column row.
     date ............ amount
     Invoice SI-1045 / your ref / paid-by lines
     ................. balance            */
@media (max-width: 600px) {
    .stmt-aging { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .stmt-tools { width: 100%; }
    .stmt-period { display: grid; grid-template-columns: repeat(5, 1fr); flex: 1 1 auto; }
    .stmt-period a { padding: 7px 2px; text-align: center; font-size: 14px; }
    .stmt-period .lg { display: none; }
    .stmt-period .sm { display: inline; }

    .stmt-table, .stmt-table tbody, .stmt-table tfoot { display: block; }
    .stmt-table thead, .stmt-table colgroup { display: none; }
    .stmt-table tr { display: grid; grid-template-columns: 1fr auto; column-gap: 10px; padding: 10px 4px; border-bottom: 1px solid var(--line); }
    .stmt-table td, .stmt-table th { display: block; padding: 0; border: 0; background: transparent; }
    .stmt-table .stmt-empty { display: none; }
    .stmt-table tr.row-past-due { background: #FDECEF; }
    .stmt-table tr.stmt-sub { background: #FAFBFC; }

    /* activity rows */
    .stmt-activity tbody tr:not(.stmt-forward) > td:nth-child(1) { grid-row: 1; grid-column: 1; }
    .stmt-activity tbody tr:not(.stmt-forward) > td:nth-child(3) { grid-row: 1; grid-column: 2; }
    .stmt-activity tbody tr:not(.stmt-forward) > td:nth-child(2) { grid-row: 2; grid-column: 1 / -1; margin-top: 2px; }
    .stmt-activity tbody tr:not(.stmt-forward) > td:nth-child(4) { grid-row: 3; grid-column: 1 / -1; margin-top: 4px; font-size: 15px; color: var(--muted); }
    .stmt-activity tbody tr:not(.stmt-forward) > td:nth-child(4)::before {
        content: "Balance "; font-family: "Barlow", sans-serif; font-size: 11.5px; font-weight: 600;
        text-transform: uppercase; letter-spacing: 0.5px;
    }
    .stmt-table tr.stmt-forward { grid-template-columns: auto 1fr auto; background: var(--paper); font-style: italic; color: var(--muted); }

    /* open items */
    .stmt-open tbody tr > td:nth-child(1) { grid-row: 1; grid-column: 1; }
    .stmt-open tbody tr > td:nth-child(4) { grid-row: 1; grid-column: 2; }
    .stmt-open tbody tr > td:nth-child(2) { grid-row: 2; grid-column: 1 / -1; margin-top: 2px; }
    .stmt-open tbody tr > td:nth-child(3) { grid-row: 3; grid-column: 1 / -1; margin-top: 3px; }
    .stmt-open .stmt-due-label { display: inline; }
    .stmt-open .stmt-due .stmt-late { display: inline; margin-left: 8px; }

    .stmt-table tfoot tr { border-top: 2px solid var(--ink); border-bottom: 0; }
    .stmt-table tfoot th { border-top: 0; }
    .stmt-links { padding-left: 8px; }
}

/* ---------- Payments received (staff) ---------- */
.pay-datebar { display: flex; gap: 6px; align-items: center; flex-wrap: nowrap; }
.pay-datebar input[type=date] { width: auto; min-width: 0; flex: 0 1 170px; padding: 8px 10px; border: 1.5px solid var(--line); border-radius: var(--radius); font: inherit; font-size: 15px; }
.pay-datebar .btn-secondary { flex: 0 0 auto; padding-left: 12px; padding-right: 12px; }
.pay-step { min-width: 40px; text-align: center; font-size: 20px; line-height: 1; }
.pay-list { display: flex; flex-direction: column; }
.pay-row { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.pay-row:first-child { padding-top: 0; }
.pay-main { min-width: 0; flex: 1 1 auto; }
.pay-amt { display: flex; flex-direction: column; align-items: flex-end; text-align: right; white-space: nowrap; }
.pay-amt .big { font-family: "Barlow Condensed", sans-serif; font-size: 22px; font-weight: 700; color: var(--ok); }
.pay-unapplied { color: var(--ls-blue-dark); font-weight: 600; }
.pay-applied { list-style: none; margin: 6px 0 0; padding: 0 0 0 10px; border-left: 2px solid var(--line); max-width: 360px; }
.pay-applied li { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--muted); line-height: 1.45; }
.pay-applied .amt { font-weight: 600; color: var(--ink); white-space: nowrap; }
.pay-total { display: flex; justify-content: space-between; padding-top: 10px; border-top: 2px solid var(--ink); margin-top: -1px; }
.pay-total strong { font-family: "Barlow Condensed", sans-serif; font-size: 22px; }
.acct-paystrip { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 16px;
    margin-bottom: 14px; background: #E8F5EC; border: 1px solid #BFE0C8; border-radius: var(--radius);
    color: var(--ink); text-decoration: none; }
.acct-paystrip strong { color: var(--ok); }
.acct-paystrip .go { color: var(--ls-blue); font-weight: 600; white-space: nowrap; }
.acct-paystrip.none { background: var(--card); border-color: var(--line); }

/* ---------- Invoice payment terms / discount ---------- */
.doc-fact-disc strong { color: var(--ok); }
.terms-row td { color: var(--ok); font-weight: 600; border-bottom: 0; }
.terms-row .terms-when { color: var(--muted); font-weight: 400; font-size: 13px; margin-left: 4px; }
.terms-net th { color: var(--ok); }
.terms-net th.num { font-size: 20px; }
.terms-expired td, .terms-expired th { color: var(--muted) !important; font-weight: 400; }
.stmt-share-note { font-size: 12px; margin-top: 3px; }

/* ---------- Invoice: payments & credits applied ---------- */
.settle-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.settle-status { font-size: 13px; font-weight: 600; padding: 3px 10px; border-radius: 999px; }
.settle-status.paid { background: #E8F5EC; color: var(--ok); }
.settle-status.part { background: #EDF2FB; color: var(--ls-blue-dark); }
.settle-status.open { background: #FDECEF; color: var(--ls-red); }
.settle-start td { font-weight: 600; }
.settle-owed { color: var(--ls-red); }
@media (max-width: 600px) {
    .settle-table tbody tr > td:nth-child(1) { grid-row: 1; grid-column: 1; }
    .settle-table tbody tr > td:nth-child(3) { grid-row: 1; grid-column: 2; }
    .settle-table tbody tr > td:nth-child(2) { grid-row: 2; grid-column: 1 / -1; margin-top: 2px; }
}

/* ---------- Unsigned contracts (staff) ---------- */
.acct-unsignedstrip { background: #FFF6E0; border-color: #EBCB7A; }
.acct-unsignedstrip strong { color: #8A5A00; }
.unsigned-detail { font-size: 14px; margin-top: 4px; }
.unsigned-days { font-family: "Barlow Condensed", sans-serif; font-size: 20px; font-weight: 700; }
.unsigned-days.late { color: var(--ls-red); }

