:root {
    --bg: #f4f7fb;
    --panel: rgba(255, 255, 255, 0.8);
    --panel-strong: #ffffff;
    --text: #172033;
    --muted: #6d7a8d;
    --primary: #4f46e5;
    --primary-soft: rgba(79, 70, 229, 0.12);
    --line: rgba(17, 24, 39, 0.08);
    --shadow: 0 20px 45px rgba(31, 41, 55, 0.12);
    --success: #16a34a;
    --danger: #dc2626;
    --date-bg: rgba(79, 70, 229, 0.08);
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    min-height: 100%;
    font-family: 'Inter', sans-serif;
    background:
        radial-gradient(circle at top left, rgba(79, 70, 229, 0.15), transparent 30%),
        radial-gradient(circle at bottom right, rgba(14, 165, 233, 0.14), transparent 28%),
        var(--bg);
    color: var(--text);
}

body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 32px 16px;
}

.page-shell {
    width: min(100%, 1200px);
}

.login-card,
.panel {
    background: var(--panel);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: var(--shadow);
    border-radius: 24px;
    padding: 32px;
}

.login-card {
    max-width: 420px;
    margin: 0 auto;
}

.eyebrow {
    display: inline-block;
    font-size: 0.74rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 12px;
}

h1 {
    margin: 0;
    font-size: clamp(2rem, 3vw, 2.6rem);
    line-height: 1.1;
}

p {
    margin: 12px 0 0;
    color: var(--muted);
}

.login-form {
    margin-top: 24px;
    display: grid;
    gap: 16px;
}

input[type='password'] {
    width: 100%;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.75);
    border-radius: 14px;
    padding: 15px 16px;
    font-size: 1rem;
    color: var(--text);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input[type='password']:focus {
    border-color: rgba(79, 70, 229, 0.5);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.08);
}

button {
    border: none;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    color: white;
    font-weight: 700;
    font-size: 0.98rem;
    padding: 15px 18px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 12px 28px rgba(79, 70, 229, 0.25);
}

button:hover {
    transform: translateY(-1px);
}

.message {
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 0.92rem;
    line-height: 1.4;
}

.message.error {
    background: rgba(220, 38, 38, 0.08);
    color: var(--danger);
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 26px;
}

.logout-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-soft);
    color: var(--primary);
    text-decoration: none;
    border-radius: 999px;
    padding: 10px 14px;
    font-weight: 600;
    font-size: 0.9rem;
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--panel-strong);
}

.progress-table {
    width: 100%;
    min-width: 0;
    border-collapse: collapse;
    table-layout: auto;
}

.progress-table th,
.progress-table td {
    padding: 6px 3px;
    text-align: left;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
    white-space: nowrap;
}

.progress-table th {
    background: rgba(79, 70, 229, 0.04);
    font-size: 0.62rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    white-space: nowrap;
}

.progress-table tbody tr:last-child td {
    border-bottom: none;
}

.col-week { width: auto; min-width: 38px; }
.col-phase { width: auto; min-width: 68px; }
.col-unit { width: auto; min-width: 96px; }
.col-reps { width: auto; min-width: 36px; }
.col-frequency { width: auto; min-width: 52px; }
.col-check { width: auto; min-width: 120px; }
.col-date { width: auto; min-width: 118px; }
.col-info { width: auto; min-width: 190px; }

.col-week,
.col-phase,
.col-date,
.col-check,
.col-reps,
.col-frequency,
.col-info {
    text-align: center;
}

.unit-stack {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    min-width: 100%;
    width: 100%;
}

.unit-value {
    display: inline-block;
    font-weight: 700;
    color: var(--primary);
    font-size: 0.72rem;
    letter-spacing: 0.01em;
    white-space: nowrap;
    text-align: left;
}

.col-unit {
    white-space: nowrap;
    text-align: left;
}

.check-cell {
    width: auto;
    min-width: 220px;
    text-align: center;
}

.check-pair {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: nowrap;
}

