:root {
  --ink: #172033;
  --muted: #667085;
  --line: #d9e0ea;
  --panel: #ffffff;
  --page: #f5f7fb;
  --blue: #2563eb;
  --green: #16a34a;
  --amber: #d97706;
}

body {
  background: var(--page);
  color: var(--ink);
}

body.modal-open {
  overflow: hidden;
}

[hidden] {
  display: none !important;
}

.dashboard-shell {
  display: flex;
  min-height: 100vh;
}

.dashboard-sidebar {
  background: #ffffff;
  border-right: 1px solid var(--line);
  display: flex;
  flex: 0 0 260px;
  flex-direction: column;
  gap: 24px;
  min-height: 100vh;
  padding: 22px 18px;
  position: sticky;
  top: 0;
}

.sidebar-brand {
  display: grid;
  gap: 3px;
}

.sidebar-brand span {
  align-items: center;
  display: inline-flex;
  gap: 9px;
  font-size: 1.02rem;
  font-weight: 800;
}

.sidebar-brand img,
.platform-mark img,
.login-logo {
  border-radius: 8px;
  display: block;
  object-fit: cover;
}

.sidebar-brand strong {
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

.sidebar-nav-button {
  align-items: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  display: flex;
  gap: 10px;
  font-weight: 700;
  justify-content: flex-start;
  min-height: 42px;
  padding: 9px 11px;
  text-align: left;
}

.sidebar-nav-button i {
  flex: 0 0 18px;
  font-size: 1rem;
  line-height: 1;
  text-align: center;
}

.sidebar-nav-button:hover {
  background: #f1f5f9;
  color: var(--ink);
}

.sidebar-nav-button.active {
  background: #eaf1ff;
  border-color: #c7d7fe;
  color: var(--blue);
}

.sidebar-account {
  border-top: 1px solid var(--line);
  color: var(--muted);
  display: grid;
  gap: 12px;
  margin-top: auto;
  padding-top: 16px;
}

.sidebar-account > div {
  align-items: center;
  display: flex;
  gap: 8px;
  min-width: 0;
}

.sidebar-account span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-content {
  flex: 1 1 auto;
  min-width: 0;
}

.login-page {
  align-items: stretch;
  background:
    linear-gradient(135deg, rgba(23, 32, 51, 0.94), rgba(22, 101, 90, 0.82)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1200' height='800' viewBox='0 0 1200 800'%3E%3Crect width='1200' height='800' fill='%23eef3f0'/%3E%3Cg fill='none' stroke='%2399a7b5' stroke-width='2' opacity='.45'%3E%3Cpath d='M0 130h1200M0 270h1200M0 415h1200M0 560h1200M0 700h1200M120 0v800M290 0v800M470 0v800M660 0v800M850 0v800M1030 0v800'/%3E%3Cpath d='M80 700C240 610 340 630 470 520s240-90 360-210 210-90 330-170' stroke='%232563eb' stroke-width='8' opacity='.45'/%3E%3Cpath d='M120 220c130 90 210 100 330 50s260-30 390 70 210 130 300 95' stroke='%2316a34a' stroke-width='6' opacity='.38'/%3E%3C/g%3E%3Cg%3E%3Ccircle cx='245' cy='610' r='16' fill='%232563eb'/%3E%3Ccircle cx='655' cy='355' r='16' fill='%2316a34a'/%3E%3Ccircle cx='970' cy='185' r='16' fill='%23d97706'/%3E%3C/g%3E%3C/svg%3E");
  background-position: center;
  background-size: cover;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow: hidden;
  padding: 0;
  position: relative;
}

.platform-landing-nav {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  left: 0;
  padding: 24px clamp(20px, 5vw, 64px);
  position: absolute;
  right: 0;
  top: 0;
  z-index: 2;
}

.platform-mark {
  align-items: center;
  color: #fff;
  display: inline-flex;
  font-size: 1.05rem;
  font-weight: 800;
  gap: 10px;
  text-decoration: none;
}

.platform-nav-links {
  display: flex;
  gap: 18px;
}

.platform-nav-links a {
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.9rem;
  text-decoration: none;
}

.platform-nav-links a:hover {
  color: #fff;
}

.platform-landing {
  align-items: center;
  display: grid;
  gap: clamp(24px, 6vw, 80px);
  grid-template-columns: minmax(0, 1fr) minmax(340px, 430px);
  margin: 0 auto;
  max-width: 1180px;
  padding: 112px clamp(20px, 5vw, 64px) 48px;
  position: relative;
  width: 100%;
  z-index: 1;
}

.platform-copy {
  color: #fff;
  max-width: 680px;
}

.platform-eyebrow {
  color: #a7f3d0;
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  margin: 0 0 14px;
  text-transform: uppercase;
}

.platform-copy h1 {
  font-size: clamp(2.5rem, 6vw, 5.6rem);
  font-weight: 800;
  line-height: 0.98;
  margin: 0;
  max-width: 740px;
}

.platform-lead {
  color: rgba(255, 255, 255, 0.82);
  font-size: 1.08rem;
  line-height: 1.6;
  margin: 22px 0 0;
  max-width: 600px;
}

.platform-status-grid {
  display: grid;
  gap: 1px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 36px;
  max-width: 560px;
}

.platform-status-grid div {
  background: rgba(255, 255, 255, 0.13);
  border: 1px solid rgba(255, 255, 255, 0.18);
  padding: 16px;
}

.platform-status-grid div:first-child {
  border-radius: 8px 0 0 8px;
}

.platform-status-grid div:last-child {
  border-radius: 0 8px 8px 0;
}

.platform-status-grid span {
  color: rgba(255, 255, 255, 0.68);
  display: block;
  font-size: 0.78rem;
  margin-bottom: 6px;
}

.platform-status-grid strong {
  color: #fff;
  display: block;
  font-size: 1rem;
}

.login-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
  display: grid;
  gap: 24px;
  padding: 24px;
  width: 100%;
}

.login-panel-header {
  align-items: flex-start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.login-brand {
  color: var(--green);
  display: block;
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.login-panel h2 {
  font-size: 1.6rem;
  margin: 6px 0 0;
}

.login-logo {
  margin-top: 10px;
}

.login-badge {
  background: #ecfdf3;
  border: 1px solid #bbf7d0;
  border-radius: 999px;
  color: #166534;
  flex: 0 0 auto;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 5px 9px;
}

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

.login-form label {
  color: var(--muted);
  font-size: 0.875rem;
}

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

.login-form .form-control {
  min-height: 44px;
}

.login-form .btn {
  min-height: 44px;
}

.login-error {
  color: #b42318;
  min-height: 20px;
  font-size: 0.875rem;
}

.app-modal-backdrop {
  align-items: center;
  background: rgba(23, 32, 51, 0.58);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 24px;
  position: fixed;
  z-index: 2000;
}

.app-modal {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.28);
  display: grid;
  gap: 16px;
  max-height: min(820px, calc(100vh - 48px));
  max-width: 980px;
  overflow: auto;
  padding: 18px;
  width: min(980px, calc(100vw - 32px));
}

.app-modal-header {
  align-items: flex-start;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding-bottom: 12px;
}

.app-modal-header h2 {
  font-size: 1.1rem;
  margin: 0;
}

.app-modal-header span {
  color: var(--muted);
  display: block;
  font-size: 0.875rem;
  margin-top: 4px;
}

@media (max-width: 900px) {
  .login-page {
    min-height: auto;
    overflow: visible;
  }

  .platform-landing-nav {
    position: relative;
  }

  .platform-landing {
    grid-template-columns: 1fr;
    gap: 24px;
    padding-bottom: 28px;
    padding-top: 20px;
  }

  .platform-copy h1 {
    font-size: 2.8rem;
    max-width: 620px;
  }

  .login-panel {
    max-width: 540px;
  }
}

@media (max-width: 560px) {
  .platform-landing-nav {
    align-items: flex-start;
    flex-direction: column;
    padding-bottom: 12px;
  }

  .platform-landing {
    padding-left: 16px;
    padding-right: 16px;
  }

  .platform-copy h1 {
    font-size: 2.15rem;
    line-height: 1.02;
  }

  .platform-lead {
    font-size: 0.98rem;
    line-height: 1.5;
    margin-top: 14px;
  }

  .platform-status-grid {
    margin-top: 18px;
  }

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

  .platform-status-grid div,
  .platform-status-grid div:first-child,
  .platform-status-grid div:last-child {
    border-radius: 8px;
    padding: 10px;
  }

  .platform-status-grid span {
    font-size: 0.7rem;
  }

  .platform-status-grid strong {
    font-size: 0.82rem;
  }

  .login-panel-header {
    display: grid;
  }
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--green);
  display: inline-block;
}

.metric,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metric {
  min-height: 96px;
  padding: 16px;
}

.metric span {
  color: var(--muted);
  display: block;
  font-size: 0.875rem;
}

.metric strong {
  display: block;
  font-size: 2rem;
  line-height: 1.1;
  margin-top: 12px;
}

.panel {
  padding: 16px;
}

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

.panel-header h1,
.panel-header h2 {
  font-size: 1rem;
  margin: 0;
}

.map-surface {
  aspect-ratio: 16 / 9;
  background: #e6edf5;
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 320px;
  overflow: hidden;
  position: relative;
}

.live-map {
  height: 100%;
  min-height: 320px;
  width: 100%;
}

.map-empty {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.875rem;
  left: 50%;
  padding: 10px 12px;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 500;
}

.path-count-marker {
  align-items: center;
  display: flex;
  justify-content: center;
}

.path-count-marker span {
  align-items: center;
  background: #172033;
  border: 2px solid #ffffff;
  border-radius: 50%;
  color: #ffffff;
  display: flex;
  font-size: 0.72rem;
  font-weight: 800;
  height: 26px;
  justify-content: center;
  min-width: 26px;
  padding: 0 4px;
}

.map-grid {
  background-image:
    linear-gradient(rgba(23, 32, 51, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 32, 51, 0.08) 1px, transparent 1px);
  background-size: 44px 44px;
  inset: 0;
  position: absolute;
}

.map-pin {
  position: absolute;
  transform: translate(-50%, -50%);
}

.map-pin span {
  background: var(--blue);
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.35);
  display: block;
  height: 20px;
  width: 20px;
}

