/* Cards, buttons, forms, chips, lists — the pieces every screen is built from. */

.card {
  background: var(--paper);
  border-radius: 24px;
  padding: 18px 16px;
}
.card--tight { padding: 0 16px; }
.card--stack { display: flex; flex-direction: column; gap: 14px; }
.card--selected { border: 2px solid var(--forest); padding: 16px; }
.card__title { font-size: 15px; font-weight: 600; color: var(--ink2); }

.section { display: flex; flex-direction: column; gap: 8px; }
.section__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.section__heading {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--display);
  font-size: 19px;
  font-weight: 700;
}

/* Buttons ------------------------------------------------------------ */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: 22px;
  background: var(--track);
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
  text-align: center;
}
.button--primary { background: var(--forest); color: var(--cream); font-weight: 700; }
.button--primary:hover { background: var(--forest-deep); color: var(--cream); }
.button--soft { background: var(--forest-soft); color: var(--forest-deep); font-weight: 700; }
.button--cream { background: var(--cream); color: var(--forest-deep); font-weight: 700; }
.button--outline { background: transparent; border: 1.5px solid #7FA08C; color: var(--cream); }
.button--danger { background: transparent; color: var(--loss); font-weight: 700; }
.button--tall { height: 54px; border-radius: 27px; font-size: 16px; }
.button--huge { height: 60px; border-radius: 30px; font-size: 18px; font-weight: 700; }
.button--block { display: flex; width: 100%; }
.button--grow { flex-grow: 1; }
.button--small { height: 36px; padding: 0 12px; border-radius: 18px; font-size: 14px; font-weight: 700; }
.button--icon { width: 44px; height: 44px; padding: 0; border-radius: 22px; background: var(--paper); }
.button:disabled { opacity: .45; cursor: default; }

.link-action {
  font-size: 15px;
  font-weight: 700;
  padding: 10px 0;
  display: inline-block;
  background: none;
  border: 0;
}

/* Forms -------------------------------------------------------------- */

.field { display: block; }
.field__label {
  display: block;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 6px;
}
.field__hint { margin-top: 6px; font-size: 14px; color: var(--ink2); }
.field__error { margin-top: 6px; font-size: 14px; font-weight: 600; color: var(--loss); }

.input, .select, .textarea {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border: 1.5px solid var(--field);
  border-radius: 14px;
  background: var(--paper);
  /* 16px keeps iOS from zooming the viewport on focus. */
  font-size: 16px;
}
.textarea { height: auto; padding: 12px 14px; line-height: 1.4; resize: vertical; }
.input:focus-visible, .select:focus-visible, .textarea:focus-visible {
  outline: 2px solid var(--forest);
  outline-offset: 1px;
  border-color: var(--forest);
}
.input--flagged { border: 2px solid var(--loss); }

.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.field-row__unit { display: flex; align-items: center; gap: 8px; }
.field-row__unit .input { min-width: 0; }
.field-row__unit span { font-size: 15px; color: var(--ink2); }

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  font-size: 16px;
}
.checkbox-row + .checkbox-row { border-top: 1px solid var(--line); }
.checkbox-row input[type="checkbox"] {
  width: 22px; height: 22px; margin: 0; accent-color: var(--forest); flex-shrink: 0;
}

.switch-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.switch-row__label { font-size: 15px; font-weight: 700; }
.switch {
  width: 56px; height: 34px; border: 0; border-radius: 17px;
  background: var(--track); position: relative; padding: 0; flex-shrink: 0;
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 28px; height: 28px; border-radius: 14px; background: var(--paper);
  box-shadow: 0 1px 2px rgba(0,0,0,.2);
  transition: left .15s ease;
}
.switch[aria-checked="true"] { background: var(--forest); }
.switch[aria-checked="true"]::after { left: 25px; background: var(--cream); }

