:root {
  --ink:        #2b2a27;
  --ink-soft:   #5c5a55;
  --ink-mute:   #8a8680;
  --paper:      #fbf8f3;
  --paper-warm: #f5efe4;
  --line:       #d9d3c7;
  --line-soft:  #e8e3d7;
  --accent:     oklch(0.72 0.14 55);
  --accent-soft:oklch(0.92 0.06 70);
  --ok:         oklch(0.58 0.13 150);
  --ok-soft:    oklch(0.93 0.05 150);
  --warn:       oklch(0.65 0.14 80);
  --warn-soft:  oklch(0.94 0.06 85);
  --bad:        oklch(0.55 0.16 30);
  --bad-soft:   oklch(0.93 0.05 30);
  --sky:        oklch(0.65 0.08 240);
  --sky-soft:   oklch(0.94 0.04 240);
  /* v2デザインで追加。既存値は変更しない。 */
  --paper-deep: #efe7d6;
  --accent-deep:oklch(0.55 0.16 50);
  --radius:     10px;
  --radius-sm:  6px;
  --shadow-ink:  2px 2px 0 var(--ink);
  --shadow-soft: 2px 2px 0 rgba(43,42,39,.10);
  --sidebar: 220px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: "BIZ UDPGothic", "Noto Sans JP", "Yu Gothic UI", "Meiryo UI", "Hiragino Sans", sans-serif;
  background: var(--paper);
  color: var(--ink);
  display: flex;
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
}
.mono { font-family: "Consolas", "SF Mono", "Menlo", monospace; font-variant-numeric: tabular-nums; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ── ログイン ── */
.login-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: var(--paper);
  background-image:
    repeating-linear-gradient(90deg, rgba(217,211,199,.18) 0 1px, transparent 1px 60px),
    repeating-linear-gradient(0deg,  rgba(217,211,199,.18) 0 1px, transparent 1px 60px);
  display: flex; align-items: center; justify-content: center;
}
.login-box {
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 12px;
  box-shadow: 4px 4px 0 var(--ink);
  padding: 36px 32px;
  width: 380px;
}
.login-brand-logo {
  display: block;
  width: 180px;
  height: auto;
  margin: 0 auto 18px;
}
.login-box h2 { font-size: 20px; font-weight: 700; margin-bottom: 20px; text-align: center; }
.login-box .subtitle { font-size: 11px; color: var(--ink-mute); text-align: center; margin-bottom: 24px; }
.login-box label { color: var(--ink-mute); font-size: 11px; display: block; margin-bottom: 6px; letter-spacing: .5px; }
.login-box select, .login-box input[type=password] {
  width: 100%; padding: 10px 12px;
  border: 1.5px solid var(--ink); border-radius: 8px;
  background: #fff; color: var(--ink); font-size: 14px;
  margin-bottom: 16px; font-family: inherit;
}
.login-box select:focus, .login-box input:focus { outline: none; box-shadow: 2px 2px 0 var(--ink); }
.login-button {
  width: 100%; padding: 12px;
  background: var(--accent); color: #fff;
  border: 1.5px solid var(--ink); border-radius: 8px;
  box-shadow: 2px 2px 0 var(--ink);
  font-size: 15px; font-weight: 700; cursor: pointer; font-family: inherit;
}
.login-button:hover { transform: translate(-1px,-1px); box-shadow: 3px 3px 0 var(--ink); }
.login-error { color: var(--bad); font-size: 12px; text-align: center; margin-top: 10px; min-height: 16px; }

.app-notification-region {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 260;
  width: min(360px, calc(100vw - 40px));
}
.app-notification {
  border: 1.5px solid var(--ink);
  border-radius: 8px;
  background: #fff;
  box-shadow: 2px 2px 0 var(--ink);
  padding: 10px 12px;
  font-weight: 700;
  white-space: pre-line;
}
.app-notification--bad { color: var(--bad); background: var(--bad-soft); }
.app-notification--ok { color: var(--ok); background: var(--ok-soft); }
.app-notification--warn { color: var(--ink); background: var(--warn-soft); }

