:root {
    --bg-primary: #04133a;
    --bg-secondary: #07205b;
    --bg-card: #13264f;
    --accent-blue: #58b8ff;
    --accent-gradient: linear-gradient(135deg, #58b8ff, #1b67d8);
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --border-radius: 12px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --error-color: #ef4444;
    --success-color: #10b981;
}

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

body {
	overscroll-behavior-y: contain;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
}

html {
	overscroll-behavior-y: contain;
}

section {
	padding-bottom: 60px;
}

.app {
    max-width: 400px;
    margin: 0 auto;
    min-height: 100vh;
    background: var(--bg-primary);
    position: relative;
    padding-bottom: 80px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Header */
/* === КРАСИВЫЕ ШРИФТЫ ДЛЯ ШАПКИ === */

/* Подключаем Inter через @font-face */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url(https://fonts.gstatic.com/s/inter/v13/UcCO3FwrK3iLTeHuS_fvQtMwCp50KnMw2boKoduKmMEVuLyfAZ9hiA.woff2) format('woff2');
}

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url(https://fonts.gstatic.com/s/inter/v13/UcCO3FwrK3iLTeHuS_fvQtMwCp50KnMw2boKoduKmMEVuGKYAZ9hiA.woff2) format('woff2');
}

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url(https://fonts.gstatic.com/s/inter/v13/UcCO3FwrK3iLTeHuS_fvQtMwCp50KnMw2boKoduKmMEVuFuYAZ9hiA.woff2) format('woff2');
}

.header {
    background: linear-gradient(135deg, #0a2a76 0%, #04133a 100%);
    padding: 14px 16px;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0 0 10px 10px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}



.brand-logo {
    display: block;
    width: min(240px, 72vw);
    margin: 0 auto 8px;
    height: auto;
    filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.35));
}

.header #headerSubtitle {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 6px;
    color: white;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    letter-spacing: -0.5px;
}

