/**
 * UNIT Engineering Platform - Binance Style
 * Dark theme with yellow accents
 */

:root {
  /* Binance Dark Theme */
  --bg: #0B0E11;
  --bg-elevated: #181A20;
  --bg-card: #1E2329;
  --bg-hover: #2B3139;
  
  --text-primary: #EAECEF;
  --text-secondary: #848E9C;
  --text-tertiary: #5E6673;
  
  --border: rgba(234, 236, 239, 0.1);
  --border-strong: rgba(234, 236, 239, 0.15);
  
  /* Binance Yellow */
  --accent: #FCD535;
  --accent-hover: #F0B90B;
  --accent-dark: #C99400;
  
  /* Status Colors */
  --success: #0ECB81;
  --danger: #F6465D;
  --warning: #F0B90B;
  
  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  
  /* Typography */
  --text-xs: 11px;
  --text-sm: 13px;
  --text-base: 14px;
  --text-md: 16px;
  --text-lg: 18px;
  --text-xl: 20px;
  --text-2xl: 24px;
  --text-3xl: 30px;
  --text-4xl: 36px;
  
  /* Radius */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  
  /* Shadows */
  --shadow-sm: 0 2px 4px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 8px rgba(0,0,0,0.3);
  --shadow-lg: 0 8px 16px rgba(0,0,0,0.4);
}

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

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: var(--text-base);
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ========== LAYOUT ========== */
.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 90;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-6);
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}

.topbar__left,
.topbar__right {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.topbar__center {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  flex: 1;
}

/* Brand */
.brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
  transition: opacity 0.2s;
}

.brand:hover {
  opacity: 0.8;
}

.brand__mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 var(--space-4);
  border-radius: var(--radius-sm);
  font-weight: 900;
  letter-spacing: 0.08em;
  font-size: var(--text-base);
  color: var(--bg);
  background: var(--accent);
}

.brand__sub {
  font-weight: 700;
  letter-spacing: 0.08em;
  font-size: var(--text-sm);
  text-transform: uppercase;
  color: var(--text-secondary);
}

/* Burger */
.burger {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-card);
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s;
}

.burger:hover {
  background: var(--bg-hover);
}

.burger__i {
  width: 18px;
  height: 14px;
  position: relative;
}

.burger__i::before,
.burger__i::after,
.burger__i span {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  border-radius: 2px;
  background: var(--text-primary);
  transition: all 0.2s;
}

.burger__i::before { top: 0; }
.burger__i span { top: 6px; }
.burger__i::after { bottom: 0; }

