/* ==========================================================================
   フォーム営業システム（ウェルビーライフHD）— 見た目の層
   app.css の部品名はそのまま、色・書体・骨格だけをここで差し替える。

   考え方: ウェルビーライフHD の社内の「帳簿」。
   - 骨格色はロゴの紺（#083484）。サイドバーの深い紺が唯一の濃い面で、本文側は白と薄い紙色だけ。
   - 上部の白いヘッダーにロゴ（Well-be Life Holdings）とシステム名を置く。
   - 琥珀（amber）は「人の手が要るもの」（承認待ち・要返信・手動送信）にだけ使う。
   - 煉瓦（brick）は「止まっている・失敗」にだけ使う。装飾には使わない。
   - 書体は2つ: 本文と操作は Zen Kaku Gothic New、画面の名前と数字は Shippori Mincho。
   - 影は使わない。区切りは罫線。角はほとんど落とさない。
   ========================================================================== */

:root {
  --ink: #16202f;
  --ink-2: #3c4658;
  --ink-3: #667085;
  --ink-4: #98a1b2;

  --paper: #f3f5f9;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --line: #dde3ec;
  --line-strong: #c4ccda;

  /* 紺（ロゴの色）: 主操作・進捗・リンク */
  --ai: #083484;
  --ai-700: #062868;
  --ai-500: #1e4fa8;
  --ai-100: #d6e0f2;
  --ai-50: #edf2fa;

  /* 煉瓦: 停止・不達・失敗・エラーだけ */
  --shu: #a8432f;
  --shu-700: #86321f;
  --shu-50: #f8ece8;

  /* 若葉: 完了 */
  --take: #2b7a57;
  --take-50: #e4f1e9;

  /* 琥珀: 人の手が要るもの */
  --kin: #a5690b;
  --kin-50: #fbf1dc;

  --moss-deep: #0a2a66;
  --moss-deep-2: #12387e;
  --moss-text: #dbe4f4;
  --moss-text-dim: #9fb0d2;

  --font-ui: "Zen Kaku Gothic New", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Meiryo", sans-serif;
  --font-mark: "Shippori Mincho", "Hiragino Mincho ProN", "Yu Mincho", serif;

  --r-sm: 2px;
  --r-md: 3px;
  --r-lg: 4px;

  --sidebar-w: 248px;
  --content-max: 1120px;
  --focus: 0 0 0 3px rgba(30, 79, 168, 0.35);
  --shadow-pop: 0 10px 28px rgba(22, 32, 47, 0.18), 0 1px 3px rgba(22, 32, 47, 0.08);
}

body {
  font-family: var(--font-ui);
  font-weight: 400;
  letter-spacing: 0.01em;
}

a {
  color: var(--ai-500);
}
a:hover {
  color: var(--ai-700);
}

/* ---------- サイドバー（唯一の濃い面・紺） ---------- */
.sidebar {
  background: var(--moss-deep);
  border-right: 0;
  padding: 24px 12px 16px;
  color: var(--moss-text);
}
.nav {
  gap: 1px;
}
.nav-group {
  margin: 18px 0 6px;
  padding: 0 10px;
  font-size: 11.5px;
  letter-spacing: 0.06em;
  color: var(--moss-text-dim);
}
.nav-group:first-child {
  margin-top: 4px;
}
.nav-item {
  color: var(--moss-text);
  border-radius: var(--r-md);
  min-height: 38px;
  font-size: 14px;
  position: relative;
}
.nav-item svg {
  stroke-width: 1.5;
  opacity: 0.85;
}
.nav-item:hover {
  background: var(--moss-deep-2);
  color: #fff;
}
.nav-item.is-active {
  background: var(--moss-deep-2);
  color: #fff;
  font-weight: 500;
}
.nav-item.is-active::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 7px;
  bottom: 7px;
  width: 3px;
  background: #fff;
}
/* サイドバーの件数は全部、紺の上で読める赤地に白い数字（1021 松浦さん「同化してて見えづらい」「文字色と背景色が同じすぎてみづらい」）。
   数字は丸の真ん中に置く（line-height で合わせると書体によって下にずれる） */
