:root {
    /* === ПАЛИТРА "DARK PREMIUM" (Стандартная) === */
    --bg-main: #121212;       /* Чуть светлее черного */
    --bg-card: #1e1e1e;       /* Темно-серый для карточек */
    --bg-element: #2c2c2e;    /* Элементы */
    --border-color: #38383a;  /* Границы */

    --text-white: #e0e0e0;    /* Не чисто белый, а мягкий серый */
    --text-gray: #a0a0a0;     

    /* Акцент (Фиолетовый) */
    --c-primary: #bb86fc;     /* Светло-фиолетовый (Material Design) */
    --c-primary-dim: rgba(187, 134, 252, 0.15);

    /* Вспомогательные */
    --c-success: #03dac6;     /* Бирюзовый */
    --c-warning: #cf6679;     /* Приглушенный красный (ошибка) */
    --c-danger: #cf6679;      
    
    --border-width: 1px;      
}

/* === РЕЖИМ ДЛЯ ДАЛЬТОНИКОВ (ВЫСОКИЙ КОНТРАСТ) === */
body.accessibility-mode {
    /* Фон - глухой черный для максимального контраста */
    --bg-main: #000000 !important;
    --bg-card: #000000 !important;       
    --bg-element: #000000 !important;    
    
    /* Рамки - ярко-белые и толстые, чтобы видеть границы */
    --border-color: #ffffff !important;
    --border-width: 2px !important;

    --text-white: #ffffff !important;
    --text-gray: #ffffff !important;     /* Убираем серый текст, делаем все белым */

    /* Акцент - Яркий Голубой (Cyan) - лучше всего виден большинству */
    --c-primary: #00FFFF !important;     
    --c-primary-dim: rgba(0, 255, 255, 0.2) !important;

    /* Вспомогательные - чистые спектральные цвета */
    --c-success: #00FF00 !important;     /* Кислотный зеленый */
    --c-warning: #FFFF00 !important;     /* Чистый желтый */
    --c-danger: #FF0000 !important;      /* Чистый красный */
}

/* Применяем стили к элементам в режиме доступности */
body.accessibility-mode * {
    border-color: var(--border-color);
}

body.accessibility-mode .admin-card, 
body.accessibility-mode .order-card, 
body.accessibility-mode .demand-slot, 
body.accessibility-mode .dark-input, 
body.accessibility-mode .action-card, 
body.accessibility-mode .finance-card, 
body.accessibility-mode .agent-card,
body.accessibility-mode .nav-drawer {
    border: 2px solid #ffffff !important;
    background-color: #000000 !important;
}

/* В режиме доступности делаем шрифт чуть жирнее */
body.accessibility-mode {
    font-weight: 600;
}

body {
    background-color: var(--bg-main);
    color: var(--text-white);
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    padding-bottom: 40px;
}

.dashboard { padding: 12px; }

/* КНОПКИ */
.action-btn {
    border: none; padding: 10px 16px; border-radius: 12px; 
    font-size: 14px; font-weight: 600; color: #121212; cursor: pointer;
    transition: all 0.2s;
    display: flex; align-items: center; justify-content: center; gap: 6px;
}
.action-btn:active { opacity: 0.7; transform: scale(0.98); }

/* Основная кнопка */
.btn-primary { 
    background-color: var(--c-primary); 
    color: #000;
    box-shadow: 0 4px 12px rgba(187, 134, 252, 0.3);
}
/* В режиме доступности убираем тень и делаем текст черным */
body.accessibility-mode .btn-primary {
    background-color: #00FFFF !important;
    color: #000000 !important;
    font-weight: 800;
    box-shadow: none;
    border: 2px solid #fff !important;
}

/* Второстепенная (Серая) */
.btn-secondary { 
    background-color: var(--bg-element); 
    color: var(--text-white);
    border: 1px solid var(--border-color);
}

/* Контурная (для отмены) */
.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-gray);
}

