:root {
  --bg: #fff5f5;
  --bg-strong: #ffe3e3;
  --surface: #ffffff;
  --surface-soft: #fff8f8;
  --line: #f0c7c7;
  --line-strong: #e6a9a9;
  --text: #361313;
  --muted: #8a4f4f;
  --red-500: #d81f26;
  --red-600: #b9141a;
  --red-700: #921118;
  --red-900: #54070a;
  --success: #0f8b4c;
  --warning: #cf6a12;
  --shadow: 0 24px 60px rgba(124, 18, 18, 0.12);
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 16px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(216, 31, 38, 0.12), transparent 26%),
    radial-gradient(circle at bottom right, rgba(185, 20, 26, 0.1), transparent 22%),
    linear-gradient(180deg, #fffafa 0%, var(--bg) 100%);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

.shell {
  max-width: 1560px;
  margin: 0 auto;
  padding: 28px 20px 48px;
}

.topbar,
.control-panel,
.main-nav,
.panel,
.hero-card {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  padding: 24px 28px;
  border-radius: var(--radius-xl);
  background:
    radial-gradient(circle at top right, rgba(216, 31, 38, 0.14), transparent 24%),
    linear-gradient(135deg, #ffffff 0%, #fff4f4 100%);
}

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

.brand-logo {
  width: 62px;
  height: 62px;
  border-radius: 18px;
  object-fit: cover;
  display: block;
  box-shadow: 0 10px 24px rgba(185, 20, 26, 0.18);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--red-500);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  font-weight: 700;
}

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

h1 {
  font-size: clamp(2rem, 4vw, 3.6rem);
  line-height: 0.95;
}

.topbar-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.button {
  border: 0;
  padding: 13px 18px;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, color 160ms ease;
}

.button:hover,
.nav-pill:hover,
.button:focus-visible,
.nav-pill:focus-visible {
  transform: translateY(-1px);
}

.button-primary {
  background: linear-gradient(135deg, var(--red-600), var(--red-500));
  color: #fff;
}

.button-ghost {
  background: #fff0f0;
  color: var(--red-700);
  border: 1px solid var(--line-strong);
}

.control-panel {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 220px)) 1fr;
  gap: 18px;
  margin-top: 18px;
  padding: 22px 24px;
  border-radius: var(--radius-lg);
}

.control-panel label,
.metric-toggle-wrap,
.mapping-form label,
.admin-login-form label {
  display: grid;
  gap: 8px;
  font-size: 0.95rem;
  font-weight: 600;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line-strong);
  background: var(--surface-soft);
  color: var(--text);
  padding: 13px 14px;
  border-radius: 14px;
}

.control-hint {
  display: grid;
  align-content: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.92rem;
  padding-left: 8px;
}

.metric-toggle-label {
  font-size: 0.95rem;
  font-weight: 600;
}

.metric-toggle {
  display: inline-flex;
  flex-wrap: wrap;
  width: fit-content;
  padding: 4px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #fff0f0;
}

.metric-toggle__button {
  border: 0;
  min-width: 74px;
  padding: 10px 18px;
  border-radius: 999px;
  background: transparent;
  color: var(--red-700);
  font-weight: 700;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.metric-toggle__button.is-active {
  background: linear-gradient(135deg, var(--red-700), var(--red-500));
  color: #fff;
}

.main-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px;
  border-radius: var(--radius-lg);
  margin-top: 18px;
}

.nav-pill {
  border: 0;
  border-radius: 999px;
  padding: 14px 22px;
  background: #fff0f0;
  color: var(--red-700);
  font-weight: 700;
  cursor: pointer;
}

.nav-pill.is-active {
  background: linear-gradient(135deg, var(--red-700), var(--red-500));
  color: #fff;
}

.content {
  margin-top: 22px;
}

.view-section {
  display: none;
}

.view-section.is-active {
  display: grid;
  gap: 18px;
}

.view-head {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: end;
}

.meta-copy {
  display: grid;
  gap: 4px;
  text-align: right;
  color: var(--muted);
}

.meta-copy strong {
  color: var(--red-700);
  font-size: 1.08rem;
}

.hero-grid,
.panel-grid {
  display: grid;
  gap: 18px;
}

.hero-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.panel-grid.two-col {
  grid-template-columns: minmax(0, 1.5fr) minmax(340px, 0.95fr);
}

