:root {
  color-scheme: light;
  --color-scrollbar-thumb: #b6c2d1;
  --color-scrollbar-thumb-hover: #94a3b8;
  --color-body-bg: #f1f5f9;
  --color-content-bg: #ffffff;
  --color-primary-bg: #0f172a;
  --color-sidebar-bg: #0f172a;
  --color-sidebar-text: #94a3b8;
  --color-sidebar-active-bg: rgba(0, 212, 255, 0.1);
  --color-sidebar-active-text: #00d4ff;
  --color-sidebar-hover-bg: rgba(255, 255, 255, 0.06);
  --color-navbar-text: #f1f5f9;
  --color-navbar-border: rgba(255, 255, 255, 0.07);
  --color-text: #0f172a;
  --color-text-dim: #475569;
  --color-border: #e2e8f0;
  --color-dropdown-bg: #ffffff;
  --color-dropdown-text: #0f172a;
  --color-dropdown-border: #e2e8f0;
  --color-dropdown-header-bg: #f8fafc;
  --color-dropdown-header-text: #475569;
  --color-input-bg: #ffffff;
  --color-input-border: #cbd5e1;
  --color-input-focus: #0ea5e9;
  --color-btn-primary: #0ea5e9;
  --color-btn-primary-hover: #0284c7;
  --color-btn-disabled: #bae6fd;
  --color-logout-text: #ef4444;
  --color-logout-hover-bg: #fef2f2;
  --color-logout-hover-text: #dc2626;
  --color-spinner-border: #e2e8f0;
  --color-spinner-top: #0ea5e9;
  --color-toggle-bg: #cbd5e1;
  --color-toggle-bg-checked: #0ea5e9;
  --color-toggle-knob: #ffffff;
  --color-card-bg: #f8fafc;
  --color-card-border: #e2e8f0;
  --color-stat-value: #0f172a;
  --color-tag-bg: #e0f2fe;
  --color-tag-text: #0284c7;
  --color-primary: #0ea5e9;
  --color-success: #16a34a;
  --color-error: #dc2626;
  --chevron-icon: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2010%206'%3E%3Cpath%20d='M1%201l4%204%204-4'%20stroke='%23475569'%20stroke-width='1.5'%20fill='none'%20stroke-linecap='round'%20stroke-linejoin='round'/%3E%3C/svg%3E");
  --shadow-card: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-dropdown: 0 8px 24px rgba(0,0,0,0.08);
}

html.dark {
  color-scheme: dark;
  --color-scrollbar-thumb: rgba(148, 163, 184, 0.35);
  --color-scrollbar-thumb-hover: rgba(148, 163, 184, 0.55);
  --color-body-bg: #0a0f1e;
  --color-content-bg: #0d1526;
  --color-primary-bg: #080d1a;
  --color-sidebar-bg: #080d1a;
  --color-sidebar-text: #64748b;
  --color-sidebar-active-bg: rgba(0, 212, 255, 0.1);
  --color-sidebar-active-text: #00d4ff;
  --color-sidebar-hover-bg: rgba(255, 255, 255, 0.05);
  --color-navbar-text: #e2e8f0;
  --color-navbar-border: rgba(255, 255, 255, 0.06);
  --color-text: #e2e8f0;
  --color-text-dim: #64748b;
  --color-border: rgba(255, 255, 255, 0.07);
  --color-dropdown-bg: #111827;
  --color-dropdown-text: #e2e8f0;
  --color-dropdown-border: rgba(255, 255, 255, 0.08);
  --color-dropdown-header-bg: #0d1526;
  --color-dropdown-header-text: #64748b;
  --color-input-bg: #111827;
  --color-input-border: rgba(255, 255, 255, 0.1);
  --color-input-focus: #00d4ff;
  --color-btn-primary: #00d4ff;
  --color-btn-primary-hover: #33dcff;
  --color-btn-disabled: rgba(0, 212, 255, 0.3);
  --color-logout-text: #f87171;
  --color-logout-hover-bg: rgba(239, 68, 68, 0.1);
  --color-logout-hover-text: #fca5a5;
  --color-spinner-border: rgba(255, 255, 255, 0.08);
  --color-spinner-top: #00d4ff;
  --color-toggle-bg: rgba(255, 255, 255, 0.1);
  --color-toggle-bg-checked: #00d4ff;
  --color-toggle-knob: #ffffff;
  --color-card-bg: #111827;
  --color-card-border: rgba(255, 255, 255, 0.07);
  --color-stat-value: #00d4ff;
  --color-tag-bg: rgba(0, 212, 255, 0.1);
  --color-tag-text: #00d4ff;
  --color-primary: #00d4ff;
  --color-success: #22c55e;
  --color-error: #f87171;
  --chevron-icon: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2010%206'%3E%3Cpath%20d='M1%201l4%204%204-4'%20stroke='%2394a3b8'%20stroke-width='1.5'%20fill='none'%20stroke-linecap='round'%20stroke-linejoin='round'/%3E%3C/svg%3E");
  --shadow-card: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-dropdown: 0 8px 32px rgba(0,0,0,0.4);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  background: var(--color-body-bg);
  color: var(--color-text);
  line-height: 1.6;
}

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

button {
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  cursor: pointer;
}

input, textarea, select {
  font-family: "Inter", system-ui, -apple-system, sans-serif;
}

html {
  scrollbar-color: var(--color-scrollbar-thumb) transparent;
}

* {
  scrollbar-width: thin;
}

*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  background: var(--color-scrollbar-thumb);
  border-radius: 4px;
}
*::-webkit-scrollbar-thumb:hover {
  background: var(--color-scrollbar-thumb-hover);
}

*::-webkit-scrollbar-corner {
  background: transparent;
}

:focus-visible {
  outline: 2px solid var(--color-input-focus);
  outline-offset: 2px;
  border-radius: 3px;
}

