/* =====================================================================
   Pan-a-Care StaffBook — Warm Design System
   基調: パステルオレンジ × アイボリー　温かく・読みやすく・現場に優しく
   ===================================================================== */

/* ---------- Design Tokens ---------- */
:root {
  --font:          "UD Digi Kyokasho NK-R", "UD デジタル 教科書体 NK-R",
                   "BIZ UDPGothic", "BIZ UDP Gothic", "游ゴシック", "Yu Gothic",
                   "Hiragino Sans", sans-serif;
  --font-size-base: 15px;

  /* palette */
  --clr-bg:        #FFFBF5;   /* アイボリー背景 */
  --clr-bg-alt:    #FFF4E6;   /* ヘッダー・セクション背景 */
  --clr-surface:   #FFFFFF;   /* カード面 */
  --clr-border:    #F0D5B0;   /* 柔らかいオレンジ系ボーダー */
  --clr-stripe:    #FFF8F0;   /* テーブル縞 */

  --clr-primary:   #E07228;   /* メインオレンジ */
  --clr-primary-h: #C45E18;   /* ホバー */
  --clr-primary-lt:#FFE4C4;   /* 淡いオレンジ（バッジ等） */
  --clr-accent:    #F5A05A;   /* アクセント */

  --clr-text:      #3A2210;   /* 主テキスト（暖色ダーク） */
  --clr-muted:     #8C6644;   /* サブテキスト */
  --clr-link:      #C05A10;   /* リンク */
  --clr-link-h:    #8B3D06;

  --clr-success:   #5A9E6A;
  --clr-danger:    #C0443A;

  /* radius */
  --r-card:  14px;
  --r-input:  8px;
  --r-btn:    8px;
  --r-badge:  6px;

  /* shadow */
  --shadow-card: 0 2px 10px rgba(200, 100, 30, 0.10), 0 1px 3px rgba(200, 100, 30, 0.06);
  --shadow-btn:  0 1px 4px rgba(200, 100, 30, 0.18);
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { font-size: var(--font-size-base); }

body {
  font-family: var(--font);
  background: var(--clr-bg);
  color: var(--clr-text);
  margin: 0;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--clr-link);
  text-decoration: none;
}
a:hover { color: var(--clr-link-h); text-decoration: underline; }

h1, h2, h3, h4 {
  font-family: var(--font);
  font-weight: bold;
  color: var(--clr-text);
  margin: 0 0 .5em;
  line-height: 1.35;
}
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }

/* ---------- Layout ---------- */
.wrap {
  max-width: 1160px;
  margin: 0 auto;
  padding: 18px 22px;
}

.row   { display: grid; grid-template-columns: 1fr 1fr;       gap: 16px; }
.grid  { display: grid; grid-template-columns: 1fr 1fr;       gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; }

@media (max-width: 680px) {
  .row, .grid, .grid3 { grid-template-columns: 1fr; }
}

/* ---------- Staff detail page layout ---------- */
body.staff-detail header .wrap,
body.staff-detail main.wrap {
  max-width: 1320px;
  margin-left: auto;
  margin-right: auto;
}

body.staff-detail main.wrap {
  padding-left: 20px;
  padding-right: 20px;
}

/* 2列グリッド内でカードが子の最小幅ではみ出さないように */
.row-staff-primary > .card,
.row-staff-secondary > .card {
  min-width: 0;
}

/* 雇用×住所：住所カードをやや広く、上端揃え */
.row-staff-primary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.18fr);
  gap: 20px 24px;
  align-items: start;
}

/* 資格×従事可・緊急×勤務条件：均等＋余白 */
.row-staff-secondary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px 24px;
  align-items: start;
}

@media (max-width: 960px) {
  .row-staff-primary,
  .row-staff-secondary {
    grid-template-columns: 1fr;
  }
}

/* 住所/連絡先履歴（項目を段ごと） */
.address-history-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.address-history-block {
  border: 1px solid var(--clr-border);
  border-radius: 10px;
  background: var(--clr-stripe);
  padding: 12px 14px;
}

.address-history-kv {
  display: grid;
  grid-template-columns: 7.5em minmax(0, 1fr);
  gap: 10px 12px;
  font-size: 13.5px;
  line-height: 1.6;
  padding: 5px 0;
  border-bottom: 1px solid rgba(240, 213, 176, 0.65);
}
.address-history-kv:last-child {
  border-bottom: none;
  padding-bottom: 0;
}
.address-history-kv:first-child {
  padding-top: 0;
}

.address-history-kv__label {
  color: var(--clr-muted);
  font-weight: bold;
  font-size: 12.5px;
}

.address-history-kv__value {
  color: var(--clr-text);
  word-break: break-word;
  overflow-wrap: anywhere;
}

