:root {
  --bg-1: #020617;
  --bg-2: #0f172a;
  --bg-3: #1e293b;
  --card: rgba(255,255,255,0.08);
  --card-2: rgba(2,6,23,0.34);
  --line: rgba(255,255,255,0.12);
  --text: #e5eef9;
  --muted: rgba(229,238,249,0.74);
  --accent: #67e8f9;
  --accent-2: #22d3ee;
  --danger: #fb7185;
  --success: #4ade80;
  --shadow: 0 24px 70px rgba(0,0,0,0.32);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top, var(--bg-3) 0%, var(--bg-2) 45%, var(--bg-1) 100%);
}
button, input, select, textarea { font: inherit; }
button {
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.06);
  color: var(--text);
  border-radius: 16px;
  padding: .85rem 1rem;
  cursor: pointer;
}
button:hover { background: rgba(255,255,255,0.1); }
button:disabled { opacity: .5; cursor: not-allowed; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: .8rem .9rem;
  background: rgba(15,23,42,.72);
  color: #fff;
}
textarea { min-height: 110px; resize: vertical; }
label.file-button {
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 16px; padding: .85rem 1rem;
  background: rgba(255,255,255,0.06); cursor: pointer;
}
label.file-button input { display: none; }
strong, h1, h2, h3 { color: #fff; }
small, .muted, .tiny { color: var(--muted); }
.app-shell { max-width: 1680px; margin: 0 auto; padding: 1rem; }
.card, .topbar, .status-panel {
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 28px;
  background: var(--card);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}
.topbar { padding: 1.25rem 1.4rem; display: flex; gap: 1rem; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.topbar h1 { margin: 0 0 .35rem; font-size: 2rem; }
.topbar p { margin: 0; max-width: 840px; color: var(--muted); }
.toolbar { display: flex; gap: .75rem; flex-wrap: wrap; justify-content: flex-end; }
.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #082f49; border: none; font-weight: 700; }
.success { background: linear-gradient(135deg, #4ade80, #22c55e); color: #052e16; border: none; font-weight: 700; }
.status-panel { margin-bottom: 1rem; padding: .95rem 1.15rem; display: grid; gap: .5rem; }
.layout { display: grid; grid-template-columns: 360px minmax(0,1fr); gap: 1rem; }
.sidebar { padding: 1rem; }
.sheet-list, .drive-list, .sidebar-group, .rows-stack, .tabs { display: grid; gap: .7rem; }
.sheet-item, .drive-item { text-align: left; width: 100%; border-radius: 22px; padding: .95rem; }
.sheet-item.active { outline: 1px solid rgba(103,232,249,.45); background: rgba(34,211,238,.16); }
.sheet-title-row { display: flex; justify-content: space-between; align-items: center; gap: .75rem; margin-bottom: .25rem; }
.pill {
  display: inline-flex; align-items: center; justify-content: center; min-height: 28px;
  border-radius: 999px; padding: .2rem .7rem; font-size: .78rem; border: 1px solid var(--line);
}
.pill.muted { background: rgba(255,255,255,.06); }
.pill.danger { background: rgba(251,113,133,.18); color: #fecdd3; border-color: rgba(251,113,133,.35); }
.pill.success { background: rgba(74,222,128,.15); color: #dcfce7; border-color: rgba(74,222,128,.28); }
.content { display: grid; gap: 1rem; }
.tabs { grid-template-columns: repeat(3, minmax(0,1fr)); padding: .4rem; }
.tabs button.active { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #082f49; font-weight: 700; }
.section { padding: 1rem; }
.row-nav-top { display:flex; justify-content:space-between; gap:1rem; align-items:flex-start; margin-bottom: 1rem; }
.row-nav-actions { display:flex; gap:.75rem; flex-wrap:wrap; }
.ghost { background: rgba(255,255,255,0.04); }
.section-title-row, .row-top { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; margin-bottom: 1rem; }
.form-grid, .row-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: .85rem; }
.field { display: grid; gap: .45rem; }
.field span { color: var(--muted); font-size: .92rem; }
.span-2 { grid-column: span 2; }
.pitch-grid { display: grid; grid-template-columns: repeat(10, minmax(0,1fr)); gap: .5rem; margin-bottom: 1rem; }
.pitch-cell { display: grid; gap: .35rem; padding: .55rem; border-radius: 18px; background: var(--card-2); }
.baseball-svg, .spray-svg { width: 100%; max-width: 370px; background: rgba(2,6,23,.5); border-radius: 24px; border: 1px solid rgba(255,255,255,.1); }
.baseball-svg.disabled { opacity: .45; }
.summary-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(340px, 420px); gap: 1rem; }
.metrics-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: .85rem; padding: 1rem; }
.metric { padding: .95rem; border-radius: 22px; border: 1px solid rgba(255,255,255,.08); background: var(--card-2); }
.metric strong { display: block; margin-top: .2rem; font-size: 1.55rem; color: var(--accent); }
.spray-chart { padding: 1rem; }
.meta-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: .85rem; margin-bottom: 1rem; }
.meta-box { padding: .85rem; border-radius: 18px; background: var(--card-2); border: 1px solid rgba(255,255,255,.08); }
.notice-error { color: #fecaca; }
.notice-ok { color: #dcfce7; }
@media (max-width: 1180px) {
  .layout, .summary-grid { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .topbar { flex-direction: column; align-items: stretch; }
  .form-grid, .row-grid, .metrics-grid, .meta-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .pitch-grid { grid-template-columns: repeat(5, minmax(0,1fr)); }
}
@media (max-width: 560px) {
  .app-shell { padding: .8rem; }
  .form-grid, .row-grid, .metrics-grid, .meta-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
}


.sidebar-toggle { white-space: nowrap; }
.content-topbar { display: none; margin-bottom: .75rem; }
.content-topbar.visible { display: flex; justify-content: flex-start; }
.layout.sidebar-collapsed { grid-template-columns: minmax(0,1fr); }
.sidebar.collapsed { display: none; }
@media (max-width: 1180px) {
  .content-topbar { display: flex; justify-content: flex-start; }
}


button.danger-button {
  background: rgba(244,63,94,0.12);
  border-color: rgba(244,63,94,0.28);
  color: #fecdd3;
}
button.danger-button:hover {
  background: rgba(244,63,94,0.2);
}
.topbar {
  background: linear-gradient(180deg, rgba(255,255,255,0.10), rgba(255,255,255,0.06));
}
.card, .status-panel {
  background: linear-gradient(180deg, rgba(255,255,255,0.09), rgba(255,255,255,0.06));
}
.sheet-item, .drive-item, .metric, .meta-box, .pitch-cell {
  transition: background .18s ease, border-color .18s ease, transform .18s ease;
}
.sheet-item:hover {
  transform: translateY(-1px);
  border-color: rgba(103,232,249,.22);
}
.section h2, .spray-chart h2 {
  margin-top: 0;
  margin-bottom: .4rem;
}
.field-shell {
  display: grid;
  gap: .6rem;
}
.row-nav-top, .section-title-row, .row-top {
  align-items: center;
}
.toolbar button, .toolbar .file-button {
  min-height: 48px;
}
input:focus, select:focus, textarea:focus, button:focus {
  outline: 2px solid rgba(103,232,249,.55);
  outline-offset: 2px;
}
