:root {
  --ui-scale: 0.8;
  --bg: #06131f;
  --bg-elevated: rgba(10, 30, 47, 0.82);
  --bg-soft: rgba(16, 53, 76, 0.68);
  --line: rgba(111, 207, 255, 0.18);
  --line-strong: rgba(111, 207, 255, 0.34);
  --text: #ebf7ff;
  --muted: #9cc5d7;
  --accent: #43d5ff;
  --accent-2: #00ffbf;
  --warning: #ffb84d;
  --danger: #ff607b;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.34);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 14px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(67, 213, 255, 0.18), transparent 35%),
    radial-gradient(circle at top right, rgba(0, 255, 191, 0.12), transparent 28%),
    linear-gradient(180deg, #071019 0%, #04101a 100%);
  color: var(--text);
  font-family: "IBM Plex Sans", sans-serif;
}

@media (min-width: 641px) {
  body {
    zoom: var(--ui-scale);
  }
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
  mask-image: radial-gradient(circle at center, black 45%, transparent 100%);
}

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

.hidden {
  display: none !important;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px;
  border-right: 1px solid var(--line);
  background: rgba(5, 15, 24, 0.86);
  backdrop-filter: blur(16px);
  display: flex;
  flex-direction: column;
  gap: 22px;
}

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

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background:
    linear-gradient(140deg, rgba(67, 213, 255, 0.95), rgba(0, 255, 191, 0.22)),
    #0d2a3e;
  box-shadow: 0 0 0 1px rgba(67, 213, 255, 0.32), 0 0 24px rgba(67, 213, 255, 0.24);
}

.sidebar h1,
.hero h2,
.card-head h3,
.login-card h2 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  letter-spacing: -0.03em;
}

.sidebar h1,
.login-card h2 {
  color: #f6fbff;
  text-shadow: 0 0 24px rgba(67, 213, 255, 0.12);
}

.eyebrow {
  margin: 0 0 6px;
  color: #7fe7ff;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  text-shadow: 0 0 20px rgba(67, 213, 255, 0.12);
}

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

.nav-link,
.ghost-button,
.primary-button {
  border: 0;
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  padding: 12px 14px;
  border-radius: 14px;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
}

.nav-icon {
  width: 18px;
  text-align: center;
  color: var(--accent);
  font-size: 0.95rem;
  flex: 0 0 18px;
}

.material-symbols-rounded {
  font-variation-settings:
    "FILL" 1,
    "wght" 500,
    "GRAD" 0,
    "opsz" 20;
  line-height: 1;
}

.nav-link.active,
.nav-link:hover {
  color: var(--text);
  background: rgba(67, 213, 255, 0.08);
  border-color: var(--line);
}

.ghost-button {
  padding: 12px 14px;
  color: var(--text);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--line);
}

.primary-button {
  padding: 13px 16px;
  border-radius: 14px;
  color: #031119;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.form-actions,
.table-actions,
.user-row-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.form-actions,
.table-actions {
  flex-wrap: wrap;
}

.user-row-head {
  justify-content: space-between;
}

.ghost-button:hover,
.primary-button:hover,
.nav-link:hover {
  transform: translateY(-1px);
}

.table-action {
  padding: 8px 12px;
  font-size: 0.82rem;
}

.danger {
  border-color: rgba(255, 96, 123, 0.28);
  color: #ffd8de;
  background: rgba(255, 96, 123, 0.08);
}

.content {
  padding: 20px;
}

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

.topbar-brand h2 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  letter-spacing: -0.03em;
  color: #f7fcff;
  text-shadow: 0 0 22px rgba(67, 213, 255, 0.1);
}

.account-area {
  position: relative;
  margin-left: auto;
}

.account-badge {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 250px;
  padding: 10px 12px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(6, 21, 32, 0.88);
  color: var(--text);
}

.account-meta {
  display: grid;
  gap: 3px;
  text-align: left;
}

.account-meta strong {
  font-size: 0.96rem;
  color: #f8fdff;
}

.account-meta span {
  font-size: 0.77rem;
  color: #9fe1f8;
}

.account-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background:
    linear-gradient(140deg, rgba(67, 213, 255, 0.9), rgba(0, 255, 191, 0.25)),
    #10354c;
  color: #031119;
  font-weight: 700;
  background-size: cover;
  background-position: center;
}

.account-avatar.large {
  width: 58px;
  height: 58px;
}

.account-avatar.image {
  color: transparent;
}

.account-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(340px, 92vw);
  padding: 16px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(6, 21, 32, 0.96);
  box-shadow: var(--shadow);
  z-index: 20;
}

.account-menu-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.login-panel {
  min-height: calc(100vh - 40px);
  display: grid;
  place-items: center;
}

.login-panel.standalone {
  min-height: 100vh;
  padding: 20px;
}

.login-body {
  overflow-x: hidden;
  position: relative;
}

