:root {
  color-scheme: light;
  --ink: #080b12;
  --muted: #667085;
  --soft: #98a2b3;
  --line: #e5e7eb;
  --panel: #ffffff;
  --page: #f6f8fb;
  --nav: #08111f;
  --nav-2: #0e1a2f;
  --primary: #13294b;
  --primary-strong: #0b1a33;
  --primary-soft: #eaf0f8;
  --black: #050608;
  --green: #16a34a;
  --yellow: #d6a600;
  --red: #dc2626;
  --shadow: 0 16px 42px rgba(10, 18, 32, 0.08);
  --shadow-soft: 0 8px 24px rgba(10, 18, 32, 0.06);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--page);
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(19, 41, 75, 0.08), transparent 34rem),
    var(--page);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

.hidden {
  display: none !important;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(8, 17, 31, 0.96), rgba(19, 41, 75, 0.92)),
    linear-gradient(45deg, #08111f, #13294b);
}

.login-panel {
  width: min(420px, 100%);
  padding: 34px;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 12px;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.24);
}

.brand-lockup,
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: inline-grid;
  place-items: center;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  font-weight: 900;
  letter-spacing: 0;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.brand-lockup h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1;
}

.brand-lockup p,
.login-hint,
.eyebrow,
.panel-heading span,
.metric-card small {
  margin: 0;
  color: var(--muted);
}

.login-form,
.crud-form {
  display: grid;
  gap: 14px;
  margin-top: 28px;
}

label {
  display: grid;
  gap: 7px;
  color: #263244;
  font-size: 12px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

input::placeholder {
  color: #98a2b3;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #2b4c7e;
  box-shadow: 0 0 0 4px rgba(19, 41, 75, 0.12);
}

textarea {
  resize: vertical;
}

.primary-action,
.secondary-action,
.ghost-action,
.nav-item,
.icon-action {
  border: 0;
  border-radius: 8px;
  min-height: 42px;
  padding: 0 14px;
  font-weight: 850;
}

.primary-action {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 10px 20px rgba(19, 41, 75, 0.16);
}

.primary-action:hover {
  background: var(--primary-strong);
}

.secondary-action {
  background: var(--black);
  color: #fff;
}

.ghost-action {
  width: 100%;
  margin-top: auto;
  background: transparent;
  color: #e9eef7;
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.user-chip {
  display: grid;
  gap: 2px;
  margin-top: auto;
  padding: 11px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-weight: 850;
}

.user-chip small {
  color: #b8c5d8;
  font-size: 12px;
  font-weight: 700;
}

.user-chip + .ghost-action {
  margin-top: 0;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 22px;
  background: linear-gradient(180deg, var(--nav), var(--nav-2));
  color: #fff;
}

.sidebar-brand {
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 22px;
}

.nav-list {
  display: grid;
  gap: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  justify-content: flex-start;
  min-height: 42px;
  background: transparent;
  color: #c7d2e4;
  text-align: left;
  transition: background 150ms ease, color 150ms ease;
}

.nav-icon {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.09);
  color: currentColor;
}

.nav-icon svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-item.active,
.nav-item:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.nav-item.active .nav-icon {
  background: #fff;
  color: var(--primary);
}

.content-shell {
  min-width: 0;
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.topbar h2 {
  margin: 3px 0 0;
  font-size: 30px;
  line-height: 1.1;
  letter-spacing: 0;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 12px;
  font-weight: 900;
}

.metric-grid,
.dashboard-grid,
.crud-page,
.admin-grid {
  display: grid;
  gap: 16px;
}

.metric-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 16px;
}

.metric-card,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-soft);
}

.metric-card {
  padding: 18px;
}

.metric-card span,
.metric-card small {
  display: block;
}

.metric-card span {
  color: #344054;
  font-size: 13px;
  font-weight: 800;
}

.metric-card strong {
  display: block;
  margin: 8px 0 6px;
  font-size: 30px;
  letter-spacing: 0;
}

.dashboard-grid {
  grid-template-columns: minmax(300px, 0.82fr) minmax(340px, 1.18fr);
}

.crud-page,
.admin-grid {
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
}

.single-crud {
  align-items: start;
}

.panel {
  padding: 18px;
}

.panel h3 {
  margin: 0 0 14px;
  font-size: 18px;
}

.panel-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.panel-heading h3 {
  margin-bottom: 0;
}

.donut-wrap {
  position: relative;
  width: min(260px, 74vw);
  aspect-ratio: 1;
  margin: 10px auto 18px;
}

