* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    /* Основная палитра (Deep Dark Theme) */
    --bg: #0f1115;
    --bg-card: #181a20;
    --bg-card-hover: #1e2128;
    --bg-modal: #181a20;
    
    /* Текст */
    --text: #ffffff;
    --text-secondary: #848b9a;
    --text-tertiary: #5e6575;

    /* Акцентные цвета с Glow эффектом */
    --accent: #3b82f6;
    --accent-glow: rgba(59, 130, 246, 0.5);
    --accent-gradient: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    
    --danger: #ef4444;
    --danger-glow: rgba(239, 68, 68, 0.5);
    --danger-gradient: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    
    --warning: #f59e0b;
    --warning-glow: rgba(245, 158, 11, 0.5);
    --warning-gradient: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    
    --success: #22c55e;
    --success-glow: rgba(34, 197, 94, 0.5);
    --success-gradient: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);

    /* Размеры и тени */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);
    
    --radius: 20px;
    --radius-sm: 14px;
    
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    
    /* Адаптивные переменные */
    --container-width: 100%;
    --container-padding: 16px;
}

body {
    font-family: var(--font-family);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    min-height: 100dvh; /* Dynamic viewport height для мобильных */
    padding: var(--container-padding);
    padding-bottom: 100px;
    -webkit-font-smoothing: antialiased;
    line-height: 1.5;
}

.app {
    max-width: var(--container-width);
    margin: 0 auto;
}

.hidden {
    display: none !important;
}

/* ===== HERO CARD - Ближайший платеж ===== */
.next-payment {
    position: relative;
    background: var(--accent-gradient);
    padding: 20px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    box-shadow: 0 20px 40px -10px var(--accent-glow);
    overflow: hidden;
    color: white;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.next-payment:active {
    transform: scale(0.98);
}

.next-payment::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 60%);
    pointer-events: none;
}

.next-payment.urgent {
    background: var(--danger-gradient);
    box-shadow: 0 20px 40px -10px var(--danger-glow);
}

.next-payment.warning {
    background: var(--warning-gradient);
    box-shadow: 0 20px 40px -10px var(--warning-glow);
}

.next-payment__badge {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 5px 10px;
    border-radius: 16px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.next-payment__label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    opacity: 0.7;
    margin-bottom: 8px;
    font-weight: 600;
}

.next-payment__title {
    font-size: 20px;
    font-weight: 800;
    margin-bottom: 4px;
    line-height: 1.2;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding-right: 60px; /* Место для badge */
}

.next-payment__desc {
    font-size: 13px;
    opacity: 0.9;
    margin-bottom: 16px;
    font-weight: 400;
    max-width: 90%;
}

.next-payment__amount {
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 12px;
    letter-spacing: -1px;
    text-shadow: 0 2px 10px rgba(0,0,0,0.15);
}

.next-payment__date {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    background: rgba(0, 0, 0, 0.15);
    padding: 6px 12px;
    border-radius: 10px;
    font-weight: 500;
}

.next-payment__days {
    position: absolute;
    bottom: -20px;
    right: 5px;
    font-size: 100px;
    font-weight: 900;
    opacity: 0.08;
    line-height: 1;
    pointer-events: none;
    user-select: none;
}

/* ===== STATISTICS ===== */
.stats-container {
    margin-bottom: 20px;
}

.stats-row {
    display: grid;
    gap: 10px;
    min-width: 0;
}

.stats-row--top {
    grid-template-columns: repeat(2, 1fr);
    margin-bottom: 10px;
}

.stats-row--bottom {
    grid-template-columns: 1fr;
}

.stat-box {
    background: var(--bg-card);
    padding: 16px 12px;
    border-radius: var(--radius-sm);
    text-align: center;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.03);
}

.stat-box--accent {
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.15);
}

.stat-box__value {
    display: block;
    font-size: 18px;
    font-weight: 800;
    margin-bottom: 4px;
    white-space: nowrap;
    letter-spacing: -0.5px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stat-box--accent .stat-box__value {
    color: #60a5fa;
    text-shadow: 0 0 20px rgba(59, 130, 246, 0.3);
}

.stat-box--danger {
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.15);
}