.login-body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.92;
  background:
    radial-gradient(circle at 12% 26%, rgba(67, 213, 255, 0.18), transparent 20%),
    radial-gradient(circle at 88% 72%, rgba(0, 255, 191, 0.16), transparent 18%),
    linear-gradient(102deg, transparent 0%, transparent 43%, rgba(67, 213, 255, 0.16) 49%, transparent 55%, transparent 100%),
    linear-gradient(72deg, transparent 0%, transparent 60%, rgba(0, 255, 191, 0.12) 64%, transparent 68%, transparent 100%),
    repeating-linear-gradient(
      90deg,
      transparent 0 11vw,
      rgba(255, 255, 255, 0.025) 11vw 11.16vw,
      transparent 11.16vw 22vw
    );
  animation: transitFlow 12s linear infinite;
}

.login-card,
.glass-card,
.metric-card {
  border: 1px solid var(--line);
  background: var(--bg-elevated);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.login-card {
  width: min(100%, 430px);
  padding: 26px;
  border-radius: 28px;
}

.brand-block.compact {
  margin-bottom: 18px;
}

.password-field {
  gap: 8px;
}

.password-input-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.password-input-wrap input {
  min-width: 0;
}

.password-toggle {
  padding: 12px 14px;
  border-radius: 14px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
}

.avatar-preview-block {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.avatar-preview {
  width: 72px;
  height: 72px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  font-weight: 700;
  color: #031119;
  background:
    linear-gradient(140deg, rgba(67, 213, 255, 0.9), rgba(0, 255, 191, 0.25)),
    #10354c;
  background-size: cover;
  background-position: center;
}

.avatar-preview.image {
  color: transparent;
}

.assign-block {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.assign-list {
  display: grid;
  gap: 8px;
  max-height: 180px;
  overflow: auto;
  padding: 10px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(2, 13, 20, 0.56);
}

.assign-item {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  justify-content: space-between;
}

.assign-item input {
  width: auto;
}

.assign-item small {
  margin-left: auto;
}

.login-card form,
.stack-form {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--muted);
}

input,
textarea,
select {
  width: 100%;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(2, 13, 20, 0.82);
  color: var(--text);
  padding: 12px 14px;
}

.dashboard {
  display: grid;
  gap: 18px;
}

.hero {
  display: grid;
  gap: 18px;
  align-items: start;
}

.hero-copy {
  color: var(--muted);
  max-width: 760px;
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.metric-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(10, 30, 47, 0.94), rgba(6, 21, 32, 0.9));
  box-shadow: var(--shadow);
}

.metric-badge span {
  color: #8fdcff;
  font-size: 0.76rem;
}

.metric-badge strong {
  display: inline-block;
  font-size: 0.95rem;
  color: #ffffff;
}

@keyframes transitFlow {
  0% {
    transform: translate3d(-5%, 0, 0);
    filter: hue-rotate(0deg);
  }
  50% {
    transform: translate3d(5%, -1.5%, 0);
    filter: hue-rotate(16deg);
  }
  100% {
    transform: translate3d(-5%, 0, 0);
    filter: hue-rotate(0deg);
  }
}

.section-panel {
  display: none;
}

.section-panel.active {
  display: block;
}

.panel-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.9fr);
  gap: 16px;
}

.full-span {
  grid-column: 1 / -1;
}

.overview-grid {
  grid-template-columns: 1fr;
  align-items: stretch;
}

.glass-card {
  border-radius: var(--radius-xl);
  padding: 18px;
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
  margin-bottom: 14px;
}

.card-head h3 {
  color: #f4fbff;
  text-shadow: 0 0 16px rgba(67, 213, 255, 0.08);
}

.status-pill {
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  font-size: 0.75rem;
  color: #9ff0ff;
  background: rgba(67, 213, 255, 0.08);
}

.map-card {
  min-height: calc(100vh - 168px);
  display: flex;
  flex-direction: column;
}

.tall-map {
  min-height: calc(100vh - 168px);
}

.map-canvas {
  position: relative;
  min-height: 0;
  height: 100%;
  flex: 1;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid var(--line);
  background:
    radial-gradient(circle at center, rgba(67, 213, 255, 0.16), rgba(4, 16, 26, 0.9)),
    linear-gradient(180deg, rgba(8, 24, 38, 0.9), rgba(2, 10, 16, 1));
}

.map-overlay {
  position: absolute;
  left: 18px;
  top: 18px;
  z-index: 2;
  pointer-events: none;
}

