:root {
  color-scheme: dark;
  --bg: #0b0d10;
  --bg-soft: #101318;
  --panel: #15191f;
  --panel-solid: #15191f;
  --panel-raised: #1b2028;
  --text: #f3f5f7;
  --muted: #a2aab6;
  --faint: #707986;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);
  --blue: #8dc2ff;
  --blue-strong: #5c9fe8;
  --green: #73d19f;
  --orange: #ffb86b;
  --red: #ff7282;
  --purple: #a690ff;
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 18px;
  --shadow: 0 14px 36px rgba(0, 0, 0, 0.2);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-width: 0;
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
}

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

button,
a,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(111, 201, 255, 0.72);
  outline-offset: 3px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.ambient {
  display: none;
}

.ambient-one {
  top: 16%;
  right: -180px;
  width: 340px;
  height: 340px;
  background: #2b8ee8;
}

.ambient-two {
  bottom: 8%;
  left: -180px;
  width: 300px;
  height: 300px;
  background: #2dc980;
  opacity: 0.09;
}

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

.boot-screen {
  min-height: 100vh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 24px;
}

.boot-screen img {
  border-radius: 22px;
  box-shadow: 0 20px 60px rgba(45, 129, 219, 0.28);
}

.loader {
  width: 26px;
  height: 26px;
  border: 3px solid rgba(255, 255, 255, 0.14);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.auth-layout {
  width: min(100%, 1060px);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: calc(28px + var(--safe-top)) 20px calc(28px + var(--safe-bottom));
  display: grid;
  align-items: center;
  gap: 22px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-lockup img {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  box-shadow: 0 14px 36px rgba(52, 150, 245, 0.2);
}

.brand-name {
  margin: 0;
  font-size: 1.45rem;
  letter-spacing: -0.035em;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--blue);
  font-size: 0.72rem;
  font-weight: 760;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.auth-copy h1 {
  max-width: 690px;
  margin: 24px 0 14px;
  font-size: clamp(2.15rem, 6vw, 4.1rem);
  line-height: 1.03;
  letter-spacing: -0.055em;
}

.auth-copy > p {
  max-width: 580px;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.18rem);
  line-height: 1.65;
}

.auth-card {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.16);
}

.onboarding-card {
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.onboarding-card .form-section {
  background: var(--panel);
}

.auth-card h2,
.section-heading h2,
.sheet h2 {
  margin: 0;
  font-size: 1.35rem;
  letter-spacing: -0.035em;
}

.feature-list {
  margin: 24px 0 0;
  padding: 0;
  display: grid;
  gap: 12px;
  color: #d5dae2;
  list-style: none;
}

.feature-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
}