.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 9999;
  padding: 0.5rem 1rem;
  background: var(--color-btn-primary);
  color: #080d1a;
  font-weight: 700;
  font-size: 0.875rem;
  border-radius: 0 0 6px 6px;
  text-decoration: none;
  transition: top 0.15s;
}
.skip-link:focus {
  top: 0;
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.icon {
  display: block;
  flex-shrink: 0;
  width: 1.25rem;
  height: 1.25rem;
}

.nav-icon > .icon {
  width: 20px;
  height: 20px;
  margin: 0 auto;
}

.sidebar-toggle-btn .nav-icon > .icon {
  width: 15px;
  height: 15px;
}

.nav-group-btn .chevron > .icon {
  width: 13px;
  height: 13px;
}

.item-icon > .icon {
  width: 16px;
  height: 16px;
  margin: 0 auto;
}

.bell-icon > .icon {
  width: 18px;
  height: 18px;
}

.btn-icon > .icon,
.chip-remove > .icon,
.check-icon > .icon {
  width: 1rem;
  height: 1rem;
}

.check-icon > .icon {
  margin-top: 0.1rem;
}

.inline-icon {
  display: inline-block;
  width: 1em;
  height: 1em;
  vertical-align: -0.125em;
}

.back-link,
.nav-card-title,
.stop-type {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--color-primary-bg);
  color: var(--color-navbar-text);
  padding: 0 1.25rem;
  position: sticky;
  top: 0;
  z-index: 1020;
  height: 56px;
  border-bottom: 1px solid var(--color-navbar-border);
  flex-shrink: 0;
}
.navbar .navbar-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.navbar .mobile-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: transparent;
  border: none;
  color: var(--color-navbar-text);
  font-size: 1.25rem;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.15s;
}
.navbar .mobile-menu-btn:hover {
  background: var(--color-sidebar-hover-bg);
}
.navbar .brand {
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: -0.02em;
  color: #e2e8f0;
}
.navbar .brand span {
  color: #00d4ff;
}
.navbar .navbar-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.app-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.layout {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.content {
  flex: 1;
  padding: 2rem;
  background: var(--color-content-bg);
  overflow-y: auto;
  min-width: 0;
}
.content:focus {
  outline: 2px solid var(--color-input-focus);
  outline-offset: -4px;
}

.page-title {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--color-text);
  margin-bottom: 1.5rem;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}
.page-header h1 {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.card {
  background: var(--color-card-bg);
  border: 1px solid var(--color-card-border);
  border-radius: 10px;
  padding: 1.5rem;
  box-shadow: var(--shadow-card);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--color-card-bg);
  border: 1px solid var(--color-card-border);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow-card);
}
.stat-card .stat-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--color-text-dim);
  margin-bottom: 0.4rem;
}
.stat-card .stat-value {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--color-stat-value);
  line-height: 1;
}
.stat-card .stat-sub {
  font-size: 0.8rem;
  color: var(--color-text-dim);
  margin-top: 0.35rem;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-card-bg);
  border: 1px solid var(--color-card-border);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
  font-size: 0.875rem;
}
.data-table thead tr {
  background: var(--color-body-bg);
  border-bottom: 1px solid var(--color-border);
}
.data-table thead tr th {
  padding: 0.65rem 1rem;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--color-text-dim);
}
.data-table tbody tr {
  border-bottom: 1px solid var(--color-border);
  transition: background 0.12s;
}
.data-table tbody tr:last-child {
  border-bottom: none;
}
.data-table tbody tr:hover {
  background: var(--color-body-bg);
}
.data-table td {
  padding: 0.75rem 1rem;
  color: var(--color-text);
  vertical-align: middle;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 100px;
  font-size: 0.7rem;
  font-weight: 600;
  background: var(--color-tag-bg);
  color: var(--color-tag-text);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.btn-admin {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-admin-primary {
  background: var(--color-btn-primary);
  color: #080d1a;
}
.btn-admin-primary:hover {
  background: var(--color-btn-primary-hover);
}
.btn-admin-primary:disabled {
  background: var(--color-btn-disabled);
  cursor: not-allowed;
}
.btn-admin-ghost {
  background: transparent;
  color: var(--color-text-dim);
  border: 1px solid var(--color-border);
}
.btn-admin-ghost:hover {
  color: var(--color-text);
  border-color: var(--color-input-border);
}
.btn-admin-danger {
  background: transparent;
  color: var(--color-logout-text);
  border: 1px solid rgba(239, 68, 68, 0.2);
}
.btn-admin-danger:hover {
  background: var(--color-logout-hover-bg);
  color: var(--color-logout-hover-text);
}

.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--color-text-dim);
  font-size: 0.9rem;
}

.alert {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.875rem;
  margin-bottom: 1rem;
}
.alert-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #f87171;
}
.alert-success {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.2);
  color: #34d399;
}
.alert-info {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.2);
  color: #60a5fa;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--color-border);
}
.setting-row:last-child {
  border-bottom: none;
}
.setting-row .setting-info h3 {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.2rem;
}
.setting-row .setting-info p {
  font-size: 0.8rem;
  color: var(--color-text-dim);
}

.error {
  color: #ef4444;
  font-size: 0.875rem;
}

.sidebar {
  width: 310px;
  background: var(--color-sidebar-bg);
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  flex-shrink: 0;
  border-right: 1px solid var(--color-navbar-border);
  display: flex;
  flex-direction: column;
}
.sidebar.collapsed {
  width: 56px;
}
.sidebar.collapsed .sidebar-toggle-btn,
.sidebar.collapsed .nav-group-btn,
.sidebar.collapsed .sidebar-nav a {
  justify-content: center;
  padding: 0.7rem 0;
  gap: 0;
}
.sidebar.collapsed .nav-label {
  opacity: 0;
  max-width: 0;
  overflow: hidden;
}
.sidebar.collapsed .nav-icon {
  width: 56px;
  text-align: center;
}
.sidebar.collapsed .nav-group-btn .chevron {
  opacity: 0;
  max-width: 0;
  overflow: hidden;
}
.sidebar.collapsed .nav-group-body {
  padding-left: 0;
  margin-left: 0;
  border-left: none;
}
.sidebar.collapsed .sidebar-nav {
  scrollbar-gutter: auto;
}

.sidebar-toggle-btn {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.8rem 0.75rem;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--color-navbar-border);
  color: var(--color-sidebar-text);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, padding 0.25s, gap 0.25s;
  flex-shrink: 0;
}
.sidebar-toggle-btn .nav-icon {
  font-size: 0.85rem;
  flex-shrink: 0;
  width: 20px;
  text-align: center;
  transition: width 0.25s, transform 0.25s;
  opacity: 0.5;
}
.sidebar-toggle-btn .nav-label {
  white-space: nowrap;
  max-width: 200px;
  transition: opacity 0.2s, max-width 0.25s;
}
.sidebar-toggle-btn:hover {
  background: var(--color-sidebar-hover-bg);
  color: #e2e8f0;
}
.sidebar-toggle-btn:hover .nav-icon {
  opacity: 0.85;
}

