:root {
  --bg: #f5f7fb;
  --panel: rgba(255, 255, 255, .86);
  --text: #111827;
  --muted: #64748b;
  --border: rgba(15, 23, 42, .12);
  --shadow: 0 20px 58px rgba(15, 23, 42, .14);
  --active: #2563eb;
  --primary: #2563eb;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; min-height: 100vh; background: var(--bg); color: var(--text); font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
body { display: grid; grid-template-columns: minmax(360px, 430px) minmax(0, 1fr); height: 100vh; min-height: 100vh; }
button, input, textarea, a { font: inherit; }
button { cursor: pointer; }
.mobile-menu-btn { display: none; }

.gm-sidebar { height: 100vh; min-height: 0; display: flex; flex-direction: column; overflow: auto; padding: 18px; background: linear-gradient(180deg, rgba(255,255,255,.92), rgba(248,250,252,.92)); border-right: 1px solid var(--border); }
.gm-header { padding: 18px 4px 14px; }
.gm-header p { margin: 0 0 6px; color: var(--active); font-weight: 900; text-transform: uppercase; letter-spacing: .06em; font-size: .75rem; }
.gm-header h1 { margin: 0; font-size: clamp(2rem, 4vw, 3.4rem); line-height: .96; letter-spacing: -.05em; }
.gm-header span { display: block; margin-top: 12px; color: var(--muted); line-height: 1.45; }

.gm-card, .gm-bottom > div { border: 1px solid rgba(255,255,255,.8); border-radius: 24px; background: var(--panel); box-shadow: var(--shadow); backdrop-filter: blur(20px) saturate(1.15); padding: 16px; margin-bottom: 14px; }
.gm-card h2, .gm-bottom h2 { margin: 0 0 12px; font-size: 1.15rem; letter-spacing: -.03em; }
.gm-help { margin: 10px 0 0; color: var(--muted); font-size: .9rem; line-height: 1.45; }
.template-list { display: grid; gap: 8px; }
.template-item { display: grid; grid-template-columns: 7px minmax(0, 1fr); gap: 10px; align-items: stretch; width: 100%; min-height: 66px; border: 1px solid var(--border); border-radius: 16px; background: rgba(255,255,255,.75); color: var(--text); padding: 0; overflow: hidden; cursor: pointer; text-align: left; }
.template-item::before { content: ""; background: var(--task-color); }
.template-item.active { border-color: var(--task-color); box-shadow: 0 12px 26px color-mix(in srgb, var(--task-color) 18%, transparent); }
.template-item:active { cursor: grabbing; }
.template-item span { display: grid; gap: 3px; padding: 10px 10px 10px 0; }
.template-item strong { font-size: .94rem; }
.template-item small { color: var(--muted); line-height: 1.25; }
.template-item em { color: var(--task-color); font-style: normal; font-size: .72rem; font-weight: 900; text-transform: uppercase; letter-spacing: .05em; }

.task-form, .game-settings { display: grid; gap: 10px; }
.address-search { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; margin-bottom: 12px; }
.address-search input { min-width: 0; border: 1px solid var(--border); border-radius: 13px; background: rgba(248,250,252,.94); color: var(--text); padding: 10px 11px; outline: none; }
.address-search button { border: 1px solid var(--active); border-radius: 13px; background: var(--active); color: #fff; padding: 9px 12px; font-weight: 900; cursor: pointer; }
.task-form label, .game-settings label { display: grid; gap: 6px; color: #334155; font-size: .84rem; font-weight: 800; }
.task-form input, .task-form textarea, .game-settings input { width: 100%; border: 1px solid var(--border); border-radius: 13px; background: rgba(248,250,252,.94); color: var(--text); padding: 10px 11px; outline: none; }
.task-form input:focus, .task-form textarea:focus, .game-settings input:focus { border-color: var(--active); box-shadow: 0 0 0 4px rgba(37,99,235,.12); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.check-row { display: flex !important; grid-template-columns: none; align-items: center; gap: 8px; }
.check-row input { width: auto; }

.gm-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.gm-actions button, .gm-actions a { min-height: 40px; padding: 9px 12px; border: 1px solid var(--border); border-radius: 13px; background: #fff; color: var(--text); text-decoration: none; font-weight: 900; cursor: pointer; }
.gm-actions button:first-child { background: var(--active); border-color: var(--active); color: #fff; }

.gm-main { min-width: 0; min-height: 100vh; height: 100vh; display: grid; grid-template-rows: minmax(420px, 56vh) minmax(0, 1fr); }
#gm-map { min-height: 420px; }
.map-drop-hint { position: fixed; top: 22px; left: 50%; z-index: 1200; transform: translateX(-50%); padding: 12px 16px; border: 1px solid rgba(255,255,255,.9); border-radius: 999px; background: rgba(17,24,39,.9); color: #fff; box-shadow: var(--shadow); font-weight: 900; pointer-events: none; }
.drag-marker-preview { position: fixed; z-index: 1500; width: 30px; height: 30px; pointer-events: none; transform: translate(-15px, -30px); }
.drag-marker-preview::before { content: ""; position: absolute; inset: 0; transform: rotate(45deg); border-radius: 50% 50% 50% 6px; background: var(--task-color, var(--active)); border: 3px solid #fff; box-shadow: 0 12px 30px rgba(15,23,42,.34); }
.gm-bottom { display: flex; gap: 14px; padding: 14px; overflow: auto; align-items: stretch; height: 100%; min-height: 0; }
.tasks-column { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; }
.tasks-column h2 { flex-shrink: 0; }
.created-list { flex: 1; max-height: 520px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding-right: 4px; }

.side-panels {
  display: flex;
  flex-direction: row;
  gap: 14px;
  align-items: stretch;
  flex-shrink: 0;
  z-index: 10;
}

.panel-icons-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 56px;
  min-width: 56px;
  flex-shrink: 0;
}

/* Kolumna z ikonami zawsze w tej samej pozycji */
.panel-icons-col .panel-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: #111827;
  color: #fff;
  font-weight: 900;
  cursor: pointer;
  transition: background .2s, color .2s;
}
.panel-icons-col .panel-icon.active {
  background: var(--active);
  color: #fff;
}

/* Panele z treścią obok ikony */
.side-panels .panel-content {
  width: min(520px, 38vw);
  max-width: 90vw;
  height: auto;
  overflow-y: auto;
  background: var(--panel);
  border-radius: 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  backdrop-filter: blur(20px) saturate(1.15);
  padding: 16px;
  z-index: 20;
  display: none;
  animation: panel-slide-in .22s cubic-bezier(.4,1.2,.4,1);
}
.side-panels .panel-content.active {
  display: block;
}

@keyframes panel-slide-in {
  from { transform: translateX(20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.close-panel-btn,
.expand-panel-btn {
  width: 42px;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(248,250,252,.94);
  color: var(--text);
  font-size: 1.35rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
}
.close-panel-btn:hover,
.expand-panel-btn:hover {
  background: #e2e8f0;
}
/* Ikony w side-panels zawsze wyrównane */
.side-panels > div > header > button,
.side-panels > div > header > .icon-btn {
  align-self: flex-start;
  margin-top: 0;
}
/* Wyrównanie ikon w pionie niezależnie od rozwinięcia */
.side-panels > div > header {
  display: flex;
  align-items: center;
  gap: 10px;
}
.side-panels > div.collapsed > header > * {
  opacity: 0.7;
}
.created-list { display: grid; gap: 8px; }
.created-task { display: grid; grid-template-columns: 7px minmax(0, 1fr) auto auto; gap: 10px; align-items: center; border: 1px solid var(--border); border-radius: 16px; background: rgba(255,255,255,.8); overflow: hidden; min-height: 72px; }
.created-task::before { content: ""; align-self: stretch; background: var(--task-color); }
.created-task span { padding: 10px 0; }
.created-task strong, .created-task small { display: block; }
.created-task small { color: var(--muted); }
.created-task button { margin-right: 8px; border: 1px solid var(--border); border-radius: 10px; background: #fff; min-height: 34px; cursor: pointer; }
#export-output { width: 100%; border: 1px solid var(--border); border-radius: 14px; background: #0f172a; color: #dbeafe; padding: 12px; font-family: Consolas, monospace; }
.export-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.export-head h2 { margin: 0; }
.export-head span { display: block; margin-top: 3px; color: var(--muted); font-size: .8rem; font-weight: 800; }
.config-body { display: grid; gap: 14px; }
.file-tools { display: grid; gap: 9px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.file-tools h3 { margin: 0; font-size: 1rem; letter-spacing: -.02em; }
.preview-link { display: inline-flex; justify-content: center; align-items: center; min-height: 40px; padding: 9px 12px; border: 1px solid var(--border); border-radius: 13px; background: #fff; color: var(--text); text-decoration: none; font-weight: 900; }
.agenda-editor { display: grid; gap: 9px; }
.agenda-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.agenda-head h3 { margin: 0; font-size: 1rem; letter-spacing: -.02em; }
.agenda-head button { min-height: 34px; border: 1px solid var(--border); border-radius: 11px; background: #fff; color: var(--text); font-weight: 900; }
.agenda-list { display: grid; gap: 8px; }
.agenda-row { display: grid; grid-template-columns: 76px minmax(0, 1fr) minmax(0, .8fr) auto; gap: 8px; align-items: center; padding: 8px; border: 1px solid var(--border); border-radius: 14px; background: rgba(255,255,255,.72); }
.agenda-row input { min-width: 0; border: 1px solid var(--border); border-radius: 11px; background: rgba(248,250,252,.94); color: var(--text); padding: 9px 10px; outline: none; }
.agenda-row button { width: 34px; height: 34px; border: 1px solid var(--border); border-radius: 10px; background: #fff; color: #dc2626; font-weight: 900; }
.saved-games-list { display: grid; gap: 7px; margin-top: 10px; }
.saved-game { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; align-items: center; padding: 9px 10px; border: 1px solid var(--border); border-radius: 13px; background: rgba(255,255,255,.72); color: var(--muted); font-size: .82rem; font-weight: 800; }
.saved-game strong, .saved-game span { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.saved-game button { min-height: 32px; border: 1px solid var(--border); border-radius: 10px; background: #fff; color: var(--text); font-weight: 900; }
.monitor-body { display: grid; gap: 12px; }
.monitor-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.monitor-summary div { padding: 10px; border: 1px solid var(--border); border-radius: 14px; background: rgba(248,250,252,.9); text-align: center; }
.monitor-summary strong { display: block; font-size: 1.15rem; }
.monitor-summary span { color: var(--muted); font-size: .72rem; font-weight: 800; }
.team-progress-list { display: grid; gap: 9px; }
.team-progress { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--border); border-left: 6px solid var(--team-color); border-radius: 16px; background: rgba(255,255,255,.78); }
.team-progress header { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.team-progress header span { color: var(--muted); font-size: .78rem; font-weight: 800; white-space: nowrap; }
.progress-bar { height: 9px; overflow: hidden; border-radius: 999px; background: rgba(15,23,42,.08); }
.progress-bar i { display: block; height: 100%; border-radius: inherit; background: var(--team-color); }
.progress-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; color: #334155; font-size: .78rem; font-weight: 900; }

.leaflet-control-zoom { border: 0 !important; box-shadow: var(--shadow) !important; }
.leaflet-control-zoom a { border: 1px solid rgba(255,255,255,.8) !important; background: rgba(255,255,255,.94) !important; color: #0f172a !important; }
.gm-marker { width: 30px; height: 30px; transform: rotate(-45deg); border-radius: 50% 50% 50% 2px; background: var(--task-color); border: 3px solid #fff; box-shadow: 0 8px 22px rgba(15,23,42,.28); }
.gm-marker-popup { display: grid; gap: 6px; min-width: 170px; }
.gm-marker-popup strong { font-size: .98rem; }
.gm-marker-popup span { color: var(--muted); font-size: .82rem; font-weight: 800; }
.gm-marker-popup button { min-height: 34px; border: 0; border-radius: 10px; background: #111827; color: #fff; font-weight: 900; }

.gm-modal { position: fixed; inset: 0; z-index: 3000; display: grid; place-items: center; padding: 22px; background: rgba(15,23,42,.36); backdrop-filter: blur(8px); }
.gm-modal[hidden] { display: none; }
.gm-modal-card { width: min(760px, 100%); max-height: min(860px, 92vh); overflow: auto; border: 1px solid rgba(255,255,255,.82); border-radius: 28px; background: rgba(255,255,255,.96); box-shadow: 0 30px 90px rgba(15,23,42,.25); padding: 20px; }
.gm-modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 16px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.gm-modal-head p { margin: 0 0 4px; color: var(--task-color); font-size: .75rem; font-weight: 900; text-transform: uppercase; letter-spacing: .06em; }
.gm-modal-head h2 { margin: 0; font-size: clamp(1.7rem, 3vw, 2.4rem); letter-spacing: -.05em; }
.gm-modal-head button { display: grid; place-items: center; width: 42px; height: 42px; border: 1px solid var(--border); border-radius: 14px; background: rgba(248,250,252,.94); color: var(--text); font-size: 1.35rem; font-weight: 900; }
.modal-fields { display: grid; gap: 11px; }
.modal-fields label { display: grid; gap: 6px; color: #334155; font-size: .86rem; font-weight: 900; }
.modal-fields input, .modal-fields textarea { width: 100%; border: 1px solid var(--border); border-radius: 14px; background: rgba(248,250,252,.94); color: var(--text); padding: 11px 12px; outline: none; }
.modal-fields input:focus, .modal-fields textarea:focus { border-color: var(--task-color); box-shadow: 0 0 0 4px color-mix(in srgb, var(--task-color) 16%, transparent); }
.validation-note { margin-top: 4px; padding: 12px 13px; border-left: 5px solid var(--task-color); border-radius: 14px; background: color-mix(in srgb, var(--task-color) 9%, white); color: #334155; line-height: 1.45; }
.gm-modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.gm-modal-actions button { min-height: 44px; padding: 10px 22px; border: 1px solid var(--border); border-radius: 14px; background: #fff; color: var(--text); font-weight: 900; }
.gm-modal-actions button[type="submit"],
.gm-modal-actions button:first-child { border-color: var(--active); background: var(--active); color: #fff; }

/* --- Live Feed Panel --- */
.feed-body {
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.feed-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.03);
  transition: opacity 0.3s;
}
.feed-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.feed-team {
  font-size: 13px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 100px;
  background: var(--surface-hover);
  color: var(--text-base);
}
.badge-alpha { background: #e0f2fe; color: #166534; }
.badge-beta { background: #fee2e2; color: #991b1b; }
.badge-gamma { background: #fef9c3; color: #854d0e; }

.feed-time {
  font-size: 12px;
  color: var(--text-muted);
}
.feed-task-name {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 12px 0;
  line-height: 1.4;
}
.feed-media {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 16px;
  aspect-ratio: 16/9;
  background: var(--surface);
}
.feed-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.play-overlay {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 48px; height: 48px;
  background: rgba(0,0,0,0.6);
  color: white;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  backdrop-filter: blur(4px);
}
.feed-actions {
  display: flex;
  gap: 8px;
}
.feed-btn {
  flex: 1;
  padding: 8px 0;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.feed-btn.accept {
  background: var(--primary);
  color: white;
}
.feed-btn.accept:hover { background: #0f172a; }
.feed-btn.reject {
  background: var(--surface-hover);
  color: var(--text-base);
}
.feed-btn.reject:hover { background: #e2e8f0; }

/* --- Live Tracking Markers --- */
.live-tracking-marker {
  transition: transform 2s linear;
}
.team-avatar {
  width: 36px;
  height: 36px;
  background: var(--team-color, #2563eb);
  color: white;
  border-radius: 50%;
  border: 3px solid white;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 16px;
}

@media (max-width: 900px) {
  body { grid-template-columns: 1fr; }

  .mobile-menu-btn {
    display: block;
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 2100;
    width: 44px;
    height: 44px;
    background: #111827;
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: var(--shadow);
  }

  .gm-sidebar {
    position: fixed;
    top: 0;
    left: -100%;
    width: 320px;
    max-width: 85vw;
    height: 100vh;
    z-index: 2050;
    transition: left 0.3s ease;
    padding-top: 60px;
  }

  .gm-sidebar.active {
    left: 0;
    box-shadow: 20px 0 50px rgba(0,0,0,0.5);
  }

  .gm-main { min-height: 70vh; height: auto; }
  .gm-bottom { flex-direction: column; padding-bottom: 100px; overflow: visible; }

  .side-panels { 
    position: fixed; 
    bottom: 0; 
    left: 0; 
    right: 0; 
    width: 100%; 
    min-width: 0;
    height: auto;
    flex-direction: row; 
    justify-content: center; 
    align-items: center;
    gap: 20px;
    padding: 12px; 
    background: rgba(255, 255, 255, 0.94); 
    backdrop-filter: blur(20px);
    border-top: 1px solid var(--border);
    box-shadow: 0 -10px 40px rgba(15, 23, 42, 0.08);
    z-index: 2000; 
  }

  .panel-icons-col {
    flex-direction: row;
    width: auto;
    justify-content: center;
  }

  .panel-icons-col .panel-icon { 
    margin-bottom: 0; 
    width: 52px;
    height: 52px;
  }

  .side-panels .panel-content {
    position: fixed;
    top: auto;
    bottom: 90px;
    left: 16px;
    right: 16px;
    width: auto;
    max-width: none;
    max-height: 75vh;
    border-radius: 24px;
    animation: panel-slide-up .25s cubic-bezier(.4,1.2,.4,1);
  }

  @keyframes panel-slide-up {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
  }

  .agenda-row { grid-template-columns: 1fr; }
}

.panel-content.panel-fullscreen { position: fixed; top: 20px !important; left: 90px !important; right: 20px !important; bottom: 20px !important; width: auto !important; height: auto !important; max-width: none !important; max-height: none !important; z-index: 9999; }
@media (max-width: 900px) { .panel-content.panel-fullscreen { left: 16px !important; bottom: 90px !important; } }

.toggle-switch { position: relative; display: inline-block; width: 44px; height: 24px; } .toggle-switch input { opacity: 0; width: 0; height: 0; } .toggle-slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #cbd5e1; transition: .3s; border-radius: 24px; } .toggle-slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px; background-color: white; transition: .3s; border-radius: 50%; } .toggle-switch input:checked + .toggle-slider { background-color: var(--active); } .toggle-switch input:checked + .toggle-slider:before { transform: translateX(20px); } .check-row { display: flex; flex-direction: row; align-items: center; gap: 12px; cursor: pointer; padding: 12px; background: var(--bg); border-radius: 12px; border: 1px solid var(--border); margin-top: 8px; font-weight: normal; font-size: 0.95rem; }


.side-panels { z-index: 10000 !important; }

.export-head > div:last-child { display: flex; gap: 8px; align-items: center; }

/* ===== SCENARIO MANAGEMENT REDESIGN ===== */

/* Active scenario card */
.active-scenario-card { background: linear-gradient(135deg, #eff6ff, #dbeafe); border: 1.5px solid #93c5fd; border-radius: 18px; padding: 16px; margin-bottom: 16px; }
.active-scenario-header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.active-scenario-badge { background: var(--active); color: #fff; font-size: .65rem; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; padding: 3px 8px; border-radius: 99px; white-space: nowrap; }
.active-scenario-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-bottom: 10px; font-size: .82rem; color: var(--muted); }
.active-scenario-meta span::before { content: attr(data-label) ': '; font-weight: 700; }
.active-scenario-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

/* Accordion buttons */
.gm-accordion-btn { min-height: 36px; padding: 6px 12px; border: 1.5px solid var(--border); border-radius: 10px; background: #fff; color: var(--text); font-size: .82rem; font-weight: 700; cursor: pointer; transition: all .15s; }
.gm-accordion-btn:hover { border-color: var(--active); color: var(--active); }
.gm-accordion-btn.primary { border-color: var(--active); background: var(--active); color: #fff; }
.gm-accordion-btn.primary:hover { background: #1d4ed8; }
.gm-accordion-btn.open { border-color: var(--active); color: var(--active); background: #eff6ff; }

/* Accordion body */
.gm-accordion-body { margin-top: 14px; padding: 14px; background: rgba(255,255,255,.8); border: 1px solid var(--border); border-radius: 13px; animation: slideDown .15s ease; }
@keyframes slideDown { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }

/* Scenario library */
.scenario-library { margin-bottom: 16px; }
.scenario-library-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.scenario-library-header h3 { margin: 0; font-size: .95rem; }
.btn-new-scenario { min-height: 36px; padding: 6px 16px; border: none; border-radius: 10px; background: var(--active); color: #fff; font-weight: 900; font-size: .85rem; cursor: pointer; }
.btn-new-scenario:hover { background: #1d4ed8; }

/* Search row */
.scenario-search-row { margin-bottom: 10px; }
.scenario-search-row input { width: 100%; padding: 9px 13px; border: 1px solid var(--border); border-radius: 12px; background: #fff; font-size: .88rem; outline: none; }
.scenario-search-row input:focus { border-color: var(--active); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }

/* Scenario cards in library */
.saved-games-list { display: grid; gap: 8px; max-height: 340px; overflow-y: auto; }
.scenario-card { border: 1px solid var(--border); border-radius: 14px; background: #fff; overflow: hidden; transition: box-shadow .15s; }
.scenario-card:hover { box-shadow: 0 4px 18px rgba(15,23,42,.1); }
.scenario-card.is-active { border-color: var(--active); background: #eff6ff; }
.scenario-card-body { padding: 12px 14px; }
.scenario-card-name { font-weight: 800; font-size: .94rem; margin-bottom: 3px; }
.scenario-card-meta { font-size: .78rem; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; }
.scenario-card-source { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding: 2px 7px; border-radius: 99px; }
.scenario-card-source.file { background: #dcfce7; color: #16a34a; }
.scenario-card-source.cloud { background: #dbeafe; color: #1d4ed8; }
.scenario-card-actions { display: flex; border-top: 1px solid var(--border); }
.scenario-card-actions button { flex: 1; padding: 8px 4px; font-size: .78rem; font-weight: 700; border: none; background: transparent; cursor: pointer; color: var(--muted); transition: all .1s; }
.scenario-card-actions button:hover { background: #f8fafc; color: var(--text); }
.scenario-card-actions button:not(:last-child) { border-right: 1px solid var(--border); }
.scenario-card-actions .btn-load { color: var(--active); }
.scenario-card-actions .btn-load:hover { background: #eff6ff; }
.scenario-card-actions .btn-dup { color: #b45309; }
.scenario-card-actions .btn-dup:hover { background: #fef9c3; }
.scenario-card-actions .btn-delete { color: #dc2626; }
.scenario-card-actions .btn-delete:hover { background: #fef2f2; }
.scenario-card-actions .btn-export { color: #059669; }
.scenario-card-actions .btn-export:hover { background: #ecfdf5; }

/* File import section */
.file-import-section { padding: 14px; border: 1.5px dashed var(--border); border-radius: 14px; margin-bottom: 14px; }
.file-import-section h3 { margin: 0 0 10px; font-size: .88rem; color: var(--muted); }
.file-import-row { display: flex; align-items: center; gap: 10px; }
.file-import-row button { min-height: 38px; padding: 7px 14px; border: 1px solid var(--border); border-radius: 10px; background: #fff; font-weight: 700; font-size: .84rem; cursor: pointer; }
.file-import-row button:hover { border-color: var(--active); color: var(--active); }
.file-import-hint { font-size: .78rem; color: var(--muted); }

/* PDF download button in monitoring */
.btn-pdf-report { min-height: 40px; padding: 8px 16px; border: none; border-radius: 12px; background: #dc2626; color: #fff; font-weight: 900; font-size: .88rem; cursor: pointer; display: flex; align-items: center; gap: 7px; }
.btn-pdf-report:hover { background: #b91c1c; }
.btn-hard-reset { min-height: 36px; padding: 6px 12px; border: 1px solid #fca5a5; border-radius: 10px; background: #fff; color: #dc2626; font-weight: 700; font-size: .78rem; cursor: pointer; }
.btn-hard-reset:hover { background: #fef2f2; }
/* --- GM CHAT STYLES --- */
.chat-body-wrapper {
  display: grid;
  grid-template-columns: 160px 1fr;
  height: 500px;
  max-height: 70vh;
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  margin-top: 10px;
  background: #fff;
}
.team-threads {
  border-right: 1px solid var(--border);
  background: #f8fafc;
  overflow-y: auto;
}
.team-thread-item {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  font-weight: 700;
  transition: background 0.2s;
}
.team-thread-item:hover {
  background: #eff6ff;
}
.team-thread-item.active {
  background: var(--active);
  color: #fff;
}
.thread-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.active-thread {
  display: flex;
  flex-direction: column;
  background: #fff;
}
.gm-chat-container {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.chat-msg {
  max-width: 85%;
  display: flex;
  flex-direction: column;
}
.msg-me {
  align-self: flex-end;
  align-items: flex-end;
}
.msg-team {
  align-self: flex-start;
  align-items: flex-start;
}
.msg-bubble {
  padding: 8px 12px;
  border-radius: 14px;
  font-size: 0.9rem;
  line-height: 1.4;
}
.msg-me .msg-bubble {
  background: var(--active);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.msg-team .msg-bubble {
  background: #f1f5f9;
  color: var(--text);
  border-bottom-left-radius: 4px;
}
.msg-meta {
  font-size: 0.7rem;
  color: var(--muted);
  margin-top: 3px;
}
.chat-input-area {
  display: flex;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid var(--border);
  background: #f8fafc;
}
.chat-input-area input {
  flex: 1;
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0 12px;
  outline: none;
  font-size: 0.9rem;
}
.chat-input-area button {
  padding: 0 14px;
  border: none;
  border-radius: 10px;
  background: var(--active);
  color: #fff;
  font-weight: 800;
  font-size: 0.85rem;
}
@media (max-width: 900px) {
  .chat-body-wrapper {
    grid-template-columns: 100px 1fr;
  }
}

/* --- TASK CONFIG ACCORDION & TOGGLES --- */
#task-config-form .gm-accordion-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid rgba(0,0,0,0.1);
}
#task-config-form .gm-accordion-btn svg {
  transition: transform 0.2s;
}
#task-config-form .gm-accordion-btn.open svg {
  transform: rotate(180deg);
}
#task-config-form .gm-accordion-body {
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,0.1);
  background: #fff;
  margin-top: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.03);
}
.toggle-switch-wrapper {
  transition: background 0.2s;
}
.toggle-switch-wrapper:hover {
  background: rgba(37,99,235,0.03) !important;
}
