/* ============================================================
   GWM V2 — War Board CSS
   Zone cards · Member chips · Reserve pool · Selection bar
   Notes · Stat bar · Drag-drop · Density modes
   ============================================================ */

/* ── STATUS DOT ──────────────────────────────────────────── */
.sdot {
  width: 8px; height: 8px; border-radius: 50%; flex: none;
  transition: box-shadow .14s;
}
.sdot.ready  { background: var(--ready);  box-shadow: 0 0 7px color-mix(in oklch, var(--ready)  calc(var(--glow)*100%), transparent); }
.sdot.late   { background: var(--late);   box-shadow: 0 0 7px color-mix(in oklch, var(--late)   calc(var(--glow)*100%), transparent); }
.sdot.absent { background: var(--absent); box-shadow: 0 0 7px color-mix(in oklch, var(--absent) calc(var(--glow)*100%), transparent); }
.sdot.leave  { background: var(--leave); }

/* ── CLASS BADGE ─────────────────────────────────────────── */
.cbadge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 7px 2px 5px; border-radius: 6px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
  border: 1px solid color-mix(in oklch, var(--cc, var(--accent)) 28%, transparent);
  background: color-mix(in oklch, var(--cc, var(--accent)) 12%, var(--panel));
  color: color-mix(in oklch, var(--cc, var(--accent)) 60%, var(--fg));
}
.cbadge .glyph {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--cc, var(--accent)); flex: none;
}

/* ── STAT BAR ────────────────────────────────────────────── */
.statbar {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px; margin-bottom: 18px;
}
@media (max-width: 1100px) { .statbar { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 640px)  { .statbar { grid-template-columns: repeat(2, 1fr); } }

.stat {
  background: var(--panel); padding: 13px 15px;
  display: flex; flex-direction: column; gap: 4px;
  border: 1px solid var(--line-soft); border-radius: var(--r);
}
.stat .k {
  font-size: 11px; font-weight: 500; color: var(--fg-3);
  display: flex; align-items: center; gap: 7px; white-space: nowrap;
}
.stat .k svg { width: 12px; height: 12px; }
.stat .v {
  font-family: 'Geist Mono', monospace;
  font-size: 22px; font-weight: 600; color: var(--fg);
  line-height: 1.1; letter-spacing: -0.02em;
}
.stat .v small { font-size: 12px; color: var(--fg-3); font-weight: 500; }
.stat.accent .v { color: var(--accent); }
.stat .bar { height: 4px; border-radius: 2px; background: var(--panel-3); overflow: hidden; margin-top: 6px; }
.stat .bar > i { display: block; height: 100%; border-radius: 2px; }

/* ── BOARD LAYOUT ────────────────────────────────────────── */
.board {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 18px; align-items: start;
}
@media (max-width: 1180px) { .board { grid-template-columns: 1fr; } }

/* Zones header */
.zones-head {
  display: flex; align-items: center; gap: 10px; margin-bottom: 12px;
}
.zones-head .lbl { font-weight: 600; font-size: 13px; color: var(--fg-2); }
.zones-head .line { flex: 1; height: 1px; background: var(--line-soft); }

/* Zone grid */
.zone-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 12px;
}

/* ── ZONE CARD ───────────────────────────────────────────── */
.zone {
  background: var(--panel); border: 1px solid var(--line-soft);
  border-radius: var(--r); overflow: hidden;
  display: flex; flex-direction: column;
  transition: border-color .14s, box-shadow .14s;
}
.zone.drop {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 0 20px color-mix(in oklch, var(--accent) 15%, transparent);
}

