@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;500;600;700;800;900&display=swap');

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --green: #1EC86A;
  --green-light: #E8FAF1;
  --green-dark: #17A358;
  --gray-bg: #F4F5F7;
  --gray-text: #8A8FA8;
  --dark: #1A1D2E;
  --dark2: #2D3561;
  --accent-orange: #FF6B35;
  --accent-purple: #7B5EA7;
  --white: #FFFFFF;
  --border: #F0F0F5;
  --shadow: 0 2px 16px rgba(0,0,0,0.08);
  --shadow-sm: 0 1px 6px rgba(0,0,0,0.06);
  --radius: 18px;
  --radius-sm: 12px;
}

html, body {
  height: 100%;
  font-family: 'Nunito', sans-serif;
  background: #1A1D2E;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 24px 16px;
  min-height: 100vh;
}

/* ─── PHONE SHELL ─── */
.phone {
  width: 375px;
  min-height: 812px;
  background: var(--gray-bg);
  border-radius: 44px;
  overflow: hidden;
  box-shadow: 0 0 0 10px #2A2D3E, 0 32px 80px rgba(0,0,0,0.6);
  display: flex;
  flex-direction: column;
  position: relative;
}

/* ─── STATUS BAR ─── */
.status-bar {
  background: var(--white);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 24px 8px;
  flex-shrink: 0;
}
.status-bar .time { font-size: 15px; font-weight: 800; color: var(--dark); }
.status-icons { display: flex; gap: 6px; align-items: center; }
.status-icons svg { width: 16px; height: 16px; fill: var(--dark); }

