/* ---------------------------------------------------------------------------
   The product screens: the connect flow and the five app tabs.

   The comps draw these inside a 390px phone. That frame is how a prototype is
   PRESENTED, not how a product is built — a bezel drawn on a 1440px monitor is
   a picture of an app rather than an app. So the phone is the base layer and
   the desktop is a real layout: the tab bar becomes a left rail, the content
   gets a column it can breathe in, and nothing pretends to be a device.
   --------------------------------------------------------------------------- */

body.app {
  background: var(--cream);
  min-height: 100vh;
}

/* The shell everything sits in: a column on a phone, a rail plus a column on
   anything wider. */
.phone {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--cream);
}

/* ------------------------------------------------------ tablet and desktop */
/* Between a phone and a desktop, the flow reads best as one centred column —
   it is a sequence of single decisions, and a wide measure would hurt it. */
@media (min-width: 700px) {
  .phone { max-width: 620px; margin: 0 auto; }
}

/* From here the app earns a proper layout. The connect flow does not: it stays
   a centred column, because "connect your bank" is one decision and a
   thousand-pixel version of it is not a better one. */
@media (min-width: 1000px) {
  .phone:has(.tabs:not([hidden]))  {
    max-width: none;
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    min-height: 100vh;
  }
  .phone:has(.tabs:not([hidden])) > .notice--demo { grid-column: 1 / -1; }
  .phone:has(.tabs:not([hidden])) > .tabs   { grid-column: 1; grid-row: 2; }
  .phone:has(.tabs:not([hidden])) > .screen { grid-column: 2; grid-row: 2; }
}

.screen {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 24px 28px;
}
.screen--flush { padding: 0; }
.screen h2 { font-size: 30px; margin-bottom: 18px; }

@media (min-width: 1000px) {
  .screen {
    padding: 40px 56px 72px;
  }
  /* The content column, not the window. Financial rows are read left to right
     and a 1400px row is unreadable. */
  .screen > * { max-width: 760px; }
  .screen h2 { font-size: 38px; }
  .screen--flush { padding: 0; }
  .screen--flush > * { max-width: none; }
}

/* The bar under a screen that owns one decision. */
.screen-foot {
  flex: none;
  padding: 14px 24px 24px;
  background: var(--cream);
  border-top: 1px solid var(--rule);
  display: flex; flex-direction: column; gap: 12px;
}

