:root {
  --bg: #e8f0ec;
  --panel: #ffffff;
  --ink: #17322e;
  --muted: #687a74;
  --line: #d8e3de;
  --primary: #176f64;
  --primary-dark: #10564e;
  --button-end: #2a897a;
  --button-hover-end: #1d7569;
  --accent: #e66040;
  --danger: #c7372f;
  --sidebar-ink: #17322e;
  --sidebar-muted: #687a74;
  --sidebar-start: rgba(248, 251, 250, 0.99);
  --sidebar-mid: rgba(248, 251, 250, 0.99);
  --sidebar-end: rgba(248, 251, 250, 0.99);
  --panel-soft: #f4f8f6;
  --panel-bg: rgba(255, 255, 255, 0.97);
  --input-bg: #ffffff;
  --input-ink: #172027;
  --secondary-bg: #edf3f0;
  --secondary-hover: #e2ece7;
  --device-row-bg: #ffffff;
  --table-cell-bg: #ffffff;
  --sidebar-card-bg: rgba(23, 111, 100, 0.035);
  --map-bg: #dce9df;
  --path-head-bg: #f1f6f7;
  --path-head-ink: #26343b;
  --path-hover: #eef8f8;
  --modal-head-bg: #ffffff;
  --modal-accent: linear-gradient(90deg, rgba(15, 110, 123, 0), rgba(15, 110, 123, 0.62), rgba(230, 109, 66, 0.58), rgba(15, 110, 123, 0));
  --path-row-border: #e5eef1;
  --shadow: 0 18px 42px rgba(25, 54, 45, 0.14);
  --sidebar-menu-font-size: 16.4px;
  --sidebar-submenu-font-size: 12.6px;
}

body[data-theme="paper"] {
  --bg: #fbfcfd;
  --line: #e7edf0;
  --primary: #3f6972;
  --primary-dark: #2c4f57;
  --button-end: #6f8f96;
  --button-hover-end: #55767e;
  --accent: #4ea76d;
  --sidebar-start: rgba(244, 250, 248, 0.98);
  --sidebar-mid: rgba(238, 246, 244, 0.98);
  --sidebar-end: rgba(235, 243, 239, 0.96);
  --sidebar-ink: #172027;
  --sidebar-muted: #66757d;
  --panel-soft: #ffffff;
  --map-bg: #f2f5f6;
  --path-head-bg: #f7fafb;
  --path-hover: #f7fbfa;
  --modal-accent: linear-gradient(90deg, rgba(63, 105, 114, 0), rgba(63, 105, 114, 0.5), rgba(78, 167, 109, 0.5), rgba(63, 105, 114, 0));
  --path-row-border: #e8eef1;
  --shadow: 0 14px 30px rgba(31, 45, 55, 0.12);
}

body[data-theme="porcelain"] {
  --bg: #f5f8fb;
  --line: #dfe8ee;
  --primary: #42728d;
  --primary-dark: #2e566d;
  --button-end: #6996aa;
  --button-hover-end: #4c7d94;
  --accent: #7f8ad8;
  --sidebar-start: rgba(229, 240, 246, 0.98);
  --sidebar-mid: rgba(219, 233, 241, 0.98);
  --sidebar-end: rgba(235, 241, 248, 0.96);
  --sidebar-ink: #142430;
  --sidebar-muted: #647988;
  --panel-soft: #fafdff;
  --map-bg: #eaf1f5;
  --path-head-bg: #f3f8fb;
  --path-hover: #eef7fb;
  --modal-accent: linear-gradient(90deg, rgba(66, 114, 141, 0), rgba(66, 114, 141, 0.58), rgba(127, 138, 216, 0.48), rgba(66, 114, 141, 0));
  --path-row-border: #e2ebf0;
}

body[data-theme="mist"] {
  --bg: #f1f8f7;
  --line: #d9e9e7;
  --primary: #417b79;
  --primary-dark: #2f5c5b;
  --button-end: #61a09a;
  --button-hover-end: #46847f;
  --accent: #6f93d2;
  --sidebar-start: rgba(220, 241, 239, 0.98);
  --sidebar-mid: rgba(211, 235, 233, 0.98);
  --sidebar-end: rgba(226, 242, 239, 0.96);
  --sidebar-ink: #142827;
  --sidebar-muted: #617876;
  --panel-soft: #f9fffe;
  --map-bg: #e4f0ef;
  --path-head-bg: #f0f8f7;
  --path-hover: #edf9f7;
  --modal-accent: linear-gradient(90deg, rgba(65, 123, 121, 0), rgba(65, 123, 121, 0.58), rgba(111, 147, 210, 0.5), rgba(65, 123, 121, 0));
  --path-row-border: #dcebe9;
}

body[data-theme="sage"] {
  --bg: #eef6f2;
  --line: #d8e7df;
  --primary: #2f7358;
  --primary-dark: #225540;
  --button-end: #3f8b68;
  --button-hover-end: #2f7358;
  --accent: #d98345;
  --sidebar-start: rgba(31, 86, 68, 0.96);
  --sidebar-mid: rgba(26, 64, 55, 0.98);
  --sidebar-end: rgba(76, 100, 69, 0.94);
  --sidebar-muted: #c5dbcf;
  --panel-soft: #f5faf7;
  --map-bg: #e5eee8;
  --path-head-bg: #f1f7f3;
  --path-hover: #eef8f1;
  --modal-accent: linear-gradient(90deg, rgba(47, 115, 88, 0), rgba(47, 115, 88, 0.62), rgba(217, 131, 69, 0.58), rgba(47, 115, 88, 0));
  --path-row-border: #e2eee7;
}

body[data-theme="peach"] {
  --bg: #f8f2ee;
  --line: #eadcd4;
  --primary: #a8543f;
  --primary-dark: #7b3c2d;
  --button-end: #c56d45;
  --button-hover-end: #a8543f;
  --accent: #0f7c86;
  --sidebar-start: rgba(117, 60, 48, 0.96);
  --sidebar-mid: rgba(79, 50, 45, 0.98);
  --sidebar-end: rgba(137, 91, 62, 0.94);
  --sidebar-muted: #ead0c4;
  --panel-soft: #fff8f4;
  --map-bg: #f0e7e0;
  --path-head-bg: #fbf1eb;
  --path-hover: #fff3ec;
  --modal-accent: linear-gradient(90deg, rgba(168, 84, 63, 0), rgba(168, 84, 63, 0.6), rgba(15, 124, 134, 0.52), rgba(168, 84, 63, 0));
  --path-row-border: #eadbd2;
}