.sidebar-nav {
  padding: 0.75rem 0.75rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-gutter: stable;
  scrollbar-color: rgba(148, 163, 184, 0.35) transparent;
}
.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.35);
}
.sidebar-nav::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.55);
}
.sidebar-nav a {
  color: var(--color-sidebar-text);
  text-decoration: none;
  padding: 0.6rem 0.75rem;
  border-radius: 7px;
  transition: background 0.12s, color 0.12s, padding 0.25s, gap 0.25s;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.875rem;
  font-weight: 500;
}
.sidebar-nav a .nav-icon {
  font-size: 1.15rem;
  flex-shrink: 0;
  width: 22px;
  text-align: center;
  opacity: 0.75;
  transition: opacity 0.12s, width 0.25s;
  font-weight: 700;
}
.sidebar-nav a .nav-label {
  white-space: nowrap;
  max-width: 200px;
  transition: opacity 0.2s, max-width 0.25s;
}
.sidebar-nav a:hover {
  background: var(--color-sidebar-hover-bg);
  color: #e2e8f0;
}
.sidebar-nav a:hover .nav-icon {
  opacity: 1;
}
.sidebar-nav a.active, .sidebar-nav a[aria-current=page] {
  background: var(--color-sidebar-active-bg);
  color: var(--color-sidebar-active-text);
}
.sidebar-nav a.active .nav-icon, .sidebar-nav a[aria-current=page] .nav-icon {
  opacity: 1;
}
.sidebar-nav a:focus-visible {
  outline: 2px solid var(--color-sidebar-active-text);
  outline-offset: -2px;
}

.sidebar-toggle-btn:focus-visible {
  outline: 2px solid var(--color-sidebar-active-text);
  outline-offset: -2px;
}

.nav-group-btn {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.6rem 0.75rem;
  background: transparent;
  border: none;
  border-radius: 7px;
  color: var(--color-sidebar-text);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.12s, color 0.12s, padding 0.25s, gap 0.25s;
}
.nav-group-btn .nav-icon {
  font-size: 1.15rem;
  flex-shrink: 0;
  width: 22px;
  text-align: center;
  opacity: 0.75;
  transition: opacity 0.12s, width 0.25s;
}
.nav-group-btn .nav-label {
  white-space: nowrap;
  max-width: 200px;
  transition: opacity 0.2s, max-width 0.25s;
}
.nav-group-btn .chevron {
  margin-left: auto;
  font-size: 0.7rem;
  opacity: 0.6;
  transition: transform 0.2s, opacity 0.2s, max-width 0.25s;
}
.nav-group-btn[aria-expanded=true] .chevron {
  transform: rotate(90deg);
}
.nav-group-btn:hover {
  background: var(--color-sidebar-hover-bg);
  color: #e2e8f0;
}
.nav-group-btn:hover .nav-icon {
  opacity: 1;
}
.nav-group-btn:focus-visible {
  outline: 2px solid var(--color-sidebar-active-text);
  outline-offset: -2px;
}
.nav-group-btn.active {
  color: var(--color-sidebar-active-text);
}
.nav-group-btn.active .nav-icon {
  opacity: 1;
}

.nav-group-body {
  display: none;
  flex-direction: column;
  gap: 0.15rem;
  padding-left: 0.35rem;
  margin-left: 0.9rem;
  border-left: 1px solid var(--color-navbar-border);
}
.nav-group-body.open {
  display: flex;
}

.user-dropdown {
  position: relative;
  display: inline-block;
}
.user-dropdown .dropdown-trigger {
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  border-radius: 7px;
  transition: opacity 0.15s;
}
.user-dropdown .dropdown-trigger:hover {
  opacity: 0.8;
}
.user-dropdown .dropdown-trigger:focus-visible {
  outline: 2px solid var(--color-input-focus);
  outline-offset: 3px;
  border-radius: 7px;
}
.user-dropdown .dropdown-trigger .avatar {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: linear-gradient(135deg, #00d4ff 0%, #a78bfa 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: #080d1a;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0;
}
.user-dropdown .dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 0.5rem);
  background: var(--color-dropdown-bg);
  border: 1px solid var(--color-dropdown-border);
  border-radius: 12px;
  box-shadow: var(--shadow-dropdown);
  min-width: 224px;
  z-index: 1100;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-6px) scale(0.97);
  transition: opacity 0.14s ease, transform 0.14s ease;
  pointer-events: none;
}
.user-dropdown .dropdown-menu.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
.user-dropdown .dropdown-menu .dropdown-header {
  padding: 0.85rem 1rem 0.8rem;
  background: var(--color-dropdown-header-bg);
  border-bottom: 1px solid var(--color-dropdown-border);
}
.user-dropdown .dropdown-menu .dropdown-header .header-label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--color-dropdown-header-text);
  margin-bottom: 0.25rem;
}
.user-dropdown .dropdown-menu .dropdown-header .header-email {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-dropdown .dropdown-menu .dropdown-body {
  padding: 0.35rem 0;
}

.dropdown-divider {
  height: 1px;
  background: var(--color-dropdown-border);
  margin: 0.3rem 0;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.6rem 1rem;
  background: transparent;
  border: none;
  color: var(--color-text);
  font-size: 0.875rem;
  font-weight: 500;
  font-family: inherit;
  text-decoration: none;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s;
}
.dropdown-item .item-icon {
  font-size: 0.95rem;
  opacity: 0.55;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
  transition: opacity 0.12s;
}
.dropdown-item:hover {
  background: rgba(0, 0, 0, 0.04);
}
.dropdown-item:hover .item-icon {
  opacity: 0.85;
}
.dropdown-item:focus-visible {
  outline: none;
  background: rgba(14, 165, 233, 0.1);
  box-shadow: inset 0 0 0 2px var(--color-input-focus);
}

html.dark .dropdown-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

html.dark .dropdown-item:focus-visible {
  background: rgba(0, 212, 255, 0.08);
  box-shadow: inset 0 0 0 2px var(--color-input-focus);
}

.logout-btn {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  text-align: left;
  padding: 0.6rem 1rem;
  background: transparent;
  border: none;
  font-family: inherit;
  color: var(--color-logout-text);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background 0.12s, color 0.12s;
}
.logout-btn .item-icon {
  font-size: 0.95rem;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}
.logout-btn:hover {
  background: var(--color-logout-hover-bg);
  color: var(--color-logout-hover-text);
}
.logout-btn:focus-visible {
  outline: none;
  background: var(--color-logout-hover-bg);
  color: var(--color-logout-hover-text);
  box-shadow: inset 0 0 0 2px var(--color-logout-text);
}

.app-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  gap: 1rem;
  background: var(--color-body-bg);
}
.app-loading .spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--color-spinner-border);
  border-top-color: var(--color-spinner-top);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.app-loading .loading-text {
  font-size: 0.85rem;
  color: var(--color-text-dim);
}

