/* ======= СОВРЕМЕННАЯ МИНИМАЛИСТИЧНАЯ ТЕМА ======= */
:root{
  /* Цветовая палитра - мягкие, приглушенные тона */
  --bg: #0a0e14;
  --bg-elev: #0f1419;
  --card: #151a21;
  --text: #e8f0f8;
  --muted: #8a9ba8;
  
  /* Акцент - современный бирюзовый с градиентом */
  --accent: #00d4ff;
  --accent-hover: #00b8e0;
  --accent-light: rgba(0, 212, 255, 0.15);
  --accent-glow: rgba(0, 212, 255, 0.2);
  
  /* Границы и разделители */
  --border: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.12);
  
  /* Стеклянный эффект */
  --glass: rgba(255, 255, 255, 0.04);
  --glass-hover: rgba(255, 255, 255, 0.06);
  
  /* Тени */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 24px var(--accent-glow);
  
  /* Календарь */
  --range-fill: rgba(0, 212, 255, 0.12);
  --range-edge: rgba(0, 212, 255, 0.25);
}

/* ======= БАЗА СТРАНИЦЫ ======= */
*,*::before,*::after{ 
  box-sizing:border-box; 
  margin: 0;
  padding: 0;
}

html{
  height:100%;
  overflow:hidden;
  overscroll-behavior:none;
  -webkit-text-size-adjust:100%;
}