.confirm-bg {
  position: fixed;
  inset: 0;
  z-index: 250;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(43, 42, 39, .28);
  padding: 20px;
}
.confirm-bg.open { display: flex; }
.confirm-shell {
  width: min(420px, 100%);
  background: #fff;
  border: 1.5px solid var(--ink);
  border-radius: 8px;
  box-shadow: 3px 3px 0 var(--ink);
  padding: 18px;
}
.confirm-shell h3 { font-size: 16px; margin-bottom: 8px; }
.confirm-shell p { color: var(--ink-soft); white-space: pre-line; margin-bottom: 16px; }
.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ── サイドバー ── */
.sidebar-shell {
  width: var(--sidebar);
  background: var(--paper-warm);
  border-right: 1.5px solid var(--ink);
  position: fixed; top: 0; left: 0; bottom: 0;
  display: flex; flex-direction: column;
  padding: 18px 14px;
  z-index: 10;
  gap: 4px;
}
.sidebar-shell .logo {
  padding: 4px 8px 14px;
  border-bottom: 1.2px dashed var(--line);
  margin-bottom: 8px;
}
.sidebar-shell .logo .product-logo { display: block; width: 160px; max-width: 100%; height: auto; }
.sidebar-shell .logo .ver { font-size: 10px; color: var(--ink-mute); margin-top: 2px; }
.sidebar-shell .office-card {
  background: #fff;
  border: 1.5px solid var(--ink);
  border-radius: 10px;
  padding: 6px 10px;
  margin-bottom: 10px;
}
.sidebar-shell .office-card .lbl { font-size: 10px; color: var(--ink-mute); }
.sidebar-shell .office-card select {
  display: block;
  width: 100%;
  min-width: 0;
  border: none;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--ink);
  font-family: inherit;
  cursor: pointer;
  outline: none;
  appearance: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-mute) 50%), linear-gradient(135deg, var(--ink-mute) 50%, transparent 50%);
  background-position: calc(100% - 8px) 10px, calc(100% - 4px) 10px;
  background-size: 4px 4px; background-repeat: no-repeat;
  padding: 2px 18px 2px 0;
}
.sidebar-shell .office-card select:focus {
  box-shadow: none;
}
.sidebar-shell .office-card select:focus-visible {
  outline: 2px solid var(--sky);
  outline-offset: 2px;
  border-radius: 4px;
}
.sidebar-shell .office-card-number {
  margin-top: 2px;
  font-size: 10px;
  line-height: 1.3;
  color: var(--ink-mute);
  word-break: break-all;
}
.sidebar-shell .section-label {
  font-size: 10px; color: var(--ink-mute);
  padding: 6px 8px 2px; letter-spacing: 1px;
}
.sidebar-shell .section-label.nav-section-spaced { margin-top: 8px; }
.sidebar-shell nav a {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: 8px;
  font-size: 13px; color: var(--ink); text-decoration: none;
  border: 1.5px solid transparent;
}
.sidebar-shell nav a:hover { background: rgba(255,255,255,.5); }
.sidebar-shell nav a.active {
  background: var(--accent); color: #fff;
  font-weight: 700;
  border-color: var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
}
.sidebar-shell .icon { font-size: 14px; width: 18px; display: inline-block; text-align: center; }
.sidebar-shell .bottom {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1.2px dashed var(--line);
  font-size: 11px; color: var(--ink-mute);
}
.sidebar-shell .bottom a {
  display: block;
  margin-top: 6px;
  color: var(--ink-soft);
  text-decoration: underline;
  cursor: pointer;
}

