.profile-card {
  background: var(--gray-900);
  border: 1px solid var(--gray-800);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-4);
  width: 100%;
  overflow: hidden;
}

.dp-sheet {
  position: fixed;
  inset: 0;
  max-width: var(--app-width);
  margin: 0 auto;
  z-index: 200;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}

.dp-sheet.open {
  opacity: 1;
  pointer-events: auto;
}

.dp-backdrop {
  position: absolute;
  inset: 0;
  background: var(--backdrop);
}

.dp-panel {
  position: relative;
  z-index: 1;
  background: var(--gray-900);
  border-top: 1px solid var(--gray-800);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: var(--space-5) var(--space-4);
  padding-bottom: calc(var(--space-5) + env(safe-area-inset-bottom));
  transform: translateY(20px);
  transition: transform 0.28s ease;
}

.dp-sheet.open .dp-panel {
  transform: translateY(0);
}

.dp-pickers {
  display: flex;
  gap: var(--space-4);
  justify-content: center;
  margin-bottom: var(--space-5);
}

.dp-col-wrap {
  flex: 1;
  position: relative;
  height: 168px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.dp-list {
  height: 168px;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  width: 100%;
  position: relative;
  z-index: 1;
}

.dp-list::-webkit-scrollbar {
  display: none;
}

.dp-item {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--type-heading);
  font-weight: 500;
  color: var(--gray-600);
  scroll-snap-align: start;
  font-family: var(--font-mono);
  transition: color 0.15s ease, font-size 0.15s ease;
  cursor: pointer;
}

.dp-item--selected {
  color: var(--text);
  font-size: var(--type-heading);
  font-weight: 700;
}

.dp-padding {
  pointer-events: none;
}

.dp-mask {
  position: absolute;
  left: 0;
  right: 0;
  height: 56px;
  pointer-events: none;
  z-index: 2;
}

.dp-mask-top {
  top: 0;
  background: linear-gradient(to bottom, var(--gray-900) 0%, transparent 100%);
}

.dp-mask-bottom {
  bottom: 0;
  background: linear-gradient(to top, var(--gray-900) 0%, transparent 100%);
}

.dp-selector {
  position: absolute;
  top: 50%;
  left: var(--space-2);
  right: var(--space-2);
  margin-top: -28px;
  height: 56px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  pointer-events: none;
  z-index: 3;
}

.dp-selector-line {
  height: 1px;
  background: var(--gray-700);
  width: 100%;
}

.pi-inline-form {
  display: contents;
}

.pi-sheet {
  position: fixed;
  inset: 0;
  max-width: var(--app-width);
  margin: 0 auto;
  z-index: 200;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}

.pi-sheet.open {
  opacity: 1;
  pointer-events: auto;
}

.pi-backdrop {
  position: absolute;
  inset: 0;
  background: var(--backdrop);
}

.pi-panel {
  position: relative;
  z-index: 1;
  background: var(--gray-900);
  border-top: 1px solid var(--gray-800);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: var(--space-5) var(--space-5);
  padding-bottom: calc(var(--space-5) + env(safe-area-inset-bottom));
  transform: translateY(20px);
  transition: transform 0.28s ease;
}

.pi-sheet.open .pi-panel {
  transform: translateY(0);
}

.pi-panel--options {
  padding-top: var(--space-3);
}

.pi-drag-handle {
  width: 36px;
  height: 4px;
  background: var(--gray-700);
  border-radius: 2px;
  margin: 0 auto var(--space-4);
}

.pi-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: var(--space-4) 0;
  background: none;
  border: none;
  border-top: 1px solid var(--gray-800);
  cursor: pointer;
  min-height: 52px;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.1s ease;
}

.pi-option:first-of-type {
  border-top: none;
}

.pi-option:hover {
  background: var(--gray-800);
}

.pi-option-label {
  font-size: var(--type-body);
  font-weight: 500;
  color: var(--text);
  font-family: var(--font-mono);
}

.pi-option-check {
  color: var(--blue-500);
  opacity: 0;
  transition: opacity 0.15s ease;
  flex-shrink: 0;
}

.pi-option-check--visible {
  opacity: 1;
}

.pi-panel--picker {
  padding-top: var(--space-5);
}

.pi-panel--picker .dp-col-wrap {
  width: 200px;
  margin: 0 auto var(--space-5);
}

.reminder-toggle-row {
  cursor: default;
  border-top: none;
}

.reminder-toggle-row:hover {
  background: none;
}

.reminder-toggle {
  position: relative;
  width: 51px;
  height: 31px;
  background: var(--gray-700);
  border: none;
  border-radius: 16px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.22s ease;
  -webkit-tap-highlight-color: transparent;
  padding: 0;
}

.reminder-toggle--on {
  background: var(--blue-500);
}

.reminder-toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 25px;
  height: 25px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.22s ease;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.reminder-toggle--on .reminder-toggle-thumb {
  transform: translateX(20px);
}

.dp-col-sep {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--type-heading);
  font-weight: 700;
  color: var(--text);
  font-family: var(--font-mono);
  padding-bottom: var(--space-5);
  flex-shrink: 0;
}

