/* Zaem.com portals - shared styles (login, partner; later client and investor).
   Same brand as zaem.com: Inter for text, Unbounded for display, deep greens, #1EC677 actions.
   Calmer than the site: light ground, white cards, no hero photos. Inter line-height max 1.3. */

:root {
  --g-950: #002819;
  --g-900: #052316;
  --g-800: #053A24;
  --g-700: #005C38;
  --ink: #004127;
  --cta: #1EC677;
  --cta-2: #14B66A;
  --on-cta: #002E1B;
  --mint: #E8FAED;
  --mint-2: #CDEBD6;
  --bg: #F3F6F4;
  --card: #ffffff;
  --line: #E1E9E4;
  --line-2: #CCD9D2;
  --text: #0B2A1D;
  --mute: #557066;
  --amber-bg: #FFF4DC;
  --amber: #7A4A00;
  --amber-line: #E8B23E;
  --err: #B42318;
  --err-bg: #FEF0EE;
  --grey-bg: #EEF1EF;
  --grey: #56635D;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 24px;
  --side: 248px;
  --shadow: 0 1px 2px rgba(0, 40, 25, .04), 0 8px 24px rgba(0, 40, 25, .06);
  --shadow-pop: 0 8px 24px rgba(0, 40, 25, .12), 0 32px 64px rgba(0, 40, 25, .18);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Unbounded", "Inter", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.3;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--ink); }
img, svg { display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
.sr { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.num { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 3px solid rgba(30, 198, 119, .55); outline-offset: 2px; border-radius: 8px; }

/* ---------- Type ---------- */
.dsp { font-family: var(--display); font-weight: 900; letter-spacing: -.02em; text-transform: uppercase; line-height: 1.05; }
.h1 { font-family: var(--display); font-weight: 900; letter-spacing: -.02em; text-transform: uppercase; line-height: 1.05; font-size: 22px; color: var(--ink); }
@media (min-width: 960px) { .h1 { font-size: 28px; } }
.h2 { font-size: 18px; font-weight: 700; color: var(--ink); letter-spacing: -.01em; }
.lead { font-size: 16px; color: var(--mute); }
.small { font-size: 14px; }
.cap { font-size: 13px; color: var(--mute); }
.mute { color: var(--mute); }
.ph { background: var(--amber-bg); color: var(--amber); border-radius: 6px; padding: 1px 6px; font-weight: 600; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 0 24px; border-radius: 26px; border: 0;
  background: var(--cta); color: var(--on-cta);
  font-size: 16px; font-weight: 600; text-decoration: none; cursor: pointer;
  transition: background 150ms ease, color 150ms ease, transform 150ms ease;
  touch-action: manipulation;
}
.btn:hover { background: var(--ink); color: #fff; }
.btn:active { transform: scale(.98); }
.btn[disabled], .btn[aria-disabled="true"] { background: #DCE5E0; color: #6A7F76; cursor: not-allowed; transform: none; }
.btn.block { width: 100%; }
.btn.sec { background: var(--mint); color: var(--ink); }
.btn.sec:hover { background: var(--mint-2); color: var(--ink); }
.btn.line { background: #fff; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line-2); }
.btn.line:hover { background: var(--mint); color: var(--ink); }
.btn.dark { background: var(--ink); color: #fff; }
.btn.dark:hover { background: var(--g-950); }
.btn.sm { min-height: 44px; padding: 0 18px; font-size: 15px; border-radius: 22px; }
.btn svg { width: 20px; height: 20px; flex: none; }
.link { background: none; border: 0; padding: 12px 4px; min-height: 44px; color: var(--ink); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; display: inline-flex; align-items: center; }
.link:hover { color: var(--g-700); }
.link[disabled] { color: var(--mute); text-decoration: none; cursor: default; }
.iconbtn { width: 44px; height: 44px; border-radius: 22px; border: 0; background: transparent; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: var(--ink); flex: none; }
.iconbtn:hover { background: var(--mint); }
.iconbtn svg { width: 20px; height: 20px; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .lbl { font-size: 14px; font-weight: 600; color: var(--ink); }
.opt { font-weight: 500; color: var(--mute); }
.inp, .sel, .txt {
  width: 100%; min-height: 52px; padding: 0 16px; border-radius: var(--r-md);
  border: 1.5px solid var(--line-2); background: #fff; font-size: 16px; color: var(--text);
  transition: border-color 150ms ease, box-shadow 150ms ease; -webkit-appearance: none; appearance: none;
}
.txt { min-height: 104px; padding: 14px 16px; resize: vertical; line-height: 1.3; }
.sel { padding-right: 44px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' fill='none' stroke='%23004127' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 8l5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; cursor: pointer; }
.inp::placeholder, .txt::placeholder { color: #8AA197; }
.inp:focus, .sel:focus, .txt:focus { outline: none; border-color: var(--g-700); box-shadow: 0 0 0 4px rgba(30, 198, 119, .22); }
.inp[aria-invalid="true"], .txt[aria-invalid="true"] { border-color: var(--err); }
.hint { font-size: 13px; color: var(--mute); }
.ferr { font-size: 14px; color: var(--err); font-weight: 500; display: flex; gap: 6px; align-items: flex-start; }
.ferr:empty { display: none; }
.inp-wrap { position: relative; }
.inp-wrap .inp { padding-right: 52px; }
.inp-wrap .iconbtn { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); }
.suffix { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); color: var(--mute); font-weight: 600; pointer-events: none; }

.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span { display: inline-flex; align-items: center; min-height: 44px; padding: 0 18px; border-radius: 22px; background: #fff; box-shadow: inset 0 0 0 1.5px var(--line-2); font-weight: 600; font-size: 15px; color: var(--ink); cursor: pointer; transition: background 150ms ease, box-shadow 150ms ease; }
.seg input:checked + span { background: var(--ink); color: #fff; box-shadow: none; }
.seg input:focus-visible + span { outline: 3px solid rgba(30, 198, 119, .55); outline-offset: 2px; }

.check { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; font-size: 15px; }
.check input { -webkit-appearance: none; appearance: none; flex: none; width: 24px; height: 24px; margin: 10px 0 0; border-radius: 7px; border: 1.5px solid var(--line-2); background: #fff; cursor: pointer; display: grid; place-content: center; }
.check input:checked { background: var(--ink); border-color: var(--ink); }
.check input:checked::after { content: ""; width: 12px; height: 7px; border-left: 2.5px solid #fff; border-bottom: 2.5px solid #fff; transform: translateY(-2px) rotate(-45deg); }
.check span { padding-top: 12px; }

.switch { -webkit-appearance: none; appearance: none; flex: none; width: 52px; height: 32px; border-radius: 16px; background: #C9D6CF; position: relative; cursor: pointer; margin: 6px 0; transition: background 150ms ease; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform 150ms ease; }
.switch:checked { background: var(--cta-2); }
.switch:checked::after { transform: translateX(20px); }

/* 6-digit code boxes */
.otp { display: flex; gap: 8px; justify-content: space-between; }
.otp input { width: 100%; max-width: 52px; min-width: 0; height: 60px; padding: 0; text-align: center; font-size: 24px; font-weight: 600; border-radius: var(--r-md); border: 1.5px solid var(--line-2); background: #fff; font-variant-numeric: tabular-nums; }
.otp input:focus { outline: none; border-color: var(--g-700); box-shadow: 0 0 0 4px rgba(30, 198, 119, .22); }
.otp.bad input { border-color: var(--err); }

/* ---------- Cards, tiles, lists ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; }
@media (min-width: 960px) { .card { padding: 24px; } }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; min-height: 44px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack.lg { gap: 24px; }
.row { display: flex; align-items: center; gap: 12px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }

.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 960px) { .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; } }
.tiles.three { grid-template-columns: repeat(1, minmax(0, 1fr)); }
@media (min-width: 600px) { .tiles.three { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.tile .k { font-size: 14px; font-weight: 600; color: var(--mute); }
.tile .v { font-size: 28px; font-weight: 700; color: var(--ink); letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.1; overflow-wrap: anywhere; }
@media (min-width: 960px) { .tile .v { font-size: 32px; } }
.tile.hl { background: var(--ink); border-color: var(--ink); }
.tile.hl .k { color: #A9D9BF; }
.tile.hl .v { color: #fff; }

.list { display: flex; flex-direction: column; }
.li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); min-height: 64px; text-decoration: none; color: inherit; }
.li:first-child { border-top: 0; }
.li .t { font-weight: 600; color: var(--text); }
.li .s { font-size: 14px; color: var(--mute); }
.li .r { margin-left: auto; text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.av { width: 40px; height: 40px; border-radius: 20px; background: var(--mint); color: var(--ink); font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex: none; font-size: 15px; }

/* Chips (status) */
.chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 13px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 3px; background: currentColor; opacity: .8; }
.st-new { background: #EAF1FB; color: #234A7A; }
.st-review { background: var(--amber-bg); color: var(--amber); }
.st-approved { background: var(--mint); color: #00663D; }
.st-funded { background: var(--ink); color: #fff; }
.st-declined { background: var(--grey-bg); color: var(--grey); }
.cm-pending { background: var(--amber-bg); color: var(--amber); }
.cm-approved { background: var(--mint); color: #00663D; }
.cm-paid { background: var(--ink); color: #fff; }
.cm-none { background: var(--grey-bg); color: var(--grey); }

/* Filter pills */
.pills { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 2px 16px; }
.pills::-webkit-scrollbar { display: none; }
@media (min-width: 960px) { .pills { margin: 0; padding: 2px 0; flex-wrap: wrap; overflow: visible; } }
.pill { flex: none; min-height: 44px; padding: 0 16px; border-radius: 22px; border: 0; background: #fff; box-shadow: inset 0 0 0 1.5px var(--line); font-weight: 600; font-size: 14px; color: var(--ink); cursor: pointer; white-space: nowrap; }
.pill:hover { background: var(--mint); }
.pill[aria-pressed="true"] { background: var(--ink); color: #fff; box-shadow: none; }

.periods { display: inline-flex; padding: 4px; background: #E6EDE9; border-radius: 26px; gap: 2px; }
.periods button { min-height: 40px; padding: 0 14px; border: 0; border-radius: 22px; background: transparent; font-weight: 600; font-size: 14px; color: var(--ink); cursor: pointer; }
.periods button[aria-pressed="true"] { background: #fff; box-shadow: 0 1px 3px rgba(0, 40, 25, .12); }

/* Table (desktop) */
.tbl { width: 100%; border-collapse: collapse; font-size: 15px; }
.tbl th { text-align: left; font-size: 13px; font-weight: 600; color: var(--mute); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 14px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .r { text-align: right; }
.tbl .name { font-weight: 600; }
@media (max-width: 959px) { .only-wide { display: none !important; } }
@media (min-width: 960px) { .only-narrow { display: none !important; } }

/* Notices */
.note { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--r-md); background: var(--mint); color: var(--ink); font-size: 15px; }
.note svg { width: 20px; height: 20px; flex: none; margin-top: 1px; }
.note.warn { background: var(--amber-bg); color: var(--amber); }
.note.err { background: var(--err-bg); color: var(--err); }
.note .x { margin: -10px -10px -10px auto; }
.note b { font-weight: 700; }

/* States */
.sk { background: linear-gradient(90deg, #E7EEEA 0%, #F2F6F4 50%, #E7EEEA 100%); background-size: 200% 100%; animation: sk 1.4s ease-in-out infinite; border-radius: 8px; }
@keyframes sk { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
.sk-line { height: 14px; }
.sk-big { height: 32px; width: 60%; }
.state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; padding: 32px 16px; }
.state .ic { width: 56px; height: 56px; border-radius: 28px; background: var(--mint); color: var(--ink); display: inline-flex; align-items: center; justify-content: center; }
.state .ic svg { width: 26px; height: 26px; }
.state.err .ic { background: var(--err-bg); color: var(--err); }
.state p { max-width: 36ch; color: var(--mute); }
.state .t { font-weight: 700; color: var(--text); font-size: 17px; }

/* ---------- App shell ---------- */
.app { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; height: calc(60px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) calc(8px + env(safe-area-inset-right)) 0 calc(16px + env(safe-area-inset-left)); display: flex; align-items: center; justify-content: space-between; background: rgba(243, 246, 244, .9); -webkit-backdrop-filter: blur(16px) saturate(160%); backdrop-filter: blur(16px) saturate(160%); border-bottom: 1px solid transparent; }
.topbar.scrolled { border-bottom-color: var(--line); }
.topbar .logo img { height: 14px; width: auto; }
.side { display: none; }
.main { flex: 1; padding: 8px 16px calc(96px + env(safe-area-inset-bottom)); width: 100%; }
.wrap { max-width: 1100px; margin: 0 auto; width: 100%; }
.page-h { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 16px; margin: 8px 0 20px; }
.page-h .grow { display: flex; flex-direction: column; gap: 6px; flex: 1 1 300px; }

.tabs { position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; background: #fff; border-top: 1px solid var(--line); display: flex; padding: 4px 4px env(safe-area-inset-bottom); }
.tabs a { flex: 1 1 0; min-width: 0; min-height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-decoration: none; color: var(--mute); font-size: 11px; font-weight: 600; border-radius: 12px; }
.tabs a svg { width: 24px; height: 24px; }
.tabs a[aria-current="page"] { color: var(--ink); }
.tabs a[aria-current="page"] svg { color: var(--cta-2); }
.tabs a span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.foot { padding: 24px 0 8px; display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; font-size: 13px; color: var(--mute); }
.status { display: inline-flex; align-items: center; gap: 8px; color: var(--mute); text-decoration: none; min-height: 44px; font-weight: 500; }
.status:hover { color: var(--ink); }
.status i { width: 8px; height: 8px; border-radius: 4px; background: var(--cta-2); box-shadow: 0 0 0 3px rgba(20, 182, 106, .2); }

@media (min-width: 960px) {
  .app { flex-direction: row; }
  .topbar, .tabs { display: none; }
  .side { display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0; width: var(--side); background: var(--g-950); color: #fff; padding: 28px 16px 20px; z-index: 30; }
  .side .logo { padding: 0 12px 28px; }
  .side .logo img { height: 16px; width: auto; }
  .side nav { display: flex; flex-direction: column; gap: 2px; }
  .side nav a { display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 0 12px; border-radius: 12px; color: rgba(255, 255, 255, .78); text-decoration: none; font-weight: 600; font-size: 15px; }
  .side nav a svg { width: 20px; height: 20px; }
  .side nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
  .side nav a[aria-current="page"] { background: rgba(255, 255, 255, .1); color: #fff; }
  .side nav a[aria-current="page"] svg { color: var(--cta); }
  .side .cta-wrap { margin-top: 24px; }
  .side .btn { width: 100%; font-size: 15px; padding: 0 14px; gap: 8px; white-space: nowrap; }
  .side .me { margin-top: auto; display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 14px; background: rgba(255, 255, 255, .06); }
  .side .me .av { background: rgba(30, 198, 119, .18); color: #fff; }
  .side .me .n { font-weight: 600; font-size: 15px; }
  .side .me .r { font-size: 13px; color: rgba(255, 255, 255, .6); }
  .side .me .iconbtn { color: #fff; margin-left: auto; }
  .side .me .iconbtn:hover { background: rgba(255, 255, 255, .1); }
  .main { margin-left: var(--side); padding: 40px 40px 24px; }
  .page-h { margin: 0 0 28px; }
}

/* Fab (mobile "+ Препоръчай клиент") */
.fab-row { margin: 4px 0; }

/* ---------- Sheet / modal ---------- */
.sheet-bg { position: fixed; inset: 0; z-index: 80; background: rgba(0, 40, 25, .5); display: flex; align-items: flex-end; justify-content: center; animation: fadeIn 180ms ease; }
.sheet { width: 100%; max-width: 520px; max-height: 92vh; overflow-y: auto; background: #fff; border-radius: 24px 24px 0 0; padding: 8px 20px calc(24px + env(safe-area-inset-bottom)); box-shadow: var(--shadow-pop); animation: up 220ms cubic-bezier(.2, .8, .2, 1); }
.sheet .grab { width: 40px; height: 4px; border-radius: 2px; background: #D3DDD8; margin: 4px auto 16px; }
.sheet .sh { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.sheet .sh h2 { font-size: 20px; font-weight: 700; color: var(--ink); padding-top: 10px; }
@media (min-width: 600px) {
  .sheet-bg { align-items: center; padding: 24px; }
  .sheet { border-radius: 24px; padding: 20px 28px 28px; }
  .sheet .grab { display: none; }
}
@keyframes up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Toast */
.toast { position: fixed; z-index: 90; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 14px; font-size: 15px; font-weight: 500; box-shadow: var(--shadow-pop); max-width: calc(100vw - 32px); animation: up 200ms ease; display: flex; gap: 10px; align-items: center; }
.toast svg { width: 18px; height: 18px; color: var(--cta); flex: none; }
@media (min-width: 960px) { .toast { bottom: 32px; left: calc(50% + var(--side) / 2); } }

/* Chart */
.chart { position: relative; width: 100%; }
.chart svg { width: 100%; height: auto; overflow: visible; }
.chart .bar { transform-box: fill-box; transform-origin: 50% 100%; animation: grow 700ms cubic-bezier(.2, .8, .2, 1) both; }
.chart .ln { animation: draw 900ms ease 250ms both; }
.chart .dot { animation: fadeIn 300ms ease 900ms both; }
.chart.static .bar, .chart.static .ln, .chart.static .dot { animation: none; }
@keyframes grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
.chart .col { cursor: pointer; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 13px; color: var(--mute); font-weight: 500; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.legend i.l { height: 3px; border-radius: 2px; width: 14px; vertical-align: 3px; }
.readout { font-size: 14px; color: var(--ink); min-height: 20px; }
@media (prefers-reduced-motion: reduce) {
  .chart .bar, .chart .ln, .chart .dot { animation: none !important; }
  .sk { animation: none; }
  .sheet, .sheet-bg, .toast { animation: none; }
}

/* QR */
.qr { background: #fff; border-radius: 12px; padding: 8px; border: 1px solid var(--line); width: 132px; flex: none; }
.qr canvas { width: 100%; height: auto; display: block; image-rendering: pixelated; }
.urlbox { display: flex; align-items: center; gap: 4px; background: var(--bg); border-radius: 12px; padding: 0 0 0 12px; min-height: 48px; }
.urlbox code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 14px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }

/* ---------- Login ---------- */
.auth { min-height: 100vh; min-height: 100dvh; background: var(--g-950); display: flex; flex-direction: column; align-items: center; padding: 24px 16px calc(16px + env(safe-area-inset-bottom)); position: relative; isolation: isolate; overflow: hidden; }
.auth::before { content: ""; position: absolute; z-index: -1; width: 900px; height: 900px; left: 50%; top: -520px; margin-left: -450px; border-radius: 50%; background: radial-gradient(closest-side, rgba(20, 182, 106, .22), rgba(20, 182, 106, 0)); pointer-events: none; }
.auth .logo { margin: 8px 0 32px; }
.auth .logo img { height: 16px; width: auto; }
.auth-card { width: 100%; max-width: 440px; background: #fff; border-radius: var(--r-xl); padding: 28px 20px 24px; box-shadow: var(--shadow-pop); display: flex; flex-direction: column; gap: 20px; }
@media (min-width: 600px) { .auth { justify-content: center; padding-top: 40px; } .auth-card { padding: 36px 36px 32px; } .auth .logo { margin-top: 0; } }
.auth-card .h1 { font-size: 22px; }
.auth-card .lead { font-size: 15px; }
.auth .foot { width: 100%; max-width: 440px; color: rgba(255, 255, 255, .7); justify-content: center; margin-top: auto; padding-top: 32px; }
@media (min-width: 600px) { .auth .foot { margin-top: 0; } }
.auth .status { color: rgba(255, 255, 255, .75); }
.auth .status:hover { color: #fff; }
.back { align-self: flex-start; margin: -8px 0 -8px -12px; }
.bigicon { width: 64px; height: 64px; border-radius: 32px; background: var(--mint); color: var(--ink); display: inline-flex; align-items: center; justify-content: center; }
.bigicon svg { width: 30px; height: 30px; }
.bigicon.warn { background: var(--amber-bg); color: var(--amber); }
.divider { display: flex; align-items: center; gap: 12px; color: var(--mute); font-size: 13px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.faceid { min-height: 64px; font-size: 17px; border-radius: 32px; }
.faceid svg { width: 26px; height: 26px; }
.spin { width: 20px; height: 20px; border-radius: 50%; border: 2.5px solid currentColor; border-right-color: transparent; animation: rot 700ms linear infinite; }
@keyframes rot { to { transform: rotate(360deg); } }

/* ---------- Client portal (app) ---------- */
.sc-paid { background: var(--grey-bg); color: var(--grey); }
.sc-due { background: #EAF1FB; color: #234A7A; }
.sc-late { background: var(--amber-bg); color: var(--amber); }
.sc-partial { background: #FFF9EC; color: var(--amber); box-shadow: inset 0 0 0 1px #F1D9A6; }

.loan { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-xl); padding: 20px; display: flex; flex-direction: column; gap: 18px; }
@media (min-width: 960px) { .loan { padding: 28px; } }
.loan .lh { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.loan .lt { font-weight: 700; color: var(--ink); }
.loan .ls { font-size: 13px; color: var(--mute); margin-top: 2px; }
.loan .big { font-size: 40px; font-weight: 700; letter-spacing: -.03em; color: var(--ink); line-height: 1; font-variant-numeric: tabular-nums; }
@media (min-width: 960px) { .loan .big { font-size: 48px; } }
.loan .k { font-size: 14px; font-weight: 600; color: var(--mute); margin-bottom: 8px; }
.loan .when { font-size: 17px; font-weight: 600; color: var(--ink); margin-top: 8px; }
.loan.late { background: #FFF8E8; border-color: #F1D9A6; }
.loan.late .big, .loan.late .lt { color: #5C3A00; }
.loan.repaid { background: transparent; border-style: dashed; gap: 8px; }
.prog { height: 10px; border-radius: 5px; background: #E3ECE7; overflow: hidden; }
.prog i { display: block; height: 100%; border-radius: 5px; background: var(--cta-2); width: 0; transition: width 900ms cubic-bezier(.2, .8, .2, 1); }
.prog-l { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; color: var(--mute); margin-top: 8px; font-weight: 500; }
.prog-l b { color: var(--ink); font-weight: 600; }
.loan.late .prog { background: #F3E3C0; }
.loan.late .prog i { background: #C98A12; }
.late-msg { display: flex; gap: 10px; align-items: flex-start; font-size: 16px; color: #5C3A00; font-weight: 500; }
.late-msg svg { width: 22px; height: 22px; flex: none; color: #B07400; }
.btn.amber { background: #E8B23E; color: #3A2600; }
.btn.amber:hover { background: #D19A22; color: #2A1B00; }
.rowlink { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 12px 16px; border-radius: var(--r-lg); background: var(--card); border: 1px solid var(--line); text-decoration: none; color: var(--text); }
.rowlink .grow b { display: block; font-weight: 600; color: var(--ink); }
.rowlink .grow span { font-size: 14px; color: var(--mute); }
.rowlink > svg { width: 20px; height: 20px; color: var(--mute); flex: none; }

.segtabs { display: flex; padding: 4px; background: #E6EDE9; border-radius: 26px; gap: 2px; }
.segtabs button { flex: 1; min-height: 44px; border: 0; border-radius: 22px; background: transparent; font-weight: 600; font-size: 15px; color: var(--ink); cursor: pointer; }
.segtabs button[aria-selected="true"] { background: #fff; box-shadow: 0 1px 3px rgba(0, 40, 25, .12); }
@media (min-width: 960px) { .segtabs { display: inline-flex; } .segtabs button { flex: none; padding: 0 22px; } }

.inst { border-top: 1px solid var(--line); }
.inst:first-child { border-top: 0; }
.inst > button { width: 100%; display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 12px 0; background: none; border: 0; text-align: left; cursor: pointer; }
.inst .n { width: 36px; height: 36px; border-radius: 18px; background: var(--bg); color: var(--mute); font-size: 13px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex: none; font-variant-numeric: tabular-nums; }
.inst.today .n { background: var(--ink); color: #fff; }
.inst .chev { width: 18px; height: 18px; color: var(--mute); transition: transform 150ms ease; flex: none; }
.inst > button[aria-expanded="true"] .chev { transform: rotate(90deg); }
.inst .split { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 0 0 14px 48px; }
.inst .split[hidden] { display: none; }
.inst .split div { background: var(--bg); border-radius: 12px; padding: 10px 12px; }
.inst .split span { display: block; font-size: 12px; color: var(--mute); font-weight: 600; }
.inst .split b { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 15px; color: var(--ink); }
.today-mark { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; color: var(--g-700); text-transform: uppercase; letter-spacing: .04em; padding: 8px 0 0; }
.today-mark::after { content: ""; flex: 1; height: 2px; background: var(--cta-2); border-radius: 1px; }

.payrow { display: flex; align-items: center; gap: 8px; min-height: 64px; padding: 10px 0; border-top: 1px solid var(--line); }
.payrow:first-child { border-top: 0; }
.payrow .grow span { display: block; font-size: 13px; color: var(--mute); font-weight: 600; }
.payrow .grow b { display: block; font-weight: 600; color: var(--text); overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.payrow.ref { background: var(--mint); border-radius: 14px; padding: 10px 4px 10px 14px; border-top: 0; margin: 4px 0; }
.soon { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 0 16px; border-radius: 28px; background: var(--grey-bg); color: var(--grey); font-weight: 600; }
.soon svg { width: 22px; height: 22px; }
.soon em { margin-left: auto; font-style: normal; font-size: 12px; background: #fff; border-radius: 10px; padding: 3px 8px; }

/* Document viewer */
.viewer { position: fixed; inset: 0; z-index: 85; background: #39443F; display: flex; flex-direction: column; animation: fadeIn 160ms ease; }
.viewer .vh { display: flex; align-items: center; gap: 8px; padding: calc(8px + env(safe-area-inset-top)) calc(8px + env(safe-area-inset-right)) 8px calc(8px + env(safe-area-inset-left)); background: #fff; border-bottom: 1px solid var(--line); }
.viewer .vh h2 { font-size: 16px; font-weight: 700; color: var(--ink); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer .vb { flex: 1; overflow: auto; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); }
.viewer iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.paper { max-width: 640px; margin: 0 auto 16px; background: #fff; border-radius: 4px; aspect-ratio: 1 / 1.414; padding: 8% 9%; display: flex; flex-direction: column; gap: 10px; box-shadow: 0 4px 16px rgba(0, 0, 0, .3); }
.paper .pl { height: 8px; border-radius: 4px; background: #E6ECE9; }
.paper .pt { font-family: var(--display); font-weight: 900; text-transform: uppercase; color: var(--ink); font-size: clamp(12px, 3.6vw, 20px); margin-bottom: 8px; }

/* Adviser */
.adv-card { display: flex; flex-direction: column; gap: 16px; }
.adv-top { display: flex; gap: 16px; align-items: center; }
.photo { width: 72px; height: 72px; border-radius: 36px; background: repeating-linear-gradient(45deg, #E6EDE9 0 6px, #F1F5F3 6px 12px); display: inline-flex; align-items: center; justify-content: center; color: var(--mute); font-size: 11px; font-weight: 600; flex: none; text-align: center; line-height: 1.1; }
.adv-btns { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.adv-btns a { min-height: 64px; border-radius: 16px; background: var(--mint); color: var(--ink); text-decoration: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-weight: 600; font-size: 14px; }
.adv-btns a:hover { background: var(--mint-2); }
.adv-btns svg { width: 22px; height: 22px; }

/* Welcome (first open) */
.welcome { min-height: 100vh; min-height: 100dvh; background: var(--g-950); color: #fff; display: flex; flex-direction: column; padding: calc(24px + env(safe-area-inset-top)) 24px calc(24px + env(safe-area-inset-bottom)); position: relative; isolation: isolate; overflow: hidden; }
.welcome::before { content: ""; position: absolute; z-index: -1; width: 700px; height: 700px; left: 50%; top: 18%; margin-left: -350px; border-radius: 50%; background: radial-gradient(closest-side, rgba(20, 182, 106, .28), rgba(20, 182, 106, 0)); }
.welcome .top { display: flex; justify-content: space-between; align-items: center; min-height: 44px; }
.welcome .top img { height: 16px; width: auto; }
.welcome .top button { background: none; border: 0; color: rgba(255,255,255,.8); font-weight: 600; min-height: 44px; padding: 0 8px; cursor: pointer; }
.welcome .art { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px 0; }
.welcome .art .disc { width: min(240px, 60vw); aspect-ratio: 1; border-radius: 50%; background: rgba(255,255,255,.06); box-shadow: inset 0 0 0 1px rgba(255,255,255,.12); display: flex; align-items: center; justify-content: center; color: var(--cta); }
.welcome .art .disc svg { width: 40%; height: 40%; stroke-width: 1.2; }
.welcome h1 { font-family: var(--display); font-weight: 900; text-transform: uppercase; letter-spacing: -.02em; font-size: 28px; line-height: 1.05; margin: 0 0 12px; }
.welcome p { color: rgba(255,255,255,.78); font-size: 17px; max-width: 34ch; }
.welcome .dots { display: flex; gap: 6px; margin: 24px 0; }
.welcome .dots i { width: 8px; height: 8px; border-radius: 4px; background: rgba(255,255,255,.3); transition: width 200ms ease; }
.welcome .dots i.on { width: 24px; background: var(--cta); }
.welcome .wrap-w { max-width: 440px; width: 100%; margin: 0 auto; display: flex; flex-direction: column; flex: 1; }
@media (prefers-reduced-motion: reduce) { .prog i { transition: none; } }

.segtabs button { line-height: 1.15; padding: 0 8px; }
[tabindex="-1"]:focus, [tabindex="-1"]:focus-visible { outline: none; }

/* Client app: light green ground, white cards with a soft green border */
body.client-app { background: #E8FAED; }
body.client-app .topbar { background: rgba(232, 250, 237, .92); }
body.client-app .topbar.scrolled { border-bottom-color: #CDEBD6; }
body.client-app .card, body.client-app .loan, body.client-app .rowlink, body.client-app .tile { border-color: #CDEBD6; }
body.client-app .loan.repaid { border-color: #A9D9BF; }
body.client-app .loan.late { border-color: #F1D9A6; }
body.client-app .rowlink .av, body.client-app .li .av { background: #E8FAED; }
body.client-app .segtabs, body.client-app .periods { background: #D3EEDC; }
body.client-app .tabs { border-top-color: #CDEBD6; }
body.client-app .pill { box-shadow: inset 0 0 0 1.5px #CDEBD6; }
body.client-app .topbar .av { background: #fff; box-shadow: inset 0 0 0 1px #CDEBD6; }
/* "Влезе от ново устройство" notice: at the bottom of the page, with a border */
.nd-note { margin-top: 24px; border: 1px solid #A9D9BF; }
body.client-app .nd-note { background: #fff; }
/* Client app: empty / error messages that sit straight on the green get a white card */
body.client-app .state:not(.card .state):not(.sheet .state) { background: #fff; border: 1px solid #CDEBD6; border-radius: var(--r-xl); padding: 32px 20px; }
