/*
 * 吉米科技赛事工作台
 * Visual tokens follow the original competition application's variables.scss
 * and apple-visual-skin.scss. This file contains presentation only.
 */

:root {
  --bg: #f5f5f7;
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --accent-dark: #005bb5;
  --line: rgba(0, 0, 0, 0.08);
  --line-strong: rgba(0, 0, 0, 0.14);
  --paper: rgba(255, 255, 255, 0.82);
  --paper-strong: rgba(255, 255, 255, 0.94);
  --paper-muted: rgba(245, 245, 247, 0.78);
  --input-bg: rgba(255, 255, 255, 0.88);
  --highlight: rgba(0, 113, 227, 0.12);
  --danger: #ff3b30;
  --error: #b42318;
  --success: #34c759;
  --warning: #ff9f0a;
  --warn: #b45f00;
  --radius: 16px;
  --control-radius: 12px;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.08);
  --shadow-soft: 0 8px 24px rgba(0, 0, 0, 0.06);
  --shadow-input: inset 0 1px 2px rgba(0, 0, 0, 0.05);
  --transition: 180ms cubic-bezier(0.25, 0.1, 0.25, 1);
}

/* Foundation */

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 0%, rgba(255, 255, 255, 0.96), transparent 34rem),
    linear-gradient(180deg, #fbfbfd 0%, #f5f5f7 48%, #ffffff 100%);
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 2rem;
  font-weight: 650;
  line-height: 1.25;
  letter-spacing: -0.035em;
  overflow-wrap: anywhere;
}

h2 {
  font-size: 1.1875rem;
  font-weight: 650;
  line-height: 1.4;
  letter-spacing: -0.02em;
}

h3 {
  font-size: 1rem;
  font-weight: 600;
}

p {
  margin: 8px 0 16px;
}

a {
  color: var(--accent);
  text-decoration: none;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a,
input,
select,
textarea,
summary {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 0.875rem;
}

.eyebrow {
  display: inline-block;
  color: var(--accent-dark);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.07em;
}

/* Buttons and inputs */

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  padding: 10px 17px;
  border: 1px solid rgba(0, 113, 227, 0.18);
  border-radius: var(--control-radius);
  background: rgba(255, 255, 255, 0.9);
  color: var(--accent);
  box-shadow: 0 6px 16px rgba(0, 113, 227, 0.08);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.45;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background-color var(--transition),
    border-color var(--transition),
    box-shadow var(--transition),
    color var(--transition);
}

button:hover,
.button:hover {
  border-color: rgba(0, 113, 227, 0.26);
  background: rgba(0, 113, 227, 0.06);
  color: var(--accent-hover);
  box-shadow: 0 10px 24px rgba(0, 113, 227, 0.12);
  text-decoration: none;
}

button:active,
.button:active {
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.16);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.primary {
  border-color: rgba(0, 113, 227, 0.42);
  background: linear-gradient(180deg, var(--accent-hover), var(--accent));
  color: #ffffff;
  box-shadow: 0 12px 26px rgba(0, 113, 227, 0.2);
}

.primary:hover {
  border-color: rgba(0, 113, 227, 0.5);
  background: linear-gradient(180deg, #1686f5, var(--accent-hover));
  color: #ffffff;
  box-shadow: 0 12px 26px rgba(0, 113, 227, 0.26);
}

.secondary {
  border-color: var(--line);
  background: rgba(245, 245, 247, 0.92);
  color: #424245;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.025);
}

.secondary:hover {
  border-color: rgba(0, 113, 227, 0.2);
  background: rgba(0, 113, 227, 0.06);
  color: var(--accent);
}

.danger {
  border-color: rgba(255, 59, 48, 0.24);
  background: rgba(255, 59, 48, 0.045);
  color: var(--error);
  box-shadow: none;
}

.danger:hover {
  border-color: rgba(255, 59, 48, 0.36);
  background: rgba(255, 59, 48, 0.09);
  color: var(--error);
  box-shadow: 0 6px 16px rgba(255, 59, 48, 0.08);
}

label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
  color: #424245;
  font-size: 0.875rem;
  font-weight: 500;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--control-radius);
  background-color: var(--input-bg);
  color: var(--ink);
  box-shadow: var(--shadow-input);
  font-size: 1rem;
  transition:
    background-color var(--transition),
    border-color var(--transition),
    box-shadow var(--transition);
}

input::placeholder,
textarea::placeholder {
  color: #86868b;
  opacity: 1;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(0, 113, 227, 0.5);
  background-color: #ffffff;
  box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.14), var(--shadow-input);
}

