:root {
  --bg-top: #1a2a4a;
  --bg-mid: #0b1020;
  --bg-bottom: #060a14;
  --panel: #121a2f;
  --panel-2: #18233d;
  --panel-3: #0f172a;
  --panel-4: #111b31;
  --line: #26324f;
  --line-strong: #35538f;
  --line-focus: #4f7cff;
  --text: #ffffff;
  --text-soft: #d6e0f5;
  --text-muted: #c8d2ea;
  --text-dim: #9fb3e8;
  --text-faint: #8fa6d6;
  --blue: #4f7cff;
  --blue-2: #6a92ff;
  --amber: #fbbf24;
  --amber-bg: rgba(251, 191, 36, 0.14);
  --sky: #7dd3fc;
  --sky-bg: rgba(96, 165, 250, 0.14);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.12);
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.12);
  --info-bg: rgba(79, 124, 255, 0.12);
  --shadow-lg: 0 28px 80px rgba(3, 8, 20, 0.48);
  --shadow-md: 0 18px 48px rgba(3, 8, 20, 0.34);
  --shadow-sm: 0 10px 28px rgba(3, 8, 20, 0.22);
  --radius-sm: 16px;
  --radius-md: 20px;
  --radius-lg: 24px;
  --radius-xl: 28px;
  --radius-2xl: 32px;
  --sidebar-width: 280px;
  --sidebar-collapsed: 104px;
  --header-height: 92px;
}

* {
  box-sizing: border-box;
  font-family: inherit;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

html {
  font-family: "Roboto", Arial, Helvetica, sans-serif;
  font-size: 15px;
}

body {
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(26, 42, 74, 0.96) 0%, rgba(11, 16, 32, 0.94) 42%, rgba(6, 10, 20, 1) 100%);
  background-color: var(--bg-bottom);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 28%),
    radial-gradient(circle at 15% 20%, rgba(79, 124, 255, 0.12), transparent 30%);
}

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

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

button {
  border: 0;
}

.app-shell {
  position: relative;
  display: flex;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  height: 100vh;
  padding: 20px 14px;
  background: rgba(11, 19, 38, 0.82);
  border-right: 1px solid rgba(38, 50, 79, 0.9);
  backdrop-filter: blur(22px);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.02);
  transition: width 0.22s ease, min-width 0.22s ease, transform 0.25s ease;
}

.sidebar-top,
.topbar,
.topbar-main,
.profile-chip,
.card-head,
.table-row-actions,
.form-actions,
.grid-toolbar,
.progress-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-top {
  justify-content: space-between;
  margin-bottom: 20px;
}

.brand-wrap {
  display: flex;
  align-items: center;
  min-width: 0;
  flex: 1;
}

.brand-copy {
  min-width: 0;
}

.brand {
  color: var(--text);
  font-size: 1.08rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  white-space: nowrap;
}

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

.sidebar-contact {
  margin-top: auto;
  padding-top: 18px;
  display: grid;
  gap: 10px;
  border-top: 1px solid rgba(38, 50, 79, 0.72);
}

.sidebar-contact-label {
  color: #8fa6d6;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0 12px;
}

.sidebar-contact-link {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 46px;
  padding: 0 14px;
  border-radius: 18px;
  color: var(--text-soft);
  border: 1px solid rgba(53, 83, 143, 0.34);
  background: rgba(255, 255, 255, 0.03);
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.sidebar-contact-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(79, 124, 255, 0.58);
  transform: translateY(-1px);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 50px;
  padding: 0 14px;
  border-radius: 18px;
  color: var(--text-soft);
  font-size: 0.93rem;
  font-weight: 500;
  border: 1px solid transparent;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(53, 83, 143, 0.5);
}

.nav-link.active {
  color: #fff;
  background: linear-gradient(180deg, rgba(79, 124, 255, 1), rgba(63, 107, 233, 1));
  border-color: rgba(106, 146, 255, 0.7);
  box-shadow: 0 16px 34px rgba(34, 65, 148, 0.32);
}

