/* Pool Manager — UI Kit v1 (Liquid Glass / Clean) */
@import url("https://unpkg.com/leaflet@1.9.4/dist/leaflet.css");
:root {
  --pm-font: "Inter", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --pm-bg-1: #eff6ff;
  --pm-bg-2: #f8fafc;
  --pm-bg-3: #e2e8f0;
  --pm-primary: #2563eb;
  --pm-primary-dim: #1d4ed8;
  --pm-accent: #3b82f6;
  --pm-success: #16a34a;
  --pm-warning: #d97706;
  --pm-danger: #dc2626;
  --pm-text: #0f172a;
  --pm-text-muted: #64748b;
  --pm-border: #dbe5f1;
  --pm-glass-bg: #ffffff;
  --pm-glass-border: #e2e8f0;
  --pm-glass-blur: 0px;
  --pm-radius: 12px;
  --pm-radius-sm: 8px;
  --pm-shadow: 0 8px 22px rgba(15, 23, 42, 0.08);
  --pm-sidebar-w: 260px;
  --pm-sidebar-collapsed: 72px;
  --pm-topbar-h: 64px;
  --pm-ring: 0 0 0 3px rgba(37, 99, 235, 0.24);
}

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

html, body {
  margin: 0;
  min-height: 100%;
  font-family: var(--pm-font);
  color: var(--pm-text);
  background: radial-gradient(1200px 600px at 10% -10%, rgba(37, 99, 235, 0.16), transparent),
    radial-gradient(900px 500px at 90% 0%, rgba(59, 130, 246, 0.12), transparent),
    linear-gradient(165deg, var(--pm-bg-1) 0%, var(--pm-bg-2) 45%, var(--pm-bg-3) 100%);
  background-attachment: fixed;
}

a { color: var(--pm-accent); text-decoration: none; transition: color 0.15s ease; }
a:hover { color: var(--pm-primary-dim); }

h1, h2, h3, h4 { margin: 0 0 0.65rem; font-weight: 600; letter-spacing: -0.02em; }
p { margin: 0 0 1rem; line-height: 1.55; }
small, .hint { color: var(--pm-text-muted); font-size: 0.875rem; }

/* ——— Glass panel ——— */
.glass-panel,
.card,
.hero {
  background: var(--pm-glass-bg);
  border: 1px solid var(--pm-glass-border);
  border-radius: var(--pm-radius);
  box-shadow: var(--pm-shadow);
}

.card, .hero { padding: 1.25rem 1.35rem; margin-bottom: 1.25rem; }
.card {
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

/* ——— App shell + sidebar ——— */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.app-sidebar {
  width: var(--pm-sidebar-w);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  padding: 1rem 0.75rem;
  border-right: 1px solid rgba(255, 255, 255, 0.14);
  background: linear-gradient(180deg, #172138 0%, #1f2f4e 100%);
  position: sticky;
  top: 0;
  height: 100vh;
  transition: width 0.25s ease;
  z-index: 100;
}

.app-shell.is-collapsed .app-sidebar { width: var(--pm-sidebar-collapsed); }
.app-shell.is-collapsed .nav-label,
.app-shell.is-collapsed .nav-group-label,
.app-shell.is-collapsed .sidebar-brand-text,
.app-shell.is-collapsed .sidebar-user-meta,
.app-shell.is-collapsed .nav-group-chevron,
.app-shell.is-collapsed .sidebar-company-name { display: none; }
.app-shell.is-collapsed .nav-link { justify-content: center; padding-inline: 0.5rem; }

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.65rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  margin-bottom: 0.75rem;
}

.sidebar-logo {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(135deg, #1d4ed8, #2563eb);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.85rem;
  color: #dbeafe;
  flex-shrink: 0;
}

.sidebar-brand-text strong { display: block; font-size: 0.95rem; color: #e2e8f0; }
.sidebar-brand-text span { font-size: 0.75rem; color: #94a3b8; }

.sidebar-toggle {
  margin: 0 0.65rem 0.75rem;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #cbd5e1;
  border-radius: var(--pm-radius-sm);
  padding: 0.45rem;
  cursor: pointer;
  margin-top: 0;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0 0.25rem 0.35rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.45) transparent;
}

.sidebar-nav::-webkit-scrollbar {
  width: 8px;
}

.sidebar-nav::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(148, 163, 184, 0.42), rgba(148, 163, 184, 0.22));
  border: 2px solid transparent;
  background-clip: padding-box;
}

.nav-group {
  margin-bottom: 0.65rem;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 12px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.06), rgba(15, 23, 42, 0.05));
  overflow: clip;
}

.nav-group-toggle {
  width: 100%;
  margin: 0;
  padding: 0.5rem 0.65rem;
  border: 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 0;
  background: transparent;
  color: inherit;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  cursor: default;
}

.nav-group-links {
  padding: 0.35rem;
}

.nav-group-label {
  display: block;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #94a3b8;
  padding: 0;
  margin: 0;
}

.nav-group-chevron {
  font-size: 0.74rem;
  color: #94a3b8;
  transition: transform 0.2s ease;
}

.nav-group.is-open .nav-group-chevron {
  transform: rotate(180deg);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.75rem;
  margin-bottom: 0.15rem;
  border-radius: var(--pm-radius-sm);
  color: #cbd5e1;
  font-size: 0.9rem;
  transition: background 0.15s, color 0.15s;
}

.nav-link:hover {
  background: rgba(148, 163, 184, 0.15);
  color: #f8fafc;
}

.nav-link.nav-active {
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.38), rgba(59, 130, 246, 0.18));
  color: #eff6ff;
  border: 1px solid rgba(147, 197, 253, 0.5);
}

.nav-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  opacity: 0.9;
}

.sidebar-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding-top: 0.65rem;
  margin-top: 0.5rem;
}

