@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* Surface Tokens */
  --surface-canvas: #F6F8F6;
  --surface-card: #FFFFFF;
  --surface-subtle: #F0F2F1;
  --surface-dark: #0F1B12;
  --surface-overlay-dark: #1A261D;

  /* Border Tokens */
  --border-light: #E2E6E3;
  --border-medium: #D0D7D1;
  --border-dark: #324A36;

  /* Typography Tokens */
  --text-primary: #17241B;
  --text-muted: #6E7771;
  --text-subtle: #909A92;
  --text-inverse: #FFFFFF;
  --text-on-dark: #B8C8B8;

  /* Brand Tokens - Palm Green */
  --accent-primary: #285227;
  --accent-dark: #1B4323;
  --accent-active: #244E24;
  --accent-muted: #386B36;
  --accent-subtle: #EAF2EA;
  --accent-subtle-border: #C0D5C0;

  /* Solid Status Tokens (Zero Opacity Wash) */
  --color-success: #2E7D32;
  --color-success-bg: #E8F5E9;
  --color-success-border: #A5D6A7;

  --color-warning: #D97706;
  --color-warning-bg: #FFF8E1;
  --color-warning-border: #FFE082;

  --color-danger: #DC2626;
  --color-danger-bg: #FFEBEE;
  --color-danger-border: #FFCDD2;

  --color-info: #1976D2;
  --color-info-bg: #E3F2FD;
  --color-info-border: #BBDEFB;

  /* Fonts */
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Layout dimensions */
  --header-height: 72px;
  --nav-tabs-height: 52px;
  --max-content-width: 1440px;
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: var(--font-sans);
  background-color: var(--surface-canvas);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

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

/* Big-Tech Custom Scrollbars */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}

::-webkit-scrollbar-track {
  background: var(--surface-subtle);
}

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

::-webkit-scrollbar-thumb:hover {
  background: var(--text-subtle);
}

/* Accessible focus ring */
:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

/* Typography Utilities */
.font-mono {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

.font-bold {
  font-weight: 700;
}

.text-primary { color: var(--accent-primary); }
.text-success { color: var(--color-success); }
.text-warning { color: var(--color-warning); }
.text-danger  { color: var(--color-danger); }
.text-muted   { color: var(--text-muted); }
.text-center  { text-align: center; }
.text-xs      { font-size: 11px; }

/* ─── LOGIN SCREEN ─── */
.login-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  background-color: #0A130C;
  overflow-y: auto;
}

.login-bg-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.35;
  filter: saturate(1.1) brightness(0.85);
  pointer-events: none;
}

.login-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(10, 19, 12, 0.45) 0%, rgba(15, 27, 18, 0.85) 100%);
  pointer-events: none;
}

.login-card {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 460px;
  background-color: var(--surface-card);
  border-radius: 20px;
  border: 1px solid var(--border-light);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
  padding: 36px 32px;
}

.login-brand-header {
  text-align: center;
  margin-bottom: 24px;
}

.login-brand-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 58px;
  height: 58px;
  background-color: var(--accent-dark);
  color: #FFFFFF;
  border-radius: 16px;
  margin-bottom: 12px;
  border: 1.5px solid rgba(255, 255, 255, 0.2);
}

.login-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.login-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

.login-role-notice {
  margin-top: 10px;
  padding: 8px 12px;
  background-color: var(--accent-subtle);
  border: 1px solid var(--accent-subtle-border);
  border-radius: 8px;
  font-size: 12px;
  color: var(--accent-dark);
  font-weight: 600;
  text-align: center;
}

.quick-accounts-section {
  margin-bottom: 20px;
}

.quick-accounts-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 8px;
  display: block;
}

.quick-chips-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quick-account-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background-color: var(--surface-subtle);
  border: 1.5px solid var(--border-light);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
  text-align: left;
}

.quick-account-chip:hover {
  border-color: var(--accent-muted);
  background-color: var(--accent-subtle);
}