/* Topnav */
.topnav {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.topnav__link {
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: var(--text-base);
  color: var(--text-secondary);
  transition: all 0.15s;
}

.topnav__link:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.topnav__link.is-active {
  color: var(--accent);
  background: rgba(252, 213, 53, 0.1);
}

/* User */
.topbar__user {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.topbar__userLabel {
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  font-family: 'SF Mono', Monaco, Consolas, monospace;
}

/* Body */
.body {
  display: flex;
  flex: 1;
}

/* Sidebar */
.sidenav {
  width: 240px;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  padding: var(--space-6) var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.navitem {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-secondary);
  transition: all 0.15s;
}

.navitem:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.navitem.is-active {
  color: var(--accent);
  background: rgba(252, 213, 53, 0.1);
}

.nav-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 40;
}

/* Content */
.content {
  flex: 1;
  padding: var(--space-8) var(--space-6);
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  background: var(--bg);
}

/* ========== PAGE ========== */
.page {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.page__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.page__actions {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
}

/* ========== TYPOGRAPHY ========== */
.h1 {
  font-size: var(--text-4xl);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: var(--space-2);
  color: var(--text-primary);
}

.h2 {
  font-size: var(--text-2xl);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.h3 {
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--text-primary);
}

.muted {
  color: var(--text-secondary);
}

.tiny {
  font-size: var(--text-xs);
}

.mono {
  font-family: 'SF Mono', Monaco, Consolas, monospace;
}

/* ========== CARDS ========== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
}

.card__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
}

.card__title {
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--text-primary);
}

.card--inner {
  background: var(--bg-elevated);
  border-color: var(--border-strong);
}

.card--sub {
  padding: var(--space-4);
}

/* ========== STATS ========== */
.stat {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.stat__label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat__value {
  font-size: 32px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
  font-family: 'SF Mono', Monaco, Consolas, monospace;
  color: var(--accent);
}

.stat__value .unit {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-tertiary);
  margin-left: var(--space-1);
}

.stat__hint {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  line-height: 1.4;
}

/* ========== GRID ========== */
.grid {
  display: grid;
  gap: var(--space-4);
}

.grid--2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid--3 {
  grid-template-columns: repeat(3, 1fr);
}

/* Invoice info в Buy UNIT */
.invoice-unit-nominal {
  margin-top: var(--space-4);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
}

.invoice-unit-nominal__value {
  font-size: 32px;
  font-weight: 800;
  color: var(--accent);
  font-family: 'SF Mono', Monaco, Consolas, monospace;
  display: inline-block;
  margin-left: var(--space-2);
}

.invoice-info-compact {
  margin-top: var(--space-2);
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  line-height: 1.6;
}

.invoice-info-compact__label {
  color: var(--text-secondary);
  font-weight: 600;
}

.invoice-due {
  margin-top: var(--space-3);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s;
}

.invoice-due:hover {
  border-color: var(--accent);
  background: var(--bg-card);
}

.invoice-due__label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-secondary);
}

.invoice-due__value {
  flex: 1;
  font-size: 24px;
  font-weight: 800;
  color: var(--accent);
  font-family: 'SF Mono', Monaco, Consolas, monospace;
}

.invoice-due .copy-icon {
  font-size: 1.5em;
}

.invoice-address {
  margin-top: var(--space-3);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s;
}

.invoice-address:hover {
  border-color: var(--accent);
  background: var(--bg-card);
}

.invoice-address .mono {
  flex: 1;
  font-size: var(--text-sm);
  color: var(--text-primary);
  word-break: break-all;
}

.invoice-address .copy-icon {
  font-size: 1.5em;
}

/* ========== BUTTONS ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: 44px;
  padding: 0 var(--space-5);
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  white-space: nowrap;
}

.btn:active {
  transform: translateY(1px);
}

.btn--primary {
  background: var(--accent);
  color: var(--bg);
}

.btn--primary:hover {
  background: var(--accent-hover);
}

.btn {
  background: var(--bg-hover);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn:hover {
  background: var(--bg-card);
  border-color: var(--border-strong);
}

.btn--danger {
  background: rgba(246, 70, 93, 0.1);
  color: var(--danger);
  border: 1px solid rgba(246, 70, 93, 0.2);
}

.btn--danger:hover {
  background: rgba(246, 70, 93, 0.15);
  border-color: rgba(246, 70, 93, 0.3);
}

.btn--ghost {
  background: transparent;
  border: none;
}

.btn--ghost:hover {
  background: var(--bg-hover);
}

.btn--sm {
  height: 36px;
  padding: 0 var(--space-4);
  font-size: var(--text-sm);
}

.btn.is-disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* ========== BADGE / CHIP ========== */
.badge, .chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--bg-hover);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.badge--test_phase, .chip--warn, .badge--warn {
  background: rgba(240, 185, 11, 0.1);
  color: var(--warning);
  border-color: rgba(240, 185, 11, 0.2);
}

.badge--distribution, .chip--ok, .badge--success {
  background: rgba(14, 203, 129, 0.1);
  color: var(--success);
  border-color: rgba(14, 203, 129, 0.2);
}

.badge--info {
  background: rgba(59, 130, 246, 0.1);
  color: #3B82F6;
  border-color: rgba(59, 130, 246, 0.2);
}

.badge--capped, .chip--muted, .badge--muted {
  background: var(--bg-hover);
  color: var(--text-tertiary);
  border-color: var(--border);
}