.session-combo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.session-box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 46px;
}

.check-toggle.small {
    width: 46px;
    height: 26px;
}

.date-cell {
    min-width: 152px;
    width: 152px;
}

.date-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.date-badge {
    min-width: 64px;
    width: 64px;
}

.info-cell {
    text-align: left;
}

.info-static {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    font-size: 0.72rem;
    line-height: 1.4;
    color: var(--text);
    white-space: nowrap;
}

.progress-table td,
.progress-table th,
.progress-table span,
.progress-table button {
    white-space: nowrap;
}

.date-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 5px 8px;
    border-radius: 999px;
    background: var(--date-bg);
    color: var(--primary);
    font-size: 0.72rem;
    font-weight: 700;
    min-width: 72px;
    white-space: nowrap;
}

.check-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 30px;
    cursor: pointer;
}

.check-toggle input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    margin: 0;
}

.switch {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: linear-gradient(180deg, #edf1f7, #dfe7f1);
    border: 1px solid rgba(148, 163, 184, 0.4);
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.08);
    transition: background 0.2s ease, box-shadow 0.2s ease;
}

.switch::before {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    left: 3px;
    top: 3px;
    border-radius: 50%;
    background: white;
    box-shadow: 0 3px 10px rgba(15, 23, 42, 0.16);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.check-toggle input:checked + .switch {
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    box-shadow: inset 0 1px 2px rgba(79, 70, 229, 0.18);
}

.check-toggle input:checked + .switch::before {
    transform: translateX(22px);
    box-shadow: 0 3px 10px rgba(79, 70, 229, 0.22);
}

.status {
    margin-top: 18px;
    min-height: 24px;
    color: var(--muted);
    font-size: 0.92rem;
}

.status.success {
    color: var(--success);
}

.status.error {
    color: var(--danger);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 700px) {
    .page-shell {
        width: min(100%, 100%);
    }

    .login-card,
    .panel {
        padding: 22px 18px;
    }

    .topbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .table-wrap {
        overflow: visible;
        border: none;
        background: transparent;
    }

    .progress-table,
    .progress-table thead,
    .progress-table tbody,
    .progress-table tr,
    .progress-table th,
    .progress-table td {
        display: block;
        width: 100%;
    }

    .progress-table thead {
        display: none;
    }

    .progress-table tbody {
        display: flex;
        flex-direction: column;
        gap: 14px;
    }

    .progress-table tr {
        background: var(--panel-strong);
        border: 1px solid var(--line);
        border-radius: 16px;
        padding: 12px 14px 8px;
        box-shadow: 0 12px 20px rgba(15, 23, 42, 0.05);
    }

    .progress-table td {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 8px 0;
        border-bottom: 1px solid var(--line);
        white-space: normal;
        text-align: left;
    }

    .progress-table td:last-child {
        border-bottom: none;
        padding-bottom: 4px;
    }

    .progress-table td::before {
        content: attr(data-label);
        font-size: 0.6rem;
        letter-spacing: 0.08em;
        text-transform: uppercase;
        color: var(--muted);
        font-weight: 700;
        flex: 0 0 auto;
    }

    .col-week,
    .col-phase,
    .col-unit,
    .col-reps,
    .col-check,
    .col-info {
        min-width: 0;
        width: 100%;
    }

    .check-cell {
        min-width: 0;
        width: 100%;
    }

    .session-combo,
    .date-wrap {
        justify-content: flex-end;
        margin-left: auto;
    }

    .unit-stack {
        justify-content: flex-end;
        width: auto;
        min-width: 0;
        margin-left: auto;
    }

    .unit-value {
        text-align: right;
    }

    .unit-stack,
    .unit-value,
    .info-static {
        width: 100%;
    }

    .info-static {
        display: flex;
        align-items: flex-end;
        text-align: left;
        white-space: normal;
    }

    .info-static div {
        width: 100%;
        display: flex;
        justify-content: space-between;
        gap: 12px;
    }
}
