/* =====================================================================
   Liujia — Dealer Portal & Admin
   Sunlit theme, matched to the main site.
   ===================================================================== */
:root {
  --cream: #f6f7f8; --cream-deep: #eceff3; --sand: #e6eefb;
  --navy: #183884; --navy-soft: #154a93; --navy-hover: #124b9a;
  --ink: #183884; --ink-soft: #3a4a66; --ink-mute: #6a7a8f;
  --gold: #ffbe6b; --gold-deep: #e27c11; --bronze: #f09a3e; --bronze-deep: #ad5906;
  --line: rgba(24,56,132,.12); --line-strong: rgba(24,56,132,.25);
  --white: #ffffff;
  --green: #2e7d4f; --green-bg: #e3f0e7;
  --blue: #24548f;  --blue-bg: #e2ecf7;
  --amber: #9a6b1a; --amber-bg: #f7edd6;
  --red: #a33a2e;   --red-bg: #f7e2de;
  --violet: #5f4b8b; --violet-bg: #ece6f4;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--cream); color: var(--ink);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 16px; line-height: 1.55; -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img, svg { max-width: 100%; display: block; }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: var(--ink); }

.display { font-family: 'Instrument Serif', Georgia, serif; font-weight: 400; letter-spacing: -0.02em; line-height: 1.05; }
.script { font-family: 'Instrument Serif', serif; font-style: italic; color: var(--bronze-deep); font-weight: 400; }
.mono-label { font-size: 11px; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; color: var(--bronze-deep); }

/* ============ Buttons ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 20px; border-radius: 999px; font-size: 14px; font-weight: 600;
  border: 2px solid transparent; transition: all .22s cubic-bezier(.22,1,.36,1); white-space: nowrap;
}
.btn-dark { background: var(--navy); color: var(--cream); }
.btn-dark:hover { background: var(--navy-hover); transform: translateY(-1px); box-shadow: 0 10px 26px rgba(24,56,132,.25); }
.btn-bronze { background: var(--bronze-deep); color: var(--cream); }
.btn-bronze:hover { background: var(--navy); }
.btn-ghost { color: var(--ink); border-color: var(--line-strong); background: transparent; }
.btn-ghost:hover { border-color: var(--ink); }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-danger { color: var(--red); border-color: var(--red-bg); background: transparent; }
.btn-danger:hover { background: var(--red-bg); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

/* ============ Login ============ */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 32px;
  background: linear-gradient(160deg, var(--cream) 55%, var(--cream-deep)); }
.login-card { width: 100%; max-width: 420px; background: var(--white); border: 1px solid var(--line);
  border-radius: 20px; padding: 40px 36px; box-shadow: 0 24px 60px rgba(24,56,132,.10); }
.login-card .logo { display: block; height: 58px; padding: 15px 24px; box-sizing: border-box;
  background: var(--ink); border-radius: 12px; margin: 0 auto 26px; }
.login-card h1 { font-size: 30px; text-align: center; margin-bottom: 6px; }
.login-card .sub { text-align: center; color: var(--ink-mute); font-size: 14px; margin-bottom: 26px; }
.demo-note { margin-top: 18px; padding: 12px 14px; background: var(--sand); border-radius: 12px;
  font-size: 12.5px; color: var(--ink-soft); line-height: 1.5; }

/* ============ Forms ============ */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: var(--ink-mute); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 11px 14px; border: 1.5px solid var(--line-strong); border-radius: 10px;
  background: var(--white); transition: border-color .15s;
}
/* Dropdowns are drawn by the page, not by the browser. Safari on a Mac puts its own pop-up button on a styled
   <select> and throws the padding away, so every dropdown came out half the height of the boxes beside it —
   and narrower, which let three fields crowd onto one line. Same box, same height, same arrow in every browser. */
.field select:not([multiple]):not([size]) {
  -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236a7a8f' stroke-width='1.8' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
  padding-right: 34px !important;   /* room for the arrow, whatever padding a field sets for itself */
}
.field select[data-frac]:not([multiple]):not([size]) { background-position: right 7px center; padding-right: 24px !important; }   /* the small fraction pickers */
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--bronze-deep); }
.field .hint { font-size: 12px; color: var(--ink-mute); margin-top: 4px; }
.form-error { color: var(--red); background: var(--red-bg); border-radius: 10px; padding: 10px 14px;
  font-size: 13.5px; margin-bottom: 14px; display: none; }
