/* ===================================================================
   SOLL Lineup App — styles.css
   =================================================================== */

:root {
  --brand-navy: #062448;
  --brand-navy-2: #14294d;
  --brand-red: #a3301f;
  --brand-red-2: #8d2418;
  --brand-cream: #f6f3ec;

  --color-bg: var(--brand-cream);
  --color-surface: #ffffff;
  --color-border: #d8d3c6;
  --color-text: var(--brand-navy);
  --color-muted: #4a5568;
  --color-primary: var(--brand-navy);
  --color-primary-dark: var(--brand-navy);
  --color-primary-hover: var(--brand-navy-2);

  --color-hard-bg: #fde2e1;
  --color-hard-border: #d33b34;
  --color-soft-bg: #fff3cd;
  --color-soft-border: #c98a06;
  --color-warn-bg: #e3e9fb;
  --color-warn-border: #4a63c0;

  --radius: 6px;

  --text-xs:   0.70rem;
  --text-sm:   0.82rem;
  --text-base: 0.90rem;
  --text-md:   1.00rem;
  --text-lg:   1.10rem;
  --text-xl:   1.40rem;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.4;
}

h1, h2, h3, h4 { margin: 0 0 0.4em 0; line-height: 1.25; }
h2 { font-size: var(--text-xl); border-bottom: 2px solid var(--brand-navy); padding-bottom: 0.3em; }
h3 { font-size: var(--text-lg); }
h4 { font-size: var(--text-md); }

p { margin: 0.4em 0; }

.hint { color: var(--color-muted); font-size: var(--text-sm); }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: -40px; left: 0;
  background: var(--color-primary-dark);
  color: #fff;
  padding: 0.5rem 1rem;
  font-size: var(--text-base);
  font-weight: 700;
  z-index: 200;
  border-radius: 0 0 var(--radius) 0;
  text-decoration: none;
  transition: top 0.15s;
}
.skip-link:focus { top: 0; }

.empty-state {
  background: #f6f3ec;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin: 0.5rem 0 1rem;
  font-size: var(--text-base);
}

