/* ============================================================
   Tab's own colour: mustard gold.
   Everything else comes from the shared stylesheet,
   shared-design/css/base.css, which every page loads first. That
   file is a copy from the transactor-design repository: change it
   there, never here.
   ============================================================ */

:root {
  --accent: #e5b23c;
  --accent-ring: rgba(229, 178, 60, 0.18);    /* around a field being typed in */
  --accent-glow: rgba(183, 121, 31, 0.22);    /* under the app icon while signing in */
}

@media (prefers-color-scheme: light) {
  :root {
    --accent: #8a5a00;
  }
}

/* ============================================================
   Rules only Tab has. Each one is drawn in a design source in
   design/screens/ (named beside it); a rule every app could use
   belongs in transactor-design instead.
   ============================================================ */

/* ---- Home (Home, HomeCurrencies, HomeInvite, HomePeople) ---- */

/* Each other currency under the hero amount: "and $120", in the display serif,
   smaller and grey (HomeCurrencies). The grey line under it closes up a little. */
.hero-more {
  margin-top: 6px;
  font-family: "EB Garamond", Georgia, serif;
  font-size: 30px;
  font-weight: 500;
  line-height: 1.1;
  color: var(--text-2);
  font-variant-numeric: lining-nums tabular-nums;
}

.hero-more + .hero-sub,
#net-more:not(:empty) + .hero-sub { margin-top: 8px; }

/* You owe / Owed to you in more than one currency (HomeCurrencies): the two keys
   once, then each currency's two amounts over its own bar, a little apart from the
   currency above. */
.split.split-multi { gap: 10px; }
.split-multi .split-key.split-col-end { justify-content: flex-end; }
.split-multi .split-value.split-col-end { text-align: right; }
.split-multi .split-bar + .split-cols { margin-top: 12px; }

/* While loading, the "You owe" placeholder is as wide as the amount it stands for,
   like "Owed to you" opposite it, not the whole column (HomeLoading). */
#app.loading .split-col .split-value { align-self: flex-start; }
#app.loading .split-col-end .split-value { align-self: flex-end; }

/* The tab's list: the same 22px under the card as the design, and room under the
   last row for the floating tab bar. */
.home-list {
  padding: 4px 20px calc(env(safe-area-inset-bottom) + 112px);
}

.home-list > .list-label:first-child { margin-top: 0; }

/* With nothing to list, the empty state sits under the card, and the tab bar
   needs no room kept for it. */
.home-list:empty { padding-bottom: 0; }

/* The line under the People tab's list. */
.list-note {
  margin: 14px 12px 0;
  font-size: 13px;
  line-height: 1.4;
  color: var(--text-2);
  text-align: center;
}

/* ---- Sheets (NewTrip, Currency, Invitation) ---- */

/* People and currencies to pick from, on the inset surface: rows a little closer
   together than a card's. */
.pick-list .list-row { padding: 10px 0; }
.pick-list .list-row-title { font-weight: 600; }
.pick-list .form-row { min-height: 0; padding: 10px 0; gap: 14px; }
/* A form row and a list row in one group still get a hairline between them
   (NewTrip's "Add someone new"; TripPersonNamed's name over "Between you"). */
.inset-group .form-row + .list-row,
.inset-group .list-row + .form-row { border-top: 1px solid var(--hairline); }

/* A form row that opens a picker (the trip's currency) instead of taking typing. */
.form-row.is-picker {
  width: 100%;
  text-align: left;
  cursor: pointer;
}

/* "+2 others" in the Invitation sheet: how many more are going, without names. */
.avatar.is-count {
  background: var(--card);
  color: var(--text-2);
}

/* A currency's symbol in its circle (Currency). Letter codes are set smaller so
   they fit. */
.currency-sign {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--card);
  font-size: 20px;
  font-weight: 600;
}

.currency-sign.is-pair { font-size: 17px; }
.currency-sign.is-code { font-size: 13px; }

.pick-list.is-currencies .list-row { padding: 8px 0; }
.pick-list.is-currencies .list-row-main { gap: 1px; }

/* A trip's type (TripType): ten icons, five to a row, each a circle over its name.
   The one picked is in the trip's tint (--av-h, set on the grid) with a ring; the
   rest are grey. */
.type-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  row-gap: 20px;
  margin-top: 6px;
}

.type-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 0;
  border: none;
  background: none;
  color: var(--text-2);
  font: inherit;
  cursor: pointer;
}

.type-circle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--inset);
}

.type-circle svg { width: 26px; height: 26px; stroke: currentColor; stroke-width: 1.8; }

.type-label { font-size: 12px; white-space: nowrap; }

.type-option[aria-checked="true"] { color: var(--text); }
.type-option[aria-checked="true"] .type-label { font-weight: 600; }
.type-option[aria-checked="true"] .type-circle {
  background: hsl(var(--av-h, 240) var(--av-bg-s) var(--av-bg-l));
  color: hsl(var(--av-h, 240) var(--av-fg-s) var(--av-fg-l));
  box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--text);
}