body[data-theme="sky"] {
  --bg: #eef7fb;
  --line: #d7e8f0;
  --primary: #2f7193;
  --primary-dark: #23536d;
  --button-end: #4b9ab9;
  --button-hover-end: #347d9d;
  --accent: #45a184;
  --sidebar-start: rgba(37, 91, 118, 0.96);
  --sidebar-mid: rgba(31, 65, 86, 0.98);
  --sidebar-end: rgba(51, 96, 104, 0.94);
  --sidebar-muted: #c5dce6;
  --panel-soft: #f4fbfe;
  --map-bg: #e2f0f6;
  --path-head-bg: #f1f8fb;
  --path-hover: #edf8fd;
  --modal-accent: linear-gradient(90deg, rgba(47, 113, 147, 0), rgba(47, 113, 147, 0.62), rgba(69, 161, 132, 0.52), rgba(47, 113, 147, 0));
  --path-row-border: #dcebf1;
}

body[data-theme="lilac"] {
  --bg: #f3f1f8;
  --line: #ded9ec;
  --primary: #6f5fa4;
  --primary-dark: #52447d;
  --button-end: #7b6db4;
  --button-hover-end: #655392;
  --accent: #c96b55;
  --sidebar-start: rgba(82, 68, 125, 0.96);
  --sidebar-mid: rgba(53, 49, 78, 0.98);
  --sidebar-end: rgba(79, 83, 119, 0.94);
  --sidebar-muted: #d6d1ea;
  --panel-soft: #faf8ff;
  --map-bg: #e8e5f0;
  --path-head-bg: #f5f2fb;
  --path-hover: #f5f0ff;
  --modal-accent: linear-gradient(90deg, rgba(111, 95, 164, 0), rgba(111, 95, 164, 0.6), rgba(201, 107, 85, 0.52), rgba(111, 95, 164, 0));
  --path-row-border: #e3deef;
}

body[data-theme="sand"] {
  --bg: #f5f1ea;
  --line: #e5ddd0;
  --primary: #76644a;
  --primary-dark: #594934;
  --button-end: #9b8564;
  --button-hover-end: #806a4f;
  --accent: #3f8e88;
  --sidebar-start: rgba(92, 77, 55, 0.96);
  --sidebar-mid: rgba(64, 58, 47, 0.98);
  --sidebar-end: rgba(104, 91, 67, 0.94);
  --sidebar-muted: #ded3c0;
  --panel-soft: #fbf8f1;
  --map-bg: #ebe4d7;
  --path-head-bg: #f7f1e6;
  --path-hover: #fbf5ea;
  --modal-accent: linear-gradient(90deg, rgba(118, 100, 74, 0), rgba(118, 100, 74, 0.58), rgba(63, 142, 136, 0.48), rgba(118, 100, 74, 0));
  --path-row-border: #e5dccf;
}

body[data-theme="graphite"] {
  --bg: #edf0f2;
  --line: #d8dde1;
  --primary: #43515a;
  --primary-dark: #29343b;
  --button-end: #60707a;
  --button-hover-end: #43515a;
  --accent: #d06c45;
  --sidebar-start: rgba(43, 54, 62, 0.97);
  --sidebar-mid: rgba(28, 36, 42, 0.99);
  --sidebar-end: rgba(63, 69, 71, 0.95);
  --sidebar-muted: #c8d0d5;
  --panel-soft: #f7f9fa;
  --map-bg: #dde3e6;
  --path-head-bg: #eef1f3;
  --path-hover: #f1f4f6;
  --modal-accent: linear-gradient(90deg, rgba(67, 81, 90, 0), rgba(67, 81, 90, 0.62), rgba(208, 108, 69, 0.54), rgba(67, 81, 90, 0));
  --path-row-border: #dde4e8;
}

body[data-theme="dusk"] {
  --bg: #dce3ea;
  --line: #c8d2dc;
  --primary: #2f4358;
  --primary-dark: #1c2b3a;
  --button-end: #526a83;
  --button-hover-end: #3d536b;
  --accent: #c7795b;
  --sidebar-start: rgba(30, 44, 60, 0.98);
  --sidebar-mid: rgba(22, 31, 44, 0.99);
  --sidebar-end: rgba(50, 55, 69, 0.96);
  --sidebar-muted: #bec9d6;
  --panel-soft: #eef2f5;
  --map-bg: #cfd9e2;
  --path-head-bg: #e7edf3;
  --path-hover: #e9eff5;
  --modal-accent: linear-gradient(90deg, rgba(47, 67, 88, 0), rgba(47, 67, 88, 0.65), rgba(199, 121, 91, 0.54), rgba(47, 67, 88, 0));
  --path-row-border: #d5dde6;
}

body[data-theme="night"] {
  --bg: #121212;
  --panel: #1b1a18;
  --ink: #f1eee7;
  --muted: #b9b2a8;
  --line: #312f2b;
  --primary: #7a6041;
  --primary-dark: #5d4730;
  --button-end: #a36f37;
  --button-hover-end: #8d5d2e;
  --accent: #d7b46a;
  --sidebar-ink: #f4f0e8;
  --sidebar-muted: #bdb4a7;
  --sidebar-start: rgba(10, 10, 10, 0.99);
  --sidebar-mid: rgba(18, 17, 15, 0.99);
  --sidebar-end: rgba(8, 8, 8, 0.99);
  --panel-soft: #1f1e1b;
  --panel-bg: rgba(27, 26, 24, 0.97);
  --input-bg: #201f1c;
  --input-ink: #f1eee7;
  --secondary-bg: #282622;
  --secondary-hover: #34312b;
  --device-row-bg: linear-gradient(180deg, rgba(32, 31, 28, 0.98), rgba(22, 21, 19, 0.98));
  --table-cell-bg: #1b1a18;
  --sidebar-card-bg: rgba(255, 255, 255, 0.055);
  --map-bg: #10100f;
  --path-head-bg: #24221f;
  --path-head-ink: #f3eee4;
  --path-hover: #292720;
  --modal-head-bg: #1a1917;
  --modal-accent: linear-gradient(90deg, rgba(215, 180, 106, 0), rgba(215, 180, 106, 0.66), rgba(241, 238, 231, 0.38), rgba(215, 180, 106, 0));
  --path-row-border: #34312b;
  --shadow: 0 18px 38px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: Manrope, "Avenir Next", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  padding: 0 16px;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--button-end));
  cursor: pointer;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(8, 79, 90, 0.16);
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