.feature-list svg,
.next-step-icon svg {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  fill: none;
  stroke: var(--blue);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.onboarding-heading > p:last-child {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.5;
}

.form-section {
  min-width: 0;
  margin: 0;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #11151a;
}

.form-section legend {
  padding: 0 8px 0 0;
  color: #e5e9ee;
  font-size: 0.88rem;
  font-weight: 720;
}

.form-section legend span {
  width: 24px;
  height: 24px;
  margin-right: 7px;
  display: inline-grid;
  place-items: center;
  color: #07111d;
  border-radius: 50%;
  background: var(--blue);
  font-size: 0.72rem;
}

.form-grid.compact {
  margin-top: 10px;
}

.section-help {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.5;
}

.parental-consent {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.parental-consent[hidden] {
  display: none;
}

.form-grid {
  display: grid;
  gap: 14px;
  margin-top: 20px;
}

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

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

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

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

.field > span,
.field > label {
  color: #cad2e1;
  font-size: 0.84rem;
  font-weight: 650;
}

.field small {
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.45;
}

.field em {
  color: var(--muted);
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 500;
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 50px;
  padding: 0 14px;
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: #0d1014;
  transition:
    border-color 0.2s,
    background 0.2s;
}

.textarea {
  min-height: 100px;
  padding-top: 13px;
  resize: vertical;
}

.input:hover,
.select:hover,
.textarea:hover {
  border-color: rgba(111, 201, 255, 0.35);
}

.input::placeholder,
.textarea::placeholder {
  color: #58647a;
}

.checkbox-row {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 11px;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.5;
}

.checkbox-row input {
  width: 20px;
  height: 20px;
  margin: 1px 0 0;
  accent-color: var(--blue-strong);
}

.notice {
  padding: 13px 14px;
  border: 1px solid rgba(111, 201, 255, 0.18);
  border-radius: 14px;
  color: #c2cee0;
  background: rgba(56, 157, 250, 0.07);
  font-size: 0.82rem;
  line-height: 1.5;
}

.notice.warning {
  border-color: rgba(255, 184, 107, 0.22);
  background: rgba(255, 184, 107, 0.07);
}

.primary-button,
.secondary-button,
.danger-button,
.icon-button,
.quick-button,
.nav-button {
  border: 0;
  cursor: pointer;
}

.primary-button,
.secondary-button,
.danger-button {
  min-height: 50px;
  padding: 0 18px;
  border-radius: 11px;
  font-weight: 760;
  transition:
    transform 0.18s,
    filter 0.18s,
    background 0.18s;
}

.primary-button {
  color: #07111d;
  background: var(--blue);
  box-shadow: none;
}

.secondary-button {
  color: var(--text);
  border: 1px solid var(--line-strong);
  background: #1b2027;
}

.danger-button {
  color: #ffdbe0;
  border: 1px solid rgba(255, 114, 130, 0.28);
  background: rgba(255, 114, 130, 0.1);
}

.primary-button:hover,
.secondary-button:hover,
.danger-button:hover {
  filter: brightness(1.08);
}

.button-label {
  display: grid;
  place-items: center;
  cursor: pointer;
}

.primary-button:active,
.secondary-button:active,
.danger-button:active,
.quick-button:active,
.nav-button:active {
  transform: scale(0.98);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.button-row > * {
  flex: 1 1 160px;
}

.auth-switch {
  margin: 16px 0 0;
  color: var(--muted);
  text-align: center;
  font-size: 0.88rem;
}

.text-button {
  padding: 4px;
  color: var(--blue);
  border: 0;
  background: none;
  font-weight: 700;
  cursor: pointer;
}

.shell {
  width: min(100%, 1120px);
  margin: 0 auto;
  padding: calc(16px + var(--safe-top)) 16px calc(106px + var(--safe-bottom));
}

.topbar {
  position: sticky;
  z-index: 20;
  top: calc(8px + var(--safe-top));
  min-height: 58px;
  margin-bottom: 20px;
  padding: 9px 10px 9px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  background: rgba(21, 25, 31, 0.92);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-brand img {
  width: 38px;
  height: 38px;
  border-radius: 11px;
}

.topbar-brand strong {
  display: block;
  letter-spacing: -0.03em;
}

.topbar-brand span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.71rem;
}

.icon-button {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
}

.icon-button svg,
.quick-button svg,
.nav-button svg,
.inline-icon svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.page {
  animation: page-in 0.32s ease both;
}

@keyframes page-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

.hero {
  position: relative;
  padding: 22px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel-solid);
}

.hero::after {
  content: none;
}

.hero-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 22px;
}

.hero h1 {
  margin: 7px 0 12px;
  font-size: clamp(1.85rem, 6vw, 2.8rem);
  line-height: 1.06;
  letter-spacing: -0.045em;
}

.hero-copy {
  max-width: 510px;
  margin: 0;
  color: #bbc5d7;
  line-height: 1.55;
}

.progress-ring {
  --value: 0;
  position: relative;
  width: 128px;
  height: 128px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--green) calc(var(--value) * 1%), rgba(255, 255, 255, 0.1) 0);
  box-shadow: 0 16px 50px rgba(36, 192, 121, 0.15);
}

