:root {
  --font-serif: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-sans: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --bg-rail: #071A15;
  --bg-rail-card: #0E2921;
  --bg-rail-hover: rgba(255, 255, 255, 0.06);
  --sidebar-border: rgba(213, 178, 104, 0.14);
  --sidebar-text: #9EB5AD;
  --sidebar-active-text: #FFFFFF;

  --bg-shell: #071A15;
  --bg-body: #F3F6F5;
  --bg-surface: #FFFFFF;
  --bg-subtle: #F5F8F7;
  --bg-hover: #EBF1EE;

  --border-color: #DCE4E1;
  --border-strong: #C2D0CB;

  --text-primary: #0B1B17;
  --text-secondary: #374B45;
  --text-muted: #5F736D;

  --brand-primary: #0F513E;
  --brand-primary-hover: #0B3E2F;
  --brand-primary-text: #FFFFFF;
  --brand-primary-soft: rgba(15, 81, 62, 0.09);
  --brand-ring: rgba(15, 118, 110, 0.22);
  --brand-gold: #B08A42;
  --brand-gold-soft: rgba(184, 149, 82, 0.14);
  --accent-gold-soft: rgba(184, 149, 82, 0.14);

  --status-success: #0F766E;
  --status-success-bg: rgba(15, 118, 110, 0.10);
  --status-warn: #B45309;
  --status-warn-bg: rgba(180, 83, 9, 0.11);
  --status-danger: #BE123C;
  --status-danger-bg: rgba(190, 18, 60, 0.10);
  --status-info: #1D4ED8;
  --status-info-bg: rgba(29, 78, 216, 0.10);

  --glider-bg: #FFFFFF;
  --glider-shadow: 0 1px 3px rgba(7, 26, 21, 0.12), 0 1px 2px rgba(7, 26, 21, 0.06);
  --shadow-card: 0 1px 2px rgba(7, 26, 21, 0.05);
  --shadow-shell: 0 18px 44px -16px rgba(0, 0, 0, 0.38);
  --shadow-elevated: 0 28px 64px -16px rgba(7, 26, 21, 0.30), 0 0 0 1px rgba(7, 26, 21, 0.06);
}

html.dark {
  --bg-rail: #060D0B;
  --bg-rail-card: #0D1915;
  --bg-rail-hover: rgba(255, 255, 255, 0.05);
  --sidebar-border: rgba(213, 178, 104, 0.12);
  --sidebar-text: #8DA39B;
  --sidebar-active-text: #F8FAFC;

  --bg-shell: #060D0B;
  --bg-body: #0C1311;
  --bg-surface: #121B18;
  --bg-subtle: #16221E;
  --bg-hover: #1B2924;

  --border-color: #22322D;
  --border-strong: #31463F;

  --text-primary: #F0F5F3;
  --text-secondary: #B7C7C1;
  --text-muted: #7F948C;

  --brand-primary: #10B981;
  --brand-primary-hover: #34D399;
  --brand-primary-text: #041510;
  --brand-primary-soft: rgba(16, 185, 129, 0.15);
  --brand-ring: rgba(16, 185, 129, 0.28);
  --brand-gold: #DFBE74;
  --brand-gold-soft: rgba(223, 190, 116, 0.15);
  --accent-gold-soft: rgba(223, 190, 116, 0.15);

  --status-success: #34D399;
  --status-success-bg: rgba(52, 211, 153, 0.13);
  --status-warn: #FBBF24;
  --status-warn-bg: rgba(251, 191, 36, 0.13);
  --status-danger: #FB7185;
  --status-danger-bg: rgba(251, 113, 133, 0.14);
  --status-info: #60A5FA;
  --status-info-bg: rgba(96, 165, 250, 0.14);

  --glider-bg: #1B2A25;
  --glider-shadow: 0 2px 6px rgba(0, 0, 0, 0.48), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.42);
  --shadow-shell: 0 20px 50px -16px rgba(0, 0, 0, 0.75);
  --shadow-elevated: 0 32px 72px -16px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(255, 255, 255, 0.07);
}

* { box-sizing: border-box; }

body {
  font-family: var(--font-sans);
  background-color: var(--bg-shell);
  color: var(--text-primary);
  margin: 0;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .font-display {
  font-family: var(--font-sans);
  letter-spacing: -0.022em;
}

.font-editorial {
  font-family: var(--font-sans);
  letter-spacing: -0.022em;
}

.font-serif-brand {
  font-family: var(--font-serif);
  letter-spacing: -0.01em;
}

.font-mono, .font-mono-num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--brand-gold); }

.fs-shell-frame {
  background: var(--bg-body);
  border: 1px solid var(--sidebar-border);
  box-shadow: var(--shadow-shell);
}