.nav-icon {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  color: currentColor;
}

.nav-icon svg {
  width: 22px;
  height: 22px;
  display: block;
  filter: drop-shadow(0 0 0.2px currentColor);
}

.sidebar-utility,
.icon-button {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(53, 83, 143, 0.42);
  border-radius: 14px;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.sidebar-utility:hover,
.icon-button:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(79, 124, 255, 0.65);
  transform: translateY(-1px);
}

.sidebar-utility svg,
.icon-button svg {
  width: 20px;
  height: 20px;
  display: block;
  filter: drop-shadow(0 0 0.2px currentColor);
}

.desktop-only {
  display: inline-flex;
}

.mobile-only,
.mobile-backdrop {
  display: none;
}

.main-panel {
  flex: 1;
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  justify-content: space-between;
  min-height: 82px;
  padding: 16px 24px;
  background: rgba(6, 10, 20, 0.52);
  border-bottom: 1px solid rgba(38, 50, 79, 0.9);
  backdrop-filter: blur(22px);
}

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

.topbar h1 {
  margin: 0;
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.topbar p {
  margin: 9px 0 0;
  max-width: 760px;
  color: #9aa6c3;
  font-size: 0.96rem;
  line-height: 1.5;
}

.profile-menu-wrap {
  position: relative;
}

.profile-menu-wrap summary {
  list-style: none;
}

.profile-menu-wrap summary::-webkit-details-marker {
  display: none;
}

.profile-chip {
  min-height: 52px;
  padding: 8px 12px 8px 8px;
  border-radius: 20px;
  border: 1px solid rgba(38, 50, 79, 0.95);
  background: linear-gradient(180deg, rgba(18, 26, 47, 0.95), rgba(12, 18, 33, 0.96));
  box-shadow: var(--shadow-sm);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.profile-chip.is-admin {
  background: linear-gradient(180deg, rgba(45, 43, 30, 0.96), rgba(36, 35, 26, 0.98));
  border-color: rgba(179, 140, 28, 0.62);
  box-shadow: 0 14px 30px rgba(22, 20, 12, 0.22);
}

.profile-chip:hover {
  border-color: rgba(79, 124, 255, 0.55);
  transform: translateY(-1px);
}

.profile-chip.is-admin:hover {
  border-color: rgba(214, 174, 55, 0.74);
  background: linear-gradient(180deg, rgba(51, 48, 34, 0.98), rgba(40, 38, 28, 0.99));
}

.profile-chip-badge,
.profile-card-icon {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border-radius: 999px;
}

.profile-chip-badge svg,
.profile-card-icon svg {
  width: 20px;
  height: 20px;
  display: block;
  filter: drop-shadow(0 0 0.2px currentColor);
}

.profile-chip-badge.is-admin,
.profile-card-icon.is-admin {
  color: #ffd84d;
  background: rgba(158, 124, 23, 0.38);
  border: 1px solid rgba(201, 160, 37, 0.24);
}

.profile-chip-badge.is-user,
.profile-card-icon.is-user {
  color: #b8e8ff;
  background: var(--sky-bg);
  border: 1px solid rgba(125, 211, 252, 0.22);
}

.profile-chip-copy {
  display: block;
  min-width: 0;
  text-align: left;
}

.profile-chip strong,
.profile-card strong {
  display: block;
  font-size: 0.94rem;
  font-weight: 700;
  line-height: 1.15;
}

.profile-chip small,
.profile-card span {
  color: var(--text-dim);
  font-size: 0.84rem;
}

.profile-chip.is-admin small {
  color: #f0d56a;
}

.profile-chip.is-admin .profile-chip-arrow {
  color: #f0d56a;
}

.profile-chip.is-admin strong {
  color: #fffdf6;
}

.profile-chip-arrow {
  width: 20px;
  height: 20px;
  margin-left: 2px;
  color: #9fb3e8;
}

.profile-chip-arrow svg {
  width: 20px;
  height: 20px;
  display: block;
  filter: drop-shadow(0 0 0.2px currentColor);
}

.profile-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 12px);
  z-index: 40;
  width: 280px;
  padding: 12px;
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(18, 26, 47, 0.98), rgba(10, 17, 32, 0.98));
  border: 1px solid rgba(38, 50, 79, 0.95);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(18px);
}
.profile-menu-wrap:not([open]) .profile-menu {
  display: none;
}