.sidebar-session-card {
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.2);
  padding: 0.3rem;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.4rem 0.5rem;
  margin-bottom: 0.15rem;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1d4ed8, #2563eb);
  border: 2px solid rgba(191, 219, 254, 0.4);
  display: grid;
  place-items: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: #dbeafe;
}

.sidebar-user-meta strong { display: block; font-size: 0.85rem; color: #f8fafc; }
.sidebar-user-meta span { font-size: 0.72rem; color: #cbd5e1; }

.sidebar-company-name {
  margin: 0 0.5rem 0.35rem;
  font-size: 0.72rem;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ——— Main content ——— */
.app-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.app-topbar {
  height: var(--pm-topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  border-bottom: 1px solid var(--pm-border);
  background: rgba(248, 250, 252, 0.92);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 50;
}

.page-title { font-size: 1.15rem; font-weight: 600; margin: 0; }
.page-subtitle { font-size: 0.8rem; color: var(--pm-text-muted); margin: 0.15rem 0 0; }

.app-content {
  padding: 1.5rem;
  max-width: 1600px;
  width: 100%;
}

/* ——— Public / auth layout ——— */
.layout-public .wrap,
.layout-auth .wrap {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1.25rem;
}

.layout-auth .wrap { max-width: 440px; padding-top: 4rem; }

.lang-switcher {
  text-align: right;
  font-size: 0.8rem;
  color: var(--pm-text-muted);
  margin-bottom: 0.75rem;
}

/* ——— Landing layout refresh ——— */
.layout-public .wrap {
  max-width: 1160px;
}

.landing-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(340px, 420px);
  gap: 1rem;
  align-items: start;
}

.landing-main {
  display: grid;
  gap: 1rem;
}

.landing-hero {
  padding: 1.4rem 1.5rem;
}

.landing-kicker {
  display: inline-flex;
  margin: 0 0 0.5rem;
  padding: 0.24rem 0.58rem;
  border-radius: 999px;
  border: 1px solid rgba(37, 99, 235, 0.28);
  background: rgba(37, 99, 235, 0.08);
  color: #1e40af;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.landing-lead {
  margin-bottom: 1rem;
  max-width: 62ch;
  color: #1e293b;
}

.landing-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.1rem;
  margin-bottom: 0.85rem;
}

.landing-meta-row p {
  margin: 0;
  font-size: 0.9rem;
}

.landing-feature-list {
  margin: 0;
  padding-left: 1rem;
  display: grid;
  gap: 0.35rem;
}

.landing-feature-list li {
  color: #334155;
  font-size: 0.9rem;
  line-height: 1.45;
}

.landing-plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.75rem;
}

.landing-plan-card {
  border: 1px solid var(--pm-glass-border);
  border-radius: var(--pm-radius);
  background: #fff;
  box-shadow: var(--pm-shadow);
  padding: 0.92rem 1rem;
}

.landing-plan-name {
  margin: 0 0 0.35rem;
  font-weight: 700;
  color: #0f172a;
}

.landing-plan-price {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
  line-height: 1.2;
  color: #1d4ed8;
  font-weight: 800;
}

.landing-plan-price span {
  font-size: 0.78rem;
  color: var(--pm-text-muted);
  margin-left: 0.22rem;
  font-weight: 600;
}

.landing-plan-copy {
  margin: 0;
  font-size: 0.85rem;
  color: #475569;
}

.landing-signup-card {
  position: sticky;
  top: 1rem;
}

.landing-signup-card h2 {
  margin-bottom: 0.35rem;
}

.landing-signup-form {
  margin-top: 0.7rem;
}

.landing-form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.1rem 0.7rem;
}

.landing-form-field small {
  display: inline-block;
  margin-top: 0.28rem;
}

.landing-signup-footer {
  margin: 0.75rem 0 0;
}

.landing-signup-footer a {
  font-size: 0.86rem;
  color: #1d4ed8;
  font-weight: 600;
}

/* ——— KPI cards ——— */
.cards, .kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.kpi-card {
  padding: 1.15rem 1.25rem;
  border-radius: var(--pm-radius);
  background: var(--pm-glass-bg);
  border: 1px solid var(--pm-glass-border);
  backdrop-filter: blur(var(--pm-glass-blur));
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s, box-shadow 0.2s;
}

.kpi-card:hover { transform: translateY(-2px); box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28); }

.kpi-card h3 {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--pm-text-muted);
  margin-bottom: 0.35rem;
}

.kpi-card .kpi-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--pm-text);
  line-height: 1.2;
}

.kpi-card .kpi-trend { font-size: 0.8rem; color: var(--pm-success); margin-top: 0.25rem; }
.kpi-card.accent { border-color: rgba(34, 211, 238, 0.35); }
.kpi-card.accent .kpi-value { color: var(--pm-primary); }

.card-link {
  text-decoration: none;
  color: inherit;
  display: block;
  transition: transform 0.2s, border-color 0.2s;
}

.card-link:hover {
  transform: translateY(-2px);
  border-color: rgba(34, 211, 238, 0.4);
}

/* ——— Forms ——— */
label { display: block; margin: 0.65rem 0 0.35rem; font-size: 0.85rem; color: var(--pm-text-muted); }

input, select, textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border-radius: var(--pm-radius-sm);
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: var(--pm-text);
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: rgba(34, 211, 238, 0.5);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.12);
}

