:root {
  --bg: #f6f5fb;
  --bg-soft: #ffffff;
  --panel: rgba(255, 255, 255, 0.88);
  --panel-solid: #ffffff;
  --panel-strong: #f3f0ff;
  --line: rgba(84, 72, 214, 0.12);
  --text: #221d48;
  --muted: #756f96;
  --accent: #5848d6;
  --accent-strong: #4638b8;
  --warn: #e7a23d;
  --danger: #e65b6d;
  --map-road: #d9e2ef;
  --map-land: #f8fbff;
  --map-park: #dcefd8;
  --shadow: 0 22px 60px rgba(70, 56, 184, 0.12);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 16px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(88, 72, 214, 0.14), transparent 28%),
    radial-gradient(circle at bottom right, rgba(162, 150, 255, 0.16), transparent 24%),
    linear-gradient(180deg, #fbfaff 0%, #f4f2fb 100%);
  color: var(--text);
  font-family: "Outfit", sans-serif;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100dvh;
  min-height: 100vh;
  overflow-x: hidden;
  overscroll-behavior-y: contain;
}

button,
input,
select {
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}

.hidden {
  display: none !important;
}

.app-shell {
  min-height: 100dvh;
  min-height: 100vh;
}

.login-brand {
  position: absolute;
  top: 28px;
  left: 28px;
  z-index: 6;
}

.auth-language-select {
  position: absolute;
  top: 28px;
  right: 28px;
  z-index: 6;
  min-width: 148px;
}

.login-panel,
.dashboard,
.register-panel {
  min-height: 100vh;
}

.login-panel {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 24px;
  padding: 112px 28px 28px;
}

.login-card,
.hero-card,
.panel,
.sidebar {
  backdrop-filter: blur(18px);
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.login-card,
.hero-card {
  border-radius: 34px;
  padding: 36px;
}

.eyebrow {
  margin: 0 0 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.74rem;
  color: var(--accent);
}

.login-card h1,
.topbar h2,
.panel h3,
.hero-card strong {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
}

.login-card h1 {
  max-width: 12ch;
  font-size: clamp(2.7rem, 5vw, 4.8rem);
  line-height: 0.96;
}

.intro {
  max-width: 54ch;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.7;
  margin: 18px 0 30px;
}

.auth-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.login-form {
  display: grid;
  gap: 16px;
  max-width: 460px;
}

.text-link {
  border: 0;
  background: transparent;
  color: var(--accent);
  font-weight: 600;
  padding: 0;
  margin-top: 14px;
  cursor: pointer;
}

.login-footer-meta {
  margin-top: 28px;
  display: grid;
  gap: 6px;
}

.login-footer-meta p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.login-form label,
.settings-form label {
  display: grid;
  gap: 10px;
  color: var(--muted);
  font-size: 0.95rem;
}

.login-form input,
.search input,
.settings-form select,
.language-select select,
.settings-form input {
  width: 100%;
  border: 1px solid rgba(88, 72, 214, 0.14);
  border-radius: 16px;
  padding: 15px 16px;
  background: rgba(88, 72, 214, 0.03);
  color: var(--text);
  outline: none;
}

.login-form button,
.settings-form button,
.ghost-button,
.nav-link {
  border: 0;
  cursor: pointer;
  touch-action: manipulation;
}

.login-form button,
.settings-form button {
  margin-top: 8px;
  padding: 15px 18px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--accent), #6d5df0);
  color: white;
  font-weight: 700;
}

.login-form button:disabled,
.settings-form button:disabled {
  opacity: 0.52;
  cursor: not-allowed;
}

.secondary-button {
  margin-top: 8px;
  padding: 15px 18px;
  border-radius: 18px;
  background: rgba(88, 72, 214, 0.08);
  color: var(--accent);
  font-weight: 700;
}

.login-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 32px;
}

.login-metrics article,
.stat-card,
.vehicle-card,
.focus-item,
.timeline-item,
.alert-card {
  border: 1px solid var(--line);
  background: rgba(88, 72, 214, 0.03);
  border-radius: 18px;
}

.login-metrics article {
  padding: 18px;
}

.login-metrics strong {
  display: block;
  font-size: 1.6rem;
}

.login-metrics span {
  color: var(--muted);
}

