:root {
    --bg: var(--tg-theme-bg-color, #fff);
    --text: var(--tg-theme-text-color, #000);
    --hint: var(--tg-theme-hint-color, #999);
    --btn: var(--tg-theme-button-color, #2481cc);
    --btn-text: var(--tg-theme-button-text-color, #fff);
    --secondary: var(--tg-theme-secondary-bg-color, #f0f0f0);
    --danger: #d33;
    --success: #28a745;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: var(--bg); color: var(--text); padding: 16px; font-size: 16px; }

.screen { display: none; animation: fadeIn 0.3s; } 
.screen.active { display: block; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.btn-primary { width: 100%; padding: 14px; background: var(--btn); color: var(--btn-text); border: none; border-radius: 12px; font-size: 16px; font-weight: bold; cursor: pointer; margin-top: 10px; transition: opacity 0.2s; }
.btn-primary:active { opacity: 0.8; }

.btn-menu { width: 100%; padding: 16px; background: var(--secondary); color: var(--text); border: 1px solid transparent; border-radius: 12px; font-size: 16px; margin-bottom: 10px; text-align: center; font-weight: 600; cursor: pointer; }

.btn-menu-large {
    width: 100%;
    padding: 24px;
    background: var(--secondary);
    color: var(--text);
    border: none;
    border-radius: 16px;
    font-size: 20px;
    margin-bottom: 15px;
    text-align: center;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.btn-warning-large { background: #ffc107 !important; color: #000 !important; }
.btn-warning-large .badge-counter { background: #000; color: #ffc107; }

.form-group { margin-bottom: 15px; } 
label { display: block; font-size: 13px; font-weight: 600; color: var(--hint); margin-bottom: 6px; text-transform: uppercase; }
input, select, textarea { width: 100%; padding: 12px; border: 1.5px solid transparent; border-radius: 10px; background: var(--secondary); color: var(--text); font-size: 16px; font-family: inherit; outline: none; }
input:focus, textarea:focus, select:focus { border-color: var(--btn); background: var(--bg); }

.error { color: var(--danger); font-size: 12px; display: none; margin-top: 4px; } 
.error.show { display: block; }

.header-nav { display: flex; align-items: center; margin-bottom: 20px; } 
.btn-back { background: none; border: none; font-size: 16px; color: var(--btn); font-weight: 600; cursor: pointer; margin-right: 12px; }

.app-header { text-align: center; margin-bottom: 24px; } 
.badge { display: inline-block; padding: 4px 12px; background: rgba(36,129,204,0.1); color: var(--btn); border-radius: 12px; font-size: 12px; font-weight: bold; }

.qty-buttons { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 8px; } 
.qty-buttons button { padding: 10px 0; background: var(--secondary); color: var(--text) !important; border: 1px solid var(--hint); border-radius: 8px; font-weight: 600; cursor: pointer; transition: all 0.15s; }
.qty-buttons button:active { background: var(--btn); color: var(--btn-text) !important; border-color: var(--btn); }

.source-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; } 
.source-card { padding: 12px 6px; background: var(--secondary); color: var(--text); border-radius: 10px; text-align: center; font-size: 12px; font-weight: 600; cursor: pointer; border: 2px solid transparent; }
.source-card.active { border-color: var(--btn); background: rgba(36,129,204,0.1); }

.request-card { background: var(--secondary); border-radius: 12px; padding: 14px; margin-bottom: 12px; font-size: 14px; border-left: 4px solid var(--hint); transition: transform 0.1s, opacity 0.1s; }
.request-card:active { transform: scale(0.98); opacity: 0.9; }
.request-card.pending { border-left-color: #ffc107; } 
.request-card.approved { border-left-color: var(--success); }
.request-card.rejected { border-left-color: var(--danger); }
.request-card.in_progress { border-left-color: var(--btn); }

.spinner { width: 30px; height: 30px; border: 3px solid var(--secondary); border-top-color: var(--btn); border-radius: 50%; animation: spin 1s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

.badge-counter { float: right; background: var(--btn); color: var(--btn-text) !important; border-radius: 12px; padding: 2px 8px; font-size: 12px; font-weight: bold; }

.group-header { font-size: 18px; font-weight: bold; margin: 20px 0 10px 0; border-bottom: 2px solid var(--secondary); padding-bottom: 5px; color: var(--text); }

.role-btn { padding: 6px 12px; border: 1px solid transparent; border-radius: 6px; cursor: pointer; font-weight: 600; margin-right: 5px; transition: all 0.2s; }
.role-btn.inactive { background: var(--secondary); color: var(--hint); border-color: var(--hint); }
.role-btn.active-manager { background: #ffc107 !important; color: #000 !important; border-color: #e0a800; }
.role-btn.active-head { background: #28a745 !important; color: #fff !important; border-color: #1e7e34; }

.modal-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.6); z-index: 1000; align-items: center; justify-content: center; }
.modal-overlay.active { display: flex; }
.modal-content { background: var(--bg); padding: 20px; border-radius: 16px; width: 90%; max-width: 400px; box-shadow: 0 10px 30px rgba(0,0,0,0.2); max-height: 85vh; overflow-y: auto; }
.btn-secondary { width: 100%; padding: 14px; background: var(--secondary); color: var(--text); border: none; border-radius: 12px; font-size: 16px; font-weight: bold; cursor: pointer; margin-top: 10px; }

.dept-select-btn { flex: 1; padding: 12px; border: 2px solid #2481cc; border-radius: 10px; background: transparent; color: #2481cc; font-size: 16px; font-weight: bold; cursor: pointer; transition: all 0.2s; }
.dept-select-btn.active { background: #2481cc; color: #ffffff !important; border-color: #2481cc; box-shadow: 0 4px 10px rgba(36, 129, 204, 0.3); }

.fixed-bottom { position: fixed; bottom: 0; left: 0; right: 0; padding: 16px; background: var(--bg); box-shadow: 0 -4px 10px rgba(0,0,0,0.05); z-index: 100; }

#bell-users, #bell-requests { display: flex; align-items: center; font-size: 14px; font-weight: bold; transition: transform 0.2s; }
#bell-users:active, #bell-requests:active { transform: scale(1.1); }
.filter-btn.active { background: var(--btn) !important; color: var(--btn-text) !important; }

/* Таймер */
.timer-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: bold;
    margin-left: 10px;
    background: var(--secondary);
    color: var(--text);
}
.timer-badge.overdue {
    background: var(--danger);
    color: white;
    animation: pulse 1s infinite;
}
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.6; }
    100% { opacity: 1; }
}

/* Цветные индикаторы статуса (вместо эмодзи) */
.status-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
}
.status-dot.pending { background-color: #ffc107; } /* Желтый */
.status-dot.approved { background-color: #28a745; } /* Зеленый */
.status-dot.rejected { background-color: #dc3545; } /* Красный */
.status-dot.in_progress { background-color: #2481cc; } /* Синий */
.status-dot.invoiced { background-color: #fd7e14; } /* Оранжевый */