.quick-account-chip.selected {
  border-color: var(--accent-primary);
  background-color: var(--accent-subtle);
}

.chip-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.chip-role {
  font-size: 11px;
  color: var(--text-muted);
}

.chip-username {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent-dark);
  font-weight: 600;
  padding: 2px 6px;
  background-color: #FFFFFF;
  border-radius: 4px;
  border: 1px solid var(--border-light);
}

.error-alert-box {
  padding: 12px 14px;
  background-color: var(--color-danger-bg);
  border: 1px solid var(--color-danger-border);
  border-radius: 8px;
  color: var(--color-danger);
  font-size: 12.5px;
  margin-bottom: 16px;
  line-height: 1.4;
}

/* Form Styles */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.form-input, .form-select {
  width: 100%;
  padding: 10px 14px;
  background-color: #FFFFFF;
  border: 1px solid var(--border-medium);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 13.5px;
  transition: border-color 0.15s ease;
}

.form-input:focus, .form-select:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(40, 82, 39, 0.15);
}

.form-input:disabled {
  background-color: var(--surface-subtle);
  color: var(--text-muted);
  cursor: not-allowed;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-range {
  width: 100%;
  accent-color: var(--accent-primary);
  margin-top: 6px;
}

.range-caption, .check-caption {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 4px;
}

.form-check-group {
  margin-bottom: 14px;
}

.check-container {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  cursor: pointer;
}

.check-container input[type="checkbox"] {
  margin-top: 3px;
  accent-color: var(--accent-primary);
  width: 16px;
  height: 16px;
}

.check-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

/* Button Styles */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  border: 1px solid transparent;
  white-space: nowrap;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.12s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0.5px);
}

.btn-primary {
  background-color: var(--accent-primary);
  color: #FFFFFF;
}

.btn-primary:hover {
  background-color: var(--accent-active);
}

.btn-outline {
  background-color: #FFFFFF;
  border-color: var(--border-medium);
  color: var(--text-primary);
}

.btn-outline:hover {
  background-color: var(--surface-subtle);
  border-color: var(--border-dark);
}

.btn-danger {
  background-color: var(--color-danger);
  color: #FFFFFF;
}

.btn-danger:hover {
  background-color: #B91C1C;
}

.btn-danger-outline {
  background-color: #FFFFFF;
  border-color: var(--color-danger-border);
  color: var(--color-danger);
}

.btn-danger-outline:hover {
  background-color: var(--color-danger-bg);
}

.btn-warning-outline {
  background-color: #FFFFFF;
  border-color: var(--color-warning-border);
  color: var(--color-warning);
}

.btn-warning-outline:hover {
  background-color: var(--color-warning-bg);
}

.btn-sm {
  padding: 5px 11px;
  font-size: 12px;
  border-radius: 6px;
  white-space: nowrap;
}

.btn-block {
  width: 100%;
}

/* ─── DASHBOARD APP SHELL ─── */
.dashboard-app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* Header */
.app-header {
  height: var(--header-height);
  background-color: var(--accent-dark);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  flex-shrink: 0;
  z-index: 100;
  position: relative;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.header-logo-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  background-color: #17381C;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
}

.header-title-block {
  white-space: nowrap;
}

.header-title-block h1 {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: #FFFFFF;
  line-height: 1.2;
}

.header-meta {
  font-size: 11.5px;
  color: var(--text-on-dark);
}

.header-middle {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.connection-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  background-color: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  color: #FFFFFF;
  white-space: nowrap;
}


.operational-clock {
  font-size: 12px;
  color: var(--text-on-dark);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.header-vertical-divider {
  width: 1px;
  height: 24px;
  background-color: rgba(255, 255, 255, 0.2);
  margin: 0 2px;
  flex-shrink: 0;
}

.user-profile-widget {
  text-align: right;
  margin-right: 2px;
  white-space: nowrap;
  flex-shrink: 0;
}

.user-profile-name {
  font-size: 12.5px;
  font-weight: 700;
  color: #FFFFFF;
  line-height: 1.2;
}

.user-profile-role {
  font-size: 10.5px;
  color: var(--text-on-dark);
}

/* Header Dropdown Menu */
.header-dropdown-container {
  position: relative;
  display: inline-block;
}

.dropdown-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  white-space: nowrap;
}

