/* iBills AI — design system
   Brand palette matches iBills Cloud Solutions (indigo → violet),
   with amber reserved for AI-specific surfaces. */

:root {
  --brand-500: #6366f1;
  --brand-600: #4f46e5;
  --brand-700: #4338ca;
  --violet-500: #8b5cf6;
  --amber-500: #f59e0b;
  --amber-100: #fef3c7;

  --ink-900: #0f172a;
  --ink-700: #334155;
  --ink-500: #64748b;
  --ink-400: #94a3b8;
  --line: #e2e8f0;
  --line-soft: #f1f5f9;
  --surface: #ffffff;
  --canvas: #f8fafc;

  --ok-600: #059669;
  --ok-50: #ecfdf5;
  --warn-600: #d97706;
  --warn-50: #fffbeb;
  --danger-600: #dc2626;
  --danger-50: #fef2f2;

  --radius: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow-md: 0 4px 16px rgba(15, 23, 42, .07);
  --shadow-lg: 0 12px 40px rgba(15, 23, 42, .10);
}

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

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

body {
  margin: 0;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink-900);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0 0 .5rem; line-height: 1.25; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
p { margin: 0 0 1rem; }
a { color: var(--brand-600); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ------------------------------------------------------------- auth pages */

.auth-shell {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
  background:
    radial-gradient(1000px 500px at 15% -10%, #eef2ff 0%, transparent 60%),
    radial-gradient(900px 500px at 100% 0%, #f5f3ff 0%, transparent 55%),
    var(--canvas);
}

.auth-card {
  width: 100%;
  max-width: 27rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 2rem;
}

.auth-card--wide { max-width: 30rem; }

.auth-head { text-align: center; margin-bottom: 1.5rem; }
.auth-head p { color: var(--ink-500); margin: 0; font-size: .925rem; }

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: .625rem;
  margin-bottom: 1rem;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -.02em;
}

.brand-mark__logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--brand-500), var(--violet-500));
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 1.05rem;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}

.brand-mark__ai {
  font-size: .625rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--warn-600);
  background: var(--amber-100);
  border-radius: 999px;
  padding: .15rem .45rem;
  vertical-align: middle;
}

/* ----------------------------------------------------------------- forms */

.field { margin-bottom: 1rem; }

.field label {
  display: block;
  font-size: .8125rem;
  font-weight: 600;
  color: var(--ink-700);
  margin-bottom: .375rem;
}

.input {
  width: 100%;
  padding: .625rem .75rem;
  font: inherit;
  font-size: .9375rem;
  color: var(--ink-900);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color .15s, box-shadow .15s;
}

.input::placeholder { color: var(--ink-400); }

.input:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, .15);
}

.input[aria-invalid="true"] {
  border-color: var(--danger-600);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, .12);
}

.field-error {
  display: block;
  margin-top: .3rem;
  font-size: .8125rem;
  color: var(--danger-600);
}

.field-hint {
  display: block;
  margin-top: .3rem;
  font-size: .8125rem;
  color: var(--ink-500);
}

.input-group { position: relative; display: flex; }
.input-group .input { padding-right: 3rem; }

.input-group__toggle {
  position: absolute;
  right: .25rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: 0;
  padding: .4rem .55rem;
  font: inherit;
  font-size: .75rem;
  font-weight: 600;
  color: var(--ink-500);
  cursor: pointer;
  border-radius: 8px;
}

.input-group__toggle:hover { color: var(--brand-600); background: var(--line-soft); }

/* --------------------------------------------------------------- buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  width: 100%;
  padding: .6875rem 1rem;
  font: inherit;
  font-size: .9375rem;
  font-weight: 600;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background .15s, box-shadow .15s, border-color .15s, transform .05s;
  text-decoration: none;
}

.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: not-allowed; }

.btn--primary {
  color: #fff;
  background: linear-gradient(135deg, var(--brand-500), var(--violet-500));
  box-shadow: var(--shadow-sm);
}
.btn--primary:hover:not(:disabled) { box-shadow: var(--shadow-md); text-decoration: none; }

.btn--ghost {
  color: var(--ink-700);
  background: var(--surface);
  border-color: var(--line);
}
.btn--ghost:hover { background: var(--line-soft); text-decoration: none; }

.btn--google { color: var(--ink-900); background: var(--surface); border-color: var(--line); }
.btn--google:hover { background: var(--line-soft); box-shadow: var(--shadow-sm); text-decoration: none; }
.btn--google svg { width: 18px; height: 18px; flex: none; }

.btn--sm { width: auto; padding: .4rem .75rem; font-size: .8125rem; }

/* --------------------------------------------------------------- divider */

