:root {
  --bg-start: #f7f0e6;
  --bg-end: #e3f1e5;
  --ink: #1c1a18;
  --muted: #6c6660;
  --accent: #e06c2f;
  --accent-strong: #c5541c;
  --accent-cool: #2c8b6d;
  --panel-width: min(100%, 1120px);
  --panel: rgba(255, 255, 255, 0.9);
  --panel-border: rgba(255, 255, 255, 0.75);
  --shadow: 0 24px 60px rgba(29, 26, 24, 0.16);
}

body[data-theme="dark"] {
  --bg-start: #111010;
  --bg-end: #1b1a19;
  --ink: #f4efe9;
  --muted: #b4aca3;
  --accent: #e07a45;
  --accent-strong: #f1a173;
  --accent-cool: #5dc396;
  --panel: rgba(20, 18, 16, 0.92);
  --panel-border: rgba(255, 255, 255, 0.06);
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", system-ui, sans-serif;
  color: var(--ink);
  min-height: 100vh;
  background: radial-gradient(
      circle at top left,
      rgba(255, 255, 255, 0.8) 0%,
      rgba(247, 240, 230, 0.4) 40%,
      rgba(247, 240, 230, 0) 70%
    ),
    linear-gradient(135deg, var(--bg-start), var(--bg-end));
  position: relative;
  overflow-x: hidden;
}

body[data-theme="dark"] {
  background: radial-gradient(
      circle at top left,
      rgba(72, 52, 40, 0.28) 0%,
      rgba(18, 16, 14, 0.5) 45%,
      rgba(18, 16, 14, 0) 72%
    ),
    linear-gradient(135deg, var(--bg-start), var(--bg-end));
}

.glow {
  position: absolute;
  width: 520px;
  height: 520px;
  background: radial-gradient(circle, rgba(224, 108, 47, 0.35), transparent 65%);
  top: -180px;
  right: -140px;
  filter: blur(10px);
  opacity: 0.7;
  animation: drift 12s ease-in-out infinite;
  pointer-events: none;
}

body[data-theme="dark"] .glow {
  background: radial-gradient(circle, rgba(224, 108, 47, 0.22), transparent 65%);
  opacity: 0.6;
}

body.is-locked {
  overflow: hidden;
}

body.is-locked .shell,
body.is-locked .glow {
  filter: blur(14px);
  pointer-events: none;
  user-select: none;
}

@keyframes drift {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(30px);
  }
}

.shell {
  max-width: 1120px;
  margin: 0 auto;
  padding: 48px 24px 64px;
  position: relative;
  z-index: 1;
}

.hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 32px;
  margin-bottom: 32px;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

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

.deck-controls .muted {
  display: block;
}

.deck-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.card-sections {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.card-sections.single {
  grid-template-columns: 1fr;
}

.today-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 18px;
}

.today-stack {
  display: grid;
  gap: 16px;
}

.section-card {
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(28, 26, 24, 0.08);
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 16px 28px rgba(29, 26, 24, 0.08);
}

body[data-theme="dark"] .section-card {
  background: rgba(18, 16, 14, 0.88);
  border-color: rgba(255, 255, 255, 0.06);
  box-shadow: 0 18px 30px rgba(0, 0, 0, 0.35);
}

.section-card.metrics-card {
  padding: 20px;
  background: linear-gradient(
      135deg,
      rgba(224, 108, 47, 0.08),
      rgba(255, 255, 255, 0.94)
    ),
    rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(224, 108, 47, 0.18);
  box-shadow: 0 18px 34px rgba(29, 26, 24, 0.12);
  display: grid;
  gap: 18px;
}

body[data-theme="dark"] .section-card.metrics-card {
  background: linear-gradient(
      135deg,
      rgba(224, 122, 69, 0.16),
      rgba(18, 16, 14, 0.85)
    ),
    rgba(18, 16, 14, 0.88);
  border-color: rgba(224, 122, 69, 0.2);
  box-shadow: 0 22px 38px rgba(0, 0, 0, 0.45);
}

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

.section-header h3 {
  margin: 0;
  font-family: "Fraunces", serif;
  font-size: 18px;
}

.totals.compact {
  gap: 12px;
}

.totals.compact .summary-card {
  padding: 10px 12px;
}