/* ---------------- App bar ---------------- */
.app-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  background: var(--color-primary-dark);
  color: #fff;
  padding: 0.6rem 1rem;
  position: sticky;
  top: 0;
  z-index: 50;
}
.app-logo {
  height: 44px; width: 44px;
  display: block;
  background: #fff;
  border-radius: 50%;
  padding: 2px;
  flex: 0 0 auto;
}
.app-bar-title h1 { font-size: 1.15rem; margin: 0; }
.app-bar-sub { font-size: var(--text-sm); opacity: 0.85; }
.app-nav { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.nav-btn {
  background: rgba(255,255,255,0.12);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: var(--radius);
  padding: 0.4rem 0.85rem;
  cursor: pointer;
  font-size: var(--text-base);
  min-height: 34px;
}
.nav-btn:hover { background: rgba(255,255,255,0.25); }
.nav-btn.active { background: #fff; color: var(--color-primary-dark); font-weight: 600; }
.nav-btn-readme { background: var(--brand-cream); border-color: var(--brand-cream); color: var(--brand-navy); }
.nav-btn-readme:hover { background: #fff; }
.nav-btn-readme.active { background: #fff; color: var(--brand-navy); }

.app-bar-controls {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-left: auto;
  flex-wrap: wrap;
}
.app-bar-controls select {
  font-size: var(--text-sm);
  padding: 0.3rem 0.5rem;
  border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,0.4);
  background: #fff;
  color: var(--color-text);
  cursor: pointer;
  min-height: 30px;
}
/* Utility buttons in the app bar (Back up / Restore) */
.btn-appbar-util {
  font-size: var(--text-xs);
  font-family: inherit;
  padding: 0.28rem 0.55rem;
  border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,0.35);
  background: rgba(255,255,255,0.12);
  color: #fff;
  cursor: pointer;
  min-height: 28px;
  white-space: nowrap;
}
.btn-appbar-util:hover { background: rgba(255,255,255,0.25); }

.inline-label { font-size: var(--text-sm); white-space: nowrap; }

/* ---------------- Main / views ---------------- */
#app-main { padding: 1rem; max-width: 1400px; margin: 0 auto; }
.view { display: none; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 1rem 1.25rem; margin-bottom: 1.5rem; }
.view.active { display: block; }

/* ---------------- Forms / tables ---------------- */
.form-row { display: flex; flex-wrap: wrap; gap: 0.6rem 1rem; align-items: center; margin: 0.6rem 0 1rem; }
.form-row label { font-weight: 600; font-size: var(--text-sm); }
.form-row input[type="text"],
.form-row input[type="number"],
.form-row input[type="date"],
.form-row input[type="time"],
.form-row select {
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: var(--text-base);
}

table.data-table {
  border-collapse: collapse;
  width: 100%;
  margin: 0.5rem 0;
  font-size: var(--text-sm);
}
table.data-table th, table.data-table td {
  border: 1px solid var(--color-border);
  padding: 0.35rem 0.5rem;
  text-align: left;
  vertical-align: middle;
}
table.data-table thead th {
  background: #f6f3ec;
  font-weight: 600;
  position: sticky;
  top: 0;
}
table.data-table tbody tr:nth-child(even) { background: #fafbfc; }
.table-scroll { overflow-x: auto; }

/* Narrow columns */
.col-slot  { width: 2.5rem; text-align: center; color: var(--color-muted); }
.col-jersey { width: 3.5rem; text-align: center; font-weight: 600; }

/* Boolean cells */
.bool-yes { color: #1a7a3c; font-weight: 700; text-align: center; }
.bool-no  { color: var(--color-muted); text-align: center; }

button {
  font-family: inherit;
  font-size: var(--text-base);
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--color-primary);
  background: var(--color-primary);
  color: #fff;
  border-radius: var(--radius);
  cursor: pointer;
  min-height: 36px;
}
button:hover { background: var(--brand-navy-2); border-color: var(--brand-navy-2); }
button.btn-secondary { background: #fff; color: var(--color-primary); }
button.btn-secondary:hover { background: #efeadd; }
button.btn-danger {
  background: #fff;
  color: var(--brand-red);
  border: 1px solid var(--brand-red);
}
button.btn-danger:hover {
  background: var(--brand-red);
  color: #fff;
  border-color: var(--brand-red);
}

/* Primary XL — Auto-generate */
button.btn-primary-xl {
  font-size: var(--text-md);
  font-weight: 700;
  padding: 0.55rem 1.2rem;
  background: var(--brand-red);
  border-color: var(--brand-red);
  color: #fff;
  letter-spacing: 0.01em;
  min-height: 40px;
}
button.btn-primary-xl:hover { background: var(--brand-red-2); border-color: var(--brand-red-2); }

button.btn-icon {
  padding: 0.3rem 0.6rem;
  font-size: var(--text-sm);
  min-height: 28px;
}
button:disabled { opacity: 0.45; cursor: not-allowed; }

button.link-btn {
  background: none;
  border: none;
  color: var(--color-primary);
  font-size: var(--text-sm);
  padding: 0;
  min-height: auto;
  text-decoration: underline;
  cursor: pointer;
  font-weight: 600;
}
button.link-btn:hover { color: var(--color-primary-dark); background: none; border: none; }

input[type="checkbox"] { width: 1.1rem; height: 1.1rem; cursor: pointer; }

/* ---------------- Badges ---------------- */
.badge {
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 0.15rem 0.45rem;
  border-radius: 3px;
  vertical-align: middle;
  margin-left: 0.4rem;
}
.badge-rule { background: var(--brand-navy); color: #fff; }
.badge-convention { background: #7a5500; color: #fff; white-space: normal; }

/* ---- Schedule entry Type/Status badges ---- */
.sbadge {
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: 700;
  padding: 0.1rem 0.5rem;
  border-radius: 12px;
  white-space: nowrap;
}
.sbadge-type { background: #e5e0d4; color: var(--brand-navy); }
.sbadge-tentative { background: #fef3c7; color: #92400e; }
.sbadge-confirmed { background: #dcfce7; color: #166534; }

/* ---- Schedule filter controls ---- */
.schedule-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  margin: 0.4rem 0 0.8rem;
}
.schedule-filters label { font-weight: 600; font-size: var(--text-sm); }
.schedule-filters select {
  padding: 0.25rem 0.4rem;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  font-family: inherit;
}

.rule-heading { color: var(--color-primary-dark); }
.convention-heading { color: #8a6300; }
.convention-note {
  background: #fff8e6;
  border: 1px solid var(--color-soft-border);
  border-left-width: 4px;
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
  font-size: var(--text-sm);
  color: #6b4f04;
}

/* ---------------- Schedule — active game row & Open Lineup button ---------------- */
tr.active-game-row td {
  background: #efeadd !important;
}
tr.active-game-row:nth-child(even) td {
  background: #e5e0d4 !important;
}

.schedule-actions-cell {
  white-space: nowrap;
}

/* "Open Lineup →" button in schedule table */
.btn-open-lineup {
  font-size: var(--text-xs);
  font-weight: 700;
  padding: 0.25rem 0.55rem;
  border-radius: var(--radius);
  border: 1px solid var(--color-primary);
  background: var(--color-primary);
  color: #fff;
  cursor: pointer;
  min-height: 26px;
  margin-right: 0.3rem;
  white-space: nowrap;
}
.btn-open-lineup:hover { background: var(--color-primary-dark); border-color: var(--color-primary-dark); }

/* Active state: brand red "✓ Active" */
.btn-open-lineup.btn-open-lineup-active {
  background: var(--brand-red);
  border-color: var(--brand-red);
  color: #fff;
}
.btn-open-lineup.btn-open-lineup-active:hover { background: var(--brand-red-2); border-color: var(--brand-red-2); }

/* "Add & Open Lineup →" button in game modal */
.btn-add-open {
  font-weight: 700;
  background: var(--brand-red);
  border-color: var(--brand-red);
  color: #fff;
}
.btn-add-open:hover { background: var(--brand-red-2); border-color: var(--brand-red-2); }

/* Lineup saved tag in schedule (small green label) */
.lineup-saved-tag {
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: 700;
  color: #1a7a3c;
  border: 1px solid #1a7a3c;
  border-radius: 3px;
  padding: 0.1rem 0.35rem;
  margin-left: 0.3rem;
  white-space: nowrap;
  vertical-align: middle;
}

/* ---------------- Game summary bar (lineup view) ---------------- */
.game-summary-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  background: var(--color-primary-dark);
  color: #fff;
  border-radius: var(--radius);
  padding: 0.5rem 0.85rem;
  margin-bottom: 0.75rem;
  font-size: var(--text-sm);
}
.game-summary-bar.hidden { display: none; }
.gsb-team {
  font-weight: 700;
  font-size: var(--text-base);
}
.gsb-info { opacity: 0.9; }
.gsb-result {
  margin-left: auto;
  font-weight: 700;
  background: rgba(255,255,255,0.15);
  border-radius: 4px;
  padding: 0.15rem 0.5rem;
}

/* ---------------- Inline game selector ---------------- */
.inline-game-selector {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  background: #f6f3ec;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.6rem 0.85rem;
  margin-bottom: 0.5rem;
}
.inline-game-label {
  font-weight: 700;
  font-size: var(--text-base);
  white-space: nowrap;
}
.inline-game-selector select {
  font-size: var(--text-base);
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  min-width: 220px;
  max-width: 100%;
}
.inline-game-hint { font-size: var(--text-sm); }

/* ---------------- Legend ---------------- */
.legend-box {
  background: #fbfcfe;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.6rem 0.9rem;
  margin: 0.75rem 0 1.25rem;
}
.legend-box summary { cursor: pointer; font-weight: 700; font-size: var(--text-base); }
.legend-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-top: 0.75rem;
}
.legend-grid ul { margin: 0.3em 0; padding-left: 1.2em; }
.legend-grid li { margin-bottom: 0.35em; }
.flag-swatch {
  display: inline-block;
  width: 1rem; height: 1rem;
  border-radius: 3px;
  margin-right: 0.4rem;
  vertical-align: middle;
  border: 1px solid rgba(0,0,0,0.25);
}
.flag-swatch.flag-hard { background: var(--color-hard-bg); border-color: var(--color-hard-border); }
.flag-swatch.flag-soft { background: var(--color-soft-bg); border-color: var(--color-soft-border); }
.flag-swatch.flag-warn { background: var(--color-warn-bg); border-color: var(--color-warn-border); }

/* ---------------- Lineup screen blocks ---------------- */
.lineup-block { margin: 1.4rem 0; }
.lineup-toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

/* ---------------- Roster filter & sortable headers ---------------- */
.roster-controls-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0.5rem 0 0.6rem;
}
.roster-filter-input {
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: var(--text-base);
  width: 18rem;
  max-width: 100%;
}
.roster-filter-input:focus {
  outline: none;
  border-color: var(--brand-navy);
  box-shadow: 0 0 0 2px rgba(6,36,72,0.15);
}
th.sortable-col { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable-col:hover { background: #e5e0d4; }
th.sort-active { background: #e5e0d4 !important; color: var(--color-primary-dark); }

/* ---------------- Game Settings panel ---------------- */
.settings-panels {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.75rem 1.5rem;
  padding: 0.1rem 0 0.25rem;
}
.settings-panel {
  padding: 0.6rem 0.75rem;
  background: #f8f9fb;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}
.settings-panel h4 {
  margin: 0 0 0.5rem;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-muted);
  font-weight: 700;
}
.settings-panel .form-row { margin: 0 0 0.25rem; gap: 0.35rem 0.55rem; align-items: center; }
input.setting-num { width: 4rem; text-align: center; }
.pref-row { display: flex; align-items: center; gap: 0.5rem; margin: 0.3rem 0; flex-wrap: wrap; }
.must-enforce-label {
  color: var(--color-muted);
  font-size: var(--text-sm) !important;
  font-weight: 600;
  border-left: 2px solid var(--color-border);
  padding-left: 0.55rem;
}
.must-enforce-label input[type="checkbox"] { width: 0.9rem !important; height: 0.9rem !important; }
.settings-hint { font-size: var(--text-xs); margin-top: 0.4rem; line-height: 1.3; }
.settings-hint-inline { font-size: var(--text-sm); font-weight: 400; }

/* Collapsible block details */
.block-details {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: #fff;
}
.block-details > summary {
  display: flex;
  align-items: center;
  cursor: pointer;
  padding: 0.55rem 0.85rem;
  list-style: none;
  user-select: none;
  border-radius: var(--radius);
  gap: 0.5rem;
}
.block-details > summary::-webkit-details-marker { display: none; }
.block-details > summary::before {
  content: '▶';
  font-size: var(--text-xs);
  color: var(--color-muted);
  flex: 0 0 auto;
  transition: transform 0.15s ease;
}
.block-details[open] > summary::before { transform: rotate(90deg); }
.block-details > summary:hover { background: #f6f3ec; border-radius: var(--radius); }
.block-details > summary h3 { margin: 0; font-size: var(--text-lg); flex: 1 1 auto; }
.block-details[open] > summary { border-bottom: 1px solid var(--color-border); border-radius: var(--radius) var(--radius) 0 0; }
.block-details > :not(summary) { padding: 0.75rem 0.85rem; }
.block-details > .form-row { padding-top: 0.6rem; }
.block-details > .convention-note { padding-top: 0; }

.toolbar-check { display: inline-flex; align-items: center; gap: 0.4rem; font-size: var(--text-sm); font-weight: 600; white-space: nowrap; cursor: pointer; }
.toolbar-check input[type="checkbox"] { width: 1rem; height: 1rem; }

/* Save status with flash animation */
.save-status { font-size: var(--text-sm); color: var(--color-muted); }
.save-status.ok { color: #1f8a4c; font-weight: 600; }
@keyframes save-flash {
  0%   { opacity: 0; transform: translateY(-4px); }
  15%  { opacity: 1; transform: translateY(0); }
  80%  { opacity: 1; }
  100% { opacity: 0.6; }
}
.save-status.flash { animation: save-flash 2.5s ease forwards; }

.hidden { display: none !important; }

/* Field diagram */
.field-diagram {
  display: block;
  max-width: 360px;
  width: 100%;
  height: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: #fff;
}

/* Attendance */
.attendance-controls { display: flex; gap: 0.5rem; margin: 0.25rem 0 0.6rem; flex-wrap: wrap; }
.attendance-list { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.attendance-chip {
  display: flex; align-items: center; gap: 0.4rem;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 0.3rem 0.7rem;
  background: #fff;
  font-size: var(--text-sm);
  min-height: 32px;
  cursor: pointer;
  transition: background 0.12s;
}
.attendance-chip:hover { background: #f6f3ec; }
.attendance-chip.is-out { background: #f1f1f1; color: var(--color-muted); text-decoration: line-through; }
.attendance-chip.is-out:hover { background: #e8e8e8; }
.attendance-chip.is-callup { border-color: var(--color-primary); }
.attendance-chip .tag-callup {
  font-size: var(--text-xs); text-transform: uppercase; font-weight: 700;
  background: var(--color-primary); color: #fff; border-radius: 3px; padding: 0 0.3rem;
  text-decoration: none;
}

/* Attendance summary line ("X present · Y absent") */
.attendance-summary {
  width: 100%;
  font-size: var(--text-sm);
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0;
  flex-wrap: wrap;
}
.att-present { color: #1a7a3c; font-weight: 600; }
.att-absent  { color: #c0392b; font-weight: 600; }
.att-absent-zero { color: var(--color-muted); }
.att-warning {
  color: #7a5500;
  font-weight: 600;
  font-style: italic;
}

/* Bench cells */
.pos-bench {
  background: #e8e8e8 !important;
  color: #555 !important;
  font-style: italic;
}
.pos-bench-row td { background: #f5f5f5; }

.absent-note { font-style: italic; }

/* batting-order slot dropdown */
.batting-order-pos-select {
  font-size: var(--text-sm);
  padding: 0.15rem 0.3rem;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  margin-right: 0.4rem;
}

/* grid table cell selects */
.grid-table select, .grid-table td select {
  width: 100%;
  font-size: var(--text-sm);
  padding: 0.2rem;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  min-width: 60px;
  min-height: 28px;
}
.grid-table th, .counts-table th { white-space: nowrap; }

/* ---------------- Grid position cell colorization ---------------- */
/* P/C = Battery (dark blue tint) */
.td-battery {
  background: #dbeafe !important;
}
/* Infield (1B 2B 3B SS) = warm amber tint */
.td-infield {
  background: #fef3c7 !important;
}
/* Outfield (LF CF RF) = light green tint */
.td-outfield {
  background: #dcfce7 !important;
}
/* Bench = grey */
.td-bench-cell {
  background: #e5e7eb !important;
}

/* ---------------- Grid summary column (Field innings count) ---------------- */
.grid-summary-head {
  background: #f0f0f8 !important;
  border-left: 2px solid var(--color-border);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-muted);
}
.grid-summary-cell {
  border-left: 2px solid var(--color-border);
  text-align: center;
  padding: 0.2rem 0.4rem;
}
/* Field count badge */
.field-count {
  display: inline-block;
  font-size: var(--text-sm);
  font-weight: 700;
  border-radius: 999px;
  width: 1.6rem;
  height: 1.6rem;
  line-height: 1.6rem;
  text-align: center;
}
.field-count.fc-ok    { background: #dcfce7; color: #166534; }   /* ≥ 2 innings: green */
.field-count.fc-warn  { background: #fef3c7; color: #92400e; }   /* 1 inning: amber */
.field-count.fc-empty { background: #fde2e1; color: #b91c1c; }   /* 0 innings: red */

/* ---------------- Flags summary count bar ---------------- */
.flags-summary {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-muted);
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 0.4rem;
  margin-bottom: 0.6rem;
}

/* ---------------- Flag highlight classes ---------------- */
.flag-hard { background: var(--color-hard-bg) !important; outline: 2px solid var(--color-hard-border); outline-offset: -2px; }
.flag-soft { background: var(--color-soft-bg) !important; outline: 2px dashed var(--color-soft-border); outline-offset: -2px; }
.flag-warn { background: var(--color-warn-bg) !important; outline: 2px dotted var(--color-warn-border); outline-offset: -2px; }

.flags-panel-group { margin-bottom: 0.9rem; }
.flags-panel-group h4 { margin-bottom: 0.3rem; }
.flag-list { list-style: none; margin: 0; padding: 0; }
.flag-item {
  border-radius: var(--radius);
  border-left: 5px solid transparent;
  padding: 0.4rem 0.6rem;
  margin-bottom: 0.35rem;
  font-size: var(--text-sm);
}
.flag-item.flag-hard { border-left-color: var(--color-hard-border); background: var(--color-hard-bg); outline: none; }
.flag-item.flag-soft { border-left-color: var(--color-soft-border); background: var(--color-soft-bg); outline: none; }
.flag-item.flag-warn { border-left-color: var(--color-warn-border); background: var(--color-warn-bg); outline: none; }
.flag-empty-msg { color: #1f8a4c; font-weight: 600; }

.views-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }

/* ---------------- Player edit modal ---------------- */
.modal-title { margin: 0 0 1rem; font-size: 1.2rem; }

.player-section-title {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--color-muted);
  padding: 0.85rem 0 0.3rem;
  border-top: 1px solid var(--color-border);
  margin-top: 0.2rem;
}

.player-id-grid {
  display: grid;
  grid-template-columns: 5.5rem 1fr;
  gap: 0.55rem 0.9rem;
  margin-bottom: 0.55rem;
}
.player-name-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem 0.9rem;
  margin-bottom: 0.1rem;
}
.player-field { display: flex; flex-direction: column; gap: 0.2rem; }
.player-field-label {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-muted);
}
.player-field input {
  width: 100%;
  padding: 0.38rem 0.5rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: var(--text-base);
  font-family: inherit;
  transition: border-color 0.15s;
}
.player-field input:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 2px rgba(6,36,72,0.15); }
input.jersey-input { width: 100%; }

/* Toggle groups */
.toggle-group {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 0.15rem 0;
}
.toggle-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  cursor: pointer;
  border-bottom: 1px solid var(--color-border);
  user-select: none;
  transition: background 0.12s;
}
.toggle-group .toggle-row:last-child { border-bottom: none; }
.toggle-row:hover { background: #f4f6fb; }

.toggle-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0; height: 0;
}

.toggle-track {
  flex: 0 0 auto;
  display: block;
  width: 2.6rem; height: 1.4rem;
  background: #bcc4ce;
  border-radius: 999px;
  position: relative;
  transition: background 0.18s;
}
.toggle-thumb {
  position: absolute;
  top: 3px; left: 3px;
  width: calc(1.4rem - 6px);
  height: calc(1.4rem - 6px);
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.28);
  transition: transform 0.18s;
}
.toggle-input:checked ~ .toggle-track { background: var(--color-primary); }
.toggle-input:checked ~ .toggle-track .toggle-thumb { transform: translateX(1.2rem); }
.toggle-input:focus-visible ~ .toggle-track { outline: 2px solid var(--color-primary); outline-offset: 2px; }

.toggle-text { flex: 1 1 auto; min-width: 0; }
.toggle-label-main { display: block; font-weight: 600; font-size: var(--text-base); line-height: 1.2; }
.toggle-label-hint { display: block; font-size: var(--text-sm); color: var(--color-muted); margin-top: 0.15rem; line-height: 1.3; }

/* ---------------- Modal ---------------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15,20,30,0.5);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.modal-overlay.hidden { display: none; }
.modal-box {
  background: #fff; border-radius: 8px; padding: 1.25rem 1.5rem;
  max-width: 520px; width: 92%; max-height: 88vh; overflow-y: auto;
  box-shadow: 0 12px 40px rgba(0,0,0,0.3);
}
.modal-box h3 { margin-top: 0; }
.modal-actions { display: flex; gap: 0.6rem; justify-content: flex-end; margin-top: 1rem; flex-wrap: wrap; }
.modal-box .form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem 1rem; }
.modal-box .form-grid label { font-weight: 600; font-size: var(--text-sm); display: block; margin-bottom: 0.2rem; }
.modal-box .form-grid input, .modal-box .form-grid select {
  width: 100%; padding: 0.35rem 0.5rem; border: 1px solid var(--color-border); border-radius: var(--radius);
}
.modal-box .form-grid .span-2 { grid-column: 1 / -1; }

/* ---------------- Print container (hidden on screen) ---------------- */
.print-only { display: none; }

/* ===================================================================
   RESPONSIVE
   =================================================================== */
@media (max-width: 900px) {
  .views-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .app-bar-controls {
    margin-left: 0;
    width: 100%;
    justify-content: flex-start;
    border-top: 1px solid rgba(255,255,255,0.2);
    padding-top: 0.4rem;
  }
  .col-notes,
  #schedule-tbody td:nth-child(8) { display: none; }

  .grid-table th:first-child,
  .grid-table td:first-child {
    position: sticky;
    left: 0;
    background: #f6f3ec;
    z-index: 2;
  }
  .grid-table tbody td:first-child { background: #fafbfc; }

  .lineup-toolbar { gap: 0.5rem; }
}

/* ===================================================================
   PRINT
   =================================================================== */
@media print {
  body * { visibility: hidden; }
  .no-print, .app-bar, #modal-overlay { display: none !important; }
  #print-container, #print-container * { visibility: visible; }
  #print-container {
    display: block;
    position: absolute;
    left: 0; top: 0; width: 100%;
    background: #fff;
    color: #000;
    font-size: 10pt;
  }
  #app-main, header, nav { display: none !important; }

  .print-section { padding: 0.25in 0.3in; }

  .print-tables-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.2in;
    align-items: start;
    margin-top: 0.1in;
  }
  .print-table-col { min-width: 0; }
  .print-card-wrap { margin-top: 0.18in; }

  .print-sub-heading {
    font-size: 10pt;
    font-weight: 700;
    margin: 0 0 0.1em;
    padding-bottom: 2pt;
    border-bottom: 1px solid #999;
  }

  .print-header {
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 2px solid #000;
    padding-bottom: 0.15em;
    margin-bottom: 0.5em;
  }
  .print-logo {
    height: 48px; width: 48px;
    flex: 0 0 auto;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .print-header h2 { border: none; padding: 0; margin: 0 0 2pt 0; }
  .print-header-text { flex: 1 1 auto; }
  .print-game-detail { margin: 0; font-size: 10pt; font-weight: 700; }
  .print-meta { font-size: 9pt; color: #555; margin: 0.3em 0 0.6em; }

  .print-flag-warning {
    background: #fde2e1;
    border: 2px solid #d33b34;
    border-radius: 4px;
    padding: 4pt 6pt;
    margin-bottom: 0.3em;
    font-size: 9pt;
    font-weight: 700;
    color: #000;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  #print-container table {
    border-collapse: collapse;
    width: 100%;
    font-size: 10pt;
    break-inside: avoid;
    page-break-inside: avoid;
  }
  #print-container thead { display: table-header-group; }
  #print-container tr { break-inside: avoid; page-break-inside: avoid; }
  #print-container th, #print-container td {
    border: 1px solid #000;
    padding: 2px 4px;
    text-align: left;
  }
  #print-container th { background: #eee !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }

  #print-container .flag-hard { background: none !important; outline: none !important; font-weight: 700; }
  #print-container .flag-hard::before { content: '⚠ '; }
  #print-container .flag-soft { background: none !important; outline: none !important; font-weight: 700; }
  #print-container .flag-soft::before { content: '~ '; }
  #print-container .flag-warn { background: none !important; outline: none !important; }
  #print-container .flag-warn::before { content: '? '; }

  #print-container .pos-battery {
    background: #d9d9d9 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  #print-container .pos-bench {
    background: #ccc !important;
    color: #000 !important;
    font-style: italic;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .lineup-card-list {
    margin: 0.1em 0 0 1.2em;
    padding: 0;
    font-size: 10pt;
    line-height: 1.5;
  }
  .lineup-card-list li { padding: 1px 0; }

  /* Hide non-print UI elements */
  .lineup-dot, .gsb-status, .btn-undo-generate,
  .attendance-summary, .legend-box, .roster-controls-bar { display: none !important; }

  /* Grayscale position patterns for print — ensures distinction when color printing is off */
  .print-pos-battery {
    background: repeating-linear-gradient(45deg, #ccc 0, #ccc 2px, #fff 2px, #fff 6px) !important;
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }
  .print-pos-infield {
    background: repeating-linear-gradient(-45deg, #999 0, #999 2px, #fff 2px, #fff 6px) !important;
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }
  .print-pos-outfield {
    background: repeating-linear-gradient(90deg, #bbb 0, #bbb 2px, #fff 2px, #fff 8px) !important;
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }
  .print-pos-bench {
    background: #ddd !important;
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }
}

/* Read Me / Help tab */
.readme-content { max-width: 760px; }
.readme-section { margin-bottom: 2rem; }
.readme-section h3 {
  font-size: var(--text-lg);
  margin-bottom: 0.4rem;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 0.2rem;
}
.readme-section h4 { font-size: var(--text-md); margin: 1rem 0 0.25rem; }
.readme-section p, .readme-section ul, .readme-section ol {
  margin: 0.3rem 0 0.5rem;
  line-height: 1.6;
  font-size: var(--text-base);
}
.readme-section ul, .readme-section ol { padding-left: 1.4rem; }
.readme-section li { margin-bottom: 0.3rem; }

/* ===================================================================
   ITERATION 3 ADDITIONS
   =================================================================== */

/* ---------------- Result color coding in schedule table ---------------- */
.result-cell { font-weight: 600; }
.result-win  { background: #dcfce7 !important; color: #166534; }
.result-loss { background: #fde2e1 !important; color: #b91c1c; }
.result-tie  { background: #f1f5f9 !important; color: var(--color-muted); }

/* ---------------- Game summary bar — lineup completeness badge ---------------- */
.gsb-status {
  font-weight: 700;
  border-radius: 4px;
  padding: 0.15rem 0.5rem;
  font-size: var(--text-xs);
  white-space: nowrap;
}
.gsb-status-issues { background: rgba(211,59,52,0.3);   color: #ffd5d5; }
.gsb-status-prefs  { background: rgba(201,138,6,0.3);   color: #ffe8a0; }
.gsb-status-clean  { background: rgba(26,122,60,0.3);   color: #b8f0d0; }
.gsb-status-empty  { background: rgba(255,255,255,0.12); color: rgba(255,255,255,0.65); }

/* ---------------- Clear Grid button — outlined danger style ---------------- */
button.btn-danger-outline {
  background: #fff;
  color: #c0392b;
  border-color: #c0392b;
}
button.btn-danger-outline:hover {
  background: #fde2e1;
  border-color: #962d22;
  color: #962d22;
}

/* ===================================================================
   ITERATION 4 ADDITIONS
   =================================================================== */

/* ---------------- Season record pill (Schedule view header) ---------------- */
.season-record {
  display: inline-block;
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--color-primary-dark);
  background: #efeadd;
  border: 1px solid #c9b8a8;
  border-radius: 999px;
  padding: 0.2rem 0.75rem;
  margin: 0.3rem 0 0.6rem;
  letter-spacing: 0.02em;
}

/* ---------------- Inline result editing ---------------- */
/* Show pointer cursor on the clickable display span */
.result-display {
  cursor: pointer;
  min-width: 2ch;
  display: inline-block;
}
.result-display:hover {
  text-decoration: underline dotted var(--color-primary);
}

/* Hidden inline input sits alongside the display span */
.result-inline-input {
  font-size: var(--text-sm);
  font-family: inherit;
  font-weight: 600;
  border: none;
  border-bottom: 2px solid var(--color-primary);
  background: transparent;
  padding: 0 0.1rem;
  width: 8ch;
  outline: none;
}
.result-inline-input:focus {
  border-bottom-color: var(--color-primary-dark);
  background: rgba(6,36,72,0.06);
}

/* ---------------- Lineup dot indicator in schedule table ---------------- */
.lineup-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  vertical-align: middle;
  margin-right: 0.35rem;
  flex-shrink: 0;
}
/* Complete: lineup saved with all slots filled */
.lineup-dot--complete {
  background: #1a7a3c;
  box-shadow: 0 0 0 2px rgba(26,122,60,0.2);
}
/* Partial: lineup exists but not fully saved/complete */
.lineup-dot--partial {
  background: #c98a06;
  box-shadow: 0 0 0 2px rgba(201,138,6,0.2);
}
/* None: no lineup for this game */
.lineup-dot--none {
  background: #c0c7d0;
}

/* ---------------- Keyboard shortcut key chips (Change B) ---------------- */
kbd {
  display: inline-block;
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: var(--text-xs);
  font-weight: 700;
  background: #f0f2f5;
  border: 1px solid #c0c7d0;
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 0.1rem 0.4rem;
  color: var(--color-text);
}
.kbd-list { display: grid; grid-template-columns: auto 1fr; gap: 0.3rem 0.75rem; align-items: center; margin: 0.5rem 0; }
.kbd-list dt { margin: 0; }
.kbd-list dd { margin: 0; font-size: var(--text-base); }

/* ---------------- Inline notes editing (Change C) ---------------- */
.notes-display { cursor: pointer; min-width: 2ch; display: inline-block; }
.notes-display:hover { text-decoration: underline dotted var(--color-primary); }
.notes-inline-input {
  font-size: var(--text-sm);
  font-family: inherit;
  border: none;
  border-bottom: 2px solid var(--color-primary);
  background: transparent;
  padding: 0 0.1rem;
  width: 14ch;
  outline: none;
}
.notes-inline-input:focus { border-bottom-color: var(--color-primary-dark); background: rgba(6,36,72,0.06); }

/* ===================================================================
   ITERATION 5B ADDITIONS
   =================================================================== */

/* ---------------- Player stats popover (Change D) ---------------- */
.player-stats-popover {
  position: absolute;
  z-index: 60;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  padding: 0.6rem 0.85rem;
  min-width: 200px;
  max-width: 280px;
  font-size: var(--text-sm);
}
.psp-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 0.3rem;
}
.psp-name { font-size: var(--text-base); }
.psp-close { font-size: var(--text-sm); padding: 0; min-height: auto; }
.psp-stats { display: grid; grid-template-columns: auto 1fr; gap: 0.2rem 0.75rem; margin: 0; }
.psp-stats dt { color: var(--color-muted); margin: 0; }
.psp-stats dd { margin: 0; font-weight: 600; }

/* Player name button in roster table — looks like a link */
.player-name-btn {
  font-size: var(--text-sm);
  font-weight: 600;
  text-align: left;
}

/* ---------------------------------------------------------------
   App version badge — fixed bottom-right corner of the viewport
   --------------------------------------------------------------- */
.app-version-badge {
  position: fixed;
  bottom: 0.5rem;
  right: 0.75rem;
  font-size: var(--text-xs);
  color: var(--color-muted);
  background: transparent;
  pointer-events: none; /* does not block clicks */
  z-index: 10;
  user-select: none;
}

/* Version-incompatibility message in the blocking modal */
.version-incompat-msg {
  color: var(--color-text);
  line-height: 1.55;
  margin-bottom: 1rem;
}


/* ===================================================================
   v2.0 PRACTICE TAB
   =================================================================== */

/* .nav-btn-practice keeps class for markup; styles inherit from .nav-btn */

/* ---- Practice view layout ---- */
.practice-view { max-width: 100%; padding: 1rem 1.25rem 2rem; }
.practice-layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 1rem;
  align-items: start;
  margin-top: 0.75rem;
}

/* ---- Panels ---- */
.practice-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
  overflow: hidden;
}
.practice-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.9rem;
  background: #f6f3ec;
  border-bottom: 1px solid var(--color-border);
  cursor: pointer;
  user-select: none;
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--color-primary-dark);
  letter-spacing: 0.01em;
}
.practice-panel-head:hover { background: #e5e9f0; }
.pchevron { font-size: 0.75rem; transition: transform 0.2s; color: var(--color-muted); }
.practice-panel-head.collapsed .pchevron { transform: rotate(-90deg); }
.practice-panel-body { padding: 0.75rem 0.9rem; }
.practice-panel-body.collapsed { display: none; }

/* Budget panel */
.practice-budget-panel { padding: 0.6rem 0.9rem; }
.pbudget-label {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-muted);
  margin-bottom: 0.35rem;
}
.pbudget-track {
  height: 8px;
  background: #e2e6ea;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 0.3rem;
}
.pbudget-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s, background 0.3s;
}
.pbudget-ok   { background: #1a7a3c; }
.pbudget-warn { background: #c98a06; }
.pbudget-over { background: #c0392b; }
.pbudget-detail {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-xs);
  color: var(--color-muted);
}

/* ---- Form helpers inside practice panel ---- */
.pfield { margin-bottom: 0.65rem; }
.pfield:last-child { margin-bottom: 0; }
.pfield label {
  display: block;
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-muted);
  margin-bottom: 0.25rem;
}
.pfield input[type="text"],
.pfield input[type="date"],
.pfield input[type="time"],
.pfield input[type="search"],
.pfield select,
.pfield textarea {
  width: 100%;
  padding: 0.35rem 0.55rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: var(--text-sm);
  color: var(--color-text);
  background: #fff;
}
.pfield textarea { resize: vertical; min-height: 52px; font-size: var(--text-sm); }
.pfield input:focus, .pfield select:focus, .pfield textarea:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 1px;
}
.pform-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem 0.75rem; }

/* ---- Drill search row ---- */
.pdrill-search-row { display: flex; gap: 0.4rem; align-items: center; margin-bottom: 0.5rem; }
.pdrill-search-wrap {
  position: relative;
  flex: 1;
}
.pdrill-search-wrap input[type="search"] {
  width: 100%;
  padding: 0.35rem 0.55rem 0.35rem 1.9rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: var(--text-sm);
  background: #fff;
}
.pdrill-search-wrap input[type="search"]:focus { outline: 2px solid var(--color-primary); outline-offset: 1px; }
.pdrill-search-ico {
  position: absolute;
  left: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.85rem;
  pointer-events: none;
  color: var(--color-muted);
}
.pdrill-clear-btn {
  padding: 0.3rem 0.55rem;
  font-size: var(--text-sm);
  min-height: 30px;
  white-space: nowrap;
}

/* ---- Chips (skill + intensity filter) ---- */
.pchips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 0.4rem;
}
.pchip {
  padding: 0.2rem 0.65rem;
  border-radius: 20px;
  font-size: var(--text-xs);
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--color-border);
  background: #fff;
  color: var(--color-muted);
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  white-space: nowrap;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
}
.pchip:hover { background: #f6f3ec; border-color: var(--color-primary); color: var(--color-primary); }
.pchip.active { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.pchip-low.active  { background: #1a7a3c; border-color: #1a7a3c; }
.pchip-med.active  { background: #b45309; border-color: #b45309; }
.pchip-high.active { background: #c0392b; border-color: #c0392b; }
.pchip:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }

/* ---- Drill status ---- */
.pdrill-status {
  font-size: var(--text-xs);
  color: var(--color-muted);
  min-height: 1.2em;
  margin: 0.15rem 0 0.35rem;
}

/* ---- Drill card scroll area ---- */
.pdrill-cards-scroll {
  max-height: 340px;
  overflow-y: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: #fafbfc;
  margin-bottom: 0.75rem;
}

/* ---- Individual drill card ---- */
.pdrill-card {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--color-border);
  background: #fafbfc;
  transition: background 0.1s;
  cursor: pointer;
}
.pdrill-card:last-child { border-bottom: none; }
.pdrill-card:hover { background: #efeadd; }
.pdrill-card.in-plan { background: #f0fdf4; border-left: 3px solid #1a7a3c; }
.pdrill-card-text { flex: 1; min-width: 0; }
.pdrill-card-name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pdrill-card-meta { font-size: var(--text-xs); color: var(--color-muted); margin-top: 1px; }
.pdrill-card-badges { display: flex; flex-wrap: wrap; gap: 0.2rem; margin-top: 0.15rem; }

/* Intensity badges */
.pbadge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 12px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.pbadge-low  { background: #dcfce7; color: #166534; }
.pbadge-med  { background: #fef3c7; color: #92400e; }
.pbadge-high { background: #fee2e2; color: #991b1b; }
.pbadge-skill { background: #e5e0d4; color: var(--brand-navy); }

/* ---- Add to plan button on drill card ---- */
.pdrill-add-btn {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s, transform 0.1s;
  padding: 0;
  min-height: 28px;
  font-weight: 700;
}
.pdrill-add-btn:hover { background: var(--color-primary-dark); transform: scale(1.1); }
.pdrill-card.in-plan .pdrill-add-btn { background: #1a7a3c; }
.pdrill-card.in-plan .pdrill-add-btn:hover { background: #155f2f; }
.pdrill-add-btn:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }

/* ---- No results empty state ---- */
.pdrill-empty {
  text-align: center;
  color: var(--color-muted);
  font-size: var(--text-sm);
  padding: 1.5rem 1rem;
}

/* ---- Skill plan gallery ---- */
.pplan-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 0.6rem;
}
.pplan-tab {
  padding: 0.18rem 0.6rem;
  border-radius: 12px;
  font-size: var(--text-xs);
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--color-border);
  background: #fff;
  color: var(--color-muted);
  transition: background 0.12s, color 0.12s;
  min-height: 26px;
  display: inline-flex;
  align-items: center;
}
.pplan-tab.active { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.pplan-tab:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.pplan-gallery {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
}
.pplan-card {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.6rem 0.75rem;
  background: #f8fafc;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: var(--text-xs);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.pplan-card:hover { border-color: var(--color-primary); background: #efeadd; }
.pplan-card:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.pplan-card-label { font-weight: 700; font-size: var(--text-sm); color: var(--color-text); margin-bottom: 0.3rem; }
.pplan-card-badges { display: flex; flex-wrap: wrap; gap: 0.2rem; margin-bottom: 0.25rem; }
.pplan-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 0.63rem;
  font-weight: 700;
  white-space: nowrap;
  letter-spacing: 0.02em;
}
.pplan-badge-skill { background: #e5e0d4; color: var(--brand-navy); }
.pplan-badge-diff  { background: #fef3c7; color: #92400e; }
.pplan-badge-age   { background: #d1fae5; color: #065f46; }
.pplan-badge-dur   { background: #f3e8ff; color: #5b21b6; }
.pplan-card-meta { font-size: 0.67rem; color: var(--color-muted); }

/* ---- Plan builder action buttons ---- */
.practice-plan-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-bottom: 0.75rem;
}
.btn-sm { padding: 0.25rem 0.65rem; font-size: var(--text-sm); min-height: 30px; }

/* ---- RIGHT: Practice plan panel ---- */
.practice-right { position: sticky; top: 5rem; }
.practice-plan-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
}
.practice-plan-header {
  background: var(--color-primary-dark);
  color: #fff;
  padding: 0.75rem 1rem;
}
.practice-plan-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.practice-plan-header h3 { margin: 0; font-size: var(--text-md); color: #fff; }
.practice-plan-hdr-actions { display: flex; gap: 0.35rem; }
.practice-plan-hdr-actions button {
  font-size: var(--text-xs);
  padding: 0.2rem 0.55rem;
  min-height: 26px;
  background: rgba(255,255,255,0.15);
  border-color: rgba(255,255,255,0.35);
  color: #fff;
}
.practice-plan-hdr-actions button:hover { background: rgba(255,255,255,0.3); }
.practice-plan-meta {
  margin-top: 0.4rem;
  font-size: var(--text-xs);
  opacity: 0.85;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
}

/* ---- Plan items list ---- */
.practice-plan-items {
  min-height: 120px;
  max-height: calc(100vh - 280px);
  overflow-y: auto;
  padding: 0.5rem 0;
}
.ppempty {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--color-muted);
  font-size: var(--text-sm);
}
.ppempty p { margin: 0.25rem 0; }

/* ---- Plan item row ---- */
.pplan-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.85rem;
  border-bottom: 1px solid var(--color-border);
  transition: background 0.1s;
}
.pplan-item:last-child { border-bottom: none; }
.pplan-item:hover { background: #faf8f2; }
.pplan-item-body { flex: 1; min-width: 0; }
.pplan-item-name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pplan-item-meta { font-size: var(--text-xs); color: var(--color-muted); margin-top: 1px; }
.pplan-item-controls { display: flex; align-items: center; gap: 0.25rem; flex-shrink: 0; }
.pplan-item-dur {
  width: 38px;
  padding: 0.15rem 0.3rem;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  font-size: var(--text-xs);
  text-align: center;
  font-family: inherit;
  background: #fff;
}
.pplan-item-dur:focus { outline: 2px solid var(--color-primary); outline-offset: 1px; }
.pplan-item-dur-lbl { font-size: var(--text-xs); color: var(--color-muted); }
.pplan-item-move-btn, .pplan-item-remove-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.15rem 0.25rem;
  min-height: 24px;
  font-size: var(--text-sm);
  color: var(--color-muted);
  border-radius: 3px;
}
.pplan-item-move-btn:hover { background: #f6f3ec; color: var(--color-primary); }
.pplan-item-remove-btn:hover { background: #fde2e1; color: var(--brand-red); }
.pplan-item-move-btn:focus-visible, .pplan-item-remove-btn:focus-visible {
  outline: 2px solid var(--color-primary); outline-offset: 1px;
}

/* ---- Plan footer ---- */
.practice-plan-footer {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.85rem;
  border-top: 2px solid var(--color-border);
  background: #f5f6f8;
  font-size: var(--text-sm);
}
.ppfooter-label { font-weight: 700; color: var(--color-text); }
#ppfooter-total { font-weight: 700; color: var(--color-primary-dark); font-size: var(--text-md); }
.ppfooter-count { color: var(--color-muted); font-size: var(--text-xs); margin-left: auto; }

/* ---- Practice plan mode toggle (Sequential vs Stations) ---- */
.pmode-toggle {
  display: flex;
  gap: 1rem;
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid var(--color-border);
  background: #f9fafb;
}
.pmode-toggle-option {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  text-transform: none;
}
.pmode-toggle-option input[type="radio"] { width: 15px; height: 15px; cursor: pointer; }

/* ---- Stations mode ---- */
.pstations-wrap { padding: 0.6rem 0.85rem; }
.pstations-wrap.hidden { display: none; }
.pstations-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}
.pstations-controls label { font-weight: 600; font-size: var(--text-sm); }
#pp-station-count {
  width: 56px;
  padding: 0.2rem 0.35rem;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  font-family: inherit;
}
.pstations-list { display: flex; flex-direction: column; gap: 0.7rem; }
.pstation-block {
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: #fff;
  padding: 0.55rem 0.7rem;
}
.pstation-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}
.pstation-label { font-weight: 700; font-size: var(--text-sm); color: var(--color-text); }
.pstation-time-wrap { display: flex; align-items: center; gap: 0.25rem; margin-left: auto; }
.pstation-time-input {
  width: 50px;
  padding: 0.15rem 0.3rem;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  font-size: var(--text-xs);
  text-align: center;
  font-family: inherit;
}
.pstation-time-lbl { font-size: var(--text-xs); color: var(--color-muted); }
.pstation-head-btns { display: flex; gap: 0.2rem; }
.pstation-drill-picker {
  width: 100%;
  padding: 0.25rem 0.4rem;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  font-family: inherit;
  font-size: var(--text-sm);
  margin-bottom: 0.4rem;
}
.pstation-drill-list { display: flex; flex-direction: column; gap: 0.2rem; }
.pstation-empty { padding: 0.3rem 0; }
.pstation-drill-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.4rem;
  border-radius: 4px;
  background: #faf8f2;
}
.pstation-drill-name { flex: 1; font-size: var(--text-sm); font-weight: 600; color: var(--color-text); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pstation-drill-meta { font-size: var(--text-xs); color: var(--color-muted); flex-shrink: 0; }

/* ---- Toast notification ---- */
.pp-toast {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%) translateY(1rem);
  background: #1f2630;
  color: #fff;
  padding: 0.55rem 1.1rem;
  border-radius: 20px;
  font-size: var(--text-sm);
  font-weight: 600;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
.pp-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---- Drill detail modal ---- */
.drill-detail-box {
  max-width: 640px;
  width: 96%;
  max-height: 88vh;
  overflow-y: auto;
}
.drill-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--color-border);
}
.drill-detail-title {
  font-size: var(--text-lg);
  font-weight: 700;
  margin: 0 0 0.3rem;
  color: var(--color-text);
}
.drill-detail-badges { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.drill-detail-close {
  background: none;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  color: var(--color-muted);
  padding: 0;
  min-height: auto;
  line-height: 1;
  flex-shrink: 0;
}
.drill-detail-close:hover { color: var(--color-text); background: none; border: none; }
.drill-detail-section { margin: 0.85rem 0; }
.drill-detail-section-title {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--color-primary);
  margin-bottom: 0.35rem;
}
.drill-detail-section p, .drill-detail-section ul, .drill-detail-section ol {
  margin: 0;
  font-size: var(--text-base);
  line-height: 1.6;
}
.drill-detail-section ul, .drill-detail-section ol { padding-left: 1.25rem; }
.drill-detail-section li { margin-bottom: 0.25rem; }
.drill-detail-cue {
  font-style: italic;
  color: var(--color-muted);
  border-left: 3px solid #c9b8a8;
  padding-left: 0.65rem;
  font-size: var(--text-base);
}
.drill-detail-equipment {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}
.drill-detail-equip-item {
  background: #f6f3ec;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.15rem 0.55rem;
  font-size: var(--text-xs);
  color: var(--color-text);
}
.drill-detail-footer {
  display: flex;
  gap: 0.6rem;
  justify-content: flex-end;
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--color-border);
}

/* ---- Saved plans modal list ---- */
.saved-plan-list {
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
}
.saved-plan-item {
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.saved-plan-item:last-child { border-bottom: none; }
.saved-plan-name { font-weight: 600; font-size: var(--text-sm); }
.saved-plan-meta { font-size: var(--text-xs); color: var(--color-muted); }

/* ---- Practice print root ---- */
#practice-print-root {
  display: none;
}

/* ---- Responsive ---- */
@media (max-width: 960px) {
  .practice-layout { grid-template-columns: 1fr; }
  .practice-right { position: static; }
  .practice-plan-items { max-height: 400px; }
  .pplan-gallery { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .practice-layout { gap: 0.5rem; }
  .pform-two-col { grid-template-columns: 1fr; }
}

/* ---- Practice print styles ---- */
@media print {
  /* Scoped to body.printing-practice so the lineup print path is unaffected.
     The global `body * { visibility:hidden }` rule hides everything; these
     rules restore visibility for the practice print root only. */
  body.printing-practice #print-container { display: none !important; }
  body.printing-practice #practice-print-root,
  body.printing-practice #practice-print-root * { visibility: visible !important; }
  body.printing-practice #practice-print-root {
    display: block !important;
    position: absolute;
    left: 0; top: 0; width: 100%;
    background: #fff; color: #000;
  }
  body.printing-practice #practice-print-root .pp-print-header {
    border-bottom: 2px solid #000;
    padding-bottom: 6pt;
    margin-bottom: 10pt;
  }
  body.printing-practice #practice-print-root .pp-print-header h2 { font-size: 14pt; margin: 0 0 3pt; border: none; padding: 0; }
  body.printing-practice #practice-print-root .pp-print-meta { font-size: 9pt; color: #555; margin: 0; }
  body.printing-practice #practice-print-root .pp-print-section-title {
    font-size: 8pt; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.06em; color: var(--brand-navy); margin: 10pt 0 4pt; border-bottom: 1px solid #ccc;
  }
  body.printing-practice #practice-print-root table { border-collapse: collapse; width: 100%; font-size: 9pt; }
  body.printing-practice #practice-print-root th { background: #eee !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body.printing-practice #practice-print-root th, body.printing-practice #practice-print-root td { border: 1px solid #999; padding: 3pt 5pt; }
  body.printing-practice #practice-print-root .pp-print-drill-block { margin-bottom: 8pt; page-break-inside: avoid; }
  body.printing-practice #practice-print-root .pp-print-drill-name { font-weight: 700; font-size: 10pt; margin-bottom: 2pt; }
  body.printing-practice #practice-print-root .pp-print-drill-detail { font-size: 8pt; color: #333; margin-bottom: 2pt; }
  body.printing-practice #practice-print-root .pp-print-cue { font-style: italic; color: #555; font-size: 8pt; }
  body.printing-practice #practice-print-root .pp-print-notes { font-size: 9pt; white-space: pre-wrap; border: 1px solid #ccc; padding: 5pt; margin-top: 8pt; }
}
