/* Components — module rows, sheets, toast, forms */

.glass-module {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: 14px 16px;
  margin-bottom: 12px;
}

.award-row {
  display: flex;
  align-items: stretch;
  min-height: 68px;
  margin-bottom: 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-glass);
  box-shadow: var(--shadow-card);
  background: var(--bg-glass);
  cursor: pointer;
  text-align: left;
  width: 100%;
  padding: 0;
  color: inherit;
}

.award-row:not(:disabled) {
  transition: background 0.15s ease, border-color 0.15s ease;
}

.award-row:not(:disabled):hover {
  background: color-mix(in srgb, var(--bg-glass) 88%, var(--bg-glass-hover));
}

.award-row:not(:disabled):active {
  transform: scale(0.995);
}

.award-row--danger .award-row-title {
  color: var(--danger);
}

.award-row:disabled {
  opacity: 1;
  cursor: default;
}

.award-row:disabled .award-row-chevron {
  display: none;
}

.award-row-icon {
  width: 68px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-glass-hover);
  font-size: 28px;
}

.award-row--icon-inverted .award-row-icon {
  background: var(--award-row-icon-bg, var(--accent));
}

.award-row--icon-inverted .award-row-icon .tms-icon {
  color: var(--bg-glass);
}

.award-row-divider {
  width: 1px;
  background: var(--border-glass);
  opacity: 0.5;
}

.award-row-body {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}

.award-row-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.award-row-title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.25;
}

.award-row-new-pill {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  line-height: 1.2;
  color: var(--text-on-accent);
  background: var(--accent);
  animation: unlock-new-pulse 1.5s ease-in-out infinite;
}

@keyframes unlock-new-pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.78;
    transform: scale(0.97);
  }
}

.award-row-detail {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.35;
}

.award-row-chevron {
  align-self: center;
  padding-right: 12px;
  color: var(--text-muted);
  font-size: 18px;
}

/* Vertical stacks of module rows (Workouts, History, More) */
.module-list,
.exercise-module-list,
.more-modules,
.more-danger-zone {
  display: flex;
  flex-direction: column;
  gap: var(--module-list-gap);
}

.module-list > .award-row,
.module-list > .glass-module-row,
.exercise-module-list > .glass-module-row,
.more-modules > .award-row,
.more-danger-zone > .award-row {
  margin-bottom: 0;
}

.exercise-row {
  /* glass module card for workout exercises */
}

.exercise-row-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.exercise-row-name {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
}

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

.exercise-row-progress {
  height: 5px;
  border-radius: calc(var(--radius-sm) / 2);
  background: color-mix(in srgb, var(--border-glass) 40%, transparent);
  overflow: hidden;
  margin-top: 0;
}

.exercise-row-progress-fill {
  height: 100%;
  border-radius: calc(var(--radius-sm) / 2);
  background: linear-gradient(90deg, var(--accent), var(--accent-dark));
}

/* iOS-style sheet */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 8000;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.sheet-backdrop.is-open { opacity: 1; }

.sheet-panel {
  position: fixed;
  left: 50%;
  right: auto;
  bottom: 0;
  width: min(100%, var(--app-max-width));
  max-width: 100%;
  min-width: 0;
  height: 100dvh;
  max-height: 100dvh;
  background: var(--bg-app);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  z-index: 8001;
  display: flex;
  flex-direction: column;
  transform: translateX(-50%) translateY(100%);
  transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.25);
  padding-top: var(--safe-top);
}

.sheet-backdrop--priority {
  background: rgba(0, 0, 0, 0.58);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.sheet-panel--priority.sheet-panel--center {
  max-height: min(88dvh, 620px);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.38);
}

body.has-priority-sheet .app-tab-bar {
  pointer-events: none;
}

.sheet-panel.is-open { transform: translateX(-50%) translateY(0); }

