@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,600;9..144,700&display=swap');

:root {
    --bg: #f2e8d9;
    --surface: #fffaf1;
    --text-main: #3b2a1e;
    --text-muted: #8a7461;
    --primary: #b8623c;
    --primary-hover: #9c4f2e;
    --secondary: #5b7c8f;
    --success: #6f8f5b;
    --warning: #c98f2e;
    --danger: #a8433a;
    --primary-tint: #f6e9df;
    --secondary-tint: #e2ebee;
    --success-tint: #e5ecdd;
    --warning-tint: #f8ecd2;
    --danger-tint: #f3e0dd;
    --neutral-tint: #ece1d1;
    --border: #e6d8c2;
    --radius: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text-main); line-height: 1.5; }
h1, h2, h3 { font-family: 'Fraunces', Georgia, 'Times New Roman', serif; font-weight: 600; letter-spacing: -0.01em; color: var(--text-main); }

.app-header { background: var(--surface); padding: 1rem 2rem; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.container { max-width: 1200px; margin: 0 auto; padding: 2rem; }
.grid-layout { display: grid; grid-template-columns: 320px 1fr; gap: 2rem; }

@media (max-width: 768px) { .grid-layout { grid-template-columns: 1fr; } }

.card { background: var(--surface); border-radius: var(--radius); padding: 1.5rem; border: 1px solid var(--border); box-shadow: 0 1px 3px rgba(59, 42, 30, 0.06); margin-bottom: 1rem; }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; font-weight: 600; font-size: 1.125rem; }

.text-muted { color: var(--text-muted); font-size: 0.875rem; }
.text-center { text-align: center; }

.btn { padding: 0.5rem 1rem; border: none; border-radius: 4px; cursor: pointer; font-weight: 500; font-size: 0.875rem; transition: all 0.2s; display: inline-flex; align-items: center; gap: 0.5rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text-main); }
.btn-outline:hover:not(:disabled) { background: var(--bg); }
.btn-success { background: var(--success); color: white; }

.list-group { list-style: none; display: flex; flex-direction: column; gap: 0.5rem; }
.list-item { display: flex; justify-content: space-between; align-items: center; padding: 0.75rem; background: var(--bg); border-radius: var(--radius); border: 1px solid var(--border); }

