@font-face {
  font-family: "IBM Plex Sans";
  src: url("/fonts/ibm-plex-sans/IBMPlexSans-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Sans";
  src: url("/fonts/ibm-plex-sans/IBMPlexSans-Medium.ttf") format("truetype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Sans";
  src: url("/fonts/ibm-plex-sans/IBMPlexSans-SemiBold.ttf") format("truetype");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Sans";
  src: url("/fonts/ibm-plex-sans/IBMPlexSans-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Sans Condensed";
  src: url("/fonts/ibm-plex-sans/IBMPlexSansCondensed-Medium.ttf") format("truetype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Sans Condensed";
  src: url("/fonts/ibm-plex-sans/IBMPlexSansCondensed-SemiBold.ttf") format("truetype");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Source Sans 3";
  src: url("/fonts/source-sans-3/SourceSans3-Variable.ttf") format("truetype");
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Barlow";
  src: url("/fonts/barlow/Barlow-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Barlow";
  src: url("/fonts/barlow/Barlow-SemiBold.ttf") format("truetype");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Barlow Condensed";
  src: url("/fonts/barlow-condensed/BarlowCondensed-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Barlow Condensed";
  src: url("/fonts/barlow-condensed/BarlowCondensed-SemiBold.ttf") format("truetype");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Manrope";
  src: url("/fonts/manrope/Manrope-Variable.ttf") format("truetype");
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("/fonts/jetbrains-mono/JetBrainsMono-Variable.ttf") format("truetype");
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --font-sans: "IBM Plex Sans", "Barlow", "Source Sans 3", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --font-condensed: "IBM Plex Sans Condensed", "Barlow Condensed", "Barlow", sans-serif;

  --text-xs: 0.6875rem;
  --text-sm: 0.75rem;
  --text-base: 0.875rem;
  --text-md: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.375rem;
  --text-2xl: 1.75rem;
  --text-3xl: 2.25rem;

  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;

  --cg-font-sans: var(--font-sans);
  --cg-font-heading: var(--font-sans);
  --cg-font-label: var(--font-condensed);
  --cg-font-mono: var(--font-mono);
  --cg-font-xs: var(--text-xs);
  --cg-font-sm: var(--text-sm);
  --cg-font-base: var(--text-base);
  --cg-font-md: var(--text-md);
  --cg-font-lg: var(--text-lg);
  --cg-font-xl: var(--text-xl);
  --cg-radius-card: var(--radius-lg);
  --cg-radius-button: var(--radius-md);
  --cg-radius-input: var(--radius-md);
  --cg-radius-modal: var(--radius-xl);
  --cg-space-1: var(--space-1);
  --cg-space-2: var(--space-2);
  --cg-space-3: var(--space-3);
  --cg-space-4: var(--space-4);
  --cg-space-5: var(--space-5);
  --cg-space-6: var(--space-6);
  --cg-space-7: var(--space-8);
  --cg-label-tracking: 0.1em;
}

html,
html[data-theme="dark"] {
  --bg-base: #0d1117;
  --bg-surface: #161b22;
  --bg-elevated: #1c2333;
  --bg-overlay: #21283b;

  --border-default: #30363d;
  --border-muted: #21262d;
  --border-emphasis: #444c56;

  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --text-muted: #484f58;
  --text-on-accent: #ffffff;

  --accent-primary: #5a7d45;
  --accent-primary-hover: #6b9254;
  --accent-primary-muted: rgba(90, 125, 69, 0.15);
  --accent-primary-border: rgba(90, 125, 69, 0.4);

  --status-live: #5a7d45;
  --status-danger: #da3633;
  --status-warning: #d29922;
  --status-info: #388bfd;
  --status-inactive: #484f58;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);

  --sidebar-bg: #0d1117;
  --sidebar-active-bg: rgba(90, 125, 69, 0.15);
  --sidebar-active-text: #6b9254;
  --sidebar-text: #8b949e;
  --sidebar-hover-bg: #161b22;

  --cg-primary: var(--accent-primary);
  --cg-primary-strong: var(--accent-primary-hover);
  --cg-primary-light: var(--accent-primary-muted);
  --cg-surface: var(--bg-surface);
  --cg-surface-soft: var(--bg-base);
  --cg-surface-muted: var(--bg-elevated);
  --cg-border: var(--border-default);
  --cg-border-strong: var(--border-emphasis);
  --cg-text-primary: var(--text-primary);
  --cg-text-secondary: var(--text-secondary);
  --cg-text-muted: var(--text-muted);
  --cg-danger: var(--status-danger);
  --cg-danger-soft: rgba(218, 54, 51, 0.15);
  --cg-warning: var(--status-warning);
  --cg-warning-soft: rgba(210, 153, 34, 0.15);
  --cg-info: var(--status-info);
  --cg-info-soft: rgba(56, 139, 253, 0.15);
  --cg-success: var(--accent-primary);
  --cg-success-soft: var(--accent-primary-muted);
  --cg-stale: var(--status-inactive);
  --cg-stale-soft: rgba(72, 79, 88, 0.15);
  --cg-shadow-1: var(--shadow-sm);
  --cg-shadow-2: var(--shadow-md);
  --cg-shadow-3: var(--shadow-lg);
}

html[data-theme="light"] {
  --bg-base: #f0f2f5;
  --bg-surface: #ffffff;
  --bg-elevated: #f6f8fa;
  --bg-overlay: #ffffff;

  --border-default: #d0d7de;
  --border-muted: #e1e4e8;
  --border-emphasis: #8b949e;

  --text-primary: #1f2328;
  --text-secondary: #57606a;
  --text-muted: #8b949e;
  --text-on-accent: #ffffff;

  --accent-primary: #4a6638;
  --accent-primary-hover: #3d5530;
  --accent-primary-muted: rgba(74, 102, 56, 0.1);
  --accent-primary-border: rgba(74, 102, 56, 0.3);

  --status-live: #4a6638;
  --status-danger: #cf222e;
  --status-warning: #bf8700;
  --status-info: #0969da;
  --status-inactive: #8b949e;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);

  --sidebar-bg: #24292f;
  --sidebar-active-bg: rgba(90, 125, 69, 0.2);
  --sidebar-active-text: #7eaa63;
  --sidebar-text: #8b949e;
  --sidebar-hover-bg: #32383f;

  --cg-primary: var(--accent-primary);
  --cg-primary-strong: var(--accent-primary-hover);
  --cg-primary-light: var(--accent-primary-muted);
  --cg-surface: var(--bg-surface);
  --cg-surface-soft: var(--bg-base);
  --cg-surface-muted: var(--bg-elevated);
  --cg-border: var(--border-default);
  --cg-border-strong: var(--border-emphasis);
  --cg-text-primary: var(--text-primary);
  --cg-text-secondary: var(--text-secondary);
  --cg-text-muted: var(--text-muted);
  --cg-danger: var(--status-danger);
  --cg-danger-soft: rgba(207, 34, 46, 0.1);
  --cg-warning: var(--status-warning);
  --cg-warning-soft: rgba(191, 135, 0, 0.14);
  --cg-info: var(--status-info);
  --cg-info-soft: rgba(9, 105, 218, 0.12);
  --cg-success: var(--accent-primary);
  --cg-success-soft: var(--accent-primary-muted);
  --cg-stale: var(--status-inactive);
  --cg-stale-soft: rgba(139, 148, 158, 0.14);
  --cg-shadow-1: var(--shadow-sm);
  --cg-shadow-2: var(--shadow-md);
  --cg-shadow-3: var(--shadow-lg);
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  background: var(--bg-base);
  color: var(--text-primary);
}

html[data-theme="dark"] {
  color-scheme: dark;
}

html[data-theme="light"] {
  color-scheme: light;
}

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

body {
  margin: 0;
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.45;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0;
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.15;
}

h1 {
  font-size: var(--text-xl);
  font-weight: 700;
}

h2 {
  font-size: var(--text-md);
  font-weight: 600;
}

h3 {
  font-size: var(--text-base);
  font-weight: 600;
}

p {
  margin: 0;
}

a {
  color: var(--accent-primary);
  text-decoration: none;
}

a:hover {
  color: var(--accent-primary-hover);
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
.btn,
.btn-primary,
.btn-outline,
.btn-ghost,
.btn-danger,
.primary,
.secondary,
.ghost,
.danger,
.eventsActionButton,
.btn-invite,
.btn-invite-primary,
.btn-invite-secondary,
.mapModeBtn,
.chatTab,
.mapFilterOnlyBtn,
.mapChatMinimizeBtn,
.mapZoomBtn,
.chatSendBtn,
.btn-logout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  height: 38px;
  width: auto;
  padding: 10px 20px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: all 120ms ease;
}

button:disabled,
.btn:disabled,
.btn-primary:disabled,
.btn-outline:disabled,
.btn-ghost:disabled,
.btn-danger:disabled,
.primary:disabled,
.secondary:disabled,
.ghost:disabled,
.danger:disabled,
.eventsActionButton:disabled,
.btn-invite:disabled,
.chatTab:disabled,
.mapModeBtn:disabled,
.mapFilterOnlyBtn:disabled,
.btn-logout:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-primary,
.primary,
button.primary,
.eventsActionButton,
.btn.btn-primary,
.btn-invite-primary {
  background: var(--accent-primary);
  color: var(--text-on-accent);
  border-color: var(--accent-primary);
}

.btn-primary:hover,
.primary:hover,
button.primary:hover,
.eventsActionButton:hover,
.btn.btn-primary:hover,
.btn-invite-primary:hover {
  background: var(--accent-primary-hover);
  border-color: var(--accent-primary-hover);
  color: var(--text-on-accent);
}

.btn-outline,
.secondary,
button.secondary,
.btn.btn-secondary,
.btn-invite,
.btn-invite-secondary,
.eventsOpenBtn,
.mapFilterOnlyBtn,
.mapModeBtn,
.chatTab {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border-default);
  font-weight: 500;
}

.btn-outline:hover,
.secondary:hover,
button.secondary:hover,
.btn.btn-secondary:hover,
.btn-invite:hover,
.btn-invite-secondary:hover,
.eventsOpenBtn:hover,
.mapFilterOnlyBtn:hover,
.mapModeBtn:hover,
.chatTab:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--border-emphasis);
}

.btn-ghost,
.ghost,
button.ghost,
.mapChatMinimizeBtn {
  background: transparent;
  color: var(--text-muted);
  border-color: transparent;
  font-weight: 500;
}

.btn-ghost:hover,
.ghost:hover,
button.ghost:hover,
.mapChatMinimizeBtn:hover {
  background: transparent;
  color: var(--text-primary);
  border-color: transparent;
}

.btn-danger,
.danger,
button.danger {
  background: transparent;
  color: var(--status-danger);
  border-color: transparent;
  font-weight: 500;
}

.btn-danger:hover,
.danger:hover,
button.danger:hover {
  background: rgba(218, 54, 51, 0.1);
  border-color: rgba(218, 54, 51, 0.3);
  color: var(--status-danger);
}

html[data-theme="light"] .btn-danger:hover,
html[data-theme="light"] .danger:hover,
html[data-theme="light"] button.danger:hover {
  background: rgba(207, 34, 46, 0.1);
  border-color: rgba(207, 34, 46, 0.28);
}

.btn-icon-round,
.chatSendBtn {
  width: 40px;
  min-width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 999px;
}

.chatSendBtn {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: var(--text-on-accent);
}

.chatSendBtn:hover {
  background: var(--accent-primary-hover);
  border-color: var(--accent-primary-hover);
}

.add-btn {
  min-height: 0;
  height: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--accent-primary);
  justify-content: flex-start;
  font-size: var(--text-base);
  font-weight: 600;
}

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

.add-btn.main,
.add-btn.in-platoon {
  width: 100%;
}

.btn-delete,
.btnKick,
.cg-icon-button {
  width: 34px;
  min-width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
}

.btn-delete:hover,
.btnKick:hover,
.cg-icon-button:hover {
  background: rgba(218, 54, 51, 0.1);
  border-color: rgba(218, 54, 51, 0.3);
  color: var(--status-danger);
}

input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="range"]),
select,
textarea,
.field input,
.chatComposer input,
#mapSearch {
  width: 100%;
  min-height: 40px;
  padding: 10px 12px;
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  outline: 0;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  transition: border-color 120ms ease, box-shadow 120ms ease, background-color 120ms ease;
}

