@font-face { font-family: "Plus Jakarta Sans"; src: url("../fonts/PlusJakartaSans.woff2") format("woff2"); font-weight: 200 800; font-style: normal; font-display: swap; }

:root {
  --ink: #0f172a; --text: #334155; --muted: #64748b; --line: #e2e8f0; --bg: #f4f6f9; --card: #fff;
  --brand: #0b6e99; --brand-dark: #085577; --brand-soft: #e6f3f8; --accent: #f59e0b; --accent-dark: #b45309;
  --good: #15803d; --bad: #b91c1c; --side: #0c1a2b; --radius: 12px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: "Plus Jakarta Sans", "Segoe UI", system-ui, Arial, sans-serif; font-size: 14.5px; line-height: 1.55; color: var(--text); background: var(--bg); }
h1, h2, h3 { color: var(--ink); margin: 0; letter-spacing: -.01em; text-wrap: balance; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.warn { color: var(--accent-dark) !important; }
.good { color: var(--good); }
.ic { width: 18px; height: 18px; flex: none; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 10px 16px; border-radius: 9px; border: 1px solid transparent; font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; text-decoration: none !important; white-space: nowrap; transition: background .15s, border-color .15s, box-shadow .15s; }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .icon-btn:focus-visible, .swatch:focus-visible { outline: 3px solid rgba(11,110,153,.3); outline-offset: 1px; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-accent { background: #fff7e6; color: var(--accent-dark); border-color: #fcd98a; }
.btn-accent:hover { background: #ffedc2; }
.btn-ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: #f8fafc; border-color: #cbd5e1; }
.btn-light { background: #fff; color: var(--ink); }
.btn-sm { padding: 7px 11px; font-size: 13px; border-radius: 8px; }
.btn-sm .ic { width: 15px; height: 15px; }
.btn-block { width: 100%; padding: 12px; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 8px; border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: #eef2f6; color: var(--ink); }
.icon-btn.danger:hover { background: #fee2e2; color: var(--bad); }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--brand); cursor: pointer; font-weight: 600; }

/* forms */
label { display: block; font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 5px; }
input, select, textarea { width: 100%; font: inherit; color: var(--ink); background: #fff; border: 1px solid #d5dbe3; border-radius: 9px; padding: 9px 11px; min-width: 0; }
textarea { resize: vertical; line-height: 1.5; }
input[type=checkbox] { width: 16px; height: 16px; padding: 0; accent-color: var(--brand); flex: none; }
input[type=file] { padding: 7px; font-size: 13px; background: #f8fafc; }
input[type=color] { width: 38px; height: 34px; padding: 2px; cursor: pointer; }
.field { margin-bottom: 14px; min-width: 0; }
.hint { display: block; font-size: 12px; color: var(--muted); margin-top: 4px; font-weight: 400; }
.label-link { float: right; font-weight: 500; }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; margin: 6px 14px 0 0; cursor: pointer; }
.checks-row { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.fg { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 16px; }
.fg-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); flex: 1; }
.c2 { grid-column: span 2; } .c3 { grid-column: span 3; } .c4 { grid-column: 1 / -1; }
.field-btn { display: flex; align-items: flex-end; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin: 4px 0 22px; }
.form-actions.sticky { position: sticky; bottom: 0; background: rgba(244,246,249,.94); backdrop-filter: blur(6px); padding: 12px 0; margin: 0; z-index: 5; }

/* alerts & badges */
.alert { padding: 11px 14px; border-radius: 10px; margin-bottom: 14px; font-size: 14px; border: 1px solid; }
.alert ul { margin: 0; padding-left: 18px; }
.a-success { background: #ecfdf3; border-color: #a7e3bd; color: #14632f; }
.a-error { background: #fef2f2; border-color: #f5b5b5; color: #991b1b; }
.a-info { background: #eff8ff; border-color: #b3dcf5; color: #0b4f73; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 700; background: #eef2f6; color: #475569; white-space: nowrap; }
.b-sent, .b-contacted { background: #e0f0ff; color: #0b5cab; }
.b-accepted, .b-converted, .b-active { background: #dcfce7; color: #14632f; }
.b-rejected, .b-blocked { background: #fee2e2; color: #991b1b; }
.b-new { background: #fff3d6; color: #92500a; }

/* app shell */
.shell { display: flex; min-height: 100vh; }
.side { width: 248px; flex: none; background: var(--side); color: #cbd5e1; display: flex; flex-direction: column; padding: 18px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; color: #fff; text-decoration: none !important; letter-spacing: -.02em; padding: 4px 6px 18px; }
.brand-dark { color: var(--ink); padding: 0; }
.brand-logo { width: 34px; height: 34px; object-fit: contain; flex: none; }
.side .brand-logo { background: #fff; border-radius: 9px; padding: 3px; }
.brand-mark { width: 34px; height: 34px; flex: none; border-radius: 10px; background: linear-gradient(135deg, #fbbf24, #f97316); color: #fff; display: inline-flex; align-items: center; justify-content: center; }
.brand-mark .ic { width: 20px; height: 20px; }
.brand-name { min-width: 0; overflow-wrap: anywhere; line-height: 1.2; }
.side-user-bottom { margin-top: auto; }
.team-edit > summary h3 { margin: 0; }
.actions form { display: inline-block; margin: 0 2px; vertical-align: middle; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav a { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 9px; color: #cbd5e1; font-weight: 500; text-decoration: none; }
.side-nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.side-nav a.active { background: rgba(255,255,255,.11); color: #fff; font-weight: 600; }
.side-label { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: #64748b; padding: 16px 12px 6px; font-weight: 700; }
.side-user { display: flex; align-items: center; gap: 10px; margin-top: 14px; padding-top: 14px; border-top: 1px solid rgba(255,255,255,.1); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: #1e3a5f; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; flex: none; }
.side-user-info { min-width: 0; flex: 1; }
.side-user-info b { display: block; color: #fff; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user-info small { display: block; font-size: 11.5px; color: #94a3b8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user .icon-btn { color: #94a3b8; }
.side-user .icon-btn:hover { background: rgba(255,255,255,.1); color: #fff; }
.side-user form { margin: 0; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 10px; padding: 14px 26px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.topbar h1 { font-size: 19px; margin-right: auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-btn { display: none; }
.content { padding: 22px 26px 40px; max-width: 1240px; width: 100%; }

/* cards, grids, tables */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 18px; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.card-h.wrap { flex-wrap: wrap; }
.card-h h3 { font-size: 15.5px; }
.card-h .muted { font-size: 13px; }
.pad { padding: 18px 18px 6px; }
.pad-x { padding: 12px 18px 0; margin: 0; }
p.pad { padding: 16px 18px; margin: 0; }
.grid { display: grid; gap: 16px; margin-bottom: 18px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
.stack > * { margin-bottom: 16px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; min-width: 0; }
.stat span { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 600; }
.stat b { display: block; font-size: 25px; color: var(--ink); font-weight: 800; letter-spacing: -.02em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat small { color: var(--muted); font-size: 12.5px; }
.hello { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.hello h2 { font-size: 22px; }
.hello p { margin: 2px 0 0; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 700; padding: 10px 14px; background: #f8fafc; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid #eef2f6; vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sub { display: block; font-size: 12.5px; color: var(--muted); font-weight: 400; }
.actions { white-space: nowrap; text-align: right; }
.actions form, .toolbar form { display: inline; margin: 0; }
.toolbar, .filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0; }
.filters input[type=search] { width: 240px; }
.filters select, .toolbar select { width: auto; max-width: 300px; }
.filters .check { margin: 0 4px; }
.stock-form { display: flex; gap: 5px; margin: 0; min-width: 190px; }
.stock-form select { width: 72px; padding: 6px; font-size: 13px; }
.stock-form input { width: 64px; padding: 6px 8px; font-size: 13px; }
.empty { text-align: center; padding: 42px 20px; color: var(--muted); }
.empty .ic { width: 38px; height: 38px; color: #cbd5e1; }
.empty p { max-width: 420px; margin: 10px auto 14px; }
.mini-list { list-style: none; margin: 0; padding: 4px 18px 8px; }
.mini-list li { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid #eef2f6; font-size: 13.5px; }
.mini-list li:last-child { border: 0; }
.mini-list b { white-space: nowrap; }
.setup-banner { display: block; border-radius: var(--radius); padding: 20px; color: #fff; text-decoration: none !important; background: linear-gradient(135deg, #0c1a2b, var(--brand)); }
.setup-banner h3 { color: #fff; font-size: 18px; margin: 0 0 4px; }
.setup-banner p { font-size: 13.5px; opacity: .9; margin-bottom: 12px; }

/* company + quotation form bits */
.logo-box { display: flex; gap: 16px; align-items: center; margin-bottom: 16px; }
.logo-prev, .img-thumb { flex: none; border: 1px dashed #cbd5e1; border-radius: 10px; background: #f8fafc; display: flex; align-items: center; justify-content: center; overflow: hidden; color: var(--muted); font-size: 12px; }
.logo-prev { width: 150px; height: 84px; padding: 8px; }
.logo-prev img { max-width: 100%; max-height: 100%; object-fit: contain; }
.img-slot { display: flex; gap: 14px; margin-bottom: 14px; }
.img-thumb { width: 132px; height: 92px; }
.img-thumb img { width: 100%; height: 100%; object-fit: cover; }
.img-ctl { flex: 1; min-width: 0; }
.img-ctl select { margin-bottom: 6px; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px #cbd5e1; cursor: pointer; padding: 0; background: #ccc; }
.swatch.sm { width: 20px; height: 20px; }
.swatch.on { box-shadow: 0 0 0 2px var(--ink); }
.swatch-custom { display: inline-flex; align-items: center; gap: 6px; margin: 0 0 0 6px; font-weight: 500; color: var(--muted); }
.items-table input, .items-table select { padding: 7px 8px; font-size: 13.5px; }
.items-table td { padding: 8px 6px; vertical-align: top; }
.items-table th { padding: 9px 6px; }
.items-table td:first-child, .items-table th:first-child { padding-left: 16px; }
.items-table .col-item { min-width: 260px; }
.items-table .desc { margin-top: 5px; font-size: 12.5px; color: var(--muted); }
.items-table input.num { width: 92px; text-align: right; }
.items-table td:nth-child(2) input { width: 78px; }
.items-table td:nth-child(4) select { width: 76px; }
.items-table td:nth-child(6) input { width: 62px; }
.items-table .amt { padding-top: 15px; font-weight: 700; color: var(--ink); min-width: 100px; }
.totals-row { display: flex; gap: 28px; align-items: flex-start; border-top: 1px solid var(--line); flex-wrap: wrap; }
.live-totals { margin: 0 0 14px; width: 320px; max-width: 100%; margin-left: auto; }
.live-totals div { display: flex; justify-content: space-between; padding: 5px 0; font-size: 14px; }
.live-totals dd { margin: 0; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.live-totals .grand { border-top: 2px solid var(--ink); margin-top: 5px; padding-top: 9px; font-size: 17px; }
.live-totals .grand dt, .live-totals .grand dd { font-weight: 800; color: var(--ink); }
.section-box { border: 1px solid var(--line); border-radius: 10px; padding: 14px; margin-bottom: 12px; background: #fbfcfd; }

/* modal */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(12,26,43,.6); display: none; align-items: flex-start; justify-content: center; padding: 30px 14px; overflow-y: auto; }
.modal.open { display: flex; }
.modal-box { background: #fff; border-radius: 16px; width: 100%; max-width: 560px; padding: 24px; position: relative; }
.modal-box h2 { font-size: 20px; margin-bottom: 4px; }
.modal-close { position: absolute; top: 14px; right: 14px; font-size: 20px; }

/* auth */
.auth-body { background: radial-gradient(1000px 500px at 50% -10%, #dcedf5, transparent), var(--bg); min-height: 100vh; }
.auth-wrap { max-width: 440px; margin: 0 auto; padding: 46px 16px; display: flex; flex-direction: column; align-items: center; }
.auth-wrap > .alert { width: 100%; }
.auth-wrap .brand { margin-bottom: 22px; font-size: 21px; }
.auth-card { width: 100%; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 28px; box-shadow: 0 12px 40px rgba(15,23,42,.07); }
.auth-card-wide { max-width: 700px; width: 700px; max-width: calc(100vw - 32px); }
.auth-card h1 { font-size: 23px; margin-bottom: 4px; }
.auth-card > .muted { margin-bottom: 18px; }
.auth-alt { text-align: center; margin: 16px 0 0; font-size: 14px; color: var(--muted); }
.auth-foot { font-size: 12.5px; color: var(--muted); margin-top: 18px; }
.or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12.5px; margin: 16px 0; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.otp-input { font-size: 26px; letter-spacing: 12px; text-align: center; font-weight: 700; padding: 12px; }
.err-code { font-size: 56px; font-weight: 800; color: var(--brand); line-height: 1; margin-bottom: 8px; }
.auth-body > .auth-card { max-width: 440px; margin: 80px auto; }
.checks { list-style: none; padding: 0; margin: 0 0 16px; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 14px; font-size: 13px; }
.checks .ok { color: var(--good); } .checks .bad { color: var(--bad); font-weight: 600; }

/* public pages */
.public-body { background: #fff; }


.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 44px; }
.pw-eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; border: 0; background: none; color: var(--muted); cursor: pointer; display: flex; align-items: center; justify-content: center; border-radius: 8px; }
.pw-eye:hover { color: var(--ink); background: #f1f5f9; }
.smtp-help { padding-top: 0; }
.smtp-help code { background: #eef2f6; padding: 1px 5px; border-radius: 4px; font-size: 12px; }
.btn-xs { padding: 5px 8px; font-size: 12.5px; border-radius: 7px; gap: 5px; }
.btn-xs .ic { width: 14px; height: 14px; }
.share { display: inline-block; }
.share-menu { position: fixed; z-index: 60; min-width: 170px; background: #fff; border: 1px solid var(--line); border-radius: 11px; box-shadow: 0 14px 36px rgba(15,23,42,.18); padding: 6px; display: flex; flex-direction: column; }
.share-menu[hidden] { display: none; }
.share-menu a, .share-menu button { display: flex; align-items: center; gap: 9px; padding: 9px 11px; border: 0; background: none; border-radius: 8px; font: inherit; font-size: 14px; font-weight: 500; color: var(--ink); text-decoration: none; cursor: pointer; text-align: left; white-space: nowrap; }
.share-menu a:hover, .share-menu button:hover { background: #f1f5f9; text-decoration: none; }
.share-menu button[hidden] { display: none; }
.cards-sm .actions, .table .actions { white-space: normal; }
.table .actions > * { margin: 2px 1px; vertical-align: middle; }
/* template picker, toggles, helpers */
.tpl-pick { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.tpl-card { margin: 0; cursor: pointer; border: 2px solid var(--line); border-radius: 12px; padding: 8px 8px 10px; background: #fff; display: block; position: relative; transition: border-color .15s, box-shadow .15s; }
.tpl-card input { position: absolute; opacity: 0; pointer-events: none; }
.tpl-card:hover { border-color: #cbd5e1; }
.tpl-card:has(input:checked) { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(11,110,153,.15); }
.tpl-card:has(input:focus-visible) { outline: 3px solid rgba(11,110,153,.3); }
.tpl-thumb { display: block; border-radius: 7px; overflow: hidden; background: #eef2f6; aspect-ratio: 210 / 297; margin-bottom: 8px; border: 1px solid #eef2f6; }
.tpl-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tpl-card b { display: block; font-size: 13.5px; color: var(--ink); }
.tpl-card small { display: block; font-size: 11.5px; color: var(--muted); font-weight: 400; line-height: 1.35; }
.toggle-btn { display: inline-flex; margin: 0; cursor: pointer; }
.toggle-btn input { position: absolute; opacity: 0; pointer-events: none; }
.toggle-btn span { display: none; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 9px; font-size: 13.5px; font-weight: 600; border: 1px solid transparent; }
.toggle-btn .off { background: var(--brand); color: #fff; }
.toggle-btn .on { background: #dcfce7; color: #14632f; border-color: #a7e3bd; }
.toggle-btn input:not(:checked) ~ .off, .toggle-btn input:checked ~ .on { display: inline-flex; }
.toggle-btn input:focus-visible ~ span { outline: 3px solid rgba(11,110,153,.3); }
.bank-note { align-self: center; margin: 0 0 14px; }
.form-tip { display: flex; gap: 10px; align-items: flex-start; background: #fff7e6; border: 1px solid #fcd98a; color: #7a4b06; border-radius: 10px; padding: 11px 14px; margin-bottom: 16px; font-size: 14px; }
.form-tip .ic { margin-top: 2px; color: var(--accent-dark); }
details.fold > summary { cursor: pointer; list-style: none; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::after { content: "+"; font-size: 20px; font-weight: 600; color: var(--muted); margin-left: 10px; }
details.fold[open] > summary::after { content: "–"; }
details.fold:not([open]) > summary { border-bottom: 0; }
details.fold > summary .muted { margin-left: auto; }
.pair { display: flex; gap: 6px; }
button.hint { text-align: left; font-size: 12px; margin-top: 5px; }
.actions .btn-sm { vertical-align: middle; margin-right: 4px; }

@media (max-width: 1000px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-main { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .side { position: fixed; left: 0; top: 0; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; box-shadow: 0 0 0 100vmax rgba(12,26,43,.5); }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 10px 16px; }
  .content { padding: 16px 16px 30px; }
  .fg { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .c3 { grid-column: 1 / -1; }
}
@media (max-width: 540px) {
  .fg, .fg-2, .g2, .g3, .g4, .checks { grid-template-columns: 1fr; }
  .c2 { grid-column: 1 / -1; }
  .filters input[type=search] { width: 100%; }
  .logo-box, .img-slot { flex-direction: column; align-items: stretch; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- phones & small tablets ---------- */
@media (max-width: 1000px) {
  .tpl-pick { grid-template-columns: repeat(5, minmax(120px, 1fr)); overflow-x: auto; padding-bottom: 4px; }
}
@media (max-width: 720px) {
  /* quotation items become easy-to-tap cards */
  .items-table, .items-table tbody { display: block; }
  .items-table thead { display: none; }
  .items-table tr.item-row { display: grid; grid-template-columns: 1fr 1fr 1.3fr 1fr 34px; gap: 6px 6px; padding: 12px 14px; border-bottom: 1px solid var(--line); align-items: end; }
  .items-table tr.item-row td { display: block; padding: 0 !important; border: 0; min-width: 0; }
  .items-table tr.item-row td[data-l]::before { content: attr(data-l); display: block; font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }
  .items-table tr.item-row input, .items-table tr.item-row select { width: 100% !important; }
  .items-table .col-item { grid-column: 1 / -1; min-width: 0; }
  .items-table tr.item-row td:nth-child(3) { grid-area: 2 / 1; }
  .items-table tr.item-row td:nth-child(4) { grid-area: 2 / 2; }
  .items-table tr.item-row td:nth-child(5) { grid-area: 2 / 3; }
  .items-table tr.item-row td:nth-child(6) { grid-area: 2 / 4; }
  .items-table tr.item-row td:nth-child(8) { grid-area: 2 / 5; }
  .items-table tr.item-row td:nth-child(2) { grid-area: 3 / 1 / auto / span 2; }
  .items-table tr.item-row td.amt { grid-area: 3 / 3 / auto / span 3; text-align: right; padding-top: 0 !important; font-size: 15px; align-self: center; }
  .totals-row { gap: 6px; }
  .live-totals { width: 100%; }
}
@media (max-width: 900px) {
  /* list tables become cards */
  .cards-sm thead { display: none; }
  .cards-sm, .cards-sm tbody { display: block; }
  .cards-sm tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 12px; padding: 13px 14px; border-bottom: 1px solid var(--line); }
  .cards-sm td { display: block; padding: 0; border: 0; text-align: left !important; min-width: 0; }
  .cards-sm td[data-l]::before { content: attr(data-l); display: block; font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
  .cards-sm td.wide { grid-column: 1 / -1; }
  .cards-sm td.actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding-top: 4px; }
}
@media (max-width: 540px) {
  body { font-size: 13.5px; }
  .topbar h1 { font-size: 16px; }
  .topbar .btn-primary { padding: 7px 9px; }
  .card-h { padding: 12px 14px; }
  .card-h h3 { font-size: 14.5px; }
  .card-h .muted { display: none; }
  .pad { padding: 14px 14px 2px; }
  .stat { padding: 12px 14px; }
  .stat b { font-size: 20px; }
  .stat span { font-size: 11px; }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 10px; }
  .hello h2 { font-size: 18px; }
  .btn { font-size: 13.5px; padding: 9px 14px; }
  .table { font-size: 13px; }
  .table th, .table td { padding: 9px 10px; }
  label { font-size: 12.5px; }
  .field { margin-bottom: 11px; }
  .form-actions.sticky { padding: 10px 0; }
  .form-actions.sticky .btn { flex: 1; }
  .auth-wrap { padding: 28px 14px; }
  .auth-card { padding: 22px 18px; }
  .auth-card h1 { font-size: 20px; }
  .modal { padding: 12px 8px; }
  .modal-box { padding: 18px 16px; }
  .tpl-card small { display: none; }
  .tpl-pick { grid-template-columns: 1fr 1fr; overflow: visible; }
  .cards-sm tr { grid-template-columns: 1fr 1fr; }
  .toggle-btn span { font-size: 13px; padding: 8px 11px; }
  .filters, .filters select { width: 100%; max-width: none; }
  .stock-form { min-width: 170px; }
}
/* iOS zooms the page when a focused field is smaller than 16px — keep fields at 16px there only */
@supports (-webkit-touch-callout: none) {
  input, select, textarea { font-size: 16px !important; }
}
