:root {
  color-scheme: light;
  font-family: system-ui, sans-serif;
  --ink: #191714;
  --muted: #5e5146;
  --orange: #ff862e;
  --orange-wash: #fff1e5;
  --border: #e4d8cc;
  color: var(--ink);
  background: #f7f3ee;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
header { background: #171513; color: #fff; border-bottom: .2rem solid var(--orange); }
.shell { width: min(72rem, 100% - 2rem); margin-inline: auto; }
.masthead { display: flex; align-items: center; gap: .75rem; min-height: 5.5rem; }
.brand-logo { display: block; width: min(10rem, 55vw); height: auto; }
#lock { margin-left: auto; color: white; background: transparent; border-color: #8e8277; }
main { padding-block: 2rem 4rem; }
h1 { margin: 0; font-size: clamp(1.9rem, 5vw, 3rem); letter-spacing: -.045em; }
h2 { margin: 0 0 .9rem; font-size: 1rem; }
p { margin: .4rem 0; }
.panel { min-width: 0; padding: 1.25rem; border: 1px solid var(--border); border-radius: .8rem; background: #fff; }
.login { max-width: 28rem; border-top: .25rem solid var(--orange); }
form { display: grid; gap: .8rem; margin-top: 1.25rem; }
input, button, select { font: inherit; border: 1px solid #a89a8c; border-radius: .45rem; background: #fff; color: var(--ink); padding: .55rem .75rem; }
button { cursor: pointer; font-weight: 650; }
button:disabled { opacity: .6; cursor: wait; }
.primary { background: var(--orange); border-color: var(--orange); color: var(--ink); }
.primary:hover { background: #ff9c55; }
:focus-visible { outline: 3px solid #b14c00; outline-offset: 3px; }
.toolbar, .controls { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; }
.toolbar { justify-content: space-between; margin-bottom: 1.25rem; }
.metrics, .details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.metric { background: var(--orange-wash); }
.metric p { font-size: 1.7rem; font-weight: 750; letter-spacing: -.03em; }
#updated, #last-seen, th { color: var(--muted); font-size: .875rem; }
#status:empty { display: none; }
#status { padding: .6rem 0; }
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
td, th { padding: .65rem .5rem; border-bottom: 1px solid var(--border); }
td:first-child, th:first-child { padding-left: 0; }
@media (max-width: 44rem) { .details { grid-template-columns: 1fr; } }
@media (max-width: 30rem) { .metrics { grid-template-columns: 1fr; } }

.sales p { color: var(--muted); margin-top: .9rem; font-size: .875rem; }

.order-panel { margin-bottom: 1rem; }
.test-label { margin-left: .4rem; padding: .2rem .5rem; border-radius: .35rem; background: var(--orange-wash); color: var(--muted); font-size: .875rem; font-weight: 650; }
.order-panel td:last-child { white-space: nowrap; }
dialog { width: min(32rem, 100% - 2rem); max-height: calc(100% - 2rem); border: 1px solid var(--border); border-radius: .8rem; color: var(--ink); padding: 1.25rem; }
dialog::backdrop { background: #17151399; }
dialog dl { display: grid; grid-template-columns: minmax(7rem, auto) minmax(0, 1fr); gap: .55rem .9rem; }
dialog dt { font-weight: 650; }
dialog dd { margin: 0; overflow-wrap: anywhere; }

@media (min-width: 58rem) { .metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.metrics .heartbeat { grid-column: 1 / -1; background: #fff; }
.metric-note { color: var(--muted); font-size: .875rem; }

.fleet { margin-bottom: 1rem; }
.fleet #fleet-summary { color: var(--muted); margin-bottom: .65rem; }
.fleet #stock-unknown { margin-top: .8rem; }
.fleet #stock-unknown:empty { display: none; }
.fleet tbody td:last-child { font-weight: 750; }
#diagnostics { max-height: 24rem; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