#sheet .type-grid + .btn { margin-top: 28px; }

.type-option:focus-visible { outline: none; }
.type-option:focus-visible .type-circle { outline: 2px solid var(--accent); outline-offset: 5px; }

/* The trip's type in NewTrip's Type row: a small circle before the chevron. */
.trip-icon.is-row { width: 36px; height: 36px; }
.trip-icon.is-row svg { width: 18px; height: 18px; }

/* TripOptions: the trip's icon is the button that opens TripType, with a pencil. */
.trip-icon.is-editable {
  position: relative;
  padding: 0;
  border: none;
  font: inherit;
  cursor: pointer;
}

.edit-badge {
  position: absolute;
  right: -4px;
  bottom: -4px;
  width: 28px;
  height: 28px;
  box-sizing: border-box;
  border-radius: 50%;
  border: 2px solid var(--card);
  background: var(--inset);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
}

.trip-icon .edit-badge svg { width: 13px; height: 13px; stroke-width: 2.2; }

/* The API's reason for refusing, in place of the grey line under a sheet's button
   (NewTrip: a name typed twice). */
.sheet-note.is-error { color: var(--neg); }

/* Words that wrap as one: "₹24,300 spent" under a trip whose number is wide. */
.keep { white-space: nowrap; }

/* ---- A trip (Trip, TripScrolled, TripLong, TripEmpty) ---- */

/* The trip's name in the top bar, in the trip's own tint (--av-h, from its name),
   as a person's name is on their page. A long name is cut with an ellipsis
   between the buttons (TripLong): centred in its grid cell, the title would
   otherwise be as wide as its text. */
.trip-name {
  max-width: 100%;
  color: hsl(var(--av-h, 240) var(--av-fg-s) var(--av-fg-l));
}

/* You and each person, then a card per day. The first label sits 28px under the
   hero; the last card leaves room for the floating Add expense / Settle up tray. */
.trip-list { padding: 0 20px; }
#trip-people .list-label { margin-top: 28px; }
#trip-entries > .list-label:first-child { margin-top: 22px; }
.trip-entries { padding-bottom: calc(env(safe-area-inset-bottom) + 122px); }
.trip-entries:empty { padding-bottom: 0; }

/* A payment between two other people: the two-way arrows, on the quiet surface. */
.list-icon.between { background: var(--inset); color: var(--text-2); }

/* Nothing added yet (TripEmpty), and a trip that is not there: in the page under
   what is above them, not over the whole view. */
#trip-empty,
#trip-missing {
  position: static;
  padding: 36px 40px calc(env(safe-area-inset-bottom) + 124px);
}

/* The way back from a trip that is not there is a real button. */
#trip-missing { pointer-events: auto; }
#trip-missing .btn { margin-top: 22px; max-width: 260px; }

#app.is-missing .hero,
#app.is-missing #trip-people,
#app.is-missing #trip-entries,
#app.is-missing #trip-actions { display: none; }
#app.is-missing #btn-options { visibility: hidden; }

/* ---- A trip's sheets (TripOptions, TripOptionsGuest, Invite, TripPerson*,
   AddPerson) ---- */

/* The spacing the sheets draw: 24px between a button and the group under it,
   12px between two groups, 32px above a destructive button (8px under a sheet's
   profile, which has its own 24px). */
#sheet .btn + .inset-group,
#sheet .btn + .sheet-note + .inset-group { margin-top: 24px; }
#sheet .inset-group + .inset-group { margin-top: 12px; }
#sheet .btn.is-apart { margin-top: 32px; }
#sheet .profile + .btn.is-apart { margin-top: 8px; }

/* The currency row once the trip has entries: no picker, a lock, a grey line. */
.form-row.is-locked { cursor: default; }
.form-row-note { font-size: 13px; color: var(--text-2); }

/* The trip link runs long: one line, cut with an ellipsis (Invite). */
.trip-link {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* The hidden box the link is copied from when the clipboard says no (Invite). */
.copy-box {
  position: fixed;
  top: 0;
  left: -9999px;
  opacity: 0;
}

/* Reset link: a row in the money red, not a button (Invite). */
.list-row.is-danger .list-row-title,
.list-row.is-danger .list-icon { color: var(--neg); }

/* A row that is a statement, not a name: "Between you in this trip". */
.list-row-title.is-plain { font-weight: 500; }

/* A person's state under their name at the top of their sheet (TripPerson). */
.profile .list-row-state { margin-top: 6px; font-size: 15px; }

/* Invite: the arrow sits close to the state before it. */
.list-row-state + .list-row-chevron { margin-left: -6px; }

/* ---- Expenses and payments (AddExpense, PaidBy, SplitEqual, SplitExact,
   EditExpense, ExpenseView, RecordPayment, EditPayment) ---- */

/* The amount on its own, 26px above the group under it. */
#sheet .amount-field { margin: 4px 0 26px; }
#sheet .amount-field label { margin-bottom: 4px; }

/* A grey line under the amount: what that person owes (RecordPayment), or why the
   money of an entry cannot change. A fixed amount is greyed. */
.amount-note {
  margin-top: 4px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--text-2);
  text-align: center;
}
.amount-field input[readonly] { color: var(--text-2); }
.amount-field input[readonly]:focus { background: transparent; }

