/* ============================================================
 * theme.css — ライトプレミアム UI（/pro/ 専用・.app-ui で適用）
 *   白基調 / 余白 / 大胆タイポ / 多層シャドウで奥行き / アクセント強め。グラデ無し。
 *   ※スケールはコンパクト寄り。grid子は min-width:0 で横はみ出し防止（100%内に収める）。
 * ============================================================ */
.app-ui {
  --th-bg: #f3f5fb;
  --th-ink: #0d1b3e;
  --th-ink-2: #41507a;
  --th-mut: #7b88a8;
  --th-line: #e7ecf6;
  --th-navy: #10317c;
  --th-pink: #ed2e64;
  --th-teal: #0f9b8e;
  --th-amber: #e8920c;
  --th-card-r: 16px;
  --th-sh-1: 0 1px 2px rgba(13, 27, 62, .05), 0 8px 22px -12px rgba(13, 27, 62, .14);
  --th-sh-2: 0 1px 2px rgba(13, 27, 62, .05), 0 20px 44px -16px rgba(13, 27, 62, .22);
}

.app-ui .main { background: var(--c-bg-page); }
.app-ui .main-inner { padding: 16px 22px 28px; max-width: 100%; box-sizing: border-box; }

/* ===== ヒーローヘッダー ===== */
.dash-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.dash-eyebrow {
  display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; letter-spacing: .03em;
  color: var(--th-navy); background: #fff; border: 1px solid var(--th-line); padding: 4px 10px; border-radius: 999px; box-shadow: var(--th-sh-1);
}
.dash-title { margin: 4px 0 1px; font-size: 15px; font-weight: 800; letter-spacing: -.02em; color: var(--th-ink); line-height: 1.2; }
.dash-sub { margin: 0; font-size: 12px; color: var(--th-mut); }
.dash-head-r { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.dash-seg { display: inline-flex; padding: 3px; background: #fff; border: 1px solid var(--th-line); border-radius: 10px; box-shadow: var(--th-sh-1); }
.dash-seg button { border: none; background: transparent; padding: 6px 12px; border-radius: 8px; font-size: 12px; font-weight: 700; color: var(--th-mut); cursor: pointer; }
.dash-seg button.is-active { background: var(--th-navy); color: #fff; }

.dash-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 13px; border: 1px solid var(--th-line);
  background: #fff; color: var(--th-ink-2); border-radius: 10px; font-size: 12.5px; font-weight: 700; cursor: pointer;
  box-shadow: var(--th-sh-1); transition: transform .12s, box-shadow .12s;
}
.dash-btn:hover { transform: translateY(-1px); box-shadow: var(--th-sh-2); }
.dash-btn-primary { background: var(--th-navy); border-color: var(--th-navy); color: #fff; }
.dash-btn-primary:hover { background: #0c2861; }

/* ===== KPI ヒーロー ===== */
.dash-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 14px; }
.dash-kpi { position: relative; min-width: 0; background: #fff; border-radius: var(--th-card-r); box-shadow: var(--th-sh-1); padding: 15px 16px 14px; overflow: hidden; transition: transform .16s, box-shadow .16s; }
.dash-kpi:hover { transform: translateY(-2px); box-shadow: var(--th-sh-2); }
/* KPIカード左の色付きバーは廃止（user: パネル一部だけの色線はやめる）。色味はアイコンchipとデルタpillで表現 */
.dash-kpi-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.dash-kpi-ic { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 11px; font-size: 15px; background: #eef2fb; color: var(--th-navy); flex-shrink: 0; }
.dash-kpi.kind-success .dash-kpi-ic { background: #e6f7f4; color: var(--th-teal); }
.dash-kpi.kind-warn .dash-kpi-ic { background: #fdf2e0; color: var(--th-amber); }
.dash-kpi.kind-error .dash-kpi-ic { background: #fde7ee; color: var(--th-pink); }
.dash-delta { display: inline-flex; align-items: center; gap: 3px; padding: 3px 8px; border-radius: 999px; font-size: 11px; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dash-delta i { font-size: 10px; }
.dash-delta.up { background: #e6f7f0; color: #0a8a5b; }
.dash-delta.down { background: #fde7ee; color: #c81e4f; }
.dash-kpi-label { margin-top: 11px; font-size: 12px; font-weight: 600; color: var(--th-mut); }
.dash-kpi-value { margin: 2px 0 11px; font-family: var(--ff-num, inherit); font-size: 25px; font-weight: 800; letter-spacing: -.02em; color: var(--th-ink); line-height: 1.05; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-kpi-foot { display: flex; align-items: center; gap: 10px; }
.dash-progress { flex: 1; height: 6px; border-radius: 999px; background: #eef1f8; overflow: hidden; min-width: 0; }
.dash-progress span { display: block; height: 100%; border-radius: 999px; background: var(--th-navy); }
.dash-kpi.kind-success .dash-progress span { background: var(--th-teal); }
.dash-kpi.kind-warn .dash-progress span { background: var(--th-amber); }
.dash-kpi.kind-error .dash-progress span { background: var(--th-pink); }
.dash-kpi-prev { font-size: 11px; color: var(--th-mut); white-space: nowrap; }

/* ===== グリッド（子は min-width:0 で収める）===== */
.dash-grid { display: grid; gap: 14px; margin-bottom: 14px; }
.dash-grid > * { min-width: 0; }
.dash-grid-trend { grid-template-columns: 2fr 1fr; }
.dash-grid-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 1100px) {
  .dash-kpis { grid-template-columns: repeat(2, 1fr); }
  .dash-grid-trend, .dash-grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 560px) { .dash-kpis { grid-template-columns: 1fr; } }

/* ===== カード共通 ===== */
.dash-card { min-width: 0; background: #fff; border-radius: var(--th-card-r); box-shadow: var(--th-sh-1); overflow: hidden; }
.dash-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 13px 18px; border-bottom: 1px solid var(--th-line); }
.dash-card-ttl { display: inline-flex; align-items: center; gap: 9px; font-size: 14px; font-weight: 800; color: var(--th-ink); min-width: 0; }
.dash-card-ic { display: inline-flex; align-items: center; justify-content: center; width: 27px; height: 27px; border-radius: 8px; font-size: 12px; flex-shrink: 0; }
.dash-card-ic.ic-navy { background: #eef2fb; color: var(--th-navy); }
.dash-card-ic.ic-pink { background: #fde7ee; color: var(--th-pink); }
.dash-card-ic.ic-teal { background: #e6f7f4; color: var(--th-teal); }
.dash-card-ic.ic-amber { background: #fdf2e0; color: var(--th-amber); }
.dash-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--th-pink); color: #fff; font-size: 11px; font-weight: 800; margin-left: 4px; }
.dash-head-note { font-size: 11px; color: var(--th-mut); white-space: nowrap; }
.dash-more { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 700; color: var(--th-navy); text-decoration: none; white-space: nowrap; }
.dash-more:hover { color: var(--th-pink); }
.dash-more i { font-size: 9px; }

/* ===== チャート ===== */
.dash-chart-card .dash-canvas { padding: 12px 16px 14px; height: 250px; box-sizing: border-box; }
.dash-legend { display: inline-flex; align-items: center; gap: 12px; font-size: 11px; color: var(--th-mut); flex-wrap: wrap; }
.dash-legend .lg { display: inline-block; margin-right: 5px; vertical-align: middle; }
.dash-legend .lg-bar { width: 10px; height: 10px; border-radius: 3px; background: var(--th-navy); }
.dash-legend .lg-line { width: 15px; height: 0; border-top: 3px solid var(--th-pink); }

.dash-donut-wrap { position: relative; height: 168px; padding: 12px 16px 0; }
.dash-donut-center { position: absolute; top: calc(50% + 6px); left: 50%; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; pointer-events: none; }
.dash-donut-center .pdc-num { font-family: var(--ff-num, inherit); font-size: 24px; font-weight: 800; color: var(--th-ink); letter-spacing: -.02em; }
.dash-donut-center .pdc-lbl { font-size: 11px; color: var(--th-mut); background: none; }
.dash-legend-list { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 14px; margin: 0; padding: 10px 16px 16px; list-style: none; }
.dash-legend-list li { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--th-ink-2); }
.dash-legend-list li b { color: var(--th-ink); font-variant-numeric: tabular-nums; }
.dash-legend-list .dot { width: 9px; height: 9px; border-radius: 3px; background: #94a3b8; }
.dash-legend-list li:nth-child(1) .dot { background: #10317c; }
.dash-legend-list li:nth-child(2) .dot { background: #ed2e64; }
.dash-legend-list li:nth-child(3) .dot { background: #3a8a7e; }
.dash-legend-list li:nth-child(4) .dot { background: #f59e0b; }
.dash-legend-list li:nth-child(5) .dot { background: #3b82f6; }

/* ===== パネル ===== */
.dash-feed, .dash-appr { list-style: none; margin: 0; padding: 6px; }
.dash-feed-item { display: flex; align-items: center; gap: 9px; padding: 9px 11px; border-radius: 10px; text-decoration: none; color: inherit; transition: background .12s; }
.dash-feed li + li .dash-feed-item, .dash-appr li + li { border-top: 1px solid var(--th-line); }
.dash-feed-item:hover { background: #f6f8fd; }
.dash-feed-date { font-size: 11px; color: var(--th-mut); white-space: nowrap; font-variant-numeric: tabular-nums; }
.dash-feed-title { font-size: 12.5px; color: var(--th-ink-2); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-feed-2line { flex-direction: column; align-items: stretch; gap: 4px; }
.dash-feed-2line .l1 { display: flex; align-items: center; gap: 8px; min-width: 0; }
.dash-feed-2line .l2 { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--th-mut); }
.dash-feed-2line .l2 .dash-feed-date { margin-left: auto; }

.dash-appr li { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; }
.dash-appr li.is-urgent { background: #fef6f8; }
.dash-appr-type { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 24px; border-radius: 8px; font-size: 11px; font-weight: 800; flex-shrink: 0; }
.dash-appr-type.apply { background: #e8eefc; color: var(--th-navy); }
.dash-appr-type.approve { background: #e6f7f0; color: #0a8a5b; }
.dash-appr-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.dash-appr-title { font-size: 12.5px; font-weight: 700; color: var(--th-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-appr-meta { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--th-mut); }
.dash-appr-due { font-size: 11px; font-weight: 800; color: var(--th-mut); white-space: nowrap; }
.dash-appr-due.is-urgent { color: var(--th-pink); }

/* ============================================================
 * データ画面（一覧 / 編集 / カレンダー 等）共通スキン
 *   既存の機能マークアップ（.page-bar / .search-box / .tbl-list / .pager …）を
 *   .app-ui スコープで“ライトプレミアム”に再スキン。機能・DOM はそのまま。
 * ============================================================ */

/* —— ページバー（タイトル＋操作）：ヘッダー直下に sticky 追従 ——
 * 高さは 46px で完全固定（折返し禁止）。thead の吸着位置
 * calc(--header-h + --pagebar-h) と常に一致し、追従時の余白を作らない。 */
.app-ui { --pagebar-h: 46px; }
.app-ui .page-bar {
  position: sticky;
  top: var(--header-h);
  z-index: 30;
  background: #fff;
  border: none;
  border-bottom: 1px solid var(--th-line);
  box-shadow: 0 6px 10px -10px rgba(13,27,62,.25);
  padding: 0 10px 0 2px;
  height: var(--pagebar-h);
  min-height: 0;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 10px;
  overflow: hidden;
}
.app-ui .page-ttl { font-size: 15px; font-weight: 800; letter-spacing: -.02em; color: var(--th-ink); gap: 10px; min-width: 0; white-space: nowrap; }
.app-ui .page-bar .page-actions { margin-left: auto; flex-shrink: 0; flex-wrap: nowrap; }
.app-ui .page-bar .ps-label { white-space: nowrap; }
.app-ui .page-ttl i { color: var(--th-navy); }
.app-ui .page-ttl .ttl-status { display:inline-flex; align-items:center; margin-left:4px; }
.app-ui .page-ttl .ttl-status select { font-size:12px; font-weight:700; padding:5px 28px 5px 12px; border-radius:8px; height:auto; }
/* 在留カード AI OCR パネル */
.app-ui .ocr-panel { display:flex; align-items:center; gap:12px; flex-wrap:wrap; }
.app-ui .ocr-panel.full { grid-column: 1 / -1; }
.app-ui .ocr-panel input[type="file"] { flex:0 0 auto; max-width:100%; }
.app-ui .ocr-status { font-size:12px; font-weight:600; color:var(--th-mut); }
.app-ui .ocr-status.is-ok { color:var(--th-teal); }
.app-ui .ocr-status.is-ng { color:var(--th-pink); }
.app-ui .page-actions { gap: 8px; }

/* —— ボタン：配色を after（＝global のカラーボタン）に合わせる —— */
.app-ui .page-actions .btn { border-radius: 8px; font-weight: 700; }
.app-ui .page-actions .btn-add { background: var(--c-main); border-color: var(--c-main); color: #fff; }
.app-ui .page-actions .btn-add:hover { background: #0c2861; }

/* —— 検索パネル：Before と同じ淡い色付き —— */
.app-ui .search-box.is-labeled {
  background: #eef2f9; border: 1px solid var(--th-line);
  border-radius: var(--th-card-r); box-shadow: var(--th-sh-1);
}
.app-ui .search-box.is-labeled .search-box-body { padding: 16px 18px; gap: 11px 16px; }
.app-ui .search-field label { color: var(--th-mut); font-weight: 600; }
.app-ui .search-field > input,
.app-ui .search-field > select,
.app-ui .search-field-range input {
  border: 1px solid var(--th-line); border-radius: 9px; background: #fbfcfe;
  min-width: 0; max-width: 100%; box-sizing: border-box;
}
/* 検索グリッドの横溢れ防止（可変列は minmax(0,1fr)） */
.app-ui .search-box-body,
.app-ui .search-box-body.col-2,
.app-ui .search-box-body.col-3,
.app-ui .search-box-body.col-4,
.app-ui .search-box-body.col-6 { grid-template-columns: repeat(var(--sb-cols,3), minmax(0,1fr)); }
.app-ui .search-box-body.col-2 { --sb-cols:2; }
.app-ui .search-box-body.col-3 { --sb-cols:3; }
.app-ui .search-box-body.col-4 { --sb-cols:4; }
.app-ui .search-box-body.col-6 { --sb-cols:6; }
.app-ui .search-field { min-width: 0; }
.app-ui .search-field-range { display: flex; align-items: center; gap: 6px; min-width: 0; }
.app-ui .search-field-range input { flex: 1 1 0; }
.app-ui .search-field > input:focus,
.app-ui .search-field > select:focus,
.app-ui .search-field-range input:focus {
  border-color: var(--th-navy); background: #fff; outline: none;
  box-shadow: 0 0 0 3px rgba(16, 49, 124, .10);
}
.app-ui .search-chips.has-chips { border-bottom-color: var(--th-line); }
.app-ui .search-chips-lead { color: var(--th-navy); }
.app-ui .cond-chip { border-color: #d8e0f0; }
.app-ui .cond-chip-k { color: var(--th-navy); }

/* —— テーブル：カード化・行区切りのみ・ゆったり —— */
.app-ui .tbl-list {
  border: 1px solid var(--th-line); border-radius: var(--th-card-r); box-shadow: var(--th-sh-1);
  overflow-x: auto; /* 列が多く親幅を超える場合は横スクロール（操作列の見切れ防止） */
}
.app-ui .tbl-list thead th {
  background: #fbfcff; color: var(--th-mut);
  font-size: 11px; font-weight: 700; letter-spacing: .02em; text-transform: none;
  border-bottom: 2px solid var(--th-line); padding: 0 14px; height: 52px;
  position: static; /* overflow-x:auto と両立しないため縦追従は無効化（ヘッダーがテーブル途中に浮く不具合を解消） */
}
/* ヘッダー実高＝行高(54px)に一致：th 52px＋border-bottom2px=54。sort列は th を 0 にし link 側で高さを揃える */
.app-ui .tbl-list thead th.sort-th { padding: 0; }
.app-ui .tbl-list thead th.sort-th .sort-link { padding: 0 14px; height: 52px; }
.app-ui .tbl-list.tbl-scroll thead th { top: 0; } /* グリッドは内部スクロール基準 */
.app-ui .dash-card .tbl-list thead th { position: static; top: auto; } /* ダッシュボードのカード内テーブルは追従不要（上部余白の原因を除去） */
.app-ui .tbl-list thead th .sort-link { color: var(--th-mut); }
.app-ui .tbl-list thead th .sort-link.is-asc,
.app-ui .tbl-list thead th .sort-link.is-desc { color: var(--th-navy); }
body.app-ui .tbl-list tbody td,
body.app-ui[data-page] .tbl-list tbody td { height: 54px; padding: 12px 14px; border-bottom: 1px solid #eef1f8; }
.app-ui .tbl-list tbody tr:hover td { background: #f7f9fe; }
.app-ui .tbl-list tfoot th { background: #fbfcfe; border-top: 2px solid var(--th-line); color: var(--th-ink); }
.app-ui .tbl-list .link-text .c2-main { color: var(--th-navy); font-weight: 700; }
.app-ui .tbl-list .chip { border-radius: 999px; font-weight: 700; }

/* 行内アクションボタン */
.app-ui .btn-normal-min { border-radius: 8px; }

/* —— bulk-bar —— */
.app-ui .bulk-bar { background: var(--th-ink); color: #fff; border: none; border-radius: 12px; box-shadow: var(--th-sh-2); }
.app-ui .bulk-bar b { color: #fff; }

/* —— フッター・ページャー —— */
.app-ui .list-foot { padding: 13px 2px 4px; }
.app-ui .pager li a {
  border-radius: 9px; border: 1px solid var(--th-line); background: #fff;
  color: var(--th-ink-2); box-shadow: var(--th-sh-1);
}
.app-ui .pager li a:hover { border-color: var(--th-navy); color: var(--th-navy); }
.app-ui .pager li.is-current a { background: var(--th-navy); border-color: var(--th-navy); color: #fff; }

/* モーダルは共通シェル（routine.php + 既存 .modal-window）を3バージョン共通で使用＝意図的に統一（pro専用の上書きは置かない）。 */

/* —— 編集フォーム（.edit-box セクション）—— */
.app-ui .edit-box {
  background: #fff; border: 1px solid var(--th-line);
  border-radius: var(--th-card-r); box-shadow: var(--th-sh-1); overflow: hidden; margin-bottom: 14px;
}
.app-ui .edit-box-header { background: #fbfcff; border-bottom: 1px solid var(--th-line); color: var(--th-ink); font-weight: 800; }
.app-ui .edit-box-header i { color: var(--th-navy); }
.app-ui .edit-field > input,
.app-ui .edit-field > select,
.app-ui .edit-field > textarea { border: 1px solid var(--th-line); border-radius: 9px; background: #fbfcfe; }
.app-ui .edit-field > input:focus,
.app-ui .edit-field > select:focus,
.app-ui .edit-field > textarea:focus { border-color: var(--th-navy); background: #fff; outline: none; box-shadow: 0 0 0 3px rgba(16, 49, 124, .10); }

/* —— カレンダー —— */
.app-ui .calendar-grid {
  background: #fff; border-radius: var(--th-card-r); box-shadow: var(--th-sh-1);
  overflow: hidden; border-collapse: separate; border-spacing: 0;
}
.app-ui .calendar-grid thead th { background: #fbfcff; color: var(--th-mut); border-bottom: 2px solid var(--th-line); padding: 11px 0; font-weight: 700; }
.app-ui .calendar-grid thead th.sunday { color: var(--th-pink); }
.app-ui .calendar-grid thead th.saturday { color: var(--th-navy); }
.app-ui .calendar-grid td.today { background: #f2f6ff; }
.app-ui .grid-event { border-radius: 6px; font-weight: 700; }

/* —— 詳細ページ（お知らせ/お問い合わせ）—— */
.app-ui .detail-card,
.app-ui .anchor-nav { border: 1px solid var(--th-line); border-radius: var(--th-card-r); box-shadow: var(--th-sh-1); }
.app-ui .detail-card-head { border-bottom-color: var(--th-line); color: var(--th-ink); font-weight: 800; }
.app-ui .detail-card-head i { color: var(--th-navy); }
.app-ui .detail-title { color: var(--th-ink); font-weight: 800; }
.app-ui .detail-crumb a { color: var(--th-navy); }
.app-ui .anchor-nav a.is-active { background: #eef3ff; color: var(--th-navy); border-left-color: var(--th-navy); }
.app-ui .timeline-dot { border-color: var(--th-navy); }
.app-ui .reply-area:focus { border-color: var(--th-navy); box-shadow: 0 0 0 3px rgba(16, 49, 124, .10); }

/* ============================================================
 * 本番品質化：共通コンポーネント（inline style 廃止に伴う class 集約）
 * ============================================================ */

/* —— 汎用ユーティリティ —— */
.app-ui .tar { text-align: right; }
.app-ui .tac { text-align: center; }
.app-ui .fc-mut { color: var(--th-mut); }
.app-ui .fw-b { font-weight: 700; }
.app-ui .ps-label { color: var(--th-mut); font-size: 11.5px; font-weight: 700; }
.app-ui .disp-val { font-size: 12.5px; color: var(--th-ink); }
.app-ui .disp-val.is-strong { font-weight: 800; color: var(--th-navy); }
.app-ui .cell-sub { font-size: 11px; color: var(--th-mut); }
.app-ui .cell-name { font-weight: 700; color: var(--th-navy); }
.app-ui .box-ok { background:#e8f8f0; border:1px solid #b7e6cd; color:#0d7a4b; padding:10px 14px; border-radius:10px; font-weight:700; margin-bottom:10px; }
.app-ui .box-error { background:#fff6f6; border:1px solid #f0c2c0; color:#d3433b; padding:10px 14px; border-radius:10px; font-weight:700; white-space:pre-line; margin-bottom:10px; }
.app-ui .empty-note { padding:40px 0; text-align:center; color:var(--th-mut); }
.app-ui .tbl-list .empty-note { padding:40px 0; }

/* —— 一覧 操作列（見切れ防止：列は縮めない・ボタンはコンパクト） —— */
.app-ui .tbl-actions { white-space: nowrap; text-align: center; }
.app-ui .tbl-list td.tbl-actions { padding-left: 6px; padding-right: 6px; }
.app-ui .btn-min {
  display: inline-flex; align-items: center; gap: 3px;
  height: 26px; padding: 0 7px; margin: 0 1px; border-radius: 7px;
  font-size: 10.5px; font-weight: 700; border: 1px solid transparent;
  text-decoration: none; cursor: pointer; background: #eef2f9; color: var(--th-ink-2);
  white-space: nowrap;
}
.app-ui .btn-min:hover { filter: brightness(.96); }
.app-ui .btn-min.is-edit { background: #e8f0fd; color: #2560c8; }
.app-ui .btn-min.is-copy { background: #eef2f9; color: var(--th-ink-2); }
.app-ui .btn-min.is-doc  { background: #e7f6f2; color: #0f9b8e; }
.app-ui .btn-min.is-danger { background: #fdecec; color: #d3433b; }

/* —— アバター（一覧・プロフィール） —— */
.app-ui .avatar-fallback { display:inline-flex; align-items:center; justify-content:center; width:34px; height:34px; border-radius:50%; background:#eef2f9; color:var(--th-navy); font-weight:800; }
.app-ui .avatar-img { width:34px; height:34px; border-radius:50%; object-fit:cover; }

/* —— ダッシュボード —— */
.app-ui .dash-grid { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:12px; margin-bottom:16px; }
.app-ui .dash-grid.cols-3 { grid-template-columns:repeat(3,minmax(0,1fr)); }
.app-ui .dash-kpi { background:#fff; border:1px solid var(--th-line); border-radius:14px; box-shadow:var(--th-sh-1); padding:14px 16px; }
.app-ui .dash-kpi .k-label { font-size:11.5px; color:var(--th-mut); font-weight:700; display:flex; align-items:center; gap:6px; }
.app-ui .dash-kpi .k-label i { color:var(--th-navy); }
.app-ui .dash-kpi .k-val { font-size:26px; font-weight:800; color:var(--th-ink); line-height:1.2; margin-top:6px; font-variant-numeric:tabular-nums; }
.app-ui a.dash-kpi { text-decoration:none; color:inherit; display:block; transition:border-color .16s, box-shadow .16s, transform .16s; }
.app-ui a.dash-kpi:hover { border-color:var(--th-navy); box-shadow:var(--th-sh-2); transform:translateY(-2px); }
.app-ui .dash-card-h .dash-more { margin-left:auto; font-size:12px; font-weight:700; color:var(--th-navy); text-decoration:none; display:inline-flex; align-items:center; gap:4px; }
.app-ui .dash-card-h .dash-more:hover { text-decoration:underline; }
.app-ui .dash-kpi .k-unit { font-size:12px; color:var(--th-mut); font-weight:700; margin-left:3px; }
.app-ui .dash-cols { display:grid; grid-template-columns:minmax(0,1.2fr) minmax(0,1fr); gap:16px; align-items:start; }
.app-ui .dash-cols.even { grid-template-columns:minmax(0,1fr) minmax(0,1fr); }
.app-ui .dash-cols > * { min-width:0; }
.app-ui .dash-card { background:#fff; border:1px solid var(--th-line); border-radius:14px; box-shadow:var(--th-sh-1); margin-bottom:16px; overflow:hidden; }
.app-ui .dash-card-h { background:#fbfcff; border-bottom:1px solid var(--th-line); padding:10px 14px; font-weight:800; color:var(--th-ink); display:flex; align-items:center; gap:8px; }
.app-ui .dash-card-h i { color:var(--th-navy); }
.app-ui .dash-card-b { padding:12px 14px; }
.app-ui .alert-list { list-style:none; margin:0; padding:0; }
.app-ui .alert-list li { display:flex; align-items:center; justify-content:space-between; padding:10px 2px; border-bottom:1px solid #eef1f8; }
.app-ui .alert-list li:last-child { border-bottom:none; }
.app-ui .alert-list .a-name { display:flex; align-items:center; gap:8px; font-weight:700; color:var(--th-ink-2); font-size:12.5px; text-decoration:none; }
.app-ui .a-badge { display:inline-flex; min-width:20px; height:20px; align-items:center; justify-content:center; border-radius:10px; font-size:11px; font-weight:800; padding:0 6px; }
.app-ui .a-ok { background:var(--st-approved-bg); color:var(--st-approved-fg); }
.app-ui .a-warn { background:var(--st-warn-bg); color:var(--st-warn-fg); }
.app-ui .a-ng { background:var(--st-rejected-bg); color:var(--st-rejected-fg); }
.app-ui .list-line { display:block; padding:8px 2px; border-bottom:1px solid #eef1f8; text-decoration:none; }
.app-ui .list-line .ll-ttl { font-weight:700; font-size:12.5px; color:var(--th-ink); }
.app-ui .list-line .ll-ttl.is-link { color:var(--th-navy); }
.app-ui .list-line .ll-sub { font-size:11px; color:var(--th-ink-2); margin-top:2px; }
.app-ui .list-line .ll-meta { font-size:10.5px; color:var(--th-mut); margin-top:2px; }

/* —— プロフィール（スタッフ・ダッシュボード） —— */
.app-ui .prof { display:flex; gap:14px; align-items:center; }
.app-ui .prof-ava { width:64px; height:64px; border-radius:50%; object-fit:cover; background:#eef2f9; color:var(--th-navy); display:flex; align-items:center; justify-content:center; font-weight:800; font-size:24px; flex:0 0 64px; }
.app-ui .prof-name { font-size:18px; font-weight:800; color:var(--th-ink); }
.app-ui .prof-sub { font-size:12px; color:var(--th-mut); margin-top:2px; }
.app-ui .alert-bar { background:#fff8ec; border:1px solid #f4d79a; color:#8a5a00; border-radius:12px; padding:10px 14px; margin-bottom:14px; font-weight:700; font-size:12.5px; display:flex; align-items:center; gap:8px; }
.app-ui .job-card { border:1px solid var(--th-line); border-radius:10px; padding:10px 12px; margin-bottom:8px; }
.app-ui .job-card .j-ttl { font-weight:700; color:var(--th-navy); font-size:13px; }
.app-ui .job-card .j-meta { font-size:11px; color:var(--th-mut); margin-top:3px; }

/* —— メッセージ トーク —— */
.app-ui .talk { display:flex; flex-direction:column; gap:12px; padding:16px 4px; }
.app-ui .talk-row { display:flex; gap:10px; max-width:72%; }
.app-ui .talk-row.is-self { align-self:flex-end; flex-direction:row-reverse; }
.app-ui .talk-row.is-other { align-self:flex-start; }
.app-ui .talk-ava { width:32px; height:32px; border-radius:50%; flex:0 0 32px; display:flex; align-items:center; justify-content:center; font-weight:800; font-size:12px; color:#fff; }
.app-ui .talk-ava.is-staff { background:#4a90d9; }
.app-ui .talk-ava.is-company { background:#0f9b8e; }
.app-ui .talk-ava.is-admin { background:var(--th-pink); }
.app-ui .talk-body { background:#fff; border:1px solid var(--th-line); border-radius:12px; padding:9px 13px; font-size:12.5px; color:var(--th-ink); box-shadow:var(--th-sh-1); }
.app-ui .talk-row.is-self .talk-body { background:#fff0f4; border-color:#f7c9d6; }
.app-ui .talk-meta { font-size:10.5px; color:var(--th-mut); margin-top:4px; }
.app-ui .talk-row.is-self .talk-meta { text-align:right; }

/* —— マスター詳細（アカウント管理） —— */
.app-ui .usr-split { display:grid; grid-template-columns:1.1fr 1fr; gap:16px; align-items:start; }
.app-ui .usr-row.is-active td { background:#eef4ff !important; }

/* —— エントリー（多言語フォーム／ランディング） —— */
.app-ui .entry-wrap { max-width:820px; margin:0 auto; padding:20px 16px 60px; }
.app-ui .entry-head { text-align:center; margin-bottom:20px; }
.app-ui .entry-logo { width:56px; height:56px; border-radius:16px; background:var(--th-navy); color:#fff; display:inline-flex; align-items:center; justify-content:center; font-size:24px; margin-bottom:10px; }
.app-ui .entry-title { font-size:22px; font-weight:800; color:var(--th-ink); }
.app-ui .entry-lead { font-size:12.5px; color:var(--th-mut); margin-top:6px; }
.app-ui .lang-switch { text-align:center; margin-bottom:16px; display:flex; gap:6px; justify-content:center; flex-wrap:wrap; }
.app-ui .lang-switch a { font-size:11.5px; padding:4px 10px; border:1px solid var(--th-line); border-radius:999px; color:var(--th-ink-2); text-decoration:none; background:#fff; }
.app-ui .lang-switch a.is-on { background:var(--th-navy); color:#fff; border-color:var(--th-navy); }
.app-ui .agree-box { background:#fbfcff; border:1px solid var(--th-line); border-radius:12px; padding:12px 14px; margin:14px 0; }
.app-ui .agree-check { display:flex; align-items:flex-start; gap:8px; font-size:12.5px; }
.app-ui .lp { max-width:560px; margin:0 auto; padding:48px 20px; text-align:center; }
.app-ui .lp-grid { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.app-ui .lp-card { display:flex; align-items:center; gap:12px; background:#fff; border:1px solid var(--th-line); border-radius:14px; box-shadow:var(--th-sh-1); padding:16px 18px; text-decoration:none; }
.app-ui .lp-card:hover { box-shadow:var(--th-sh-2); }
.app-ui .lp-flag { font-size:22px; flex:0 0 28px; }
.app-ui .lp-lang { font-weight:800; color:var(--th-ink); font-size:15px; }
.app-ui .lp-lang-sub { font-size:11px; color:var(--th-mut); }

/* —— 汎用の縦積みインライン抑制 —— */
.app-ui .tgl-check { display:inline-flex; align-items:center; gap:6px; height:28px; }
.app-ui .edit-box-block { display:block; }
.app-ui .reply-text { width:100%; box-sizing:border-box; }
.app-ui .reply-file-note { font-size:11px; color:var(--th-mut); }

/* —— チャット入力バー（メッセージ返信：添付＋本文＋送信を1バーに） —— */
.app-ui .chat-input {
  display:flex; align-items:flex-end; gap:8px;
  background:#fff; border:1px solid var(--th-line); border-radius:22px;
  padding:8px 8px 8px 6px; box-shadow:var(--th-sh-1);
}
.app-ui .chat-attach {
  flex:0 0 36px; width:36px; height:36px; border-radius:50%;
  display:flex; align-items:center; justify-content:center;
  background:#eef2f9; color:var(--th-navy); cursor:pointer; font-size:15px;
  transition:background .12s;
}
.app-ui .chat-attach:hover { background:#e2e9f6; }
.app-ui .chat-attach input[type="file"] { display:none; }
.app-ui .chat-text {
  flex:1 1 auto; min-width:0; border:none; outline:none; resize:none;
  background:transparent; font-size:13px; line-height:1.5; padding:8px 2px;
  max-height:120px; box-sizing:border-box;
}
.app-ui .chat-text:focus { box-shadow:none; }
.app-ui .chat-send {
  flex:0 0 40px; width:40px; height:40px; border-radius:50%; border:none;
  background:var(--th-pink); color:#fff; font-size:15px; cursor:pointer;
  display:flex; align-items:center; justify-content:center;
  transition:filter .12s;
}
.app-ui .chat-send:hover { filter:brightness(1.08); }
.app-ui .chat-file-chip {
  display:none; margin:6px 4px 0; font-size:11px; color:var(--th-navy);
  align-items:center; gap:6px; font-weight:700;
}
.app-ui .chat-file-chip.has-file { display:inline-flex; }
.app-ui .chat-file-chip i { color:#d3433b; }
.app-ui .chat-note { font-size:10.5px; color:var(--th-mut); margin:6px 4px 0; }
.app-ui .talk-img { max-width:220px; max-height:220px; border-radius:8px; margin-top:6px; display:block; }
.app-ui .talk-file { display:inline-flex; align-items:center; gap:6px; margin-top:6px; color:var(--th-navy); text-decoration:none; font-weight:700; font-size:12px; }
.app-ui .talk-file i { color:#d3433b; }
.app-ui .fc-sub { font-size:11px; color:var(--th-mut); }
.app-ui .mw-40 { max-width:40px; }
.app-ui .tbl-list.tbl-flat { border:none; box-shadow:none; border-radius:0; }
.app-ui .auth-lead { font-size:12px; color:var(--th-mut); margin-bottom:14px; }
.app-ui .auth-foot { margin-top:14px; }
.app-ui a.chip { text-decoration:none; }
.app-ui .note-text { font-size:12.5px; color:var(--th-ink-2); line-height:1.7; }
.app-ui .doc-id { margin-left:10px; color:var(--th-mut); font-size:13px; }
.app-ui .btn-c { max-width:320px; margin:0 auto; }
.app-ui .agree-check input { margin-top:2px; }
.app-ui .auth-logo.is-center { margin:0 auto 12px; }
.app-ui .auth-logo.is-teal { background:var(--th-teal); }
.app-ui .lp-foot { margin-top:22px; font-size:11.5px; }
.app-ui .foot-link { text-align:center; margin-top:16px; font-size:11.5px; }

/* —— 状態セレクトの背景色（sc-*）。theme の select 既定背景より優先させる —— */
.app-ui select.js-status-color.sc-approved { background-color:var(--st-approved-bg); color:var(--st-approved-fg); border-color:var(--st-approved-fg); }
.app-ui select.js-status-color.sc-pending  { background-color:var(--st-pending-bg);  color:var(--st-pending-fg);  border-color:var(--st-pending-fg); }
.app-ui select.js-status-color.sc-draft    { background-color:var(--st-draft-bg);    color:var(--st-draft-fg);    border-color:var(--st-draft-fg); }
.app-ui select.js-status-color.sc-rejected { background-color:var(--st-rejected-bg); color:var(--st-rejected-fg); border-color:var(--st-rejected-fg); }
.app-ui select.js-status-color.sc-paid     { background-color:var(--st-info-bg);     color:var(--st-info-fg);     border-color:var(--st-info-fg); }
.app-ui select.js-status-color.sc-overdue  { background-color:var(--st-overdue-bg);  color:var(--st-overdue-fg);  border-color:var(--st-overdue-fg); }

/* —— 帳票（請求書・契約書 PDFプレビュー：画面表示分。印刷は print.css @media print） —— */
.doc-wrap { background:#e9edf5; min-height:100vh; }
.doc-actions { max-width:800px; margin:14px auto 0; text-align:right; }
.doc-preview { max-width:800px; margin:14px auto 40px; background:#fff; padding:40px 44px; box-shadow:0 6px 24px rgba(0,0,0,.12); font-size:12.5px; color:#111; line-height:1.7; }
.doc-title { font-size:24px; font-weight:800; text-align:center; letter-spacing:8px; margin-bottom:24px; color:#111; }
.doc-title.sm { font-size:22px; letter-spacing:6px; margin-bottom:8px; }
.dp-lead { text-align:center; font-size:11.5px; color:#444; margin-bottom:22px; }
.dp-top { display:flex; justify-content:space-between; gap:20px; margin-bottom:20px; }
.dp-to .to-name { font-size:17px; font-weight:800; border-bottom:2px solid #111; padding-bottom:4px; margin-bottom:6px; }
.dp-from { font-size:11.5px; text-align:right; color:#333; }
.dp-from .fr-name { font-size:14px; font-weight:800; color:#111; }
.dp-amount { border:2px solid #111; padding:10px 16px; font-size:18px; font-weight:800; text-align:center; margin:16px 0 20px; }
.dp-meta { font-size:11.5px; color:#333; margin-bottom:14px; display:flex; gap:24px; flex-wrap:wrap; }
.dp-tbl { width:100%; border-collapse:collapse; font-size:12px; margin-bottom:18px; }
.dp-tbl th, .dp-tbl td { border:1px solid #333; padding:6px 8px; vertical-align:top; }
.dp-tbl thead th { background:#f0f0f0; }
.dp-tbl.form th { background:#f5f5f5; width:150px; text-align:left; font-weight:700; }
.dp-sum { width:280px; margin-left:auto; margin-top:12px; border-collapse:collapse; font-size:12.5px; }
.dp-sum th, .dp-sum td { border:1px solid #333; padding:6px 10px; }
.dp-sum .grand { font-size:15px; font-weight:800; background:#f0f0f0; }
.dp-note { margin-top:20px; font-size:11.5px; border:1px solid #ccc; padding:10px; }
.dp-parties { display:flex; gap:20px; margin-bottom:20px; }
.dp-party { flex:1; border:1px solid #333; padding:10px 12px; }
.dp-party .p-ttl { font-weight:800; font-size:11px; background:#f0f0f0; margin:-10px -12px 8px; padding:5px 12px; border-bottom:1px solid #333; }
.dp-sign { margin-top:28px; font-size:12px; }
.dp-sign .row { display:flex; justify-content:space-between; gap:20px; margin-top:14px; }
.dp-sign .box { flex:1; border-top:1px solid #333; padding-top:6px; }
@media print { .doc-wrap { background:#fff; } .doc-actions { display:none; } .doc-preview { box-shadow:none; margin:0; padding:0; max-width:100%; } }

@media (max-width:1000px){
  .app-ui .dash-grid, .app-ui .dash-grid.cols-3 { grid-template-columns:1fr; }
  .app-ui .dash-cols, .app-ui .dash-cols.even { grid-template-columns:1fr; }
  .app-ui .usr-split { grid-template-columns:1fr; }
  .app-ui .lp-grid { grid-template-columns:1fr; }
}
.app-ui .auth-ok { background:#e8f8f0; border:1px solid #b7e6cd; color:#0d7a4b; padding:10px 14px; border-radius:10px; font-weight:700; margin-bottom:10px; font-size:12.5px; }
.app-ui .btn-row { display:flex; gap:8px; justify-content:flex-end; }
.app-ui .fw-ink { font-weight:700; color:var(--th-ink); }
.app-ui .edit-box.mb0 { margin-bottom:0; }
.app-ui .sum-th { font-size:14px; }
.app-ui .sum-val { font-size:15px; color:var(--th-navy); font-weight:800; }