.panel-grid--ops-split {
  grid-template-columns: minmax(0, 3fr) minmax(320px, 1fr);
}

.panel {
  border-radius: var(--radius-lg);
  padding: 22px;
  background:
    linear-gradient(180deg, #ffffff 0%, #fff9f9 100%);
}

.panel--feature {
  padding: 26px;
}

.hero-card {
  border-radius: var(--radius-xl);
  padding: 24px;
  display: grid;
  gap: 18px;
  background:
    radial-gradient(circle at top right, rgba(216, 31, 38, 0.16), transparent 30%),
    linear-gradient(160deg, #ffffff 0%, #fff1f1 100%);
}

.hero-card--accent {
  background:
    radial-gradient(circle at top left, rgba(216, 31, 38, 0.18), transparent 28%),
    linear-gradient(160deg, #fff6f6 0%, #ffe6e6 100%);
}

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

.panel-head span,
.inline-feedback {
  color: var(--muted);
  font-size: 0.92rem;
}

.summary-strip {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.summary-chip {
  min-width: 120px;
  padding: 14px;
  border-radius: 18px;
  background: #fff;
  border: 1px solid var(--line);
}

.summary-chip span {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.summary-chip strong {
  display: block;
  margin-top: 10px;
  font-size: 1.8rem;
}

.compare-list {
  display: grid;
  gap: 12px;
}

.compare-row {
  padding: 16px 18px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
}

.compare-row__head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
  margin-bottom: 12px;
}

.compare-row__kicker {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
}

.compare-row__head strong {
  display: block;
  font-size: 1.12rem;
}

.compare-row__head p,
.compare-row__values span {
  color: var(--muted);
  font-size: 0.9rem;
}

.compare-row__values {
  text-align: right;
}

.compare-row__values strong {
  font-size: 1.6rem;
  color: var(--red-700);
  line-height: 0.9;
}

.compare-row__track {
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(180deg, #fff2f2 0%, #ffe3e3 100%);
  overflow: hidden;
}

.compare-row__track span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--red-700), var(--red-500));
}

.building-chart {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 18px;
  align-items: center;
}

.building-figure {
  position: relative;
  width: 126px;
  height: 240px;
  border-radius: 26px 26px 8px 8px;
  border: 2px solid #f3b1b1;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(255, 242, 242, 1) 100%);
  overflow: hidden;
}

.building-fill {
  position: absolute;
  inset: auto 0 0 0;
  background:
    linear-gradient(180deg, rgba(216, 31, 38, 0.88) 0%, rgba(146, 17, 24, 0.98) 100%);
  transition: height 260ms ease;
}

.building-fill--goal {
  background:
    linear-gradient(180deg, rgba(138, 79, 79, 0.18) 0%, rgba(138, 79, 79, 0.28) 100%);
}

.building-grid {
  position: absolute;
  inset: 12px 12px 10px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(10, 1fr);
  gap: 8px;
}

.building-grid span {
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.32);
}

.building-label {
  display: grid;
  gap: 12px;
}

.building-label strong {
  font-size: clamp(2rem, 4vw, 3rem);
  color: var(--red-700);
  line-height: 0.92;
}

.building-label p {
  color: var(--muted);
  line-height: 1.5;
}

.machine-spotlight {
  position: relative;
  gap: 20px;
  overflow: hidden;
}

.machine-spotlight::after {
  content: "";
  position: absolute;
  inset: auto -40px -60px auto;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(216, 31, 38, 0.14) 0%, rgba(216, 31, 38, 0) 70%);
  pointer-events: none;
}

.machine-spotlight__top,
.machine-spotlight__hero,
.machine-spotlight__footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
}

.machine-spotlight__top {
  align-items: start;
}

.machine-spotlight__top h3 {
  font-size: clamp(1.9rem, 3vw, 2.5rem);
  line-height: 0.94;
}

.machine-spotlight__work {
  margin-top: 8px;
  color: var(--muted);
  font-size: 1rem;
  font-weight: 600;
}

.machine-spotlight__badges {
  display: grid;
  justify-items: end;
  gap: 10px;
}

.machine-spotlight__position {
  padding: 9px 14px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--red-700);
  font-weight: 800;
}