.totals.compact .summary-card strong {
  font-size: 20px;
}

.log-section {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.log-section .items {
  max-height: 420px;
  overflow-y: auto;
  padding: 2px 4px 2px 18px;
  touch-action: pan-y;
  flex: 1;
  gap: 10px;
  position: relative;
  --log-progress: 0;
  --log-progress-opacity: 0.4;
}

.log-section .items::before,
.log-section .items::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 10px;
  bottom: 10px;
  width: 2px;
  border-radius: 999px;
}

.log-section .items::before {
  background: rgba(28, 26, 24, 0.12);
}

.log-section .items::after {
  bottom: auto;
  height: calc((100% - 20px) * var(--log-progress));
  background: linear-gradient(180deg, var(--accent), transparent);
  opacity: var(--log-progress-opacity);
}

body[data-theme="dark"] .log-section .items::before {
  background: rgba(255, 255, 255, 0.12);
}

body[data-theme="dark"] .log-section .items::after {
  background: linear-gradient(180deg, var(--accent-strong), transparent);
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 12px;
  color: var(--accent-strong);
  margin: 0 0 8px;
}

h1 {
  font-family: "Fraunces", serif;
  font-size: clamp(32px, 4vw, 48px);
  line-height: 1.05;
  margin: 0 0 12px;
}

.hero-title {
  display: inline-block;
}

.hero-badge {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(224, 108, 47, 0.12);
  border: 1px solid rgba(224, 108, 47, 0.32);
  color: var(--accent-strong);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

body[data-theme="dark"] .hero-badge {
  background: rgba(224, 108, 47, 0.2);
  border-color: rgba(224, 108, 47, 0.45);
}

.subtitle {
  margin: 0;
  color: var(--muted);
  max-width: 520px;
}

.badge {
  display: grid;
  gap: 8px;
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: var(--shadow);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.grid {
  position: relative;
  display: block;
  padding: 0 0 8px;
  min-height: clamp(520px, 70vh, 780px);
  transition: height 0.45s ease;
  will-change: height;
  touch-action: pan-y;
}

.grid.is-dragging,
.grid.is-dragging * {
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  -webkit-touch-callout: none;
  cursor: grabbing;
}

.grid.single {
  min-height: auto;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  padding: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
  animation: rise 0.8s ease both;
  width: var(--panel-width);
  margin: 0 auto;
  position: relative;
  isolation: isolate;
  will-change: transform, opacity, filter;
  backface-visibility: hidden;
  transition:
    transform 0.55s ease,
    box-shadow 0.55s ease,
    opacity 0.45s ease,
    filter 0.45s ease,
    visibility 0s linear 0.45s;
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
  transform: none;
}

.panel.is-active {
  transform: translateY(-2px) scale(1.01);
  box-shadow: 0 22px 50px rgba(0, 0, 0, 0.18);
}

.grid.deck-active {
  overflow: hidden;
}

.grid.deck-active .panel {
  position: absolute;
  top: 0;
  left: 50%;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(10px) scale(0.98);
  filter: blur(3px);
  visibility: hidden;
  z-index: 0;
}

.grid.deck-active .panel.is-active {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(-2px) scale(1);
  filter: none;
  visibility: visible;
  transition-delay: 0s;
  animation: none;
  z-index: 2;
}

.grid.deck-active .panel.is-active::after {
  content: "";
  position: absolute;
  inset: -16px;
  background: radial-gradient(
    circle at top,
    rgba(224, 108, 47, 0.18),
    transparent 70%
  );
  opacity: 0.7;
  filter: blur(22px);
  z-index: -1;
  pointer-events: none;
}

body[data-theme="dark"] .grid.deck-active .panel.is-active::after {
  opacity: 0.45;
}


.panel-pager {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 16px 0 0;
}

.swipe-hint {
  margin: 6px 0 0;
  text-align: center;
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}

.pager-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  border: none;
  background: rgba(28, 26, 24, 0.2);
  cursor: pointer;
  transition: transform 0.3s ease, background 0.3s ease;
  position: relative;
}

body[data-theme="dark"] .pager-dot {
  background: rgba(255, 255, 255, 0.2);
}

.pager-dot.is-active {
  background: var(--accent);
  transform: scale(1.4);
}

.pager-dot::after {
  content: attr(data-label);
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%) translateY(6px);
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(28, 26, 24, 0.9);
  color: #fff;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  white-space: nowrap;
}

