/* Nitte 共通スタイル。ビルド不要のため、直接配信する。 */
:root {
    --bg: #f4f6f8;
    --surface: #ffffff;
    --text: #1d2327;
    --muted: #646970;
    --border: #dcdfe3;
    --primary: #2271b1;
    --primary-hover: #135e96;
    --ok: #1a7f37;
    --ng: #b32d2e;
    --warn: #996800;
    --side: #1d2327;
    --side-hover: #2c3338;
    --side-text: #c3c4c7;
    --radius: 6px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, system-ui, sans-serif;
    font-size: 15px;
    line-height: 1.7;
}

h1, h2, h3 { line-height: 1.35; }
h2 { font-size: 1.25rem; margin: 0 0 1rem; }
h3 { font-size: 1.05rem; margin: 1.75rem 0 .5rem; }

.muted { color: var(--muted); }
.ok { color: var(--ok); }
.ng { color: var(--ng); }

/* ゲスト（ログイン・初期設定） */
body.guest { display: flex; justify-content: center; padding: 2rem 1rem; }
.guest-card {
    width: 100%;
    max-width: 520px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
}
.brand { margin: 0; font-size: 1.8rem; letter-spacing: .04em; }
.brand-sub { margin: 0 0 1.5rem; color: var(--muted); font-size: .9rem; }

/* フォーム */
label { display: block; margin: 1rem 0 .25rem; font-weight: 600; font-size: .9rem; }
input[type=text], input[type=password], input[type=email], input[type=date], input[type=number], select, textarea {
    width: 100%;
    padding: .55rem .7rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font: inherit;
    background: #fff;
}
textarea { font-family: ui-monospace, Consolas, monospace; font-size: .85rem; }
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.field-error { color: var(--ng); margin: .25rem 0 0; font-size: .85rem; }