.machine-spotlight__hero {
  align-items: end;
}

.machine-spotlight__score {
  min-width: 180px;
  display: grid;
  gap: 8px;
}

.machine-spotlight__label,
.machine-spotlight__metric span,
.machine-spotlight__progress-scale,
.machine-spotlight__footer {
  color: var(--muted);
}

.machine-spotlight__label {
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.76rem;
  font-weight: 700;
}

.machine-spotlight__score strong {
  font-size: clamp(4rem, 8vw, 6rem);
  line-height: 0.88;
  color: var(--red-700);
}

.machine-spotlight__score p {
  font-size: 0.95rem;
}

.machine-spotlight__progress {
  flex: 1;
  display: grid;
  gap: 10px;
  padding: 18px 20px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(240, 199, 199, 0.9);
  backdrop-filter: blur(8px);
}

.machine-spotlight__progress-bar {
  height: 20px;
  border-radius: 999px;
  background: linear-gradient(180deg, #fff4f4 0%, #ffe1e1 100%);
  overflow: hidden;
}

.machine-spotlight__progress-bar span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--red-700), var(--red-500));
  box-shadow: 0 6px 18px rgba(216, 31, 38, 0.24);
}

.machine-spotlight__progress-scale {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.9rem;
  font-weight: 700;
}

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

.machine-spotlight__metric {
  padding: 18px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid var(--line);
  display: grid;
  gap: 8px;
}

.machine-spotlight__metric strong {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  line-height: 0.92;
  color: var(--red-700);
}

.machine-spotlight__metric.is-primary {
  background: linear-gradient(160deg, #fff6f6 0%, #ffe6e6 100%);
  border-color: var(--line-strong);
}

.machine-spotlight__footer {
  align-items: center;
  font-size: 0.92rem;
  font-weight: 600;
}

.machine-spotlight--green .machine-spotlight__progress-bar span {
  background: linear-gradient(90deg, #0f8b4c, #31b86f);
  box-shadow: 0 6px 18px rgba(15, 139, 76, 0.22);
}

.machine-spotlight--orange .machine-spotlight__progress-bar span {
  background: linear-gradient(90deg, #cf6a12, #f0a33c);
  box-shadow: 0 6px 18px rgba(207, 106, 18, 0.22);
}

.hero-card--rhythm {
  background:
    radial-gradient(circle at top right, rgba(216, 31, 38, 0.1), transparent 26%),
    linear-gradient(160deg, #ffffff 0%, #fff6f6 100%);
}

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

.rhythm-chip {
  padding: 16px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
  display: grid;
  gap: 6px;
}

.rhythm-chip span,
.rhythm-chip small {
  color: var(--muted);
}

.rhythm-chip strong {
  font-size: 1.8rem;
  color: var(--red-700);
  line-height: 0.92;
}

.rhythm-chip.is-good {
  border-color: rgba(15, 139, 76, 0.18);
  background: linear-gradient(180deg, rgba(223, 246, 233, 0.7) 0%, rgba(255, 255, 255, 0.95) 100%);
}

.rhythm-chip.is-warning {
  border-color: rgba(207, 106, 18, 0.2);
  background: linear-gradient(180deg, rgba(255, 240, 219, 0.75) 0%, rgba(255, 255, 255, 0.95) 100%);
}

.status-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 700;
}

.status-tag.red {
  background: #ffe2e2;
  color: var(--red-700);
}

.status-tag.green {
  background: #dff6e9;
  color: var(--success);
}

.status-tag.orange {
  background: #fff0db;
  color: var(--warning);
}

.status-tag.neutral {
  background: #f7eaea;
  color: var(--muted);
}

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

.machine-card,
.rank-card,
.timeline-card,
.alert-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
}

.machine-card {
  padding: 16px;
  display: grid;
  gap: 14px;
}

.machine-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.machine-meta {
  display: grid;
  gap: 4px;
}

.machine-meta small,
.table-shell td small {
  color: var(--muted);
}

.machine-progress {
  height: 12px;
  border-radius: 999px;
  background: #ffe3e3;
  overflow: hidden;
}

.machine-progress span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--red-600), var(--red-500));
}

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

.machine-stats div {
  padding: 12px;
  border-radius: 16px;
  background: #fff5f5;
}