/* ─── APP HEADER ─── */
.app-header {
  background: var(--white);
  padding: 6px 20px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.header-logo { display: flex; align-items: center; gap: 8px; }
.logo-mark {
  width: 34px; height: 34px;
  background: var(--green);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; color: white; font-size: 11px; letter-spacing: -0.5px;
}
.logo-text { font-size: 16px; font-weight: 800; color: var(--dark); }
.logo-text span { color: var(--green); }
.header-actions { display: flex; gap: 8px; align-items: center; }
.hdr-btn {
  width: 36px; height: 36px;
  background: var(--gray-bg);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  position: relative;
  border: none;
  transition: background 0.15s;
}
.hdr-btn:active { background: #E2E5EF; }
.hdr-btn svg { width: 18px; height: 18px; fill: var(--dark); }
.notif-dot {
  position: absolute; top: 5px; right: 5px;
  width: 8px; height: 8px;
  background: #FF4444;
  border-radius: 50%;
  border: 1.5px solid white;
}

/* ─── TABS (Банк / Сервисы) ─── */
.top-tabs {
  background: var(--white);
  display: flex;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.top-tab {
  flex: 1; padding: 11px 8px;
  text-align: center;
  font-size: 14px; font-weight: 700;
  color: var(--gray-text);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.2s;
  text-decoration: none;
  display: block;
}
.top-tab.active { color: var(--green); border-bottom-color: var(--green); }

/* ─── SCROLL AREA ─── */
.scroll-area {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  background: var(--gray-bg);
}
.scroll-area::-webkit-scrollbar { display: none; }

/* ─── BOTTOM NAV ─── */
.bottom-nav {
  background: var(--white);
  padding: 6px 0 18px;
  display: flex;
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 20px rgba(0,0,0,0.06);
  flex-shrink: 0;
  position: relative;
}
.nav-item {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; gap: 2px;
  cursor: pointer;
  padding: 5px 4px 0;
  text-decoration: none;
}
.nav-item svg { width: 22px; height: 22px; fill: var(--gray-text); }
.nav-label { font-size: 10px; font-weight: 700; color: var(--gray-text); }
.nav-item.active svg { fill: var(--green); }
.nav-item.active .nav-label { color: var(--green); }

/* QR centre button */
.nav-qr {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center;
  position: relative;
  padding-top: 0;
  text-decoration: none;
}
.qr-fab {
  width: 60px; height: 60px;
  background: linear-gradient(135deg, var(--green), #0EAD55);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 20px rgba(30,200,106,0.5);
  cursor: pointer;
  border: 4px solid white;
  margin-top: -22px;
  transition: transform 0.2s, box-shadow 0.2s;
}
.qr-fab:active { transform: scale(0.94); box-shadow: 0 2px 12px rgba(30,200,106,0.4); }
.qr-fab svg { width: 26px; height: 26px; fill: white; }
.nav-qr .nav-label { color: var(--green); font-size: 10px; font-weight: 800; margin-top: 3px; }

/* ─── SECTION HEADER ─── */
.sec-hdr {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px 10px;
}
.sec-title { font-size: 17px; font-weight: 900; color: var(--dark); }
.sec-action { font-size: 13px; font-weight: 700; color: var(--green); cursor: pointer; text-decoration: none; }

/* ─── CARD ─── */
.card {
  background: var(--white);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}

/* ─── MIR BADGE ─── */
.mir {
  display: inline-block;
  background: #005BBB; color: white;
  font-size: 9px; font-weight: 800;
  padding: 2px 6px; border-radius: 4px;
}

/* ─── SPACER ─── */
.spacer { height: 20px; }

/* ─── PAGE TITLE (back-arrow pages) ─── */
.page-header {
  background: var(--white);
  padding: 6px 20px 12px;
  display: flex; align-items: center; gap: 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.back-btn {
  width: 36px; height: 36px;
  background: var(--gray-bg);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; text-decoration: none;
  border: none; flex-shrink: 0;
}
.back-btn svg { width: 20px; height: 20px; fill: var(--dark); }
.page-title { font-size: 17px; font-weight: 900; color: var(--dark); flex: 1; }

/* ─── NOTIFICATIONS PANEL ─── */
.notif-overlay {
  position: absolute; inset: 0;
  background: rgba(26,29,46,0.5);
  z-index: 100;
  display: none;
  backdrop-filter: blur(2px);
}
.notif-overlay.open { display: block; }
.notif-panel {
  position: absolute; top: 0; right: 0;
  width: 100%; background: var(--white);
  border-radius: 0 0 var(--radius) var(--radius);
  overflow: hidden;
  transform: translateY(-100%);
  transition: transform 0.35s cubic-bezier(0.4,0,0.2,1);
  max-height: 75%;
  display: flex; flex-direction: column;
}
.notif-overlay.open .notif-panel { transform: translateY(0); }
.notif-header {
  padding: 16px 20px 12px;
  display: flex; justify-content: space-between; align-items: center;
  border-bottom: 1px solid var(--border);
}
.notif-title { font-size: 17px; font-weight: 900; color: var(--dark); }
.notif-close {
  width: 30px; height: 30px;
  background: var(--gray-bg); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; border: none;
  font-size: 14px; color: var(--dark); font-weight: 700;
}
.notif-scroll { overflow-y: auto; padding: 8px 0; }
.notif-item {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 20px;
  border-bottom: 1px solid #F9F9FB;
  transition: background 0.15s; cursor: pointer;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:active { background: var(--gray-bg); }
.notif-item.unread { background: #F0FCF7; }
.notif-icon {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.ni-green { background: var(--green-light); }
.ni-blue { background: #E8F4FF; }
.ni-orange { background: #FFF0E8; }
.notif-body { flex: 1; }
.notif-name { font-size: 13px; font-weight: 800; color: var(--dark); }
.notif-text { font-size: 12px; font-weight: 600; color: var(--gray-text); margin-top: 2px; line-height: 1.4; }
.notif-time { font-size: 11px; font-weight: 600; color: var(--gray-text); white-space: nowrap; }

/* ─── QR MODAL ─── */
.qr-overlay {
  position: absolute; inset: 0;
  background: rgba(26,29,46,0.7);
  z-index: 100;
  display: none;
  align-items: flex-end;
  backdrop-filter: blur(4px);
}
.qr-overlay.open { display: flex; }
.qr-sheet {
  background: var(--white);
  width: 100%;
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 8px 24px 36px;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.4,0,0.2,1);
}
.qr-overlay.open .qr-sheet { transform: translateY(0); }
.qr-handle {
  width: 36px; height: 4px;
  background: #DDD; border-radius: 2px;
  margin: 10px auto 20px;
}
.qr-modal-title { font-size: 18px; font-weight: 900; color: var(--dark); text-align: center; margin-bottom: 4px; }
.qr-modal-sub { font-size: 13px; color: var(--gray-text); font-weight: 600; text-align: center; margin-bottom: 24px; }
.qr-code-box {
  width: 200px; height: 200px;
  background: var(--gray-bg);
  border-radius: var(--radius);
  margin: 0 auto 24px;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--border);
}
.qr-code-box svg { width: 160px; height: 160px; }
.qr-actions { display: flex; gap: 12px; }
.qr-btn-action {
  flex: 1; padding: 14px;
  border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 800;
  cursor: pointer; border: none;
  text-align: center;
}
.qr-btn-primary { background: var(--green); color: white; }
.qr-btn-secondary { background: var(--gray-bg); color: var(--dark); }

/* ═══════════════════════════════════════════════════════════
   DARK THEME  — применяется через data-theme="dark" на <html>
   ═══════════════════════════════════════════════════════════ */
[data-theme="dark"] {
  --green:       #1EC86A;
  --green-light: #0D2E1C;
  --green-dark:  #17A358;
  --gray-bg:     #0F1923;
  --white:       #1A2535;
  --dark:        #E8EEFA;
  --dark2:       #111827;
  --border:      #243040;
  --gray-text:   #6B7A96;
}
[data-theme="dark"] body               { background: #080C14; }
[data-theme="dark"] .phone             { background: #0F1923; box-shadow: 0 0 0 10px #1a1d2e, 0 32px 80px rgba(0,0,0,0.8); }
[data-theme="dark"] .status-bar        { background: #1A2535; border-color: #243040; }
[data-theme="dark"] .status-bar .time  { color: #E8EEFA; }
[data-theme="dark"] .status-icons svg  { fill: #E8EEFA; }
[data-theme="dark"] .app-header        { background: #1A2535; border-color: #243040; }
[data-theme="dark"] .top-tabs          { background: #1A2535; border-color: #243040; }
[data-theme="dark"] .top-tab           { color: #6B7A96; }
[data-theme="dark"] .top-tab.active    { color: #1EC86A; border-bottom-color: #1EC86A; }
[data-theme="dark"] .bottom-nav        { background: #1A2535; border-color: #243040; box-shadow: 0 -4px 20px rgba(0,0,0,0.4); }
[data-theme="dark"] .page-header       { background: #1A2535; border-color: #243040; }
[data-theme="dark"] .hdr-btn           { background: #243040; }
[data-theme="dark"] .hdr-btn svg       { fill: #E8EEFA; }
[data-theme="dark"] .back-btn          { background: #243040; }
[data-theme="dark"] .back-btn svg      { fill: #E8EEFA; }
[data-theme="dark"] .ph-title,
[data-theme="dark"] .page-title        { color: #E8EEFA; }
[data-theme="dark"] .ph-icon           { background: #243040; }
[data-theme="dark"] .ph-icon svg       { fill: #E8EEFA; }
[data-theme="dark"] .scroll-area       { background: #0F1923; }

/* Cards / items */
[data-theme="dark"] .card-item,
[data-theme="dark"] .quick-card,
[data-theme="dark"] .bonus-card,
[data-theme="dark"] .rates-card,
[data-theme="dark"] .info-card,
[data-theme="dark"] .stories-row,
[data-theme="dark"] .user-row,
[data-theme="dark"] .customize-btn,
[data-theme="dark"] .chat-section,
[data-theme="dark"] .chat-search,
[data-theme="dark"] .chat-search-inner { background: #1A2535; }
[data-theme="dark"] .customize-btn     { border-color: #3A4560; }
[data-theme="dark"] .filter-row        { background: #1A2535; border-color: #243040; }
[data-theme="dark"] .filter-chip       { background: #243040; color: #E8EEFA; }
[data-theme="dark"] .hist-search,
[data-theme="dark"] .chat-search-inner { background: #243040; }

/* Text */
[data-theme="dark"] .sec-title,
[data-theme="dark"] .notif-title,
[data-theme="dark"] .rates-ttl,
[data-theme="dark"] .rate-cur,
[data-theme="dark"] .rate-buy,
[data-theme="dark"] .chat-name,
[data-theme="dark"] .tx-name,
[data-theme="dark"] .ci-name,
[data-theme="dark"] .user-name,
[data-theme="dark"] .qi-lbl            { color: #E8EEFA; }
[data-theme="dark"] .rate-row          { border-color: #243040; }
[data-theme="dark"] .notif-item        { border-color: #243040; }
[data-theme="dark"] .notif-item.unread { background: #0D2E1C; }
[data-theme="dark"] .notif-panel,
[data-theme="dark"] .qr-sheet,
[data-theme="dark"] .detail-sheet      { background: #1A2535; }
[data-theme="dark"] .qr-modal-title    { color: #E8EEFA; }
[data-theme="dark"] .qr-code-box       { background: #243040; border-color: #3A4560; }
[data-theme="dark"] .qr-btn-secondary  { background: #243040; color: #E8EEFA; }

/* Nav icons */
[data-theme="dark"] .nav-item svg      { fill: #6B7A96; }
[data-theme="dark"] .nav-item.active svg { fill: #1EC86A; }
[data-theme="dark"] .nav-label         { color: #6B7A96; }
[data-theme="dark"] .nav-item.active .nav-label { color: #1EC86A; }

/* Chat window */
[data-theme="dark"] .chat-win-header   { background: #1A2535; border-color: #243040; }
[data-theme="dark"] .chat-win-name     { color: #E8EEFA; }
[data-theme="dark"] .chat-messages     { background: #0F1923; }
[data-theme="dark"] .msg.in .msg-bubble { background: #1A2535; color: #E8EEFA; }
[data-theme="dark"] .msg-card          { background: #1A2535; }
[data-theme="dark"] .msg-card-title    { color: #E8EEFA; }
[data-theme="dark"] .chat-input-row    { background: #1A2535; border-color: #243040; }
[data-theme="dark"] .chat-input        { background: #243040; color: #E8EEFA; }
[data-theme="dark"] .chat-item         { background: #1A2535; border-color: #243040; }
[data-theme="dark"] .chat-item.unread  { background: #0D2E1C; }

/* History */
[data-theme="dark"] .tx-item           { background: #1A2535; }
[data-theme="dark"] .chart-section     { background: #1A2535; }
[data-theme="dark"] .chart-title       { color: #E8EEFA; }

/* Apply page */
[data-theme="dark"] .product-card      { background: #1A2535; }
[data-theme="dark"] .product-name      { color: #E8EEFA; }
[data-theme="dark"] .feat-pill         { background: #243040; color: #E8EEFA; }
[data-theme="dark"] .cat-tabs          { background: #1A2535; border-color: #243040; }
[data-theme="dark"] .cat-tab           { color: #6B7A96; }
[data-theme="dark"] .cat-tab.active    { color: #1EC86A; border-bottom-color: #1EC86A; }
[data-theme="dark"] .compare-section   { background: #1A2535; }
[data-theme="dark"] .compare-hdr       { border-color: #243040; }
[data-theme="dark"] .compare-title     { color: #E8EEFA; }
[data-theme="dark"] .compare-row       { border-color: #243040; }
[data-theme="dark"] .cr-label          { color: #6B7A96; }
[data-theme="dark"] .cr-val            { color: #E8EEFA; }

/* Customize page */
[data-theme="dark"] .drag-item         { background: #1A2535; }
[data-theme="dark"] .di-name           { color: #E8EEFA; }
[data-theme="dark"] .toggle            { background: #3A4560; }
[data-theme="dark"] .order-badge       { background: #243040; color: #6B7A96; }
[data-theme="dark"] .theme-label       { color: #E8EEFA; }

/* ═══════════════════════════════════════════════════════════
   BLUE THEME
   ═══════════════════════════════════════════════════════════ */
[data-theme="blue"] {
  --green:       #2196F3;
  --green-light: #E3F2FD;
  --green-dark:  #1565C0;
  --gray-bg:     #EBF4FF;
  --white:       #FFFFFF;
  --dark:        #0D1B2A;
  --dark2:       #1565C0;
  --border:      #D6EAFF;
  --gray-text:   #5B7A9A;
}
[data-theme="blue"] .qr-fab            { background: linear-gradient(135deg, #2196F3, #1565C0); box-shadow: 0 4px 20px rgba(33,150,243,0.5); }
[data-theme="blue"] .top-tab.active    { color: #2196F3; border-bottom-color: #2196F3; }
[data-theme="blue"] .nav-item.active svg { fill: #2196F3; }
[data-theme="blue"] .nav-item.active .nav-label,
[data-theme="blue"] .nav-qr .nav-label { color: #2196F3; }
[data-theme="blue"] .filter-chip.active { background: #E3F2FD; color: #1565C0; border-color: #2196F3; }

/* ═══════════════════════════════════════════════════════════
   WARM THEME
   ═══════════════════════════════════════════════════════════ */
[data-theme="warm"] {
  --green:       #FF6B35;
  --green-light: #FFF0E8;
  --green-dark:  #D4521A;
  --gray-bg:     #FFF8F4;
  --white:       #FFFFFF;
  --dark:        #2C1810;
  --dark2:       #8B3A1A;
  --border:      #FFE8DA;
  --gray-text:   #9A7060;
}
[data-theme="warm"] .qr-fab            { background: linear-gradient(135deg, #FF6B35, #D4521A); box-shadow: 0 4px 20px rgba(255,107,53,0.5); }
[data-theme="warm"] .top-tab.active    { color: #FF6B35; border-bottom-color: #FF6B35; }
[data-theme="warm"] .nav-item.active svg { fill: #FF6B35; }
[data-theme="warm"] .nav-item.active .nav-label,
[data-theme="warm"] .nav-qr .nav-label { color: #FF6B35; }
[data-theme="warm"] .filter-chip.active { background: #FFF0E8; color: #D4521A; border-color: #FF6B35; }