/* Zone header */
.zone-top {
  display: flex; align-items: center; gap: 9px;
  padding: 11px 12px; border-bottom: 1px solid var(--line-soft);
}
.zone-type-ico {
  width: 28px; height: 28px; border-radius: var(--r-sm);
  display: grid; place-items: center; flex: none;
  background: color-mix(in oklch, var(--zc, var(--accent)) 16%, var(--panel-2));
  color: color-mix(in oklch, var(--zc, var(--accent)) 70%, var(--fg));
}
.zone-type-ico svg { width: 15px; height: 15px; }
.zone-name {
  font-weight: 600; font-size: 14px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.zone-meta { font-size: 11px; color: var(--fg-3); margin-top: 1px; text-transform: capitalize; }
.zone-cp { margin-left: auto; text-align: right; flex: none; }
.zone-cp .sum { font-family: 'Geist Mono', monospace; font-weight: 600; font-size: 13px; color: var(--gold); }
.zone-cp .avg { font-size: 10.5px; color: var(--fg-3); }
.zone-tools { display: flex; gap: 2px; margin-left: 4px; }
.zone-tools .t {
  width: 26px; height: 26px; border-radius: 7px;
  display: grid; place-items: center; color: var(--fg-3);
  transition: background .12s, color .12s;
}
.zone-tools .t:hover { background: var(--panel-3); color: var(--fg); }
.zone-tools .t svg { width: 14px; height: 14px; }

/* Role count strip */
.rolebar {
  display: flex; gap: 2px; padding: 6px 12px;
  background: var(--bg-deep); border-bottom: 1px solid var(--line-soft);
}
.rolebar .rc {
  flex: 1; display: flex; align-items: center; justify-content: center;
  gap: 5px; font-size: 11px; font-weight: 500; color: var(--fg-3);
}
.rolebar .rc b { color: var(--fg); font-family: 'Geist Mono', monospace; font-weight: 600; }
.rolebar .rc i { width: 7px; height: 7px; border-radius: 2px; display: inline-block; }

/* Zone body */
.zone-body {
  padding: 8px; display: flex; flex-direction: column; gap: 5px; min-height: 64px;
}
/* Prevent child elements from consuming drag events — drop fires on .zone */
.zone-body .zone-empty { pointer-events: none; }
.zone-empty {
  color: var(--fg-3); font-size: 12px; text-align: center;
  padding: 18px 8px; border: 1px dashed var(--line); border-radius: var(--r-sm);
}

/* Zone strategy tags */
.ztags { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 12px 9px; }
.ztag { font-size: 10.5px; color: var(--fg-3); font-weight: 500; }
.ztag b { color: color-mix(in oklch, var(--zc, var(--accent)) 62%, var(--fg)); font-weight: 500; }

/* ── MEMBER CHIP ─────────────────────────────────────────── */
.mchip {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 9px; border-radius: var(--r-sm);
  background: var(--panel-2); border: 1px solid var(--line-soft);
  cursor: grab; position: relative;
  -webkit-user-select: none; -moz-user-select: none; user-select: none;
  -webkit-user-drag: element;
  transition: background .12s, border-color .12s, box-shadow .12s;
}
/* CRITICAL: prevent child elements (SVGs, text spans) from intercepting */
/* native drag events. Without this, Chromium fails to fire dragstart on */
/* the parent .mchip when the user clicks-and-drags on a child. */
.mchip > * { pointer-events: none; }
.mchip:hover { background: var(--panel-3); border-color: var(--line); }
.mchip:active { cursor: grabbing; }
.mchip.sel {
  border-color: var(--accent);
  background: var(--accent-dim);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.mchip.dragging { opacity: 0.35; pointer-events: none; }
.mchip.drag-over { box-shadow: 0 0 0 2px var(--accent); }

.mchip .grip { color: var(--fg-3); opacity: 0; transition: opacity .12s; flex: none; }
.mchip:hover .grip { opacity: 0.5; }
.mchip .grip svg { width: 13px; height: 13px; }

.mchip .mid { display: flex; flex-direction: column; min-width: 0; flex: 1; gap: 3px; }
.mchip .nm  { font-weight: 500; font-size: 13px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mchip .meta { display: flex; align-items: center; gap: 7px; }
.mchip .note { font-size: 10.5px; color: var(--fg-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.mchip .cp  { font-family: 'Geist Mono', monospace; font-size: 11px; color: var(--gold); font-weight: 500; margin-left: auto; flex: none; }
.mchip .warn { color: var(--late); display: grid; place-items: center; }
.mchip .warn svg { width: 14px; height: 14px; }

/* Touch drag ghost */
.touch-ghost {
  position: fixed; z-index: 9999; pointer-events: none; opacity: 0.85;
  transform: scale(1.04) rotate(-1deg);
  box-shadow: 0 12px 30px rgba(0,0,0,.5);
  transition: none;
}

/* ── DENSITY MODES ───────────────────────────────────────── */
[data-density="compact"] .mchip        { padding: 4px 8px; gap: 7px; }
[data-density="compact"] .mchip .nm    { font-size: 12px; }
[data-density="compact"] .zone-body    { gap: 3px; padding: 6px; }
[data-density="compact"] .zone-top     { padding: 8px 12px; }
[data-density="compact"] .stat         { padding: 10px 12px; }
[data-density="compact"] .stat .v      { font-size: 18px; }

/* ── SIDE PANEL ──────────────────────────────────────────── */
.side { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 10px; }

.panel {
  background: var(--panel); border: 1px solid var(--line-soft);
  border-radius: var(--r); overflow: hidden;
}
.panel-head {
  display: flex; align-items: center; gap: 9px;
  padding: 12px 14px; border-bottom: 1px solid var(--line-soft);
}
.panel-head svg { width: 15px; height: 15px; color: var(--fg-3); flex: none; }
.panel-head .ttl { font-weight: 600; font-size: 13px; }
.panel-head .ct  { font-family: 'Geist Mono', monospace; font-size: 12px; color: var(--fg-3); margin-left: auto; }

/* ── RESERVE POOL ────────────────────────────────────────── */
.reserve-tools {
  display: flex; flex-direction: column; gap: 7px; padding: 10px 12px;
  border-bottom: 1px solid var(--line-soft);
}
.search {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-deep); border: 1px solid var(--line-soft);
  border-radius: var(--r-sm); padding: 7px 10px;
  transition: border-color .14s;
}
.search:focus-within { border-color: var(--accent); }
.search svg { width: 14px; height: 14px; color: var(--fg-3); flex: none; }
.search input {
  background: none; border: none; outline: none; color: var(--fg);
  font-size: 13px; width: 100%; padding: 0;
}
.search input::placeholder { color: var(--fg-3); }
.sel-input {
  width: 100%; background: var(--bg-deep); border: 1px solid var(--line-soft);
  border-radius: var(--r-sm); padding: 7px 10px; color: var(--fg); font-size: 13px;
  outline: none; cursor: pointer;
  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='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; padding-right: 32px;
}
.reserve-list {
  display: flex; flex-direction: column; gap: 5px;
  padding: 8px; max-height: 420px; overflow-y: auto;
  transition: background .14s;
}
.reserve-list.drop {
  background: color-mix(in oklch, var(--accent) 8%, var(--panel));
  outline: 1px dashed var(--accent); outline-offset: -4px;
  border-radius: var(--r-sm);
}

/* ── NOTES BOARD ─────────────────────────────────────────── */
.notes-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 10px;
}
.note-card {
  background: color-mix(in oklch, var(--nc, var(--gold)) 14%, var(--panel-2));
  border: 1px solid color-mix(in oklch, var(--nc, var(--gold)) 28%, var(--line-soft));
  border-radius: var(--r-sm); padding: 10px; font-size: 12px; line-height: 1.5;
  color: var(--fg-2); min-height: 60px; position: relative; cursor: text;
  transition: border-color .14s;
}
.note-card:focus { outline: none; border-color: color-mix(in oklch, var(--nc, var(--gold)) 60%, var(--line)); }
.note-card .nx {
  position: absolute; top: 5px; right: 5px; width: 18px; height: 18px;
  border-radius: 4px; display: grid; place-items: center;
  color: var(--fg-3); opacity: 0; transition: opacity .12s, background .12s;
}
.note-card .nx svg { width: 11px; height: 11px; }
.note-card:hover .nx { opacity: 1; }
.note-card .nx:hover { background: color-mix(in oklch, var(--absent) 18%, var(--panel-2)); color: var(--absent); }
.note-add {
  border: 1px dashed var(--line-soft); border-radius: var(--r-sm);
  padding: 10px; font-size: 12px; color: var(--fg-3); cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 60px; transition: border-color .14s, color .14s;
}
.note-add svg { width: 14px; height: 14px; }
.note-add:hover { border-color: var(--accent); color: var(--accent); }

/* ── SELECTION BAR ───────────────────────────────────────── */
.selbar {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  z-index: 200; display: flex; align-items: center; gap: 8px;
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: var(--r); padding: 8px 12px;
  box-shadow: 0 18px 40px -16px rgba(0,0,0,.7);
  animation: selrise .2s cubic-bezier(.34, 1.36, .64, 1);
  white-space: nowrap;
}
@keyframes selrise { from { opacity: 0; transform: translateX(-50%) translateY(10px) scale(.97); } }
.selbar .cnt { font-size: 13px; font-weight: 600; color: var(--fg); }
.selbar .sep { width: 1px; height: 20px; background: var(--line); }

/* Zone picker dropdown inside selbar */
.zone-picker-dd {
  position: absolute; bottom: calc(100% + 8px); left: 0; min-width: 210px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--r);
  padding: 5px; max-height: 280px; overflow-y: auto;
  box-shadow: 0 18px 40px -16px rgba(0,0,0,.7);
  animation: dropIn .12s ease;
}
.zone-picker-item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: var(--r-sm);
  font-size: 13px; color: var(--fg-2); cursor: pointer;
  transition: background .1s;
}
.zone-picker-item:hover { background: var(--panel-3); color: var(--fg); }
.zone-picker-item .zdot { width: 8px; height: 8px; border-radius: 50%; flex: none; }

/* ── FAB STACK ───────────────────────────────────────────── */
.fab-stack {
  position: fixed; right: 18px; bottom: 22px; z-index: 50;
  display: flex; flex-direction: column; gap: 10px;
}
.fab {
  width: 44px; height: 44px; border-radius: var(--r);
  display: grid; place-items: center; color: var(--fg-2);
  background: var(--panel-2); border: 1px solid var(--line);
  box-shadow: 0 10px 24px -14px rgba(0,0,0,.6);
  transition: all .14s;
}
.fab:hover { color: var(--accent); border-color: color-mix(in oklch, var(--accent) 40%, var(--line)); }
.fab svg { width: 19px; height: 19px; }

/* ── ASSIGN MODAL CARDS ──────────────────────────────────── */
.assign-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
}
.assign-card {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-soft);
  background: var(--panel-2);
  cursor: pointer;
  transition: border-color .12s, background .12s, box-shadow .12s;
  user-select: none;
  min-height: 48px;
}
.assign-card:hover {
  border-color: var(--line);
  background: var(--panel-3);
}
.assign-card.pick {
  border-color: var(--accent);
  background: color-mix(in oklch, var(--accent) 14%, var(--panel-2));
  box-shadow: inset 0 0 0 1px var(--accent);
}
.assign-card .chk {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  border: 1.5px solid var(--line);
  background: transparent;
  flex: 0 0 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .12s;
}
.assign-card.pick .chk {
  background: var(--accent);
  border-color: var(--accent);
}
.assign-card .chk svg {
  width: 11px;
  height: 11px;
  color: var(--accent-ink);
}
.assign-card .sdot { flex: 0 0 8px; }
.assign-card .ac-body {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.assign-card .ac-name {
  font-weight: 500;
  font-size: 13px;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.assign-card .ac-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}
.assign-card .ac-cp {
  font-size: 11px;
  color: var(--gold);
  font-weight: 500;
}
