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

/* ─── Tokens ─────────────────────────────────────────────────── */
:root {
  --bg:           #f7f7f5;
  --surface:      #ffffff;
  --surface-hi:   #f9fafb;
  --border:       #ebebeb;
  --border-hi:    #d4d4d4;
  --text:         #0f0f0f;
  --text-muted:   #6b7280;
  --text-faint:   #9ca3af;
  --pitch-green:  #3a7d52;
  --pitch-stripe: rgba(0,0,0,0.045);
  --pitch-line:   rgba(255,255,255,0.7);
  --radius-sm:    6px;
  --radius:       10px;
  --sidebar-w:    280px;
  --right-panel-w: 520px;
  --pitch-w:      400px;
  --pitch-h:      580px;
  --topbar-h:     50px;
  --card-margin:  12px;
}

/* ─── Base ────────────────────────────────────────────────────── */
body {
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
}

/* ─── Topbar ──────────────────────────────────────────────────── */
.app-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topbar-h);
  background: #1c3829;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  z-index: 300;
  flex-shrink: 0;
}

/* ── Brand (left) ─────────────────────────────────────── */
.app-topbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-left: 2px;
}

.app-topbar-logo {
  display: block;
  flex-shrink: 0;
}

.app-topbar-divider {
  display: block;
  width: 1px;
  height: 50px;
  background: rgba(255, 255, 255, 0.25);
  flex-shrink: 0;
}

.app-topbar-wordmark {
  font-family: 'DM Sans', sans-serif;
  font-size: 18px;
  font-weight: 900;
  color: #ffffff;
  letter-spacing: -0.02em;
  user-select: none;
}

/* ── Actions (right) ──────────────────────────────────── */
.app-topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.app-topbar-companion-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.app-topbar-companion {
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.75);
  white-space: nowrap;
}

.app-topbar-companion-link {
  color: rgba(255, 255, 255, 0.75);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.app-topbar-companion-link:hover {
  color: #ffffff;
}

/* ── Variant: transparent (for later use) ─────────────── */
.app-topbar--transparent {
  background: transparent;
  border-bottom: 1px solid rgba(255, 255, 255, 0.25);
}

.app-topbar--transparent .app-topbar-btn {
  background: #ffffff;
  color: #1c3829;
}

.app-topbar--transparent .app-topbar-btn:hover {
  background: rgba(255, 255, 255, 0.85);
}

.app-topbar-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  background: rgba(255,255,255,0.12);
  border: none;
  border-radius: 4px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: #ffffff;
  cursor: pointer;
  transition: background 0.15s ease;
  white-space: nowrap;
}

.app-topbar-btn:hover {
  background: rgba(255,255,255,0.22);
}

.app-topbar-btn--icon {
  padding: 8px 10px;
}

/* ─── Cloud account button ────────────────────────────────────────── */
.cloud-account-btn {
  position: relative;
  opacity: 0.45; /* anonymous / not signed in */
  transition: opacity 0.2s;
}
.cloud-account-btn.cloud-btn--signed-in {
  opacity: 1;
}
/* Red dot badge for sync errors */
.cloud-account-btn.cloud-btn--error::after {
  content: '';
  position: absolute;
  top: 7px;
  right: 7px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ef4444;
  border: 1.5px solid #1c3829;
}

#app-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
  padding-top: var(--topbar-h);
  padding-left: calc(var(--sidebar-w) + var(--card-margin) * 2);
  padding-right: calc(var(--right-panel-w) + var(--card-margin) * 2);
  box-sizing: border-box;
}

#main-area {
  flex: 1;
  position: relative;
  display: flex;
  overflow: hidden;
  min-width: 0;
}

#app-root { display: contents; }

/* ─── Sidebar card ────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  left: var(--card-margin);
  top: calc(var(--topbar-h) + var(--card-margin));
  bottom: var(--card-margin);
  width: var(--sidebar-w);
  background: #ffffff;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 10;
}

/* ─── Spillere card header ────────────────────────────────────── */
.spillere-card-header {
  height: 48px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  flex-shrink: 0;
}

/* ─── Panel section title ─────────────────────────────────────── */
.panel-title {
  font-family: 'Sora', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text);
}

/* ─── Typography utilities ───────────────────────────────────── */

.section-title {
  font-family: 'Sora', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

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

.text-body {
  font-size: 13px;
  font-weight: 400;
  color: var(--text);
  line-height: 1.6;
}

.text-help {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-muted);
  line-height: 1.6;
}

.text-faint {
  font-size: 12px;
  color: var(--text-faint);
}


.spillere-card-title {
  /* layout only — typography via .panel-title */
}

.spillere-card-actions-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-icon-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  flex-shrink: 0;
}

.card-icon-btn:hover {
  background: rgba(0,0,0,0.05);
  color: var(--text);
}

.card-icon-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.card-icon-btn:disabled:hover {
  background: transparent;
  color: var(--text-muted);
}

.card-icon-btn--accent {
  background: rgba(37, 99, 235, 0.08);
  color: #2563eb;
}

.card-icon-btn--accent:hover {
  background: #3b82f6;
  color: #ffffff;
}

.card-icon-btn--destructive {
  background: rgba(192, 57, 43, 0.08);
  color: #c0392b;
}

.card-icon-btn--destructive:hover {
  background: #c0392b;
  color: #ffffff;
}


/* ─── Autocomplete ────────────────────────────────────────────── */
.ac-dropdown {
  position: fixed;
  z-index: 200;
  background: #fff;
  border: 1px solid #E5E5EA;
  border-radius: 6px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.10);
  overflow: hidden;
  padding: 4px 0;
}

.ac-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
}

.ac-group-pill {
  font-size: 0.7rem;
  font-weight: 500;
  border-radius: 20px;
  padding: 1px 7px;
  letter-spacing: 0.01em;
  flex-shrink: 0;
}

