:root {
    --bg: #080b12;
    --card: #121826;
    --card2: #171f31;
    --text: #f4f7fb;
    --muted: #9ca8ba;
    --accent: #6ee7b7;
    --accent2: #60a5fa;
    --danger: #fb7185;
    --yellow: #ffc928;
    --green-soft: rgba(110, 231, 183, .10);
    --green-border: rgba(110, 231, 183, .25);
    --red-soft: rgba(251, 113, 133, .10);
    --red-border: rgba(251, 113, 133, .25);
    --vacation: #93c5fd;
    --vacation-soft: rgba(96, 165, 250, .12);
    --vacation-border: rgba(96, 165, 250, .35);
    --border: rgba(255, 255, 255, .08);
    --field: rgba(255, 255, 255, .06);
    --tabbar-h: calc(64px + env(safe-area-inset-bottom));
}

[hidden] { display: none !important; }

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at top left, rgba(96, 165, 250, .13), transparent 35%),
        radial-gradient(circle at bottom right, rgba(110, 231, 183, .09), transparent 30%),
        var(--bg);
    background-attachment: fixed;
    color: var(--text);
    min-height: 100vh;
}

a { color: inherit; text-decoration: none; }

.page { width: min(760px, 100%); margin: 0 auto; padding: 22px; }
body.has-tabbar .page { padding-bottom: calc(var(--tabbar-h) + 24px); }
body.has-selection .page { padding-bottom: calc(var(--tabbar-h) + 230px); }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; padding-top: env(safe-area-inset-top); }
.logo { font-size: 26px; font-weight: 850; letter-spacing: -.04em; }
.logo span { color: var(--accent); }
.topbar-user { font-size: 14px; font-weight: 650; overflow-wrap: anywhere; text-align: right; }

.tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 48;
    display: flex; justify-content: center;
    min-height: var(--tabbar-h); padding: 6px 8px env(safe-area-inset-bottom);
    background: rgba(12, 17, 28, .96); border-top: 1px solid var(--border);
    -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
.tabbar a, .tabbar button {
    flex: 1 1 0; max-width: 190px; width: auto;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    padding: 6px 2px; border-radius: 14px; background: transparent; border: 0;
    color: var(--text); font-size: 12px; font-weight: 700;
}
.tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tabbar .active, .tabbar .is-open { color: var(--accent); }

.sheet-backdrop { position: fixed; inset: 0; z-index: 46; background: rgba(0, 0, 0, .55); }
.more-sheet {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 47;
    width: min(760px, 100%); margin: 0 auto;
    padding: 14px 18px calc(var(--tabbar-h) + 12px);
    background: linear-gradient(180deg, var(--card), var(--card2));
    border: 1px solid var(--border); border-bottom: 0; border-radius: 28px 28px 0 0;
    box-shadow: 0 -24px 70px rgba(0, 0, 0, .45);
}
.sheet-group { color: var(--muted); font-size: 13px; font-weight: 700; margin: 12px 4px 6px; }
.sheet-link { display: block; padding: 14px 16px; border-radius: 16px; background: var(--field); border: 1px solid var(--border); font-weight: 700; margin-bottom: 8px; }
.sheet-link.active { border-color: var(--accent); color: var(--accent); }
.sheet-logout { color: #fda4af; }
button.sheet-logout { width: 100%; justify-content: flex-start; font-size: inherit; }

.card {
    background: linear-gradient(180deg, var(--card), var(--card2));
    border: 1px solid var(--border);
    border-radius: 28px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, .35);
    padding: 24px;
    margin-bottom: 18px;
}
.card h2, .card h3 { margin-top: 0; }

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 22px; }
.login-card { width: min(430px, 100%); }
.muted, .sub { color: var(--muted); }
.back-link { display: inline-block; color: var(--muted); margin-bottom: 14px; font-weight: 650; }