select {
  appearance: none;
  padding-right: 35px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 20px, calc(100% - 12px) 20px;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}

textarea {
  resize: vertical;
}

input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-height: 18px;
  flex-shrink: 0;
  margin: 0;
  accent-color: var(--accent);
  box-shadow: none;
}

input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

input[type="file"] {
  padding: 7px;
  font-size: 0.875rem;
  box-shadow: none;
}

input[type="file"]::file-selector-button {
  margin-right: 10px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(245, 245, 247, 0.92);
  color: #424245;
  font: inherit;
  cursor: pointer;
}

/* Application shell */

.app-shell {
  display: grid;
  grid-template-columns: 212px minmax(0, 1fr);
  gap: 20px;
  min-height: 100vh;
  max-width: 1840px;
  margin: 0 auto;
  padding: 16px 20px 0;
}

.sidebar {
  position: sticky;
  top: 16px;
  display: flex;
  flex-direction: column;
  align-self: start;
  height: calc(100dvh - 32px);
  min-height: 0;
  overflow-y: auto;
  padding: 26px 14px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow-soft);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
}

.wordmark {
  display: block;
  padding: 0 12px;
  color: var(--ink);
  font-size: 1.375rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.035em;
}

.wordmark:hover {
  color: var(--accent);
  text-decoration: none;
}

.wordmark span {
  display: block;
  margin-top: 5px;
  color: var(--accent);
  font-size: 0.875rem;
  font-weight: 550;
  letter-spacing: 0.08em;
}

.sidebar-caption {
  margin: 9px 12px 28px;
  color: var(--muted);
  font-size: 0.8125rem;
}

.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  min-height: 45px;
  padding: 10px 14px;
  border: 1px solid transparent;
  border-radius: var(--control-radius);
  color: #424245;
  font-size: 0.9375rem;
  font-weight: 500;
  transition:
    background-color var(--transition),
    border-color var(--transition),
    color var(--transition);
}

.nav-item:hover {
  border-color: rgba(0, 113, 227, 0.1);
  background: rgba(0, 113, 227, 0.055);
  color: var(--accent);
  text-decoration: none;
}

.nav-item.active {
  border-color: rgba(0, 113, 227, 0.18);
  background: var(--highlight);
  color: var(--accent-dark);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.56);
  font-weight: 600;
}

.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding: 22px 8px 0;
}

.avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border: 1px solid rgba(0, 113, 227, 0.12);
  border-radius: 50%;
  background: rgba(0, 113, 227, 0.09);
  color: var(--accent);
  font-size: 1rem;
  font-weight: 600;
}

.sidebar-footer strong {
  display: block;
  color: var(--ink);
  font-size: 0.875rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.sidebar-footer small {
  display: block;
  margin-top: 1px;
  color: var(--muted);
  font-size: 0.75rem;
}

.logout {
  width: 100%;
  min-height: 40px;
  margin-top: 17px;
  border-color: var(--line);
  background: rgba(245, 245, 247, 0.85);
  color: var(--muted);
  box-shadow: none;
  font-size: 0.875rem;
}

.main-content {
  width: 100%;
  min-width: 0;
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 0 14px;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 112px;
  margin-bottom: 20px;
  padding: 20px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow-soft);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
}

.page-header h1 {
  margin: 6px 0 4px;
}

.page-header p {
  margin: 6px 0 0;
  font-size: 0.9375rem;
}

.page-header > .button {
  flex-shrink: 0;
}

.selection-bar {
  margin-bottom: 20px;
  padding: 18px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.035);
}

.selection-date {
  display: block;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.875rem;
}

.page-footer {
  padding: 18px 12px;
  color: #86868b;
  font-size: 0.75rem;
  text-align: center;
}

/* Cards and form structure */

.panel,
.stat-card,
.signature-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow-soft);
}

.panel {
  margin-bottom: 20px;
  padding: 24px;
}

.panel > h2 {
  margin-bottom: 20px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 96px;
  padding: 20px 24px;
}

.stat-card span {
  color: var(--muted);
  font-size: 0.875rem;
}

.stat-card strong {
  color: var(--accent);
  font-size: 1.875rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.section-heading p {
  margin: 5px 0 0;
}

.section-heading > span {
  font-size: 0.875rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.wide,
.form-actions {
  grid-column: 1 / -1;
}

.form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
}

.inline-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px;
  min-width: 0;
}