/* ── メイン ── */
.main-shell {
  margin-left: var(--sidebar);
  flex: 1; display: flex; flex-direction: column;
  width: calc(100% - var(--sidebar));
  max-width: calc(100% - var(--sidebar));
  min-width: 0;
  min-height: 100vh;
}
.page {
  display: none; flex: 1; flex-direction: column;
  padding: 24px 32px;
}
.page.active { display: flex; }
/* v2: 情報量の少ない画面は横幅を制限して間延びを防ぐ（左揃えのまま、中央寄せはしない）。 */
.page.page--narrow.active { max-width: 1080px; }
.page-head {
  display: flex; align-items: flex-end; gap: 16px;
  margin-bottom: 18px; flex-wrap: wrap;
}
.page-head .crumb { font-size: 12px; color: var(--ink-mute); }
.page-head h1 {
  font-size: 26px; font-weight: 700; margin: 4px 0 0;
}
.page-head .greeting { font-size: 12px; color: var(--ink-mute); }
.page-head .head-right { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ── 共通: SketchBox ── */
.sb {
  background: var(--paper);
  border: 1.5px solid var(--ink);
  border-radius: 10px;
  box-shadow: 2px 2px 0 rgba(43,42,39,0.08);
  padding: 16px;
}
.sb-white { background: #fff; }
.sb-warm { background: var(--paper-warm); }
.sb-ok { background: var(--ok-soft); }
.sb-warn { background: var(--warn-soft); }
.sb-bad { background: var(--bad-soft); }
.sb-sky { background: var(--sky-soft); }
.sb-flat { box-shadow: none; }
.sb-thick { border-width: 2px; }

/* ── ボタン ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 18px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px; font-weight: 600;
  background: var(--paper); color: var(--ink);
  border: 1.5px solid var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: transform .08s, box-shadow .08s;
}
.btn:hover { transform: translate(-1px,-1px); box-shadow: 3px 3px 0 var(--ink); }
.btn:active { transform: translate(1px,1px); box-shadow: 1px 1px 0 var(--ink); }
.btn:disabled {
  opacity: .55;
  cursor: not-allowed;
  transform: none;
  box-shadow: 1px 1px 0 var(--ink);
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-success { background: var(--ok); color: #fff; }
.btn-danger { background: var(--bad); color: #fff; }
.btn-ghost { background: transparent; color: var(--ink-soft); border: 1.5px dashed var(--ink-mute); box-shadow: none; }
.btn-ghost:hover { box-shadow: none; }
.btn-sm { padding: 4px 12px; font-size: 12px; }
.btn-xs { padding: 2px 10px; font-size: 11px; box-shadow: 1.5px 1.5px 0 var(--ink); }
/* v2: 押しやすい大きめCTA */
.btn-lg { padding: 10px 22px; font-size: 14px; min-height: 42px; }
.btn-xl { padding: 12px 28px; font-size: 16px; min-height: 48px; }

/* ── Chip / Pill ── */
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 10px; border-radius: 999px;
  background: var(--paper-warm); color: var(--ink);
  border: 1.2px solid var(--ink);
  font-size: 12px; font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
}
.chip-ok { background: var(--ok-soft); color: var(--ok); border-color: var(--ok); }
.chip-warn { background: var(--warn-soft); color: var(--warn); border-color: var(--warn); }
.chip-bad { background: var(--bad-soft); color: var(--bad); border-color: var(--bad); }
.chip.chip-active {
  font-weight: 700;
  box-shadow: 2px 2px 0 var(--ink);
  transform: translate(-1px,-1px);
}
.chip.chip-active[data-svc-filter="all"] {
  background: var(--ink); color: #fff; border-color: var(--ink);
}
.chip.chip-active.chip-a {
  background: var(--accent); color: #fff; border-color: var(--accent);
}
.chip.chip-active.chip-b {
  background: var(--sky); color: #fff; border-color: var(--sky);
}
/* v2: サービス種別チップ（A型=橙 / B型=青） */
.chip-a { background: var(--accent-soft); color: var(--accent-deep); border-color: var(--accent); }
.chip-b { background: var(--sky-soft); color: var(--sky); border-color: var(--sky); }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 600;
  border: 1.3px solid currentColor;
  white-space: nowrap;
}
.pill-ok { background: var(--ok-soft); color: var(--ok); }
.pill-warn { background: var(--warn-soft); color: var(--warn); }
.pill-bad { background: var(--bad-soft); color: var(--bad); }
.pill-mute { background: var(--paper-warm); color: var(--ink-mute); }

/* ── 状態ドット ── */
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; border: 1px solid var(--ink); }
.dot-ok { background: var(--ok); }
.dot-warn { background: var(--warn); }
.dot-bad { background: var(--bad); }