button:hover {
  background: linear-gradient(135deg, var(--primary-dark), var(--button-hover-end));
  box-shadow: 0 10px 24px rgba(8, 79, 90, 0.24);
  transform: translateY(-1px);
}

button.secondary {
  color: var(--ink);
  background: var(--secondary-bg);
}

button.secondary:hover {
  background: var(--secondary-hover);
}

button.danger {
  background: linear-gradient(135deg, var(--danger), #e2554a);
}

button.active {
  background: linear-gradient(135deg, var(--accent), #f0a13a);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

input,
select {
  width: 100%;
  min-height: 36px;
  border: 1px solid rgba(127, 149, 160, 0.28);
  border-radius: 6px;
  padding: 6px 10px;
  background: var(--input-bg);
  color: var(--input-ink);
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

input:focus,
select:focus {
  border-color: #49aab0;
  box-shadow: 0 0 0 3px rgba(22, 139, 138, 0.16);
}

label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 700;
}

.hidden {
  display: none !important;
}

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

.login-shell {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #edf3ef;
}

.login-panel {
  width: min(380px, 100%);
  padding: 24px;
  border: 1px solid #d8e3de;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 20px 48px rgba(25, 54, 45, 0.12);
}

.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0 0 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid #d8e3de;
  text-align: center;
}

.login-brand img {
  width: 132px;
  height: 134px;
  object-fit: contain;
  mix-blend-mode: multiply;
}

.login-panel h1 {
  margin: 0;
  color: #17322e;
  font-size: 30px;
  font-weight: 850;
  letter-spacing: 0;
  text-align: center;
}

.login-panel label {
  color: #687a74;
  font-size: 10.5px;
}

.login-panel input {
  min-height: 36px;
  border-color: #d8e3de;
  color: #17322e;
  background: #f4f8f6;
  box-shadow: none;
}

.login-panel button[type="submit"] {
  min-height: 38px;
  margin-top: 2px;
  border-radius: 6px;
  background: #176f64;
  box-shadow: none;
  font-size: 11.5px;
}

.login-panel button[type="submit"]:hover {
  background: #10564e;
  box-shadow: none;
}

.stack {
  display: grid;
  gap: 13px;
}

.compact {
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.setup-actions,
.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-top: 18px;
}

.database-maintenance-panel {
  width: min(560px, 100%);
}

.setup-warning {
  margin: 16px 0 0;
  padding: 12px;
  border: 1px solid rgba(194, 83, 65, 0.2);
  border-radius: 8px;
  background: rgba(194, 83, 65, 0.08);
  color: #7a352b;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
}

.error-text {
  color: #9f2d20;
}

.message,
.muted {
  min-height: 20px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 650;
}

.sidebar-note {
  min-height: 18px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.sidebar label,
.sidebar .message,
.sidebar .muted,
.sidebar .sidebar-note {
  font-size: var(--sidebar-submenu-font-size);
}

.sidebar-note:empty {
  display: none;
}

.app-shell {
  position: relative;
  height: 100vh;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 390px minmax(0, 1fr);
  overflow: hidden;
  transition: grid-template-columns 240ms ease;
}

.app-shell.sidebar-collapsed {
  grid-template-columns: 0 minmax(0, 1fr);
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
  overflow-y: auto;
  border-right: 1px solid var(--line);
  scrollbar-gutter: stable;
  background: var(--panel-bg);
  color: var(--ink);
  padding: 18px 20px 16px;
  font-size: 1.033rem;
  transition: opacity 160ms ease, transform 240ms ease;
}

.sidebar-collapsed .sidebar {
  opacity: 0;
  pointer-events: none;
  transform: translateX(-100%);
}

.brand-row,
.section-title,
.db-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.language-field {
  margin-top: 0;
  color: var(--muted);
}

.language-field select {
  border-color: var(--line);
  background: var(--input-bg);
  color: var(--input-ink);
}

.section-title h2 {
  margin: 0;
  letter-spacing: 0;
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 26px;
  min-height: 106px;
  padding: 0 3px;
}

.brand-logo {
  width: 101px;
  height: 104px;
  flex: 0 0 101px;
  object-fit: contain;
  mix-blend-mode: multiply;
}

.welcome-copy {
  display: grid;
  gap: 3px;
  align-content: center;
  min-width: 0;
}

.welcome-copy span {
  color: var(--muted);
  font-size: 12.6px;
  font-weight: 750;
}

.welcome-copy strong {
  color: var(--ink);
  font-size: 18px;
  font-weight: 850;
  line-height: 1.1;
}

.brand-divider {
  position: relative;
  height: 21px;
}

.brand-divider::before {
  position: absolute;
  top: 10px;
  right: 0;
  left: 0;
  height: 1px;
  background: var(--line);
  content: "";
}

.brand-divider::after {
  position: absolute;
  top: 7px;
  left: 0;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--primary);
  content: "";
}

.sidebar-toggle {
  position: absolute;
  top: 50%;
  left: 390px;
  z-index: 900;
  display: grid;
  width: 27px;
  min-height: 50px;
  place-items: center;
  border: 1px solid var(--line);
  border-left: 0;
  border-radius: 0 7px 7px 0;
  padding: 0;
  color: var(--ink);
  background: var(--panel-bg);
  box-shadow: 5px 0 14px rgba(18, 39, 33, 0.12);
  transform: translateY(-50%);
  transition: left 240ms ease, background 160ms ease;
}

.sidebar-toggle:hover {
  color: var(--ink);
  background: var(--panel-soft);
  box-shadow: 5px 0 14px rgba(18, 39, 33, 0.16);
  transform: translateY(-50%);
}

.sidebar-toggle svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 240ms ease;
}

.sidebar-collapsed .sidebar-toggle {
  left: 0;
}

.sidebar-collapsed .sidebar-toggle svg {
  transform: rotate(180deg);
}

body[data-theme="night"] .brand-logo {
  filter: brightness(1.28) saturate(0.9);
  mix-blend-mode: screen;
}

.section-title h2 {
  font-size: 17.6px;
  font-weight: 850;
}

.compact-title h2 {
  font-size: 16.4px;
}

.view-tabs {
  display: grid;
  grid-template-columns: 1fr;
  gap: 5px;
  margin: 10px 0 14px;
}

.view-tabs > button {
  min-height: 40px;
  border: 1px solid transparent;
  padding: 0 14px;
  color: color-mix(in srgb, var(--ink) 82%, var(--muted));
  background: transparent;
  box-shadow: none;
  font-size: var(--sidebar-menu-font-size);
  text-align: left;
}

.view-tabs > button:hover {
  border-color: var(--line);
  background: var(--panel-soft);
  box-shadow: none;
}

.view-tabs > button.active {
  border-color: color-mix(in srgb, var(--accent) 18%, transparent);
  color: color-mix(in srgb, var(--accent) 70%, var(--ink));
  background: color-mix(in srgb, var(--accent) 12%, var(--panel-bg));
  box-shadow: none;
}

.history-paths-submenu {
  display: grid;
  gap: 6px;
  margin: 0 0 5px 13px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-bg);
  color: var(--ink);
  box-shadow: 0 8px 24px rgba(25, 54, 45, 0.08);
  font-size: var(--sidebar-submenu-font-size);
}