.dropdown-caret {
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.header-dropdown-container.open .dropdown-caret {
  transform: rotate(180deg);
}

.header-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 270px;
  background-color: #122416;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 10px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.65);
  padding: 6px;
  display: none;
  flex-direction: column;
  z-index: 1000;
  animation: dropdown-fade-in 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes dropdown-fade-in {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.header-dropdown-container.open .header-dropdown-menu {
  display: flex;
}

.dropdown-header-title {
  padding: 8px 12px 4px 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-on-dark);
  white-space: nowrap;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 6px;
  color: #FFFFFF;
  text-decoration: none;
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
  font-family: inherit;
  box-sizing: border-box;
}

.dropdown-item:hover, .dropdown-item:focus {
  background-color: rgba(255, 255, 255, 0.14);
  color: #FFFFFF;
  outline: none;
}

.dropdown-item-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background-color: rgba(255, 255, 255, 0.1);
  color: #E2E6E3;
  flex-shrink: 0;
}

.dropdown-item:hover .dropdown-item-icon {
  background-color: rgba(255, 255, 255, 0.2);
  color: #FFFFFF;
}

.dropdown-item-text {
  flex: 1;
  min-width: 0;
}

.dropdown-item-title {
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
}

.dropdown-item-sub {
  font-size: 10.5px;
  color: var(--text-on-dark);
  line-height: 1.2;
  white-space: nowrap;
}

.dropdown-divider {
  height: 1px;
  background-color: rgba(255, 255, 255, 0.14);
  margin: 6px 0;
}

.btn-logout {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 12px;
  white-space: nowrap;
}

@media (max-width: 1280px) {
  .header-middle {
    display: none;
  }
}

@media (max-width: 900px) {
  .user-profile-widget {
    display: none;
  }
}

/* Secondary Tab Navigation */
.app-nav-tabs {
  height: var(--nav-tabs-height);
  background-color: #FFFFFF;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 6px;
  flex-shrink: 0;
  overflow-x: auto;
}

.nav-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: transparent;
  border: none;
  border-bottom: 2.5px solid transparent;
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s ease, border-color 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.12s ease;
}

.nav-tab-btn:hover {
  color: var(--text-primary);
  transform: translateY(-1px);
}

.nav-tab-btn:active {
  transform: translateY(0);
}

.nav-tab-btn.active {
  color: var(--accent-primary);
  border-bottom-color: var(--accent-primary);
}

.nav-counter {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--accent-primary);
}

/* Main Workspace */
.dashboard-workspace {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.tab-page {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  overflow-y: auto;
}

.tab-page.active {
  display: flex;
  animation: tab-enter 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes tab-enter {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ─── TAB 1: PETA BLOK (SPATIAL MAP) ─── */
.map-view-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
}

.map-control-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  background-color: #FFFFFF;
  border-bottom: 1px solid var(--border-light);
  z-index: 5;
  flex-wrap: wrap;
  gap: 12px;
}

.map-control-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.map-control-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  margin-right: 4px;
}

.map-afdeling-chip {
  padding: 5px 12px;
  background-color: var(--surface-subtle);
  border: 1px solid var(--border-light);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.map-afdeling-chip.active {
  background-color: var(--accent-dark);
  color: #FFFFFF;
  border-color: var(--accent-dark);
}

.map-control-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.overlay-control-group {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
}

#estate-map {
  flex: 1;
  width: 100%;
  height: 100%;
  background-color: #E5EBE5;
}

/* Custom Map Markers */
.custom-mandor-icon {
  background: transparent;
  border: none;
}