/* Choice chips — the kind picker. A radio group that looks like buttons. */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 20px;
  background: var(--track);
  font-size: 15px;
  font-weight: 600;
}
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip:has(input:checked), .chip[aria-pressed="true"] {
  background: var(--forest);
  color: var(--cream);
  font-weight: 700;
}
.chip:has(input:focus-visible) { outline: 2px solid var(--forest); outline-offset: 2px; }
.chip--large { height: 42px; border-radius: 21px; padding: 0 14px 0 10px; }

/* Badges ------------------------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.badge--gain { background: var(--gain-soft); color: var(--gain); }
.badge--loss { background: var(--loss-soft); color: var(--loss); }
.badge--forest { background: var(--forest-soft); color: var(--forest-deep); }
.badge--running { background: var(--forest); color: var(--fern); }
.badge--quiet { color: var(--ink2); }

.dot { width: 7px; height: 7px; border-radius: 4px; background: currentColor; }
.dot--pulsing { animation: pulse 2.4s ease-in-out infinite; }

/* Rows --------------------------------------------------------------- */

.rows { background: var(--paper); border-radius: 22px; padding: 0 16px; }
.row {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 14px 0;
  color: var(--ink);
}
.row + .row, .rows > * + * { border-top: 1px solid var(--line); }
.row__body { flex-grow: 1; min-width: 0; }
.row__title { font-size: 16px; font-weight: 700; }
.row__subtitle { font-size: 14px; color: var(--ink2); }
.row__meta { text-align: right; flex-shrink: 0; }
.row__meta-value { font-family: var(--display); font-size: 16px; font-weight: 700; }
.row__meta-caption { font-size: 13px; color: var(--ink2); }
.row__chevron { flex-shrink: 0; color: var(--ink2); }

/* The coloured spine that tells billable from included from internal at a
   glance, on every list in the app. */
.spine { width: 10px; height: 36px; border-radius: 5px; flex-shrink: 0; }
.spine--billable { background: var(--forest); }
.spine--included { background: var(--sage); }
.spine--internal { background: var(--sand); }

.avatar {
  width: 40px; height: 40px; flex-shrink: 0;
  border-radius: 20px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--display); font-size: 15px; font-weight: 800;
  background: var(--forest-soft); color: var(--forest-deep);
}
.avatar--client { background: var(--fern-soft); }
.avatar--internal { background: #EFEBE0; }

/* Notices ------------------------------------------------------------ */

.notice {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 20px;
  background: var(--forest-soft);
  color: var(--ink);
  font-size: 15px;
}
.notice--alert { background: var(--loss-soft); }
.notice__icon {
  width: 34px; height: 34px; flex-shrink: 0;
  border-radius: 17px;
  background: var(--forest); color: #FFF;
  display: flex; align-items: center; justify-content: center;
}
.notice--alert .notice__icon { background: var(--loss); }
.notice__body { flex-grow: 1; min-width: 0; }
.notice__title { font-size: 15px; font-weight: 700; }
.notice__subtitle { font-size: 14px; color: var(--ink2); }

.empty {
  padding: 24px 16px;
  text-align: center;
  color: var(--ink2);
  font-size: 15px;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink2);
}
.legend__item { display: flex; align-items: center; gap: 6px; }
.legend__swatch { width: 10px; height: 10px; border-radius: 3px; }
.legend__swatch--billable { background: var(--forest); }
.legend__swatch--included { background: var(--sage); }
.legend__swatch--internal { background: var(--sand); }
.legend__swatch--income { background: var(--gain); }
.legend__swatch--expenses { background: var(--loss); }

.stepper {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border-radius: 24px;
  background: var(--paper);
}
.stepper__button {
  width: 40px; height: 40px;
  border: 0; border-radius: 20px; background: transparent;
  display: flex; align-items: center; justify-content: center;
}
.stepper__button:disabled { color: var(--muted-mark); }
.stepper__value {
  font-family: var(--display); font-size: 17px; font-weight: 700;
  min-width: 44px; text-align: center;
}