/* Group pill colors — shared by .ac-group-pill and .fbd-table-pill */
.ac-group-pill[data-group-idx="0"], .fbd-table-pill[data-group-idx="0"] { background: #e6f4ea; color: #2a7a38; border: 1px solid #b7dfc0; }
.ac-group-pill[data-group-idx="1"], .fbd-table-pill[data-group-idx="1"] { background: #fce8e6; color: #c0392b; border: 1px solid #f5b8b3; }
.ac-group-pill[data-group-idx="2"], .fbd-table-pill[data-group-idx="2"] { background: #e8e8e8; color: #1a1a1a; border: 1px solid #c8c8c8; }
.ac-group-pill[data-group-idx="3"], .fbd-table-pill[data-group-idx="3"] { background: #ffffff; color: #555;    border: 1px solid #ddd; }
.ac-group-pill[data-group-idx="4"], .fbd-table-pill[data-group-idx="4"] { background: #e3f0fc; color: #1a6fc4; border: 1px solid #b0d4f5; }
.ac-group-pill[data-group-idx="5"], .fbd-table-pill[data-group-idx="5"] { background: #f0eaff; color: #6b2fa0; border: 1px solid #d4b8f5; }
.ac-group-pill[data-group-idx="6"], .fbd-table-pill[data-group-idx="6"] { background: #fef9e3; color: #b07c0a; border: 1px solid #f0e0a0; }

.ac-item:hover,
.ac-item--active {
  background: #F2F2F7;
}

.ac-item--destructive { color: #c0392b; }
.ac-item--destructive:hover { background: rgba(192, 57, 43, 0.06); color: #c0392b; }


.sidebar-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 24px 16px 0;
}

.sidebar-group:first-child {
  padding-top: 20px;
}

.sidebar-group:last-child {
  padding-bottom: 20px;
}

.sidebar-group-label {
  display: block;
  font-family: 'Sora', sans-serif;
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-faint);
  margin-bottom: 8px;
}

/* ─── Sidebar v3 (roster) ─────────────────────────────────────── */
.sidebar-v3-body {
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 100%;
  box-sizing: border-box;
}

.sidebar-clear-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: auto;
  margin-bottom: 4px;
  padding: 8px 10px;
  background: rgba(220, 38, 38, 0.08);
  border: none;
  border-radius: 4px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: #c0392b;
  cursor: pointer;
  box-sizing: border-box;
  transition: background 0.18s ease-out, color 0.18s ease-out;
}

.sidebar-clear-btn:hover {
  background: #e53935;
  color: #ffffff;
}

.sidebar-clear-btn--inactive {
  background: rgba(0, 0, 0, 0.04);
  color: #b0b8c1;
  cursor: not-allowed;
}

.sidebar-clear-btn--inactive:hover {
  background: rgba(0, 0, 0, 0.04);
  color: #b0b8c1;
}

.sidebar-v3-header {
  display: flex;
  align-items: center;
  height: 48px;
  padding: 0 16px;
  /* typography via .panel-title */
}

.sidebar-v3-divider {
  border: none;
  border-top: 1px solid #E5E5E5;
  margin: 12px 0 8px;
}

/* ─── Sidebar section ─────────────────────────────────────────── */
.section-label {
  display: block;
  font-family: 'Sora', sans-serif;
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-faint);
  margin-bottom: 8px;
}

.lineup-form .section-label {
  margin-bottom: 8px;
}

.lineup-form {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,0.15) transparent;
}

.lineup-form::-webkit-scrollbar { width: 4px; }
.lineup-form::-webkit-scrollbar-track { background: transparent; }
.lineup-form::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 2px; }

/* ─── Inputs ──────────────────────────────────────────────────── */
/* Outer row wrapping input-wrap + player info button */
.sidebar-player-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.sidebar-player-row .input-wrap {
  flex: 1;
  min-width: 0;
}

.sidebar-player-info-btn {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-faint);
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease, color 120ms ease, background 120ms ease;
}

.sidebar-player-row:has(.player-input:not(:placeholder-shown)) .sidebar-player-info-btn.is-roster {
  opacity: 1;
  pointer-events: auto;
}

.sidebar-player-info-btn:hover {
  color: var(--text);
  background: rgba(0, 0, 0, 0.06);
}

.input-wrap {
  display: flex;
  align-items: center;
  background: #f0f0ee;
  border-radius: var(--radius-sm);
}

.input-wrap:hover {
  background: #ebebea;
}

.input-wrap:focus-within {
  background: #f0f0ee;
  outline: 2px solid var(--text);
  outline-offset: -2px;
}

.player-input {
  flex: 1;
  min-width: 0;
  height: 34px;
  background: transparent;
  border: none;
  outline: none;
  padding: 0 8px 0 12px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
}

.player-input::placeholder { color: #9ca3af; font-weight: 400; }

.input-trailing {
  padding-right: 10px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 400;
  color: #9ca3af;
  pointer-events: none;
  white-space: nowrap;
  flex-shrink: 0;
  opacity: 1;
  transition: opacity 300ms ease;
}

.player-input:placeholder-shown + .input-trailing {
  opacity: 0;
  pointer-events: none;
}

.input-clear-btn {
  display: none;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-right: 6px;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  color: #9ca3af;
}

.input-clear-btn:hover { color: var(--text); }

/* On hover, swap trailing text for clear button when the field has a value */
.input-wrap:hover .player-input:not(:placeholder-shown) + .input-trailing { display: none; }
.input-wrap:hover .player-input:not(:placeholder-shown) ~ .input-clear-btn { display: flex; }

/* ─── Pitch area ──────────────────────────────────────────────── */
.pitch-container {
  flex: 1;
  min-width: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 88px 40px 40px;
  background: var(--bg);
  overflow: hidden;
}


.pitch-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  width: 100%;
}



/* ─── Actions bar ─────────────────────────────────────────────── */
.pitch-actions {
  position: absolute;
  top: 18px;
  left: 16px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pitch-actions-btns {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.pitch-tip { display: none; }

/* ─── Export below pitch ──────────────────────────────────────── */
.export-below-pitch {
  display: flex;
  justify-content: center;
  padding-top: 16px;
}

.action-btn--right {
  margin-left: auto;
}

.action-btn--icon {
  padding: 8px;
}

.action-select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  padding: 8px 30px 8px 14px;
  background-color: rgba(37, 99, 235, 0.08);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none' stroke='%232563eb' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  border: none;
  border-radius: 4px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: #2563eb;
  cursor: pointer;
  transition: background-color 0.18s ease-out, color 0.18s ease-out;
}

.action-select:hover {
  background-color: #3b82f6;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none' stroke='%23ffffff' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
  color: #ffffff;
}

.action-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  background: rgba(37, 99, 235, 0.08);
  border: none;
  border-radius: 4px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: #2563eb;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.18s ease-out, color 0.18s ease-out;
}

.action-btn:hover {
  background: #3b82f6;
  color: #ffffff;
}

.action-btn--inactive {
  background: rgba(0, 0, 0, 0.04);
  color: #b0b8c1;
  cursor: not-allowed;
}

.action-btn--inactive:hover {
  background: rgba(0, 0, 0, 0.04);
  color: #b0b8c1;
}

.action-btn--destructive {
  background: rgba(192, 57, 43, 0.08);
  color: #c0392b;
}

.action-btn--destructive:hover {
  background: #c0392b;
  color: #ffffff;
}

/* ─── Right panel card ────────────────────────────────────────── */
.right-panel {
  position: fixed;
  right: var(--card-margin);
  top: calc(var(--topbar-h) + var(--card-margin));
  bottom: var(--card-margin);
  width: var(--right-panel-w);
  background: #ffffff;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  padding: 28px 28px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,0.15) transparent;
  z-index: 10;
}

.right-panel::-webkit-scrollbar { width: 4px; }
.right-panel::-webkit-scrollbar-track { background: transparent; }
.right-panel::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 2px; }

/* ─── Formation panel ────────────────────────────────────────── */
.fp-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 20px;
}

.fp-name {
  font-family: 'Sora', sans-serif;
  font-size: 2rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}

.fp-badge {
  font-family: 'DM Sans', sans-serif;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 7px;
}

.fp-pitch {
  width: 180px;
  margin: 0 0 24px 0;
}

.fp-pitch svg {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 6px;
}

.fp-description {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 20px;
}

.fp-section {
  margin-bottom: 18px;
}

.fp-section-label {
  display: block;
  font-family: 'DM Sans', sans-serif;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8E8E93;
  margin-bottom: 8px;
}

.fp-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.fp-list li {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem;
  color: var(--text);
  line-height: 1.5;
  padding-left: 14px;
  position: relative;
}

.fp-strengths li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #34C759;
}

.fp-weaknesses li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #FF3B30;
}

.fp-clubs {
  margin-bottom: 24px;
}

.fp-clubs-list {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0;
}

.fp-source {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.75rem;
  color: #C7C7CC;
  margin: 0;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* ─── Formation panel source link ────────────────────────────── */
.fp-source-link {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  background: rgba(37, 99, 235, 0.08);
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: #2563eb;
  text-decoration: none;
  margin-bottom: 16px;
  transition: background 0.18s ease-out, color 0.18s ease-out;
}

.fp-source-link:hover {
  background: #3b82f6;
  color: #ffffff;
}

/* ─── Formation panel transitions ────────────────────────────── */
@keyframes fp-shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}

@keyframes fp-fade-in {
  from { opacity: 0; transform: translateY(5px); }
  to   { opacity: 1; transform: translateY(0); }
}

