:root {
  color-scheme: dark;
  --bg: #050b13;
  --bg-2: #07111f;
  --surface: #0d1928;
  --surface-2: #122236;
  --surface-3: #172a41;
  --line: rgba(169, 189, 209, 0.14);
  --line-strong: rgba(169, 189, 209, 0.25);
  --text: #f6fbff;
  --muted: #91a4b8;
  --muted-2: #6f8499;
  --accent: #44e29b;
  --accent-strong: #22c87d;
  --accent-soft: rgba(68, 226, 155, 0.12);
  --blue: #67a8ff;
  --blue-soft: rgba(103, 168, 255, 0.13);
  --amber: #ffc866;
  --danger: #ff6b78;
  --danger-soft: rgba(255, 107, 120, 0.12);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
  --radius: 22px;
  --radius-sm: 14px;
  --content: 1020px;
  --top-safe: env(safe-area-inset-top, 0px);
  --bottom-safe: env(safe-area-inset-bottom, 0px);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-width: 300px;
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--text);
  background:
    radial-gradient(circle at 10% -10%, rgba(68, 226, 155, 0.11), transparent 33rem),
    radial-gradient(circle at 100% 8%, rgba(103, 168, 255, 0.09), transparent 30rem),
    linear-gradient(180deg, var(--bg-2), var(--bg) 48%);
  overflow-x: hidden;
}

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