.inline-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-body-bg);
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
}
.login-page::before {
  content: "";
  position: absolute;
  top: 30%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 600px;
  height: 400px;
  background: radial-gradient(ellipse, rgba(0, 212, 255, 0.04) 0%, transparent 65%);
  pointer-events: none;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--color-card-bg);
  border: 1px solid var(--color-card-border);
  border-radius: 14px;
  padding: 2.5rem 2rem;
  box-shadow: var(--shadow-dropdown);
  position: relative;
  z-index: 1;
}
.login-card .login-logo {
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--color-text);
  margin-bottom: 2rem;
  text-align: center;
}
.login-card .login-logo span {
  color: #00d4ff;
}
.login-card h1 {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.4rem;
}
.login-card .login-sub {
  font-size: 0.85rem;
  color: var(--color-text-dim);
  margin-bottom: 1.75rem;
}
.login-card .form-group {
  margin-bottom: 1rem;
}
.login-card .form-group label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--color-text-dim);
  margin-bottom: 0.4rem;
}
.login-card .form-group input {
  width: 100%;
  padding: 0.65rem 0.85rem;
  background: var(--color-input-bg);
  border: 1px solid var(--color-input-border);
  border-radius: 7px;
  color: var(--color-text);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.login-card .form-group input::placeholder {
  color: var(--color-text-dim);
  opacity: 0.6;
}
.login-card .form-group input:focus {
  border-color: var(--color-input-focus);
  box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1);
}
.login-card .form-group input:-webkit-autofill, .login-card .form-group input:-webkit-autofill:hover, .login-card .form-group input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px var(--color-input-bg) inset;
  -webkit-text-fill-color: var(--color-text);
  transition: background-color 5000s ease-in-out 0s;
}
.login-card .login-btn {
  width: 100%;
  padding: 0.7rem 1rem;
  background: var(--color-btn-primary);
  color: #080d1a;
  border: none;
  border-radius: 7px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  margin-top: 0.5rem;
  transition: background 0.15s, box-shadow 0.15s, transform 0.1s;
}
.login-card .login-btn:hover:not(:disabled) {
  background: var(--color-btn-primary-hover);
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.3);
}
.login-card .login-btn:active:not(:disabled) {
  transform: translateY(1px);
}
.login-card .login-btn:disabled {
  background: var(--color-btn-disabled);
  cursor: not-allowed;
}
.login-card .field-error {
  font-size: 0.75rem;
  color: #f87171;
  margin-top: 0.35rem;
  min-height: 1.1em;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.login-card .login-error {
  margin-top: 1rem;
  padding: 0.65rem 0.85rem;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 7px;
  font-size: 0.825rem;
  color: #f87171;
  text-align: center;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 24px;
  flex-shrink: 0;
}
.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}
.toggle-switch .slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--color-toggle-bg);
  border-radius: 24px;
  transition: background 0.2s;
}
.toggle-switch .slider::before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: var(--color-toggle-knob);
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}
.toggle-switch input:checked + .slider {
  background: var(--color-toggle-bg-checked);
}
.toggle-switch input:checked + .slider::before {
  transform: translateX(22px);
}
.toggle-switch input:focus-visible + .slider {
  outline: 2px solid var(--color-input-focus);
  outline-offset: 2px;
}

.sidebar-backdrop {
  display: none;
}