.sheet-panel--center {
  top: 50%;
  left: 50%;
  right: auto;
  bottom: auto;
  width: min(var(--app-max-width), calc(100vw - 32px));
  height: auto;
  max-height: min(80dvh, 560px);
  padding-bottom: 0;
  border-radius: var(--radius-lg);
  transform: translate(-50%, -50%) scale(0.96);
  opacity: 0;
  transition: transform 0.25s cubic-bezier(0.32, 0.72, 0, 1), opacity 0.25s ease;
}

.sheet-panel--center.is-open {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}

.sheet-grabber {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--border-glass);
  margin: 8px auto 0;
  flex-shrink: 0;
}

.sheet-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  padding: 8px 12px 12px;
  border-bottom: 1px solid var(--border-glass);
  flex-shrink: 0;
}

.sheet-header-title {
  grid-column: 2;
  text-align: center;
  font-size: 16px;
  font-weight: 600;
  margin: 0;
}

.sheet-header-leading {
  justify-self: start;
}

.sheet-header-trailing {
  justify-self: end;
  display: flex;
  gap: 4px;
}

.sheet-header-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 10px;
  border: none;
  background: transparent;
  color: var(--accent);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  border-radius: var(--radius-sm);
}

.sheet-header-btn--icon {
  width: 36px;
  padding: 0;
}

.sheet-header-btn--primary {
  font-weight: 600;
}

.sheet-header-btn:hover { background: var(--bg-glass-hover); }

.sheet-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 16px;
  padding-bottom: calc(16px + var(--safe-bottom));
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.sheet-body:has(.add-exercise-sheet),
.sheet-body:has(.exercise-detail-sheet) {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 8px 10px 0;
}

.sheet-panel--center .sheet-body {
  padding-bottom: 16px;
}

.v2-form-group {
  margin-bottom: 16px;
}

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

.glass-section {
  padding: 14px;
  margin-bottom: 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
  background: var(--bg-glass);
  box-shadow: var(--shadow-card);
}

.glass-section-title {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--accent);
}

.glass-section-title--macro { color: var(--life-macro); }
.glass-section-title--sleep { color: var(--life-sleep); }
.glass-section-title--zen { color: var(--life-zen); }
.glass-section-title--reading { color: var(--life-reading); }

.life-goals-form {
  display: flex;
  flex-direction: column;
}

.life-goals-block {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.life-goals-block .v2-form-group:last-child {
  margin-bottom: 0;
}

.life-goals-section-title {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--accent);
}

.life-goals-section-title--macro { color: var(--life-macro); }
.life-goals-section-title--sleep { color: var(--life-sleep); }
.life-goals-section-title--zen { color: var(--life-zen); }
.life-goals-section-title--reading { color: var(--life-reading); }

.life-goals-section-desc {
  margin: 0 0 14px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-muted);
}

.life-goals-divider {
  margin: 18px 0;
  border: none;
  border-top: 1px solid var(--border-glass);
}

.life-trends-intro {
  margin: 0 0 16px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--text-muted);
}

.life-trends-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.life-trends-row {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
  background: var(--bg-glass);
}

.life-trends-row-head {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  padding: 0;
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.life-trends-row-main {
  flex: 1;
  min-width: 0;
}

.life-trends-row-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
}

.life-trends-row-goal {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--text-muted);
}

.life-trends-row-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.life-trends-row-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.life-trends-row-chevron {
  color: var(--text-muted);
  flex-shrink: 0;
  margin-top: 4px;
}

.life-trends-row-body {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid color-mix(in srgb, var(--border-glass) 60%, transparent);
}

.life-trends-chart-host {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.life-trends-row-body[hidden] {
  display: none;
}

.life-trends-empty {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  padding: 16px 8px;
}

.life-trends-log-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-top: 12px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--accent);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.profile-action-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.profile-action-btn {
  min-height: 72px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 8px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
  background: var(--bg-glass);
  color: inherit;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}

.profile-action-btn span:last-child {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
}