.machine-stats span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.machine-stats strong {
  display: block;
  margin-top: 8px;
  font-size: 1.15rem;
}

.ranking-list,
.timeline-list,
.alerts-list {
  display: grid;
  gap: 12px;
}

.timeline-list--auto-scroll {
  max-height: calc(100vh - 250px);
  overflow: auto;
  padding-right: 4px;
  scrollbar-width: none;
}

.timeline-list--auto-scroll::-webkit-scrollbar {
  display: none;
}

.chart-stage {
  position: relative;
  min-height: 220px;
}

.chart-stage--large {
  min-height: 340px;
}

.panel-grid--secondary-top {
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
}

.panel-grid--secondary-tv-split {
  grid-template-columns: minmax(0, 3fr) minmax(320px, 1fr);
}

.rank-card,
.timeline-card,
.alert-card {
  padding: 14px 16px;
}

.rank-card {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.rank-order {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--red-600), var(--red-500));
  color: #fff;
  font-weight: 800;
}

.timeline-card {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 14px;
}

.timeline-time {
  color: var(--red-700);
  font-weight: 700;
}

.alert-card {
  border-left: 5px solid var(--red-500);
  background: #fff7f7;
}

.alert-card.warning {
  border-left-color: var(--warning);
}

.alert-card.success {
  border-left-color: var(--success);
}

.heatmap-grid {
  display: grid;
  gap: 10px;
}

.heatmap-row {
  display: grid;
  grid-template-columns: 160px repeat(7, minmax(34px, 1fr));
  gap: 8px;
  align-items: center;
}

.heatmap-cell {
  min-height: 46px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-weight: 700;
  color: #fff;
}

.heatmap-machine {
  font-weight: 700;
}

.admin-layout {
  display: grid;
  grid-template-columns: minmax(360px, 0.9fr) minmax(0, 1.3fr);
  gap: 18px;
}

.admin-login-panel {
  max-width: 520px;
}

.admin-login-form {
  display: flex;
  gap: 12px;
  align-items: end;
}

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

.mapping-form .checkbox-line,
.mapping-form .form-actions {
  grid-column: 1 / -1;
}

.checkbox-line {
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-weight: 600;
}

.checkbox-line.compact {
  justify-content: end;
}

.checkbox-line input {
  width: auto;
}