@media (max-width: 1024px) {
  .content {
    padding: 1.5rem;
  }
  .card-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }
}
@media (max-width: 768px) {
  .navbar .mobile-menu-btn {
    display: flex;
  }
  .sidebar {
    position: fixed;
    top: 56px;
    left: 0;
    bottom: 0;
    z-index: 1020;
    width: 310px !important;
    max-width: calc(100vw - 3rem);
    height: calc(100vh - 56px);
    transform: translateX(-100%);
    transition: transform 0.22s ease;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar .sidebar-toggle-btn {
    display: none;
  }
  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    top: 56px;
    z-index: 1019;
    background: rgba(0, 0, 0, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
  }
  .sidebar-backdrop.active {
    opacity: 1;
    pointer-events: auto;
  }
  .content {
    padding: 1.25rem 1rem;
  }
  .card-grid {
    grid-template-columns: 1fr 1fr;
  }
  .compliance-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  .data-table {
    font-size: 0.8rem;
  }
  .data-table th, .data-table td {
    padding: 0.6rem 0.75rem;
  }
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
  .map-layout {
    flex-direction: column;
    height: auto;
  }
  .map-wrap {
    height: 60vh;
  }
  .map-panel {
    width: 100% !important;
    height: auto;
    max-height: 45vh;
  }
  .map-panel.collapsed {
    max-height: none;
  }
}
@media (max-width: 480px) {
  .card-grid {
    grid-template-columns: 1fr;
  }
  .users-toolbar,
  .matcher-row {
    align-items: stretch;
  }
  .users-toolbar > label,
  .users-toolbar > select,
  .users-toolbar > input,
  .users-toolbar > button,
  .matcher-row > label,
  .matcher-row > select,
  .matcher-row > input,
  .matcher-row > button {
    width: 100%;
  }
  .page-title,
  .page-header h1 {
    font-size: 1.2rem;
  }
}
html[data-view=cards] .table-scroll {
  overflow-x: visible;
}
html[data-view=cards] .data-table {
  display: block;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  overflow: visible;
}
html[data-view=cards] .data-table thead {
  display: none;
}
html[data-view=cards] .data-table tbody,
html[data-view=cards] .data-table tfoot {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: 1rem;
}
html[data-view=cards] .data-table tfoot {
  margin-top: 1rem;
}
html[data-view=cards] .data-table tr {
  display: flex;
  flex-direction: column;
  background: var(--color-card-bg);
  border: 1px solid var(--color-card-border);
  border-radius: 10px;
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
html[data-view=cards] .data-table tr:last-child {
  border-bottom: 1px solid var(--color-card-border);
}
html[data-view=cards] .data-table tr:hover {
  background: var(--color-card-bg);
}
html[data-view=cards] .data-table tr:has(> td[colspan]) {
  grid-column: 1/-1;
}
html[data-view=cards] .data-table td,
html[data-view=cards] .data-table th {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.55rem 1rem;
  border-bottom: 1px solid var(--color-border);
  text-align: right;
}
html[data-view=cards] .data-table td:last-child,
html[data-view=cards] .data-table th:last-child {
  border-bottom: 0;
}
html[data-view=cards] .data-table td::before,
html[data-view=cards] .data-table th::before {
  content: attr(data-label);
  flex: 0 0 38%;
  text-align: left;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--color-text-dim);
}
html[data-view=cards] .data-table td:not([data-label]), html[data-view=cards] .data-table td[data-label=""],
html[data-view=cards] .data-table th:not([data-label]),
html[data-view=cards] .data-table th[data-label=""] {
  justify-content: flex-end;
}
html[data-view=cards] .data-table td:not([data-label])::before, html[data-view=cards] .data-table td[data-label=""]::before,
html[data-view=cards] .data-table th:not([data-label])::before,
html[data-view=cards] .data-table th[data-label=""]::before {
  display: none;
}
html[data-view=cards] .data-table td[colspan],
html[data-view=cards] .data-table th[colspan] {
  display: block;
  text-align: left;
}

@media (max-width: 1024px) {
  .table-scroll {
    overflow-x: visible;
  }
  .data-table {
    display: block;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    overflow: visible;
  }
  .data-table thead {
    display: none;
  }
  .data-table tbody,
  .data-table tfoot {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
    gap: 1rem;
  }
  .data-table tfoot {
    margin-top: 1rem;
  }
  .data-table tr {
    display: flex;
    flex-direction: column;
    background: var(--color-card-bg);
    border: 1px solid var(--color-card-border);
    border-radius: 10px;
    box-shadow: var(--shadow-card);
    overflow: hidden;
  }
  .data-table tr:last-child {
    border-bottom: 1px solid var(--color-card-border);
  }
  .data-table tr:hover {
    background: var(--color-card-bg);
  }
  .data-table tr:has(> td[colspan]) {
    grid-column: 1/-1;
  }
  .data-table td,
  .data-table th {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.55rem 1rem;
    border-bottom: 1px solid var(--color-border);
    text-align: right;
  }
  .data-table td:last-child,
  .data-table th:last-child {
    border-bottom: 0;
  }
  .data-table td::before,
  .data-table th::before {
    content: attr(data-label);
    flex: 0 0 38%;
    text-align: left;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--color-text-dim);
  }
  .data-table td:not([data-label]), .data-table td[data-label=""],
  .data-table th:not([data-label]),
  .data-table th[data-label=""] {
    justify-content: flex-end;
  }
  .data-table td:not([data-label])::before, .data-table td[data-label=""]::before,
  .data-table th:not([data-label])::before,
  .data-table th[data-label=""]::before {
    display: none;
  }
  .data-table td[colspan],
  .data-table th[colspan] {
    display: block;
    text-align: left;
  }
}
.compliance-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.75rem;
  align-items: start;
}

.compliance-section {
  margin-bottom: 1.5rem;
}
.compliance-section .section-title {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 0.75rem;
}
.compliance-section .section-hint {
  font-size: 0.82rem;
  color: var(--color-text-dim);
  margin-bottom: 0.9rem;
}

.compliance-section .form-group,
.item-draft .form-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-bottom: 0.9rem;
  flex: 1 1 0;
}
.compliance-section .form-group label,
.item-draft .form-group label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--color-text-dim);
}
.compliance-section .form-group .badge,
.item-draft .form-group .badge {
  align-self: flex-start;
}
.compliance-section input[type=text],
.compliance-section input[type=email],
.compliance-section input[type=number],
.compliance-section input[type=tel],
.compliance-section input[type=date],
.compliance-section select,
.item-draft input[type=text],
.item-draft input[type=email],
.item-draft input[type=number],
.item-draft input[type=tel],
.item-draft input[type=date],
.item-draft select {
  width: 100%;
  padding: 0.5rem 0.65rem;
  font-size: 0.875rem;
  color: var(--color-text);
  background: var(--color-input-bg);
  border: 1px solid var(--color-input-border);
  border-radius: 6px;
  transition: border-color 0.15s;
}
.compliance-section input[type=text]:focus,
.compliance-section input[type=email]:focus,
.compliance-section input[type=number]:focus,
.compliance-section input[type=tel]:focus,
.compliance-section input[type=date]:focus,
.compliance-section select:focus,
.item-draft input[type=text]:focus,
.item-draft input[type=email]:focus,
.item-draft input[type=number]:focus,
.item-draft input[type=tel]:focus,
.item-draft input[type=date]:focus,
.item-draft select:focus {
  border-color: var(--color-input-focus);
  outline: none;
}

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  color: var(--color-text-dim);
  cursor: pointer;
  white-space: nowrap;
}

.matcher-set {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 0.9rem 1rem 0.3rem;
  margin: 0.5rem 0 1rem;
}
.matcher-set legend {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--color-text-dim);
  padding: 0 0.4rem;
}

.matcher-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  align-items: flex-end;
  margin-bottom: 0.5rem;
}

.matcher-row.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  align-items: end;
}

.items-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0.75rem 0 0.6rem;
}
.items-header .section-title {
  margin-bottom: 0;
}

.item-draft {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 2fr 1fr auto;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.5rem;
}
.item-draft .form-group {
  margin-bottom: 0;
}