.map-overlay-card {
  max-width: 280px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(156, 197, 215, 0.16);
  background: rgba(4, 16, 26, 0.8);
  color: var(--text);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.map-overlay-card strong {
  display: block;
  font-size: 0.88rem;
  margin-bottom: 4px;
}

.map-overlay-card p {
  color: var(--muted);
  font-size: 0.78rem;
}

.map-placeholder {
  min-height: 340px;
  height: 100%;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 24px;
  color: var(--muted);
}

.radar-ring {
  width: 104px;
  height: 104px;
  border-radius: 50%;
  border: 1px solid rgba(67, 213, 255, 0.45);
  box-shadow: 0 0 0 18px rgba(67, 213, 255, 0.08), 0 0 0 36px rgba(67, 213, 255, 0.03);
  margin-bottom: 18px;
  animation: pulse 2.4s infinite ease-in-out;
}

@keyframes pulse {
  0%, 100% { transform: scale(0.94); opacity: 0.78; }
  50% { transform: scale(1); opacity: 1; }
}

.feed-list,
.table-shell,
.capture-grid,
.note-block {
  display: grid;
  gap: 10px;
}

.data-table-wrap {
  width: 100%;
  overflow-x: auto;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(4, 16, 26, 0.68);
}

.data-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

.data-table thead th {
  padding: 12px 14px;
  text-align: left;
  font-size: 0.76rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #86def8;
  background: rgba(10, 30, 47, 0.9);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.data-table tbody td {
  padding: 13px 14px;
  color: var(--text);
  border-bottom: 1px solid rgba(111, 207, 255, 0.1);
  vertical-align: middle;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table tbody tr:hover {
  background: rgba(67, 213, 255, 0.04);
}

.actions-cell {
  white-space: nowrap;
}

.fleet-data-table .vehicle-row-head strong,
.admin-table .user-profile strong {
  margin-bottom: 0;
}

.feed-item,
.table-row,
.capture-card {
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(4, 16, 26, 0.72);
  padding: 12px 14px;
}

.feed-item strong,
.table-row strong,
.capture-card strong {
  display: block;
  margin-bottom: 6px;
  color: #f5fbff;
}

.feed-meta,
.table-meta,
.capture-meta,
.note-block p,
.form-message {
  color: #b7e7f7;
  font-size: 0.88rem;
  margin: 0;
}

.table-row {
  display: grid;
  gap: 6px;
}

.user-row {
  gap: 10px;
}

.user-profile,
.vehicle-row-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-table .user-profile {
  min-width: 240px;
}

.signal-meta {
  display: grid;
  gap: 4px;
  min-width: 220px;
}

.signal-meta strong {
  margin: 0;
  color: #f6fbff;
}

.mini-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: #031119;
  background:
    linear-gradient(140deg, rgba(67, 213, 255, 0.9), rgba(0, 255, 191, 0.25)),
    #10354c;
  background-size: cover;
  background-position: center;
}

.mini-avatar.image {
  color: transparent;
}

.vehicle-icon {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, rgba(67, 213, 255, 0.2), rgba(0, 255, 191, 0.1));
  border: 1px solid rgba(67, 213, 255, 0.24);
  color: #78e7ff;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.info-badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(67, 213, 255, 0.1), rgba(0, 255, 191, 0.06));
  color: #f2fdff;
  font-size: 0.78rem;
}

.fleet-data-table .info-badge,
.admin-table .status-pill {
  justify-content: center;
}

.modal-shell {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 9, 14, 0.72);
  backdrop-filter: blur(10px);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(560px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  padding: 18px;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: rgba(6, 21, 32, 0.96);
  box-shadow: var(--shadow);
}

.modal-close {
  padding: 10px 12px;
}

body.modal-open {
  overflow: hidden;
}

.capture-grid {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.capture-thumb {
  aspect-ratio: 4 / 3;
  border-radius: 14px;
  background:
    linear-gradient(145deg, rgba(67, 213, 255, 0.2), rgba(0, 255, 191, 0.05)),
    rgba(2, 10, 16, 1);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 0.84rem;
}

@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

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

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

  .hero-badges {
    flex-direction: column;
    align-items: stretch;
  }

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

  .topbar {
    display: grid;
  }

  .tall-map {
    min-height: calc(100vh - 240px);
  }
}

@media (max-width: 640px) {
  .content {
    padding: 14px;
  }

  .sidebar {
    padding: 16px;
  }

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

  .glass-card,
  .metric-card,
  .login-card {
    border-radius: 20px;
    padding: 14px;
  }

  .map-card,
  .tall-map {
    min-height: calc(100vh - 220px);
  }

  .map-canvas,
  .map-placeholder {
    min-height: 0;
  }

  .data-table {
    min-width: 100%;
  }

  .data-table thead {
    display: none;
  }

  .data-table,
  .data-table tbody,
  .data-table tr,
  .data-table td {
    display: block;
    width: 100%;
  }

  .data-table tbody tr {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(111, 207, 255, 0.1);
  }

  .data-table tbody td {
    padding: 8px 0;
    border: 0;
  }

  .data-table tbody td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 4px;
    color: #86def8;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
  }

  .actions-cell {
    white-space: normal;
  }
}