.badge--hold {
  background: rgba(246, 70, 93, 0.1);
  color: var(--danger);
  border-color: rgba(246, 70, 93, 0.2);
}

/* ========== TABLE ========== */
.table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  background: var(--bg-card);
}

/* ========== TABLES ========== */
.tablewrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table thead {
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}

.table th {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.table td {
  padding: var(--space-4);
  font-size: var(--text-base);
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
}

.table tbody tr:last-child td {
  border-bottom: none;
}

.table tbody tr:hover {
  background: var(--bg-hover);
}

.table td.amt {
  font-family: 'SF Mono', Monaco, Consolas, monospace;
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--accent);
}

/* ========== FORM ========== */
.form-row {
  margin-bottom: var(--space-5);
}

.form-label {
  display: block;
  margin-bottom: var(--space-2);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
}

.form-input,
.form-select,
.form-textarea,
.input {
  width: 100%;
  height: 44px;
  padding: 0 var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  font-family: inherit;
  background: var(--bg-card);
  color: var(--text-primary);
  transition: all 0.15s;
}

.form-input:hover,
.form-select:hover,
.form-textarea:hover,
.input:hover {
  border-color: var(--border-strong);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus,
.input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--bg-elevated);
}

.form-textarea {
  height: auto;
  min-height: 100px;
  padding: var(--space-3) var(--space-4);
  resize: vertical;
}

.form-hint,
.field__hint {
  margin-top: var(--space-1);
  font-size: var(--text-sm);
  color: var(--text-tertiary);
}

/* Auth forms spacing */
.auth .form .field {
  margin-bottom: var(--space-5);
}

.auth .form .btn {
  margin-top: var(--space-4);
  margin-bottom: var(--space-4);
}

/* ========== FAQ ACCORDION ========== */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.faq-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color 0.2s;
}

.faq-item.is-open {
  border-color: var(--accent);
}

.faq-question {
  width: 100%;
  padding: var(--space-5) var(--space-6);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-4);
  background: none;
  border: none;
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
}

.faq-question:hover {
  background: var(--bg-hover);
}

.faq-icon {
  flex-shrink: 0;
  color: var(--text-tertiary);
  transition: transform 0.2s, color 0.2s;
}

.faq-item.is-open .faq-icon {
  transform: rotate(180deg);
  color: var(--accent);
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
}

.faq-item.is-open .faq-answer {
  max-height: 1000px;
}

.faq-answer-content {
  padding: 0 var(--space-6) var(--space-5) var(--space-6);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--text-secondary);
}

/* ========== TIMELINE ========== */
.timeline {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.timeline__item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-4);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border);
}

.timeline__item:last-child {
  border-bottom: none;
}

.timeline__main {
  flex: 1;
  min-width: 0;
}

.timeline__title {
  font-size: var(--text-base);
  font-weight: 600;
  margin-bottom: var(--space-1);
  color: var(--text-primary);
}

.timeline__sub {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}

.timeline__amt {
  font-family: 'SF Mono', Monaco, Consolas, monospace;
  font-size: var(--text-lg);
  font-weight: 700;
  flex-shrink: 0;
}

.timeline__amt.pos {
  color: var(--success);
}

.timeline__amt.neg {
  color: var(--danger);
}

/* ========== PAYMENT MODAL ========== */
.pay-grid {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: var(--space-6);
}

.pay-qr {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-4);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

#payQr {
  padding: var(--space-3);
  background: white;
  border-radius: var(--radius-sm);
}

.pay-qr__hint {
  margin-top: var(--space-2);
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  text-align: center;
}

