:root {
    /* Глубокий, "дорогой" темный фон, как у банковских приложений */
    --bg-primary: #0d1117; 
    --bg-secondary: #161b22; 
    --bg-card: #1c2128; 
    --bg-card-hover: #22272e;
    
    --border: #30363d; 
    --border-light: #484f58; 
    
    /* Сохраняем желтый, но делаем его чуть более золотым/премиальным */
    --accent: #e3b341; 
    --accent-dark: #cda035;
    
    /* Пастельные тона для статусов */
    --success: #2ea043; 
    --danger: #da3633; 
    --warning: #e3b341; 
    --info: #388bfd;
    
    --text-primary: #c9d1d9; 
    --text-secondary: #8b949e; 
    --text-muted: #6e7681;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Inter', sans-serif; background: var(--bg-primary); color: var(--text-primary); height: 100vh; overflow: hidden; position: fixed; width: 100%; }
::-webkit-scrollbar { width: 4px; } ::-webkit-scrollbar-track { background: var(--bg-secondary); } ::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.app-container { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
.main-content { 
    flex: 1; 
    overflow-y: auto; 
    padding: 16px; 
    padding-bottom: 110px; 
    -webkit-overflow-scrolling: touch; 
}

.screen { display: none; } .screen.active { display: block; }

/* Обновленные карточки */
.card { 
    background: var(--bg-card); 
    border: 1px solid var(--border); 
    border-radius: 16px; 
    padding: 16px; 
    margin-bottom: 16px; 
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transition: all 0.2s ease; 
}
.card:hover { border-color: var(--border-light); background: var(--bg-card-hover); }

.reality-card { background: linear-gradient(135deg, #1c2128 0%, #0d1117 100%); border: 1px solid rgba(227, 179, 65, 0.3); text-align: center; }
.reality-label { font-size: 10px; text-transform: uppercase; letter-spacing: 2px; color: var(--text-secondary); }
.reality-value { font-size: 56px; font-weight: 900; color: var(--accent); margin: 8px 0; font-variant-numeric: tabular-nums; }
.reality-sub { font-size: 11px; color: var(--text-muted); }

.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.stat-card { background: var(--bg-secondary); border-radius: 14px; padding: 10px 6px; text-align: center; border: 1px solid var(--border); }
.stat-value { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 9px; color: var(--text-muted); margin-top: 3px; }

.compare-card { background: var(--bg-secondary); border-left: 3px solid var(--info); }
.compare-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); }
.compare-row:last-child { border-bottom: none; }
.fair-price { color: var(--success); font-weight: 600; } .damage { color: var(--danger); font-weight: bold; }

.warning-card { background: rgba(218, 54, 51, 0.1); border-left: 4px solid var(--danger); display: flex; gap: 12px; align-items: center; }
.warning-card i { font-size: 24px; color: var(--danger); }

.tariffs-grid { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tariff-badge { background: rgba(227, 179, 65, 0.1); border: 1px solid rgba(227, 179, 65, 0.2); border-radius: 30px; padding: 4px 10px; font-size: 10px; font-weight: 500; color: var(--accent); }
.tariff-badge i { margin-right: 3px; }

.expenses-header { display: flex; justify-content: space-between; align-items: center; cursor: pointer; padding: 6px 0; }
.expenses-details {
    display: none; /* Вместо max-height для надежности */
    padding-top: 10px;
    border-top: 1px solid var(--border);
    margin-top: 10px;
}

.expenses-details.active {
    display: block;
    animation: fadeIn 0.3s ease;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Индикатор топливной эффективности */
.efficiency-container {
    margin-top: 10px;
    background: #000;
    height: 4px;
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

#efficiency-bar {
    width: 100%;
    height: 100%;
    background: var(--success);
    transition: width 0.5s ease, background-color 0.5s ease;
}
.expense-item { display: flex; justify-content: space-between; padding: 6px 0; font-size: 12px; border-bottom: 1px dashed var(--border); }
.expense-item:last-child { border-bottom: none; }

.gps-status { display: flex; align-items: center; justify-content: space-between; background: var(--bg-secondary); border-radius: 40px; padding: 6px 14px; margin-bottom: 12px; border: 1px solid var(--border); }
.gps-dot { width: 8px; height: 8px; border-radius: 10px; background: var(--text-muted); transition: all 0.3s; }
.gps-dot.active { background: var(--success); box-shadow: 0 0 8px var(--success); }
.gps-dot.warning { background: var(--warning); box-shadow: 0 0 8px var(--warning); }
.gps-text { font-size: 10px; color: var(--text-secondary); } .gps-accuracy { font-family: monospace; font-size: 9px; color: var(--text-muted); }

.actions-card { background: transparent; padding: 0; margin: 8px 0 30px 0; border: none; box-shadow: none; }

/* Обновленные кнопки */
.btn { 
    width: 100%; 
    padding: 16px; 
    border-radius: 12px; 
    font-weight: 600; 
    font-size: 15px; 
    letter-spacing: 0.5px;
    border: none; 
    cursor: pointer; 
    transition: all 0.2s; 
    margin-bottom: 10px; 
    box-shadow: 0 4px 14px rgba(0,0,0,0.15);
}
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-dark)); color: #000; } 
.btn-primary:active { transform: scale(0.98); background: var(--accent-dark); }
.btn-success { background: linear-gradient(135deg, var(--success), #238636); color: #fff; } 
.btn-danger { background: linear-gradient(135deg, var(--danger), #b32624); color: #fff; }
.btn-outline { background: transparent; border: 1px solid var(--accent); color: var(--accent); box-shadow: none; }

.bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; background: rgba(13, 17, 23, 0.95); backdrop-filter: blur(20px); border-top: 1px solid var(--border); display: flex; padding: 8px 0 18px; z-index: 100; }
.nav-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--text-muted); font-size: 10px; cursor: pointer; padding: 6px 0; }
.nav-item i { font-size: 22px; } .nav-item.active { color: var(--accent); }

.history-item { display: flex; justify-content: space-between; align-items: center; padding: 12px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background 0.2s; }
.history-item:hover { background: var(--bg-card-hover); }

.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0, 0, 0, 0.95); backdrop-filter: blur(8px); z-index: 1000; display: none; align-items: center; justify-content: center; padding: 20px; }
.modal-overlay.active { display: flex; }
.modal-content { background: var(--bg-card); border-radius: 24px; max-width: 420px; width: 100%; max-height: 85vh; overflow-y: auto; padding: 20px; border: 1px solid var(--border); }

.input-group { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.input-group label { font-size: 12px; color: var(--text-secondary); flex: 1; }
.input-group input { width: 85px; padding: 8px; border-radius: 10px; background: var(--bg-secondary); border: 1px solid var(--border); color: var(--accent); font-size: 13px; text-align: right; font-weight: 500; }
.input-group.full-width { flex-direction: column; align-items: stretch; gap: 5px; } .input-group.full-width input { width: 100%; text-align: left; color: #fff; }

#toast { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); background: var(--bg-card); border: 1px solid var(--border); border-left: 3px solid var(--accent); padding: 8px 16px; border-radius: 40px; font-size: 12px; z-index: 9999; display: none; backdrop-filter: blur(10px); white-space: nowrap; box-shadow: 0 4px 20px rgba(0,0,0,0.5); }
#qrcode canvas { max-width: 100%; height: auto; }
#installBtn { display: none; background: var(--accent); color: #000; border: none; padding: 12px 20px; border-radius: 30px; font-weight: bold; margin: 10px 0; cursor: pointer; width: 100%; font-size: 14px; }

/* AUTH SCREEN STYLES */
.auth-container { position: fixed; top: 0; left: 0; width: 100%; height: 100vh; background: var(--bg-primary); z-index: 9999; display: none; align-items: center; justify-content: center; padding: 20px; }
.auth-container.active { display: flex; }
.auth-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 24px; padding: 30px 20px; width: 100%; max-width: 400px; text-align: center; box-shadow: 0 10px 30px rgba(0,0,0,0.5); }
.auth-card h2 { color: var(--accent); margin-bottom: 5px; }
.auth-card p { color: var(--text-muted); font-size: 12px; }

/* ИНФО-БАННЕР */
.info-banner { background: rgba(56, 139, 253, 0.1); border: 1px solid rgba(56, 139, 253, 0.3); border-radius: 12px; padding: 12px; margin-bottom: 15px; display: flex; gap: 10px; align-items: flex-start; }
.info-banner i { color: var(--info); font-size: 20px; }
.info-banner p { font-size: 11px; color: var(--text-secondary); line-height: 1.4; margin: 0; }

/* Анимация Детектора (Пульсация радара) */
.detector-pulse {
    animation: radar-pulse 2s infinite ease-in-out;
    color: var(--accent);
    text-shadow: 0 0 10px rgba(227, 179, 65, 0.4);
}

@keyframes radar-pulse {
    0% { transform: scale(1); opacity: 1; text-shadow: 0 0 5px rgba(227, 179, 65, 0.4); }
    50% { transform: scale(1.05); opacity: 0.9; text-shadow: 0 0 20px rgba(227, 179, 65, 0.8); }
    100% { transform: scale(1); opacity: 1; text-shadow: 0 0 5px rgba(227, 179, 65, 0.4); }
}

.history-date-header {
    background: var(--bg-secondary);
    padding: 8px 12px;
    border-radius: 8px;
    margin-top: 20px;
    position: sticky;
    top: 0;
    z-index: 10;
}

--- START OF FILE main.css ---
:root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #141414;
    --bg-card: #1c1c1c;
    --border: #262626;
    --accent: #e3b341;
    --success: #2ea043;
    --danger: #da3633;
    --text-primary: #ffffff;
    --text-secondary: #a1a1a1;
    --text-muted: #525252;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-font-smoothing: antialiased; }
body { 
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg-primary); 
    color: var(--text-primary);
    font-size: 14px;
}

.main-content { padding: 12px; padding-bottom: 100px; }

/* Липкие заголовки (Аккордеоны) */
.history-date-header {
    position: sticky;
    top: -1px;
    background: var(--bg-primary);
    padding: 20px 4px 10px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    z-index: 10;
    border-bottom: 1px solid var(--border);
}

/* Унифицированные карточки */
.history-item {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 14px 8px;
    display: grid;
    grid-template-columns: 50px 1fr 80px; /* Фиксированная сетка */
    align-items: center;
    cursor: pointer;
    height: 64px; /* Строго одинаковая высота */
}
.history-item:active { background: #1a1a1a; }

.h-time { font-size: 13px; color: var(--text-secondary); font-weight: 400; }
.h-info { overflow: hidden; padding: 0 8px; }
.h-addr { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #eee; }
.h-meta { font-size: 10px; color: var(--text-muted); margin-top: 2px; }
.h-price-block { text-align: right; }
.h-price { font-size: 14px; font-weight: 600; color: var(--accent); }
.h-net { font-size: 10px; color: var(--success); }

/* Модальное окно (Аудит) */
.modal-overlay { 
    position: fixed; inset: 0; background: rgba(0,0,0,0.9); 
    display: none; z-index: 1000; align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay.active { display: flex; }
.modal-content { 
    background: var(--bg-secondary); width: 100%; max-width: 400px; 
    border-radius: 20px; padding: 24px; border: 1px solid var(--border);
    max-height: 85vh; overflow-y: auto;
}

/* Юридические кнопки */
.legal-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 20px; }
.btn-doc { 
    background: transparent; border: 1px solid var(--border); color: var(--accent); 
    padding: 12px; border-radius: 12px; font-size: 12px; font-weight: 500; text-align: left;
    display: flex; justify-content: space-between; align-items: center;
}
.btn-doc:active { background: var(--border); }

/* Подпись */
.sig-container { 
    background: #fff; border-radius: 12px; margin-top: 10px; 
    height: 100px; display: flex; align-items: center; justify-content: center; padding: 10px;
}
.sig-container img { max-width: 100%; max-height: 100%; object-fit: contain; }

/* Поиск */
.search-bar { 
    margin-bottom: 10px; background: var(--bg-secondary); border-radius: 12px; 
    padding: 12px 16px; border: 1px solid var(--border); color: #fff; width: 100%; outline: none;
}

.legal-actions {
    display: flex;
    flex-direction: column;
    gap: 1px; /* Эффект разделительной линии между кнопками */
    background: var(--border);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.btn-doc {
    background: var(--bg-secondary);
    border: none;
    color: var(--accent);
    padding: 14px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    font-weight: 500;
    width: 100%;
    cursor: pointer;
    transition: background 0.2s;
    text-align: left;
}

.btn-doc i:first-child {
    margin-right: 10px;
    font-size: 16px;
    vertical-align: middle;
}

.btn-doc i:last-child {
    color: var(--text-muted);
}

.btn-doc:active {
    background: #252525;
}

.btn-doc span {
    display: flex;
    align-items: center;
}

.search-input {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: #ffffff;
    font-size: 14px;
    outline: none;
    margin-bottom: 16px;
    transition: all 0.2s;
    -webkit-appearance: none;
    box-sizing: border-box;
}

.search-input:focus {
    border-color: var(--accent);
    background: #1a1a1a;
}

.search-input::placeholder {
    color: var(--text-muted);
}

/* Стили для юридического блока в модалке */
.legal-actions {
    display: flex;
    flex-direction: column;
    gap: 1px;
    background: var(--border);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.btn-doc {
    background: var(--bg-secondary);
    border: none;
    color: var(--accent);
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    font-weight: 500;
    width: 100%;
    cursor: pointer;
    text-align: left;
}

.btn-doc:active {
    background: #252525;
}

.btn-doc i:last-child {
    color: var(--text-muted);
    font-size: 18px;
}

--- START OF FILE main.css ---
/* ... (оставляем базовые переменные) ... */

/* Стилизация селектора (Банковский стиль) */
#stat-period, select {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--accent);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 13px;
    outline: none;
    cursor: pointer;
    appearance: none; /* Убираем стандартную стрелку */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23e3b341'%3E%3Cpath d='M12 16L6 10H18L12 16Z'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 16px;
    padding-right: 30px;
}

/* Оптимизация таксометра: Цены в ряд */
.price-dashboard {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 15px;
}

.price-box {
    background: rgba(0,0,0,0.2);
    padding: 12px;
    border-radius: 12px;
    text-align: center;
    border: 1px solid var(--border);
}

.price-box .label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.price-box .value {
    font-size: 24px;
    font-weight: 800;
}

/* Фикс аккордеона Расходов */
.expenses-details {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, opacity 0.2s;
    opacity: 0;
}

.expenses-details.active {
    max-height: 500px;
    opacity: 1;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

/* Улучшение баннеров ущерба (мгновенное появление) */
#damage-banner, #pickup-loss-banner {
    display: none; /* По умолчанию скрыты */
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { transform: translateY(-10px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Эффект свечения для Детектора, когда он выше Яндекса */
.detector-warning {
    border-color: var(--danger) !important;
    box-shadow: 0 0 15px rgba(218, 54, 51, 0.2);
}

.floating-status {
    position: fixed;
    top: 10px;
    left: 10px;
    right: 10px;
    background: var(--bg-card);
    border: 1px solid var(--accent);
    border-radius: 40px;
    padding: 8px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 2000;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    transform: translateY(-100px);
    transition: transform 0.3s ease;
}

.floating-status.active {
    transform: translateY(0);
}