.pager-dot.show-label::after,
.pager-dot:focus-visible::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

body[data-theme="dark"] .pager-dot::after {
  background: rgba(255, 255, 255, 0.18);
  color: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.lock-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 13, 11, 0.55);
  backdrop-filter: blur(8px);
  z-index: 10;
}

body.is-locked .lock-overlay {
  display: flex;
}

.lock-card {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  padding: 24px;
  box-shadow: var(--shadow);
  text-align: left;
}

.lock-card h2 {
  font-family: "Fraunces", serif;
  margin: 0 0 8px;
}

.lock-form {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.lock-form input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  font-size: 15px;
  font-family: inherit;
  background: rgba(255, 255, 255, 0.85);
}

body[data-theme="dark"] .lock-form input {
  background: rgba(16, 14, 12, 0.7);
  color: var(--ink);
  border-color: rgba(255, 255, 255, 0.1);
}

.lock-form button {
  padding: 12px 16px;
  border-radius: 12px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

.lock-form button:hover {
  background: var(--accent-strong);
}

.lock-error {
  min-height: 1.2em;
  margin: 10px 0 0;
  color: var(--accent-strong);
  font-size: 13px;
}

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

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

.panel-header {
  margin-bottom: 20px;
}

.panel-header.split {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.panel-header h2 {
  font-family: "Fraunces", serif;
  margin: 0 0 4px;
}

.panel-header p {
  margin: 0;
  color: var(--muted);
}

.panel-date {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(224, 108, 47, 0.08);
  border: 1px solid rgba(224, 108, 47, 0.2);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

body[data-theme="dark"] .panel-date {
  background: rgba(224, 108, 47, 0.14);
  border-color: rgba(224, 108, 47, 0.35);
}

.stack {
  display: grid;
  gap: 16px;
}

.steps {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.step-card {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(28, 26, 24, 0.08);
}

.step-card strong {
  font-size: 15px;
}

.step-card span {
  font-size: 13px;
  color: var(--muted);
}

.overview-grid {
  display: grid;
  gap: 14px;
  margin-bottom: 16px;
}

.overview-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid rgba(28, 26, 24, 0.08);
  box-shadow: 0 16px 30px rgba(29, 26, 24, 0.08);
}

body[data-theme="dark"] .overview-card {
  background: rgba(22, 20, 18, 0.92);
  border-color: rgba(255, 255, 255, 0.06);
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.35);
}

.overview-card.is-active {
  transform: translateY(-2px);
}

.overview-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
}

.overview-header strong {
  font-size: 16px;
}

.overview-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 12px;
}

.metrics-card .overview-meta {
  display: grid;
  gap: 10px;
}

.overview-stat {
  display: grid;
  gap: 4px;
}

.overview-stat strong {
  font-size: 20px;
}

.metrics-card .overview-stats {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-areas:
    "estimate estimate"
    "weight scale"
    "caliper lean"
    "fat fat";
  gap: 14px;
}

.metrics-card .overview-stat {
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(28, 26, 24, 0.08);
  border-radius: 14px;
  padding: 14px 14px 12px;
  min-height: 92px;
  align-content: center;
  gap: 6px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

body[data-theme="dark"] .metrics-card .overview-stat {
  background: rgba(14, 12, 10, 0.7);
  border-color: rgba(255, 255, 255, 0.06);
}

.metrics-card .overview-stat.primary {
  min-height: 108px;
}

.metrics-card .overview-stat.primary strong {
  font-size: 22px;
}

.metrics-card .metrics-estimate {
  grid-area: estimate;
}

.metrics-card .metrics-weight {
  grid-area: weight;
}

.metrics-card .metrics-scale {
  grid-area: scale;
}

.metrics-card .metrics-caliper {
  grid-area: caliper;
}

.metrics-card .metrics-lean {
  grid-area: lean;
}

.metrics-card .metrics-fat {
  grid-area: fat;
}

.metrics-card .metrics-weight {
  background: linear-gradient(
    135deg,
    rgba(44, 139, 109, 0.16),
    rgba(255, 255, 255, 0.92)
  );
  border-color: rgba(44, 139, 109, 0.32);
}

body[data-theme="dark"] .metrics-card .metrics-weight {
  background: linear-gradient(
    135deg,
    rgba(44, 139, 109, 0.24),
    rgba(14, 12, 10, 0.8)
  );
  border-color: rgba(93, 195, 150, 0.4);
}


.overview-stat.emphasis {
  position: relative;
  padding-bottom: 8px;
}

.overview-stat.emphasis::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 2px;
  width: 64%;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), transparent);
  opacity: 0.85;
}