.map-pin.secondary span {
  background: var(--amber);
  box-shadow: 0 6px 18px rgba(217, 119, 6, 0.35);
}

.map-pin label {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 0.75rem;
  margin-top: 6px;
  padding: 3px 6px;
  white-space: nowrap;
}

.timeline {
  display: grid;
  gap: 10px;
  max-height: 360px;
  overflow: auto;
}

.timeline-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.timeline-summary {
  background: #ecfdf3;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  padding: 10px;
}

.timeline-summary strong,
.timeline-item strong {
  display: block;
  font-size: 0.875rem;
}

.timeline-summary span,
.timeline-item span {
  color: var(--muted);
  display: block;
  font-size: 0.8125rem;
}

.policy-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.policy-grid label {
  color: var(--muted);
  font-size: 0.8125rem;
}

.management-form,
.assignment-form {
  display: grid;
  gap: 12px;
}

.management-form label,
.assignment-form label {
  color: var(--muted);
  font-size: 0.8125rem;
}

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

.assignment-form button,
.assignment-form .form-status {
  align-self: end;
}

.form-status {
  color: var(--muted);
  font-size: 0.875rem;
  min-height: 24px;
}

.form-actions,
.management-toolbar {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.management-toolbar {
  justify-content: flex-end;
}

.management-toolbar .form-control {
  min-width: 240px;
}

.management-toolbar .form-select {
  min-width: 140px;
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 220px;
}

.table-actions-compact {
  min-width: 150px;
}

.employee-detail {
  display: grid;
  gap: 14px;
}

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

.employee-detail-header strong {
  display: block;
}

.employee-detail-header span {
  color: var(--muted);
  font-size: 0.8125rem;
}

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

.detail-grid div,
.detail-list-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.detail-grid span,
.detail-section > span,
.detail-list-item span {
  color: var(--muted);
  display: block;
  font-size: 0.78rem;
}

.detail-grid strong,
.detail-section strong,
.detail-list-item strong {
  display: block;
  font-size: 0.92rem;
  margin-top: 4px;
}

.detail-section {
  display: grid;
  gap: 8px;
}

.detail-list-item {
  display: grid;
  gap: 2px;
}

.tenant-admin-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.tenant-admin-chip {
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  border-radius: 6px;
  color: #243876;
  display: inline-flex;
  font-size: 0.75rem;
  line-height: 1.2;
  padding: 3px 6px;
}

code {
  color: var(--ink);
}

@media (max-width: 700px) {
  .dashboard-shell {
    flex-direction: column;
  }

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

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

  .sidebar-account {
    margin-top: 0;
  }

  .assignment-form {
    grid-template-columns: 1fr;
  }

  .management-toolbar {
    align-items: stretch;
    width: 100%;
  }

  .management-toolbar .form-control,
  .management-toolbar .form-select,
  .management-toolbar .btn {
    width: 100%;
  }

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