/* The two-way switch sits 22px above the list or 30px above the amount. */
#sheet .seg + .field.amount-field { margin-top: 30px; }

/* The grey line between the split's people and Done (SplitEqual, SplitExact). */
#sheet .sheet-note.split-note { margin-top: 14px; }
#sheet .split-note + .btn { margin-top: 24px; }

/* Each person's part in an exact split: typed in place of the amount a row shows. */
.part-input {
  width: 120px;
  flex-shrink: 0;
  border: none;
  outline: none;
  background: transparent;
  padding: 0;
  text-align: right;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.part-input.is-zero,
.part-input::placeholder { color: var(--text-3); }
.pick-list label.list-row { cursor: text; }

/* An entry you can only read (ExpenseView): "Rahul paid" over the amount, in the
   amount field's place. */
.amount-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
}
.amount-view-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-2);
}
.amount-view-value {
  font-family: "EB Garamond", Georgia, serif;
  font-size: 56px;
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-variant-numeric: lining-nums tabular-nums;
}
.amount-view + .list-label { margin-top: 26px; }
.amount-view + .sheet-note { margin-top: 16px; }
.inset-group.is-read + .sheet-note { margin-top: 16px; }

/* ---- A person (Person) ---- */

/* The number sits a little lower than Home's, under the person's name; the trips
   start 28px under the line below the bar. */
#view-person .hero { padding-top: 30px; }
.person-list { padding: 0 20px calc(env(safe-area-inset-bottom) + 40px); }
#person-trips .list-label { margin-top: 28px; }
#person-trips .list-note { margin: 16px 20px 0; }

/* Nobody to show: in the page under the top bar, with a real way back. */
#person-missing {
  position: static;
  padding: 36px 40px calc(env(safe-area-inset-bottom) + 40px);
  pointer-events: auto;
}
#person-missing .btn { margin-top: 22px; max-width: 260px; }

#app.is-missing #view-person .hero,
#app.is-missing #person-trips { display: none; }

/* ---- Joining from a link (JoinTrip, JoinTripNew, JoinTripDead) ----
   SignInInvite is the sign-in page itself (#signedout in base.css). The other three
   share one column: a circle, a serif heading and a line at the top, the names to
   pick from (JoinTrip) and the name to join as (JoinTripNew), and the button at the
   bottom. */
.join-view {
  overflow-y: auto;
  padding-bottom: calc(env(safe-area-inset-bottom) + 44px);
}
.join-view > * { flex-shrink: 0; }

.join-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: calc(env(safe-area-inset-top) + 96px) 28px 0;
}
/* A link that cannot be joined sits lower, with nothing under it but the button. */
.join-view.is-message .join-head { padding: calc(env(safe-area-inset-top) + 180px) 32px 0; }

/* The circle at the top: the trip's own (.trip-icon .is-large) when joining, a grey
   one with a line drawing when the link cannot be joined. */
.join-icon.is-plain {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--inset);
  color: var(--text-2);
}
.join-icon.is-plain svg { width: 32px; height: 32px; stroke: currentColor; stroke-width: 1.8; }

.join-title {
  margin-top: 18px;
  font-family: "EB Garamond", Georgia, serif;
  font-size: 40px;
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}

.join-text {
  margin-top: 10px;
  font-size: 15px;
  line-height: 1.45;
  color: var(--text-2);
}
.join-view.is-message .join-text { margin-top: 14px; }

.join-pick { padding: 36px 20px 0; }
.join-pick .list-label { margin: 0 6px 10px; }
/* The name field under the names, once "I'm not on this list" is picked. */
.join-pick:not([hidden]) + .join-pick { padding-top: 24px; }

/* The button sits at the bottom of the screen, or under the names when they are
   many. */
.join-actions { margin-top: auto; padding: 24px 28px 0; }
.join-actions .sheet-note { margin-top: 16px; }
/* "Are you Akshay?" (JoinTripAsk): the question over its answers, one button each. */
.join-ask-text {
  margin-bottom: 16px;
  font-size: 15px;
  line-height: 1.45;
  text-align: center;
}
.join-ask-btns .btn + .btn { margin-top: 10px; }

/* A name to pick: a ring, filled in thick when picked (JoinTrip). */
.radio {
  width: 24px;
  height: 24px;
  box-sizing: border-box;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1.5px solid var(--text-3);
  transition: border 0.15s ease;
}
[aria-checked="true"] > .radio { border: 7px solid var(--text); }