select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238b949e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: calc(100% - 12px) center;
  background-size: 14px 14px;
}

textarea {
  min-height: 80px;
  resize: vertical;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="range"]):focus,
select:focus,
textarea:focus,
.field input:focus,
.chatComposer input:focus,
#mapSearch:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-primary-muted);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
}

label,
.field label,
.row > label {
  display: block;
  margin-bottom: 6px;
  color: var(--text-secondary);
  font-family: var(--font-condensed);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.readonlyField {
  min-height: 40px;
  padding: 10px 12px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.card,
.panel,
.eventBriefingCard,
.eventsActionCard,
.mapOverlayCard,
.teamCard,
.qrModalContent,
.confirmModalCard {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.card,
.panel,
.teamCard {
  padding: 20px;
}

.hint,
.muted,
.small,
.textMuted {
  color: var(--text-secondary);
}

.small {
  font-size: var(--text-sm);
}

.badge,
.pill,
.statusPill,
.eventBriefingStatus,
.topTeamBadge,
.eventEndedBanner,
.missionTilePrio,
.missionTilePlanungBadge,
.poiTileBadge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-family: var(--font-condensed);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-family: var(--font-condensed);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-default);
}

tbody td {
  padding: 12px 16px;
  color: var(--text-primary);
  font-size: var(--text-base);
  vertical-align: middle;
  border-bottom: 1px solid var(--border-muted);
}

tbody tr:hover {
  background: var(--bg-elevated);
}

.qrModal,
.confirmModalBackdrop {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
  z-index: 1000;
}

.qrModal:not(.hidden),
.confirmModalBackdrop:not(.hidden) {
  display: flex;
}

.qrModalContent,
.editorConfirmCard,
.textPropsCard,
#mapOverlayCard,
#mapDeleteConfirmCard,
.confirmModalCard {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
}

.validationBox,
.error,
.status,
.offlineSnapshotBanner,
.mobile-web-warning,
.mapMissionHistoryState {
  position: relative;
  padding: 12px 14px 12px 16px;
  border-radius: 10px;
  border: 1px solid var(--border-default);
  box-shadow: var(--shadow-sm);
}

.validationBox::before,
.error::before,
.status::before,
.offlineSnapshotBanner::before,
.mobile-web-warning::before,
.mapMissionHistoryState::before {
  content: "";
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: 0;
  width: 4px;
  border-radius: 999px;
}

.error {
  background: rgba(218, 54, 51, 0.1);
  color: var(--status-danger);
  border-color: rgba(218, 54, 51, 0.3);
}

.error::before,
.mapMissionHistoryState.error::before {
  background: var(--status-danger);
}

.status {
  background: var(--accent-primary-muted);
  color: var(--accent-primary);
  border-color: var(--accent-primary-border);
}

.status::before,
.mapMissionHistoryState.success::before {
  background: var(--accent-primary);
}

.mobile-web-warning,
.offlineSnapshotBanner,
.mapMissionHistoryState {
  background: var(--bg-surface);
}

.mobile-web-warning::before,
.offlineSnapshotBanner::before {
  background: var(--status-warning);
}

.themeToggle {
  width: 32px;
  min-width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--border-default);
  background: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.themeToggle:hover {
  background: var(--bg-elevated);
  border-color: var(--border-emphasis);
  color: var(--text-primary);
}

.themeToggleIcon {
  display: none;
  width: 16px;
  height: 16px;
  align-items: center;
  justify-content: center;
}

.themeToggleIcon svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.themeToggle[data-theme-current="dark"] .themeToggleIconSun,
.themeToggle[data-theme-current="light"] .themeToggleIconMoon {
  display: inline-flex;
}

.toggle-track {
  width: 36px;
  height: 20px;
  border-radius: 10px;
  background: var(--border-default);
  position: relative;
  cursor: pointer;
  transition: background 120ms ease;
}

.toggle-track.active {
  background: var(--accent-primary);
}

.toggle-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
  position: absolute;
  top: 2px;
  left: 2px;
  transition: transform 120ms ease;
}

.toggle-track.active .toggle-thumb {
  transform: translateX(16px);
}

.cg-icon-button svg,
.btn-delete svg,
.btnKick svg,
.cgActionIcon svg {
  width: 16px;
  height: 16px;
}

.cgActionIcon,
.mapNotificationBellIcon,
.themeToggleIcon {
  flex: 0 0 auto;
}

.cg-mono,
.liveMapClockTime,
.qrModalInviteCode,
.eventTrackingCurrentTime,
.eventBriefingStatValue,
.eventTrackingMetric .value {
  font-family: var(--font-mono);
}

.cg-label {
  font-family: var(--font-condensed);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

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