.history-paths-submenu label,
.history-paths-submenu .muted,
.history-paths-submenu .sidebar-note {
  font-size: var(--sidebar-submenu-font-size);
}

.history-paths-submenu input,
.history-paths-submenu select {
  min-height: 32px;
  padding: 5px 8px;
  font-size: var(--sidebar-submenu-font-size);
}

.mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.mode-switch button {
  min-height: 30px;
  color: var(--primary-dark);
  background: var(--secondary-bg);
  box-shadow: none;
  font-size: var(--sidebar-submenu-font-size);
}

.mode-switch button.active {
  color: #fff;
  background: var(--primary);
}

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

.compact-presets.daily-presets {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  width: 100%;
  margin-inline: auto;
}

.compact-presets button {
  min-height: 48px;
  padding: 0;
  font-size: var(--sidebar-submenu-font-size);
}

.icon-presets button {
  position: relative;
  display: grid;
  min-width: 0;
  place-items: center;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  color: var(--primary-dark);
  background: transparent;
  box-shadow: none;
}

.icon-presets button:hover {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 7%, transparent);
}

.compact-presets button.active,
.icon-presets button.active {
  border-bottom-color: var(--accent);
  color: var(--accent);
  background: transparent;
}

.icon-presets svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.icon-presets button[data-instant-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% - 12px);
  z-index: 20;
  width: max-content;
  max-width: 130px;
  padding: 2px 5px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--ink);
  background: var(--panel-bg);
  box-shadow: 0 5px 14px rgba(25, 54, 45, 0.14);
  font-size: 9px;
  font-weight: 750;
  line-height: 1.2;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 2px);
}

.icon-presets button[data-instant-tooltip]:hover::after,
.icon-presets button[data-instant-tooltip]:focus-visible::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

.range-summary,
.manual-range {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.history-paths-submenu > .range-summary {
  width: 100%;
  margin-inline: auto;
}

.range-field {
  position: relative;
  min-width: 0;
}

.range-field-label {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: var(--sidebar-submenu-font-size);
  font-weight: 800;
  text-align: center;
}

.range-pill {
  display: flex;
  width: 100%;
  min-height: 32px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  padding: 5px 7px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-soft);
  box-shadow: none;
  text-align: center;
}

.range-pill:hover {
  border-color: color-mix(in srgb, var(--primary) 48%, var(--line));
  background: color-mix(in srgb, var(--primary) 5%, var(--panel-soft));
  box-shadow: none;
  transform: none;
}

.range-pill strong {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: var(--sidebar-submenu-font-size);
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.range-pill.editable-range {
  color: var(--ink);
  cursor: pointer;
}

.range-pill.editable-range > strong {
  flex: 1 1 auto;
  text-align: center;
}

.date-native-input {
  position: absolute;
  right: 9px;
  bottom: 9px;
  width: 1px;
  height: 1px;
  min-height: 1px;
  padding: 0;
  opacity: 0;
  pointer-events: none;
}

.date-native-input.date-native-input-open {
  right: 4px;
  bottom: 4px;
  width: calc(100% - 8px);
  height: 30px;
  min-height: 30px;
  padding: 4px 6px;
  border: 0;
  color: var(--ink);
  background: var(--panel-soft);
  box-shadow: none;
  opacity: 1;
  pointer-events: auto;
  z-index: 2;
}

.date-native-input::-webkit-calendar-picker-indicator {
  width: 0;
  margin: 0;
  padding: 0;
  opacity: 0;
}

.compact-button {
  min-height: 32px;
  font-size: 12px;
}

.panel {
  display: grid;
  gap: 10px;
  margin: 0 0 12px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-bg);
  color: var(--ink);
  box-shadow: 0 8px 24px rgba(25, 54, 45, 0.08);
}

.panel .section-title h2 {
  color: var(--ink);
}

.db-tools {
  display: grid;
  gap: 8px;
}

#db-load {
  width: fit-content;
}

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

.device-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.device-panel-header-actions {
  justify-content: center;
  min-height: 24px;
}

.device-panel-header > strong {
  color: var(--ink);
  font-size: 15.1px;
  font-weight: 850;
}

.device-panel-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 5px;
  margin-inline: auto;
}

.compact-action {
  min-height: 30px;
  padding: 6px 9px;
  font-size: 13.9px;
}

.tiny-device-action {
  display: grid;
  width: 26px;
  min-height: 26px;
  place-items: center;
  border: 1px solid rgba(127, 149, 160, 0.22);
  border-radius: 6px;
  padding: 0;
  color: var(--primary-dark);
  background: rgba(255, 255, 255, 0.44);
  box-shadow: none;
  opacity: 0.82;
}