button, .btn {
  margin-top: 0.75rem;
  padding: 0.6rem 1.1rem;
  border: none;
  border-radius: var(--pm-radius-sm);
  background: linear-gradient(135deg, var(--pm-primary-dim), var(--pm-primary));
  color: #ffffff;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}

button:hover, .btn:hover { opacity: 0.92; }

.btn-ghost {
  background: transparent;
  border: 1px solid #cbd5e1;
  color: var(--pm-text-muted);
  margin-top: 0;
}

.btn-ghost:hover { color: var(--pm-text); border-color: var(--pm-glass-border); }

.sidebar-logout { padding: 0 0.5rem 0.35rem; margin: 0; }
.sidebar-logout button { width: 100%; margin: 0; padding: 0.42rem 0.65rem; font-size: 0.78rem; }
button:active { transform: scale(0.98); }

.button-link, a.button-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.55rem 1rem;
  border-radius: var(--pm-radius-sm);
  background: linear-gradient(135deg, var(--pm-primary-dim), var(--pm-primary));
  color: #042028 !important;
  font-weight: 600;
  font-size: 0.875rem;
  text-decoration: none;
  border: none;
}

.button-link.secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--pm-text) !important;
  border: 1px solid var(--pm-border);
}

a:focus-visible,
button:focus-visible,
.btn:focus-visible,
.button-link:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.nav-link:focus-visible,
.quick-action-tile:focus-visible,
.mode-switch-link:focus-visible {
  outline: none;
  box-shadow: var(--pm-ring);
}

.danger-btn, button.danger-btn { background: linear-gradient(135deg, #b91c1c, var(--pm-danger)); color: #fff; }

/* ——— Tables ——— */
.table-wrap { overflow-x: auto; border-radius: var(--pm-radius-sm); }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

th, td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--pm-border);
}

th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--pm-text-muted);
  background: rgba(0, 0, 0, 0.15);
}

tr:hover td { background: rgba(255, 255, 255, 0.02); }
tbody tr {
  transition: background-color 0.15s ease;
}

/* ——— Badges & flashes ——— */
.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
}

.badge.pass { background: rgba(52, 211, 153, 0.2); color: var(--pm-success); }
.badge.fail { background: rgba(248, 113, 113, 0.2); color: var(--pm-danger); }
.badge.warn { background: rgba(251, 191, 36, 0.2); color: var(--pm-warning); }
.badge.pending { background: rgba(148, 163, 184, 0.2); color: var(--pm-text-muted); }

.flash {
  padding: 0.75rem 1rem;
  border-radius: var(--pm-radius-sm);
  margin-bottom: 1rem;
  border: 1px solid transparent;
}

.flash-success { background: rgba(52, 211, 153, 0.12); border-color: rgba(52, 211, 153, 0.3); }
.flash-error { background: rgba(248, 113, 113, 0.12); border-color: rgba(248, 113, 113, 0.3); }

/* --- Settings page --- */
.tenant-settings-tabs-wrap {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  margin-bottom: 18px;
  position: sticky;
  top: 12px;
  z-index: 40;
}

.tenant-settings-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 12px;
  border-bottom: 1px solid #f1f5f9;
}

.tenant-settings-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 0;
  padding: 9px 14px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: #475569;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
  text-decoration: none;
}

.tenant-settings-tab-btn i {
  color: #94a3b8;
  font-size: 14px;
}

.tenant-settings-tab-btn:hover {
  background: #f8fafc;
  color: #0f172a;
}

.tenant-settings-tab-btn.is-active {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}

.tenant-settings-tab-btn.is-active i {
  color: #2563eb;
}

.tenant-settings-panels {
  min-height: 120px;
}

.tenant-settings-panel {
  display: none;
  animation: settingsPanelIn .2s ease;
}

.tenant-settings-panel.is-active {
  display: block;
}

.tenant-settings-panel-lead {
  margin: 0 0 16px;
  padding: 12px 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  font-size: 13px;
  color: #64748b;
  line-height: 1.5;
}

.settings-card {
  background: #fff;
  border-radius: 12px;
  padding: 20px 25px;
  margin-bottom: 25px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  border: 1px solid #e2e8f0;
}

.settings-title {
  font-weight: 800;
  color: var(--pm-text);
  text-transform: uppercase;
  font-size: 13px;
  letter-spacing: .5px;
  border-bottom: 1px solid #f1f5f9;
  padding-bottom: 10px;
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.tenant-settings-panel h4 {
  margin: .9rem 0 .45rem;
  font-size: .9rem;
  color: #475569;
}

.theme-option-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.75rem;
}

.theme-option-card {
  position: relative;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 16px;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #f8fafc;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .1s;
}

.theme-option-card input {
  margin-top: 4px;
  accent-color: var(--pm-primary);
}

.theme-option-card:hover {
  border-color: #93c5fd;
  box-shadow: 0 6px 18px rgba(37, 99, 235, .08);
}

.theme-option-card:active {
  transform: scale(0.99);
}

.theme-option-card:has(input:checked) {
  border-color: var(--pm-primary);
  background: #eff6ff;
  box-shadow: 0 0 0 3px rgba(52, 152, 219, .14);
}

.theme-option-card--liquid:has(input:checked) {
  background: linear-gradient(135deg, rgba(239, 246, 255, .96), rgba(245, 243, 255, .96));
}

.theme-option-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #bfdbfe;
  color: #2563eb;
  background: #eaf2ff;
}

.theme-option-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.theme-option-copy span {
  color: #64748b;
  font-size: .95rem;
}

.settings-action-btn {
  margin-top: .65rem;
  display: inline-flex;
  align-items: center;
  gap: .5rem;
}

@supports not selector(:has(*)) {
  .theme-option-card--active {
    border-color: var(--pm-primary);
    background: #eff6ff;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, .14);
  }
}

@keyframes settingsPanelIn {
  from {
    opacity: .6;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 720px) {
  .tenant-settings-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 8px;
  }
  .tenant-settings-tab-btn {
    flex-shrink: 0;
    font-size: 12px;
    padding: 8px 12px;
  }
  .tenant-settings-tab-btn .tenant-settings-tab-label {
    display: none;
  }
}

@media (min-width: 721px) {
  .tenant-settings-tab-btn .tenant-settings-tab-short {
    display: none;
  }
}

.settings-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.25rem 0.75rem;
}