.btn-primary,
.btn-secondary,
.btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1.1rem;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
}

.btn-danger {
  background: rgba(239, 68, 68, 0.12);
  color: #dc2626;
  margin-top: 0.4rem;
}
.btn-danger:hover {
  background: rgba(239, 68, 68, 0.2);
}
.btn-danger:disabled {
  background: var(--color-btn-disabled);
  color: var(--color-text-dim);
  cursor: not-allowed;
}

.btn-primary {
  background: var(--color-btn-primary);
  color: #080d1a;
  margin-top: 0.4rem;
}
.btn-primary:hover {
  background: var(--color-btn-primary-hover);
}
.btn-primary:disabled {
  background: var(--color-btn-disabled);
  cursor: not-allowed;
}

.btn-secondary {
  background: transparent;
  color: var(--color-text-dim);
  border: 1px solid var(--color-border);
}
.btn-secondary:hover {
  color: var(--color-text);
  border-color: var(--color-input-border);
}

.form-hint {
  margin: 0.6rem 0 0;
  font-size: 0.8rem;
  color: var(--color-text-dim);
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  color: var(--color-text-dim);
  width: 2rem;
  height: 2rem;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
}
.btn-icon:hover {
  color: var(--color-logout-hover-text);
  border-color: rgba(239, 68, 68, 0.3);
  background: var(--color-logout-hover-bg);
}

.badge-blocking {
  background: rgba(239, 68, 68, 0.12);
  color: #dc2626;
}
.badge-warning {
  background: rgba(217, 119, 6, 0.14);
  color: #b45309;
}
.badge-active {
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
}
.badge-retired {
  background: var(--color-border);
  color: var(--color-text-dim);
}

.sev-blocking {
  color: #dc2626;
  font-weight: 600;
}

.sev-warning {
  color: #b45309;
  font-weight: 600;
}

.sev-ok {
  color: #059669;
  font-weight: 600;
}

.resolve-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0 0.75rem;
}

.declaration-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
}

.declaration-status {
  font-size: 0.8rem;
  color: var(--color-text-dim);
}

.template-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.template-card {
  background: var(--color-card-bg);
  border: 1px solid var(--color-card-border);
  border-radius: 10px;
  padding: 1.1rem 1.25rem;
  box-shadow: var(--shadow-card);
}

.template-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.35rem;
}

.template-name {
  font-size: 0.95rem;
  font-weight: 700;
  display: block;
}

.template-desc {
  font-size: 0.8rem;
  color: var(--color-text-dim);
  display: block;
  margin-top: 0.15rem;
}

.template-matchers {
  font-size: 0.8rem;
  color: var(--color-text-dim);
  margin-bottom: 0.75rem;
}

.data-table.compact {
  font-size: 0.82rem;
}
.data-table.compact th, .data-table.compact td {
  padding: 0.45rem 0.75rem;
}

@media (max-width: 720px) {
  .item-draft {
    grid-template-columns: 1fr 1fr;
  }
}
.alert-warning {
  background: rgba(217, 119, 6, 0.1);
  border: 1px solid rgba(217, 119, 6, 0.25);
  color: #d97706;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.875rem;
  color: var(--color-text);
  cursor: pointer;
}
.checkbox-label input[type=checkbox] {
  width: 1rem;
  height: 1rem;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.85rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  background: var(--color-body-bg);
  border: 1px solid var(--color-border);
  font-size: 0.82rem;
  color: var(--color-text);
}

.chip-remove {
  background: transparent;
  border: none;
  color: var(--color-text-dim);
  cursor: pointer;
  line-height: 1;
  padding: 0;
}
.chip-remove:hover {
  color: var(--color-logout-hover-text);
}

.table-scroll {
  overflow-x: auto;
  max-width: 100%;
}

.form-page-header {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 1.5rem;
}
.form-page-header h1 {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.form-page-header .back-link {
  font-size: 0.8rem;
  color: var(--color-text-dim);
  text-decoration: none;
  width: fit-content;
}
.form-page-header .back-link:hover {
  color: var(--color-btn-primary);
}

.entity-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem 1.5rem;
}
.entity-details div {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.entity-details dt {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-dim);
}
.entity-details dd {
  font-size: 0.9rem;
  color: var(--color-text);
}

.nav-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  text-decoration: none;
  color: var(--color-text);
  background: var(--color-card-bg);
  border: 1px solid var(--color-card-border);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow-card);
  transition: border-color 0.15s, transform 0.1s;
}
.nav-card:hover {
  border-color: var(--color-btn-primary);
  transform: translateY(-1px);
}
.nav-card .nav-card-title {
  font-weight: 700;
  font-size: 1rem;
}
.nav-card .nav-card-sub {
  font-size: 0.8rem;
  color: var(--color-text-dim);
}

.role-checkboxes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.5rem 1rem;
  margin-top: 0.35rem;
}

.role-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  cursor: pointer;
}
.role-check input {
  accent-color: var(--color-btn-primary);
}

.dispatch-group {
  margin-top: 0.75rem;
}

.dispatch-group-title {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--color-text-dim);
  margin-bottom: 0.35rem;
}

.dispatch-checks {
  list-style: none;
  margin: 0;
  padding: 0;
}
.dispatch-checks li {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.3rem 0;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--color-border);
}
.dispatch-checks li:last-child {
  border-bottom: none;
}
.dispatch-checks .check-icon {
  font-weight: 700;
}
.dispatch-checks .check-pass .check-icon {
  color: #34d399;
}
.dispatch-checks .check-fail .check-icon {
  color: #f87171;
}

.dispatch-hint {
  font-size: 0.8rem;
  color: var(--color-text-dim);
  margin: 0.25rem 0;
}

.field-error {
  font-size: 0.75rem;
  line-height: 1.2;
  color: #dc2626;
  margin-top: 0.15rem;
  min-height: 1.2em;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

html.dark .field-error {
  color: #f87171;
}

input[aria-invalid=true],
select[aria-invalid=true],
textarea[aria-invalid=true] {
  border-color: #dc2626 !important;
}
input[aria-invalid=true]:focus,
select[aria-invalid=true]:focus,
textarea[aria-invalid=true]:focus {
  border-color: #dc2626 !important;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15) !important;
}

html.dark input[aria-invalid=true],
html.dark select[aria-invalid=true],
html.dark textarea[aria-invalid=true] {
  border-color: #f87171 !important;
}
html.dark input[aria-invalid=true]:focus,
html.dark select[aria-invalid=true]:focus,
html.dark textarea[aria-invalid=true]:focus {
  border-color: #f87171 !important;
  box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.2) !important;
}