.form-error.show { display: block; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-soft); }
.check input { width: 16px; height: 16px; accent-color: var(--bronze-deep); }

/* ============ Read-only review of a placed order ============ */
.review-only .item-card { background: var(--cream); border: 1px dashed var(--line-strong); }
.review-only .item-head .t::after { content: " · read only"; font-weight: 400; font-size: 12px; color: var(--ink-mute); }
.review-only input:disabled, .review-only select:disabled, .review-only textarea:disabled {
  background: #f1ece0; color: var(--ink-soft); -webkit-text-fill-color: var(--ink-soft); border-color: var(--line);
  opacity: 1; cursor: not-allowed; }
.review-only select:disabled { appearance: none; -webkit-appearance: none; }
.review-only .field select:disabled:not([multiple]):not([size]) { background-image: none; padding-right: 14px !important; }   /* read only: no arrow */
.review-only .field select[data-frac]:disabled:not([multiple]):not([size]) { padding-right: 4px !important; }
.review-only .check { color: var(--ink-mute); }
.review-only .fabchip.ro { cursor: default; background: #f1ece0; border: 1.5px dashed var(--line); }
.review-only .fabchip.ro:hover { border-color: var(--line); }
.review-only .item-price { opacity: .8; }

/* ============ App shell ============ */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: 240px; flex-shrink: 0; background: var(--navy); color: var(--cream);
  display: flex; flex-direction: column; padding: 26px 18px; position: sticky; top: 0; height: 100vh; }
.sidebar .logo-box { padding: 0 8px 26px; border-bottom: 1px solid rgba(255,255,255,.15); margin-bottom: 20px; }
.sidebar .logo-box img { height: 26px; filter: brightness(0) invert(1) sepia(.18); }
.sidebar .who { font-size: 12.5px; color: rgba(255,255,255,.65); margin-top: 10px; line-height: 1.4; }
.sidebar nav { display: flex; flex-direction: column; gap: 4px; }
.sidebar nav a { padding: 11px 14px; border-radius: 10px; font-size: 14.5px; font-weight: 500;
  color: rgba(255,255,255,.78); display: flex; align-items: center; gap: 10px; transition: all .15s; }
.sidebar nav a:hover { background: rgba(255,255,255,.08); color: var(--cream); }
.sidebar nav a.active { background: var(--bronze-deep); color: var(--cream); }
.sidebar .spacer { flex: 1; }
.sidebar .mode-tag { font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--gold); padding: 8px 14px; }
.sidebar .signout { margin: 0 8px; padding: 10px 14px; border-radius: 10px; border: 1px solid rgba(255,255,255,.3);
  background: transparent; color: var(--cream); font-size: 13.5px; }
.sidebar .signout:hover { background: rgba(255,255,255,.1); }

.main { flex: 1; min-width: 0; padding: 40px 48px 80px; max-width: 1180px; }   /* min-width:0 — wide tables scroll inside their card instead of stretching the whole page */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 28px; flex-wrap: wrap; }
.page-head h1 { font-size: 40px; }
.page-head .sub { color: var(--ink-mute); font-size: 15px; margin-top: 4px; }

/* ============ Cards / stats ============ */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 30px; }
.stat { background: var(--white); border: 1px solid var(--line); border-radius: 16px; padding: 18px 20px; }
.stat .num { font-size: 32px; font-family: 'Instrument Serif', serif; }
.stat .lbl { font-size: 12.5px; color: var(--ink-mute); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }

.card { background: var(--white); border: 1px solid var(--line); border-radius: 18px; padding: 26px 28px; margin-bottom: 22px; }
.card h2 { font-size: 24px; margin-bottom: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.card-head h2 { margin: 0; }

/* ============ P&L tabs ============ */
.pnl-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: -10px 0 22px; border-bottom: 2px solid var(--line-strong); padding-bottom: 0; }
.pnl-tab { background: transparent; border: 0; border-bottom: 3px solid transparent; margin-bottom: -2px; padding: 9px 11px; font: inherit; font-size: 13.5px; font-weight: 600;
  color: var(--ink-mute); cursor: pointer; border-radius: 8px 8px 0 0; white-space: nowrap; }