.tiny-device-action:hover {
  opacity: 1;
  transform: translateY(-1px);
  background: var(--input-bg);
  box-shadow: none;
}

.tiny-device-action.action-select-all {
  color: #0f766e;
}

.tiny-device-action.action-clear-all {
  color: #b45353;
}

.tiny-device-action svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
}

#current-status:empty {
  display: none;
}

.device-filter {
  display: grid;
  gap: 6px;
}

.selected-device-tools {
  display: flex;
  min-height: 34px;
  align-items: center;
  gap: 8px;
}

.selected-device-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 15.1px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.device-row {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 7px;
  align-items: center;
  min-height: 35px;
  padding: 3px 7px;
  border: 0;
  border-radius: 5px;
  background: var(--panel-soft);
  box-shadow: none;
}

.device-row:nth-child(even) {
  background: transparent;
}

.device-row:hover {
  background: color-mix(in srgb, var(--primary) 7%, var(--panel-soft));
}

.device-select {
  display: grid;
  width: 18px;
  min-width: 18px;
  place-items: center;
  cursor: pointer;
}

.device-select input,
.assignment-row input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.pretty-check {
  position: relative;
  display: grid;
  width: 16px;
  height: 16px;
  place-items: center;
  border: 1px solid rgba(127, 149, 160, 0.36);
  border-radius: 5px;
  background: var(--input-bg);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--panel) 34%, transparent);
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease;
}

.pretty-check::after {
  width: 7px;
  height: 4px;
  border-bottom: 1.8px solid #fff;
  border-left: 1.8px solid #fff;
  opacity: 0;
  transform: rotate(-45deg) translateY(-1px);
  content: "";
}

.device-select input:checked + .pretty-check,
.assignment-row input:checked + .pretty-check {
  border-color: transparent;
  background: var(--accent);
  box-shadow: 0 2px 7px color-mix(in srgb, var(--accent) 28%, transparent);
}

.device-select input:checked + .pretty-check::after,
.assignment-row input:checked + .pretty-check::after {
  opacity: 1;
}

.device-select:hover .pretty-check,
.assignment-row:hover .pretty-check {
  border-color: color-mix(in srgb, var(--primary) 52%, var(--line));
}

.device-name {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.device-title {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-weight: 800;
  font-size: 13.2px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.device-tools {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 4px;
}

.device-color {
  width: 30px;
  height: 30px;
  min-height: 30px;
  border: 1px solid rgba(127, 149, 160, 0.32);
  border-radius: 50%;
  padding: 2px;
  background: #ffffff;
  cursor: pointer;
}

.device-color::-webkit-color-swatch-wrapper {
  padding: 0;
}

.device-color::-webkit-color-swatch {
  border: 0;
  border-radius: 50%;
}

.device-color::-moz-color-swatch {
  border: 0;
  border-radius: 50%;
}

.device-icon-picker {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 30px;
  border: 1px solid rgba(127, 149, 160, 0.32);
  border-radius: 8px;
  padding: 0 4px;
  background: var(--input-bg);
}

.device-icon-preview {
  display: grid;
  width: 44px;
  height: 34px;
  place-items: center;
  border-radius: 6px;
  color: var(--device-icon-color, var(--ink));
  background: transparent;
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
}

.device-icon-preview svg {
  width: 40px;
  height: 28px;
}

.device-icon-chip {
  width: 48px;
  height: 36px;
  min-height: 36px;
  border: 1px solid transparent;
  padding: 0;
  background: transparent;
  box-shadow: none;
}

.device-list .device-icon-preview {
  width: 38px;
  height: 28px;
}

.device-list .device-icon-preview svg {
  width: 36px;
  height: 24px;
}

.device-list .device-icon-chip {
  width: 42px;
  height: 30px;
  min-height: 30px;
}

.device-icon-chip svg {
  width: 44px;
  height: 30px;
}

.device-edit-trigger:hover {
  border-color: var(--line);
  color: var(--device-icon-color, var(--ink));
  background: var(--panel-soft);
  box-shadow: none;
  transform: none;
}

.device-vehicle-icon .vehicle-body,
.device-vehicle-icon .vehicle-track {
  fill: currentColor;
  stroke: #4d5a55;
  stroke-width: 1.6;
}

.device-vehicle-icon .vehicle-drum {
  fill: #46514d;
  stroke: #46514d;
  stroke-width: 1.8;
}

.device-vehicle-icon {
  overflow: visible;
  transform: scale(var(--device-icon-scale, 1));
  transform-origin: center;
}

.device-vehicle-icon .vehicle-drum-detail {
  fill: none;
  stroke: #3d3d3d;
  stroke-width: 2;
}

.device-vehicle-icon .vehicle-thin-arm {
  fill: none;
  stroke: currentColor;
  stroke-width: 4.2;
}

.device-vehicle-icon .vehicle-window {
  fill: color-mix(in srgb, var(--input-bg) 92%, white);
}

.device-vehicle-icon .vehicle-wheel {
  fill: #46514d;
}

.device-vehicle-icon .vehicle-hub {
  fill: currentColor;
}

.device-vehicle-icon .vehicle-detail {
  fill: none;
  stroke: #5d6965;
  stroke-width: 1.45;
}

.device-icon-picker select {
  width: 22px;
  min-height: 22px;
  border: 0;
  padding: 0;
  color: transparent;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
}

.icon-button {
  display: grid;
  width: 30px;
  min-height: 30px;
  place-items: center;
  padding: 0;
  color: var(--primary-dark);
  background: #eef4f6;
  box-shadow: none;
  font-size: 15px;
}

.icon-button:hover {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--button-end));
}

.device-editor-card {
  width: min(520px, calc(100vw - 38px));
}

.device-editor-style-field {
  display: grid;
  gap: 7px;
}

.device-editor-style-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 54px;
  gap: 10px;
  align-items: center;
}

.device-editor-icon-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
}

.device-editor-icon-choice {
  display: grid;
  min-width: 0;
  min-height: 48px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 3px;
  color: var(--device-icon-color, var(--primary));
  background: var(--panel-soft);
  box-shadow: none;
}