.overview-stat.emphasis .label {
  color: var(--accent-strong);
  font-weight: 600;
}

.overview-stat.emphasis strong {
  font-size: 26px;
  color: var(--accent-strong);
  letter-spacing: 0.02em;
  text-shadow: 0 12px 30px rgba(224, 108, 47, 0.25);
}

body[data-theme="dark"] .overview-stat.emphasis::after {
  background: linear-gradient(90deg, var(--accent-strong), transparent);
  opacity: 0.75;
}

.metrics-card .overview-stat.emphasis {
  background: linear-gradient(
    135deg,
    rgba(224, 108, 47, 0.2),
    rgba(255, 255, 255, 0.92)
  );
  border-color: rgba(224, 108, 47, 0.45);
  box-shadow: 0 12px 24px rgba(224, 108, 47, 0.2);
  padding: 18px 18px 16px;
  min-height: 126px;
  align-content: start;
  gap: 10px;
  overflow: hidden;
}

body[data-theme="dark"] .metrics-card .overview-stat.emphasis {
  background: linear-gradient(
    135deg,
    rgba(224, 122, 69, 0.25),
    rgba(14, 12, 10, 0.75)
  );
  border-color: rgba(224, 122, 69, 0.45);
}

.metrics-card .overview-stat.emphasis::after {
  display: none;
}

.metrics-card .overview-stat.emphasis::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at top left,
    rgba(255, 255, 255, 0.65),
    transparent 70%
  );
  opacity: 0.6;
  pointer-events: none;
}

body[data-theme="dark"] .metrics-card .overview-stat.emphasis::before {
  opacity: 0.25;
}

.metrics-card .overview-stat.emphasis strong {
  font-size: 32px;
  text-shadow: 0 18px 36px rgba(224, 108, 47, 0.3);
}

.overview-meta {
  display: grid;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(28, 26, 24, 0.08);
}

.metrics-card .overview-meta {
  background: rgba(28, 26, 24, 0.04);
  border-radius: 14px;
  padding: 12px;
  margin-top: 0;
  border-top: none;
  grid-template-columns: minmax(0, 1fr);
}

body[data-theme="dark"] .metrics-card .overview-meta {
  background: rgba(255, 255, 255, 0.04);
}

body[data-theme="dark"] .overview-meta {
  border-top-color: rgba(255, 255, 255, 0.06);
}

.meta-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.meta-chip {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 6px 8px;
  border-radius: 999px;
  background: rgba(28, 26, 24, 0.06);
  border: 1px solid rgba(28, 26, 24, 0.08);
  color: var(--muted);
}

body[data-theme="dark"] .meta-chip {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.08);
}

.meta-note {
  font-size: 12px;
  color: var(--muted);
}

.sync-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.field {
  display: grid;
  gap: 8px;
  font-size: 14px;
  color: var(--muted);
}

textarea,
select,
input {
  font-family: "Space Grotesk", system-ui, sans-serif;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(28, 26, 24, 0.16);
  background: rgba(255, 255, 255, 0.9);
  font-size: 15px;
  color: var(--ink);
  width: 100%;
}

input[type="search"] {
  appearance: none;
  -webkit-appearance: none;
}

input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-results-button,
input[type="search"]::-webkit-search-results-decoration {
  display: none;
}

textarea {
  resize: vertical;
  min-height: 140px;
}

textarea:focus,
select:focus,
input:focus,
button:focus {
  outline: 2px solid rgba(224, 108, 47, 0.35);
  outline-offset: 2px;
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--muted);
}

.checkbox input {
  width: 18px;
  height: 18px;
}

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

button {
  border: none;
  border-radius: 999px;
  padding: 12px 20px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  background: var(--accent);
  color: white;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 12px 24px rgba(224, 108, 47, 0.25);
}

