: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-logo {
  width: 46px;
  height: 46px;
  display: block;
  flex: 0 0 46px;
  object-fit: contain;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.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);
}

.danger-action {
  width: 100%;
  min-height: 44px;
  border: 0;
  border-radius: 10px;
  background: #fee4e2;
  color: #b42318;
  font-weight: 900;
  cursor: pointer;
}

.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;
  position: relative;
}

.notification-trigger {
  position: relative;
  width: 44px;
  min-width: 44px;
  padding: 0;
}

.notification-count {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 19px;
  height: 19px;
  display: inline-grid;
  place-items: center;
  padding: 0 5px;
  border: 2px solid #fff;
  border-radius: 999px;
  background: #e11d48;
  color: #fff;
  font-size: 10px;
  font-weight: 900;
}

.notification-popover {
  position: fixed;
  top: 92px;
  right: 28px;
  z-index: 80;
  width: min(380px, calc(100vw - 32px));
  max-height: min(560px, calc(100vh - 118px));
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.22);
}

.notification-popover-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 14px 10px;
  border-bottom: 1px solid var(--line);
}

.notification-list {
  display: grid;
  gap: 10px;
  max-height: 470px;
  overflow: auto;
  padding: 12px;
}

.notification-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding: 12px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 10px;
  background: #f8fafc;
}

.notification-item.unread {
  border-color: rgba(8, 145, 178, 0.35);
  background: #eefbff;
}

.notification-item strong,
.notification-item p,
.notification-item small {
  display: block;
}

.notification-item strong {
  color: #0f172a;
}

.notification-item p {
  margin: 5px 0;
  color: #334155;
  line-height: 1.4;
}

.notification-item small,
.notification-read {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.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(3, 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;
  gap: 10px;
}

.plate-card-top {
  justify-content: flex-start;
}

.plate-card-top .status-pill {
  margin-left: auto;
}

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

.asset-badge {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
}

.asset-badge-large {
  width: 48px;
  height: 48px;
}

.asset-badge svg,
.asset-pin svg,
.table-actions svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.asset-badge-large svg {
  width: 25px;
  height: 25px;
}

.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;
  gap: 12px;
}

.detail-title .status-pill {
  margin-left: auto;
}

.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;
}

.profile-area,
.profile-grid,
.profile-form {
  display: grid;
  gap: 14px;
}

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

.profile-card {
  gap: 16px;
}

.profile-avatar {
  display: inline-grid;
  place-items: center;
  width: 62px;
  height: 62px;
  border-radius: 18px;
  background: var(--primary);
  color: #fff;
  font-size: 28px;
  font-weight: 900;
}

.profile-card h2 {
  margin: 0;
}

.profile-card p {
  margin: 4px 0 0;
  color: var(--muted);
}

.profile-photo-wrap {
  display: grid;
  justify-items: start;
  gap: 10px;
}

.profile-photo {
  width: 86px;
  height: 86px;
  border-radius: 18px;
  object-fit: cover;
  border: 1px solid var(--line);
}

.photo-upload-action {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  padding: 0 12px;
  border-radius: 9px;
  background: var(--primary);
  color: #fff;
  font-weight: 900;
  cursor: pointer;
}

.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;
}

.history-card-list {
  display: grid;
  gap: 10px;
}

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

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

.history-card p {
  margin: 0;
  color: #344054;
  line-height: 1.35;
}

.history-card small {
  color: var(--muted);
}

.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;
}

.toggle-line {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 10px;
  min-height: 42px;
}

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

.inline-actions {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.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;
}