.pnl-tab:hover { color: var(--ink); background: rgba(0,0,0,.03); }
.pnl-tab.active { color: var(--ink); border-bottom-color: var(--bronze-deep); }
.pnl-badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 99px; background: var(--gold, #ffbe6b); color: var(--ink); margin-left: 2px; vertical-align: 1px; }
.pnl-badge.red { background: #f6ddd8; color: var(--red); }

/* ============ Tables ============ */
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tblwrap { overflow-x: visible; }   /* desktop: a table fits its card — long text wraps between words (never mid-word) and the page never scrolls sideways */
@media (max-width: 1100px) { .tblwrap { overflow-x: auto; } }
/* Never split a word to squeeze a column ("Ko / dy / Ro / bis / on") — a word only breaks when it can't fit on its own line.
   Wide tables scroll inside .tblwrap instead of crushing their columns. */
.tbl td { word-break: normal; overflow-wrap: normal; }
.tbl td.right { white-space: nowrap; }   /* money/date cells never split mid-number */
.tbl td.nw, .tbl th.nw { white-space: nowrap; }   /* order numbers, dates, pills — short tokens that must not split */
.tbl td.nm, .tbl th.nm { white-space: normal; min-width: 110px; }   /* names: wrap between words only */
.tbl td.acts { white-space: normal; }
.tbl td.acts .btn { margin: 2px 0; white-space: nowrap; }
.tbl.tight { font-size: 13.5px; }                  /* dense money tables (P&L) */
.tbl.tight td { padding: 8px 6px; }
.tbl.tight th { padding: 7px 6px; font-size: 10.5px; }
@media (max-width: 1366px) { .main { padding: 32px 30px 70px; } .card { padding: 22px 22px; } }   /* laptop screens: give the tables the room */
.tbl a.olink { color: inherit; text-decoration: none; border-bottom: 1.5px solid var(--bronze, #c9a65a); font-weight: 700; }
.tbl a.olink:hover, a.olink:hover { color: var(--bronze-deep, #8a6a2a); }
a.olink { color: inherit; text-decoration: none; border-bottom: 1.5px solid var(--bronze, #c9a65a); font-weight: 700; cursor: pointer; }
.tbl th { text-align: left; font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-mute); font-weight: 600; padding: 10px 12px; border-bottom: 2px solid var(--line-strong); }
.tbl td { padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tbody tr { transition: background .12s; }
.tbl tbody tr:hover { background: var(--cream); }
.tbl .right { text-align: right; }
.tbl .clickable { cursor: pointer; }
.empty { text-align: center; color: var(--ink-mute); padding: 36px 20px; font-size: 15px; }

/* ============ Status pills ============ */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.s-order-placed { background: var(--blue-bg); color: var(--blue); }
.pill.s-in-production { background: var(--amber-bg); color: var(--amber); }
.pill.s-shipped { background: var(--violet-bg); color: var(--violet); }
.pill.s-delivered { background: var(--green-bg); color: var(--green); }
.pill.s-on-hold { background: var(--red-bg); color: var(--red); }
.pill.s-remake { background: var(--red-bg); color: var(--red); }
.pill.s-draft { background: var(--sand); color: var(--bronze-deep); }
.pill.s-sample { background: var(--navy); color: var(--cream); letter-spacing: .04em; text-transform: uppercase; font-size: 11.5px; }   /* a sample order — solid, so it can't be missed or mistaken for a status */

/* ============ Timeline ============ */
.timeline { display: flex; align-items: flex-start; margin: 18px 0 6px; }
.tl-step { flex: 1; text-align: center; position: relative; font-size: 12px; color: var(--ink-mute); }
.tl-step .dot { width: 14px; height: 14px; border-radius: 50%; background: var(--cream-deep);
  border: 2px solid var(--line-strong); margin: 0 auto 8px; position: relative; z-index: 2; }
.tl-step::before { content: ''; position: absolute; top: 6px; left: -50%; width: 100%; height: 2px; background: var(--line); z-index: 1; }
.tl-step:first-child::before { display: none; }
.tl-step.done .dot { background: var(--bronze-deep); border-color: var(--bronze-deep); }
.tl-step.done::before { background: var(--bronze-deep); }
.tl-step.done { color: var(--ink); font-weight: 600; }
.tl-warn { margin-top: 10px; font-size: 13.5px; color: var(--red); background: var(--red-bg);
  border-radius: 10px; padding: 8px 14px; display: inline-block; }

/* ============ Quote builder ============ */
.builder-grid { display: grid; grid-template-columns: 1fr 340px; gap: 22px; align-items: start; }
@media (max-width: 980px) { .builder-grid { grid-template-columns: 1fr; } }
.item-card { background: var(--white); border: 1px solid var(--line); border-radius: 16px; padding: 20px 22px; margin-bottom: 14px; }
.item-card .row { display: flex; flex-wrap: wrap; gap: 12px; }   /* fields are never narrower than their widest option — long labels wrap to the next row instead of clipping */
.item-card .row > .field { flex: 1 1 150px; max-width: 100%; }   /* …but never wider than the row itself: on a narrow card a long dropdown trims with … instead of sticking out of the card */
.item-card .row > .field.fab-field { flex: 1 1 300px; min-width: min(300px, 100%); }   /* the fabric box keeps room for its picture, its name and the Browse button: beside a wide dropdown the row wraps to a new line — it used to be squeezed until the name ran down the page one letter per line */
.item-card .row > .field > select { width: max-content; min-width: 100%; max-width: 100%; }   /* a select is never narrower than its longest option; the field grows and the row wraps instead */
.item-card .row > .field > div > select { width: max-content; min-width: max-content; }        /* selects paired with an input or a "Pics" button (fractions, liner colour, bottom rail) */
.item-card .row > .field > div > input[type=number] { min-width: 72px; }
.builder-grid > :first-child { min-width: 0; }   /* the builder column may shrink; rows wrap inside it instead of pushing the summary off-screen */
@media (max-width: 1100px) { .card { overflow-x: auto; } }   /* wide tables scroll inside their card on tablets — never the whole page */
.fab-preview > div:not(.fab-none) { min-width: 0; flex: 1; }
.fab-preview b, .fab-preview .d { white-space: normal; overflow-wrap: anywhere; }
.item-card .opts { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 12px; }
.item-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.item-head .t { font-weight: 700; font-size: 15px; }
.item-price { font-size: 14px; color: var(--ink-soft); margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line-strong); }
.item-price b { color: var(--ink); }
.item-errors { margin-top: 10px; font-size: 13px; color: var(--red); }
.item-errors div::before { content: '⚠ '; }
.summary { background: var(--navy); color: var(--cream); border-radius: 18px; padding: 24px 26px; position: sticky; top: 24px; }
.summary h3 { font-family: 'Instrument Serif', serif; font-size: 24px; font-weight: 400; margin-bottom: 14px; }
.summary .line { display: flex; justify-content: space-between; font-size: 14px; padding: 6px 0; color: rgba(255,255,255,.85); }
.summary .line.total { border-top: 1px solid rgba(255,255,255,.25); margin-top: 10px; padding-top: 14px;
  font-size: 19px; font-weight: 700; color: var(--cream); }
.summary .note { font-size: 12px; color: rgba(255,255,255,.6); margin-top: 12px; line-height: 1.5; }
.summary .btn { width: 100%; margin-top: 14px; }
.summary .btn-gold { background: var(--gold); color: var(--navy); }
.summary .btn-gold:hover { background: var(--gold-deep); color: var(--cream); }

/* ============ Modal ============ */
.modal-bg { position: fixed; inset: 0; background: rgba(24,56,132,.45); display: none;
  align-items: flex-start; justify-content: center; padding: 60px 20px; z-index: 200; overflow-y: auto; }
.modal-bg.open { display: flex; }
.modal { background: var(--white); border-radius: 20px; padding: 32px 34px; width: 100%; max-width: 640px;
  box-shadow: 0 30px 80px rgba(24,56,132,.3); }
.modal.wide { max-width: 1000px; }   /* wide tables (cost breakdowns) */
.modal h2 { font-size: 26px; margin-bottom: 18px; }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; align-items: center; flex-wrap: wrap; margin-top: 22px; }   /* a long note on the left never stretches the buttons tall */
.modal .actions > span { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
select { max-width: 100%; }
.field select { text-overflow: ellipsis; }
.modal .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
@media (max-width: 560px) { .modal .grid2 { grid-template-columns: 1fr; } }

/* ============ Toast ============ */
.toast { position: fixed; bottom: 28px; right: 28px; background: var(--navy); color: var(--cream);
  padding: 14px 22px; border-radius: 12px; font-size: 14.5px; box-shadow: 0 16px 40px rgba(24,56,132,.35);
  opacity: 0; transform: translateY(12px); transition: all .3s; z-index: 300; pointer-events: none; }
.toast.show { opacity: 1; transform: none; }

/* ============ Detail rows ============ */
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 6px 16px; font-size: 14.5px; }
.kv dt { color: var(--ink-mute); font-weight: 600; }
.itemlist { margin-top: 10px; }
.itemlist .it { padding: 10px 0; border-bottom: 1px dashed var(--line); font-size: 14px; display: flex; justify-content: space-between; gap: 14px; }
.itemlist .it:last-child { border-bottom: none; }
.itemlist .it .d { color: var(--ink-mute); font-size: 13px; }

/* ============ Pricing editor ============ */
.price-grid input { width: 90px; padding: 7px 10px; border: 1.5px solid var(--line-strong); border-radius: 8px; text-align: right; }
.banner { background: var(--sand); border-radius: 12px; padding: 12px 16px; font-size: 13.5px; color: var(--ink-soft); margin-bottom: 18px; }

/* ============ Fabric picker ============ */
.fab-preview { display: flex; gap: 12px; align-items: center; margin-top: 12px; padding: 10px 12px;
  background: var(--cream); border: 1px solid var(--line); border-radius: 12px; font-size: 14px; }
.fab-preview img { width: 84px; height: 60px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line-strong); }
.fab-preview .fab-none { width: 84px; height: 60px; border-radius: 8px; background: repeating-linear-gradient(45deg, var(--cream-deep), var(--cream-deep) 6px, var(--sand) 6px, var(--sand) 12px); border: 1px solid var(--line); }
.fab-preview .d { font-size: 12.5px; color: var(--ink-mute); }
.fab-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px;
  max-height: 56vh; overflow-y: auto; padding: 2px; }
.fab-cell { cursor: pointer; border: 2px solid transparent; border-radius: 12px; overflow: hidden;
  background: var(--cream); transition: all .15s; }
.fab-cell:hover { border-color: var(--bronze-deep); transform: translateY(-2px); box-shadow: 0 8px 20px rgba(24,56,132,.12); }
.fab-cell img { width: 100%; height: 96px; object-fit: cover; display: block; }
.fab-cell .cap { padding: 7px 9px; font-size: 12px; line-height: 1.35; }
.fab-cell .cap b { display: block; font-size: 12.5px; }
.fab-cell .cap span { color: var(--ink-mute); display: inline-block; margin-right: 6px; }
.it-swatch { width: 56px; height: 40px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line-strong); flex-shrink: 0; }
.it-swatch.none { display: inline-block; background: repeating-linear-gradient(45deg, var(--cream-deep), var(--cream-deep) 5px, var(--sand) 5px, var(--sand) 10px); }

.fab-cell.oos img { opacity: .4; filter: grayscale(.7); }
.fab-cell.oos { cursor: not-allowed; }
.fab-oos { position: absolute; font-size: 10px; font-weight: 700; letter-spacing: .06em; background: var(--red-bg); color: var(--red);
  padding: 3px 8px; border-radius: 6px; margin: 6px; max-width: calc(100% - 12px); }
.fab-cell { position: relative; }
.fab-cell.sel { border-color: var(--bronze-deep); }
.fab-fam { grid-column: 1 / -1; font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-mute); padding: 8px 2px 0; }

/* chosen-fabric chip on the order cards — tap anywhere on it to browse */
.fabchip { display: flex; align-items: center; gap: 10px; padding: 5px 8px; border: 1.5px solid var(--line-strong); border-radius: 10px; background: var(--white); cursor: pointer; }
.fabchip:hover { border-color: var(--bronze-deep); }
.fabchip .fc-t { flex: 1; min-width: 0; line-height: 1.3; text-align: left; }
.fabchip .fc-t b { display: block; font-size: 13.5px; white-space: normal; overflow-wrap: anywhere; }   /* fabric name and code wrap rather than trim */
.fabchip .fc-t span { display: block; color: var(--ink-mute); font-size: 12px; white-space: normal; overflow-wrap: anywhere; }

/* ============ Responsive ============ */
/* (superseded by the mobile/tablet layers at the end of this file) */

/* ============================================================
   MOBILE LAYER (≤760px) — phones only; desktop untouched.
   Turns the dealer tables into stacked cards (no side-scroll),
   collapses the sidebar into a top bar, tames the detail pages.
   ============================================================ */
@media (max-width: 760px){
  .shell{flex-direction:column}
  .sidebar{width:100%;height:auto;min-height:0;box-sizing:border-box;display:flex;flex-direction:row;align-items:center;flex-wrap:wrap;column-gap:10px;row-gap:0;padding:10px 14px 0;position:static}
  .sidebar .logo-box{padding:0;border:none;margin:0;display:flex;align-items:center;flex:1;min-width:0}
  .sidebar .logo-box img{height:20px}
  .sidebar .who{display:none}
  .sidebar .spacer{display:none}
  .sidebar .mode-tag{display:none}
  .sidebar .signout{margin:0;padding:6px 12px;font-size:12.5px;border-radius:99px;flex-shrink:0}
  .sidebar nav{flex-direction:row;flex-wrap:nowrap;overflow-x:auto;-webkit-overflow-scrolling:touch;gap:5px;flex:1 1 100%;order:5;margin:9px -14px 0;padding:0 14px 11px;scrollbar-width:none}
  .sidebar nav::-webkit-scrollbar{display:none}
  .sidebar nav a{padding:7px 14px;font-size:13.5px;white-space:nowrap;border-radius:99px;flex-shrink:0;background:rgba(255,255,255,.07)}
  .sidebar nav a.active{background:var(--bronze-deep);color:var(--cream)}
  .main{padding:20px 16px 90px;max-width:100%;box-sizing:border-box}
  .page-head{margin-bottom:18px}
  .page-head h1{font-size:30px}
  .card{padding:18px 16px;border-radius:16px}
  .stat .num{font-size:26px}
  .kv{grid-template-columns:112px 1fr;font-size:14px}
  .tl-step{font-size:10.5px}
  .summary{position:static}
  .modal{padding:22px 18px;max-height:92vh;overflow:auto;border-radius:16px}
  .banner{font-size:13px}
  /* phones: every builder field takes the full width; a select wider than the screen trims with … instead of pushing the page sideways */
  .item-card .row > .field{flex:1 1 100%;min-width:0;max-width:100%}
  .item-card .row > .field.fab-field{flex:1 1 100%;min-width:0}
  .builder-grid{grid-template-columns:minmax(0,1fr)}   /* phones: the builder is as wide as the screen and no wider — a long button label wraps instead of pushing the whole page sideways */
  .summary .btn{white-space:normal;text-align:center}
  .item-card .row > .field > select{width:100%;min-width:0}
  .item-card .row > .field > div > select{min-width:0;max-width:100%}
  .item-card .row > .field > div{min-width:0}
  .toast{left:12px;right:12px;bottom:16px;max-width:none;text-align:center}
  .card > div[style*="grid-template-columns"],.field > div[style*="grid-template-columns"]{grid-template-columns:1fr !important}

  /* dealer tables → cards with inline labels (portal.html sets body.is-dealer) */
  body.is-dealer .tbl thead{display:none}
  body.is-dealer .tbl,body.is-dealer .tbl tbody,body.is-dealer .tbl tr,body.is-dealer .tbl td{display:block;width:100%;box-sizing:border-box}
  body.is-dealer .tbl tr{border:1px solid var(--line);border-radius:14px;padding:10px 14px;margin-bottom:10px;background:var(--white)}
  body.is-dealer .tbl tr:last-child{margin-bottom:0}
  body.is-dealer .tbl tbody tr:hover{background:var(--white)}
  body.is-dealer .tbl td{border:none;padding:5px 0;display:flex;justify-content:space-between;align-items:baseline;gap:14px;text-align:right}
  body.is-dealer .tbl td[data-th]::before{content:attr(data-th);font-size:10.5px;letter-spacing:.09em;text-transform:uppercase;color:var(--ink-mute);font-weight:700;flex-shrink:0;text-align:left}
  body.is-dealer .tbl td:not([data-th]){justify-content:flex-end;gap:8px}
}

/* ============================================================
   TABLET LAYER — iPads. Portrait gets breathing room + card
   tables; landscape (≥1025px) keeps the full desktop layout.
   ============================================================ */
@media (min-width: 761px) and (max-width: 1024px){
  .sidebar{width:200px;padding-top:20px}
  .main{padding:28px 30px 70px}
  .page-head h1{font-size:34px}
  .card{padding:22px 22px}
  .kv{grid-template-columns:140px 1fr}
}
/* iPad portrait (768/834): the 7-column order table can't breathe — card it */
@media (min-width: 761px) and (max-width: 900px){
  body.is-dealer .tbl thead{display:none}
  body.is-dealer .tbl,body.is-dealer .tbl tbody,body.is-dealer .tbl tr,body.is-dealer .tbl td{display:block;width:100%;box-sizing:border-box}
  body.is-dealer .tbl tr{border:1px solid var(--line);border-radius:14px;padding:10px 16px;margin-bottom:10px;background:var(--white)}
  body.is-dealer .tbl tr:last-child{margin-bottom:0}
  body.is-dealer .tbl tbody tr:hover{background:var(--white)}
  body.is-dealer .tbl td{border:none;padding:5px 0;display:flex;justify-content:space-between;align-items:baseline;gap:14px;text-align:right}
  body.is-dealer .tbl td[data-th]::before{content:attr(data-th);font-size:10.5px;letter-spacing:.09em;text-transform:uppercase;color:var(--ink-mute);font-weight:700;flex-shrink:0;text-align:left}
  body.is-dealer .tbl td:not([data-th]){justify-content:flex-end;gap:8px}
}

.pill.s-internal-hold { background: #e5e7e9; color: #5c6570; }

/* ===== white-label skin: blue + orange ===== */
:root { --cream:#f6f7f8; --cream-deep:#eceff3; --sand:#e6eefb;
  --navy:#183884; --navy-soft:#154a93; --navy-hover:#124b9a;
  --ink:#212529; --ink-soft:#454f5b; --ink-mute:#5f6871;
  --gold:#ffbe6b; --gold-deep:#e27c11; --bronze:#f09a3e; --bronze-deep:#ad5906;
  --line:rgba(33,37,41,.12); --line-strong:rgba(33,37,41,.24);
  --white:#ffffff;
  --blue:#154a93; --blue-bg:#eaf3ff; }
.display, .stat .num, .summary h3 { font-family: 'Poppins','Inter',-apple-system,BlinkMacSystemFont,sans-serif; font-weight: 600; letter-spacing: -0.01em; line-height: 1.2; }
.script { font-family: inherit; font-style: normal; font-weight: inherit; color: #d2690a; }
.btn { border-radius: 6px; font-family: 'Poppins','Inter',-apple-system,BlinkMacSystemFont,sans-serif; font-weight: 500; }
.btn-bronze { background: var(--bronze-deep); color: #fff; }
.sidebar nav a { border-radius: 6px; font-family: 'Poppins','Inter',-apple-system,BlinkMacSystemFont,sans-serif; }
.sidebar nav a.active { background: rgba(255,255,255,.14); color: #fff; box-shadow: inset 4px 0 0 var(--gold-deep); }
.sidebar .logo-box img { filter: none; height: 28px; }
.sidebar .signout { border-radius: 6px; }
.login-card { border-radius: 12px; }
.login-card .logo { background: var(--navy); border-radius: 8px; }
.login-card h1 { font-size: 24px; }
.page-head h1 { font-size: 30px; }
.card { border-radius: 10px; } .card h2 { font-size: 19px; }
.stat { border-radius: 10px; } .stat .num { font-size: 26px; }
.modal { border-radius: 12px; } .modal h2 { font-size: 21px; }
.banner { border-radius: 8px; }
.field input, .field select, .field textarea { border-radius: 6px; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--navy); }
@media (max-width: 760px) { .page-head h1 { font-size: 24px; } .stat .num { font-size: 22px; } .card { border-radius: 10px; } .modal { border-radius: 12px; } .sidebar .logo-box img { height: 22px; } .sidebar nav a.active { background: #fff; color: var(--navy); box-shadow: none; } }
@media (min-width: 761px) and (max-width: 1024px) { .page-head h1 { font-size: 27px; } }

/* their logo */
.sidebar .logo-box img { filter: none; height: 48px; max-width: 100%; object-fit: contain; object-position: left center; background: #fff; border-radius: 8px; padding: 8px 12px; box-sizing: border-box; }
.login-card .logo { height: 46px; object-fit: contain; background: transparent; padding: 0; border-radius: 0; }
@media (max-width: 760px) { .sidebar .logo-box img { height: 34px; padding: 5px 9px; } }