.profile-card,
.menu-link,
.card,
.stat-card,
.login-card,
.toolbar,
.list-card,
.empty-card,
.home-primary-card,
.home-side-card,
.mini-stat,
.summary-item,
.heatmap-panel {
  border-radius: 24px;
  border: 1px solid rgba(38, 50, 79, 0.96);
  background: linear-gradient(180deg, rgba(18, 26, 47, 0.96), rgba(15, 23, 42, 0.98));
  box-shadow: var(--shadow-md);
}

.profile-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
}

.menu-link {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0;
  padding: 14px 16px;
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.04);
  transition: background 0.18s ease, border-color 0.18s ease;
}

.menu-link:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(79, 124, 255, 0.4);
}

.content {
  padding: 24px 24px 30px;
}

.card,
.stat-card,
.map-panel,
.list-card,
.login-card,
.toolbar,
.empty-card,
.heatmap-panel {
  padding: 20px;
}

.section-head,
.card-head {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.section-head {
  display: flex;
  align-items: center;
}

.section-head-spread {
  justify-content: space-between;
}

.card-head.compact {
  margin-bottom: 14px;
}

.card h2,
.stat-card h3,
.map-panel h2,
.list-card h2,
.heatmap-panel h2,
.home-card-head h2,
.home-side-card h3,
.section-head h2 {
  margin: 0;
  color: var(--text);
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.list-card > h2 {
  margin-bottom: 16px;
}

.user-list-head {
  margin-bottom: 22px;
}

.user-list-head h2 {
  margin-bottom: 10px;
}

.user-list-head p {
  margin: 0;
  color: #9aa6c3;
  font-size: 0.92rem;
  line-height: 1.5;
}

.muted,
.card-head p,
.heatmap-panel p {
  margin: 8px 0 0;
  color: #9aa6c3;
  font-size: 0.92rem;
  line-height: 1.5;
}

.stats-grid,
.summary-grid,
.stat-grid-2,
.toolbar-grid,
.split-grid,
.home-grid {
  display: grid;
  gap: 18px;
}

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

.stat-card {
  min-height: 118px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.stat-card .brand {
  margin-top: 8px;
  font-size: 1.9rem;
}

.stat-card-icon {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border-radius: 16px;
  border: 1px solid rgba(38, 50, 79, 0.8);
}

.stat-card-icon svg {
  width: 22px;
  height: 22px;
  display: block;
}

.stat-card-icon.is-blue {
  color: #bfd0ff;
  background: rgba(79, 124, 255, 0.14);
}

.stat-card-icon.is-green {
  color: #86efac;
  background: rgba(16, 185, 129, 0.14);
}

.stat-card-icon.is-amber {
  color: #fcd34d;
  background: rgba(245, 158, 11, 0.14);
}

.stat-card-icon.is-gold {
  color: #f5d87f;
  background: rgba(251, 191, 36, 0.14);
}

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

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

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

.summary-item,
.mini-stat {
  padding: 18px;
  background: linear-gradient(180deg, rgba(24, 35, 61, 0.88), rgba(17, 27, 49, 0.96));
}

.summary-item span,
.mini-stat span {
  display: block;
  margin-bottom: 10px;
  color: #8fa6d6;
  font-size: 0.84rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.summary-item strong,
.mini-stat strong {
  display: block;
  color: var(--text);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.summary-item .secondary-value {
  margin-top: 8px;
  color: #d6e0f5;
}

.title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.title-row h2 {
  margin: 0;
}

.title-icon {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border-radius: 14px;
  background: rgba(79, 124, 255, 0.12);
  border: 1px solid rgba(79, 124, 255, 0.22);
  color: #bfd0ff;
}

.title-icon svg {
  width: 18px;
  height: 18px;
  display: block;
}

.split-grid {
  align-items: stretch;
  grid-template-columns: 380px minmax(0, 1fr);
}

.profile-shell {
  grid-template-columns: minmax(0, 430px) minmax(0, 520px);
  justify-content: start;
}

.profile-panel-card {
  height: fit-content;
}

.user-form-card {
  align-self: start;
  height: fit-content;
}

.field,
.checkbox-field {
  display: block;
  margin-bottom: 16px;
}

.field span,
.field label,
.checkbox-field {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
}

.field input,
.field select {
  width: 100%;
  margin-top: 8px;
  min-height: 50px;
  padding: 0 16px;
  color: var(--text);
  border-radius: 18px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.98), rgba(17, 27, 49, 0.98));
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.field select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, #8fa6d6 50%),
    linear-gradient(135deg, #8fa6d6 50%, transparent 50%);
  background-position:
    calc(100% - 22px) calc(50% - 3px),
    calc(100% - 16px) calc(50% - 3px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 42px;
}

.field input:focus,
.field select:focus {
  border-color: var(--line-focus);
  box-shadow: 0 0 0 4px rgba(79, 124, 255, 0.12);
}

.field input:disabled {
  opacity: 0.86;
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 0 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.98), rgba(17, 27, 49, 0.98));
}

.checkbox-field input {
  width: 16px;
  height: 16px;
  accent-color: var(--line-focus);
}

.primary-button,
.secondary-button,
.danger-button,
.ghost-button,
.map-button,
.outline-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 48px;
  padding: 0 16px;
  border-radius: 16px;
  cursor: pointer;
  font-size: 0.94rem;
  font-weight: 700;
  transition: transform 0.18s ease, opacity 0.18s ease, background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.primary-button:hover,
.secondary-button:hover,
.danger-button:hover,
.ghost-button:hover,
.map-button:hover,
.outline-button:hover {
  transform: translateY(-1px);
}

.primary-button {
  color: #fff;
  background: linear-gradient(180deg, rgba(79, 124, 255, 1), rgba(66, 110, 236, 1));
  border: 1px solid rgba(106, 146, 255, 0.7);
  box-shadow: 0 14px 28px rgba(42, 78, 173, 0.26);
}

.primary-button:hover {
  background: linear-gradient(180deg, rgba(106, 146, 255, 1), rgba(79, 124, 255, 1));
}

.secondary-button,
.outline-button {
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(53, 83, 143, 0.72);
}

.secondary-button:hover,
.outline-button:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(79, 124, 255, 0.72);
}

.ghost-button {
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.ghost-button:hover {
  background: rgba(255, 255, 255, 0.07);
}

.danger-button {
  color: #fecaca;
  background: rgba(239, 68, 68, 0.14);
  border: 1px solid rgba(239, 68, 68, 0.28);
}

.full-width {
  width: 100%;
}

.button-icon {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  color: currentColor;
}

.button-icon svg {
  width: 20px;
  height: 20px;
  display: block;
  filter: drop-shadow(0 0 0.2px currentColor);
}

.menu-link-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  color: currentColor;
}

.menu-link-icon svg {
  width: 18px;
  height: 18px;
  display: block;
  filter: drop-shadow(0 0 0.2px currentColor);
}

.home-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 18px;
  align-items: stretch;
  min-height: calc(100vh - var(--header-height) - 66px);
}

.home-primary-card,
.home-side-card {
  background: linear-gradient(180deg, rgba(18, 26, 47, 0.96), rgba(15, 23, 42, 0.98));
}

.home-primary-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: calc(100vh - var(--header-height) - 66px);
}

