/* QuoteFlow styles, full palette in :root */

:root {
  --bg: #edf0f8;
  --card: #ffffff;
  --ink: #171a2b;
  --muted: #8f96a9;
  --faint: #b7bdcb;
  --line: #eef0f6;
  --p1: #6a5ae0;
  --p2: #8f7bf3;
  --grad: linear-gradient(100deg, #6a5ae0 0%, #8b74f0 100%);
  --grad-card: linear-gradient(115deg, #5747d6 0%, #7a67ee 55%, #9482f4 100%);
  --danger: #dc2626;
  --shadow-card: 0 8px 24px rgba(23, 26, 43, .06);
  --shadow-pop: 0 16px 40px rgba(23, 26, 43, .14);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

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

button { font: inherit; color: inherit; }

.svg { width: 20px; height: 20px; flex: none; }

/* phone frame removed, app is full screen */
.phone {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  background: var(--bg);
  overflow: hidden;
  position: relative;
}

.app { position: relative; height: 100%; display: flex; flex-direction: column; }

.screens { position: relative; flex: 1; min-height: 0; }

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transition: opacity .35s ease, visibility .35s ease;
}

.screen.active { opacity: 1; visibility: visible; }

/* top bar */
.topbar {
  flex: none;
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  align-items: center;
  gap: 8px;
  padding: calc(16px + env(safe-area-inset-top, 0px)) 16px 10px;
}

.topbar__title {
  margin: 0;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -.01em;
}

.iconbtn {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: var(--card);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(23, 26, 43, .08);
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
}
.iconbtn:active { transform: scale(.92); }
.iconbtn .svg { width: 18px; height: 18px; }

.iconbtn--gear { color: var(--p1); }

.iconbtn--primary {
  background: var(--grad);
  color: #fff;
  box-shadow: 0 8px 20px rgba(106, 90, 224, .4);
}

.iconbtn--placeholder { background: transparent; box-shadow: none; pointer-events: none; }

.content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 6px 16px 118px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.content::-webkit-scrollbar { display: none; }

.content--auth { padding: 22px 24px 40px; }

.pane { display: none; }
.pane.active { display: block; animation: fadeUp .35s ease; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

/* auth screen */
.auth__title {
  margin: 14px 0 0;
  font-size: 27px;
  font-weight: 800;
  letter-spacing: -.02em;
}

.auth__sub {
  margin: 8px 0 0;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--muted);
}

.auth__form { margin-top: 26px; }

.field { display: block; margin-top: 18px; }

.field__label {
  display: block;
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 600;
  color: #4a5164;
}

.field__input {
  width: 100%;
  padding: 14px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: #f5f6fa;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  transition: background .2s, border-color .2s, box-shadow .2s;
}
.field__input::placeholder { color: #aab0c0; }
.field__input:focus {
  outline: none;
  background: #fff;
  border-color: #b9aef5;
  box-shadow: 0 0 0 4px rgba(106, 90, 224, .12);
}

select.field__input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238f96a9' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 38px;
}

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-row .field { margin-top: 14px; }

.form-error {
  margin: 14px 0 0;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--danger);
}

.shake { animation: shake .4s ease; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  50% { transform: translateX(6px); }
  75% { transform: translateX(-4px); }
}

/* buttons */
.btn-primary {
  width: 100%;
  height: 50px;
  margin-top: 30px;
  border: 0;
  border-radius: 14px;
  background: var(--grad);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  cursor: pointer;
  box-shadow: 0 12px 26px rgba(106, 90, 224, .35);
  transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
}
.btn-primary:active { transform: scale(.98); filter: brightness(1.05); }

.btn-primary__icon {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-primary__icon .svg { width: 20px; height: 20px; }

.btn-danger {
  width: 100%;
  height: 48px;
  margin-top: 16px;
  border: 0;
  border-radius: 14px;
  background: #fdecec;
  color: var(--danger);
  font-size: 14px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: transform .15s ease;
}
.btn-danger:active { transform: scale(.98); }
.btn-danger .svg { width: 17px; height: 17px; }

.btn-ghost-danger {
  width: 100%;
  height: 46px;
  margin-top: 10px;
  border: 1px solid #f2d7d7;
  border-radius: 14px;
  background: #fff;
  color: var(--danger);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .15s ease;
}
.btn-ghost-danger:active { transform: scale(.98); }

.section-label {
  margin: 22px 2px 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #9aa1b2;
}
.card .section-label { margin: 0 0 18px; }

/* purple balance card */
.balance-card {
  position: relative;
  overflow: hidden;
  padding: 20px;
  border-radius: 20px;
  background: var(--grad-card);
  color: #fff;
  box-shadow: 0 16px 40px rgba(90, 70, 220, .35);
}
.balance-card::after {
  content: "";
  position: absolute;
  top: -60px;
  right: -40px;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, .28) 0%, rgba(255, 255, 255, 0) 70%);
  pointer-events: none;
}