.sidebar .nav-count,
.sidebar .nav-count[data-count],
.topbar .topbar-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #e5484d;
  color: #fff;
  font: 700 12px/1 system-ui, -apple-system, "Segoe UI", sans-serif;
  font-variant-numeric: tabular-nums;
}
.sidebar .nav-count[hidden],
.topbar .topbar-count[hidden] {
  display: none;
}
/* スマホの上部バーのお知らせにも件数を出す */
.topbar .icon-btn {
  position: relative;
}
.topbar .topbar-count {
  position: absolute;
  top: 3px;
  left: calc(50% + 3px);       /* 鈴の右肩（鈴を隠さない） */
  right: auto;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  border: 2px solid var(--surface);
  box-sizing: content-box;
}
.sidebar-foot {
  border-top: 1px solid rgba(217, 230, 221, 0.18);
}
.account-name {
  color: #fff;
}
.account-mail {
  color: var(--moss-text-dim);
}
.sidebar .sidebar-legal,
.sidebar .small,
.sidebar .muted {
  color: var(--moss-text-dim);
}

/* ---------- 本文の骨格 ---------- */
.main {
  padding: 36px 44px 88px;
}
.page-head {
  margin-bottom: 26px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line-strong);
}
.page-title {
  font-family: var(--font-mark);
  font-weight: 600;
  font-size: 28px;
  letter-spacing: 0.04em;
  line-height: 1.3;
}
.page-desc {
  font-size: 13.5px;
  color: var(--ink-3);
}
h1, h2, h3 {
  letter-spacing: 0.01em;
}
.panel {
  border-radius: var(--r-lg);
  border-color: var(--line);
}
.panel-head {
  padding: 14px 20px;
}
.panel-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}
.panel-desc,
.field-hint,
.muted,
.small {
  color: var(--ink-3);
}

/* ---------- 数字（帳簿の数字は明朝） ---------- */
.metric-value,
.kpi-value {
  font-family: var(--font-mark);
  font-weight: 600;
  font-size: 30px;
  letter-spacing: 0.02em;
}
.metric-label,
.kpi-label {
  font-size: 13px;
  color: var(--ink-3);
}
.metrics {
  border-radius: var(--r-lg);
}

/* ---------- ボタン ---------- */
.btn {
  border-radius: var(--r-md);
  font-weight: 500;
  letter-spacing: 0.02em;
}
.btn-primary {
  background: var(--ai);
  border-color: var(--ai);
}
.btn-primary:hover:not(:disabled) {
  background: var(--ai-700);
  border-color: var(--ai-700);
}
.btn-secondary {
  background: var(--surface);
  color: var(--ai-700);
  border-color: var(--ai-100);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--ai-50);
  color: var(--ai-700);
  border-color: var(--ai-500);
}
.btn-ghost {
  color: var(--ai-500);
}
.btn-danger {
  color: var(--shu);
  border-color: #e3c0b7;
}

/* ---------- 札（輪郭だけ・塗らない） ---------- */
.badge {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--ink-2);
  border-radius: 2px;
  height: 22px;
  font-weight: 500;
}
.badge-attention {
  background: transparent;
  color: var(--shu);
  border-color: #dba99d;
}
.badge-warning {
  background: var(--kin-50);
  color: #7f5107;
  border-color: #e4c98e;
}
.badge-success {
  background: transparent;
  color: var(--take);
  border-color: #a9d0bb;
}
.badge-info {
  background: transparent;
  color: var(--ai-500);
  border-color: var(--ai-100);
}

/* ---------- 表（罫線で読む） ---------- */
.table th {
  background: var(--surface);
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 700;
  border-bottom: 2px solid var(--ink-2);
  padding: 10px 14px;
}
.table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
}
.table tr.is-link:hover td {
  background: var(--ai-50);
}
.table .cell-strong {
  font-weight: 500;
}

/* ---------- 注意書き・バナー ---------- */
.alert {
  border-radius: var(--r-md);
}
.alert-info {
  background: var(--surface-2);
  border-color: var(--line);
}
.alert-info::before {
  background: var(--ai-500);
}
.send-banner {
  border-radius: var(--r-lg);
}