body[data-theme="dark"] button {
  box-shadow: 0 12px 24px rgba(224, 108, 47, 0.18);
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 28px rgba(224, 108, 47, 0.3);
}

button.ghost {
  background: transparent;
  color: var(--accent-strong);
  border: 1px solid rgba(224, 108, 47, 0.35);
  box-shadow: none;
}

body[data-theme="dark"] button.ghost {
  border-color: rgba(240, 153, 104, 0.4);
}

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

.status {
  min-height: 18px;
  color: var(--accent-cool);
  font-size: 14px;
}

.tabs {
  display: inline-flex;
  gap: 8px;
  padding: 6px;
  border-radius: 999px;
  border: 1px solid rgba(28, 26, 24, 0.08);
  background: rgba(255, 255, 255, 0.7);
  margin-bottom: 18px;
}

.range-bar {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
}

.range-modes {
  display: inline-flex;
  gap: 8px;
  padding: 6px;
  border-radius: 999px;
  border: 1px solid rgba(28, 26, 24, 0.08);
  background: rgba(255, 255, 255, 0.7);
}

.range-btn {
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border: none;
  box-shadow: none;
}

.range-btn.active {
  background: white;
  color: var(--ink);
  box-shadow: 0 10px 20px rgba(28, 26, 24, 0.1);
}

.range-controls {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(28, 26, 24, 0.08);
}

