/* Shared application frame; page-specific data layouts remain in their apps. */
body.ui-shell {
  --app-header-height: 64px;
  --sidebar-width: 200px;
  --app-sidebar-width: 200px;
  padding-top: var(--app-header-height);
  margin: 0;
}
.ui-shell .wrapper { min-width: 0; }
.ui-shell main { min-width: 0; padding: var(--spacing-4); }
.ui-shell main:has(> .settings-main) { padding: 0; }
.ui-shell .settings-main { min-width: 0; max-width: none; padding: var(--spacing-4); }
.ui-shell .container-fluid { padding-inline: 0; }
/* The page frame owns outer spacing. Bootstrap py-* must not add a second gutter. */
.ui-shell :is(main, .settings-main) > .container-fluid { padding-block: 0 !important; }
.ui-shell :is(main, .settings-main) > :is(.kouiki-main-inner, .tems-inner) { max-width: none; margin: 0; }
.ui-shell :is(main, .settings-main) > .tl-page { max-width: none; margin: 0; padding: 0; }
.ui-shell :is(main, main > .container-fluid) > :is(h1, h2) { margin-block: 0 var(--spacing-4) !important; }
.ui-shell .wrapper > header { height: var(--app-header-height); padding: 4px 16px; z-index: 300; }
.ui-shell .header-logo { height: 40px; max-width: 200px; object-fit: contain; }
.ui-shell .header-right { min-width: 0; gap: 2px; }
.ui-shell .header-user-info { font-size: var(--ui-font-note); line-height: 1.5; }
.ui-shell .header-nav-row { gap: 12px; }
.ui-shell .header-nav .nav-menu { gap: 4px; }
.ui-shell .header-nav .nav-item { border: 0; padding: 0; background: transparent; }
.ui-shell .header-nav .link { padding: 4px 8px; min-height: 32px; font-size: var(--ui-font-body); gap: 8px; border-radius: var(--radius-md); transition: background-color 150ms ease; }
/* ドロップダウンの無い項目（広域・日次）もホバーが分かるよう、全項目で背景を付ける */
.ui-shell .header-nav .nav-item:is(:hover, :focus-within) > .link:not(.link-disabled) { background: var(--bg-tertiary); text-decoration: none; }
/* Keep the home screen's feature colors from header.css. */
.ui-shell .header-nav .nav-icon-box { width: 24px; height: 24px; flex-shrink: 0; padding: 0; border-radius: var(--radius-md); }
.ui-shell .header-buttons { gap: 8px; }
.ui-shell .header-buttons :is(a,button) { min-height: 32px; padding: 4px 8px; font-size: var(--ui-font-body); border-radius: var(--radius-md); transition: background-color 150ms ease, color 150ms ease; }
.ui-shell .nav-item:focus-within > .dropDown { visibility: visible; opacity: 1; pointer-events: auto; display: block; }
.ui-shell .app-sidebar { top: var(--app-header-height); height: calc(100dvh - var(--app-header-height)); z-index: 200; padding: 8px; }
.ui-shell .app-sidebar-link { min-height: 36px; padding: 8px; line-height: 20px; font-size: var(--ui-font-body); }
.ui-shell :is(.app-sidebar-group-label,.app-sidebar-section-label) { font-size: var(--ui-font-note); letter-spacing: 0; text-transform: none; padding: 8px; }
.ui-shell #sidebarOpenBtn, .ui-shell #settingsSidebarOpenBtn { z-index: 201; }
.ui-shell #sidebar.active ~ main { margin-left: var(--sidebar-width); }
.ui-shell #sidebar:not(.active) ~ main { margin-left: 0; padding-left: 36px; }
.ui-shell :is(main,#main-content,.settings-main) { transition: none; }
.ui-shell h2 { font-size: 20px; font-weight: 600; letter-spacing: 0; }
.ui-shell :is(h3,h4,h5,h6) { font-size: 16px; font-weight: 500; letter-spacing: 0; }
.ui-shell .card { border: 1px solid var(--border-color); border-radius: var(--radius-lg); box-shadow: none; }
.ui-shell .card-header { padding: 12px 16px; background: var(--bg-primary); border-bottom: 1px solid var(--border-color); }
.ui-shell .card-body { padding: 16px; min-width: 0; }
.ui-shell .text-muted { color: var(--ui-text-muted) !important; }
.ui-shell .ui-section { margin-bottom: 16px; }
@media (max-width: 1000px) {
  .ui-shell .header-logo { max-width: 128px; height: 32px; }
  .ui-shell .header-nav-row { gap: 4px; }
  .ui-shell .header-nav .link { padding-inline: 4px; }
}
@media (max-width: 768px) {
  body.ui-shell { padding-top: 0; }
  .ui-shell .wrapper > header { position: relative; height: auto; }
  .ui-shell .header-top { flex-wrap: wrap; gap: 8px; }
  .ui-shell .header-right { align-items: flex-start; }
  .ui-shell .header-nav-row, .ui-shell .header-nav .nav-menu { flex-wrap: wrap; }
  .ui-shell .app-sidebar { position: relative; top: 0; height: auto; }
  .ui-shell #sidebar.active ~ main { margin-left: 0; }
}
.ui-shell .ui-footer { padding: 12px 16px; border-top: 1px solid var(--border-color); color: var(--text-secondary); font-size: var(--ui-font-note); background: var(--bg-primary); }
.ui-shell .ui-footer p { margin: 0; }
.ui-shell .admin-breadcrumb { margin-bottom: 16px; padding: 8px 12px; border: 1px solid var(--border-color); border-left: 3px solid var(--color-slate-500); border-radius: var(--radius-md); background: var(--bg-primary); }
.ui-shell .admin-breadcrumb-content { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: var(--ui-font-note); color: var(--text-secondary); }
.ui-shell .admin-breadcrumb-back { padding: 4px 8px; color: var(--ui-action-bg); }
.ui-shell .admin-breadcrumb-label { font-weight: 600; }
/* Old plan/report templates retain their own form and table semantics. */
.ui-legacy .app-sidebar { width: var(--sidebar-width); min-width: 0; }
.ui-legacy .app-sidebar ul { list-style: none; padding: 0; margin: 0 0 16px; }
.ui-legacy .app-sidebar .app-sidebar-section-label { color: var(--text-secondary); margin: 0; font-weight: 500; }
.ui-legacy main { flex: 1; max-width: calc(100% - var(--sidebar-width)); background: var(--bg-secondary); }
.ui-legacy #sidebar:not(.active) ~ main { max-width: 100%; }
.ui-legacy .content-title { height: auto; padding: 0; background: transparent; border: 0; }
.ui-legacy :is(.content-column,.content-flex,.section-model,.section-model-filter-sort) { min-width: 0; max-width: 100%; height: auto; box-sizing: border-box; }
.ui-legacy .content-column { padding: 0; gap: 16px; }
.ui-legacy .content-column > :is(.section-model-filter-sort, .section-model) { margin: 0; }
.ui-legacy .content-column > .section-model-filter-sort { width: auto; }
.ui-legacy .section-model-message { margin: 0 0 var(--spacing-4); }
.ui-legacy .content-flex { flex-wrap: wrap; gap: 12px; }
.ui-legacy .section-model { overflow-x: auto; padding: 12px; background: var(--bg-primary); border: 1px solid var(--border-color); border-radius: var(--radius-lg); }
.ui-legacy :is(.section-model-filter-sort,.section-model-filter-sort-element) { padding: 0; border: 0; background: transparent; }
.ui-legacy .section-model-choices { display: flex; align-items: flex-start; margin: 0 0 8px; }
.ui-legacy .section-model-choices label { width: auto; }
.ui-legacy .ui-button { width: auto; height: auto; margin: 4px 0; }
.ui-legacy main .section-model-table { table-layout: auto; }
@media (max-width: 768px) { .ui-legacy main { max-width: 100%; } }
.ui-legacy .app-sidebar .app-sidebar-section-label { color: var(--color-slate-400); }
/* 計画作成の手動実行: 青枠の箱を絞り込みの面と同じ面にし、ラベルは入力の上、ボタンは面の下端に右寄せで並べる */
.ui-legacy :is(.section-manual-input, .section-manual-input-large) {
  display: flex; flex-direction: column; gap: 12px; width: auto; min-width: 0; max-width: 100%;
  margin: 0; padding: 12px 16px; background: var(--bg-primary); border: 1px solid var(--border-color); border-radius: var(--radius-lg);
}
.ui-legacy .content-flex:has(> :is(.section-manual-input, .section-manual-input-large)) { padding: 0; }
.ui-legacy :is(.section-manual-input, .section-manual-input-large) > form { flex: 1; display: flex; flex-direction: column; gap: 12px; }
.ui-legacy .section-manual-input-title { margin: 0; padding: 0; font-size: 1rem; font-weight: 500; }
.ui-legacy .section-manual-input-choices { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 0; }
.ui-legacy :is(.section-manual-input-label, .section-manual-input-choices > label) { width: auto; margin: 0; font-size: var(--ui-font-note); font-weight: 500; color: var(--text-secondary); }
.ui-legacy .section-manual-input-select { max-width: 100%; min-height: var(--ui-control-height); }
.ui-legacy .section-manual-input-btn { position: static; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: auto; }
.ui-legacy .section-manual-input-btn > div { flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.ui-legacy .section-manual-input-btn .ui-button { margin: 0; }
.ui-legacy .section-manual-output { margin: 0; }
body.ui-legacy main a.ui-button { background: var(--bg-primary); color: var(--text-primary); border-color: var(--border-color-strong); }
/* Filters occupy one compact band; chart controls stay with the chart. */
.ui-shell .ui-filter-panel > .card-header { display: none; }
.ui-shell .ui-filter-panel > .card-body { padding: 0; }
.ui-shell .ui-filter-panel:has(> .card-body) { padding: 12px 16px; }
/* 一覧画面の組み方をそろえる: 見出し → 絞り込みの面 → 件数 → データの面。面の中に面を重ねない */
.ui-shell :is(.bg-list-section,.base-list-section,.middle-list-section,.daily-list-section,.contract-list-section) { background: transparent; border: 0; border-radius: 0; padding: 0; }
.ui-shell :is(.bg-list-section,.base-list-section,.middle-list-section,.daily-list-section,.contract-list-section) > .section-header { padding-bottom: 0; border-bottom: 0; }
.ui-shell :is(.bg-list-section,.base-list-section,.middle-list-section,.daily-list-section,.contract-list-section) > .section-header h2 { font-size: 24px; font-weight: 600; }
.ui-shell .area-filter { padding: 12px 16px; background: var(--bg-primary); border-color: var(--border-color); border-radius: var(--radius-lg); }
.ui-shell .area-filter-btn { min-height: 28px; }
/* 旧帳票の列は gap: 16px で並ぶので、中の絞り込みパネルの下 margin を重ねない */
.ui-legacy .content-column > * > form.ui-filter-panel:last-child { margin-bottom: 0; }
/* 区切られた作業のまとまり（取込・状況・設定など）は 1 枚のカードに入れ、カード同士は 16px あける */
.ui-shell .ui-card { padding: 16px; margin-bottom: 16px; background: var(--bg-primary); }
.ui-shell .ui-card > * + * { margin-top: 12px; }
.ui-shell .ui-card-title { font-size: 16px; font-weight: 600; line-height: 1.5; margin: 0; }
.ui-shell .ui-card-note { margin-bottom: 0; }
.ui-shell .ui-lead { max-width: 960px; margin: 0 0 16px; color: var(--text-secondary); }
.ui-shell .ui-form-stack { display: flex; flex-direction: column; gap: 16px; }
.ui-shell .ui-form-stack > p { margin: 0; }
.ui-shell .ui-form-table { max-width: 640px; }
.ui-shell .ui-fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
.ui-shell .ui-fieldset > legend { float: none; width: auto; margin: 0 0 4px; font-size: var(--ui-font-note); color: var(--text-secondary); }
.ui-shell .ui-fieldset .form-check { margin: 0; }
.ui-shell table.ui-table td.ui-cell-empty { color: var(--text-secondary); }
/* レポート一覧の列見出しは途中で折り返さない（「事業者コー／ド」を防ぐ）。入り切らないときは表の面が横に流れる */
/* daily_and_monthly_report_base.css の table { table-layout: fixed } だと等幅に割られて見出しが重なるので、中身に合わせる */
.ui-shell table.report-list-table { table-layout: auto; }
.ui-shell table.report-list-table > thead > tr > th { white-space: nowrap; }
/* ul で組んだサイドバー（レポート・計画作成・自己託送）は、旧帳票の画面でなくても（TEMSへ登録など）グループの間を 16px あける */
.ui-shell .app-sidebar > ul { list-style: none; padding: 0; margin: 0 0 16px; }