@media (max-width: 480px) {
  .address-history-kv {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}

/* ---------- Header / Nav ---------- */
header {
  background: var(--clr-bg-alt);
  border-bottom: 2px solid var(--clr-border);
  position: sticky; top: 0; z-index: 100;
}
header .wrap { padding-top: 10px; padding-bottom: 10px; }

.site-header__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
}
.site-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--clr-primary);
}
.site-brand:hover {
  text-decoration: none;
  color: var(--clr-primary-h);
}
.site-brand__logo {
  border-radius: 10px;
  object-fit: contain;
  box-shadow: 0 1px 4px rgba(200, 100, 30, 0.12);
}
.site-header__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.site-brand__text {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}
/* 職員管理サブメニュー（検索 / 一覧 / 新規登録） */
.staff-hub-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  font-size: 14px;
}
.staff-hub-nav__item {
  font-weight: 700;
  color: var(--clr-primary);
  text-decoration: none;
  padding: 4px 2px;
  border-bottom: 2px solid transparent;
}
.staff-hub-nav__item:hover {
  text-decoration: none;
  border-bottom-color: var(--clr-primary-h);
  color: var(--clr-primary-h);
}
.staff-hub-nav__item--current {
  border-bottom-color: var(--clr-primary);
  pointer-events: none;
  color: var(--clr-text);
}
.staff-hub-nav__sep {
  color: var(--clr-border);
  user-select: none;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.nav-home {
  font-size: 15px !important;
  font-weight: 800 !important;
  color: var(--clr-primary) !important;
  letter-spacing: .04em;
}
.nav-sep {
  color: var(--clr-border);
  font-size: 18px;
  margin: 0 2px;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  padding: 5px 14px;
  border-radius: var(--r-btn);
  font-size: 13.5px;
  font-weight: bold;
  color: var(--clr-primary);
  border: 1.5px solid var(--clr-primary);
  background: var(--clr-surface);
  transition: background .15s, color .15s;
}
.nav-link:hover {
  background: var(--clr-primary);
  color: #fff;
  text-decoration: none;
}
.nav-link.active {
  background: var(--clr-primary);
  color: #fff;
}

.site-name {
  font-size: 12px;
  color: var(--clr-muted);
  margin-top: 4px;
}

/* ---------- Cards ---------- */
.card {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--r-card);
  padding: 18px 20px;
  box-shadow: var(--shadow-card);
}
.card + .card { margin-top: 14px; }

.card-title {
  font-size: 1.05rem;
  font-weight: bold;
  color: var(--clr-text);
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 1.5px solid var(--clr-border);
}

/* ---------- Muted / Badge ---------- */
.muted {
  color: var(--clr-muted);
  font-size: 13px;
  line-height: 1.7;
}

.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: var(--r-badge);
  font-size: 12px;
  font-weight: bold;
  background: var(--clr-primary-lt);
  color: var(--clr-primary-h);
}
.badge-green {
  background: #D6F0DC;
  color: #2E7B40;
}
.badge-warn {
  background: #FFF0C0;
  color: #8B6000;
  cursor: help;
}
.badge-gray {
  background: #EDE8E0;
  color: #6B5A48;
}

/* ---------- Forms ---------- */
label {
  display: block;
  font-size: 13px;
  color: var(--clr-muted);
  margin-bottom: 4px;
  font-weight: bold;
}

input[type="text"],
input[type="date"],
input[type="number"],
input[type="email"],
input:not([type]),
select,
textarea {
  width: 100%;
  padding: 8px 11px;
  border-radius: var(--r-input);
  border: 1.5px solid var(--clr-border);
  background: var(--clr-bg);
  color: var(--clr-text);
  font-family: var(--font);
  font-size: 14px;
  transition: border-color .15s, box-shadow .15s;
  appearance: auto;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--clr-accent);
  box-shadow: 0 0 0 3px rgba(224,114,40,.15);
}

input[type="checkbox"] {
  width: auto;
  accent-color: var(--clr-primary);
  width: 18px; height: 18px;
  cursor: pointer;
  vertical-align: middle;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 20px;
  border-radius: var(--r-btn);
  border: 1.5px solid var(--clr-primary);
  background: var(--clr-primary);
  color: #fff;
  font-family: var(--font);
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: var(--shadow-btn);
  transition: background .15s, transform .1s;
  text-decoration: none;
}
.btn:hover {
  background: var(--clr-primary-h);
  border-color: var(--clr-primary-h);
  color: #fff;
  text-decoration: none;
  transform: translateY(-1px);
}
.btn:active { transform: translateY(0); }

.btn-outline {
  background: var(--clr-surface);
  color: var(--clr-primary);
}
.btn-outline:hover {
  background: var(--clr-primary-lt);
  color: var(--clr-primary-h);
}

