:root {
  --ink: #102131;
  --muted: #657487;
  --line: #dde6ec;
  --green: #13a66b;
  --green-dark: #08744d;
  --navy: #0b1b2b;
  --paper: #f3f6f8;
  --white: #fff;
}

* { box-sizing: border-box; }
html { background: var(--paper); }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 16px;
  margin: 0;
  min-width: 320px;
}
button, a { -webkit-tap-highlight-color: transparent; font-family: inherit; }
.dashboard-shell { display: flex; flex-direction: column; min-height: 100vh; }

.site-header {
  backdrop-filter: blur(14px);
  background: rgba(11, 27, 43, .98);
  border-bottom: 1px solid rgba(255,255,255,.08);
  color: white;
  position: sticky;
  top: 0;
  z-index: 20;
}
.header-inner, .dashboard-content, .site-footer { margin: 0 auto; width: min(980px, calc(100% - 40px)); }
.header-inner { align-items: center; display: flex; height: 68px; justify-content: space-between; }
.brand { align-items: center; color: white; display: inline-flex; gap: 10px; text-decoration: none; }
.brand-mark {
  align-items: center;
  background: var(--green);
  border-radius: 12px;
  box-shadow: none;
  display: inline-flex;
  height: 40px;
  justify-content: center;
  width: 40px;
}
.brand-mark svg { height: 21px; width: 21px; }
.brand > span:last-child { display: flex; flex-direction: column; line-height: 1; }
.brand strong { font-size: 20px; letter-spacing: .02em; }
.brand small { color: #9eb0be; font-size: 8px; font-weight: 700; letter-spacing: .16em; margin-top: 5px; }
.header-actions { align-items: center; display: flex; gap: 8px; }
.caster-health { align-items: center; color: #ccdae3; display: flex; font-size: 12px; font-weight: 600; gap: 7px; margin-right: 4px; }
.health-dot { background: #32d78d; border-radius: 50%; height: 8px; width: 8px; }
.caster-health.is-connected .health-dot { box-shadow: 0 0 0 4px rgba(50,215,141,.13); }
.caster-health.is-disconnected { color: #ffc7c7; }
.caster-health.is-disconnected .health-dot { background: #e45858; box-shadow: 0 0 0 4px rgba(228,88,88,.14); }
.static-button {
  align-items: center;
  border: 1px solid transparent;
  border-radius: 9px;
  cursor: pointer;
  display: inline-flex;
  font-size: 12px;
  font-weight: 700;
  gap: 6px;
  height: 38px;
  justify-content: center;
  padding: 0 12px;
  text-decoration: none;
  transition: background-color .2s ease, opacity .2s ease;
}
.static-button:disabled { cursor: wait; opacity: .65; }
.static-button:focus-visible, .station-manage-button:focus-visible { outline: 3px solid rgba(21,184,116,.35); outline-offset: 2px; }
.refresh-button { background: transparent !important; border-color: #385064 !important; color: #e4edf3 !important; }
.refresh-button:hover { background: #173247 !important; }
.admin-button { background: var(--green) !important; color: #061f16 !important; }
.admin-button:hover { background: #36c98b !important; }

.dashboard-content { flex: 1; padding: 36px 0 44px; }
.dashboard-heading { align-items: flex-end; display: flex; justify-content: space-between; }
.eyebrow { color: var(--green-dark); font-size: 10px; font-weight: 800; letter-spacing: .14em; margin: 0 0 7px; }
.dashboard-heading h1 { font-size: 34px; font-weight: 700; letter-spacing: -.035em; line-height: 1.1; margin: 0; }
.updated-line { align-items: center; color: var(--muted); display: flex; font-size: 12px; gap: 7px; margin: 10px 0 0; }
.updated-line strong { color: #405468; font-variant-numeric: tabular-nums; }
.warning-banner {
  align-items: center;
  background: #fff8e7;
  border: 1px solid #efdcaa;
  border-radius: 12px;
  color: #735914;
  display: flex;
  font-size: 13px;
  gap: 9px;
  margin-top: 18px;
  padding: 11px 13px;
}
.is-hidden { display: none !important; }

.summary-grid { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 24px; }
.summary-card {
  align-items: center;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(20,46,64,.04);
  display: flex;
  justify-content: space-between;
  min-height: 82px;
  padding: 16px 18px;
}
.summary-card > span { color: var(--muted); font-size: 12px; font-weight: 600; }
.summary-card > div { align-items: baseline; display: flex; gap: 5px; }
.summary-card strong { font-size: 27px; font-variant-numeric: tabular-nums; line-height: 1; margin: 0; }
.summary-card small { color: #8a98a6; font-size: 11px; }
.primary-summary { background: var(--green); border-color: var(--green); color: white; }
.primary-summary > span, .primary-summary small { color: rgba(255,255,255,.82); }

.section-heading { align-items: center; display: flex; justify-content: space-between; margin: 30px 0 12px; }
.section-heading h2 { font-size: 18px; font-weight: 700; letter-spacing: -.015em; margin: 0; }
.section-heading > span { color: var(--muted); font-size: 11px; }
.station-grid { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.station-grid.is-single { grid-template-columns: minmax(0, 1fr); }
.station-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 12px 34px rgba(20,46,64,.055);
  min-height: 0;
  overflow: hidden;
  padding: 22px;
  position: relative;
}
.station-card.is-offline { background: #fbfcfd; }
.station-accent { background: #2d3943; height: 3px; left: 0; position: absolute; right: 0; top: 0; }
.station-card.is-online .station-accent { background: var(--green); }
.station-card-top { align-items: center; display: flex; gap: 14px; justify-content: space-between; }
.station-title-row { display: block; min-width: 0; }
.station-title-row h2 { font-size: 21px; font-weight: 700; letter-spacing: -.025em; margin: 0; overflow-wrap: anywhere; }
.status-badge {
  align-items: center;
  border-radius: 999px;
  display: flex;
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 700;
  gap: 7px;
  padding: 7px 10px;
}
.status-badge.online { background: #e7f8f0; color: var(--green-dark); }
.status-badge.offline { background: #e9edf0; color: #3c4954; }
.status-dot { background: #26323c; border-radius: 50%; height: 8px; width: 8px; }
.status-badge.online .status-dot { animation: status-pulse 1.35s ease-out infinite; background: var(--green); }
@keyframes status-pulse { 0% { box-shadow: 0 0 0 0 rgba(19,166,107,.45); } 75%,100% { box-shadow: 0 0 0 7px rgba(19,166,107,0); } }
@media (prefers-reduced-motion: reduce) { .status-badge.online .status-dot { animation: none; } }
.station-location { align-items: center; color: var(--muted); display: flex; font-size: 12px; gap: 6px; margin: 8px 0 17px; }
.station-metrics { display: grid; gap: 8px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.metric-block {
  align-items: flex-start;
  background: #f5f8fa;
  border: 1px solid #eaf0f3;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-height: 72px;
  padding: 13px;
}
.metric-block span { color: #738294; font-size: 10px; font-weight: 600; line-height: 1.2; white-space: normal; }
.metric-block strong { color: var(--ink); font-size: 15px; font-variant-numeric: tabular-nums; line-height: 1.2; margin: 0; overflow: visible; white-space: normal; }
.station-bottom { align-items: flex-end; border-top: 1px solid #edf1f3; display: flex; gap: 18px; justify-content: space-between; margin-top: 16px; padding-top: 15px; }
.station-footer { align-items: center; border: 0; display: flex; flex: 1; gap: 16px; justify-content: space-between; margin: 0; min-width: 0; padding: 0; }
.station-footer > div:first-child { display: flex; flex-direction: column; }
.footer-label { color: #82909e; font-size: 9px; margin-bottom: 3px; }
.station-footer strong { font-size: 12px; }
.mount-chip {
  background: #edf3f6;
  border-radius: 8px;
  color: #405567;
  display: inline-flex;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 9px;
  font-weight: 700;
  max-width: 55%;
  overflow: hidden;
  padding: 7px 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.station-actions { display: flex; flex: 0 0 auto; justify-content: flex-end; margin: 0; }
.station-manage-button {
  align-items: center;
  background: var(--navy);
  border: 1px solid var(--navy);
  border-radius: 10px;
  color: white;
  display: inline-flex;
  font-size: 11px;
  font-weight: 700;
  gap: 7px;
  justify-content: center;
  min-height: 40px;
  padding: 9px 12px;
  text-decoration: none;
}
.station-manage-button:hover { background: #16364b; border-color: #16364b; }
.coordinates { color: #8796a5; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 9px; margin: 9px 0 0; text-align: right; }
.station-card-loading { min-height: 240px; }
.loading-line, .loading-panel { animation: loading 1.2s ease-in-out infinite alternate; background: #edf2f5; border-radius: 8px; }
.loading-line { height: 14px; margin-bottom: 10px; width: 38%; }
.loading-line.wide { height: 22px; width: 52%; }
.loading-panel { height: 76px; margin-top: 32px; width: 100%; }
@keyframes loading { to { background: #f6f8fa; } }
.is-spinning { animation: spin .75s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty-state { background: white; border: 1px dashed #cdd9e1; border-radius: 16px; color: var(--muted); grid-column: 1 / -1; padding: 34px; text-align: center; }
.empty-state h2 { color: var(--ink); font-size: 18px; margin: 8px 0 5px; }
.empty-state p { font-size: 13px; margin: 0; }
.empty-symbol { color: #8ca1af; font-size: 30px; }
.site-footer { align-items: center; border-top: 1px solid #dbe4ea; color: #788795; display: flex; font-size: 10px; justify-content: space-between; padding: 18px 0 22px; }
.footer-brand { color: #244154; font-size: 11px; font-weight: 800; }

@media (max-width: 720px) {
  .header-inner, .dashboard-content, .site-footer { width: min(100% - 24px, 980px); }
  .header-inner { height: 62px; }
  .brand { gap: 8px; }
  .brand-mark { border-radius: 10px; height: 36px; width: 36px; }
  .brand-mark svg { height: 19px; width: 19px; }
  .brand strong { font-size: 18px; }
  .brand small { font-size: 7px; margin-top: 4px; }
  .caster-health { margin: 0; }
  .caster-health span:last-child, .refresh-label { display: none; }
  .static-button { height: 40px; padding: 0 10px; }
  .refresh-button { min-width: 40px; padding: 0 !important; }
  .dashboard-content { padding: 24px 0 32px; }
  .dashboard-heading h1 { font-size: 28px; }
  .eyebrow { font-size: 9px; }
  .updated-line { font-size: 11px; margin-top: 8px; }
  .summary-grid { gap: 8px; margin-top: 18px; }
  .summary-card { align-items: flex-start; flex-direction: column; gap: 8px; min-height: 84px; padding: 13px; }
  .summary-card > span { font-size: 10px; }
  .summary-card strong { font-size: 24px; }
  .section-heading { margin: 24px 0 10px; }
  .section-heading h2 { font-size: 17px; }
  .section-heading > span { font-size: 10px; }
  .station-grid { grid-template-columns: 1fr; }
  .station-card { border-radius: 16px; padding: 17px 15px 15px; }
  .station-card-top { gap: 8px; }
  .station-title-row h2 { font-size: 18px; }
  .status-badge { font-size: 10px; gap: 6px; padding: 7px 9px; }
  .status-dot { height: 7px; width: 7px; }
  .station-location { font-size: 11px; margin: 7px 0 14px; }
  .station-metrics { gap: 6px; }
  .metric-block { border-radius: 10px; min-height: 68px; padding: 10px 8px; }
  .metric-block span { font-size: 9px; }
  .metric-block strong { font-size: 13px; }
  .station-bottom { align-items: stretch; flex-direction: column; gap: 12px; margin-top: 14px; padding-top: 13px; }
  .station-footer { width: 100%; }
  .station-actions, .station-manage-button { width: 100%; }
  .station-manage-button { min-height: 44px; }
  .site-footer { padding: 16px 0 20px; }
}

@media (max-width: 380px) {
  .header-actions { gap: 5px; }
  .admin-button { padding: 0 9px; }
  .section-heading > span { display: none; }
  .status-badge { font-size: 0; padding: 9px; }
  .status-dot { height: 9px; width: 9px; }
}