.inline-form label {
  flex: 1;
  min-width: 180px;
}

.inline-form button {
  flex-shrink: 0;
}

.stack {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 16px;
}

.stack > button {
  align-self: flex-start;
}

.stack > p {
  margin: 0;
}

.stack.compact {
  min-width: 220px;
  margin: 16px 0;
  gap: 10px;
}

.check {
  flex-direction: row;
  align-items: center;
  gap: 10px;
  color: #424245;
  font-size: 0.875rem;
  font-weight: 400;
}

.check-list {
  display: grid;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--control-radius);
  background: rgba(255, 255, 255, 0.6);
}

.check-list > .check {
  min-height: 47px;
  padding: 12px 15px;
  border-bottom: 1px solid var(--line);
}

.check-list > .check:last-child {
  border-bottom: 0;
}

.check-list > .check:hover {
  background: rgba(0, 113, 227, 0.045);
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

fieldset {
  min-width: 0;
  margin: 0;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: var(--control-radius);
}

legend {
  padding: 0 7px;
  color: #424245;
  font-size: 0.875rem;
  font-weight: 600;
}

.button-row,
.link-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
}

.button-row {
  gap: 10px;
}

.button-row .button {
  min-height: 40px;
  padding: 8px 13px;
  font-size: 0.875rem;
}

.link-row {
  gap: 15px;
}

/* Tables, selection and status */

.table-scroll {
  max-width: 100%;
  margin-top: 18px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  border: 1px solid var(--line);
  border-radius: var(--control-radius);
  background: rgba(255, 255, 255, 0.5);
  scrollbar-color: #c7c7cc transparent;
  scrollbar-width: thin;
}

table {
  width: 100%;
  border-collapse: collapse;
  color: var(--ink);
  font-size: 0.875rem;
  white-space: normal;
}

th,
td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  overflow-wrap: anywhere;
}

th {
  background: rgba(245, 245, 247, 0.88);
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
}

tbody tr:last-child td,
tbody tr:last-child th[scope="row"] {
  border-bottom: 0;
}

tbody tr:hover td,
tbody tr:hover th[scope="row"] {
  background: rgba(0, 113, 227, 0.055);
}

.order-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 30px;
  padding: 0 6px;
  border: 1px solid rgba(0, 113, 227, 0.1);
  border-radius: 8px;
  background: rgba(0, 113, 227, 0.075);
  color: var(--accent-dark);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.badge,
.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 3px 8px;
  border: 1px solid rgba(0, 113, 227, 0.13);
  border-radius: 7px;
  background: rgba(0, 113, 227, 0.09);
  color: var(--accent-dark);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.56);
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.5;
  vertical-align: middle;
  white-space: nowrap;
}

.status-badge {
  margin-top: 5px;
}

.status-active {
  border-color: rgba(52, 199, 89, 0.2);
  background: rgba(52, 199, 89, 0.14);
  color: #167a34;
}

.status-disabled,
.status-expired,
.status-deleted {
  border-color: rgba(255, 59, 48, 0.16);
  background: rgba(255, 59, 48, 0.1);
  color: var(--error);
}

.status-not_started,
.badge-warning {
  border-color: rgba(255, 159, 10, 0.2);
  background: rgba(255, 159, 10, 0.12);
  color: #9b5700;
}

.notice {
  margin-bottom: 20px;
  padding: 14px 17px;
  border: 1px solid;
  border-radius: var(--control-radius);
  font-size: 0.9375rem;
  overflow-wrap: anywhere;
}

.notice p {
  margin: 8px 0 0;
}

.notice ul {
  margin: 0;
  padding-left: 20px;
}

.notice.success {
  border-color: rgba(52, 199, 89, 0.22);
  background: rgba(52, 199, 89, 0.09);
  color: #167a34;
}

.notice.error {
  border-color: rgba(255, 59, 48, 0.2);
  background: rgba(255, 59, 48, 0.055);
  color: var(--error);
}

.notice.warning {
  border-color: rgba(255, 159, 10, 0.23);
  background: rgba(255, 159, 10, 0.08);
  color: #9b5700;
}

.empty {
  padding: 40px 20px;
  color: var(--muted);
  text-align: center;
}

details > summary {
  color: #424245;
  font-weight: 600;
  line-height: 1.6;
  list-style-position: inside;
  cursor: pointer;
}

details > summary:hover {
  color: var(--accent);
}

details[open] > summary {
  margin-bottom: 16px;
}

/* Draws, training plans and signatures */