.progress-ring::before {
  content: "";
  position: absolute;
  width: 102px;
  height: 102px;
  border-radius: 50%;
  background: #121a27;
  box-shadow: inset 0 0 0 1px var(--line);
}

.ring-label {
  position: relative;
  z-index: 1;
  text-align: center;
}

.ring-label strong {
  display: block;
  font-size: 1.5rem;
  letter-spacing: -0.05em;
}

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

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

.quick-button {
  min-height: 82px;
  padding: 13px 10px;
  display: grid;
  place-items: center;
  gap: 8px;
  color: #dce5f2;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  font-size: 0.78rem;
  font-weight: 680;
}

.quick-button:first-child {
  color: #dce5f2;
  border-color: var(--line);
  background: var(--panel);
}

.next-step {
  margin: 14px 0;
  padding: 18px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 15px;
  border: 1px solid rgba(141, 194, 255, 0.28);
  border-radius: var(--radius);
  background: #141b23;
}

.next-step-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: rgba(141, 194, 255, 0.1);
}

.next-step h2 {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.next-step p:not(.eyebrow) {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
}

.content-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 14px;
}

.card {
  grid-column: span 6;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

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

.card.third {
  grid-column: span 4;
}

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

.card-header h3 {
  margin: 0;
  font-size: 1rem;
  letter-spacing: -0.02em;
}

.card-subtitle {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.status-label {
  padding: 5px 8px;
  color: #c9e1ff !important;
  border: 1px solid rgba(141, 194, 255, 0.2);
  border-radius: 999px;
  background: rgba(141, 194, 255, 0.07);
  font-size: 0.68rem !important;
}

.card-header span,
.muted {
  color: var(--muted);
  font-size: 0.8rem;
}

.metric {
  margin: 0;
  font-size: clamp(1.9rem, 6vw, 2.7rem);
  font-weight: 780;
  letter-spacing: -0.065em;
}

.metric small {
  margin-left: 3px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0;
}

.metric-caption {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.progress-track {
  height: 8px;
  margin-top: 16px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.progress-fill {
  width: var(--progress, 0%);
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
  transition: width 0.5s ease;
}

.macro-row {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.macro {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #11151a;
}

.macro span {
  display: block;
  color: var(--muted);
  font-size: 0.67rem;
  text-transform: uppercase;
}

.macro strong {
  display: block;
  margin-top: 3px;
  font-size: 0.92rem;
}

.explain-details {
  margin-top: 14px;
  padding-top: 13px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.55;
}

.explain-details summary {
  color: var(--blue);
  font-weight: 680;
  cursor: pointer;
}

.explain-details p {
  margin: 10px 0 0;
}

.nutrition-fields {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #11151a;
}

.nutrition-fields summary {
  font-size: 0.84rem;
  font-weight: 680;
  cursor: pointer;
}

.nutrition-fields summary span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 500;
}

.nutrition-fields > p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.76rem;
}

.support-card {
  display: grid;
  gap: 7px;
}

.support-card p,
.support-card span {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

.motivation {
  position: relative;
  display: grid;
  align-content: space-between;
  min-height: 185px;
  overflow: hidden;
  background:
    radial-gradient(circle at 100% 0, rgba(111, 201, 255, 0.16), transparent 55%),
    var(--panel);
}

.motivation blockquote {
  margin: 0;
  max-width: 420px;
  font-size: 1.25rem;
  font-weight: 720;
  line-height: 1.24;
  letter-spacing: -0.035em;
}

.streak {
  margin-top: 24px;
  color: var(--green);
  font-size: 0.8rem;
  font-weight: 750;
}

.section-heading {
  margin: 4px 0 18px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
}

.section-heading p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.scan-hero {
  position: relative;
  min-height: 210px;
  padding: 22px;
  display: grid;
  align-content: end;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #151b22;
}

.scan-frame {
  position: absolute;
  inset: 25px 25px auto auto;
  width: 96px;
  height: 96px;
  border-top: 2px solid var(--blue);
  border-right: 2px solid var(--blue);
  border-radius: 0 22px 0 0;
  opacity: 0.35;
}

.scan-hero h2 {
  margin: 0 0 8px;
  font-size: 1.65rem;
  letter-spacing: -0.045em;
}

.scan-hero p {
  max-width: 540px;
  margin: 0 0 18px;
  color: #b7c2d5;
  line-height: 1.5;
}

.hidden-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.meal-list,
.achievement-list,
.reminder-list,
.search-results {
  display: grid;
  gap: 10px;
}

.list-item {
  padding: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 13px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.032);
}

.list-item-main {
  min-width: 0;
}

.list-item strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-item span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.75rem;
}

.list-item-value {
  flex: 0 0 auto;
  font-size: 0.92rem;
  font-weight: 750;
}

.delete-mini {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  color: var(--red);
  border: 0;
  border-radius: 50%;
  background: rgba(255, 114, 130, 0.09);
  cursor: pointer;
}

.chart-wrap {
  width: 100%;
  min-height: 230px;
  margin-top: 10px;
}

.chart {
  width: 100%;
  height: 230px;
  overflow: visible;
}

.chart-grid {
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 1;
}

.chart-area {
  fill: url("#chart-gradient");
}

.chart-line {
  fill: none;
  stroke: var(--blue);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart-dot {
  fill: var(--bg);
  stroke: var(--green);
  stroke-width: 3;
}

.empty-state {
  padding: 24px 16px;
  color: var(--muted);
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: 16px;
}

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

.badge-card {
  min-height: 116px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.035);
}

.badge-card.locked {
  filter: grayscale(1);
  opacity: 0.46;
}

.badge-mark {
  width: 34px;
  height: 34px;
  margin-bottom: 13px;
  display: grid;
  place-items: center;
  color: #07151f;
  border-radius: 11px;
  background: var(--blue);
  font-weight: 900;
}

.badge-card strong {
  display: block;
  font-size: 0.88rem;
}

.badge-card p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.4;
}

.bottom-nav {
  position: fixed;
  z-index: 30;
  right: 14px;
  bottom: calc(10px + var(--safe-bottom));
  left: 14px;
  max-width: 620px;
  min-height: 72px;
  margin: 0 auto;
  padding: 7px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 3px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 18px;
  background: rgba(21, 25, 31, 0.94);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.nav-button {
  min-width: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 4px;
  color: #7f8ba0;
  border-radius: 12px;
  background: transparent;
  font-size: 0.65rem;
  font-weight: 700;
}

.nav-button.active {
  color: #07121c;
  background: var(--blue);
}

.toast-region {
  position: fixed;
  z-index: 100;
  top: calc(16px + var(--safe-top));
  right: 16px;
  left: 16px;
  display: grid;
  justify-items: center;
  pointer-events: none;
}

.toast {
  max-width: 440px;
  padding: 12px 16px;
  color: #07131c;
  border-radius: 999px;
  background: #dff4ff;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.38);
  font-size: 0.82rem;
  font-weight: 720;
  animation: toast-in 0.25s ease both;
}

.toast.error {
  color: #2a060b;
  background: #ffd9df;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
}

.modal-backdrop {
  position: fixed;
  z-index: 80;
  inset: 0;
  padding: calc(24px + var(--safe-top)) 14px calc(14px + var(--safe-bottom));
  display: grid;
  align-items: end;
  background: rgba(0, 0, 0, 0.64);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: fade-in 0.2s ease both;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

.sheet {
  width: min(100%, 620px);
  max-height: min(88vh, 800px);
  margin: 0 auto;
  padding: 22px;
  overflow-y: auto;
  border: 1px solid var(--line-strong);
  border-radius: 30px;
  background: #121824;
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.58);
}

.sheet-header {
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.sheet-close {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  color: var(--muted);
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.07);
  cursor: pointer;
}

.scan-preview {
  width: 100%;
  max-height: 250px;
  margin-bottom: 15px;
  object-fit: cover;
  border-radius: 18px;
  background: #070a10;
}

.analysis-loader {
  min-height: 260px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 15px;
  text-align: center;
}

.analysis-loader p {
  max-width: 300px;
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.item-editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 90px 85px;
  align-items: end;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.item-editor:last-child {
  border-bottom: 0;
}

.item-editor .field span {
  font-size: 0.7rem;
}

.settings-sections {
  display: grid;
  gap: 16px;
}

.settings-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.settings-card h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.settings-card > p {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.5;
}

.reminder-row {
  padding: 12px 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 100px auto;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--line);
}

.reminder-row:last-child {
  border-bottom: 0;
}

.toggle {
  position: relative;
  width: 48px;
  height: 28px;
}

.toggle input {
  position: absolute;
  opacity: 0;
}

.toggle-track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #343c4a;
  transition: background 0.2s;
}

.toggle-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
  transition: transform 0.2s;
}

