/* LeadsBox partner app (Telegram Mini App). Colors follow the user's Telegram theme. */
:root {
  --bg: var(--tg-theme-secondary-bg-color, #f1f2f6);
  --card: var(--tg-theme-section-bg-color, var(--tg-theme-bg-color, #ffffff));
  --text: var(--tg-theme-text-color, #141821);
  --hint: var(--tg-theme-hint-color, #8a8f9c);
  --link: var(--tg-theme-link-color, #3b82f6);
  --accent: var(--tg-theme-button-color, #4b47e0);
  --accent-text: var(--tg-theme-button-text-color, #ffffff);
  --head: var(--tg-theme-section-header-text-color, var(--hint));
  --red: var(--tg-theme-destructive-text-color, #e5484d);
  --green: #1f9d55; --amber: #c27c0e;
  --line: color-mix(in srgb, var(--hint) 22%, transparent);
}
@media (prefers-color-scheme: dark) {
  :root { --bg: var(--tg-theme-secondary-bg-color, #0f1115); --card: var(--tg-theme-section-bg-color, var(--tg-theme-bg-color, #1a1d24)); --text: var(--tg-theme-text-color, #eceef3);
    --hint: var(--tg-theme-hint-color, #8d93a3); --green: #3ccf7c; --amber: #f0b44c; }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif; -webkit-font-smoothing: antialiased; min-height: 100vh; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--link); }
.hidden { display: none !important; }

.boot, .loading { display: grid; place-items: center; padding: 48px 0; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty-page { min-height: 90vh; display: flex; flex-direction: column; gap: 14px; align-items: center; justify-content: center; text-align: center; padding: 24px; color: var(--hint); }

/* Header and tabs */
.top { display: flex; align-items: center; gap: 12px; padding: 14px 16px 6px; }
.hello { flex: 1; min-width: 0; }
.brand { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--hint); font-weight: 700; }
.greet { font-size: 20px; font-weight: 750; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lang { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 6px 8px; font-size: 13px; }
.view { padding: 8px 12px calc(84px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px; }
.tabs { position: fixed; left: 0; right: 0; bottom: 0; display: flex; background: var(--card); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); z-index: 10; }
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; border: 0; background: none; color: var(--hint); font-size: 10.5px; font-weight: 600; padding: 4px 0; cursor: pointer; position: relative; min-width: 0; }
.tab span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.tab svg { width: 24px; height: 24px; fill: currentColor; }
.tab.on { color: var(--accent); }
.tab .dot { position: absolute; top: 3px; left: calc(50% + 8px); width: 8px; height: 8px; border-radius: 50%; background: var(--red); }

/* Cards */
.card { background: var(--card); border-radius: 16px; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; border: 0; text-align: left; width: 100%; }
.card h2 { margin: 0; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--head); font-weight: 700; }
.card h3 { margin: 6px 0 0; font-size: 14px; font-weight: 700; }
.card p { margin: 0; }
.hint { color: var(--hint); font-size: 13px; }
.hint.ok { color: var(--green); }
.hint.bad, .bad { color: var(--red); }
.hint.small { font-size: 12px; }
.center { text-align: center; }
.text { white-space: pre-wrap; overflow-wrap: anywhere; }
.row { display: flex; align-items: center; gap: 10px; }
.grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.empty { text-align: center; color: var(--hint); padding: 28px 16px; display: flex; flex-direction: column; gap: 12px; align-items: center; }
.card.empty { align-items: stretch; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 12px; padding: 12px 16px; background: var(--accent); color: var(--accent-text); font-weight: 650; cursor: pointer; text-decoration: none; width: 100%; }
.btn:disabled { opacity: .55; }
.btn:active { transform: scale(.985); }
.btn.ghost { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); }
.btn.small { width: auto; padding: 7px 12px; font-size: 13px; border-radius: 10px; }
.link { border: 0; background: none; color: var(--link); padding: 0; cursor: pointer; font-size: 13px; }
.pill { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; white-space: nowrap; background: color-mix(in srgb, var(--hint) 16%, transparent); color: var(--hint); }
.pill.ok { background: color-mix(in srgb, var(--green) 16%, transparent); color: var(--green); }
.pill.wait { background: color-mix(in srgb, var(--amber) 16%, transparent); color: var(--amber); }

/* Onboarding */
.progress { height: 8px; border-radius: 6px; background: var(--line); overflow: hidden; }
.progress .fill { height: 100%; background: var(--accent); border-radius: 6px; transition: width .4s ease; }
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.step { display: flex; gap: 12px; }
.step .mark { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line); flex: none; display: grid; place-items: center; font-weight: 800; font-size: 13px; color: var(--accent-text); margin-top: 1px; }
.step.done .mark { background: var(--green); border-color: var(--green); }
.step.done b { color: var(--hint); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--hint) 60%, transparent); }
.step .body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.step p { color: var(--hint); font-size: 13.5px; }
.step .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; align-items: center; }
.quick { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.qa { background: var(--card); border: 0; border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; font-weight: 650; cursor: pointer; text-align: left; }
.qa .ic { font-size: 22px; }

/* Offers */
.filters { display: flex; flex-direction: column; gap: 8px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -12px; padding: 0 12px; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.chip.on { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.select, .input { width: 100%; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; outline: none; }
.input:focus, .select:focus { border-color: var(--accent); }
textarea.input { resize: vertical; min-height: 84px; }
.offer { cursor: pointer; }
.meta { display: flex; gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--hint); }
.meta .strong { color: var(--green); font-weight: 750; }
.meta.big { font-size: 14px; }
.geos { font-size: 12.5px; color: var(--hint); letter-spacing: .02em; }
.kv { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.kv:last-child { border-bottom: 0; }
.kv span { color: var(--hint); }

/* Stats */
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kpi { background: var(--card); border-radius: 16px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.kpi span { font-size: 12.5px; color: var(--hint); font-weight: 600; }
.kpi b { font-size: 22px; letter-spacing: -.01em; }
.kpi.wide { grid-column: span 2; }
.kpi.wide b { color: var(--green); font-size: 26px; }
.chart svg { width: 100%; height: auto; }
.chart rect { fill: var(--accent); opacity: .85; }
.chart text { fill: var(--hint); font-size: 9px; }

/* Requests and documents */
.item { display: flex; flex-direction: column; gap: 4px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.item:last-of-type { border-bottom: 0; }
.sub { font-size: 13.5px; overflow-wrap: anywhere; }
.list { gap: 0; padding: 4px 6px; }
.doc { display: flex; align-items: center; gap: 12px; border: 0; background: none; padding: 12px 10px; text-align: left; cursor: pointer; border-bottom: 1px solid var(--line); width: 100%; }
.doc:last-child { border-bottom: 0; }
.doc .ic { font-size: 22px; }
.doc .grow { display: flex; flex-direction: column; }
.doc .go { color: var(--hint); font-size: 22px; }

/* Ad check */
.chips.wrap .chip { min-width: 46px; text-align: center; }
.result.pass { border: 2px solid color-mix(in srgb, var(--green) 50%, transparent); }
.result.warn { border: 2px solid color-mix(in srgb, var(--amber) 50%, transparent); }
.result.fail { border: 2px solid color-mix(in srgb, var(--red) 50%, transparent); }
.verdict { font-size: 17px; }
.score { font-weight: 800; color: var(--hint); }
.finding { border-left: 3px solid var(--line); padding: 4px 0 4px 10px; display: flex; flex-direction: column; gap: 3px; }
.finding.high { border-color: var(--red); }
.finding.medium { border-color: var(--amber); }
.finding.low { border-color: #d8c100; }
.finding p { font-size: 13.5px; }
.finding q { font-size: 13px; color: var(--hint); font-style: italic; }
.finding .fix { color: var(--green); }
.safer { white-space: pre-wrap; background: color-mix(in srgb, var(--accent) 7%, transparent); border-radius: 12px; padding: 10px 12px; font-size: 14px; }

.toast { position: fixed; left: 16px; right: 16px; bottom: calc(90px + env(safe-area-inset-bottom)); background: #1d2230; color: #fff; padding: 11px 14px; border-radius: 12px; font-size: 14px; text-align: center;
  opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s; z-index: 30; box-shadow: 0 8px 24px rgba(0,0,0,.2); }
.toast.show { opacity: 1; transform: none; }
.toast.bad { background: var(--red); }

/* v3: payouts, conversations, monitor, web portal */
.stack { display: flex; flex-direction: column; gap: 10px; }
/* Seven tabs still fit a phone: narrower icons and labels, scrolling only on very small screens. */
.tabs.many { overflow-x: auto; scrollbar-width: none; padding-left: 2px; padding-right: 2px; }
.tabs.many::-webkit-scrollbar { display: none; }
.tabs.many .tab { flex: 1 1 0; min-width: 46px; padding: 4px 1px; font-size: 10px; letter-spacing: -0.1px; }
.tabs.many .tab svg { width: 22px; height: 22px; }
.item.click { border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left; width: 100%; cursor: pointer; padding: 10px 0; color: inherit; }
.item.click:last-of-type { border-bottom: 0; }
.pill.bad { background: color-mix(in srgb, var(--red) 15%, transparent); color: var(--red); }
.pill.muted { opacity: .85; }
.thread { display: flex; flex-direction: column; gap: 8px; }
.bubble { max-width: 86%; padding: 9px 12px; border-radius: 14px; background: color-mix(in srgb, var(--hint) 10%, var(--card)); display: flex; flex-direction: column; gap: 3px; align-self: flex-start; }
.bubble.you { align-self: flex-end; background: color-mix(in srgb, var(--accent) 16%, var(--card)); border-bottom-right-radius: 4px; }
.bubble.team { border-bottom-left-radius: 4px; }
.bubble.ai { border-bottom-left-radius: 4px; background: color-mix(in srgb, #7c3aed 12%, var(--card)); }
.bubble .who { font-size: 11.5px; font-weight: 700; color: var(--hint); }
.bubble .time { font-size: 11px; color: var(--hint); align-self: flex-end; }
.bubble .text { white-space: pre-wrap; overflow-wrap: anywhere; }
.composer textarea { min-height: 70px; }
.top .back { width: auto; padding: 6px 12px; font-size: 18px; line-height: 1; }
.top .link { font-size: 13px; white-space: nowrap; }
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 420px; align-items: stretch; text-align: center; padding: 28px 24px; gap: 12px; }
.login-card .logo { width: 56px; height: 56px; margin: 0 auto; }
.login-card h1 { margin: 0; font-size: 22px; letter-spacing: -.01em; }
.login-card .lang { align-self: center; margin-top: 6px; }
.or { display: flex; align-items: center; gap: 10px; color: var(--hint); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* The web portal on wide screens: header on top, tabs as a sidebar. */
body.web { background: var(--bg); }
@media (min-width: 900px) {
  body.web #app { display: grid; grid-template-columns: 220px minmax(0, 1fr); grid-template-areas: "head head" "nav view"; max-width: 1120px; margin: 0 auto; column-gap: 20px; padding: 0 20px; }
  /* Signed out there is no header or sidebar: the sign-in card is centred on the whole page. */
  body.web .login, body.web #app > .empty-page { grid-column: 1 / -1; }
  body.web .top { grid-area: head; padding: 22px 4px 10px; }
  body.web .view { grid-area: view; padding: 8px 0 40px; }
  body.web .tabs { grid-area: nav; position: sticky; top: 16px; align-self: start; flex-direction: column; gap: 2px; background: transparent; border: 0; padding: 8px 0; overflow: visible; }
  body.web .tabs .tab, body.web .tabs.many .tab { flex-direction: row; justify-content: flex-start; gap: 10px; font-size: 14.5px; padding: 10px 12px; border-radius: 12px; min-width: 0; }
  body.web .tabs .tab svg { width: 20px; height: 20px; }
  body.web .tabs .tab.on { background: color-mix(in srgb, var(--accent) 12%, transparent); }
  body.web .tab .dot { top: 50%; left: auto; right: 10px; transform: translateY(-50%); }
  body.web .quick { grid-template-columns: repeat(4, 1fr); }
  body.web .toast { left: auto; right: 24px; bottom: 24px; max-width: 420px; }
  body.web .btn { width: auto; }
  body.web .card > .btn, body.web .composer .btn { align-self: flex-start; }
  body.web .login-card .btn { width: 100%; }
}