.badge { font-size: 0.75rem; padding: 0.25rem 0.5rem; border-radius: 12px; background: var(--neutral-tint); color: var(--text-muted); font-weight: 600; }
.badge-waiting { background: var(--secondary-tint); color: #3d5a68; }
.badge-stale { background: var(--warning-tint); color: #8a5a1f; }
.badge-overdue { background: var(--danger-tint); color: #7a2e26; font-weight: 700; }
.badge-staged { background: var(--warning-tint); color: #8a5a1f; }
.badge-playing { background: var(--success-tint); color: #3f5934; }

.courts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.match-teams { display: flex; flex-direction: column; gap: 0.75rem; margin: 1rem 0; }
.team-row { display: flex; justify-content: space-between; align-items: center; padding: 0.5rem; background: var(--neutral-tint); border-radius: 4px; }

.toast { position: fixed; bottom: 20px; right: 20px; padding: 1rem 1.5rem; border-radius: var(--radius); color: white; opacity: 0; transform: translateY(10px); transition: all 0.3s ease; pointer-events: none; z-index: 1000; box-shadow: 0 4px 6px rgba(59, 42, 30, 0.15); }
.toast.show { opacity: 1; transform: translateY(0); }
.toast-error { background: var(--danger); }
.toast-info { background: var(--text-main); }
.toast-success { background: var(--success); }

.hidden { display: none !important; }
.mt-1 { margin-top: 1rem; }
.mb-1 { margin-bottom: 1rem; }

@media (max-width: 900px) {
    .container { padding: 1.25rem; }
    .courts-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
}
@media (max-width: 640px) {
    .app-header { flex-wrap: wrap; row-gap: 0.5rem; padding: 1rem; }
    .app-header h1 { font-size: 1.15rem; }
    .container { padding: 1rem; }
    .grid-layout { gap: 1rem; }
    .card { padding: 1.1rem; }
    .card-header { flex-wrap: wrap; row-gap: 0.4rem; }
    .courts-grid { grid-template-columns: 1fr; }
}
@media (max-width: 420px) {
    .list-item { flex-wrap: wrap; gap: 0.5rem; }
    .team-row { flex-wrap: wrap; row-gap: 0.4rem; }
    .btn { padding: 0.5rem 0.75rem; }
}
select, input[type="text"], input[type="password"], input[type="number"], textarea {
    min-width: 0; max-width: 100%;
}

/* ---- Editable match slots (Up Next + live courts) ---- */
.team-block { display: flex; flex-direction: column; gap: 0.4rem; padding: 0.6rem; background: var(--neutral-tint); border-radius: 8px; }
.team-head { display: flex; justify-content: space-between; align-items: center; min-height: 1.75rem; }
.team-tag { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-muted); }
.slot-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.4rem; }
.player-slot { display: flex; align-items: stretch; min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.slot-name { flex: 1; min-width: 0; padding: 0.5rem 0.6rem; border: none; background: transparent; font: inherit; font-weight: 600; color: var(--text-main); text-align: left; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot-name:hover { background: var(--primary-tint); }
.slot-remove { border: none; border-left: 1px solid var(--border); background: transparent; color: var(--text-muted); padding: 0 0.6rem; cursor: pointer; font-size: 0.9rem; }
.slot-remove:hover { background: var(--danger-tint); color: var(--danger); }
.player-slot.empty { background: transparent; border: 1.5px dashed var(--primary); }
.player-slot.empty .slot-name { color: var(--primary); font-weight: 500; text-align: center; }

.modal-backdrop { position: fixed; inset: 0; background: rgba(59, 42, 30, 0.5); z-index: 1500; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.modal-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; width: 100%; max-width: 420px; max-height: 80vh; overflow-y: auto; }
.modal-title { font-size: 1.1rem; margin-bottom: 0.25rem; }
.modal-options { display: flex; flex-direction: column; gap: 0.4rem; margin: 0.75rem 0; }
.modal-option { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; width: 100%; padding: 0.7rem 0.8rem; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; font: inherit; font-weight: 500; color: var(--text-main); cursor: pointer; text-align: left; }
.modal-option:hover { background: var(--primary-tint); }
.modal-footer { display: flex; gap: 0.5rem; justify-content: flex-end; }

/* =====================================================================
   v2 additions: nav, stat tiles, tabs, queue rows, courts, leaderboard,
   history, profile history. Appended last so they refine the base rules.
   ===================================================================== */
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.btn { border-radius: 8px; }
.btn-danger-outline { background: transparent; border: 1px solid var(--danger); color: var(--danger); }
.btn-danger-outline:hover:not(:disabled) { background: var(--danger-tint); }
.btn-sm { padding: 0.25rem 0.55rem; font-size: 0.75rem; }
.input { width: 100%; padding: 0.6rem 0.75rem; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text-main); font: inherit; font-size: 0.95rem; }
.input:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px var(--primary-tint); }

.player-tag { color: var(--text-muted); font-weight: 500; font-size: 0.8em; margin-left: 0.3rem; font-variant-numeric: tabular-nums; }

/* Header + nav */
.app-header { position: sticky; top: 0; z-index: 40; gap: 1rem; }
.header-left, .header-right { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; row-gap: 0.4rem; }
.header-right { justify-content: flex-end; }
.app-brand { font-family: 'Fraunces', Georgia, serif; font-weight: 600; font-size: 1.2rem; color: var(--text-main); text-decoration: none; letter-spacing: -0.01em; margin-right: 0.5rem; }
.app-nav { display: flex; gap: 0.25rem; align-items: center; flex-wrap: wrap; }
.nav-link { font-size: 0.85rem; font-weight: 500; color: var(--text-muted); text-decoration: none; padding: 0.35rem 0.8rem; border-radius: 999px; }
.nav-link:hover { background: var(--bg); color: var(--text-main); }
.nav-link.active { background: var(--primary-tint); color: var(--primary); font-weight: 600; }
.session-pill { display: inline-flex; align-items: center; gap: 0.45rem; font-size: 0.8rem; font-weight: 600; color: #3f5934; background: var(--success-tint); padding: 0.3rem 0.7rem; border-radius: 999px; max-width: 220px; }
.session-pill span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-dot { display: inline-block; flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%; background: var(--success); animation: live-pulse 2s infinite; }
@keyframes live-pulse { 0% { box-shadow: 0 0 0 0 rgba(111, 143, 91, 0.55); } 70% { box-shadow: 0 0 0 7px rgba(111, 143, 91, 0); } 100% { box-shadow: 0 0 0 0 rgba(111, 143, 91, 0); } }
@media (prefers-reduced-motion: reduce) { .live-dot { animation: none; } }

/* Stat tiles */
.stat-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 0.75rem; }
.stat-tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.75rem 0.9rem; box-shadow: 0 1px 3px rgba(59, 42, 30, 0.04); }
.stat-value { font-family: 'Fraunces', Georgia, serif; font-size: 1.6rem; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); font-weight: 600; margin-top: 0.25rem; }
.stat-tile.accent .stat-value { color: var(--primary); }
.stat-tile.good .stat-value { color: var(--success); }

/* Chips + empty states */
.chip { display: inline-flex; align-items: center; gap: 0.25rem; font-size: 0.7rem; font-weight: 600; padding: 0.15rem 0.5rem; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); color: var(--text-muted); white-space: nowrap; }
.chip.pos { color: var(--success); border-color: #cfdcc3; background: var(--success-tint); }
.chip.neg { color: var(--danger); border-color: #e6c5c0; background: var(--danger-tint); }
.chip.warn { color: #8a5a1f; border-color: #ecd39b; background: var(--warning-tint); }
.empty-state { padding: 2rem 1rem; text-align: center; border: 1px dashed var(--border); border-radius: var(--radius); background: var(--bg); }
.empty-state .title { font-weight: 600; font-size: 0.9rem; }
.empty-state .hint { color: var(--text-muted); font-size: 0.8rem; margin-top: 0.25rem; }
.section-label { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-muted); margin: 1.25rem 0 0.5rem; }
.section-label:first-child { margin-top: 0; }

/* Segmented tabs */
.segmented { display: inline-flex; background: var(--neutral-tint); border-radius: 10px; padding: 3px; gap: 2px; }
.segmented button { border: none; background: transparent; padding: 0.4rem 1rem; border-radius: 8px; font: inherit; font-size: 0.85rem; font-weight: 600; color: var(--text-muted); cursor: pointer; }
.segmented button.active { background: var(--surface); color: var(--primary); box-shadow: 0 1px 2px rgba(59, 42, 30, 0.12); }

/* Dashboard layout */
.grid-layout { grid-template-columns: 360px 1fr; align-items: start; }
.grid-layout > * { min-width: 0; }
.dash-stats { grid-column: 1 / -1; }
.join-code-box { background: var(--warning-tint); border: 1px solid var(--warning); border-radius: var(--radius); padding: 0.6rem 0.75rem; margin-bottom: 1rem; text-align: center; cursor: pointer; }
.join-code-box:hover { filter: brightness(0.98); }
.join-code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 1.7rem; font-weight: 700; letter-spacing: 0.25em; }
.roster-row { display: flex; gap: 0.5rem; margin-bottom: 0.5rem; }
.roster-row select { flex: 1; min-width: 0; }
.roster-tools { display: grid; grid-template-columns: repeat(4, auto); gap: 0.4rem; margin-bottom: 1rem; }
.roster-tools .btn { justify-content: center; padding: 0.45rem 0.4rem; font-size: 0.78rem; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin-top: 1rem; padding: 0.65rem 0.8rem; background: var(--success-tint); border: 1px solid #cfdcc3; border-radius: var(--radius); }
.switch-row label.switch-text { font-weight: 600; color: #3f5934; cursor: pointer; font-size: 0.875rem; }
.switch-row small { display: block; font-weight: 400; color: var(--text-muted); font-size: 0.72rem; }
.switch { appearance: none; -webkit-appearance: none; flex: 0 0 auto; width: 44px; height: 26px; border-radius: 999px; background: #c9bba5; position: relative; cursor: pointer; transition: background 0.2s; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); transition: transform 0.2s; }
.switch:checked { background: var(--success); }
.switch:checked::after { transform: translateX(18px); }

/* Queue rows (dashboard) */
.q-list { list-style: none; display: flex; flex-direction: column; gap: 0.45rem; max-height: 560px; overflow-y: auto; padding-right: 2px; }
.q-item { display: grid; grid-template-columns: 1.6rem 1fr auto; column-gap: 0.6rem; row-gap: 0.3rem; align-items: center; padding: 0.6rem 0.7rem; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); }
.q-rank { grid-row: 1 / span 2; font-weight: 700; color: var(--text-muted); text-align: center; font-size: 0.9rem; }
.q-name { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-meta { display: flex; flex-wrap: wrap; gap: 0.3rem; align-items: center; min-width: 0; }
.q-actions { display: flex; gap: 0.3rem; align-items: center; justify-content: flex-end; }

/* Court tiles (dashboard) */
.court-tile { border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; background: var(--surface); }
.court-tile.open { background: transparent; border-style: dashed; display: flex; justify-content: space-between; align-items: center; color: var(--text-muted); }
.court-tile.open h3 { color: var(--text-muted); font-size: 1rem; }
.court-tile.live { background: var(--primary-tint); border-color: var(--primary); }
.court-tile-head { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; margin-bottom: 0.75rem; }
.court-tile-head h3 { font-size: 1.05rem; color: var(--primary); }

/* Recent matches (dashboard) */
.result-row { padding: 0.7rem 0.8rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); font-size: 0.875rem; }
.result-meta { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; margin-bottom: 0.4rem; }
.result-teams { display: grid; grid-template-columns: 1fr auto 1fr; gap: 0.5rem; align-items: center; }
.result-team { min-width: 0; color: var(--text-muted); }
.result-team.win { color: var(--text-main); font-weight: 600; }
.result-team.win::before { content: '\2713  '; color: var(--success); }
.result-team:last-child { text-align: right; }

/* Leaderboard (live + standings) */
.lb-head { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; }
.lb-row { display: grid; grid-template-columns: 2rem 1fr auto; gap: 0.75rem; align-items: center; padding: 0.8rem 0.25rem; border-bottom: 1px solid var(--border); }
.lb-row:last-child { border-bottom: none; }
.lb-rank { width: 1.9rem; height: 1.9rem; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; font-weight: 700; font-size: 0.85rem; color: var(--text-muted); background: var(--neutral-tint); }
.lb-rank.r1 { background: #f3dfa3; color: #7d5c0e; }
.lb-rank.r2 { background: #e4ded3; color: #5d554a; }
.lb-rank.r3 { background: #ecc9ab; color: #7a4520; }
.lb-name { font-weight: 600; font-size: 1.02rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-sub { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.1rem; }
.lb-pct { text-align: right; font-weight: 700; font-size: 1.15rem; color: var(--primary); font-variant-numeric: tabular-nums; line-height: 1.1; }
.lb-pct small { display: block; font-size: 0.72rem; font-weight: 500; color: var(--text-muted); }
.lb-row.unranked .lb-name { color: var(--text-muted); font-weight: 500; }
.lb-row.unranked .lb-rank { background: transparent; border: 1px dashed var(--border); }
.lb-qualify { text-align: center; font-size: 0.72rem; font-weight: 600; line-height: 1.25; color: #8a5a1f; background: var(--warning-tint); padding: 0.3rem 0.7rem; border-radius: 12px; max-width: 8.5rem; }
.lb-row.unranked .lb-name { white-space: normal; overflow: visible; }
#form-new-player input[type="text"] { flex: 1 1 100% !important; }

/* History page */
.history-wrap { max-width: 1000px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
.page-title { display: flex; justify-content: space-between; align-items: end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.page-title h2 { font-size: 1.6rem; }
.history-list { display: flex; flex-direction: column; gap: 0.6rem; }
.history-card { display: grid; grid-template-columns: 3.4rem 1fr auto; gap: 0.9rem; align-items: center; padding: 0.85rem 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); text-decoration: none; color: inherit; transition: border-color 0.15s, box-shadow 0.15s; }
.history-card:hover { border-color: var(--primary); box-shadow: 0 2px 8px rgba(59, 42, 30, 0.08); }
.date-block { text-align: center; background: var(--primary-tint); color: var(--primary); border-radius: 10px; padding: 0.4rem 0; line-height: 1.1; }
.date-block .m { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700; }
.date-block .d { font-family: 'Fraunces', Georgia, serif; font-size: 1.35rem; font-weight: 600; }
.date-block .y { font-size: 0.65rem; color: var(--text-muted); }
.history-title { font-weight: 600; font-size: 1.02rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-sub { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.15rem; }
.history-stats { display: flex; gap: 1rem; text-align: center; }
.history-stats b { display: block; font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.history-stats span { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); font-weight: 600; }
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.data-table th { text-align: left; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); font-weight: 700; padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--border); white-space: nowrap; }
.data-table td { padding: 0.65rem 0.6rem; border-bottom: 1px solid var(--border); white-space: nowrap; font-variant-numeric: tabular-nums; }
.data-table tr:last-child td { border-bottom: none; }
.data-table .num { text-align: right; }
.data-table a { color: var(--text-main); text-decoration: none; font-weight: 600; }
.data-table a:hover { color: var(--primary); text-decoration: underline; }
.game-row { padding: 0.8rem 0.9rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); }
.game-meta { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--text-muted); font-weight: 600; margin-bottom: 0.45rem; }
.game-teams { display: grid; grid-template-columns: 1fr auto 1fr; gap: 0.75rem; align-items: center; }
.game-team { min-width: 0; line-height: 1.5; color: var(--text-muted); }
.game-team.win { color: var(--text-main); font-weight: 600; }
.game-team.win .team-flag { display: inline-block; font-size: 0.65rem; font-weight: 700; letter-spacing: 0.05em; color: var(--success); background: var(--success-tint); padding: 0.05rem 0.4rem; border-radius: 999px; margin-bottom: 0.15rem; }
.game-team:last-child { text-align: right; }
.vs { font-size: 0.7rem; color: var(--text-muted); font-weight: 700; }
.back-link { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.85rem; color: var(--text-muted); text-decoration: none; font-weight: 500; margin-bottom: 0.75rem; }
.back-link:hover { color: var(--primary); }

/* Profile history */
.profile-history-item { display: grid; grid-template-columns: 1fr auto; gap: 0.5rem; align-items: center; padding: 0.7rem 0; border-bottom: 1px solid var(--border); text-align: left; }
.profile-history-item:last-child { border-bottom: none; }
.profile-history-item .h-title { font-weight: 600; font-size: 0.95rem; }
.profile-history-item .h-sub { font-size: 0.75rem; color: var(--text-muted); }
.profile-history-item .h-rec { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.profile-history-item .h-rec small { display: block; font-weight: 500; font-size: 0.72rem; color: var(--text-muted); }

@media (max-width: 900px) { .grid-layout { grid-template-columns: 1fr; } .q-list { max-height: none; } }
@media (max-width: 640px) {
    .app-header { padding: 0.75rem 1rem; }
    .history-card { grid-template-columns: 3rem 1fr; }
    .history-stats { grid-column: 1 / -1; justify-content: space-around; padding-top: 0.5rem; border-top: 1px solid var(--border); }
    .result-teams, .game-teams { grid-template-columns: 1fr; gap: 0.2rem; }
    .result-team:last-child, .game-team:last-child { text-align: left; }
    .vs { display: none; }
}

/* Roster check-in list */
.roster-list { max-height: 360px; overflow-y: auto; display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 1rem; }
.roster-item { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.45rem 0.6rem; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; }
.roster-item-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.roster-item-skill { color: var(--text-muted); font-size: 0.72rem; margin-left: 0.4rem; }
.roster-item-actions { display: flex; gap: 0.25rem; flex-shrink: 0; }
#roster-filter { flex: 1; min-width: 0; }
/* ---- Queue rows: three-row layout so chips and actions have room ---- */
.q-rank { grid-row: 1 / span 3; }
.q-item .q-meta { grid-column: 2 / -1; }
.q-item .q-actions { grid-column: 2 / -1; justify-content: flex-start; flex-wrap: wrap; }

/* ---- Request (play together / against) ---- */
.chip.req { color: #3d5a68; border-color: #bfd0d7; background: var(--secondary-tint); white-space: normal; }
.chip.req button { border: none; background: none; cursor: pointer; color: var(--danger); padding: 0 0 0 2px; font-size: 0.7rem; }
.req-team { display: flex; flex-direction: column; gap: 0.4rem; padding: 0.6rem; background: var(--neutral-tint); border-radius: 8px; }
.req-select { width: 100%; padding: 0.5rem; border-radius: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--text-main); font: inherit; font-size: 0.9rem; }
.req-select:disabled { opacity: 1; font-weight: 600; background: var(--primary-tint); }
.req-vs { text-align: center; font-size: 0.72rem; font-weight: 700; color: var(--text-muted); margin: 0.35rem 0; letter-spacing: 0.06em; }
.req-summary { margin: 0.9rem 0; padding: 0.55rem 0.7rem; border-radius: 8px; font-size: 0.8rem; background: var(--bg); border: 1px solid var(--border); color: var(--text-muted); }
.req-summary.ok { background: var(--success-tint); border-color: #cfdcc3; color: #3f5934; }

/* Paddle Stack indicator (live view + dashboard): which stack a match or player belongs to */
.stack { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.78rem; font-weight: 700; padding: 0.22rem 0.65rem; border-radius: 999px; white-space: nowrap; border: 1px solid transparent; }
.stack.winners { background: var(--success-tint); color: #3f5934; border-color: #b9ceab; }
.stack.losers { background: var(--secondary-tint); color: #2f4753; border-color: #c3d4db; }
.stack.mixed { background: var(--neutral-tint); color: var(--text-muted); border-color: var(--border); }
.stack.sm { font-size: 0.68rem; padding: 0.08rem 0.45rem; gap: 0.25rem; }

/* Branded dialogs (UI.confirm / UI.form in shared.js) */
.dlg-overlay { position: fixed; inset: 0; z-index: 2000; display: flex; align-items: center; justify-content: center; padding: 1rem; background: rgba(59, 42, 30, 0.45); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); opacity: 0; transition: opacity 0.18s ease; }
.dlg-overlay.show { opacity: 1; }
.dlg { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 1.5rem; box-shadow: 0 18px 50px rgba(59, 42, 30, 0.28); transform: translateY(10px) scale(0.97); transition: transform 0.22s cubic-bezier(0.34, 1.3, 0.5, 1); }
.dlg-overlay.show .dlg { transform: none; }
.dlg-title { font-size: 1.2rem; margin-bottom: 0.4rem; }
.dlg-msg { color: var(--text-muted); font-size: 0.92rem; margin-bottom: 1rem; }
.dlg-label { display: block; font-size: 0.8rem; font-weight: 600; margin: 0.6rem 0 0.25rem; }
.dlg-field { width: 100%; padding: 0.6rem 0.7rem; border: 1px solid var(--border); border-radius: 8px; background: #fff; color: var(--text-main); font: inherit; }
.dlg-field:focus { outline: 2px solid var(--primary); outline-offset: 1px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 1.25rem; }
.dlg-actions .btn { justify-content: center; padding: 0.55rem 1rem; }
.btn.dlg-danger { background: var(--danger); border-color: var(--danger); }
.btn.dlg-danger:hover:not(:disabled) { background: #8c352d; border-color: #8c352d; }
@media (max-width: 480px) { .dlg-actions { flex-direction: column-reverse; } .dlg-actions .btn { width: 100%; } }
@media (prefers-reduced-motion: reduce) { .dlg-overlay, .dlg { transition: none; } }