.channel-grid {
  display: grid;
  grid-template-columns: repeat(2, 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(74px + env(safe-area-inset-bottom));
  }

  .desktop-only-panel {
    display: none;
  }

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

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

  .brand-logo {
    width: 42px;
    height: 42px;
    flex-basis: 42px;
  }

  .notification-popover {
    inset: auto 10px calc(86px + env(safe-area-inset-bottom)) 10px;
    width: auto;
    max-height: min(62vh, 520px);
    border-radius: 12px;
  }

  .notification-list {
    max-height: calc(62vh - 54px);
  }

  .notification-item {
    grid-template-columns: 1fr;
  }

  .channel-grid {
    grid-template-columns: 1fr;
  }

  .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(var(--mobile-nav-count, 4), 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: 14px;
  }

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

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

  body[data-page="tracking"] .topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
  }

  body[data-page="tracking"] .topbar-actions {
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
  }

  body[data-page="tracking"] .topbar h2 {
    font-size: 20px;
    margin-top: 0;
  }

  body[data-page="tracking"] .eyebrow {
    margin-bottom: 2px;
  }

  .eyebrow {
    font-size: 11px;
  }

  .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;
  }

  .profile-grid {
    grid-template-columns: 1fr;
  }

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

  .panel {
    padding: 14px;
  }

  .panel h3 {
    font-size: 16px;
    margin-bottom: 10px;
  }

  .metric-card {
    padding: 13px;
  }

  .metric-card strong {
    font-size: 24px;
  }

  .plate-card {
    gap: 8px;
    padding: 13px;
    border-radius: 12px;
  }

  .plate-card-top {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) auto;
  }

  .plate-card-top strong {
    min-width: 0;
    font-size: 19px;
  }

  .plate-card-meta {
    display: grid;
    grid-template-columns: 1fr;
    gap: 4px;
    font-size: 11px;
  }

  .record-meta,
  .muted-line {
    font-size: 12px;
  }

  .detail-hero {
    gap: 12px;
  }

  .detail-title {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
  }

  .detail-title h2 {
    font-size: 24px;
    overflow-wrap: anywhere;
  }

  .asset-badge-large {
    width: 42px;
    height: 42px;
  }

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

  .detail-grid div,
  .info-list span {
    padding: 10px;
    border-radius: 9px;
  }

  .period-filter {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .period-filter button {
    min-height: 40px;
    padding: 0 10px;
    font-size: 12px;
  }

  .route-panel {
    padding: 12px;
  }

  .route-point {
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 8px;
    padding: 8px 0;
  }

  .route-dot {
    width: 28px;
    height: 28px;
  }

  .route-point:not(:last-child)::after {
    left: 13px;
    top: 36px;
  }

  table {
    min-width: 640px;
  }

  .inline-actions {
    grid-template-columns: 1fr;
  }

  .field-grid {
    gap: 8px;
  }

  .check-card {
    min-height: 42px;
    padding: 9px 10px;
  }
}

.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);
}

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

.asset-pin span {
  display: grid;
  place-items: center;
}

.asset-pin svg {
  width: 22px;
  height: 22px;
}

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

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

.asset-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;
  color: inherit;
  text-decoration: none;
}

.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;
}

.ai-assistant-button {
  position: fixed;
  right: 18px;
  bottom: calc(92px + env(safe-area-inset-bottom));
  z-index: 60;
  width: 66px;
  height: 66px;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #fff;
  color: #fff;
  box-shadow: 0 18px 40px rgba(15, 45, 74, 0.28);
  cursor: grab;
  touch-action: none;
}

.ai-assistant-button img {
  width: 58px;
  height: 58px;
  object-fit: cover;
  border-radius: 50%;
  pointer-events: none;
}

.ai-chat-panel {
  position: fixed;
  right: 18px;
  bottom: calc(160px + env(safe-area-inset-bottom));
  z-index: 61;
  width: min(380px, calc(100vw - 28px));
  height: min(560px, 72vh);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
  overflow: hidden;
}

.ai-chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  background: #0f2d4a;
  color: #fff;
}

.ai-chat-head small {
  display: block;
  color: #bdeaf3;
  font-size: 12px;
}

.ai-chat-messages {
  height: calc(100% - 118px);
  padding: 12px;
  display: grid;
  align-content: start;
  gap: 10px;
  overflow-y: auto;
  background: #f8fafc;
}

.ai-message {
  max-width: 88%;
  padding: 10px 12px;
  border-radius: 12px;
  line-height: 1.35;
  font-size: 14px;
}

.ai-message.assistant {
  background: #fff;
  border: 1px solid var(--line);
}

.ai-message.user {
  justify-self: end;
  background: var(--primary);
  color: #fff;
}

.ai-chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.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;
}

.install-card .install-action {
  width: 100%;
}

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

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

/* Premium visual refresh */
:root {
  --ink: #111827;
  --muted: #64748b;
  --soft: #94a3b8;
  --line: #dbe4ef;
  --panel: rgba(255, 255, 255, 0.92);
  --page: #eef4f8;
  --nav: #07111f;
  --nav-2: #102338;
  --primary: #0f2d4a;
  --primary-strong: #071c31;
  --primary-soft: #e5f2fb;
  --accent: #0891b2;
  --accent-2: #22c55e;
  --black: #111827;
  --shadow: 0 18px 45px rgba(15, 23, 42, 0.12);
  --shadow-soft: 0 10px 28px rgba(15, 23, 42, 0.08);
}