/* ------------------------------------------------------------ connect flow */
.bank-btn {
  display: flex; align-items: center; gap: 14px;
  width: 100%; padding: 16px 18px;
  background: var(--cream-menu);
  border: 1px solid var(--espresso);
  border-radius: 8px;
  box-shadow: 2px 2px 0 rgba(36, 28, 23, 0.35);
  cursor: pointer; text-align: left;
  font-family: var(--ui); font-size: 16px; font-weight: 600; color: var(--ink);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.bank-btn:hover { background: #FFFDF6; transform: translate(-1px, -1px); box-shadow: 3px 3px 0 rgba(36, 28, 23, 0.45); }
.bank-btn__name { flex: 1; }
.bank-btn__go { font-family: var(--ticket); font-size: 18px; color: var(--red); }

.assure {
  margin-top: auto; padding-top: 24px;
  display: flex; gap: 12px; align-items: flex-start;
  border-top: 1px solid var(--rule);
}
.assure__tick {
  width: 22px; height: 22px; flex: none;
  border: 2px solid var(--espresso); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
}
.assure p { font-size: 12px; line-height: 1.5; color: var(--ink-4); }

.scanning { display: flex; flex-direction: column; justify-content: center; gap: 30px; min-height: 70vh; }
.scan-line {
  display: flex; align-items: center; gap: 14px;
  padding: 15px 0; border-bottom: 1px dashed var(--rule-2);
  transition: opacity 0.35s ease;
}
.scan-line__label { flex: 1; font-size: 17px; font-weight: 500; }
.scan-line__status { font-family: var(--ticket); font-size: 12px; letter-spacing: 0.1em; color: var(--red); }
.bar { height: 6px; background: var(--rule-3); overflow: hidden; }
.bar__fill { height: 100%; width: 0; background: var(--red); transition: width 0.5s ease; }

/* ------------------------------------------------------------- app screens */
.app-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0 18px;
}
.app-head__word { font-family: var(--display); font-size: 19px; letter-spacing: 0.12em; color: var(--red); }
.avatar {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  background: var(--chrome); border: 1px solid #9C978F; border-radius: 50%;
  font-size: 13px; font-weight: 700; color: var(--espresso-2);
}

.total-card .money { color: var(--ink); font-size: 44px; }
.total-card__chips { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

.score-link {
  width: 100%; text-align: left;
  display: flex; align-items: center; gap: 16px;
  background: var(--espresso); border: none; padding: 18px 20px;
  margin: 16px 0 22px; cursor: pointer;
}
.score-link:hover { background: #2E241E; }
.score-link__n { font-family: var(--display); font-size: 34px; line-height: 1.1; color: var(--cream-lit); }
.score-link__band { font-family: var(--ticket); font-size: 11px; letter-spacing: 0.14em; color: var(--mustard); }

.offer {
  display: flex; align-items: center; gap: 14px;
  padding: 15px 16px; background: var(--cream-menu); border: 1px solid var(--rule);
}
.offer__name { font-size: 15px; font-weight: 600; }
.offer__detail { font-family: var(--ticket); font-size: 11px; color: var(--ink-4); }
.offer__go { font-family: var(--ticket); font-size: 11px; letter-spacing: 0.1em; color: var(--red); }

/* History rows carry a decision, so they are taller than a display row. */
.hist { background: var(--cream-menu); border: 1px solid var(--espresso); padding: 4px 18px 14px; }
.hist__row { display: flex; align-items: center; gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--rule-3); }
.hist__row:last-of-type { border-bottom: none; }
.hist__name { font-size: 16px; font-weight: 600; }
.hist__meta { font-family: var(--ticket); font-size: 11px; letter-spacing: 0.06em; color: var(--ink-4); }
.hist__total { display: flex; justify-content: space-between; align-items: baseline; padding: 16px 0 4px; border-top: 1px solid var(--espresso); }
.hist__total .money { font-size: 26px; }

.consent {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 0 2px;
  font-family: var(--ticket); font-size: 11px; letter-spacing: 0.06em; color: var(--ink-4);
}
.consent input { width: 18px; height: 18px; accent-color: var(--red); flex: none; }

/* Reliability */
.score-hero {
  background: var(--espresso); padding: 26px 24px 30px;
  display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center;
}
.score-hero__n { font-family: var(--display); font-size: 96px; line-height: 1.02; color: var(--cream-lit); }
.score-hero__n span { font-size: 26px; color: var(--on-dark-2); }
.score-hero__band {
  margin-top: 8px; padding: 7px 16px; background: var(--red);
  font-family: var(--display); font-size: 14px; letter-spacing: 0.18em; color: var(--cream-lit);
}
.factor { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px dotted var(--rule-2); }
.factor__m { font-family: var(--ticket); font-size: 14px; font-weight: 700; color: var(--red); }
.factor--bad .factor__m { color: var(--ink-5); }
.factor span:last-child { flex: 1; font-size: 15px; line-height: 1.35; }
.factor--bad span:last-child { color: var(--ink-3); }

/* Bills */
.ticket-card { background: var(--cream-menu); border: 1px solid var(--espresso); box-shadow: 3px 3px 0 rgba(36, 28, 23, 0.28); }
.ticket-card__head {
  padding: 12px 18px; border-bottom: 2px solid var(--espresso);
  font-family: var(--ticket); font-size: 11px; letter-spacing: 0.2em;
}
.ticket-card__body { padding: 6px 18px; }
.ticket-card__row {
  display: flex; align-items: baseline; gap: 10px;
  padding: 13px 0; border-bottom: 1px dotted var(--rule-2);
  font-family: var(--ticket);
}
.ticket-card__row span:nth-child(2) { flex: 1; }
.ticket-card__sums { padding: 14px 18px 18px; display: flex; flex-direction: column; gap: 10px; }
.ticket-card__sum { display: flex; justify-content: space-between; align-items: baseline; }
.ticket-card__sum b { font-family: var(--display); font-size: 24px; font-weight: 400; }
.ticket-card__flag {
  background: var(--red); padding: 14px 18px;
  display: flex; align-items: center; justify-content: space-between;
  font-family: var(--display); font-size: 16px; letter-spacing: 0.1em; color: var(--cream-lit);
}
.ticket-card__flag--watch { background: var(--espresso); }

/* You */
.card-plate {
  position: relative; height: 190px; border-radius: 14px;
  background: linear-gradient(150deg, #FBF6EA, #F0E6D2);
  border: 1px solid var(--rule-2);
  box-shadow: 0 14px 28px -16px rgba(36, 28, 23, 0.6);
  overflow: hidden; margin-bottom: 24px;
}
.card-plate__stripe { position: absolute; top: 0; right: 0; bottom: 0; width: 16px; background: var(--red); }
.card-plate__word { position: absolute; top: 20px; left: 22px; font-family: var(--display); font-size: 22px; letter-spacing: 0.14em; color: var(--red); }
.card-plate__num { position: absolute; bottom: 46px; left: 22px; font-family: var(--ticket); font-size: 17px; letter-spacing: 0.14em; color: var(--espresso-2); }
.card-plate__name { position: absolute; bottom: 20px; left: 22px; font-family: var(--ticket); font-size: 11px; letter-spacing: 0.16em; color: var(--ink-4); }

.settings { background: var(--cream-menu); border: 1px solid var(--rule); }
.settings__row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; padding: 16px 18px; border: none; border-bottom: 1px solid var(--rule-3);
  background: none; font-family: var(--ui); font-size: 15px; color: var(--ink);
  text-align: left; cursor: pointer;
}
.settings__row:last-child { border-bottom: none; }
.settings__row:hover { background: #FFFDF6; }
.settings__go { font-family: var(--ticket); font-size: 15px; color: var(--red); }

/* --------------------------------------------------------------- tab bar */
.tabs {
  flex: none;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--cream-menu);
  border-top: 1px solid var(--espresso);
  padding: 8px 6px calc(14px + env(safe-area-inset-bottom, 8px));
}

.tab {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 8px 2px; background: none; border: none; cursor: pointer;
  color: var(--ink-5);
}
.tab[aria-current="page"] { color: var(--red); }
.tab__mark {
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  border: 1.5px solid currentColor; border-radius: 4px;
  font-family: var(--display); font-size: 11px;
}
.tab__label { font-family: var(--ticket); font-size: 10px; letter-spacing: 0.06em; font-weight: 700; }

/* --------------------------------------------------------------- spinner */
.working {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--ticket); font-size: 11px; letter-spacing: 0.14em; color: var(--ink-4);
}
.working::before {
  content: ""; width: 12px; height: 12px; border: 2px solid var(--rule-2);
  border-top-color: var(--red); border-radius: 50%;
  animation: toviSpin 0.8s linear infinite;
}
@keyframes toviSpin { to { transform: rotate(360deg); } }

/* ------------------------------------------------- one-offs, as classes */
/* See the note at the foot of tovi.css: the CSP does not allow style="". */
.screen--split  { display: flex; flex-direction: column; justify-content: space-between; gap: 26px; }
.screen--column { display: flex; flex-direction: column; }
.screen--center { display: flex; flex-direction: column; justify-content: center; gap: 22px; }
.welcome-checks { margin: -16px -24px 26px; }
.welcome-h { font-size: 38px; line-height: 1.1; }
.stat-line { display: flex; align-items: baseline; gap: 10px; padding-bottom: 16px; border-bottom: 1px solid var(--rule); }
.stat-line__n { font-family: var(--display); font-size: 15px; }
.screen__title-pad { padding: 16px 24px 8px; }
.screen__body-pad  { padding: 0 24px 20px; }
.scan-h { font-size: 34px; margin: 0; }
.notice--spaced { margin-top: 18px; }
.loading { padding-top: 40px; }
.linked-h { font-size: 32px; }
.connect-sub { margin-bottom: 22px; }
.connect-note { padding-top: 12px; text-align: center; }

/* The way out of preview, in the band that announces it. */
.band-leave {
  background: none;
  border: none;
  border-bottom: 1px solid currentColor;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

/* ------------------------------------------------------ home: the tally */
/* Found, verified, reporting — in the order the product happens. */
.tally {
  display: grid; grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--espresso);
  border-bottom: 1px solid var(--espresso);
  margin: 18px 0 22px;
}
.tally__cell { padding: 14px 0; text-align: center; border-right: 1px solid var(--rule); }
.tally__cell:last-child { border-right: none; }
.tally__n { font-family: var(--display); font-size: 30px; line-height: 1; color: var(--red); }
.tally .ticket { padding-top: 6px; }

/* ------------------------------------------------- home: the one action */
.next { background: var(--cream-menu); border: 1px solid var(--espresso); padding: 18px 20px 20px; }
.next__title { font-family: var(--display); font-size: 20px; line-height: 1.25; padding: 6px 0 8px; }
.next__body { font-size: 14px; line-height: 1.55; color: var(--ink-3); padding-bottom: 16px; }

/* ------------------------------------------------ recurring: what recurs */
.rec { background: var(--cream-menu); border: 1px solid var(--espresso); padding: 2px 18px; }
.rec__row {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 0; border-bottom: 1px solid var(--rule-3);
}
.rec__row:last-child { border-bottom: none; }
.rec__main { flex: 1; min-width: 0; }
.rec__name { font-size: 16px; font-weight: 600; }
.rec__meta { font-family: var(--ticket); font-size: 11px; letter-spacing: 0.04em; color: var(--ink-4); padding-top: 3px; }
.rec__right { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.rec__amount { font-family: var(--ticket); font-size: 15px; font-weight: 700; }
.rec__total {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 16px 2px 0;
}
.rec__total .money { font-size: 26px; }

/* The history rows carry a decision, so they need air between them. */
.hist__item + .hist__item { border-top: 1px solid var(--rule-3); }

/* ------------------------------------------- discovery: what was found */
.found { padding-bottom: 18px; }
.found__line { display: flex; align-items: baseline; gap: 10px; padding: 4px 0; }
.found__n { font-family: var(--display); font-size: 30px; line-height: 1.1; color: var(--red); }
.found__what { font-size: 15px; line-height: 1.35; color: var(--ink-2); }

/* ------------------------------------------------------- the offer card */
.offer-card {
  background: var(--espresso);
  color: var(--cream-lit);
  padding: 18px 20px 20px;
  margin-bottom: 12px;
}
.offer-card .ticket { color: var(--on-dark); }
.offer-card__list { margin: 12px 0 16px; padding: 0; list-style: none; }
.offer-card__list li {
  font-size: 15px; line-height: 1.4; padding: 7px 0 7px 20px; position: relative;
}
.offer-card__list li::before {
  content: "→"; position: absolute; left: 0; color: var(--mustard);
  font-family: var(--ticket);
}
.offer-card__price { display: flex; align-items: baseline; gap: 10px; min-height: 34px; }
.offer-card__note {
  padding-top: 12px; font-size: 13px; line-height: 1.5; color: var(--on-dark);
}
.offer-card__price .money { color: var(--cream-lit); font-size: 34px; }
.offer-card__price .ticket { color: var(--on-dark-2); }

/* --------------------------------------------- the plan banner in the app */
.plan-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px;
  background: var(--espresso); color: var(--cream-lit);
  padding: 14px 16px; margin-bottom: 18px;
}
.plan-bar__text { flex: 1; min-width: 200px; font-size: 14px; line-height: 1.4; }
.plan-bar .btn { padding: 12px 18px; font-size: 12px; }

/* --------------------------------------------------------- legal footer */
.legal-foot {
  padding: 26px 0 4px;
  font-family: var(--ticket);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-5);
}
.legal-foot a { color: var(--ink-4); }
.legal-foot a:hover { color: var(--red); }
.screen--flush .legal-foot { padding: 26px 24px 4px; }

