/* ============================================================
   GWM V2 — attendance.css
   Dual War Attendance System
   Siege + Practice · Stats · Schedule Card · Notifications
   ============================================================ */

/* ── TYPE FILTER BAR ─────────────────────────────────────── */
.att-type-bar {
  display: flex; align-items: center; gap: 6px;
  background: var(--bg-deep); padding: 3px; border-radius: var(--r-sm);
  border: 1px solid var(--line-soft); flex: none;
}
.att-type-btn {
  padding: 5px 14px; border-radius: 6px; font-size: 12px; font-weight: 500;
  color: var(--fg-3); cursor: pointer; transition: all .14s; user-select: none;
}
.att-type-btn:hover { color: var(--fg-2); }
.att-type-btn.active { color: var(--fg); background: var(--panel-2); box-shadow: 0 1px 2px rgba(0,0,0,.25); }

/* ── DUAL STATS ROW ──────────────────────────────────────── */
.dual-stats-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px;
}
@media (max-width: 580px) { .dual-stats-row { grid-template-columns: 1fr; } }

.stat-card {
  background: var(--panel); border: 1px solid var(--line-soft);
  border-radius: var(--r); padding: 16px 18px;
}
.stat-card-head {
  display: flex; align-items: center; gap: 8px; margin-bottom: 14px;
}
.stat-card-icon {
  width: 30px; height: 30px; border-radius: 8px; flex: none;
  display: grid; place-items: center;
}
.stat-card-icon.siege  { background: color-mix(in oklch, var(--accent) 18%, var(--panel)); color: var(--accent); }
.stat-card-icon.practice { background: color-mix(in oklch, var(--azure) 18%, var(--panel)); color: var(--azure); }
.stat-card-title { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--fg-3); }

.stat-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
}
.stat-cell { display: flex; flex-direction: column; gap: 2px; }
.stat-val { font-size: 20px; font-weight: 700; font-family: 'Geist Mono', monospace; color: var(--fg); line-height: 1; }
.stat-val.win  { color: var(--ready); }
.stat-val.loss { color: var(--absent); }
.stat-val.pct  { color: var(--accent); }
.stat-key { font-size: 10px; color: var(--fg-3); font-weight: 500; text-transform: uppercase; letter-spacing: .04em; }

/* ── ENHANCED SCHEDULE CARD ──────────────────────────────── */
.war-sched-card-v2 {
  display: flex; gap: 0; align-items: stretch; flex-wrap: wrap;
  background: var(--panel); border: 1px solid var(--line-soft);
  border-radius: var(--r); overflow: hidden; margin-bottom: 14px;
}
.sched-block {
  flex: 1; min-width: 200px; padding: 14px 18px;
  border-right: 1px solid var(--line-soft);
  display: flex; flex-direction: column; gap: 6px;
}
.sched-block:last-child { border-right: none; }
.sched-block.actions {
  flex: none; justify-content: center; align-items: flex-end;
  gap: 8px; padding: 12px 14px; flex-direction: row;
}
.sched-type-label {
  display: flex; align-items: center; gap: 6px;
  font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--fg-3);
}
.sched-type-dot {
  width: 6px; height: 6px; border-radius: 50%; flex: none;
}
.sched-type-dot.siege    { background: var(--accent); }
.sched-type-dot.practice { background: var(--azure); }
.sched-main { font-size: 16px; font-weight: 700; color: var(--fg); font-family: 'Geist Mono', monospace; }
.sched-sub  { font-size: 12px; color: var(--fg-3); }

/* ── WAR TABLE — enhanced ────────────────────────────────── */
.att-table th:nth-child(3) { text-align: center; }
.att-table td:nth-child(3) { text-align: center; }

/* Type pill */
.type-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 600;
  letter-spacing: .03em; text-transform: uppercase;
}
.type-pill.siege {
  background: color-mix(in oklch, var(--accent) 15%, var(--panel));
  color: var(--accent);
  border: 1px solid color-mix(in oklch, var(--accent) 30%, transparent);
}
.type-pill.practice {
  background: color-mix(in oklch, var(--azure) 15%, var(--panel));
  color: var(--azure);
  border: 1px solid color-mix(in oklch, var(--azure) 30%, transparent);
}