.btn-sm {
  padding: 5px 12px;
  font-size: 13px;
}

/* keep <button> elements consistent */
button {
  display: inline-flex;
  align-items: center;
  padding: 8px 20px;
  border-radius: var(--r-btn);
  border: 1.5px solid var(--clr-primary);
  background: var(--clr-primary);
  color: #fff;
  font-family: var(--font);
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: var(--shadow-btn);
  transition: background .15s;
}
button:hover {
  background: var(--clr-primary-h);
  border-color: var(--clr-primary-h);
}

/* ---------- Tables ---------- */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
thead {
  background: var(--clr-bg-alt);
}
th {
  padding: 8px 10px;
  text-align: left;
  font-size: 12.5px;
  color: var(--clr-muted);
  font-weight: bold;
  border-bottom: 2px solid var(--clr-border);
}
td {
  padding: 9px 10px;
  border-bottom: 1px solid #F2E8DC;
  vertical-align: top;
  color: var(--clr-text);
}
tbody tr:nth-child(even) td { background: var(--clr-stripe); }
tbody tr:hover td { background: var(--clr-primary-lt); transition: background .12s; }

.tbl-name {
  font-weight: bold;
  font-size: 14.5px;
}
.tbl-kana {
  font-size: 12px;
  color: var(--clr-muted);
}

/* ---------- Actions row ---------- */
.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

/* ---------- Filter bar (list page) ---------- */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 14px;
}
.filter-bar select {
  width: auto;
  min-width: 160px;
  padding: 6px 10px;
}
.filter-label {
  font-size: 13px;
  font-weight: bold;
  color: var(--clr-muted);
  white-space: nowrap;
}

