.party-toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0; }
.party-board { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); gap: 16px; align-items: start; }
.party-column { min-width: 0; min-height: 180px; padding: 16px; border: 2px solid var(--border); border-radius: var(--radius); background: var(--surface-soft); }
.party-column h4 { margin: 0 0 14px; }
.party-column.unassigned { border-style: dashed; }
.party-column.drop-target { border-color: var(--accent); background: var(--surface-bright); }
.party-player { display: grid; gap: 10px; margin-top: 10px; padding: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; overflow-wrap: anywhere; }
.party-player[draggable="true"] { cursor: grab; }
.party-player.dragging { opacity: .5; }
.party-player label { display: grid; gap: 5px; color: var(--muted); font-size: 12px; }
.party-player select { width: 100%; min-width: 0; }

:root {
  color-scheme: dark;
  --bg: #21160f;
  --surface: #322116;
  --surface-soft: #49301d;
  --surface-bright: #593b24;
  --border: #785437;
  --text: #fff6ed;
  --muted: #c9aa91;
  --accent: #ffc66d;
  --accent-hover: #ffd58e;
  --accent-ink: #2d1608;
  --danger: #f06f62;
  --radius: 12px;
}

:root[data-theme="dark"] {
  --bg: #0f1115;
  --surface: #181b21;
  --surface-soft: #242932;
  --surface-bright: #303744;
  --border: #3d4552;
  --text: #f3f5f7;
  --muted: #9ea7b4;
  --accent: #7ba2d6;
  --accent-hover: #96b7e3;
  --accent-ink: #0c1118;
  --danger: #e66d71;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f7f2ec;
  --surface: #ffffff;
  --surface-soft: #eee5dc;
  --surface-bright: #e4d5c8;
  --border: #cdb9a7;
  --text: #2d251f;
  --muted: #746356;
  --accent: #a65c23;
  --accent-hover: #864719;
  --accent-ink: #fff9f2;
  --danger: #bd3f4d;
}

:root[data-theme="blue"] {
  --bg: #101a29;
  --surface: #18263a;
  --surface-soft: #223753;
  --surface-bright: #2b4567;
  --border: #3e5c7d;
  --text: #eef6ff;
  --muted: #9db3ca;
  --accent: #4da3ff;
  --accent-hover: #78b9ff;
  --accent-ink: #0b1c2f;
  --danger: #ff7a72;
}

:root[data-theme="green"] {
  --bg: #0b1017;
  --surface: #121a24;
  --surface-soft: #192532;
  --surface-bright: #213142;
  --border: #2a3c4d;
  --text: #f4f8fb;
  --muted: #93a8b9;
  --accent: #66e0bb;
  --accent-hover: #87edcc;
  --accent-ink: #06251c;
  --danger: #ff7d78;
}

:root[data-theme="purple"] {
  --bg: #181225;
  --surface: #251b38;
  --surface-soft: #392752;
  --surface-bright: #493369;
  --border: #654b82;
  --text: #f8f1ff;
  --muted: #baa5cc;
  --accent: #b177eb;
  --accent-hover: #c99af5;
  --accent-ink: #21102f;
  --danger: #ff7d86;
}

:root[data-theme="orange"] {
  --bg: #25140d;
  --surface: #382016;
  --surface-soft: #50301f;
  --surface-bright: #633c26;
  --border: #80543a;
  --text: #fff4ec;
  --muted: #cba68f;
  --accent: #f39a4a;
  --accent-hover: #ffb66f;
  --accent-ink: #2d1608;
  --danger: #f06f62;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 85% 5%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 28rem),
    radial-gradient(circle at 5% 95%, color-mix(in srgb, var(--muted) 9%, transparent), transparent 32rem),
    var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
.hidden { display: none !important; }

.eyebrow {
  margin: 0 0 7px;
  color: var(--accent);
  font-size: 0.69rem;
  font-weight: 850;
  letter-spacing: 0.17em;
}

.muted { color: var(--muted); line-height: 1.65; }
.compact { margin: 7px 0 0; font-size: 0.87rem; }

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(620px, 100%);
  padding: clamp(32px, 6vw, 72px);
  border: 1px solid var(--border);
  border-radius: 18px;
  background: linear-gradient(145deg, color-mix(in srgb, var(--surface-soft) 96%, transparent), color-mix(in srgb, var(--surface) 96%, var(--bg)));
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.38);
}

