/* ============================================================
   Service Trade Tracker — mobile-first styling
   Layered on top of Bootstrap 5 (reset + utilities only).
   ============================================================ */

:root {
  --teal:        #0d9488;
  --teal-dark:   #0f766e;
  --emerald:     #059669;
  --violet:      #7c6cf0;
  --violet-dark: #6d5de0;

  --bg:    #eef3f4;
  --card:  #ffffff;
  --ink:   #0f1f24;
  --muted: #5b7079;
  --line:  #e3eaec;

  --plus:  #0f766e;
  --minus: #d6446b;

  --radius:    20px;
  --radius-sm: 14px;
  --shadow:    0 6px 22px rgba(15, 60, 70, 0.10);
  --shadow-sm: 0 2px 10px rgba(15, 60, 70, 0.08);

  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { -webkit-tap-highlight-color: transparent; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

/* ---- App shell ---------------------------------------------------------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 18px 12px;
  background: rgba(238, 243, 244, 0.9);
  backdrop-filter: saturate(150%) blur(8px);
}
.app-header__title { font-weight: 700; font-size: 18px; letter-spacing: -0.01em; }
.app-header__logout {
  font-size: 14px; font-weight: 600; color: var(--muted);
  text-decoration: none; padding: 6px 10px; border-radius: 999px;
}
.app-header__logout:active { background: rgba(0,0,0,0.05); }

.app-main {
  max-width: 560px;
  margin: 0 auto;
  padding: 10px 18px calc(96px + var(--safe-bottom));
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.page-title { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; margin: 8px 2px 16px; }

/* ---- Balance card ------------------------------------------------------- */
.balance-card {
  margin: 6px 0 18px;
  padding: 28px 24px 30px;
  border-radius: 26px;
  color: #fff;
  text-align: center;
  background: linear-gradient(150deg, #14b8a6 0%, var(--teal) 45%, var(--emerald) 100%);
  box-shadow: 0 12px 30px rgba(13, 148, 136, 0.34);
}
.balance-card__label {
  margin: 0; font-size: 14px; font-weight: 600; letter-spacing: 0.04em;
  text-transform: uppercase; opacity: 0.85;
}
.balance-card__value {
  margin: 6px 0 2px; font-size: 76px; font-weight: 800; line-height: 1;
  letter-spacing: -0.03em;
}
.balance-card__unit { font-size: 24px; font-weight: 600; opacity: 0.85; margin-left: 8px; }
.balance-card__equiv { margin: 0; font-size: 16px; font-weight: 500; opacity: 0.95; }

/* ---- Big action buttons ------------------------------------------------- */
.action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 24px;
}
.btn-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 132px;
  padding: 18px 10px;
  border-radius: var(--radius);
  text-decoration: none;
  color: #fff;
  box-shadow: var(--shadow);
  transition: transform 0.08s ease;
}
.btn-action:active { transform: scale(0.97); }
.btn-action--clean   { background: linear-gradient(155deg, #14b8a6, var(--teal-dark)); }
.btn-action--massage { background: linear-gradient(155deg, #8b7cf6, var(--violet-dark)); }
.btn-action__icon { font-size: 34px; line-height: 1; }
.btn-action__text { font-size: 18px; font-weight: 700; }
.btn-action__hint { font-size: 13px; font-weight: 500; opacity: 0.85; }

/* ---- Panels & ledger ---------------------------------------------------- */
.panel { margin-top: 6px; }
.panel__head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: 0 2px 10px;
}
.panel__title { font-size: 18px; font-weight: 700; margin: 0; }
.panel__link { font-size: 14px; font-weight: 600; color: var(--teal-dark); text-decoration: none; }

.ledger { list-style: none; margin: 0; padding: 0; }
.ledger:not(.ledger--full) .ledger__row { background: var(--card); border-radius: var(--radius-sm); margin-bottom: 8px; box-shadow: var(--shadow-sm); }
.ledger--full { overflow: hidden; padding: 4px 0; }

.ledger__row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 15px;
}
.ledger--full .ledger__row + .ledger__row { border-top: 1px solid var(--line); }
.ledger__icon {
  flex: 0 0 40px; height: 40px; width: 40px;
  display: grid; place-items: center;
  font-size: 20px; border-radius: 12px; background: #f0f5f6;
}
.ledger__main { flex: 1 1 auto; display: flex; flex-direction: column; min-width: 0; }
.ledger__type { font-weight: 650; font-size: 16px; }
.ledger__meta { font-size: 13px; color: var(--muted); }
.ledger__amt { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 18px; white-space: nowrap; }
.ledger__amt.is-plus  { color: var(--plus); }
.ledger__amt.is-minus { color: var(--minus); }

.ledger__del { margin: 0 0 0 2px; }
.ledger__del-btn {
  border: none; background: transparent; color: #b9c6cb;
  font-size: 16px; line-height: 1; padding: 8px; border-radius: 10px; cursor: pointer;
}
.ledger__del-btn:active { background: #f1f5f6; color: var(--minus); }

.empty { text-align: center; color: var(--muted); padding: 28px 16px; }

/* ---- Forms -------------------------------------------------------------- */
.form-head { display: flex; align-items: center; gap: 6px; margin: 4px 0 16px; }
.form-head__back {
  font-size: 30px; line-height: 1; text-decoration: none; color: var(--teal-dark);
  width: 40px; height: 40px; display: grid; place-items: center; margin-left: -8px;
}
.form-head__title { font-size: 24px; font-weight: 800; margin: 0; letter-spacing: -0.02em; }

.form-card { padding: 20px 18px 22px; }
.form-note {
  margin: 18px 2px 20px; font-size: 14px; color: var(--muted);
  background: #f1f6f6; padding: 12px 14px; border-radius: 12px;
}
.form-note strong { color: var(--ink); }

.field { display: block; margin-bottom: 18px; }
.field__label {
  display: block; font-size: 13px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--muted); margin-bottom: 8px;
}
.field__input {
  width: 100%; box-sizing: border-box;
  padding: 14px 14px; font-size: 17px;
  border: 1.5px solid var(--line); border-radius: 14px; background: #fff; color: var(--ink);
}
.field__input:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(13,148,136,0.15); }

/* Segmented control (radio buttons styled as a row of pills) */
.segmented { display: flex; gap: 8px; }
.segmented--lg .segmented__btn { padding: 18px 10px; font-size: 18px; }
.segmented__input { position: absolute; opacity: 0; pointer-events: none; }
.segmented__btn {
  flex: 1 1 0; text-align: center; cursor: pointer;
  padding: 14px 10px; font-size: 16px; font-weight: 650;
  border: 1.5px solid var(--line); border-radius: 14px; background: #fff; color: var(--ink);
  transition: all 0.12s ease;
}
.segmented__input:checked + .segmented__btn {
  background: var(--teal); border-color: var(--teal); color: #fff;
  box-shadow: 0 4px 12px rgba(13,148,136,0.3);
}
.segmented__input:focus-visible + .segmented__btn { box-shadow: 0 0 0 3px rgba(13,148,136,0.25); }

/* ---- Buttons ------------------------------------------------------------ */
.btn-primary {
  --bs-btn-bg: var(--teal); /* tame bootstrap if present */
  display: inline-flex; align-items: center; justify-content: center;
  border: none; cursor: pointer;
  background: var(--teal); color: #fff;
  font-size: 18px; font-weight: 700;
  padding: 16px 20px; border-radius: 16px;
  box-shadow: 0 6px 16px rgba(13,148,136,0.3);
}
.btn-primary:active { background: var(--teal-dark); }
.btn-block { width: 100%; }

/* ---- Bottom tab bar ----------------------------------------------------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex;
  padding-bottom: var(--safe-bottom);
  background: rgba(255,255,255,0.94);
  backdrop-filter: saturate(160%) blur(12px);
  border-top: 1px solid var(--line);
}
.tabbar__item {
  flex: 1 1 0; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 9px 0 10px; text-decoration: none; color: var(--muted); font-size: 11px; font-weight: 600;
}
.tabbar__icon { font-size: 22px; line-height: 1; filter: grayscale(0.4); opacity: 0.7; }
.tabbar__item.is-active { color: var(--teal-dark); }
.tabbar__item.is-active .tabbar__icon { filter: none; opacity: 1; }

/* ---- Flash toast -------------------------------------------------------- */
.toast-flash {
  margin: 0 0 14px; padding: 13px 16px; border-radius: 14px;
  font-weight: 600; font-size: 15px; box-shadow: var(--shadow-sm);
  animation: flash-in 0.25s ease;
}
.toast-flash--success { background: #d9f3ee; color: #0b6055; }
.toast-flash--error   { background: #fde0e7; color: #a01840; }
@keyframes flash-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ---- Summary ------------------------------------------------------------ */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.stat { padding: 18px 16px; display: flex; flex-direction: column; gap: 4px; }
.stat__value { font-size: 38px; font-weight: 800; line-height: 1; letter-spacing: -0.02em; }
.stat__label { font-size: 13px; color: var(--muted); font-weight: 600; }
.stat--accent { background: linear-gradient(150deg, #14b8a6, var(--teal)); }
.stat--accent .stat__value, .stat--accent .stat__label { color: #fff; }
.stat--accent .stat__label { opacity: 0.9; }

.equiv-card {
  padding: 20px; display: flex; flex-direction: column; gap: 4px; align-items: center; text-align: center;
}
.equiv-card__label { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.equiv-card__value { font-size: 22px; font-weight: 800; color: var(--teal-dark); }

/* ---- Login -------------------------------------------------------------- */
.screen-login { background: linear-gradient(165deg, #0f766e 0%, #0d9488 50%, #10b39c 100%); min-height: 100vh; }
.login-wrap {
  max-width: 380px; margin: 0 auto; padding: 0 24px;
  min-height: 100vh; display: flex; flex-direction: column; justify-content: center; align-items: center;
}
.login-mark {
  font-size: 40px; width: 84px; height: 84px; display: grid; place-items: center;
  background: rgba(255,255,255,0.16); color: #fff; border-radius: 26px; margin-bottom: 16px;
}
.login-title { color: #fff; font-size: 28px; font-weight: 800; margin: 0; letter-spacing: -0.02em; }
.login-sub { color: rgba(255,255,255,0.85); margin: 4px 0 26px; font-size: 15px; }
.login-card { width: 100%; padding: 22px 20px; box-sizing: border-box; }
.login-card .btn-block { margin-top: 4px; }