.add-player,
.participant-detail {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.participant-detail h3 {
  margin: 18px 0 5px;
}

.draw-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 26px;
  margin-top: 12px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.draw-controls p {
  margin: 7px 0 12px;
  font-size: 0.875rem;
}

.draw-controls button {
  min-width: 130px;
}

.preview-block {
  border-color: rgba(0, 113, 227, 0.23);
  background: rgba(250, 253, 255, 0.94);
}

.preview-block .stack {
  margin-top: 20px;
}

.signature-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
}

.signature-card {
  padding: 20px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.035);
}

.signature-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 130px;
  margin-bottom: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(245, 245, 247, 0.75);
}

.signature-preview img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.signature-card p {
  font-size: 0.875rem;
}

/* Manual score entry */

.score-instructions {
  margin-bottom: 18px;
  padding: 16px 18px;
  border: 1px solid rgba(0, 113, 227, 0.12);
  border-radius: var(--control-radius);
  background: rgba(0, 113, 227, 0.045);
  color: #424245;
  font-size: 0.875rem;
}

.score-instructions p {
  margin: 0 0 9px;
}

.score-instructions p:last-child {
  margin-bottom: 0;
}

.score-entry-table {
  min-width: 790px;
}

.score-entry-table .athlete-name {
  min-width: 90px;
  background: transparent;
  color: var(--ink);
  font-weight: 400;
  white-space: normal;
}

.athlete-name strong,
.score-subgroup {
  display: block;
}

.score-cell {
  padding: 10px 7px;
}

