* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", "Segoe UI", Arial, sans-serif;
  color: #343641;
  background: #ece7f2;
}

.brand-icon {
  width: 44px;
  height: 44px;
  margin-right: 12px;
  border-radius: 14px;
  background: rgba(111, 124, 197, 0.2);
  color: #6f7cc5;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.brand-icon svg {
  width: 23px;
  height: 23px;
}

.brand-icon path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-shell {
  width: 100%;
  max-width: 430px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 14px 10px 26px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card {
  background: #f2f3f6;
  border: 1px solid #dfdfe3;
  border-radius: 18px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.07);
  padding: 14px;
}

h1 {
  text-align: center;
  margin: 0;
  font-size: 2rem;
  line-height: 1.2;
}

h2 {
  margin: 0;
  font-size: 1.9rem;
  line-height: 1.3;
}

p {
  margin: 6px 0 0;
  color: #616371;
  line-height: 1.5;
}

.subtitle {
  font-size: 0.95rem;
  color: #7e808c;
  margin-top: 1px;
}

.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
}

.header-main {
  display: flex;
  align-items: center;
  gap: 12px;
}

.icon-action {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  text-decoration: none;
  color: #7b7d89;
  border: 1px solid #d5d6de;
  display: grid;
  place-items: center;
  font-size: 1.15rem;
  background: #f8f8fa;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.icon-action:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  background-color: #ffffff;
  color: #4c4f5f;
}

.icon-action:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  background-color: #f2f3f6;
}


.alerts-card {
  background: #f0ebe3;
  border-color: #e1d7ca;
}

.alert-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.alert-list li {
  color: #60606c;
  font-weight: 500;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

.alert-dismiss-btn {
  margin-left: auto;
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1.5px solid #c8bfad;
  background: rgba(255, 255, 255, 0.55);
  color: #7a7060;
  font-size: 0.8rem;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.alert-dismiss-btn:hover {
  background: #d4ead7;
  border-color: #7ec688;
  color: #3a8f48;
}

.notif-dismiss-btn {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1.5px solid rgba(0, 0, 0, 0.12);
  background: rgba(255, 255, 255, 0.5);
  color: #5a5e6e;
  font-size: 0.9rem;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.notif-dismiss-btn:hover {
  background: #d4ead7;
  border-color: #7ec688;
  color: #3a8f48;
}

.alert-dot {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ffd8bf;
  color: #cb6a3a;
  margin-right: 6px;
  font-size: 0.75rem;
}

.alert-dot.info {
  background: #d1eef8;
  color: #2f9ab8;
}

.focus-card {
  background: #efe5d2;
  border-color: #e4d8bf;
}

.focus-card h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #d4ac57;
  font-size: 1.45rem;
  margin-bottom: 10px;
}

.status-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #f3cb6e;
}

.sensor-tile {
  background: #f5f5f7;
  border: 1px solid #e0e1e8;
  border-radius: 16px;
  padding: 14px;
}

.sensor-tile + .sensor-tile {
  margin-top: 10px;
}

.sensor-label {
  margin: 0;
  font-size: 1rem;
  color: #c9818c;
  font-weight: 600;
}

.sensor-label.co2 {
  color: #48abc7;
}

.sensor-reading {
  margin: 4px 0 8px;
  font-size: 2.3rem;
  color: #3b3e4d;
  font-weight: 500;
}

.unit {
  font-size: 1.65rem;
  color: #7a7d8e;
}

.bars {
  height: 88px;
  display: flex;
  align-items: flex-end;
  gap: 4px;
}

.bars span {
  flex: 1;
  border-radius: 999px;
  background: linear-gradient(180deg, #7ecf8a, #5fae6c);
}

.bars span.warn {
  background: linear-gradient(180deg, #f5a742, #e07820);
}

.bars span.danger {
  background: linear-gradient(180deg, #f07070, #d94040);
}

.bars span.muted {
  background: linear-gradient(180deg, #e7e7ea, #d4d4d8);
}

.wave-placeholder {
  height: 84px;
  border-radius: 16px;
  position: relative;
  overflow: hidden;
  background: linear-gradient(140deg, #9bd2ee, #7ebee2);
}

.wave-placeholder::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: 
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.4) 2px, transparent 3px),
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.3) 4px, transparent 5px),
    radial-gradient(circle at 80% 40%, rgba(255, 255, 255, 0.2) 3px, transparent 4px);
  
  background-size: 60px 60px, 100px 100px, 80px 80px;
  
  animation: co2Rise 6s linear infinite;
}

@keyframes co2Rise {
  from {
    background-position: 0 0, 0 0, 0 0;
  }
  to {
    background-position: 0 -60px, 0 -100px, 0 -80px;
  }
}

.chart-placeholder {
  position: relative;
  margin-top: 10px;
  border-radius: 14px;
  height: 190px;
  border: 1px dashed #d8d9e2;
  background: repeating-linear-gradient(
    to top,
    transparent 0 35px,
    rgba(137, 139, 154, 0.1) 35px 36px
  );
  overflow: hidden;
}

.chart-placeholder .line {
  position: absolute;
  inset: 0;
}

.chart-placeholder.has-data .line {
  display: none;
}

.chart-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.chart-axis {
  stroke: rgba(120, 124, 142, 0.35);
  stroke-width: 1.2;
}

.chart-noise {
  fill: none;
  stroke: #e2a2ab;
  stroke-width: 2.8;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.chart-co2 {
  fill: none;
  stroke: #56b7d5;
  stroke-width: 2.8;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.chart-label {
  fill: #7a7d8e;
  font-size: 11px;
  font-family: "Inter", "Segoe UI", Arial, sans-serif;
}

.chart-point {
  stroke: #ffffff;
  stroke-width: 1.4;
  cursor: pointer;
  transition: r 0.15s ease;
}

.chart-point-noise {
  fill: #e2a2ab;
}

.chart-point-co2 {
  fill: #56b7d5;
}

.chart-point:hover,
.chart-point.is-active {
  r: 5.8;
  stroke-width: 2;
}

.chart-tooltip {
  position: absolute;
  left: 50%;
  bottom: 8px;
  transform: translateX(-50%);
  background: rgba(43, 46, 59, 0.92);
  color: #ffffff;
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 0.78rem;
  white-space: nowrap;
  max-width: calc(100% - 20px);
  overflow: hidden;
  text-overflow: ellipsis;
  border-left: 3px solid transparent;
}

.chart-tooltip.is-noise {
  border-left-color: #e2a2ab;
}

.chart-tooltip.is-co2 {
  border-left-color: #56b7d5;
}

.chart-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 0.92rem;
  color: #7d8192;
}

.noise-line::before,
.co2-line::before {
  content: "";
  position: absolute;
  left: 8%;
  right: 8%;
  top: 20%;
  bottom: 12%;
  border-radius: 8px;
}

.noise-line::before {
  border-left: 3px solid #e2a2ab;
  border-bottom: 3px solid #e2a2ab;
}

.co2-line::before {
  border-right: 3px solid #56b7d5;
  border-top: 3px solid #56b7d5;
}

.chart-legend {
  text-align: center;
  font-size: 0.95rem;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
}

.legend-noise {
  color: #c9818c;
  font-weight: 600;
}

.legend-co2 {
  color: #48abc7;
  font-weight: 600;
}

.legend-sep {
  color: #b0b2be;
}

.stack-list {
  margin-top: 10px;
  display: grid;
  gap: 10px;
}

.stack-item {
  border-radius: 14px;
  padding: 12px;
  background: #e9edf4;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
}

.stack-item p {
  margin: 0;
  font-size: 0.95rem;
  color: #454857;
}

.stack-item small {
  color: #7c8090;
  font-size: 0.9rem;
}

.stack-item .circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.45);
}

