/* App shell */
.screen {
  height: 100vh;
  height: 100dvh;
  height: var(--app-height, 100dvh);
  max-width: 480px;
  margin: 0 auto;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.header {
  padding: 20px 22px 6px 22px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.header--split {
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: 14px;
}

.header-eyebrow {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--text-soft);
}

.header-title {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
}

.header-subtitle {
  font-size: 12.5px;
  color: var(--text-soft);
  margin-top: 2px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.icon-btn--lg {
  width: 38px;
  height: 38px;
  border-radius: 11px;
}

.content {
  flex-grow: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 22px 110px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-soft);
}

.section-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-soft);
  padding-left: 2px;
}

.section-label--danger {
  color: var(--terracotta);
}

/* Status badge */
.status-badge {
  display: inline-flex;
  align-self: flex-start;
  align-items: center;
  gap: 7px;
  border-radius: 100px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
}

.status-badge .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}

/* Progress */
.progress-track {
  position: relative;
  height: 10px;
  background: var(--border);
  border-radius: 100px;
}

.progress-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  border-radius: 100px;
  transition: width .3s ease;
}

.progress-marker {
  position: absolute;
  top: -3px;
  width: 2px;
  height: 16px;
  background: var(--text);
  border-radius: 2px;
}

.progress-caption {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-soft);
}

/* KPI row */
.kpi-row {
  display: flex;
  border-top: 1px solid var(--border);
  margin-top: 2px;
  padding-top: 12px;
}

.kpi-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.kpi-item + .kpi-item {
  border-left: 1px solid var(--border);
  padding-left: 14px;
}

.kpi-item-label {
  font-size: 11.5px;
  color: var(--text-soft);
}

.kpi-item-value {
  font-size: 16px;
  font-weight: 600;
}

/* Weight display */
.weight-display {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.weight-display .value {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 600;
}

.weight-display .unit {
  font-size: 14px;
  color: var(--text-soft);
}

/* Entry rows */
.entry-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 0;
  border-top: 1px solid var(--border);
}

.entry-row--wide {
  padding: 13px 0;
}

.entry-date {
  font-size: 14px;
  color: var(--text-soft);
}

.entry-row--wide .entry-date {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text);
}

.entry-note {
  font-size: 12px;
  color: var(--text-soft);
}

.entry-weight {
  font-size: 15px;
  font-weight: 600;
}

.entry-row--wide .entry-weight {
  font-size: 15.5px;
}

.entry-delta {
  font-size: 12.5px;
  font-weight: 600;
  min-width: 34px;
  text-align: right;
}

.delta-down { color: var(--green); }
.delta-up { color: var(--terracotta); }
.delta-none { color: var(--text-soft); }

.entry-actions {
  display: flex;
  gap: 4px;
}

.entry-icon-btn {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* FAB */
.fab {
  position: absolute;
  right: 22px;
  bottom: 86px;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(30, 27, 22, 0.25);
  border: none;
}

/* Tabbar */
.tabbar {
  flex-shrink: 0;
  height: 70px;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
}

.tabbar-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.tabbar-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted-icon);
}

.tabbar-item.active .tabbar-label {
  color: var(--text);
}

/* Buttons */
.btn {
  width: 100%;
  border-radius: var(--radius-button);
  padding: 17px;
  font-size: 16px;
  font-weight: 600;
  border: none;
}

.btn-primary {
  background: var(--text);
  color: #fff;
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1.5px solid var(--border);
}

.btn-danger-outline {
  background: var(--surface);
  color: var(--terracotta);
  border: 1.5px solid var(--terracotta);
  padding: 13px;
  font-size: 14.5px;
}

.btn-link {
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-soft);
  padding: 6px;
  background: none;
  border: none;
}

.btn-toggle {
  flex: 1;
  padding: 12px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}

.btn-toggle.active {
  border-color: var(--text);
  background: var(--text);
  color: #fff;
}

/* Inputs */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-soft);
}

.input {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-input);
  padding: 14px 16px;
  font-size: 16px;
  color: var(--text);
  width: 100%;
}

.input:focus {
  outline: 2px solid var(--blue);
  outline-offset: 1px;
}

.input-suffix-wrap {
  position: relative;
}

.input-suffix-wrap .input {
  padding-right: 38px;
}

.input-suffix {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 13px;
  color: var(--text-soft);
  pointer-events: none;
}

textarea.input {
  resize: none;
  font-size: 14.5px;
}

/* Info banner */
.info-banner {
  background: var(--blue-soft);
  border-radius: var(--radius-input);
  padding: 14px 16px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.info-banner .icon {
  margin-top: 2px;
  flex-shrink: 0;
}

.info-banner .text {
  font-size: 13px;
  color: #2A4E63;
  line-height: 1.5;
}

/* Errors */
.error-banner {
  background: var(--terracotta-soft);
  border-radius: var(--radius-input);
  padding: 14px 16px;
  font-size: 13px;
  color: var(--terracotta);
  line-height: 1.5;
}

/* Big weight input (add entry) */
.weight-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 36px 20px;
}

.weight-hero-input-wrap {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.weight-hero-input {
  width: 150px;
  border: none;
  background: transparent;
  font-family: var(--font-display);
  font-size: 64px;
  font-weight: 600;
  color: var(--text);
  text-align: right;
  outline: none;
}

.weight-hero-unit {
  font-size: 20px;
  color: var(--text-soft);
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(30, 27, 22, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  z-index: 50;
}

.modal-card {
  background: var(--surface);
  border-radius: 20px;
  padding: 26px 22px;
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
}

.modal-text {
  font-size: 14px;
  color: var(--text-soft);
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}

.modal-actions .btn {
  width: auto;
  flex: 1;
  padding: 13px;
  font-size: 14.5px;
  border-radius: 12px;
}

/* Balance card (net saldo across all projects) */
.balance-card {
  background: var(--text);
  border-radius: 16px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.balance-label {
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.65);
}

.balance-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
}

.balance-value {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 600;
  color: #fff;
}

.balance-sub {
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.65);
}

/* Clickable list rows (e.g. closed-project history) */
.history-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 0;
  border-top: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
}

.history-row:first-child {
  border-top: none;
}

.history-row-main {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.history-row-name {
  font-size: 14.5px;
  font-weight: 600;
}

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

/* Pill badges (outcome labels) */
.pill-badge {
  font-size: 11.5px;
  font-weight: 600;
  border-radius: 100px;
  padding: 4px 10px;
  white-space: nowrap;
  flex-shrink: 0;
}

.pill-badge--success {
  background: var(--green-soft);
  color: var(--green);
}

.pill-badge--neutral {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-soft);
}

/* Outcome preview banner (add-past-project live feedback) */
.outcome-preview {
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  gap: 10px;
  align-items: center;
}

.outcome-preview .icon {
  flex-shrink: 0;
}

.outcome-preview .text {
  font-size: 13px;
  line-height: 1.5;
}

.outcome-preview--reached {
  background: var(--green-soft);
}

.outcome-preview--reached .text {
  color: #2C4A38;
}

.outcome-preview--stopped {
  background: var(--bg);
  border: 1px solid var(--border);
}

.outcome-preview--stopped .text {
  color: var(--text-soft);
}

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

/* Two- or three-column field row (onboarding, add-past-project) */
.weight-row {
  display: flex;
  gap: 14px;
}

.weight-row .field {
  flex: 1;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--text-soft);
  z-index: 100;
}

[hidden] {
  display: none !important;
}