#formation-panel-body.fp-body--exit {
  opacity: 0;
  transition: opacity 140ms ease-out;
  pointer-events: none;
}

#formation-panel-body.fp-body--enter {
  animation: fp-fade-in 220ms ease-out both;
}

.fp-skel-wrap {
  display: flex;
  flex-direction: column;
}

.fp-skel {
  border-radius: 5px;
  background: linear-gradient(90deg, #f2f2f7 25%, #e5e5ea 50%, #f2f2f7 75%);
  background-size: 200% 100%;
  animation: fp-shimmer 1.4s ease-in-out infinite;
}

.fp-skel--name  { width: 52%; height: 30px; margin-bottom: 20px; }
.fp-skel--pitch { width: 180px; height: 116px; border-radius: 6px; margin-bottom: 24px; }
.fp-skel--label { width: 48px; height: 9px; border-radius: 3px; margin-bottom: 10px; }

.fp-skel-lines {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.fp-skel--line { height: 12px; border-radius: 3px; }

.fp-skel--w80 { width: 80%; }
.fp-skel--w75 { width: 75%; }
.fp-skel--w70 { width: 70%; }
.fp-skel--w65 { width: 65%; }
.fp-skel--w60 { width: 60%; }
.fp-skel--w55 { width: 55%; }
.fp-skel--w50 { width: 50%; }

/* ─── Unknown formation placeholders (static, no animation) ───── */
.fp-unknown-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0 0 20px;
  line-height: 1.4;
}

.fp-placeholder-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.fp-placeholder {
  border-radius: 5px;
  background: #f2f2f7;
}

.fp-placeholder--pitch  { width: 180px; height: 116px; border-radius: 6px; margin-bottom: 6px; }
.fp-placeholder--label  { width: 48px;  height: 9px;   border-radius: 3px; margin-top: 6px; }
.fp-placeholder--line   { height: 12px; border-radius: 3px; }

.fp-placeholder--w80 { width: 80%; }
.fp-placeholder--w75 { width: 75%; }
.fp-placeholder--w70 { width: 70%; }
.fp-placeholder--w65 { width: 65%; }
.fp-placeholder--w55 { width: 55%; }
.fp-placeholder--w50 { width: 50%; }

/* ─── Player info panel (right panel secondary state) ─────────── */
.fp-player-back {
  display: flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  padding: 0 0 16px;
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-faint);
  cursor: pointer;
  transition: color 0.15s;
}
.fp-player-back:hover { color: var(--text); }

.fp-player-name-section {
  margin-bottom: 16px;
}

.fp-player-fullname {
  font-family: 'Sora', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 2px;
}

.fp-player-nickname {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--text-muted);
  margin: 0;
}

.fp-player-details {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.fp-player-detail-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.fp-player-detail-label {
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint);
  min-width: 68px;
  flex-shrink: 0;
}

.fp-player-detail-value {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
}

.fp-player-notes {
  margin-bottom: 20px;
}

.fp-player-notes-text {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 6px 0 0;
  white-space: pre-wrap;
}

.fp-player-rediger-btn {
  width: 100%;
  padding: 10px 16px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
  background: var(--text);
  color: var(--surface);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: center;
  transition: opacity 0.15s;
}
.fp-player-rediger-btn:hover { opacity: 0.85; }

/* ─── Pitch header ────────────────────────────────────────────── */
/* ─── Pitch header (removed — formation picker moved to sidebar) */



/* ─── Pitch row (pitch + bench) ──────────────────────────────── */
.pitch-row {
  position: relative;
  display: flex;
  align-items: center;
}

/* ─── Bench ───────────────────────────────────────────────────── */
.pitch-bench {
  position: absolute;
  left: calc(var(--pitch-w) + 20px);
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ─── Bench input appear animation ───────────────────────────── */
@keyframes bench-input-appear {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.bench-input-new {
  animation: bench-input-appear 150ms ease forwards;
}


.bench-node {
  position: relative;
  width: 64px;
  flex-shrink: 0;
  cursor: pointer;
  transition: transform 120ms ease;
}

.bench-node:hover {
  transform: scale(1.06);
  z-index: 10;
}

.bench-node svg { display: block; }

.bench-node.bench-coach { margin-top: 12px; }


.sidebar-v3-bench-area {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 0 0 0
}

/* ─── Pitch ───────────────────────────────────────────────────── */
.pitch {
  position: relative;
  width: var(--pitch-w);
  height: var(--pitch-h);
  background: var(--pitch-green);
  border-radius: 6px;
  border: 2px solid rgba(255,255,255,0.15);
  overflow: visible;
  box-shadow:
    0 0 0 1px rgba(0,0,0,0.08),
    0 24px 64px rgba(0,0,0,0.18);
}

.pitch::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 4px;
  background: repeating-linear-gradient(
    180deg,
    var(--pitch-stripe) 0px,
    var(--pitch-stripe) 38px,
    transparent 38px,
    transparent 76px
  );
  pointer-events: none;
}

.pitch-lines {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* ─── Pitch markings ──────────────────────────────────────────── */
.line-center {
  position: absolute;
  top: 50%; left: 0; right: 0;
  height: 1px;
  background: var(--pitch-line);
  transform: translateY(-50%);
}

.circle-center {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 108px; height: 102px;
  border-radius: 50%;
  border: 1px solid var(--pitch-line);
}

.dot-center {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--pitch-line);
}

.box-top {
  position: absolute;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: 237px; height: 91px;
  border: 1px solid var(--pitch-line);
  border-top: none;
}

.box-bottom {
  position: absolute;
  bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 237px; height: 91px;
  border: 1px solid var(--pitch-line);
  border-bottom: none;
}

.goalbox-top {
  position: absolute;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: 108px; height: 30px;
  border: 1px solid var(--pitch-line);
  border-top: none;
}

.goalbox-bottom {
  position: absolute;
  bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 108px; height: 30px;
  border: 1px solid var(--pitch-line);
  border-bottom: none;
}

.penalty-spot-top,
.penalty-spot-bottom {
  position: absolute;
  left: 50%;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--pitch-line);
}

.penalty-spot-top    { top:    61px; transform: translate(-50%, -50%); }
.penalty-spot-bottom { bottom: 61px; transform: translate(-50%,  50%); }

.penalty-d-top,
.penalty-d-bottom {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 108px; height: 102px;
  border-radius: 50%;
  border: 1px solid var(--pitch-line);
  background: none;
}

.penalty-d-top    { top:    10px; clip-path: inset(81px 0 0 0); }
.penalty-d-bottom { bottom: 10px; clip-path: inset(0 0 81px 0); }


.corner-tl, .corner-tr, .corner-bl, .corner-br {
  position: absolute;
  width: 12px; height: 12px;
}

.corner-tl { top: 0; left:  0; border-right: 1px solid var(--pitch-line); border-bottom: 1px solid var(--pitch-line); border-bottom-right-radius: 12px; }
.corner-tr { top: 0; right: 0; border-left:  1px solid var(--pitch-line); border-bottom: 1px solid var(--pitch-line); border-bottom-left-radius:  12px; }
.corner-bl { bottom: 0; left:  0; border-right: 1px solid var(--pitch-line); border-top: 1px solid var(--pitch-line); border-top-right-radius: 12px; }
.corner-br { bottom: 0; right: 0; border-left:  1px solid var(--pitch-line); border-top: 1px solid var(--pitch-line); border-top-left-radius:  12px; }

/* ─── Player node ─────────────────────────────────────────────── */
.player-node {
  position: absolute;
  width: 64px;
  height: 64px;
  transform: translate(-50%, -50%);
  cursor: default;
  transition: transform 120ms ease;
}