.donut {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: conic-gradient(var(--green) 0 33%, var(--yellow) 33% 66%, var(--red) 66% 100%);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.04);
}

.donut::after {
  content: "";
  position: absolute;
  inset: 18%;
  border-radius: 50%;
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--line);
}

.donut-center {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  pointer-events: none;
}

.donut-center strong {
  font-size: 34px;
}

.donut-center span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.legend {
  display: grid;
  gap: 9px;
}

.legend span {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  color: #344054;
  font-size: 14px;
}

.legend i {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-right: 8px;
}

.legend b {
  margin-left: auto;
}

.green {
  background: var(--green);
}

.yellow {
  background: var(--yellow);
}

.red {
  background: var(--red);
}

.recent-list,
.tracking-results,
.stock-grid,
.plate-card-grid,
.route-line {
  display: grid;
  gap: 10px;
}

.plate-card-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.plate-card {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow-soft);
  transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.plate-card:hover {
  transform: translateY(-2px);
  border-color: #c7d2e4;
  box-shadow: var(--shadow);
}

.plate-card-top,
.plate-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.plate-card-top strong {
  font-size: 22px;
}

.plate-card-meta {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.tracking-detail {
  display: grid;
  gap: 16px;
}

.back-link {
  width: fit-content;
  color: var(--primary);
  font-weight: 900;
}

.detail-hero {
  display: grid;
  gap: 16px;
}

.detail-title {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.detail-title h2 {
  margin: 0;
  font-size: 34px;
}

.detail-grid,
.detail-two-col {
  display: grid;
  gap: 12px;
}

.detail-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.detail-two-col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.detail-grid div,
.info-list span {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.detail-grid strong,
.info-list strong {
  color: var(--ink);
  font-size: 14px;
}

.info-list {
  display: grid;
  gap: 8px;
}

.plain-text {
  margin: 0;
  color: #344054;
  line-height: 1.55;
}

.period-filter {
  display: grid;
  grid-template-columns: repeat(2, minmax(160px, 1fr)) repeat(4, auto);
  align-items: end;
  gap: 10px;
  margin-bottom: 14px;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.photo-grid img {
  width: 100%;
  aspect-ratio: 1.2;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafc;
}

.history-table {
  margin-top: 14px;
}

.history-table table {
  min-width: 1180px;
}

.route-view {
  margin-bottom: 16px;
}

.route-panel {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fafc;
}

.route-point {
  position: relative;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  padding: 10px 0;
}

.route-point:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 16px;
  top: 44px;
  bottom: -12px;
  width: 2px;
  background: #cbd5e1;
}

.route-dot {
  position: relative;
  z-index: 1;
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}

.route-point strong {
  display: block;
  margin-bottom: 3px;
}

.route-point p {
  margin: 0 0 4px;
  color: #344054;
}

.route-point small {
  color: var(--muted);
}

.record-item,
.stock-card {
  display: grid;
  gap: 8px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.record-top,
.stock-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.record-title,
.stock-code {
  font-weight: 900;
}

.record-meta,
.muted-line {
  color: var(--muted);
  font-size: 13px;
}

.battery {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 900;
  font-size: 12px;
}

.search-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  align-items: end;
  gap: 12px;
  margin-bottom: 16px;
}

.data-table {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 650px;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  font-size: 14px;
}

th {
  color: #475467;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.table-actions {
  display: flex;
  gap: 7px;
}

.icon-action {
  min-width: 36px;
  min-height: 34px;
  padding: 0 8px;
  background: #eef2f7;
  color: #182230;
}

.icon-action.danger {
  background: #fff1f1;
  color: #b42318;
}

.stock-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.tag-label {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 26px;
  padding: 0 9px;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  background: #f8fafc;
  color: #182230;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
  font-weight: 900;
}

.setting-list {
  display: grid;
  gap: 12px;
}

.setting-list label {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 10px;
  font-weight: 700;
}

.setting-list input {
  width: 18px;
  min-height: 18px;
}

.report-builder {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.report-fields-wrap {
  display: grid;
  gap: 10px;
}

.field-title {
  color: #263244;
  font-size: 12px;
  font-weight: 900;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.check-card {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafc;
  color: #263244;
}

.check-card input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--primary);
}

.report-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.report-output {
  min-height: 88px;
}

.empty-state {
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 1080px) {
  .metric-grid,
  .dashboard-grid,
  .crud-page,
  .admin-grid,
  .stock-grid,
  .plate-card-grid,
  .detail-grid,
  .report-builder,
  .photo-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .field-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  body {
    padding-bottom: calc(78px + env(safe-area-inset-bottom));
  }

  .login-shell {
    padding: 18px;
    align-items: end;
  }

  .login-panel {
    padding: 24px;
    border-radius: 16px;
  }

  .app-shell {
    display: block;
  }

  .sidebar {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    z-index: 20;
    display: block;
    padding: 7px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 18px;
    box-shadow: 0 22px 60px rgba(5, 6, 8, 0.28);
  }

  .sidebar-brand,
  .user-chip,
  .ghost-action {
    display: none;
  }

  .nav-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
  }

  .nav-item {
    min-height: 54px;
    display: grid;
    justify-items: center;
    align-content: center;
    gap: 4px;
    padding: 0 8px;
    font-size: 11px;
    border-radius: 12px;
  }

  .nav-icon {
    width: 26px;
    height: 24px;
    background: transparent;
  }

  .nav-icon svg {
    width: 20px;
    height: 20px;
  }

  .nav-item.active .nav-icon {
    background: transparent;
  }

  .content-shell {
    padding: 18px;
  }

  .topbar,
  .topbar-actions,
  .panel-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar h2 {
    font-size: 26px;
  }

  .metric-grid,
  .dashboard-grid,
  .crud-page,
  .admin-grid,
  .stock-grid,
  .plate-card-grid,
    .detail-grid,
    .detail-two-col,
    .photo-grid,
    .report-builder,
    .field-grid,
    .period-filter,
    .search-row {
    grid-template-columns: 1fr;
  }

  .metric-card,
  .panel {
    border-radius: 14px;
  }

  table {
    min-width: 720px;
  }
}

.field-hint { display:block; margin-top:4px; color:#64748b; font-size:12px; }

.alert-item {
  border-left: 4px solid var(--red);
  background: #fff7f7;
}

.battery-low {
  color: #991b1b;
  background: #fee2e2;
  padding: 4px 8px;
  border-radius: 999px;
  font-weight: 900;
}

.map-filter {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr)) auto auto;
  gap: 12px;
  align-items: end;
  margin: 14px 0 18px;
}

.ghost-light {
  min-height: 42px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--primary);
  font-weight: 850;
}