/* ---------- Print styles ---------- */
@media print {
  @page { size: A4 landscape; margin: 12mm 10mm; }

  /* <header> 一律非表示にすると帳票内の <header> まで消えるため .site-header のみ */
  .no-print, .site-header, .filter-bar, .actions, button, .btn { display: none !important; }

  body {
    background: #fff;
    color: #000;
    font-size: 10pt;
    font-family: var(--font);
  }

  .wrap { padding: 0; max-width: 100%; }

  .print-title {
    display: block !important;
    font-size: 14pt;
    font-weight: bold;
    text-align: center;
    margin-bottom: 6mm;
    color: #000;
  }

  table { font-size: 9pt; }
  th    { background: #EEE; color: #000; border-bottom: 1pt solid #999; padding: 4pt 6pt; }
  td    { padding: 4pt 6pt; border-bottom: .5pt solid #CCC; }
  tbody tr:nth-child(even) td { background: #F8F4EE; }
  tbody tr:hover td { background: transparent; }

  .card { border: none; box-shadow: none; padding: 0; }
}

/* hide print-title on screen */
.print-title { display: none; }

/* ---------- 支援計画 印刷プレビュー（画面） ---------- */
.support-plan-print {
  max-width: 720px;
  margin: 0 auto;
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--r-card);
  padding: 20px 24px 28px;
  box-shadow: var(--shadow-card);
}
.support-plan-print__header {
  border-bottom: 2px solid var(--clr-border);
  padding-bottom: 12px;
  margin-bottom: 16px;
}
.support-plan-print__title {
  font-size: 1.2rem;
  margin: 0 0 8px;
}
.support-plan-print__meta {
  font-size: 13px;
  margin: 0;
  line-height: 1.6;
  color: var(--clr-text);
}
.support-plan-print__section {
  margin-top: 18px;
  page-break-inside: avoid;
}
.support-plan-print__section h2 {
  font-size: 1.02rem;
  border-left: 4px solid var(--clr-primary);
  padding-left: 8px;
  margin: 0 0 8px;
}
.support-plan-print__h3 {
  font-size: 0.95rem;
  margin: 10px 0 4px;
  color: var(--clr-primary-h);
}
.support-plan-print__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.support-plan-print__table th,
.support-plan-print__table td {
  border: 1px solid #ccc;
  padding: 6px 8px;
  vertical-align: top;
}
.support-plan-print__table th { background: #f5f0e8; }
.support-plan-print__small { font-size: 12px; color: var(--clr-muted); margin: 0; }
.support-plan-print__warn { color: #8b2b1f; font-size: 12px; margin: 6px 0 0; }
.support-plan-print__ol { font-size: 12.5px; margin: 0; padding-left: 1.2em; }

.support-plan-print__anno {
  font-size: 11.5px;
  color: var(--clr-muted);
  margin: 0 0 10px;
  line-height: 1.5;
}
.sp-sheet { page-break-inside: avoid; }
.sp-subh {
  font-size: 0.95rem;
  margin: 14px 0 6px;
  color: var(--clr-text);
  border-bottom: 1px dashed var(--clr-border);
  padding-bottom: 4px;
}
.sp-block {
  font-size: 12.5px;
  line-height: 1.65;
  white-space: pre-wrap;
  min-height: 1.2em;
  margin: 0 0 8px;
}
.sp-grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 14px;
  margin-bottom: 10px;
}
@media (max-width: 560px) {
  .sp-grid2 { grid-template-columns: 1fr; }
}
.sp-field--wide { grid-column: 1 / -1; }
.sp-label {
  display: block;
  font-size: 11px;
  color: var(--clr-muted);
  font-weight: bold;
  margin-bottom: 2px;
}
.sp-val {
  border: 1px solid var(--clr-border);
  border-radius: 6px;
  padding: 6px 8px;
  min-height: 1.5em;
  background: #fff;
  font-size: 12.5px;
}
table.sp-needs th { font-size: 10.5px; vertical-align: bottom; }
table.sp-needs td { font-size: 10.5px; }
.sp-metafoot { opacity: 0.9; }

/* ---------- 支援計画 帳票（Excel 風・印刷向け） ---------- */
.support-plan-print.support-plan-print--excel {
  max-width: none;
  width: 100%;
  margin: 0 auto;
  padding: 16px 12px 32px;
  background: #d0d0d0;
  border: none;
  border-radius: 0;
  box-shadow: none;
  font-family: "Yu Gothic UI", "YuGothic", "Meiryo UI", Meiryo, "MS PGothic", sans-serif;
  color: #111;
}
.support-plan-print--excel .support-plan-print__sheet {
  max-width: 210mm;
  margin: 0 auto;
  padding: 10mm 12mm 12mm;
  background: #fff;
  border: 1px solid #5a5a5a;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  box-sizing: border-box;
}
.support-plan-print--excel .support-plan-print__header--excel {
  border-bottom: 2px solid #000;
  padding-bottom: 6px;
  margin-bottom: 6px;
}
.support-plan-print--excel .support-plan-print__title--excel {
  font-size: 12.5pt;
  font-weight: 700;
  text-align: center;
  margin: 0 0 6px;
  padding: 6px 8px;
  border: 1.5px solid #000;
  background: #fff;
  line-height: 1.4;
  letter-spacing: 0.02em;
}
.support-plan-print--excel .support-plan-print__meta {
  font-size: 9.5pt;
  margin: 0;
  text-align: center;
  color: #111;
  line-height: 1.5;
}
.support-plan-print--excel .support-plan-print__section {
  margin-top: 6px;
  page-break-inside: avoid;
}
.support-plan-print--excel .support-plan-print__section:first-of-type {
  margin-top: 0;
}
/* 大見出し = 帳票の帯（Excel「行全体に塗り」に近い） */
.support-plan-print--excel .support-plan-print__section > h2 {
  font-size: 10.5pt;
  font-weight: 700;
  margin: 0 0 0;
  padding: 4px 8px;
  background: #d9d9d9;
  border: 1px solid #000;
  border-bottom: 1px solid #000;
  color: #000;
  line-height: 1.35;
  page-break-after: avoid;
}
.support-plan-print--excel .sp-sheet > h2 {
  border-top: 1px solid #000;
}
.support-plan-print--excel .support-plan-print__anno {
  font-size: 8.5pt;
  color: #333;
  margin: 0 0 0;
  padding: 3px 6px;
  background: #f7f7f7;
  border: 1px solid #b0b0b0;
  line-height: 1.45;
  border-bottom: 1px solid #000;
}
.support-plan-print--excel .support-plan-print__section > h2 + .support-plan-print__anno {
  margin-top: 0;
}
.support-plan-print--excel .sp-excel-blockgroup {
  border: 1.5px solid #000;
  border-top: 0;
  margin: 0 0 4px;
  background: #fff;
}
.support-plan-print--excel .support-plan-print__anno + .sp-excel-blockgroup {
  margin-top: 0;
}
.support-plan-print--excel .sp-excel-blockgroup .sp-grid2--in-group,
.support-plan-print--excel .sp-excel-blockgroup .sp-grid2 {
  border: none;
  margin: 0;
  border-bottom: 1px solid #000;
}
.support-plan-print--excel .sp-excel-blockgroup .sp-excel-stack {
  border: 0;
  margin: 0;
}
.support-plan-print--excel .support-plan-print__section > h2 + .sp-excel-stack {
  margin-top: 0;
  border-top: 0;
}
.support-plan-print--excel .support-plan-print__anno + .sp-excel-stack {
  margin-top: 0;
  border-top: 0;
}
.support-plan-print--excel .sp-excel-stack > .sp-excel-inner-table--first {
  border-top: 0;
}
/* 帳票スタック: 小見出し＋文＋表を1つの罫内で隙間ゼロ */
.support-plan-print--excel .sp-excel-stack {
  border: 1.5px solid #000;
  margin: 0 0 4px;
  background: #fff;
  box-sizing: border-box;
}
.support-plan-print--excel .sp-excel-stack > .sp-subh {
  margin: 0;
  border: 0;
  border-radius: 0;
  border-top: 0;
  border-bottom: 1px solid #000;
  border-left: 4px solid #333;
  padding: 2px 6px;
  background: #e8e8e8;
  font-size: 9.5pt;
  font-weight: 600;
  line-height: 1.4;
  color: #000;
}
.support-plan-print--excel .sp-excel-stack > .sp-block--stacked {
  margin: 0;
  border: 0;
  border-bottom: 1px solid #000;
  border-radius: 0;
  min-height: 1.1em;
  padding: 3px 6px;
  line-height: 1.5;
  background: #fff;
  color: #000;
  font-size: 9.5pt;
}
.support-plan-print--excel .sp-excel-stack > .sp-excel-table-wrap,
.support-plan-print--excel .sp-excel-stack > .sp-excel-inner-table {
  margin: 0;
  border: 0;
  border-bottom: 1px solid #000;
}
.support-plan-print--excel .sp-excel-stack > .sp-excel-goals,
.support-plan-print--excel .sp-excel-stack > .sp-excel-plangroup,
.support-plan-print--excel .sp-excel-stack > .support-plan-print__ol--in-stack {
  margin: 0;
  border: 0;
  border-bottom: 1px solid #000;
}
.support-plan-print--excel .sp-excel-stack > *:last-child {
  border-bottom: 0 !important;
}
/* 長期／短期: ラベル列＋枠 */
.support-plan-print--excel .sp-excel-goals {
  display: table;
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  background: #fff;
}
.support-plan-print--excel .sp-excel-goal-row {
  display: table-row;
}
.support-plan-print--excel .sp-excel-goal-lbl {
  display: table-cell;
  width: 3.4em;
  max-width: 3.4em;
  box-sizing: border-box;
  padding: 3px 4px;
  font-size: 8.5pt;
  font-weight: 700;
  text-align: center;
  vertical-align: top;
  color: #000;
  background: #d9d9d9;
  border: 0;
  border-top: 1px solid #000;
  border-right: 1px solid #000;
  border-left: 0;
  line-height: 1.3;
}
.support-plan-print--excel .sp-excel-goal-row:first-child .sp-excel-goal-lbl {
  border-top: 0;
}
.support-plan-print--excel .sp-excel-goal-val {
  display: table-cell;
  padding: 3px 6px;
  font-size: 9.5pt;
  line-height: 1.5;
  color: #000;
  background: #fff;
  border: 0;
  border-top: 1px solid #000;
  vertical-align: top;
  word-break: break-word;
}
.support-plan-print--excel .sp-excel-goal-row:first-child .sp-excel-goal-val {
  border-top: 0;
}
/* スタック内の表（内側は外枠なし。親スタックの罫に含める） */
.support-plan-print--excel .sp-excel-inner-table {
  width: 100%;
  border: none;
  border-collapse: collapse;
  font-size: 9pt;
  table-layout: fixed;
}
.support-plan-print--excel .sp-excel-inner-table th,
.support-plan-print--excel .sp-excel-inner-table td {
  border: 1px solid #000;
  background: #fff;
}
.support-plan-print--excel .sp-excel-inner-table th {
  background: #d9d9d9;
  font-size: 8.5pt;
}
/* needs 表: 枠二重を避け（親スタックが外枠） */
.support-plan-print--excel .sp-excel-table-wrap .sp-needs,
.support-plan-print--excel .sp-excel-stack .sp-needs {
  width: 100%;
  border: none;
  margin: 0;
}
/* plan_text 縦積み */
.support-plan-print--excel .sp-excel-plangroup {
  display: block;
  margin: 0;
  padding: 0;
  background: #fff;
}
.support-plan-print--excel .sp-excel-plangroup .support-plan-print__block--in-stack {
  margin: 0;
  border: 0;
  border-top: 1px solid #000;
  border-radius: 0;
  background: #fff;
}
.support-plan-print--excel .sp-excel-plangroup .support-plan-print__block--in-stack:first-child {
  border-top: 0;
}
.support-plan-print--excel .sp-excel-plangroup .support-plan-print__h3 {
  border: 0;
  border-bottom: 1px solid #000;
  background: #e8e8e8;
}
/* 箇条書き: 上の要素と一続き */
.support-plan-print--excel .support-plan-print__ol--in-stack {
  font-size: 9pt;
  margin: 0;
  padding: 4px 6px 4px 1.3em;
  background: #fff;
  border: 0;
  list-style-position: outside;
  line-height: 1.45;
}
.support-plan-print--excel .sp-block--empty-note {
  font-size: 9pt;
  color: #555;
}
.support-plan-print--excel .sp-block--meta-small {
  font-size: 8.5pt;
  line-height: 1.5;
  color: #333;
}
.support-plan-print--excel .support-plan-print__anno code {
  font-size: 8pt;
  border-radius: 0;
  border: 1px solid #aaa;
  background: #fff;
  padding: 0 3px;
}
/* 2 列ラベル＋値（罫线つきセル） */
.support-plan-print--excel .sp-grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  margin: 0 0 6px;
  border: 1.5px solid #000;
  background: #fff;
}
.support-plan-print--excel .sp-field {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  border: 0 solid #000;
  border-width: 0 1px 1px 0;
  min-height: 1.5em;
  box-sizing: border-box;
}
.support-plan-print--excel .sp-field:nth-child(2n) { border-right-width: 0; }
.support-plan-print--excel .sp-field--wide {
  grid-column: 1 / -1;
  border-right-width: 0;
}
.support-plan-print--excel .sp-label {
  display: flex;
  align-items: center;
  flex: 0 0 6.4em;
  max-width: 6.4em;
  margin: 0;
  padding: 3px 4px;
  font-size: 8pt;
  font-weight: 600;
  color: #000;
  background: #d9d9d9;
  border-right: 1px solid #000;
  line-height: 1.25;
}
.support-plan-print--excel .sp-val {
  flex: 1;
  margin: 0;
  min-height: 1.3em;
  padding: 3px 5px;
  font-size: 9.5pt;
  color: #000;
  background: #fff;
  border: none;
  border-radius: 0;
  line-height: 1.4;
  word-break: break-word;
}
/* スタック外に孤立した .sp-block のみ（保険） */
.support-plan-print--excel .sp-block:not(.sp-block--stacked) {
  font-size: 9.5pt;
  line-height: 1.55;
  margin: 0 0 4px;
  padding: 5px 7px;
  min-height: 2.2em;
  background: #fff;
  border: 1px solid #000;
  color: #000;
  white-space: pre-wrap;
}
/* 表 = 罫線全面・ヘッダ灰 */
.support-plan-print--excel .support-plan-print__table {
  width: 100%;
  font-size: 9pt;
  border-collapse: collapse;
  border: 1.5px solid #000;
  table-layout: fixed;
}
.support-plan-print--excel .support-plan-print__table th,
.support-plan-print--excel .support-plan-print__table td {
  border: 1px solid #000;
  padding: 3px 5px;
  color: #000;
  background: #fff;
  word-wrap: break-word;
}
.support-plan-print--excel .support-plan-print__table th {
  background: #d9d9d9;
  font-weight: 600;
  text-align: center;
  vertical-align: middle;
}
.support-plan-print--excel table.sp-needs th { font-size: 8.5pt; }
.support-plan-print--excel table.sp-needs td { font-size: 8.5pt; }
.support-plan-print--excel .support-plan-print__ol {
  font-size: 9pt;
  border: 1px solid #000;
  padding: 6px 8px 6px 1.4em;
  margin: 4px 0 0;
  background: #fff;
}
/* plan_text ブロック（スタック外フォールバック） */
.support-plan-print--excel .support-plan-print__block:not(.support-plan-print__block--in-stack) {
  border: 1px solid #000;
  margin: 0 0 4px;
  background: #fff;
}
.support-plan-print--excel .support-plan-print__h3 {
  font-size: 8.5pt;
  font-weight: 600;
  margin: 0;
  padding: 2px 6px;
  background: #e8e8e8;
  border-bottom: 1px solid #000;
  color: #000;
}
.support-plan-print--excel .support-plan-print__body {
  padding: 4px 6px;
  font-size: 9.5pt;
  color: #000;
  margin: 0;
}
/* メタ枠 */
.support-plan-print--excel .sp-metafoot--sheet {
  margin-top: 12px;
  padding-top: 6px;
  border-top: 1px dashed #666;
  opacity: 1;
}
.support-plan-print--excel .sp-metafoot--sheet h2 {
  background: #f0f0f0;
  color: #444;
  font-size: 9.5pt;
  border: 1px solid #999;
}
.support-plan-print--excel .sp-metafoot--sheet .support-plan-print__small {
  font-size: 8pt;
  color: #555;
  margin: 4px 0 0;
}
/* 共通 print の tbody 縞を帳票表では上書き */
.support-plan-print--excel .support-plan-print__table tbody tr:nth-child(even) td {
  background: #fff;
}

@media print {
  body.support-plan-print-page {
    background: #fff;
  }
  body.support-plan-print-page .wrap {
    max-width: 100%;
    padding: 0;
  }
  .support-plan-print {
    max-width: 100%;
    border: none;
    box-shadow: none;
    padding: 0;
  }
  @page support_plan_portrait {
    size: A4 portrait;
    margin: 10mm 11mm 12mm;
  }
  /* 既定 @page（横）が残る他画面向け。支援計画は名前付きページで縦固定 */
  body.support-plan-print-page {
    page: support_plan_portrait;
  }
  body.support-plan-print-page .site-header { display: none !important; }
  body.support-plan-print-page main.wrap { max-width: 100% !important; }
  .support-plan-print.support-plan-print--excel {
    background: #fff;
    padding: 0;
  }
  .support-plan-print--excel .support-plan-print__sheet {
    max-width: none;
    width: 100%;
    border: none;
    box-shadow: none;
    padding: 0;
    margin: 0;
  }
  .support-plan-print--excel .sp-grid2 {
    break-inside: avoid;
  }
  .support-plan-print--excel table.sp-needs {
    break-inside: auto;
  }
  .support-plan-print--excel table.sp-needs tr {
    break-inside: avoid;
  }
}

/* ---------- 支援計画：週次グリッド（A3 横想定） ---------- */
body.support-plan-weekly-print-page .wrap {
  max-width: 100%;
}
.support-plan-weekly-print {
  background: #fff;
  color: #111;
  padding: 0 0 1rem;
}
.support-plan-weekly-print__head {
  margin: 0 0 0.4rem;
}
.support-plan-weekly-print__title {
  font-size: 1.05rem;
  margin: 0 0 0.2rem;
  font-weight: 700;
  color: #000;
}
.support-plan-weekly-print__meta {
  font-size: 11.5px;
  margin: 0 0 0.5rem;
  color: #333;
}
.support-plan-weekly__section {
  margin-top: 0.2rem;
}
.support-plan-weekly__h2 {
  font-size: 10pt;
  margin: 0 0 0.25rem;
  font-weight: 700;
}
.support-plan-weekly__sub {
  font-size: 7.5pt;
  line-height: 1.3;
  margin: 0 0 0.4rem;
  color: #333;
  white-space: pre-wrap;
}
.support-plan-weekly__table-wrap {
  overflow: auto;
  max-width: 100%;
}
.support-plan-weekly__grid {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 6.5pt;
  border: 1px solid #000;
  background: #fff;
}
.support-plan-weekly__grid th,
.support-plan-weekly__grid td {
  border: 1px solid #000;
  padding: 2px 3px;
  vertical-align: top;
  text-align: left;
  color: #000;
}
.support-plan-weekly__th-time {
  width: 2.2rem;
  background: #e8e8e8;
  font-size: 6.5pt;
  font-weight: 600;
}
.support-plan-weekly__th-day {
  background: #e8e8e8;
  font-size: 7.5pt;
  font-weight: 700;
  text-align: center;
}
.support-plan-weekly__timecell {
  background: #f3f3f3;
  font-size: 6.5pt;
  font-weight: 600;
  text-align: right;
  white-space: nowrap;
  width: 2.2rem;
}
.support-plan-weekly__daycell {
  min-height: 1.1rem;
  background: #fff;
}
.support-plan-weekly__line {
  line-height: 1.2;
  margin-bottom: 1px;
  word-wrap: break-word;
}
.support-plan-weekly__empty { display: inline-block; min-width: 1px; }
.support-plan-weekly__unplaced {
  margin-top: 0.5rem;
  font-size: 7.5pt;
  color: #5a1a0a;
}
.support-plan-weekly__h3,
.support-plan-weekly__ol {
  font-size: 7.5pt;
  margin: 0.3rem 0 0.2rem;
}
@media print {
  body.support-plan-weekly-print-page {
    page: support_plan_a3_ls;
  }
  @page support_plan_a3_ls {
    size: A3 landscape;
    margin: 5mm 7mm 6mm;
  }
  body.support-plan-weekly-print-page {
    background: #fff;
  }
  body.support-plan-weekly-print-page .wrap {
    max-width: 100% !important;
    padding: 0;
  }
  body.support-plan-weekly-print-page .site-header { display: none !important; }
  body.support-plan-weekly-print-page main.wrap { max-width: 100% !important; }
  .support-plan-weekly__table-wrap { overflow: visible; }
  .support-plan-weekly__timecell { color: #000; }
  .support-plan-weekly__th-day { color: #000; }
}
@media screen and (min-width: 900px) {
  body.support-plan-weekly-print-page .support-plan-weekly__grid {
    font-size: 7.5pt;
  }
  body.support-plan-weekly-print-page .support-plan-weekly__h2 {
    font-size: 11.5pt;
  }
}

/* ---------- Severe visit class admin ---------- */
.svc-class-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.svc-class-card {
  border: 1px solid var(--clr-border);
  border-radius: var(--r-card);
  background: var(--clr-surface);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.svc-class-card__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 8px 12px;
  background: var(--clr-bg-alt);
  border-bottom: 1px solid var(--clr-border);
}

.svc-class-card__name {
  margin: 0;
  font-size: 1.05rem;
  white-space: nowrap;
}

.svc-class-card__count {
  font-size: 13px;
  white-space: nowrap;
}

.svc-class-card__body {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1.35fr);
  gap: 0;
}

.svc-class-panel {
  padding: 8px 12px 10px;
  min-width: 0;
}

.svc-class-panel--status {
  border-right: 1px solid var(--clr-border);
  background: var(--clr-surface);
}

.svc-class-panel--form {
  background: #FFFCF8;
}

.svc-class-panel__title {
  margin: 0 0 6px;
  font-size: 0.82rem;
  color: var(--clr-muted);
  font-weight: bold;
  letter-spacing: 0.02em;
}

.svc-class-status-line {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  font-size: 13px;
  line-height: 1.4;
}

.svc-class-status-class {
  font-size: 14px;
}

.svc-class-sep {
  color: var(--clr-border);
  font-weight: normal;
  user-select: none;
}

.svc-class-note-line {
  margin: 4px 0 0;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--clr-text);
  word-break: break-word;
}

.svc-class-note-label {
  color: var(--clr-muted);
  font-weight: bold;
  margin-right: 4px;
}

.svc-class-empty {
  margin: 0;
  font-size: 13px;
  color: var(--clr-muted);
  line-height: 1.45;
}

.svc-class-reference {
  margin-left: 6px;
  font-size: 12.5px;
}

.svc-class-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.svc-class-form__row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 6px 10px;
}

.svc-class-form__row--note {
  align-items: flex-end;
}

.svc-class-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  min-width: 0;
}