/* Кнопка входа */
.main-btn-yellow {
    width: 100%;
    background-color: var(--c-primary);
    color: #000;
    border: none;
    padding: 16px;
    border-radius: 16px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.1s;
    box-shadow: 0 4px 12px rgba(187, 134, 252, 0.3);
}
body.accessibility-mode .main-btn-yellow {
    background-color: #00FFFF !important;
    color: #000000 !important;
    border: 2px solid #fff !important;
    box-shadow: none;
}
.main-btn-yellow:active { transform: scale(0.98); }

/* ИНПУТЫ */
.dark-input {
    width: 100%; background: var(--bg-element); 
    border: var(--border-width) solid var(--border-color); 
    border-radius: 12px; padding: 14px; 
    color: #fff; font-size: 16px;
    box-sizing: border-box; transition: border-color 0.2s;
}
.dark-input:focus { border-color: var(--c-primary); outline: none; }

/* ЗАГОЛОВКИ */
.date-header {
    font-size: 17px; font-weight: 700; margin: 24px 0 12px 4px; 
    color: var(--text-gray); text-transform: uppercase; letter-spacing: 0.5px;
    display: flex; align-items: center; gap: 8px;
}

/* СКРОЛЛБАР */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #333; border-radius: 2px; }

/* АНИМАЦИИ */
@keyframes slideUp {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.slide-in-bottom { animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1); }

/* МОДАЛКИ */
.modal-backdrop {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.8); backdrop-filter: blur(10px); z-index: 200;
}
.modal-sheet {
    position: fixed; bottom: 0; left: 0; width: 100%; height: auto;
    background: var(--bg-card);
    border-radius: 24px 24px 0 0; z-index: 201;
    box-sizing: border-box; border-top: 1px solid var(--border-color);
    box-shadow: 0 -10px 40px rgba(0,0,0,0.5);
    
    /* FIX SCROLLING */
    max-height: 92vh; /* Не выше 92% экрана */
    display: flex;
    flex-direction: column;
}

.sheet-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 10px; margin-top: 14px; padding: 0 16px;
    flex-shrink: 0; /* Заголовок не сжимается */
}

/* Контейнер для скролла внутри модалки */
.sheet-scroll-content {
    overflow-y: auto;
    padding: 0 16px 30px 16px;
    flex: 1; /* Занимает все доступное место */
    -webkit-overflow-scrolling: touch; /* Плавный скролл на iOS */
}

.sheet-title { font-size: 17px; font-weight: 600; color: #fff; }
.btn-cancel { background: none; border: none; color: var(--text-gray); font-size: 16px; cursor: pointer; }
.btn-save { background: none; border: none; color: var(--c-primary); font-size: 16px; font-weight: 600; cursor: pointer; }
.btn-save.active { color: var(--c-primary); }

/* АДАПТИВ ДЛЯ МОДАЛОК НА ПК */
@media (min-width: 768px) {
    .modal-sheet {
        top: 50%; left: 50%; transform: translate(-50%, -50%) !important;
        bottom: auto; width: 500px; max-width: 90%; height: auto; max-height: 85vh;
        border-radius: 20px; border: 1px solid var(--border-color);
    }
}

/* === СТИЛИ ДЛЯ ВЕРХНЕЙ ЧАСТИ (DASHBOARD) === */
.main-card {
    background: var(--bg-card);
    border-radius: 24px;
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}

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

.nav-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-white);
}

.profile-btn {
    width: 40px;
    height: 40px;
    background: var(--bg-element);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    border: 1px solid var(--border-color);
}

.search-wrapper {
    margin-bottom: 16px;
}

.search-bar {
    width: 100%;
    background: var(--bg-element);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px 16px;
    color: var(--text-white);
    font-size: 15px;
    box-sizing: border-box;
    transition: border-color 0.2s;
}
.search-bar:focus {
    border-color: var(--c-primary);
    outline: none;
}