.stat-box--danger .stat-box__value {
    color: #f87171;
    text-shadow: 0 0 20px rgba(239, 68, 68, 0.3);
}

.stat-box__label {
    font-size: 10px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

/* ===== PAYMENT CARDS ===== */
.payments {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.payment-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    border: 1px solid rgba(255,255,255,0.03);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    overflow: hidden;
}

.payment-card:active {
    transform: scale(0.97);
    background: var(--bg-card-hover);
}

/* Эффект свечения при наведении на десктопе */
@media (hover: hover) {
    .payment-card:hover {
        transform: translateY(-4px);
        box-shadow: var(--shadow-md);
        border-color: rgba(255,255,255,0.08);
    }
}

/* Стили для оплаченной карточки */
.payment-card.paid {
    background: rgba(34, 197, 94, 0.08);
    border: 1px solid rgba(34, 197, 94, 0.15);
}

.payment-card.paid .payment-card__amount {
    color: var(--success);
    text-shadow: 0 0 15px rgba(34, 197, 94, 0.3);
}

.payment-card.paid .payment-card__title {
    color: rgba(255,255,255,0.8);
}

.payment-card.paid .payment-card__date,
.payment-card.paid .payment-card__desc {
    opacity: 0.7;
}

/* Элементы внутри карточки */
.payment-card__info {
    flex: 1;
    min-width: 0;
}

.payment-card__header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.payment-card__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 10px currentColor;
}

.payment-card__dot.urgent { background: var(--danger); color: var(--danger); }
.payment-card__dot.warning { background: var(--warning); color: var(--warning); }
.payment-card__dot.ok { background: var(--success); color: var(--success); }
.payment-card__dot.blue { background: #3b82f6; color: #3b82f6; }
.payment-card__dot.green { background: var(--success); color: var(--success); }
.payment-card__dot.yellow { background: var(--warning); color: var(--warning); }
.payment-card__dot.red { background: var(--danger); color: var(--danger); }

.payment-card__title {
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -0.3px;
}

.payment-card__desc {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.payment-card__date {
    font-size: 12px;
    color: var(--text-tertiary);
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 500;
    flex-wrap: wrap;
}

.payment-card__date svg {
    width: 13px;
    height: 13px;
    opacity: 0.7;
    flex-shrink: 0;
}

.payment-card__right {
    text-align: right;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
}

.payment-card__amount {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.5px;
    white-space: nowrap;
}

.payment-card__actions {
    display: flex;
    gap: 6px;
}

/* Кнопки действий */
.btn-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.btn-icon svg {
    width: 18px;
    height: 18px;
    stroke-width: 2px;
}

.btn-icon--danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.btn-icon--danger:active {
    background: var(--danger);
    color: #fff;
    transform: scale(0.9);
}

@media (hover: hover) {
    .btn-icon--danger:hover {
        background: rgba(239, 68, 68, 0.2);
    }
}

/* ===== FAB (Floating Action Button) ===== */
.fab {
    position: fixed;
    bottom: 24px;
    right: 16px;
    width: 56px;
    height: 56px;
    border-radius: 18px;
    background: var(--accent-gradient);
    color: #fff;
    border: none;
    box-shadow: 0 10px 30px rgba(59, 130, 246, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 100;
}

.fab svg {
    width: 22px;
    height: 22px;
}

.fab:active {
    transform: scale(0.9) rotate(90deg);
}

/* ===== MODAL ===== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: none;
    justify-content: center;
    align-items: flex-end;
}

.modal.show {
    display: flex;
}

.modal__backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: fadeIn 0.3s ease;
}

.modal__sheet {
    position: relative;
    background: var(--bg-modal);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    max-height: 90dvh;
    overflow-y: auto;
    border-radius: 24px 24px 0 0;
    padding: 20px;
    padding-bottom: max(20px, env(safe-area-inset-bottom));
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 -10px 40px rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.05);
    border-bottom: none;
}

.modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.modal__title {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.modal__close {
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,0.05);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.modal__close:hover,
.modal__close:active {
    background: rgba(255,255,255,0.1);
    color: var(--text);
}

.modal__close svg {
    width: 18px;
    height: 18px;
}

/* ===== FORMS ===== */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 600;
    margin-left: 4px;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 14px 16px;
    background: #0f1115;
    border: 2px solid #23262d;
    border-radius: 14px;
    color: var(--text);
    font-size: 16px;
    font-family: inherit;
    transition: all 0.2s ease;
    /* Prevent zoom on iOS */
    font-size: max(16px, 1rem);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
    background: #13161c;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 60px;
}

/* Form row - два поля в ряд */
.form-row {
    display: flex;
    gap: 12px;
}

.form-row .form-group {
    flex: 1;
    min-width: 0;
}

.btn-primary {
    width: 100%;
    padding: 16px;
    background: var(--accent-gradient);
    color: #fff;
    border: none;
    border-radius: 16px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    margin-top: 8px;
    transition: all 0.2s ease;
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.3);
}

.btn-primary:active {
    transform: scale(0.98);
    box-shadow: 0 2px 10px rgba(59, 130, 246, 0.2);
}

/* ===== TOGGLE SWITCH ===== */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 30px;
}

