:root {
  --bg: #2a2a2a;
  --shell: #171717;
  --panel: #1f1f1f;
  --panel-strong: #101010;
  --card: #242424;
  --card-soft: #202020;
  --text: #f6f3ef;
  --muted: #9a9a9a;
  --muted-strong: #c9c9c9;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);
  --brand: #67d7ff;
  --accent: #85a8ff;
  --cyan: #00c4d8;
  --queue: #ffc170;
  --strong-queue: #ff8e79;
  --ok: #73d39b;
  --shadow: 0 28px 70px rgba(0, 0, 0, 0.34);
  --number-font: "Sora", "IBM Plex Sans", sans-serif;
  --body-font: "IBM Plex Sans", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  min-width: 320px;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--body-font);
  font-size: 16px;
}

body {
  min-height: 100vh;
  overflow: hidden;
  display: grid;
  place-items: center;
}

button,
input,
select,
textarea {
  font: inherit;
}

.app-shell {
  width: min(100vw, calc(100vh * 16 / 9));
  height: min(100vh, calc(100vw * 9 / 16));
  aspect-ratio: 16 / 9;
  padding: clamp(18px, 1.65vw, 32px);
  border-radius: clamp(0px, 1.4vw, 28px);
  background: var(--shell);
  box-shadow: var(--shadow);
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: clamp(10px, 1vw, 18px);
  overflow: hidden;
}

.brand-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-lockup > div {
  min-width: 0;
}

.brand-logo {
  width: clamp(38px, 2.65vw, 54px);
  height: clamp(38px, 2.65vw, 54px);
  border-radius: 12px;
  object-fit: cover;
  background: #ffffff;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.28);
  flex: 0 0 auto;
}

h1,
h2,
strong {
  font-family: var(--number-font);
  letter-spacing: 0;
}

h1 {
  margin: 0;
  font-size: clamp(1.45rem, 2vw, 2.3rem);
  line-height: 1.04;
  color: var(--text);
  overflow-wrap: anywhere;
}

.route-subtitle {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: clamp(0.88rem, 0.82vw, 1rem);
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.header-status {
  display: flex;
  gap: 10px;
  flex: 0 0 auto;
}

.time-block {
  min-width: clamp(104px, 7vw, 132px);
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
}

.time-label {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  margin-bottom: 4px;
}

.time-block strong {
  font-size: clamp(1rem, 1.05vw, 1.24rem);
  color: var(--text);
}

.route-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 0;
}

.route-tab {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted-strong);
  padding: 7px 13px;
  font-weight: 700;
  font-size: clamp(0.76rem, 0.72vw, 0.88rem);
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease;
}

.route-tab:hover {
  color: var(--text);
  border-color: rgba(103, 215, 255, 0.38);
}

.route-tab:focus-visible {
  outline: 3px solid rgba(103, 215, 255, 0.42);
  outline-offset: 3px;
}

.route-tab.active {
  color: #171717;
  background: var(--brand);
  border-color: var(--brand);
}

.dashboard {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(250px, 18.8vw, 350px);
  grid-template-rows: minmax(0, 1fr) clamp(84px, 8.4vw, 118px);
  gap: clamp(12px, 1vw, 18px);
}

.queue-chart-panel,
.status-card,
.weather-card,
.insight-card,
.status-sentence {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel);
}

.queue-chart-panel {
  grid-column: 1;
  grid-row: 1;
  min-height: 0;
  padding: clamp(18px, 1.6vw, 30px);
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(circle at 50% 115%, rgba(103, 215, 255, 0.11), transparent 46%),
    var(--panel);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: clamp(8px, 0.9vw, 16px);
}

.panel-header h2 {
  margin: 0;
  font-size: clamp(1.55rem, 1.9vw, 2.35rem);
  line-height: 1.1;
}

.panel-header p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: clamp(0.88rem, 0.82vw, 1rem);
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px 16px;
  color: var(--muted-strong);
  font-weight: 700;
  font-size: clamp(0.78rem, 0.74vw, 0.9rem);
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.legend-line {
  width: 28px;
  height: 0;
  border-top: 3px solid currentColor;
}

.legend-actual {
  color: var(--brand);
}

.legend-expected {
  color: #94e7ff;
  border-top-style: dashed;
}

.legend-yesterday {
  color: #7fb5ff;
}

.legend-history {
  color: #c5d2df;
}