.player-node[data-draggable="true"] {
  cursor: grab;
}

.player-node:hover,
.player-node.active {
  transform: translate(-50%, -50%) scale(1.06);
  z-index: 10;
}

.player-node.is-dragging:hover {
  transform: translate(-50%, -50%) scale(1.12);
}

.player-node:focus { outline: none; }
.player-node:focus-visible { outline: none; }

.player-node.is-bench-target {
  transform: translate(-50%, -50%) scale(1.1);
  z-index: 10;
}

.player-node.is-bench-target svg {
  filter: drop-shadow(0 0 6px rgba(255,255,255,0.7));
}

.bench-node.is-pitch-target {
  outline: 2px solid rgba(255,255,255,0.6);
  outline-offset: 2px;
  border-radius: 4px;
}

.player-node svg {
  display: block;
}

.player-node.is-dragging {
  cursor: grabbing;
  z-index: 100;
  transition: none;
  transform: translate(-50%, -50%) scale(1.12);
}

/* swap: 200ms decelerate position + scale pulse */
.player-node.is-animating-swap {
  transition: left 200ms cubic-bezier(0.25, 0.46, 0.45, 0.94),
              top  200ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
  animation: node-pulse-swap 200ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* reset: 240ms decelerate position + gentler scale pulse */
.player-node.is-animating-reset {
  transition: left 240ms cubic-bezier(0.25, 0.46, 0.45, 0.94),
              top  240ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
  animation: node-pulse-reset 240ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes node-pulse-swap {
  0%   { transform: translate(-50%, -50%) scale(1.0); }
  40%  { transform: translate(-50%, -50%) scale(1.06); }
  100% { transform: translate(-50%, -50%) scale(1.0); }
}

@keyframes node-pulse-reset {
  0%   { transform: translate(-50%, -50%) scale(1.0); }
  50%  { transform: translate(-50%, -50%) scale(1.04); }
  100% { transform: translate(-50%, -50%) scale(1.0); }
}

/* entry: spawn-to-formation animation when creating from dialog */
.player-node.is-animating-entry {
  animation: node-entry-appear 480ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes node-entry-appear {
  0%   { transform: translate(-50%, -50%) scale(0.45); }
  65%  { transform: translate(-50%, -50%) scale(1.07); }
  100% { transform: translate(-50%, -50%) scale(1.0); }
}

/* bench node entry animation when creating from dialog */
.bench-node.is-bench-entry {
  animation: bench-node-appear 360ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes bench-node-appear {
  0%   { opacity: 0; transform: translateY(8px) scale(0.75); }
  65%  { transform: translateY(-2px) scale(1.05); }
  100% { opacity: 1; transform: translateY(0) scale(1.0); }
}

/* ─── Pitch drag-and-drop ─────────────────────────────────────── */
.pitch-drop-overlay {
  display: none;
  position: absolute;
  inset: 0;
  border-radius: 4px;
  z-index: 20;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  pointer-events: none;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(2px);
}

.pitch--drop-ready .pitch-drop-overlay {
  display: flex;
  background: rgba(255, 255, 255, 0.22);
}

.pitch--drop-ready {
  outline: 2px solid rgba(255, 255, 255, 0.7);
  outline-offset: -2px;
}

.pitch-drop-icon {
  color: rgba(255, 255, 255, 0.85);
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.25));
}

.pitch-drop-label {
  margin: 0;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.8rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.92);
  text-shadow: 0 1px 4px rgba(0,0,0,0.3);
}



/* Reading state */
.pitch-is-reading .player-node {
  opacity: 0;
  pointer-events: none;
}

.pitch-reading-overlay {
  position: absolute;
  inset: 0;
  border-radius: 4px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(0, 0, 0, 0.38);
  pointer-events: none;
}

.pitch-reading-spinner {
  width: 22px;
  height: 22px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: rgba(255, 255, 255, 0.88);
  border-radius: 50%;
  animation: pitch-spin 0.75s linear infinite;
}

@keyframes pitch-spin { to { transform: rotate(360deg); } }

.pitch-reading-label {
  margin: 0;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.8rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.92);
  text-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

/* ─── Toast ──────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: grid;
  grid-template-columns: 16px 1fr 20px;
  align-items: start;
  gap: 8px;
  background: #1c1c1c;
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.22), 0 1px 4px rgba(0, 0, 0, 0.14);
  padding: 11px 12px 11px 14px;
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 0.82rem;
  font-weight: 450;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.92);
  max-width: 300px;
  pointer-events: auto;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 200ms ease, transform 200ms ease;
}

.toast.toast--in {
  opacity: 1;
  transform: translateY(0);
}

.toast.toast--out {
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast-icon {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  margin-top: 1px;
}

.toast--success .toast-icon { color: #4ade80; }
.toast--warning .toast-icon { color: #fbbf24; }
.toast--error   .toast-icon { color: #f87171; }

.toast-message {
  align-self: center;
}

.toast-name-list {
  display: block;
  margin-top: 4px;
  opacity: 0.8;
}

.toast-dismiss {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  margin-top: -1px;
  border: none;
  background: none;
  color: rgba(255, 255, 255, 0.4);
  cursor: pointer;
  border-radius: 4px;
  padding: 0;
  font-size: 14px;
  line-height: 1;
  flex-shrink: 0;
  transition: color 120ms ease;
}

.toast-dismiss:hover { color: rgba(255, 255, 255, 0.85); }

/* pitch loading state while formation is being applied */
.pitch.pitch-is-forming::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 4px;
  z-index: 5;
  animation: pitch-forming-pulse 700ms ease-in-out forwards;
  pointer-events: none;
}

@keyframes pitch-forming-pulse {
  0%   { background: rgba(0,0,0,0); }
  35%  { background: rgba(0,0,0,0.12); }
  100% { background: rgba(0,0,0,0); }
}

/* suggest: slow, floaty movement with a lifted glow */
.player-node.is-animating-suggest {
  transition: left 720ms cubic-bezier(0.4, 0, 0.2, 1),
              top  720ms cubic-bezier(0.4, 0, 0.2, 1);
  animation: node-pulse-suggest 720ms ease-in-out forwards;
}

@keyframes node-pulse-suggest {
  0%   { transform: translate(-50%, -50%) scale(1.0);    filter: drop-shadow(0 0px  0px rgba(0,0,0,0.0)); }
  25%  { transform: translate(-50%, -50%) scale(1.14);   filter: drop-shadow(0 6px 16px rgba(0,0,0,0.18)); }
  75%  { transform: translate(-50%, -50%) scale(1.10);   filter: drop-shadow(0 6px 14px rgba(0,0,0,0.14)); }
  100% { transform: translate(-50%, -50%) scale(1.0);    filter: drop-shadow(0 0px  0px rgba(0,0,0,0.0)); }
}

.player-node .player-name,
.bench-node .name-tag {
  position: absolute;
  top: calc(100% - 6px);
  left: 50%;
  transform: translateX(-50%);
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  font-weight: 500;
  color: #0f0f0f;
  background: rgba(255,255,255,0.88);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  box-shadow: 0 1px 4px rgba(0,0,0,0.10);
  padding: 2px 7px;
  border-radius: 4px;
  white-space: nowrap;
  max-width: 88px;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
  line-height: 1.5;
}

.player-node .player-name:empty {
  display: none;
}

/* ─── Player node edit button ─────────────────────────────────── */
.player-node-edit-btn {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: rgba(255,255,255,0.82);
  border: none;
  border-radius: 3px;
  cursor: pointer;
  color: var(--text-faint);
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease, color 120ms ease;
  z-index: 5;
}
.player-node:hover .player-node-edit-btn {
  opacity: 1;
  pointer-events: auto;
}
.player-node-edit-btn:hover {
  color: var(--text);
  background: rgba(255,255,255,0.96);
}

