:root {
  --navy: #171717;
  --navy-2: #303030;
  --ink: #222222;
  --muted: #686868;
  --line: #dddddd;
  --paper: #ffffff;
  --canvas: #f2f2f2;
  --amber: #4a4a4a;
  --amber-dark: #303030;
  --green: #208567;
  --red: #b44949;
  --shadow: 0 18px 45px rgba(0, 0, 0, .10);
  font-family: "Josefin Sans", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; font-size: 16px; line-height: 1.5; background: radial-gradient(circle at 90% 0, #d7d7d7 0, transparent 34rem), var(--canvas); }
a { color: #303030; text-decoration: none; }
a:hover { text-decoration: underline; }
.site-header { min-height: 76px; padding: 0 5vw; display: flex; align-items: center; justify-content: space-between; gap: 2rem; background: rgba(238,238,238,.97); backdrop-filter: blur(14px); color: #171717; border-bottom: 1px solid #c8c8c8; box-shadow: 0 3px 16px rgba(0,0,0,.14); }
.site-header .brand { color: #171717; }
.site-header .brand-logo { border: 1px solid #b8b8b8; box-shadow: 0 2px 7px rgba(0,0,0,.18); }
.site-header .brand small { color: #666666; }
.brand { color: white; display: flex; align-items: center; gap: .8rem; text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand-logo { display: block; width: 52px; height: 52px; flex: 0 0 52px; border-radius: 10px; object-fit: cover; }
.brand strong, .brand small { display: block; }
.brand strong { font-family: "Space Grotesk", ui-sans-serif, sans-serif; font-size: 1.05rem; font-weight: 700; letter-spacing: .035em; line-height: 1.05; }
.brand small { color: #bdbdbd; font-size: .72rem; text-transform: uppercase; letter-spacing: .12em; margin-top: .12rem; }
nav { display: flex; align-items: center; gap: .35rem; }
.nav-link { color: #383838; padding: .65rem .85rem; border-radius: 9px; font-size: .9rem; font-weight: 650; }
.nav-link:hover, .nav-link.active { color: #111111; background: rgba(0,0,0,.09); text-decoration: none; }
.nav-link.muted { color: #666666; }
.page-shell { width: min(1180px, calc(100% - 2rem)); margin: 0 auto; padding: 2.25rem 0 4rem; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.eyebrow { margin: 0 0 .4rem; color: var(--amber-dark); font-size: .75rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { font-family: "Cinzel", Georgia, serif; }
h1 { margin-bottom: .35rem; color: var(--navy); font-size: clamp(1.8rem, 4vw, 2.65rem); letter-spacing: -.035em; line-height: 1.08; }
h2 { color: var(--navy); font-size: 1.15rem; }
.subtitle { color: var(--muted); margin-bottom: 0; line-height: 1.55; }
.card { background: var(--paper); border: 1px solid rgba(205,216,224,.85); border-radius: 18px; box-shadow: var(--shadow); }
.search-card { padding: 1.15rem; margin-bottom: 1.5rem; }
.search-grid { display: grid; grid-template-columns: minmax(14rem, 2fr) 1fr 1fr auto; gap: .75rem; align-items: end; }
label { display: block; color: #455569; font-size: .78rem; font-weight: 750; letter-spacing: .02em; }
input, select { width: 100%; min-height: 44px; margin-top: .35rem; padding: .7rem .8rem; border: 1px solid #cbd6de; border-radius: 10px; background: white; color: var(--ink); font: inherit; outline: none; }
input:focus, select:focus { border-color: #4a4a4a; box-shadow: 0 0 0 3px rgba(48,48,48,.16); }
input[type=file] { padding: .55rem; background: #f8fafb; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: .7rem 1rem; border: 0; border-radius: 10px; background: var(--navy); color: white; font: inherit; font-size: .9rem; font-weight: 750; cursor: pointer; }
.button:hover { background: var(--navy-2); text-decoration: none; }
.button.primary { background: #171717; color: white; }
.button.primary:hover { background: #3a3a3a; }
.button.ghost { background: #edf2f5; color: var(--navy); }
.button.danger { background: #fff1f1; color: #a32727; border: 1px solid #e6bcbc; }
.button.danger:hover { background: #dc2626; color: white; border-color: #dc2626; }
.button.compact { min-height: 40px; padding: .5rem .75rem; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
.stat { padding: 1.1rem 1.25rem; }
.stat span { color: var(--muted); font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.stat strong { display: block; margin-top: .25rem; color: var(--navy); font-size: 1.65rem; }
.section-head { padding: 1.1rem 1.25rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; border-bottom: 1px solid var(--line); }
.section-head h2 { margin: 0; }
.count-pill, .badge { display: inline-flex; align-items: center; border-radius: 99px; font-size: .75rem; font-weight: 750; }
.count-pill { padding: .35rem .65rem; background: #edf2f5; color: var(--muted); }
.badge { padding: .28rem .58rem; background: #ededed; color: #404040; }
.badge.month { background: #e2e2e2; color: #303030; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: .8rem 1.25rem; background: #f8fafb; color: var(--muted); text-align: left; font-size: .7rem; text-transform: uppercase; letter-spacing: .09em; }
td { padding: 1rem 1.25rem; border-top: 1px solid #edf1f3; vertical-align: middle; }
tbody tr:hover { background: #fbfcfd; }
.customer-link { color: var(--navy); font-weight: 750; }
.file-link { display: inline-flex; align-items: center; gap: .5rem; font-weight: 650; }
.file-icon { display: block; width: 28px; height: 28px; flex: 0 0 28px; object-fit: contain; }
.empty { padding: 3.5rem 1.5rem; text-align: center; color: var(--muted); }
.empty strong { display: block; margin-bottom: .5rem; color: var(--navy); font-size: 1.1rem; }
.form-card { max-width: 760px; padding: 1.5rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem; }
.form-grid .full { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; gap: .75rem; padding-top: .5rem; }
.alert { margin-bottom: 1rem; padding: .85rem 1rem; border-radius: 10px; background: #fbecec; color: #8b3333; border: 1px solid #efcdcd; }
.alert.success { background: #e8f7f1; color: #17664f; border-color: #b9e4d3; }
.back-link { display: inline-flex; margin-bottom: 1rem; color: var(--muted); font-weight: 650; }
.review-list { display: grid; gap: 1rem; }
.review-card { padding: 1.2rem; }
.review-card header { display: flex; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.review-path { font-weight: 750; overflow-wrap: anywhere; }
.decision-grid { display: grid; grid-template-columns: 1fr 1fr auto; gap: .8rem; align-items: end; }
.review-actions { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.radio-label { display: flex; gap: .5rem; align-items: center; }
.radio-label input { width: auto; min-height: auto; margin: 0; }
.pagination { display: flex; justify-content: space-between; margin-top: 1.25rem; }
.login-page { min-height: 100vh; display: grid; grid-template-columns: 1.15fr .85fr; background: var(--navy); }
.login-story { padding: clamp(2rem, 7vw, 6rem); display: flex; flex-direction: column; justify-content: space-between; color: white; background: radial-gradient(circle at 15% 20%, rgba(255,255,255,.13), transparent 22rem), linear-gradient(145deg, #111111, #3d3d3d); }
.login-story .brand { width: fit-content; padding: .65rem .85rem; border: 1px solid #c8c8c8; border-radius: 14px; background: rgba(238,238,238,.97); color: #171717; box-shadow: 0 5px 18px rgba(0,0,0,.24); }
.login-story .brand-logo { border: 1px solid #b8b8b8; box-shadow: 0 2px 7px rgba(0,0,0,.18); }
.login-story .brand small { color: #666666; }
.login-story h1 { max-width: 650px; color: white; font-size: clamp(2.6rem, 6vw, 5.4rem); }
.login-story p { max-width: 540px; color: #d0d0d0; font-size: 1.05rem; line-height: 1.7; }
.login-panel { display: grid; place-items: center; padding: 2rem; background: #f7f9fa; border-radius: 28px 0 0 28px; }
.login-box { width: min(380px, 100%); }
.login-box .brand { color: var(--navy); margin-bottom: 3rem; }
.login-box .brand small { color: var(--muted); }
.login-box h2 { margin-bottom: .45rem; font-size: 1.75rem; }
.login-box form { display: grid; gap: 1rem; margin-top: 1.6rem; }
.login-box .button { width: 100%; margin-top: .35rem; }
.site-footer { padding: 1.4rem; color: #8a97a5; text-align: center; font-size: .75rem; }
.action-cell { width: 1%; text-align: right; }
.action-cell form { margin: 0; }
.action-cell .button { white-space: nowrap; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.trash-list { display: grid; }
.trash-item { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.25rem; border-top: 1px solid var(--line); }
.trash-item:first-child { border-top: 0; }
.trash-item strong { color: var(--navy); overflow-wrap: anywhere; }
.trash-item p { margin: .25rem 0 0; color: var(--muted); }
.trash-actions { display: flex; align-items: center; gap: .65rem; }
.trash-actions form { margin: 0; }
.trash-item.legacy { align-items: flex-start; flex-direction: column; background: #fbfdfd; }
.legacy-restore { width: 100%; display: grid; grid-template-columns: 2fr 1fr 1fr auto; align-items: end; gap: .75rem; }
button, a, input, select { transition: color .2s ease, background-color .2s ease, border-color .2s ease, box-shadow .2s ease, transform .2s ease; }
:focus-visible { outline: 3px solid #555555; outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; } }

/* Gasville Operations Console */
:root {
  --navy: #17191b;
  --navy-2: #292c2f;
  --ink: #252524;
  --muted: #656560;
  --line: #d8d8d2;
  --paper: #ffffff;
  --canvas: #f3f3ee;
  --amber: #f3b61f;
  --amber-dark: #765400;
  --station-red: #c72b2b;
  --shadow: 0 10px 28px rgba(24, 24, 22, .07);
  font-family: "Work Sans", ui-sans-serif, system-ui, sans-serif;
}
body { background: var(--canvas); font-family: "Work Sans", ui-sans-serif, system-ui, sans-serif; }
h1, h2, h3 { font-family: "Outfit", ui-sans-serif, system-ui, sans-serif; }
a { color: #5f430d; }
.portal-frame { min-height: 100vh; display: grid; grid-template-columns: 232px minmax(0, 1fr); }
.operations-sidebar { position: sticky; top: 0; height: 100vh; z-index: 10; display: flex; flex-direction: column; padding: 24px 16px 18px; color: #f6f5f1; background: var(--navy); border-right: 1px solid var(--navy-2); }
.operations-sidebar .brand { min-height: 72px; padding: 0 8px 20px; gap: 12px; color: #fff; border-bottom: 1px solid #343431; }
.operations-sidebar .brand-logo { width: 52px; height: 52px; flex-basis: 52px; padding: 4px; object-fit: contain; background: #f1f0ec; border: 1px solid #d8d7d1; border-radius: 9px; box-shadow: 0 3px 10px rgba(0,0,0,.28); }
.operations-sidebar .brand strong { font-family: "Outfit", ui-sans-serif, sans-serif; font-size: .96rem; font-weight: 800; letter-spacing: .055em; }
.operations-sidebar .brand small { margin-top: 4px; color: #aaa9a3; font-size: .66rem; letter-spacing: .14em; }
.side-nav { display: grid; gap: 6px; margin-top: 24px; }
.side-nav .nav-link, .sidebar-logout { display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 0 13px; border-radius: 8px; color: #c9c8c2; font-size: .9rem; font-weight: 600; }
.side-nav .nav-link:hover, .side-nav .nav-link.active, .sidebar-logout:hover { color: #fff; background: var(--navy-2); text-decoration: none; }
.side-nav .nav-link.active { box-shadow: inset 3px 0 0 var(--amber); }
.nav-icon { width: 21px; height: 21px; flex: 0 0 21px; }
.sidebar-logout { margin-top: auto; border-top: 1px solid #343431; border-radius: 0; padding-top: 13px; color: #aaa9a3; }
.portal-workspace { min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }
.workspace-bar { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 12px 32px; background: rgba(255,255,255,.94); border-bottom: 1px solid var(--line); }
.workspace-bar div { display: grid; gap: 1px; }
.workspace-bar strong { font-family: "Outfit", sans-serif; font-size: 1.05rem; color: var(--ink); }
.workspace-kicker { color: var(--muted); font-size: .68rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.system-status { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: .76rem; font-weight: 600; }
.system-status i { width: 8px; height: 8px; border-radius: 50%; background: #3e8d64; box-shadow: 0 0 0 3px #e0f0e7; }
.workspace-symbol { display: block; width: 64px; height: 64px; flex: 0 0 64px; object-fit: cover; border: 1px solid var(--line); border-radius: 12px; }
.page-shell { width: 100%; max-width: 1500px; margin: 0 auto; padding: 30px 32px 56px; }
.page-heading { align-items: center; margin-bottom: 22px; }
.eyebrow { margin-bottom: 5px; color: #9d2020; font-size: .7rem; letter-spacing: .15em; }
h1 { font-size: clamp(1.9rem, 3vw, 2.55rem); letter-spacing: -.025em; }
h2 { font-size: 1.12rem; letter-spacing: -.01em; }
.subtitle { color: var(--muted); }
.card { border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.stats { gap: 12px; margin-bottom: 18px; }
.stat { min-height: 98px; padding: 16px 18px; border-left: 3px solid #cac9c3; box-shadow: none; }
.stat:first-child { border-left-color: var(--station-red); }
.stat:nth-child(2) { border-left-color: var(--amber); }
.stat strong { margin-top: 2px; font-family: "Outfit", sans-serif; font-size: 1.8rem; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.money { font-variant-numeric: tabular-nums; font-weight: 700; }
.search-card { padding: 14px; margin-bottom: 18px; box-shadow: none; }
.search-grid { grid-template-columns: minmax(13rem, 2fr) minmax(9rem, 1fr) minmax(10rem, 1fr) auto; }
label { color: #454540; font-size: .75rem; }
input, select { min-height: 44px; border-color: #cfcfc8; border-radius: 7px; }
input:focus, select:focus { border-color: var(--station-red); box-shadow: 0 0 0 3px rgba(199,43,43,.14); }
.button { min-height: 44px; border-radius: 7px; background: #252524; }
.button:hover { background: #3b3b38; }
.button.primary { background: var(--station-red); }
.button.primary:hover { background: #a91f1f; }
.button.ghost { background: #ecebe6; }
.button.danger { background: #fff; }
.section-head { padding: 14px 18px; }
.count-pill { background: var(--amber); color: #302300; }
.badge { background: #ecebe6; }
.badge.month { background: #ffe6a6; color: #684800; }
/* Status: pending work stands out amber, resolved settles into green. */
.badge.pending { background: #ffe6a6; color: #684800; }
.badge.resolved { background: #dcf3e6; color: #1a6b42; }
/* Fuel grade at a glance, loosely echoing real pump signage. */
.badge.fuel-reg { background: #dbe9fb; color: #1a4d8f; }
.badge.fuel-prem { background: #fbe9c9; color: #7a4f00; }
.badge.fuel-diesel { background: #dfeee0; color: #1f5c33; }

.inline-action { display: inline-flex; align-items: center; gap: 6px; }
.inline-action input { min-height: 36px; width: 9rem; padding: 6px 10px; }
.inline-action .button { min-height: 36px; }

details.card > summary { cursor: pointer; padding: 14px 18px; display: flex; align-items: center; gap: 8px; font-family: "Outfit", sans-serif; font-weight: 700; color: var(--navy); list-style: none; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::before { content: '+'; display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 5px; background: #ecebe6; font-weight: 800; }
details.card[open] > summary::before { content: '\2212'; }
details.card[open] > summary { border-bottom: 1px solid var(--line); }
th { position: sticky; top: 0; z-index: 1; padding: 11px 18px; background: #efeee9; color: #5c5c56; font-size: .68rem; }
td { padding: 12px 18px; }
tbody tr:hover { background: #faf9f6; }
/* Combined per-date total row inserted after a date's individual fuel-type
   rows in the delivery log — tinted and top-bordered to read as a subtotal,
   not another detail row. */
tr.subtotal-row td { background: #f4f1e9; border-top: 2px solid var(--line); }
tr.subtotal-row:hover td { background: #f4f1e9; }
.table-wrap { max-height: min(64vh, 720px); }
.customer-link { color: #292927; }
.file-link { color: #454540; }
.file-icon { width: 24px; height: 24px; flex-basis: 24px; }
.form-card { max-width: 860px; padding: 22px; }
.review-list { gap: 12px; }
.review-card { border-left: 3px solid var(--station-red); }
.review-path { font-family: "Work Sans", sans-serif; }
.trash-item { padding: 14px 18px; }
.alert { border-radius: 8px; }
.site-footer { margin-top: auto; border-top: 1px solid var(--line); background: #fff; }
:focus-visible { outline-color: var(--station-red); }

.login-page { background: radial-gradient(circle at 8% 20%, rgba(243,182,31,.20), transparent 22rem), linear-gradient(145deg, #17191b, #292c2f); }
.login-story { background: transparent; }
.login-story-branding { display: grid; place-items: center; gap: 24px; margin: auto 0; }
.login-story > small { align-self: flex-start; color: #8f969b; text-align: left; }
.login-story-mark { display: grid; place-items: center; width: 100%; }
.login-story-mark img { display: block; width: clamp(260px, 28vw, 360px); max-width: 100%; height: auto; border-radius: 26px; filter: brightness(1.4) contrast(1.08); box-shadow: 0 22px 56px rgba(0,0,0,.34); }
.login-box .login-form-brand { justify-content: center; width: 100%; }
.login-box .login-form-brand .brand-logo { width: 156px; height: 156px; flex-basis: 156px; padding: 10px; object-fit: contain; background: #f3f3ee; border-radius: 24px; box-shadow: 0 14px 34px rgba(0,0,0,.28); }
.login-panel { background: transparent; }
.login-box h2 { color: #f8fafc; }
.login-box .eyebrow { color: var(--amber); }
.login-box .subtitle { color: #b8bec3; }
.login-box label { color: #e5e7e8; }
.login-box input { color: #202225; background: #f8f9f7; border-color: #70767b; }
.login-box .button.primary { background: var(--station-red); }

@media (max-width: 980px) {
  .portal-frame { display: block; }
  .operations-sidebar { position: static; width: 100%; height: auto; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 10px 14px; }
  .operations-sidebar .brand { min-height: 0; padding: 0; border: 0; }
  .operations-sidebar .brand-logo { width: 42px; height: 42px; flex-basis: 42px; }
  .operations-sidebar .brand span { display: none; }
  .side-nav { display: flex; justify-content: center; gap: 4px; margin: 0; }
  .side-nav .nav-link, .sidebar-logout { min-height: 44px; padding: 0 10px; }
  .side-nav .nav-link.active { box-shadow: inset 0 -3px 0 var(--amber); }
  .sidebar-logout { margin: 0; padding-top: 0; border: 0; }
  .workspace-bar { padding: 10px 20px; }
  .page-shell { padding: 24px 20px 48px; }
}
@media (max-width: 820px) {
  .portal-frame { padding-bottom: 0; }
  .operations-sidebar {
    position: sticky;
    inset: 0 0 auto;
    z-index: 50;
    width: 100%;
    height: 68px;
    display: block;
    padding: 4px 6px;
    border: 0;
    border-bottom: 1px solid #343431;
    box-shadow: 0 8px 24px rgba(0,0,0,.16);
  }
  .operations-sidebar .brand { display: none; }
  .side-nav {
    display: flex;
    width: calc(100% - 66px);
    height: 60px;
    justify-content: flex-start;
    gap: 2px;
    margin: 0;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
  }
  .side-nav::-webkit-scrollbar { display: none; }
  .side-nav .nav-link, .sidebar-logout {
    min-width: 62px;
    min-height: 60px;
    flex: 1 0 62px;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    padding: 4px 5px;
    border-radius: 7px;
    font-size: .64rem;
    line-height: 1.1;
  }
  .side-nav .nav-link span, .sidebar-logout span { display: block; }
  .side-nav .nav-link.active { box-shadow: inset 0 3px 0 var(--amber); }
  .sidebar-logout {
    position: absolute;
    top: 4px;
    right: 6px;
    display: flex;
    width: 60px;
    min-width: 60px;
    margin: 0;
    padding-top: 4px;
    border: 0;
  }
  .nav-icon { width: 22px; height: 22px; flex-basis: 22px; }
  .workspace-bar { position: static; min-height: 58px; padding: 10px 12px; box-shadow: 0 2px 10px rgba(24,24,22,.05); }
  .workspace-bar strong { font-size: .95rem; }
  .workspace-kicker { font-size: .62rem; }
  .system-status { display: none; }
  .workspace-symbol { display: none; }
  .page-shell { padding: 20px 12px 40px; }
  .search-grid, .form-grid, .decision-grid { grid-template-columns: 1fr; }
  .form-actions { align-items: stretch; flex-direction: column; }
  .form-actions .button { width: 100%; }
  .stats { grid-template-columns: 1fr 1fr; }
  .page-heading { align-items: flex-start; }
  .page-heading .button { width: 100%; }
  .section-head { align-items: flex-start; flex-direction: column; }
  .table-wrap { max-height: none; }
  .table-wrap table,
  .table-wrap thead,
  .table-wrap tbody,
  .table-wrap tr,
  .table-wrap th,
  .table-wrap td { display: block; }
  .table-wrap thead,
  .table-wrap .table-head-row { display: none; }
  .table-wrap tbody { display: grid; gap: 10px; padding: 10px; }
  .table-wrap tr { border: 1px solid var(--line); border-radius: 10px; background: #fff; overflow: hidden; }
  .table-wrap td { display: grid; grid-template-columns: minmax(0, 8.5rem) minmax(0, 1fr); gap: 10px; align-items: center; padding: 10px 12px; border-top: 1px solid #ecebe6; text-align: left; }
  .table-wrap td:first-child { border-top: 0; }
  .table-wrap td:empty { display: none; padding: 0; border: 0; }
  .table-wrap td::before { content: attr(data-label); color: var(--muted); font-size: .69rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
  .table-wrap td.action-cell { width: auto; }
  .table-wrap td.action-cell form { width: 100%; }
  .table-wrap td.action-cell .button,
  .table-wrap td .inline-action,
  .table-wrap td .inline-action .button { width: 100%; }
  .table-wrap td .inline-action { align-items: stretch; flex-direction: column; }
  .table-wrap td .inline-action input { width: 100%; }
  .vendor-invoices td { overflow-wrap: anywhere; }
  .vendor-invoices .table-wrap td.action-cell { grid-template-columns: minmax(0, 1fr); }
  .vendor-invoices .action-cell input { min-width: 0; max-width: 100%; font-size: 16px; }
  .vendor-invoices .action-cell .button,
  .vendor-invoices .action-cell .inline-action input { min-height: 44px; }
  tr.subtotal-row td { grid-template-columns: 1fr; }
  tr.subtotal-row td::before { content: none; }
  .trash-item { align-items: flex-start; flex-direction: column; }
  .trash-actions { width: 100%; align-items: stretch; flex-direction: column; }
  .trash-actions .button { width: 100%; }
  .pagination { gap: 10px; flex-direction: column; }
  .pagination .button { width: 100%; }
}
@media (max-width: 760px) {
  .site-header { padding: .7rem 1rem; align-items: flex-start; }
  .brand small { display: none; }
  nav { gap: .1rem; }
  .nav-link { padding: .65rem .55rem; font-size: .78rem; }
  .page-shell { width: min(100% - 1rem, 1180px); padding-top: 1.25rem; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .search-grid, .form-grid, .decision-grid { grid-template-columns: 1fr; }
  .search-grid .button { width: 100%; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stats .stat:last-child { grid-column: 1 / -1; }
  th, td { padding: .85rem .8rem; }
  .login-page { grid-template-columns: 1fr; }
  .login-story { display: none; }
  .login-panel { min-height: 100vh; border-radius: 0; }
  .login-box .brand { margin-bottom: 2rem; }
  .legacy-restore { grid-template-columns: 1fr; }
  .trash-item:not(.legacy) { align-items: flex-start; }
  .trash-actions { align-items: stretch; flex-direction: column; }
}
@media (max-width: 480px) {
  h1 { font-size: 1.75rem; }
  .page-shell { padding-inline: 10px; }
  .page-heading { gap: 12px; margin-bottom: 18px; }
  .stats { grid-template-columns: 1fr; gap: 8px; }
  .stats .stat:last-child { grid-column: auto; }
  .stat { min-height: 78px; padding: 12px 14px; }
  .stat strong { font-size: 1.55rem; }
  .search-card, .form-card { padding: 12px; }
  .section-head { padding: 12px 14px; gap: 8px; }
  .table-wrap tbody { padding: 8px; gap: 8px; }
  .table-wrap td { grid-template-columns: minmax(0, 6.8rem) minmax(0, 1fr); padding: 9px 10px; }
  .file-link { min-width: 0; overflow-wrap: anywhere; }
  .review-card header { align-items: flex-start; flex-direction: column; }
  .login-panel { padding: 20px; }
  .login-box .login-form-brand .brand-logo { width: 116px; height: 116px; flex-basis: 116px; }
  .login-box h2 { font-size: 1.5rem; }
}

@media (min-width: 821px) {
  .vendor-invoices { margin-block: 18px; }
  .vendor-invoices th, .vendor-invoices td { padding: 10px 8px; }
  .vendor-invoices td { font-size: .85rem; vertical-align: top; }
  .vendor-invoices .money { white-space: nowrap; }
  .vendor-invoices > .subtitle { padding: 12px 18px; }
  .vendor-invoices .inline-action { display: flex; flex-direction: column; align-items: stretch; gap: 8px; width: 200px; max-width: 100%; }
  .vendor-invoices .inline-action input,
  .vendor-invoices .inline-action select { width: 100%; min-width: 0; min-height: 44px; margin: 0; font-size: 16px; }
  .vendor-invoices .action-cell > * + * { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
}


.invoice-sort { padding: 16px 18px; border-bottom: 1px solid var(--line); }
.invoice-sort-controls { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.invoice-sort-controls label { width: 220px; max-width: 100%; }
.invoice-sort-controls select { height: 44px; font-size: 16px; }
.invoice-sort-controls .button { flex: 0 0 auto; height: 44px; padding: 0 16px; border: 1px solid #cfcfc8; font-size: .85rem; font-weight: 600; }
.invoice-sort-controls .button:hover { background: #e1e0d9; border-color: #aaa99f; }
.invoice-sort .subtitle { margin-top: 8px; font-size: .75rem; }
@media (max-width: 480px) {
  .invoice-sort { padding: 12px 14px; }
  .invoice-sort-controls label { flex: 1 1 150px; }
}

@media print {
  .operations-sidebar, .workspace-bar, .site-footer, .no-print { display: none !important; }
  .portal-workspace { margin: 0; }
  .page-shell { padding: 0; }
  .card { box-shadow: none; border: 1px solid #999; }
  .table-wrap { max-height: none; overflow: visible; }
  table { width: 100%; border-collapse: collapse; }
  th, td { border: 1px solid #999; }
}

/* Vendor workspace: directory alongside a compact account ledger. */
.vendor-content { min-width: 0; }
.vendor-directory { display: none; }
.vendor-directory-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 18px 12px; }
.vendor-directory-heading h1 { font-size: 1.7rem; margin: 0; }
.vendor-add { margin: 0 14px 14px; box-shadow: none; }
.vendor-add form { padding: 14px; }
.vendor-add .button { margin-top: 12px; width: 100%; }
.vendor-search { display: grid; gap: 10px; padding: 0 18px 18px; }
.vendor-list { display: grid; gap: 0; }
.vendor-list-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 5px 10px; padding: 16px 18px; color: var(--ink); border-top: 1px solid var(--line); border-left: 3px solid transparent; }
.vendor-list-item:hover { background: #f3f2ed; text-decoration: none; }
.vendor-list-item[aria-current] { background: #f5efdf; border-left-color: #b88018; }
.vendor-list-name { font-weight: 600; overflow-wrap: anywhere; }
.vendor-list-item .money { font-size: .85rem; }
.vendor-list-item small { color: var(--muted); }
.vendor-list-item[hidden], #vendor-search-empty[hidden] { display: none; }
.invoice-tabs { display: flex; gap: 6px; padding: 10px 16px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.invoice-tabs a { flex-shrink: 0; padding: 9px 12px; color: var(--muted); font-size: .85rem; font-weight: 600; border-radius: 6px; }
.invoice-tabs a[aria-current] { background: #252524; color: white; }
.invoice-detail-meta { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0 0 10px; font-size: .85rem; }
.invoice-detail-meta dt { font-size: .72rem; color: var(--muted); }
.invoice-detail-meta dd { margin: 0; overflow-wrap: anywhere; }
.invoice-note { grid-column: 1 / -1; }
.credit-application-list { list-style: none; margin: 0 0 14px; padding: 0; }
.credit-application-list li { padding: 6px 0; border-top: 1px dashed var(--line); font-size: .85rem; }
.credit-application-list form { display: inline; margin-left: 10px; }
.row-menu > summary { list-style: none; cursor: pointer; }
.row-menu > summary::-webkit-details-marker { display: none; }
.row-menu[open] > summary { margin-bottom: 8px; }
.row-menu-panel { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.row-menu-panel .inline-action { flex-direction: column; align-items: stretch; }
@media screen and (min-width: 1100px) {
  .page-shell:has(.vendor-workspace) { max-width: 1800px; padding: 24px; }
  .vendor-workspace { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 24px; align-items: start; }
  .vendor-directory { display: block; position: sticky; top: 24px; max-height: calc(100vh - 48px); overflow-y: auto; background: white; border: 1px solid var(--line); border-radius: 12px; }
  .vendor-content > .back-link { display: none; }
  .vendor-content > .page-heading { min-height: 92px; flex-wrap: wrap; }
  .vendor-content h1 { font-size: clamp(1.5rem, 2vw, 2rem); }
  .vendor-content .page-heading .button { font-size: .78rem; padding: 8px 12px; }
  .vendor-invoices .invoice-secondary { display: none; }
  .vendor-invoices .table-wrap { max-height: 65vh; }
  .vendor-invoices th, .vendor-invoices td { padding: 12px 10px; vertical-align: middle; }
  .vendor-invoices td.money, .vendor-invoices th:nth-child(3), .vendor-invoices th:nth-child(4), .vendor-invoices th:nth-child(6) { text-align: right; }
  .invoice-detail-meta { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
  .credit-application-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
  .credit-application-list form { margin-left: 0; }
  .vendor-invoices .invoice-sort { padding: 10px 18px; }
  .vendor-invoices .invoice-sort-controls label { width: 170px; }
}
@media screen and (max-width: 1099px) {
  .vendor-directory-page .vendor-directory { display: block; }
  .vendor-directory-page .vendor-content { display: none; }
}
@media print {
  .invoice-tabs, .vendor-directory { display: none !important; }
}