/* Round badge */
.round-badge {
  display: inline-flex; align-items: center; padding: 1px 7px;
  border-radius: 999px; font-size: 10px; font-weight: 600;
  background: var(--panel-2); color: var(--fg-3); border: 1px solid var(--line-soft);
  margin-top: 3px;
}

/* ── LOG WAR MODAL — mode tabs ───────────────────────────── */
.war-type-tabs {
  display: flex; gap: 0; border-radius: var(--r-sm); overflow: hidden;
  border: 1px solid var(--line-soft); margin-bottom: 18px;
}
.war-type-tab {
  flex: 1; padding: 9px 0; text-align: center; font-size: 13px; font-weight: 500;
  color: var(--fg-3); cursor: pointer; transition: all .14s;
  display: flex; align-items: center; justify-content: center; gap: 7px;
  background: var(--bg-deep);
}
.war-type-tab:hover { color: var(--fg-2); }
.war-type-tab.active {
  background: var(--panel-2); color: var(--fg);
  box-shadow: inset 0 -2px 0 var(--accent);
}
.war-type-tab.active.practice { box-shadow: inset 0 -2px 0 var(--azure); }

/* ── DRILL-DOWN MODAL ────────────────────────────────────── */
.drill-head {
  display: flex; align-items: center; gap: 12px;
  padding-bottom: 14px; border-bottom: 1px solid var(--line-soft); margin-bottom: 14px;
}
.drill-stat { display: flex; flex-direction: column; gap: 2px; }
.drill-stat-val { font-size: 22px; font-weight: 700; color: var(--fg); font-family: 'Geist Mono', monospace; }
.drill-stat-key { font-size: 10px; color: var(--fg-3); text-transform: uppercase; letter-spacing: .04em; }

.attend-list { display: flex; flex-direction: column; gap: 2px; max-height: 380px; overflow-y: auto; }
.attend-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border-radius: var(--r-sm); font-size: 13px;
  transition: background .1s;
}
.attend-row:hover { background: var(--panel-2); }
.attend-row .ar-name { flex: 1; font-weight: 500; }
.attend-row .ar-cls  { font-size: 11px; color: var(--fg-3); width: 40px; }
.attend-row .ar-miss { font-size: 11px; font-family: 'Geist Mono', monospace; color: var(--fg-3); width: 50px; text-align: right; }
.attend-row .ar-miss-input {
  width: 50px; padding: 3px 6px; font-size: 11px;
  font-family: 'Geist Mono', monospace; color: var(--fg-2);
  background: var(--bg-deep); border: 1px solid var(--line-soft);
  border-radius: 4px; text-align: center; transition: border-color .12s;
}
.attend-row .ar-miss-input:hover { border-color: var(--line); }
.attend-row .ar-miss-input:focus {
  border-color: var(--accent); outline: none;
  box-shadow: 0 0 0 2px color-mix(in oklch, var(--accent) 20%, transparent);
}
.attend-row .ar-miss-input::-webkit-inner-spin-button,
.attend-row .ar-miss-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.attend-row .ar-miss-input { -moz-appearance: textfield; }

