/* Onest and Unbounded use the CRM font files with Cyrillic and Latin glyphs. */
@font-face {
  font-family: Onest;
  font-weight: 400 500;
  src: url('/onest-cyrillic-400-normal.woff2');
}
@font-face {
  font-family: Onest;
  font-weight: 600;
  src: url('/onest-cyrillic-600-normal.woff2');
}
@font-face {
  font-family: Unbounded;
  font-weight: 600;
  src: url('/unbounded-cyrillic-600-normal.woff2');
}

/* Shared CRM shell and component styles. */
:root {
  --night: #141a26;
  --night-2: #171e2c;
  --surface: #1e2534;
  --surface-2: #262e40;
  --surface-3: #30394e;
  --line: rgba(148, 170, 210, 0.12);
  --line-strong: rgba(148, 170, 210, 0.22);
  --line-control: rgba(148, 170, 210, 0.34);
  --text: #eef1f8;
  --muted: #9aa5ba;
  --lamp: #7587fa;
  --lamp-solid: #5163e6;
  --lamp-ink: #ffffff;
  --iris: #a78bfa;
  --rose: #ef5a6f;
  --ok: #3ecf8e;
  --warn: #f5a524;
  --error: #f2706a;

  --font-display: 'Unbounded', 'Onest', system-ui, sans-serif;
  --font-body: 'Onest', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-code: ui-monospace, 'SF Mono', 'JetBrains Mono', Menlo, Consolas, monospace;
  --radius-s: 8px;
  --radius-m: 14px;
  --radius-l: 20px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --sidebar: 232px;
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  background: var(--night);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}
h1,
h2,
h3 {
  margin: 0;
  font-weight: 600;
}
h1 {
  font-family: var(--font-display);
  font-size: clamp(20px, 2.4vw, 26px);
  letter-spacing: -0.01em;
}
a {
  color: inherit;
}
button,
input {
  font: inherit;
  color: inherit;
}
:focus-visible {
  outline: 2px solid var(--lamp);
  outline-offset: 2px;
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 13px;
}
.pos {
  color: var(--ok);
}
.neg {
  color: var(--error);
}
.shell {
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  min-height: 100vh;
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 20px 14px;
  border-right: 1px solid var(--line);
  background: var(--night-2);
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px;
  text-decoration: none;
  font-family: var(--font-display);
  font-size: 16px;
}
.brand b {
  color: var(--lamp);
  font-weight: 600;
}
.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-s);
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.nav__item:hover {
  background: var(--surface);
  color: var(--text);
}
.nav__item.is-active {
  background: rgba(117, 135, 250, 0.16);
  color: var(--lamp);
}
.nav__item.is-active svg {
  color: var(--lamp);
}
.burger {
  display: none;
}
.main {
  min-width: 0;
  padding: 28px clamp(16px, 3vw, 40px) 64px;
}
.page {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.page__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
}
.user-head p {
  margin: 4px 0 0;
}
.user-head h1 {
  word-break: break-all;
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  padding: 18px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}
.card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.card__title {
  font-size: 15px;
  font-weight: 600;
}
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.grid-2 > div {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}
.kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.kpi__label {
  color: var(--muted);
  font-size: 13px;
}
.kpi__value {
  font-family: var(--font-display);
  font-size: clamp(18px, 2vw, 24px);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kpi--lamp .kpi__value {
  color: var(--lamp);
}
.kpi__hint {
  font-size: 12.5px;
  color: var(--muted);
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
.field__label {
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 500;
  padding: 0;
}
.input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border-radius: var(--radius-s);
  border: 1px solid var(--line-control);
  background: var(--night-2);
  transition: border-color 0.15s, box-shadow 0.15s;
  font-size: 15px;
}
.input:focus {
  outline: none;
  border-color: var(--lamp);
  box-shadow: 0 0 0 3px rgba(117, 135, 250, 0.18);
}
.input:disabled {
  opacity: 0.6;
}
.input[type='date'] {
  color-scheme: dark;
}
.stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.btn {
  height: 40px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius-s);
  border: 1px solid transparent;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, transform 0.1s, opacity 0.15s;
}
.btn:active {
  transform: translateY(1px);
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.btn--primary {
  background: var(--lamp-solid);
  color: var(--lamp-ink);
}
.btn--primary:hover:not(:disabled) {
  background: #6172ee;
}
.btn--ghost {
  background: transparent;
  border-color: var(--line-control);
}
.btn--ghost:hover:not(:disabled) {
  border-color: var(--lamp);
  background: rgba(117, 135, 250, 0.06);
}
.btn--danger {
  background: rgba(239, 90, 111, 0.16);
  border-color: rgba(239, 90, 111, 0.55);
  color: #ffb3bb;
}
.btn--danger:hover:not(:disabled) {
  background: rgba(239, 90, 111, 0.28);
}
.btn--sm {
  height: 32px;
  padding: 0 12px;
  font-size: 13.5px;
}
.link-btn {
  border: 0;
  background: none;
  padding: 2px 4px;
  color: var(--lamp);
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 500;
}
.link-btn:hover {
  text-decoration: underline;
}
.badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  vertical-align: middle;
}
.badge + .badge,
* + .badge {
  margin-left: 6px;
}
td > .badge:first-child {
  margin-left: 0;
}
.badge--ok {
  background: rgba(62, 207, 142, 0.15);
  color: var(--ok);
}
.badge--warn {
  background: rgba(245, 165, 36, 0.15);
  color: var(--warn);
}
.badge--muted {
  background: rgba(148, 170, 210, 0.09);
  color: var(--muted);
}
.table-wrap {
  overflow-x: auto;
  margin: 0 -4px;
  -webkit-overflow-scrolling: touch;
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.table th {
  text-align: left;
  font-weight: 500;
  font-size: 12.5px;
  color: var(--muted);
  padding: 8px 10px;
  border-bottom: 1px solid var(--line-strong);
  white-space: nowrap;
}
.table td {
  white-space: nowrap;
  padding: 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.table tbody tr:last-child td {
  border-bottom: 0;
}
.table .num {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.kpis--4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.empty {
  margin: 0;
  padding: 18px 0;
  color: var(--muted);
  text-align: center;
  font-size: 14px;
}

.menu-backdrop { display: none; }
@media (max-width: 1100px) {
  .kpis,
  .kpis--4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: sticky;
    z-index: 50;
    height: auto;
    padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .burger {
    display: grid;
    gap: 6px;
    place-content: center;
    width: 42px;
    height: 42px;
    border: 1px solid var(--line-control);
    border-radius: var(--radius-s);
    background: transparent;
    cursor: pointer;
  }
  .burger span {
    display: block;
    width: 18px;
    height: 2px;
    border-radius: 2px;
    background: var(--text);
    transition: transform 0.2s var(--ease);
  }
  .menu-open .burger span:first-child {
    transform: translateY(4px) rotate(45deg);
  }
  .menu-open .burger span:last-child {
    transform: translateY(-4px) rotate(-45deg);
  }
  .nav {
    display: none;
    flex-basis: 100%;
    padding-top: 10px;
  }
  .menu-open .nav {
    display: flex;
  }
  .main {
    padding: 20px 16px 56px;
  }
  .grid-2 {
    grid-template-columns: 1fr;
  }
  .card {
    padding: 16px;
    border-radius: var(--radius-m);
  }

}

@media (max-width: 560px) {
  .kpis,
  .kpis--4 {
    gap: 8px;
  }
  .kpi {
    padding: 12px;
  }
  .page__head {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}
.whoami {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 10px 0;
  border-top: 1px solid var(--line);
  font-size: 14px;
  font-weight: 500;
  min-width: 0;
}
.whoami small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}
.whoami__dot {
  width: 30px;
  height: 30px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(117, 135, 250, 0.16);
  color: var(--lamp);
  font-size: 13px;
  font-weight: 700;
}
.kpis--3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
@media (max-width: 860px) {
  .whoami {
    display: none;
  }
}
@media (max-width: 560px) {
  .kpis--3 {
    grid-template-columns: 1fr;
  }
}
.nav__group {
  margin: 14px 12px 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 0.75;
}
.nav__group:first-child {
  margin-top: 0;
}
.card,
.kpi {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}
.card {
  border-radius: var(--radius-m);
}
.kpi__label {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.kpi__value,
.table td.num {
  font-variant-numeric: tabular-nums;
}
.kpi--lamp {
  background: linear-gradient(135deg, rgba(117, 135, 250, 0.2), var(--surface) 75%);
  border-color: rgba(117, 135, 250, 0.3);
}
.badge {
  gap: 6px;
}
.badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 6px 0 -4px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}
* {
  scrollbar-width: thin;
  scrollbar-color: var(--surface-3) transparent;
}
.empty {
  padding: 22px 16px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-m);
  background: rgba(148, 170, 210, 0.025);
  line-height: 1.5;
}
.table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.table tbody tr {
  transition: background 0.12s;
}
.table tbody tr:hover td {
  background: rgba(148, 170, 210, 0.035);
}
.btn:active:not(:disabled) {
  transform: scale(0.98);
}
.btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}
.btn--ghost:hover:not(:disabled) {
  background: rgba(148, 170, 210, 0.06);
}
.card__title {
  font-size: 14.5px;
  letter-spacing: -0.005em;
}
.card {
  padding: 18px 20px 20px;
  transition: border-color 0.2s;
}

@media (max-width: 860px) {
  .shell {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto 1fr;
  }

  .menu-open .nav {
    position: absolute;
    inset: 100% 0 auto;
    max-height: calc(100dvh - 65px - env(safe-area-inset-top));
    overflow-y: auto;
    padding: 8px 16px max(12px, env(safe-area-inset-bottom));
    background: var(--night-2);
    border-bottom: 1px solid var(--line);
    overscroll-behavior: contain;
  }

  .menu-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 49;
    background: rgba(7, 10, 18, 0.55);
    touch-action: none;
    animation: fade 120ms var(--ease);
  }

  .nav__item,
  .burger {
    min-height: 44px;
  }
}

