:root {
  /* Logo palette: red · black · gray (legacy --blue* aliases → charcoal) */
  --red: #E60028;
  --red-deep: #B80020;
  --red-soft: rgba(230, 0, 40, 0.12);
  --ink: #121212;
  --ink-soft: #2A2A2A;
  --gray: #A8A8A8;
  --gray-soft: #F3F3F3;
  --blue: #2A2A2A;
  --blue-deep: #121212;
  --blue-soft: #F5F0F1;
  --bg-deep: #EDEDED;
  --bg-panel: #F7F7F7;
  --text: #121212;
  --text-muted: #5C5C5C;
  --border: rgba(18, 18, 18, 0.12);
  --card: #ffffff;
  --radius: 16px;
  --radius-sm: 12px;
  --shadow: 0 4px 6px -1px rgba(18, 18, 18, 0.06), 0 18px 36px -14px rgba(18, 18, 18, 0.12);
  --shadow-lg: 0 25px 50px -12px rgba(18, 18, 18, 0.16);
  --sidebar-w: 280px;
  --sidebar-bg: linear-gradient(180deg, #121212 0%, #1C1C1C 48%, #2A1216 100%);
  --sidebar-border: rgba(255, 255, 255, 0.08);
  --sidebar-text: rgba(245, 245, 245, 0.78);
  --sidebar-text-active: #ffffff;
  --font-display: "Plus Jakarta Sans", "Manrope", system-ui, sans-serif;
  --font-body: "Manrope", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  width: 100%;
  overflow-x: clip;
}
body {
  margin: 0;
  width: 100%;
  max-width: 100%;
  overflow-x: clip;
  font-family: var(--font-body);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
img, svg, video { max-width: 100%; height: auto; }
a { color: inherit; }
.muted { color: var(--text-muted); }
.small { font-size: .85rem; }

/* ——— Login ——— */
.login-body {
  min-height: 100vh;
  margin: 0;
  position: relative;
}
.login-bg {
  position: fixed; inset: 0; z-index: 0;
  background:
    radial-gradient(ellipse 80% 55% at 12% 0%, rgba(230, 0, 40, 0.14), transparent 55%),
    radial-gradient(ellipse 70% 50% at 100% 100%, rgba(18, 18, 18, 0.08), transparent 50%),
    linear-gradient(165deg, #f0f0f0 0%, #f7f7f7 42%, #ebebeb 100%);
}
.login-layout {
  position: relative; z-index: 1;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  padding: clamp(1.25rem, 4vw, 3rem);
  align-items: center;
  max-width: 1080px;
  margin: 0 auto;
}
@media (min-width: 900px) {
  .login-layout { grid-template-columns: 1.1fr .9fr; gap: 3rem; }
}
.login-hero-logo {
  display: block;
  width: min(260px, 72vw);
  height: auto;
  margin-bottom: 1.25rem;
  filter: drop-shadow(0 10px 24px rgba(18, 18, 18, 0.14));
}
.login-hero-title {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  font-weight: 800;
  letter-spacing: -.03em;
  margin: 0 0 .35rem;
  color: var(--ink);
}
.login-hero-sub {
  margin: 0 0 .75rem;
  font-weight: 700;
  color: var(--red);
  letter-spacing: .02em;
}
.login-hero-text {
  margin: 0 0 1rem;
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 36ch;
}
.login-perks {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--text-muted);
}
.login-perks li { margin-bottom: .45rem; }
.login-card {
  background: rgba(255,255,255,.94);
  border: 1px solid rgba(255,255,255,.9);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow-lg);
  padding: clamp(1.4rem, 4vw, 2rem);
  backdrop-filter: blur(16px);
}
.login-kicker {
  display: inline-block;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--red);
  margin-bottom: .35rem;
}
.login-title {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 800;
  margin: 0 0 .35rem;
}
.login-form { display: grid; gap: 1rem; margin-top: 1rem; }
.login-form label { display: grid; gap: .35rem; font-size: .9rem; font-weight: 600; }
.login-remember {
  display: flex !important;
  align-items: center;
  gap: .65rem;
  font-weight: 600 !important;
  cursor: pointer;
  user-select: none;
  color: var(--ink);
}
.login-remember input {
  width: 1.15rem;
  height: 1.15rem;
  accent-color: var(--red);
  margin: 0;
  flex: 0 0 auto;
}
.login-remember span { line-height: 1.3; }