.st-moving {
  --st: #16a34a;
}

.st-idle {
  --st: #2563eb;
}

.st-workshop {
  --st: #d97706;
}

.st-parked,
.st-stale {
  --st: #64748b;
}

.map-layout {
  display: flex;
  gap: 0.75rem;
  height: calc(100vh - 8.5rem);
}

.map-wrap {
  position: relative;
  overflow: hidden;
  flex: 1;
  min-width: 0;
  height: 100%;
  border-radius: 12px;
  background: #dbeafe;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.map-wrap:active {
  cursor: grabbing;
}

.map-world {
  position: absolute;
  left: 0;
  top: 0;
  will-change: transform;
}

.map-tile {
  position: absolute;
  width: 256px;
  height: 256px;
  pointer-events: none;
  user-select: none;
}

.map-marker {
  position: absolute;
  transform: translate(-50%, -50%);
  z-index: 2;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 6px;
}
.map-marker .dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--st, #2563eb);
  border: 3px solid #ffffff;
  box-shadow: 0 0 0 2px var(--st, #2563eb);
}
.map-marker.selected {
  z-index: 3;
}
.map-marker.selected .dot {
  width: 16px;
  height: 16px;
  box-shadow: 0 0 0 3px var(--st, #2563eb), 0 0 0 7px rgba(37, 99, 235, 0.25);
}
.map-marker .lbl {
  font-size: 0.8rem;
  white-space: nowrap;
  color: #1e293b;
  font-weight: 600;
  text-shadow: 0 0 3px rgba(255, 255, 255, 0.9);
}
.map-marker.is-trailer .dot {
  border-radius: 3px;
}

.map-status {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 3;
  background: rgba(15, 23, 42, 0.85);
  color: #f1f5f9;
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  font-size: 0.85rem;
}
.map-status::before {
  content: "";
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: #22c55e;
  margin-right: 0.5rem;
  vertical-align: 0.06em;
}
.map-status.offline::before {
  background: #ef4444;
}

.map-legend {
  position: absolute;
  bottom: 6px;
  left: 10px;
  z-index: 3;
  display: flex;
  gap: 0.75rem;
  align-items: center;
  background: rgba(255, 255, 255, 0.85);
  color: #1e293b;
  padding: 0.3rem 0.7rem;
  border-radius: 8px;
  font-size: 0.75rem;
}
.map-legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.map-attribution {
  position: absolute;
  bottom: 6px;
  right: 10px;
  z-index: 3;
  font-size: 0.7rem;
  color: rgba(30, 41, 59, 0.9);
  background: rgba(255, 255, 255, 0.6);
  padding: 2px 6px;
  border-radius: 4px;
}

.veh-dot {
  flex-shrink: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--st, #64748b);
}
.veh-dot.is-trailer {
  border-radius: 3px;
  background: #7c3aed;
}

.veh-kind {
  margin-left: 0.4rem;
  padding: 0 0.3rem;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #7c3aed;
  border: 1px solid currentColor;
  border-radius: 4px;
  vertical-align: middle;
}

.map-panel {
  display: flex;
  flex-direction: column;
  width: 300px;
  height: 100%;
  background: var(--color-content-bg);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  overflow: hidden;
  transition: width 0.15s ease;
}
.map-panel.collapsed {
  width: 46px;
}
.map-panel.collapsed .map-panel-head {
  justify-content: center;
  padding: 0.6rem 0;
}

.map-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--color-border);
}
.map-panel-head .section-title {
  margin: 0;
  font-size: 0.95rem;
  white-space: nowrap;
}

.veh-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  list-style: none;
  margin: 0;
  padding: 0.25rem;
}

.veh-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.5rem 0.6rem;
  border: 1px solid transparent;
  border-radius: 8px;
  background: none;
  color: var(--color-text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.veh-row:hover {
  background: var(--color-dropdown-header-bg);
}
.veh-row.selected {
  border-color: var(--color-btn-primary);
  background: var(--color-sidebar-active-bg);
}
.veh-row .veh-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.veh-row .veh-name {
  font-weight: 600;
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.veh-row .veh-sub {
  font-size: 0.75rem;
  color: var(--color-text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.veh-row .veh-speed {
  flex-shrink: 0;
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  color: var(--color-text-dim);
}

select,
input[type=text],
input[type=email],
input[type=password],
input[type=number],
input[type=date],
input[type=datetime-local] {
  padding: 0.45rem 0.65rem;
  font-size: 0.875rem;
  color: var(--color-text);
  background-color: var(--color-input-bg);
  border: 1px solid var(--color-input-border);
  border-radius: 6px;
  transition: border-color 0.15s;
}
select:focus,
input[type=text]:focus,
input[type=email]:focus,
input[type=password]:focus,
input[type=number]:focus,
input[type=date]:focus,
input[type=datetime-local]:focus {
  border-color: var(--color-input-focus);
  outline: none;
}
select:disabled,
input[type=text]:disabled,
input[type=email]:disabled,
input[type=password]:disabled,
input[type=number]:disabled,
input[type=date]:disabled,
input[type=datetime-local]:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

select {
  appearance: none;
  padding-right: 1.9rem;
  background-image: var(--chevron-icon);
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
  background-size: 0.65rem;
  cursor: pointer;
}

input[type=checkbox],
input[type=radio] {
  accent-color: var(--color-btn-primary);
  width: 15px;
  height: 15px;
  cursor: pointer;
}

input[type=date]::-webkit-calendar-picker-indicator,
input[type=datetime-local]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.6;
}
input[type=date]::-webkit-calendar-picker-indicator:hover,
input[type=datetime-local]::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
}

.users-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 0.9rem;
  margin-bottom: 1.25rem;
}
.users-toolbar label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.85rem;
  color: var(--color-text-dim);
  white-space: nowrap;
}
.users-toolbar:has(> .section-title) {
  justify-content: space-between;
}

.row-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
}

