:root {
  /* ととのい（株式会社ととのい）のロゴ・サイトの色 */
  --brand: #0a84f6;        /* ロゴの青 */
  --brand-deep: #046bd2;   /* 白い文字をのせる青（読みやすさのため少し濃く） */
  --brand-navy: #0b3f74;   /* 見出し帯 */
  --sky: #91d7f2;          /* サイトの水色 */
  --sky-pale: #c4eef2;     /* サイトの淡い水色 */
  --sky-mist: #eef8fd;
  --bg: #f5f9fc; --panel: #fff; --ink: #334155; --sub: #64748b; --line: #dbe5ee;
  --accent: var(--brand-deep); --accent-ink: #fff; --warn: #b5541c; --danger: #b3261e;
  --kaigo: #d9efd9; --kaigo-b: #4c9a4c; --seishin: #dbe7f7; --seishin-b: #3f6fb5;
  --iryo: #f8dcdc; --iryo-b: #c0433f; --new: #fbf0bf; --new-b: #b8960f;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, "Hiragino Sans", "Noto Sans JP", sans-serif; background: var(--bg); color: var(--ink); font-size: 15px; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 6px 12px; color: var(--ink); }
button:hover { border-color: var(--brand); }
button.primary:hover { background: var(--brand-navy); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.danger { color: var(--danger); }
button.link { border: none; background: none; color: var(--accent); padding: 0; text-decoration: underline; }
button.small { padding: 2px 8px; font-size: 13px; }
input, select, textarea { border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; background: #fff; color: var(--ink); }
textarea { width: 100%; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }
.err { color: var(--danger); min-height: 1em; }
.muted { color: var(--sub); font-size: 13px; }

.login { display: grid; place-items: center; min-height: 100vh; }
.login-card { background: var(--panel); padding: 32px; border-radius: 16px; width: 320px; display: grid; gap: 14px; box-shadow: 0 2px 12px rgba(0,0,0,.06); }
.login { background: linear-gradient(160deg, #fff 0%, var(--sky-pale) 100%); }
.login-card h1 { margin: 0; color: var(--brand); display: flex; align-items: center; gap: 12px; }
.login-card h1 img { width: 56px; }
.login-card h1 small { font-size: 14px; color: var(--sub); }
.login-card label { display: grid; gap: 4px; font-size: 13px; color: var(--sub); }

.app { display: grid; grid-template-columns: 200px 1fr; min-height: 100vh; }
.side { background: linear-gradient(180deg, #fff 0%, var(--sky-mist) 100%); color: var(--ink); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 16px 10px; gap: 2px; position: sticky; top: 0; height: 100vh; }
.side .brand { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 700; padding: 4px 8px 16px; color: var(--brand); }
.side .brand img { width: 40px; height: auto; }
.side .brand small { display: block; font-size: 11px; color: var(--sub); font-weight: 400; }
.side a { color: inherit; text-decoration: none; padding: 8px 10px; border-radius: 8px; }
.side a:hover { background: var(--sky-mist); color: var(--brand-deep); }
.side a.on { background: var(--brand-deep); color: #fff; font-weight: 600; }
.side .me { margin-top: auto; font-size: 13px; display: grid; gap: 4px; padding: 10px; }
.side .me .link { color: var(--brand-deep); text-align: left; }
main { padding: 20px 28px 60px; min-width: 0; }
h2 { margin: 0 0 14px; font-size: 22px; color: var(--brand-navy); }
h3 { color: var(--brand-navy); }
h3 { margin: 18px 0 8px; font-size: 16px; }
.bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.bar .grow { flex: 1; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 14px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin-bottom: 14px; }
.card { background: var(--panel); border: 1px solid var(--line); border-top: 3px solid var(--sky); border-radius: 12px; padding: 14px 16px; }
.card .big { font-size: 30px; font-weight: 700; }
.card ul { margin: 6px 0 0; padding-left: 18px; font-size: 14px; max-height: 220px; overflow: auto; }

table { border-collapse: collapse; width: 100%; background: var(--panel); }
th, td { border-bottom: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: middle; font-size: 14px; }
th { background: #e8f4fb; font-weight: 600; position: sticky; top: 0; z-index: 1; font-size: 13px; }
tr.click:hover td { background: var(--sky-mist); cursor: pointer; }
tr.group td { background: var(--sky-pale); font-weight: 700; color: var(--accent); }
td.c, th.c { text-align: center; }
td.r, th.r { text-align: right; }
.tablewrap { overflow: auto; max-height: calc(100vh - 200px); border: 1px solid var(--line); border-radius: 10px; }

.tag { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 12px; border: 1px solid; white-space: nowrap; }
.t-介護 { background: var(--kaigo); border-color: var(--kaigo-b); }
.t-精神 { background: var(--seishin); border-color: var(--seishin-b); }
.t-医療, .t-特別指示 { background: var(--iryo); border-color: var(--iryo-b); }
.t-new { background: var(--new); border-color: var(--new-b); }
.due { color: var(--danger); font-weight: 600; }
.soon { color: var(--warn); font-weight: 600; }

.form { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px 14px; }
.form label { display: grid; grid-template-columns: minmax(0, 1fr); gap: 3px; font-size: 12px; color: var(--sub); overflow-wrap: anywhere; }
.form label.wide { grid-column: 1 / -1; }
.form input, .form select, .form textarea { font-size: 15px; color: var(--ink); }
.rows td input, .rows td select { width: 100%; }

/* スケジュール */
.sched { display: grid; overflow: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); max-height: calc(100vh - 190px); }
.sched .col { position: relative; border-left: 1px solid var(--line); min-width: 130px; }
.sched .head { position: sticky; top: 0; background: #e8f4fb; z-index: 3; padding: 6px; font-size: 13px; height: 70px; border-bottom: 1px solid var(--line); }
.sched .head.off { background: #e5e9ee; color: var(--sub); }
.sched .times { min-width: 52px; position: relative; }
.sched .tl { position: absolute; left: 0; right: 0; border-top: 1px dashed #e6eef4; font-size: 11px; color: var(--sub); padding-left: 4px; }
.sched .tl.hour { border-top: 1px solid #d6e2ec; }
.sched .lunch { position: absolute; left: 0; right: 0; background: repeating-linear-gradient(45deg, #f1f6fa, #f1f6fa 6px, #fff 6px, #fff 12px); }
.sched .v { position: absolute; left: 3px; right: 3px; border-radius: 6px; border: 1px solid; padding: 2px 5px; font-size: 12px; overflow: hidden; cursor: pointer; line-height: 1.3; }
.sched .v.extra { border-style: dashed; border-width: 2px; }
.sched .v.warn { box-shadow: 0 0 0 2px var(--danger); }
.sched .v .t { font-weight: 600; }
.sched .offmask { position: absolute; inset: 70px 0 0 0; background: rgba(0,0,0,.04); }
.legend { display: flex; gap: 8px; align-items: center; font-size: 12px; flex-wrap: wrap; }

.shift td { text-align: center; padding: 3px; cursor: pointer; min-width: 30px; font-size: 13px; user-select: none; }
.shift td.name { text-align: left; cursor: default; white-space: nowrap; }
.shift td.we { background: #f1f5f9; }
.shift td.休 { background: #f5d8d6; font-weight: 700; }
.shift td.午前, .shift td.午後 { background: #fbf0bf; }
.shift td.日勤x { background: #d9efd9; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; background: #fff; cursor: pointer; font-size: 13px; text-align: left; }
.chip.on { border-color: var(--accent); background: #e3f1fe; box-shadow: 0 0 0 1px var(--accent); }
.chip b { font-size: 14px; }

.diff { font-size: 13px; }
.diff del { color: var(--danger); }
.diff ins { color: var(--accent); text-decoration: none; font-weight: 600; }

dialog { border: none; border-radius: 14px; padding: 20px; max-width: min(760px, 94vw); width: 100%; box-shadow: 0 10px 40px rgba(0,0,0,.2); }
dialog::backdrop { background: rgba(0,0,0,.3); }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--brand-navy); color: #fff; padding: 10px 18px; border-radius: 10px; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 99; }
.toast.show { opacity: 1; }
.print-area { display: none; }

@media (max-width: 800px) {
  .app { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; }
  .side .brand, .side .me { display: none; }
  main { padding: 14px 16px 40px; }
}

@media print {
  body { background: #fff; font-size: 12pt; }
  body > *:not(.print-area) { display: none !important; }
  .print-area { display: block; }
  .print-area table { background: none; }
  .print-area th { position: static; background: #eee; }
  .print-area th, .print-area td { font-size: 10.5pt; padding: 3px 5px; border: 1px solid #999; }
  .page { page-break-after: always; }
  .page:last-child { page-break-after: auto; }
  .letter { font-size: 11.5pt; line-height: 1.8; padding: 10mm 8mm; }
  .letter h1 { text-align: center; font-size: 17pt; margin: 8mm 0; letter-spacing: .3em; }
  .envelope { height: 230mm; position: relative; font-size: 16pt; }
  .envelope .zip { font-size: 15pt; letter-spacing: .2em; margin: 12mm 0 0 10mm; }
  .envelope .addr { margin: 8mm 0 0 14mm; font-size: 14pt; }
  .envelope .to { margin: 20mm 0 0 20mm; font-size: 20pt; }
  .envelope .from { position: absolute; bottom: 0; right: 10mm; font-size: 10pt; text-align: right; }
  @page { margin: 12mm; }
}

/* ヘルプ */
.help-btn { position: fixed; top: 14px; right: 18px; z-index: 20; background: #fff; border-color: var(--sky); color: var(--brand-deep); font-weight: 600; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.help h4 { margin: 16px 0 6px; color: var(--accent); }
.help-steps { padding-left: 22px; line-height: 1.8; margin: 0; }
.help-steps li { margin-bottom: 4px; }
.faq { border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; margin-bottom: 6px; background: var(--sky-mist); }
.faq summary, .help-sec summary { cursor: pointer; font-weight: 600; }
.faq p { margin: 6px 0 2px; line-height: 1.7; }
.help-sec { border-bottom: 1px solid var(--line); padding: 10px 0; }
.help-sec summary { font-size: 16px; }
.flow { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.flow-when { font-weight: 700; color: var(--accent); margin-bottom: 6px; }
.flow-item { display: grid; gap: 2px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; text-decoration: none; color: var(--ink); background: #fff; }
.flow-item:hover { border-color: var(--accent); background: var(--sky-mist); }
.flow-item span { font-size: 13px; color: var(--sub); }
main > h2:first-child, main > .bar:first-child { padding-right: 190px; }
@media (max-width: 800px) { .help-btn { top: auto; bottom: 16px; } main > h2:first-child, main > .bar:first-child { padding-right: 0; } }

/* ===== 2回目の打ち合わせで足した画面 ===== */
.kpis { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 16px; min-width: 130px; display: grid; }
.kpi span { font-size: 12px; color: var(--sub); }
.kpi b { font-size: 26px; color: var(--brand-navy); }
.kpi small { font-size: 13px; font-weight: 400; color: var(--sub); }
.cards.home { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); align-items: start; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.card-head .count { font-size: 22px; color: var(--brand-navy); }
.card-foot { margin-top: 8px; font-size: 13px; color: var(--sub); display: flex; gap: 14px; flex-wrap: wrap; }
table.mini { background: none; }
table.mini td { font-size: 13px; padding: 5px 6px; }
table.mini tr.past td { opacity: .5; }
table.mini tr.click:hover td { background: var(--sky-mist); cursor: pointer; }
.cards.home .card { max-height: 420px; overflow: auto; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; flex-wrap: wrap; }
.seg button { border: none; border-radius: 0; border-right: 1px solid var(--line); padding: 5px 12px; }
.seg button:last-child { border-right: none; }
.seg button.on { background: var(--brand-deep); color: #fff; }
.form label.check, label.check { display: flex; flex-direction: row; align-items: center; gap: 6px; font-size: 14px; color: var(--ink); }
.checks { display: flex; gap: 10px; flex-wrap: wrap; }
.checks label.check { gap: 3px; }
h3.sec { margin-top: 0; }
.panel h4 { margin: 16px 0 6px; color: var(--brand-navy); font-size: 14px; }
.tag:empty { display: none; }
table.rece td { font-size: 12.5px; vertical-align: top; }
table.rece td.memo { max-width: 260px; color: var(--sub); }
table.bars th { width: 50px; background: none; position: static; }
.bar-wrap { position: relative; height: 18px; background: var(--sky-mist); border-radius: 4px; }
.bar-all, .bar-in { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; }
.bar-all { background: var(--sky); }
.bar-in { background: var(--brand-deep); }
.legend-box { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: middle; }
.legend-box.all { background: var(--sky); } .legend-box.in { background: var(--brand-deep); }

@media print {
  /* 計画書・報告書の担当表 */
  table.docsheet td, table.docsheet th { font-size: 12pt; padding: 5px 8px; }
  table.docsheet .box { width: 14mm; text-align: center; font-size: 14pt; }
  /* 指示書の依頼文（いまのExcelの並び） */
  .letter2 { font-size: 11pt; line-height: 1.75; padding: 6mm 10mm; position: relative; min-height: 260mm; }
  .letter2 h1 { text-align: center; font-size: 17pt; letter-spacing: .15em; margin: 4mm 0 6mm; }
  .letter2 .l-date { text-align: right; }
  .letter2 .l-to { margin-top: 6mm; font-size: 12pt; }
  .letter2 .l-dr { display: inline-block; margin-top: 3mm; font-size: 13pt; }
  .letter2 .l-from { margin: 4mm 0 0 auto; width: 80mm; font-size: 10.5pt; line-height: 1.6; }
  .letter2 .l-body { margin-top: 8mm; }
  .letter2 .l-keigu { text-align: right; }
  .letter2 .l-ki { text-align: center; margin: 6mm 0; }
  .letter2 .l-who, .letter2 .l-kind { margin-left: 20mm; font-size: 12pt; }
  .letter2 .l-date2 { margin-left: 20mm; }
  .letter2 .l-rehab { margin-top: 6mm; border: 1px solid #999; padding: 3mm 4mm; }
  .letter2 .l-note { margin: 2mm 0; }
  /* 長3封筒（縦書き） */
  .env { width: 120mm; height: 235mm; position: relative; page-break-after: always; overflow: hidden; font-family: "Hiragino Mincho ProN", "Yu Mincho", serif; }
  .env:last-child { page-break-after: auto; }
  .env-zip { position: absolute; top: 12mm; right: 9mm; font-size: 16pt; letter-spacing: 2.6mm; font-family: "Hiragino Sans", sans-serif; }
  .env-body { position: absolute; top: 32mm; bottom: 18mm; right: 12mm; left: 12mm; writing-mode: vertical-rl; }
  .env-body p { margin: 0; }
  .env-addr { font-size: 14pt; margin-left: 3mm !important; }
  .env-addr2 { font-size: 12pt; padding-top: 18mm; margin-left: 8mm !important; }
  .env-corp { font-size: 13pt; padding-top: 30mm; margin-left: 2mm !important; }
  .env-name { font-size: 21pt; padding-top: 24mm; letter-spacing: .12em; margin-left: 4mm !important; }
  .env-hon { padding-top: 6mm; display: inline-block; }
  .env-person { font-size: 17pt; padding-top: 50mm; letter-spacing: .1em; }
  .env-dept { font-size: 12pt; padding-top: 50mm; }
  /* 新規依頼の確認用紙 */
  .intake-sheet h2 { text-align: center; font-size: 16pt; }
  .intake-sheet table th { width: 26mm; background: #f2f2f2; }
  .intake-sheet td.fill { min-height: 9mm; height: 9mm; }
  .intake-sheet td.tall { height: 24mm; vertical-align: top; }
  .intake-sheet .circle { border: 1.5px solid #000; border-radius: 50%; padding: 0 3px; font-weight: 400; }
}
table.mini td:first-child { white-space: nowrap; }
.rows th { white-space: nowrap; }
.rows td select { min-width: 96px; }
.rows td input:not([type=checkbox]) { min-width: 84px; }
.rows td input[type=date], .rows td input[type=time] { min-width: 130px; }
.panel { overflow-x: auto; }
table.rece { min-width: 1350px; }
table.rece td:first-child { white-space: nowrap; }
table.rece th { white-space: nowrap; }

/* ===== 3回目の打ち合わせ（10/16） ===== */
.tag.t-first { background: #ffe7cc; border-color: #d9822b; color: #8a4b0f; font-weight: 700; }
.tag.stop-hard { background: #c0392b; border-color: #c0392b; color: #fff; font-weight: 700; }
.tag.stop-wait { background: #f6c343; border-color: #c99a14; color: #4a3600; font-weight: 700; }
.tag.stop-other { background: #8a96a3; border-color: #8a96a3; color: #fff; font-weight: 700; }
.confirm-bar { display: inline-flex; align-items: center; gap: 8px; padding: 4px 10px; border-radius: 10px; border: 1px solid var(--line); background: #fff; }
.confirm-bar.ok { border-color: #4c9a4c; background: #eef8ee; }
.confirm-bar.ng { border-color: #d9822b; background: #fff6ea; }
.confirm-bar b { font-size: 14px; }
.palette { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.palette button { padding: 4px 10px; font-size: 13px; }
.palette button.on { outline: 3px solid var(--brand); }
.shift td.k-日勤 { background: #d9efd9; } .shift td.k-公休 { background: #f5d8d6; font-weight: 700; }
.shift td.k-有給 { background: #f0c7e8; font-weight: 700; } .shift td.k-特休 { background: #e3d4f7; font-weight: 700; }
.shift td.k-欠勤 { background: #c9c9c9; font-weight: 700; } .shift td.k-午前, .shift td.k-午後 { background: #fbf0bf; }
.shift td.k-オンコール { background: #cfe3fb; font-weight: 700; } .shift td.k-出張 { background: #d6f1ef; }
table.rece td.memo { min-width: 260px; }
table.rece textarea.memo-in { width: 100%; min-width: 240px; min-height: 52px; font-size: 12.5px; }
table.rece input.yen { width: 84px; text-align: right; }
table.rece .grp { background: #f6fbfe; }
@media print {
  table.docsheet .ck { min-width: 22mm; height: 9mm; }
  table.rece-print td, table.rece-print th { font-size: 8.5pt; padding: 2px 3px; vertical-align: top; }
  table.rece.rece-print td.medfee { min-width: 0; width: 40mm; }
  table.rece-print td.memo { min-width: 0; width: 60mm; }
  table.rece-print .pf { display: flex; align-items: flex-end; gap: 1mm; height: 6.5mm; white-space: nowrap; }
  table.rece-print .wbox { display: inline-block; width: 24mm; height: 5.5mm; line-height: 5.5mm; border-bottom: 0.3mm solid #555; padding: 0 1mm; }
  table.rece-print .wbox.r { text-align: right; }
  table.rece-print .pl { display: inline-block; width: 9mm; }
}
table.rece tr.stopped td { background: #fdf1f0; }
table.rece td:nth-child(3) { white-space: nowrap; }
table.rece td:nth-child(12) { min-width: 250px; white-space: nowrap; }
table.rece { min-width: 1500px; }
@media print {
  /* 長3封筒（横書き。ロゴ入りの封筒の上に宛名だけ印刷する） */
  .envh { width: 120mm; height: 235mm; position: relative; page-break-after: always; overflow: hidden; font-family: "Hiragino Sans", sans-serif; }
  .envh:last-child { page-break-after: auto; }
  .eh-zip { position: absolute; top: 24mm; left: 12mm; font-size: 13pt; letter-spacing: .05em; }
  .eh-addr { position: absolute; top: 33mm; left: 12mm; right: 10mm; font-size: 12pt; line-height: 1.5; }
  .eh-addr2 { position: absolute; top: 41mm; left: 22mm; right: 10mm; font-size: 11pt; }
  .eh-who { position: absolute; top: 70mm; left: 10mm; right: 10mm; text-align: center; }
  .eh-corp { font-size: 12pt; margin-bottom: 2mm; }
  .eh-name { font-size: 18pt; font-weight: 600; letter-spacing: .08em; line-height: 1.5; }
  .eh-person { font-size: 15pt; margin-top: 2mm; }
  .eh-dept { font-size: 11pt; margin-top: 3mm; }
  .eh-note { font-size: 12pt; margin-top: 5mm; }
  .eh-extra { font-size: 10.5pt; margin-top: 5mm; text-align: left; border: 1px solid #000; padding: 2mm 3mm; }
}
@media print {
  .letter2 .l-to { font-weight: 700; font-size: 13pt; }
  .letter2 .l-dr.u { text-decoration: underline; font-weight: 700; }
  .letter2 .l-who { text-align: center; margin-left: 0; font-weight: 700; font-size: 13pt; }
  .letter2 .l-kind { text-align: center; margin-left: 0; }
  .letter2 .l-content { text-align: center; margin-top: 8mm; }
  .letter2 .l-date2 { text-align: center; margin-left: 0; margin-top: 10mm; font-weight: 700; font-size: 13pt; }
}
/* 計画書・報告書：色（特指示＝赤・リハのみ＝緑・生保＝灰） */
.docs-tb tr.dr-seiho td { background: #eceff2; }
.docs-tb tr.dr-tokki td.nm { box-shadow: inset 5px 0 0 #d9534f; }
.docs-tb tr.dr-rehab td.nm { box-shadow: inset 5px 0 0 #6aa84f; }
.tag.dr-tokki-tag { background: #f4c7c3; border-color: #d9534f; } .tag.dr-rehab-tag { background: #cfe8c4; border-color: #6aa84f; }
.tag.dr-seiho-tag { background: #dfe3e8; border-color: #9aa3ad; }
@media print {
  table.docsheet th, table.docsheet td { font-size: 10pt; padding: 3px 5px; }
  table.docsheet .nm { min-width: 30mm; white-space: nowrap; }
  table.docsheet .ck { width: 17mm; min-width: 17mm; height: 8mm; text-align: center; }
  table.docsheet td.memo { width: 40mm; font-size: 8.5pt; }
  table.docsheet .slash { background: linear-gradient(to bottom right, transparent calc(50% - .6px), #000 50%, transparent calc(50% + .6px)); }
  table.docsheet .p-none { background: #555 !important; }
  table.docsheet .p-proxy { background: #ddd; font-size: 9pt; }
  .p-tokki { background: #e74c3c !important; color: #fff; }
  .p-rehab { background: #a9d18e !important; }
  tr.p-seiho td { background: #d9d9d9; }
  .p-legend { font-size: 9pt; margin-top: 3mm; }
  .p-legend span { display: inline-block; width: 10mm; border: 1px solid #999; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
/* 1週間のスケジュール */
.wwrap { max-height: calc(100vh - 230px); }
table.wsheet { border-collapse: collapse; width: max-content; background: #fff; }
table.wsheet th, table.wsheet td { border: 1px solid #c9d3dc; padding: 0 2px; font-size: 11px; line-height: 1.2; height: 15px; }
table.wsheet .w-day { background: #dbeaf6; text-align: center; font-size: 12px; position: sticky; top: 0; z-index: 2; }
table.wsheet .w-day.we { color: var(--danger); }
table.wsheet .w-st { background: #eef5fb; min-width: 46px; max-width: 56px; text-align: center; font-weight: 600; position: sticky; top: 22px; z-index: 2; }
table.wsheet .w-time { background: #f4f7fa; white-space: nowrap; font-weight: 400; color: var(--sub); position: sticky; left: 0; z-index: 1; }
table.wsheet tr.w-hour td, table.wsheet tr.w-hour th { border-top: 1.5px solid #8fa3b5; }
table.wsheet .w-dayend { border-right: 2.5px solid #4f6b84; }
table.wsheet td.w-off, table.wsheet th.w-off { background: #bfc4c9; color: #555; }
table.wsheet td.w-cx, table.wsheet th.w-cx { background: #8d939a; color: #fff; }
table.wsheet td.w-v { vertical-align: top; text-align: center; border: 1.5px solid #6a7b8a; }
table.wsheet td.w-v b { display: block; font-size: 11px; }
table.wsheet td.w-v small { display: block; font-size: 9px; }
table.wsheet td.w-v i { font-style: normal; font-size: 9px; display: block; }
table.wsheet td.t-介護 { background: #8fc35a; } table.wsheet td.t-精神 { background: #4f8fd6; color: #fff; }
table.wsheet td.t-医療, table.wsheet td.t-特別指示 { background: #e2543f; color: #fff; } table.wsheet td.t-new { background: #f5e33b; }
table.wsheet td.w-cancel { background: repeating-linear-gradient(135deg, #e2543f, #e2543f 4px, #f4b1a6 4px, #f4b1a6 8px); color: #fff; }
table.wsheet td.w-un { background: #fff; outline: 2px dashed var(--danger); }
table.wsheet td.w-extra { border-style: dashed; }
table.wsheet td.w-warn { box-shadow: inset 0 0 0 2px #b3261e; }
.tag.w-cancel-tag { background: repeating-linear-gradient(135deg, #e2543f, #e2543f 4px, #f4b1a6 4px, #f4b1a6 8px); color: #fff; border-color: #e2543f; }
table.wnotes { margin-top: 10px; width: auto; } table.wnotes td { font-size: 12px; padding: 2px 10px; border: 1px solid #ccc; }
@media print {
  table.wsheet th, table.wsheet td { font-size: 6.3pt !important; height: 3.6mm; padding: 0 1px; border: .4pt solid #888 !important; }
  table.wsheet td.w-v b { font-size: 6.5pt; } table.wsheet td.w-v small, table.wsheet td.w-v i { font-size: 5pt; }
  table.wsheet .w-st { min-width: 0; max-width: none; position: static; } table.wsheet .w-day, table.wsheet .w-time { position: static; }
  table.wsheet { width: 100%; table-layout: fixed; }
  table.wsheet .w-dayend { border-right: 1.5pt solid #000 !important; }
  .w-title { margin: 0 0 2mm; font-size: 11pt; }
  table.wnotes td { font-size: 8pt; padding: 1px 6px; }
}
@media print {
  .screen-print .tablewrap { max-height: none !important; overflow: visible !important; border: none; }
  .screen-print table { min-width: 0 !important; }
}

/* ===== 入力欄の形をそろえる（幅・高さ・はみ出し） ===== */
input, select, textarea, button { box-sizing: border-box; font-family: inherit; }
input:not([type=checkbox]):not([type=radio]):not([type=file]), select {
  height: 38px; line-height: 1.2; padding: 0 10px; font-size: 15px; vertical-align: middle;
}
select { appearance: none; -webkit-appearance: none; padding-right: 30px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%2364748b' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right 10px center; }
input[type=date], input[type=time], input[type=month], input[type=datetime-local] { padding-right: 6px; }
input[type=date]::-webkit-date-and-time-value, input[type=time]::-webkit-date-and-time-value, input[type=month]::-webkit-date-and-time-value { text-align: left; }
textarea { padding: 8px 10px; font-size: 15px; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(10, 132, 246, .15); }
.form { align-items: end; }
.form > label, .form > span > label { min-width: 0; }
.form label > input:not([type=checkbox]), .form label > select, .form label > textarea { width: 100%; min-width: 0; }
.form label.check { height: 38px; align-self: end; }
.form label > span { min-width: 0; }
.bar button, .bar .seg button { height: 34px; display: inline-flex; align-items: center; gap: 4px; }
.bar button.small, .bar .small { height: 30px; }
.bar input:not([type=checkbox]):not([type=file]), .bar select { height: 34px; font-size: 14px; }
.bar label { display: inline-flex; align-items: center; gap: 6px; }
.seg { align-items: stretch; }
button.small { height: 30px; padding: 0 10px; display: inline-flex; align-items: center; }
.rows td input:not([type=checkbox]), .rows td select { height: 34px; font-size: 14px; }
table td input:not([type=checkbox]), table td select { height: 32px; font-size: 13.5px; }
table.rece input.yen { height: 28px; }

/* ===== 表とカードを崩さない（全画面共通） ===== */
/* 表の中の文字は折り返さない（日付・名前・電話・見出し・ボタン）。長い文の列だけ .wrap / .memo で折り返す */
th, td { white-space: nowrap; }
td.wrap, td.memo, th.wrap, td.team { white-space: normal; }
button, .tag { white-space: nowrap; }
/* カードとパネルは中身をはみ出させない。表が広いときはその中で横にスクロール */
.card, .panel { min-width: 0; }
.card > table, .panel > table:not(.rows) { display: block; overflow-x: auto; max-width: 100%; }
.rows-wrap { overflow-x: auto; max-width: 100%; }
/* ホームのカードは同じ高さにそろえ、中身が多いときはカードの中でスクロール */
.cards.home { grid-auto-rows: 380px; align-items: stretch; }
.cards.home .card { display: flex; flex-direction: column; max-height: none; overflow: hidden; }
.cards.home .card > table, .cards.home .card > p { flex: 1; min-height: 0; overflow: auto; display: block; }
.cards.home .card .card-foot { margin-top: auto; padding-top: 8px; border-top: 1px solid var(--line); }
/* 出納帳の下の段 */
.cash-bottom { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; align-items: stretch; }
.cash-bottom .card { display: flex; flex-direction: column; }
@media (max-width: 900px) { .cash-bottom { grid-template-columns: 1fr; } }
/* 入力用の表（指示書・保険証・支援チーム・定期訪問・会議 など）は、列を枠の幅に合わせて割り振る */
table.rows { table-layout: fixed; width: 100%; }
table.rows td input:not([type=checkbox]), table.rows td select { width: 100%; min-width: 0; }
table.rows th:last-child:empty, table.rows td:last-child:has(> button[data-del]) { width: 44px; }
table.rows td { overflow: hidden; }
table.rows td.c { text-align: center; }
/* ホームのカードの中の表は、名前（1列目）以外は折り返してよい（横にはみ出さない） */
.cards.home table.mini { width: 100%; }
.cards.home table.mini td { white-space: normal; }
.cards.home table.mini td:first-child { white-space: nowrap; }
table.rows th:last-child:empty { width: 56px; }
table.rows td { overflow: visible; }
table.rows.svc { table-layout: auto; }
table.rows.svc th:first-child { width: 80px; } table.rows.svc td.c { width: 60px; }
.cards.home table.mini td:last-child { white-space: nowrap; }
@media print {
  /* 長3封筒（ロゴ入り）：郵便番号の赤い枠に1桁ずつ。下の差出人（約190mmから下）にはかからないようにする */
  .envh .eh-box { position: absolute; top: 12mm; width: 5.7mm; height: 8mm; line-height: 8mm; text-align: center;
    font-size: 15pt; font-family: "Hiragino Sans", sans-serif; }
  .envh .eh-addr { top: 30mm; }
  .envh .eh-addr2 { top: 38mm; }
  .envh .eh-who { top: 62mm; bottom: 50mm; overflow: hidden; }
}
/* 認定調査（特記事項）の行 */
.sv-row { display: grid; grid-template-columns: 150px minmax(0, 1fr) 116px; gap: 10px; align-items: start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.sv-code { display: grid; gap: 4px; }
.sv-code input { width: 100%; }
.sv-text textarea { width: 100%; min-height: 60px; }
.sv-text .chips { margin-top: 6px; }
.sv-ops { display: flex; gap: 4px; justify-content: flex-end; }
.chip { line-height: 1.4; }
button.chip { height: auto; min-height: 30px; white-space: normal; text-align: left; }
.side a { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shift td.k-遅出 { background: #ffd8a8; font-weight: 700; }
.sched .outmask { position: absolute; left: 0; right: 0; background: repeating-linear-gradient(45deg, #eef1f4, #eef1f4 5px, #f8fafb 5px, #f8fafb 10px); z-index: 0; }
.sched .v { z-index: 1; }
table.wsheet td.w-out { background: #e3e7eb; }
.sched .head b, .sched .head span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar .links { display: inline-flex; gap: 14px; white-space: nowrap; }
/* レセ：医療費確認は表の上で確認先と金額を入れる */
table.rece td.medfee select { height: 28px; width: 152px; font-size: 12.5px; padding: 0 6px; margin-bottom: 3px; }
table.rece td.medfee input.yen { width: 72px; height: 26px; min-height: 26px; padding: 0 6px; margin: 1px 0; }
table.rece td.medfee { line-height: 1.2; }

/* ---- ルート・地図 ---- */
a.btn { display: inline-block; border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; text-decoration: none; color: var(--ink); background: var(--panel); }
a.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
a.btn.primary:hover { background: var(--brand-navy); }
.ok { color: #2f7a2f; font-weight: 600; }
.route-people { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin-bottom: 12px; }
.route-people .chip { line-height: 1.5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.route-status { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; border: 1px solid var(--line); background: var(--sky-mist); border-radius: 10px; padding: 10px 14px; margin-bottom: 12px; font-size: 14px; }
.route-status .grow { flex: 1; }
.route-status.ok { border-color: #4c9a4c; background: #eef8ee; color: var(--ink); font-weight: normal; }
.route-status.warn { border-color: var(--danger); background: #fdf0ef; }
.route-wrap { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(320px, 1fr); gap: 14px; align-items: start; }
.route-map { height: calc(100vh - 290px); min-height: 420px; border: 1px solid var(--line); border-radius: 12px; background: #eef2f5; z-index: 0; }
.route-note { margin: 6px 2px 0; }
.route-nav { margin-bottom: 10px; }
.sim { padding: 12px 14px; }
.sim-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.sim-head .grow { flex: 1; }
.sim-clock { font-size: 26px; font-weight: 700; color: var(--brand-navy); font-variant-numeric: tabular-nums; }
.sim-ctl { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; align-items: end; }
.sim-ctl button { grid-column: 1 / -1; }
.sim-ctl label { display: flex; flex-direction: column; font-size: 12px; color: var(--sub); gap: 2px; }
.sim-ctl select { width: 100%; }
.sim-sum { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 10px 0; font-size: 14px; padding: 8px 10px; background: var(--sky-mist); border-radius: 8px; }
.sim-rows { list-style: none; margin: 0; padding: 0; max-height: calc(100vh - 470px); min-height: 200px; overflow: auto; font-size: 14px; }
.sim-rows li { padding: 6px 8px; border-radius: 8px; }
.sim-rows li.leg { color: var(--sub); font-size: 13px; padding: 2px 8px 2px 22px; }
.sim-rows li.visit { border: 1px solid var(--line); border-left-width: 5px; cursor: pointer; margin: 2px 0; }
.sim-rows li.visit.t-介護 { border-left-color: var(--kaigo-b); }
.sim-rows li.visit.t-精神 { border-left-color: var(--seishin-b); }
.sim-rows li.visit.t-医療, .sim-rows li.visit.t-特別指示 { border-left-color: var(--iryo-b); }
.sim-rows li.visit.late { background: #fdf0ef; }
.sim-rows li.now { box-shadow: 0 0 0 2px var(--brand); background: #e3f1fe; }
.sim-rows .tm { font-weight: 700; font-variant-numeric: tabular-nums; }
.sim-rows .num { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--brand-deep); color: #fff; font-size: 12px; margin-right: 6px; }
.sim-rows a.nav { float: right; font-size: 13px; }
.rt-pin { display: grid !important; place-items: center; border-radius: 50%; border: 2px solid #fff; color: #fff; font-weight: 700; font-size: 13px; box-shadow: 0 1px 4px rgba(0,0,0,.35); background: var(--kaigo-b); }
.rt-pin.t-精神 { background: var(--seishin-b); }
.rt-pin.t-医療, .rt-pin.t-特別指示 { background: var(--iryo-b); }
.rt-pin.base { background: var(--brand-navy); }
.rt-mover { font-size: 24px; line-height: 30px; text-align: center; filter: drop-shadow(0 1px 2px rgba(0,0,0,.4)); }
.sched .head .rc { display: block; font-size: 12px; margin-top: 2px; white-space: nowrap; }
.sched .head .rc a { text-decoration: none; }
.sched .head .rc span { display: inline; }
@media (max-width: 900px) {
  .route-wrap { grid-template-columns: 1fr; }
  .route-map { height: 50vh; min-height: 300px; }
  .sim-rows { max-height: none; }
}
@media print { .route-map, .sim-ctl, .route-nav { display: none; } }
/* ログインの見出しを1行に（「ととのい」「事務アプリ」が途中で折れない） */
.login-card h1 { white-space: nowrap; font-size: 28px; }
.login-card h1 small { white-space: nowrap; }
.gm-test { list-style: none; padding: 0; margin: 8px 0 0; font-size: 14px; }
.gm-test li { padding: 6px 0; border-bottom: 1px solid var(--line); font-weight: normal; }
.gm-test li > div { color: var(--ink); }
.gm-test li .muted { color: var(--sub); }
/* 取り込み：同じ方を選ぶ */
.merge-pick { margin-top: 6px; }
.merge-pick select { width: 100%; max-width: 560px; }
/* 利用者：指示書の履歴（カイポケの指示書タブと同じ並び） */
.inst-log { max-height: 360px; margin-bottom: 10px; }
.inst-log td { font-size: 13px; vertical-align: top; }
.inst-log td:first-child { white-space: nowrap; }
/* 取り込みの数字：6枚を3列×2段にそろえる */
.cards.import-cards { display: grid; grid-template-columns: repeat(3, 1fr); }
/* 取り込み：Excelのファイル選び（説明が長くても欄からはみ出さない） */
table.xl-files th { width: 46%; white-space: normal; }
table.xl-files th small { font-weight: normal; }
select.mode-sel { padding: 2px 6px; font-size: 14px; width: 8.5em; min-width: 8.5em; }
/* 勤務表：A〜D・AM・PM・勤務なし、オンコール（紙と同じく 青＝18:00〜9:00、緑＝9:00〜翌9:00） */
.shift td.k-A, .shift td.k-B, .shift td.k-C, .shift td.k-D { background: #fff; }
.shift td.k-C, .shift td.k-D, .shift td.k-B { font-weight: 700; }
.shift td.k-勤務なし { background: #f3f4f6; }
.shift td.oc-夜 { background: #b9c7dc !important; }
.shift td.oc-終日 { background: #c8d5b0 !important; }
.shift td.oc-セカンド { box-shadow: inset 0 0 0 2px #8a6bbf; }
.shift td sup { font-size: 9px; color: #6b4fa0; margin-left: 1px; }
.shift td.k-公休, .shift td.k-有給, .shift td.k-特休 { color: #c0392b; }
.palette.oc-pal button b { min-width: 2.2em; display: inline-block; }
/* 勤務表：31日＋集計が1440pxで横に収まるように詰める。狭い画面では横に動かしても名前の列は残す */
.shift td, .shift th { padding: 3px 2px; }
.shift td { min-width: 27px; }
.shift td.k-午前, .shift td.k-午後 { font-size: 11.5px; letter-spacing: -0.3px; }
.shift td.name, .shift thead th:first-child { position: sticky; left: 0; z-index: 2; background: var(--panel, #fff); box-shadow: 1px 0 0 var(--line); }
.shift thead th:first-child { z-index: 3; }