.range-nav {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.range-label {
  text-align: center;
}

.range-controls strong {
  display: block;
  font-size: 18px;
}

.range-custom {
  display: none;
  gap: 12px;
  align-items: end;
  grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
}

.range-bar.custom .range-custom {
  display: grid;
}

.tab {
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border: none;
  box-shadow: none;
}

.tab.active {
  background: white;
  color: var(--ink);
  box-shadow: 0 10px 20px rgba(28, 26, 24, 0.1);
}

.tab:hover {
  transform: none;
  box-shadow: none;
}

.status-banner {
  margin: 0 0 16px;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(44, 139, 109, 0.1);
  border: 1px solid rgba(44, 139, 109, 0.25);
  color: var(--accent-cool);
  font-size: 14px;
}

.status-banner:empty {
  display: none;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.totals {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.summary-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 18px;
  padding: 14px 16px;
  border: 1px solid rgba(28, 26, 24, 0.08);
}

body[data-theme="dark"] .summary-card {
  background: rgba(22, 20, 18, 0.92);
  border-color: rgba(255, 255, 255, 0.06);
}

.totals strong {
  display: block;
  font-size: 22px;
  color: var(--ink);
}

.label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.label-icon {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.label-icon-badge {
  position: relative;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: var(--goal-color, var(--accent));
}

.label-icon-badge::before {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 999px;
  background: conic-gradient(
    var(--goal-color, var(--accent)) calc(var(--goal-progress, 0) * 1turn),
    rgba(28, 26, 24, 0.12) 0
  );
  opacity: var(--goal-opacity, 0.25);
}

body[data-theme="dark"] .label-icon-badge::before {
  background: conic-gradient(
    var(--goal-color, var(--accent)) calc(var(--goal-progress, 0) * 1turn),
    rgba(255, 255, 255, 0.16) 0
  );
}

.label-icon-badge::after {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
}

body[data-theme="dark"] .label-icon-badge::after {
  background: rgba(14, 12, 10, 0.9);
}

.label-icon-svg {
  width: 12px;
  height: 12px;
  opacity: 0.7;
  position: relative;
  z-index: 1;
}

.summary-stat {
  --goal-progress: 0;
  --goal-opacity: 0.15;
}

.summary-stat.summary-calories {
  --goal-color: var(--accent);
}

.summary-stat.summary-entries {
  --goal-color: #f2b64a;
}

.summary-stat.summary-hydration {
  --goal-color: #57b6ff;
}

.summary-stat.goal-mid .label {
  color: var(--goal-color);
}

.summary-stat.goal-hit .label-icon-badge {
  box-shadow: 0 0 14px rgba(224, 108, 47, 0.35);
}

.summary-stat.summary-hydration.goal-hit .label-icon-badge {
  box-shadow: 0 0 16px rgba(87, 182, 255, 0.4);
}

.summary-stat.summary-entries.goal-hit .label-icon-badge {
  box-shadow: 0 0 14px rgba(242, 182, 74, 0.35);
}

.summary-stat.goal-hit strong {
  color: var(--goal-color);
}

.icon-wrap {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.icon {
  width: 22px;
  height: 22px;
}

.accent-hot {
  background: linear-gradient(135deg, #f07d4b, #d4521c);
}

.accent-lean {
  background: linear-gradient(135deg, #3a8c6f, #1f6c55);
}

.accent-carb {
  background: linear-gradient(135deg, #f2b64a, #dd8a21);
}

.accent-fat {
  background: linear-gradient(135deg, #5776d1, #354c9e);
}

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

.weekday {
  text-align: center;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.calendar-day {
  min-height: 86px;
  border-radius: 16px;
  padding: 10px;
  border: 1px solid rgba(28, 26, 24, 0.08);
  background: rgba(255, 255, 255, 0.85);
  display: grid;
  gap: 6px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.calendar-day:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(28, 26, 24, 0.12);
}

.calendar-day.muted {
  opacity: 0.35;
  cursor: default;
  box-shadow: none;
  transform: none;
}

.day-number {
  font-weight: 600;
  font-size: 14px;
}

.day-kcal {
  font-size: 13px;
  color: var(--muted);
}

.day-count {
  font-size: 12px;
  color: var(--accent-strong);
}

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

.insight-card {
  background: rgba(255, 255, 255, 0.85);
  border-radius: 18px;
  padding: 16px;
  border: 1px solid rgba(28, 26, 24, 0.08);
  display: grid;
  gap: 10px;
}

.chart-card {
  gap: 12px;
}

.chart-card svg {
  width: 100%;
  height: 80px;
  overflow: visible;
}

.chart-line {
  fill: none;
  stroke-width: 2.2;
}

.chart-area {
  fill: rgba(224, 108, 47, 0.16);
  stroke: none;
}

.line-kcal {
  stroke: #e06c2f;
}

.line-protein {
  stroke: #2c8b6d;
}

.line-carbs {
  stroke: #e06c2f;
}

.line-fat {
  stroke: #4c66c2;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  font-size: 12px;
  color: var(--muted);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-item::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.legend-item.protein::before {
  background: #2c8b6d;
}

.legend-item.carbs::before {
  background: #e06c2f;
}

.legend-item.fat::before {
  background: #4c66c2;
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

.macro-bars {
  display: grid;
  gap: 10px;
}

.macro-bar {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

.bar {
  height: 8px;
  background: rgba(28, 26, 24, 0.08);
  border-radius: 999px;
  overflow: hidden;
}

.bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
}

#macro-protein {
  background: #2c8b6d;
}

#macro-carbs {
  background: #e06c2f;
}

#macro-fat {
  background: #4c66c2;
}

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

.list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  color: var(--ink);
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(28, 26, 24, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 10;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: min(420px, 92vw);
  background: rgba(255, 255, 255, 0.96);
  border-left: 1px solid rgba(28, 26, 24, 0.1);
  transform: translateX(100%);
  transition: transform 0.25s ease;
  z-index: 11;
}

.drawer.open {
  transform: translateX(0);
}

.drawer-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.drawer-content {
  display: grid;
  gap: 18px;
  padding: 24px;
  height: 100%;
  overflow-y: auto;
}

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

.drawer-header h3 {
  margin: 4px 0 0;
  font-family: "Fraunces", serif;
}

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

.drawer-metrics div {
  background: rgba(224, 108, 47, 0.08);
  border-radius: 14px;
  padding: 12px;
  border: 1px solid rgba(224, 108, 47, 0.2);
}

.drawer-items {
  display: grid;
  gap: 10px;
}

.drawer-section {
  display: grid;
  gap: 10px;
}

.drawer-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.meal-summary {
  display: grid;
  gap: 10px;
}

.meal-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(28, 26, 24, 0.08);
}

.meal-chip span {
  font-size: 13px;
  color: var(--muted);
}

.meal-chip strong {
  font-size: 14px;
}

.items {
  display: grid;
  gap: 12px;
}

.item-card {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(28, 26, 24, 0.08);
}

body[data-theme="dark"] .item-card {
  background: rgba(22, 20, 18, 0.92);
  border-color: rgba(255, 255, 255, 0.06);
}

.log-section .item-card {
  padding: 12px 14px 12px 18px;
  background: rgba(255, 255, 255, 0.94);
  border-color: rgba(28, 26, 24, 0.12);
  box-shadow: 0 12px 24px rgba(28, 26, 24, 0.08);
  position: relative;
  overflow: hidden;
  margin-left: 6px;
}

.log-section .item-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 3px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--accent), transparent);
  opacity: 0.7;
}

body[data-theme="dark"] .log-section .item-card {
  background: rgba(14, 12, 10, 0.9);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.4);
}

body[data-theme="dark"] .log-section .item-card::before {
  background: linear-gradient(180deg, var(--accent-strong), transparent);
  opacity: 0.8;
}

.item-card span {
  font-size: 13px;
  color: var(--muted);
}

.item-card strong {
  font-size: 16px;
}

@media (min-width: 900px) {
  .metrics-card .overview-meta {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }

  .metrics-card .meta-note {
    justify-self: end;
    text-align: right;
  }
}

@media (max-width: 900px) {
  :root {
    --panel-width: 100%;
  }

  .hero {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px 12px;
  }

  .hero h1 {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 0;
  }

  .hero-badge {
    display: inline-flex;
  }

  .deck-controls {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .deck-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .deck-actions button {
    width: 100%;
  }

  .deck-controls .eyebrow {
    display: none;
  }

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

  .overview-grid {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    padding-bottom: 6px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .overview-grid::-webkit-scrollbar {
    display: none;
  }

  .overview-card {
    flex: 0 0 86%;
    min-width: 86%;
    scroll-snap-align: center;
    scroll-snap-stop: always;
    transition: transform 0.35s ease, box-shadow 0.35s ease;
  }

  .overview-card.is-active {
    transform: translateY(-2px) scale(1.01);
    box-shadow: 0 20px 44px rgba(0, 0, 0, 0.18);
  }

  .today-layout {
    grid-template-columns: 1fr;
  }

  .log-section .items {
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }

  .grid {
    min-height: clamp(480px, 78vh, 720px);
  }

  .grid.deck-active .panel {
    filter: none;
    transform: translateX(-50%) translateY(12px) scale(0.99);
  }

  .grid.deck-active .panel.is-active {
    transform: translateX(-50%) translateY(0) scale(1);
  }

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


  .range-controls {
    grid-template-columns: 1fr;
    justify-items: start;
  }
}

@media (max-width: 600px) {
  .shell {
    padding: 32px 18px 48px;
  }

  body {
    font-size: 17px;
  }

  h1 {
    font-size: 36px;
  }

  .subtitle {
    font-size: 17px;
  }

  .panel-header p {
    font-size: 16px;
  }

  .field {
    font-size: 16px;
  }

  textarea,
  select,
  input {
    font-size: 17px;
    padding: 14px 16px;
  }

  .checkbox {
    font-size: 16px;
  }

  .tabs,
  .range-modes {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
  }

  .tab,
  .range-btn {
    font-size: 14px;
    padding: 10px 16px;
  }

  .range-controls strong {
    font-size: 22px;
  }

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

  .label {
    font-size: 13px;
  }

  .overview-card {
    padding: 14px;
  }

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

  .metrics-card .overview-stat strong {
    font-size: 18px;
  }

  .metrics-card .overview-stat.emphasis {
    min-height: 112px;
  }

  .metrics-card .overview-stat.emphasis strong {
    font-size: 26px;
  }

  .metrics-card .overview-meta {
    font-size: 12px;
  }

  .status,
  .status-banner {
    font-size: 16px;
  }

  .summary-card strong {
    font-size: 22px;
  }

  .panel-date {
    font-size: 10px;
    padding: 5px 8px;
  }

  .item-card strong {
    font-size: 17px;
  }

  .item-card span,
  .list li,
  .day-kcal,
  .day-count,
  .weekday {
    font-size: 14px;
  }

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

  .deck-controls {
    gap: 10px;
  }

  .sync-row {
    flex-direction: column;
    align-items: stretch;
  }

  .tabs,
  .range-modes {
    width: 100%;
    justify-content: space-between;
  }

  .calendar-grid {
    gap: 6px;
  }

  .calendar-day {
    min-height: 70px;
  }

  .drawer {
    width: 100%;
  }
}

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