@media (max-width: 560px) {
  .main {
    padding-inline: 12px;
    padding-bottom: calc(32px + env(safe-area-inset-bottom));
  }

  .page,
  .grid-2 {
    gap: 12px;
  }

  .page__head {
    gap: 12px;
  }

  .page__head h1 {
    overflow-wrap: anywhere;
  }

  .input {
    min-height: 44px;
  }

  input.input,
  textarea.input {
    font-size: 16px;
  }

  .btn--sm {
    min-height: 40px;
  }

  .table-wrap {
    overscroll-behavior-x: contain;
  }
}

@media (max-width: 560px) {
  .card {
    padding: 14px;
  }
}
@media (prefers-reduced-motion: no-preference) {
  .page {
    animation: fade 120ms var(--ease);
  }

  .btn {
    transition: background-color 120ms ease-out, border-color 120ms ease-out,
      color 120ms ease-out, box-shadow 120ms ease-out, transform 100ms var(--ease);
  }
}

/* Partner views use the CRM page, card, KPI, form and table components above. */
[hidden] {
  display: none !important;
}
a.btn {
  text-decoration: none;
}
.nav__item svg {
  flex: none;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
  gap: 16px;
}
.media {
  align-items: flex-start;
}
.media canvas {
  width: 100%;
  height: 215px;
  object-fit: contain;
  background: var(--night-2);
  border-radius: var(--radius-s);
}
.media small,
.form small {
  color: var(--muted);
}
.form {
  width: 100%;
}
.form button {
  align-self: flex-start;
  justify-self: start;
}

.narrow {
  width: 100%;
  max-width: 620px;
}

.message:empty {
  display: none;
}
.demo {
  font-size: 13px;
  color: var(--muted);
}
.card .table-wrap {
  min-width: 0;
}
.card .table td:last-child .btn {
  margin: 2px;
}

.card p { margin: 0; }
.partner-steps { margin: 0; padding-inline-start: 1.5em; }
.partner-steps li + li { margin-top: 8px; }
.partner-steps li::marker { color: var(--muted); }
.account-name { min-width: 0; }
#accountName { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media .card__head { width: 100%; }
.media canvas { align-self: stretch; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.receipt-picker { position: relative; cursor: pointer; }
.receipt-picker input { position: absolute; inset: 0; opacity: 0; width: 100%; cursor: pointer; }
.receipt-picker:focus-within { outline: 2px solid var(--lamp); }