.player-node .player-name.name-edit-wrap,
.bench-node .name-edit-wrap {
  overflow: visible;
  background: none;
  border-left: none;
  padding: 0;
}

.name-edit {
  display: block;
  width: 80px;
  padding: 2px 6px;
  background: rgba(255, 255, 255, 0.92);
  border: none;
  border-radius: var(--radius-sm);
  box-shadow: 0 1px 4px rgba(0,0,0,0.12);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  text-align: center;
  outline: none;
  animation: name-edit-in 120ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes name-edit-in {
  from { opacity: 0; transform: scaleY(0.8); }
  to   { opacity: 1; transform: scaleY(1); }
}

@keyframes name-tag-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.name-tag-enter {
  animation: name-tag-in 120ms 40ms ease-out both;
}

/* ─── Position picker popover ────────────────────────────────── */

.pitch-popover {
  position: fixed;
  z-index: 300;
  width: 200px;
  max-height: calc(100vh - 24px);
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 10px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.10), 0 1px 4px rgba(0,0,0,0.06);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: hidden;
  animation: popover-in 120ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes popover-in {
  from { opacity: 0; transform: scale(0.94); }
  to   { opacity: 1; transform: scale(1); }
}

.pitch-popover-input-row {
  display: flex;
  align-items: center;
  position: relative;
}

.pitch-popover-clear-btn {
  position: absolute;
  right: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  color: #b0b0b0;
}
.pitch-popover-clear-btn:hover { color: #333; }
.pitch-popover-clear-btn[hidden] { display: none; }

.pitch-popover-input {
  width: 100%;
  box-sizing: border-box;
  padding: 7px 10px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  color: #0f0f0f;
  background: #f7f7f7;
  border: 1px solid transparent;
  border-radius: 7px;
  outline: none;
  transition: background 120ms, border-color 120ms, box-shadow 120ms;
}
.pitch-popover-input:focus {
  background: #fff;
  border-color: #d0d0d0;
  box-shadow: 0 0 0 3px rgba(0,0,0,0.05);
}
.pitch-popover-input::placeholder { color: #b0b0b0; }
.pitch-popover-input-row:has(.pitch-popover-clear-btn) .pitch-popover-input { padding-right: 28px; }

.pitch-popover-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.pitch-popover-list[hidden] { display: none; }

.pitch-popover-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 80ms;
}
.pitch-popover-item:hover,
.pitch-popover-item--active {
  background: #f5f5f5;
}

.pitch-popover-item-name {
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  color: #0f0f0f;
  font-weight: 400;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ─── FillBenchDialog — Apple Minimal ───────────────────────── */

.fbd-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.22);
  display: flex !important;
  align-items: center;
  justify-content: center;
  z-index: 400;
}
.fbd-overlay[hidden] { display: none !important; }

/* ─── Modal system ───────────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.22);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 400;
}
.modal-overlay[hidden] { display: none !important; }

.modal-dialog {
  background: var(--surface);
  border-radius: 12px;
  box-shadow: 0 0 0 0px var(--border), 0 8px 40px rgba(0, 0, 0, 0.10), 0 2px 8px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Remove header divider — modals use whitespace separation */
.modal-dialog .fbd-header {
  border-bottom: none;
}

/* Small — alert / yes-no */
.modal-dialog--sm {
  width: min(440px, 94vw);
}

/* Medium — import options / multi-field forms */
.modal-dialog--md {
  width: min(580px, 94vw);
}

/* Functional — interactive content (lists, config, tools). Always custom-built. */
.modal-dialog--functional {
  width: min(860px, 94vw);
  height: min(600px, 90vh);
}
.modal-dialog--functional .fbd-header {
  border-bottom: 1px solid var(--border);
}

/* Rich — half image, half content */
.modal-dialog--rich {
  width: min(860px, 94vw);
  height: min(520px, 90vh);
  flex-direction: row;
}
.modal-dialog--rich.modal-rich--top {
  width: min(540px, 94vw);
  height: auto;
  flex-direction: column;
}

.modal-rich__image {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.modal-rich__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.modal-rich--top .modal-rich__image {
  flex: none;
  height: 260px;
}

.modal-rich__content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* Right variant — image is second child */
.modal-dialog--rich.modal-rich--right .modal-rich__image  { order: 2; }
.modal-dialog--rich.modal-rich--right .modal-rich__content { order: 1; }

/* Typography scale — modal titles */
/* Header Medium  (.fbd-title)      : 1.2rem — Small + Medium modals  */
/* Header Large   (.fbd-title--lg)  : 1.5rem — Rich modals            */
/* Header X-Large (.fbd-title--xl)  : 2.2rem — Hero / splash screens  */
.fbd-title--lg { font-size: 1.5rem; }
.fbd-title--xl {
  font-size: 2.2rem;
  letter-spacing: -0.03em;
}

/* ─────────────────────────────────────────────────────────────── */

.fbd-dialog {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.10), 0 2px 8px rgba(0, 0, 0, 0.05);
  width: min(900px, 94vw);
  height: min(780px, 90vh);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Header */
.fbd-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 24px 18px 24px;
  border-bottom: 1px solid var(--border);
}

.fbd-title {
  font-family: 'Sora', sans-serif;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
}

.fbd-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-faint);
  font-size: 15px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  line-height: 1;
  transition: background 0.18s ease-out, color 0.18s ease-out;
}
.fbd-close:hover { background: var(--surface-hi); color: var(--text); }

.fbd-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Stepper */
.fbd-stepper {
  display: flex;
  align-items: center;
  padding: 20px 24px 0;
}

.fbd-step {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.fbd-step-number {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid var(--border-hi);
  background: transparent;
  color: var(--text-faint);
  font-size: 10px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s ease-out, border-color 0.2s ease-out, color 0.2s ease-out;
}

.fbd-step--active .fbd-step-number,
.fbd-step--done   .fbd-step-number {
  background: var(--text);
  border-color: var(--text);
  color: var(--surface);
}

.fbd-step-label {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-faint);
  white-space: nowrap;
}

.fbd-step--active .fbd-step-label { color: var(--text); font-weight: 500; }
.fbd-step--done   .fbd-step-label { color: var(--text-faint); }

.fbd-step-connector {
  display: block;
  flex: 1;
  height: 1px;
  background: var(--border);
  margin: 0 8px;
}

/* Body */
.fbd-body {
  flex: 1;
  overflow: hidden;
  display: flex;
  padding: 0;
  min-height: 0;
}

.fbd-placeholder {
  font-size: 13px;
  color: var(--text-faint);
}

/* Step 1 — group selection */
.fbd-groups-hint {
  font-size: 13px;
  color: var(--text-faint);
  margin-bottom: 12px;
}

.fbd-group-list { list-style: none; display: flex; flex-direction: column; }

.fbd-group-row { display: flex; }

.fbd-group-label {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  user-select: none;
  transition: background 0.15s ease-out;
}
.fbd-group-label:hover { background: var(--surface-hi); }

.fbd-group-checkbox { flex-shrink: 0; width: 15px; height: 15px; accent-color: var(--text); }

.fbd-group-name { color: var(--text); font-weight: 400; }

/* Step 2 — formation selection */
.fbd-formation-list { list-style: none; display: flex; flex-direction: column; }

.fbd-formation-row { display: flex; }

.fbd-formation-label {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  user-select: none;
  transition: background 0.15s ease-out;
}
.fbd-formation-label:hover { background: var(--surface-hi); }

.fbd-formation-radio { flex-shrink: 0; width: 15px; height: 15px; accent-color: var(--text); }

