:root {
    --bg: #0f172a;
    --surface: #1f2937;
    --surface-2: #273345;
    --text: #f1f5f9;
    --muted: #94a3b8;
    --planned: #f6c453;
    --actual: #4ade80;
    --excused: #94a3b8;
    --today: #38bdf8;
    --risk: #ef4444;
    --ok: #4ade80;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    background: var(--bg);
    color: var(--text);
    font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

a { color: var(--today); }

/* Login ------------------------------------------------------------------ */
body.login { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card {
    background: var(--surface); padding: 2rem; border-radius: 12px;
    width: min(360px, 90vw);
}
.login-card h1 { margin: 0 0 1rem; font-size: 1.4rem; }
.login-card form { display: flex; flex-direction: column; gap: 1rem; }
.login-card label { display: flex; flex-direction: column; gap: 0.4rem; font-size: 0.9rem; color: var(--muted); }
.login-card input {
    padding: 0.7rem; border-radius: 6px; border: 1px solid #334155;
    background: #0b1220; color: var(--text); font-size: 1rem;
}
.login-card button {
    padding: 0.8rem; border: 0; border-radius: 6px;
    background: var(--today); color: #0b1220; font-weight: 600; font-size: 1rem;
    cursor: pointer;
}
.login-card .error { color: var(--risk); margin: 0; font-size: 0.9rem; }

/* Calendar --------------------------------------------------------------- */
.topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1rem; gap: 1rem; background: var(--surface);
    position: sticky; top: 0; z-index: 10;
}
.counter-big { font-size: 1.8rem; font-weight: 700; }
.counter.ok   .counter-big { color: var(--ok); }
.counter.risk .counter-big { color: var(--risk); }
.counter-sub { font-size: 0.8rem; color: var(--muted); }
.counter.risk .counter-sub strong { color: var(--risk); }
.counter.ok   .counter-sub strong { color: var(--ok); }

.push-btn {
    padding: 0.5rem 0.8rem; border-radius: 6px; border: 1px solid #334155;
    background: transparent; color: var(--text); cursor: pointer; font-size: 0.85rem;
}
.push-btn.on { background: var(--actual); color: #0b1220; border-color: transparent; }

.month-nav {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1rem; max-width: 720px; margin: 0 auto;
    gap: 0.5rem;
}
.month-nav a {
    text-decoration: none; font-size: 1.4rem; padding: 0.4rem 0.8rem;
    border-radius: 6px; background: var(--surface);
}
.month-head { text-align: center; flex: 1; }
.month-head h2 { margin: 0; font-size: 1.1rem; }
.month-stats {
    display: flex; gap: 0.5rem; justify-content: center; flex-wrap: wrap;
    margin-top: 0.25rem; font-size: 0.7rem;
}
.month-stats .stat { padding: 0.1rem 0.4rem; border-radius: 4px; background: var(--surface); color: var(--muted); }
.month-stats .stat.actual  { background: color-mix(in srgb, var(--actual)  35%, var(--surface)); color: var(--text); }
.month-stats .stat.planned { background: color-mix(in srgb, var(--planned) 35%, var(--surface)); color: var(--text); }
.month-stats .stat.remote  { background: color-mix(in srgb, #818cf8 35%, var(--surface)); color: var(--text); }

.cal {
    width: 100%; max-width: 720px; margin: 0 auto;
    border-collapse: separate; border-spacing: 4px;
    padding: 0 0.5rem;
}
.cal th {
    font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em;
    color: var(--muted); font-weight: 500; padding: 0.4rem 0;
}
.cal td {
    background: var(--surface); border-radius: 8px;
    vertical-align: top; min-height: 64px; height: 64px;
    width: calc(100% / 7); position: relative; padding: 4px;
}
.cal td.pad { background: transparent; }
.cell.planned { background: color-mix(in srgb, var(--planned) 35%, var(--surface)); }
.cell.actual  { background: color-mix(in srgb, var(--actual)  40%, var(--surface)); }
.cell.remote  { background: color-mix(in srgb, #818cf8 35%, var(--surface)); }
.cell.excused { background: var(--surface-2); }
.cell.today { outline: 2px solid var(--today); outline-offset: -2px; }
.cell.busy  { opacity: 0.5; }

.day-num   { font-size: 0.85rem; color: var(--muted); }
.cell.actual .day-num,
.cell.planned .day-num { color: var(--text); font-weight: 600; }
.day-label { font-size: 0.7rem; margin-top: 0.2rem; }

.cell { cursor: pointer; }
.cell:hover, .cell:focus { outline: 2px solid color-mix(in srgb, var(--today) 60%, transparent); outline-offset: -2px; }

/* Bottom sheet ---------------------------------------------------------- */
.sheet-backdrop {
    position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 100;
    animation: fadein 0.15s ease-out;
}
.action-sheet {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 101;
    background: var(--surface); border-radius: 16px 16px 0 0;
    padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom));
    transform: translateY(100%); transition: transform 0.2s ease-out;
    max-width: 720px; margin: 0 auto;
}
.action-sheet.open { transform: translateY(0); }
.sheet-head {
    display: flex; align-items: center; justify-content: space-between;
    padding-bottom: 0.75rem; margin-bottom: 0.75rem;
    border-bottom: 1px solid var(--surface-2);
}
.sheet-date { font-weight: 600; font-size: 1.05rem; }
.sheet-close {
    background: transparent; border: 0; color: var(--muted);
    font-size: 1.6rem; line-height: 1; padding: 0 0.4rem;
    cursor: pointer; min-width: 44px; min-height: 44px;
}
.sheet-actions { display: flex; flex-direction: column; gap: 0.5rem; }
.sheet-btn {
    display: flex; align-items: center; gap: 0.8rem;
    padding: 0.9rem 1rem; min-height: 52px;
    background: var(--surface-2); color: var(--text);
    border: 0; border-radius: 10px;
    font-size: 1rem; font-weight: 500; text-align: left;
    cursor: pointer;
}
.sheet-btn span { font-size: 1.3rem; width: 1.6rem; text-align: center; }
.sheet-btn:active { transform: scale(0.98); }
.sheet-btn.actual  { background: color-mix(in srgb, var(--actual)  40%, var(--surface-2)); }
.sheet-btn.plan    { background: color-mix(in srgb, var(--planned) 40%, var(--surface-2)); }
.sheet-btn.remote  { background: color-mix(in srgb, #818cf8 40%, var(--surface-2)); }
.sheet-btn.reset   { background: transparent; color: var(--muted); }

@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }

.page-footer {
    text-align: center; padding: 2rem 1rem;
    color: var(--muted); font-size: 0.85rem;
}

@media (max-width: 480px) {
    .cal { border-spacing: 3px; padding: 0 0.25rem; }
    .cal td { min-height: 60px; height: 60px; padding: 4px; }
    .day-num { font-size: 1rem; font-weight: 600; }
    .day-label { font-size: 0.7rem; }
}