/* ------------------------------------------------- desktop sizing tweaks */
@media (min-width: 1000px) {
  /* The bottom bar becomes a rail. This block sits at the end of the file on
     purpose: a media query adds no specificity, so it only wins by coming
     after the phone rules it is overriding. */
  .tabs {
    grid-template-columns: 1fr;
    align-content: start;
    gap: 4px;
    padding: 28px 16px;
    border-top: none;
    border-right: 1px solid var(--espresso);
  }
  .tab {
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 6px;
  }
  .tab:hover { background: #F2E7D1; }
  .tab[aria-current="page"] { background: var(--cream); }
  .tab__mark { width: 30px; height: 30px; font-size: 12px; }
  .tab__label { font-size: 11px; letter-spacing: 0.1em; }

  .app-head { padding: 0 0 26px; }
  .total-card .money { font-size: 56px; }
  .score-link { padding: 22px 24px; }
  .score-hero { padding: 44px 24px 48px; }
  .score-hero__n { font-size: 128px; }
  .card-plate { max-width: 420px; }
  /* Two columns where the content is genuinely a pair of lists. */
  .hist { padding: 8px 24px 18px; }
  .ticket-card__head, .ticket-card__body, .ticket-card__sums { padding-left: 24px; padding-right: 24px; }
}