body {
  background:
    linear-gradient(rgba(15, 45, 74, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 45, 74, 0.045) 1px, transparent 1px),
    linear-gradient(135deg, #f8fbfd 0%, #eef4f8 48%, #e8f3f2 100%);
  background-size: 28px 28px, 28px 28px, auto;
}

.login-shell {
  background:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(145deg, #07111f 0%, #0f2d4a 54%, #064e5f 100%);
  background-size: 30px 30px, 30px 30px, auto;
}

.login-panel,
.metric-card,
.panel,
.plate-card,
.record-item,
.stock-card,
.map-position-card,
.history-card,
.route-panel {
  border-color: rgba(148, 163, 184, 0.28);
  border-radius: 10px;
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(14px);
}

.login-panel {
  position: relative;
  overflow: hidden;
  border-color: rgba(255, 255, 255, 0.52);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.32);
}

.login-panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.brand-mark {
  background: linear-gradient(145deg, #0f2d4a, #0891b2);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22), 0 12px 26px rgba(8, 145, 178, 0.2);
}

.sidebar {
  background:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(180deg, var(--nav), var(--nav-2));
  background-size: 24px 24px, 24px 24px, auto;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand {
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

.nav-item {
  color: #c7d2e4;
  border: 1px solid transparent;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.08);
}

.nav-item.active {
  background: rgba(8, 145, 178, 0.18);
  border-color: rgba(34, 197, 94, 0.25);
  color: #fff;
}

.nav-item.active .nav-icon {
  background: #e8fbff;
  color: #0f2d4a;
}

.topbar {
  padding: 16px 18px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.74);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(14px);
}

.eyebrow {
  color: #0891b2;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.topbar h2 {
  color: #0f172a;
}

.metric-card,
.panel {
  position: relative;
  overflow: hidden;
}

.metric-card::before,
.panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, rgba(8, 145, 178, 0.75), rgba(34, 197, 94, 0.72));
  opacity: 0.85;
}

.metric-card strong,
.donut-center strong,
.plate-card-top strong,
.detail-title h2 {
  color: #0f172a;
}

.primary-action,
.secondary-action,
.install-action {
  border-radius: 8px;
  background: linear-gradient(135deg, #0f2d4a, #075985);
  box-shadow: 0 12px 24px rgba(15, 45, 74, 0.18);
  transition: transform 150ms ease, box-shadow 150ms ease, filter 150ms ease;
}

.primary-action:hover,
.secondary-action:hover,
.install-action:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
  box-shadow: 0 16px 30px rgba(15, 45, 74, 0.22);
}

.ghost-light,
.ghost-action {
  transition: border-color 150ms ease, background 150ms ease, color 150ms ease;
}

.ghost-light:hover {
  border-color: rgba(8, 145, 178, 0.4);
  background: #f0fbff;
}

input,
select,
textarea {
  border-color: #d8e2ed;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(8, 145, 178, 0.14);
}

.status-pill,
.battery,
.tag-label,
.asset-badge,
.map-card-main span {
  border: 1px solid rgba(8, 145, 178, 0.12);
  background: #e8f7fb;
  color: #075985;
}

.data-table {
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.78);
}

th {
  background: rgba(15, 45, 74, 0.045);
  color: #475569;
}

td {
  color: #1f2937;
}

tr:hover td {
  background: rgba(8, 145, 178, 0.035);
}

.plate-card:hover,
.map-position-card:hover,
.record-item:hover,
.stock-card:hover {
  border-color: rgba(8, 145, 178, 0.32);
  box-shadow: var(--shadow);
}

.asset-pin {
  background: linear-gradient(145deg, #0f2d4a, #0891b2);
  box-shadow: 0 12px 28px rgba(15, 45, 74, 0.28);
}

.map-view {
  border-color: rgba(148, 163, 184, 0.32);
  box-shadow: var(--shadow);
}

.icon-action {
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: #f2f7fb;
  color: #0f2d4a;
}

.icon-action:hover {
  border-color: rgba(8, 145, 178, 0.35);
  background: #e8f7fb;
}

.icon-action.danger {
  background: #fff5f5;
}

@media (max-width: 760px) {
  body {
    background-size: 22px 22px, 22px 22px, auto;
  }

  .topbar {
    padding: 12px;
    border-radius: 10px;
  }

  .sidebar {
    background:
      linear-gradient(90deg, rgba(7, 17, 31, 0.98), rgba(15, 45, 74, 0.98));
    backdrop-filter: blur(18px);
  }

  .nav-item.active {
    background: rgba(8, 145, 178, 0.24);
  }

  .metric-card::before,
  .panel::before {
    height: 2px;
  }
}