/* ——— Powered by NOVELSOFT ——— */
.powered-by {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: .35rem .45rem;
  margin: 0;
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--text-muted);
}
.powered-by-label { opacity: .85; }
.powered-by-link {
  color: inherit;
  font-weight: 800;
  letter-spacing: .08em;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
  border-bottom-color: rgba(230, 0, 40, .35);
  padding-bottom: 1px;
  transition: color .15s ease, border-color .15s ease;
}
.powered-by-link:hover,
.powered-by-link:focus-visible {
  color: var(--red);
  border-bottom-color: var(--red);
  outline: none;
}
.powered-by--login {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.powered-by--sidebar {
  margin-top: .85rem;
  padding: .55rem .85rem 0;
  justify-content: flex-start;
  color: rgba(255,255,255,.55);
  font-size: .72rem;
  border-top: 1px solid var(--sidebar-border);
}
.powered-by--sidebar .powered-by-link {
  color: rgba(255,255,255,.82);
  border-bottom-color: rgba(255,176,192,.4);
}
.powered-by--sidebar .powered-by-link:hover,
.powered-by--sidebar .powered-by-link:focus-visible {
  color: #fff;
  border-bottom-color: #ffb3c0;
}

.alert {
  background: #fde8ec;
  color: var(--red-deep);
  padding: .75rem .9rem;
  border-radius: 12px;
  margin-bottom: .5rem;
  border: 1px solid rgba(230,0,40,.15);
}
.hint { color: var(--text-muted); font-size: .85rem; margin: 1rem 0 0; }

/* ——— Dashboard shell ——— */
.dashboard-body {
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(ellipse 110% 70% at 100% 0%, rgba(230, 0, 40, 0.07), transparent 45%),
    radial-gradient(ellipse 80% 50% at 0% 100%, rgba(18, 18, 18, 0.05), transparent 50%),
    var(--bg-deep);
}
.dashboard-frame {
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  max-width: 100%;
  display: flex;
  overflow-x: clip;
}
.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.16);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 60;
}
.sidebar-head {
  padding: 1.1rem 1rem 1rem;
  border-bottom: 1px solid var(--sidebar-border);
  background: rgba(255,255,255,.04);
}
.sidebar-brand {
  display: grid;
  gap: .55rem;
  text-decoration: none;
  justify-items: stretch;
}
.sidebar-logo-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: .65rem .75rem;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .18);
}
.sidebar-logo {
  width: 100%;
  max-width: 200px;
  height: auto;
  max-height: 56px;
  object-fit: contain;
  display: block;
}
.sidebar-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  padding: .2rem .55rem;
  border-radius: 999px;
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #fff;
  background: var(--red);
}
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: .28rem;
  padding: 1rem .7rem;
  overflow: auto;
  flex: 1;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .8rem .85rem;
  border-radius: 12px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: .92rem;
  font-weight: 600;
  border: 0;
  background: transparent;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: background .18s ease, color .18s ease, transform .15s ease;
}
.nav-link:hover {
  color: var(--sidebar-text-active);
  background: rgba(255,255,255,.08);
}
.nav-link.is-active {
  color: #fff;
  background: linear-gradient(90deg, rgba(230, 0, 40, 0.42), rgba(230, 0, 40, 0.12));
  box-shadow: inset 3px 0 0 #FF4D6A, 0 4px 12px rgba(0,0,0,.12);
}
.nav-icon { flex: 0 0 auto; opacity: .9; }
.nav-link.is-active .nav-icon { color: #ffd0d8; opacity: 1; }
.nav-label { flex: 1; }
.sidebar-foot {
  padding: .75rem .7rem 1rem;
  border-top: 1px solid var(--sidebar-border);
}
.sidebar-user {
  display: grid; gap: .15rem;
  padding: .65rem .85rem .85rem;
  color: rgba(255,255,255,.85);
  font-size: .82rem;
}
.sidebar-user strong { font-size: .78rem; letter-spacing: .06em; text-transform: uppercase; color: #ffb3c0; }
.plate-chip {
  display: inline-flex; margin-top: .35rem; width: fit-content;
  padding: .2rem .55rem; border-radius: 999px;
  background: rgba(255,255,255,.1); font-weight: 700;
}
.logout-link { margin-top: .25rem; }

.sidebar-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(8, 20, 40, .45);
  z-index: 35;
  border: 0;
}
.dashboard-frame--drawer-open .sidebar-backdrop { display: block; }

.dashboard-content {
  flex: 1;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  padding: clamp(.7rem, 1.4vw, 1.1rem) clamp(.65rem, 1.2vw, 1rem);
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  overflow-x: clip;
}
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: .75rem 1rem;
  background: rgba(255,255,255,.88);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,.95);
  box-shadow: 0 1px 3px rgba(15,23,42,.04), 0 8px 24px rgba(15,23,42,.06);
  border-radius: var(--radius);
  padding: .9rem 1.15rem;
}
.top-bar-lead { display: flex; align-items: center; gap: .85rem; min-width: 0; }
.top-kicker {
  margin: 0;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--red);
}
.top-bar-title {
  margin: .1rem 0 0;
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 2vw, 1.45rem);
  font-weight: 800;
  letter-spacing: -.03em;
}
.top-actions { display: flex; flex-wrap: wrap; gap: .45rem; justify-content: flex-end; }
.user-chip {
  display: inline-flex; align-items: center;
  padding: .45rem .75rem;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue-deep);
  font-size: .82rem;
  font-weight: 700;
  text-decoration: none;
  border: 1px solid transparent;
}
.user-chip.accent { background: var(--red-soft); color: var(--red-deep); }
.user-chip-logout { background: #fff; border-color: var(--border); color: var(--text-muted); }

.tv-status {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .4rem .75rem .4rem .55rem;
  border-radius: 999px;
  font-size: .8rem;
  font-weight: 650;
  line-height: 1.25;
  border: 1px solid transparent;
  white-space: nowrap;
}
.tv-status-dot {
  width: .55rem;
  height: .55rem;
  border-radius: 50%;
  flex: 0 0 auto;
}
.tv-status-text strong { font-weight: 800; }
.tv-status.is-online {
  background: linear-gradient(180deg, #ecfdf3 0%, #d1fae5 100%);
  color: #047857;
  border-color: rgba(16, 185, 129, .35);
}
.tv-status.is-online .tv-status-dot {
  background: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, .22);
}
.tv-status.is-offline {
  background: #fde8ec;
  color: var(--red-deep);
  border-color: rgba(230, 0, 40, .2);
}
.tv-status.is-offline .tv-status-dot {
  background: var(--red);
  box-shadow: 0 0 0 3px rgba(230, 0, 40, .18);
}

.tv-health {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .5rem;
  margin: .35rem 0 .75rem;
}
.tv-health-chip {
  appearance: none;
  width: 100%;
  border-radius: 14px;
  padding: .7rem .65rem;
  font-weight: 800;
  font-size: .86rem;
  line-height: 1.25;
  text-align: center;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
}
.tv-health-chip:disabled {
  cursor: default;
}
.tv-health-chip.is-ok {
  background: #ecfdf3;
  border-color: #86efac;
  color: #166534;
}
.tv-health-chip.is-miss {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #991b1b;
}
@media (max-width: 720px) {
  .tv-health { grid-template-columns: 1fr 1fr; }
}
.tv-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: .65rem;
  margin: .35rem 0 .75rem;
}
.tv-kpi {
  background: var(--gray-soft);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: .75rem .85rem;
}
.tv-kpi-label {
  display: block;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.tv-kpi-value {
  display: block;
  margin-top: .2rem;
  font-family: var(--font-display);
  font-size: 1.35rem;
  letter-spacing: -.03em;
}
.tv-table-wrap {
  overflow-x: auto;
  margin: 0 -.15rem;
}
.tv-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
}
.tv-table th,
.tv-table td {
  text-align: left;
  padding: .55rem .6rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.tv-table th {
  font-size: .72rem;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
}
.tv-table tbody tr:hover { background: #fafafa; }
.tv-map-unmatched { opacity: .72; }
.tv-map-review { background: #fffbeb; }
.tv-map-auto.is-written { background: #ecfdf3; }
.tv-type {
  display: inline-flex;
  padding: .12rem .45rem;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 800;
  background: #f1f5f9;
  color: #475569;
}
.tv-type.is-filled, .tv-type.is-corrected {
  background: #d1fae5;
  color: #047857;
}
.tv-type.is-returned, .tv-type.is-removed, .tv-type.is-expired {
  background: #fee2e2;
  color: #b91c1c;
}

.mobile-menu-btn {
  display: none;
  width: 44px; height: 44px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
  padding: 0;
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.mobile-menu-btn span {
  display: block; width: 18px; height: 2px;
  background: var(--blue); border-radius: 2px;
}

.panel-area {
  display: grid;
  gap: .95rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

/* ——— Content cards ——— */
.card, .hero-panel {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid rgba(255,255,255,.8);
  padding: clamp(.9rem, 2.5vw, 1.2rem);
  width: 100%;
  max-width: 100%;
  min-width: 0;
}
.card h2, .card h3 { margin: 0 0 .35rem; font-family: var(--font-display); letter-spacing: -.02em; }
.hero-panel {
  background: linear-gradient(135deg, #121212 0%, #1C1C1C 48%, #3A0A12 100%);
  color: #fff;
  position: relative;
  overflow: hidden;
}
.hero-panel::after {
  content: "";
  position: absolute; right: -40px; top: -40px;
  width: 180px; height: 180px; border-radius: 50%;
  background: radial-gradient(circle, rgba(230,0,40,.45), transparent 70%);
}
.hero-panel h2 { position: relative; z-index: 1; margin: 0 0 .85rem; }
.hero-actions { position: relative; z-index: 1; }
.hero-actions .action-card {
  background: rgba(255, 255, 255, 0.96);
  color: var(--text);
  border-color: transparent;
}
.hero-actions .action-card:hover {
  background: #fff;
}
.steps { position: relative; z-index: 1; margin: 0; padding-left: 1.15rem; line-height: 1.6; }
.grid-actions {
  display: grid;
  gap: .65rem;
  grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr));
}
.action-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: .9rem .85rem;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  transition: transform .15s ease, box-shadow .15s ease;
  min-width: 0;
}
.action-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.action-card span {
  display: inline-grid; place-items: center;
  width: 30px; height: 30px; border-radius: 9px;
  background: var(--red); color: #fff; font-weight: 800; margin-bottom: .5rem;
}
.action-card h3 {
  margin: 0 0 .2rem;
  font-family: var(--font-display);
  font-size: clamp(.92rem, 1.5vw, 1.05rem);
  line-height: 1.25;
}
.action-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: clamp(.75rem, 1.2vw, .85rem);
  line-height: 1.3;
}
@media (max-width: 900px) {
  .grid-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .grid-actions { grid-template-columns: 1fr; }
}
.fleet { list-style: none; padding: 0; margin: 0; }
.fleet li {
  display: flex; justify-content: space-between; align-items: center; gap: .85rem;
  padding: .85rem 0; border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.fleet-car {
  display: grid;
  gap: .45rem;
  min-width: 0;
}
.fleet-car strong {
  font-size: 1.05rem;
  letter-spacing: .01em;
}
.fleet-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .4rem .55rem;
}
.fleet-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-left: auto;
}
.fleet-status {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  width: fit-content;
  padding: .28rem .7rem .28rem .55rem;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .03em;
  line-height: 1.2;
  border: 1px solid transparent;
}
.fleet-status-dot {
  width: .55rem;
  height: .55rem;
  border-radius: 50%;
  flex: 0 0 auto;
}
.fleet-status.is-loaded {
  background: linear-gradient(180deg, #ecfdf3 0%, #d1fae5 100%);
  color: #047857;
  border-color: rgba(16, 185, 129, .35);
  box-shadow: 0 1px 0 rgba(255,255,255,.7) inset, 0 4px 10px rgba(16, 185, 129, .12);
}
.fleet-status.is-loaded .fleet-status-dot {
  background: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, .22);
}
.fleet-status.is-empty {
  background: #f8fafc;
  color: #64748b;
  border-color: #e2e8f0;
}
.fleet-status.is-empty .fleet-status-dot {
  background: #94a3b8;
}
.fleet-date {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  width: fit-content;
  padding: .26rem .65rem;
  border-radius: 999px;
  font-size: .85rem;
  line-height: 1.2;
  letter-spacing: .01em;
  background: #f8fafc;
  color: #475569;
  border: 1px solid #e2e8f0;
}
.fleet-date-label {
  font-weight: 650;
  opacity: .85;
}
.fleet-date-value {
  font-weight: 700;
  color: #334155;
  padding-left: .35rem;
  margin-left: .05rem;
  border-left: 1px solid #cbd5e1;
}
.fleet-date.is-load,
.fleet-date.is-move {
  background: #f8fafc;
  color: #475569;
  border-color: #e2e8f0;
  box-shadow: none;
}
.fleet-date.is-load .fleet-date-value,
.fleet-date.is-move .fleet-date-value {
  border-left-color: #cbd5e1;
  color: #334155;
}
.info .fleet-meta { display: inline-flex; margin-left: .5rem; vertical-align: middle; }
.info .fleet-status { vertical-align: middle; }
.info {
  background: var(--blue-soft);
  color: var(--blue-deep);
  padding: .85rem 1rem;
  border-radius: 12px;
  border: 1px solid rgba(10,71,143,.12);
}

.form-row { display: grid; gap: .8rem; }
@media (min-width: 700px) {
  .form-row { grid-template-columns: 200px 1fr; align-items: end; }
}
label { display: grid; gap: .35rem; font-size: .9rem; font-weight: 650; }
input, select, button { font: inherit; }
input, select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: .78rem .9rem;
  background: #fff;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, select:focus {
  outline: none;
  border-color: rgba(10,71,143,.45);
  box-shadow: 0 0 0 4px rgba(10,71,143,.12);
}
.toolbar-inline {
  display: flex; flex-wrap: wrap; gap: .55rem; margin-top: .55rem;
}
.btn {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  border-radius: 12px;
  padding: .75rem 1rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  font-weight: 700;
  min-height: 44px;
}
.btn.primary {
  background: linear-gradient(135deg, var(--red), var(--red-deep));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 8px 18px rgba(230, 0, 40, 0.25);
}
.btn.secondary {
  background: var(--blue);
  color: #fff;
  border-color: transparent;
}
.btn.ghost { background: transparent; }
.btn.block { width: 100%; }
.btn:active { transform: scale(.98); }
.table-head {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: .55rem;
  gap: .5rem; flex-wrap: wrap;
}
.table-head-tools {
  display: flex; align-items: center; gap: .4rem; flex-wrap: wrap;
}

.lines { display: grid; gap: .55rem; }
.line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .5rem .8rem;
  padding: .85rem .9rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: linear-gradient(180deg, #fff, #f8fafc);
  min-width: 0;
}
.line > div:first-child { min-width: 0; overflow-wrap: anywhere; }
.line .code { font-size: .76rem; color: var(--text-muted); font-weight: 700; }
.line .name { font-weight: 750; }
.qty-wrap { display: flex; align-items: center; gap: .35rem; }
.qty-wrap button {
  width: 42px; height: 42px; border-radius: 11px;
  border: 1px solid var(--border); background: #fff;
  font-size: 1.2rem; cursor: pointer; font-weight: 700;
}
.qty-wrap input {
  width: 78px; text-align: center; padding: .55rem .3rem;
  font-size: 1.08rem; font-weight: 800;
}
.line .stock { font-size: .78rem; color: var(--text-muted); grid-column: 1 / -1; }
.line .rm { color: var(--red); border: 0; background: transparent; cursor: pointer; font-size: 1rem; }

.item-picker { position: relative; z-index: 20; margin-bottom: .75rem; }
.item-picker-row {
  display: grid;
  gap: .65rem;
}
@media (min-width: 720px) {
  .item-picker-row {
    grid-template-columns: minmax(140px, 200px) 1fr;
    align-items: end;
  }
}
.cat-pick {
  display: grid;
  gap: .35rem;
  margin: 0;
  font-size: .85rem;
  font-weight: 700;
  color: var(--text-muted);
}
.cat-pick select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: .55rem .75rem;
  font: inherit;
  font-weight: 600;
  background: #fff;
  color: var(--ink);
}
.combo { position: relative; }