.fs-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: var(--shadow-card);
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.fs-card-hover:hover {
  border-color: var(--border-strong);
  box-shadow: 0 8px 20px -10px rgba(7, 26, 21, 0.15);
}

.fs-card-hero {
  background: linear-gradient(135deg, #071A15 0%, #0D3026 58%, #134033 100%);
  color: #F4F8F6;
  border: 1px solid rgba(213, 178, 104, 0.26);
  border-radius: 14px;
  box-shadow: 0 12px 28px -12px rgba(7, 26, 21, 0.52);
}

.fs-subtle {
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: 10px;
}

.fs-topbar {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
}

.fs-sidebar {
  background-color: var(--bg-rail);
  color: #F4F8F6;
  transition: width 0.24s cubic-bezier(0.22, 1, 0.36, 1), transform 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}
.fs-sidebar.collapsed { width: 70px; }
.fs-sidebar.collapsed .fs-hide-collapsed { display: none; }
.fs-sidebar.collapsed .fs-nav-item { justify-content: center; padding-left: 0; padding-right: 0; }
.fs-sidebar.collapsed .fs-partner-btn { justify-content: center; padding: 8px; }

.fs-rail-card {
  background: var(--bg-rail-card);
  border: 1px solid var(--sidebar-border);
  border-radius: 10px;
  color: #F4F8F6;
  transition: border-color 0.16s ease;
}
.fs-rail-card:hover { border-color: rgba(213, 178, 104, 0.45); }

.fs-nav-wrap { position: relative; }

.fs-nav-glider {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.22) 0%, rgba(184, 149, 82, 0.12) 100%);
  border: 1px solid rgba(213, 178, 104, 0.34);
  box-shadow: 0 4px 12px -4px rgba(0, 0, 0, 0.42);
  pointer-events: none;
  z-index: 0;
  opacity: 0;
  transition: transform 0.26s cubic-bezier(0.22, 1, 0.36, 1), height 0.22s ease, opacity 0.18s ease;
}
.fs-nav-glider::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  border-radius: 0 4px 4px 0;
  background: #DFBE74;
}

.fs-nav-item {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 34px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 11px;
  border-radius: 9px;
  color: var(--sidebar-text);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.16s ease, background 0.16s ease;
  user-select: none;
}
.fs-nav-item:hover:not(.active) {
  background: var(--bg-rail-hover);
  color: #ECF3F0;
}
.fs-nav-item.active {
  color: var(--sidebar-active-text);
  font-weight: 600;
}
.fs-nav-item.active svg { color: #DFBE74; }

.fs-rail-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(158, 181, 173, 0.15);
  color: #CBD9D4;
}
.fs-nav-item.active .fs-rail-badge {
  background: rgba(223, 190, 116, 0.24);
  color: #F3DFB1;
}

.fs-seg-track {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 3px;
  border-radius: 9px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
}
.fs-seg-track.grid {
  display: grid;
}
.fs-seg-glider {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 0;
  border-radius: 7px;
  background: var(--glider-bg);
  border: 1px solid var(--border-color);
  box-shadow: var(--glider-shadow);
  pointer-events: none;
  z-index: 0;
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1), width 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}
.fs-seg-btn {
  position: relative;
  z-index: 1;
  padding: 5px 11px;
  border-radius: 7px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.18s ease;
}
.fs-seg-btn:hover { color: var(--text-primary); }
.fs-seg-btn.active { color: var(--text-primary); font-weight: 700; }