.btn {
    display: inline-block;
    margin-top: 1rem;
    padding: .55rem 1.1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
    color: var(--text);
    font: inherit;
    cursor: pointer;
    text-decoration: none;
}
.btn:hover { background: #f0f0f1; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-block { display: block; width: 100%; }

.notice { padding: .7rem 1rem; border-radius: var(--radius); margin: 0 0 1rem; border: 1px solid; }
.notice-ok { background: #edfaef; border-color: #b7e4bf; color: #0f5a25; }
.notice-error { background: #fcf0f1; border-color: #f0b8bb; color: #8a1f21; }
.notice-warn { background: #fcf9e8; border-color: #e8d98a; color: #614700; }

.code, pre.code {
    background: #f6f7f7;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: .6rem .8rem;
    font-family: ui-monospace, Consolas, monospace;
    overflow-x: auto;
}

.steps { padding-left: 1.4rem; color: var(--muted); }
.steps li.current { color: var(--text); font-weight: 600; }
.steps li.done { color: var(--ok); }
.steps li.done::marker { content: "✓ "; }

/* アプリ本体：左に濃色のサイドメニュー、本文は明るい背景 */
[x-cloak] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

body.app { display: block; }
.topbar { display: none; }
.shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 230px;
    flex-shrink: 0;
    background: var(--side);
    color: var(--side-text);
    padding: 1rem 0;
    display: flex;
    flex-direction: column;
}
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar a { display: block; padding: .55rem 1.25rem; color: var(--side-text); text-decoration: none; }
.sidebar a:hover { background: var(--side-hover); color: #fff; }
.sidebar a.active { background: var(--primary); color: #fff; }
.sidebar-brand { font-size: 1.35rem; font-weight: 700; color: #fff !important; padding-bottom: 1rem !important; }
.sidebar-brand small { display: block; font-size: .7rem; font-weight: 400; color: var(--side-text); }
.sidebar-heading { margin: 1.25rem 1.25rem .25rem; font-size: .72rem; letter-spacing: .08em; color: #8c8f94; }
.sidebar .sidebar-manual { margin-top: auto; margin-bottom: .75rem; }
.sidebar-user { padding: 1rem 1.25rem 0; border-top: 1px solid #3c434a; font-size: .85rem; }
.sidebar-user small { display: block; color: #8c8f94; }
.link-button { background: none; border: 0; color: #72aee6; padding: 0; cursor: pointer; font: inherit; text-decoration: underline; }

.content { flex: 1; min-width: 0; padding: 1.5rem 2rem 3rem; max-width: 1200px; }
.backdrop { display: none; }

/* 表 */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
table.data { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.data th, table.data td { padding: .5rem .75rem; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
table.data th { background: #f6f7f7; white-space: nowrap; font-weight: 600; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data tr.holiday td { background: #fff8e5; }
table.data tr.uncertain td { background: #fcf0f1; }
table.data tr.zero td.days { color: var(--muted); }
.badge { display: inline-block; padding: .05rem .5rem; border-radius: 999px; font-size: .78rem; background: #e8eaed; }
.badge-warn { background: #fcf3cf; color: #614700; }
.badge-ng { background: #fcd9db; color: #8a1f21; }
.badge-ok { background: #d5f1dc; color: #0f5a25; }

/* 集計のヘッダー */
.summary { display: flex; flex-wrap: wrap; gap: 1rem; margin: 1rem 0; }
.summary .card { flex: 1 1 150px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .75rem 1rem; }
.summary .card .label { font-size: .8rem; color: var(--muted); }
.summary .card .value { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; }

.toolbar { display: flex; flex-wrap: wrap; gap: .75rem 1rem; align-items: flex-end; margin: 1rem 0; }
.toolbar label { margin: 0 0 .15rem; font-size: .8rem; font-weight: 600; }
.toolbar select { width: auto; min-width: 9rem; }
.toolbar .btn { margin-top: 0; }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.25rem; margin: 1rem 0; }
.panel h3:first-child { margin-top: 0; }

@media (max-width: 800px) {
    .topbar { display: flex; align-items: center; gap: .75rem; background: var(--side); color: #fff; padding: .5rem 1rem; position: sticky; top: 0; z-index: 20; }
    .menu-toggle { background: none; border: 0; color: #fff; font-size: 1.4rem; cursor: pointer; }
    .topbar-brand { font-weight: 700; }
    .sidebar { position: fixed; z-index: 30; top: 0; bottom: 0; left: 0; transform: translateX(-100%); transition: transform .2s; overflow-y: auto; }
    .shell.menu-open .sidebar { transform: none; }
    .shell.menu-open .backdrop { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 25; }
    .content { padding: 1rem 1rem 3rem; }
}

@media print {
    .sidebar, .topbar, .toolbar, .no-print { display: none !important; }
    body { background: #fff; font-size: 11pt; }
    .content { padding: 0; max-width: none; }
    .table-wrap { border: 0; overflow: visible; }
    table.data { font-size: 9pt; }
    table.data thead { display: table-header-group; }
    table.data tr { page-break-inside: avoid; }
}

.nowrap { white-space: nowrap; }
ul.plain { list-style: none; margin: 0; padding: 0; }
label.radio { display: block; margin: .35rem 0; font-weight: 400; }
progress { width: 100%; max-width: 420px; height: 12px; }
table.data td.col-subject { min-width: 14rem; }
table.data td.col-notes { min-width: 9rem; }

/* 印刷ページの集計カード（画面の .summary と同じ見た目を、表で作る） */
table.figures { width: 100%; border-collapse: separate; border-spacing: .75rem 0; margin: 0 -.75rem; table-layout: fixed; }
td.figure { border: 1px solid var(--border); border-radius: var(--radius); padding: .6rem 1rem; background: #f6f7f7; }
td.figure-main { width: 50%; border: 2px solid var(--primary); background: #eef5fb; }
.figure-label { font-size: .8rem; color: var(--muted); }
.figure-value { font-size: 1.9rem; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
td.figure-main .figure-value { font-size: 3rem; color: var(--primary-hover); }
.figure-unit { font-size: 1.2rem; margin-left: .15rem; }
@media print { td.figure, td.figure-main { -webkit-print-color-adjust: exact; print-color-adjust: exact; } }

/* マニュアル */
.manual { max-width: 880px; }
.manual h3 { margin-top: 0; font-size: 1.15rem; padding-bottom: .3rem; border-bottom: 2px solid var(--border); }
.manual h4 { margin: 1.4rem 0 .4rem; font-size: 1rem; }
.manual p, .manual li { line-height: 1.8; }
.manual ul { padding-left: 1.3rem; }
.manual code { background: #f0f0f1; padding: .05rem .35rem; border-radius: 4px; font-size: .9em; }
.manual section { scroll-margin-top: 1rem; }
.manual .toc { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .75rem 1.25rem; margin: 1rem 0; }
.manual .toc ol { margin: .4rem 0 0; padding-left: 1.4rem; columns: 2; }
.manual table.data { margin: .5rem 0 1rem; background: var(--surface); }
@media (max-width: 800px) { .manual .toc ol { columns: 1; } }