.combo-drop {
  position: absolute;
  left: 0; right: 0; top: calc(100% + 6px);
  max-height: min(58vh, 520px);
  overflow: auto;
  background: #fff;
  border: 1px solid rgba(10,71,143,.18);
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, .16);
  padding: .45rem;
  z-index: 30;
  width: 100%;
}
.combo-empty {
  padding: .9rem 1rem;
  color: var(--text-muted);
  font-size: .92rem;
}
.combo-item {
  display: grid;
  grid-template-columns: 1fr;
  gap: .55rem;
  align-items: stretch;
  padding: .8rem .85rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  margin-bottom: .4rem;
  background: #fff;
}
.combo-item:last-child { margin-bottom: 0; }
.combo-item:hover, .combo-item.is-in-cart {
  background: var(--blue-soft);
  border-color: rgba(10,71,143,.18);
}
.combo-meta { min-width: 0; }
.combo-meta strong {
  display: block;
  font-size: 1rem;
  line-height: 1.3;
}
.combo-meta small {
  color: var(--text-muted);
  font-size: .8rem;
}
.combo-qty {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 48px minmax(64px, 1fr);
  gap: .35rem;
  width: 100%;
  max-width: 100%;
  align-items: stretch;
}
.combo-qty button {
  width: 100%;
  min-height: 48px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
  font-weight: 800;
  font-size: 1.35rem;
  cursor: pointer;
}
.combo-qty input {
  width: 100%;
  min-height: 48px;
  text-align: center;
  padding: .45rem .3rem;
  font-weight: 800;
  font-size: 1.2rem;
  border-radius: 12px;
  border: 1px solid var(--border);
}
.combo-qty .combo-add {
  width: 100%;
  padding: 0 .75rem;
  background: var(--blue);
  color: #fff;
  border-color: transparent;
  font-size: 1rem;
  letter-spacing: .02em;
}