/* Status dot inline */
.sdot-sm { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.sdot-sm.ready   { background: var(--ready); }
.sdot-sm.absent  { background: var(--absent); }
.sdot-sm.busy   { background: var(--busy, var(--fg-3)); }


/* Attend count row */
.attend-counts {
  display: flex; gap: 16px; align-items: center;
  padding: 10px 0; margin-bottom: 10px;
  border-bottom: 1px solid var(--line-soft);
}
.ac-item { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.ac-val   { font-weight: 600; font-family: 'Geist Mono', monospace; }

/* ── NOTIFICATION BELL ───────────────────────────────────── */
.notif-bell-btn {
  position: relative; padding: 6px; border-radius: 8px;
  color: var(--fg-3); transition: all .14s; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.notif-bell-btn:hover { color: var(--fg); background: var(--panel-2); }
.notif-badge {
  position: absolute; top: 2px; right: 2px;
  min-width: 16px; height: 16px; border-radius: 999px; padding: 0 4px;
  background: var(--accent); color: var(--accent-ink);
  font-size: 10px; font-weight: 700; display: grid; place-items: center;
  line-height: 1; border: 2px solid var(--bg);
}

/* ── NOTIFICATION PANEL ──────────────────────────────────── */
.notif-panel {
  position: fixed; top: 52px; right: 10px; width: 340px;
  background: var(--panel); border: 1px solid var(--line-soft);
  border-radius: var(--r); box-shadow: 0 8px 32px rgba(0,0,0,.45);
  z-index: 300; overflow: hidden;
}
.notif-panel-head {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px;
  border-bottom: 1px solid var(--line-soft); background: var(--bg-deep);
}
.notif-panel-head h4 { flex: 1; font-size: 13px; font-weight: 600; margin: 0; }
.notif-clear-btn { font-size: 11px; color: var(--fg-3); cursor: pointer; padding: 2px 6px; border-radius: 4px; }
.notif-clear-btn:hover { color: var(--fg); background: var(--panel-2); }

.notif-list { max-height: 360px; overflow-y: auto; }
.notif-item {
  display: flex; gap: 10px; padding: 10px 14px;
  border-bottom: 1px solid var(--line-soft); cursor: pointer;
  transition: background .1s;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--panel-2); }
.notif-item.unread { background: color-mix(in oklch, var(--accent) 6%, var(--panel)); }
.notif-item.unread:hover { background: color-mix(in oklch, var(--accent) 10%, var(--panel)); }
.notif-icon {
  width: 28px; height: 28px; border-radius: 8px; flex: none;
  display: grid; place-items: center; font-size: 13px;
}
.notif-icon.siege    { background: color-mix(in oklch, var(--accent) 20%, var(--panel)); color: var(--accent); }
.notif-icon.practice { background: color-mix(in oklch, var(--azure) 20%, var(--panel)); color: var(--azure); }
.notif-icon.reminder { background: color-mix(in oklch, var(--gold, #f59e0b) 20%, var(--panel)); color: var(--gold, #f59e0b); }
.notif-body { flex: 1; min-width: 0; }
.notif-title { font-size: 12px; font-weight: 600; color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notif-msg   { font-size: 11px; color: var(--fg-3); margin-top: 2px; line-height: 1.4; }
.notif-time  { font-size: 10px; color: var(--fg-3); margin-top: 4px; font-family: 'Geist Mono', monospace; }
.notif-unread-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex: none; margin-top: 4px; }

.notif-empty {
  padding: 40px 20px; text-align: center;
  color: var(--fg-3); font-size: 13px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}

/* ── ROLL CALL MODAL ─────────────────────────────────────── */
.rollcall-preview {
  background: var(--bg-deep); border: 1px solid var(--line-soft);
  border-radius: var(--r-sm); padding: 12px 14px;
  font-size: 13px; line-height: 1.6; color: var(--fg-2); white-space: pre-wrap;
  max-height: 150px; overflow-y: auto;
  font-family: 'Geist Mono', monospace;
}

.audience-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.audience-chip {
  padding: 5px 12px; border-radius: 999px; font-size: 12px; font-weight: 500;
  cursor: pointer; border: 1px solid var(--line-soft); color: var(--fg-3);
  transition: all .14s; user-select: none; background: var(--panel-2);
}
.audience-chip.on {
  border-color: var(--accent); color: var(--accent);
  background: color-mix(in oklch, var(--accent) 12%, var(--panel));
}

/* ── RESULT PICKER ───────────────────────────────────────── */
.result-picker { display: flex; gap: 8px; }
.result-btn {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px; border-radius: var(--r-sm); border: 1.5px solid var(--line-soft);
  font-size: 13px; font-weight: 500; cursor: pointer; color: var(--fg-3);
  background: var(--panel-2); transition: all .14s;
}
.result-btn:hover { color: var(--fg); border-color: var(--line); }
.result-btn.victory.on { border-color: var(--ready); color: var(--ready); background: color-mix(in oklch, var(--ready) 12%, var(--panel)); }
.result-btn.defeat.on  { border-color: var(--absent); color: var(--absent); background: color-mix(in oklch, var(--absent) 12%, var(--panel)); }

/* Log war grid */
.log-war-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ============================================================
   UPCOMING EVENTS BAR (War Board Integration)
   ============================================================ */

.upcoming-bar {
  margin-bottom: 14px;
  background: var(--panel); border: 1px solid var(--line-soft);
  border-radius: var(--r); overflow: hidden;
}

.upcoming-header {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px 0;
}
.upcoming-title {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .05em; color: var(--fg-3); flex: 1;
}

/* Cards row */
.upcoming-cards {
  display: flex; gap: 0; overflow-x: auto; padding: 10px 12px 12px;
  gap: 10px; scrollbar-width: thin;
}
.upcoming-cards::-webkit-scrollbar { height: 4px; }
.upcoming-cards::-webkit-scrollbar-thumb { background: var(--line-soft); border-radius: 999px; }

/* Individual event card */
.upcoming-card {
  flex: none; width: 220px; min-width: 180px;
  background: var(--panel-2); border: 1px solid var(--line-soft);
  border-radius: var(--r-sm); padding: 12px 14px;
  display: flex; flex-direction: column; gap: 6px;
  position: relative; transition: border-color .14s;
}
.upcoming-card:hover { border-color: var(--line); }
.upcoming-card.siege    { border-left: 3px solid var(--accent); }
.upcoming-card.practice { border-left: 3px solid var(--azure); }

/* Top row: type pill + countdown */
.upc-top {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.upc-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 999px;
  font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em;
}
.upc-pill.siege    { background: color-mix(in oklch, var(--accent) 15%, transparent); color: var(--accent); }
.upc-pill.practice { background: color-mix(in oklch, var(--azure) 15%, transparent); color: var(--azure); }

.upc-countdown {
  font-size: 11px; font-weight: 600; color: var(--fg-3);
  font-family: 'Geist Mono', monospace;
}
.upc-countdown.today { color: var(--ready); }

/* Time + meta */
.upc-time { font-size: 18px; font-weight: 700; color: var(--fg); font-family: 'Geist Mono', monospace; }
.upc-meta { font-size: 11px; color: var(--fg-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Self-register buttons */
.upc-register {
  display: flex; align-items: center; gap: 6px; margin-top: 2px; flex-wrap: wrap;
}
/* v2.2: label เหนือปุ่ม Ready/Busy — บอกชัดว่าเป็นสถานะของผู้ใช้ ไม่ใช่ stat รวม */
.upc-reg-label {
  display: block; width: 100%;
  font-size: 10px; color: var(--fg-3);
  letter-spacing: .04em; text-transform: uppercase;
  margin-bottom: 1px; line-height: 1.2;
}
.upc-reg-btn {
  padding: 4px 10px; border-radius: 999px; font-size: 11px; font-weight: 600;
  cursor: pointer; border: 1.5px solid var(--line-soft);
  background: var(--panel); color: var(--fg-3); transition: all .14s;
  display: flex; align-items: center; gap: 4px;
}
.upc-reg-btn:hover { border-color: var(--line); color: var(--fg); }
.upc-reg-btn.ready.active  {
  background: color-mix(in oklch, var(--ready) 15%, var(--panel));
  border-color: var(--ready); color: var(--ready);
}
.upc-reg-btn.busy.active  {
  background: color-mix(in oklch, var(--busy) 15%, var(--panel));
  border-color: var(--busy); color: var(--busy);
}
.upc-reg-count {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; color: var(--fg-3); margin-left: 4px;
  font-family: 'Geist Mono', monospace;
}
.upc-reg-hint {
  font-size: 11px; color: var(--fg-3);
  display: flex; align-items: center; gap: 4px;
}

/* Delete button (ad-hoc events) */
.upc-delete-btn {
  position: absolute; top: 8px; right: 8px;
  width: 20px; height: 20px; border-radius: 4px;
  display: grid; place-items: center;
  color: var(--fg-3); opacity: 0; transition: opacity .14s, background .14s;
  cursor: pointer;
}
.upcoming-card:hover .upc-delete-btn { opacity: 1; }
.upc-delete-btn:hover { background: var(--panel-3); color: var(--absent); }


/* ── BOARD SELECTOR: neon glow + tags (Step 5) ──────────────── */
.upcoming-card.default-board { border-left: 3px solid var(--gold); }
.upc-pill.default {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600;
  background: color-mix(in oklch, var(--gold) 15%, transparent);
  color: var(--gold);
}

.upcoming-card.siege.board-active         { --glow: var(--accent); }
.upcoming-card.practice.board-active      { --glow: var(--azure); }
.upcoming-card.default-board.board-active { --glow: var(--gold); }
.upcoming-card.board-active {
  border-color: var(--glow);
  animation: board-glow 1.8s ease-in-out infinite;
}
@keyframes board-glow {
  0%,100% { box-shadow: 0 0 0 1px var(--glow), 0 0 12px color-mix(in oklch, var(--glow) 35%, transparent); }
  50%     { box-shadow: 0 0 0 1px var(--glow), 0 0 22px color-mix(in oklch, var(--glow) 60%, transparent),
                        0 0 38px color-mix(in oklch, var(--glow) 28%, transparent); }
}

.upc-edit-btn {
  position: absolute; top: 8px; right: 8px;
  width: 22px; height: 22px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line-soft); border-radius: var(--r-sm);
  background: var(--panel); color: var(--fg-3); cursor: pointer;
  opacity: 0; transition: opacity .14s, color .14s, border-color .14s;
}
.upcoming-card:hover .upc-edit-btn { opacity: 1; }
.upc-edit-btn:hover { color: var(--accent); border-color: var(--accent); }

/* ── NEXT SIEGE "Today" badge (blinking) ─────────────────────── */
.sched-today-badge {
  display: inline-block; margin-left: 8px;
  padding: 1px 8px; border-radius: 999px;
  font-size: 10px; font-weight: 700; letter-spacing: .03em;
  background: color-mix(in oklch, var(--ready) 18%, transparent);
  color: var(--ready);
  animation: sched-today-blink 1.4s ease-in-out infinite;
}
@keyframes sched-today-blink {
  0%, 100% { opacity: 1; }
  50%      { opacity: .35; }
}
/* ════════════════════════════════════════════════════════════
   v1.9 — Dual War Close System (รอปิด + Close War modal)
   ════════════════════════════════════════════════════════════ */

/* ── การ์ดรอปิด ── */
.upcoming-card.pending { border-style: dashed; }
.upcoming-card.pending.siege    { border-left: 3px solid var(--gold); }
.upcoming-card.pending.practice { border-left: 3px solid var(--gold); }
.upc-countdown.pending { color: var(--gold); font-weight: 700; }

.upc-reg-summary {
  display: inline-flex; gap: 10px; align-items: center;
  font-size: 11px; font-weight: 600; margin-top: 2px;
}

.upc-close-btn {
  display: flex; align-items: center; justify-content: center; gap: 5px;
  width: 100%; margin-top: 8px; padding: 6px 10px;
  font-size: 11px; font-weight: 600; cursor: pointer;
  border: 1px solid var(--line-soft); border-radius: var(--r-sm);
  background: var(--panel-2); color: var(--fg-2);
  transition: border-color .15s, background .15s, color .15s;
}
.upc-close-btn:hover {
  border-color: color-mix(in oklch, var(--ready) 45%, var(--line));
  color: var(--ready);
}
.upc-close-btn.urgent {
  border-color: color-mix(in oklch, var(--gold) 45%, var(--line));
  background: color-mix(in oklch, var(--gold) 10%, var(--panel));
  color: var(--gold);
}
.upc-close-btn.urgent:hover {
  background: color-mix(in oklch, var(--gold) 18%, var(--panel));
}

/* ── สีจุดสถานะใหม่ ── */
.sdot-sm.present { background: var(--ready); }
.sdot-sm.excused { background: var(--busy, var(--fg-3)); }

/* ── Close War modal ── */
.cw-bulk-row {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  margin-bottom: 10px;
}
.cw-bulk-row .sel-input { padding: 6px 10px; font-size: 12px; }

.cw-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.cw-chip {
  padding: 3px 10px; font-size: 11px; font-weight: 600; cursor: pointer;
  border: 1px solid var(--line-soft); border-radius: 999px;
  color: var(--chip-c, var(--fg-3));
  transition: border-color .12s, background .12s;
}
.cw-chip:hover { border-color: var(--line); }
.cw-chip.active {
  border-color: color-mix(in oklch, var(--chip-c, var(--accent)) 55%, var(--line));
  background: color-mix(in oklch, var(--chip-c, var(--accent)) 12%, transparent);
}

.cw-list {
  max-height: 320px; overflow-y: auto;
  border: 1px solid var(--line-soft); border-radius: var(--r);
  background: var(--panel-2);
}
.cw-list::-webkit-scrollbar { width: 5px; }
.cw-list::-webkit-scrollbar-thumb { background: var(--line-soft); border-radius: 999px; }

.cw-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; border-bottom: 1px solid var(--line-soft);
}
.cw-row:last-child { border-bottom: none; }
.cw-name {
  flex: 1; min-width: 0; font-size: 12.5px; font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cw-zone {
  font-size: 10px; padding: 1px 7px; border-radius: 999px;
  background: color-mix(in oklch, var(--accent) 12%, transparent);
  color: var(--accent); white-space: nowrap; flex: none;
}
.cw-cls { font-size: 10.5px; color: var(--fg-3); flex: none; width: 56px; text-align: right;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.cw-toggle {
  display: inline-flex; flex: none; overflow: hidden;
  border: 1px solid var(--line-soft); border-radius: 999px;
}
.cw-tg-btn {
  padding: 3px 11px; font-size: 11px; font-weight: 600; cursor: pointer;
  background: transparent; border: none; color: var(--fg-3);
  transition: background .1s, color .1s;
}
.cw-tg-btn + .cw-tg-btn { border-left: 1px solid var(--line-soft); }
.cw-tg-btn:hover { color: var(--fg-2); }
.cw-tg-btn.on.present { background: color-mix(in oklch, var(--ready) 20%, transparent);  color: var(--ready); }
.cw-tg-btn.on.excused { background: color-mix(in oklch, var(--busy)  28%, transparent);  color: var(--fg-1); }
.cw-tg-btn.on.absent  { background: color-mix(in oklch, var(--absent) 20%, transparent); color: var(--absent); }

.cw-rest {
  display: flex; align-items: center; gap: 5px;
  font-size: 11px; color: var(--fg-3); padding: 7px 2px 0;
}
.cw-tally {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 2px 0; font-size: 12px; font-weight: 600;
}
.cw-tally .spacer { flex: 1; }
.cw-tally .mono { font-family: var(--mono, ui-monospace, monospace); }

@media (max-width: 560px) {
  .cw-cls { display: none; }
  .cw-tg-btn { padding: 3px 8px; }
}

/* ════════════════════════════════════════════════════════════
   MOBILE (≤640px): War-history table → stacked cards
   thead hidden, each row becomes a card laid out with grid-areas.
   ════════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
  .att-table-wrap { overflow-x: visible; }
  .att-table,
  .att-table tbody { display: block; }
  .att-table thead { display: none; }

  .att-table tr {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "date    type"
      "war     war"
      "turnout result";
    gap: 7px 10px;
    align-items: center;
    padding: 12px 14px;
    margin-bottom: 10px;
    background: var(--panel-2);
    border: 1px solid var(--line-soft);
    border-radius: var(--r-md, 10px);
  }
  .att-table td { display: block; padding: 0; border: none; }
  .att-table td:nth-child(1) { grid-area: date; }
  .att-table td:nth-child(2) { grid-area: war; }
  .att-table td:nth-child(3) { grid-area: type;    justify-self: end; text-align: right; }
  .att-table td:nth-child(4) { grid-area: turnout; min-width: 0; }
  .att-table td:nth-child(5) { grid-area: result;  justify-self: end; }

  .att-table .war-name { font-size: 14px; line-height: 1.3; }
  .att-table .turnout-wrap { width: 100%; }
}

/* ════════════════════════════════════════════════════════════
   MOBILE (≤640px): keep the Attendance subtitle on one line.
   .view-head is a shared flex row; on phones the subtitle was the
   only flexible item so it got squeezed into a 4-line column.
   Scoped to this view via :has(.att-type-bar) so other pages'
   headers are untouched. Header wraps; controls flow below.
   ════════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
  .view-head:has(.att-type-bar) { flex-wrap: wrap; row-gap: 10px; }
  .view-head:has(.att-type-bar) .spacer { display: none; }
  .view-head:has(.att-type-bar) .sub { flex: 1 1 100%; }
}
