:root {
  --brand-blue: #2f6f6b;
  --brand-blue-dark: #1f2a2e;
  --brand-blue-light: #4f8f89;
  --brand-green: #dde5d7;
  --brand-green-dark: #b9c9b0;
  --bg: #f5f6f4;
  --surface: #ffffff;
  --text: #2d3b3e;
  --muted: #4f5f61;
  --border: #d7ddd2;
  --focus: #2f6f6b;
  --logo-cyan: #3aa8df;
  --logo-lime: #a7c83f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Lexend", Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 8% 10%, rgba(58, 168, 223, 0.1) 0%, transparent 22%),
    radial-gradient(circle at 88% 16%, rgba(167, 200, 63, 0.12) 0%, transparent 24%),
    radial-gradient(circle at 18% 74%, rgba(47, 111, 107, 0.1) 0%, transparent 26%),
    radial-gradient(circle at 86% 82%, rgba(58, 168, 223, 0.08) 0%, transparent 24%),
    linear-gradient(135deg, #f3f7f1 0%, #edf3e9 48%, var(--bg) 100%);
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background:
    radial-gradient(circle at 12% 18%, rgba(58, 168, 223, 0.18) 0%, transparent 28%),
    radial-gradient(circle at 82% 12%, rgba(167, 200, 63, 0.22) 0%, transparent 30%),
    radial-gradient(circle at 52% 78%, rgba(47, 111, 107, 0.14) 0%, transparent 34%),
    linear-gradient(118deg, #eef4eb 0%, #e6efe2 38%, #dbe6d5 72%, #d3e0cc 100%);
  color: var(--text);
  border-bottom: 1px solid #cfd8c7;
  box-shadow: 0 8px 20px rgba(40, 62, 54, 0.09);
}

.brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo {
  width: 72px;
  height: 72px;
  object-fit: contain;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid #c6d7ca;
  box-shadow: 0 6px 16px rgba(31, 42, 46, 0.14);
  padding: 0.3rem;
}

h1 {
  margin: 0;
  font-size: 1.32rem;
}

.subtitle {
  margin: 0.2rem 0 0;
  font-weight: 600;
  font-size: 0.92rem;
  color: #4e605a;
}

/* Full-width hero under topbar — image + soft fade into page background */
.hero-banner {
  position: relative;
  width: 100%;
  height: 220px;
  overflow: hidden;
  background-color: var(--bg);
  background-image: url("./hero-image.jpg");
  background-size: cover;
  background-position: center;
}

.hero-banner::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    to bottom,
    rgb(from var(--bg) r g b / 0%) 25%,
    rgb(from var(--bg) r g b / 50%) 65%,
    var(--bg) 100%
  );
}

.grid {
  max-width: 1100px;
  margin: 1.2rem auto 2rem;
  padding: 0 1rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.full {
  grid-column: 1 / -1;
}

.card {
  background: var(--surface);
  border: 1px solid #ccd7c7;
  border-radius: 14px;
  padding: 1rem;
  box-shadow: 0 6px 18px rgba(44, 62, 52, 0.1);
}

h2 {
  margin-top: 0;
}

.muted {
  color: var(--muted);
}

.avatar-label {
  margin-top: 0.2rem;
  text-align: center;
}

.avatar-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.75rem 0;
}

.avatar-picker {
  width: 98px;
  height: 98px;
  border-radius: 999px;
  border: 2px dashed #b8c9b6;
  background: #f5f9f2;
  display: grid;
  place-items: center;
  overflow: hidden;
  cursor: pointer;
  margin: 0 auto;
  color: #456764;
  font-size: 0.82rem;
  text-align: center;
}

#avatarPreview {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

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

label {
  display: block;
  margin: 0.56rem 0 0.3rem;
  font-weight: 700;
}

input,
textarea,
button {
  font: inherit;
}

input:not([type="checkbox"]),
input[type="file"],
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.62rem;
  background: #fff;
}

input:focus,
textarea:focus,
button:focus {
  outline: 3px solid color-mix(in srgb, var(--focus) 45%, transparent);
  outline-offset: 2px;
}