.docs-list { display: grid; gap: .55rem; }
.docs-filter-card { margin-bottom: .15rem; }
.docs-filter { display: grid; gap: .65rem; }
.docs-filter-fields {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem 1rem;
  align-items: end;
}
.docs-filter-fields label {
  display: grid;
  gap: .3rem;
  min-width: min(100%, 11rem);
  flex: 1 1 10rem;
}
.docs-filter-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  align-items: center;
}
.docs-filter-hint { margin: 0; }
.doc-row {
  display: flex; justify-content: space-between; gap: .75rem; align-items: center;
  padding: .85rem .95rem; border: 1px solid var(--border); border-radius: 14px;
  background: #fff; flex-wrap: wrap;
}
.doc-actions { display: flex; gap: .4rem; flex-wrap: wrap; }

.driver-route { align-items: flex-start; }
.driver-route-main { display: grid; gap: .35rem; width: 100%; }
.driver-route-rule { margin: .15rem 0 0; font-weight: 700; }
.driver-prefix {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.6rem;
  padding: .1rem .4rem;
  margin: 0 .15rem;
  border-radius: 999px;
  background: var(--red-soft);
  color: var(--red-deep);
  font-weight: 800;
}
.driver-cust {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  list-style: none;
  margin: .4rem 0 0;
  padding: 0;
}
.driver-cust li {
  background: var(--gray-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .22rem .65rem;
  font-size: .82rem;
  font-weight: 650;
}

.toast {
  position: fixed; left: 50%; bottom: 5.5rem; transform: translateX(-50%);
  background: var(--blue-deep); color: #fff;
  padding: .8rem 1.2rem; border-radius: 999px; z-index: 80;
  max-width: 92vw; box-shadow: var(--shadow-lg);
}
.toast.err { background: var(--red-deep); }

.hero-sub { margin: 0; opacity: .9; position: relative; z-index: 1; }
.screen-card { padding-bottom: 1.25rem; }
.screen-head {
  display: flex; flex-wrap: wrap; gap: 1rem;
  justify-content: space-between; align-items: flex-end;
  margin-bottom: .85rem;
}
.screen-head.compact {
  align-items: center;
  margin-bottom: .65rem;
  gap: .65rem 1rem;
}
.screen-head.compact h2 { margin: 0; font-size: clamp(1.15rem, 2.2vw, 1.35rem); }
.screen-head h2 { margin: 0 0 .2rem; }
.screen-head-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: .45rem .55rem;
}
.screen-head-tools .btn {
  min-height: 44px;
  white-space: nowrap;
}
.car-pick { min-width: min(180px, 100%); flex: 1 1 140px; }
.order-block .table-head { margin-bottom: .5rem; }
.lines-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: .75rem;
  margin-top: .85rem;
  padding: .9rem 1rem;
  border-top: 2px solid var(--border);
  font-size: 1.05rem;
}
.lines-total span { font-weight: 650; color: var(--text-muted); }
.lines-total strong {
  font-size: 1.25rem;
  font-weight: 850;
  letter-spacing: -.02em;
  color: var(--text);
}
.cust-block {
  display: grid;
  gap: .4rem;
  margin: 0 0 .85rem;
}
.cust-label {
  margin: 0;
  font-size: .9rem;
  font-weight: 700;
}
.cust-combo #custSearch {
  min-height: 48px;
  font-size: 1.02rem;
}
.cust-selected {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding: .7rem .85rem;
  border-radius: 12px;
  border: 1px solid rgba(10,71,143,.16);
  background: var(--blue-soft);
  font-weight: 750;
  min-width: 0;
}
.cust-selected span {
  min-width: 0;
  overflow-wrap: anywhere;
}
.cust-item {
  width: 100%;
  text-align: left;
  cursor: pointer;
  background: #fff;
}
.btn.small-btn {
  min-height: 36px;
  padding: .35rem .65rem;
  flex-shrink: 0;
}
.sale-picker #itemSearch {
  min-height: 50px;
  font-size: 1.05rem;
}
.quick-actions {
  display: grid; gap: .55rem; margin-bottom: .85rem;
}
.quick-actions.single { grid-template-columns: 1fr; }
@media (min-width: 640px) {
  .quick-actions:not(.single) { grid-template-columns: 1.2fr .8fr; }
}
.action-card span { display: none; }
.search-label { display: grid; gap: .35rem; margin: 0; }
.btn.big {
  min-height: 52px;
  font-size: 1.02rem;
  padding: .9rem 1.15rem;
}
.sticky-bar {
  position: sticky;
  bottom: 0;
  z-index: 35;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  display: flex;
  flex-wrap: wrap;
  gap: .55rem;
  padding: .7rem .85rem calc(.7rem + env(safe-area-inset-bottom, 0px));
  margin: 0;
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 -10px 28px rgba(15, 23, 42, 0.08);
  backdrop-filter: blur(8px);
}
.sticky-bar .btn {
  flex: 1 1 calc(50% - .3rem);
  min-width: 0;
}
.sticky-bar .btn.primary { flex: 1 1 100%; }
.panel-area { padding-bottom: .35rem; }
.fleet li .btn { min-height: 36px; padding: .4rem .7rem; font-size: .85rem; }
.fleet-actions .btn { white-space: nowrap; }