.toggle-switch input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #23262d;
    transition: .3s cubic-bezier(0.25, 0.8, 0.25, 1);
    border-radius: 30px;
    border: 1px solid rgba(255,255,255,0.05);
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 4px;
    bottom: 3px;
    background-color: #fff;
    transition: .3s cubic-bezier(0.25, 0.8, 0.25, 1);
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--success);
    border-color: transparent;
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(22px);
}

/* ===== EMPTY STATE ===== */
.empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-tertiary);
}

.empty__icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.empty__text {
    font-size: 15px;
    font-weight: 500;
}

/* ===== LOADER ===== */
.loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 60px 20px;
    color: var(--text-tertiary);
    gap: 16px;
}

.loader__spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #23262d;
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* ===== ACCESS DENIED ===== */
.access-denied {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
}

.access-denied__content {
    text-align: center;
    max-width: 320px;
}

.access-denied__icon {
    width: 100px; 
    height: 100px;
    margin: 0 auto 24px;
    background: rgba(59, 130, 246, 0.1);
    border-radius: 50%;
    display: flex; 
    align-items: center; 
    justify-content: center;
    color: var(--accent);
    box-shadow: 0 0 40px rgba(59, 130, 246, 0.1);
}

.access-denied__icon svg {
    width: 50px;
    height: 50px;
}

.access-denied__icon--red {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    box-shadow: 0 0 40px rgba(239, 68, 68, 0.1);
}

.access-denied__icon--warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
    box-shadow: 0 0 40px rgba(245, 158, 11, 0.1);
}

.access-denied__title { 
    font-size: 22px; 
    font-weight: 800; 
    margin-bottom: 12px; 
    letter-spacing: -0.5px; 
}

.access-denied__text { 
    color: var(--text-secondary); 
    line-height: 1.6;
    font-size: 14px;
    margin-bottom: 20px;
}

.access-denied__hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-tertiary);
    background: rgba(255,255,255,0.03);
    padding: 12px 16px;
    border-radius: 12px;
}

.access-denied__hint svg {
    flex-shrink: 0;
    opacity: 0.7;
}

/* ===== ANIMATIONS ===== */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes zoomIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }

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

/* Small phones (320px - 374px) */
@media (max-width: 374px) {
    :root {
        --container-padding: 12px;
    }
    
    body {
        padding-bottom: 90px;
    }
    
    .next-payment {
        padding: 16px;
    }
    
    .next-payment__title {
        font-size: 18px;
        padding-right: 50px;
    }
    
    .next-payment__amount {
        font-size: 26px;
    }
    
    .next-payment__days {
        font-size: 70px;
        bottom: -10px;
    }
    
    .next-payment__badge {
        font-size: 9px;
        padding: 4px 8px;
        top: 12px;
        right: 12px;
    }
    
    .stat-box {
        padding: 12px 10px;
    }
    
    .stat-box__value {
        font-size: 15px;
    }
    
    .stat-box__label {
        font-size: 9px;
    }
    
    .payment-card {
        padding: 14px;
        gap: 10px;
    }
    
    .payment-card__title {
        font-size: 14px;
    }
    
    .payment-card__amount {
        font-size: 14px;
    }
    
    .payment-card__desc {
        font-size: 11px;
    }
    
    .payment-card__date {
        font-size: 11px;
    }
    
    .fab {
        width: 50px;
        height: 50px;
        border-radius: 16px;
        bottom: 20px;
        right: 12px;
    }
    
    .fab svg {
        width: 20px;
        height: 20px;
    }
    
    .modal__sheet {
        padding: 16px;
    }
    
    .modal__title {
        font-size: 18px;
    }
    
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .btn-icon {
        width: 32px;
        height: 32px;
        border-radius: 8px;
    }
    
    .btn-icon svg {
        width: 16px;
        height: 16px;
    }
    
    .access-denied__icon {
        width: 80px;
        height: 80px;
    }
    
    .access-denied__icon svg {
        width: 40px;
        height: 40px;
    }
    
    .access-denied__title {
        font-size: 18px;
    }
    
    .access-denied__text {
        font-size: 13px;
    }
}