.settings-form-grid .full {
  grid-column: 1 / -1;
}

.settings-full-address {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.settings-color-input {
  padding: 0.2rem;
  min-height: 2.2rem;
  border-radius: var(--pm-radius-sm);
  cursor: pointer;
}

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

.settings-color-input::-webkit-color-swatch,
.settings-color-input::-moz-color-swatch {
  border: none;
  border-radius: calc(var(--pm-radius-sm) - 2px);
}

.settings-logo-preview-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.settings-logo-preview {
  display: block;
  width: 100%;
  max-width: 100%;
  height: 100%;
  border: 1px solid var(--pm-border);
  border-radius: 12px;
  background: #fff;
  padding: 0.35rem;
  object-fit: contain;
}

.company-settings-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(240px, 0.9fr);
  gap: 1.2rem;
}

.company-settings-media {
  display: grid;
  gap: .85rem;
  align-content: start;
}

.company-logo-panel {
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: .85rem;
  background: #f8fafc;
}

.company-logo-title {
  margin: 0 0 .55rem;
  font-weight: 700;
  color: #334155;
  font-size: .86rem;
}

.company-logo-preview {
  position: relative;
  width: 100%;
  min-height: 180px;
  border: 1px dashed #cbd5e1;
  border-radius: 14px;
  background: linear-gradient(180deg, #fff, #f8fafc);
  padding: .5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: .7rem;
}

.company-logo-preview.has-image {
  border-style: solid;
  border-color: #bfdbfe;
}

.company-logo-preview.is-empty {
  background: linear-gradient(180deg, #f8fafc, #f1f5f9);
}

.company-logo-delete-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  margin: 0;
  border: 0;
  border-radius: 999px;
  background: #dc2626;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(220, 38, 38, .3);
  z-index: 2;
}

.company-logo-delete-btn:hover {
  background: #b91c1c;
}

.company-logo-placeholder {
  width: 100%;
  height: 100%;
  min-height: 150px;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: .45rem;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  background: rgba(241, 245, 249, .75);
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: .72rem;
  font-weight: 700;
}

.company-logo-placeholder i {
  font-size: 1.25rem;
}

.settings-upload-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  width: 100%;
  padding: .62rem .8rem;
  border-radius: 12px;
  border: 1px solid #bfdbfe;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.12), rgba(59, 130, 246, 0.18));
  color: #1d4ed8;
  font-weight: 700;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}

.settings-upload-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(37, 99, 235, .14);
  border-color: #93c5fd;
}

.settings-upload-btn-secondary {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.04), rgba(51, 65, 85, 0.06));
  border-color: #cbd5e1;
  color: #334155;
}

.settings-upload-name {
  margin: .45rem 0 0;
  color: #64748b;
  font-size: .78rem;
  text-align: center;
  word-break: break-word;
}

@media (max-width: 980px) {
  .company-settings-layout {
    grid-template-columns: 1fr;
  }
}

.settings-inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.settings-inline-actions button {
  margin-top: 0.65rem;
}

.settings-switch-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.2rem 0.9rem;
  margin-bottom: 0.65rem;
}

.settings-switch-list label {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--pm-text);
}

.settings-switch-list input[type="checkbox"] {
  width: auto;
}

.settings-checklist-section {
  border-top: 1px dashed var(--pm-border);
  padding-top: 0.55rem;
  margin-top: 0.55rem;
}

.settings-checklist-section h4 {
  margin: 0 0 0.35rem;
  font-size: 0.9rem;
}

.settings-checklist-fields {
  margin: 0;
  padding-left: 1rem;
  display: grid;
  gap: 0.35rem;
}

.settings-checklist-fields .hint {
  margin-left: 0.2rem;
}

.settings-checklist-field-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.settings-checklist-config {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin: 0.25rem 0 0.35rem;
}

.settings-checklist-card-default {
  border-color: rgba(59, 130, 246, 0.2);
  box-shadow: 0 12px 28px rgba(37, 99, 235, 0.08);
}

.settings-checklist-fields-default {
  list-style: none;
  padding-left: 0;
  gap: 0.7rem;
}

.settings-default-field-row {
  padding: 0.6rem 0.65rem;
  border: 1px solid var(--pm-border);
  border-radius: var(--pm-radius-sm);
  background: rgba(255, 255, 255, 0.72);
}

.settings-checklist-edit {
  margin-top: 0.35rem;
}

.settings-checklist-edit summary {
  cursor: pointer;
  color: var(--pm-text-muted);
  font-size: 0.82rem;
}

.settings-checklist-edit form {
  margin-top: 0.4rem;
  border-top: 1px dashed var(--pm-border);
  padding-top: 0.4rem;
}

/* ——— Utilities ——— */
.mode-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem;
  margin-bottom: 0.8rem;
  border: 1px solid var(--pm-border);
  border-radius: var(--pm-radius-sm);
  background: #ffffff;
}

.mode-switch-label {
  color: var(--pm-text-muted);
  font-size: 0.78rem;
  padding: 0 0.25rem;
}

.mode-switch-link {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  border: 1px solid transparent;
  color: var(--pm-text-muted);
  font-size: 0.8rem;
}

.mode-switch-link:hover {
  color: var(--pm-text);
  border-color: var(--pm-border);
  background: rgba(255, 255, 255, 0.04);
}

.mode-switch-link.active {
  color: #ffffff;
  border-color: rgba(37, 99, 235, 0.35);
  background: linear-gradient(135deg, var(--pm-primary-dim), var(--pm-primary));
}

.admin-overview-header .section-header {
  margin-bottom: 0;
}

.admin-quick-actions {
  padding-top: 1rem;
}

.quick-action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
}

.quick-action-tile {
  display: block;
  border: 1px solid var(--pm-border);
  border-radius: var(--pm-radius-sm);
  padding: 0.85rem;
  background: #ffffff;
  color: var(--pm-text);
  transition: border-color 0.15s ease, transform 0.15s ease, background 0.15s ease;
}