.pay-info {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.pay-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.pay-field__label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.pay-copyline {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s;
}

.pay-copyline:hover {
  border-color: var(--accent);
  background: var(--bg-card);
}

.pay-copyline span.mono {
  flex: 1;
  font-size: var(--text-sm);
  color: var(--text-primary);
  word-break: break-all;
}

.pay-hint {
  padding: var(--space-3);
  background: rgba(252, 213, 53, 0.05);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Copy icon - 1.5x от шрифта */
.copy-icon {
  font-size: 1.5em;
  opacity: 0.6;
  transition: opacity 0.15s;
  flex-shrink: 0;
  user-select: none;
}

.pay-copyline:hover .copy-icon,
.invoice-address:hover .copy-icon {
  opacity: 1;
}

.pay-info #payNominal,
.pay-info #payPriceTotal,
.pay-info #payDue {
  font-size: 28px;
  font-weight: 800;
  font-family: 'SF Mono', Monaco, Consolas, monospace;
  color: var(--accent);
}

/* ========== COPYLINE ========== */
.copyline {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  padding: var(--space-3) var(--space-4);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.copyline span {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: var(--text-sm);
  color: var(--text-primary);
}

/* Кнопка копирования с иконкой/текстом */
.btn-copy-icon {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
}

.btn-copy-icon__icon {
  display: none;
  font-size: 18px;
}

.btn-copy-icon__text {
  display: inline;
}

/* Copybox (like copyline but for withdraw page) */
.copybox {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  padding: var(--space-3) var(--space-4);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  flex-wrap: wrap;
}

.copybox__value {
  flex: 1;
  min-width: 0;
  font-size: var(--text-sm);
  color: var(--text-primary);
  word-break: break-all;
  overflow-wrap: anywhere;
}

/* Field wrapper */
.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.field__label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Payout address display (readonly, no copy button) */
.payout-address-display {
  padding: var(--space-3) var(--space-4);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.payout-address-display .mono {
  font-size: var(--text-sm);
  color: var(--accent);
  word-break: break-all;
  line-height: 1.6;
}

/* Payout address display (without copy button) */
.payout-address-display {
  padding: var(--space-3) var(--space-4);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  word-break: break-all;
  font-size: var(--text-sm);
  color: var(--text-primary);
}

/* Payout address display (без кнопки) */
.payout-address-display {
  padding: var(--space-3) var(--space-4);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.payout-address-display .mono {
  font-size: var(--text-sm);
  color: var(--accent);
  word-break: break-all;
  line-height: 1.6;
}

/* Key-Value display */
.kv {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.kv__row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border);
}

.kv__row:last-child {
  border-bottom: none;
}

.kv__k {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.kv__v {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--accent);
}

/* ========== MODAL ========== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}

.modal.is-open {
  display: flex;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 1;
}

.modal__dialog,
.modal__panel {
  position: relative;
  z-index: 2;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  max-width: 900px;
  width: 100%;
  max-height: none;
  overflow-y: visible;
  box-shadow: var(--shadow-lg);
}

.modal__head {
  padding: var(--space-5);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal__title {
  font-size: var(--text-2xl);
  font-weight: 600;
  color: var(--text-primary);
}

.modal__body {
  padding: var(--space-6);
}

/* ========== HINTS / ALERTS ========== */
.hint {
  padding: var(--space-4);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-top: 8px;
}

.hint__title {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.hint__text {
  font-size: var(--text-sm);
  line-height: 1.5;
  color: var(--text-secondary);
}

.hint--muted {
  background: transparent;
  border: none;
  padding: var(--space-2) 0;
  margin-top: var(--space-2);
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  line-height: 1.6;
}

.note {
  padding: var(--space-4);
  border-left: 3px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  background: var(--bg-elevated);
}

.note--warn {
  background: rgba(240, 185, 11, 0.05);
  border-color: var(--warning);
  color: var(--text-primary);
}

/* ========== EMPTY STATE ========== */
.empty {
  text-align: center;
  padding: var(--space-8) var(--space-4);
}

.empty__title {
  font-size: var(--text-xl);
  font-weight: 600;
  margin-bottom: var(--space-2);
  color: var(--text-primary);
}

.empty__text {
  color: var(--text-secondary);
  margin-bottom: var(--space-4);
}

/* ========== PROGRESS BAR ========== */
.progress {
  height: 8px;
  background: var(--bg-elevated);
  border-radius: 999px;
  overflow: hidden;
}

.progress__bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
  transition: width 0.3s;
}

/* ========== UTILITIES ========== */
.row {
  display: flex;
  gap: var(--space-4);
  align-items: center;
}

.hr {
  height: 1px;
  background: var(--border);
  margin: var(--space-4) 0;
}

.link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.link:hover {
  text-decoration: underline;
}

/* Pager */
.pager {
  display: flex;
  gap: var(--space-3);
  align-items: center;
  justify-content: space-between;
}

.pager .muted {
  color: var(--text-tertiary);
}

/* Pagination */
.pager {
  display: flex;
  gap: var(--space-2);
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
}

.pager .muted {
  margin-right: auto;
}

/* ========== TOAST ========== */
#toastHost {
  position: fixed;
  top: var(--space-6);
  right: var(--space-6);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  pointer-events: none;
  max-width: 400px;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  box-shadow: var(--shadow-lg);
  pointer-events: all;
  transition: all 0.3s;
}

.toast__title {
  font-size: var(--text-sm);
  font-weight: 700;
  margin-bottom: var(--space-1);
  color: var(--text-primary);
}

.toast__msg {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.toast--success {
  border-left-color: var(--success);
}

.toast--error {
  border-left-color: var(--danger);
}

.toast--warn {
  border-left-color: var(--warning);
}

/* ========== RESPONSIVE ========== */

@media (min-width: 640px) {
  .pay-grid {
    grid-template-columns: 260px 1fr;
  }
}

@media (max-width: 1024px) {
  .sidenav {
    position: fixed;
    top: 0;
    left: -260px;
    height: 100vh;
    z-index: 45;
    transition: left 0.3s;
    box-shadow: var(--shadow-lg);
  }

  .app-shell.nav-open .sidenav {
    left: 0;
  }

  .app-shell.nav-open .nav-backdrop {
    display: block;
  }

  .burger {
    display: flex;
  }
}

@media (max-width: 768px) {
  .topbar {
    height: 56px;
    padding: 0 var(--space-4);
  }

  .topnav {
    display: none;
  }

  .brand__sub {
    display: none;
  }

  .topbar__userLabel {
    display: none;
  }

  .content {
    padding: var(--space-6) var(--space-4);
  }

  .h1 {
    font-size: var(--text-3xl);
  }

  .h2 {
    font-size: var(--text-xl);
  }

  .grid--2,
  .grid--3 {
    grid-template-columns: 1fr;
  }

  .units-grid {
    grid-template-columns: 1fr !important;
  }

  .card {
    padding: var(--space-4);
  }

  .page__head {
    flex-direction: column;
  }

  .page__actions {
    width: 100%;
  }

  .btn {
    width: 100%;
  }

  .pay-grid {
    grid-template-columns: 1fr;
  }

  .stat__value {
    font-size: 28px;
  }
  
  /* Модалка оплаты mobile - КОМПАКТНО */
  .modal {
    padding: var(--space-1);
  }
  
  .modal__dialog,
  .modal__panel {
    max-width: 90%;
    max-height: 80vh;
    border-radius: var(--radius-md);
  }
  
  .modal__head {
    padding: var(--space-2);
  }
  
  .modal__body {
    padding: var(--space-2);
  }
  
  .modal__title {
    font-size: var(--text-base);
  }
  
  .pay-grid {
    grid-template-columns: 1fr;
    gap: var(--space-2);
  }
  
  .pay-qr {
    padding: var(--space-2);
  }
  
  .pay-qr #payQr {
    max-width: 160px;
    padding: var(--space-1);
  }
  
  .pay-qr #payQr img,
  .pay-qr #payQr canvas {
    width: 100% !important;
    height: auto !important;
  }
  
  .pay-qr__hint {
    font-size: 9px;
    margin-top: var(--space-1);
    line-height: 1.3;
  }
  
  .pay-info {
    gap: var(--space-2);
  }
  
  .pay-field {
    gap: var(--space-1);
  }
  
  .pay-field__label {
    font-size: 10px;
  }
  
  .pay-copyline {
    padding: var(--space-1) var(--space-2);
  }
  
  .pay-copyline span.mono {
    font-size: 10px;
    line-height: 1.2;
    word-break: break-all;
  }
  
  .pay-hint {
    padding: var(--space-1);
    font-size: 10px;
    line-height: 1.3;
  }
  
  .copy-icon {
    font-size: 16px;
  }
  
  /* Текущий счет на mobile */
  .invoice-unit-nominal {
    margin-top: var(--space-3);
  }
  
  .invoice-unit-nominal__value {
    font-size: 28px;
    display: block;
    margin-left: 0;
    margin-top: var(--space-1);
  }
  
  .invoice-info-compact {
    font-size: 12px;
  }
  
  .invoice-due {
    padding: var(--space-2) var(--space-3);
  }
  
  .invoice-due__label {
    font-size: var(--text-sm);
  }
  
  .invoice-due__value {
    font-size: 20px;
  }
  
  .invoice-due .copy-icon {
    font-size: 16px;
  }
  
  .invoice-address {
    padding: var(--space-2) var(--space-3);
  }
  
  .invoice-address .mono {
    font-size: 11px;
  }
  
  .invoice-address .copy-icon {
    font-size: 16px;
  }

  .card--sub {
    min-height: auto;
    padding: var(--space-4);
  }
  
  .card--sub .card__head {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-2);
  }
  
  .card--sub .hint__text {
    font-size: var(--text-sm);
    line-height: 1.6;
    word-break: break-word;
  }
  
  .card--sub .h3 {
    font-size: var(--text-base);
    font-weight: 700;
  }
  
  .card--sub .badge {
    font-size: 10px;
    padding: 3px 8px;
  }
  
  .card--sub .muted {
    font-size: var(--text-sm);
  }
  
  .card--sub .tiny {
    font-size: 11px;
  }
  
  .card--sub b {
    color: var(--accent);
  }

  .progress {
    height: 8px;
  }

  #toastHost {
    left: var(--space-4);
    right: var(--space-4);
    max-width: none;
  }
  
  /* Withdrawals mobile fix */
  .copybox {
    flex-direction: column;
    align-items: stretch;
  }
  
  .copybox__value {
    word-break: break-all;
    text-align: left;
    padding: var(--space-2) 0;
    min-width: auto;
  }
  
  .copybox .btn {
    width: 100%;
  }
  
  /* Кнопка копирования - только иконка на mobile */
  .btn-copy-icon__text {
    display: none;
  }
  
  .btn-copy-icon__icon {
    display: inline;
    font-size: 20px;
  }
  
  .btn-copy-icon {
    padding: var(--space-2);
    min-width: 36px;
  }
  
  .copyline {
    padding: var(--space-2) var(--space-3);
  }
  
  .copyline span {
    font-size: 11px;
  }
  
  .payout-address-display {
    padding: var(--space-3);
  }
  
  .payout-address-display .mono {
    font-size: var(--text-xs);
    word-break: break-all;
    line-height: 1.7;
  }
  
  .kv__row {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-1);
    padding: var(--space-3) 0;
  }
  
  .kv__k {
    font-size: 11px;
  }
  
  .kv__v {
    font-size: 22px;
    font-weight: 800;
  }
  
  .kv__k {
    font-size: 10px;
  }
  
  .kv__v {
    font-size: var(--text-xl);
    font-weight: 800;
  }
  
  .card {
    overflow: hidden;
  }
  
  .card__head {
    flex-wrap: wrap;
  }
  
  /* Settings mobile fix */
  .field__label {
    font-size: 10px;
  }
  
  .form-input,
  .input {
    font-size: var(--text-base);
  }
}

