:root {
  /* Noble Fueling Solutions brand (from noble-fs.com) */
  --navy: #1f2523;        /* brand charcoal-green: headings, header */
  --navy-2: #2d3633;
  --deep: #172924;        /* deep green */
  --accent: #d5af34;      /* Noble gold */
  --accent-dark: #b8952a;
  --accent-soft: #faf3dc;
  --ink: #1f2523;
  --muted: #5f6663;
  --line: #e4e4e1;
  --soft: #f8f8f8;
  --card: #ffffff;
  --ok: #1f7a4d;
  --ok-soft: #e4f4ec;
  --warn: #9a5b00;
  --warn-soft: #fff3dc;
  --bad: #b42318;
  --bad-soft: #fde8e6;
  --info: #8a6a12;
  --info-soft: #e6effa;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(31, 37, 35, .05), 0 4px 14px rgba(31, 37, 35, .04);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 15px/1.55 "Rethink Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--ink); background: var(--soft);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--info); text-decoration: none; font-weight: 500; }
a:hover { text-decoration: underline; }
h1, h2, .brand, .stat .n { font-family: "Poppins", "Rethink Sans", sans-serif; }
h1 { font-size: 28px; line-height: 1.2; margin: 0; font-weight: 600; letter-spacing: -.02em; color: var(--ink); }
h2 { font-size: 17px; margin: 0 0 12px; font-weight: 500; letter-spacing: -.01em; }
h3 { font-size: 15px; margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 13.5px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.hidden { display: none !important; }

/* ---------- top bar ---------- */
.impersonating {
  background: #fbe9a8; color: #3b2d00; border-bottom: 1px solid var(--accent); font-weight: 600; font-size: 14px;
  padding: 8px 16px; display: flex; gap: 12px; align-items: center; justify-content: center; flex-wrap: wrap;
}
.impersonating form { margin: 0; }
.impersonating button { background: var(--navy); color: #fff; border: 0; border-radius: 6px; padding: 5px 12px; font-weight: 600; cursor: pointer; }
.topbar { background: var(--navy); color: #fff; border-top: 4px solid var(--accent); }
.topbar .wrap { display: flex; align-items: center; gap: 24px; height: 76px; }
.brand { color: #fff; font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand .logo { height: 56px; width: auto; display: block; }
.brand .divider { width: 1px; height: 30px; background: rgba(255,255,255,.22); }
.brand .mark { width: 30px; height: 30px; border-radius: 7px; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 15px; }
.brand small { display: block; font-family: "Rethink Sans", sans-serif; font-weight: 500; color: var(--accent); font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; }
.nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.nav a { color: #fff; font-weight: 600 !important; padding: 8px 12px; border-radius: 6px; font-weight: 500; font-size: 14.5px; white-space: nowrap; }
.nav a:hover { background: var(--navy-2); color: #fff; text-decoration: none; }
.nav a.on { color: var(--accent); background: transparent; box-shadow: inset 0 -2px 0 var(--accent); border-radius: 0; }
.userbox { display: flex; align-items: center; gap: 12px; white-space: nowrap; }
.userbox .who { text-align: right; font-size: 13px; line-height: 1.25; }
.userbox .who b { display: block; color: #fff; font-weight: 600; }
.userbox .who span { color: #b9bfbc; }
.userbox a, .userbox button { color: #fff; background: transparent; border: 1px solid #4a5451; border-radius: 6px; padding: 6px 10px; font-size: 13px; cursor: pointer; font-family: inherit; }
.userbox a:hover, .userbox button:hover { background: var(--navy-2); color: #fff; text-decoration: none; }
.userbox form { margin: 0; }
.cart-link { position: relative; }
.badge { display: inline-grid; place-items: center; min-width: 28px; padding: 0 8px; height: 28px; border-radius: 14px; background: var(--accent); color: #1f2523; font-family: "Poppins", sans-serif; font-size: 15px; font-weight: 700; line-height: 1; margin-left: 8px; vertical-align: middle; box-shadow: 0 0 0 2px rgba(255,255,255,.08); }

.wrap { max-width: 1240px; margin: 0 auto; padding: 0 20px; }
main.wrap { padding-top: 28px; padding-bottom: 48px; min-height: calc(100vh - 76px - 88px); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- cards / layout ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-body { padding: 18px 20px; }
.card + .card { margin-top: 16px; }
/* Side-by-side layouts space with gap, not margin, so their tops line up */
.layout-side > .card + .card, .grid > .card + .card, .layout-side > * + *, .grid > * + * { margin-top: 0; }
.card-head { padding: 14px 20px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.card-head h2 { margin: 0; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.layout-side { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
.sticky { position: sticky; top: 16px; }

/* ---------- forms ---------- */
label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 5px; color: #344154; }
.field { margin-bottom: 14px; }
.field .hint { font-weight: 400; color: var(--muted); font-size: 12.5px; margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=tel], input[type=search], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: #fff; border: 1px solid #c9d2dc; border-radius: 6px; padding: 8px 10px; min-height: 38px;
}
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(213, 175, 52, .35); border-color: var(--accent); }
.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 500; font-size: 14px; }
.check input { margin-top: 3px; }
.row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.row-addr { display: grid; gap: 12px; grid-template-columns: 2fr 70px 110px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 600; font-size: 14px; border-radius: 6px; padding: 8px 14px; min-height: 38px;
  border: 1px solid #c9d2dc; background: #fff; color: var(--ink); cursor: pointer; white-space: nowrap; }
.btn:hover { background: #f6f8fa; text-decoration: none; }
.btn-primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-2); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-danger { color: var(--bad); border-color: #efc2bd; }
.btn-danger:hover { background: var(--bad-soft); }
.btn-sm { padding: 4px 10px; min-height: 30px; font-size: 13px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.inline { display: inline; margin: 0; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; }
.t th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); background: #fafaf8; white-space: nowrap; }
.t td { padding: 10px 12px; border-bottom: 1px solid #eef1f4; vertical-align: top; }
.t tr:last-child td { border-bottom: 0; }
.t tbody tr:hover td { background: #fbfcfd; }
.t tr.inactive td { color: var(--muted); }
.t .pn { font-weight: 700; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 13.5px; white-space: nowrap; }
.t .qty { width: 86px; }
.t .qty input { width: 76px; text-align: right; }
.t a.rowlink { color: var(--ink); font-weight: 600; }

.add-form { display: flex; gap: 6px; justify-content: flex-end; align-items: center; }
.add-form input { width: 70px; text-align: right; min-height: 34px; padding: 5px 8px; }
.add-form .btn { min-height: 34px; }
.in-cart { color: var(--ok); font-size: 12.5px; font-weight: 600; white-space: nowrap; }

/* ---------- pills ---------- */
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; background: #eef1f4; color: #3a4757; }
.st-submitted { background: var(--info-soft); color: var(--info); }
.st-acknowledged, .st-processing { background: #ede9fb; color: #5139a8; }
.st-backordered { background: var(--warn-soft); color: var(--warn); }
.st-partially_shipped { background: #e3f4f6; color: #116a75; }
.st-shipped, .st-delivered, .ln-shipped, .ln-in_stock { background: var(--ok-soft); color: var(--ok); }
.st-cancelled, .ln-cancelled, .ln-unavailable { background: var(--bad-soft); color: var(--bad); }
.ln-backordered { background: var(--warn-soft); color: var(--warn); }
.ln-substituted { background: #ede9fb; color: #5139a8; }
.role-superadmin { background: var(--accent); color: #fff; }
.role-admin { background: var(--navy); color: #fff; }
.role-vendor { background: #e3f4f6; color: #116a75; }

/* ---------- filters / tabs ---------- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.toolbar input[type=search] { flex: 1; min-width: 220px; }
.toolbar select { width: auto; min-width: 150px; }
.search-hero { display: flex; gap: 10px; }
.search-hero input { font-size: 16px; min-height: 46px; padding: 10px 14px; }
.search-hero .btn { min-height: 46px; padding: 0 20px; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tabs a { padding: 6px 12px; border-radius: 6px; color: var(--muted); font-weight: 600; font-size: 14px; }
.tabs a.on { background: var(--navy); color: #fff; }
.tabs a:hover { text-decoration: none; background: #e8ecf1; }
.tabs a.on:hover { background: var(--navy); }
.tabs .n { opacity: .7; font-weight: 500; margin-left: 3px; }

.pager { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-top: 1px solid var(--line); font-size: 14px; color: var(--muted); }
.pager .btns { display: flex; gap: 6px; }

/* ---------- flash ---------- */
.flash { border-radius: var(--radius); padding: 12px 16px; margin-bottom: 18px; font-weight: 500; border: 1px solid; }
.flash-success { background: var(--ok-soft); border-color: #b9e0ca; color: #145c39; }
.flash-error { background: var(--bad-soft); border-color: #f3c3bd; color: #8a1a12; }
.flash-info { background: var(--info-soft); border-color: #c3d8f1; color: #174c86; }
.flash-link { background: var(--warn-soft); border-color: #f0d79f; color: #5b3a00; }
.copyrow { display: flex; gap: 8px; margin-top: 8px; }
.copyrow input { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }

/* ---------- definition lists ---------- */
dl.kv { display: grid; grid-template-columns: 130px 1fr; gap: 6px 14px; margin: 0; font-size: 14px; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; white-space: pre-line; overflow-wrap: anywhere; }

/* ---------- timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 16px 22px; }
.timeline li::before { content: ""; position: absolute; left: 5px; top: 6px; width: 9px; height: 9px; border-radius: 50%; background: #b6c2cf; }
.timeline li::after { content: ""; position: absolute; left: 9px; top: 18px; bottom: 0; width: 1px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline li.ev-comment::before { background: var(--navy); }
.timeline li.ev-status::before { background: var(--accent); }
.timeline li.ev-created::before { background: var(--ok); }
.timeline .meta { font-size: 12.5px; color: var(--muted); }
.timeline .msg { white-space: pre-line; font-size: 14px; }
.timeline .ev-comment .msg { background: var(--soft); border-left: 3px solid var(--accent); border-radius: 6px; padding: 8px 10px; margin-top: 4px; }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat .n { font-size: 22px; font-weight: 700; }
.stat .l { font-size: 12.5px; color: var(--muted); }

/* ---------- auth pages ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: linear-gradient(165deg, rgba(31,37,35,.92), rgba(23,41,36,.97)), var(--deep); border-top: 4px solid var(--accent); }
.auth-logo { display: flex; justify-content: center; margin-bottom: 18px; }
.auth-logo img { height: 130px; }
.auth-sub { text-align: center; color: #b8952a; font-weight: 600; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; white-space: nowrap; margin: -6px 0 24px; }
.auth .card { width: 100%; max-width: 400px; }
.auth .card-body { padding: 28px; }
.auth .brand { color: var(--navy); margin-bottom: 20px; }
.auth .brand small { color: var(--muted); }
.auth h1 { font-size: 22px; margin-bottom: 4px; }
.site-foot { background: var(--accent); color: #fff; margin-top: 24px; }
.site-foot .wrap { display: flex; justify-content: space-between; align-items: center; gap: 16px; min-height: 64px; font-size: 13.5px; font-weight: 500; flex-wrap: wrap; padding-top: 12px; padding-bottom: 12px; }
.site-foot img { height: 52px; opacity: .95; }
.site-foot a { color: #fff; font-weight: 600; }
.st-submitted { background: #eef2f6; color: #2f4a63; }
.auth p.lead { margin: 0 0 20px; color: var(--muted); font-size: 14px; text-wrap: balance; }
.auth .foot { margin-top: 16px; font-size: 13.5px; text-align: center; }

.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty h3 { color: var(--ink); font-size: 16px; }
.notice { background: var(--warn-soft); border: 1px solid #f0d79f; color: #5b3a00; border-radius: var(--radius); padding: 10px 14px; font-size: 14px; margin-bottom: 16px; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--navy); border-left: 4px solid var(--accent); color: #fff; padding: 10px 18px; border-radius: 8px; font-weight: 600; font-size: 14px; opacity: 0; transition: all .2s; pointer-events: none; z-index: 50; box-shadow: 0 6px 20px rgba(0,0,0,.2); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }

@media (max-width: 960px) {
  .layout-side { grid-template-columns: 1fr; }
  .sticky { position: static; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .userbox .who { display: none; }
}
@media (max-width: 720px) {
  .wrap { padding: 0 14px; }
  .topbar .wrap { flex-wrap: wrap; height: auto; padding-top: 10px; padding-bottom: 6px; gap: 8px 16px; }
  .nav { order: 3; flex-basis: 100%; }
  .userbox { margin-left: auto; }
  .brand small { display: none; }
  .row-addr { grid-template-columns: 1fr 70px; }
  .row-addr > :last-child { grid-column: 1 / -1; }
  .t .hide-sm { display: none; }
  dl.kv { grid-template-columns: 110px 1fr; }
}
@media print {
  .topbar, .impersonating, .no-print, .flash { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; }
  .layout-side { grid-template-columns: 1fr; }
}

.logo-text { font-family: "Poppins", sans-serif; font-weight: 700; letter-spacing: .12em; color: var(--accent); font-size: 20px; }

/* ---------- part pictures ---------- */
.thumb-col { width: 60px; padding-right: 0 !important; }
.thumb { display: block; width: 48px; height: 48px; border-radius: 6px; border: 1px solid var(--line); background: #fff; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
a.thumb:hover { border-color: var(--accent); }
.thumb-empty { background: var(--soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23c4c8c6' stroke-width='1.6'%3E%3Crect x='3' y='5' width='18' height='14' rx='2'/%3E%3Ccircle cx='9' cy='10' r='1.6'/%3E%3Cpath d='m4 17 5-5 4 4 3-3 4 4'/%3E%3C/svg%3E") center / 22px no-repeat; }
.item-photo { display: block; width: 100%; max-height: 280px; object-fit: contain; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.item-photo-empty { height: 160px; display: grid; place-items: center; color: var(--muted); font-size: 14px; background: var(--soft); }
.lightbox { position: fixed; inset: 0; background: rgba(15, 20, 18, .82); display: grid; place-items: center; z-index: 100; padding: 24px; cursor: zoom-out; }
.lightbox img { max-width: min(900px, 100%); max-height: 85vh; background: #fff; border-radius: 8px; box-shadow: 0 10px 40px rgba(0,0,0,.4); }
.lightbox .cap { position: absolute; bottom: 18px; left: 0; right: 0; text-align: center; color: #fff; font-weight: 600; }
@media (max-width: 720px) { .thumb-col { width: 48px; } .thumb { width: 40px; height: 40px; } }
.stat .n.n-date { font-size: 15px; line-height: 1.3; padding-top: 6px; }

/* ---------- pricing / payment ---------- */
.totals > div:first-child { display: flex; justify-content: space-between; align-items: baseline; font-size: 15px; }
.totals > div:first-child b { font-family: "Poppins", sans-serif; font-size: 22px; }
.totals .small { margin-top: 4px; }
.card-attn { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.nav { gap: 2px; }
.nav a { padding: 8px 10px; }
@media (max-width: 1400px) { .userbox .who { display: none; } .brand > span:last-child small { display: none; } }


/* ---------- Review order button: count is the point ---------- */
.btn-review { min-height: 48px; padding: 8px 18px; font-size: 16px; gap: 10px; }
.btn-review .review-count { display: inline-grid; place-items: center; min-width: 34px; height: 34px; padding: 0 8px; border-radius: 17px;
  background: var(--navy); color: #fff; font-family: "Poppins", sans-serif; font-size: 18px; font-weight: 700; line-height: 1; }
.btn-review .review-unit { font-weight: 600; margin-left: -4px; }

/* ---------- part detail page ---------- */
a.part-link { color: var(--ink); }
a.part-link:hover { color: var(--info); text-decoration: underline; }
a.part-link.desc { font-weight: 500; }
.part-top { display: grid; grid-template-columns: 420px minmax(0, 1fr); gap: 32px; align-items: start; margin-bottom: 24px; }
.part-photo { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); aspect-ratio: 1 / 1; display: grid; place-items: center; overflow: hidden; }
.part-photo img { width: 100%; height: 100%; object-fit: contain; display: block; }
.part-photo a { display: block; width: 100%; height: 100%; cursor: zoom-in; }
.part-photo-empty { display: flex; flex-direction: column; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; }
.part-photo-empty .thumb { width: 96px; height: 96px; background-size: 40px; }
.part-eyebrow { font-size: 12.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--info); }
.part-title { font-size: 30px; margin: 6px 0 4px; }
.part-pn { font-size: 16px; color: var(--muted); }
.part-facts { display: flex; flex-wrap: wrap; gap: 14px 36px; margin: 22px 0; padding: 16px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.part-facts > div { display: flex; flex-direction: column; gap: 4px; }
.part-facts .label { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.part-price { font-family: "Poppins", sans-serif; font-size: 22px; }
.part-add { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
.part-add input[type=number] { width: 96px; min-height: 48px; font-size: 18px; font-weight: 700; text-align: center; }
.part-add .btn { min-height: 48px; padding: 0 22px; font-size: 15px; }
.part-details { white-space: pre-line; font-size: 15.5px; line-height: 1.6; }
.spec-table th { width: 38%; text-transform: none; letter-spacing: 0; font-size: 14px; color: var(--muted); background: #fafaf8; font-weight: 600; white-space: normal; }
.spec-table td { font-size: 15px; }
.file-list { list-style: none; margin: 0; padding: 0; }
.file-list li { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid #eef1f4; }
.file-list li:last-child { border-bottom: 0; }
.file-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow-wrap: anywhere; }
.file-kind { flex: none; width: 52px; height: 40px; border-radius: 6px; display: grid; place-items: center; font-size: 11px; font-weight: 700; letter-spacing: .03em; background: #eef1f4; color: #3a4757; text-transform: uppercase; }
.file-kind.kind-pdf { background: var(--bad-soft); color: var(--bad); }
.file-kind.kind-image { background: var(--info-soft); color: var(--info); }
.file-kind.kind-excel, .file-kind.kind-csv { background: var(--ok-soft); color: var(--ok); }
.file-kind.kind-word { background: #e6effa; color: #1d5fa8; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
@media (max-width: 960px) { .part-top { grid-template-columns: 1fr; } .part-photo { max-width: 420px; } }

/* Review order: floats on every page so the order is always one click away */
.review-float { position: fixed; right: 24px; bottom: 24px; z-index: 40; box-shadow: 0 10px 28px rgba(31, 37, 35, .28); min-height: 56px; padding: 10px 22px; font-size: 17px; }
.review-float .review-count { min-width: 38px; height: 38px; border-radius: 19px; font-size: 20px; }
body:has(.review-float:not(.hidden)) main.wrap { padding-bottom: 110px; }
@media print { .review-float { display: none !important; } }
@media (max-width: 720px) { .review-float { left: 14px; right: 14px; bottom: 14px; justify-content: center; } }
.nav a { display: inline-flex; align-items: center; min-height: 40px; }
@media (max-width: 720px) {
  .search-hero { flex-wrap: wrap; }
  .search-hero input[type=search] { flex: 1 1 100%; }
  .search-hero select { flex: 1 1 auto; min-width: 0 !important; }
}

/* ======================================================================
   Phone layout
   ====================================================================== */
.layout-side > *, .grid > *, .part-top > * { min-width: 0; }
.line-status-select { min-width: 130px; }
.line-note-input { min-width: 150px; }

@media (max-width: 720px) {
  body { font-size: 15px; }
  h1 { font-size: 24px; }
  main.wrap { padding-top: 18px; }
  .page-head { margin-bottom: 14px; align-items: flex-start; }
  .page-head .actions { width: 100%; }
  .card-body { padding: 16px; }
  .card-head { padding: 12px 16px; flex-wrap: wrap; }
  input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=tel], input[type=search], select, textarea { font-size: 16px; } /* no iOS zoom-on-focus */
  .btn { min-height: 44px; }
  .btn-sm { min-height: 36px; }

  /* header: logo + account on one line, menu scrolls sideways under it */
  .topbar .wrap { gap: 6px 12px; padding-top: 8px; padding-bottom: 0; }
  .brand .logo { height: 44px; }
  .brand .divider, .brand > span:last-child { display: none; }
  .userbox a, .userbox button { padding: 6px 10px; }
  .nav { margin: 0 -14px; padding: 0 10px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { padding: 8px 10px; font-size: 15px; }

  /* toolbars stack */
  .toolbar { padding: 12px; gap: 8px; }
  .toolbar input[type=search], .toolbar select { flex: 1 1 100%; min-width: 0; width: 100%; }
  .toolbar .tabs { width: 100%; }
  .stats { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .stat { padding: 10px 12px; }
  .stat .n { font-size: 20px; }
  .row { grid-template-columns: 1fr 1fr; }
  .row > .field[style*="span 2"] { grid-column: 1 / -1 !important; }
  dl.kv { grid-template-columns: 104px 1fr; }

  /* ---- tables become cards ---- */
  .table-wrap:has(> table.cards) { overflow: visible; }
  table.cards, table.cards tbody { display: block; width: 100%; }
  table.cards thead { display: none; }
  table.cards tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); align-items: start; }
  table.cards tr:last-child { border-bottom: 0; }
  table.cards.has-thumb tr { grid-template-columns: 56px minmax(0, 1fr) auto; }
  table.cards td { display: block; padding: 0; border: 0; grid-column: 1 / -1; text-align: left !important; white-space: normal; min-width: 0; }
  table.cards.has-thumb td { grid-column: 2 / -1; }
  table.cards td.hide-sm { display: none; }
  table.cards td.hide-sm.sm-show { display: block; }
  table.cards td:empty { display: none; }
  table.cards td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); font-size: 13px; font-weight: 600; }
  table.cards td[data-label] > div, table.cards td[data-label] > .small { display: inline; margin-left: 6px; }
  table.cards .thumb-col { grid-column: 1 !important; grid-row: 1 / span 6; width: auto; padding: 0 !important; }
  table.cards .thumb-col .thumb { width: 56px; height: 56px; }
  table.cards .c-head { grid-row: 1; grid-column: 1 / 2; font-size: 15px; }
  table.cards .c-head::before { content: none !important; }
  table.cards.has-thumb .c-head { grid-column: 2 / 3; }
  table.cards .c-side { grid-row: 1; grid-column: -2 / -1 !important; text-align: right !important; }
  table.cards .c-full { grid-column: 1 / -1 !important; }
  table.cards.has-thumb .c-full { grid-column: 2 / -1 !important; }
  table.cards .c-actions { display: flex; gap: 8px; flex-wrap: wrap; }
  table.cards .c-actions .inline { display: inline-flex; }
  table.cards .add-form { justify-content: flex-start; flex-wrap: wrap; margin-top: 4px; }
  table.cards .add-form input { width: 84px; min-height: 44px; font-size: 16px; }
  table.cards .add-form .btn { min-height: 44px; padding: 0 20px; }
  table.cards .add-form .in-cart { order: 3; width: 100%; }
  table.cards td.qty { width: auto; }
  table.cards td.qty input { width: 90px; min-height: 44px; display: inline-block; margin-left: 6px; }
  table.cards .line-status-select { min-width: 0; width: auto; display: inline-block; margin-left: 6px; }
  table.cards .line-note-input { min-width: 0; width: 100%; margin-top: 4px; }
  table.cards tr.inactive td { opacity: .75; }

  /* part page */
  .part-top { gap: 18px; }
  .part-photo { max-width: none; aspect-ratio: 4 / 3; }
  .part-title { font-size: 24px; }
  .part-add input[type=number] { width: 84px; }
  .part-add .btn { flex: 1; }
  .file-list li { padding: 12px 16px; }

  /* order page: actions wrap, print hidden */
  .actions [data-print] { display: none; }
}