.login-card h1 {
  max-width: 560px;
  margin: 0;
  font-size: clamp(2.3rem, 7vw, 4.8rem);
  line-height: 0.98;
  letter-spacing: -0.065em;
}

.login-card .muted { max-width: 520px; margin: 28px 0; }

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 30px;
  padding: 28px 22px;
  border-right: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
}

.brand { display: flex; align-items: center; gap: 13px; }
.brand h1 { margin: 0; font-size: 1.55rem; letter-spacing: -0.04em; }
.brand .eyebrow { margin-bottom: 2px; }
.sidebar-icon {
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  object-fit: cover;
  border: 2px solid var(--border);
  border-radius: 50%;
  background: var(--surface-soft);
}

.tabs { display: grid; gap: 6px; }
.tab {
  padding: 12px 14px;
  color: var(--muted);
  text-align: left;
  border: 0;
  border-radius: 5px;
  background: transparent;
  font-weight: 700;
}
.tab:hover, .tab.active { color: var(--text); background: var(--surface-soft); }

.user-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
.user-card strong, .user-card span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-card span { margin-top: 3px; color: var(--muted); font-size: 0.72rem; }
.avatar { width: 38px; height: 38px; border-radius: 50%; }

.content { width: min(1440px, 100%); padding: 34px clamp(20px, 4vw, 58px) 70px; }
.content-header, .panel-heading, .utility-panel, .form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.content-header { min-height: 76px; }
.content-header h2, .panel-heading h3, .utility-panel h3 { margin: 0; letter-spacing: -0.04em; }
.content-header h2 { font-size: clamp(1.9rem, 3vw, 2.8rem); }
.panel-heading { margin-bottom: 22px; }
.panel-heading h3, .utility-panel h3 { font-size: 1.35rem; }

.channel-picker { display: grid; gap: 7px; }
.channel-picker span, .field span { color: var(--muted); font-size: 0.76rem; font-weight: 750; }

.notice {
  margin-top: 24px;
  padding: 13px 16px;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface-soft);
  font-size: 0.88rem;
}
.notice.warning {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
}

.live-attendance { margin-top: 24px; }
.attendance-heading { align-items: flex-start; }
.attendance-target {
  display: grid;
  grid-template-columns: minmax(240px, 420px) minmax(0, 1fr);
  align-items: end;
  gap: 16px;
  margin-bottom: 18px;
  padding: 15px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: color-mix(in srgb, var(--surface-soft) 55%, transparent);
}
.attendance-target p { margin-bottom: 8px; }
.attendance-choices {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
}
.attendance-choice {
  min-height: 94px;
  display: grid;
  align-content: space-between;
  gap: 15px;
  padding: 14px;
  color: var(--text);
  text-align: left;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
}
.attendance-choice:hover:not(:disabled) { border-color: var(--accent); }
.attendance-choice.selected {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 13%, var(--surface));
  box-shadow: inset 3px 0 var(--accent);
}
.attendance-choice-heading { display: flex; justify-content: space-between; gap: 12px; }
.attendance-choice-heading > span { color: var(--accent); font-size: 0.78rem; white-space: nowrap; }
.attendance-choice small { color: var(--muted); line-height: 1.45; }
.attendance-admin-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
.role-assignment { margin-top: 24px; padding-top: 22px; border-top: 1px solid var(--border); }
.assignment-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}
.assignment-heading h4 { margin: 0; font-size: 1.08rem; }
.assignment-list { display: grid; border-top: 1px solid var(--border); }
.assignment-row {
  display: grid;
  grid-template-columns: minmax(170px, 0.8fr) minmax(200px, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
}
.assignment-member strong, .assignment-member span { display: block; }
.assignment-member span { margin-top: 3px; color: var(--muted); font-size: 0.76rem; }
.assignment-actions { display: flex; gap: 7px; }
.attendance-launch-buttons { display: grid; gap: 8px; }

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 28px 0 18px;
}
.stat-card, .panel, .action-card, .preview-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
}
.stat-card { display: grid; gap: 8px; padding: 20px; }
.stat-card span, .stat-card small { color: var(--muted); }
.stat-card strong { font-size: clamp(1.4rem, 3vw, 2.15rem); letter-spacing: -0.045em; }
.stat-card.accent {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 15%, transparent), color-mix(in srgb, var(--surface) 92%, transparent));
}