.home-card-head {
  padding: 20px 20px 14px;
}

.home-map-frame {
  flex: 1;
  padding: 0 16px 16px;
  position: relative;
}

#map {
  width: 100%;
  min-height: calc(100vh - var(--header-height) - 116px);
  height: 100%;
  border-radius: 24px;
  overflow: hidden;
  border: 1px solid rgba(38, 50, 79, 0.9);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.map-placeholder {
  position: absolute;
  inset: 0 16px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  border-radius: 24px;
  border: 1px dashed rgba(53, 83, 143, 0.62);
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.96), rgba(17, 27, 49, 0.98));
  z-index: 2;
}

.map-placeholder-copy {
  display: grid;
  gap: 8px;
  max-width: 420px;
  color: #c8d2ea;
  line-height: 1.6;
}

.map-placeholder-copy strong {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
}

.map-placeholder-copy span {
  color: #9fb3e8;
}

.home-side-column {
  display: grid;
  grid-template-rows: 1fr 1fr;
  gap: 18px;
  min-height: calc(100vh - var(--header-height) - 66px);
}

.home-side-card {
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.home-field {
  margin: 14px 0 0;
}

.home-cta {
  margin-top: 14px;
}

.insights-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  gap: 24px;
  margin-top: 24px;
  align-items: stretch;
}