button,
label[for],
select,
input[type="date"],
input[type="range"] {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
label.file-button:focus-within {
  outline: 3px solid rgba(103, 168, 255, 0.5);
  outline-offset: 2px;
}

button:active {
  transform: translateY(1px);
}

svg {
  display: block;
}

[hidden] {
  display: none !important;
}

.noscript {
  padding: 1rem;
  background: #8b1f2b;
  color: white;
  text-align: center;
  font-weight: 700;
}

.app-shell {
  min-height: 100vh;
  min-height: 100dvh;
}

.top-bar {
  position: sticky;
  z-index: 50;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: calc(68px + var(--top-safe));
  padding: calc(10px + var(--top-safe)) max(18px, calc((100vw - var(--content)) / 2)) 10px;
  border-bottom: 1px solid rgba(169, 189, 209, 0.08);
  background: rgba(5, 11, 19, 0.82);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
}

.brand-button {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.brand-button > span:last-child {
  display: grid;
  min-width: 0;
}

.brand-button strong {
  overflow: hidden;
  color: var(--text);
  font-size: 0.98rem;
  letter-spacing: -0.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-button small {
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.3;
}

.brand-mark {
  display: grid;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(68, 226, 155, 0.35);
  border-radius: 14px;
  color: var(--accent);
  background: linear-gradient(145deg, rgba(68, 226, 155, 0.16), rgba(103, 168, 255, 0.08));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.brand-mark svg {
  width: 29px;
  height: 29px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(13, 25, 40, 0.72);
  font-size: 0.73rem;
  font-weight: 700;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(68, 226, 155, 0.09);
}

.status-pill.is-offline .status-dot {
  background: var(--amber);
  box-shadow: 0 0 0 4px rgba(255, 200, 102, 0.09);
}

.icon-button {
  display: grid;
  width: 40px;
  height: 40px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 13px;
  color: var(--muted);
  background: rgba(13, 25, 40, 0.78);
  cursor: pointer;
}

.icon-button svg {
  width: 21px;
  height: 21px;
}

.install-banner,
.update-banner {
  position: relative;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  width: min(calc(100% - 28px), var(--content));
  margin: 12px auto 0;
  padding: 14px 16px;
  border: 1px solid rgba(103, 168, 255, 0.25);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(103, 168, 255, 0.15), rgba(68, 226, 155, 0.08));
  box-shadow: var(--shadow);
}

.install-banner strong {
  display: block;
  margin-bottom: 2px;
  font-size: 0.85rem;
}

.install-banner p,
.update-banner span {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.45;
}

.update-banner {
  border-color: rgba(68, 226, 155, 0.28);
  background: rgba(24, 70, 52, 0.94);
}

.text-button,
.danger-link,
.small-button {
  flex: 0 0 auto;
  padding: 7px 10px;
  border: 0;
  border-radius: 10px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 0.76rem;
  font-weight: 800;
  cursor: pointer;
}

.danger-link {
  color: var(--danger);
  background: var(--danger-soft);
}

.small-button {
  color: var(--blue);
  background: var(--blue-soft);
}

.main-content {
  width: min(calc(100% - 28px), var(--content));
  margin: 0 auto;
  padding: 22px 0 calc(104px + var(--bottom-safe));
}

.screen {
  animation: screenIn 220ms ease both;
}

@keyframes screenIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin: 4px 2px 19px;
}

.section-heading.compact {
  margin-top: 30px;
  margin-bottom: 12px;
}

.section-heading h1,
.section-heading h2,
.card-heading h2,
.hero-card h1 {
  margin: 0;
  letter-spacing: -0.035em;
}

.section-heading h1 {
  font-size: clamp(2rem, 6vw, 3.25rem);
  line-height: 1.03;
}

.section-heading h2,
.card-heading h2 {
  font-size: 1.13rem;
}

.section-heading > div > p:last-child {
  max-width: 650px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.55;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hero-card {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 210px;
  gap: 26px;
  overflow: hidden;
  padding: clamp(24px, 6vw, 44px);
  border: 1px solid rgba(68, 226, 155, 0.18);
  border-radius: 28px;
  background:
    linear-gradient(115deg, rgba(68, 226, 155, 0.10), transparent 44%),
    radial-gradient(circle at 80% 30%, rgba(103, 168, 255, 0.14), transparent 17rem),
    var(--surface);
  box-shadow: var(--shadow);
}

.hero-card::after {
  position: absolute;
  right: -45px;
  bottom: -90px;
  width: 230px;
  height: 230px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 50%;
  content: "";
}

.hero-copy {
  position: relative;
  z-index: 1;
  min-width: 0;
}

.hero-card h1 {
  max-width: 600px;
  font-size: clamp(2rem, 7vw, 4.3rem);
  line-height: 0.98;
}

.hero-card h1 span {
  color: var(--accent);
}

.hero-card .hero-copy > p:last-child {
  max-width: 540px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
}

.goal-ring {
  --progress: 0deg;
  position: relative;
  z-index: 1;
  display: grid;
  flex: 0 0 auto;
  width: clamp(118px, 19vw, 152px);
  height: clamp(118px, 19vw, 152px);
  padding: 10px;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--accent) var(--progress), rgba(255,255,255,0.08) 0);
  box-shadow: 0 0 50px rgba(68, 226, 155, 0.10);
}

.goal-ring::before {
  position: absolute;
  inset: 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 50%;
  background: var(--surface);
  content: "";
}

.goal-ring > div {
  position: relative;
  display: grid;
  text-align: center;
}

.goal-ring strong {
  font-size: clamp(1.65rem, 5vw, 2.4rem);
  letter-spacing: -0.05em;
}

.goal-ring span {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 11px;
  margin: 12px 0;
}

.stats-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.stats-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.stat-card {
  min-width: 0;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: rgba(13, 25, 40, 0.78);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.025);
}