body{
  margin:0;
  padding:0;
  padding-bottom: 12px;
  min-height:100%;
  height:100dvh;
  overflow:hidden;
  overscroll-behavior:none;
  -webkit-overflow-scrolling:touch;
  font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  letter-spacing: -0.01em;
  background: 
    radial-gradient(ellipse 120% 80% at 50% -20%, rgba(0, 212, 255, 0.08) 0%, transparent 70%),
    linear-gradient(180deg, #0a0e14 0%, #0d1117 100%);
  background-attachment:fixed;
  color:var(--text);
  display:flex;
  flex-direction:column;
  touch-action:pan-y;
  -webkit-tap-highlight-color:transparent;
}

@supports not (height: 100dvh) {
  body { height:100vh; }
}

@supports (padding-top: env(safe-area-inset-top)) {
  body {
    padding-top: env(safe-area-inset-top);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }
}

/* ======= ОСНОВНОЙ КОНТЕЙНЕР ======= */
.wrap{
  max-width:900px; 
  width:100%;
  margin:16px auto;
  margin-bottom:96px;
  padding:20px 18px;
  height:auto;
  flex-shrink:0;
}

/* ======= ТИПОГРАФИКА ======= */
h1{
  font-size: 24px;
  font-weight: 700;
  line-height: 1.2;
  margin: 0;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--text) 0%, var(--muted) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

p.lead{
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  margin: 12px 0 20px;
  font-weight: 400;
}

label{
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  display: block;
  margin-bottom: 8px;
  letter-spacing: 0.01em;
}

.muted{
  color: var(--muted);
  font-size: 13px;
}

.small{
  font-size: 12px;
}

/* ======= ФОРМЫ ======= */
.field{
  display: flex;
  flex-direction: column;
  margin-bottom: 16px;
}

input[type="text"], 
input[type="file"],
input[type="number"],
input.input,
select,
.select, 
.fake-input{
  background: var(--card);
  border: 1px solid var(--border);
  padding: 12px 14px;
  border-radius: 14px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
  width: 100%;
  box-sizing: border-box;
}

input[type="text"]:focus,
input[type="number"]:focus,
input.input:focus,
textarea.textarea-input:focus,
select:focus,
.fake-input:focus-within{
  border-color: var(--accent);
  background: rgba(0, 212, 255, 0.05);
  box-shadow: 0 0 0 3px var(--accent-light);
  outline: none;
}

input[type="text"]::placeholder,
input[type="number"]::placeholder,
input.input::placeholder,
textarea.textarea-input::placeholder{
  color: #5a6773;
  opacity: 0.6;
}

textarea.textarea-input{
  background: var(--card);
  border: 1px solid var(--border);
  padding: 12px 14px;
  border-radius: 14px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
  min-height: 100px;
}

select,
.select-input{
  color: var(--text);
  font-size: 15px;
  border-radius: 12px;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L6 6L11 1' stroke='%238a9ba8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}

select option{
  background: var(--card);
  color: var(--text);
}

.token-row{
  display: flex;
  gap: 10px;
  align-items: stretch;
}

/* ======= КНОПКИ ======= */
.btn{
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
  border: none;
  padding: 12px 20px;
  border-radius: 14px;
  color: #001a20;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 
    0 4px 12px rgba(0, 212, 255, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  position: relative;
  overflow: hidden;
}

.btn::before{
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

.btn:hover::before{
  left: 100%;
}

.btn:hover{
  transform: translateY(-1px);
  box-shadow: 
    0 6px 20px rgba(0, 212, 255, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.btn:active{
  transform: translateY(0);
}

.btn.secondary{
  background: var(--glass);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: none;
}

.btn.secondary:hover{
  background: var(--glass-hover);
  border-color: var(--border-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn.secondary::before{
  display: none;
}

.btn.small{
  padding: 10px 16px;
  font-size: 13px;
}

.btn.ghost{
  background: transparent;
  border: 1px dashed var(--border);
  color: var(--muted);
  box-shadow: none;
}

.btn.ghost:hover{
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

.btn.disabled{
  opacity: 0.5;
  pointer-events: none;
  cursor: not-allowed;
}

/* ======= СЕГМЕНТНЫЙ ПЕРЕКЛЮЧАТЕЛЬ ======= */
.seg{
  display: inline-flex;
  gap: 4px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 4px;
  overflow: hidden;
}

.seg button{
  padding: 10px 16px;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  border-radius: 14px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.seg button.active{
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
  color: #001a20;
  box-shadow: 0 2px 8px rgba(0, 212, 255, 0.3);
}

.seg-small button{
  padding: 8px 14px;
  font-size: 13px;
}

/* ======= КАЛЕНДАРЬ И ПРЕСЕТЫ ======= */
.range-row{
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.fake-input{
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 240px;
  cursor: pointer;
  user-select: none;
  transition: all 0.2s ease;
}

.fake-input:hover{
  background: var(--glass-hover);
  border-color: var(--border-hover);
}

.fake-input .icon{
  font-size: 18px;
  opacity: 0.7;
}

.chips{
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip-btn{
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.chip-btn:hover{
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

/* ======= ПОПАП КАЛЕНДАРЯ ======= */
.picker-pop{
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fadeIn 0.2s ease;
}

.picker{
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 20px;
  min-width: 320px;
  max-width: 90vw;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.picker header,
.picker footer{
  background: var(--glass);
  border-radius: 16px;
  padding: 12px;
}

.picker header{
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.picker header .nav{
  display: flex;
  gap: 8px;
}

/* Календарь */
.cal{
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}

.cal-head{
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  padding: 8px 0;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

#grid{
  position: relative;
}

.cal-day{
  position: relative;
  z-index: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  border-radius: 12px;
  background: var(--glass);
  border: 1px solid transparent;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

.cal-day.in-month:hover{
  background: var(--glass-hover);
  border-color: var(--border);
  transform: scale(1.05);
}

.cal-day.empty{
  visibility: hidden;
}

.cal-day.in-range{
  background: var(--range-fill);
  border-color: var(--range-edge);
}

.cal-day.range-left::before,
.cal-day.range-right::before{
  content: "";
  position: absolute;
  top: 4px;
  bottom: 4px;
  z-index: -1;
  background: var(--range-fill);
  border: 1px solid var(--range-edge);
}

.cal-day.range-left::before{
  left: -10px;
  right: 4px;
  border-right: none;
  border-radius: 12px 0 0 12px;
}

.cal-day.range-right::before{
  left: 4px;
  right: -10px;
  border-left: none;
  border-radius: 0 12px 12px 0;
}

.cal-day.is-start,
.cal-day.is-end,
.cal-day.is-single{
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
  color: #001a20;
  border-color: transparent;
  box-shadow: 
    0 0 0 3px var(--accent-light),
    0 4px 12px rgba(0, 212, 255, 0.4);
  z-index: 1;
  font-weight: 600;
}

.cal-day.today{
  outline: 2px dashed var(--accent);
  outline-offset: -2px;
}

.picker footer{
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 16px;
}

/* ======= КАРТОЧКИ И УВЕДОМЛЕНИЯ ======= */
.file-list{
  margin-top: 16px;
}

.notice{
  padding: 16px;
  border-radius: 16px;
  background: var(--glass);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  box-shadow: var(--shadow-sm);
}

.file-card{
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  transition: all 0.2s ease;
}

.file-card:hover{
  background: var(--glass-hover);
  border-color: var(--border-hover);
}

/* ======= СПИННЕР ======= */
.spinner{
  width: 20px;
  height: 20px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

@keyframes spin{
  to { transform: rotate(360deg); }
}

@keyframes fadeIn{
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideDown{
  from { 
    opacity: 0;
    transform: translateX(-50%) translateY(-20px);
  }
  to { 
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

@keyframes slideUp{
  from { 
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
  to { 
    opacity: 0;
    transform: translateX(-50%) translateY(-20px);
  }
}

/* ======= ЭКРАНЫ ======= */
.screen{
  display: none;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.screen.active{
  display: block;
}

.wrap.center{
  text-align: center;
}

/* ======= ВКЛАДКИ (TABBAR) ======= */
.tabbar{
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: auto;
  min-height: 64px;
  padding: 12px 12px;
  padding-bottom: max(12px, calc(env(safe-area-inset-bottom) + 8px));
  background: #0b0f14;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  border-top: 1px solid rgba(255,255,255,0.06);
  z-index: 50;
  flex-shrink: 0;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.3);
}

.tabbar .tab-item .ti svg{
  width: 20px;
  height: 20px;
  color: currentColor;
}

.tabbar .tab-item{
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 12px;
  color: #cfd8e3;
  background: transparent;
  border: 0;
  border-radius: 12px;
  padding: 8px 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tabbar .tab-item .ti{
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: rgba(255,255,255,0.08);
  transition: all 0.2s ease;
  overflow: hidden;
}

.tabbar .tab-item .ti .tab-icon{
  width: 20px;
  height: 20px;
  object-fit: contain;
  object-position: center;
  transition: all 0.2s ease;
  display: block;
}

/* Стили для фото пользователя в иконке профиля */
.tabbar .tab-item .ti #profileTabIcon.user-photo{
  border-radius: 50% !important;
  object-fit: cover !important;
  width: 20px !important;
  height: 20px !important;
}

.tabbar .tab-item.active{
  color: #0bd1d1;
  background: rgba(11,209,209,0.08);
}

.tabbar .tab-item.active .ti{
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
  box-shadow: 0 2px 8px rgba(0, 212, 255, 0.3);
}

.tabbar .tab-item.active .ti .tab-icon{
  filter: brightness(1.1) drop-shadow(0 0 2px rgba(255, 255, 255, 0.5));
  transform: scale(1.05);
}

.tabbar .tab-item:hover .ti{
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
}

.tabbar .tab-item:hover .ti .tab-icon{
  transform: scale(1.05);
}

/* ======= ПРОГРЕСС-БАР ======= */
.progress-wrap{
  margin-top: 16px;
  padding: 16px;
  background: var(--glass);
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.progress-bar-container{
  width: 100%;
  height: 6px;
  background: var(--card);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.progress-bar{
  height: 100%;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-hover) 100%);
  border-radius: 10px;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 12px var(--accent-glow);
}

.progress-detail{
  margin-top: 12px;
  font-size: 13px;
  color: var(--muted);
}

/* ======= РЕЖИМ ВЫГРУЗКИ ======= */
.finance-mode-field{
  animation: fadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.finance-mode-hint{
  margin-top: 12px;
  line-height: 1.6;
  color: var(--muted);
}

/* ======= СТАТУС ======= */
.status-row{
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-progress{
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ======= СТРАНИЦА СЕРВИСОВ ======= */
.services-grid{
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-top: 20px;
}

.service-card{
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: left;
  width: 100%;
  box-shadow: var(--shadow-sm);
}

.service-card:hover{
  background: var(--glass-hover);
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.service-icon{
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-light);
  border-radius: 12px;
  padding: 10px;
}

.service-icon img{
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.service-content{
  flex: 1;
  min-width: 0;
}

.service-content h3{
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 4px 0;
  color: var(--text);
}

.service-content p{
  margin: 0;
}

/* ======= КАРТОЧКИ СТАТУСОВ ======= */
.cards-grid{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.cards-grid > .card{
  display: block;
  position: relative;
  isolation: isolate;
}

.card{
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 20px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm);
  display: block;
  position: relative;
  margin: 0;
}

.card:hover{
  background: var(--glass-hover);
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.card-header{
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.card-header h3{
  font-size: 16px;
  font-weight: 600;
  margin: 0;
  color: var(--text);
}

.card-body{
  color: var(--muted);
  font-size: 14px;
}

.btn-row{
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

/* ======= АДАПТИВНОСТЬ ======= */
@media screen and (max-height: 600px) {
  .wrap {
    padding: 16px;
    margin: 12px auto;
    margin-bottom: 88px;
  }
  h1 { font-size: 22px; }
  p.lead { font-size: 13px; margin: 10px 0 16px; }
  .field { margin-bottom: 14px; }
  .btn { padding: 10px 18px; font-size: 13px; }
  .tabbar { 
    min-height: 56px;
    padding: 8px 12px;
    padding-bottom: max(8px, calc(env(safe-area-inset-bottom) + 4px));
  }
  .wrap-header { 
    margin-bottom: 10px; 
    align-items: center;
  }
  .theme-toggle-wrapper {
    display: flex;
    align-items: center;
  }
}

@media screen and (max-width: 480px) {
  /* Переопределяем padding на body для равномерного центрирования */
  /* Используем одинаковый padding с обеих сторон, игнорируя различия в safe-area */
  body {
    padding-left: 8px !important;
    padding-right: 8px !important;
  }
  
  .screen {
    padding-left: 0;
    padding-right: 0;
    box-sizing: border-box;
  }
  
  .wrap {
    padding: 16px;
    margin: 8px auto;
    margin-bottom: 88px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
  p.lead { font-size: 13px; margin: 10px 0 16px; }
  .field { margin-bottom: 14px; }
  .range-row { flex-direction: column; align-items: stretch; }
  .fake-input { min-width: auto; padding: 10px 12px; }
  .chips { justify-content: center; }
  .seg { flex-wrap: wrap; }
  .seg button { flex: 1; min-width: 80px; text-align: center; padding: 8px 12px; font-size: 13px; }
  .cards-grid { grid-template-columns: 1fr; gap: 12px; }
  .card { padding: 16px; }
  .btn { padding: 10px 16px; font-size: 13px; }
  
  /* Выравнивание заголовка и переключателя темы */
  .wrap-header { 
    position: relative !important;
    display: block !important;
    gap: 0;
    min-height: 24px;
  }
  .wrap-header h1 {
    display: inline-block !important;
    vertical-align: middle !important;
    padding-right: 54px;
    line-height: 1.2 !important;
    margin: 0;
    font-size: 20px !important;
    max-width: calc(100% - 54px);
  }
  .wrap-header > div:first-child {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    width: 100% !important;
    margin-bottom: 8px;
  }
  .wrap-header > div:first-child h1 {
    padding-right: 0 !important;
    max-width: none !important;
    flex: 1;
  }
  .theme-toggle-wrapper {
    display: inline-block !important;
    vertical-align: middle !important;
    position: absolute !important;
    top: 0 !important;
    right: 0 !important;
    margin-top: 0;
  }
  .theme-toggle {
    width: 42px;
    height: 21px;
    display: block;
  }
  .toggle-button {
    width: 17px;
    height: 17px;
    top: 2px;
    left: 2px;
  }
  #theme-toggle-wb:checked + .theme-toggle .toggle-button,
  #theme-toggle-ozon:checked + .theme-toggle .toggle-button,
  #theme-toggle-services:checked + .theme-toggle .toggle-button,
  #theme-toggle-status:checked + .theme-toggle .toggle-button,
  #theme-toggle-merge:checked + .theme-toggle .toggle-button,
  #theme-toggle-profile:checked + .theme-toggle .toggle-button {
    transform: translateX(21px);
  }
  
  /* Адаптация для страницы Сервисы */
  .services-grid {
    gap: 12px;
  }
  .service-card {
    padding: 16px;
  }
  .service-icon {
    width: 40px;
    height: 40px;
  }
  .service-content h3 {
    font-size: 16px;
  }
}

@media screen and (max-height: 450px) and (orientation: landscape) {
  .wrap {
    padding: 12px 16px;
    margin: 6px auto;
    margin-bottom: 64px;
  }
  h1 { font-size: 18px; }
  p.lead { display: none; }
  .field { margin-bottom: 10px; }
  .btn { padding: 8px 14px; font-size: 12px; }
  .tabbar { 
    min-height: 48px;
    padding: 6px 8px;
    padding-bottom: max(6px, calc(env(safe-area-inset-bottom) + 2px));
  }
  .tabbar .tab-item { 
    font-size: 10px;
    padding: 6px 4px;
  }
  .tabbar .tab-item .ti { 
    width: 24px; 
    height: 24px;
  }
  .tabbar .tab-item .ti .tab-icon {
    width: 18px;
    height: 18px;
    object-fit: contain;
  }
  .wrap-header { 
    margin-bottom: 8px; 
    align-items: center;
  }
  .theme-toggle-wrapper {
    display: flex;
    align-items: center;
    margin-top: 0;
  }
}

/* ======= УТИЛИТЫ ======= */
.row{
  display: flex;
  gap: 12px;
  align-items: center;
}

.col{
  display: flex;
  flex-direction: column;
}

footer{
  margin-top: 24px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

/* ======= ЗАГОЛОВОК С ПЕРЕКЛЮЧАТЕЛЕМ ТЕМЫ ======= */
.wrap-header{
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  gap: 16px;
  position: relative;
}

.wrap-header h1{
  flex: 1;
  margin: 0;
  line-height: 1.2;
  display: flex;
  align-items: center;
  height: auto;
}

.wrap-header .btn{
  align-self: center;
  height: auto;
  line-height: 1.4;
}

/* ======= ПЕРЕКЛЮЧАТЕЛЬ ТЕМЫ ======= */
.theme-toggle-wrapper{
  flex-shrink: 0;
  margin-top: 0;
  display: flex;
  align-items: center;
}

#theme-toggle-wb,
#theme-toggle-ozon,
#theme-toggle-status,
#theme-toggle-merge,
#theme-toggle-profile{
  opacity: 0;
  height: 0;
  width: 0;
}

.theme-toggle{
  position: relative;
  cursor: pointer;
  display: inline-block;
  width: 48px;
  height: 24px;
  background: #211042;
  border-radius: 50px;
  transition: 500ms;
  overflow: hidden;
}

.theme-toggle:hover{
  transform: scale(1.05);
  box-shadow: 
    0 4px 12px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.toggle-button{
  position: absolute;
  display: inline-block;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #FAEAF1;
  overflow: hidden;
  box-shadow: 0 0 12px 2px rgba(255, 255, 255, 0.5);
  transition: all 500ms ease-out;
}

.crater{
  position: absolute;
  display: inline-block;
  background: #FAEAF1;
  border-radius: 50%;
  transition: 500ms;
}

.crater-1{
  background: #FFFFF9;
  width: 20px;
  height: 20px;
  left: 2px;
  bottom: 2px;
}

.crater-2{
  width: 4px;
  height: 4px;
  top: -1px;
  left: 10px;
}

.crater-3{
  width: 4px;
  height: 4px;
  top: 4px;
  right: -1px;
}

.crater-4{
  width: 2px;
  height: 2px;
  top: 6px;
  left: 8px;
}

.crater-5{
  width: 4px;
  height: 4px;
  top: 10px;
  left: 12px;
}

.crater-6{
  width: 2px;
  height: 2px;
  top: 12px;
  left: 5px;
}

.crater-7{
  width: 3px;
  height: 3px;
  bottom: 2px;
  left: 9px;
}

.star{
  position: absolute;
  display: inline-block;
  border-radius: 50%;
  background: #FFF;
  box-shadow: 1px 0 2px 2px rgba(255, 255, 255);
}

.star-1{
  width: 1.5px;
  height: 1.5px;
  right: 20px;
  bottom: 10px;
}

.star-2{
  width: 2px;
  height: 2px;
  right: 16px;
  top: 2px;
}

.star-3{
  width: 1px;
  height: 1px;
  right: 14px;
  bottom: 4px;
}

.star-4{
  width: 0.8px;
  height: 0.8px;
  right: 10px;
  bottom: 12px;
}

.star-5{
  width: 1px;
  height: 1px;
  right: 2px;
  bottom: 8px;
}

.star-6, .star-7, .star-8{
  width: 2px;
  height: 0.6px;
  border-radius: 1px;
  transform: rotate(-45deg);
  box-shadow: 1px 0px 1px 0.6px #FFF;
  animation-name: travel;
  animation-duration: 1.5s;
  animation-timing-function: ease-out;
  animation-iteration-count: infinite;
}

.star-6{
  right: 7px;
  bottom: 8px;
  animation-delay: -2s;
}

.star-7{
  right: 12px;
  bottom: 14px;
}

.star-8{
  right: 22px;
  top: 2px;
  animation-delay: -4s;
}

@keyframes travel{
  0%{
    transform: rotate(-45deg) translateX(18px);
  }
  50%{
    transform: rotate(-45deg) translateX(-6px);
    box-shadow: 1px 0px 1.5px 0.6px #FFF;
  }
  100%{
    transform: rotate(-45deg) translateX(-9px);
    width: 0.6px;
    height: 0.6px;
    opacity: 0;
    box-shadow: none;
  }
}

/* Светлая тема (когда чекбокс отмечен) */
#theme-toggle-wb:checked + .theme-toggle,
#theme-toggle-ozon:checked + .theme-toggle,
#theme-toggle-status:checked + .theme-toggle,
#theme-toggle-merge:checked + .theme-toggle,
#theme-toggle-profile:checked + .theme-toggle,
.theme-toggle.checked{
  background: #24D7F7;
}

#theme-toggle-wb:checked + .theme-toggle .toggle-button,
#theme-toggle-ozon:checked + .theme-toggle .toggle-button,
#theme-toggle-status:checked + .theme-toggle .toggle-button,
#theme-toggle-merge:checked + .theme-toggle .toggle-button,
#theme-toggle-profile:checked + .theme-toggle .toggle-button,
.theme-toggle.checked .toggle-button{
  background: #F7FFFF;
  transform: translateX(24px);
  box-shadow: 0 0 12px 2px rgba(255, 255, 255, 0.7);
}

#theme-toggle-wb:checked + .theme-toggle .toggle-button .crater,
#theme-toggle-ozon:checked + .theme-toggle .toggle-button .crater,
#theme-toggle-status:checked + .theme-toggle .toggle-button .crater,
#theme-toggle-merge:checked + .theme-toggle .toggle-button .crater,
#theme-toggle-profile:checked + .theme-toggle .toggle-button .crater,
.theme-toggle.checked .toggle-button .crater{
  transform: rotate(-45deg) translateX(24px);
}

#theme-toggle-wb:checked + .theme-toggle .star,
#theme-toggle-ozon:checked + .theme-toggle .star,
#theme-toggle-status:checked + .theme-toggle .star,
#theme-toggle-merge:checked + .theme-toggle .star,
#theme-toggle-profile:checked + .theme-toggle .star,
.theme-toggle.checked .star{
  animation: move 2s infinite;
  transform: none;
  box-shadow: none;
}

#theme-toggle-wb:checked + .theme-toggle .star-1,
#theme-toggle-ozon:checked + .theme-toggle .star-1,
#theme-toggle-status:checked + .theme-toggle .star-1,
#theme-toggle-merge:checked + .theme-toggle .star-1,
#theme-toggle-profile:checked + .theme-toggle .star-1,
.theme-toggle.checked .star-1{
  width: 10px;
  height: 2px;
  border-radius: 2px;
  background: #FFF;
  left: 4px;
  top: 6px;
  box-shadow: none;
}

#theme-toggle-wb:checked + .theme-toggle .star-2,
#theme-toggle-ozon:checked + .theme-toggle .star-2,
#theme-toggle-status:checked + .theme-toggle .star-2,
#theme-toggle-merge:checked + .theme-toggle .star-2,
#theme-toggle-profile:checked + .theme-toggle .star-2,
.theme-toggle.checked .star-2{
  width: 3px;
  height: 3px;
  background: #FFF;
  left: 6px;
  top: 5px;
  box-shadow: -1px 0 2px 0 rgba(0, 0, 0, 0.1);
}

#theme-toggle-wb:checked + .theme-toggle .star-3,
#theme-toggle-ozon:checked + .theme-toggle .star-3,
#theme-toggle-status:checked + .theme-toggle .star-3,
#theme-toggle-merge:checked + .theme-toggle .star-3,
#theme-toggle-profile:checked + .theme-toggle .star-3,
.theme-toggle.checked .star-3{
  width: 4px;
  height: 4px;
  background: #FFF;
  left: 8px;
  top: 4px;
  box-shadow: -1px 0 2px 0 rgba(0, 0, 0, 0.1);
}

#theme-toggle-wb:checked + .theme-toggle .star-4,
#theme-toggle-ozon:checked + .theme-toggle .star-4,
#theme-toggle-status:checked + .theme-toggle .star-4,
#theme-toggle-merge:checked + .theme-toggle .star-4,
#theme-toggle-profile:checked + .theme-toggle .star-4,
.theme-toggle.checked .star-4{
  width: 3px;
  height: 3px;
  background: #FFF;
  left: 10px;
  top: 5px;
  box-shadow: -1px 0 2px 0 rgba(0, 0, 0, 0.1);
}

#theme-toggle-wb:checked + .theme-toggle .star-5,
#theme-toggle-ozon:checked + .theme-toggle .star-5,
#theme-toggle-status:checked + .theme-toggle .star-5,
#theme-toggle-merge:checked + .theme-toggle .star-5,
#theme-toggle-profile:checked + .theme-toggle .star-5,
.theme-toggle.checked .star-5{
  width: 14px;
  height: 4px;
  border-radius: 4px;
  background: #FFF;
  left: 7px;
  bottom: 4px;
  box-shadow: none;
}

#theme-toggle-wb:checked + .theme-toggle .star-6,
#theme-toggle-ozon:checked + .theme-toggle .star-6,
#theme-toggle-status:checked + .theme-toggle .star-6,
#theme-toggle-merge:checked + .theme-toggle .star-6,
#theme-toggle-profile:checked + .theme-toggle .star-6,
.theme-toggle.checked .star-6{
  width: 4px;
  height: 4px;
  background: #FFF;
  border-radius: 50%;
  left: 9px;
  bottom: 4px;
  box-shadow: -1px 0 2px 0 rgba(0, 0, 0, 0.1);
}

#theme-toggle-wb:checked + .theme-toggle .star-7,
#theme-toggle-ozon:checked + .theme-toggle .star-7,
#theme-toggle-status:checked + .theme-toggle .star-7,
#theme-toggle-merge:checked + .theme-toggle .star-7,
#theme-toggle-profile:checked + .theme-toggle .star-7,
.theme-toggle.checked .star-7{
  width: 5px;
  height: 5px;
  background: #FFF;
  border-radius: 50%;
  left: 12px;
  bottom: 4px;
  box-shadow: -1px 0 2px 0 rgba(0, 0, 0, 0.1);
}

#theme-toggle-wb:checked + .theme-toggle .star-8,
#theme-toggle-ozon:checked + .theme-toggle .star-8,
#theme-toggle-status:checked + .theme-toggle .star-8,
#theme-toggle-merge:checked + .theme-toggle .star-8,
#theme-toggle-profile:checked + .theme-toggle .star-8,
.theme-toggle.checked .star-8{
  width: 4px;
  height: 4px;
  background: #FFF;
  border-radius: 50%;
  left: 16px;
  top: 14px;
  box-shadow: -1px 0 2px 0 rgba(0, 0, 0, 0.1);
}

@keyframes move{
  0%{
    transform: none;
  }
  25%{
    transform: translateX(1px);
  }
  100%{
    transform: translateX(-1px);
  }
}

/* ======= СВЕТЛАЯ ТЕМА ======= */
body.light-theme{
  --bg: #f5f7fa;
  --bg-elev: #ffffff;
  --card: #ffffff;
  --text: #1a1d29;
  --muted: #6b7280;
  
  --accent: #24D7F7;
  --accent-hover: #1bc0dd;
  --accent-light: rgba(36, 215, 247, 0.15);
  --accent-glow: rgba(36, 215, 247, 0.25);
  
  --border: rgba(0, 0, 0, 0.1);
  --border-hover: rgba(0, 0, 0, 0.15);
  
  --glass: rgba(255, 255, 255, 0.8);
  --glass-hover: rgba(255, 255, 255, 0.9);
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.16);
  --shadow-glow: 0 0 24px rgba(0, 102, 255, 0.15);
  
  --range-fill: rgba(36, 215, 247, 0.12);
  --range-edge: rgba(36, 215, 247, 0.25);
  
  background: 
    radial-gradient(ellipse 120% 80% at 50% -20%, rgba(0, 102, 255, 0.05) 0%, transparent 70%),
    linear-gradient(180deg, #f5f7fa 0%, #e8ecf1 100%);
}

body.light-theme h1{
  background: linear-gradient(135deg, #1a1d29 0%, #3b3f54 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

body.light-theme .tabbar{
  background: #ffffff;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.05);
}

body.light-theme .tabbar .tab-item{
  color: #6b7280;
}

body.light-theme .tabbar .tab-item.active{
  color: #24D7F7;
  background: rgba(36, 215, 247, 0.1);
}

body.light-theme .tabbar .tab-item.active .ti{
  background: linear-gradient(135deg, #24D7F7 0%, #1bc0dd 100%);
  box-shadow: 0 2px 8px rgba(36, 215, 247, 0.3);
}

body.light-theme .tabbar .tab-item.active .ti .tab-icon{
  filter: brightness(1.1) drop-shadow(0 0 2px rgba(255, 255, 255, 0.8));
}

body.light-theme .tabbar .tab-item .ti{
  background: rgba(0, 0, 0, 0.05);
}

body.light-theme .tabbar .tab-item:hover .ti{
  background: rgba(0, 0, 0, 0.08);
}

body.light-theme .service-card{
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

body.light-theme .service-card:hover{
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(0, 0, 0, 0.12);
}

body.light-theme .service-icon{
  background: rgba(36, 215, 247, 0.1);
}

/* Дубликат удален - объединен с основным медиа-запросом выше */

/* ======= PROFILE SCREEN ======= */
.profile-card {
  display: flex;
  align-items: flex-start;
  padding: 24px;
  margin-bottom: 24px;
  background: linear-gradient(135deg, var(--glass) 0%, rgba(255, 255, 255, 0.02) 100%);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-md);
}

.profile-info {
  flex: 1;
  min-width: 0;
  width: 100%;
}

.profile-name {
  font-size: 24px;
  font-weight: 600;
  margin: 0 0 8px 0;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-username {
  font-size: 16px;
  color: var(--accent);
  margin: 0 0 6px 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

.profile-id {
  font-size: 14px;
  color: var(--muted);
  margin: 0;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.stat-card {
  padding: 20px 16px;
  background: var(--glass);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: 12px;
  text-align: center;
  transition: all 0.3s ease;
}

.stat-card:hover {
  background: var(--glass-hover);
  border-color: var(--border-hover);
  transform: translateY(-2px);
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 4px;
  line-height: 1;
}

.stat-label {
  font-size: 13px;
  color: var(--muted);
}

/* Section Header */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-header h3 {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
  color: var(--text);
}

/* Donation Section */
.donation-section {
  margin-bottom: 32px;
}

.donation-description {
  font-size: 14px;
  color: var(--muted);
  margin: 0 0 20px 0;
  line-height: 1.5;
}

.donation-item {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 16px;
  margin-bottom: 12px;
  background: var(--glass);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: all 0.3s ease;
}

.donation-item:hover {
  background: var(--glass-hover);
  border-color: var(--border-hover);
  transform: translateX(4px);
}

.donation-icon {
  font-size: 32px;
  line-height: 1;
  flex-shrink: 0;
}

.donation-content {
  flex: 1;
  min-width: 0;
}

.donation-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.donation-subtitle {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 12px;
  word-break: break-word;
}

.donation-actions {
  display: flex;
  gap: 8px;
}

.donation-btn {
  padding: 8px 16px;
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.donation-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.donation-btn:active {
  transform: translateY(0);
}

/* QR Code Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-content {
  background: var(--glass);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: 16px;
  max-width: 400px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
  color: var(--text);
}

.modal-close {
  background: none;
  border: none;
  font-size: 28px;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.modal-close:hover {
  background: var(--glass-hover);
  color: var(--text);
}

.modal-body {
  padding: 24px;
}

.qr-code-container {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px;
  background: #ffffff;
  border-radius: 12px;
  margin-bottom: 16px;
  min-height: 250px;
}

.qr-code-container img {
  max-width: 100%;
  height: auto;
}

.qr-instruction {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  margin: 0;
  line-height: 1.5;
}

body.light-theme .qr-code-container {
  background: #f5f5f5;
}


/* History List */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.history-item {
  padding: 16px;
  background: var(--glass);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: all 0.3s ease;
}

.history-item:hover {
  background: var(--glass-hover);
  border-color: var(--border-hover);
  transform: translateX(4px);
}

.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.history-type {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.history-status {
  font-size: 13px;
  padding: 4px 10px;
  border-radius: 12px;
  font-weight: 500;
}

.history-status.status-done {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
}

.history-status.status-error {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.history-status.status-pending,
.history-status.status-processing {
  background: rgba(250, 204, 21, 0.15);
  color: #facc15;
}

.history-download-link {
  display: inline-block;
  padding: 6px 12px;
  background: var(--accent);
  color: #000;
  text-decoration: none;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s ease;
  cursor: pointer;
  font-family: inherit;
}

.history-download-link:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.history-download-link:active {
  transform: translateY(0);
}

.history-details {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 4px;
}

.history-date {
  font-size: 12px;
  color: var(--muted);
}

/* Settings List */
.settings-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.setting-item {
  padding: 16px;
  background: var(--glass);
  backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.setting-item:first-child {
  border-radius: 12px 12px 0 0;
}

.setting-item:last-child {
  border-radius: 0 0 12px 12px;
}

.setting-info {
  flex: 1;
}

.setting-label {
  font-size: 15px;
  color: var(--text);
  margin-bottom: 2px;
}

.setting-value {
  font-size: 13px;
  color: var(--muted);
}

/* Action Item (clickable setting) */
.setting-item.action-item {
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.setting-item.action-item:hover {
  background: var(--glass-hover);
  transform: translateX(2px);
}

.setting-item.action-item:active {
  transform: translateX(0);
  opacity: 0.8;
}

.action-icon {
  font-size: 18px;
  color: var(--accent);
  margin-left: 12px;
  transition: transform 0.2s ease;
}

.setting-item.action-item:hover .action-icon {
  transform: translateX(4px);
}

/* Compact History */
.history-list.compact .history-item {
  padding: 12px;
  font-size: 14px;
}

.history-list.compact .history-header {
  margin-bottom: 6px;
}

.history-list.compact .history-details {
  font-size: 12px;
  margin-bottom: 4px;
}

.history-list.compact .history-date {
  font-size: 11px;
}

/* Light theme adjustments for profile */
body.light-theme .profile-card {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
}


body.light-theme .stat-card {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

body.light-theme .history-item {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

body.light-theme .setting-item {
  background: #ffffff;
}

body.light-theme .settings-list {
  background: rgba(0, 0, 0, 0.08);
}

/* Responsive adjustments */
@media screen and (max-width: 480px) {
  .profile-card {
    flex-direction: column;
    text-align: center;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
  }
  
  .stat-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-align: left;
  }
  
  .stat-value {
    font-size: 24px;
  }
}

/* Modal Styles */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  z-index: 1001;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
}

.modal-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 32px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.modal-close:hover {
  background: var(--glass);
  color: var(--text);
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.modal-detail-row {
  margin-bottom: 16px;
}

.modal-detail-label {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 4px;
}

.modal-detail-value {
  font-size: 15px;
  color: var(--text);
  word-break: break-word;
}

.modal-download-link {
  display: inline-block;
  margin-top: 8px;
  padding: 10px 16px;
  background: var(--accent);
  color: #000;
  text-decoration: none;
  border-radius: 8px;
  font-weight: 600;
  transition: all 0.2s ease;
}

.modal-download-link:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

body.light-theme .modal-content {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.08);
}

body.light-theme .modal-close:hover {
  background: rgba(0, 0, 0, 0.05);
}

/* Clickable history items */
.history-item {
  cursor: pointer;
  transition: all 0.2s ease;
}

.history-item:hover {
  background: var(--glass-hover);
  transform: translateX(2px);
}

.history-item:active {
  transform: translateX(0);
  opacity: 0.9;
}

/* Выравнивание для очень узких экранов до 280px */
@media screen and (max-width: 280px) {
  .wrap-header {
    min-height: 21.6px;
  }
  .wrap-header h1 {
    font-size: 18px;
    line-height: 1.2;
    padding-right: 50px;
    max-width: calc(100% - 50px);
  }
  .theme-toggle {
    width: 40px;
    height: 20px;
  }
  .toggle-button {
    width: 16px;
    height: 16px;
  }
  #theme-toggle-wb:checked + .theme-toggle .toggle-button,
  #theme-toggle-ozon:checked + .theme-toggle .toggle-button,
  #theme-toggle-status:checked + .theme-toggle .toggle-button,
  #theme-toggle-merge:checked + .theme-toggle .toggle-button,
  #theme-toggle-profile:checked + .theme-toggle .toggle-button {
    transform: translateX(20px);
  }
}