@media (max-width: 480px) {
  .h1 {
    font-size: var(--text-2xl);
  }

  .stat__value {
    font-size: 24px;
  }

  .timeline__amt {
    font-size: var(--text-md);
  }
  
  /* Pager на mobile */
  .pager {
    display: flex;
    gap: var(--space-2);
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
  }
  
  .pager .muted {
    font-size: var(--text-xs);
  }
}

/* ─── Mobile Menu Improvements ───────────────────────────────────────────── */

/* Show burger on all pages */
.burger {
  display: flex;
}

/* Divider in sidenav */
.navitem-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 16px;
}

/* Logout button in sidenav */
.navitem--logout {
  color: var(--error);
  font-weight: 600;
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
}

.navitem--logout:hover {
  background: var(--bg-hover);
  color: var(--error);
}

/* Mobile adjustments */
@media (max-width: 768px) {
  /* Hide desktop auth buttons on mobile */
  .topbar__user {
    display: none !important;
  }

  /* Always show burger */
  .burger {
    display: flex !important;
  }

  /* Ensure sidenav works on all pages */
  .sidenav {
    display: block;
  }

  /* Adjust topbar spacing */
  .topbar__right {
    gap: 8px;
  }
}

/* Desktop - hide burger on public pages if not logged in */
@media (min-width: 769px) {
  /* Topbar user visible on desktop */
  .topbar__user {
    display: flex !important;
  }

  /* Hide sidenav on desktop for public pages */
  body:not(.has-sidenav) .sidenav {
    display: none;
  }

  body:not(.has-sidenav) .nav-backdrop {
    display: none;
  }
}