.divider {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin: 1.25rem 0;
  color: var(--ink-400);
  font-size: .75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.divider::before, .divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* ------------------------------------------------------- signup progress */

.steps-mini {
  display: flex;
  align-items: center;
  gap: .5rem;
  list-style: none;
  margin: 1.5rem 0 0;
  padding: 0;
  font-size: .75rem;
  color: var(--ink-400);
}

.steps-mini li {
  display: flex;
  align-items: center;
  gap: .35rem;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.steps-mini li strong {
  flex: none;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--line-soft);
  color: var(--ink-500);
  display: grid;
  place-items: center;
  font-size: .625rem;
  font-weight: 700;
}

.steps-mini .is-done { color: var(--ok-600); }
.steps-mini .is-done strong { background: var(--ok-50); color: var(--ok-600); }

.steps-mini .is-current { color: var(--brand-700); font-weight: 600; }
.steps-mini .is-current strong {
  background: linear-gradient(135deg, var(--brand-500), var(--violet-500));
  color: #fff;
}

.verified-pill {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .2rem .6rem;
  border-radius: 999px;
  background: var(--ok-50);
  border: 1px solid #a7f3d0;
  color: #065f46;
  font-size: .8125rem;
  font-weight: 600;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------------------------------------------------------------- alerts */

.alert {
  display: flex;
  gap: .625rem;
  padding: .75rem .875rem;
  border-radius: var(--radius);
  font-size: .875rem;
  margin-bottom: 1rem;
  border: 1px solid transparent;
}

.alert--error   { background: var(--danger-50); color: #991b1b; border-color: #fecaca; }
.alert--success { background: var(--ok-50);     color: #065f46; border-color: #a7f3d0; }
.alert--info    { background: #eff6ff;          color: #1e40af; border-color: #bfdbfe; }

/* ------------------------------------------------------------ app layout */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, .85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.topbar__inner {
  max-width: 76rem;
  margin: 0 auto;
  padding: .75rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.topbar__spacer { flex: 1; }

.wallet-chip {
  display: inline-flex;
  align-items: baseline;
  gap: .4rem;
  padding: .375rem .75rem;
  border-radius: 999px;
  background: var(--ok-50);
  border: 1px solid #a7f3d0;
  font-size: .875rem;
  font-weight: 650;
  color: #065f46;
  white-space: nowrap;
}

.wallet-chip--low { background: var(--danger-50); border-color: #fecaca; color: #991b1b; }
.wallet-chip__label { font-size: .6875rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; opacity: .75; }

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  object-fit: cover;
  background: linear-gradient(135deg, var(--brand-500), var(--violet-500));
  color: #fff;
  display: grid;
  place-items: center;
  font-size: .8125rem;
  font-weight: 700;
  flex: none;
}

.page { max-width: 76rem; margin: 0 auto; padding: 2rem 1.25rem 4rem; }

.page-head { margin-bottom: 1.75rem; }
.page-head p { color: var(--ink-500); margin: 0; }

/* ----------------------------------------------------------- module grid */

.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.module {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: box-shadow .18s, transform .18s, border-color .18s;
  text-decoration: none;
  color: inherit;
}

.module:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: #c7d2fe;
  text-decoration: none;
}

.module--soon { opacity: .72; pointer-events: none; }

.module__icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  margin-bottom: 1rem;
  font-size: 1.35rem;
}

.module__icon--pdf   { background: var(--danger-50); }
.module__icon--image { background: #eff6ff; }
.module__icon--chat  { background: var(--amber-100); }

.module h3 { font-size: 1.0625rem; margin-bottom: .25rem; }
.module p { font-size: .875rem; color: var(--ink-500); margin: 0 0 1rem; flex: 1; }

.module__price {
  display: inline-flex;
  align-self: flex-start;
  padding: .25rem .625rem;
  border-radius: 999px;
  background: var(--line-soft);
  font-size: .8125rem;
  font-weight: 650;
  color: var(--ink-700);
}

.badge-soon {
  position: absolute;
  top: 1rem;
  right: 1rem;
  padding: .2rem .5rem;
  border-radius: 999px;
  background: var(--line-soft);
  color: var(--ink-500);
  font-size: .6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
}

/* ----------------------------------------------------------------- cards */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card__head {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: .75rem;
}

.card__head h2 { margin: 0; font-size: .9375rem; }
.card__body { padding: 1.25rem; }

.empty {
  padding: 2.5rem 1.25rem;
  text-align: center;
  color: var(--ink-500);
  font-size: .9375rem;
}

/* ---------------------------------------------------------------- tables */

.table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.table th {
  text-align: left;
  padding: .625rem 1.25rem;
  font-size: .6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-500);
  background: var(--line-soft);
  white-space: nowrap;
}
.table td { padding: .75rem 1.25rem; border-top: 1px solid var(--line-soft); vertical-align: middle; }
.table tbody tr:hover { background: #fbfcfe; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.credit { color: var(--ok-600); font-weight: 650; }
.debit  { color: var(--ink-900); font-weight: 650; }
.muted  { color: var(--ink-500); }

.table-scroll { overflow-x: auto; }

/* ----------------------------------------------------------- error pages */

.error-shell {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
  text-align: center;
}
.error-code {
  font-size: 3.5rem;
  font-weight: 800;
  letter-spacing: -.03em;
  background: linear-gradient(135deg, var(--brand-500), var(--violet-500));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  line-height: 1;
  margin-bottom: .5rem;
}
.error-shell p { color: var(--ink-500); max-width: 26rem; margin-inline: auto; }

/* ----------------------------------------------------------- convert flow */

.step {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.25rem;
  overflow: hidden;
}

.step[hidden] { display: none; }

.step__head {
  display: flex;
  gap: .875rem;
  align-items: flex-start;
  padding: 1.125rem 1.25rem;
  border-bottom: 1px solid var(--line-soft);
}

.step__head h2 { margin: 0 0 .125rem; font-size: 1rem; }

.step__num {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--brand-500), var(--violet-500));
  color: #fff;
  display: grid;
  place-items: center;
  font-size: .8125rem;
  font-weight: 700;
  margin-top: .125rem;
}

.step__num--done { background: var(--ok-600); }

.step__body { padding: 1.25rem; }

.step__actions {
  display: flex;
  gap: .625rem;
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: 1.25rem;
  padding-top: 1.125rem;
  border-top: 1px solid var(--line-soft);
}

/* --------------------------------------------------------------- templates */

.tpl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: .75rem;
  margin-bottom: .5rem;
}

.tpl {
  position: relative;
  display: block;
  padding: .875rem 1rem;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color .15s, background .15s, box-shadow .15s;
}

.tpl:hover { border-color: #c7d2fe; background: #fbfcff; }
.tpl input { position: absolute; opacity: 0; pointer-events: none; }
.tpl:has(input:checked) {
  border-color: var(--brand-500);
  background: #f5f6ff;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, .12);
}

.tpl__body { display: block; }
.tpl__name { display: block; font-weight: 650; font-size: .9375rem; margin-bottom: .125rem; }
.tpl__meta { display: block; font-size: .75rem; color: var(--ink-500); margin-bottom: .375rem; }
.tpl__cols {
  display: block;
  font-size: .75rem;
  color: var(--ink-400);
  line-height: 1.45;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.tpl__badge {
  position: absolute;
  top: .625rem;
  right: .625rem;
  font-size: .625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--brand-600);
  background: #eef2ff;
  border-radius: 999px;
  padding: .125rem .4rem;
}

.tpl-upload { display: flex; align-items: center; gap: .875rem; flex-wrap: wrap; }

/* --------------------------------------------------------------- dropzone */

.dropzone {
  border: 2px dashed var(--line);
  border-radius: var(--radius-lg);
  padding: 2rem 1.25rem;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  background: #fcfdfe;
}

.dropzone:hover, .dropzone:focus-visible { border-color: var(--brand-500); background: #f5f6ff; outline: none; }
.dropzone--over { border-color: var(--brand-500); background: #eef2ff; }
.dropzone__icon { font-size: 2rem; line-height: 1; margin-bottom: .625rem; }
.dropzone__title { font-weight: 600; margin: 0 0 .25rem; }

/* --------------------------------------------------------------- filelist */

.filelist { list-style: none; margin: 1rem 0 0; padding: 0; }

.filelist li {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .625rem .75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: .5rem;
  font-size: .875rem;
  background: var(--surface);
}

.filelist li[data-status="failed"] { border-color: #fecaca; background: var(--danger-50); }
.filelist li[data-status="done"]   { border-color: #a7f3d0; }

.fl__icon { flex: none; font-size: 1.05rem; width: 1.5rem; text-align: center; }
.fl__main { flex: 1; min-width: 0; }
.fl__name { display: block; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fl__meta { display: block; font-size: .75rem; color: var(--ink-500); margin-top: .0625rem; }
.fl__meta--error { color: var(--danger-600); }
.fl__units { flex: none; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }

.fl__tag {
  flex: none;
  font-size: .625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: .15rem .4rem;
  border-radius: 999px;
}

.fl__tag--scanned { color: var(--warn-600); background: var(--warn-50); }

.fl__remove {
  flex: none;
  border: 0;
  background: none;
  color: var(--ink-400);
  cursor: pointer;
  font-size: 1.125rem;
  line-height: 1;
  padding: .25rem .375rem;
  border-radius: 6px;
}
.fl__remove:hover { color: var(--danger-600); background: var(--danger-50); }

.spinner {
  width: 15px;
  height: 15px;
  border: 2px solid var(--line);
  border-top-color: var(--brand-500);
  border-radius: 999px;
  animation: spin .7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------------ quote */

.quote {
  text-align: center;
  padding: 1.75rem 1.25rem;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, #eef2ff, #f5f3ff);
  border: 1px solid #ddd6fe;
}

.quote__row { font-size: 1rem; color: var(--ink-700); font-weight: 550; }
.quote__mult { color: var(--ink-400); margin: 0 .4rem; }

.quote__total {
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -.02em;
  margin: .375rem 0 .625rem;
  background: linear-gradient(135deg, var(--brand-600), var(--violet-500));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.quote__balance { font-size: .875rem; color: var(--ink-500); }
.quote__balance strong { color: var(--ink-900); }

.filelist--summary li { padding: .5rem .75rem; }

/* --------------------------------------------------------------- progress */

.progress {
  height: 8px;
  background: var(--line-soft);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: .5rem;
}

.progress__bar {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand-500), var(--violet-500));
  transition: width .4s ease;
}

/* ------------------------------------------------------------------ chat */

.chat {
  display: grid;
  grid-template-columns: 15rem 1fr;
  gap: 1.25rem;
  height: calc(100dvh - 8rem);
  min-height: 30rem;
}

.chat__side { display: flex; flex-direction: column; gap: .75rem; min-width: 0; }

.chat__side-label {
  font-size: .6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-400);
  margin: .5rem 0 0;
}

.chat__list { display: flex; flex-direction: column; gap: .25rem; overflow-y: auto; }

.chat__item {
  display: block;
  padding: .5rem .625rem;
  border-radius: 10px;
  color: var(--ink-700);
  text-decoration: none;
  transition: background .15s;
}
.chat__item:hover { background: var(--line-soft); text-decoration: none; }
.chat__item--active { background: #eef2ff; color: var(--brand-700); }

.chat__item-title {
  display: block;
  font-size: .8125rem;
  font-weight: 550;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat__item-meta { display: block; font-size: .6875rem; color: var(--ink-400); }

.chat__main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.chat__bar {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .625rem 1rem;
  border-bottom: 1px solid var(--line);
  background: #fcfdfe;
}

.chat__spend { display: flex; align-items: baseline; gap: .4rem; font-size: .875rem; }
.chat__spend-label {
  font-size: .6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--ink-400);
}
.chat__spend strong { color: var(--ink-900); font-variant-numeric: tabular-nums; }

.chat__model select {
  font: inherit;
  font-size: .8125rem;
  font-weight: 600;
  padding: .3rem 1.75rem .3rem .6rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2364748b' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right .6rem center;
  color: var(--ink-700);
  cursor: pointer;
  appearance: none;
}
.chat__model select:focus { outline: none; border-color: var(--brand-500); box-shadow: 0 0 0 3px rgba(99,102,241,.15); }

.chat__scroll { flex: 1; overflow-y: auto; padding: 1.25rem; scroll-behavior: smooth; }

.chat__empty { text-align: center; padding: 2.5rem 1rem; max-width: 30rem; margin: 0 auto; }
.chat__empty-icon { font-size: 2rem; margin-bottom: .5rem; }
.chat__empty h2 { font-size: 1.125rem; }

.chat__suggestions { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; margin-top: 1.25rem; }

.chip {
  font: inherit;
  font-size: .8125rem;
  padding: .4rem .75rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-700);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.chip:hover { border-color: var(--brand-500); background: #f5f6ff; color: var(--brand-700); }

.msg { margin-bottom: 1rem; display: flex; flex-direction: column; }
.msg--user { align-items: flex-end; }

.msg__body {
  max-width: 46ch;
  padding: .625rem .875rem;
  border-radius: 14px;
  font-size: .9375rem;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.msg--user .msg__body {
  background: linear-gradient(135deg, var(--brand-500), var(--violet-500));
  color: #fff;
  border-bottom-right-radius: 4px;
}

.msg--assistant .msg__body {
  background: var(--line-soft);
  color: var(--ink-900);
  border-bottom-left-radius: 4px;
  max-width: 62ch;
}

.msg__cost {
  font-size: .6875rem;
  color: var(--ink-400);
  margin-top: .25rem;
  font-variant-numeric: tabular-nums;
}

.dots { display: inline-flex; gap: 4px; padding: .2rem 0; }
.dots i {
  width: 6px; height: 6px; border-radius: 999px; background: var(--ink-400);
  animation: blink 1.2s infinite ease-in-out;
}
.dots i:nth-child(2) { animation-delay: .18s; }
.dots i:nth-child(3) { animation-delay: .36s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

.chat__composer { border-top: 1px solid var(--line); padding: .875rem 1rem; background: #fcfdfe; }
.chat__composer form { display: flex; gap: .625rem; align-items: flex-end; }
.chat__composer textarea { resize: none; overflow-y: auto; max-height: 200px; }
.chat__hint { margin: .5rem 0 0; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

@media (max-width: 52rem) {
  .chat { grid-template-columns: 1fr; height: auto; }
  .chat__side { flex-direction: row; align-items: center; overflow-x: auto; }
  .chat__side-label { display: none; }
  .chat__list { flex-direction: row; }
  .chat__item { white-space: nowrap; }
  .chat__scroll { min-height: 24rem; max-height: 60dvh; }
}

/* ------------------------------------------------------- onboarding desk */

.onboard { max-width: 54rem; }

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.input[readonly] { background: var(--line-soft); color: var(--ink-500); cursor: default; }

.amount-input { position: relative; }
.amount-input__rupee {
  position: absolute;
  left: .75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-500);
  font-weight: 600;
  pointer-events: none;
}
.amount-input .input { padding-left: 1.75rem; }

.calc {
  margin: 1rem 0;
  padding: .875rem 1rem;
  border-radius: var(--radius);
  background: var(--line-soft);
  border: 1px solid var(--line);
  transition: background .2s, border-color .2s;
}
.calc--active { background: #f5f6ff; border-color: #ddd6fe; }

.calc__line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: .875rem;
  color: var(--ink-700);
  padding: .2rem 0;
}
.calc__line strong { font-variant-numeric: tabular-nums; }

.calc__line--total {
  margin-top: .375rem;
  padding-top: .5rem;
  border-top: 1px solid var(--line);
  font-size: 1rem;
}
.calc__line--total strong { font-size: 1.25rem; font-weight: 750; color: var(--brand-700); }

.calc__note {
  margin: .5rem 0 0;
  font-size: .8125rem;
  color: var(--ink-500);
}
.calc__note strong { color: var(--ok-600); }

.onboard-actions { display: flex; gap: .375rem; justify-content: flex-end; }

.pill {
  display: inline-block;
  padding: .2rem .55rem;
  border-radius: 999px;
  background: var(--line-soft);
  color: var(--ink-500);
  font-size: .75rem;
  font-weight: 650;
  white-space: nowrap;
}
.pill--done { background: var(--ok-50); color: var(--ok-600); }

/* ---------------------------------------------------------- QR overlay */

.qr-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 1.25rem;
  background: rgba(15, 23, 42, .55);
  backdrop-filter: blur(3px);
  overflow-y: auto;
}
.qr-overlay[hidden] { display: none; }

.qr-card {
  width: 100%;
  max-width: 22rem;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 1.5rem;
  text-align: center;
  animation: qr-pop .18s ease-out;
}

@keyframes qr-pop {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
  to   { opacity: 1; transform: none; }
}

.qr-welcome { font-size: 1.0625rem; font-weight: 700; margin: 0 0 .125rem; }
.qr-sub { font-size: .8125rem; color: var(--ink-500); margin: 0 0 1rem; }

.qr-box {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: .625rem;
  margin-bottom: 1rem;
  line-height: 0;
}
.qr-box svg { width: 100%; height: auto; display: block; }

.qr-amount {
  font-size: 1.875rem;
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--ink-900);
  font-variant-numeric: tabular-nums;
}
.qr-breakdown { font-size: .8125rem; color: var(--ink-500); margin: .125rem 0 .375rem; }
.qr-upi { font-size: .8125rem; color: var(--ink-700); font-weight: 600; margin: 0 0 1rem; word-break: break-all; }

@media (max-width: 40rem) {
  .field-row { grid-template-columns: 1fr; gap: 0; }
  .onboard-actions { flex-direction: column; align-items: stretch; }
}

/* --------------------------------------------------------------- utility */

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-0 { margin-bottom: 0; }
.text-center { text-align: center; }
.small { font-size: .8125rem; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }

@media (max-width: 30rem) {
  .auth-card { padding: 1.5rem; }
  .topbar__inner { padding: .625rem 1rem; }
  .page { padding: 1.5rem 1rem 3rem; }
  .wallet-chip__label { display: none; }
}
