:root {
  --bg: #f5f7f4;
  --ink: #17201a;
  --muted: #687267;
  --line: #dce2da;
  --panel: #ffffff;
  --panel-soft: #eef4ee;
  --green: #1d8a4d;
  --yellow: #d39b16;
  --red: #c13d36;
  --blue: #2768b4;
  --dark: #162319;
  --shadow: 0 10px 28px rgba(19, 31, 23, 0.08);
}

* {
  box-sizing: border-box;
}

.hidden { display: none !important; }
.auth-pending { display: none !important; }

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(circle at top left, #285d43 0, #10261a 43%, #08140d 100%);
}

.auth-card {
  width: min(440px, 100%);
  padding: 34px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 20px;
  background: rgba(255,255,255,.97);
  box-shadow: 0 28px 70px rgba(0,0,0,.32);
}

.auth-brand-mark {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: #174e31;
  color: #fff;
  font-size: 20px;
  font-weight: 800;
}

.auth-card > p:first-of-type { margin: 18px 0 5px; color: #3d6e52; font-size: 12px; font-weight: 800; letter-spacing: .12em; }
.auth-card h1 { margin: 0; font-size: 29px; }
.auth-description { margin: 10px 0 22px; color: #66756b; line-height: 1.55; }
.auth-card form { display: grid; gap: 14px; }
.auth-card label { display: grid; gap: 6px; color: #415047; font-size: 13px; font-weight: 700; }
.auth-card input { width: 100%; min-height: 44px; }
.auth-card .primary-button { width: 100%; min-height: 45px; margin-top: 3px; }
.text-button { border: 0; background: transparent; color: #2768b4; cursor: pointer; padding: 13px 0 0; }
.auth-message { min-height: 20px; margin: 12px 0 0; color: #b62e28; font-size: 13px; }
.auth-config-warning { margin-top: 14px; padding: 11px; border-radius: 8px; background: #fff1d7; color: #80540b; font-size: 13px; }

.account-chip { display: grid; padding: 5px 10px; border: 1px solid #d8e2db; border-radius: 9px; background: #fff; }
.account-chip span { font-size: 11px; color: #66756b; }
.account-chip strong { font-size: 13px; color: #174e31; }
#team-switcher { max-width: 180px; }
.sync-status { margin: -6px 0 12px auto; width: max-content; padding: 5px 10px; border-radius: 999px; background: #edf4ef; color: #52675a; font-size: 12px; }
.sync-status.syncing { background: #fff1d7; color: #80540b; }
.sync-status.synced { background: #e6f5eb; color: #17653a; }
.sync-status.error { background: #fde9e7; color: #a82925; }
.permission-locked { opacity: .52 !important; cursor: not-allowed !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, "Malgun Gothic", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px 1fr;
}

.sidebar {
  background: var(--dark);
  color: #eef6ef;
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: #234630;
  border-radius: 8px;
  font-weight: 800;
}

.brand strong,
.brand span {
  display: block;
}

.brand span,
.side-meta span,
#view-kicker {
  color: var(--muted);
  font-size: 12px;
}

.sidebar .brand span,
.side-meta span {
  color: rgba(238, 246, 239, 0.66);
}

.nav {
  display: grid;
  gap: 8px;
}

.nav-item {
  height: 44px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: rgba(238, 246, 239, 0.72);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  text-align: left;
}

.nav-item span {
  width: 24px;
  text-align: center;
}

.nav-item.active,
.nav-item:hover {
  background: #2d5a3b;
  color: #fff;
}

.side-meta {
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  padding-top: 16px;
}

.side-meta strong {
  display: block;
  margin-top: 4px;
}

.main {
  min-width: 0;
  padding: 24px;
}

.topbar {
  height: 72px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

#view-kicker,
.report-title p {
  margin: 0 0 5px;
  text-transform: uppercase;
  font-weight: 700;
}

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

h1 {
  margin-bottom: 0;
  font-size: 28px;
}

h2 {
  font-size: 18px;
  margin-bottom: 0;
}

h3 {
  font-size: 15px;
}

.top-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.icon-button,
.danger-button,
.ghost-button,
.primary-button {
  min-height: 38px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 0 13px;
}

.icon-button {
  width: 40px;
  padding: 0;
}

.primary-button {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
  font-weight: 700;
}

.danger-button {
  color: var(--red);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.ewma-metric {
  border-color: #d8c8ee;
  background: #faf7ff;
}

.ewma-metric small {
  color: #7b4ab5;
  font-size: 10px;
}

.ewma-value {
  color: #6d3da4;
}

.ewma-trend {
  display: inline-flex;
  min-width: 62px;
  justify-content: center;
  border-radius: 999px;
  padding: 4px 7px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.ewma-trend.up { background: #fce4e2; color: #a5261d; }
.ewma-trend.steady { background: #eee8f7; color: #65408d; }
.ewma-trend.down { background: #e2f2e7; color: #17653a; }

.metric,
.panel,
.report-page {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric {
  min-height: 92px;
  padding: 17px;
}

.metric span {
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  display: block;
  margin-top: 10px;
  font-size: 30px;
}

.dashboard-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(360px, 0.8fr);
  gap: 14px;
  margin-bottom: 14px;
}

.panel {
  padding: 16px;
  min-width: 0;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

select,
input {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: #fff;
  color: var(--ink);
}

.risk-table,
.entries-table {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 700px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 11px 10px;
  text-align: left;
  font-size: 13px;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: 12px;
  background: #f7faf7;
}

.status-pill {
  display: inline-flex;
  width: 82px;
  min-height: 30px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 5px 12px;
  color: #fff;
  font-weight: 900;
  font-size: 13px;
  line-height: 1;
  letter-spacing: 0.2px;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.14);
}

.status-GREEN {
  border-color: #0f5b30;
  background: #146c3a;
  color: #fff;
}

.status-YELLOW {
  border-color: #b47b00;
  background: #ffc928;
  color: #2b2100;
}

.status-RED {
  border-color: #861c15;
  background: #b42318;
  color: #fff;
}

.legend {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.green {
  background: var(--green);
}

.yellow {
  background: var(--yellow);
}

.red {
  background: var(--red);
}

.chart-wrap {
  height: 270px;
}

.chart-value {
  font-size: 11px;
  font-weight: 800;
  paint-order: stroke;
  stroke: #fff;
  stroke-width: 4px;
  stroke-linejoin: round;
}

.load-value { fill: #2768b4; }
.red-value { fill: #c13d36; }

#load-chart {
  width: 100%;
  height: 100%;
}

.heatmap {
  overflow: auto;
  display: grid;
  gap: 6px;
}

.heat-row {
  display: grid;
  grid-template-columns: 120px repeat(7, minmax(52px, 1fr));
  gap: 6px;
  align-items: center;
  min-width: 560px;
}

.heat-cell {
  min-height: 34px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

.heat-label {
  color: var(--muted);
  font-size: 13px;
}

.entry-form {
  display: grid;
  grid-template-columns: repeat(7, minmax(110px, 1fr));
  gap: 10px;
  align-items: end;
}

.entry-form input[readonly] {
  background: #eef3ef;
  color: #23452f;
  font-weight: 800;
}

.panel-actions,
.row-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.table-button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: #2768b4;
  padding: 4px 7px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.table-button.danger { color: var(--red); }

.editing-row td { background: #fff7d6; }

.edit-notice {
  margin: 12px 0 0;
  border-left: 4px solid #d39b16;
  border-radius: 6px;
  background: #fff8dc;
  padding: 10px 12px;
  color: #725207;
  font-weight: 700;
}

.injury-form,
.result-form {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
}

.game-record-panel {
  border-top: 4px solid #2d6eb8;
}

.game-record-panel h2 small {
  color: #2d6eb8;
  font-size: 12px;
}

.team-game-form {
  display: grid;
  grid-template-columns: minmax(260px, 1.5fr) repeat(3, minmax(90px, 0.55fr)) auto;
  gap: 10px;
  align-items: end;
  padding: 12px;
  margin: 0 0 14px;
  border: 1px solid #c9d8ca;
  border-radius: 9px;
  background: #f3f8f4;
}

.team-game-heading strong,
.team-game-heading span {
  display: block;
}

.team-game-heading span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 5px;
}

.game-record-form {
  display: grid;
  grid-template-columns: minmax(150px, 0.55fr) minmax(280px, 1.45fr) minmax(250px, 1fr) auto auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
}

.game-hitter-fields,
.game-starter-fields,
.game-bullpen-fields {
  display: grid;
  grid-template-columns: repeat(5, minmax(90px, 1fr));
  gap: 7px;
  grid-column: 1 / -1;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 10px;
}

.game-record-context {
  min-height: 40px;
  border-radius: 8px;
  padding: 8px 11px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: #edf4fb;
  border-left: 5px solid #2d6eb8;
}

.game-record-context strong,
.game-record-context span {
  display: block;
}

.game-record-context span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

.context-hitter { border-left-color: #2f855a; background: #edf8f1; }
.context-starter { border-left-color: #2d6eb8; background: #edf4fb; }
.context-bullpen { border-left-color: #7c4dac; background: #f4eff9; }

.role-form-title {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding-bottom: 7px;
}

.role-form-title span {
  color: var(--muted);
  font-size: 12px;
}

.team-game-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(70px, 1fr));
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px;
  margin: 0;
  grid-column: span 2;
}

.workflow-guide {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.workflow-guide article {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f6faf7;
  padding: 12px;
}

.workflow-guide strong,
.workflow-guide span { display: block; }
.workflow-guide span { color: var(--muted); font-size: 12px; margin-top: 5px; }

.injury-player-context {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 8px;
  margin: 4px 0 15px;
}

.injury-player-context article {
  border: 1px solid #cad8cd;
  border-radius: 8px;
  background: #f5faf6;
  padding: 10px;
}

.injury-player-context span,
.injury-player-context strong { display: block; }
.injury-player-context span { color: var(--muted); font-size: 11px; }
.injury-player-context strong { margin-top: 4px; }

.team-game-fields legend {
  color: var(--muted);
  font-size: 11px;
  padding: 0 4px;
}

.wide-field {
  grid-column: span 2;
}

.optimal-load-panel {
  border-top: 4px solid #2d6eb8;
}

.optimal-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 10px;
  margin: 14px 0 20px;
}

.optimal-summary article {
  border: 1px solid #cad8cd;
  border-radius: 10px;
  background: #f4f9f5;
  padding: 14px;
}

.optimal-summary span,
.optimal-summary strong {
  display: block;
}

.optimal-summary span {
  color: var(--muted);
  font-size: 12px;
}

.optimal-summary strong {
  color: #245f9f;
  font-size: 20px;
  margin-top: 7px;
}

.optimal-summary small {
  display: block;
  color: var(--muted);
  margin-top: 6px;
}

.optimal-load-panel .entries-table {
  margin-top: 18px;
}

.optimal-load-panel .entries-table h3 {
  margin-bottom: 8px;
}

.estimation-disclaimer {
  margin-top: 18px;
  border-radius: 8px;
  background: #fff7df;
  color: #6f5818;
  padding: 11px 13px;
  font-size: 12px;
}

.injury-type {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.injury-type-contact {
  color: #7a3210;
  background: #fff0e4;
  border: 1px solid #e8b58f;
}

.injury-type-non-contact {
  color: #174e31;
  background: #e9f6ed;
  border: 1px solid #a8d0b5;
}

.injury-type-unknown {
  color: #59665d;
  background: #f1f3f1;
  border: 1px solid #ccd4ce;
}

.injury-association-panel .auto-summary p + p {
  padding-top: 10px;
  border-top: 1px solid #d7e2d9;
}

label span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 5px;
}

label input,
label select {
  width: 100%;
}

.hidden {
  display: none;
}

.segmented {
  display: inline-flex;
  background: var(--panel-soft);
  padding: 3px;
  border-radius: 8px;
}

.segment {
  min-height: 32px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  padding: 0 12px;
}

.segment.active {
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  font-weight: 800;
}

.inline-form {
  display: grid;
  grid-template-columns: minmax(120px, 1.25fr) 92px minmax(100px, 1fr) minmax(96px, auto) minmax(96px, auto) minmax(138px, auto);
  gap: 8px;
  align-items: stretch;
}

.inline-form button {
  min-width: 0;
  white-space: nowrap;
  word-break: keep-all;
  padding-inline: 14px;
  line-height: 1.2;
}

#roster-submit,
#cancel-roster-edit,
#merge-duplicate-roster {
  min-height: 40px;
  height: auto;
}

#merge-duplicate-roster {
  border-color: #c9342f;
  background: #c9342f;
  color: #fff;
  font-weight: 800;
}

#merge-duplicate-roster:hover {
  border-color: #a92723;
  background: #a92723;
}

.roster-role-help {
  margin: 10px 0 14px;
  padding: 10px 12px;
  border: 1px solid #bdd7c5;
  border-radius: 8px;
  background: #f2faf4;
  color: #315c3e;
  font-size: 12px;
}

.roster-role-history {
  display: block;
  margin-top: 4px;
  color: #2f6d45;
  font-size: 11px;
  font-weight: 700;
}

.settings-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(220px, 1fr) 120px;
  gap: 10px;
  align-items: end;
}

.analysis-controls {
  display: flex;
  gap: 8px;
  align-items: center;
}

.custom-period-controls,
.pitcher-plan-controls {
  display: grid;
  grid-template-columns: minmax(150px, 210px) minmax(150px, 210px) auto 1fr;
  gap: 10px;
  align-items: end;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f7faf7;
}

.custom-period-controls .setting-note {
  align-self: center;
}

.period-insight-panel {
  border-top: 4px solid #2f855a;
}

.pitcher-operations-panel {
  border-top: 4px solid #7352a3;
}

.pitcher-plan-controls {
  grid-template-columns: repeat(3, minmax(150px, 1fr)) auto;
  background: #f7f3fb;
  border-color: #d7cbe3;
}

.pitcher-plan-selected td {
  background: #f4eff9;
}

.readiness-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 104px;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.readiness-ready {
  color: #0f6b3b !important;
  background: #e6f5ec;
}

.readiness-limited {
  color: #795800 !important;
  background: #fff2c7;
}

.readiness-check {
  color: #a3211d !important;
  background: #fde7e5;
}

.readiness-insufficient {
  color: #59665d !important;
  background: #edf0ed;
}

.chart-wrap.tall {
  height: 340px;
}

#period-chart {
  width: 100%;
  height: 100%;
}

.retention-list {
  display: grid;
  gap: 10px;
}

.retention-list article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfb;
  padding: 12px;
}

.retention-list strong,
.retention-list span {
  display: block;
}

.retention-list span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 5px;
  line-height: 1.4;
}

.setting-note {
  color: var(--muted);
  font-size: 13px;
}

.data-quality-panel {
  margin-bottom: 18px;
}

.quality-grade {
  min-width: 112px;
  padding: 8px 12px;
  border-radius: 999px;
  color: #fff;
  text-align: center;
  font-size: 14px;
}

.quality-high { background: #11723f; }
.quality-medium { background: #b77900; }
.quality-low { background: #c52820; }

.quality-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.quality-summary article {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-soft);
}

.quality-summary span,
.quality-summary strong {
  display: block;
}

.quality-summary span {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
}

.quality-summary strong {
  font-size: 18px;
}

.quality-issues {
  margin-top: 12px;
  padding: 11px 14px;
  border-left: 4px solid #d69b18;
  background: #fff9e9;
  color: #4b4230;
}

.quality-issues p,
.quality-issues ul {
  margin: 0;
}

.quality-issues ul {
  padding-left: 20px;
}

.delivery-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(190px, 1fr));
  gap: 12px;
  align-items: stretch;
}

.delivery-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfdfb;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 10px;
  min-width: 0;
}

.delivery-card p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  margin-bottom: 0;
}

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

.checklist label {
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 16px;
  background: #fff;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  justify-content: start;
  gap: 12px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
  text-align: left;
  cursor: pointer;
  overflow-wrap: anywhere;
}

.checklist input {
  width: 18px;
  height: 18px;
  margin: 0;
  min-height: auto;
  justify-self: center;
  accent-color: var(--primary);
}

.checklist label:hover {
  border-color: #a9c7b1;
  background: #f7fbf8;
}

.checklist label:has(input:checked) {
  border-color: #79ad88;
  background: #eef8f1;
  color: #14552d;
}

.empty-state {
  grid-column: 1 / -1;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fbfdfb;
  color: var(--muted);
  padding: 18px;
  text-align: center;
}

.roster-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(190px, 1fr));
  gap: 10px;
}

.player-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfdfb;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.player-card span {
  color: var(--muted);
  font-size: 12px;
}

.roster-card-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.editing-roster-card {
  border-color: #d39b16;
  background: #fff8dc;
}

.pitcher-entered-row td {
  background: #eef8f0;
}

.entry-complete,
.entry-pending {
  display: inline-block;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 800;
}

.entry-complete {
  background: #dff3e4;
  color: #1f6b38;
}

.entry-pending {
  background: #fff2d8;
  color: #8a5a00;
}

.report-page {
  padding: 24px;
}

.report-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid var(--ink);
  padding-bottom: 14px;
  margin-bottom: 18px;
}

.report-title strong {
  color: #fff;
  border-radius: 8px;
  padding: 9px 14px;
}

.report-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}

.auto-summary {
  border: 1px solid #bfd0c2;
  border-radius: 10px;
  background: #f5faf6;
  padding: 14px 16px;
  margin-bottom: 18px;
}

.auto-summary h3 { margin: 0 0 8px; }
.auto-summary p { margin: 0 0 8px; line-height: 1.6; }
.auto-summary ul { margin: 0; padding-left: 20px; color: var(--muted); line-height: 1.55; }

.summary-box {
  background: #f7faf7;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.summary-box span {
  color: var(--muted);
  font-size: 12px;
}

.summary-box strong {
  display: block;
  margin-top: 7px;
  font-size: 22px;
}

.report-columns {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.report-item {
  border-bottom: 1px solid var(--line);
  padding: 10px 0;
  font-size: 13px;
}

.report-item strong {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.report-item p {
  color: var(--muted);
  margin: 0;
}

.daily-special-report-panel {
  margin-bottom: 18px;
}

.manual-note-form {
  display: grid;
  grid-template-columns: 160px 190px minmax(280px, 1fr);
  gap: 10px;
  align-items: end;
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f7faf7;
}

.manual-note-form label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.manual-note-form textarea {
  min-height: 68px;
  resize: vertical;
}

.manual-note-main {
  grid-column: span 1;
}

.manual-note-actions {
  display: flex;
  gap: 8px;
}

.manual-note-help {
  margin: 8px 2px 0;
  color: var(--muted);
  font-size: 12px;
}

.manual-note-content {
  min-width: 220px;
  white-space: pre-wrap;
}

.entries-table a {
  color: var(--blue);
  font-weight: 700;
  text-decoration: underline;
}

.daily-report-date-control {
  display: grid;
  gap: 4px;
  min-width: 170px;
}

.daily-report-date-control span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.daily-report-page {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.daily-report-section {
  margin-top: 20px;
}

.daily-report-section h3,
.daily-report-grid h3 {
  margin: 0 0 9px;
}

.daily-report-grid {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 16px;
  margin-top: 20px;
}

.daily-team-result {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf7;
  padding: 10px 12px;
  margin-bottom: 10px;
}

.daily-team-result span {
  text-align: right;
}

.pitch-split-progress {
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.pitch-split-progress-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
}

.pitch-split-progress-head h3,
.pitch-split-progress-head p {
  margin: 0;
}

.pitch-split-progress-head p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.pitch-split-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pitch-split-controls label {
  display: grid;
  gap: 4px;
  min-width: 150px;
}

.pitch-split-controls span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.pitch-split-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.pitch-split-summary article {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f7faf7;
}

.pitch-split-summary span,
.pitch-split-summary strong {
  display: block;
}

.pitch-split-summary span {
  color: var(--muted);
  font-size: 11px;
}

.pitch-split-summary strong {
  margin-top: 4px;
  font-size: 20px;
}

.pitch-split-result-count {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.pitch-split-complete,
.pitch-split-needs {
  display: inline-flex;
  min-width: 92px;
  justify-content: center;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
}

.pitch-split-complete {
  color: #12613a;
  background: #dff3e7;
}

.pitch-split-needs {
  color: #9a4c00;
  background: #fff0d5;
}

.record-search-controls {
  display: flex;
  align-items: end;
  gap: 8px;
  flex-wrap: wrap;
}

.record-search-controls label {
  display: grid;
  gap: 4px;
  min-width: 170px;
}

.record-search-controls label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.record-search-summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f5faf6;
  padding: 10px 12px;
  margin: 14px 0;
}

.record-search-summary span {
  color: var(--muted);
}

.record-search-grid {
  display: grid;
  gap: 18px;
}

.record-search-grid section {
  min-width: 0;
}

.record-search-grid h3 {
  margin: 0 0 8px;
}

@media (max-width: 980px) {
  .manual-note-form {
    grid-template-columns: 1fr 1fr;
  }

  .manual-note-main {
    grid-column: 1 / -1;
  }

  .pitch-split-progress-head {
    align-items: stretch;
    flex-direction: column;
  }

  .pitch-split-summary {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }

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

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 3;
    padding: 12px;
  }

  .brand,
  .side-meta {
    display: none;
  }

  .nav {
    grid-template-columns: repeat(7, 1fr);
  }

  .nav-item {
    justify-content: center;
  }

  .nav-item b {
    display: none;
  }

  .main {
    padding: 14px;
  }

  .topbar {
    height: auto;
    align-items: flex-start;
  }

  .metric-grid,
  .dashboard-layout,
  .report-summary,
  .report-columns,
  .daily-report-grid,
  .roster-grid,
  .optimal-summary {
    grid-template-columns: 1fr;
  }

  .entry-form,
  .injury-form,
  .result-form,
  .team-game-form,
  .game-record-form {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }

  .team-game-heading {
    grid-column: 1 / -1;
  }

  .game-entry-select,
  .game-record-context,
  .game-hitter-fields,
  .game-starter-fields,
  .game-bullpen-fields,
  .team-game-fields {
    grid-column: 1 / -1;
  }

  .game-date-filter {
    grid-column: 1 / -1;
  }

  .game-hitter-fields,
  .game-starter-fields,
  .game-bullpen-fields {
    grid-template-columns: repeat(3, minmax(80px, 1fr));
  }

  .workflow-guide { grid-template-columns: 1fr; }
  .injury-player-context { grid-template-columns: repeat(2, minmax(120px, 1fr)); }

  .wide-field {
    grid-column: 1 / -1;
  }

  .inline-form {
    grid-template-columns: 1fr 100px;
  }

  .settings-form,
  .analysis-controls,
  .custom-period-controls,
  .pitcher-plan-controls,
  .delivery-grid,
  .checklist {
    grid-template-columns: 1fr;
  }

  .analysis-controls {
    display: grid;
    width: 100%;
  }

  .record-search-controls {
    width: 100%;
  }
}

@media (max-width: 560px) {
  .quality-summary {
    grid-template-columns: 1fr;
  }

  .record-search-controls,
  .record-search-summary {
    display: grid;
    grid-template-columns: 1fr;
  }
}

@media print {
  body {
    background: #fff;
  }

  .sidebar,
  .topbar,
  .view:not(#report-view) {
    display: none !important;
  }

  .app-shell,
  .main {
    display: block;
    padding: 0;
  }

  #report-view {
    display: block !important;
  }

  .report-page {
    box-shadow: none;
    border: 0;
  }
}

.action-complete,
.primary-button.action-complete,
button.action-complete {
  background: #c62828 !important;
  border-color: #a91f1f !important;
  color: #fff !important;
  box-shadow: 0 0 0 3px rgba(198, 40, 40, 0.14);
}

.action-success-notice {
  position: fixed;
  z-index: 10000;
  top: 18px;
  right: 20px;
  max-width: min(480px, calc(100vw - 40px));
  padding: 13px 18px;
  border: 1px solid #a91f1f;
  border-radius: 10px;
  background: #c62828;
  color: #fff;
  font-weight: 700;
  line-height: 1.45;
  box-shadow: 0 10px 28px rgba(78, 10, 10, 0.24);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-12px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.action-success-notice.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 560px) {
  .action-success-notice {
    top: 10px;
    right: 10px;
    max-width: calc(100vw - 20px);
  }
}