.quick-action-tile strong {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.88rem;
  color: var(--pm-primary);
}

.quick-action-tile span {
  display: block;
  font-size: 0.78rem;
  color: var(--pm-text-muted);
  line-height: 1.35;
}

.quick-action-tile:hover {
  border-color: rgba(37, 99, 235, 0.35);
  background: #eff6ff;
  transform: translateY(-2px);
}

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

.admin-widget {
  margin-bottom: 0;
}

.admin-widget h3 {
  margin-bottom: 0.35rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--pm-text-muted);
}

.widget-main {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--pm-text);
}

.admin-widget-wide {
  grid-column: span 2;
}

.mini-progress {
  width: 100%;
  max-width: 90px;
  height: 7px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.2);
  overflow: hidden;
  margin-bottom: 0.2rem;
}

.mini-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--pm-primary-dim), var(--pm-success));
  transition: width 0.28s ease;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.filter-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
  align-items: end;
  margin-bottom: 1rem;
}

.filter-row button { margin-top: 0; width: fit-content; }

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
  margin: 0.75rem 0;
}

.actions, .actions-inline, .button-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.actions button { margin-top: 0; }
.inline-form { display: inline; margin: 0; }
.inline-form button { margin: 0; padding: 0.35rem 0.6rem; font-size: 0.8rem; }

.work-orders-grid {
  display: grid;
  gap: 0.75rem;
}

.work-order-card {
  margin-bottom: 0;
}

.work-order-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
}

.work-order-head strong {
  font-size: 0.95rem;
}

.work-order-status {
  font-size: 0.72rem;
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--pm-border);
  background: rgba(148, 163, 184, 0.12);
  white-space: nowrap;
}

.work-order-status.status-pending { background: rgba(59, 130, 246, 0.15); }
.work-order-status.status-working_on_it { background: rgba(234, 179, 8, 0.2); }
.work-order-status.status-rescheduled { background: rgba(168, 85, 247, 0.18); }
.work-order-status.status-completed { background: rgba(34, 197, 94, 0.18); }
.work-order-status.status-cancelled { background: rgba(239, 68, 68, 0.16); }

.work-order-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.25rem 0.75rem;
  margin-bottom: 0.5rem;
}

.work-order-meta span {
  font-size: 0.76rem;
  color: var(--pm-text-muted);
}

.work-order-actions {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
  align-items: center;
}

.work-order-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.work-order-actions select {
  margin: 0;
  min-width: 180px;
}

.work-order-actions button {
  margin: 0;
  padding: 0.42rem 0.6rem;
  font-size: 0.78rem;
}

.work-order-actions-row .button-link,
.work-order-actions-row a.button-link {
  padding: 0.42rem 0.58rem;
  font-size: 0.78rem;
}

.work-order-form-grid {
  display: grid;
  gap: 0.75rem;
}

.work-order-form-grid .full {
  grid-column: 1 / -1;
}

.work-order-contact-mode {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.work-order-contact-mode label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.work-order-checkbox-wrap {
  display: flex;
  align-items: end;
}

.work-order-checkbox-wrap label {
  margin: 0;
}

.work-order-disabled {
  opacity: 0.45;
  filter: saturate(0.4);
}

.work-order-disabled select,
.work-order-disabled input,
.work-order-disabled textarea,
.work-order-disabled button {
  pointer-events: none;
}

code {
  background: rgba(0, 0, 0, 0.35);
  padding: 0.15rem 0.4rem;
  border-radius: 6px;
  font-size: 0.85em;
}

.chart-card { min-height: 280px; }
.chart-card canvas { max-height: 260px; }

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.75rem;
}

.photo-grid img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--pm-radius-sm);
  border: 1px solid var(--pm-border);
}

.photo-thumb {
  display: block;
  overflow: hidden;
  border-radius: var(--pm-radius-sm);
  border: 1px solid var(--pm-glass-border);
  background: rgba(0, 0, 0, 0.25);
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.client-gallery-thumb {
  width: 100%;
  padding: 0;
  cursor: pointer;
}

.photo-thumb:hover {
  transform: translateY(-2px);
  border-color: rgba(34, 211, 238, 0.45);
}

.gallery-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.88);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  z-index: 1200;
  padding: 1rem;
}

.gallery-lightbox[hidden] {
  display: none;
}

.gallery-lightbox-figure {
  margin: 0;
  text-align: center;
}

.gallery-lightbox-figure img {
  max-width: min(95vw, 1200px);
  max-height: 78vh;
  border-radius: 10px;
}

.gallery-lightbox-figure figcaption {
  margin-top: 0.65rem;
  color: #dbeafe;
  font-size: 0.95rem;
}

.gallery-lightbox-nav,
.gallery-lightbox-close {
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: rgba(15, 23, 42, 0.8);
  color: #e2e8f0;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 1.4rem;
}

.gallery-lightbox-close {
  position: absolute;
  top: 0.8rem;
  right: 0.8rem;
  font-size: 1.6rem;
  line-height: 1;
}

.gallery-lightbox-nav.prev {
  justify-self: start;
}

.gallery-lightbox-nav.next {
  justify-self: end;
}

body.gallery-lightbox-open {
  overflow: hidden;
}

.avatar-photo {
  padding: 0;
  overflow: hidden;
}

.avatar-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-lg {
  width: 56px;
  height: 56px;
  font-size: 1rem;
}

.avatar-sm {
  width: 32px;
  height: 32px;
  font-size: 0.7rem;
}

.person-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.portal-shell .sidebar-logo {
  background: linear-gradient(135deg, #38bdf8, #0ea5e9);
}

.portal-shell .nav-link.nav-active {
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.38), rgba(59, 130, 246, 0.18));
  color: #eff6ff;
  border-color: rgba(147, 197, 253, 0.5);
}

