:root {
    --bg: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --accent: #38bdf8;
    --text: #f1f5f9;
    --muted: #94a3b8;
    --border: rgba(255, 255, 255, 0.1);
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #facc15;
    --dod: #ffd700; /* Золотой для ДОД */
}

/* --- БАЗА И ОБНУЛЕНИЕ --- */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background-color: var(--bg);
    background-image: 
        radial-gradient(at 0% 0%, rgba(56, 189, 248, 0.12) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(30, 41, 59, 0.4) 0px, transparent 50%);
    color: var(--text);
    font-family: 'Inter', -apple-system, sans-serif;
    line-height: 1.5;
    min-height: 100vh;
    padding: 20px;
}

.container { max-width: 1100px; margin: 0 auto; }

/* Стеклянные карточки */
.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2);
}

/* --- ОПЕРАТИВНАЯ СВОДКА (Summary) --- */
.summary-grid {
    display: grid;
    grid-template-columns: 1fr 2.5fr;
    gap: 30px;
    align-items: start;
}

.duty-column {
    border-right: 1px solid var(--border);
    padding-right: 20px;
}

.summary-section-title {
    font-size: 0.7rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 12px;
    display: block;
}

.presence-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.presence-item {
    background: rgba(255, 255, 255, 0.03);
    padding: 10px 15px;
    border-radius: 10px;
    border: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
    position: relative; /* Для метки 0.5 */
}

.presence-item:hover { background: rgba(255, 255, 255, 0.07); }

/* Метка 0.5 в сводке */
.presence-item[data-contract="0.5"] {
    border-left: 3px solid var(--warning);
}

/* Состояния в сводке */
.presence-item.is-online { border-color: rgba(34, 197, 94, 0.3); }

.presence-item.is-late {
    border-color: var(--danger);
    background: rgba(239, 68, 68, 0.05);
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.1);
}

.presence-item.is-late .presence-time {
    color: var(--danger);
    font-weight: 900;
}

.status-dot { font-size: 0.8rem; margin-right: 8px; }
.presence-name { font-size: 0.85rem; font-weight: 500; display: flex; align-items: center; }
.presence-time { font-size: 0.75rem; color: var(--accent); font-family: 'Courier New', monospace; font-weight: bold; }

/* --- КАЛЕНДАРЬ --- */
.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.calendar-grid { 
    display: grid; 
    grid-template-columns: repeat(7, 1fr); 
    gap: 10px; 
}

.weekdays-bar { margin-bottom: 10px; opacity: 0.7; }
.weekday-label { text-align: center; font-size: 0.75rem; font-weight: bold; color: var(--muted); text-transform: uppercase; }
.weekday-label.weekend { color: var(--danger); }

.calendar-day { 
    min-height: 110px; 
    padding: 12px; 
    position: relative; 
    transition: all 0.2s ease; 
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
    display: flex;
    flex-direction: column;
}

.calendar-day:not(.day-disabled):hover { 
    transform: translateY(-3px); 
    border-color: var(--accent) !important; 
    box-shadow: 0 4px 20px rgba(0,0,0,0.4); 
    cursor: pointer;
}

.day-disabled { opacity: 0.25; pointer-events: none; background: rgba(0,0,0,0.2); }
.empty-cell { background: transparent; border: none; }
.day-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.day-number { font-weight: bold; font-size: 0.9rem; }
.text-danger { color: var(--danger) !important; }

.is-dod { 
    border: 2px solid var(--dod) !important; 
    background: rgba(255, 215, 0, 0.05) !important; 
}
.dod-badge { 
    font-size: 0.6rem; 
    background: var(--dod); 
    color: #000; 
    padding: 2px 5px; 
    border-radius: 4px; 
    font-weight: 800; 
}

/* --- ИНТЕРФЕЙС И КНОПКИ --- */
.user-badge { 
    font-size: 0.75rem; 
    padding: 4px 8px; 
    background: rgba(255, 255, 255, 0.05); 
    border-radius: 6px; 
    margin-top: 4px; 
    border-left: 3px solid var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text);
}
.user-badge.spec { border-left-color: #ff00ff; }
.user-badge.tech { border-left-color: #00ffff; }
.user-badge.admin { border-left-color: var(--accent); }

.btn-ui {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    text-decoration: none;
    font-size: 0.85rem;
    transition: all 0.2s;
    cursor: pointer;
    font-weight: bold;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.btn-ui:hover { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.btn-ui:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-presence {
    background: var(--danger);
    color: #fff;
    border: none;
    padding: 8px 18px;
    font-weight: 800;
    animation: pulse-notify 2s infinite ease-in-out;
}

/* --- МОДАЛЬНОЕ ОКНО --- */
.modal-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content { 
    width: 100%;
    max-width: 400px;
    border: 1px solid var(--accent);
    animation: modal-slide-up 0.3s ease-out;
}

.modal-select { 
    width: 100%; padding: 10px; margin: 8px 0;  
    background: var(--bg); color: white; border: 1px solid var(--border);  
    border-radius: 8px;
    color-scheme: dark;
}

@keyframes modal-slide-up {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- ПЛАНИРОВЩИК (НОВОЕ) --- */
.weekly-row {
    transition: all 0.3s ease;
}

.sch-input {
    text-align: center;
}

/* --- СЧЕТЧИК СЕРИИ --- */
.streak-card { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; margin-bottom: 20px; background: linear-gradient(135deg, rgba(255, 107, 107, 0.1), rgba(255, 230, 0, 0.1)); border: 1px solid rgba(255, 230, 0, 0.2); }
.streak-value { font-size: 3rem; font-weight: 900; line-height: 1; background: linear-gradient(to bottom, #fff, var(--warning)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; margin-bottom: 5px; filter: drop-shadow(0 0 10px rgba(250, 204, 21, 0.5)); }
.streak-label { font-size: 0.7rem; color: var(--muted); text-transform: uppercase; letter-spacing: 2px; }
.streak-fire { font-size: 1.5rem; margin-bottom: 10px; }

/* --- ПРОФИЛЬ И АВАТАРКИ --- */
.work-time-display { font-size: 1.3rem; font-weight: bold; color: var(--accent); margin: 5px 0; }
.profile-info-block { border-top: 1px solid var(--border); padding: 15px 0; text-align: center; }

.avatar-container { position: relative; width: 100px; height: 100px; margin: 0 auto 15px; }
.avatar-img, .avatar-placeholder { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; border: 3px solid var(--accent); box-shadow: 0 0 15px rgba(56, 189, 248, 0.3); }
.avatar-placeholder { background: var(--accent); color: var(--bg); display: flex; align-items: center; justify-content: center; font-size: 2.5rem; font-weight: bold; }
.avatar-edit-label { position: absolute; bottom: 0; right: 0; background: var(--bg); border: 1px solid var(--accent); width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 0.9rem; transition: transform 0.2s; }
.avatar-edit-label:hover { transform: scale(1.1); background: var(--accent); }

/* --- АДАПТИВНОСТЬ --- */
@media (max-width: 768px) {
    .summary-grid { grid-template-columns: 1fr; }
    .duty-column { border-right: none; border-bottom: 1px solid var(--border); padding-bottom: 20px; }
    .calendar-grid { gap: 5px; }
}