.form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.table-shell {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

.data-table th,
.data-table td {
  padding: 13px 14px;
  border-bottom: 1px solid #f4d7d7;
  text-align: left;
}

.data-table th {
  background: #fff0f0;
  color: var(--red-700);
}

.table-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.mini-button {
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #fff5f5;
  color: var(--red-700);
  padding: 8px 12px;
  cursor: pointer;
}

.data-table--wide {
  min-width: 1180px;
}

.panel-head--compact {
  margin-bottom: 12px;
}

.goal-import-review {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.goal-import-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.goal-import-stat {
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #fff9f7;
  display: grid;
  gap: 6px;
}

.goal-import-stat strong {
  font-size: 1.35rem;
  color: var(--ink);
}

.goal-import-stat span {
  color: var(--muted);
  font-size: 0.88rem;
}

.goal-import-stat.is-good {
  background: #f3fff8;
  border-color: #b7e7c9;
}

.goal-import-stat.is-warning {
  background: #fff8ec;
  border-color: #f0d3a0;
}

.goal-import-stat.is-error {
  background: #fff1f1;
  border-color: #efc1c1;
}

.goal-import-row.is-error {
  background: #fff7f7;
}

.goal-import-row.is-warning {
  background: #fffbf3;
}

.goal-import-row.is-ok {
  background: #f9fffb;
}

.goal-alert-list {
  display: grid;
  gap: 6px;
  min-width: 240px;
}

.goal-alert {
  padding: 7px 9px;
  border-radius: 10px;
  font-size: 0.83rem;
  line-height: 1.35;
}

.goal-alert.is-error {
  background: #ffe8e8;
  color: #981b1e;
}

.goal-alert.is-warning {
  background: #fff3df;
  color: #8f5200;
}

.goal-import-source {
  max-width: 320px;
  white-space: normal;
  line-height: 1.4;
}

.goal-segments {
  display: grid;
  gap: 10px;
  min-width: 260px;
}

.goal-segment-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fffafa;
}

.goal-segment-card__head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.goal-segment-card__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.goal-segment-card label {
  display: grid;
  gap: 6px;
  font-size: 0.86rem;
  font-weight: 600;
}

.goal-segment-card small {
  color: var(--muted);
}

.goal-warnings {
  display: grid;
  gap: 6px;
  min-width: 240px;
}

.goal-ocr-box {
  display: grid;
  gap: 10px;
  min-width: 320px;
}

.goal-ocr-box__label {
  display: grid;
  gap: 6px;
  font-size: 0.86rem;
  font-weight: 600;
}

.goal-ocr-box__textarea {
  width: 100%;
  min-height: 152px;
  resize: vertical;
  font: inherit;
  line-height: 1.45;
}

.goal-warning-chip {
  padding: 8px 10px;
  border-radius: 12px;
  font-size: 0.85rem;
  line-height: 1.35;
}

.goal-warning-chip.warning {
  background: #fff4e6;
  color: #8f5200;
}

.goal-warning-chip.error {
  background: #ffeaea;
  color: #9b1616;
}

.goal-meta-cell {
  min-width: 120px;
}

.is-hidden {
  display: none !important;
}

.tv-mode .shell {
  max-width: none;
  padding: 18px;
  padding-top: 38px;
}

.tv-mode .topbar {
  position: fixed;
  top: 8px;
  left: 18px;
  right: 18px;
  z-index: 20;
  overflow: hidden;
  padding: 18px 22px;
  min-height: 24px;
  max-height: 24px;
  opacity: 0.55;
  transition: max-height 180ms ease, opacity 180ms ease, box-shadow 180ms ease;
}

.tv-mode .topbar:hover,
.tv-mode .topbar:focus-within {
  max-height: 140px;
  opacity: 1;
  box-shadow: 0 24px 60px rgba(124, 18, 18, 0.2);
}

.tv-mode .topbar > * {
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 140ms ease, transform 140ms ease;
}

.tv-mode .topbar::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 1;
  background:
    linear-gradient(90deg, rgba(216, 31, 38, 0.82), rgba(185, 20, 26, 0.58));
}

.tv-mode .topbar:hover::before,
.tv-mode .topbar:focus-within::before {
  opacity: 0;
}

.tv-mode .topbar:hover > *,
.tv-mode .topbar:focus-within > * {
  opacity: 1;
  transform: translateY(0);
}

.tv-mode .content {
  margin-top: 10px;
}

.tv-mode h1 {
  font-size: 2.4rem;
}

.tv-mode h2 {
  font-size: 2.4rem;
}

.tv-mode .control-panel,
.tv-mode .main-nav {
  display: none;
}

.tv-mode .daily-desktop-panels {
  display: none;
}

.tv-mode .machine-card-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.tv-mode .secondary-tv-ops .machine-card-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.tv-mode .panel,
.tv-mode .hero-card {
  padding: 24px;
}

.tv-mode .chart-stage--large {
  min-height: 420px;
}

.tv-mode .summary-chip strong,
.tv-mode .building-label strong {
  font-size: 2.6rem;
}

@media (max-width: 1100px) {
  .hero-grid,
  .panel-grid.two-col,
  .admin-layout,
  .machine-card-grid,
  .mapping-form,
  .control-panel {
    grid-template-columns: 1fr;
  }

  .view-head,
  .topbar,
  .panel-head,
  .admin-login-form {
    flex-direction: column;
    align-items: flex-start;
  }

  .meta-copy {
    text-align: left;
  }
}

@media (max-width: 720px) {
  .shell {
    padding-inline: 14px;
  }

  .machine-stats,
  .summary-strip,
  .timeline-card,
  .heatmap-row,
  .machine-spotlight__metrics,
  .rhythm-grid {
    grid-template-columns: 1fr;
  }

  .building-chart {
    grid-template-columns: 1fr;
  }

  .goal-import-stats {
    grid-template-columns: 1fr 1fr;
  }

  .building-figure,
  .machine-spotlight__hero,
  .machine-spotlight__top,
  .machine-spotlight__footer,
  .compare-row__head {
    margin: 0 auto;
    flex-direction: column;
    align-items: flex-start;
  }

  .machine-spotlight__score {
    min-width: 0;
  }

  .building-figure {
    margin: 0 auto;
  }
}