.map-view {
  width: 100%;
  height: min(64vh, 620px);
  min-height: 420px;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: #eef2f7;
  box-shadow: var(--shadow-soft);
}

.vehicle-pin {
  display: grid;
  place-items: center;
  border-radius: 999px 999px 999px 4px;
  background: #10264a;
  color: #fff;
  border: 2px solid #fff;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.22);
  transform: rotate(-45deg);
}

.vehicle-pin span {
  display: inline-block;
  max-width: 58px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transform: rotate(45deg);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
}

.vehicle-pin-ok {
  background: #10264a;
}

.vehicle-pin-warn {
  background: #a16207;
}

.vehicle-pin-low {
  background: #b42318;
}

.map-popup {
  display: grid;
  gap: 3px;
  min-width: 150px;
}

.map-popup strong {
  font-size: 15px;
}

.map-popup span,
.map-popup small {
  color: #475467;
}

.map-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.map-position-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 13px;
  background: #fff;
  display: grid;
  gap: 5px;
}

.map-card-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.map-card-main span {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 12px;
  font-weight: 900;
}

.map-position-card span,
.map-position-card small {
  color: var(--muted);
}

.map-position-card p {
  margin: 0;
  color: var(--ink);
}

@media (max-width: 860px) {
  .map-filter {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 8px 0 12px;
  }

  .map-filter label {
    grid-column: 1 / -1;
  }

  .map-view {
    height: calc(100vh - 306px);
    min-height: 390px;
    border-radius: 16px;
  }

  .map-list {
    grid-template-columns: 1fr;
    gap: 8px;
    margin-top: 10px;
  }

  .map-position-card {
    padding: 12px;
    gap: 4px;
  }

  .map-position-card p {
    display: -webkit-box;
    overflow: hidden;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }
}

.install-action {
  min-height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 12px;
  background: #10264a;
  color: #fff;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(15, 23, 42, .16);
}

.install-action[hidden] {
  display: none !important;
}

.install-card {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f8fafc;
  display: grid;
  gap: 8px;
}

.install-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.install-card small {
  color: var(--muted);
  line-height: 1.35;
}

@media (max-width: 720px) {
  .topbar-actions {
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .install-action,
  .secondary-action {
    min-height: 42px;
  }
}