.insights-side {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 24px;
  min-height: 100%;
}

.summary-panel,
.stats-panel,
.heatmap-panel,
.legend-panel {
  margin-top: 0;
}

.summary-panel,
.stats-panel {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.results-column {
  display: grid;
  gap: 24px;
  align-items: stretch;
}

.results-column .heatmap-panel {
  margin-top: 0;
  height: 100%;
}

.summary-grid-3,
.stat-grid-4 {
  grid-template-columns: 1fr;
}

.summary-grid,
.stat-grid-4 {
  flex: 1;
}

.progress-bar {
  width: 100%;
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(38, 50, 79, 0.58);
}

.progress-fill {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #2c7be5, #4f7cff, #22b8a5, #f2c14e);
  transition: width 0.24s ease;
}

.progress-inline {
  display: flex;
  align-items: center;
  gap: 12px;
}

.progress-inline .progress-bar {
  flex: 1;
}

.progress-copy {
  margin: 0;
  color: #c8d2ea;
  font-size: 0.9rem;
  text-align: right;
  white-space: nowrap;
  flex: 0 0 auto;
}

.legend-list {
  display: grid;
  gap: 10px;
  align-content: start;
}

.legend-list-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.legend-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 18px 20px;
  border-radius: 22px;
  background: rgba(24, 35, 61, 0.88);
  border: 1px solid rgba(38, 50, 79, 0.62);
}

.legend-color {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  flex: 0 0 auto;
  margin-top: 4px;
}

.legend-item strong {
  display: block;
  margin-bottom: 8px;
  font-size: 0.98rem;
}

.legend-item .muted {
  line-height: 1.45;
}

.legend-note {
  margin: 0;
  max-width: 540px;
  color: #9aa6c3;
  font-size: 0.92rem;
  line-height: 1.45;
  text-align: right;
}

.heatmap-action {
  min-width: 276px;
  min-height: 58px;
  padding: 0 24px;
  border-radius: 22px;
  font-size: 0.95rem;
}

.heatmap-action .button-icon {
  width: 22px;
  height: 22px;
}

.heatmap-action .button-icon svg {
  width: 22px;
  height: 22px;
  display: block;
}

.heatmap-wrap {
  flex: 1;
  overflow: auto;
}

#heatmapCanvas {
  display: block;
  max-width: 100%;
  border-radius: 22px;
  border: 1px solid rgba(38, 50, 79, 0.9);
  background: #0f172a;
}

.progress-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(4, 9, 18, 0.46);
  backdrop-filter: blur(8px);
}

.progress-modal-card {
  width: min(100%, 420px);
  padding: 22px;
  border-radius: 24px;
  border: 1px solid rgba(53, 83, 143, 0.62);
  background: linear-gradient(180deg, rgba(18, 26, 47, 0.98), rgba(10, 17, 32, 0.98));
  box-shadow: var(--shadow-lg);
}

