/* CarStorage — the look of the SwiftUI app: always dark (.preferredColorScheme(.dark)), iOS system colors
   and type sizes, a large title with «+» in the bar at the top, tabs at the bottom, rounded cards on the
   grouped background, and the form as a sheet. Telegram's theme does not change it: tg.js paints Telegram's
   header to match. */

:root {
  color-scheme: dark;
  --bg: #000000;          /* systemGroupedBackground */
  --card: #1c1c1e;        /* secondarySystemGroupedBackground */
  --sheet-bg: #1c1c1e;    /* systemGroupedBackground inside a sheet */
  --sheet-row: #2c2c2e;   /* secondarySystemGroupedBackground inside a sheet */
  --text: #ffffff;
  --hint: rgba(235, 235, 245, 0.6);         /* secondaryLabel */
  --placeholder: rgba(235, 235, 245, 0.3);  /* placeholderText; a button that is off */
  --sep: rgba(84, 84, 88, 0.6);             /* separator */
  --gray: #8e8e93;        /* systemGray: a tab that is not chosen */
  --gray5: #2c2c2e;
  --gray6: #1c1c1e;
  --fill: rgba(118, 118, 128, 0.24);        /* tertiarySystemFill: date pills, the stepper */
  --track: rgba(120, 120, 128, 0.36);       /* the grey part of a slider */
  --blue: #0a84ff;
  --orange: #ff9f0a;
  --green: #30d158;
  --red: #ff453a;
  --bar: rgba(22, 22, 23, 0.88);            /* bar material */
  --row: var(--card);
  --nav-top: 0px;
  --safe-bottom: max(env(safe-area-inset-bottom, 0px), var(--tg-safe-area-inset-bottom, 0px));
}

:root[data-view='form'] {
  --row: var(--sheet-row);
  --bar: rgba(30, 30, 32, 0.9);
}

/* ---------- base ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.29 -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  /* a long press selects nothing, as in a native screen; fields stay editable */
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

button,
input,
select,
textarea {
  font: inherit; /* a control under 16px makes iOS zoom into the page when it gets focus; the car picker included */
  color: inherit;
}

input,
textarea {
  -webkit-user-select: text;
  user-select: text;
}

button {
  cursor: pointer;
}

button:focus-visible,
[role='button']:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

b {
  font-weight: 700;
}

#app {
  position: relative;
  z-index: 1;
  max-width: 600px;
  margin: 0 auto;
  padding: 0 16px calc(32px + var(--safe-bottom));
}

:root.has-tabbar #app {
  padding-bottom: calc(49px + var(--safe-bottom) + 16px);
}

:root[data-view='form'] #app {
  padding-bottom: 0;
}

:root[data-view='list'] #app,
:root[data-view='missing'] #app,
:root[data-view='cars'] #app,
:root[data-view='settings'] #app {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - var(--nav-top));
}

.muted {
  color: var(--hint);
}

.small {
  font-size: 12px;
}

.c-orange {
  color: var(--orange);
}

.c-green {
  color: var(--green);
}

.c-red {
  color: var(--red);
}

.c-blue {
  color: var(--blue);
}

/* ---------- navigation bar: a sticky row with the buttons, the large title under it ---------- */

.nav-row {
  position: sticky;
  top: var(--nav-top);
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr minmax(0, auto) 1fr;
  align-items: center;
  height: 44px;
  margin: 0 -16px;
  padding: 0 8px;
  transition: background-color 0.2s, box-shadow 0.2s;
}

:root.scrolled .nav-row {
  background: var(--bar);
  box-shadow: 0 0.5px 0 var(--sep);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
}

.nav-side {
  display: flex;
  align-items: center;
  min-width: 0;
}

.nav-side.end {
  justify-content: flex-end;
}

.nav-title {
  overflow: hidden;
  min-width: 0;
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  line-height: 22px;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.15s;
}

.nav-row.inline .nav-title,
:root.title-up .nav-title {
  opacity: 1;
}

.nav-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--blue);
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 44px;
  padding: 0 8px;
  border: 0;
  background: none;
  color: var(--blue);
  font-size: 17px;
  white-space: nowrap;
}

.nav-btn:disabled {
  color: var(--placeholder);
  cursor: default;
}

.nav-btn.back {
  padding-left: 2px;
}