.device-editor-icon-choice:hover {
  border-color: color-mix(in srgb, var(--primary) 48%, var(--line));
  color: var(--device-icon-color, var(--primary));
  background: color-mix(in srgb, var(--primary) 7%, var(--panel-soft));
  box-shadow: none;
  transform: none;
}

.device-editor-icon-choice.active {
  border-color: var(--accent);
  color: var(--device-icon-color, var(--primary));
  background: color-mix(in srgb, var(--accent) 12%, var(--panel-soft));
  box-shadow: inset 0 0 0 1px var(--accent);
}

.device-editor-icon-choice svg {
  width: 58px;
  max-width: 100%;
  height: 36px;
}

#device-editor-color {
  width: 100%;
  height: 48px;
  min-height: 48px;
  border-radius: 6px;
  padding: 3px;
}

.assignment-list {
  display: grid;
  gap: 7px;
  max-height: 190px;
  overflow: auto;
}

.assigned-summary {
  display: grid;
  gap: 7px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.assigned-summary > strong {
  color: var(--ink);
  font-size: 15.1px;
  font-weight: 850;
}

.assigned-device-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.assigned-device-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 28px;
  max-width: 100%;
  border: 1px solid rgba(127, 149, 160, 0.28);
  border-radius: 999px;
  padding: 3px 4px 3px 9px;
  color: var(--ink);
  background: var(--table-cell-bg);
  font-size: 15.1px;
  font-weight: 800;
}

.assigned-device-remove {
  display: grid;
  width: 22px;
  min-width: 22px;
  min-height: 22px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  padding: 0;
  color: var(--muted);
  background: transparent;
  box-shadow: none;
}

.assigned-device-remove:hover,
.assigned-device-remove:focus-visible {
  color: #fff;
  background: var(--danger);
  box-shadow: none;
  transform: none;
}

.assigned-device-remove svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 2.2;
}

.assignment-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--ink);
  cursor: pointer;
}

.assignment-row.disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.place-cell {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.place-cell [data-place-text] {
  max-width: 210px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.place-edit {
  width: 26px;
  min-height: 26px;
  font-size: 13px;
}

.switch,
.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.switch input,
.check-row input {
  width: 16px;
  min-height: 16px;
  accent-color: var(--accent);
}

.preset-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.preset-grid.compact-presets {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.sidebar-bottom {
  margin-top: auto;
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--sidebar-card-bg);
}

.settings-menu {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.settings-menu summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 32px;
  padding: 0 10px;
  color: var(--ink);
  cursor: pointer;
  list-style: none;
  font-size: 15.1px;
  font-weight: 850;
}

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

.settings-menu summary::after {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translate(-1px, -1px);
  transition: transform 0.16s ease;
}

.settings-menu[open] summary::after {
  transform: rotate(225deg) translate(-1px, -1px);
}

.settings-menu-body {
  display: grid;
  gap: 7px;
  padding: 8px;
  border-top: 1px solid var(--line);
}

.settings-inline-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
}

.settings-inline-field input {
  min-height: 30px;
  padding: 0 9px;
  font-size: var(--sidebar-submenu-font-size);
}

.sidebar-bottom .language-field {
  display: grid;
  gap: 4px;
  color: var(--muted);
}

.sidebar-bottom .language-field span {
  font-size: var(--sidebar-submenu-font-size);
  font-weight: 800;
}

.sidebar-bottom .language-field select {
  min-height: 30px;
  padding: 0 9px;
  border-radius: 7px;
  font-size: var(--sidebar-submenu-font-size);
}

.sidebar-bottom .sidebar-note {
  min-height: 0;
  margin: 0;
  font-size: var(--sidebar-submenu-font-size);
  line-height: 1.35;
}

.logout-bottom {
  min-height: 32px;
  margin-top: 0;
  padding: 0 10px;
  width: 100%;
  border: 1px solid var(--line);
  color: var(--ink);
  background: transparent;
  box-shadow: none;
  font-size: 15.1px;
}

.sidebar .view-panel,
.sidebar .view-panel * {
  font-size: var(--sidebar-submenu-font-size);
}

.logout-bottom:hover {
  border-color: color-mix(in srgb, var(--primary) 38%, var(--line));
  color: var(--primary-dark);
  background: color-mix(in srgb, var(--primary) 8%, var(--panel-bg));
  box-shadow: none;
}

.map-area {
  position: relative;
  min-width: 0;
  height: 100vh;
  min-height: 100vh;
  overflow: hidden;
  background: var(--map-bg);
  font-size: var(--sidebar-submenu-font-size);
}

#map,
#google-map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.loading-overlay {
  position: absolute;
  inset: 0;
  z-index: 850;
  display: grid;
  place-items: center;
  background: rgba(8, 18, 24, 0.18);
  backdrop-filter: blur(2px);
}

.loading-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-width: min(360px, calc(100vw - 48px));
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  padding: 14px 16px;
  color: var(--ink);
  background: color-mix(in srgb, var(--panel-bg) 92%, white);
  box-shadow: var(--shadow);
}

.loading-spinner {
  width: 30px;
  height: 30px;
  border: 3px solid rgba(127, 149, 160, 0.25);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading-card .icon-close {
  width: 32px;
  min-height: 32px;
  font-size: 20px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.leaflet-container,
#google-map {
  width: 100%;
  height: 100%;
  background: var(--map-bg);
  font-family: Manrope, "Avenir Next", ui-sans-serif, system-ui, sans-serif;
}

#google-map .gm-style button {
  min-height: auto !important;
  border-radius: 6px !important;
  padding: 0 !important;
  box-shadow: 0 5px 14px rgba(25, 54, 45, 0.12) !important;
  transform: none !important;
}

#google-map .gm-style-mtc button {
  min-height: 30px !important;
  padding: 0 10px !important;
  color: #27413a !important;
  background: rgba(255, 255, 255, 0.94) !important;
  font-family: Manrope, "Avenir Next", ui-sans-serif, system-ui, sans-serif !important;
  font-size: 10px !important;
  font-weight: 700 !important;
  line-height: 30px !important;
  backdrop-filter: blur(8px);
}