.fbd-formation-name { color: var(--text); font-weight: 400; font-family: 'Sora', sans-serif; font-size: 12px; }

/* Step 3 — player list */
.fbd-player-count {
  font-size: 12px;
  color: var(--text-faint);
  margin-bottom: 12px;
}

.fbd-player-list {
  list-style: none;
  display: flex;
  flex-direction: column;
}

.fbd-player-row { display: flex; }

.fbd-player-label {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  user-select: none;
  transition: background 0.15s ease-out;
}
.fbd-player-label:hover { background: var(--surface-hi); }

.fbd-player-label--disabled { opacity: 0.35; cursor: not-allowed; }

.fbd-player-checkbox { flex-shrink: 0; width: 15px; height: 15px; accent-color: var(--text); }

.fbd-player-name { flex: 1; color: var(--text); font-weight: 400; }

.fbd-player-group { font-size: 11px; color: var(--text-faint); }

/* Step 3 — player search picker */
.fbd-picker {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.fbd-picker-count {
  font-size: 12px;
  color: var(--text-faint);
  margin-bottom: 10px;
}

.fbd-picker-input {
  width: 100%;
  padding: 8px 12px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 150ms ease;
  margin-bottom: 12px;
}

.fbd-picker-input::placeholder { color: var(--text-faint); }

.fbd-picker-input:focus {
  outline: 2px solid var(--text);
  outline-offset: 2px;
  border-color: var(--border);
}

.fbd-picker-suggestions {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 16px;
}

.fbd-picker-group {
  padding: 0;
}

.fbd-picker-group + .fbd-picker-group {
  border-top: 1px solid var(--border);
}

.fbd-picker-group-header {
  padding: 7px 12px 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.fbd-picker-list {
  list-style: none;
  padding: 0 4px 4px;
}

.fbd-picker-item {
  padding: 6px 8px;
  border-radius: 5px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  transition: background 100ms ease;
}

.fbd-picker-item:hover,
.fbd-picker-item--active {
  background: var(--surface-hi);
}

.fbd-picker-empty {
  padding: 12px;
  font-size: 13px;
  color: var(--text-faint);
  text-align: center;
}

/* Three-column workspace */
.fbd-workspace {
  display: flex;
  flex: 1;
  min-height: 0;
}

.fbd-col-filters {
  width: 12rem;
  flex-shrink: 0;
  padding: 20px 16px 20px 20px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
}

.fbd-checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.fbd-col-table {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 20px;
  gap: 10px;
  min-width: 0;
  overflow: hidden;
}

.fbd-col-table .fbd-table-wrap {
  flex: 1;
  overflow-y: auto;
  margin-bottom: 0;
}

.fbd-col-selected {
  width: 15.5rem;
  flex-shrink: 0;
  border-left: 1px solid var(--border);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
}

.fbd-col-heading {
  /* replaced by .panel-title — kept for flex-shrink only */
  flex-shrink: 0;
}

.fbd-search-input {
  width: 100%;
  flex-shrink: 0;
  padding: 8px 12px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 150ms ease;
}
.fbd-search-input::placeholder { color: var(--text-faint); }
.fbd-search-input:focus {
  outline: 2px solid var(--text);
  outline-offset: 2px;
  border-color: var(--border);
}

.fbd-selected-count {
  font-size: 12px;
  color: var(--text-faint);
  transition: color 0.15s;
  flex-shrink: 0;
}
.fbd-selected-count[data-state="empty"]   { color: var(--text-faint); }
.fbd-selected-count[data-state="partial"] { color: #e53935; }
.fbd-selected-count[data-state="full"]    { color: #2e7d32; }

.fbd-selected-tags-area {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.fbd-selected-tag {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  background: var(--surface-hi);
  border: 1px solid var(--border);
  gap: 6px;
  flex-shrink: 0;
}

.fbd-selected-tag-name {
  font-size: 13px;
  font-weight: 400;
  color: var(--text);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fbd-selected-tag-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-faint);
  font-size: 14px;
  line-height: 1;
  padding: 0;
  flex-shrink: 0;
  transition: color 100ms ease;
}
.fbd-selected-tag-remove:hover { color: var(--text); }

/* Row added animation */
@keyframes fbd-row-added {
  0%   { background-color: #f2f8f3; }
  65%  { background-color: #f2f8f3; }
  100% { background-color: transparent; }
}

.fbd-row--added { animation: fbd-row-added 700ms ease forwards; }

/* Step 3 — two-column table picker (legacy, kept for reference) */
.fbd-picker-layout {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 24px;
  align-items: start;
}

.fbd-filters-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 0;
}

.fbd-filters-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 6px;
}

/* Group toggle rows */
.fbd-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 4px;
  cursor: pointer;
  border-radius: 6px;
  transition: background 100ms ease;
}
.fbd-toggle-row:hover { background: var(--surface-hi); }

.fbd-toggle-label {
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  color: var(--text);
  user-select: none;
}

/* ─── Checkbox row (replaces toggle) ─────────────────────────── */
.fbd-checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 4px;
  cursor: pointer;
  border-radius: 6px;
  transition: background 100ms ease;
}
.fbd-checkbox-row:hover { background: var(--surface-hi); }

.fbd-checkbox-row input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--text);
  cursor: pointer;
  flex-shrink: 0;
  margin: 0;
}

.fbd-checkbox-label {
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  color: var(--text);
  user-select: none;
}

/* TODO: remove once toggle fully replaced */
/* iOS-style toggle switch */
.fbd-toggle-switch {
  position: relative;
  width: 34px;
  height: 20px;
  flex-shrink: 0;
}
.fbd-toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}
.fbd-toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border-hi);
  border-radius: 20px;
  cursor: pointer;
  transition: background 180ms ease;
}
.fbd-toggle-slider::before {
  content: '';
  position: absolute;
  left: 2px;
  top: 2px;
  width: 16px;
  height: 16px;
  background: var(--surface);
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.18);
  transition: transform 180ms ease;
}
.fbd-toggle-switch input:checked + .fbd-toggle-slider { background: var(--text); }
.fbd-toggle-switch input:checked + .fbd-toggle-slider::before { transform: translateX(14px); }

/* ─── Groups editor modal ─────────────────────────────────────── */
.groups-editor-modal { max-height: 80vh; }
.paste-modal.groups-editor-modal { width: min(860px, 94vw); }

.groups-editor-body {
  padding: 20px;
  overflow-y: auto;
}
.groups-editor-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

/* Shared grid template — header and every data row use the same columns */
.groups-editor-header,
.groups-editor-row {
  display: grid;
  grid-template-columns: 40px 1.5fr 2fr 1fr 120px 40px;
  column-gap: 10px;
  align-items: center;
  padding: 8px 12px;
}