.mandor-marker {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.mandor-pulse {
  position: absolute;
  top: 4px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background-color: rgba(46, 125, 50, 0.4);
  animation: pulse-ring 2s infinite ease-out;
}

.mandor-icon-box {
  position: relative;
  z-index: 2;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background-color: var(--accent-dark);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #FFFFFF;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.mandor-label {
  margin-top: 2px;
  padding: 1px 6px;
  background-color: #FFFFFF;
  border: 1px solid var(--border-medium);
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

@keyframes pulse-ring {
  0% { transform: scale(0.6); opacity: 1; }
  100% { transform: scale(1.6); opacity: 0; }
}

.custom-issue-icon {
  background: transparent;
  border: none;
}

.issue-marker {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  border: 2px solid #FFFFFF;
  box-shadow: 0 2px 6px rgba(0,0,0,0.35);
}

.issue-marker.urgent {
  background-color: var(--color-danger);
}

.issue-marker.normal {
  background-color: var(--color-warning);
}

/* Map Popup Card */
.map-popup-card {
  padding: 2px;
  font-family: var(--font-sans);
}

.popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 6px;
}

.popup-title {
  font-weight: 700;
  font-size: 13.5px;
  color: var(--text-primary);
}

.popup-badge {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
}

.badge-visited {
  background-color: var(--color-success-bg);
  color: var(--color-success);
  border: 1px solid var(--color-success-border);
}

.badge-unvisited {
  background-color: var(--surface-subtle);
  color: var(--text-muted);
  border: 1px solid var(--border-light);
}

.badge-active {
  background-color: var(--accent-subtle);
  color: var(--accent-dark);
  border: 1px solid var(--accent-subtle-border);
}

.badge-danger {
  background-color: var(--color-danger-bg);
  color: var(--color-danger);
  border: 1px solid var(--color-danger-border);
}

.badge-warning {
  background-color: var(--color-warning-bg);
  color: var(--color-warning);
  border: 1px solid var(--color-warning-border);
}

.popup-meta {
  font-size: 11.5px;
  color: var(--text-primary);
  line-height: 1.6;
}

.popup-footer {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--border-light);
}

/* ─── TAB 2: TELEMETRY FLEET ─── */
.tab-content-container {
  padding: 24px;
  max-width: var(--max-content-width);
  margin: 0 auto;
  width: 100%;
}

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

.kpi-card {
  background-color: var(--surface-card);
  border: 1px solid var(--border-light);
  border-radius: 14px;
  padding: 18px 20px;
}

.kpi-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
}

.kpi-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-primary);
  margin: 4px 0 2px 0;
  letter-spacing: -0.02em;
}

.kpi-sub {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}

.kpi-note {
  font-size: 11.5px;
  color: var(--text-subtle);
}

/* Toolbar & Segmented Controls */
.section-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 14px;
}

.segmented-control {
  display: inline-flex;
  background-color: var(--surface-subtle);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
}

.segmented-btn {
  padding: 8px 16px;
  border: none;
  background: transparent;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.segmented-btn.active {
  background-color: var(--accent-dark);
  color: #FFFFFF;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-chip {
  padding: 6px 14px;
  background-color: var(--surface-card);
  border: 1px solid var(--border-light);
  border-radius: 20px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.filter-chip.active {
  background-color: var(--accent-dark);
  color: #FFFFFF;
  border-color: var(--accent-dark);
}

.search-input {
  max-width: 260px;
  padding: 8px 12px;
  font-size: 13px;
}

/* Fleet Cards */
.fleet-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 18px;
}

.fleet-card {
  background-color: var(--surface-card);
  border: 1.2px solid var(--border-light);
  border-radius: 14px;
  padding: 20px;
  display: flex;
  flex-direction: column;
}

.fleet-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 12px;
}

.fleet-name {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-primary);
}

.fleet-sub {
  font-size: 12px;
  color: var(--text-muted);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
}