.hero-card {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(244, 240, 255, 0.98)),
    radial-gradient(circle at 65% 20%, rgba(88, 72, 214, 0.16), transparent 22%);
}

.product-visual {
  position: relative;
  min-height: 520px;
  display: grid;
  place-items: center;
  border-radius: 30px;
  overflow: hidden;
  background:
    radial-gradient(circle at 25% 25%, rgba(88, 72, 214, 0.16), transparent 26%),
    radial-gradient(circle at 75% 72%, rgba(228, 67, 67, 0.12), transparent 22%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(246, 243, 255, 0.95));
}

.product-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(88, 72, 214, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(88, 72, 214, 0.07) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.8), transparent);
}

.product-orb {
  position: absolute;
  border-radius: 50%;
}

.orb-one {
  top: 50px;
  right: 44px;
  width: 220px;
  height: 220px;
  background: radial-gradient(circle, rgba(88, 72, 214, 0.18), rgba(88, 72, 214, 0.03));
}

.orb-two {
  left: 42px;
  bottom: 48px;
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, rgba(228, 67, 67, 0.14), rgba(228, 67, 67, 0.03));
}

.device-render {
  position: relative;
  z-index: 1;
  width: min(100%, 520px);
  height: auto;
  object-fit: contain;
  transform: scale(2);
  transform-origin: center;
  filter: drop-shadow(0 28px 48px rgba(34, 29, 72, 0.18));
}

.hero-radar {
  position: absolute;
  inset: auto auto 30px 36px;
  width: 190px;
  height: 190px;
  border-radius: 50%;
  border: 1px solid rgba(88, 72, 214, 0.14);
  box-shadow: inset 0 0 0 28px rgba(88, 72, 214, 0.03), inset 0 0 0 56px rgba(88, 72, 214, 0.03);
}

.hero-map,
.map-surface {
  position: relative;
  overflow: hidden;
  border-radius: 28px;
  min-height: 340px;
  background:
    radial-gradient(circle at 18% 24%, rgba(118, 201, 145, 0.2), transparent 12%),
    radial-gradient(circle at 76% 68%, rgba(118, 201, 145, 0.16), transparent 12%),
    linear-gradient(0deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.92)),
    linear-gradient(var(--map-road) 1px, transparent 1px),
    linear-gradient(90deg, var(--map-road) 1px, transparent 1px),
    linear-gradient(135deg, #e9eef7 0%, var(--map-land) 100%);
  background-size: auto, auto, auto, 54px 54px, 54px 54px, auto;
}

.hero-map::after,
.map-surface::after {
  content: "";
  position: absolute;
  inset: 10% 8%;
  background:
    linear-gradient(115deg, transparent 0 11%, rgba(198, 207, 223, 0.8) 11% 12%, transparent 12% 33%, rgba(198, 207, 223, 0.8) 33% 34%, transparent 34% 100%),
    linear-gradient(35deg, transparent 0 24%, rgba(198, 207, 223, 0.72) 24% 25%, transparent 25% 57%, rgba(198, 207, 223, 0.72) 57% 58%, transparent 58% 100%);
  opacity: 0.6;
  pointer-events: none;
}

.hero-map {
  margin-top: 30px;
}

.pulse,
.vehicle-dot,
.route-node {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: currentColor;
  border: 0;
  padding: 0;
  box-shadow: 0 0 0 0 rgba(88, 72, 214, 0.35);
  animation: pulse 2.8s infinite;
}

.vehicle-dot {
  transform: translate(-50%, -50%);
}

.map-label {
  position: absolute;
  transform: translateY(-50%);
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 0.74rem;
  white-space: nowrap;
  box-shadow: 0 8px 24px rgba(70, 56, 184, 0.12);
}

.p1 { top: 28%; left: 24%; }
.p2 { top: 46%; left: 62%; animation-delay: 0.9s; }
.p3 { top: 68%; left: 38%; animation-delay: 1.5s; }

.route {
  position: absolute;
  inset: 20% 18% 24% 18%;
  border: 2px dashed rgba(88, 72, 214, 0.35);
  border-radius: 999px 45% 50% 30%;
  transform: rotate(-12deg);
}

.hero-status {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-top: 26px;
  position: relative;
  z-index: 1;
}