.stat-card span,
.stat-card small {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stat-card strong {
  display: block;
  overflow: hidden;
  margin: 5px 0 3px;
  font-size: clamp(1.1rem, 3vw, 1.55rem);
  letter-spacing: -0.04em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card {
  margin-top: 12px;
  padding: clamp(18px, 4vw, 25px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(13, 25, 40, 0.86);
  box-shadow: 0 15px 45px rgba(0, 0, 0, 0.16), inset 0 1px 0 rgba(255,255,255,0.025);
}

.card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 17px;
}

.card-copy {
  margin: -4px 0 18px;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.6;
}

.chart-wrap {
  position: relative;
  width: 100%;
  height: 230px;
  overflow: hidden;
  border-radius: 13px;
  background: linear-gradient(180deg, rgba(103, 168, 255, 0.025), transparent);
}

.chart-wrap.large {
  height: 290px;
}

.chart-wrap canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.empty-chart {
  position: absolute;
  inset: 0;
  display: grid;
  padding: 20px;
  place-items: center;
  color: var(--muted-2);
  font-size: 0.82rem;
  text-align: center;
}

.legend {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.7rem;
  white-space: nowrap;
}

.legend i {
  width: 12px;
  height: 3px;
  margin-left: 5px;
  border-radius: 4px;
  background: var(--accent);
}

.legend i.target {
  background: var(--blue);
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 11px;
}

.quick-card {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 17px;
  color: var(--text);
  background: rgba(13, 25, 40, 0.74);
  text-align: left;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.quick-card:hover {
  border-color: rgba(68, 226, 155, 0.28);
  background: var(--surface-2);
  transform: translateY(-1px);
}

.quick-icon {
  display: grid;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 13px;
  background: rgba(255,255,255,0.055);
  font-size: 1.2rem;
}

.quick-card > span:last-child {
  display: grid;
  min-width: 0;
}

.quick-card strong,
.quick-card small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quick-card strong {
  font-size: 0.84rem;
}

.quick-card small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.67rem;
}

.timeline,
.entry-list {
  display: grid;
  gap: 9px;
}

.timeline-item,
.entry-item {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 13px;
  padding: 13px;
  border: 1px solid rgba(169,189,209,0.10);
  border-radius: 15px;
  background: rgba(255,255,255,0.018);
}

.timeline-icon,
.entry-icon {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 13px;
  background: var(--accent-soft);
  font-size: 1.05rem;
}

.timeline-main,
.entry-main {
  min-width: 0;
}

.timeline-main strong,
.entry-main strong {
  display: block;
  overflow: hidden;
  font-size: 0.84rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timeline-main p,
.entry-main p {
  overflow: hidden;
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timeline-date,
.entry-value {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  text-align: right;
  white-space: nowrap;
}

.entry-value strong {
  color: var(--text);
  font-size: 0.92rem;
}

.entry-actions {
  display: flex;
  justify-content: flex-end;
  gap: 5px;
  margin-top: 7px;
}

.mini-action {
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255,255,255,0.025);
  font-size: 0.65rem;
  font-weight: 800;
  cursor: pointer;
}

.mini-action.delete {
  color: var(--danger);
}

.empty-state {
  display: grid;
  min-height: 130px;
  padding: 24px;
  place-items: center;
  align-content: center;
  border: 1px dashed var(--line-strong);
  border-radius: 16px;
  color: var(--muted-2);
  text-align: center;
}

.empty-state span {
  font-size: 1.6rem;
}

.empty-state p {
  margin: 8px 0 0;
  font-size: 0.78rem;
}

.form-card form {
  display: grid;
  gap: 14px;
}

.form-grid {
  display: grid;
  gap: 12px;
}

.form-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.field {
  display: grid;
  min-width: 0;
  gap: 7px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 750;
}

.field > span small {
  color: var(--muted-2);
  font-weight: 500;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 13px;
  color: var(--text);
  background: rgba(5, 11, 19, 0.66);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.02);
  appearance: none;
}

.field textarea {
  min-height: 88px;
  resize: vertical;
}

.field input::placeholder,
.field textarea::placeholder {
  color: #536b80;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: rgba(68, 226, 155, 0.52);
  background: rgba(7, 17, 31, 0.95);
}

.field select {
  padding-right: 36px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 21px, calc(100% - 13px) 21px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

input[type="date"]::-webkit-calendar-picker-indicator {
  opacity: 0.7;
  filter: invert(1);
}

.field .range {
  min-height: 48px;
  padding: 0;
  border: 0;
  background: transparent;
  accent-color: var(--accent);
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.primary-button,
.secondary-button,
.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  gap: 10px;
  padding: 0 17px;
  border-radius: 13px;
  font-size: 0.8rem;
  font-weight: 850;
  cursor: pointer;
}

.primary-button {
  border: 1px solid rgba(68, 226, 155, 0.45);
  color: #03140d;
  background: linear-gradient(135deg, #58efaa, #32d889);
  box-shadow: 0 8px 25px rgba(68, 226, 155, 0.17);
}

.primary-button:disabled {
  opacity: 0.55;
  cursor: wait;
}

.secondary-button {
  border: 1px solid var(--line);
  color: var(--text);
  background: var(--surface-2);
}

.secondary-button.full {
  width: 100%;
  justify-content: flex-start;
  padding: 12px 15px;
  text-align: left;
}

.secondary-button.full > span:last-child {
  display: grid;
}

.secondary-button.full strong {
  font-size: 0.8rem;
}

.secondary-button.full small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.68rem;
}

.danger-button {
  border: 1px solid rgba(255, 107, 120, 0.30);
  color: var(--danger);
  background: var(--danger-soft);
}

.action-stack {
  display: grid;
  gap: 9px;
}

.file-button {
  cursor: pointer;
}

.segmented-control {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-bottom: 12px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(13,25,40,0.74);
}

.segmented-control button {
  min-height: 42px;
  border: 0;
  border-radius: 11px;
  color: var(--muted);
  background: transparent;
  font-size: 0.76rem;
  font-weight: 800;
  cursor: pointer;
}

.segmented-control button.is-active {
  color: var(--text);
  background: var(--surface-3);
  box-shadow: 0 6px 18px rgba(0,0,0,0.18);
}

.measurement-summary {
  margin-top: 12px;
}

.photo-picker {
  position: relative;
  display: grid;
  min-height: 210px;
  overflow: hidden;
  place-items: center;
  border: 1px dashed var(--line-strong);
  border-radius: 17px;
  background: rgba(5, 11, 19, 0.48);
}

.photo-picker input[type="file"] {
  position: absolute;
  z-index: 3;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

#photoPickerPrompt {
  display: grid;
  padding: 25px;
  place-items: center;
  text-align: center;
}

#photoPickerPrompt span {
  font-size: 2rem;
}

#photoPickerPrompt strong {
  margin-top: 8px;
  font-size: 0.9rem;
}

#photoPickerPrompt small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.72rem;
}