/* Анимация пульсации для градиента */
@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.header {
    background: linear-gradient(-45deg, #0a2a76, #0e3a97, #58b8ff, #04133a);
    background-size: 400% 400%;
    animation: gradientShift 8s ease infinite;
}
/* Main Content */
.main {
    padding: 16px;
}

.sync-status-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.sync-status-badge.synced {
    background: #10b981;
    color: white;
}

.sync-status-badge.pending {
    background: #f59e0b;
    color: white;
}

.sync-status-badge.offline {
    background: #6b7280;
    color: white;
}

.sync-status-badge.syncing {
    background: #3b82f6;
    color: white;
    animation: pulse 1.5s infinite;
}

.sync-status-badge.error {
    background: #ef4444;
    color: white;
}

.info-value.has-pending {
    color: #f59e0b;
    font-weight: 600;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.screen {
    display: none;
    overflow-y: auto;
}

.screen.active {
    display: block;
}

/* Form Styles */
.operation-form {
    background: var(--bg-card);
    padding: 20px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.form-select, .form-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #475569;
    border-radius: var(--border-radius);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 1rem;
    margin-bottom: 16px;
    transition: all 0.2s ease;
}

.form-select:focus, .form-input:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-select:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.quantity-input {
    position: relative;
    margin-bottom: 16px;
}

.quantity-input label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.sum-display {
    background: var(--bg-secondary);
    padding: 16px;
    border-radius: var(--border-radius);
    text-align: center;
    margin-bottom: 20px;
    border: 2px solid #475569;
}

.sum-display .amount {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--accent-blue);
    margin-bottom: 4px;
}

.sum-display .calculation {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.btn-primary {
    width: 100%;
    padding: 14px 20px;
    background: var(--accent-gradient);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 12px -1px rgba(0, 0, 0, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.date-input {
    margin-bottom: 16px;
}

.date-input label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--text-primary);
}

.date-input .form-input {
    width: 100%;
    padding: 12px;
    border: 1px solid #475569;
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 16px;
}

/* Кастомизация для мобильных */
@media (max-width: 768px) {
    .date-input .form-input {
        font-size: 16px;
    }
}

/* Last Operation */
.last-operation {
    margin-top: 20px;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid #334155;
}

.last-operation h3 {
    margin: 0 0 12px 0;
    font-size: 16px;
    color: var(--text-primary);
}

.operation-card {
    background: var(--bg-primary);
    border: 1px solid #475569;
    border-radius: 8px;
    padding: 12px;
}

.operation-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.operation-name {
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
    margin-right: 8px;
}

.operation-status {
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 8px;
    white-space: nowrap;
}

.operation-status.synced {
    background: #10b981;
    color: white;
}

.operation-status.pending {
    background: #f59e0b;
    color: white;
}

.operation-details {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 14px;
}

.operation-quantity, .operation-price {
    color: var(--text-secondary);
}

.operation-total {
    font-weight: 600;
    color: var(--text-primary);
}

.operation-footer {
    border-top: 1px solid #374151;
    padding-top: 8px;
}

.operation-date {
    font-size: 12px;
    color: var(--text-tertiary);
}

.no-operations {
    text-align: center;
    color: var(--text-tertiary);
    font-style: italic;
    padding: 20px;
}

/* Today Operations */
.today-operations {
    background: var(--bg-card);
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.today-operations h3 {
    font-size: 1.125rem;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.operations-list {
    space-y: 12px;
}

/* === СТРАНИЦА СТАТИСТИКИ === */

/* Навигация периодов */
.period-navigation {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 20px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: 12px;
}

.nav-btn, .calendar-btn {
    background: var(--bg-primary);
    border: 1px solid #475569;
    border-radius: 8px;
    padding: 8px 12px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 16px;
}

.nav-btn:hover, .calendar-btn:hover {
    background: #374151;
}

.current-period {
    font-weight: 600;
    color: var(--text-primary);
    min-width: 120px;
    text-align: center;
}

/* Быстрые периоды */
.quick-periods {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.period-btn {
    flex: 1;
    background: var(--bg-secondary);
    border: 1px solid #475569;
    border-radius: 8px;
    padding: 10px 16px;
    color: var(--text-secondary);
    cursor: pointer;
    text-align: center;
    min-width: 80px;
}

.period-btn.active {
    background: var(--accent-gradient);
    color: white;
    border-color: #3b82f6;
}

/* Сводка статистики */
.stats-summary {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
}

.stats-numbers {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.stats-label {
    font-size: 14px;
    color: var(--text-tertiary);
}

/* Секции по дням */
.day-section {
    margin-bottom: 24px;
    background: var(--bg-secondary);
    border-radius: 12px;
    overflow: hidden;
}

.day-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #1e293b;
    border-bottom: 1px solid #374151;
}

.day-date {
    font-weight: 600;
    color: var(--text-primary);
}

.day-total {
    font-weight: 600;
    color: #10b981;
}

.day-operations {
    padding: 8px;
}

/* Карточки операций в статистике */
.stats-operation-card {
    background: var(--bg-primary);
    border: 1px solid #475569;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.stats-operation-card:hover {
    border-color: #3b82f6;
    transform: translateY(-1px);
}

.stats-operation-card .operation-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.stats-operation-card .operation-name {
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
    margin-right: 8px;
}

.stats-operation-card .operation-time {
    font-size: 12px;
    color: var(--text-tertiary);
    white-space: nowrap;
}

.stats-operation-card .operation-details {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 14px;
}

.stats-operation-card .operation-quantity,
.stats-operation-card .operation-price {
    color: var(--text-secondary);
}

.stats-operation-card .operation-total {
    font-weight: 600;
    color: var(--text-primary);
}

/* Итоги периода */
.period-total {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 16px;
    margin-top: 20px;
}

.total-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.total-item:last-child {
    margin-bottom: 0;
}

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

.total-value {
    font-weight: 600;
    color: var(--text-primary);
}

/* Стили для экрана итогов */
.month-navigation {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    background: var(--bg-card);
    padding: 16px;
    border-radius: var(--border-radius);
}

.nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.nav-btn:hover:not(:disabled) {
    background: var(--accent-blue);
}

.current-month {
    font-weight: 600;
    font-size: 1.1rem;
    text-align: center;
}

.total-amount {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent-blue);
    margin-bottom: 8px;
}

.stats-details {
    display: flex;
    justify-content: space-around;
    margin-top: 16px;
}

.stat-item {
    text-align: center;
}

.stat-value {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.groups-list {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.product-group {
    border-bottom: 1px solid #475569;
}

.product-group:last-child {
    border-bottom: none;
}

.product-header {
    background: var(--bg-secondary);
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
}

.product-name {
    font-size: 1.1rem;
}

.product-total {
    color: var(--accent-blue);
    font-weight: 600;
}

.blank-group {
    padding: 12px 16px;
    border-bottom: 1px solid #475569;
}

.blank-group:last-child {
    border-bottom: none;
}

.blank-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #475569;
}

.blank-name {
    font-weight: 600;
    font-size: 1rem;
}

.blank-total {
    color: var(--accent-blue);
    font-weight: 600;
}

.operation-name {
    flex: 1;
    color: var(--text-primary);
}

.operation-details {
    color: var(--text-secondary);
    text-align: right;
}

.operation-quantity {
    margin-right: 8px;
}

.operation-amount {
    font-weight: 600;
    color: var(--accent-blue);
    min-width: 80px;
    text-align: right;
}

/* Стили для экрана профиля */
.profile-section {
    background: var(--bg-card);
    padding: 20px;
    border-radius: var(--border-radius);
    margin-bottom: 16px;
}

.section-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.info-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
}

.info-label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.info-value {
    font-weight: 600;
    color: var(--text-primary);
    text-align: right;
}

.btn {
    width: 100%;
    padding: 14px 20px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 8px;
}

.btn:last-child {
    margin-bottom: 0;
}

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

.btn-danger {
    background: #dc2626;
    color: white;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.btn:active {
    transform: translateY(0);
}

/* Стили для экрана логина */
.login-container {
    width: 100%;
    max-width: 400px;
}

.login-form {
    background: var(--bg-card);
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-weight: 500;
}

.form-input.error {
    border-color: var(--error-color);
}

.error-message {
    color: var(--error-color);
    font-size: 0.875rem;
    margin-top: 6px;
    display: none;
}

.error-message.show {
    display: block;
}

.btn-primary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.btn-loading .btn-text {
    opacity: 0;
}

.btn-loading::after {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 2px solid transparent;
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.server-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    font-size: 0.9rem;
}

.status-online {
    color: var(--success-color);
}

.status-offline {
    color: var(--error-color);
}

.login-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--error-color);
    color: var(--error-color);
    padding: 12px 16px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    text-align: center;
    display: none;
}

.login-error.show {
    display: block;
}

.demo-credentials {
    margin-top: 25px;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    border-left: 4px solid var(--accent-blue);
}

.demo-title {
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.demo-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border-top: 1px solid #374151;
    display: flex;
    padding: 8px;
    max-width: 400px;
    margin: 0 auto;
}

.nav-btn, .nav-tab {
    flex: 1;
    padding: 12px 8px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.75rem;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.nav-btn.active, .nav-tab.active {
    color: var(--accent-blue);
    background: rgba(59, 130, 246, 0.1);
}

.nav-btn span {
    font-size: 0.75rem;
}

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(90deg, #374151 25%, #4b5563 50%, #374151 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 4px;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Toast */
.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: var(--accent-gradient);
    color: white;
    padding: 12px 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    z-index: 1000;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

/* Модальные окна */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    padding: 20px;
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 350px;
}

.modal-buttons {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.btn, .modal-btn {
    padding: 12px 20px;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
    flex: 1;
}

.modal-btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.modal-btn-danger {
    background: #dc2626;
    color: white;
}

.edit-input {
    width: 100%;
    padding: 12px;
    border: 2px solid #475569;
    border-radius: var(--border-radius);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 1rem;
    margin-bottom: 16px;
}

/* Состояния */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 16px;
}

/* Базовые стили ядра */
.screen {
    display: none;
}
.screen.active {
    display: block;
}
.hidden {
    display: none !important;
}
#app {
    padding: 20px;
}

/* === МОДАЛКА РЕДАКТИРОВАНИЯ === */
.edit_modal_overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
}

.edit_modal_container {
    background: var(--bg-primary);
    border-radius: 16px;
    padding: 24px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
    border: 1px solid #475569;
}

.edit_modal_header {
    margin-bottom: 20px;
    text-align: center;
}

.edit_modal_title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 8px 0;
}

.edit_modal_operation_path {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.edit_modal_content {
    margin-bottom: 24px;
}

.edit_modal_field {
    margin-bottom: 16px;
}

.edit_modal_field label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--text-primary);
}