.balance-chart-row {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
}

.balance-info {
    text-align: center;
}

.total-sum {
    font-size: 32px;
    font-weight: 800;
    color: var(--text-white);
    letter-spacing: -0.5px;
}

.total-label {
    font-size: 13px;
    color: var(--text-gray);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* КРУГОВАЯ ДИАГРАММА */
.chart-wrapper {
    position: relative;
    width: 140px;
    height: 140px;
}

.circular-chart {
    display: block;
    margin: 0 auto;
    max-width: 100%;
    max-height: 100%;
}

.circle-bg {
    fill: none;
    stroke: var(--bg-element);
    stroke-width: 2.5;
}

.circle {
    fill: none;
    stroke-width: 2.5;
    stroke-linecap: round;
    transition: stroke-dasharray 0.6s ease;
}

.stroke-orange { stroke: var(--c-warning); }
.stroke-green { stroke: var(--c-success); }
.stroke-dark { stroke: #555; }

.donut-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    display: flex;
    flex-direction: column;
}

.donut-text span:first-child {
    font-size: 11px;
    color: var(--text-gray);
    margin-bottom: 2px;
}

.donut-text span:last-child {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-white);
}

/* КАТЕГОРИИ (ЛЕГЕНДА) */
.categories-list {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.cat-pill {
    flex: 1;
    background: var(--bg-element);
    border-radius: 12px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--border-color);
}

.cat-icon-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.bg-green { background: rgba(50, 215, 75, 0.15); color: var(--c-success); }
.bg-orange { background: rgba(255, 159, 10, 0.15); color: var(--c-warning); }
.bg-rework { background: rgba(255, 69, 58, 0.15); color: var(--c-danger); }

.cat-text {
    text-align: center;
}

.cat-name {
    display: block;
    font-size: 10px;
    color: var(--text-gray);
    margin-bottom: 2px;
}

.cat-val {
    display: block;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-white);
}

/* === T-BANK STYLE INPUTS === */

/* Убираем стрелочки у input number */
input[type=number]::-webkit-inner-spin-button, 
input[type=number]::-webkit-outer-spin-button { 
  -webkit-appearance: none; 
  margin: 0; 
}

/* Обертка для большой суммы */
.t-money-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 20px 0 30px;
    position: relative;
}

.t-money-row {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 2px;
}

/* Сам инпут суммы */
.t-money-input {
    background: transparent;
    border: none;
    color: var(--text-white);
    font-size: 48px;
    font-weight: 700;
    text-align: center;
    width: 220px; /* Ширина под 5-6 цифр */
    outline: none;
    padding: 0;
    margin: 0;
    caret-color: var(--c-primary);
    font-family: -apple-system, BlinkMacSystemFont, sans-serif;
}

.t-money-input::placeholder {
    color: #3a3a3c;
}

.t-currency {
    font-size: 48px;
    font-weight: 700;
    color: var(--text-gray);
}

.t-label {
    font-size: 14px;
    color: var(--text-gray);
    margin-top: 4px;
    font-weight: 500;
}

/* Группа для расходов (Детали) */
.expense-input-group {
    background: var(--bg-element);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    border: 1px solid var(--border-color);
    transition: border-color 0.2s;
}

.expense-input-group:focus-within {
    border-color: var(--c-warning); /* Оранжевый фокус */
}

.expense-label {
    font-size: 15px;
    color: var(--text-white);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.expense-input {
    background: transparent;
    border: none;
    color: var(--c-warning); /* Оранжевый текст */
    font-size: 18px;
    font-weight: 600;
    text-align: right;
    width: 120px;
    outline: none;
}

/* Комментарий */
.comment-area {
    width: 100%;
    background: var(--bg-element);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 14px;
    color: var(--text-white);
    font-size: 15px;
    resize: none;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
}
.comment-area:focus {
    border-color: var(--c-primary);
}
.comment-area::placeholder {
    color: #555;
}