.stack-item.blue {
  background: #e1e8f3;
}

.stack-item.sand {
  background: #ece6dc;
}

.stack-item.green {
  background: #dcebdd;
}



@media (min-width: 560px) {
  .app-shell,
  .mobile-shell {
    max-width: 460px;
    padding: 22px 14px 28px;
    gap: 18px;
  }

  .card {
    padding: 16px;
  }

  .sensor-reading {
    font-size: 2.5rem;
  }
}

@media (min-width: 900px) {
  body {
    background: #e4dded;
  }

  .app-shell {
    max-width: 1200px;
    padding: 32px 32px 40px;
    gap: 20px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }

  /* Header: full width */
  .app-shell > section:nth-child(1) {
    grid-column: 1 / -1;
    padding: 18px 22px;
  }

  /* Alerts: full width */
  .app-shell > section:nth-child(2) {
    grid-column: 1 / -1;
  }

  /* Focus card (sensors): left column, row 3 */
  .app-shell > section:nth-child(3) {
    grid-column: 1;
    grid-row: 3;
  }

  /* Activity chart: right column, row 3 */
  .app-shell > section:nth-child(4) {
    grid-column: 2;
    grid-row: 3;
  }

  /* Notifications: left column, row 4 */
  .app-shell > section:nth-child(5) {
    grid-column: 1;
    grid-row: 4;
  }


  /* Sensor tiles side by side inside focus card */
  .focus-card .sensor-tiles-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 10px;
  }

  .focus-card .sensor-tile + .sensor-tile {
    margin-top: 0;
  }

  .card {
    padding: 20px;
    border-radius: 22px;
  }

  h2 {
    font-size: 1.5rem;
  }

  .sensor-reading {
    font-size: 2.6rem;
  }

  .chart-placeholder {
    height: 220px;
  }
}
  
@keyframes slideInUp {
  0% {
    opacity: 0;
    transform: translateY(30px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.card {
  opacity: 0;
  animation: slideInUp 0.8s ease-out forwards;
}

.dashboard-header { animation-delay: 0.1s; }
.card:nth-of-type(1) { animation-delay: 0.2s; }
.card:nth-of-type(2) { animation-delay: 0.3s; }
.card:nth-of-type(3) { animation-delay: 0.4s; }
.card:nth-of-type(4) { animation-delay: 0.5s; }
.card:nth-of-type(5) { animation-delay: 0.6s; }