.layout-document .wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 3rem;
}

.layout-document .lang-switcher {
  margin-bottom: 1rem;
}

/* Command center */
.route-date-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.6rem 0.7rem;
}

.route-date-arrow {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #ffffff;
  border: 1px solid var(--pm-border);
  color: #334155;
}

.route-date-strip {
  display: flex;
  gap: 0.45rem;
  overflow-x: auto;
  flex: 0 1 auto;
  justify-content: center;
  max-width: 920px;
  scrollbar-width: none;
}

.route-date-strip::-webkit-scrollbar {
  display: none;
}

.route-date-pill {
  min-width: 60px;
  border: 1px solid #dbe5f1;
  background: #f8fafc;
  border-radius: 10px;
  padding: 0.34rem 0.5rem;
  text-align: center;
  color: #334155;
}

.route-date-pill small,
.route-date-pill span {
  display: block;
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  line-height: 1.1;
}

.route-date-pill strong {
  display: block;
  font-size: 1rem;
  line-height: 1.1;
  margin: 0.12rem 0;
}

.route-date-pill.active {
  background: #2563eb;
  color: #eff6ff;
  border-color: #1d4ed8;
}

.route-kpi-grid .kpi-card {
  margin-bottom: 0;
}

.route-manager-grid {
  display: grid;
  grid-template-columns: minmax(300px, 340px) minmax(420px, 1fr) minmax(360px, 1fr);
  gap: 0.9rem;
}

.route-manager-col {
  margin-bottom: 0;
}

.route-manager-col h3 {
  margin-bottom: 0.55rem;
}

.route-tech-list {
  display: grid;
  gap: 0.55rem;
  margin-bottom: 0.8rem;
}

.route-tech-card {
  position: relative;
  display: block;
  border: 1px solid var(--pm-border);
  border-radius: var(--pm-radius-sm);
  padding: 0.65rem 0.75rem 0.65rem 1rem;
  background: #fff;
  color: var(--pm-text);
}

.route-tech-color {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  border-radius: 8px 0 0 8px;
}

.route-tech-card strong {
  display: block;
  font-size: 0.86rem;
  margin-bottom: 0.15rem;
}

.route-tech-card span {
  color: var(--pm-text-muted);
  font-size: 0.76rem;
  display: block;
}

.route-tech-meta {
  margin-top: 0.2rem;
}

.route-tech-card.active {
  border-color: rgba(37, 99, 235, 0.55);
  background: #eff6ff;
}

.route-stop-list {
  max-height: 72vh;
  overflow-y: auto;
  display: grid;
  gap: 0.6rem;
}

.route-stop-card {
  position: relative;
  border: 1px solid #dbe5f1;
  border-left: 4px solid #2563eb;
  border-radius: 14px;
  padding: 0.78rem 0.9rem 0.8rem 0.75rem;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(20px) saturate(170%);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.1);
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.route-stop-card.type-weekly { border-left-color: #2563eb; }
.route-stop-card.type-supplier { border-left-color: #facc15; }
.route-stop-card.type-work-order { border-left-color: #9333ea; }

.route-stop-card.is-completed {
  opacity: 0.45;
  border-left-color: #22c55e;
}

.route-stop-head {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
  padding-right: 1.25rem;
}

.route-stop-head strong {
  font-size: 0.86rem;
  display: block;
  margin-bottom: 0.18rem;
}

.route-stop-head .route-stop-number {
  color: #1d4ed8;
  min-width: 1.4rem;
}

.route-stop-head .route-stop-number.route-stop-bubble {
  color: #fff;
}

.route-stop-bubble {
  display: inline-flex;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  color: #fff;
  border: 2px solid #dc2626;
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.25);
}

.route-stop-client {
  min-width: 0;
  flex: 1;
}

.route-stop-address {
  margin: 0;
  font-size: 0.76rem;
  color: var(--pm-text-muted);
}

.stop-cash-placeholder {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: #64748b;
  background: #f1f5f9;
  border: 1px solid #94a3b8;
}

.stop-cash-inline {
  flex: 0 0 auto;
}

.client-meta-inline {
  margin-top: 6px;
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 6px;
  width: 100%;
}

.client-tags-inline {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
  flex: 1 1 auto;
}

.card-eta-time {
  font-size: 11px;
  font-weight: 800;
  color: #64748b;
}

.card-eta-inline {
  margin-left: auto;
  white-space: nowrap;
  text-align: right;
  flex: 0 0 auto;
}

.card-type-tag {
  font-size: 0.58rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 999px;
  background: #dbeafe;
  color: #1d4ed8;
}

.card-body-water-tag {
  background: #e0e7ff;
  color: #4338ca;
}

.route-drag-handle {
  position: absolute;
  top: 0.5rem;
  right: 0.2rem;
  border: 0;
  background: transparent;
  color: #64748b;
  font-size: 1rem;
  cursor: grab;
}

.route-sort-ghost {
  opacity: 0.35;
}

.route-sort-chosen {
  border-color: rgba(37, 99, 235, 0.5);
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.15);
}

.route-accordion {
  border: 1px solid var(--pm-border);
  border-radius: var(--pm-radius-sm);
  background: #fff;
  margin-bottom: 0.65rem;
}

.route-accordion summary {
  cursor: pointer;
  list-style: none;
  padding: 0.6rem 0.72rem;
  font-size: 0.83rem;
  font-weight: 700;
  color: #334155;
}

.route-accordion[open] summary {
  border-bottom: 1px solid var(--pm-border);
}

.route-accordion form {
  padding: 0.2rem 0.72rem 0.72rem;
}

.route-manager-map {
  width: 100%;
  min-height: 520px;
  border: 1px solid #dbe7f5;
  border-radius: var(--pm-radius-sm);
  background: #f8fbff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.65);
}

.route-map-number span {
  display: inline-flex;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  background: #16a34a;
  color: #fff;
  border: 2px solid #fff;
  font-size: 0.76rem;
  font-weight: 800;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.3);
}

