:root {
  --font-serif: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-sans: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;

  --bg-body: #f6f4ef;
  --bg-surface: #ffffff;
  --bg-subtle: #efece5;
  --bg-hover: #f3f0e8;
  --bg-sidebar: #0f2922;
  --bg-sidebar-hover: rgba(255, 255, 255, 0.06);
  --bg-sidebar-active: rgba(184, 149, 82, 0.16);
  --sidebar-text: #cedad5;
  --sidebar-active-text: #e8cc8c;
  --sidebar-border: rgba(255, 255, 255, 0.09);

  --border-color: #e4dfd4;
  --border-strong: #cfc8b8;

  --text-primary: #16211e;
  --text-secondary: #43524d;
  --text-muted: #6e7b76;

  --brand-primary: #0f2922;
  --brand-primary-hover: #183d33;
  --brand-primary-text: #faf8f3;
  --brand-gold: #b89552;
  --brand-gold-soft: rgba(184, 149, 82, 0.14);

  --status-success: #1e6b52;
  --status-success-bg: rgba(30, 107, 82, 0.11);
  --status-warn: #9a6714;
  --status-warn-bg: rgba(184, 149, 82, 0.16);
  --status-danger: #9f3535;
  --status-danger-bg: rgba(159, 53, 53, 0.11);
  --status-info: #28516b;
  --status-info-bg: rgba(40, 81, 107, 0.11);

  --login-bg: #ece8df;
  --login-panel-left: #0f2922;
  --login-card: #ffffff;

  --shadow-card: 0 1px 2px rgba(22, 33, 30, 0.04), 0 6px 20px rgba(22, 33, 30, 0.035);
  --shadow-elevated: 0 24px 64px rgba(15, 41, 34, 0.16);
}

html.dark {

  --bg-body: #111514;
  --bg-surface: #181e1c;
  --bg-subtle: #202825;
  --bg-hover: #242e2a;
  --bg-sidebar: #0a0f0e;
  --bg-sidebar-hover: rgba(255, 255, 255, 0.05);
  --bg-sidebar-active: rgba(200, 162, 88, 0.15);
  --sidebar-text: #a5b0ac;
  --sidebar-active-text: #e3c47d;
  --sidebar-border: rgba(255, 255, 255, 0.07);

  --border-color: #27312d;
  --border-strong: #37453f;

  --text-primary: #f2efe9;
  --text-secondary: #c4c1b8;
  --text-muted: #8b9490;

  --brand-primary: #c8a258;
  --brand-primary-hover: #d8b56c;
  --brand-primary-text: #111815;
  --brand-gold: #d5b268;
  --brand-gold-soft: rgba(200, 162, 88, 0.15);

  --status-success: #52a680;
  --status-success-bg: rgba(82, 166, 128, 0.14);
  --status-warn: #d8b262;
  --status-warn-bg: rgba(216, 178, 98, 0.15);
  --status-danger: #d46666;
  --status-danger-bg: rgba(212, 102, 102, 0.14);
  --status-info: #78a5c4;
  --status-info-bg: rgba(120, 165, 196, 0.14);

  --login-bg: #0c100f;
  --login-panel-left: #121a18;
  --login-card: #181e1c;

  --shadow-card: 0 2px 10px rgba(0, 0, 0, 0.28);
  --shadow-elevated: 0 28px 70px rgba(0, 0, 0, 0.65);
}

* {
  box-sizing: border-box;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-body);
  color: var(--text-primary);
  margin: 0;
  -webkit-font-smoothing: antialiased;
}

.font-editorial {
  font-family: var(--font-serif);
  letter-spacing: -0.015em;
}

.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: rgba(110, 123, 118, 0.32); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--brand-gold); }

.fs-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  box-shadow: var(--shadow-card);
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.fs-card-hover:hover {
  border-color: var(--brand-gold);
  transform: translateY(-1px);
}

.fs-subtle {
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-color);
}

.btn-swiss-primary {
  background-color: var(--brand-primary);
  color: var(--brand-primary-text);
  border: 1px solid transparent;
  border-radius: 10px;
  font-weight: 700;
  transition: all 0.16s ease;
  cursor: pointer;
}
.btn-swiss-primary:hover {
  background-color: var(--brand-primary-hover);
}