.pill-active {
  background-color: var(--color-success-bg);
  color: var(--color-success);
  border: 1px solid var(--color-success-border);
}

.pill-idle {
  background-color: var(--surface-subtle);
  color: var(--text-muted);
  border: 1px solid var(--border-light);
}

.pill-warning {
  background-color: var(--color-warning-bg);
  color: var(--color-warning);
  border: 1px solid var(--color-warning-border);
}

.pill-danger {
  background-color: var(--color-danger-bg);
  color: var(--color-danger);
  border: 1px solid var(--color-danger-border);
}

.pill-success {
  background-color: var(--color-success-bg);
  color: var(--color-success);
  border: 1px solid var(--color-success-border);
}

.pulse-indicator {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--color-success);
  margin-right: 4px;
}

.fleet-telemetry-body {
  font-size: 12.5px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
  flex: 1;
}

.telemetry-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.telemetry-label {
  color: var(--text-muted);
}

.telemetry-val {
  font-weight: 600;
  color: var(--text-primary);
}

.battery-bar {
  display: inline-block;
  width: 38px;
  height: 7px;
  background-color: var(--surface-subtle);
  border-radius: 4px;
  overflow: hidden;
  margin-right: 4px;
  vertical-align: middle;
}

.battery-fill {
  display: block;
  height: 100%;
  border-radius: 4px;
}

.fleet-card-actions {
  display: flex;
  gap: 8px;
}

.fleet-card-actions .btn {
  flex: 1;
}

/* ─── DATA TABLES ─── */
.table-card {
  background-color: var(--surface-card);
  border: 1px solid var(--border-light);
  border-radius: 14px;
  overflow: hidden;
}

.table-header-title {
  padding: 16px 20px;
  font-size: 14px;
  font-weight: 800;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-light);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
}

.data-table th {
  background-color: var(--surface-subtle);
  padding: 12px 16px;
  font-weight: 700;
  font-size: 11.5px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-light);
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}

.data-table tbody tr:hover {
  background-color: #FAFCFA;
}

.cell-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.badge-count {
  display: inline-block;
  padding: 2px 8px;
  background-color: var(--accent-subtle);
  border: 1px solid var(--accent-subtle-border);
  color: var(--accent-dark);
  font-weight: 700;
  border-radius: 12px;
  font-size: 11px;
}

.pagination-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-top: 1px solid var(--border-light);
  background-color: #FFFFFF;
}

.pagination-info {
  font-size: 12.5px;
  color: var(--text-muted);
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.page-number {
  font-size: 12.5px;
  font-weight: 600;
  padding: 0 4px;
}

/* ─── TAB 3: ISSUES & QUALITY INSPECTIONS ─── */
.sub-filter-row {
  display: flex;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.filter-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.issues-cards-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.issue-card {
  background-color: var(--surface-card);
  border: 1.2px solid var(--border-light);
  border-radius: 14px;
  padding: 20px;
}

.issue-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.issue-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.urgency-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
}

.issue-category {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-primary);
}

.issue-description {
  font-size: 13.5px;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.issue-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  background-color: var(--surface-subtle);
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 14px;
}

.asisten-note-box {
  background-color: var(--color-warning-bg);
  border: 1px solid var(--color-warning-border);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  color: #78350F;
  margin-bottom: 14px;
}

.issue-card-actions {
  display: flex;
  gap: 8px;
}

/* ─── TAB 4: PATROL PROGRESS ─── */
.progress-summary-card {
  background-color: var(--surface-card);
  border: 1.2px solid var(--border-light);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 24px;
}

.progress-header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-title {
  font-size: 17px;
  font-weight: 800;
  color: var(--text-primary);
}

.card-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

.progress-badge {
  font-size: 13px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 20px;
}

.progress-bar-wrap {
  margin-bottom: 24px;
}

.progress-bar-track {
  width: 100%;
  height: 12px;
  background-color: var(--surface-subtle);
  border-radius: 6px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background-color: var(--accent-primary);
  border-radius: 6px;
  transition: width 0.3s ease;
}

