/* Compact, dark-themed dashboard. Tuned for information density and
   readable pre-formatted CLI output inside the sub-panels. */

:root {
  --bg: #0d1117;
  --panel: #161b22;
  --panel-2: #1c2129;
  --border: #30363d;
  --fg: #e6edf3;
  --muted: #8b949e;
  --accent: #58a6ff;
  --ok: #3fb950;
  --warn: #d29922;
  --err: #f85149;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 13px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.5rem 1rem;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}

.topbar h1 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent);
}

.controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.controls label {
  color: var(--muted);
  font-size: 0.85rem;
}

.controls select,
.controls button {
  background: var(--panel-2);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.25rem 0.5rem;
  font: inherit;
  cursor: pointer;
}

.controls select:hover,
.controls button:hover {
  border-color: var(--accent);
}

.status {
  color: var(--muted);
  font-size: 0.85rem;
  margin-left: auto;
}

.status.ok { color: var(--ok); }
.status.err { color: var(--err); }

main {
  padding: 0.75rem;
}

.empty-note {
  text-align: center;
  color: var(--muted);
  padding: 3rem 1rem;
}

/* Gridstack customization */
.grid-stack {
  min-height: 200px;
}

.grid-stack-item-content {
  background: transparent !important;
  overflow: hidden !important;
}

.panel-inner {
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.6rem;
  background: var(--panel-2);
  border-bottom: 1px solid var(--border);
  cursor: move; /* Gridstack drag handle */
  user-select: none;
}

.panel-title {
  font-weight: 600;
  color: var(--accent);
}

.panel-status {
  color: var(--muted);
  font-size: 0.85rem;
  flex: 1;
}

.panel-controls {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.panel-controls select,
.panel-controls button {
  background: var(--panel);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.15rem 0.35rem;
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}

.panel-controls button {
  font-size: 1rem;
  line-height: 1;
  padding: 0.05rem 0.35rem 0.1rem;
}

/* Inner 3x2 grid of sub-panels.
   Col 1 is wider (with a minimum) because it holds the linescore, which
   is fixed-width monospaced text (~60 chars) and horizontally scrolls
   at 1fr on typical viewports. The chart in cols 2-3 remains happy at
   the smaller share. */
.panel-grid {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(320px, 1.5fr) 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 1px;
  background: var(--border);
  overflow: hidden;
  min-height: 0;
}

.cell {
  background: var(--panel);
  padding: 0.35rem 0.5rem;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.cell-linescore {
  grid-column: 1 / span 1;
  grid-row: 2 / span 1;
}

.cell-scoreless {
  grid-column: 2 / span 2;
  grid-row: 2 / span 1;
}

.cell-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 0.25rem;
  flex: 0 0 auto;
}

.cell-body {
  flex: 1;
  overflow: auto;
  margin: 0;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.35;
  white-space: pre;
  color: var(--fg);
}

.cell-body.chart-body {
  padding: 0;
  overflow: hidden;
}

.cell-body.error {
  color: var(--err);
}

.cell-body.empty {
  color: var(--muted);
  font-style: italic;
  white-space: pre-wrap;
}

/* Loading shimmer for freshly-updating cells */
.cell.stale .cell-body {
  opacity: 0.6;
  transition: opacity 0.15s ease-in;
}

/* Newly-added panel highlight */
@keyframes panel-flash {
  0% { box-shadow: 0 0 0 2px var(--accent); }
  100% { box-shadow: none; }
}
.panel-inner.fresh {
  animation: panel-flash 2s ease-out;
}