.photo-picker img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.photo-grid .wide {
  grid-column: 1 / -1;
}

.photo-card {
  position: relative;
  overflow: hidden;
  min-height: 240px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-2);
  cursor: pointer;
}

.photo-card img {
  display: block;
  width: 100%;
  height: 240px;
  object-fit: cover;
  transition: transform 220ms ease;
}

.photo-card:hover img {
  transform: scale(1.025);
}

.photo-card-overlay {
  position: absolute;
  inset: auto 0 0;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  padding: 36px 12px 11px;
  background: linear-gradient(transparent, rgba(0,0,0,0.84));
  text-align: left;
}

.photo-card-overlay > span:first-child {
  min-width: 0;
}

.photo-card-overlay strong,
.photo-card-overlay small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.photo-card-overlay strong {
  font-size: 0.78rem;
}

.photo-card-overlay small {
  margin-top: 2px;
  color: rgba(255,255,255,0.68);
  font-size: 0.65rem;
}

.photo-delete {
  position: relative;
  z-index: 3;
  flex: 0 0 auto;
  padding: 6px 8px;
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 8px;
  color: #fff;
  background: rgba(0,0,0,0.45);
  font-size: 0.63rem;
  font-weight: 800;
  cursor: pointer;
}

.privacy-badge,
.version-badge {
  flex: 0 0 auto;
  padding: 6px 9px;
  border-radius: 999px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 0.65rem;
  font-weight: 900;
  text-transform: uppercase;
}