.chart {
  width: 100%;
  min-height: 0;
  flex: 1;
  display: block;
}

.status-overview {
  grid-column: 2;
  grid-row: 1 / -1;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) minmax(0, 1fr) auto auto;
  gap: clamp(10px, 0.9vw, 16px);
}

.status-card,
.weather-card {
  min-height: 0;
  padding: clamp(14px, 1.1vw, 20px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  background: var(--card-soft);
}

.status-card-primary {
  border-color: rgba(103, 215, 255, 0.3);
}

.weather-card {
  gap: 6px;
  padding-block: clamp(12px, 0.9vw, 16px);
  border-color: rgba(103, 215, 255, 0.18);
}

.weather-value {
  color: var(--text);
  font-size: clamp(1.32rem, 1.85vw, 2.15rem);
  line-height: 1.05;
}

.status-label,
.insight-label {
  color: var(--muted);
  font-weight: 700;
  font-size: clamp(0.8rem, 0.74vw, 0.92rem);
}

.status-value {
  display: block;
  font-size: clamp(2.35rem, 4vw, 4.9rem);
  line-height: 0.95;
  color: var(--text);
  white-space: nowrap;
}

.status-card-primary .status-value {
  color: var(--brand);
}

.status-note {
  color: var(--muted-strong);
  font-size: clamp(0.88rem, 0.82vw, 1rem);
  line-height: 1.35;
}

.status-sentence {
  align-self: start;
  min-height: auto;
  padding: clamp(13px, 0.95vw, 17px);
  border-left: 5px solid var(--cyan);
  color: var(--muted-strong);
  font-size: clamp(1rem, 0.96vw, 1.14rem);
  line-height: 1.42;
  overflow-wrap: anywhere;
  display: flex;
  align-items: center;
}

body[data-severity="NORMAL"] .status-sentence {
  border-left-color: var(--ok);
}

body[data-severity="LIGHT_QUEUE"] .status-sentence {
  border-left-color: var(--queue);
}

body[data-severity="QUEUE"] .status-sentence,
body[data-severity="MAJOR_QUEUE"] .status-sentence {
  border-left-color: var(--strong-queue);
}

.insight-row {
  grid-column: 1;
  grid-row: 2;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(12px, 1vw, 18px);
}

.insight-card {
  min-height: 0;
  padding: clamp(14px, 1vw, 20px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 7px;
  background: var(--card-soft);
}

.insight-card strong {
  font-size: clamp(1.18rem, 1.65vw, 1.9rem);
  line-height: 1.12;
  overflow-wrap: anywhere;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-aspect-ratio: 16 / 10) and (min-width: 981px) {
  .app-shell {
    border-radius: 0;
  }
}

@media (max-width: 980px) {
  body {
    display: block;
    min-height: 100vh;
    overflow-y: auto;
  }

  .app-shell {
    width: 100%;
    height: auto;
    min-height: 100vh;
    aspect-ratio: auto;
    border-radius: 0;
    padding: 16px 12px 24px;
    display: flex;
    flex-direction: column;
    overflow: visible;
  }

  .brand-header,
  .panel-header {
    flex-direction: column;
    align-items: stretch;
  }

  .header-status {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .time-block {
    min-width: 0;
  }

  .route-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
  }

  .route-tabs::-webkit-scrollbar {
    display: none;
  }

  .route-tab {
    flex: 0 0 auto;
  }

  .dashboard {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .queue-chart-panel {
    order: 1;
    min-height: 430px;
  }

  .status-overview {
    order: 2;
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .status-card {
    min-height: 132px;
  }

  .status-value {
    font-size: clamp(2.8rem, 15vw, 4.7rem);
  }

  .insight-row {
    order: 3;
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .chart-legend {
    justify-content: flex-start;
  }
}

@media (max-width: 560px) {
  .brand-lockup {
    align-items: flex-start;
    gap: 12px;
    width: 100%;
  }

  .brand-lockup > div {
    width: calc(100% - 54px);
  }

  .brand-logo {
    width: 42px;
    height: 42px;
    border-radius: 10px;
  }

  .route-subtitle {
    max-width: 100%;
    white-space: normal;
    word-break: break-word;
    font-size: 0.82rem;
  }

  .header-status {
    grid-template-columns: 1fr;
  }

  .queue-chart-panel {
    min-height: 390px;
  }
}