.new-workout-destinations {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.new-workout-dest {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
  background: var(--bg-glass);
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.new-workout-dest:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.new-workout-dest strong {
  display: block;
  font-size: 15px;
  margin-bottom: 2px;
}

.new-workout-dest-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.new-workout-dest-copy span {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
}

.skip-setup-link {
  display: block;
  width: 100%;
  margin-top: 12px;
  padding: 8px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  text-decoration: underline;
}

.wizard-bottom-bar {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border-glass);
}

.wizard-bottom-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-align: center;
}

.wizard-bottom-instruction {
  font-size: 14px;
  text-align: center;
  margin: 0 0 10px;
}

.add-exercise-chooser {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

.program-chooser-btn {
  min-height: 88px;
  padding: 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
  background: var(--bg-glass);
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.program-chooser-btn.is-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent);
}

.program-chooser-btn strong {
  display: block;
  margin-bottom: 4px;
}

.program-chooser-btn span {
  font-size: 12px;
  color: var(--text-muted);
}

.v2-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.v2-input {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--text-muted);
  border-color: color-mix(in srgb, var(--text-muted) 45%, transparent);
  background: var(--bg-input);
  color: var(--text-main);
}

.v2-input:focus {
  outline: none;
  border-color: var(--accent);
}

.v2-btn-row {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.v2-btn {
  flex: 1;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
  background: var(--bg-glass);
  color: var(--text-main);
  font-weight: 600;
  cursor: pointer;
}

.v2-btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--text-on-accent);
}

.v2-btn--danger {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 35%, transparent);
}

.v2-toast-host {
  position: fixed;
  top: calc(8px + var(--safe-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 9000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  pointer-events: none;
  width: min(420px, calc(100vw - 40px));
}

.v2-toast {
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--bg-glass) 92%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border-glass);
  box-shadow: var(--shadow-card);
  font-size: var(--type-body);
  font-weight: 400;
  line-height: 1.4;
  color: var(--text-main);
  text-align: center;
  word-wrap: break-word;
  white-space: normal;
  opacity: 0;
  transform: translateY(calc(-12px - var(--safe-top)));
  transition:
    opacity 0.38s cubic-bezier(0.25, 0.9, 0.3, 1),
    transform 0.48s cubic-bezier(0.33, 1.12, 0.32, 1);
  pointer-events: auto;
}

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

/* iOS uses one glass chrome for info, success, and warnings. */
.v2-toast--success,
.v2-toast--warn,
.v2-toast--error,
.v2-toast--info {
  background: color-mix(in srgb, var(--bg-glass) 92%, transparent);
  border-color: var(--border-glass);
  color: var(--text-main);
}

@media (prefers-reduced-motion: reduce) {
  .v2-toast {
    transform: none;
    transition: opacity 0.22s ease;
  }
}

.theme-toggle-row {
  display: flex;
  gap: 8px;
}

.theme-toggle-btn {
  flex: 1;
  padding: 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
  background: transparent;
  cursor: pointer;
  font-weight: 600;
  color: var(--text-muted);
}

.theme-toggle-btn.is-active {
  background: color-mix(in srgb, var(--accent) 18%, var(--bg-glass));
  color: var(--text-main);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border-glass));
}

.award-row-footnote {
  font-weight: 600;
  color: var(--accent);
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  padding-bottom: 16px;
}

.calendar-grid--history {
  gap: 6px;
}

.calendar-day-label {
  text-align: center;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 4px 0;
}

.calendar-day-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 28px;
  border: none;
  background: transparent;
  padding: 0;
  cursor: default;
}

.calendar-day-btn.is-tappable {
  cursor: pointer;
}

.calendar-day-btn.is-today .calendar-day-num {
  font-weight: 700;
}

.calendar-day-marker {
  position: absolute;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  pointer-events: none;
}

.calendar-day-btn[data-marker="workout"] .calendar-day-marker {
  background: color-mix(in srgb, var(--accent) 40%, transparent);
}

.calendar-day-btn[data-marker="workout"]:active .calendar-day-marker {
  background: var(--accent);
}