#google-map .gm-style-mtc + .gm-style-mtc {
  margin-left: 4px !important;
}

#google-map .gm-style-mtc button:hover {
  background: #f4f8f6 !important;
  box-shadow: 0 5px 14px rgba(25, 54, 45, 0.12) !important;
  transform: none !important;
}

.device-map-marker-wrap {
  border: 0;
  background: transparent;
}

.device-map-marker {
  position: relative;
  display: block;
  width: 58px;
  height: 58px;
  pointer-events: auto;
  transform: scale(0.9);
  transform-origin: center;
}

.device-map-badge {
  position: absolute;
  left: 3px;
  top: 11px;
  display: grid;
  width: 52px;
  height: 38px;
  place-items: center;
  border: 0;
  color: var(--device-color);
  background: transparent;
  filter:
    drop-shadow(var(--device-outline-width, 1.35px) 0 0 rgba(255, 255, 255, 0.96))
    drop-shadow(var(--device-outline-width-negative, -1.35px) 0 0 rgba(255, 255, 255, 0.96))
    drop-shadow(0 var(--device-outline-width, 1.35px) 0 rgba(255, 255, 255, 0.96))
    drop-shadow(0 var(--device-outline-width-negative, -1.35px) 0 rgba(255, 255, 255, 0.96))
    drop-shadow(0 2px 1.5px rgba(17, 25, 21, 0.42));
}

.device-map-badge svg {
  width: 52px;
  height: 38px;
}

.device-direction-arrow {
  position: absolute;
  left: 23px;
  top: 23px;
  z-index: -1;
  width: 0;
  height: 0;
  border-right: 6px solid transparent;
  border-bottom: 12px solid var(--device-color);
  border-left: 6px solid transparent;
  filter: drop-shadow(0 -1px 0 #43504b) drop-shadow(1px 0 0 #43504b) drop-shadow(-1px 0 0 #43504b);
  transform: rotate(var(--device-heading)) translateY(-25px);
  transform-origin: 6px 6px;
}

.tracker-popup {
  min-width: 210px;
  max-width: 290px;
  padding: 2px 1px;
  color: #1d252b;
  font-family: Manrope, "Avenir Next", ui-sans-serif, system-ui, sans-serif;
}

.tracker-popup-title {
  display: block;
  margin: 0 0 8px;
  padding: 0 18px 7px 0;
  border-bottom: 1px solid #dfe5e8;
  color: #172026;
  font-size: var(--sidebar-submenu-font-size);
  line-height: 1.3;
}

.tracker-google-popup-title {
  display: block;
  padding: 0 4px;
  color: #172026;
  font-family: Manrope, "Avenir Next", ui-sans-serif, system-ui, sans-serif;
  font-size: var(--sidebar-submenu-font-size);
  font-weight: 750;
  line-height: 1.3;
}

.tracker-popup-google {
  padding-top: 0;
}

.tracker-popup-grid {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  align-items: center;
  gap: 5px 12px;
  font-size: 11.5px;
  line-height: 1.35;
}

.tracker-popup-grid span {
  color: #67747d;
}

.tracker-popup-grid b {
  overflow-wrap: anywhere;
  color: #253038;
  font-weight: 750;
}

.leaflet-popup-content {
  margin: 12px 14px;
}

.leaflet-popup-content-wrapper {
  border-radius: 7px;
}

/* Critical Leaflet layout fallback in case the CDN stylesheet is blocked. */
.leaflet-container {
  position: absolute;
  overflow: hidden;
  outline-offset: 1px;
  touch-action: none;
}

.leaflet-pane,
.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow,
.leaflet-tile-container,
.leaflet-pane > svg,
.leaflet-pane > canvas,
.leaflet-zoom-box,
.leaflet-image-layer,
.leaflet-layer {
  position: absolute;
  left: 0;
  top: 0;
}

.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow {
  user-select: none;
  -webkit-user-drag: none;
}

.leaflet-tile {
  width: 256px;
  height: 256px;
}

.leaflet-pane {
  z-index: 400;
}

.leaflet-tile-pane {
  z-index: 200;
}

.leaflet-overlay-pane {
  z-index: 400;
}

.leaflet-marker-pane {
  z-index: 600;
}

.leaflet-tooltip-pane {
  z-index: 650;
}

.leaflet-popup-pane {
  z-index: 700;
}

.leaflet-control-container .leaflet-top,
.leaflet-control-container .leaflet-bottom {
  position: absolute;
  z-index: 1000;
  pointer-events: none;
}

.leaflet-top {
  top: 0;
}

.leaflet-right {
  right: 0;
}

.leaflet-bottom {
  bottom: 0;
}

.leaflet-left {
  left: 0;
}

.leaflet-control {
  position: relative;
  z-index: 800;
  margin: 10px;
  pointer-events: auto;
}

.leaflet-control a {
  text-decoration: none;
}

.leaflet-bar {
  overflow: hidden;
  border: 1px solid rgba(23, 50, 46, 0.14) !important;
  border-radius: 7px !important;
  box-shadow: 0 5px 16px rgba(25, 54, 45, 0.14) !important;
}

.leaflet-bar a,
.leaflet-bar a:hover {
  width: 32px !important;
  height: 32px !important;
  border-bottom-color: rgba(23, 50, 46, 0.1) !important;
  color: #27413a !important;
  background: rgba(255, 255, 255, 0.94) !important;
  font-size: 18px !important;
  line-height: 32px !important;
  backdrop-filter: blur(8px);
}

.leaflet-bar a:hover {
  background: #f4f8f6 !important;
}

.db-view {
  position: absolute;
  inset: 18px;
  z-index: 500;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-bg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.db-filter-bar {
  display: grid;
  grid-template-columns: minmax(150px, 0.8fr) minmax(160px, 0.9fr) minmax(220px, 1.5fr) auto;
  align-items: end;
  gap: 9px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-soft);
}

.db-filter-bar label {
  min-width: 0;
  font-size: var(--sidebar-submenu-font-size);
}

.db-filter-bar select,
.db-filter-bar input {
  min-height: 34px;
  font-size: var(--sidebar-submenu-font-size);
}

.db-filter-actions,
.db-page-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.db-filter-actions button,
.db-page-actions button {
  min-height: 34px;
  padding: 0 11px;
  box-shadow: none;
  font-size: var(--sidebar-submenu-font-size);
}

.db-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 14px;
  border-top: 1px solid var(--line);
  background: var(--panel-soft);
  font-size: var(--sidebar-submenu-font-size);
}

