/* 共通UIキットのスタイル。theme.css の :root トークンを使用。theme.css の後に読込。 */

/* ---- データテーブル ツールバー ---- */
.dt-toolbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-bottom: 10px;
}
.dt-search { position: relative; flex: 1 1 220px; min-width: 160px; }
.dt-search-ic { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); opacity: .5; font-size: 13px; pointer-events: none; }
.dt-search .input { width: 100%; padding-left: 30px; }
.dt-filter { min-width: 120px; }
.dt-extra { display: flex; gap: 8px; align-items: center; }
.dt-clear { white-space: nowrap; }
.dt-count { margin-left: auto; color: var(--muted, #5b6573); font-size: 12px; white-space: nowrap; }

.table-wrap { overflow: auto; border: 1px solid var(--line, #d3d9e2); border-radius: var(--radius, 10px); background: var(--surface, #fff); }
.table-wrap .table { margin: 0; }
.table th.is-sortable { cursor: pointer; user-select: none; white-space: nowrap; }
.table th.is-sortable:hover { background: #e9eef5; }
.ta-right { text-align: right; }
.ta-center { text-align: center; }
.table tr.is-clickable { cursor: pointer; }
.table tr.is-clickable:hover td { background: #eef4fb; }
.dt-empty { text-align: center; color: var(--muted, #5b6573); padding: 28px 12px; }

/* ---- チップ / ステータスラベル ---- */
.chip { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 999px;
  background: #eef1f5; color: var(--muted, #5b6573); border: 1px solid var(--line, #d3d9e2); }
.chip-brand { background: #e8eef6; color: var(--brand, #1f3a5f); border-color: #c9d8ea; }
.chip-ok { background: #e3f3ea; color: var(--ok, #1e7d46); border-color: #bfe3cd; }
.chip-warn { background: #fdeede; color: var(--warn, #b15c00); border-color: #f3d4ab; }
.chip-danger { background: #fae3e1; color: var(--danger, #c2261b); border-color: #f0c2bd; }
.status-label { font-size: 12px; color: var(--text, #1f2937); vertical-align: middle; }

/* ---- レイヤー: モーダル / ドロワー ---- */
body.ui-locked { overflow: hidden; }
#ui-layer-host { position: fixed; inset: 0; z-index: 1000; pointer-events: none; }
.ui-overlay { position: fixed; inset: 0; pointer-events: auto; display: flex; }
.ui-scrim { position: absolute; inset: 0; background: rgba(17, 26, 42, .46); }
.ui-overlay-modal { align-items: center; justify-content: center; padding: 24px; }
.ui-overlay-drawer { justify-content: flex-end; }

.ui-modal, .ui-drawer {
  position: relative; background: var(--surface, #fff); border-radius: var(--radius, 10px);
  box-shadow: 0 18px 50px rgba(0,0,0,.3); display: flex; flex-direction: column;
  max-height: calc(100vh - 48px); animation: ui-pop .14s ease-out;
}
.ui-modal { width: min(720px, 100%); }
.ui-modal.lg { width: min(960px, 100%); }
.ui-modal.sm { width: min(480px, 100%); }
.ui-drawer { width: min(560px, 100%); height: 100vh; max-height: 100vh; border-radius: 0; }
.ui-drawer.left { animation: ui-slide-l .16s ease-out; }
.ui-drawer { animation: ui-slide-r .16s ease-out; }
@keyframes ui-pop { from { transform: translateY(8px) scale(.98); opacity: 0; } }
@keyframes ui-slide-r { from { transform: translateX(40px); opacity: .4; } }
@keyframes ui-slide-l { from { transform: translateX(-40px); opacity: .4; } }

.ui-panel-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line, #d3d9e2); }
.ui-panel-title { font-weight: 700; font-size: 16px; color: var(--text, #1f2937); flex: 1; }
.ui-panel-sub { padding: 8px 18px 0; color: var(--muted, #5b6573); font-size: 13px; }
.ui-panel-body { padding: 16px 18px; overflow: auto; }
.ui-panel-foot { padding: 12px 18px; border-top: 1px solid var(--line, #d3d9e2); display: flex; gap: 8px; justify-content: flex-end; }
.ui-x { background: transparent; border: 0; font-size: 22px; line-height: 1; color: var(--muted, #5b6573); cursor: pointer; padding: 2px 6px; border-radius: 6px; }
.ui-x:hover { background: #eef1f5; color: var(--text, #1f2937); }

/* ---- カレンダー ---- */
.cal { border: 1px solid var(--line, #d3d9e2); border-radius: var(--radius, 10px); overflow: hidden; background: var(--surface, #fff); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-head .cal-h { text-align: center; font-size: 12px; font-weight: 700; color: var(--muted, #5b6573); padding: 8px 0; background: #f3f6fa; border-bottom: 1px solid var(--line, #d3d9e2); }
.cal-cell { min-height: 76px; border-right: 1px solid var(--line, #eef1f5); border-bottom: 1px solid var(--line, #eef1f5); padding: 6px; position: relative; }
.cal-cell.is-clickable { cursor: pointer; }
.cal-cell.is-clickable:hover { background: #eef4fb; }
.cal-empty { background: #fafbfc; }
.cal-d { font-size: 12px; font-weight: 700; color: var(--text, #1f2937); }
.cal-cell.is-today { outline: 2px solid var(--brand, #1f3a5f); outline-offset: -2px; }
.cal-cell.heat-ok { background: #e7f4ec; }
.cal-cell.heat-warn { background: #fdf0e0; }
.cal-cell.heat-danger { background: #fae4e2; }
.cal-rate { font-size: 11px; color: var(--muted, #5b6573); margin-top: 2px; }

/* ---- 汎用ミニ表示（ドリルダウン内） ---- */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; font-size: 13px; }
.kv dt { color: var(--muted, #5b6573); }
.kv dd { margin: 0; color: var(--text, #1f2937); }
.mini-list { display: flex; flex-direction: column; gap: 6px; }
.mini-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line, #d3d9e2); border-radius: 8px; background: #fff; }
.mini-row.is-clickable { cursor: pointer; } .mini-row.is-clickable:hover { background: #eef4fb; }
.mini-grow { flex: 1; min-width: 0; }
.unit { font-size: 12px; font-weight: 600; color: var(--muted, #5b6573); margin-left: 2px; }
.section-label { font-size: 12px; font-weight: 700; color: var(--muted, #5b6573); margin: 14px 0 6px; text-transform: none; }

@media (max-width: 640px) {
  .dt-count { margin-left: 0; order: 5; flex-basis: 100%; }
  .ui-overlay-modal { padding: 0; align-items: stretch; }
  .ui-modal { width: 100%; max-height: 100vh; border-radius: 0; }
  .cal-cell { min-height: 56px; }
}