.toggle input:checked + .toggle-track {
  background: #2fc878;
}

.toggle input:checked + .toggle-track::after {
  transform: translateX(20px);
}

.install-banner {
  margin-bottom: 16px;
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid rgba(111, 201, 255, 0.2);
  border-radius: 17px;
  background: rgba(111, 201, 255, 0.07);
}

.install-banner strong {
  display: block;
  font-size: 0.86rem;
}

.install-banner span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.72rem;
}

.install-banner button {
  flex: 0 0 auto;
}

.offline-banner {
  position: fixed;
  z-index: 60;
  top: calc(8px + var(--safe-top));
  right: 16px;
  left: 16px;
  max-width: 440px;
  margin: 0 auto;
  padding: 9px 13px;
  color: #2b1600;
  border-radius: 999px;
  background: #ffd597;
  text-align: center;
  font-size: 0.76rem;
  font-weight: 750;
}

.admin-shell {
  width: min(100%, 1120px);
  margin: 0 auto;
  padding: calc(16px + var(--safe-top)) 16px calc(42px + var(--safe-bottom));
}

.compact-button {
  min-height: 38px;
  padding-inline: 13px;
  font-size: 0.78rem;
}

.admin-heading {
  margin: 34px 0 22px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
}

.admin-heading h1 {
  margin: 5px 0 8px;
  font-size: clamp(2rem, 5vw, 3.5rem);
  letter-spacing: -0.055em;
}