.edit_modal_quantity_input,
.edit_modal_date_input {
    width: 100%;
    padding: 12px;
    border: 1px solid #475569;
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 16px;
}

.edit_modal_quantity_input:focus,
.edit_modal_date_input:focus {
    border-color: #3b82f6;
    outline: none;
}

.edit_modal_actions_row {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.edit_modal_save_btn {
    flex: 2;
    background: var(--accent-gradient);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px;
    font-weight: 600;
    cursor: pointer;
}

.edit_modal_delete_btn {
    flex: 1;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px;
    font-weight: 600;
    cursor: pointer;
}

.edit_modal_cancel_row {
    margin-bottom: 16px;
}

.edit_modal_cancel_btn {
    width: 100%;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid #475569;
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
}

.edit_modal_error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
    text-align: center;
}

/* Состояния кнопок */
.edit_modal_save_btn:disabled,
.edit_modal_delete_btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.edit_modal_save_btn:hover:not(:disabled),
.edit_modal_delete_btn:hover:not(:disabled),
.edit_modal_cancel_btn:hover {
    opacity: 0.9;
}

/* Стили для пути операции */
.path-product,
.path-blank {
    color: var(--text-tertiary);
    font-size: 0.9em;
    opacity: 0.7;
}

.path-operation {
    color: var(--text-primary);
    font-weight: 600;
}