/* ─── Fix Sidenav Layout ──────────────────────────────────────────────────── */

/* Ensure navitems are full width blocks */
.navitem {
  display: block !important;
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-secondary);
  transition: all 0.15s;
  text-align: left;
  border: none;
  background: transparent;
  cursor: pointer;
}

.navitem:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.navitem.is-active {
  color: var(--accent);
  background: rgba(252, 213, 53, 0.1);
}

/* Divider in sidenav */
.navitem-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 0;
}

/* Logout button in sidenav */
.navitem--logout {
  color: var(--danger) !important;
  font-weight: 600;
}

.navitem--logout:hover {
  background: var(--bg-hover);
  color: var(--danger) !important;
}

/* Ensure sidenav is column layout */
.sidenav {
  display: flex !important;
  flex-direction: column !important;
  gap: 4px !important;
}

/* ─── Fix: First menu item hidden under header ────────────────────────────── */
@media (max-width: 1024px) {
  .sidenav {
    padding-top: 80px !important; /* Отступ от шапки */
  }
}

/* ─── Language Selector (Dropdown) ────────────────────────────────────────── */
.lang-selector {
  position: relative;
  margin-right: 16px;
}

.lang-selector__btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 11px;
  font-weight: 700;
  font-family: 'Syne', sans-serif;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: all 0.15s;
}

.lang-selector__btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}

.lang-selector__btn svg {
  transition: transform 0.2s;
}

.lang-selector.is-open .lang-selector__btn svg {
  transform: rotate(180deg);
}

.lang-selector__menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 180px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  padding: 4px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all 0.2s;
  z-index: 100;
  max-height: 400px;
  overflow-y: auto;
}

.lang-selector.is-open .lang-selector__menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.lang-selector__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 14px;
  transition: all 0.15s;
  cursor: pointer;
}

.lang-selector__item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.lang-selector__item.is-active {
  background: rgba(252, 213, 53, 0.1);
  color: var(--accent);
}

.lang-selector__code {
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.05em;
  min-width: 24px;
}

.lang-selector__name {
  flex: 1;
}

.lang-selector__item svg {
  color: var(--accent);
  flex-shrink: 0;
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .lang-selector {
    margin-right: 0;
  }
  
  .lang-selector__btn {
    padding: 4px 10px;
    font-size: 10px;
  }
  
  .lang-selector__menu {
    right: 0;
    min-width: 160px;
  }
}