.admin-heading p:last-child {
  max-width: 600px;
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.admin-shield {
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  color: var(--green);
  border: 1px solid rgba(115, 209, 159, 0.25);
  border-radius: 18px;
  background: rgba(115, 209, 159, 0.08);
}

.admin-shield svg {
  width: 30px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.admin-metrics {
  margin-bottom: 16px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.admin-metrics article,
.admin-list-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
}

.admin-metrics article {
  padding: 17px;
}

.admin-metrics span {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
}

.admin-metrics strong {
  display: block;
  margin-top: 8px;
  font-size: 1.8rem;
  letter-spacing: -0.05em;
}

.admin-list-card {
  padding: 20px;
}

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

.section-heading h2 {
  margin: 4px 0 0;
  letter-spacing: -0.035em;
}

.admin-count,
.account-status {
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 750;
}

.admin-count {
  min-width: 31px;
  padding: 6px 10px;
  color: var(--blue);
  border: 1px solid rgba(141, 194, 255, 0.2);
  text-align: center;
}

.admin-users {
  display: grid;
  gap: 8px;
}

.admin-user {
  padding: 13px;
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto auto;
  align-items: center;
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-soft);
}

.admin-user-main {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-avatar {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  color: #07111d;
  border-radius: 12px;
  background: var(--blue);
  font-weight: 800;
}

.admin-user-main strong,
.admin-user-main span,
.admin-user-main small {
  display: block;
}

.admin-user-main span {
  max-width: 40vw;
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.8rem;
}

.admin-user-main small,
.admin-user-status small {
  margin-top: 3px;
  color: var(--faint);
  font-size: 0.7rem;
}

.admin-user-status {
  text-align: center;
}

.account-status {
  display: inline-block;
  padding: 5px 9px;
}

.account-status.active {
  color: var(--green);
  background: rgba(115, 209, 159, 0.09);
}

.account-status.suspended {
  color: var(--red);
  background: rgba(255, 114, 130, 0.09);
}

.admin-user-actions {
  display: flex;
  gap: 7px;
}

@media (min-width: 840px) {
  .auth-layout {
    grid-template-columns: 1.08fr 0.92fr;
    padding-inline: 42px;
  }

  .onboarding-layout {
    width: min(100%, 1220px);
    grid-template-columns: minmax(300px, 0.72fr) minmax(620px, 1.28fr);
    align-items: start;
    padding-top: calc(48px + var(--safe-top));
    padding-bottom: calc(48px + var(--safe-bottom));
  }

  .onboarding-layout .auth-copy {
    position: sticky;
    top: calc(48px + var(--safe-top));
  }

  .shell {
    padding-inline: 28px;
  }

  .bottom-nav {
    bottom: 18px;
  }
}

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

  .admin-user {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .admin-user-actions {
    grid-column: 1 / -1;
  }

  .admin-user-actions > * {
    flex: 1;
  }

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

  .progress-ring {
    width: 108px;
    height: 108px;
    position: absolute;
    right: 0;
    bottom: 0;
    opacity: 0.9;
  }

  .progress-ring::before {
    width: 86px;
    height: 86px;
  }

  .hero-copy {
    max-width: 100%;
  }

  .ring-label strong {
    font-size: 1.2rem;
  }

  .card,
  .card.third {
    grid-column: 1 / -1;
  }

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

@media (max-width: 470px) {
  .admin-shell {
    padding-right: 12px;
    padding-left: 12px;
  }

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

  .admin-shield {
    width: 48px;
    height: 48px;
    flex: 0 0 auto;
  }

  .admin-list-card {
    padding: 13px;
  }

  .admin-user {
    grid-template-columns: minmax(0, 1fr);
  }

  .admin-user-status {
    text-align: left;
  }

  .admin-user-main span {
    max-width: 65vw;
  }

  .shell {
    padding-right: 12px;
    padding-left: 12px;
  }

  .topbar {
    margin-right: 2px;
    margin-left: 2px;
  }

  .auth-layout {
    padding-right: 15px;
    padding-left: 15px;
  }

  .auth-card,
  .hero,
  .sheet {
    padding: 18px;
  }

  .onboarding-card {
    padding: 0;
  }

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

  .hero h1 {
    max-width: 100%;
  }

  .hero-copy {
    max-width: 100%;
    font-size: 0.88rem;
  }

  .next-step {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .next-step .primary-button {
    grid-column: 1 / -1;
  }

  .quick-button {
    min-height: 92px;
    padding-inline: 6px;
  }

  .progress-ring {
    right: -9px;
    bottom: -8px;
  }

  .macro-row {
    gap: 5px;
  }

  .macro {
    padding: 9px 7px;
  }

  .bottom-nav {
    right: 9px;
    left: 9px;
  }

  .item-editor {
    grid-template-columns: minmax(0, 1fr) 76px;
  }

  .item-editor > :last-child {
    grid-column: 1 / -1;
  }

  .reminder-row {
    grid-template-columns: minmax(0, 1fr) 88px auto;
  }
}

@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;
  }
}

@media (prefers-contrast: more) {
  :root {
    --muted: #c0c8d6;
    --line: rgba(255, 255, 255, 0.24);
    --line-strong: rgba(255, 255, 255, 0.4);
  }

  .topbar,
  .bottom-nav {
    background: #111722;
    backdrop-filter: none;
  }
}