label { display: block; color: var(--muted); font-size: 14px; margin: 14px 0 8px; }
input, select, textarea {
    width: 100%;
    border: 1px solid var(--border);
    background: var(--field);
    color: var(--text);
    border-radius: 16px;
    padding: 14px 15px;
    font-size: 16px;
    font-family: inherit;
    outline: none;
}
input:focus, select:focus { border-color: var(--accent2); }
select option { background: #111827; color: #fff; }
input:-webkit-autofill {
    -webkit-text-fill-color: var(--text);
    box-shadow: 0 0 0 1000px #1b2335 inset;
    caret-color: var(--text);
}
.checkbox-wrap { display: flex; align-items: flex-start; gap: 10px; margin: 12px 0; color: var(--text); }
.checkbox-wrap input { width: auto; margin-top: 3px; }
.checkbox-wrap small { display: block; color: var(--muted); }
.weekday-picks { display: flex; flex-wrap: wrap; gap: 8px; }
.weekday-picks label { display: flex; align-items: center; gap: 6px; margin: 0; padding: 10px 12px; border-radius: 14px; background: var(--field); border: 1px solid var(--border); color: var(--text); }
.weekday-picks input { width: auto; }

button, .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 0;
    border-radius: 18px;
    padding: 13px 17px;
    font-size: 15px;
    font-weight: 750;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    color: #061018;
    cursor: pointer;
    width: 100%;
    font-family: inherit;
}
.btn-secondary { background: rgba(255, 255, 255, .08); color: var(--text); border: 1px solid var(--border); }
.btn-danger { background: rgba(251, 113, 133, .14); color: #fda4af; border: 1px solid rgba(251, 113, 133, .25); }
.btn-small { width: auto; padding: 9px 12px; border-radius: 13px; font-size: 14px; }

.stack > * + * { margin-top: 12px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row > * { flex: 1 1 auto; }
.form-actions { margin-top: 18px; }

.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.stat { border-radius: 18px; padding: 12px 14px; background: var(--field); border: 1px solid var(--border); min-height: 76px; }
.stat .label { color: var(--muted); font-size: 13px; font-weight: 650; }
.stat .value { font-size: 24px; font-weight: 850; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .extra { color: var(--muted); font-size: 12px; margin-top: 3px; }
.stat.plus { background: var(--green-soft); border-color: var(--green-border); }
.stat.plus .value { color: #86efac; }
.stat.minus { background: var(--red-soft); border-color: var(--red-border); }
.stat.minus .value { color: #fda4af; }
.stat .vacation-value { color: var(--vacation); }

.alert-ok, .alert-error, .hint-yellow { border-radius: 18px; padding: 14px 16px; margin-bottom: 16px; font-weight: 650; }
.alert-ok { background: var(--green-soft); border: 1px solid var(--green-border); color: #86efac; }
.alert-error { background: var(--red-soft); border: 1px solid var(--red-border); color: #fda4af; }
.hint-yellow { background: rgba(255, 201, 40, .12); border: 1px solid rgba(255, 201, 40, .35); color: var(--yellow); }

.password-field { position: relative; }
.password-field input { padding-right: 52px; }
.password-toggle {
    position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
    width: 42px; height: 42px; padding: 0; border-radius: 12px;
    background: transparent; color: var(--muted);
}
.password-toggle svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.password-toggle .eye-closed { display: none; }
.password-toggle.is-visible .eye-open { display: none; }
.password-toggle.is-visible .eye-closed { display: block; }
.pw-rules { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 4px; font-size: 14px; }
.pw-rules li { color: var(--danger); }
.pw-rules li::before { content: "✗ "; }
.pw-rules li.ok { color: var(--accent); }
.pw-rules li.ok::before { content: "✓ "; }

.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { color: var(--muted); font-weight: 700; font-size: 14px; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .plus { color: #86efac; font-weight: 750; }
.table .minus { color: #fda4af; font-weight: 750; }
.table tfoot td { font-weight: 850; border-top: 2px solid var(--border); }

.badge { display: inline-flex; border-radius: 999px; padding: 4px 10px; font-size: 13px; font-weight: 800; background: rgba(255, 255, 255, .08); }

.c-mint   { --c: #6ee7b7; }
.c-blue   { --c: #60a5fa; }
.c-amber  { --c: #fbbf24; }
.c-rose   { --c: #fb7185; }
.c-violet { --c: #a78bfa; }
.c-cyan   { --c: #22d3ee; }
.c-lime   { --c: #a3e635; }
.c-slate  { --c: #94a3b8; }
.swatch { display: inline-block; width: 14px; height: 14px; border-radius: 50%; background: var(--c, var(--muted)); vertical-align: middle; }

@media (max-width: 820px) {
    .page { padding: 14px; }
    body.has-tabbar .page { padding-bottom: calc(var(--tabbar-h) + 18px); }
    body.has-selection .page { padding-bottom: calc(var(--tabbar-h) + 230px); }
    .card { border-radius: 22px; padding: 18px; }
    .grid-2 { grid-template-columns: 1fr; }
    .row { flex-direction: column; align-items: stretch; }
    .table.responsive thead { display: none; }
    .table.responsive, .table.responsive tbody, .table.responsive tr, .table.responsive td { display: block; }
    .table.responsive tr { border: 1px solid var(--border); border-radius: 16px; margin-bottom: 10px; padding: 8px; background: var(--field); }
    .table.responsive td { border: 0; padding: 6px 8px; text-align: left; }
    .table.responsive td::before { content: attr(data-label); display: block; color: var(--muted); font-size: 12px; }
    .table.responsive tfoot, .table.responsive tfoot tr, .table.responsive tfoot td { display: block; }
}

.center { text-align: center; }
.month-nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.month-nav h1 { margin: 0; font-size: 24px; letter-spacing: -.02em; text-align: center; flex: 1 1 auto; }
.month-nav .btn { width: 46px; min-height: 42px; font-size: 22px; padding: 0; }
.today-link { margin: -6px 0 12px; }

.calendar { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.cal-head { text-align: center; color: var(--muted); font-size: 13px; font-weight: 700; padding: 4px 0; }
.day-cell { margin: 0; cursor: pointer; display: block; position: relative; min-width: 0; }
.day-cell input { position: absolute; inset: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.day {
    display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
    min-height: 66px; padding: 6px 2px; border-radius: 13px;
    background: var(--field); border: 2px solid transparent; color: var(--text);
    -webkit-user-select: none; user-select: none; position: relative;
}
.day.is-weekend { background: rgba(255, 255, 255, .03); }
.day.is-holiday .day-num { color: var(--yellow); }
.day.is-today { border-color: var(--accent2); }
.day.has-entry { background: color-mix(in srgb, var(--c) 18%, transparent); }
.day.has-entry .day-code { color: var(--c); }
.day.is-sick { background: var(--red-soft); }
.day.is-sick .day-code { color: var(--danger); }
.day.is-vacation { background: var(--vacation-soft); }
.day.is-vacation .day-code { color: var(--vacation); }
.day-num { font-size: 13px; color: var(--muted); font-weight: 700; }
.day-code { font-size: 18px; font-weight: 850; line-height: 1.15; margin-top: 1px; overflow-wrap: anywhere; text-align: center; }
.day-hours { font-size: 10px; color: var(--muted); font-variant-numeric: tabular-nums; }
.day-hol { position: absolute; top: 6px; right: 6px; width: 6px; height: 6px; border-radius: 50%; background: var(--yellow); }
.day-cell input:checked + .day { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(110, 231, 183, .35); }
.day-cell input:focus-visible + .day { outline: 2px solid var(--accent2); }

.select-hint { margin: 14px 0 0; text-align: center; font-size: 14px; }
.action-bar {
    position: fixed; left: 0; right: 0; bottom: var(--tabbar-h); z-index: 40;
    width: min(760px, 100%); margin: 0 auto; padding: 12px 14px 14px;
    background: linear-gradient(180deg, var(--card), var(--card2));
    border: 1px solid var(--border); border-bottom: 0; border-radius: 22px 22px 0 0;
    box-shadow: 0 -18px 50px rgba(0, 0, 0, .45);
}
.selection-info { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.selection-info > span { flex: 1 1 auto; font-weight: 750; }
.selection-info .btn-small { min-height: 40px; }
#select-none { width: 44px; padding: 0; font-size: 16px; }
.action-buttons { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.action-buttons button { padding: 12px 4px; min-height: 48px; font-size: clamp(12px, 3.6vw, 14px); border-radius: 15px; hyphens: manual; text-align: center; line-height: 1.15; min-width: 0; }
.btn-shift { background: color-mix(in srgb, var(--c) 22%, transparent); color: var(--text); border: 1px solid color-mix(in srgb, var(--c) 45%, transparent); }
.btn-sick { background: var(--red-soft); color: #fda4af; border: 1px solid var(--red-border); }
.btn-vacation { background: var(--vacation-soft); color: var(--vacation); border: 1px solid var(--vacation-border); }

.entry-list { display: grid; gap: 6px; }
.entry-row {
    display: flex; align-items: center; gap: 12px;
    min-height: 52px; padding: 9px 12px; border-radius: 15px;
    background: var(--field); border: 1px solid var(--border);
}
.entry-row:active { border-color: var(--accent2); }
.entry-date { flex: 0 0 auto; min-width: 84px; font-variant-numeric: tabular-nums; color: var(--muted); font-size: 14px; }
.entry-date b { color: var(--text); }
.entry-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.entry-title { font-weight: 750; }
.entry-time, .entry-note { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.entry-hours { flex: 0 0 auto; font-weight: 800; font-variant-numeric: tabular-nums; }
.entry-row .swatch { width: 10px; height: 10px; margin-top: -2px; }
.entry-row.is-sick .entry-title { color: #fda4af; }
.entry-row.is-sick .swatch { background: var(--danger); }
.entry-row.is-vacation .entry-title { color: var(--vacation); }
.entry-row.is-vacation .swatch { background: var(--vacation); }
.nowrap { white-space: nowrap; }

.fold { padding: 0; }
.fold > summary { list-style: none; cursor: pointer; display: flex; flex-direction: column; gap: 2px; padding: 16px 48px 16px 18px; position: relative; }
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary::after { content: "›"; position: absolute; right: 20px; top: 50%; transform: translateY(-50%); font-size: 24px; color: var(--muted); transition: transform .15s; }
.fold[open] > summary::after { transform: translateY(-50%) rotate(90deg); }
.fold > form { padding: 0 18px 18px; }
.fold-title { font-weight: 800; font-size: 17px; }
.fold-meta { color: var(--muted); font-size: 14px; }
.fold-meta b { color: var(--text); }
.btn-row { display: grid; grid-template-columns: 1fr 1fr 2fr; gap: 8px; margin-top: 10px; }
.btn-row .btn-small { width: 100%; min-height: 44px; }

.year-list { display: grid; gap: 6px; }
.year-row {
    display: flex; align-items: center; gap: 12px;
    min-height: 56px; padding: 10px 14px; border-radius: 15px;
    background: var(--field); border: 1px solid var(--border);
}
a.year-row:active { border-color: var(--accent2); }
.year-row.is-total { border-color: rgba(255, 255, 255, .18); background: rgba(255, 255, 255, .09); margin-top: 6px; }
.year-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.year-title { font-weight: 800; }
.year-meta { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.year-meta .plus { color: #86efac; }
.year-meta .minus { color: #fda4af; }
.year-saldo { flex: 0 0 auto; font-weight: 850; font-size: 17px; font-variant-numeric: tabular-nums; }
.year-saldo.plus { color: #86efac; }
.year-saldo.minus { color: #fda4af; }
.year-legend { font-size: 13px; margin: 12px 0 0; }
.fold > .fold-body { padding: 0 18px 18px; }
.fold-body > p:last-child { margin-bottom: 0; }
.fold-meta b.plus { color: #86efac; }
.fold-meta b.minus { color: #fda4af; }

.copy-source { font-size: 14px; font-family: ui-monospace, Menlo, monospace; }
.steps { margin: 0; padding-left: 22px; }
.steps li + li { margin-top: 6px; }

.text-link { color: var(--accent); font-weight: 700; }
.hp-field { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.count-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 7px; margin-left: 8px; border-radius: 999px; background: var(--accent); color: #061018; font-size: 13px; font-weight: 850; vertical-align: middle; }
.tabbar button { position: relative; }
.tabbar .tab-badge { position: absolute; top: 2px; left: calc(50% + 8px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: #061018; font-size: 11px; font-weight: 850; display: flex; align-items: center; justify-content: center; }
.request-message { margin: 0; padding: 12px 14px; border-radius: 14px; background: var(--field); border: 1px solid var(--border); overflow-wrap: anywhere; }
.surcharge-row { display: grid; gap: 8px; }