.progress-modal-card h2 {
  margin: 0 0 16px;
  color: var(--text);
  font-size: 1.06rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.progress-bar-modal {
  height: 14px;
}

.status-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(4, 9, 18, 0.5);
  backdrop-filter: blur(8px);
}

.status-modal-card {
  width: min(100%, 440px);
  padding: 18px;
  border-radius: 24px;
  border: 1px solid rgba(53, 83, 143, 0.62);
  background: linear-gradient(180deg, rgba(18, 26, 47, 0.98), rgba(10, 17, 32, 0.98));
  box-shadow: var(--shadow-lg);
}

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

.status-modal-head h2 {
  margin: 0;
  color: var(--text);
  font-size: 1.04rem;
  font-weight: 700;
}

.status-modal-body {
  margin: 0;
}

.toolbar {
  background: rgba(11, 19, 38, 0.88);
}

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

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

.table-row {
  padding: 16px;
  border-radius: 22px;
  border: 1px solid rgba(38, 50, 79, 0.9);
  background: linear-gradient(180deg, rgba(24, 35, 61, 0.92), rgba(17, 27, 49, 0.98));
}

.table-row-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.user-row-head {
  align-items: center;
}

.user-row-info {
  min-width: 0;
}

.user-row-info > strong {
  display: block;
  font-size: 1.14rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.user-row-actions {
  margin-top: 0;
  justify-content: flex-end;
  flex-wrap: nowrap;
}

.meta {
  margin-top: 8px;
  color: #9fb3e8;
  line-height: 1.45;
}

.table-row-actions {
  flex-wrap: wrap;
  margin-top: 14px;
}

.inline-form {
  display: inline;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 500;
}

.badge-active {
  color: #bbf7d0;
  background: rgba(16, 185, 129, 0.16);
}

.badge-passive {
  color: #fde68a;
  background: rgba(245, 158, 11, 0.18);
}

.badge-role {
  color: #dbeafe;
  background: rgba(79, 124, 255, 0.18);
}

.badge-self {
  color: #b8e8ff;
  background: rgba(125, 211, 252, 0.16);
}

.alert {
  margin: 0 0 16px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid transparent;
  line-height: 1.45;
}

.alert-success {
  color: #d1fae5;
  background: var(--success-bg);
  border-color: rgba(16, 185, 129, 0.28);
}

.alert-error {
  color: #fecaca;
  background: var(--danger-bg);
  border-color: rgba(239, 68, 68, 0.28);
}

.alert-info {
  color: #dbe6ff;
  background: var(--info-bg);
  border-color: rgba(79, 124, 255, 0.28);
}

.alert-warning {
  color: #fde68a;
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.28);
}

.empty-card {
  color: #9aa6c3;
}

.small-help {
  margin-top: 8px;
  color: #8fa6d6;
  font-size: 0.88rem;
}

.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.login-card {
  width: min(100%, 460px);
  padding: 30px;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 26px;
}

.login-brand-icon {
  width: 56px;
  height: 56px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border-radius: 18px;
  color: #9db8ff;
  background: linear-gradient(180deg, rgba(24, 35, 61, 0.98), rgba(15, 23, 42, 0.98));
  border: 1px solid rgba(53, 83, 143, 0.92);
}

.login-brand-icon svg {
  width: 30px;
  height: 30px;
  display: block;
  filter: drop-shadow(0 0 0.25px currentColor);
}

.login-brand h1 {
  margin: 0;
  color: var(--text);
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.04em;
}

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

.login-field {
  margin-bottom: 0;
}

.login-field span {
  display: block;
  margin-bottom: 8px;
}

.login-submit {
  margin-top: 4px;
  gap: 10px;
}

.login-helper-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 16px;
  color: #8fb2ff;
  text-decoration: none;
  font-weight: 600;
  margin-top: 4px;
  border: 1px solid rgba(143, 178, 255, 0.34);
  border-radius: 14px;
  background: rgba(18, 28, 49, 0.72);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition: color 0.18s ease, border-color 0.18s ease, background-color 0.18s ease, transform 0.18s ease;
}