.calendar-day-btn[data-marker="data"] .calendar-day-marker {
  border: 2px solid color-mix(in srgb, var(--accent) 55%, transparent);
  background: transparent;
}

.calendar-day-num {
  position: relative;
  z-index: 1;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-main);
  line-height: 1;
}

.calendar-day-btn[data-marker="workout"] .calendar-day-num {
  color: var(--text-on-accent, #fff);
}

.calendar-day-btn[data-marker="data"] .calendar-day-num {
  color: var(--text-main);
}

.calendar-day-num--muted {
  color: var(--text-muted);
}

.calendar-cell {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-main);
  font-size: 13px;
  cursor: pointer;
}

.calendar-cell.is-other { opacity: 0.35; }
.calendar-cell.is-today { outline: 1px solid var(--accent); }
.calendar-cell.has-data { background: var(--bg-glass-hover); }

.calendar-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
}

.calendar-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.calendar-nav-label {
  font-weight: 600;
  font-size: 15px;
}

.calendar-cell:disabled {
  opacity: 0.4;
  cursor: default;
}

.v2-hint {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.45;
  margin: 0 0 12px;
}

.v2-textarea {
  min-height: 120px;
  resize: vertical;
  font-family: inherit;
}

.v2-btn--sm {
  padding: 6px 12px;
  font-size: 13px;
}

.v2-btn--with-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.v2-btn-row.data-settings-actions,
.v2-btn-row.archives-actions {
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.v2-btn-row.data-settings-actions .v2-btn--with-icon,
.v2-btn-row.archives-actions .v2-btn--with-icon {
  margin-bottom: 0;
}

.width-full { width: 100%; }

.setup-choice-card {
  display: block;
  width: 100%;
  text-align: left;
  padding: 16px;
  margin-bottom: 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
  background: var(--bg-glass);
  cursor: pointer;
  color: inherit;
}

.setup-choice-card strong {
  display: block;
  font-size: 15px;
  margin-bottom: 4px;
}

.setup-choice-card span {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.4;
}

.profile-edit-emoji-row {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.profile-emoji-pick {
  width: 56px;
  height: 56px;
  font-size: 28px;
  border-radius: var(--radius-md);
  border: 2px solid var(--border-glass);
  background: var(--bg-glass);
  cursor: pointer;
}

.profile-emoji-pick.is-active {
  border-color: var(--accent);
  background: rgba(96, 165, 250, 0.15);
}


.v2-first-run {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: var(--bg-app);
  overflow-y: auto;
  padding: calc(16px + var(--safe-top)) var(--app-gutter) calc(24px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  width: min(100%, var(--app-max-width));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--border-glass) 40%, transparent);
}

body.first-run-active { overflow: hidden; }

.first-run-inner {
  max-width: 100%;
  margin: 0 auto;
  padding: 0 4px;
}

.first-run-progress {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
}

.first-run-progress span {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: var(--border-glass);
}

.first-run-progress span.is-active {
  background: var(--accent);
}

.first-run-step-cap {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0 0 4px;
}

.first-run-headline {
  font-size: 22px;
  margin: 0 0 8px;
}

.first-run-sub {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.45;
  margin: 0 0 20px;
}

.first-run-panel { margin-bottom: 24px; }

.first-run-health {
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  max-height: 40vh;
  overflow-y: auto;
  padding: 12px;
  border-radius: var(--radius-md);
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  margin-bottom: 16px;
}

.first-run-agree {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 14px;
  margin-bottom: 16px;
  cursor: pointer;
}

.v2-first-run.is-intro-screen {
  display: flex;
  flex-direction: column;
}

.v2-first-run.is-intro-screen .first-run-intro-screen {
  flex: 1;
  min-height: 0;
}

.first-run-intro-screen {
  text-align: center;
  padding-top: 32px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-height: calc(100dvh - var(--safe-top) - var(--safe-bottom) - 40px);
}

.first-run-intro-top {
  flex-shrink: 0;
}

.first-run-intro-top .first-run-logo-mark {
  margin-bottom: 0;
}

.first-run-intro-bottom {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding-top: 24px;
  padding-bottom: 4px;
}

.first-run-app-row,
.app-promo-tiles {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: flex-start;
  gap: 10px;
  width: fit-content;
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 24px;
  padding: 0;
}

.first-run-app-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  width: 72px;
  flex: 0 0 auto;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text-main);
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.16s ease;
}