.row-actions .btn-secondary {
  margin-top: 0.4rem;
  padding-block: calc(0.55rem - 1px);
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.9rem;
  line-height: 1;
}
.btn-icon:hover {
  color: var(--color-text);
  border-color: var(--color-input-border);
  background: var(--color-sidebar-hover-bg);
}
.btn-icon:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.btn-icon.danger:hover {
  color: var(--color-logout-hover-text);
  border-color: rgba(239, 68, 68, 0.3);
  background: var(--color-logout-hover-bg);
}

.notif-bell .notif-trigger {
  position: relative;
  width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  color: var(--color-navbar-text);
}
.notif-bell .notif-trigger .bell-icon {
  display: flex;
  font-size: 1.05rem;
  line-height: 1;
}
.notif-bell .notif-badge {
  position: absolute;
  top: -4px;
  right: -6px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: #dc2626;
  color: #fff;
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}
.notif-bell .notif-menu {
  min-width: 340px;
  max-width: min(380px, 100vw - 1.5rem);
}
.notif-bell .notif-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}
.notif-bell .notif-head .header-label {
  margin-bottom: 0;
}
.notif-bell .notif-mark-all {
  background: transparent;
  border: none;
  padding: 0;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-btn-primary);
  cursor: pointer;
  white-space: nowrap;
}
.notif-bell .notif-mark-all:hover {
  text-decoration: underline;
}
.notif-bell .notif-mark-all:focus-visible {
  outline: 2px solid var(--color-input-focus);
  outline-offset: 2px;
  border-radius: 4px;
}
.notif-bell .notif-list {
  max-height: 380px;
  overflow-y: auto;
  padding: 0.3rem 0;
}
.notif-bell .notif-empty {
  padding: 1rem;
  font-size: 0.8rem;
  color: var(--color-text-dim);
  text-align: center;
}
.notif-bell .notif-item {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  width: 100%;
  padding: 0.55rem 1rem;
  background: transparent;
  border: none;
  font-family: inherit;
  color: var(--color-text);
  text-align: left;
  cursor: default;
  transition: background 0.12s;
}
.notif-bell .notif-item .notif-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: transparent;
  flex-shrink: 0;
  margin-top: 0.4rem;
}
.notif-bell .notif-item .notif-main {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  min-width: 0;
}
.notif-bell .notif-item .notif-title {
  font-size: 0.82rem;
  font-weight: 500;
}
.notif-bell .notif-item .notif-body {
  font-size: 0.75rem;
  color: var(--color-text-dim);
}
.notif-bell .notif-item .notif-kind {
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-dim);
  opacity: 0.75;
}
.notif-bell .notif-item .notif-age {
  margin-left: auto;
  font-size: 0.72rem;
  color: var(--color-text-dim);
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 0.15rem;
}
.notif-bell .notif-item.notif-unread {
  cursor: pointer;
}
.notif-bell .notif-item.notif-unread .notif-dot {
  background: var(--color-btn-primary);
}
.notif-bell .notif-item.notif-unread .notif-title {
  font-weight: 700;
}
.notif-bell .notif-item.notif-unread:hover {
  background: rgba(0, 0, 0, 0.04);
}
.notif-bell .notif-item:focus-visible {
  outline: none;
  background: rgba(14, 165, 233, 0.1);
  box-shadow: inset 0 0 0 2px var(--color-input-focus);
}

html.dark .notif-bell .notif-item.notif-unread:hover {
  background: rgba(255, 255, 255, 0.06);
}

html.dark .notif-bell .notif-item:focus-visible {
  background: rgba(0, 212, 255, 0.08);
}

@media (max-width: 480px) {
  .notif-bell .notif-menu {
    position: fixed;
    top: calc(56px + 0.4rem);
    left: 0.75rem;
    right: 0.75rem;
    min-width: 0;
    max-width: none;
    width: auto;
  }
}
.dashboard-welcome {
  margin-bottom: 1.75rem;
}
.dashboard-welcome h1 {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.25rem;
}
.dashboard-welcome p {
  font-size: 0.9rem;
  color: var(--color-text-dim);
}

.kpi-card {
  display: block;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.kpi-card:hover {
  border-color: var(--color-btn-primary);
  transform: translateY(-1px);
}
.kpi-card .stat-value.kpi-dim {
  color: var(--color-text-dim);
}

.dash-panels {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.dash-panel {
  margin-bottom: 0;
}
.dash-panel .panel-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}
.dash-panel .panel-head .section-title {
  margin-bottom: 0;
}
.dash-panel .panel-link {
  font-size: 0.8rem;
  color: var(--color-btn-primary);
  text-decoration: none;
  white-space: nowrap;
}
.dash-panel .panel-link:hover {
  text-decoration: underline;
}
.dash-panel .panel-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.dash-panel .panel-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.55rem 0;
  border-top: 1px solid var(--color-card-border);
}
.dash-panel .panel-item:first-child {
  border-top: 0;
}
.dash-panel .item-main {
  min-width: 0;
}
.dash-panel .item-title {
  font-size: 0.85rem;
  font-weight: 600;
}
.dash-panel .item-sub {
  font-size: 0.75rem;
  color: var(--color-text-dim);
  margin-top: 0.15rem;
}
.dash-panel .item-side {
  text-align: right;
  white-space: nowrap;
  font-size: 0.8rem;
}
.dash-panel .unread-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-btn-primary);
  margin-right: 0.4rem;
  vertical-align: middle;
}

.badge-overdue {
  color: #dc2626;
  font-weight: 600;
  font-size: 0.8rem;
}

.badge-due-soon {
  color: #d97706;
  font-weight: 600;
  font-size: 0.8rem;
}

html.dark .badge-overdue {
  color: #f87171;
}

html.dark .badge-due-soon {
  color: #fbbf24;
}

.users-count {
  font-size: 0.85rem;
  color: var(--color-text-dim);
}

.user-email {
  font-weight: 500;
}

.user-actions {
  display: flex;
  gap: 0.5rem;
}

.settings-section {
  background: var(--color-card-bg);
  border: 1px solid var(--color-card-border);
  border-radius: 10px;
  padding: 0 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-card);
}
.settings-section h2 {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--color-text-dim);
  padding: 1.1rem 0 0.6rem;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 0;
}