/* In Telegram its own header has the back button. */
:root.tg .nav-btn.back {
  visibility: hidden;
}

.nav-icon:active,
.nav-btn:active:not(:disabled) {
  opacity: 0.5;
}

.large-title {
  margin: 0;
  padding: 2px 0 8px;
  font-size: 34px;
  line-height: 41px;
  font-weight: 700;
  letter-spacing: 0.011em;
}

/* a quiet line under the title: «Копию не сохраняли 20 дней ›» */
.note {
  display: block;
  margin: -4px 0 4px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--hint);
  font-size: 13px;
  text-align: left;
}

/* ---------- segmented control (UISegmentedControl, dark) ---------- */

.seg {
  display: flex;
  margin: 6px 0 0;
  padding: 2px;
  border-radius: 9px;
  background: var(--fill);
}

.seg button {
  flex: 1;
  height: 28px;
  padding: 0 6px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.seg button.on {
  background: #636366;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12), 0 3px 1px rgba(0, 0, 0, 0.04);
}

.seg.hist {
  margin: 4px 0 8px;
}

/* a small one inside a row of the form: «Нет | Сутки | Часы»; a long label (or big system text) puts it on its own line */
.field.late {
  flex-wrap: wrap;
}

.field .seg.mini {
  flex: 0 0 auto;
  margin: 0 0 0 auto;
}

.seg.mini button {
  flex: 0 0 auto;
  padding: 0 11px;
}

.sheet .seg {
  margin: 4px 0 0;
}

/* ---------- tab bar ---------- */

.tabbar {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 30;
  display: flex;
  justify-content: center;
  padding-bottom: var(--safe-bottom);
  background: var(--bar);
  box-shadow: 0 -0.5px 0 var(--sep);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
}

.tabbar button {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
  max-width: 280px;
  height: 49px;
  padding: 0 0 5px;
  border: 0;
  background: none;
  color: var(--gray);
  font-size: 10px;
  font-weight: 500;
  line-height: 12px;
  letter-spacing: 0.01em;
}

.tabbar button.on {
  color: var(--blue);
}

.tabbar svg {
  display: block;
}

/* ---------- the form opens as a sheet: it slides up over the list, which steps back; a pull down
   (app.js) moves it with the finger, and it slides away when it closes ---------- */

.sheet {
  margin: 10px -16px 0;
  padding: 0 16px calc(32px + var(--safe-bottom));
  min-height: calc(100vh - var(--nav-top) - 10px);
  border-radius: 10px 10px 0 0;
  background: var(--sheet-bg);
}

.sheet .nav-row {
  height: 56px;
}

.sheet-sub {
  margin: 0 16px;
  font-size: 15px;
  color: var(--hint);
  overflow-wrap: anywhere;
}

/* The form keeps the rows of all three kinds and shows those of the chosen one. */
.sheet[data-kind='day'] [data-k]:not([data-k~='day']),
.sheet[data-kind='hour'] [data-k]:not([data-k~='hour']),
.sheet[data-kind='trf'] [data-k]:not([data-k~='trf']) {
  display: none !important;
}

.sheet.in {
  animation: sheet-in 0.36s cubic-bezier(0.32, 0.72, 0, 1);
}

.sheet.leaving {
  transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
  pointer-events: none;
}

.sheet.snap {
  transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
}

@keyframes sheet-in {
  from {
    transform: translateY(100vh);
  }
}

/* --pull runs from 0 (the sheet is up) to 1 (the sheet is gone) and brings the list back forward */
#behind {
  --pull: 0;
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  border-radius: calc(10px * (1 - var(--pull)));
  pointer-events: none;
  transform: translateY(calc(4px * (1 - var(--pull)))) scale(calc(0.93 + 0.07 * var(--pull)));
  transform-origin: 50% 0;
  filter: brightness(calc(0.55 + 0.45 * var(--pull)));
}

#behind.in {
  animation: behind-in 0.36s cubic-bezier(0.32, 0.72, 0, 1);
}

#behind.restored {
  --pull: 1;
  transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1), filter 0.32s, border-radius 0.32s;
}

#behind.snap {
  transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1), filter 0.28s, border-radius 0.28s;
}

@keyframes behind-in {
  from {
    border-radius: 0;
    transform: none;
    filter: none;
  }
}

