:root {
  --page-bg: #f6efe7;
  --page-grad-a: #f7d7ce;
  --page-grad-b: #f0f4f7;
  --card-bg: rgba(238, 242, 245, 0.88);
  --card-border: rgba(255, 255, 255, 0.7);
  --text-main: #23252b;
  --text-soft: #66727d;
  --teal-muted: #7c9ba8;
  --teal-live: #badce3;
  --pink: #d85bb0;
  --red-soft: #ff7470;
  --red: #ff3950;
  --red-deep: #e30045;
  --shadow: 0 24px 60px rgba(43, 53, 68, 0.14);
  --radius-xl: 34px;
  --radius-lg: 24px;
  --radius-pill: 999px;
  --font-display: "Avenir Next", "Segoe UI", "Helvetica Neue", sans-serif;
  --font-body: "Avenir Next", "Trebuchet MS", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-body);
  color: var(--text-main);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.7), transparent 24%),
    linear-gradient(135deg, var(--page-grad-a), var(--page-grad-b) 55%, #f7f9fb);
}

.page-shell {
  width: min(1160px, calc(100% - 32px));
  margin: 32px auto;
}

.hero {
  display: grid;
  grid-template-columns: 1.4fr minmax(260px, 0.8fr);
  gap: 24px;
  align-items: end;
  margin-bottom: 24px;
}

.hero-copy,
.hero-badge,
.heatmap-card,
.info-card {
  backdrop-filter: blur(16px);
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow);
}

.hero-copy {
  padding: 32px;
  border-radius: var(--radius-xl);
}

.eyebrow {
  margin: 0 0 12px;
  font-size: 0.9rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--pink);
}

.hero-copy h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 5vw, 4.2rem);
  line-height: 0.95;
  letter-spacing: -0.04em;
}

.hero-text {
  margin: 20px 0 0;
  max-width: 54ch;
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--text-soft);
}

.hero-badge {
  border-radius: 30px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.badge-label {
  color: var(--text-soft);
  font-size: 0.95rem;
}

.hero-badge strong {
  font-size: 2rem;
  line-height: 1;
}

.status-pill {
  width: fit-content;
  padding: 10px 14px;
  border-radius: var(--radius-pill);
  background: rgba(216, 91, 176, 0.12);
  color: var(--pink);
  font-weight: 700;
}

.heatmap-card {
  border-radius: 36px;
  padding: 28px 28px 22px;
}

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

.card-title {
  display: flex;
  gap: 16px;
  align-items: center;
}

.icon-wrap {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.72);
}

.icon-wrap svg {
  width: 32px;
  height: 32px;
  fill: currentColor;
}

.card-title h2 {
  margin: 0;
  font-size: clamp(2rem, 3.8vw, 3rem);
  letter-spacing: -0.04em;
  font-weight: 700;
}

.card-title p {
  margin: 4px 0 0;
  color: var(--text-soft);
}

.toolbar-actions {
  display: flex;
  gap: 14px;
  align-items: center;
}

.current-day-label,
.info-button {
  border: 0;
  background: rgba(28, 36, 44, 0.08);
  color: var(--text-main);
}

.current-day-label {
  font: inherit;
  font-weight: 700;
  padding: 18px 24px;
  border-radius: 22px;
  min-width: 220px;
  text-transform: lowercase;
}

.info-button {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  font-size: 1.7rem;
  cursor: pointer;
}

.sensor-note {
  margin: 18px 0 0;
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.64);
  color: var(--text-soft);
  line-height: 1.55;
}

.chart-status {
  margin: 30px 0 8px 88px;
  font-size: clamp(1.4rem, 2.7vw, 2.2rem);
  line-height: 1.2;
}

.live-label {
  color: var(--pink);
  font-weight: 800;
}

.live-summary {
  font-weight: 500;
}

.chart {
  position: relative;
  height: 390px;
  padding: 16px 10px 0 10px;
}

.bars {
  position: absolute;
  inset: 0 10px 54px 10px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
}

.bar-group {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: end;
  height: 100%;
  position: relative;
}

.bar {
  width: min(42px, 100%);
  border-radius: 20px;
  transition: height 250ms ease, transform 250ms ease, opacity 250ms ease;
  transform-origin: bottom center;
  box-shadow: inset 0 -4px 0 rgba(255, 255, 255, 0.16);
}

.bar.is-live {
  width: min(44px, 100%);
  background: var(--teal-live);
  position: relative;
}

.bar.is-live::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -2px;
  transform: translateX(-50%);
  width: 40px;
  height: 14px;
  border-radius: 10px;
  background: var(--pink);
}