.version-badge {
  color: var(--blue);
  background: var(--blue-soft);
}

.step-list,
.plain-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.step-list {
  display: grid;
  gap: 10px;
}

.step-list li {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 11px;
  border: 1px solid rgba(169,189,209,0.09);
  border-radius: 14px;
  background: rgba(255,255,255,0.018);
}

.step-list li > span {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 12px;
  color: #03140d;
  background: var(--accent);
  font-size: 0.78rem;
  font-weight: 950;
}

.step-list p {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.5;
}

.step-list strong {
  color: var(--text);
}

.success-note {
  margin: 14px 0 0;
  padding: 11px 13px;
  border: 1px solid rgba(68,226,155,0.18);
  border-radius: 13px;
  color: #b9f7d8;
  background: rgba(68,226,155,0.07);
  font-size: 0.76rem;
  line-height: 1.5;
}

.plain-list {
  display: grid;
  gap: 10px;
}

.plain-list li {
  position: relative;
  padding-left: 20px;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.55;
}

.plain-list li::before {
  position: absolute;
  top: 0.55em;
  left: 2px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  content: "";
}

.danger-zone {
  border-color: rgba(255, 107, 120, 0.18);
}

.app-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 27px 10px 6px;
  color: var(--muted);
  text-align: left;
}

.app-footer img {
  border-radius: 9px;
}

.app-footer p {
  margin: 0;
  font-size: 0.67rem;
  line-height: 1.5;
}

.app-footer strong {
  color: #b8c8d7;
}

.bottom-nav {
  position: fixed;
  z-index: 60;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  min-height: calc(70px + var(--bottom-safe));
  padding: 7px max(8px, calc((100vw - 680px) / 2)) var(--bottom-safe);
  border-top: 1px solid rgba(169, 189, 209, 0.11);
  background: rgba(5, 11, 19, 0.91);
  backdrop-filter: blur(22px) saturate(150%);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
}

.bottom-nav button {
  display: grid;
  min-width: 0;
  min-height: 56px;
  padding: 6px 2px;
  place-items: center;
  align-content: center;
  gap: 3px;
  border: 0;
  border-radius: 12px;
  color: var(--muted-2);
  background: transparent;
  cursor: pointer;
}

.bottom-nav button.is-active {
  color: var(--accent);
  background: rgba(68, 226, 155, 0.07);
}

.bottom-nav svg {
  width: 23px;
  height: 23px;
  fill: currentColor;
}

.bottom-nav button[data-go="training"] svg {
  fill: none;
}