.division-progress-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  border-top: 1px solid var(--border-light);
  padding-top: 18px;
}

.division-progress-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.div-prog-header {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
}

.div-prog-bar {
  width: 100%;
  height: 6px;
  background-color: var(--surface-subtle);
  border-radius: 3px;
  overflow: hidden;
}

.div-prog-fill {
  height: 100%;
  background-color: var(--accent-muted);
  border-radius: 3px;
}

.div-prog-detail {
  font-size: 11.5px;
  color: var(--text-muted);
}

/* ─── TAB 5: QR CODE CATALOG ─── */
.catalog-info-banner {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  background-color: var(--accent-subtle);
  border: 1px solid var(--accent-subtle-border);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.banner-icon {
  width: 48px;
  height: 48px;
  background-color: #FFFFFF;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-primary);
  border: 1px solid var(--accent-subtle-border);
  flex-shrink: 0;
}

.banner-content {
  flex: 1;
  min-width: 280px;
}

.banner-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--accent-dark);
}

.banner-desc {
  font-size: 13px;
  color: var(--text-primary);
  margin: 4px 0 10px 0;
}

.banner-specs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.spec-tag {
  font-size: 11px;
  font-weight: 700;
  background-color: #FFFFFF;
  border: 1px solid var(--accent-subtle-border);
  padding: 3px 8px;
  border-radius: 6px;
  color: var(--accent-dark);
}

.banner-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

.qr-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}

.qr-card {
  background-color: #FFFFFF;
  border: 1.5px solid var(--border-light);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.qr-card-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.qr-title-box {
  display: flex;
  align-items: center;
  gap: 6px;
}

.qr-code-id {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-muted);
}

.qr-block-badge {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 6px;
  background-color: var(--surface-subtle);
  border: 1px solid var(--border-light);
  border-radius: 4px;
}

.qr-afdeling-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-primary);
}

.qr-preview-box {
  width: 150px;
  height: 150px;
  background-color: #FFFFFF;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  padding: 5px;
}

.qr-loading-placeholder {
  font-size: 11px;
  color: var(--text-muted);
}

.qr-card-info {
  margin-bottom: 14px;
}

.qr-point-name {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-primary);
}

.qr-point-coords {
  font-size: 11px;
  color: var(--text-muted);
  margin: 2px 0 4px 0;
}

.qr-point-desc {
  font-size: 11.5px;
  color: var(--text-subtle);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qr-card-actions {
  display: flex;
  gap: 6px;
  width: 100%;
  margin-top: auto;
}

.qr-card-actions .btn {
  flex: 1;
  padding: 5px 6px;
  font-size: 11px;
}

/* ─── MODAL DIALOGS ─── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 27, 18, 0.72);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 999999 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
  animation: modal-backdrop-in 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-dialog {
  background-color: var(--surface-card);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  width: 100%;
  max-width: 620px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35);
  padding: 28px 24px;
  position: relative;
  z-index: 1000000 !important;
  animation: modal-dialog-in 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modal-backdrop-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modal-dialog-in {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-dialog-large {
  max-width: 840px;
}

.modal-close-btn {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border-light);
  background-color: var(--surface-base);
  color: var(--text-muted);
  font-size: 22px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  z-index: 20;
}

.modal-close-btn:hover {
  background-color: #FEE2E2;
  color: #DC2626;
  border-color: #DC2626;
}

.modal-header {
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 12px;
  padding-right: 36px;
}

.modal-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
}

.modal-subtitle {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 3px;
}

.modal-footer-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
  border-top: 1px solid var(--border-light);
  padding-top: 16px;
  position: sticky;
  bottom: -24px;
  background-color: var(--surface-card);
  z-index: 10;
}

/* 10x10 cm Sticker Physical Layout (Singular & Print) */
.single-qr-print-wrapper {
  display: flex;
  justify-content: center;
  padding: 20px;
}

.qr-sticker-frame {
  width: 280px;
  height: 280px;
  border: 3px solid #17241B;
  background-color: #FFFFFF;
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  text-align: center;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.qr-sticker-header {
  border-bottom: 1.5px solid #17241B;
  width: 100%;
  padding-bottom: 4px;
}

.sticker-org {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #17241B;
}

.sticker-title {
  font-size: 10px;
  font-weight: 700;
  color: var(--accent-dark);
}

.qr-canvas-holder {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 6px 0;
}

.qr-sticker-footer {
  border-top: 1.5px solid #17241B;
  width: 100%;
  padding-top: 4px;
  line-height: 1.3;
}

.sticker-point {
  font-size: 12px;
  font-weight: 800;
  color: #17241B;
}

.sticker-block {
  font-size: 10px;
  color: #17241B;
}

.sticker-coords {
  font-size: 9px;
  color: var(--text-muted);
}

.sheet-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-top: 16px;
  max-height: 480px;
  overflow-y: auto;
  padding: 10px;
  background-color: var(--surface-subtle);
  border-radius: 12px;
}

.mini-frame {
  width: 180px;
  height: 200px;
  padding: 8px;
}

/* Mandor Management Styles */
.mandor-mgmt-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 12px;
}