.svc-class-field__label {
  font-size: 11px;
  font-weight: bold;
  color: var(--clr-muted);
  line-height: 1.2;
}

.svc-class-field--class select {
  width: 4.5rem;
  padding: 5px 8px;
  font-size: 13px;
}

.svc-class-field--date input {
  width: 10.5rem;
  padding: 5px 8px;
  font-size: 13px;
}

.svc-class-field--by input {
  width: 8.5rem;
  padding: 5px 8px;
  font-size: 13px;
}

.svc-class-field--note {
  flex: 1 1 12rem;
  min-width: 10rem;
}

.svc-class-field--note input {
  padding: 5px 8px;
  font-size: 13px;
}

.svc-class-form__submit {
  flex: 0 0 auto;
  margin-bottom: 1px;
  white-space: nowrap;
}

.svc-class-history {
  border-top: 1px solid var(--clr-border);
  background: var(--clr-bg);
  font-size: 12.5px;
}

.svc-class-history > summary {
  padding: 5px 12px;
  cursor: pointer;
  color: var(--clr-muted);
  font-weight: bold;
  list-style: none;
}

.svc-class-history > summary::-webkit-details-marker {
  display: none;
}

.svc-class-history > summary::before {
  content: "▸ ";
  display: inline-block;
  width: 1em;
}

