:root {
    --bg: #0b1220;
    --card: #151d2e;
    --text: #e6edf7;
    --muted: #7d8ba5;
    --line: #243049;

    --done: #4ade80;
    --almost: #a3e635;
    --partial: #facc15;
    --skip: #2c3752;
    --slip: #f87171;
    --frozen: #38bdf8;
    --dayoff: #c084fc;
    --pending: #3d4a68;
    --none: #1a2337;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background: var(--bg);
    color: var(--text);
    font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    padding: 16px 14px calc(24px + env(safe-area-inset-bottom));
    max-width: 640px;
    margin: 0 auto;
    -webkit-text-size-adjust: 100%;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding-bottom: 14px;
    margin-bottom: 14px;
    border-bottom: 1px solid var(--line);
}

.wallet { display: flex; align-items: baseline; gap: 6px; }
.balance { font-size: 30px; font-weight: 700; letter-spacing: -0.5px; }
.wallet .unit { color: var(--muted); font-size: 13px; }

.today { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-size: 13px; }
.earned { color: var(--done); }
.pending { color: var(--muted); }

.card {
    background: var(--card);
    border-radius: 14px;
    padding: 14px;
    margin-bottom: 10px;
}

.card-head { display: flex; align-items: center; gap: 9px; }
.emoji { font-size: 20px; line-height: 1; }
.name { font-weight: 600; flex: 1; }
.streak { font-size: 14px; color: var(--partial); white-space: nowrap; }

.state { margin: 10px 0; font-size: 22px; font-weight: 600; }
.s-done, .s-almost { color: var(--done); }
.s-partial { color: var(--partial); }
.s-slip { color: var(--slip); }
.s-pending, .s-skip { color: var(--muted); }
.s-frozen { color: var(--frozen); }
.s-dayoff { color: var(--dayoff); }

.heat { display: flex; gap: 3px; }
.cell { flex: 1 1 0; aspect-ratio: 1; border-radius: 2px; background: var(--skip); }
.c-done { background: var(--done); }
.c-almost { background: var(--almost); }
.c-partial { background: var(--partial); }
.c-slip { background: var(--slip); }
.c-frozen { background: var(--frozen); }
.c-dayoff { background: var(--dayoff); }
.c-pending { background: var(--pending); }
.c-none { background: var(--none); }

.card-foot {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    font-size: 12px;
    color: var(--muted);
}

.empty { color: var(--muted); text-align: center; padding: 40px 0; }

.login { max-width: 320px; margin: 18vh auto 0; text-align: center; }
.login h1 { font-size: 22px; margin-bottom: 22px; letter-spacing: -0.3px; }
.login form { display: flex; flex-direction: column; gap: 10px; }

input[type=password] {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--text);
    font-size: 16px;
    padding: 13px 14px;
    width: 100%;
}
input[type=password]:focus { outline: none; border-color: var(--done); }

.login button[type=submit] {
    background: var(--done);
    border: none;
    border-radius: 10px;
    color: #06240f;
    font-size: 16px;
    font-weight: 600;
    padding: 13px;
    cursor: pointer;
}

.error { color: var(--slip); font-size: 14px; }

.bottom { margin-top: 22px; text-align: center; }
.link {
    background: none; border: none; color: var(--muted);
    font-size: 13px; cursor: pointer; text-decoration: underline;
}

button, input, textarea { font-family: inherit; }

.controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; width: 100%; }

.slot {
    width: 36px; height: 36px; padding: 0;
    border: 2px solid var(--line); border-radius: 50%;
    background: transparent; cursor: pointer;
    transition: background .12s ease, border-color .12s ease;
}
.slot.on { background: var(--done); border-color: var(--done); }

.btn {
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 9px;
    color: var(--text);
    font-size: 15px;
    min-height: 40px;
    padding: 9px 14px;
    cursor: pointer;
}
.btn:active { background: var(--line); }
.btn:disabled { opacity: .45; }
.btn-primary { background: var(--done); border-color: var(--done); color: #06240f; font-weight: 600; }
.btn-danger { border-color: var(--slip); color: var(--slip); }
.btn-ghost { color: var(--muted); font-size: 13px; min-height: 34px; padding: 7px 11px; }

.num, .note {
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 9px;
    color: var(--text);
    font-size: 16px;
    padding: 9px 12px;
}
.num { width: 92px; }
.note { flex: 1 1 100%; }
.num:focus, .note:focus { outline: none; border-color: var(--done); }

.card-error { color: var(--slip); font-size: 13px; margin: -4px 0 10px; }

.card-foot { align-items: center; gap: 10px; }