/* ---------- 入力 ---------- */
.input,
.select,
.textarea {
  border-radius: var(--r-md);
  border-color: var(--line-strong);
  background: var(--surface);
}
.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--ai-500);
}
.field-label {
  font-weight: 500;
  color: var(--ink-2);
}
.subnav .is-active {
  color: var(--ai-700);
  border-bottom-color: var(--ai);
}

/* ---------- 公開ページ（ログイン・予約） ---------- */
.public-header,
.auth-card {
  border-color: var(--line);
}
.auth-title,
.legal-title {
  font-family: var(--font-mark);
  font-weight: 600;
  letter-spacing: 0.04em;
}

/* ---------- 出典 ---------- */
.data-attribution {
  margin-top: 48px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--ink-4);
}

/* ---------- モバイル ---------- */
@media (max-width: 960px) {
  .main {
    padding: 20px 16px 72px;
  }
  .page-title {
    font-size: 23px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}

/* ---------- ヘッダー（ロゴ＋システム名。全画面共通） ---------- */
:root {
  --header-h: 60px;
}
.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: var(--header-h);
  padding: 0 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.brand,
.brand:hover {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
  min-width: 0;
}
.brand-logo {
  display: block;
  height: 32px;
  width: auto;
}
.brand-sep {
  width: 1px;
  height: 26px;
  background: var(--line-strong);
}
.brand-name {
  font-family: var(--font-mark);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: 0.06em;
  color: var(--ai);
}
.brand-sub {
  font-size: 12.5px;
  color: var(--ink-3);
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  padding: 1px 8px;
}
.app-header-user {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  font-size: 13px;
  color: var(--ink-2);
  white-space: nowrap;
}
.app-header-role {
  font-size: 12px;
  color: var(--ink-3);
}
/* ヘッダーの下にサイドバーと本文 */
.app-header + .shell,
.app-header ~ .shell {
  min-height: calc(100vh - var(--header-h));
}
.app-header ~ .shell .sidebar {
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
  padding-top: 16px;
}
/* 公開ページ（ログイン・予約）のヘッダー */
.public-header .brand-logo {
  height: 30px;
}
/* モバイルの上部バーはロゴのマークだけ（白地に紺） */
.brand-compact,
.brand-compact:hover {
  gap: 10px;
}
.brand-mark {
  display: block;
  height: 24px;
  width: auto;
}
.brand-compact .brand-name {
  font-size: 15px;
  letter-spacing: 0.03em;
}

@media (max-width: 960px) {
  .app-header {
    display: none;
  }
  .app-header ~ .shell .sidebar {
    top: 0;
    height: 100vh;
  }
  .topbar {
    background: var(--surface);
    color: var(--ink);
    border-bottom: 1px solid var(--line);
  }
  .topbar .icon-btn {
    color: var(--ink);
  }
}
@media (max-width: 520px) {
  .public-header .brand-logo {
    height: 22px;
  }
  .public-header .brand-name {
    font-size: 14px;
  }
}
dialog.fd {
  border-top: 4px solid var(--ai);
}

/* ==========================================================================
   スマホ・狭い画面（1021 松浦さん「スマホの表示がいまいち・文字の被りが起きないように」）
   - 画面の名前は省略（…）せず折り返す
   - タブは横に流さず折り返す（どのタブがあるか一目で分かるように）
   - 表は枠の中で横にスクロールし、列が細くなって1文字ずつ折り返さないよう最小幅を持たせる
   - 押す場所は指で押せる大きさ（40px 前後）。入力欄は 16px（iPhone の自動拡大を防ぐ）
   ========================================================================== */
:where(body.app) .page-title {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  overflow-wrap: anywhere;
}
@media (max-width: 760px) {
  .subnav {
    flex-wrap: wrap;
    overflow-x: visible;
    row-gap: 2px;
  }
  .subnav a,
  .subnav button {
    padding: 10px 12px;
  }
  .table-wrap {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
  }
  .table-wrap .table th,
  .table-wrap .table td {
    min-width: 7.5em;
    padding: 10px 12px;
  }
  .table-wrap .table th.num,
  .table-wrap .table td.num,
  .table-wrap .table td.td-actions,
  .table-wrap .table th:empty,
  .table-wrap .table td:has(> input[type="checkbox"]) {
    min-width: 0;
  }
  .table-wrap .table td:has(> .badge),
  .table-wrap .table td.nw {
    white-space: nowrap;
  }
  .btn {
    min-height: 40px;
  }
  .btn.btn-sm {
    min-height: 36px;
  }
  .input,
  .select,
  .textarea {
    font-size: 16px;
  }
  .input,
  .select {
    min-height: 42px;
  }
  .dt-sort {
    min-height: 36px;
  }
  .panel-head {
    flex-wrap: wrap;
    gap: 8px 12px;
  }
  .btn-row {
    flex-wrap: wrap;
  }
  .kv dd,
  .ac-readonly dd {
    overflow-wrap: anywhere;
  }
}

/* ---------- スマホのヘッダー（ログイン・予約などの公開画面と、ログイン後の上部バー） ----------
   幅の広いロゴを小さいマークに切り替え、システム名とリンクが重ならないようにする。名前が入らない幅では … で切る */
.brand-mark-public {
  display: none;
}
.public-header-inner {
  gap: 12px;
}
.public-header .brand {
  flex: 1 1 auto;
  min-width: 0;
}
.public-header .brand-name,
.topbar .brand-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.public-nav {
  flex: none;
}
@media (max-width: 560px) {
  .public-header .brand-logo,
  .public-header .brand-sep {
    display: none;
  }
  .brand-mark-public {
    display: block;
    height: 24px;
    width: auto;
    flex: none;
  }
  .public-header .brand {
    gap: 10px;
  }
  .public-header .brand-name {
    font-size: 15px;
  }
}
.topbar .brand-compact {
  flex: 1 1 auto;
  min-width: 0;
}

/* サイドバー下段（お知らせ・設定・管理）の区切り。見出しは付けない（1021 並び替え） */
.nav-sep {
  height: 1px;
  margin: 14px 10px 8px;
  background: rgba(219, 228, 244, 0.18);
}

/* ---------- ヘッダーの右上: お知らせと利用者のメニュー（パソコン。1021） ---------- */
.app-header-right { display: flex; align-items: center; gap: 10px; }
.hdr-bell { position: relative; display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: var(--r-md); color: var(--ink-2); }
.hdr-bell:hover { background: var(--surface-2); color: var(--ai); }
.hdr-bell svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
/* 件数の丸: 鈴の右肩に置き、数字は丸の真ん中に（line-height で合わせると枠線の分だけ下にずれる） */
.hdr-count { position: absolute; top: 4px; left: 21px; display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 999px; background: #e5484d; color: #fff; font: 700 11px/1 system-ui, -apple-system, "Segoe UI", sans-serif; font-variant-numeric: tabular-nums; box-sizing: border-box; box-shadow: 0 0 0 2px var(--surface); }
.hdr-count[hidden] { display: none; }
.hdr-user { position: relative; }
.hdr-user > summary { list-style: none; display: inline-flex; align-items: baseline; gap: 8px; padding: 8px 12px; border: 1px solid transparent; border-radius: var(--r-md); font-size: 13.5px; color: var(--ink-2); cursor: pointer; }
.hdr-user > summary::-webkit-details-marker { display: none; }
.hdr-user > summary::after { content: "▾"; font-size: 11px; color: var(--ink-3); }
.hdr-user > summary:hover, .hdr-user[open] > summary { background: var(--surface-2); border-color: var(--line); }
.hdr-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 50; min-width: 180px; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-pop); display: grid; }
.hdr-menu a { padding: 9px 12px; border-radius: var(--r-sm); color: var(--ink); text-decoration: none; font-size: 14px; }
.hdr-menu a:hover { background: var(--ai-50); color: var(--ai-700); }
.hdr-menu a[hidden] { display: none; }
@media (min-width: 961px) {
  .nav-mobile-only { display: none !important; }
}

/* 横に並べたパネルの上端をそろえる。縦に積む時の「.panel + .panel」の上の余白が、横に並べた2枚目以降にも付いて
   1枚だけ下がっていた（1021 松浦さん「ここ高さズレてるの気になる」）。横並びの入れ物（*-split / *-cols / *-grid / *-columns / *-layout）では消す */
[class*="-split"] > .panel,
[class*="-cols"] > .panel,
[class*="-grid"] > .panel,
[class*="-columns"] > .panel,
[class*="-layout"] > .panel {
  margin-top: 0;
}