.behind-page {
  display: flex;
  flex-direction: column;
  max-width: 600px;
  min-height: calc(100vh - var(--nav-top));
  margin: 0 auto;
  padding: 0 16px calc(49px + var(--safe-bottom) + 16px);
}

#behind .tabbar {
  position: absolute;
}

@media (prefers-reduced-motion: reduce) {
  .sheet.in,
  #behind.in {
    animation: none;
  }

  .sheet.leaving,
  .sheet.snap,
  #behind.restored,
  #behind.snap,
  .rent.going {
    transition: none;
  }
}

/* ---------- rental card (CarRentCardView) ---------- */

.cards {
  display: grid;
  gap: 16px;
  padding-top: 16px;
}

.rent {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
  border-radius: 16px;
  background: var(--card);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.03);
  cursor: pointer;
}

/* a finished card folds away before the list is redrawn (height is set from the card by app.js) */
.rent.going {
  overflow: hidden;
  margin-bottom: -16px;
  padding-top: 0;
  padding-bottom: 0;
  opacity: 0;
  transition: height 0.3s cubic-bezier(0.32, 0.72, 0, 1), padding 0.3s cubic-bezier(0.32, 0.72, 0, 1),
    margin 0.3s cubic-bezier(0.32, 0.72, 0, 1), opacity 0.18s;
}

.rent-sec {
  padding-top: 14px;
  border-top: 0.5px solid var(--sep);
}

