/* Layout: black top bar, white work surface, dense tables; ORA red for primary actions and live state. */
[hidden] { display: none !important; }
:root {
  --bg: #f4f4f4; --surface: #ffffff; --ink: #111111; --ink-2: #555555; --ink-3: #8a8a8a; --line: #e1e1e1;
  --top: #000000; --on-top: #ffffff; --on-top-2: #a3a1a1; --accent: #d90000; --accent-tint: #fde8e8;
  --good: #1f7a46; --good-tint: #e1f3e8; --warn: #8a5a00; --warn-tint: #fbefd2; --grey-tint: #ececec;
  --f: "Archivo", "Helvetica Neue", Arial, sans-serif; --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace; --r: 3px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0e0e0e; --surface: #181818; --ink: #f0f0f0; --ink-2: #b4b4b4; --ink-3: #888; --line: #2c2c2c;
    --accent: #ff3030; --accent-tint: #3a1414; --good: #63d08f; --good-tint: #15301f; --warn: #f0c060; --warn-tint: #3a2e12; --grey-tint: #262626; color-scheme: dark; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.45 var(--f); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }
h1, h2, h3 { font-stretch: 80%; font-weight: 800; text-transform: uppercase; margin: 0; letter-spacing: .01em; }
h1 { font-size: 28px; } h2 { font-size: 20px; } h3 { font-size: 15px; letter-spacing: .06em; }
code, .mono { font-family: var(--mono); font-size: 12px; }
.small { font-size: 12px; color: var(--ink-3); }
.err { color: var(--accent); font-weight: 600; }
.btn { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px; border-radius: var(--r); border: 1px solid var(--line);
  background: var(--surface); cursor: pointer; font-weight: 700; text-transform: uppercase; font-stretch: 88%; letter-spacing: .04em; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--ink-3); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.ghost { background: transparent; color: inherit; border-color: rgba(255,255,255,.3); }
.btn.small { min-height: 30px; padding: 0 10px; font-size: 12px; }
.btn.danger { color: var(--accent); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
input[type=text], input:not([type]), input[type=number], input[type=password], input[type=search], select, textarea {
  width: 100%; min-height: 36px; padding: 6px 10px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
textarea { min-height: 120px; resize: vertical; }
label { display: block; font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); margin: 12px 0 4px; }
label.check { display: flex; align-items: center; gap: 8px; text-transform: none; letter-spacing: 0; font-size: 14px; color: var(--ink); margin: 8px 0; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: var(--top); }
.login-card { width: min(380px, 100%); background: var(--surface); border-top: 6px solid var(--accent); padding: 24px; border-radius: var(--r); }
.login-card .btn { width: 100%; justify-content: center; margin-top: 16px; }
.login-card img { display: block; margin: 8px auto; background: #fff; padding: 6px; }
.login-brand, .brand { display: grid; line-height: 1; font-stretch: 75%; text-transform: uppercase; font-weight: 800; }
.login-brand span, .brand span { color: var(--accent); letter-spacing: .2em; font-size: 12px; }
.login-brand strong { font-size: 30px; margin-bottom: 8px; } .brand strong { font-size: 20px; }

/* shell */
.top { position: sticky; top: 0; z-index: 20; background: var(--top); color: var(--on-top); display: flex; align-items: center; gap: 20px; padding: 10px 20px; border-bottom: 3px solid var(--accent); flex-wrap: wrap; }
.top nav { display: flex; gap: 2px; flex-wrap: wrap; flex: 1; }
.top nav a { text-decoration: none; color: var(--on-top-2); padding: 6px 10px; font-weight: 700; text-transform: uppercase; font-stretch: 85%; letter-spacing: .04em; border-radius: var(--r); }
.top nav a:hover, .top nav a[aria-current] { color: var(--on-top); }
.top nav a[aria-current] { box-shadow: inset 0 -3px 0 var(--accent); border-radius: 0; }
main { max-width: 1400px; margin: 0 auto; padding: 20px; }
.pill { display: inline-block; min-width: 18px; padding: 0 6px; border-radius: 9px; background: var(--accent); color: #fff; font-size: 11px; text-align: center; }
.head { display: flex; align-items: end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 16px; }
@media (max-width: 800px) { .grid2, .grid3 { grid-template-columns: minmax(0, 1fr); } }

/* product list */
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.toolbar input[type=search] { max-width: 320px; } .toolbar select { max-width: 220px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.chip { border: 1px solid var(--line); background: var(--surface); padding: 5px 10px; border-radius: 999px; cursor: pointer; font-weight: 600; }
.chip[aria-pressed=true] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip b { font-variant-numeric: tabular-nums; margin-left: 4px; opacity: .7; }
.tablewrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); background: var(--surface); position: sticky; top: 0; }
tbody tr:hover { background: var(--bg); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.thumb { width: 52px; height: 40px; object-fit: cover; border-radius: 2px; background: var(--grey-tint); display: block; }
.name a { font-weight: 700; text-decoration: none; } .name a:hover { color: var(--accent); }
.status { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 3px; white-space: nowrap; }
.s-in-wms { background: var(--good-tint); color: var(--good); }
.s-not-in-wms { background: var(--warn-tint); color: var(--warn); }
.s-inactive { background: var(--accent-tint); color: var(--accent); }
.s-manual { background: var(--grey-tint); color: var(--ink-2); }
.switch { position: relative; width: 40px; height: 22px; border-radius: 11px; background: var(--line); border: 0; cursor: pointer; padding: 0; }
.switch::after { content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: left .15s; }
.switch[aria-checked=true] { background: var(--accent); } .switch[aria-checked=true]::after { left: 21px; }
.bulk { position: sticky; bottom: 0; background: var(--top); color: #fff; padding: 10px 16px; display: flex; gap: 10px; align-items: center; border-radius: var(--r); margin-top: 10px; }

/* editor */
.editor { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1000px) { .editor { grid-template-columns: minmax(0, 1fr); } }
.editor .panel + .panel { margin-top: 16px; }
.savebar { position: sticky; top: 64px; z-index: 5; background: var(--bg); padding: 8px 0 12px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 14px; margin: 8px 0 0; }
.facts dt { color: var(--ink-3); } .facts dd { margin: 0; }
.imgs { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; margin-top: 8px; }
.img { position: relative; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: #fff; }
.img img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; }
.img .tools { display: flex; justify-content: space-between; padding: 2px; background: var(--surface); }
.img .tools button { border: 0; background: none; cursor: pointer; padding: 2px 6px; }
.img.first { outline: 2px solid var(--accent); }
.group { border: 1px solid var(--line); border-radius: var(--r); padding: 10px; margin-top: 10px; background: var(--bg); }
.group-head { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; align-items: center; }
.choice { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1.1fr) 100px auto; gap: 6px; align-items: center; margin-top: 6px; }
.choice .p { font-size: 12px; color: var(--ink-3); }
@media (max-width: 700px) { .choice { grid-template-columns: minmax(0, 1fr); } }
.fits { max-height: 380px; overflow: auto; border: 1px solid var(--line); border-radius: var(--r); padding: 8px 10px; background: var(--surface); }
.fits details { margin: 2px 0; } .fits summary { cursor: pointer; font-weight: 700; padding: 3px 0; }
.fits .model { margin: 4px 0 6px 14px; } .fits .model b { font-size: 12px; text-transform: uppercase; color: var(--ink-2); }
.fits label.check { margin: 2px 0 2px 10px; font-size: 13px; }
.results { margin-top: 10px; }
.list-edit td input, .list-edit td textarea { min-height: 32px; }
.list-edit td textarea { min-height: 32px; height: 32px; }
.enq-detail { white-space: pre-wrap; font-family: var(--mono); font-size: 12px; background: var(--bg); padding: 10px; border-radius: var(--r); }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: var(--r); font-weight: 600; z-index: 50; max-width: calc(100% - 32px); }
.toast.bad { background: var(--accent); color: #fff; }
.empty { padding: 30px; text-align: center; color: var(--ink-2); }
.veh-make { border: 1px solid var(--line); border-radius: var(--r); padding: 10px; margin-top: 10px; background: var(--surface); }
.veh-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1.4fr) auto; gap: 6px; margin-top: 6px; align-items: center; }