.login-helper-link:hover {
  color: #bfd3ff;
  border-color: rgba(191, 211, 255, 0.52);
  background: rgba(30, 45, 74, 0.92);
  transform: translateY(-1px);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.user-email {
  margin-top: 6px;
}

#locationSearchInput {
  text-overflow: ellipsis;
}

.presence-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(148, 163, 184, 0.12);
  color: #d7deea;
}

.presence-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: currentColor;
  flex: 0 0 auto;
}

.presence-badge.is-online {
  color: #3ac779;
  background: rgba(58, 199, 121, 0.12);
  border-color: rgba(58, 199, 121, 0.28);
}

.presence-badge.is-recent {
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.28);
}

.presence-badge.is-away {
  color: #c5cedd;
}

.presence-badge.is-registered {
  color: #6ee7f0;
  background: rgba(110, 231, 240, 0.11);
  border-color: rgba(110, 231, 240, 0.24);
}

.app-shell[data-sidebar-collapsed="true"] .sidebar {
  width: var(--sidebar-collapsed);
  min-width: var(--sidebar-collapsed);
  padding-left: 12px;
  padding-right: 12px;
}

.app-shell[data-sidebar-collapsed="true"] .brand-copy,
.app-shell[data-sidebar-collapsed="true"] .nav-link span:last-child,
.app-shell[data-sidebar-collapsed="true"] .sidebar-contact-label,
.app-shell[data-sidebar-collapsed="true"] .sidebar-contact-link span:last-child {
  display: none;
}

.app-shell[data-sidebar-collapsed="true"] .sidebar-top {
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.app-shell[data-sidebar-collapsed="true"] .nav-link {
  justify-content: center;
  padding: 0;
}

.app-shell[data-sidebar-collapsed="true"] .sidebar-contact-link {
  justify-content: center;
  padding: 0;
}

.app-shell[data-sidebar-collapsed="true"] .brand-wrap {
  justify-content: center;
}

.app-shell[data-sidebar-collapsed="true"] .sidebar-utility {
  transform: rotate(180deg);
}

@media (max-width: 1180px) {
  .home-shell,
  .split-grid,
  .home-grid {
    grid-template-columns: 1fr;
  }

  .home-side-column {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: none;
    min-height: auto;
  }

  #map {
    min-height: 560px;
  }

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

@media (max-width: 900px) {
  .desktop-only {
    display: none;
  }

  .mobile-only {
    display: inline-flex;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }

  .sidebar[data-open="true"] {
    transform: translateX(0);
  }

  .mobile-backdrop[data-open="true"] {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 25;
    background: rgba(2, 6, 17, 0.72);
    border: 0;
    backdrop-filter: blur(6px);
  }

  .topbar {
    padding: 16px 20px;
  }

  .topbar h1 {
    font-size: 1.7rem;
  }

  .topbar p {
    font-size: 0.92rem;
  }

  .content {
    padding: 24px 20px 30px;
  }
}

@media (max-width: 720px) {
  .insights-layout,
  .insights-side,
  .summary-grid,
  .stat-grid-2,
  .stat-grid-4,
  .toolbar-grid,
  .home-side-column,
  .stats-grid,
  .results-column,
  .legend-list-grid,
  .summary-grid-3 {
    grid-template-columns: 1fr;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
  }

  .user-row-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .user-row-actions {
    width: 100%;
    margin-top: 14px;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .profile-menu {
    width: min(100vw - 32px, 280px);
  }

  .home-card-head {
    padding-bottom: 10px;
  }

  .home-side-card,
  .card,
  .list-card,
  .stat-card,
  .heatmap-panel,
  .login-card {
    padding: 18px;
  }

  .section-head-spread.align-start-mobile {
    flex-direction: column;
    align-items: flex-start;
  }

  .legend-note {
    text-align: left;
  }

  .heatmap-action {
    width: 100%;
    min-width: 0;
  }

  #map {
    min-height: 420px;
  }
}