/* ── 入力 ── */
input[type=text], input[type=password], input[type=time], input[type=month], input[type=number], input[type=file], select, textarea {
  font-family: inherit;
  font-size: 13px;
  padding: 6px 10px;
  border: 1.3px solid var(--ink);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  outline: none;
}
input:focus, select:focus, textarea:focus { box-shadow: 2px 2px 0 var(--ink); }
.readonly-only { display: none; }
body.master-readonly .readonly-only { display: block; }
body.master-readonly .site-write-copy { display: none; }
.readonly-banner {
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  background: var(--paper-warm);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
}
body.master-readonly .readonly-banner { display: flex; }
.readonly-value {
  display: block;
  min-height: 32px;
  padding: 6px 10px;
  border: 1.3px solid var(--line);
  border-radius: 6px;
  background: var(--paper-warm);
  color: var(--ink);
  line-height: 1.45;
  white-space: pre-wrap;
  cursor: default;
}
.readonly-value.is-empty { color: var(--ink-mute); }
.readonly-value--inline {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  margin-right: 8px;
  padding: 2px 8px;
  font-size: 12px;
  white-space: nowrap;
}
.readonly-source-control { display: none; }
.readonly-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 16px;
}
.readonly-field {
  min-width: 0;
}
.readonly-label {
  display: block;
  margin-bottom: 4px;
  color: var(--ink-mute);
  font-size: 12px;
  font-weight: 700;
}

/* ── 帳票出力ステータス別ウィンドウ ─────────────────────── */
.report-status-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 32px;
  background: var(--paper);
  color: var(--ink);
}
.report-status-card {
  width: min(620px, 100%);
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 10px;
  box-shadow: var(--shadow-ink);
  padding: 28px 30px;
}
.report-status-card h2 {
  font-size: 22px;
  line-height: 1.35;
  margin: 10px 0;
}
.report-status-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  font-weight: 700;
}
.report-status-icon--error {
  background: var(--bad-soft);
  border: 2px solid var(--bad);
  color: var(--bad);
}
.report-status-icon--loading {
  border: 4px solid var(--line);
  border-top-color: var(--accent);
  animation: report-status-spin .8s linear infinite;
}
.report-status-lead {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.7;
}
.report-status-detail {
  margin-top: 12px;
  color: var(--ink-soft);
  line-height: 1.7;
}
.report-status-steps {
  display: grid;
  gap: 8px;
  margin-top: 18px;
  padding: 14px 18px 14px 34px;
  background: var(--paper-warm);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.report-status-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 22px;
}
.report-status-button {
  min-height: 38px;
  padding: 8px 16px;
  border: 1.5px solid var(--ink);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 2px 2px 0 var(--ink);
}
.report-status-button--primary {
  background: var(--accent);
  color: #fff;
}
.report-status-button:hover { transform: translateY(-1px); }
.report-status-button:active {
  transform: translate(2px, 2px);
  box-shadow: none;
}
@keyframes report-status-spin {
  to { transform: rotate(360deg); }
}

/* ── サマリーカード ── */
.cards-row {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 14px; margin-bottom: 16px;
}
.cards-row.cards-row--three { grid-template-columns: repeat(3, 1fr); }
.cards-row.cards-row--four { grid-template-columns: repeat(4, 1fr); }
.summary-num {
  font-size: 32px; font-weight: 700;
  font-family: "Consolas", "SF Mono", "Menlo", monospace; font-variant-numeric: tabular-nums;
}
.summary-num.summary-num--large { font-size: 28px; line-height: 1; }
.summary-num.summary-num--compact { font-size: 22px; line-height: 1; }
.summary-num .unit { font-size: 14px; color: var(--ink-mute); margin-left: 4px; }
.summary-lbl { font-size: 11px; color: var(--ink-mute); margin-bottom: 4px; }
.home-summary-card { padding: 14px 16px; }
.home-summary-card--users { border-top: 3px solid var(--accent); }
.home-summary-card--days { border-top: 3px solid var(--ok); }
.home-summary-card--avg { border-top: 3px solid var(--warn); }
.home-summary-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 12px;
}
.home-summary-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.home-summary-metric {
  text-align: center;
  border-radius: 8px;
  padding: 10px 6px;
}
.home-summary-metric--a { background: var(--accent-soft); }
.home-summary-metric--b { background: var(--sky-soft); }
.home-summary-type {
  font-size: 10px;
  font-weight: 700;
  margin-bottom: 6px;
}
.home-summary-type--a { color: var(--accent); }
.home-summary-type--b { color: var(--sky); }
.summary-bar {
  height: 6px; background: #fff; border: 1px solid var(--line);
  border-radius: 3px; margin-top: 8px; overflow: hidden;
}
.summary-bar > div { height: 100%; background: var(--ok); }

