/* ===== BASE ===== */
* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
    margin: 0;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;

    padding:
        10px
        10px
        calc(10px + env(safe-area-inset-bottom))
        10px;

    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #0f1115;
    color: #e6e6e6;
}

/* ===== HEADER ===== */
.header {
    flex: 0 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.header h2 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
}

.header a {
    color: #7aa2ff;
    text-decoration: none;
    font-size: 20px;
    padding: 6px 12px;
    border-radius: 10px;
    background: rgba(255,255,255,0.04);
}

.header a:active {
    background: rgba(122,162,255,0.2);
}

/* ===== WEEKDAYS ===== */
.weekdays {
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-size: 11px;
    opacity: 0.55;
    margin-bottom: 4px;
}

/* ===== CALENDAR GRID (AUTO-HEIGHT) ===== */
.calendar {
    flex: 1 1 auto;
    display: grid;
    grid-template-columns: repeat(7, 1fr);

    /* КЛЮЧЕВОЕ: всегда 6 строк */
    grid-template-rows: repeat(6, 1fr);

    gap: 6px;
}

/* ===== EMPTY CELLS ===== */
.empty {
    width: 100%;
}

/* ===== DAY CELL ===== */
.day {
    padding: 6px;
    border-radius: 12px;

    display: flex;
    flex-direction: column;
    justify-content: space-between;

    font-size: 12px;
    position: relative;
}

/* ===== DATE NUMBER ===== */
.num {
    font-size: 15px;
    font-weight: 600;
    line-height: 1;
}

/* ===== TYPE INDICATOR ===== */
.type {
    width: 100%;
    height: 4px;
    border-radius: 4px;
    opacity: 0.85;
}

/* ===== SHIFT TYPES ===== */
.day.day {
    background: #1f2b22;
}
.day.day .type {
    background: #3cb371;
}

.day.night {
    background: #1c223a;
}
.day.night .type {
    background: #6c7cff;
}

.day.off {
    background: #2b2b2b;
}
.day.off .type {
    background: #9e9e9e;
}

/* ===== WEEKEND ===== */
.day.weekend {
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.12);
}

/* ===== TODAY ===== */
.day.today {
    outline: 1px solid #ffd54f;
    outline-offset: 3px;
}

/* ===== TAP FEEDBACK ===== */
.day:active {
    transform: scale(0.97);
}

/* ===== DESKTOP / TABLET ===== */
@media (min-width: 768px) {
    body {
        padding: 20px;
        max-width: 520px;
        margin: 0 auto;
    }

    .num {
        font-size: 17px;
    }

    .type {
        height: 5px;
    }
}