.rent-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.rent-model {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.rent-plate {
  margin-top: 4px;
  font-size: 15px;
  color: var(--hint);
  overflow-wrap: anywhere;
}

.rent-badges {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 6px;
}

.pencil {
  color: var(--hint);
}

.pill {
  padding: 6px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.pill-orange {
  background: rgba(255, 159, 10, 0.15);
  color: var(--orange);
}

.pill-green {
  background: rgba(48, 209, 88, 0.15);
  color: var(--green);
}

.client {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.client svg {
  flex-shrink: 0;
  color: var(--blue);
}

.client b {
  min-width: 0;
  overflow-wrap: anywhere;
}

.cap {
  font-size: 11px;
  font-weight: 700;
  color: var(--hint);
  letter-spacing: 0.02em;
}

.dates {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.dates .d {
  margin-top: 4px;
  font-size: 13px;
  font-weight: 700;
}

.dates .t {
  margin-top: 4px;
  font-size: 12px;
}

/* «Вернуть до 6 нояб. 10:00 · 105 000 ₸» under the term of the form; «в аренде до …» under the car */
.field.plan {
  min-height: 34px;
  padding-top: 4px;
  padding-bottom: 10px;
  font-size: 13px;
  color: var(--hint);
}

.field.plan.c-red { color: var(--red); }
.field.plan.c-orange { color: var(--orange); }
.field.plan.c-green { color: var(--green); }

/* «Просрочено» over the overdue cards */
.list-cap.red {
  color: var(--red);
}

/* «Просрочено на 3 ч», «через 2 ч», «Выдача через 2 дн.» */
.dates .n {
  margin-top: 3px;
  font-size: 11px;
  font-weight: 700;
}

.route .b {
  margin-top: 4px;
  font-size: 13px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.days {
  flex-shrink: 0;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--gray6);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.end {
  text-align: right;
}

.mileage-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
}

.mileage-row .b {
  font-size: 13px;
  font-weight: 700;
}

.mileage-row .small {
  margin-top: 2px;
}

.flag {
  flex-shrink: 0;
  padding: 8px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  text-align: right;
}

.flag div + div {
  margin-top: 2px;
}

.flag.bad {
  background: rgba(255, 69, 58, 0.1);
  color: var(--red);
}

.flag.ok {
  background: rgba(48, 209, 88, 0.1);
  color: var(--green);
}

.flag.wait {
  background: rgba(142, 142, 147, 0.16);
  color: var(--hint);
}

.fuel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.gauges {
  display: flex;
  gap: 16px;
  margin-top: 8px;
}

.gauge {
  display: flex;
  align-items: center;
  gap: 6px;
}

.gauge svg {
  flex-shrink: 0;
}

.g-track,
.g-val {
  fill: none;
  stroke-width: 3.5;
}

.g-track {
  stroke: var(--gray5);
}

.g-val {
  stroke-linecap: round;
}

.g-blue {
  stroke: var(--blue);
}

.g-orange {
  stroke: var(--orange);
}

.g-title {
  font-size: 10px;
  color: var(--hint);
}

.g-pct {
  margin-top: 1px;
  font-size: 13px;
  font-weight: 700;
}

.fuel .end {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  font-size: 13px;
}

.cap2 {
  font-size: 11px;
}

.total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.total .small div + div {
  margin-top: 2px;
}

.sum {
  margin-top: 2px;
  font-size: 22px;
  font-weight: 700;
  color: var(--blue);
  white-space: nowrap;
}

.finish {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  margin-top: 4px;
  padding: 12px;
  border: 0;
  border-radius: 10px;
  background: var(--blue);
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
}

.finish .ck {
  fill: none;
  stroke: var(--blue);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.finish:active,
.extend:active,
.extend-h:active,
.more:active {
  opacity: 0.8;
}

/* «+1 сутки» above «Завершить» on an overdue card: side by side the long label of «Завершить» breaks in two */
.rent-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rent-actions .finish {
  min-width: 0;
}

.extend,
.extend-h {
  width: 100%;
  margin-top: 4px;
  padding: 12px 14px;
  border: 0;
  border-radius: 10px;
  background: var(--fill);
  color: var(--blue);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

/* «+1 сутки» and «+1 час» share one row on a daily card */
.extend-row {
  display: flex;
  gap: 6px;
}

.extend-row .extend,
.extend-row .extend-h {
  flex: 1 1 0;
  min-width: 0;
}

/* ---------- history: a month and its sum above its cards; «Выдача позже» on the active list ---------- */

.month-head,
.list-cap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  margin: 22px 4px 0;
  font-size: 13px;
  font-weight: 600;
  line-height: 18px;
  letter-spacing: 0.02em;
  color: var(--hint);
  text-transform: uppercase;
}

.month-head span + span {
  flex-shrink: 0;
  text-transform: none;
}

/* the month over every kind, under the month's own line */
.month-head .all {
  flex-basis: 100%;
  font-weight: 400;
  text-transform: none;
}

.month-head + .cards,
.list-cap + .cards {
  padding-top: 8px;
}

/* ---------- list screen ---------- */

.empty {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  padding: 0 16px 44px;
  font-size: 17px;
  text-align: center;
  color: var(--hint);
}

.more {
  display: block;
  width: 100%;
  margin-top: 16px;
  padding: 12px;
  border: 0;
  border-radius: 12px;
  background: var(--card);
  color: var(--blue);
  font-size: 17px;
}

/* ---------- grouped lists and the form (an inset grouped Form) ---------- */

.section-title {
  margin: 24px 16px 7px;
  font-size: 13px;
  line-height: 18px;
  color: var(--hint);
  text-transform: uppercase;
}

.nav-row + .section-title {
  margin-top: 14px;
}

.list {
  overflow: hidden;
  border-radius: 10px;
  background: var(--row);
}

.list.gap {
  margin-top: 32px;
}

.list.top {
  margin-top: 8px;
}

.list > * {
  position: relative;
}

.list > * + *::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  left: 16px;
  border-top: 0.5px solid var(--sep);
}

.field {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 5px 16px;
  font-size: 17px;
}

.field .label {
  flex: 1 1 auto;
  min-width: 0;
}

.txt {
  flex: 1 1 0;
  min-width: 0;
  height: 34px;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 17px;
  caret-color: var(--blue);
}

.txt::placeholder,
textarea::placeholder {
  color: var(--placeholder);
  opacity: 1;
}

.field.money .label {
  flex: 0 0 auto;
}

.field.money .txt {
  min-width: 64px;
  text-align: right;
}

/* picker row: the value on the right, the real <select> invisible on top (the wheel on iPhone) */
.field.pick {
  position: relative;
  cursor: pointer;
}

.field.pick .label {
  flex: 0 0 auto; /* the label keeps its width; a long car name is the one that gets cut */
}

.pick-val {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  color: var(--hint);
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chev-ud {
  flex-shrink: 0;
  color: var(--gray);
}

.field.pick select {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.field.pick:focus-within {
  box-shadow: inset 0 0 0 2px var(--blue);
}

/* routes typed before, under the route field of a transfer */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 16px;
}

.chip {
  max-width: 100%;
  overflow: hidden;
  padding: 6px 10px;
  border: 0;
  border-radius: 14px;
  background: var(--fill);
  color: var(--text);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chip:active {
  opacity: 0.6;
}

/* iOS switch */
input.switch {
  position: relative;
  flex: 0 0 auto;
  width: 51px;
  height: 31px;
  margin: 0;
  border-radius: 16px;
  background: var(--track);
  cursor: pointer;
  transition: background-color 0.2s;
  -webkit-appearance: none;
  appearance: none;
}

input.switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15), 0 1px 1px rgba(0, 0, 0, 0.06);
  transition: transform 0.2s;
}

input.switch:checked {
  background: var(--green);
}

input.switch:checked::after {
  transform: translateX(20px);
}

.field.slider {
  flex-wrap: wrap;
}

.field.slider .label {
  flex: 0 0 auto;
}

.field.slider input[type='range'] {
  flex: 1 1 64px;
  min-width: 64px;
}

.val {
  flex: 0 0 auto;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.fuel-field {
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  padding-top: 9px;
  padding-bottom: 4px;
}

.fuel-field .label {
  font-size: 13px;
}

/* iOS slider: blue on the left of the white knob, grey on the right; --p is set by app.js */
input[type='range'] {
  --p: 50%;
  width: 100%;
  height: 30px;
  margin: 0;
  background: transparent;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

input[type='range']:focus {
  outline: none;
}

input[type='range']::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(to right, var(--blue) var(--p), var(--track) var(--p));
}

input[type='range']::-webkit-slider-thumb {
  width: 28px;
  height: 28px;
  margin-top: -12px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0.5px 4px rgba(0, 0, 0, 0.12), 0 6px 13px rgba(0, 0, 0, 0.12);
  -webkit-appearance: none;
  appearance: none;
}

input[type='range']:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.55);
}

input[type='range']::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  background: var(--track);
}

input[type='range']::-moz-range-progress {
  height: 4px;
  border-radius: 2px;
  background: var(--blue);
}

input[type='range']::-moz-range-thumb {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0.5px 4px rgba(0, 0, 0, 0.12), 0 6px 13px rgba(0, 0, 0, 0.12);
}

/* compact DatePicker: a date pill and a time pill; the real input lies invisible on top and opens the picker */
.pills {
  display: flex;
  flex: 0 0 auto;
  gap: 6px;
}

.pill-in {
  position: relative;
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 11px;
  border-radius: 7px;
  background: var(--fill);
  font-size: 17px;
  white-space: nowrap;
}

.pill-in input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.pill-in:focus-within {
  box-shadow: 0 0 0 2px var(--blue);
}

.stepper {
  display: inline-flex;
  flex: 0 0 auto;
  overflow: hidden;
  border-radius: 8px;
  background: var(--fill);
}

.stepper button {
  width: 47px;
  height: 32px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 22px;
  line-height: 32px;
}

.stepper button + button {
  box-shadow: inset 0.5px 0 0 var(--sep);
}

.stepper button:active:not(:disabled) {
  background: var(--fill);
}

.stepper button:disabled {
  color: var(--placeholder);
  cursor: default;
}

.row {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 44px;
  padding: 11px 16px;
  border: 0;
  background: transparent;
  font-size: 17px;
  text-align: left;
  color: var(--blue);
}

.row.center {
  justify-content: center;
  text-align: center;
}

.row.danger {
  color: var(--red);
}

/* a navigation row: white text, a grey chevron on the right */
.row.nav {
  justify-content: space-between;
  gap: 12px;
  color: var(--text);
}

.row.nav .row-main {
  min-width: 0;
}

.row.nav .row-title {
  overflow-wrap: anywhere;
}

.chev-r {
  flex-shrink: 0;
  color: var(--gray);
}

.row:active {
  background: var(--fill);
}

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

.row-sub {
  font-size: 13px;
  color: var(--hint);
}

.form-error {
  margin: 16px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 69, 58, 0.12);
  color: var(--red);
  font-size: 15px;
}

/* ---------- data screen ---------- */

.panel {
  margin-top: 8px;
  padding: 4px 16px 12px;
  border-radius: 10px;
  background: var(--row);
}

.kv {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  font-size: 17px;
}

.kv + .kv {
  border-top: 0.5px solid var(--sep);
}

.kv span {
  color: var(--hint);
}

.kv b {
  flex: 0 0 auto;
  white-space: nowrap; /* «+400 000 ₸» stays on one line; the caption on the left wraps instead */
}

/* the sum of the «Возврат» sheet (not .sum: that is the card's blue one-line figure) */
.panel.ret {
  margin-top: 0;
}

.kv .big {
  font-size: 22px;
  color: var(--blue);
}

.meter {
  overflow: hidden;
  height: 6px;
  margin: 2px 0 8px;
  border-radius: 3px;
  background: var(--fill);
}

.meter i {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: var(--blue);
}

.hint {
  margin: 8px 16px 0;
  font-size: 13px;
  line-height: 1.4;
  color: var(--hint);
}

.hint.c-red {
  color: var(--red);
}

.backup-text {
  display: block;
  width: 100%;
  min-height: 120px;
  padding: 12px 16px;
  border: 0;
  outline: 0;
  background: transparent;
  font: 16px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  resize: vertical;
}

.backup-text.out {
  margin-top: 12px;
  border-radius: 10px;
  background: var(--row);
}

.foot {
  margin-top: 28px;
  text-align: center;
}

.sync {
  font-size: 13px;
  color: var(--hint);
}

.link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--blue);
  font-size: inherit;
  text-decoration: underline;
}