.panel { padding: 24px; }
.workflow-panel { margin-bottom: 18px; }
.workflow-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.action-card { display: flex; flex-direction: column; gap: 17px; min-height: 330px; padding: 20px; }
.action-card h4, .preview-card h4 { margin: 0 0 8px; font-size: 1.08rem; }
.action-card p { margin: 0; color: var(--muted); font-size: 0.87rem; line-height: 1.55; }
.action-card > .button, .action-card > form { margin-top: auto; }
.action-number { color: var(--accent); font-size: 0.73rem; font-weight: 900; letter-spacing: 0.12em; }
.compact-form { display: grid; gap: 12px; }
.utility-panel { padding: 22px 24px; }

.button, .icon-button, .mini-button {
  border: 1px solid transparent;
  border-radius: 5px;
  font-weight: 780;
}
.button {
  min-height: 43px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 17px;
  text-decoration: none;
}
.button-primary { color: var(--accent-ink); background: var(--accent); }
.attendance-session-field { margin-bottom: 20px; }
.player-picker { border: 1px solid var(--border); border-radius: 10px; margin-top: 14px; background: var(--surface-soft); }
.player-picker summary { padding: 14px; cursor: pointer; font-weight: 600; }
.player-picker > input { margin: 0 12px 10px; width: calc(100% - 24px); }
.player-checklist { max-height: 300px; overflow-y: auto; padding: 4px 12px 12px; }
.player-check { display: flex; align-items: center; gap: 10px; padding: 10px 4px; cursor: pointer; }
.player-check[hidden] { display: none; }
.player-check input[type="checkbox"] { width: 18px; height: 18px; flex: 0 0 18px; margin: 0; padding: 0; accent-color: var(--accent); }
.assignment-roster-summary { white-space: pre-line; line-height: 1.7; overflow-wrap: anywhere; }
.button-primary:hover { background: var(--accent-hover); }
.button-secondary { color: var(--text); border-color: var(--border); background: var(--surface-bright); }
.button-danger { color: var(--accent-ink); background: var(--danger); }
.icon-button { width: 36px; height: 36px; color: var(--muted); background: var(--surface-soft); }
.mini-button { min-height: 34px; padding: 6px 10px; color: var(--text); border-color: var(--border); background: var(--surface-soft); }
.mini-button.danger { color: var(--danger); }
button:disabled { cursor: not-allowed; opacity: 0.35; }

.field { display: grid; gap: 8px; }
input, select, textarea {
  width: 100%;
  min-height: 43px;
  padding: 10px 12px;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 5px;
  outline: none;
  background: color-mix(in srgb, var(--bg) 76%, var(--surface));
}
textarea { resize: vertical; line-height: 1.55; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 13%, transparent); }