.score-input {
  min-width: 86px;
  max-width: 112px;
  padding: 10px 8px;
  color: var(--accent-dark);
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.score-input::placeholder {
  color: #86868b;
  font-size: 0.875rem;
}

.dns-control {
  white-space: nowrap;
}

.confirmed-total {
  color: var(--accent);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.score-confirmation {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.score-confirmation p {
  margin: 0;
}

/* Account management and login audit */

.account-subline {
  display: block;
  margin-top: 4px;
}

.account-table {
  min-width: 850px;
}

.account-table th[scope="row"] {
  background: transparent;
  color: var(--ink);
  font-weight: 400;
}

.selected-account td,
.selected-account th[scope="row"] {
  background: var(--highlight);
}

.selected-account:hover td,
.selected-account:hover th[scope="row"] {
  background: rgba(0, 113, 227, 0.14);
}

.account-table td:nth-child(2) > span {
  display: block;
  width: fit-content;
}

.account-indicators {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 5px;
}

.pagination {
  margin-top: 18px;
}

.account-danger {
  margin-top: 24px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.account-danger > summary {
  color: var(--error);
}

.admin-danger-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.user-agent-cell {
  min-width: 150px;
  max-width: 280px;
}

.user-agent-cell summary {
  font-size: 0.8125rem;
  font-weight: 400;
  overflow-wrap: anywhere;
}

.user-agent-text {
  display: block;
  margin-top: 8px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.session-table {
  min-width: 800px;
}

/* Original table-management tabs and scorebook workspace */

.module-tabs {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.module-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 58px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 6px 16px rgba(0, 113, 227, 0.08);
  font-size: 0.98rem;
  font-weight: 900;
  text-align: center;
  line-height: 1.4;
  transition: border-color var(--transition), background-color var(--transition), color var(--transition);
}

.module-tab:hover {
  border-color: rgba(0, 113, 227, 0.26);
  background: rgba(0, 113, 227, 0.08);
  color: var(--accent);
  text-decoration: none;
}

.module-tab.active {
  border-color: rgba(0, 113, 227, 0.26);
  background: var(--highlight);
  color: var(--accent);
}

.module-icon {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.06);
  font-size: 0.78rem;
}

.module-tab.active .module-icon {
  background: rgba(255, 255, 255, 0.56);
}

.scorebook-feature {
  overflow: hidden;
  margin-bottom: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.08);
}

.scorebook-feature .panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
}

.scorebook-feature .panel-title h2 {
  margin-bottom: 4px;
  font-size: 1.35rem;
}

.scorebook-feature .panel-title span {
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 700;
}

.scorebook-feature .panel-title > button {
  flex-shrink: 0;
}

.scorebook-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: end;
  gap: 14px;
  padding: 22px 24px 14px;
  background: #fbfdff;
}

.scorebook-grid > label {
  position: relative;
  display: grid;
  gap: 8px;
}

.scorebook-grid label > span:first-child {
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 800;
}

.scorebook-feature input:not([type="checkbox"]),
.scorebook-feature select,
.scorebook-feature textarea {
  min-height: 44px;
  border-radius: 8px;
}

.scorebook-grid:has(.scorebook-file-name) {
  row-gap: 36px;
  padding-bottom: 36px;
}

.scorebook-grid .scorebook-file-name {
  position: absolute;
  top: calc(100% + 3px);
  max-width: 100%;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scorebook-feature:has(select[name="head_signature_mode"] option[value="unified"]:checked) .scorebook-signature-project,
.scorebook-feature:has(select[name="head_signature_mode"] option[value="by_project"]:checked) .scorebook-signature-unified {
  display: none;
}

.scorebook-sections {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 18px 24px;
}

.scorebook-sections > label {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 10px 14px;
  border: 1px solid rgba(0, 113, 227, 0.08);
  border-radius: 8px;
  background: #f8fbff;
  color: var(--ink);
  font-weight: 800;
}

.scorebook-sections input {
  width: 16px;
  height: 16px;
  min-height: 16px;
}

.scorebook-sportsmanship {
  display: block;
  width: calc(100% - 36px);
  margin: 0 18px;
}

.scorebook-feature .sportsmanship-box {
  display: block;
  width: 100%;
  min-height: 112px;
  padding: 12px 14px;
  line-height: 1.55;
}

.scorebook-groups {
  display: flex;
  flex-direction: column;
  padding: 18px 24px;
  counter-reset: scorebook-selected;
}

.scorebook-groups .modal-tools {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  order: -1;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
}

.scorebook-count {
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 700;
}

.scorebook-selected-count::before {
  content: counter(scorebook-selected);
}

.scorebook-groups .batch-list {
  max-height: 300px;
  overflow-y: auto;
  padding: 12px 18px;
}

.scorebook-groups .batch-item {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  padding: 10px 6px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  font-weight: 400;
}

.scorebook-groups .batch-item:has(input:checked) {
  counter-increment: scorebook-selected;
}

.scorebook-groups .batch-item > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scorebook-empty {
  margin: 0;
  padding: 16px 0;
  color: var(--muted);
  font-size: 0.875rem;
}

.scorebook-actions {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 14px;
  padding: 18px 24px;
  border-top: 1px solid var(--line);
}

.scorebook-feature:not(:has(input[name="sections"]:checked)) button[value="export"],
.scorebook-feature:not(:has(input[name="group_ids"]:checked)) button[value="export"] {
  opacity: 0.45;
  pointer-events: none;
  box-shadow: none;
}

.scorebook-export-time {
  width: 216px;
  max-width: 100%;
}

.scorebook-feedback {
  margin: 18px 24px 0;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Login and error pages */

.login-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 440px);
  align-items: center;
  gap: 8vw;
  min-height: 100vh;
  max-width: 1440px;
  margin: 0 auto;
  padding: 8vh 8vw;
}

.login-brand {
  padding: 20px 0;
}

.login-brand .eyebrow {
  font-size: 0.9375rem;
  font-weight: 650;
  letter-spacing: 0.04em;
}

.login-brand h1 {
  margin: 22px 0;
  color: var(--ink);
  font-size: clamp(2.5rem, 3.6vw, 3.75rem);
  font-weight: 650;
  line-height: 1.22;
  letter-spacing: -0.055em;
}

.login-brand p {
  max-width: 27rem;
  color: var(--muted);
  font-size: 1.0625rem;
  line-height: 1.8;
}

.brand-line {
  width: 52px;
  height: 4px;
  margin: 38px 0 18px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--accent), #69adf5);
}

.login-brand > span:last-child {
  color: var(--muted);
  font-size: 0.875rem;
}

.login-card {
  width: 100%;
  max-width: 440px;
  padding: 38px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--paper);
  box-shadow: var(--shadow);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
}

.login-card h2 {
  margin: 10px 0 8px;
  font-size: 1.625rem;
  font-weight: 650;
}

.login-card > p {
  margin-bottom: 26px;
  font-size: 0.875rem;
}

.login-card .stack > button {
  width: 100%;
  margin-top: 8px;
}

.login-card > .small {
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 0.8125rem;
  line-height: 1.7;
}

.error-page {
  width: calc(100% - 40px);
  max-width: 640px;
  margin: 12vh auto;
  padding: 38px;
}

.error-page h1 {
  margin: 15px 0 22px;
}

/* Responsive layouts */

