/* ── Krevo · shared buyer UI styles ─────────────────────────────────
   Design tokens + components. Dark text on light bg, clean fintech look.
   Mobile-first responsive. Other teams: link /css/style.css and extend —
   do not fork. */

:root {
  /* brand */
  --brand: #4f46e5;
  --brand-dark: #4338ca;
  --brand-darker: #3730a3;
  --brand-soft: #eef2ff;
  --accent: #0ea5e9;

  /* surfaces */
  --bg: #f6f8fc;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --ink: #101a2c;
  --ink-2: #334155;
  --muted: #64748b;
  --line: #e4eaf3;
  --line-2: #eef2f7;

  /* feedback */
  --ok: #15803d;
  --ok-soft: #e9f9ef;
  --ok-line: #bbe7c8;
  --warn: #b45309;
  --warn-soft: #fef5e4;
  --warn-line: #f3d9a8;
  --err: #dc2626;
  --err-soft: #fdeeee;
  --err-line: #f5c2c2;
  --info: #0369a1;
  --info-soft: #e8f4fd;
  --info-line: #b9def5;

  /* shape */
  --radius: 14px;
  --radius-sm: 9px;
  --radius-xs: 6px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 10px 28px -14px rgba(16, 24, 40, .16);
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .07);

  /* spacing */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px;
  --s6: 24px; --s7: 32px; --s8: 40px; --s9: 56px;

  --max-w: 1080px;
  --max-w-sm: 560px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
          "Noto Sans", "Noto Sans Devanagari", "Mangal", sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 15.5px;
  line-height: 1.55;
}
img { max-width: 100%; display: block; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── layout ── */
.wrap { max-width: var(--max-w); margin: 0 auto; padding: 0 var(--s4); }
.wrap-sm { max-width: var(--max-w-sm); margin: 0 auto; padding: 0 var(--s4); }
.section { padding: var(--s8) 0; }
.mt1{margin-top:var(--s1)} .mt2{margin-top:var(--s2)} .mt3{margin-top:var(--s3)}
.mt4{margin-top:var(--s4)} .mt5{margin-top:var(--s5)} .mt6{margin-top:var(--s6)}
.mb2{margin-bottom:var(--s2)} .mb3{margin-bottom:var(--s3)} .mb4{margin-bottom:var(--s4)}
.text-muted { color: var(--muted); }
.text-center { text-align: center; }
.small { font-size: 13px; }

/* ── topbar ── */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 50;
}
.topbar-in {
  max-width: var(--max-w); margin: 0 auto; padding: var(--s3) var(--s4);
  display: flex; align-items: center; gap: var(--s4);
}
.brand { font-weight: 800; font-size: 19px; color: var(--ink); letter-spacing: -.02em; }
.brand b { color: var(--brand); }
.brand:hover { text-decoration: none; }
.topbar nav { margin-left: auto; display: flex; align-items: center; gap: var(--s2); }
.topbar nav a.navlink {
  color: var(--ink-2); font-weight: 600; font-size: 14px;
  padding: var(--s2) var(--s3); border-radius: var(--radius-sm);
}
.topbar nav a.navlink:hover { background: var(--surface-2); text-decoration: none; }

/* ── buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  font: inherit; font-weight: 700; font-size: 15px;
  padding: 11px 20px; border-radius: var(--radius-sm);
  border: 1px solid transparent; cursor: pointer;
  transition: transform .04s ease, box-shadow .15s ease, background .15s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--brand); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--brand-dark); }
.btn-outline { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn-outline:hover { border-color: var(--brand); color: var(--brand-dark); }
.btn-ghost { background: transparent; color: var(--brand-dark); padding: 8px 12px; }
.btn-ghost:hover { background: var(--brand-soft); }
.btn-danger { background: var(--err); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-success { background: var(--ok); color: #fff; }
.btn-sm { padding: 7px 13px; font-size: 13.5px; }
.btn-block { width: 100%; }
.btn-lg { padding: 14px 26px; font-size: 16.5px; }

/* ── cards ── */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  padding: var(--s5);
}
.card.flat { box-shadow: none; }
.card-pad-lg { padding: var(--s7); }
.card-title { margin: 0 0 var(--s2); font-size: 18px; letter-spacing: -.01em; }
.grid { display: grid; gap: var(--s4); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 760px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* ── forms ── */
.field { margin-bottom: var(--s4); }
.label { display: block; font-weight: 700; font-size: 13.5px; margin-bottom: var(--s2); color: var(--ink-2); }
.input, .select, .textarea {
  width: 100%; font: inherit; font-size: 15.5px; color: var(--ink);
  background: var(--surface); border: 1.5px solid var(--line);
  border-radius: var(--radius-sm); padding: 11px 13px;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft);
}
.input.invalid { border-color: var(--err); }
.field-err { color: var(--err); font-size: 13px; margin-top: var(--s1); font-weight: 600; }
.field-hint { color: var(--muted); font-size: 13px; margin-top: var(--s1); }
.textarea { min-height: 96px; resize: vertical; }
.otp-row { display: flex; gap: var(--s2); }
.otp-row .input { text-align: center; letter-spacing: .35em; font-size: 20px; font-weight: 700; }