.db-page-summary {
  color: var(--muted);
  font-weight: 750;
}

.path-modal {
  inset: clamp(12px, 3vw, 34px);
  grid-template-rows: auto minmax(0, 1fr) auto;
  border: 0;
  background: var(--panel-bg);
}

.db-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.path-modal .db-header {
  position: relative;
  justify-content: center;
  padding: 18px 58px;
  background: var(--modal-head-bg);
}

.path-modal .db-header::after {
  position: absolute;
  right: 58px;
  bottom: 0;
  left: 58px;
  height: 3px;
  border-radius: 999px;
  background: var(--modal-accent);
  content: "";
}

.path-modal .db-header strong {
  color: var(--ink);
  font-size: var(--sidebar-submenu-font-size);
  font-weight: 850;
  text-align: center;
}

.icon-close {
  position: absolute;
  top: 12px;
  right: 14px;
  display: grid;
  width: 38px;
  min-height: 38px;
  place-items: center;
  padding: 0;
  border-radius: 50%;
  color: var(--primary-dark);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 8px 18px rgba(17, 35, 45, 0.12);
  font-size: 24px;
  line-height: 1;
}

.icon-close:hover {
  color: #fff;
  background: linear-gradient(135deg, var(--danger), #e2554a);
}

.db-table-wrap {
  overflow: auto;
}

#paths-table-wrap,
#daily-table-wrap {
  padding: 10px 12px;
  background: var(--panel-soft);
}

.db-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.db-table th,
.db-table td {
  border-bottom: 1px solid var(--line);
  padding: 7px 8px;
  text-align: left;
  white-space: nowrap;
  vertical-align: middle;
  color: var(--ink);
  background: var(--table-cell-bg);
}

.db-table th {
  position: sticky;
  top: 0;
  color: var(--path-head-ink);
  background: var(--path-head-bg);
}

.path-table {
  min-width: 1060px;
  border-collapse: separate;
  border-spacing: 0 6px;
  font-size: 12.5px;
}

.path-table .path-max-speed {
  width: 76px;
  max-width: 76px;
  text-align: center;
}

.daily-table {
  min-width: 1180px;
}

.path-table th {
  z-index: 2;
  border-bottom: 1px solid var(--path-row-border);
  padding: 9px 12px;
  vertical-align: middle;
  color: var(--path-head-ink);
  background: var(--path-head-bg);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: none;
}

.path-table th:first-child {
  border-radius: 8px 0 0 8px;
}

.path-table th:last-child {
  border-radius: 0 8px 8px 0;
}

.path-table td {
  border-bottom: 1px solid var(--path-row-border);
  padding: 7px 12px;
  vertical-align: middle;
  background: var(--table-cell-bg);
  color: var(--ink);
  line-height: 1.25;
}

.path-table tbody tr:hover td {
  background: var(--path-hover);
}

.path-table td:first-child {
  border-left: 1px solid var(--path-row-border);
  border-radius: 8px 0 0 8px;
}

.path-table td:last-child {
  border-right: 1px solid var(--path-row-border);
  border-radius: 0 8px 8px 0;
}

.path-table button:not(.place-edit) {
  min-height: 28px;
  padding: 0 9px;
  font-size: 11px;
}

.path-table .place-cell {
  min-height: 24px;
  align-items: center;
}

.path-table .place-edit {
  width: 24px;
  min-width: 24px;
  min-height: 24px;
  padding: 0;
  border-radius: 7px;
  font-size: 12px;
}

.path-empty {
  display: grid;
  min-height: 180px;
  place-items: center;
  color: var(--muted);
  font-weight: 800;
}

.path-table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  background: var(--panel-bg);
}

.path-footer-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
}

.path-footer-actions button {
  min-height: 32px;
  padding: 0 10px;
  font-size: 11.5px;
}

.print-table-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.print-table-button svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.pagination {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 800;
}

.pagination button {
  min-height: 32px;
  padding: 0 10px;
  font-size: 11.5px;
}

.page-status {
  white-space: nowrap;
}

.path-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.place-editor {
  position: absolute;
  inset: 0;
  z-index: 900;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(10, 16, 18, 0.38);
}

.place-editor-card {
  display: grid;
  gap: 12px;
  width: min(420px, 100%);
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-bg);
  box-shadow: var(--shadow);
}

.place-editor-card > strong {
  color: var(--ink);
  font-size: var(--sidebar-submenu-font-size);
  font-weight: 850;
}

.place-editor-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.device-editor-card .place-editor-actions {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
}

.device-editor-card .place-editor-actions button {
  width: auto;
  min-width: 112px;
  min-height: 36px;
  padding: 0 14px;
  box-shadow: none;
  font-size: 11.5px;
}

#device-editor-status:empty {
  display: none;
}

@media (max-width: 820px) {
  .app-shell {
    height: auto;
    min-height: 100%;
    grid-template-columns: 1fr;
    overflow: auto;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    max-height: none;
  }

  .sidebar-toggle {
    display: none;
  }

  .app-shell.sidebar-collapsed {
    grid-template-columns: 1fr;
  }

  .app-shell.sidebar-collapsed .sidebar {
    display: none;
  }

  .db-filter-bar {
    grid-template-columns: 1fr 1fr;
  }

  .db-filter-actions {
    align-self: end;
  }

  .map-area {
    height: 64vh;
    min-height: 420px;
  }

  .db-view {
    inset: 8px;
  }

  .path-modal .db-header {
    padding: 16px 54px;
  }

  .path-modal .db-header strong {
    font-size: var(--sidebar-submenu-font-size);
  }

  .path-table-footer {
    align-items: stretch;
    flex-direction: column;
  }

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

  .path-footer-actions {
    width: 100%;
  }

  .path-footer-actions button {
    flex: 1;
  }

  .history-paths-submenu > .range-summary { width: 100%; }
}