.product-caption {
  margin-top: 18px;
}

.hero-status p,
.sidebar-footer p,
.stat-card p,
.vehicle-card p,
.history-table,
.timeline-item p,
.alert-card p,
.focus-item p,
.info-panel li {
  color: var(--muted);
}

.dashboard {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 22px;
  padding: 22px;
}

.sidebar,
.content,
.panel {
  border-radius: var(--radius-xl);
}

.sidebar {
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo {
  display: block;
  width: min(220px, 100%);
  height: auto;
}

.register-panel {
  display: grid;
  place-items: center;
  padding: 112px 28px 28px;
}

.register-card {
  width: min(640px, 100%);
  padding: 36px;
  border-radius: 34px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.register-form {
  max-width: none;
}

.role-fields {
  display: grid;
  gap: 16px;
}

.consent-row {
  grid-template-columns: auto 1fr;
  align-items: center;
}

.consent-row input {
  width: 18px;
  height: 18px;
}

.login-switch {
  margin: 0;
  color: var(--muted);
}

.inline-link {
  border: 0;
  background: transparent;
  color: var(--accent);
  font-weight: 700;
  cursor: pointer;
  padding: 0;
}

.back-link {
  border: 0;
  background: transparent;
  color: var(--accent);
  padding: 0;
  margin-bottom: 18px;
  font-weight: 600;
  cursor: pointer;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav-link {
  text-align: left;
  padding: 14px 16px;
  border-radius: 16px;
  background: transparent;
  color: var(--muted);
  transition: 160ms ease;
  width: 100%;
}

.nav-link.active,
.nav-link:hover {
  background: rgba(88, 72, 214, 0.1);
  color: var(--text);
}

.sidebar-footer {
  margin-top: auto;
  padding: 18px;
  border-radius: 20px;
  background: rgba(88, 72, 214, 0.04);
  display: flex;
  align-items: stretch;
  justify-content: stretch;
}

.content {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.topbar h2 {
  font-size: clamp(2rem, 4vw, 3rem);
}

.topbar-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.search {
  display: block;
}

.search input {
  width: min(360px, 100%);
  min-width: 280px;
}

.topbar-user-device {
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(360px, 100%);
  min-width: 280px;
  padding: 10px 14px;
  border-radius: 22px;
  border: 1px solid rgba(88, 72, 214, 0.12);
  background: linear-gradient(180deg, rgba(247, 245, 255, 0.98), rgba(241, 238, 255, 0.98));
  box-shadow: 0 14px 30px rgba(88, 72, 214, 0.08);
}

.topbar-device-avatar {
  width: 52px;
  height: 52px;
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(88, 72, 214, 0.18), rgba(217, 79, 104, 0.12)),
    rgba(88, 72, 214, 0.08);
  background-size: cover;
  background-position: center;
  flex: 0 0 auto;
}

.topbar-user-device-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.topbar-user-device-copy span {
  color: var(--muted);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.topbar-user-device-copy strong,
.topbar-user-device-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-user-device-copy strong {
  color: var(--text);
  font-size: 1rem;
}

.topbar-user-device-copy small {
  color: #7c739f;
  font-size: 0.84rem;
}

.language-select {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.language-select select {
  min-width: 148px;
}

.ghost-button {
  background: rgba(88, 72, 214, 0.06);
  color: var(--text);
  padding: 14px 18px;
  border-radius: 16px;
}

.add-device-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.sidebar-logout {
  white-space: nowrap;
}

.alarm-primary-button {
  background: linear-gradient(135deg, var(--accent), #7869f2);
  color: white;
}

.view {
  display: none;
  gap: 18px;
}

.view.active {
  display: grid;
}

.vehicle-grid,
.alert-stack {
  display: grid;
  gap: 18px;
}

.stat-card {
  padding: 20px;
}

.stat-card strong {
  display: block;
  margin: 10px 0 6px;
  font-size: 2rem;
  font-family: "Space Grotesk", sans-serif;
}

.layout-grid {
  display: grid;
  gap: 18px;
}

.overview-stage {
  position: relative;
  min-height: 520px;
}

.overview-map-panel {
  min-height: 520px;
}

.overview-map-panel .map-surface {
  min-height: 420px;
}

.focus-panel {
  position: absolute;
  top: 28px;
  right: 28px;
  width: min(360px, 34vw);
  max-height: calc(100% - 56px);
  overflow: auto;
  z-index: 4;
  transform: translateX(calc(100% + 24px));
  opacity: 0;
  pointer-events: none;
  transition: transform 260ms ease, opacity 220ms ease;
}

.overview-stage.has-alerts .focus-panel {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

.panel {
  padding: 22px;
}

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

.badge {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(88, 72, 214, 0.12);
  color: var(--accent);
  font-size: 0.9rem;
}

.badge.muted {
  color: var(--warn);
  background: rgba(231, 162, 61, 0.14);
}

.focus-list,
.timeline,
.alert-stack {
  display: grid;
  gap: 12px;
}

.focus-item,
.timeline-item,
.alert-card {
  padding: 16px;
}

.focus-item strong,
.vehicle-card strong,
.timeline-item strong,
.alert-card strong {
  display: block;
  margin-bottom: 4px;
}

.focus-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin-top: 10px;
  font-size: 0.9rem;
  color: var(--muted);
}

.focus-item-meta strong {
  display: inline;
  margin-bottom: 0;
  color: inherit;
}

.alert-device-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.delete-alert-button {
  border: 0;
  border-radius: 12px;
  padding: 10px 14px;
  background: rgba(228, 67, 67, 0.12);
  color: #b3261e;
  font-weight: 700;
  cursor: pointer;
}

.focus-directions-button {
  border: 1px solid rgba(88, 72, 214, 0.18);
  border-radius: 12px;
  padding: 10px 14px;
  background: rgba(88, 72, 214, 0.06);
  color: #5848d6;
  font-weight: 700;
  cursor: pointer;
}

.focus-ack-button {
  border: 0;
  border-radius: 12px;
  padding: 10px 14px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 700;
  cursor: pointer;
}

.delete-device-button {
  border: 1px solid rgba(125, 115, 174, 0.18);
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(88, 72, 214, 0.04);
  color: #7d73ae;
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
  white-space: nowrap;
}

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

.vehicle-card {
  padding: 18px;
}

.vehicle-location {
  min-height: 24px;
}

.vehicle-card-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.vehicle-meta,
.vehicle-footer,
.alert-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.vehicle-meta,
.vehicle-footer,
.timeline-item span,
.alert-meta {
  font-size: 0.94rem;
  color: var(--muted);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 0.84rem;
  background: rgba(88, 72, 214, 0.06);
}

.status-pill::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.status-moving { color: var(--accent); }
.status-idle { color: var(--warn); }
.status-offline { color: var(--danger); }
.status-triggered { color: #e44343; }
.status-safe { color: #5e8dd8; }
.status-acknowledged { color: #ffb454; }

.vehicle-card.priority {
  border-color: rgba(228, 67, 67, 0.42);
  box-shadow: inset 0 0 0 1px rgba(228, 67, 67, 0.16), 0 14px 30px rgba(228, 67, 67, 0.1);
  background: linear-gradient(180deg, rgba(255, 236, 236, 0.95), rgba(255, 250, 250, 0.96));
}

.vehicle-card.priority strong:first-child,
.focus-item strong {
  color: #b3261e;
}

.status-pill.status-triggered,
.status-pill.status-acknowledged {
  background: rgba(228, 67, 67, 0.12);
  color: #b3261e;
  font-weight: 700;
}

.status-pill.status-acknowledged::before {
  background: #b3261e;
}

.map-surface::before {
  content: "";
  position: absolute;
  inset: 18px;
  border-radius: 24px;
  border: 1px solid rgba(88, 72, 214, 0.08);
}

.map-surface.is-google-map {
  background: #eef2fb;
}

.map-surface.is-google-map::before,
.map-surface.is-google-map::after {
  display: none;
}

.gm-style button,
.gm-style img {
  max-width: none;
}

.map-fallback {
  height: 100%;
  min-height: 260px;
  display: grid;
  place-content: center;
  gap: 10px;
  padding: 24px;
  text-align: center;
  color: var(--muted);
}

.map-fallback strong {
  color: var(--text);
  font-family: "Space Grotesk", sans-serif;
}

.history-table-wrap {
  overflow-x: auto;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
}

.history-table th,
.history-table td {
  text-align: left;
  padding: 16px 10px;
  border-bottom: 1px solid var(--line);
}

.history-table th {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.settings-form {
  display: grid;
  gap: 16px;
}

.settings-subhead h4 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.15rem;
}

.device-privacy-panel {
  display: grid;
  gap: 18px;
  padding: 20px;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: rgba(88, 72, 214, 0.04);
}

.push-settings-copy {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.push-settings-actions {
  display: flex;
  justify-content: flex-start;
}

.device-privacy-grid {
  display: grid;
  gap: 16px;
}

.owner-caregiver-form {
  display: grid;
  gap: 14px;
}

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

.owner-caregiver-limit {
  color: var(--muted);
  font-weight: 700;
}

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

.owner-caregiver-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
}

.owner-caregiver-card p,
.empty-caregiver-copy {
  margin: 4px 0 0;
  color: var(--muted);
}

.danger-link {
  color: #bd2020;
  border-color: rgba(189, 32, 32, 0.18);
}

.device-preview-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
}

.device-preview-avatar {
  width: 92px;
  height: 92px;
  border-radius: 24px;
  background:
    linear-gradient(135deg, rgba(88, 72, 214, 0.16), rgba(228, 67, 67, 0.1)),
    rgba(88, 72, 214, 0.08);
  background-size: cover;
  background-position: center;
  flex: 0 0 auto;
}

.device-preview-card strong {
  display: block;
  margin-bottom: 6px;
}

.device-preview-card p {
  margin: 0;
  color: var(--muted);
}

.patient-identity {
  display: flex;
  align-items: center;
  gap: 12px;
}

.patient-identity-copy {
  min-width: 0;
}

.patient-identity-copy strong {
  margin-bottom: 0;
}

.patient-avatar {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(88, 72, 214, 0.18), rgba(228, 67, 67, 0.12)),
    rgba(88, 72, 214, 0.08);
  background-size: cover;
  background-position: center;
  flex: 0 0 auto;
}

.toggle-row {
  grid-template-columns: 1fr auto;
  align-items: center;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  padding: 14px 18px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  z-index: 40;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(70, 56, 184, 0.18);
  backdrop-filter: blur(8px);
  z-index: 30;
}

.alarm-modal {
  width: min(560px, 100%);
  padding: 28px;
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(246, 243, 255, 0.98));
  border: 1px solid rgba(88, 72, 214, 0.18);
  box-shadow: 0 30px 80px rgba(70, 56, 184, 0.16);
}

.compact-modal {
  width: min(460px, 100%);
}

.alarm-modal h3 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: 2rem;
}

.alert-eyebrow {
  color: #e44343;
}

.alarm-modal-copy {
  color: #5f5a7d;
  line-height: 1.7;
}

.alarm-modal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0 20px;
}

.alarm-modal-grid article {
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(88, 72, 214, 0.1);
  background: rgba(88, 72, 214, 0.03);
}

.alarm-modal-grid span {
  display: block;
  font-size: 0.82rem;
  color: #7d73ae;
  margin-bottom: 6px;
}

.alarm-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.alarm-modal-actions .ghost-button:disabled {
  opacity: 0.52;
  cursor: not-allowed;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(88, 72, 214, 0.35); }
  70% { box-shadow: 0 0 0 18px rgba(88, 72, 214, 0); }
  100% { box-shadow: 0 0 0 0 rgba(88, 72, 214, 0); }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

@media (max-width: 1120px) {
  .login-panel,
  .dashboard,
  .layout-grid {
    grid-template-columns: 1fr;
  }

  .dashboard {
    padding: 18px;
    gap: 18px;
  }

  .sidebar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
  }

  .brand {
    flex: 0 0 auto;
  }

  .nav {
    display: flex;
    flex: 1 1 420px;
    flex-wrap: wrap;
    gap: 10px;
  }

  .nav-link {
    width: auto;
    min-width: 150px;
  }

  .sidebar-footer {
    margin-top: 0;
    margin-left: auto;
    padding: 0;
    background: transparent;
  }

  .topbar {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .topbar-actions {
    width: 100%;
    justify-content: space-between;
  }

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

  .overview-stage {
    min-height: auto;
  }

  .overview-map-panel {
    min-height: auto;
  }

  .focus-panel {
    position: static;
    width: auto;
    max-height: none;
    margin-top: 18px;
    transform: none;
    opacity: 1;
    pointer-events: auto;
  }
}

@media (max-width: 760px) {
  .login-panel,
  .dashboard,
  .register-panel {
    padding: 12px;
    gap: 12px;
  }

  .app-shell {
    padding-bottom: calc(18px + env(safe-area-inset-bottom));
  }

  .dashboard {
    padding-bottom: calc(104px + env(safe-area-inset-bottom));
  }

  .login-brand {
    position: static;
    display: flex;
    justify-content: center;
    padding: 16px 16px 0;
  }

  .auth-language-select {
    position: static;
    margin: 12px 16px 0;
    width: calc(100% - 32px);
    max-width: 220px;
  }

  .login-card,
  .hero-card,
  .panel,
  .sidebar,
  .register-card {
    padding: 20px;
    border-radius: 24px;
  }

  .brand,
  .sidebar-footer {
    width: 100%;
  }

  .brand {
    display: none;
  }

  .brand-logo {
    width: min(180px, 58vw);
  }

  .sidebar {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 12px;
    top: auto;
    z-index: 24;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.96);
  }

  .nav {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    gap: 8px;
  }

  .nav-link {
    width: 100%;
    min-width: 0;
    min-height: 56px;
    padding: 0;
    display: grid;
    place-items: center;
    border-radius: 18px;
    font-size: 0;
    color: transparent;
    text-align: center;
  }

  .nav-link::before {
    content: "";
    width: 22px;
    height: 22px;
    display: block;
    color: var(--muted);
    background: currentColor;
    -webkit-mask: var(--mobile-nav-icon) center / contain no-repeat;
    mask: var(--mobile-nav-icon) center / contain no-repeat;
  }

  .nav-link[data-view="overview"]::before {
    --mobile-nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M12 3.2 3.75 10v10.25c0 .41.34.75.75.75h5.5c.41 0 .75-.34.75-.75v-5.5c0-.41.34-.75.75-.75h1c.41 0 .75.34.75.75v5.5c0 .41.34.75.75.75h5.5c.41 0 .75-.34.75-.75V10L12 3.2Zm0 1.94 6.75 5.57v8.79H15.5V14.5A2.25 2.25 0 0 0 13.25 12h-1.5A2.25 2.25 0 0 0 9.5 14.5v4.99H5.25v-8.78L12 5.14Z'/%3E%3C/svg%3E");
  }

  .nav-link[data-view="history"]::before {
    --mobile-nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M5 5.25A2.25 2.25 0 0 1 7.25 3h9.5A2.25 2.25 0 0 1 19 5.25v13.5A2.25 2.25 0 0 1 16.75 21h-9.5A2.25 2.25 0 0 1 5 18.75V5.25Zm2.25-.75a.75.75 0 0 0-.75.75v13.5c0 .41.34.75.75.75h9.5c.41 0 .75-.34.75-.75V5.25a.75.75 0 0 0-.75-.75h-9.5Zm1.25 3.25c0-.41.34-.75.75-.75h5.5a.75.75 0 0 1 0 1.5h-5.5a.75.75 0 0 1-.75-.75Zm0 4c0-.41.34-.75.75-.75h5.5a.75.75 0 0 1 0 1.5h-5.5a.75.75 0 0 1-.75-.75Zm0 4c0-.41.34-.75.75-.75h3.5a.75.75 0 0 1 0 1.5h-3.5a.75.75 0 0 1-.75-.75Z'/%3E%3C/svg%3E");
  }

  .nav-link[data-view="settings"]::before {
    --mobile-nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M6.5 6.5a2.5 2.5 0 1 1 4.78 1H21a.75.75 0 0 1 0 1.5h-9.72A2.5 2.5 0 0 1 6.5 8a2.5 2.5 0 0 1 0-1.5Zm0 1.5a1 1 0 1 0 2 0 1 1 0 0 0-2 0Zm6.22 7H3a.75.75 0 0 1 0-1.5h9.72a2.5 2.5 0 1 1 0 1.5ZM15.5 16a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z'/%3E%3C/svg%3E");
  }

  .nav-link.active::before,
  .nav-link:hover::before {
    color: var(--text);
  }

  .login-metrics,
  .vehicle-grid {
    grid-template-columns: 1fr;
  }

  .topbar,
  .topbar-actions,
  .hero-status,
  .auth-actions,
  .vehicle-meta,
  .vehicle-footer,
  .alert-meta,
  .alarm-modal-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .sidebar-footer {
    width: auto;
    margin: 0;
    padding: 0;
    background: transparent;
    display: flex;
    align-items: center;
  }

  .sidebar-logout {
    min-width: 56px;
    min-height: 56px;
    padding: 0;
    display: grid;
    place-items: center;
    border-radius: 18px;
    font-size: 0;
    color: transparent;
  }

  .sidebar-logout::before {
    content: "";
    width: 22px;
    height: 22px;
    display: block;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M10.75 3A2.75 2.75 0 0 0 8 5.75v2.5a.75.75 0 0 0 1.5 0v-2.5c0-.69.56-1.25 1.25-1.25h6.5c.69 0 1.25.56 1.25 1.25v12.5c0 .69-.56 1.25-1.25 1.25h-6.5c-.69 0-1.25-.56-1.25-1.25v-2.5a.75.75 0 0 0-1.5 0v2.5A2.75 2.75 0 0 0 10.75 21h6.5A2.75 2.75 0 0 0 20 18.25V5.75A2.75 2.75 0 0 0 17.25 3h-6.5ZM3.22 11.47a.75.75 0 0 0 0 1.06l3.5 3.5a.75.75 0 1 0 1.06-1.06l-2.22-2.22H14a.75.75 0 0 0 0-1.5H5.56l2.22-2.22a.75.75 0 1 0-1.06-1.06l-3.5 3.5Z'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M10.75 3A2.75 2.75 0 0 0 8 5.75v2.5a.75.75 0 0 0 1.5 0v-2.5c0-.69.56-1.25 1.25-1.25h6.5c.69 0 1.25.56 1.25 1.25v12.5c0 .69-.56 1.25-1.25 1.25h-6.5c-.69 0-1.25-.56-1.25-1.25v-2.5a.75.75 0 0 0-1.5 0v2.5A2.75 2.75 0 0 0 10.75 21h6.5A2.75 2.75 0 0 0 20 18.25V5.75A2.75 2.75 0 0 0 17.25 3h-6.5ZM3.22 11.47a.75.75 0 0 0 0 1.06l3.5 3.5a.75.75 0 1 0 1.06-1.06l-2.22-2.22H14a.75.75 0 0 0 0-1.5H5.56l2.22-2.22a.75.75 0 1 0-1.06-1.06l-3.5 3.5Z'/%3E%3C/svg%3E") center / contain no-repeat;
    color: var(--muted);
  }

  .search input {
    width: 100%;
    min-width: 0;
  }

  .topbar h2 {
    font-size: clamp(2rem, 10vw, 2.8rem);
  }

  .topbar-actions > * {
    width: 100%;
  }

  .add-device-button {
    justify-content: center;
    width: 100%;
  }

  .panel-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .badge {
    align-self: flex-start;
  }

  .hero-map,
  .map-surface,
  .product-visual {
    min-height: 260px;
  }

  .overview-map-panel .map-surface {
    min-height: 260px;
  }

  .device-preview-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .device-preview-avatar {
    width: 72px;
    height: 72px;
    border-radius: 20px;
  }

  .toast {
    left: 12px;
    right: 12px;
    bottom: 12px;
  }

  .modal-backdrop {
    padding: 12px;
  }

  .alarm-modal-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 540px) {
  .login-card h1,
  .register-card h1 {
    font-size: clamp(2.1rem, 12vw, 3rem);
  }

  .product-visual {
    min-height: 220px;
  }

  .device-render {
    width: min(100%, 360px);
    transform: scale(1.45);
  }

  .panel,
  .sidebar,
  .register-card,
  .login-card,
  .hero-card {
    padding: 18px;
  }

  .sidebar {
    left: 10px;
    right: 10px;
    bottom: 10px;
    padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
  }

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

  .nav-link,
  .sidebar-logout {
    min-height: 52px;
  }

  .alarm-modal {
    padding: 22px;
    border-radius: 24px;
  }

  .alarm-modal h3 {
    font-size: 1.65rem;
  }
}
