:root {
  --bg: #f4f6f8; --surface: #fff; --surface-soft: #f8fafc; --text: #16202a;
  --muted: #647180; --line: #dde3e9; --primary: #1f5f8b; --primary-dark: #174a6d;
  --danger: #b42318; --radius: 12px; --shadow: 0 8px 30px rgba(21,32,43,.07);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--text); background: var(--bg);
}
* { box-sizing: border-box; }
body { min-height: 100vh; margin: 0; background: var(--bg); }
a { color: inherit; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.topbar {
  min-height: 68px; padding: 0 4vw; display: flex; align-items: center; gap: 28px;
  background: #132a3a; color: #fff; box-shadow: 0 3px 14px rgba(11,26,36,.18);
}
.brand {
  display: inline-flex; align-items: center; gap: 10px; margin-right: auto;
  font-weight: 750; text-decoration: none; white-space: nowrap;
}
.brand-mark {
  width: 34px; height: 34px; display: inline-grid; place-items: center; flex: 0 0 auto;
  border-radius: 9px; background: #2b80b8; color: #fff; font-size: 13px; letter-spacing: .04em;
}
.brand-mark-large { width: 48px; height: 48px; border-radius: 12px; font-size: 17px; }
.main-nav { display: flex; align-items: center; gap: 20px; }
.main-nav > a:not(.button) {
  color: #d8e2e9; font-size: 14px; font-weight: 650; text-decoration: none;
}
.main-nav > a:hover { color: #fff; }
.page-shell { width: min(1200px,92vw); margin: 0 auto; padding: 42px 0 64px; }
.auth-body {
  display: flex; flex-direction: column;
  background: radial-gradient(circle at top left,rgba(43,128,184,.16),transparent 36%),#eef2f5;
}
.auth-shell { width: min(460px,92vw); margin: auto; padding: 56px 0; }
.auth-card {
  padding: 34px; border: 1px solid var(--line); border-radius: 18px;
  background: var(--surface); box-shadow: var(--shadow);
}
.auth-heading { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 28px; }
.auth-heading h1 { margin: 2px 0 8px; }
.auth-heading p:last-child { margin: 0; color: var(--muted); line-height: 1.5; }
.footer {
  width: min(1200px,92vw); margin: auto auto 0; padding: 24px 0;
  display: flex; justify-content: space-between; gap: 20px; color: var(--muted); font-size: 12px;
}
.page-header {
  margin-bottom: 26px; display: flex; justify-content: space-between; align-items: flex-end; gap: 24px;
}
.page-header h1 { margin: 2px 0 5px; font-size: clamp(27px,4vw,38px); }
.page-header p { margin: 0; color: var(--muted); }
.eyebrow {
  margin: 0; color: var(--primary); font-size: 12px; font-weight: 800;
  letter-spacing: .1em; text-transform: uppercase;
}
.header-actions { display: flex; gap: 10px; }
.button {
  min-height: 42px; padding: 0 17px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid transparent; border-radius: 9px; font-weight: 720; font-size: 14px;
  text-decoration: none; transition: 150ms ease;
}
.button:hover { transform: translateY(-1px); }
.button-primary { background: var(--primary); color: #fff; }
.button-primary:hover { background: var(--primary-dark); }
.button-secondary { border-color: #bfd0dc; background: #eef5f9; color: #164e72; }
.button-ghost { border-color: var(--line); background: transparent; color: inherit; }
.topbar .button-ghost { border-color: #506573; color: #e8f0f5; }
.button-danger { border-color: #efc6c2; background: #fff2f0; color: var(--danger); }
.button-small { min-height: 36px; padding: 0 13px; font-size: 13px; }
.button-block { width: 100%; }
.alert {
  margin-bottom: 22px; padding: 13px 15px; border: 1px solid;
  border-radius: 9px; font-size: 14px; line-height: 1.45;
}
.alert ul { margin: 8px 0 0; padding-left: 20px; }
.alert-success { border-color: #a9dac2; background: #eaf8f1; color: #11633d; }
.alert-error { border-color: #efc0bc; background: #fff1f0; color: #8f241c; }
.stack-form, .truck-form { display: grid; gap: 18px; }
label { display: grid; gap: 7px; color: #354351; font-size: 13px; font-weight: 720; }
input, select, textarea {
  width: 100%; padding: 11px 12px; border: 1px solid #cbd4dc; border-radius: 8px;
  outline: none; background: #fff; color: var(--text); font-weight: 450;
}
textarea { resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus {
  border-color: #4387b6; box-shadow: 0 0 0 3px rgba(43,128,184,.12);
}
.metric-grid {
  margin-bottom: 28px; display: grid; grid-template-columns: repeat(5,1fr); gap: 14px;
}
.metric-card {
  min-height: 130px; padding: 20px; display: flex; flex-direction: column; justify-content: space-between;
  border: 1px solid var(--line); border-top: 4px solid #768391; border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow);
}
.metric-card span { color: var(--muted); font-size: 13px; font-weight: 680; }
.metric-card strong { font-size: 34px; }
.metric-green { border-top-color: #27a66a; } .metric-amber { border-top-color: #db9418; }
.metric-blue { border-top-color: #3b82b5; } .metric-red { border-top-color: #c95850; }
.panel {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow); overflow: hidden;
}
.panel + .panel { margin-top: 20px; }
.panel-header {
  padding: 20px 22px; display: flex; align-items: center; justify-content: space-between;
  gap: 18px; border-bottom: 1px solid var(--line);
}
.panel-header h2 { margin: 0 0 4px; font-size: 18px; }
.panel-header p { margin: 0; color: var(--muted); font-size: 13px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
th, td { padding: 15px 18px; border-bottom: 1px solid #e8edf1; text-align: left; font-size: 13px; }
th {
  background: var(--surface-soft); color: var(--muted); font-size: 11px;
  letter-spacing: .05em; text-transform: uppercase;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfcfd; }.text-link { color: var(--primary); font-size: 13px; font-weight: 750; text-decoration: none; }
.text-link:hover { text-decoration: underline; }
.mono { font-family: "SFMono-Regular",Consolas,monospace; letter-spacing: .03em; }
.row-actions { display: flex; gap: 14px; }
.truck-cell { display: flex; align-items: center; gap: 11px; }
.truck-cell div { display: grid; gap: 3px; }
.truck-cell small { color: var(--muted); }
.truck-thumb {
  width: 39px; height: 39px; display: grid; place-items: center;
  border-radius: 9px; background: #eaf1f5; font-size: 19px;
}
.status {
  padding: 5px 9px; display: inline-block; border-radius: 999px; font-size: 11px; font-weight: 800;
}
.status-available { background: #e2f5eb; color: #146c43; }
.status-reserved { background: #fff1cf; color: #865600; }
.status-sold { background: #e5f0f8; color: #1b5d89; }
.status-maintenance { background: #ffe7e4; color: #982d24; }
.status-inactive { background: #eaedf0; color: #59636d; }
.filter-bar {
  margin-bottom: 18px; padding: 16px; display: grid;
  grid-template-columns: minmax(230px,2fr) repeat(3,minmax(120px,1fr)) auto auto;
  align-items: end; gap: 12px; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--surface);
}
.filter-bar label span { font-size: 12px; }
.filter-bar input, .filter-bar select { padding: 9px 10px; }
.empty-state { padding: 54px 24px; text-align: center; }
.empty-state h3, .empty-state h1 { margin: 0 0 8px; }
.empty-state p { margin: 0 0 20px; color: var(--muted); }
.empty-state.standalone { width: min(560px,100%); margin: 8vh auto; }
.error-code { color: #b9c4cc; font-size: 64px; font-weight: 850; }
.form-section { overflow: visible; }
.form-grid {
  padding: 22px; display: grid; grid-template-columns: 1fr 1fr; gap: 19px;
}
.span-2 { grid-column: span 2; }
.upload-placeholder {
  margin: 22px; padding: 35px; display: grid; justify-items: center; gap: 7px;
  border: 1px dashed #afbdc8; border-radius: 10px; background: var(--surface-soft);
  color: var(--muted); text-align: center;
}
.upload-placeholder span { font-size: 28px; }
.upload-placeholder strong { color: var(--text); }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; }
.detail-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 20px; }
.detail-grid .panel { margin: 0; }
.truck-hero { grid-row: span 2; }
.truck-placeholder {
  min-height: 320px; display: grid; place-content: center; justify-items: center; gap: 10px;
  background: linear-gradient(140deg,#e8eef2,#f7f9fa); color: var(--muted);
}
.truck-placeholder span { font-size: 84px; filter: grayscale(.25); }
.truck-summary { padding: 25px; }
.truck-summary .price { margin: 15px 0 8px; display: block; font-size: 28px; }
.truck-summary p, .long-text { color: #465462; line-height: 1.65; white-space: pre-line; }
.detail-list {
  margin: 0; padding: 8px 22px 20px; display: grid;
  grid-template-columns: 1fr 1fr; gap: 0 28px;
}
.detail-list div { padding: 13px 0; border-bottom: 1px solid #edf0f3; }
.detail-list dt {
  margin-bottom: 5px; color: var(--muted); font-size: 11px;
  font-weight: 750; text-transform: uppercase;
}
.detail-list dd { margin: 0; font-size: 14px; font-weight: 650; }
.long-text { margin: 0; padding: 20px 22px; }
.danger-zone {
  margin-top: 22px; padding: 20px 22px; display: flex; justify-content: space-between;
  align-items: center; gap: 20px; border: 1px solid #efcbc8;
  border-radius: var(--radius); background: #fffafa;
}
.danger-zone p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
@media (max-width: 950px) {
  .metric-grid { grid-template-columns: repeat(2,1fr); }
  .filter-bar { grid-template-columns: 1fr 1fr; }
  .filter-search { grid-column: span 2; }
  .detail-grid { grid-template-columns: 1fr; }
  .truck-hero { grid-row: auto; }
}
@media (max-width: 720px) {
  .topbar { padding: 13px 4vw; flex-wrap: wrap; gap: 13px; }
  .brand { width: calc(100% - 65px); }
  .main-nav { width: 100%; order: 3; overflow-x: auto; }
  .main-nav .button { display: none; }
  .page-shell { padding-top: 28px; }
  .page-header { align-items: flex-start; flex-direction: column; }
  .header-actions { width: 100%; }
  .header-actions .button { flex: 1; }
  .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .footer { flex-direction: column; }
  .danger-zone { align-items: stretch; flex-direction: column; }
}
@media (max-width: 520px) {
  .metric-grid, .filter-bar { grid-template-columns: 1fr; }
  .filter-search { grid-column: auto; }
  .filter-bar .button { width: 100%; }
  .auth-card { padding: 25px; }
  .detail-list { grid-template-columns: 1fr; }
}
/* Dashboard chart */
.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(320px, .75fr) minmax(0, 1.5fr);
  gap: 20px;
}
.dashboard-grid .panel { margin-top: 0; }
.chart-content {
  padding: 24px;
  display: grid;
  grid-template-columns: 190px 1fr;
  align-items: center;
  gap: 24px;
}
.donut-chart { position: relative; width: 190px; height: 190px; }
.donut-chart svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
  overflow: visible;
}
.donut-track, .donut-segment { fill: none; stroke-width: 13; }
.donut-track { stroke: #edf1f4; }
.donut-segment { stroke-linecap: butt; }
.donut-segment-available { stroke: #27a66a; }
.donut-segment-reserved { stroke: #db9418; }
.donut-segment-sold { stroke: #3b82b5; }
.donut-segment-maintenance { stroke: #c95850; }
.donut-segment-inactive { stroke: #8a96a1; }
.donut-total {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  pointer-events: none;
}
.donut-total strong { font-size: 34px; line-height: 1; }
.donut-total span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.chart-legend { margin: 0; padding: 0; display: grid; gap: 13px; list-style: none; }
.chart-legend li {
  display: grid;
  grid-template-columns: 10px minmax(90px, 1fr) auto 44px;
  align-items: center;
  gap: 9px;
  font-size: 12px;
}
.chart-legend strong { font-size: 14px; text-align: right; }
.chart-legend small { color: var(--muted); text-align: right; }
.legend-dot { width: 9px; height: 9px; border-radius: 50%; }
.legend-dot-available { background: #27a66a; }
.legend-dot-reserved { background: #db9418; }
.legend-dot-sold { background: #3b82b5; }
.legend-dot-maintenance { background: #c95850; }
.legend-dot-inactive { background: #8a96a1; }

@media (max-width: 950px) {
  .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .chart-content { grid-template-columns: 1fr; justify-items: center; }
  .chart-legend { width: 100%; }
}