/* ─── Глобальные стили ─────────────────────────────────────────────────────── */
:root {
    --col-alarm:   #dc3545;  /* красный  — тревога */
    --col-test:    #198754;  /* зелёный  — тест    */
    --col-empty:   #ffc107;  /* жёлтый   — пусто   */
    --col-future:  #f1f1f1;  /* серый    — будущее */
    --col-today-border: #0d6efd;
    --cal-border: #d6dde5;
}

/* ─── Страница входа ───────────────────────────────────────────────────────── */
.login-card {
    width: 100%;
    max-width: 380px;
}

/* ─── Календарная сетка ────────────────────────────────────────────────────── */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

/* Заголовки (Пн … Вс) */
.cal-header {
    text-align: center;
    font-weight: 600;
    font-size: .8rem;
    padding: 4px 0;
    color: #555;
    background: #f8f9fa;
    border-radius: 4px;
    border: 1px solid var(--cal-border);
}

/* Базовая ячейка */
.cal-cell {
    min-height: 64px;
    border-radius: 6px;
    padding: 4px 6px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    cursor: pointer;
    transition: filter .15s;
    position: relative;
    background: var(--col-future);
    border: 1px solid var(--cal-border);
    user-select: none;
    /* override <a> default styles */
    color: inherit;
    text-decoration: none;
}

.cal-cell:hover {
    filter: brightness(.9);
}

/* Пустая (заполнитель до 1-го числа) */
.cal-cell--blank {
    background: transparent;
    pointer-events: none;
}

/* Сегодняшний день */
.cal-cell--today {
    border-width: 2px;
    border-color: var(--col-today-border) !important;
    box-shadow: 0 0 0 2px rgba(13,110,253,.25);
}

/* Цветовые состояния */
.day-alarm  { background: var(--col-alarm);  color: #fff; }
.day-maintenance { background: #0d6efd;      color: #fff; }
.day-test   { background: var(--col-test);   color: #fff; }
.day-empty  { background: var(--col-empty);  color: #333; }
.day-other  { background: #6c757d;          color: #fff; }
.day-future { background: var(--col-future); color: #aaa; }

/* Разделённая ячейка: по одной полосе на каждый объект */
.cal-cell--split {
    background: #fff;
    padding: 4px 4px 3px;
}
.cal-halves {
    display: flex;
    gap: 2px;
    width: 100%;
    flex: 1;
    margin-top: 3px;
}
.cal-half {
    flex: 1;
    border-radius: 3px;
    font-size: .62rem;
    font-weight: 600;
    padding: 2px 2px;
    text-align: center;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    min-height: 20px;
    line-height: 16px;
    position: relative;
}

.cal-half-label {
    position: relative;
    z-index: 2;
}

.cal-half-slices {
    position: absolute;
    inset: 0;
    display: flex;
    z-index: 1;
}

.cal-cell--multi {
    background: #fff;
}

.cal-cell-slices {
    display: flex;
    width: 100%;
    flex: 1;
    margin-top: 4px;
    border-radius: 4px;
    overflow: hidden;
}

.cal-slice {
    flex: 1;
}

/* Номер дня */
.cal-day-number {
    font-size: .85rem;
    font-weight: 700;
    line-height: 1;
}

/* Иконки событий под номером */
.cal-icons {
    font-size: .75rem;
    margin-top: auto;
    line-height: 1.2;
}

/* ─── Легенда ──────────────────────────────────────────────────────────────── */
.legend-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: .78rem;
    font-weight: 500;
    color: #fff;
}

.legend-badge.day-alarm  { background: var(--col-alarm); }
.legend-badge.day-maintenance { background: #0d6efd; }
.legend-badge.day-test   { background: var(--col-test);  }
.legend-badge.day-empty  { background: var(--col-empty); color: #333; }
.legend-badge.day-other  { background: #6c757d; }
.legend-badge.day-future { background: var(--col-future); color: #555; border: 1px solid #ddd; }

/* ─── Адаптивность ─────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
    .cal-cell {
        min-height: 44px;
        padding: 3px 4px;
    }
    .cal-day-number { font-size: .75rem; }
    .cal-icons      { font-size: .65rem; }
    .cal-header     { font-size: .7rem; }
    .cal-half       { font-size: .5rem; min-height: 14px; line-height: 14px; }
    .cal-cell-slices { margin-top: 2px; }
}