.reminder-test-btn {
  display: block;
  width: 100%;
  padding: var(--space-4);
  background: var(--gray-900);
  border: 1px solid var(--gray-800);
  border-radius: var(--radius-lg);
  color: var(--blue-500);
  font-size: var(--type-body);
  font-weight: 600;
  font-family: var(--font-mono);
  cursor: pointer;
  min-height: 52px;
  margin-bottom: var(--space-4);
  transition: background 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}

.reminder-test-btn:hover {
  background: var(--gray-800);
}

.reminder-test-btn--secondary {
  color: var(--gray-400);
  margin-top: calc(-1 * var(--space-2));
}

.reminder-hint {
  font-size: var(--type-label);
  color: var(--gray-600);
  line-height: 1.6;
  text-align: center;
  padding: var(--space-3) var(--space-4);
  margin-top: var(--space-2);
}

.pi-field-error {
  font-size: var(--type-label);
  color: var(--danger);
  min-height: 1.25rem;
  padding: 0 var(--space-1) var(--space-2);
  margin: 0;
}

.settings-header {
  display: flex;
  align-items: center;
  width: 100%;
  margin-bottom: var(--space-4);
}

.settings-header h1 {
  flex: 1;
  margin: 0;
  font-size: var(--type-heading);
  text-align: center;
}

.settings-header::after {
  content: "";
  width: 44px;
  flex-shrink: 0;
}