/* ── 検索バー ── */
.search-row {
  display: flex; gap: 8px; align-items: center;
  margin-bottom: 12px; flex-wrap: wrap;
}
.search-input {
  flex: 1;
  background: #fff;
  border: 1.5px solid var(--ink);
  border-radius: 10px;
  padding: 6px 12px;
  display: flex; align-items: center; gap: 8px;
  min-width: 200px;
}
.search-input input { border: none; flex: 1; padding: 0; font-size: 13px; box-shadow: none; background: transparent; }
.search-input input:focus { box-shadow: none; }
.search-input .search-icon { color: var(--ink-mute); }
.inline-label {
  font-size: 11px;
  color: var(--ink-mute);
  margin-left: 8px;
}
.inline-select { font-size: 12px; }

/* ── 利用者設定一覧 ── */
.user-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  align-items: center;
  margin-bottom: 14px;
}
.user-filter-row .search-input {
  flex: 1 1 300px;
  max-width: 100%;
  min-width: min(100%, 240px);
}
.user-filter-row .search-input input {
  min-width: 0;
}
.user-filter-chips {
  display: flex;
  flex: 0 1 auto;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  min-width: 0;
}
.user-filter-chips .chip {
  min-height: 28px;
}
.user-filter-row .filter-checkbox {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
  min-width: max-content;
  min-height: 28px;
  font-size: 12px;
}
.user-filter-sort {
  display: inline-flex;
  flex: 0 1 220px;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-width: 190px;
  margin-left: auto;
}
.user-filter-sort .inline-label {
  flex: 0 0 auto;
  margin-left: 0;
}
.user-filter-sort .inline-select {
  flex: 1 1 150px;
  max-width: 100%;
  min-width: 140px;
}
.user-list {
  display: grid;
  gap: 10px;
}
.user-card-heading {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  align-items: baseline;
  min-width: 0;
}
.user-card-heading .user-meta-id {
  flex: 0 0 auto;
}
.user-meta-id,
.user-meta-kana,
.user-meta-recipient {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-meta-svc {
  justify-self: start;
  max-width: 100%;
}
.user-meta-svc .chip {
  max-width: 100%;
  min-width: 150px;
  justify-content: center;
  cursor: default;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-meta-status {
  display: flex;
  justify-content: flex-end;
  min-width: 54px;
}
.user-card-actions .btn {
  min-width: 76px;
  justify-content: center;
}
.user-list-empty {
  padding: 16px;
  color: var(--ink-mute);
  font-size: 13px;
}

@media (max-width: 860px) {
  .user-card-meta {
    grid-template-columns: minmax(92px, .65fr) minmax(160px, 1fr);
    gap: 8px 18px;
  }
  .user-meta-svc {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .user-filter-row .search-input {
    flex-basis: 100%;
    min-width: 100%;
  }
  .user-filter-sort {
    flex: 1 1 100%;
    justify-content: flex-start;
    min-width: 0;
    margin-left: 0;
  }
  .user-filter-sort .inline-select {
    flex: 0 1 240px;
  }
}

@media (max-width: 520px) {
  .user-filter-chips,
  .user-filter-row .filter-checkbox,
  .user-filter-sort {
    flex-basis: 100%;
  }
  .user-filter-sort {
    flex-wrap: wrap;
  }
  .user-filter-sort .inline-select {
    flex: 1 1 180px;
  }
  .user-card {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .user-card-actions {
    display: flex;
    justify-content: space-between;
    justify-self: stretch;
    min-width: 0;
  }
  .user-card-meta {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .user-meta-status {
    justify-content: flex-start;
  }
}

/* ── テーブル共通 ── */
.tbl-wrap {
  background: #fff;
  border: 1.5px solid var(--ink);
  border-radius: 10px;
  box-shadow: 2px 2px 0 rgba(43,42,39,.08);
  overflow: hidden;
}
table.std {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
table.std thead tr { background: var(--paper-warm); }
table.std th {
  padding: 10px 12px; font-size: 11px; font-weight: 600;
  color: var(--ink-soft); text-align: center;
  border-bottom: 1.5px solid var(--ink);
  letter-spacing: 0.3px; white-space: nowrap;
}
table.std th.left { text-align: left; }
table.std td {
  padding: 9px 12px; font-size: 13px;
  vertical-align: middle;
  border-top: 1px solid var(--line-soft);
}
table.std td.center { text-align: center; }
table.std td.left { text-align: left; }
table.std td.num,
table.std td.money {
  text-align: right;
  font-family: "Consolas", "SF Mono", "Menlo", monospace;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
table.std tr.row-warn { background: var(--warn-soft); }
table.std tr.row-bad { background: var(--bad-soft); }
table.std tr.row-total td {
  background: var(--paper-warm); font-weight: 700;
  border-top: 2px solid var(--ink);
}
table.std .progress {
  height: 6px; width: 80px; background: var(--line-soft);
  border-radius: 3px; border: 1px solid var(--line); overflow: hidden;
  display: inline-block; vertical-align: middle;
}
table.std .progress > div { height: 100%; }

/* ── アバター ── */
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent-soft); border: 1.2px solid var(--ink);
  font-size: 12px; font-weight: 700;
  flex-shrink: 0;
}
.avatar-lg { width: 48px; height: 48px; font-size: 18px; }
.avatar-xl { width: 56px; height: 56px; font-size: 22px; border-width: 2px; }
.avatar.b { background: var(--sky-soft); }
.cell-name-flex { display: inline-flex; align-items: center; gap: 10px; }
.text-alert { color: var(--bad); font-weight: 700; }

/* ── アラートバー ── */
.alert-bar {
  background: var(--bad-soft); border: 1.5px solid var(--bad);
  border-radius: 10px; padding: 10px 16px;
  margin-bottom: 14px; font-size: 13px; color: var(--bad);
  display: none; align-items: center; gap: 12px;
  box-shadow: 2px 2px 0 rgba(43,42,39,.08);
}
.alert-bar.show { display: flex; }
.alert-bar .lead { font-weight: 700; }

/* ── 月ナビ ── */
.month-nav {
  display: inline-flex; align-items: center; gap: 8px;
  background: #fff; border: 1.5px solid var(--ink);
  border-radius: 10px; padding: 4px 12px;
  box-shadow: 2px 2px 0 rgba(43,42,39,.08);
}
.month-nav .nav-btn {
  border: none; background: transparent; cursor: pointer;
  color: var(--ink-mute); font-size: 14px; padding: 2px 4px;
}
.month-nav input[type=month] {
  border: none; padding: 2px 4px; font-weight: 600;
  font-family: "Consolas", "SF Mono", "Menlo", monospace; font-variant-numeric: tabular-nums;
  font-size: 13px;
}
.month-nav input:focus { box-shadow: none; }
.initially-hidden { display: none; }
.is-hidden { display: none; }
.is-visible-block { display: block; }
.is-visible-flex { display: flex; }
.home-missing-list { margin-bottom: 14px; }
.helper-text {
  font-size: 12px;
  color: var(--ink-soft);
}
.helper-text--top { margin-top: 2px; }
.muted-text { color: var(--ink-mute); }
.muted { color: var(--ink-mute); }
.spacer { flex: 1 1 auto; }
.stretch { flex: 1; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 12px; }
.mt-8 { margin-top: 6px; } .mt-12 { margin-top: 8px; } .mt-16 { margin-top: 12px; } .mt-24 { margin-top: 16px; }
.mb-8 { margin-bottom: 6px; } .mb-12 { margin-bottom: 8px; } .mb-16 { margin-bottom: 12px; } .mb-24 { margin-bottom: 16px; }
.text-xs { font-size: 11px; }
.text-sm { font-size: 12px; }

/* ── フローティング保存バー（未保存リマインド＋保存確認） ── */
.save-bar {
  position: fixed;
  bottom: 24px;
  right: 24px;
  left: auto;
  max-width: min(440px, calc(100vw - 48px));
  z-index: 80;
  display: none;
  align-items: center;
  gap: 12px;
  border: 2px solid var(--ink);
  border-radius: 10px;
  box-shadow: 3px 3px 0 var(--ink);
  padding: 12px 16px;
  background: #fff;
}
.save-bar.show { display: flex; }
.save-bar.dirty { background: var(--warn-soft); }
.save-bar.saved { background: var(--ok-soft); }
.save-bar .save-bar-msg { font-size: 14px; font-weight: 700; }
.save-bar.dirty .save-bar-msg::before { content: "● "; color: var(--warn); }
.save-bar.saved .save-bar-msg::before { content: "✓ "; color: var(--ok); }

/* ── レスポンシブ（iPad縦・狭幅PC） ── */
@media (max-width: 1100px) {
  .cards-row,
  .cards-row.cards-row--three,
  .cards-row.cards-row--four { grid-template-columns: repeat(2, 1fr); }
  .billing-summary-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .page { padding: 18px 16px; }
  .page-head .head-right { margin-left: 0; width: 100%; }
  .send-grid { grid-template-columns: 1fr; }
  /* 列の多い一覧は枠内で横スクロールさせ、レイアウト崩れを防ぐ */
  .tbl-wrap { overflow-x: auto; }
  .tbl-wrap table.std { min-width: 640px; }
  .readonly-form-grid { grid-template-columns: 1fr; }
  .save-bar { left: auto; right: 16px; bottom: 16px; max-width: calc(100vw - 32px); }
}
@media (max-width: 600px) {
  body { display: block; }
  .sidebar-shell {
    position: relative;
    top: auto;
    left: auto;
    bottom: auto;
    width: 100%;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
    grid-template-areas:
      "logo office"
      "nav nav"
      "bottom bottom";
    align-items: start;
    gap: 8px 12px;
    padding: 12px;
    border-right: 0;
    border-bottom: 1.5px solid var(--ink);
  }
  .sidebar-shell .logo {
    grid-area: logo;
    margin: 0;
    padding: 4px 0;
    border-bottom: 0;
  }
  .sidebar-shell .office-card {
    grid-area: office;
    margin: 0;
  }
  .sidebar-shell nav {
    grid-area: nav;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
  }
  .sidebar-shell .section-label { grid-column: 1 / -1; }
  .sidebar-shell .section-label.nav-section-spaced { margin-top: 4px; }
  .sidebar-shell nav a { min-width: 0; }
  .sidebar-shell .bottom {
    grid-area: bottom;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 0;
    padding-top: 8px;
  }
  .sidebar-shell .bottom a { margin-top: 0; }
  .main-shell {
    width: 100%;
    max-width: 100%;
    margin-left: 0;
  }
  .page { padding: 16px 12px; }
}

/* ── 起動モード（本部/現場） ───────────────────────────────── */
.mode-badge {
  display: inline-block;
  margin-top: 6px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}
.mode-badge--hq { background: #1d4ed8; color: #fff; }
.mode-badge--site { background: #047857; color: #fff; }
.mode-badge--standalone { background: #6d28d9; color: #fff; }
.mode-badge--unset { background: #b45309; color: #fff; }

body.master-readonly .site-write-action,
body.master-readonly [data-master-action="toggle-active"],
body.master-readonly [data-staff-detail-action="save-basic"],
body.master-readonly [data-staff-detail-action="toggle-active"],
body.master-readonly [data-sd-period-action] { display: none; }
body.actual-readonly .actual-write-action { display: none; }

/* ── 送受信ページ ─────────────────────────────────────────── */
.transfer-card { margin-bottom: 16px; }
.transfer-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 8px 0; }
/* display:flex の指定が hidden 属性の非表示を上書きしないようにする */
.transfer-row[hidden] { display: none; }
.transfer-help { font-size: 12.5px; color: #555; margin-bottom: 6px; }
.transfer-latest { font-size: 13px; font-weight: 600; color: #1d4ed8; margin-top: 6px; }
.transfer-preview { margin-top: 10px; }
.transfer-preview-meta { font-size: 13px; margin-bottom: 4px; }
.transfer-preview-summary { font-size: 13.5px; margin-bottom: 8px; }
.transfer-preview-warn { font-size: 12.5px; color: #b45309; margin: 6px 0; }
.transfer-conflict-count { color: #b91c1c; }
.transfer-conflict-head { font-size: 12.5px; color: #b91c1c; margin: 8px 0; }
.transfer-conflict-bulk { margin-left: 8px; color: #333; }
.transfer-conflict-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.transfer-conflict-table th, .transfer-conflict-table td {
  border: 1px solid #e2e8f0; padding: 6px 8px; text-align: left; vertical-align: top;
}
.transfer-conflict-table th { background: #f8fafc; }
.transfer-conflict-meta { font-size: 11px; color: #777; margin-top: 2px; }
.transfer-conflict-choice label { display: block; white-space: nowrap; font-size: 12px; }
.transfer-history-title { font-size: 12.5px; font-weight: 700; margin: 10px 0 4px; }
.transfer-history-row {
  display: flex; gap: 12px; flex-wrap: wrap; align-items: center;
  font-size: 12.5px; padding: 5px 0; border-bottom: 1px solid #eef2f7;
}
.transfer-history-type {
  background: #eef2ff; color: #3730a3; border-radius: 4px;
  padding: 1px 8px; font-weight: 700; font-size: 11.5px;
}
.transfer-history-file { font-size: 11.5px; color: #555; }

/* 初期データ移行 */
.transfer-office-option {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px; border: 1px solid #e2e8f0; border-radius: 6px;
  margin: 4px 0; font-size: 13px; cursor: pointer;
}
.transfer-office-option:hover { background: #f8fafc; }
.transfer-office-hint-ok { color: #15803d; font-size: 12px; }
.hq-office-list { margin: 8px 0 14px; }
.hq-office-add-title { margin-top: 4px; font-size: 13px; }
.transfer-office-hint-warn { color: #b45309; font-size: 12px; font-weight: 600; }
.transfer-check { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; }

/* 氏名クリックで編集ページへ */
.name-link { cursor: pointer; }
.name-link:hover { text-decoration: underline; color: #1d4ed8; }
.picker-confirm-all-label {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 10.5px; font-weight: 400; cursor: pointer;
}

.transfer-mode-options { margin: 8px 0; display: flex; flex-direction: column; gap: 4px; }
.transfer-check--indent { margin-left: 22px; color: #555; }

.maintenance-block {
  border-top: 1px solid var(--line);
  margin-top: 14px;
  padding-top: 14px;
}
.maintenance-block:first-of-type {
  border-top: 0;
  margin-top: 0;
  padding-top: 0;
}
.maintenance-title { font-weight: 700; margin-bottom: 8px; }
.maintenance-checks { display: grid; gap: 6px; margin: 10px 0; }
.maintenance-office-list {
  display: grid;
  gap: 6px;
  margin: 8px 0 10px;
  max-height: 180px;
  overflow: auto;
}
.maintenance-office-item { display: flex; align-items: center; gap: 8px; }

/* 単一サービス種別の事業所では、他方の種別フィルタを表示しない（ホーム・月次実績一覧・利用者設定） */
body.svc-only-a .calendar-filter-row .btn[id="cal-filter-B型"],
body.svc-only-a .btn[id="picker-filter-B型"],
body.svc-only-a .master-service-filter--b,
body.svc-only-b .calendar-filter-row .btn[id="cal-filter-A型"],
body.svc-only-b .btn[id="picker-filter-A型"],
body.svc-only-b .master-service-filter--a { display: none; }
/* 単独種別の事業所では「サービス種別」ソートと、他方の種別チップが不要 */
body.svc-only-a .master-sort option[value="svc"],
body.svc-only-b .master-sort option[value="svc"] { display: none; }
.license-status-panel {
  white-space: pre-line;
  padding: 14px 16px;
  margin: 14px 0;
  border: 1px solid #b8dfcb;
  border-radius: 12px;
  background: #f0faf5;
  color: #185c3d;
  line-height: 1.7;
}

.license-status-panel--warning {
  border-color: #f2c99e;
  background: #fff7ed;
  color: #8a4515;
}

.settings-action-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 12px 0;
}
.data-management-card {
  min-width: 0;
  margin-bottom: 16px;
}
.data-management-card:last-child { margin-bottom: 0; }
.data-management-card .settings-help,
.data-management-card .transfer-help {
  line-height: 1.65;
  overflow-wrap: anywhere;
}
.data-management-card ol.settings-help {
  margin: 0 0 8px;
  padding-left: 22px;
}