.leaflet-control-attribution {
  background: rgba(255, 255, 255, 0.72) !important;
  backdrop-filter: blur(4px);
  border-radius: 8px;
  border: 1px solid #dbe5f1;
}

/* Client map */
.client-map-layout {
  display: grid;
  grid-template-columns: minmax(270px, 320px) minmax(0, 1fr);
  gap: 0.9rem;
}

.client-map-filters {
  border: 1px solid var(--pm-border);
  border-radius: var(--pm-radius-sm);
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.75);
  display: grid;
  gap: 0.85rem;
  align-content: start;
}

.client-map-search-block label {
  margin-top: 0;
}

.client-map-search-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.45rem;
  align-items: center;
}

.client-map-search-row button {
  margin-top: 0;
}

.client-map-filter-block h3 {
  margin: 0;
  font-size: 0.88rem;
}

.client-map-filter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.client-map-filter-head .btn-ghost {
  padding: 0.32rem 0.58rem;
  font-size: 0.76rem;
}

.client-map-filter-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.client-map-filter-btn {
  margin-top: 0;
  border: 1px solid #cbd5e1;
  border-left-width: 6px;
  border-left-color: var(--client-map-btn-color, #2563eb);
  background: #fff;
  color: #334155;
  padding: 0.38rem 0.68rem;
  font-size: 0.8rem;
  border-radius: 999px;
}

.client-map-filter-btn.is-active {
  background: linear-gradient(135deg, var(--client-map-btn-color, #2563eb), #0f172a);
  color: #f8fafc;
  border-color: transparent;
}

.client-map-summary {
  border-top: 1px dashed var(--pm-border);
  padding-top: 0.65rem;
}

.client-map-summary p {
  margin: 0 0 0.3rem;
  font-size: 0.82rem;
}

.client-map-canvas-wrap {
  display: grid;
  gap: 0.45rem;
}

.client-map-canvas {
  width: 100%;
  min-height: 680px;
  border: 1px solid #dbe7f5;
  border-radius: var(--pm-radius-sm);
  background: #f8fbff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.68);
}

.client-map-marker span {
  display: inline-block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.3);
}

.client-map-search-marker span {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #f59e0b;
  color: #111827;
  border: 2px solid #ffffff;
  font-size: 0.82rem;
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.38);
}

/* Legacy compat */
.tenant-header, .tenant-nav, .control-nav { display: none; }
.wizard-progress { padding: 1rem; margin: 1rem 0; border: 1px solid var(--pm-border); border-radius: var(--pm-radius); background: var(--pm-glass-bg); }
.wizard-progress-track { height: 8px; background: rgba(0,0,0,0.3); border-radius: 999px; overflow: hidden; margin: 0.75rem 0; }
.wizard-progress-fill { height: 100%; background: linear-gradient(90deg, var(--pm-primary-dim), var(--pm-success)); }
.wizard-step { display: flex; gap: 0.5rem; padding: 0.5rem; border-radius: 8px; font-size: 0.875rem; }
.wizard-step.pass { background: rgba(52,211,153,0.1); }
.wizard-step.fail { background: rgba(248,113,113,0.1); }
.wizard-step.pending { background: rgba(251, 191, 36, 0.16); }
.row-overdue td { background: rgba(251, 191, 36, 0.08); }
.plan-options { display: grid; gap: 0.65rem; }
.plan-option {
  padding: 0.75rem;
  border: 1px solid #cbd5e1;
  border-radius: var(--pm-radius-sm);
  background: #ffffff;
  color: #334155;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.plan-option:hover {
  border-color: #93c5fd;
  background: #f8fbff;
}
.plan-option input[type="radio"] {
  width: auto;
  margin-right: 0.45rem;
  accent-color: var(--pm-primary);
}
.plan-option:has(input:checked) {
  border-color: var(--pm-primary);
  background: #eff6ff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.invoice-lines { display: grid; gap: 0.75rem; }
.invoice-line-row { display: grid; grid-template-columns: 1.2fr 2fr 0.6fr 0.8fr; gap: 0.5rem; align-items: center; }
.stop-actions { white-space: nowrap; }
.admin-tenant-status-grid {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  margin-bottom: 0.9rem;
}

.admin-tenant-status-item {
  border: 1px solid var(--pm-border);
  border-radius: var(--pm-radius-sm);
  background: rgba(255, 255, 255, 0.72);
  padding: 0.6rem 0.7rem;
}

.admin-tenant-status-item strong {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--pm-text-muted);
}

.admin-tenant-status-item code {
  display: inline-block;
}

.admin-tenant-action-grid {
  gap: 0.55rem;
}

.admin-tenant-action-grid button {
  margin-top: 0;
}

.admin-company-profile-grid {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 0.9rem;
  align-items: start;
}

.admin-company-logo {
  border: 1px solid var(--pm-border);
  border-radius: var(--pm-radius-sm);
  background: #fff;
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.6rem;
}

.admin-company-logo .settings-logo-preview {
  margin: 0;
}

.admin-company-logo-placeholder {
  color: var(--pm-text-muted);
  font-size: 0.85rem;
}

.platform-owner-hero p {
  margin-bottom: 0;
  color: #334155;
}

.platform-owner-status-card h2,
.platform-owner-table-card h2 {
  margin-bottom: 0.75rem;
}

.platform-owner-status-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.55rem;
}

.platform-owner-status-list li {
  margin: 0;
  padding: 0.52rem 0.6rem;
  border: 1px solid var(--pm-border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.8);
  color: #334155;
  font-size: 0.82rem;
}

.platform-owner-table-card .table-wrap {
  border: 1px solid var(--pm-border);
  border-radius: 12px;
  background: #ffffff;
}