@media (min-width: 1450px) {
  .form-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 184px minmax(0, 1fr);
    gap: 16px;
    padding-right: 16px;
    padding-left: 16px;
  }

  .sidebar {
    padding-right: 10px;
    padding-left: 10px;
  }

  .page-header,
  .panel {
    padding: 20px;
  }

  .section-heading {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .checkbox-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stat-card {
    gap: 10px;
    padding: 18px 16px;
  }

  .login-layout {
    gap: 6vw;
    padding: 8vh 6vw;
  }

  .login-card {
    padding: 30px;
  }
}

@media (max-width: 920px) {
  .module-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .module-tab {
    justify-content: flex-start;
    padding-right: 14px;
    padding-left: 14px;
    text-align: left;
  }

  .scorebook-grid,
  .scorebook-sections {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 760px) {
  .app-shell {
    display: block;
    padding: 12px 12px 0;
  }

  .sidebar {
    position: relative;
    top: auto;
    height: auto;
    min-height: 0;
    margin-bottom: 16px;
    padding: 19px 16px 14px;
  }

  .wordmark {
    width: fit-content;
    max-width: calc(100% - 94px);
    padding: 0;
    font-size: 1.25rem;
  }

  .wordmark span {
    display: inline;
    margin-left: 7px;
    font-size: 0.875rem;
    letter-spacing: 0;
  }

  .sidebar-caption {
    margin: 4px 0 15px;
    font-size: 0.75rem;
  }

  .sidebar nav {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 7px;
  }

  .nav-item {
    min-height: 40px;
    padding: 8px 11px;
    font-size: 0.875rem;
  }

  .sidebar-footer {
    display: none;
  }

  .sidebar > form {
    position: absolute;
    top: 15px;
    right: 16px;
  }

  .logout {
    min-height: 36px;
    margin-top: 0;
    padding: 8px 11px;
    font-size: 0.8125rem;
  }

  .main-content {
    padding-bottom: 8px;
  }

  .page-header {
    align-items: flex-start;
    min-height: 0;
    gap: 12px;
    margin-bottom: 16px;
    padding: 18px 16px;
  }

  .page-header h1 {
    font-size: 1.625rem;
  }

  .page-header p {
    font-size: 0.875rem;
  }

  .page-header > .button {
    min-height: 36px;
    padding: 8px 10px;
    font-size: 0.8125rem;
  }

  .eyebrow {
    font-size: 0.6875rem;
  }

  .selection-bar,
  .panel {
    margin-bottom: 16px;
    padding: 18px 16px;
  }

  .inline-form label {
    min-width: 150px;
  }

  .form-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }

  .stats-grid {
    gap: 9px;
    margin-bottom: 16px;
  }

  .stat-card {
    display: block;
    min-height: 90px;
    padding: 15px 12px;
  }

  .stat-card span {
    display: block;
    font-size: 0.8125rem;
  }

  .stat-card strong {
    display: block;
    margin-top: 7px;
    font-size: 1.625rem;
  }

  .section-heading {
    gap: 12px;
    margin-bottom: 18px;
  }

  .draw-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 18px;
  }

  .draw-controls button {
    align-self: flex-start;
  }

  .signature-grid,
  .admin-danger-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  th,
  td {
    padding: 12px 9px;
  }

  .score-entry-table {
    min-width: 710px;
  }

  .score-entry-table th,
  .score-entry-table td {
    padding: 11px 7px;
  }

  .score-input {
    min-width: 80px;
  }

  .score-confirmation .check {
    align-items: flex-start;
  }

  .score-confirmation .check input {
    margin-top: 3px;
  }

  .admin-stats .stat-card span {
    font-size: 0.75rem;
  }

  .login-layout {
    display: flex;
    flex-direction: column;
    gap: 28px;
    padding: 40px 20px;
  }

  .login-brand {
    width: 100%;
    max-width: 440px;
    padding: 0;
  }

  .login-brand h1 {
    margin: 14px 0;
    font-size: 2.125rem;
  }

  .login-brand p {
    margin-bottom: 0;
    font-size: 1rem;
  }

  .brand-line,
  .login-brand > span:last-child {
    display: none;
  }

  .login-card {
    padding: 28px;
  }

  .error-page {
    width: calc(100% - 32px);
    margin: 10vh auto;
    padding: 26px;
  }
}

@media (max-width: 400px) {
  .checkbox-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .page-header {
    flex-wrap: wrap;
  }

  .login-layout {
    padding-right: 16px;
    padding-left: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms;
    animation-duration: 0.01ms;
    animation-iteration-count: 1;
  }
}