.balance-card__label {
  display: block;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .78);
}

.balance-card__amount {
  display: block;
  margin-top: 8px;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -.02em;
}

.balance-card__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  font-size: 12px;
  font-weight: 500;
  color: rgba(255, 255, 255, .88);
}

.balance-card__meta .meta-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .22);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.meta-dot .svg { width: 10px; height: 10px; }

/* funnel */
.funnel { display: flex; flex-direction: column; gap: 12px; }

.frow {
  position: relative;
  width: 100%;
  padding: 14px 14px 20px;
  border: 0;
  border-radius: 16px;
  background: var(--card);
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 12px;
  text-align: left;
  cursor: pointer;
  box-shadow: var(--shadow-card);
  transition: transform .15s ease;
}
.frow:active { transform: scale(.985); }

.frow__icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.frow__icon .svg { width: 17px; height: 17px; }

.frow__name {
  font-size: 14.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.frow__name em {
  font-style: normal;
  font-size: 11px;
  font-weight: 600;
  color: #6f7688;
  background: #eef0f5;
  border-radius: 999px;
  padding: 2px 8px;
}

.frow__amt { font-size: 15px; font-weight: 700; }

.frow__chev { width: 16px; height: 16px; color: var(--faint); }

.frow__track {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 8px;
  height: 4px;
  border-radius: 2px;
  overflow: hidden;
}
.frow__track i {
  display: block;
  height: 100%;
  border-radius: 2px;
  transition: width .5s ease;
}

/* cards and chart */
.card {
  background: var(--card);
  border-radius: 18px;
  padding: 18px;
  box-shadow: var(--shadow-card);
}

.chart-card { margin-top: 22px; }

.chart {
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  gap: 16px;
  padding: 4px 6px 0;
}

.chart__col { display: flex; flex-direction: column; align-items: center; gap: 10px; }

.chart__track {
  position: relative;
  width: 28px;
  height: 118px;
  border-radius: 9px;
  background: #eceafb;
  overflow: hidden;
}
.chart__track i {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 9px;
  background: linear-gradient(180deg, #8f7bf3 0%, #6a5ae0 100%);
  transition: height .6s ease;
}

.chart__label { font-size: 10.5px; font-weight: 600; color: var(--muted); }

.list { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }

.lrow {
  width: 100%;
  padding: 12px;
  border: 0;
  border-radius: 16px;
  background: var(--card);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  text-align: left;
  cursor: pointer;
  box-shadow: var(--shadow-card);
  transition: transform .15s ease;
}
.lrow:active { transform: scale(.985); }

.lrow__icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.lrow__icon .svg { width: 17px; height: 17px; }

.lrow__body { min-width: 0; }
.lrow__body strong {
  display: block;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lrow__body span {
  display: block;
  margin-top: 3px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lrow__end { text-align: right; }
.lrow__end strong { display: block; font-size: 14px; font-weight: 700; }
.lrow__end .pill {
  display: inline-block;
  margin-top: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #ece9fb;
  color: var(--p1);
  font-size: 13px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.empty {
  margin: 34px 0;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

/* document filter chips */
.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 2px 4px;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }

.chip {
  flex: none;
  padding: 8px 14px;
  border: 0;
  border-radius: 999px;
  background: var(--card);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-card);
  transition: background .2s, color .2s;
}
.chip.active { background: #ece9fb; color: var(--p1); }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.stat {
  background: var(--card);
  border-radius: 16px;
  padding: 14px;
  box-shadow: var(--shadow-card);
}
.stat span {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #9aa1b2;
}
.stat strong {
  display: block;
  margin-top: 7px;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -.01em;
}
.stat em {
  display: block;
  margin-top: 4px;
  font-style: normal;
  font-size: 11px;
  color: var(--muted);
}

.mix { display: flex; flex-direction: column; gap: 14px; }

.mix__row { display: grid; grid-template-columns: 58px 1fr 84px; align-items: center; gap: 10px; }
.mix__name { font-size: 12px; font-weight: 700; color: #4a5164; }
.mix__track { height: 8px; border-radius: 4px; background: #f0f1f7; overflow: hidden; }
.mix__track i { display: block; height: 100%; border-radius: 4px; transition: width .5s ease; }
.mix__val { font-size: 12px; font-weight: 700; text-align: right; }

/* bottom tab bar */
.tabbar {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  background: var(--card);
  border-radius: 24px;
  padding: 7px;
  display: flex;
  box-shadow: var(--shadow-pop);
  z-index: 10;
}

.tab {
  flex: 1;
  border: 0;
  background: transparent;
  border-radius: 18px;
  padding: 9px 2px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: #98a0b3;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: background .25s, color .25s;
}
.tab .svg { width: 19px; height: 19px; }
.tab.active { background: #ece9fb; color: var(--p1); }

/* bottom sheet and backdrop */
.backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 12, 20, .45);
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s ease;
  z-index: 20;
}
.backdrop.show { opacity: 1; pointer-events: auto; }

.sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 82%;
  overflow-y: auto;
  background: #fff;
  border-radius: 28px 28px 0 0;
  padding: 14px 20px calc(24px + env(safe-area-inset-bottom, 0px));
  transform: translateY(105%);
  transition: transform .38s cubic-bezier(.32, .72, .25, 1);
  z-index: 30;
  scrollbar-width: none;
}
.sheet::-webkit-scrollbar { display: none; }
.sheet.open { transform: none; }

.sheet__handle {
  width: 44px;
  height: 4px;
  border-radius: 2px;
  background: #e2e4ec;
  margin: 0 auto 16px;
}

.sheet__title { margin: 4px 0 0; font-size: 17px; font-weight: 800; letter-spacing: -.01em; }
.sheet__sub { margin: 5px 0 0; font-size: 12.5px; color: var(--muted); }

.sheet__form .field:first-of-type { margin-top: 16px; }

.seg {
  display: flex;
  gap: 4px;
  margin-top: 16px;
  padding: 4px;
  background: #f1f2f7;
  border-radius: 12px;
}
.seg label { flex: 1; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span {
  display: block;
  padding: 9px 0;
  border-radius: 9px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  transition: background .2s, color .2s, box-shadow .2s;
}
.seg input:checked + span {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 3px 10px rgba(23, 26, 43, .1);
}

.detail { margin-top: 16px; }
.drow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 2px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.drow:last-child { border-bottom: 0; }
.drow span { color: var(--muted); }
.drow strong { font-weight: 700; }

.sheet__actions { margin-top: 18px; }
.sheet__actions .btn-primary { margin-top: 0; }

.muted-center {
  margin: 4px 0 0;
  text-align: center;
  font-size: 12.5px;
  color: var(--muted);
}

.profile {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
  padding: 14px;
  border-radius: 16px;
  background: #f5f6fa;
}
.profile__avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--grad);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.profile__body strong { display: block; font-size: 13.5px; font-weight: 700; word-break: break-all; }
.profile__body span { display: block; margin-top: 2px; font-size: 12px; color: var(--muted); }

.mini-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.mini-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #f5f6fa;
  font-size: 12.5px;
}
.mini-row strong { font-weight: 700; }
.mini-row span { color: var(--muted); }

/* toast */
.toast {
  position: absolute;
  left: 50%;
  bottom: 96px;
  transform: translate(-50%, 14px);
  max-width: 82%;
  padding: 11px 18px;
  border-radius: 999px;
  background: #171a2b;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s ease, transform .3s ease;
  z-index: 40;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

:focus-visible { outline: 2px solid var(--p1); outline-offset: 2px; }

/* small screens */
@media (max-width: 360px) {
  .content { padding: 4px 12px 118px; }
  .content--auth { padding: 18px 18px 32px; }
  .balance-card__amount { font-size: 26px; }
}