@media (min-width: 640px) {
  .sticky-bar .btn { flex: 1 1 140px; }
  .sticky-bar .btn.primary { flex: 2 1 220px; }
}

@media (max-width: 900px) {
  .dashboard-frame {
    display: block;
  }
  .sidebar {
    position: fixed;
    left: 0; top: 0;
    transform: translateX(-105%);
    transition: transform .22s ease;
    width: min(var(--sidebar-w), 86vw);
    max-width: 86vw;
    flex: none;
    height: 100%;
    height: 100dvh;
  }
  .sidebar.sidebar--open { transform: translateX(0); }
  .mobile-menu-btn { display: inline-flex; flex-shrink: 0; }
  .top-actions .user-chip:not(.accent):not(.user-chip-logout):not(.tv-status) { display: none; }
  .tv-status {
    font-size: .72rem;
    padding: .32rem .6rem .32rem .45rem;
    white-space: normal;
    max-width: 100%;
  }
  .dashboard-content {
    width: 100%;
    max-width: 100%;
    padding: .55rem .5rem .75rem;
    gap: .85rem;
  }
  .top-bar {
    padding: .75rem .85rem;
    gap: .65rem;
  }
  .top-bar-title {
    font-size: 1.05rem;
  }
  .card, .hero-panel {
    padding: .85rem .9rem;
  }
  .combo-qty {
    grid-template-columns: 44px minmax(0, 1fr) 44px minmax(56px, .95fr);
  }
  .combo-qty button,
  .combo-qty input {
    min-height: 44px;
  }
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(8, 12, 20, .55);
  display: grid;
  place-items: center;
  padding: 1rem;
}
.modal-overlay[hidden] { display: none !important; }
.tv-unmapped-card {
  width: min(720px, 100%);
  max-height: min(80vh, 720px);
  overflow: auto;
}
.modal-card.tv-unmapped-card {
  width: min(720px, 100%);
}
.modal-card {
  width: min(420px, 100%);
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 1.15rem 1.2rem;
  display: grid;
  gap: .75rem;
}
.modal-card h3 { margin: 0; font-family: var(--font-display); }
.modal-card label { display: grid; gap: .35rem; font-weight: 700; font-size: .9rem; }
.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  justify-content: flex-end;
  margin-top: .25rem;
}
.modal-actions .btn { min-width: 110px; }