.platform-owner-table-card table {
  background: #ffffff;
}

.platform-owner-table-card th {
  background: #f8fafc;
}

.platform-owner-guide-list {
  margin: 0;
  padding-left: 1.1rem;
  display: grid;
  gap: 0.55rem;
}

.platform-owner-guide-list li {
  line-height: 1.5;
  color: #334155;
}

.platform-owner-guide-list li strong {
  color: #0f172a;
}

.admin-security-actions {
  margin-top: 1rem;
}

.admin-tenant-plan-form {
  margin-bottom: 0.85rem;
}

.admin-tenant-plan-form select {
  max-width: 340px;
}

.admin-tenant-setup-card {
  border-color: #d4e3f7;
}

.admin-tenant-setup-card .section-header .hint {
  font-size: 0.82rem;
}

.admin-tenant-setup-card .detail-grid {
  margin-top: 0.45rem;
}

.admin-tenant-action-grid {
  margin-top: 0.25rem;
}

.admin-tenant-action-grid button {
  min-height: 2.3rem;
}

.no-margin-top {
  margin-top: 0;
}

@media (max-width: 900px) {
  .landing-shell {
    grid-template-columns: 1fr;
  }
  .landing-signup-card {
    position: static;
    top: auto;
  }
  .app-shell { flex-direction: column; }
  .app-sidebar {
    width: 100%;
    height: auto;
    position: relative;
    flex-direction: column;
    align-items: stretch;
    padding: 0.7rem 0.6rem;
  }
  .sidebar-brand {
    padding: 0.2rem 0.35rem 0.55rem;
    margin-bottom: 0.5rem;
  }
  .sidebar-footer {
    margin-top: 0.55rem;
  }
  .sidebar-nav {
    display: none;
    width: 100%;
    overflow-x: auto;
    overflow-y: visible;
    padding: 0.05rem 0 0.3rem;
    gap: 0.55rem;
    align-items: flex-start;
    scrollbar-width: none;
  }
  .sidebar-nav::-webkit-scrollbar {
    display: none;
  }
  .app-shell.mobile-nav-open .sidebar-nav {
    display: flex;
  }
  .nav-group {
    margin: 0;
    min-width: 188px;
    position: relative;
    flex: 0 0 auto;
  }
  .nav-group-toggle {
    cursor: pointer;
    padding: 0.58rem 0.62rem;
  }
  .nav-group-links {
    position: absolute;
    top: calc(100% + 0.38rem);
    left: 0;
    min-width: 220px;
    max-width: min(84vw, 320px);
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 12px;
    background: linear-gradient(170deg, rgba(15, 23, 42, 0.98), rgba(30, 41, 59, 0.95));
    box-shadow: 0 14px 30px rgba(2, 6, 23, 0.35);
    z-index: 110;
    display: none;
  }
  .nav-group.is-open .nav-group-links {
    display: block;
  }
  .nav-group-links .nav-link:last-child {
    margin-bottom: 0;
  }
  .app-shell.is-collapsed .app-sidebar {
    width: 100%;
  }
  .app-shell.is-collapsed .nav-label,
  .app-shell.is-collapsed .nav-group-label,
  .app-shell.is-collapsed .sidebar-user-meta,
  .app-shell.is-collapsed .nav-group-chevron,
  .app-shell.is-collapsed .sidebar-company-name {
    display: initial;
  }
  .app-shell.is-collapsed .nav-link {
    justify-content: flex-start;
    padding-inline: 0.75rem;
  }
  .app-content { padding: 1.1rem; }
  .app-topbar { padding: 0 1rem; }
  .invoice-line-row { grid-template-columns: 1fr; }
  .admin-widget-wide { grid-column: span 1; }
  .route-manager-grid {
    grid-template-columns: 1fr;
  }
  .admin-company-profile-grid {
    grid-template-columns: 1fr;
  }
  .client-map-layout {
    grid-template-columns: 1fr;
  }
  .route-stop-list {
    max-height: none;
  }
  .route-manager-map {
    min-height: 320px;
  }
  .client-map-canvas {
    min-height: 420px;
  }
}

@media (min-width: 920px) {
  .work-orders-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 720px) {
  .landing-form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .work-order-form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .landing-hero {
    padding: 1.1rem;
  }
  .landing-meta-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
  }
  .landing-plan-grid {
    grid-template-columns: 1fr;
  }
  .card, .hero { padding: 1rem; margin-bottom: 0.9rem; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.7rem; }
  .kpi-card { padding: 0.9rem; }
  .kpi-card .kpi-value { font-size: 1.35rem; }
  .section-header { margin-bottom: 0.75rem; }
  .button-link, a.button-link { padding: 0.5rem 0.82rem; font-size: 0.82rem; }
  th, td { padding: 0.62rem 0.5rem; font-size: 0.79rem; }
  th { font-size: 0.65rem; }
  .card > table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .card > table thead,
  .card > table tbody,
  .card > table tr {
    white-space: nowrap;
  }
  .work-order-head {
    flex-direction: column;
    align-items: flex-start;
  }
  .work-order-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .work-order-meta {
    grid-template-columns: 1fr;
  }
  .work-order-actions select,
  .work-order-actions button {
    width: 100%;
  }
  .work-order-actions-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .work-order-actions-row form,
  .work-order-actions-row a {
    width: 100%;
  }
  .work-order-actions-row .work-order-actions {
    width: 100%;
  }
  .work-order-actions-row .work-order-actions input[type="date"] {
    width: 100%;
  }
}

@media (prefers-contrast: more) {
  :root {
    --pm-border: rgba(148, 163, 184, 0.35);
    --pm-text-muted: #cbd5e1;
  }
  .nav-link.nav-active,
  .mode-switch-link.active {
    border-width: 2px;
  }
  .kpi-card,
  .card {
    border-color: rgba(255, 255, 255, 0.28);
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