.settings-back {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  color: var(--text);
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

.account-section-title {
  margin: var(--space-6) 0 var(--space-3);
  font-size: var(--type-heading);
  font-weight: 700;
  color: var(--text);
}

.account-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  min-height: 72px;
  padding: var(--space-3) var(--space-5);
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.account-row--bordered {
  border-top: 1px solid var(--gray-800);
}

.account-row--static {
  cursor: default;
}

.account-row-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.account-row-label {
  font-size: var(--type-body);
  font-weight: 600;
  color: var(--text);
}

.account-row-value {
  font-size: var(--type-label);
  color: var(--gray-500);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-row-edit {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 var(--space-5);
  border-radius: 999px;
  background: var(--gray-800);
  color: var(--text);
  font-size: var(--type-body);
  font-weight: 600;
  flex-shrink: 0;
}

.pi-sheet-header {
  display: flex;
  align-items: center;
  margin-bottom: var(--space-5);
}

.pi-sheet-header::after {
  content: "";
  width: 44px;
  flex-shrink: 0;
}

.pi-sheet-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: none;
  background: none;
  color: var(--text);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.pi-sheet-title {
  flex: 1;
  margin: 0;
  font-size: var(--type-heading);
  font-weight: 700;
  text-align: center;
  color: var(--text);
}

.pi-form-group {
  margin-bottom: var(--space-4);
}

.pi-input-label {
  display: block;
  margin-bottom: var(--space-2);
  font-size: var(--type-body);
  font-weight: 600;
  color: var(--text);
}

.pi-text-input {
  display: block;
  width: 100%;
  min-height: 52px;
  padding: var(--space-3) var(--space-4);
  border: none;
  border-radius: var(--radius-md);
  background: var(--gray-800);
  outline: none;
  font-size: var(--type-input);
  color: var(--text);
  caret-color: var(--text);
}

.pi-text-input:focus {
  box-shadow: 0 0 0 2px var(--gray-600);
}

.pi-text-input::placeholder {
  color: var(--gray-500);
}

.pi-btn-save {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 56px;
  margin-top: var(--space-2);
  border: none;
  border-radius: var(--radius-lg);
  background: var(--btn-primary-bg);
  color: var(--btn-primary-text);
  font-size: var(--type-body);
  font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.pi-btn-save:active {
  opacity: 0.85;
}

.pi-panel,
.dp-panel {
  border-radius: 24px 24px 0 0;
}

.pi-panel--form {
  padding-top: var(--space-3);
}

.pi-panel--form .pi-drag-handle,
.dp-panel .pi-drag-handle {
  margin-bottom: var(--space-3);
}

.pi-option-check {
  color: var(--text);
}

.unit-option {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  min-height: 64px;
  padding: 0 var(--space-5);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.unit-option + .unit-option {
  border-top: 1px solid var(--gray-800);
}

.unit-option input {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
}

.unit-option-label {
  flex: 1;
  font-size: var(--type-body);
  font-weight: 500;
  color: var(--text);
}

.unit-option-radio {
  position: relative;
  width: 28px;
  height: 28px;
  border: 2.5px solid var(--gray-500);
  border-radius: 50%;
  flex-shrink: 0;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.unit-option:has(input:checked) .unit-option-radio {
  background: var(--btn-primary-bg);
  border-color: var(--btn-primary-bg);
}

.unit-option:has(input:checked) .unit-option-radio::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--btn-primary-text);
  transform: translate(-50%, -50%);
}

.theme-editor {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding: 0 var(--space-4) var(--space-6);
}

.theme-editor-preview {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-4);
  border-radius: 16px;
  background: var(--theme-bg);
  color: var(--theme-text);
  border: 1px solid color-mix(in srgb, var(--theme-text) 15%, var(--theme-bg));
}

.theme-editor-preview-title {
  font-size: var(--type-heading);
  font-weight: 700;
}

.theme-editor-preview-muted {
  font-size: var(--type-label);
  color: var(--theme-muted);
}

.theme-editor-preview-row {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.theme-editor-preview-card,
.theme-editor-preview-accent,
.theme-editor-preview-button {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border-radius: 10px;
  font-size: var(--type-label);
  font-weight: 700;
}

.theme-editor-preview-card {
  background: var(--theme-surface);
  border: 1px solid color-mix(in srgb, var(--theme-text) 15%, var(--theme-bg));
}

.theme-editor-preview-accent {
  background: var(--theme-accent);
  color: var(--theme-accent-text);
}

.theme-editor-preview-button {
  background: var(--theme-text);
  color: var(--theme-bg);
}

.theme-editor-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: var(--type-label);
  font-weight: 600;
  color: var(--gray-500);
}

.theme-editor-field select {
  min-height: 48px;
  padding: 0 var(--space-3);
  border: 1px solid var(--gray-800);
  border-radius: var(--radius-md);
  background: var(--gray-900);
  color: var(--text);
  font: inherit;
  font-size: var(--type-input);
}

.theme-editor-colours {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.theme-editor-colour {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 56px;
  padding: 0 var(--space-3) 0 var(--space-4);
  border-radius: var(--radius-lg);
  background: var(--gray-900);
  cursor: pointer;
}

.theme-editor-colour-label {
  flex: 1;
  font-size: var(--type-body);
  font-weight: 600;
}

.theme-editor-colour-hex {
  font-size: var(--type-label);
  color: var(--gray-500);
  font-variant-numeric: tabular-nums;
}

.theme-editor-colour input[type="color"] {
  width: 44px;
  height: 44px;
  padding: 0;
  border: 2px solid var(--gray-800);
  border-radius: 50%;
  background: none;
  cursor: pointer;
}

.theme-editor-colour input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

.theme-editor-colour input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: 50%;
}

.theme-editor-group {
  margin: var(--space-2) 0 0;
  font-size: var(--type-caption);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gray-500);
}

.theme-editor-preview-bars {
  display: flex;
  gap: 6px;
  margin-top: var(--space-2);
}

.theme-editor-preview-bar {
  flex: 1;
  height: 6px;
  border-radius: 3px;
}

.theme-editor-preview-bar--green { background: var(--theme-green); }
.theme-editor-preview-bar--protein { background: var(--theme-protein); }
.theme-editor-preview-bar--fat { background: var(--theme-fat); }
.theme-editor-preview-bar--carbs { background: var(--theme-carbs); }

.units-card {
  padding: 0;
}

.unit-row {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: "title seg" "example seg";
  align-items: center;
  column-gap: var(--space-3);
  min-height: 64px;
  margin: 0;
  padding: var(--space-3) var(--space-4);
  border: none;
}

.unit-row--wide {
  grid-template-columns: 1fr;
  grid-template-areas: "title" "example" "seg";
  row-gap: 2px;
}

.unit-row--wide .unit-seg {
  margin-top: var(--space-2);
}

.unit-row--wide .unit-seg-option {
  flex: 1;
}

.unit-row + .unit-row {
  border-top: 1px solid var(--gray-800);
}

.unit-row-title {
  grid-area: title;
  float: left;
  padding: 0;
  font-size: var(--type-body);
  font-weight: 600;
  color: var(--text);
}

.unit-row-examples {
  grid-area: example;
  font-size: var(--type-label);
  color: var(--gray-500);
  font-variant-numeric: tabular-nums;
}

.unit-example--1,
.unit-example--2,
.unit-row:has(.unit-seg-option--1 input:checked) .unit-example--0,
.unit-row:has(.unit-seg-option--2 input:checked) .unit-example--0 {
  display: none;
}

.unit-row:has(.unit-seg-option--1 input:checked) .unit-example--1,
.unit-row:has(.unit-seg-option--2 input:checked) .unit-example--2 {
  display: inline;
}

.unit-seg {
  grid-area: seg;
  display: flex;
  padding: 3px;
  border-radius: 999px;
  background: var(--gray-800);
}

.unit-seg-option {
  position: relative;
  margin: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.unit-seg-option input {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
}

.unit-seg-option span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  min-height: 38px;
  padding: 0 var(--space-3);
  border-radius: 999px;
  font-size: var(--type-label);
  font-weight: 600;
  color: var(--gray-400);
  transition: background 0.15s ease, color 0.15s ease;
}

.unit-seg-option input:checked + span {
  background: var(--text);
  color: var(--bg);
}

.unit-seg-option input:focus-visible + span {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

.units-note {
  margin: var(--space-3) var(--space-1) 0;
  font-size: var(--type-label);
  line-height: 1.5;
  color: var(--gray-500);
}