/* Table container */
.groups-editor-list {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

/* Header row */
.groups-editor-header {
  background: var(--surface-hi);
  border-bottom: 1px solid var(--border);
}
.groups-editor-header-cell {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

/* Data rows */
.groups-editor-row { border-bottom: 1px solid var(--border); }
.groups-editor-row:last-child { border-bottom: none; }
.groups-editor-row.dragging { opacity: 0.4; }
.groups-editor-row.drag-over {
  background: var(--surface-hi);
  outline: 2px solid #0f0f0f;
  outline-offset: -2px;
}

/* Grid cell contents */
.groups-editor-handle {
  font-size: 16px;
  color: var(--text-muted);
  cursor: grab;
  user-select: none;
  line-height: 1;
  justify-self: center;
}
.groups-editor-handle:active { cursor: grabbing; }

.groups-editor-name-input { width: 100%; }

.groups-editor-import-text {
  font-size: 0.875rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Farve column: custom color picker */
.groups-editor-farve-wrap {
  min-width: 0;
}
.groups-editor-color-dot {
  width: 13px;
  height: 13px;
  border-radius: 3px;
  border: 1px solid rgba(0,0,0,0.14);
  background: #e5e7eb;
  flex-shrink: 0;
}
.groups-editor-color-dot[data-color-idx="0"] { background: #7dc895; }
.groups-editor-color-dot[data-color-idx="1"] { background: #f29490; }
.groups-editor-color-dot[data-color-idx="2"] { background: #a8a8a8; }
.groups-editor-color-dot[data-color-idx="3"] { background: #ffffff; }
.groups-editor-color-dot[data-color-idx="4"] { background: #7ab5f0; }
.groups-editor-color-dot[data-color-idx="5"] { background: #b492f0; }
.groups-editor-color-dot[data-color-idx="6"] { background: #f0cc60; }

.groups-editor-color-trigger {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  background: var(--surface-hi);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem;
  font-weight: 400;
  cursor: pointer;
  text-align: left;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.groups-editor-color-trigger:focus {
  border-color: var(--text);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(0,0,0,0.06);
}
.groups-editor-color-trigger-label {
  flex: 1;
  min-width: 0;
}
.groups-editor-color-chevron {
  flex-shrink: 0;
  color: var(--text-muted);
  display: flex;
  align-items: center;
}
.groups-editor-color-dropdown {
  z-index: 500;
}
.groups-editor-color-item {
  gap: 8px;
  justify-content: flex-start;
}

.groups-editor-count {
  font-size: 0.875rem;
  color: var(--text-muted);
  white-space: nowrap;
}
.groups-editor-del {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  line-height: 1;
  justify-self: center;
  display: flex;
  align-items: center;
}
.groups-editor-del:hover { color: #c0392b; }
.groups-editor-empty {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  padding: 12px 0;
}
/* Two-class selector beats .paste-modal-footer alone */
.paste-modal-footer.groups-editor-footer { justify-content: flex-start; gap: 8px; }

.fbd-table-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.fbd-table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 16px;
}

.fbd-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
}

.fbd-th-name { width: 42%; }
.fbd-th-group { /* takes remaining width */ }

.fbd-table thead tr {
  border-bottom: 1px solid var(--border);
}

.fbd-table thead th {
  padding: 8px 12px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-faint);
  text-align: left;
}

.fbd-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 100ms ease;
}

.fbd-table tbody tr:last-child { border-bottom: none; }

.fbd-table tbody tr:hover { background: var(--surface-hi); }

.fbd-table-name {
  padding: 8px 12px;
  color: var(--text);
  font-weight: 400;
  vertical-align: middle;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fbd-table-action {
  padding: 6px 4px 6px 10px;
  text-align: left;
  width: 36px;
  vertical-align: middle;
}

.fbd-table-group {
  padding: 6px 12px;
  vertical-align: middle;
  text-align: right;
}

.fbd-th-group {
  text-align: right !important;
}

.fbd-th-add { width: 36px; }

.fbd-table-name--custom { color: var(--text-muted); font-style: normal; }
.fbd-table-name--custom em { font-style: normal; font-weight: 600; color: var(--text); }

.fbd-table-empty {
  padding: 20px 12px;
  text-align: center;
  color: var(--text-faint);
  font-size: 13px;
}

.fbd-add-btn {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 100ms ease, border-color 100ms ease;
}

.fbd-add-btn:hover:not(:disabled) {
  background: var(--text);
  color: var(--surface);
  border-color: var(--text);
}

.fbd-add-btn:disabled {
  opacity: 0.25;
  cursor: not-allowed;
}

.fbd-table-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
}


/* Selected tags */
.fbd-picker-tags-wrap {
  padding-top: 4px;
}

.fbd-picker-tags-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 8px;
}

.fbd-picker-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.fbd-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 6px 3px 9px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 12px;
  line-height: 1;
}

.fbd-tag-name {
  font-weight: 500;
  color: var(--text);
}

.fbd-tag-remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  border: none;
  background: none;
  color: var(--text-faint);
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  border-radius: 50%;
  padding: 0;
  transition: background 100ms ease, color 100ms ease;
}

.fbd-tag-remove:hover {
  background: var(--surface-hi);
  color: var(--text);
}

/* Panel title row — heading + right-aligned action in a column */
.panel-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Save confirmation toast text in Trup modal footer */
.trup-saved-confirm {
  font-size: 13px;
  color: var(--text-muted);
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
}

/* Footer */
.fbd-footer {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 24px 24px;
}

.fbd-footer-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.fbd-footer-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.fbd-import-status {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.fbd-footer-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ─── Paste modal (stacked on FBD dialog) ───────────────────── */
.paste-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 401;
}

.paste-modal-overlay[hidden] { display: none !important; }

.paste-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.14), 0 2px 8px rgba(0, 0, 0, 0.06);
  width: min(480px, 92vw);
  max-height: min(80vh, 660px);
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow: hidden;
}

.paste-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 0;
}

.paste-modal-title {
  font-family: 'Sora', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.paste-modal-close {
  position: static;
}

.paste-modal-body {
  padding: 14px 20px 0;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.paste-modal-textarea {
  min-height: 180px;
  max-height: 320px;
}

.paste-modal-hint {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin: 6px 0 0;
  text-align: right;
}

.paste-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  padding: 14px 20px 20px;
}

.fbd-paste-area {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 0 0;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  margin-top: 4px;
}

.fbd-paste-input {
  width: 100%;
  min-height: 100px;
  max-height: 180px;
  resize: vertical;
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  outline: none;
  box-sizing: border-box;
  transition: border-color 150ms ease;
}

.fbd-paste-input:focus {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

.fbd-paste-input::placeholder {
  color: var(--text-muted);
}

.fbd-paste-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

/* ─── Rich tooltip ──────────────────────────────────────────── */
.rich-tooltip {
  position: fixed;
  z-index: 9999;
  display: none;
  flex-direction: row;
  align-items: flex-start;
  gap: 10px;
  width: 240px;
  background: var(--surface);
  border: 1px solid rgba(0, 0, 0, 0.07);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.10), 0 2px 6px rgba(0, 0, 0, 0.06);
  padding: 12px 14px;
  pointer-events: none;
  opacity: 0;
  transform: translateY(5px);
  transition: opacity 140ms ease, transform 140ms ease;
}

.rich-tooltip--visible {
  opacity: 1;
  transform: translateY(0);
}

/* Arrow — default: below tooltip (pointing down toward trigger) */
.rich-tooltip::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: var(--arrow-x, 50%);
  transform: translateX(-50%) rotate(45deg);
  width: 8px;
  height: 8px;
  background: var(--surface);
  border-right: 1px solid rgba(0, 0, 0, 0.07);
  border-bottom: 1px solid rgba(0, 0, 0, 0.07);
}

/* Flipped: tooltip is below the trigger — arrow points up */
.rich-tooltip--below {
  transform: translateY(-5px);
}
.rich-tooltip--below.rich-tooltip--visible {
  transform: translateY(0);
}
.rich-tooltip--below::after {
  bottom: auto;
  top: -5px;
  border-right: none;
  border-bottom: none;
  border-left: 1px solid rgba(0, 0, 0, 0.07);
  border-top: 1px solid rgba(0, 0, 0, 0.07);
}

.rich-tooltip-icon-wrap {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 4px;
  background: rgba(37, 99, 235, 0.08);
  color: #2563eb;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rich-tooltip-text {
  flex: 1;
  min-width: 0;
}

.rich-tooltip-title {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 3px;
  line-height: 1.3;
}

.rich-tooltip-desc {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.45;
}

.fbd-btn {
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.18s ease-out, color 0.18s ease-out;
}

.fbd-btn--primary          { background: var(--text); color: var(--surface); }
.fbd-btn--primary:hover    { background: #2a2a2a; }
.fbd-btn--primary:disabled { background: var(--surface-hi); color: var(--text-faint); cursor: not-allowed; }

.fbd-btn--secondary          { background: var(--surface-hi); color: var(--text); border-color: var(--border); }
.fbd-btn--secondary:hover    { background: var(--border); }

.fbd-btn--ghost       { background: none; color: var(--text-faint); }
.fbd-btn--ghost:hover { color: var(--text); }

.fbd-btn--danger       { background: transparent; color: #c0392b; border-color: #c0392b; }
.fbd-btn--danger:hover { background: #c0392b; color: #fff; }

/* ─── Export dialog ─────────────────────────────────────────── */
.export-dialog {
  background: #123928;
}

.export-dialog .modal-rich__content {
  background: var(--surface);
}

.export-preview-panel {
  background: #123928;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Credit-card shine overlay */
.export-preview-panel::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at var(--shine-x, 50%) var(--shine-y, 30%),
    rgba(255,255,255,0.18) 0%,
    rgba(255,255,255,0.06) 30%,
    transparent 65%
  );
  pointer-events: none;
  transition: background 0.08s ease-out;
}

.export-preview-panel img {
  width: 88%;
  height: auto;
  max-height: 88%;
  object-fit: contain;
  display: block;
  transform: perspective(900px) rotateX(var(--tilt-x, 0deg)) rotateY(var(--tilt-y, 0deg));
  transition: transform 0.12s ease-out, opacity 3s ease;
  will-change: transform;
  border-radius: 6px;
  opacity: 0;
}

.export-preview-panel img.is-visible {
  opacity: 1;
}

.export-preview-skeleton {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    var(--surface-hi) 0%,
    var(--border) 50%,
    var(--surface-hi) 100%
  );
  background-size: 200% 100%;
  animation: skeleton-sweep 1.4s ease-in-out infinite;
}

@keyframes skeleton-sweep {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.export-dialog-body {
  padding: 16px 24px 8px;
}

.export-helper-text {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0 0 12px;
}

.export-match-input {
  width: 100%;
  box-sizing: border-box;
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 15px;
  font-weight: 400;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.15s;
}

.export-match-input:focus {
  border-color: var(--text);
}

/* ─── Export canvas (off-screen render target) ──────────────── */
#export-canvas {
  position: fixed;
  left: -9999px;
  top: 0;
}

.ec-wrap {
  width: 520px;
  background: #ffffff;
  padding: 28px 0 24px;
  font-family: 'DM Sans', system-ui, sans-serif;
  overflow: visible;
}

.ec-header {
  padding: 0 60px;
  margin-bottom: 12px;
}

.ec-match-title {
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: #0f0f0f;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

/* 60px horizontal + 24px vertical safe zone keeps all player nodes
   and name labels within the capture element's physical dimensions */
.ec-pitch-wrap {
  padding: 24px 60px;
  overflow: visible;
}

.ec-bench {
  padding: 0 60px;
  margin-top: 8px;
  text-align: left;
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 400;
  color: #6b7280;
  letter-spacing: 0.01em;
}

/* ─── Roster screen (sidebar) ─────────────────────────────────── */
.roster-screen {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 100%;
}

.roster-screen-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 0;
  gap: 8px;
}

.roster-screen-back {
  display: flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  padding: 4px 0;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: color 0.15s;
}
.roster-screen-back:hover { color: var(--text); }

.roster-screen-title {
  font-family: 'Sora', sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.roster-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.roster-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 16px;
  gap: 8px;
  cursor: pointer;
  border-radius: 0;
  transition: background 0.12s;
  outline: none;
}
.roster-row:hover  { background: var(--surface-hi); }
.roster-row:focus  { background: var(--surface-hi); }
.roster-row:active { background: #ebebea; }

.roster-row-name {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.roster-row-shirt {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text-faint);
}

/* "Trup" button at bottom of lineup sidebar */
.sidebar-trup-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 8px 16px 0;
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.04);
  border: none;
  border-radius: 4px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.sidebar-trup-btn:hover {
  background: rgba(0, 0, 0, 0.07);
  color: var(--text);
}

/* Add player button */
.roster-add-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: calc(100% - 32px);
  margin: 8px 16px 16px;
  padding: 9px 14px;
  background: var(--text);
  color: #fff;
  border: none;
  border-radius: 4px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}
.roster-add-btn:hover { opacity: 0.85; }

/* ─── Trup modal: right edit column ───────────────────────────── */
.trup-col-edit {
  width: 300px;
}

.trup-edit-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.trup-col-edit .roster-edit-form {
  flex: none;
  overflow-y: visible;
  padding: 12px 0;
}

.trup-edit-footer {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}

.trup-edit-footer-btns {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 40px 24px;
  text-align: center;
}

.empty-icon {
  font-size: 28px;
  margin-bottom: 4px;
}

.empty-heading {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.empty-desc {
  font-size: 13px;
  color: var(--text-muted);
  max-width: 240px;
  line-height: 1.5;
}

.trup-list-empty {
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  color: var(--text-faint);
  text-align: center;
  padding: 24px 16px;
}

.trup-shirt-cell {
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  color: var(--text-faint);
  white-space: nowrap;
}

.fbd-table tbody tr.trup-row--active td {
  background: rgba(0, 0, 0, 0.04);
}

@keyframes trup-card-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes trup-card-out {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(6px); }
}

.trup-edit-card.trup-edit-card--out {
  animation: trup-card-out 0.14s ease forwards;
  pointer-events: none;
}

.trup-edit-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: trup-card-in 0.14s ease;
}

.trup-confirm-panel {
  max-width: 340px;
}

.trup-confirm-msg {
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  color: var(--text);
  padding: 6px 0 10px;
  margin: 0;
  line-height: 1.5;
}

.trup-edit-card .roster-edit-form {
  padding: 0;
  overflow-y: visible;
  flex: none;
}

.trup-card-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.trup-add-error {
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  color: #c0392b;
  margin: 0 0 4px;
}

.backup-desc {
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  color: var(--text-secondary, #6e6e73);
  line-height: 1.5;
  margin: 0 0 4px;
}

.backup-cloud-section {
  margin-bottom: 4px;
}

.backup-cloud-label {
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 4px;
}

.backup-cloud-label--synced {
  color: var(--text-muted);
  font-weight: 500;
}

.backup-divider {
  border-top: 1px solid var(--border);
  margin: 16px 0;
}

/* ─── Roster editor shared ─────────────────────────────────────── */
.roster-editor-title {
  font-family: 'Sora', sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
}

.roster-edit-form {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.roster-edit-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.roster-field-auto-hint {
  font-size: 0.72rem;
  color: var(--text-faint);
  margin-top: 2px;
}

.roster-edit-label {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.roster-edit-input,
.roster-edit-select,
.roster-edit-textarea {
  width: 100%;
  background: var(--surface-hi);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem;
  font-weight: 400;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.roster-edit-input:focus,
.roster-edit-select:focus,
.roster-edit-textarea:focus {
  border-color: var(--text);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(0,0,0,0.06);
}
.roster-edit-textarea { resize: vertical; min-height: 64px; }
.roster-edit-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
  cursor: pointer;
}

.roster-editor-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  gap: 8px;
}

.roster-editor-footer-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.roster-delete-btn {
  background: none;
  border: none;
  padding: 0;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  color: #c0392b;
  cursor: pointer;
  transition: opacity 0.15s;
}
.roster-delete-btn:hover { opacity: 0.75; }