.bottom-nav span {
  overflow: hidden;
  max-width: 100%;
  font-size: 0.63rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.toast {
  position: fixed;
  z-index: 200;
  right: 16px;
  bottom: calc(86px + var(--bottom-safe));
  left: 16px;
  width: min(calc(100% - 32px), 430px);
  margin: auto;
  padding: 13px 15px;
  border: 1px solid rgba(68, 226, 155, 0.26);
  border-radius: 14px;
  color: #d8fcea;
  background: rgba(19, 66, 48, 0.96);
  box-shadow: 0 20px 60px rgba(0,0,0,0.38);
  font-size: 0.78rem;
  font-weight: 750;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.toast.is-error {
  border-color: rgba(255,107,120,0.28);
  color: #ffdce0;
  background: rgba(95, 29, 39, 0.97);
}

.photo-dialog {
  width: min(calc(100% - 24px), 820px);
  max-height: min(92vh, 900px);
  overflow: hidden;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 22px;
  color: var(--text);
  background: #02060b;
  box-shadow: 0 40px 120px rgba(0,0,0,0.72);
}

.photo-dialog::backdrop {
  background: rgba(0,0,0,0.82);
  backdrop-filter: blur(9px);
}

.photo-dialog img {
  display: block;
  width: 100%;
  max-height: 78vh;
  object-fit: contain;
  background: #000;
}

.dialog-close {
  position: absolute;
  z-index: 3;
  top: 12px;
  right: 12px;
  display: grid;
  width: 40px;
  height: 40px;
  padding: 0 0 3px;
  place-items: center;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 50%;
  color: #fff;
  background: rgba(0,0,0,0.55);
  font-size: 1.5rem;
  cursor: pointer;
}

.dialog-caption {
  display: grid;
  gap: 3px;
  padding: 14px 17px 17px;
  background: var(--surface);
}

.dialog-caption strong {
  font-size: 0.86rem;
}

.dialog-caption span {
  color: var(--muted);
  font-size: 0.72rem;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(1px, 1px, 1px, 1px) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
}

@media (max-width: 840px) {
  .quick-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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

@media (max-width: 620px) {
  .top-bar {
    min-height: calc(61px + var(--top-safe));
    padding-right: 14px;
    padding-left: 14px;
  }

  .brand-mark {
    width: 37px;
    height: 37px;
    border-radius: 12px;
  }

  .brand-mark svg {
    width: 25px;
    height: 25px;
  }

  .status-pill span:last-child {
    display: none;
  }

  .status-pill {
    min-height: 36px;
    padding: 0 12px;
  }

  .main-content {
    width: min(calc(100% - 20px), var(--content));
    padding-top: 14px;
  }

  .hero-card {
    min-height: 190px;
    padding: 24px 20px;
    border-radius: 22px;
  }

  .hero-card h1 {
    max-width: 240px;
    font-size: clamp(2rem, 11vw, 3.25rem);
  }

  .hero-card .hero-copy > p:last-child {
    max-width: 260px;
    font-size: 0.78rem;
  }

  .goal-ring {
    width: 104px;
    height: 104px;
  }

  .goal-ring::before {
    inset: 8px;
  }

  .goal-ring strong {
    font-size: 1.55rem;
  }

  .card {
    padding: 17px;
    border-radius: 18px;
  }

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

  .stats-grid,
  .stats-grid.three,
  .stats-grid.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stat-card {
    padding: 14px;
  }

  .form-grid.two,
  .form-grid.three {
    grid-template-columns: 1fr;
  }

  .chart-wrap {
    height: 210px;
  }

  .chart-wrap.large {
    height: 240px;
  }

  .timeline-item,
  .entry-item {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .timeline-date,
  .entry-value {
    grid-column: 2;
    text-align: left;
  }

  .entry-actions {
    justify-content: flex-start;
  }

  .photo-card,
  .photo-card img {
    min-height: 205px;
    height: 205px;
  }
}

@media (max-width: 450px) {
  .hero-card {
    align-items: flex-end;
  }

  .goal-ring {
    position: absolute;
    top: 18px;
    right: 17px;
    width: 88px;
    height: 88px;
  }

  .goal-ring strong {
    font-size: 1.32rem;
  }

  .goal-ring span {
    font-size: 0.56rem;
  }

  .hero-card h1 {
    padding-right: 68px;
  }

  .quick-grid {
    grid-template-columns: 1fr;
  }

  .quick-card {
    padding: 13px;
  }

  .photo-grid {
    grid-template-columns: 1fr;
  }

  .photo-card,
  .photo-card img {
    min-height: 310px;
    height: 310px;
  }

  .install-banner,
  .update-banner {
    width: calc(100% - 20px);
    align-items: flex-start;
    flex-direction: column;
    gap: 9px;
  }

  .text-button {
    align-self: flex-end;
  }
}

@media (min-width: 1100px) {
  .bottom-nav {
    right: auto;
    bottom: 18px;
    left: 50%;
    width: 620px;
    min-height: 72px;
    padding: 7px;
    border: 1px solid var(--line);
    border-radius: 21px;
    transform: translateX(-50%);
    box-shadow: var(--shadow);
  }

  .main-content {
    padding-bottom: 126px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
