:root {
  --navy: #0f2f52;
  --navy-2: #173f6b;
  --accent: #f5a623;
  --accent-dark: #d48806;
  --bg: #f4f6f9;
  --card: #ffffff;
  --text: #1c2733;
  --muted: #5f6b7a;
  --line: #dfe4ea;
  --red: #c62828;
  --red-bg: #fdecec;
  --green: #2e7d32;
  --green-bg: #e8f5e9;
  --blue: #1565c0;
  --blue-bg: #e3f0fd;
  --amber: #a15c00;
  --amber-bg: #fff4e0;
  --gray-bg: #eef1f4;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text); background: var(--bg); line-height: 1.5; font-size: 15px;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: 1.7rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
.loading { padding: 4rem; text-align: center; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: .9em; }
.pre { white-space: pre-wrap; }
.hidden { display: none !important; }

/* ---------- buttons & forms */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  padding: .55em 1.1em; border-radius: 8px; border: 1px solid transparent;
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none !important;
  background: var(--navy); color: #fff; transition: background .15s;
}
.btn:hover { background: var(--navy-2); }
.btn.accent { background: var(--accent); color: #1c1300; }
.btn.accent:hover { background: var(--accent-dark); }
.btn.ghost { background: #fff; color: var(--navy); border-color: var(--line); }
.btn.ghost:hover { background: var(--gray-bg); }
.btn.danger { background: #fff; color: var(--red); border-color: #f1c4c4; }
.btn.danger:hover { background: var(--red-bg); }
.btn.sm { padding: .3em .7em; font-size: .85rem; }
.btn.lg { padding: .8em 1.5em; font-size: 1.05rem; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: .25em; }
input, select, textarea {
  width: 100%; font: inherit; padding: .55em .7em; border: 1px solid #c9d1db; border-radius: 8px; background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid #9cc3f0; border-color: var(--blue); }
textarea { min-height: 110px; resize: vertical; }
input[type=checkbox], input[type=radio] { width: auto; margin-right: .4em; flex: none; }
.check { display: flex; align-items: center; font-weight: 500; }
.field { margin-bottom: 1rem; }
.grid { display: grid; gap: 1rem; }
.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)); }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.spacer { flex: 1; }
.form-error { background: var(--red-bg); color: var(--red); padding: .6em .9em; border-radius: 8px; margin-bottom: 1rem; }
.form-error:empty { display: none; }

/* ---------- cards & tables */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem; margin-bottom: 1.25rem; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: .75rem; flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; }
.table-wrap { overflow-x: auto; margin: 0 -1.25rem; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .6rem 1.25rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: #fafbfc; }
tr.click { cursor: pointer; }
tr.click:hover td { background: #f6f9fd; }
tr:last-child td { border-bottom: 0; }
.empty { padding: 2rem; text-align: center; color: var(--muted); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; margin: 0; }
.kv dt { color: var(--muted); font-size: .88rem; }
.kv dd { margin: 0; }

/* ---------- badges */
.badge { display: inline-block; padding: .15em .6em; border-radius: 999px; font-size: .78rem; font-weight: 700; white-space: nowrap; background: var(--gray-bg); color: var(--muted); }
.b-blue { background: var(--blue-bg); color: var(--blue); }
.b-green { background: var(--green-bg); color: var(--green); }
.b-red { background: var(--red-bg); color: var(--red); }
.b-amber { background: var(--amber-bg); color: var(--amber); }
.b-navy { background: var(--navy); color: #fff; }

/* ---------- public site */
.site-header { background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 20; }
.site-header .inner { max-width: 1160px; margin: 0 auto; padding: .8rem 1.25rem; display: flex; align-items: center; gap: 1.5rem; }
.logo { display: flex; align-items: center; gap: .65rem; color: #fff !important; text-decoration: none !important; font-weight: 800; font-size: 1.3rem; letter-spacing: .08em; line-height: 1.1; }
.logo-mark { width: 40px; height: 40px; flex: none; }
.logo small { display: block; font-weight: 600; font-size: .62rem; color: #b8c7d9; letter-spacing: .32em; margin-top: .15rem; }
.site-nav { display: flex; gap: 1.2rem; flex: 1; }
.site-nav a { color: #dce6f2; font-weight: 500; }
.site-nav a:hover, .site-nav a.active { color: #fff; text-decoration: none; }
.menu-btn { display: none; background: none; border: 0; color: #fff; font-size: 1.6rem; cursor: pointer; }
.hero { background: linear-gradient(135deg, var(--navy) 0%, #1e5185 100%); color: #fff; }
.hero .inner { max-width: 1160px; margin: 0 auto; padding: 4.5rem 1.25rem 4rem; display: grid; grid-template-columns: 1.3fr 1fr; gap: 3rem; align-items: center; }
.hero h1 { font-size: 2.6rem; margin-bottom: .4em; }
.hero p.lead { font-size: 1.15rem; color: #d6e2ef; max-width: 560px; }
.hero .eyebrow { color: var(--accent); font-weight: 700; text-transform: uppercase; letter-spacing: .1em; font-size: .8rem; margin-bottom: .8em; }
.hero-card { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.18); border-radius: 14px; padding: 1.5rem; }
.hero-card h3 { color: #fff; }
.hero-card ul { margin: 0; padding-left: 1.1rem; color: #d6e2ef; }
.hero-card li { margin-bottom: .45rem; }
.section { max-width: 1160px; margin: 0 auto; padding: 3.5rem 1.25rem; }
.section.narrow { max-width: 760px; }
.section h2.title { font-size: 1.8rem; text-align: center; margin-bottom: .3em; }
.section p.sub { text-align: center; color: var(--muted); max-width: 640px; margin: 0 auto 2.2rem; }
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }
.feature { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 1.5rem; }
.feature .icon { width: 44px; height: 44px; border-radius: 10px; background: var(--amber-bg); color: var(--accent-dark); display: grid; place-items: center; font-size: 1.3rem; margin-bottom: .8rem; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; counter-reset: step; }
.step { position: relative; padding: 1.5rem 1.5rem 1.5rem 4.2rem; background: #fff; border-radius: 12px; border: 1px solid var(--line); }
.step::before { counter-increment: step; content: counter(step); position: absolute; left: 1.3rem; top: 1.4rem; width: 2rem; height: 2rem; border-radius: 50%; background: var(--navy); color: #fff; display: grid; place-items: center; font-weight: 700; }
.band { background: #fff; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.cta-band { background: var(--accent); }
.cta-band .section { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; padding: 2.2rem 1.25rem; flex-wrap: wrap; }
.cta-band h2 { margin: 0; }
.areas { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip { background: var(--gray-bg); border-radius: 999px; padding: .2em .75em; font-size: .85rem; }
.site-footer { background: #0b223c; color: #b8c7d9; }
.site-footer .inner { max-width: 1160px; margin: 0 auto; padding: 2.5rem 1.25rem; display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 2rem; }
.site-footer a { color: #dce6f2; }
.site-footer h4 { color: #fff; margin: 0 0 .6rem; }
.site-footer .legal { grid-column: 1 / -1; border-top: 1px solid #1f3a5a; padding-top: 1rem; font-size: .82rem; }
.auth-wrap { min-height: calc(100vh - 66px); display: grid; place-items: center; padding: 2rem 1rem; }
.auth-card { width: 100%; max-width: 420px; }

/* ---------- app shell (portal + staff) */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar { background: var(--navy); color: #cfdbe8; padding: 1rem .75rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; }
.sidebar .logo { padding: .3rem .5rem 1.2rem; }
.sidebar nav a { display: flex; align-items: center; gap: .65rem; color: #cfdbe8; padding: .55rem .75rem; border-radius: 8px; font-weight: 500; margin-bottom: 2px; }
.sidebar nav a:hover { background: rgba(255,255,255,.07); text-decoration: none; color: #fff; }
.sidebar nav a.active { background: rgba(255,255,255,.13); color: #fff; }
.sidebar nav .ico { width: 1.2rem; text-align: center; opacity: .9; }
.sidebar nav .count { margin-left: auto; background: var(--accent); color: #1c1300; border-radius: 999px; font-size: .72rem; font-weight: 800; padding: 0 .5em; }
.sidebar .nav-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .1em; color: #7f98b4; padding: 1rem .75rem .3rem; }
.sidebar .who { margin-top: auto; padding: .9rem .75rem .2rem; border-top: 1px solid rgba(255,255,255,.12); font-size: .85rem; }
.sidebar .who strong { color: #fff; display: block; }
.sidebar .who a { color: #cfdbe8; }
.main { min-width: 0; }
.topbar { display: none; background: var(--navy); color: #fff; padding: .7rem 1rem; align-items: center; gap: 1rem; position: sticky; top: 0; z-index: 20; }
.page { padding: 1.75rem 2rem 3rem; max-width: 1280px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.page-head .crumb { font-size: .85rem; margin-bottom: .2rem; }
.filters { display: flex; gap: .6rem; flex-wrap: wrap; margin-bottom: 1rem; }
.filters > * { width: auto; min-width: 140px; }
.filters input[type=search] { min-width: 240px; flex: 1; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.tile { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--shadow); color: inherit; display: block; }
a.tile:hover { text-decoration: none; border-color: #b9c6d6; }
.tile .num { font-size: 1.9rem; font-weight: 800; line-height: 1.1; }
.tile .lbl { color: var(--muted); font-size: .85rem; }
.tile.alert .num { color: var(--red); }
.tile.warn .num { color: var(--amber); }
.two-col { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.two-col.even { grid-template-columns: 1fr 1fr; }

/* ---------- call tracker & timeline */
.tracker { display: flex; margin: .5rem 0 1.25rem; }
.tracker .st { flex: 1; text-align: center; position: relative; font-size: .8rem; color: var(--muted); padding-top: 1.9rem; }
.tracker .st::before { content: ''; position: absolute; top: .55rem; left: 50%; width: 1rem; height: 1rem; margin-left: -.5rem; border-radius: 50%; background: #fff; border: 3px solid #c9d1db; z-index: 1; }
.tracker .st::after { content: ''; position: absolute; top: .95rem; left: -50%; width: 100%; height: 3px; background: #c9d1db; }
.tracker .st:first-child::after { display: none; }
.tracker .st.done { color: var(--text); }
.tracker .st.done::before { background: var(--green); border-color: var(--green); }
.tracker .st.done::after { background: var(--green); }
.tracker .st.current { color: var(--navy); font-weight: 700; }
.tracker .st.current::before { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 4px var(--amber-bg); }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 1.1rem 1.6rem; border-left: 2px solid var(--line); margin-left: .4rem; }
.timeline li:last-child { border-left-color: transparent; }
.timeline li::before { content: ''; position: absolute; left: -.42rem; top: .2rem; width: .75rem; height: .75rem; border-radius: 50%; background: #c9d1db; }
.timeline li.k-note::before { background: var(--blue); }
.timeline li.k-status::before, .timeline li.k-assign::before, .timeline li.k-schedule::before { background: var(--accent); }
.timeline li.k-part::before { background: var(--green); }
.timeline li.internal { background: #fffbea; border-radius: 6px; }
.timeline .meta { font-size: .8rem; color: var(--muted); }

/* ---------- shop & dispatch */
.products { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1rem; }
.product { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; display: flex; flex-direction: column; gap: .4rem; }
.product .price { font-size: 1.2rem; font-weight: 800; }
.product .actions { margin-top: auto; display: flex; gap: .5rem; }
.product .actions input { width: 70px; }
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 1rem; overflow-x: auto; padding-bottom: 1rem; }
.lane { background: #e9edf2; border-radius: var(--radius); padding: .75rem; min-height: 200px; }
.lane h3 { display: flex; justify-content: space-between; font-size: .95rem; }
.job { background: #fff; border-radius: 8px; padding: .7rem .8rem; margin-bottom: .6rem; box-shadow: var(--shadow); border-left: 4px solid #c9d1db; font-size: .88rem; }
.job.p-Machine.Down, .job.p-down { border-left-color: var(--red); }
.job.p-high { border-left-color: var(--accent); }
.job select { margin-top: .4rem; font-size: .82rem; padding: .3em .4em; }
.bar-row { display: grid; grid-template-columns: minmax(120px, 1.2fr) 3fr auto; gap: .6rem; align-items: center; margin-bottom: .45rem; font-size: .88rem; }
.bar { height: 12px; border-radius: 6px; background: var(--navy-2); min-width: 2px; }
.bars-v { display: flex; align-items: flex-end; gap: 4px; height: 140px; padding-top: 1rem; }
.bars-v div { flex: 1; background: var(--navy-2); border-radius: 4px 4px 0 0; position: relative; min-height: 2px; }
.bars-v div span { position: absolute; top: -1.2rem; left: 0; right: 0; text-align: center; font-size: .7rem; color: var(--muted); }

/* ---------- modal & toast */
.modal-bg { position: fixed; inset: 0; background: rgba(10, 20, 35, .5); display: grid; place-items: center; z-index: 100; padding: 1rem; }
.modal { background: #fff; border-radius: 12px; width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto; padding: 1.5rem; }
#toast { position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%) translateY(150%); background: var(--navy); color: #fff; padding: .7rem 1.2rem; border-radius: 8px; transition: transform .25s; z-index: 200; max-width: 90vw; }
#toast.show { transform: translateX(-50%) translateY(0); }
#toast.err { background: var(--red); }

/* ---------- responsive */
@media (max-width: 960px) {
  .hero .inner, .two-col, .two-col.even, .areas { grid-template-columns: 1fr; }
  .features, .steps { grid-template-columns: 1fr 1fr; }
  .site-footer .inner { grid-template-columns: 1fr 1fr; }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  body { font-size: 15px; }
  .menu-btn { display: block; margin-left: auto; }
  .site-nav { display: none; position: absolute; top: 100%; left: 0; right: 0; background: var(--navy); flex-direction: column; padding: .5rem 1.25rem 1rem; gap: .7rem; }
  .site-nav.open { display: flex; }
  .site-header .inner .header-cta { display: none; }
  .hero h1 { font-size: 2rem; }
  .hero .inner { padding: 3rem 1rem; }
  .features, .steps, .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .site-footer .inner { grid-template-columns: 1fr; }
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; position: fixed; inset: 0 25% 0 0; z-index: 50; height: 100%; }
  .sidebar.open { display: flex; }
  .topbar { display: flex; }
  .page { padding: 1.25rem 1rem 3rem; }
  .tracker .st { font-size: .68rem; }
  th, td { padding: .55rem .8rem; }
  .table-wrap { margin: 0 -1.25rem; }
  .hide-sm { display: none; }
}
@media print {
  .sidebar, .topbar, .no-print, .site-header, .site-footer { display: none !important; }
  .shell { display: block; }
  .card { box-shadow: none; border: 0; }
}

/* Settings tabs, import/export, car stock, technician map */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin: 0 0 1.25rem; overflow-x: auto; }
.tabs a { padding: .6rem 1rem; color: var(--muted); font-weight: 600; text-decoration: none; border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs a.active { color: var(--navy); border-bottom-color: var(--accent); }
.io-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.25rem; }
.io-grid .card { margin: 0; display: flex; flex-direction: column; gap: .6rem; }
.io-grid .card .row { margin-top: auto; }
.io-result { font-size: .9rem; }
.io-result ul { margin: .3rem 0 0; padding-left: 1.2rem; max-height: 160px; overflow: auto; }
.tech-map { height: 340px; border-radius: var(--radius); border: 1px solid var(--line); margin-bottom: .75rem; }
img.logo-mark { object-fit: contain; }
.logo-img { height: 44px; width: auto; max-width: 220px; object-fit: contain; display: block; }
.logo .on-white { background: #fff; padding: 3px 6px; border-radius: 8px; box-sizing: content-box; }