.path-separator {
    color: var(--text-tertiary);
    opacity: 0.5;
    margin: 0 4px;
    font-size: 0.8em;
}

/* Для модалки */
.edit_modal_operation_path {
    font-size: 14px;
    line-height: 1.4;
}

/* Для карточек в статистике */
.operation-name {
    line-height: 1.3;
}

#logoutBtn, #headerLogoutBtn {
    transition: opacity 0.3s ease, visibility 0.3s ease;
}


/* Стили для фильтра */
.filter-section {
    margin-top: 12px;
    position: relative;
}

.filter-header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-toggle-btn {
    background: var(--accent-gradient);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.filter-toggle-btn.active {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.filter-clear-btn {
    background: #6b7280;
    color: white;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.filter-clear-btn:hover {
    background: #ef4444;
}

.filter-clear-btn.hidden {
    display: none;
}

.filter-spoiler {
    background: var(--bg-card);
    border: 1px solid #475569;
    border-radius: 8px;
    margin-top: 8px;
    padding: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

.filter-spoiler.hidden {
    display: none;
}

.filter-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.filter-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #475569;
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 14px;
}

.filter-select:focus {
    outline: none;
    border-color: #3b82f6;
}

.filter-apply-btn {
    background: var(--accent-gradient);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-apply-btn:hover {
    opacity: 0.9;
}

/* Добавляем в app.css */
.filter-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.filter-apply-btn {
    flex: 2;
    background: var(--accent-gradient);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-cancel-btn {
    flex: 1;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid #475569;
    border-radius: 6px;
    padding: 10px 16px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-apply-btn:hover,
.filter-cancel-btn:hover {
    opacity: 0.9;
}
/* === v3 refresh === */
:root {
    --bg-primary: #08111f;
    --bg-secondary: rgba(15, 23, 42, 0.82);
    --bg-card: rgba(15, 23, 42, 0.92);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-blue: #60a5fa;
    --accent-gradient: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
    --shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
    --border-radius: 18px;
}

body {
    background:
        radial-gradient(circle at top, rgba(59,130,246,0.24), transparent 30%),
        radial-gradient(circle at bottom right, rgba(124,58,237,0.18), transparent 28%),
        #08111f;
    min-height: 100vh;
}

#app {
    max-width: 460px;
    margin: 0 auto;
    padding: 16px 14px 96px;
}

.header {
    background: rgba(8, 17, 31, 0.8) !important;
    backdrop-filter: blur(18px);
    border-bottom: 1px solid rgba(148, 163, 184, 0.16);
    box-shadow: 0 10px 30px rgba(0,0,0,.2);
    border-radius: 0 0 22px 22px;
    animation: none;
}


.brand-logo {
    display: block;
    width: min(240px, 72vw);
    margin: 0 auto 8px;
    height: auto;
    filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.35));
}

.header #headerSubtitle {
    font-size: 1.15rem;
    letter-spacing: -0.03em;
}

.operation-form,
.last-operation,
.profile-section,
.stats-summary,
.period-total,
.operations-list,
.groups-list,
.month-navigation,
.period-navigation,
.quick-periods {
    background: rgba(15, 23, 42, 0.78);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 22px;
    box-shadow: var(--shadow);
}

.operation-form,
.last-operation,
.profile-section,
.stats-summary,
.period-total,
.groups-list,
.month-navigation,
.period-navigation,
.quick-periods {
    padding: 18px;
    margin-bottom: 16px;
}

.form-select, .form-input {
    border: 1px solid rgba(148, 163, 184, 0.2);
    background: rgba(2, 6, 23, 0.55);
    border-radius: 16px;
    min-height: 52px;
}

.sum-display {
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(30,41,59,0.95), rgba(15,23,42,0.95));
    border: 1px solid rgba(96, 165, 250, 0.18);
}

.sum-display .amount {
    font-size: 1.9rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: #bfdbfe;
}

.btn-primary,
.btn,
.btn-secondary,
.btn-warning,
.nav-btn,
.calendar-btn,
.period-btn,
.filter-apply-btn,
.filter-toggle-btn {
    border-radius: 16px !important;
    border: 1px solid rgba(148, 163, 184, 0.12);
    box-shadow: 0 10px 24px rgba(0,0,0,.18);
}

.btn-secondary,
.btn-warning,
.nav-btn,
.calendar-btn,
.period-btn,
.filter-toggle-btn {
    background: rgba(30, 41, 59, 0.92);
    color: var(--text-primary);
}

.info-row,
.total-item {
    border-radius: 14px;
    background: rgba(2, 6, 23, 0.28);
    padding: 10px 12px;
    margin-bottom: 8px;
}

.info-label,
.stats-label,
.calculation {
    color: var(--text-secondary);
}

.sync-status-badge {
    border-radius: 999px;
    padding: 6px 12px;
}

.operation-card,
.group-card,
.stats-operation-card {
    background: rgba(2, 6, 23, 0.42) !important;
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 18px !important;
    box-shadow: 0 12px 30px rgba(0,0,0,.16);
}


/* === Nitki v3.2 mobile fixes === */
.info-row {
    align-items: stretch;
    gap: 12px;
}

.info-label,
.info-value,
.sync-status-badge {
    min-width: 0;
}

.info-label {
    flex: 1 1 42%;
    word-break: break-word;
}

.info-value {
    flex: 1 1 58%;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.sync-status-badge {
    margin-left: auto;
    text-align: center;
    white-space: nowrap;
}

.form-select,
.form-input,
.btn,
.nav-btn,
.nav-tab {
    min-width: 0;
}

@media (max-width: 480px) {
    .app {
        max-width: 100%;
        padding-bottom: 92px;
    }

    .main {
        padding: 12px;
    }

    .operation-form,
    .last-operation,
    .profile-section,
    .stats-summary,
    .period-total,
    .groups-list,
    .month-navigation,
    .period-navigation,
    .quick-periods {
        padding: 14px;
        border-radius: 18px;
    }

    .info-row {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        padding: 12px;
    }

    .info-label,
    .info-value {
        text-align: left;
    }

    .sync-status-badge {
        width: fit-content;
        max-width: 100%;
    }

    .section-title {
        font-size: 1rem;
        line-height: 1.3;
    }

    .form-select,
    .form-input {
        min-height: 48px;
        padding: 12px 14px;
        margin-bottom: 12px;
    }

    .bottom-nav {
        max-width: 100%;
        padding: 6px;
        gap: 6px;
    }

    .nav-btn,
    .nav-tab {
        padding: 10px 4px;
        font-size: 0.7rem;
        gap: 2px;
    }

    .nav-btn span {
        font-size: 0.7rem;
        line-height: 1.1;
    }
}


/* --- v3.3.3 real profile fix --- */
#profileScreen .profile-section {
    overflow: hidden;
}

#profileScreen .section-title {
    justify-content: space-between;
    cursor: default;
}