.bar-label {
  position: absolute;
  bottom: -44px;
  font-size: clamp(1rem, 2.3vw, 1.2rem);
  color: #34383f;
}

.bar-group.is-live .bar-label {
  font-size: 1.8rem;
}

.bar-group.is-live .live-guide {
  position: absolute;
  bottom: 56px;
  width: 0;
  height: 204px;
  border-left: 3px dashed rgba(110, 125, 136, 0.35);
}

.x-axis-start,
.x-axis-end {
  position: absolute;
  bottom: 49px;
  width: 3px;
  height: 12px;
  border-radius: 999px;
  background: rgba(35, 37, 43, 0.6);
}

.x-axis-start {
  left: 0;
}

.x-axis-end {
  right: 0;
}

.day-dots {
  display: flex;
  justify-content: center;
  gap: 18px;
  margin-top: 10px;
}

.day-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(44, 49, 57, 0.18);
}

.day-dot.is-active {
  background: rgba(44, 49, 57, 0.74);
}

.stay-time {
  margin: 28px 0 8px;
  text-align: center;
  font-size: clamp(1.5rem, 4vw, 2.6rem);
  letter-spacing: -0.03em;
}

.stay-time strong {
  font-weight: 500;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 24px;
}

.admin-shell {
  display: grid;
  gap: 24px;
}

.admin-card {
  backdrop-filter: blur(16px);
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow);
  border-radius: 32px;
  padding: 28px;
}

.auth-card {
  max-width: 520px;
}

.auth-card h2,
.control-card h2 {
  margin: 0 0 10px;
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  letter-spacing: -0.03em;
}

.auth-card p {
  margin: 0 0 20px;
  color: var(--text-soft);
}

.auth-form,
.button-row {
  display: flex;
  gap: 14px;
  align-items: end;
}

.field {
  display: grid;
  gap: 10px;
}

.field span {
  font-size: 0.95rem;
  color: var(--text-soft);
}

.field input,
.field select {
  font: inherit;
  border: 0;
  border-radius: 18px;
  padding: 16px 18px;
  background: rgba(255, 255, 255, 0.8);
  color: var(--text-main);
}

.field input[type="range"] {
  padding: 0;
  background: transparent;
}

.static-field {
  font: inherit;
  font-weight: 700;
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.8);
  color: var(--text-main);
  text-transform: lowercase;
}

.primary-button,
.ghost-button {
  font: inherit;
  border: 0;
  cursor: pointer;
  border-radius: 18px;
  padding: 16px 20px;
  font-weight: 700;
}

.primary-button {
  background: var(--red-deep);
  color: white;
}

.ghost-button {
  background: rgba(28, 36, 44, 0.08);
  color: var(--text-main);
}

.auth-error {
  margin: 14px 0 0;
  color: var(--red-deep);
  font-weight: 700;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  margin-bottom: 22px;
}

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

.preview-box {
  display: grid;
  gap: 8px;
  align-content: start;
  border-radius: 24px;
  padding: 18px;
  background:
    radial-gradient(circle at top right, rgba(216, 91, 176, 0.18), transparent 38%),
    rgba(255, 255, 255, 0.72);
}

.preview-label {
  color: var(--text-soft);
}

.preview-box strong {
  font-size: 1.6rem;
}

.info-card {
  border-radius: 28px;
  padding: 24px;
}

.info-card.emphasis {
  background:
    radial-gradient(circle at top right, rgba(216, 91, 176, 0.16), transparent 28%),
    var(--card-bg);
}

.info-card h3 {
  margin: 0 0 10px;
  font-size: 1.2rem;
}

.info-card p {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.6;
}

.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-width: 960px) {
  .hero,
  .info-grid,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .card-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar-actions {
    justify-content: space-between;
  }

  .auth-form,
  .button-row,
  .panel-header {
    flex-direction: column;
    align-items: stretch;
  }

  .chart-status {
    margin-left: 0;
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100% - 20px, 100%);
    margin: 10px auto 20px;
  }

  .hero-copy,
  .hero-badge,
  .heatmap-card,
  .info-card {
    border-radius: 24px;
  }

  .hero-copy,
  .hero-badge,
  .heatmap-card {
    padding: 20px;
  }

  .card-title {
    align-items: flex-start;
  }

  .card-title h2 {
    font-size: 2rem;
  }

  .toolbar-actions {
    gap: 10px;
  }

  .current-day-label {
    min-width: 0;
    width: 100%;
  }

  .chart {
    height: 300px;
    overflow-x: auto;
    overflow-y: hidden;
  }

  .bars {
    width: 720px;
  }

  .stay-time {
    font-size: 2rem;
  }
}