.fatal,
.loading {
  padding: 80px 16px;
  font-size: 17px;
  text-align: center;
}

.loading {
  color: var(--hint);
}

.fatal .more {
  margin-top: 24px;
}

/* ---------- banner, short notes, page confirm ---------- */

#banner {
  padding: 10px 16px;
  background: rgba(255, 69, 58, 0.14);
  color: var(--red);
  font-size: 15px;
  text-align: center;
}

#banner button {
  margin-left: 8px;
  padding: 4px 10px;
  border: 0;
  border-radius: 8px;
  background: var(--red);
  color: #ffffff;
  font-weight: 600;
}

/* not an error: the records of the last run while the cloud has not answered */
#banner.quiet {
  background: rgba(142, 142, 147, 0.18);
  color: var(--hint);
}

#banner.quiet button {
  background: var(--gray);
}

#toast {
  position: fixed;
  bottom: calc(24px + var(--safe-bottom));
  left: 50%;
  z-index: 40;
  width: max-content;
  max-width: calc(100vw - 32px);
  padding: 10px 16px;
  border-radius: 14px;
  background: rgba(58, 58, 60, 0.96);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  color: #ffffff;
  font-size: 15px;
  text-align: center;
  transform: translateX(-50%);
  pointer-events: none;
}

:root.has-tabbar #toast {
  bottom: calc(49px + var(--safe-bottom) + 16px);
}