.first-run-app-tile:hover {
  transform: translateY(-2px);
}

.first-run-app-tile:active {
  transform: translateY(0) scale(0.96);
}

.first-run-app-tile-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 12px;
  box-shadow:
    0 6px 16px color-mix(in srgb, var(--shadow-card-color, #000) 16%, transparent),
    0 1px 0 color-mix(in srgb, #fff 16%, transparent) inset;
}

.first-run-app-tile-icon .tms-icon {
  color: var(--bg-glass);
}

.first-run-app-tile-label {
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  max-width: 72px;
}

.first-run-app-tile-note {
  font-size: 9px;
  font-weight: 500;
  color: var(--text-muted);
  line-height: 1.15;
  margin-top: -2px;
  text-align: center;
  max-width: 72px;
}

.first-run-app-tile--ios .first-run-app-tile-icon {
  background: var(--accent);
}

.first-run-app-tile--android .first-run-app-tile-icon {
  background: #4caf50;
}

.first-run-app-tile--paypal .first-run-app-tile-icon {
  background: #0070ba;
}

.first-run-intro-copy {
  margin-bottom: 14px;
}

.first-run-intro-copy:last-of-type {
  margin-bottom: 20px;
}

/* Level-up award */
.level-up-award {
  text-align: center;
  padding: 8px 4px 4px;
}

.level-up-award-badge {
  font-size: 3rem;
  line-height: 1;
  margin-bottom: 12px;
}

.level-up-award-kicker {
  margin: 0 0 4px;
  font-size: var(--type-caption);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.level-up-award-title {
  margin: 0 0 12px;
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
}

.level-up-award-copy {
  margin: 0 0 10px;
  font-size: var(--type-body);
  line-height: 1.45;
  color: var(--text-main);
}

.level-up-award-support {
  margin: 0 0 20px;
  font-size: var(--type-caption);
  line-height: 1.45;
  color: var(--text-muted);
}

.level-up-award .app-promo-tiles {
  margin-bottom: 20px;
}

.level-up-award-support + .app-promo-tiles {
  margin-top: 4px;
}

.profile-support-sheet {
  text-align: center;
  padding: 4px 4px 0;
}

.profile-support-sheet-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--danger) 14%, transparent);
  color: var(--danger);
}

.profile-support-sheet-title {
  margin: 0 0 10px;
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-main);
}

.profile-support-sheet-lead,
.profile-support-sheet-note {
  margin: 0 0 12px;
  font-size: var(--type-body);
  line-height: 1.5;
  color: var(--text-main);
  text-align: left;
}

.profile-support-sheet-subhead {
  margin: 0 0 8px;
  font-size: var(--type-body);
  font-weight: 600;
  line-height: 1.4;
  color: var(--text-main);
  text-align: left;
}

.profile-support-sheet-perks {
  margin: 0 0 14px;
  padding-left: 1.15rem;
  font-size: var(--type-body);
  line-height: 1.45;
  color: var(--text-muted);
  text-align: left;
}

.profile-support-sheet-perks li + li {
  margin-top: 6px;
}

.profile-support-sheet-note {
  font-size: var(--type-caption);
  color: var(--text-muted);
}

.profile-support-sheet .app-promo-tiles {
  margin-top: 4px;
}

/* Items detail sheet */
.unlock-item-sheet {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 4px 8px 0;
  min-height: 260px;
}

.unlock-item-preview-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 108px;
  margin-bottom: 8px;
}

.unlock-item-preview--emoji {
  font-size: 4.5rem;
  line-height: 1;
}