.badge { padding: 7px 10px; color: var(--muted); border: 1px solid var(--border); border-radius: 999px; font-size: 0.74rem; }
.lineup-panel { margin-top: 28px; }
.lineup-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(260px, 0.6fr); gap: 18px; }
.lineup-editor { display: grid; gap: 15px; }
.sheet-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}
.sheet-heading strong, .sheet-heading span { display: block; }
.sheet-heading strong { font-size: 0.92rem; }
.sheet-heading span { margin-top: 4px; color: var(--muted); font-size: 0.77rem; }
.lineup-sheet {
  min-height: 430px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 7px;
  outline: none;
  background: color-mix(in srgb, var(--bg) 76%, var(--surface));
}
.lineup-sheet:focus-visible { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 13%, transparent); }
.lineup-table {
  width: 100%;
  min-width: 470px;
  border-collapse: collapse;
  table-layout: fixed;
}
.lineup-table th, .lineup-table td { border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.lineup-table thead th {
  position: sticky;
  top: 0;
  height: 43px;
  padding: 7px 11px;
  color: var(--muted);
  text-align: left;
  background: var(--surface-soft);
  font-size: 0.76rem;
  font-weight: 780;
  z-index: 1;
}
.lineup-table th:nth-child(1) { width: 43px; }
.lineup-table th:nth-child(3) { width: 145px; }
.lineup-table th:nth-child(4) { width: 43px; }
.lineup-table th:last-child, .lineup-table td:last-child { border-right: 0; }
.column-letter {
  display: inline-grid;
  place-items: center;
  min-width: 21px;
  height: 21px;
  margin-right: 8px;
  color: var(--accent-ink);
  border-radius: 4px;
  background: var(--accent);
  font-size: 0.68rem;
  font-weight: 900;
}
.sheet-corner, .sheet-row-number, .sheet-action-cell { background: var(--surface-soft); }
.sheet-row-number {
  padding: 0;
  color: var(--muted);
  text-align: center;
  font-size: 0.73rem;
  font-weight: 750;
}
.lineup-table td { height: 45px; padding: 0; }
.lineup-cell-input {
  height: 44px;
  min-height: 44px;
  padding: 9px 11px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.lineup-cell-input:focus {
  position: relative;
  border: 0;
  box-shadow: inset 0 0 0 2px var(--accent);
  z-index: 1;
}
.lineup-cell-input:disabled { cursor: not-allowed; opacity: 0.48; }
.sheet-action-cell { text-align: center; }
.sheet-delete {
  width: 30px;
  height: 30px;
  padding: 0;
  color: var(--muted);
  border: 0;
  border-radius: 4px;
  background: transparent;
  font-size: 1.2rem;
  line-height: 1;
}
.sheet-delete:hover:not(:disabled) { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); }
.sheet-delete:disabled { cursor: not-allowed; opacity: 0.3; }
.form-footer { align-items: flex-end; }
.form-footer p { max-width: 480px; }
.preview-card { padding: 20px; background: color-mix(in srgb, var(--surface-soft) 65%, transparent); }
.role-list { display: grid; margin-top: 18px; border-top: 1px solid var(--border); }
.role-row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.role-row strong { color: var(--text); font-size: 0.87rem; }
.role-row span { color: var(--accent); font-size: 0.78rem; white-space: nowrap; }

.settings-panel { margin-top: 28px; }
.theme-card { max-width: 520px; display: grid; gap: 16px; }
.theme-card p { margin: 0; }

.empty-state { max-width: 560px; margin: 80px auto; padding: 42px; text-align: center; border: 1px dashed var(--border); border-radius: var(--radius); }
.empty-state h3 { margin: 0; }

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  max-width: min(390px, calc(100% - 48px));
  padding: 14px 18px;
  color: var(--accent-ink);
  border-radius: 8px;
  background: var(--accent);
  box-shadow: 0 16px 55px rgba(0, 0, 0, 0.46);
  font-weight: 780;
  z-index: 10;
}
.toast.error { color: var(--accent-ink); background: var(--danger); }

@media (max-width: 980px) {
  .workflow-grid { grid-template-columns: 1fr; }
  .action-card { min-height: 0; }
  .lineup-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { position: static; width: 100%; height: auto; gap: 18px; border-right: 0; border-bottom: 1px solid var(--border); }
  .tabs { display: flex; overflow-x: auto; }
  .tab { white-space: nowrap; }
  .user-card { margin-top: 0; }
  .content { padding: 24px 16px 60px; }
  .content-header, .utility-panel, .form-footer { align-items: stretch; flex-direction: column; }
  .stats { grid-template-columns: 1fr; }
  .panel { padding: 19px 15px; }
  .attendance-target, .assignment-row { grid-template-columns: 1fr; }
  .assignment-actions { justify-content: flex-start; }
}