/* ── badges ── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 700; letter-spacing: .02em;
  padding: 3px 10px; border-radius: 999px; border: 1px solid transparent;
  text-transform: uppercase;
}
.badge-ok { background: var(--ok-soft); color: var(--ok); border-color: var(--ok-line); }
.badge-warn { background: var(--warn-soft); color: var(--warn); border-color: var(--warn-line); }
.badge-err { background: var(--err-soft); color: var(--err); border-color: var(--err-line); }
.badge-info { background: var(--info-soft); color: var(--info); border-color: var(--info-line); }
.badge-neutral { background: var(--surface-2); color: var(--ink-2); border-color: var(--line); }
.badge-brand { background: var(--brand-soft); color: var(--brand-dark); border-color: #d9defe; }

/* ── alerts ── */
.alert {
  border: 1px solid; border-radius: var(--radius-sm);
  padding: var(--s3) var(--s4); font-size: 14px; font-weight: 500;
}
.alert-ok { background: var(--ok-soft); border-color: var(--ok-line); color: #14532d; }
.alert-warn { background: var(--warn-soft); border-color: var(--warn-line); color: #7c2d12; }
.alert-err { background: var(--err-soft); border-color: var(--err-line); color: #7f1d1d; }
.alert-info { background: var(--info-soft); border-color: var(--info-line); color: #0c4a6e; }

/* ── tables ── */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line-2); }
.table th { background: var(--surface-2); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.table tr:last-child td { border-bottom: none; }

/* ── spinner / loading ── */
.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2.5px solid rgba(255,255,255,.45); border-top-color: #fff;
  animation: spin .7s linear infinite; display: inline-block; vertical-align: -3px;
}
.spinner.dark { border-color: var(--line); border-top-color: var(--brand); }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-block { text-align: center; padding: var(--s9) var(--s4); color: var(--muted); }
.loading-block .spinner.dark { width: 30px; height: 30px; border-width: 3.5px; }

/* ── toast ── */
#toast-root {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: 22px; z-index: 9999; display: flex; flex-direction: column; gap: var(--s2);
  width: min(92vw, 460px);
}
.toast {
  background: #101a2c; color: #fff; border-radius: var(--radius-sm);
  padding: 12px 16px; font-size: 14px; font-weight: 500;
  box-shadow: 0 12px 30px -8px rgba(0,0,0,.35);
  animation: toast-in .22s ease-out;
}
.toast.err { background: #7f1d1d; }
.toast.ok { background: #14532d; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

/* ── hero / landing ── */
.hero {
  background: radial-gradient(1100px 480px at 50% -80px, var(--brand-soft), transparent),
              var(--surface);
  border-bottom: 1px solid var(--line);
  padding: var(--s9) 0 var(--s8);
  text-align: center;
}
.hero h1 { font-size: clamp(30px, 5vw, 46px); letter-spacing: -.03em; margin: 0 0 var(--s3); }
.hero h1 .hl { color: var(--brand); }
.hero p.lead { color: var(--muted); font-size: 18px; max-width: 640px; margin: 0 auto var(--s6); }
.hero-cta { display: flex; gap: var(--s3); justify-content: center; flex-wrap: wrap; }
.step-num {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--brand-soft); color: var(--brand-dark);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 17px; margin-bottom: var(--s3);
}
.footer { border-top: 1px solid var(--line); padding: var(--s6) 0; color: var(--muted); font-size: 13.5px; }
.footer .wrap { display: flex; gap: var(--s5); flex-wrap: wrap; align-items: center; justify-content: space-between; }
.footer nav { display: flex; gap: var(--s4); flex-wrap: wrap; }

/* ── storefront / product ── */
.creator-head { display: flex; gap: var(--s4); align-items: center; }
.avatar {
  width: 64px; height: 64px; border-radius: 50%; object-fit: cover;
  background: var(--brand-soft); color: var(--brand-dark);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 24px; flex: none;
}
.product-card { display: flex; flex-direction: column; height: 100%; }
.product-card .p-title { font-size: 16.5px; font-weight: 700; margin: 0 0 var(--s1); }
.product-card .p-desc { color: var(--muted); font-size: 13.5px; flex: 1;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.product-card .p-foot { display: flex; align-items: center; justify-content: space-between; margin-top: var(--s4); }
.price { font-size: 20px; font-weight: 800; letter-spacing: -.01em; }
.price-old { text-decoration: line-through; color: var(--muted); font-size: 14px; font-weight: 500; margin-right: var(--s2); }
.price-row { display: flex; align-items: baseline; gap: var(--s2); flex-wrap: wrap; }

/* ── learn player ── */
.player-layout { display: grid; grid-template-columns: 300px 1fr; gap: var(--s5); align-items: start; }
@media (max-width: 860px) { .player-layout { grid-template-columns: 1fr; } }
.lesson-list { max-height: 70vh; overflow-y: auto; }
.module-title { font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: var(--s4) 0 var(--s2); }
.lesson-item {
  display: flex; gap: var(--s2); align-items: flex-start; width: 100%;
  text-align: left; background: none; border: 1px solid transparent;
  border-radius: var(--radius-sm); padding: 9px 10px; cursor: pointer; font: inherit; font-size: 14px;
}
.lesson-item:hover { background: var(--surface-2); }
.lesson-item.active { background: var(--brand-soft); border-color: #d9defe; }
.lesson-item.locked { opacity: .55; cursor: not-allowed; }
.lesson-item .tick { color: var(--ok); font-weight: 800; flex: none; }
.lesson-body { min-height: 320px; }
.lesson-body video { width: 100%; border-radius: var(--radius-sm); background: #000; max-height: 62vh; }
.prose { white-space: pre-wrap; }
.quiz-q { font-weight: 700; margin: var(--s4) 0 var(--s2); }
.quiz-opt { display: flex; gap: var(--s2); align-items: flex-start; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: var(--s2); cursor: pointer; }
.quiz-opt:hover { border-color: var(--brand); }
.quiz-opt input { margin-top: 3px; }
.progress { height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), var(--accent)); border-radius: 999px; transition: width .4s ease; }

/* ── misc ── */
.divider { border: none; border-top: 1px solid var(--line); margin: var(--s5) 0; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: var(--s2) var(--s4); font-size: 14px; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; font-weight: 600; }
@media (max-width: 560px) { .kv { grid-template-columns: 1fr; } .kv dt { margin-top: var(--s2); } }
.copy-row { display: flex; gap: var(--s2); align-items: center; }
.copy-row .input { font-family: ui-monospace, monospace; font-size: 13px; }
.list-plain { list-style: none; margin: 0; padding: 0; }
.list-plain > li { padding: var(--s3) 0; border-bottom: 1px solid var(--line-2); }
.list-plain > li:last-child { border-bottom: none; }
.empty { text-align: center; color: var(--muted); padding: var(--s7) var(--s4); }
.lang-toggle { font-weight: 700; font-size: 13.5px; }
details.disclosure { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: var(--s3) var(--s4); background: var(--surface); }
details.disclosure summary { cursor: pointer; font-weight: 700; }