.svc-class-history[open] > summary::before {
  content: "▾ ";
}

.svc-class-history__list {
  margin: 0;
  padding: 0 12px 8px;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.svc-class-history__line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  padding: 4px 8px;
  border-radius: var(--r-input);
  background: var(--clr-surface);
  border: 1px solid #F2E8DC;
  line-height: 1.4;
}

.svc-class-history__line--current {
  border-color: #A8D4B4;
  background: #F6FBF7;
}

.svc-class-history__tag {
  font-size: 11px;
  font-weight: bold;
  color: #2E7B40;
}

.svc-class-history__note {
  flex: 1 1 100%;
  color: var(--clr-muted);
  font-size: 12px;
  word-break: break-word;
}

@media (max-width: 820px) {
  .svc-class-card__body {
    grid-template-columns: 1fr;
  }
  .svc-class-panel--status {
    border-right: none;
    border-bottom: 1px solid var(--clr-border);
  }
  .svc-class-form__row--note {
    flex-direction: column;
    align-items: stretch;
  }
  .svc-class-form__submit {
    align-self: flex-end;
  }
  .svc-class-field--class select,
  .svc-class-field--date input,
  .svc-class-field--by input {
    width: 100%;
  }
}

/* ---------- Utility ---------- */
.mt8  { margin-top:  8px; }
.mt12 { margin-top: 12px; }
.mt16 { margin-top: 16px; }
.mt24 { margin-top: 24px; }
.mb8  { margin-bottom:  8px; }
.text-right { text-align: right; }
code {
  background: var(--clr-primary-lt);
  color: var(--clr-primary-h);
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 12.5px;
}