/* a note with «Отменить»: only the button takes taps (a thumb-sized area), the note itself still lets them through */
#toast.with-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
}

.toast-btn {
  flex-shrink: 0;
  margin: -12px -10px;
  padding: 12px 10px;
  border: 0;
  background: none;
  color: var(--blue);
  font-size: 15px;
  font-weight: 700;
  pointer-events: auto;
}

/* a mouse on a Mac: rows and cards light up under it; a finger never sees this */
@media (hover: hover) and (pointer: fine) {
  .row:hover {
    background: var(--fill);
  }

  .rent:hover {
    background: #232326;
  }

  .more:hover,
  .chip:hover,
  .extend:hover,
  .extend-h:hover,
  .finish:hover,
  .toast-btn:hover {
    filter: brightness(1.15);
  }

  .nav-btn:hover:not(:disabled),
  .nav-icon:hover,
  .note:hover {
    opacity: 0.75;
  }

  .seg button:not(.on):hover,
  .stepper button:not(:disabled):hover {
    background: rgba(255, 255, 255, 0.07);
  }
}

#modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.45);
}

.modal-box {
  overflow: hidden;
  width: 270px;
  border-radius: 14px;
  background: rgba(44, 44, 46, 0.98);
  text-align: center;
}

.modal-text {
  padding: 19px 16px 18px;
  font-size: 15px;
  line-height: 20px;
}

.modal-actions {
  display: flex;
  border-top: 0.5px solid var(--sep);
}

.modal-actions button {
  flex: 1;
  height: 44px;
  border: 0;
  background: transparent;
  color: var(--blue);
  font-size: 17px;
}

.modal-actions button + button {
  border-left: 0.5px solid var(--sep);
  font-weight: 600;
}