.btn-swiss-primary {
  background: linear-gradient(180deg, #115E49 0%, #0B4334 100%);
  color: #FFFFFF;
  border: 1px solid rgba(11, 67, 52, 0.9);
  box-shadow: 0 1px 2px rgba(7, 26, 21, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  font-weight: 600;
  transition: filter 0.14s ease, transform 0.08s ease;
  cursor: pointer;
}
.btn-swiss-primary:hover { filter: brightness(1.08); }
html.dark .btn-swiss-primary {
  background: linear-gradient(180deg, #10B981 0%, #059669 100%);
  color: #03150F;
  border-color: rgba(16, 185, 129, 0.7);
}

.btn-swiss-outline {
  background-color: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-weight: 500;
  transition: background 0.14s ease, border-color 0.14s ease;
  cursor: pointer;
}
.btn-swiss-outline:hover {
  border-color: var(--border-strong);
  background-color: var(--bg-subtle);
}

.btn-swiss-gold {
  background-color: var(--brand-gold-soft);
  color: var(--brand-gold);
  border: 1px solid rgba(184, 149, 82, 0.36);
  border-radius: 8px;
  font-weight: 700;
  transition: all 0.14s ease;
  cursor: pointer;
}
.btn-swiss-gold:hover { background-color: rgba(184, 149, 82, 0.24); }

:where(.fs-input) {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: 8px;
  padding: 0.48rem 0.75rem;
  font-size: 0.8rem;
  outline: none;
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}
.fs-input:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px var(--brand-ring);
}

.fs-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 34px;
  height: 19px;
  border-radius: 999px;
  background: var(--border-strong);
  cursor: pointer;
  flex-shrink: 0;
}
.fs-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.fs-switch-track { position: absolute; inset: 0; border-radius: 999px; transition: background 0.2s ease; }
.fs-switch-knob {
  position: absolute; left: 2px; top: 2px; width: 15px; height: 15px;
  border-radius: 999px; background: #FFFFFF;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.28);
  transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}
.fs-switch input:checked ~ .fs-switch-track { background: var(--brand-primary); }
.fs-switch input:checked ~ .fs-switch-knob { transform: translateX(15px); }

.swiss-login-bg {
  background-color: #F3F6F5;
  background-image:
    radial-gradient(ellipse 75% 48% at 50% -10%, rgba(15, 81, 62, 0.13), transparent 65%),
    radial-gradient(rgba(7, 26, 21, 0.09) 1px, transparent 1px);
  background-size: 100% 100%, 24px 24px;
}
html.dark .swiss-login-bg {
  background-color: #080E0C;
  background-image:
    radial-gradient(ellipse 75% 48% at 50% -10%, rgba(16, 185, 129, 0.16), transparent 65%),
    radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1.45;
  white-space: nowrap;
}
.badge-emerald { background: var(--status-success-bg); color: var(--status-success); }
.badge-cyan { background: var(--status-info-bg); color: var(--status-info); }
.badge-amber { background: var(--status-warn-bg); color: var(--status-warn); }
.badge-rose { background: var(--status-danger-bg); color: var(--status-danger); }
.badge-indigo { background: var(--status-info-bg); color: var(--status-info); }
.badge-slate { background: var(--bg-subtle); color: var(--text-secondary); border: 1px solid var(--border-color); }
.badge-gold { background: var(--brand-gold-soft); color: var(--brand-gold); }

.fs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.fs-table thead th {
  background-color: var(--bg-subtle);
  color: var(--text-muted);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border-color);
  text-align: left;
  white-space: nowrap;
}
.fs-table tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}
.fs-table tbody tr:last-child td { border-bottom: none; }
.fs-table tbody tr { transition: background 0.12s ease; }
.fs-table tbody tr:hover td { background-color: var(--bg-hover); }
.fs-row-selected td { background-color: var(--brand-primary-soft) !important; }

.fs-kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
}

.fs-heat-cell {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 3px;
  transition: transform 0.12s ease;
}
.fs-heat-cell:hover { transform: scale(1.25); }

#security-watermark {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 55;
  overflow: hidden;
  opacity: 0.08;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(5, 1fr);
  align-items: center;
  justify-items: center;
}
html.dark #security-watermark { opacity: 0.11; }
#security-watermark.hidden { display: none !important; }
.watermark-tile {
  transform: rotate(-26deg);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--brand-primary);
  border: 1px dashed var(--brand-gold);
  padding: 3px 10px;
  border-radius: 4px;
  white-space: nowrap;
  user-select: none;
}
html.dark .watermark-tile { color: var(--brand-gold); }

.fs-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(7, 18, 15, 0.5);
  backdrop-filter: blur(3px);
  z-index: 80;
  display: none;
}
.fs-drawer-backdrop.open { display: block; }
.fs-drawer {
  position: fixed;
  top: 10px; right: 10px; bottom: 10px;
  width: calc(100% - 20px); max-width: 560px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  box-shadow: var(--shadow-elevated);
  z-index: 85;
  transform: translateX(calc(100% + 24px));
  transition: transform 0.26s cubic-bezier(0.22, 1, 0.36, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.fs-drawer.open { transform: translateX(0); }

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #34D399;
  display: inline-block;
  animation: fsPulse 2.2s ease-in-out infinite;
}
@keyframes fsPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

.leaflet-container {
  font-family: var(--font-sans) !important;
  border-radius: 10px;
  z-index: 10;
}
html.dark .leaflet-tile-pane {
  filter: brightness(0.78) invert(1) contrast(1.05) grayscale(0.35);
}

.thermal-paper {
  background: #fffdf8;
  color: #0b1b17;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.48;
  padding: 18px 16px;
  border-radius: 6px;
  border: 1px dashed #a8a29e;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.15);
  max-width: 315px;
  margin: 0 auto;
}

@keyframes slideInRight {
  from { transform: translateX(24px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
.fs-toast { animation: slideInRight 0.2s ease forwards; }

@media print {
  aside, header, #security-watermark, .no-print { display: none !important; }
  main { padding: 0 !important; }
}
