html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: #1f1f1f;
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
}

.dashboard-body {
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
}

.dashboard-screen {
  box-sizing: border-box;
  width: 100vw;
  height: 100vh;
  padding: 8px;
  background: #202020;
}

.top-strip,
.tile {
  background: #303030;
  box-sizing: border-box;
}

.top-strip {
  height: 52px;
  margin: 0 0 8px 0;
  padding: 8px 18px;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  overflow: hidden;
}

.brand {
  -webkit-box-flex: 0;
  -webkit-flex: 0 0 auto;
  flex: 0 0 auto;
  color: #f05a3b;
  font-size: 24px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: 0.01em;
  margin-right: 18px;
}

.top-status-group {
  -webkit-box-flex: 1;
  -webkit-flex: 1 1 auto;
  flex: 1 1 auto;
  min-width: 0;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
}

.top-course {
  -webkit-box-flex: 1;
  -webkit-flex: 1 1 auto;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 18px;
  line-height: 1.1;
  font-weight: 700;
}

.top-next {
  -webkit-box-flex: 0;
  -webkit-flex: 0 1 38%;
  flex: 0 1 38%;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: #d2d2d2;
  font-size: 16px;
  line-height: 1.1;
  font-weight: 600;
  margin-left: 18px;
}

.connection-state {
  -webkit-box-flex: 0;
  -webkit-flex: 0 0 72px;
  flex: 0 0 72px;
  text-align: right;
  font-size: 14px;
  font-weight: 700;
  color: #bdbdbd;
}
.connection-state.ok { color: #5ef2aa; }
.connection-state.error { color: #ffb4a8; }

.dashboard-main {
  height: calc(100vh - 16px - 52px - 8px - 22px);
  overflow: hidden;
}

.row {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 8px;
}
.row > .tile { margin-right: 8px; }
.row > .tile:last-child { margin-right: 0; }

.tile {
  position: relative;
  min-height: 40px;
  overflow: hidden;
}

.hero-row { height: 182px; }

.announcement-tile {
  -webkit-box-flex: 1;
  -webkit-flex: 1 1 auto;
  flex: 1 1 auto;
  padding: 20px 26px;
  background: #d8563e;
}
.announcement-tile.no-message { background: #303030; }
.announcement-tile.info { background: #36516b; }
.announcement-tile.warn,
.announcement-tile.warning { background: #d86735; }
.announcement-tile.urgent,
.announcement-tile.alert,
.announcement-tile.danger { background: #c84638; }
.announcement-tile.success { background: #128a60; }

.announcement-content {
  height: 100%;
  box-sizing: border-box;
  padding-right: 100px;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-flex-direction: column;
  flex-direction: column;
  -webkit-box-pack: center;
  -webkit-justify-content: center;
  justify-content: center;
}

.message-title {
  font-size: 26px;
  line-height: 1.1;
  font-weight: 700;
  margin: 0 0 12px 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.message-body {
  max-height: 58px;
  overflow: hidden;
  font-size: 18px;
  line-height: 1.3;
  font-weight: 500;
}

.announcement-tile.no-message .message-title {
  color: #e8e8e8;
}
.announcement-tile.no-message .message-body {
  color: #c9c9c9;
}

.ack-button {
  position: absolute;
  right: 22px;
  bottom: 18px;
  min-width: 82px;
  border: 0;
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 15px;
  line-height: 1.2;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.24);
  color: #fff;
}
.ack-button:disabled { opacity: 0.45; }

.time-tile {
  -webkit-box-flex: 0;
  -webkit-flex: 0 0 31%;
  flex: 0 0 31%;
  padding: 24px 16px 18px;
  background: #d8563e;
  text-align: center;
}
.date-label {
  font-size: 22px;
  line-height: 1.1;
  margin-bottom: 18px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.92);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.time-label {
  font-size: 66px;
  line-height: 0.92;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.ops-row { height: 108px; }
.today-tile {
  -webkit-box-flex: 1;
  -webkit-flex: 1 1 auto;
  flex: 1 1 auto;
  padding: 12px 20px 10px;
}
.door-tile {
  -webkit-box-flex: 0;
  -webkit-flex: 0 0 31%;
  flex: 0 0 31%;
  padding: 12px 18px;
}
.ops-title {
  color: #d6d6d6;
  font-size: 18px;
  line-height: 1.1;
  font-weight: 700;
  margin-bottom: 8px;
}
.today-sessions {
  font-size: 15px;
  line-height: 1.28;
  font-weight: 600;
  overflow: hidden;
}
.today-row {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}
.today-more {
  color: #cfcfcf;
  font-weight: 500;
}
.door-headline {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-pack: justify;
  -webkit-justify-content: space-between;
  justify-content: space-between;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  margin-bottom: 6px;
}
.door-headline .ops-title { margin-bottom: 0; }
.door-summary {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: #cfcfcf;
  font-size: 14px;
  line-height: 1.1;
  text-align: right;
  margin-left: 10px;
}
.door-list {
  height: 64px;
  overflow: hidden;
}
.door-row {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  margin-bottom: 3px;
  font-size: 15px;
  line-height: 1.1;
  color: #e8e8e8;
}
.door-status {
  -webkit-box-flex: 0;
  -webkit-flex: 0 0 20px;
  flex: 0 0 20px;
  font-size: 14px;
  font-weight: 700;
  color: #858585;
}
.door-label {
  -webkit-box-flex: 1;
  -webkit-flex: 1 1 auto;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-weight: 600;
}
.door-text {
  -webkit-box-flex: 0;
  -webkit-flex: 0 0 auto;
  flex: 0 0 auto;
  margin-left: 8px;
  color: #cfcfcf;
  font-size: 13px;
  font-weight: 600;
}
.door-row.closed .door-status { color: #868686; }
.door-row.closed .door-label { color: #d6d6d6; }
.door-row.open .door-status,
.door-row.unlocked .door-status { color: #ffb347; }
.door-row.open .door-label,
.door-row.unlocked .door-label { color: #fff; }
.door-row.unknown .door-status { color: #999; }
.door-row.unknown .door-label { color: #d0d0d0; }

.action-row { height: 184px; }
.status-card {
  -webkit-box-flex: 1;
  -webkit-flex: 1 1 0;
  flex: 1 1 0;
  padding: 16px 18px 16px;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-flex-direction: column;
  flex-direction: column;
  -webkit-box-pack: justify;
  -webkit-justify-content: space-between;
  justify-content: space-between;
  background: #303030;
}
.status-card.ok { background: #107f58; }
.status-card.warn { background: #b87900; }
.status-card.alert { background: #c84638; }
.status-card.idle { background: #303030; }
.status-card.stale { background: #6b5d31; }

.card-title {
  font-size: 18px;
  line-height: 1.08;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.96);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.course-main {
  max-height: 46px;
  overflow: hidden;
  font-size: 28px;
  line-height: 1.0;
  font-weight: 700;
  letter-spacing: -0.03em;
}
.card-value {
  font-size: 50px;
  line-height: 0.92;
  font-weight: 700;
  letter-spacing: -0.05em;
}
.value-line { white-space: nowrap; }
.unit {
  margin-left: 6px;
  font-size: 18px;
  line-height: 1;
  font-weight: 700;
  opacity: 0.92;
}
.card-status {
  max-height: 28px;
  overflow: hidden;
  font-size: 22px;
  line-height: 1.08;
  font-weight: 700;
}
.card-detail {
  min-height: 18px;
  max-height: 38px;
  overflow: hidden;
  font-size: 15px;
  line-height: 1.24;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.9);
}
.card-action {
  min-height: 18px;
  max-height: 38px;
  overflow: hidden;
  font-size: 16px;
  line-height: 1.18;
  font-weight: 700;
}
.progress-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.35);
  overflow: hidden;
  margin: 6px 0 3px;
}
.progress-track.hidden { display: none; }
.progress-bar {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
}

.climate-row { height: 84px; }
.climate-tile {
  -webkit-box-flex: 1;
  -webkit-flex: 1 1 0;
  flex: 1 1 0;
  padding: 11px 18px;
}
.climate-title {
  font-size: 17px;
  line-height: 1.05;
  font-weight: 700;
  color: #cfcfcf;
  margin-bottom: 8px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.metric-line {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-pack: justify;
  -webkit-justify-content: space-between;
  justify-content: space-between;
  -webkit-box-align: baseline;
  -webkit-align-items: baseline;
  align-items: baseline;
  font-size: 16px;
  line-height: 1.24;
}
.metric-line span {
  color: #bfbfbf;
  font-weight: 500;
}
.metric-line strong {
  font-size: 19px;
  line-height: 1;
  font-weight: 700;
}

.footer-line {
  height: 22px;
  color: #999;
  font-size: 11px;
  line-height: 22px;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-pack: justify;
  -webkit-justify-content: space-between;
  justify-content: space-between;
  padding: 0 4px;
  overflow: hidden;
}
.footer-line span {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  margin-right: 10px;
}
.footer-line span:last-child { margin-right: 0; }

@media (orientation: portrait) {
  .dashboard-screen {
    padding: 6px;
  }

  .top-strip {
    height: 58px;
    margin-bottom: 6px;
    padding: 8px 14px;
  }

  .brand {
    font-size: 22px;
    margin-right: 14px;
  }

  .top-status-group {
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -webkit-flex-direction: column;
    flex-direction: column;
    -webkit-box-align: start;
    -webkit-align-items: flex-start;
    align-items: flex-start;
    -webkit-box-pack: center;
    -webkit-justify-content: center;
    justify-content: center;
  }

  .top-course {
    width: 100%;
    font-size: 17px;
  }

  .top-next {
    width: 100%;
    margin-left: 0;
    margin-top: 3px;
    font-size: 14px;
  }

  .connection-state {
    -webkit-flex-basis: 60px;
    flex-basis: 60px;
    font-size: 12px;
  }

  .dashboard-main {
    height: calc(100vh - 12px - 58px - 6px - 22px);
  }

  .hero-row {
    height: 180px;
  }

  .announcement-tile {
    padding: 18px 20px;
  }

  .announcement-content {
    padding-right: 82px;
  }

  .message-title {
    font-size: 24px;
    margin-bottom: 10px;
  }

  .message-body {
    font-size: 17px;
    max-height: 52px;
  }

  .ack-button {
    right: 18px;
    bottom: 16px;
    min-width: 72px;
    font-size: 14px;
    padding: 7px 14px;
  }

  .time-tile {
    -webkit-flex-basis: 31%;
    flex-basis: 31%;
    padding: 18px 12px 14px;
  }

  .date-label {
    font-size: 17px;
    margin-bottom: 14px;
  }

  .time-label {
    font-size: 52px;
  }

  .ops-row {
    height: 112px;
  }

  .today-tile,
  .door-tile {
    padding: 10px 14px;
  }

  .ops-title {
    font-size: 16px;
  }

  .today-sessions {
    font-size: 14px;
  }

  .door-list {
    height: 70px;
  }

  .door-row {
    font-size: 14px;
  }

  .door-text {
    font-size: 12px;
  }

  .action-row {
    height: auto;
    -webkit-flex-wrap: wrap;
    flex-wrap: wrap;
    margin-bottom: 6px;
  }

  .action-row > .tile {
    margin-right: 6px;
    margin-bottom: 6px;
  }

  .action-row > .tile:last-child {
    margin-right: 0;
  }

  .course-card {
    -webkit-box-flex: 0;
    -webkit-flex: 0 0 100%;
    flex: 0 0 100%;
    width: 100%;
    min-height: 140px;
    margin-right: 0 !important;
  }

  .air-card,
  .noise-card {
    -webkit-box-flex: 1;
    -webkit-flex: 1 1 0;
    flex: 1 1 0;
    min-height: 144px;
  }

  .status-card {
    padding: 14px 16px;
  }

  .card-title {
    font-size: 17px;
  }

  .course-main {
    font-size: 24px;
    max-height: 40px;
  }

  .card-value {
    font-size: 42px;
  }

  .unit {
    font-size: 16px;
  }

  .card-status {
    font-size: 18px;
    max-height: 24px;
  }

  .card-detail,
  .card-action {
    font-size: 14px;
  }

  .climate-row {
    height: 78px;
    margin-bottom: 6px;
  }

  .climate-row > .tile { margin-right: 6px; }
  .climate-tile {
    padding: 9px 14px;
  }

  .climate-title {
    font-size: 15px;
    margin-bottom: 6px;
  }

  .metric-line {
    font-size: 14px;
  }

  .metric-line strong {
    font-size: 18px;
  }
}

.setup-body {
  background: #202020;
  min-height: 100vh;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  -webkit-box-pack: center;
  -webkit-justify-content: center;
  justify-content: center;
}
.setup-card {
  width: 420px;
  max-width: calc(100vw - 40px);
  padding: 34px;
  background: #303030;
  border-radius: 18px;
  box-sizing: border-box;
}
.setup-eyebrow {
  color: #ef5b3a;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
  font-size: 13px;
}
.setup-card h1 { margin: 10px 0 12px; }
.setup-card p { color: #d0d0d0; line-height: 1.45; }
.setup-card label { display: block; margin: 18px 0 8px; color: #dcdcdc; }
.setup-card input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #555;
  background: #1f1f1f;
  color: #fff;
  border-radius: 10px;
  padding: 13px 14px;
  font-size: 18px;
}
.setup-card button {
  margin-top: 22px;
  width: 100%;
  border: 0;
  background: #ef5b3a;
  color: #fff;
  border-radius: 999px;
  padding: 13px 14px;
  font-size: 18px;
  font-weight: 700;
}
.setup-error {
  margin-top: 10px;
  color: #ffb2a6;
}