/* Regular phones (375px - 479px) */
@media (min-width: 375px) and (max-width: 479px) {
    :root {
        --container-padding: 16px;
    }
}

/* Large phones / Small tablets (480px - 767px) */
@media (min-width: 480px) {
    :root {
        --container-width: 460px;
        --container-padding: 20px;
    }
    
    body {
        padding-bottom: 110px;
    }
    
    .next-payment {
        padding: 24px;
    }
    
    .next-payment__title {
        font-size: 22px;
    }
    
    .next-payment__amount {
        font-size: 36px;
    }
    
    .next-payment__days {
        font-size: 120px;
    }
    
    .stat-box {
        padding: 18px 16px;
    }
    
    .stat-box__value {
        font-size: 20px;
    }
    
    .stat-box__label {
        font-size: 11px;
    }
    
    .payment-card {
        padding: 18px;
    }
    
    .payment-card__title {
        font-size: 16px;
    }
    
    .payment-card__amount {
        font-size: 17px;
    }
    
    .fab {
        width: 60px;
        height: 60px;
        border-radius: 20px;
        bottom: 28px;
        right: 20px;
    }
    
    .modal__title {
        font-size: 22px;
    }
}

/* Tablets (768px - 1023px) */
@media (min-width: 768px) {
    :root {
        --container-width: 540px;
        --container-padding: 24px;
        --radius: 24px;
        --radius-sm: 16px;
    }
    
    body {
        padding-top: 32px;
        padding-bottom: 120px;
    }
    
    .next-payment {
        padding: 28px;
        margin-bottom: 24px;
    }
    
    .next-payment__title {
        font-size: 26px;
    }
    
    .next-payment__desc {
        font-size: 15px;
    }
    
    .next-payment__amount {
        font-size: 42px;
        margin-bottom: 16px;
    }
    
    .next-payment__date {
        font-size: 14px;
        padding: 8px 14px;
    }
    
    .next-payment__days {
        font-size: 140px;
        bottom: -15px;
    }
    
    .next-payment__badge {
        font-size: 11px;
        padding: 6px 12px;
        top: 20px;
        right: 20px;
    }
    
    .stats-container {
        margin-bottom: 24px;
    }
    
    .stats-row {
        gap: 12px;
    }
    
    .stat-box {
        padding: 20px 16px;
    }
    
    .stat-box__value {
        font-size: 22px;
    }
    
    .payments {
        gap: 14px;
    }
    
    .payment-card {
        padding: 20px;
        gap: 16px;
    }
    
    .payment-card__header {
        gap: 12px;
        margin-bottom: 8px;
    }
    
    .payment-card__title {
        font-size: 17px;
    }
    
    .payment-card__desc {
        font-size: 13px;
        margin-bottom: 10px;
    }
    
    .payment-card__date {
        font-size: 13px;
    }
    
    .payment-card__amount {
        font-size: 19px;
    }
    
    .payment-card__actions {
        gap: 8px;
    }
    
    .btn-icon {
        width: 40px;
        height: 40px;
        border-radius: 12px;
    }
    
    .btn-icon svg {
        width: 20px;
        height: 20px;
    }
    
    .fab {
        width: 64px;
        height: 64px;
        border-radius: 24px;
        bottom: 32px;
        right: 24px;
    }
    
    .fab svg {
        width: 24px;
        height: 24px;
    }
    
    /* Modal становится центрированным на таблетках */
    .modal {
        align-items: center;
    }
    
    .modal__sheet {
        border-radius: 28px;
        margin: 20px;
        padding: 24px;
        padding-bottom: 24px;
        animation: zoomIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    }
    
    .modal__title {
        font-size: 24px;
    }
    
    .form-group {
        margin-bottom: 20px;
    }
    
    .form-group label {
        font-size: 14px;
        margin-bottom: 10px;
    }
    
    .form-group input,
    .form-group textarea {
        padding: 16px 18px;
        border-radius: 16px;
    }
    
    .btn-primary {
        padding: 18px;
        border-radius: 18px;
        font-size: 17px;
        margin-top: 12px;
    }
    
    .loader {
        padding: 80px 20px;
    }
    
    .loader__spinner {
        width: 48px;
        height: 48px;
        border-width: 4px;
    }
    
    .access-denied__icon {
        width: 120px;
        height: 120px;
        margin-bottom: 32px;
    }
    
    .access-denied__icon svg {
        width: 60px;
        height: 60px;
    }
    
    .access-denied__title {
        font-size: 28px;
        margin-bottom: 16px;
    }
    
    .access-denied__text {
        font-size: 15px;
    }
}