.mandor-stat-summary {
  display: flex;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.stat-badge {
  padding: 6px 12px;
  background-color: var(--surface-subtle);
  border-radius: 8px;
  font-size: 12px;
  border: 1px solid var(--border-light);
}

.mandor-cards-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mandor-account-card {
  background-color: var(--surface-card);
  border: 1.2px solid var(--border-light);
  border-radius: 12px;
  padding: 16px;
}

.mandor-account-card.inactive-card {
  opacity: 0.75;
  background-color: var(--surface-subtle);
}

.mandor-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.mandor-name {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-primary);
  display: block;
}

.mandor-username {
  font-size: 11.5px;
  color: var(--text-muted);
}

.mandor-card-meta {
  font-size: 12px;
  color: var(--text-primary);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 4px;
  margin-bottom: 12px;
  background-color: var(--surface-subtle);
  padding: 8px 12px;
  border-radius: 8px;
}

.mandor-card-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* Settings Styles */
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 16px;
}

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

.settings-card {
  background-color: var(--surface-card);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 18px;
}

.settings-card-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--accent-dark);
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 8px;
}

/* Diagnostics Grid */
.diagnostics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  font-size: 12.5px;
  padding: 12px;
  background-color: var(--surface-subtle);
  border-radius: 10px;
}

.diag-item span {
  display: block;
  color: var(--text-muted);
  font-size: 11px;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast-item {
  padding: 12px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #FFFFFF;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
  pointer-events: auto;
  transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  animation: toast-in 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.toast-success { background-color: var(--color-success); }
.toast-warning { background-color: var(--color-warning); }
.toast-danger  { background-color: var(--color-danger); }
.toast-info    { background-color: var(--accent-dark); }

.toast-item.fade-out {
  opacity: 0;
  transform: translateY(8px);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  background-color: var(--surface-card);
  border: 1px dashed var(--border-medium);
  border-radius: 14px;
}

.empty-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.empty-desc {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ─── PRINT MEDIA QUERY ─── */
@media print {
  body {
    background-color: #FFFFFF !important;
  }
  .app-header, .app-nav-tabs, .map-control-bar, .modal-footer-actions, .toast-container {
    display: none !important;
  }
  .modal-backdrop {
    position: static !important;
    background: transparent !important;
    padding: 0 !important;
  }
  .modal-dialog {
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
    max-width: 100% !important;
  }
  .single-qr-print-wrapper {
    padding: 0 !important;
  }
  .qr-sticker-frame {
    box-shadow: none !important;
    page-break-inside: avoid;
  }
  .sheet-preview-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10mm !important;
    background: transparent !important;
    overflow: visible !important;
    max-height: none !important;
  }
}