.btn-swiss-outline {
  background-color: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  font-weight: 600;
  transition: all 0.16s ease;
  cursor: pointer;
}
.btn-swiss-outline:hover {
  border-color: var(--brand-gold);
  background-color: var(--bg-hover);
}

.btn-swiss-gold {
  background-color: var(--brand-gold-soft);
  color: var(--brand-gold);
  border: 1px solid rgba(184, 149, 82, 0.35);
  border-radius: 10px;
  font-weight: 700;
  transition: all 0.16s ease;
  cursor: pointer;
}
.btn-swiss-gold:hover {
  background-color: rgba(184, 149, 82, 0.24);
}

:where(.fs-input) {
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  border-radius: 10px;
  padding: 0.55rem 0.85rem;
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.fs-input:focus {
  border-color: var(--brand-gold);
  box-shadow: 0 0 0 3px rgba(184, 149, 82, 0.18);
}

.fs-sidebar {
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--sidebar-border);
}

.fs-nav-item {
  display: flex;
  align-items: center;
  gap: 0.72rem;
  padding: 0.6rem 0.88rem;
  border-radius: 9px;
  color: var(--sidebar-text);
  font-size: 0.825rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  border-left: 3px solid transparent;
  user-select: none;
}
.fs-nav-item:hover {
  background: var(--bg-sidebar-hover);
  color: #ffffff;
}
.fs-nav-item.active {
  background: var(--bg-sidebar-active);
  color: var(--sidebar-active-text);
  font-weight: 700;
  border-left-color: var(--brand-gold);
}

.swiss-login-bg {
  background-color: var(--login-bg);
  background-image:
    linear-gradient(rgba(184, 149, 82, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(184, 149, 82, 0.055) 1px, transparent 1px);
  background-size: 40px 40px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.22rem 0.62rem;
  border-radius: 9999px;
  font-size: 0.69rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.badge-emerald { background: var(--status-success-bg); color: var(--status-success); border: 1px solid rgba(30, 107, 82, 0.25); }
.badge-cyan { background: var(--status-info-bg); color: var(--status-info); border: 1px solid rgba(40, 81, 107, 0.25); }
.badge-amber { background: var(--status-warn-bg); color: var(--status-warn); border: 1px solid rgba(184, 149, 82, 0.32); }
.badge-rose { background: var(--status-danger-bg); color: var(--status-danger); border: 1px solid rgba(159, 53, 53, 0.26); }
.badge-indigo { background: var(--status-info-bg); color: var(--status-info); border: 1px solid rgba(40, 81, 107, 0.25); }
.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); border: 1px solid rgba(184, 149, 82, 0.35); }

.fs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.83rem;
}
.fs-table thead th {
  background-color: var(--bg-subtle);
  color: var(--text-muted);
  font-size: 0.69rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.78rem 1rem;
  border-bottom: 1px solid var(--border-color);
  text-align: left;
  white-space: nowrap;
}
.fs-table tbody td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}
.fs-table tbody tr:hover td {
  background-color: var(--bg-hover);
}

#security-watermark {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 55;
  overflow: hidden;
  opacity: 0.11;
  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.14;
}
#security-watermark.hidden {
  display: none !important;
}
.watermark-tile {
  transform: rotate(-26deg);
  font-family: var(--font-mono);
  font-size: 12px;
  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(15, 25, 22, 0.52);
  backdrop-filter: blur(3px);
  z-index: 60;
  display: none;
}
.fs-drawer-backdrop.open { display: block; }
.fs-drawer {
  position: fixed;
  top: 0; right: 0;
  height: 100vh; width: 100%; max-width: 580px;
  background-color: var(--bg-surface);
  border-left: 1px solid var(--border-color);
  box-shadow: var(--shadow-elevated);
  z-index: 65;
  transform: translateX(100%);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
}
.fs-drawer.open { transform: translateX(0); }

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--status-success);
  display: inline-block;
}

.leaflet-container {
  font-family: var(--font-sans) !important;
  border-radius: 12px;
  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: #16211e;
  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(30px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
.fs-toast {
  animation: slideInRight 0.22s ease forwards;
}

@media print {
  aside, header, #security-watermark, .no-print { display: none !important; }
  main { padding: 0 !important; }
}