.jobs-lead { margin: 0 0 1rem; font-size: 1rem; line-height: 1.45; }
.jobs-grid {
  display: grid;
  gap: 1rem;
}
@media (min-width: 800px) {
  .jobs-grid { grid-template-columns: 1fr 1fr; }
}
.job-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1rem 1.1rem 1.15rem;
  display: grid;
  gap: .7rem;
  background: #fff;
}
.job-card.is-off { opacity: .62; }
.job-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
}
.job-card-head h3 { margin: 0; font-family: var(--font-display); }
.job-switch, .job-check {
  display: flex;
  align-items: center;
  gap: .55rem;
  font-weight: 700;
}
.job-switch input,
.job-check input {
  width: 1.25rem;
  height: 1.25rem;
  margin: 0;
  flex: 0 0 auto;
  accent-color: var(--red, #E60028);
}
.job-card input[type="time"] {
  max-width: 10.5rem;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: .02em;
}
.job-next {
  margin: 0;
  padding: .7rem .85rem;
  border-radius: 12px;
  background: var(--gray-soft);
  font-weight: 750;
}
.jobs-save { margin-top: 1rem; }

.orders-total-banner {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: .75rem;
  margin: 0 0 .75rem;
  padding: .95rem 1.05rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--gray-soft);
  font-weight: 700;
}
.orders-total-banner.is-alert {
  border-color: rgba(230, 0, 40, .35);
  background: var(--red-soft);
  color: var(--red-deep);
}
.orders-total-banner strong {
  font-size: 1.35rem;
  font-weight: 850;
  letter-spacing: -.02em;
}
.orders-summary {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: .75rem;
  margin: 0 0 .35rem;
  font-weight: 650;
}
.orders-summary strong {
  font-size: 1.2rem;
  font-weight: 850;
}
.orders-summary strong.is-alert,
.orders-total-banner.is-alert strong {
  color: var(--red, #E60028);
}
.orders-toolbar {
  display: flex;
  align-items: center;
  margin: .55rem 0 .45rem;
}
.orders-check-all {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  font-weight: 700;
  cursor: pointer;
}
.orders-list { display: grid; gap: .5rem; }
.order-row {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .85rem .95rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  cursor: pointer;
}
.order-row:active { background: var(--gray-soft); }
.order-row.is-invoiced {
  opacity: .72;
  cursor: default;
}
.order-check, .order-check-spacer {
  flex: 0 0 1.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.order-check input {
  width: 1.2rem;
  height: 1.2rem;
  accent-color: var(--red, #E60028);
}
.order-row-main { min-width: 0; flex: 1; display: grid; gap: .2rem; }
.order-row-main strong {
  overflow-wrap: anywhere;
}
.order-row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem .75rem;
  color: var(--text-muted);
  font-weight: 650;
  font-size: .92rem;
}
.order-tag {
  color: var(--blue, #0a478f);
  font-weight: 800;
}
.composer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: 1rem;
}
.composer-actions .btn { flex: 1 1 140px; }
.sale-composer[hidden], .orders-board[hidden] { display: none !important; }

/* ——— PWA standalone safe areas (iOS) ——— */
body.pwa-standalone {
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
body.pwa-standalone .sticky-bar {
  padding-bottom: calc(.7rem + env(safe-area-inset-bottom, 0px));
}
body.pwa-standalone .sidebar {
  padding-top: env(safe-area-inset-top, 0px);
}