.row {
  margin-top: 0.8rem;
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.btn {
  border: 0;
  border-radius: 10px;
  padding: 0.55rem 0.85rem;
  cursor: pointer;
  font-weight: 700;
}

.btn-primary {
  background: linear-gradient(135deg, #d6e1cf 5%, #c4d3bc 90%);
  border: 1px solid #b4c4aa;
  color: #1f2a2e;
}

.btn-secondary {
  background: #f7faf5;
  border: 1px solid #c8d3c2;
  color: var(--brand-blue-dark);
}

.btn-ghost {
  background: #eef3eb;
  color: var(--brand-blue-dark);
}

.consent-box {
  background: #f7faf5;
  border: 1px dashed #c4d0be;
  border-radius: 12px;
  padding: 0.85rem;
}

.checkbox {
  display: flex;
  gap: 0.62rem;
  align-items: flex-start;
  margin-top: 0;
}

.checkbox input {
  margin-top: 0.2rem;
}

.measure-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.65rem;
}

.switch {
  display: flex;
  gap: 0.55rem;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.55rem 0.65rem;
  margin: 0;
}

.traffic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.75rem;
}

.traffic-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #f9fcf7;
  padding: 0.7rem;
}

.traffic-card h3 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
}

.traffic-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
}

.traffic-btn {
  border: 1px solid #cad8c6;
  border-radius: 10px;
  background: #fff;
  padding: 0.55rem 0.45rem;
  font-weight: 700;
}

.traffic-btn.active-green {
  background: #dff1dc;
  border-color: #74b86d;
}

.traffic-btn.active-yellow {
  background: #f8f2cf;
  border-color: #c8ad41;
}

.traffic-btn.active-red {
  background: #f8dbdb;
  border-color: #cc6a6a;
}

.traffic-reason {
  margin-top: 0.15rem;
}

.sleep-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.6rem 1rem;
  align-items: end;
}

.sleep-form textarea,
.sleep-form button {
  grid-column: 1 / -1;
}

.status {
  margin: 0.85rem 0 0;
  font-weight: 700;
  color: #305d59;
}

.dashboard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.8rem;
}

.dashboard article {
  border: 1px solid #d4dccf;
  border-left: 4px solid var(--logo-cyan);
  border-radius: 10px;
  padding: 0.75rem;
  background: #fafcf9;
}

.dashboard h3 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
}

.big-number {
  margin: 0;
  font-size: 1.65rem;
  font-weight: 800;
  color: #2f6f6b;
}

.footer {
  padding: 0.35rem 1rem 1.3rem;
  text-align: center;
  color: var(--muted);
}

.footer.footer-cta a {
  color: var(--brand-blue);
  font-weight: 600;
}

.footer.footer-cta a:hover {
  text-decoration: underline;
}

.footer.footer-cta a:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 2px;
}

.hidden-panel {
  display: none;
}

.form-section {
  margin-top: 1.15rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
}

.form-section:first-of-type {
  border-top: 0;
  padding-top: 0;
  margin-top: 0;
}

.form-section > h3 {
  margin: 0 0 0.55rem;
  font-size: 1.02rem;
  color: var(--brand-blue-dark);
}

.scale-group {
  display: grid;
  gap: 0.55rem;
}

.scale-block .switch {
  margin: 0;
}

.scale-desc {
  margin: 0.35rem 0 0;
  padding-left: 1.85rem;
  font-size: 0.88rem;
  line-height: 1.45;
  max-width: 42rem;
}

body.high-contrast {
  --bg: #ffffff;
  --surface: #ffffff;
  --text: #05182b;
  --muted: #1e3652;
  --border: #17314f;
}

body.high-contrast .topbar {
  background:
    radial-gradient(circle at 12% 16%, rgba(47, 111, 107, 0.16) 0%, transparent 26%),
    radial-gradient(circle at 82% 10%, rgba(167, 200, 63, 0.2) 0%, transparent 28%),
    linear-gradient(120deg, #e4ece0 0%, #dce6d7 55%, #d3dfcd 100%);
  border-bottom-color: #2d3b3e;
}

body.high-contrast {
  background: #ffffff;
}

@media (max-width: 640px) {
  .logo {
    width: 56px;
    height: 56px;
  }

  h1 {
    font-size: 1.1rem;
  }
}