#profileScreen .section-title span:nth-child(2) {
    flex: 1;
    min-width: 0;
}

#profileScreen .is-collapsible .section-title {
    cursor: pointer;
    user-select: none;
}

#profileScreen .section-chevron {
    margin-left: auto;
    transition: transform .2s ease;
    font-size: 1rem;
    line-height: 1;
}

#profileScreen .collapsed .section-chevron {
    transform: rotate(-90deg);
}

#profileScreen .profile-section-content {
    display: block;
    padding-top: 4px;
}

#profileScreen .collapsed .profile-section-content {
    display: none;
}

#profileScreen .info-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    background: var(--bg-secondary);
    border: 1px solid rgba(255,255,255,.05);
    border-radius: 18px;
    padding: 18px 16px;
}

#profileScreen .info-label,
#profileScreen .info-value,
#profileScreen .sync-status-badge {
    min-width: 0;
}

#profileScreen .info-label {
    justify-self: start;
    align-self: start;
}

#profileScreen .info-value {
    justify-self: end;
    text-align: right;
    overflow-wrap: anywhere;
}

#profileScreen #syncStatusBadge {
    justify-self: end;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

#profileScreen .btn-disabled-offline,
#profileScreen .btn:disabled {
    opacity: .45;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
    pointer-events: none;
}

@media (max-width: 480px) {
    #profileScreen .profile-section {
        padding: 18px 16px;
    }

    #profileScreen .info-row {
        grid-template-columns: 1fr;
        gap: 10px;
        align-items: start;
    }

    #profileScreen .info-label,
    #profileScreen .info-value,
    #profileScreen #syncStatusBadge {
        justify-self: start;
        text-align: left;
    }

    #profileScreen #syncStatusBadge {
        max-width: 100%;
    }
}