.unlock-item-preview--theme {
  display: flex;
  align-items: center;
  justify-content: center;
}

.unlock-item-preview--level {
  width: 92px;
  height: 92px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--accent);
}

.unlock-item-preview--generic {
  color: var(--accent);
}

.unlock-item-copy {
  width: 100%;
  max-width: 280px;
}

.unlock-item-headline {
  margin: 0 0 8px;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.15;
  color: var(--text-main);
}

.unlock-item-detail {
  margin: 0 0 8px;
  font-size: var(--type-body);
  line-height: 1.45;
  color: var(--text-main);
}

.unlock-item-date {
  margin: 0;
  font-size: var(--type-caption);
  line-height: 1.4;
  color: var(--text-muted);
}

.unlock-item-footer {
  width: 100%;
  margin-top: auto;
  padding-top: 28px;
  display: flex;
  justify-content: center;
}

.unlock-item-apply {
  min-width: 168px;
  max-width: min(100%, 240px);
}

.dev-tools-section-note {
  margin: -6px 0 10px;
  font-size: var(--type-caption);
  color: var(--text-muted);
  line-height: 1.4;
}

.first-run-intro-cta {
  margin-top: 0;
}

.first-run-intro-footer {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.first-run-intro-version {
  margin: 0;
  font-size: var(--type-caption);
  font-weight: 600;
  color: var(--text-muted);
}

.first-run-intro-legal-copy {
  margin: 0;
  font-size: var(--type-caption);
  line-height: 1.45;
  color: var(--text-muted);
}

.first-run-intro-legal {
  justify-content: center;
  margin-top: 2px;
}

.first-run-logo {
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
}

.first-run-intro-title {
  font-size: 28px;
  margin: 0 0 12px;
}

.first-run-back {
  margin-bottom: 8px;
}

.archives-item-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Program archives — folder module with file rows */
.archives-folder-module {
  padding: 0;
  overflow: hidden;
  margin-bottom: 0;
}

.archives-folder-module--compact .archives-folder-head {
  border-bottom: none;
}

.archives-folder-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-glass);
}

.archives-folder-head-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent);
}

.archives-folder-head-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  text-align: left;
}

.archives-folder-head-text strong {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
}

.archives-folder-head-text .v2-hint {
  margin: 0;
  line-height: 1.35;
}

.archives-folder-body {
  padding: 0;
}

.archives-folder-foot {
  padding: 12px;
  border-top: 1px solid var(--border-glass);
  background: color-mix(in srgb, var(--bg-glass) 88%, transparent);
}

.archives-folder-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 16px;
  text-align: center;
}

.archives-folder-empty p {
  margin: 0;
  font-size: 13px;
  line-height: 1.4;
  color: var(--text-muted);
}

.archives-folder-empty-icon {
  color: color-mix(in srgb, var(--accent) 55%, var(--text-muted));
  opacity: 0.85;
}

.archives-folder-more {
  margin: 0;
  padding: 8px 16px 12px;
  text-align: center;
}

.archives-file-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  min-height: 56px;
}

.archives-file-row + .archives-file-row {
  border-top: 1px solid color-mix(in srgb, var(--border-glass) 70%, transparent);
}

.archives-file-row--static {
  cursor: default;
}

.archives-file-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--bg-app) 55%, transparent);
  color: var(--accent);
}

.archives-file-meta {
  flex: 1;
  min-width: 0;
  text-align: left;
}

.archives-file-name {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--text-main);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.archives-file-detail {
  margin-top: 2px;
  font-size: 12px;
  line-height: 1.3;
  color: var(--text-muted);
}

.archives-file-actions {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 4px;
}

.archives-file-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--bg-glass) 90%, transparent);
  color: var(--accent);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.archives-file-action:hover {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}

.archives-file-action--danger {
  color: var(--danger);
}

.archives-file-action--danger:hover {
  background: color-mix(in srgb, var(--danger) 10%, transparent);
}