/* Desktop (1024px+) */
@media (min-width: 1024px) {
    :root {
        --container-width: 600px;
    }
    
    body {
        padding-top: 48px;
    }
    
    /* Центрируем FAB ближе к контенту на широких экранах */
    .fab {
        right: calc(50% - 340px);
    }
    
    .payment-card {
        padding: 22px 24px;
    }
}

/* Large Desktop (1440px+) */
@media (min-width: 1440px) {
    :root {
        --container-width: 640px;
    }
    
    .fab {
        right: calc(50% - 380px);
    }
}

/* ===== SAFE AREA для устройств с вырезом ===== */
@supports (padding: max(0px)) {
    body {
        padding-left: max(var(--container-padding), env(safe-area-inset-left));
        padding-right: max(var(--container-padding), env(safe-area-inset-right));
        padding-bottom: max(100px, calc(80px + env(safe-area-inset-bottom)));
    }
    
    .fab {
        bottom: max(24px, calc(16px + env(safe-area-inset-bottom)));
        right: max(16px, env(safe-area-inset-right));
    }
}

/* ===== LANDSCAPE ORIENTATION ===== */
@media (max-height: 500px) and (orientation: landscape) {
    body {
        padding-top: 12px;
        padding-bottom: 80px;
    }
    
    .next-payment {
        padding: 16px;
        margin-bottom: 16px;
    }
    
    .next-payment__amount {
        font-size: 28px;
        margin-bottom: 8px;
    }
    
    .next-payment__days {
        font-size: 60px;
    }
    
    .stats-container {
        margin-bottom: 16px;
    }
    
    .stat-box {
        padding: 12px;
    }
    
    .payments {
        gap: 10px;
    }
    
    .payment-card {
        padding: 14px;
    }
    
    .modal__sheet {
        max-height: 95vh;
        padding: 16px;
    }
    
    .form-group {
        margin-bottom: 12px;
    }
    
    .form-group input,
    .form-group textarea {
        padding: 12px 14px;
    }
    
    .btn-primary {
        padding: 14px;
    }
}

/* ===== DARK MODE CONTRAST (для системных настроек) ===== */
@media (prefers-contrast: high) {
    :root {
        --bg: #000000;
        --bg-card: #111111;
        --text: #ffffff;
        --text-secondary: #bbbbbb;
    }
    
    .payment-card {
        border-width: 2px;
    }
    
    .form-group input,
    .form-group textarea {
        border-width: 2px;
    }
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .next-payment:active,
    .payment-card:active,
    .fab:active,
    .btn-primary:active,
    .btn-icon--danger:active {
        transform: none;
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    body {
        background: white;
        color: black;
        padding: 20px;
    }
    
    .fab,
    .modal,
    .access-denied {
        display: none !important;
    }
    
    .next-payment,
    .stat-box,
    .payment-card {
        background: white;
        border: 1px solid #ddd;
        box-shadow: none;
        color: black;
    }
    
    .payment-card__amount {
        color: black;
    }
}
