:root {

    --navy: #1a3a5c;
    --navy-light: #2a5080;
    --accent: #e8a020;
    --accent-dark: #d4901a;
    --green: #2d7a4f;
    --purple: #5b3fa0;
    --teal: #1d7a7a;
    --blue: #1a6fa8;
    --red: #c0392b;
    --bg: #f0f4f8;
    --white: #ffffff;
    --border: #d4dce8;
    --border-input: #a9b7c9;
    --text: #2c3e50;
    --muted: #6b7a8d;

    --wage-bg: #fff4e0;    --wage-text: #8b5e10;
    --labor-bg: #e8f8ef;   --labor-text: #1a7a4a;
    --energy-bg: #e8f4fd;  --energy-text: #1a6fa8;
    --digital-bg: #f0e8ff; --digital-text: #5b3fa0;
    --tariff-bg: #ffe8e8;  --tariff-text: #a02020;
    --invoice-bg: #e6f5f5; --invoice-text: #1d6a6a;
    --ebooks-bg: #eceef1;  --ebooks-text: #5a6472;

    --f-bg: #fff0e8;       --f-text: #a04020;      --f-border: #e0a080;
    --g7-bg: #e8f0ff;      --g7-text: #2050a0;
    --violet-border: #c0a0f0;
    --gold-bg: #fff8e8;    --gold-text: #a06b10;   --gold-border: #e0c070;

    --surface-subtle: #f5f7fa;
    --surface-hover: #fafbfc;
    --surface-emphasis: #eef4fb;

    --fw-regular: 400;
    --fw-medium: 500;
    --fw-semibold: 600;
    --fw-bold: 700;
    --fw-extrabold: 800;
    --fw-black: 900;

    --lh-tight: 1;
    --lh-snug: 1.4;
    --lh-base: 1.5;
    --lh-relaxed: 1.7;
    --lh-loose: 1.8;

    --focus-ring: 0 0 0 2px rgba(26,58,92,0.18);
    --focus-ring-soft: 0 0 0 2px rgba(26,58,92,0.1);
    --placeholder-color: #9aa7b8;

    --icon-sm: 16px;
    --icon-md: 22px;
    --icon-lg: 28px;
    --icon-xl: 36px;

    --space-1: 4px;
    --space-2: 6px;
    --space-3: 8px;
    --space-4: 10px;
    --space-5: 12px;
    --space-6: 14px;
    --space-7: 16px;
    --space-8: 20px;
    --space-9: 24px;

    --radius-sm: 5px;
    --radius-md: 7px;
    --radius-lg: 10px;
    --radius-pill: 999px;

    --fs-2xs: 9px;
    --fs-xs: 10px;
    --fs-sm: 11px;
    --fs-base: 12px;
    --fs-md: 13px;
    --fs-lg: 14px;
    --fs-xl: 20px;
    --fs-display: 26px;

    --shadow-card: 0 1px 4px rgba(0,0,0,0.06);
    --subheader-h: 44px;
    --control-h: 32px;
    --mi-label-w: 100px;
    --content-max: 1600px;
  }

  * { box-sizing: border-box; margin: 0; padding: 0; }
  body {
    font-family: 'Hiragino Sans', 'Noto Sans JP', sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: var(--fs-base);
    line-height: var(--lh-base);
  }

  .flex { display: flex; }
  .flex-col { display: flex; flex-direction: column; }
  .items-center { align-items: center; }
  .items-end { align-items: flex-end; }
  .items-start { align-items: flex-start; }
  .flex-wrap { flex-wrap: wrap; }

  .gap-xs { gap: var(--space-2); }
  .gap-sm { gap: var(--space-3); }
  .gap-md { gap: var(--space-5); }
  .gap-lg { gap: var(--space-7); }

  .grid { display: grid; }
  .grid-2 { grid-template-columns: 1fr 1fr; }

  .grid-form-result { grid-template-columns: minmax(0, 40fr) minmax(0, 60fr); }
  .grid-gap-md { gap: var(--space-5); }
  .grid-gap-lg { gap: var(--space-7); }

  .text-muted { color: var(--muted); }
  .text-sm { font-size: var(--fs-sm); }
  .text-danger { color: var(--red); font-weight: var(--fw-semibold); }
  .font-bold { font-weight: var(--fw-bold); }
  .mt-sm { margin-top: var(--space-3); }
  .mt-md { margin-top: var(--space-5); }

  .nav-toggle-fixed {
    display: none; position: fixed; top: 6px; left: var(--space-3); z-index: 110;
    width: 32px; height: 32px; align-items: center; justify-content: center;
    background: var(--navy); color: white; border: 2px solid white; border-radius: var(--radius-md);
    font-size: var(--fs-md); cursor: pointer; box-shadow: var(--shadow-card);
    transition: left 0.2s ease;
  }

  body.nav-open .nav-toggle-fixed { left: calc(min(240px, 80vw) - 32px - var(--space-3)); }
  .sidebar-scrim { display: none; }

  .page { display: none; }
  .page.active { display: flex; min-height: 100vh; }

  .sidebar {
    width: 220px; flex-shrink: 0; align-self: flex-start; background: var(--white);
    border-right: 1px solid var(--border);
    position: sticky; top: 0; height: 100vh; overflow-y: auto;
  }
  .sidebar-brand {
    display: flex; align-items: center; gap: var(--space-2);
    padding: var(--space-5) var(--space-7); font-weight: var(--fw-black); font-size: var(--fs-md); color: var(--navy);
    border-bottom: 1px solid var(--border); white-space: nowrap;
  }
  .sidebar-brand span { color: var(--accent-dark); }
  .sidebar-header { padding: var(--space-6) var(--space-7); background: var(--navy); color: white; }
  .sidebar-header--pref { background: var(--green); }
  .sidebar-header--shokokai { background: var(--purple); }
  .sidebar-header__top { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-2); }
  .sidebar-header__top > div:first-child { min-width: 0; flex: 1; }

  #org-role-select { flex-shrink: 0; }
  #org-role-select + div { min-width: 0; flex: 1; }
  .sidebar-header .org-type { font-size: var(--fs-2xs); color: rgba(255,255,255,0.6); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 2px; }
  .sidebar-header .org-name {
    font-size: var(--fs-sm); font-weight: var(--fw-bold);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .sidebar-header .user-info {
    font-size: var(--fs-xs); color: rgba(255,255,255,0.7); margin-top: var(--space-2);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }

  .sidebar-header--shokokai {
    padding-top: var(--space-5); padding-bottom: var(--space-5);
    display: flex; flex-direction: column; justify-content: center; gap: var(--space-2);
  }
  .sidebar-header--shokokai .user-info { margin-top: 0; }
  .nav-section { border-bottom: 1px solid var(--border); }
  .nav-section-label { font-size: var(--fs-2xs); font-weight: var(--fw-bold); color: var(--muted); padding: var(--space-2) var(--space-6) 3px; letter-spacing: 0.8px; text-transform: uppercase; }
  .nav-item {
    display: flex; align-items: center; gap: var(--space-3);
    padding: var(--space-3) var(--space-6); cursor: pointer; font-size: var(--fs-base); color: var(--text);
    transition: all 0.15s; border-left: 3px solid transparent; text-decoration: none;
  }
  .nav-item:hover { background: var(--bg); }
  .nav-item.active { background: #eef3ff; color: var(--navy); font-weight: var(--fw-semibold); border-left-color: var(--navy); }
  .nav-item--disabled { color: var(--muted); cursor: default; }
  .nav-item--disabled:hover { background: none; }
  .nav-item .icon { width: 16px; text-align: center; flex-shrink: 0; }

  .main { flex: 1; overflow-x: hidden; }
  .screen { display: none; }
  .screen.active { display: block; }
  .screen-body { padding: var(--space-8) var(--space-9); max-width: var(--content-max); width: 100%; }

  .screen-body--fill { display: flex; flex-direction: column; height: calc(100vh - var(--subheader-h)); min-height: 0; overflow: hidden; }
  .card--fill { flex: 1; display: flex; flex-direction: column; min-height: 0; }
  .card--fill .table-scroll { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; }

  .card--fill .table-scroll th { position: sticky; top: 0; z-index: 1; }

  /* ホーム・アカウント管理・報告書一覧・ナレッジ管理：ウィンドウ高さに追従して一覧領域を伸ばす */
  .page.active:has(#view-home.active),
  .page.active:has(#view-accounts.active),
  .page.active:has(#view-reports.active),
  .page.active:has(#view-knowledge.active #knowledge-root.kd-list-fill) {
    height: 100vh;
    max-height: 100vh;
    overflow: hidden;
  }
  .main:has(#view-home.active),
  .main:has(#view-accounts.active),
  .main:has(#view-reports.active),
  .main:has(#view-knowledge.active #knowledge-root.kd-list-fill) {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    min-height: 0;
    height: auto;
    max-height: none;
    overflow: hidden;
  }
  .main:has(#view-home.active) > .top-bar,
  .main:has(#view-accounts.active) > .top-bar,
  .main:has(#view-reports.active) > .top-bar,
  .main:has(#view-knowledge.active #knowledge-root.kd-list-fill) > .top-bar {
    flex-shrink: 0;
  }
  #main-mount:has(#view-home.active),
  #main-mount:has(#view-accounts.active),
  #main-mount:has(#view-reports.active),
  #main-mount:has(#view-knowledge.active #knowledge-root.kd-list-fill) {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  #view-home.app-view.active,
  #view-accounts.app-view.active,
  #view-reports.app-view.active,
  #view-knowledge.app-view.active:has(#knowledge-root.kd-list-fill) {
    flex: 1 1 auto;
    min-height: 0;
    height: auto;
    max-height: 100%;
    display: flex !important;
    flex-direction: column;
    overflow: hidden;
  }
  /* AI相談：空のときは従来どおり内容高さ。回答があるときだけ右カード内スクロール＋下部固定入力 */
  #ap-result-scroll {
    padding: var(--space-5);
  }
  #ap-result-feedback {
    border-top: 1px solid var(--gold-border, var(--border));
    background: #fff;
    padding: var(--space-4) var(--space-5);
  }
  #ap-result-feedback[hidden] {
    display: none !important;
  }
  #ap-result-card.is-filled {
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 8rem);
    overflow: hidden;
  }
  #ap-result-card.is-filled > #ap-result-header {
    flex-shrink: 0;
  }
  #ap-result-card.is-filled > #ap-result-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
  }
  #ap-result-card.is-filled > #ap-result-feedback {
    flex-shrink: 0;
  }
  #view-home > .screen-body--fill {
    flex: 1 1 auto;
    height: auto !important;
    max-height: none;
    min-height: 0;
    max-width: none;
    box-sizing: border-box;
    overflow: hidden;
  }
  #view-home .home-fill-content {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  #view-home .home-fill-content > .cat-lbl,
  #view-home .home-fill-content > .card.notice-card,
  #view-home .home-fill-content > .dash-actions-panel,
  #view-home .home-fill-content > .grid {
    flex-shrink: 0;
  }
  #view-home .home-fill-content > .grid {
    margin-bottom: var(--space-5);
  }
  #view-home .home-fill-content > .dash-actions-panel {
    margin-bottom: 0;
  }
  #view-home .home-list-section,
  #view-home #dash-bottom-table {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin-top: var(--space-5);
  }
  #view-home .home-list-section > .cat-lbl {
    flex-shrink: 0;
  }
  #view-home .recent-reports-card.card--fill,
  #view-home #dash-monthly-table-card.card--fill {
    flex: 1 1 auto;
    min-height: 0;
    margin-bottom: 0;
    overflow: hidden;
  }
  #view-home .recent-reports-card.card--fill .table-scroll,
  #view-home #dash-monthly-table-card.card--fill .table-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
  }
  #view-home .recent-reports-card.card--fill .table-scroll th,
  #view-home #dash-monthly-table-card.card--fill .table-scroll th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--surface-subtle);
  }
  #view-home #dash-monthly-table-card.card--fill > .card-header {
    flex-shrink: 0;
  }
  #accounts-root,
  #knowledge-root.kd-list-fill {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  #accounts-root > .screen-body--fill,
  #view-reports > .screen-body--fill,
  #knowledge-root.kd-list-fill > .screen-body--fill {
    flex: 1 1 auto;
    height: auto !important;
    max-height: none;
    min-height: 0;
    max-width: none;
    box-sizing: border-box;
    overflow: hidden;
  }
  #accounts-root > .screen-body--fill > .cat-lbl,
  #view-reports > .screen-body--fill > .cat-lbl,
  #knowledge-root.kd-list-fill > .screen-body--fill > .flow-steps {
    flex-shrink: 0;
  }
  #knowledge-root.kd-list-fill .kd-fill-content {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin-top: var(--space-6);
  }
  #knowledge-root.kd-list-fill .kd-fill-content > .card:not(.card--fill) {
    flex-shrink: 0;
  }
  #accounts-filter-card.card--fill,
  #reports-filter-card.card--fill,
  #knowledge-root.kd-list-fill .card.card--fill {
    flex: 1 1 auto;
    min-height: 0;
    margin-bottom: 0;
    max-height: none;
    overflow: hidden;
  }
  /* 絞り込みヘッダーは縮めない（縮むと sticky 表頭が入力欄に重なる） */
  #accounts-filter-card.card--fill > .card-header,
  #reports-filter-card.card--fill > .card-header,
  #knowledge-root.kd-list-fill .card.card--fill > .card-header {
    flex-shrink: 0;
  }
  #accounts-filter-card.card--fill .table-scroll,
  #reports-filter-card.card--fill .table-scroll,
  #knowledge-root.kd-list-fill .card.card--fill .table-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
  }
  #accounts-filter-card.card--fill .table-scroll th,
  #reports-filter-card.card--fill .table-scroll th,
  #knowledge-root.kd-list-fill .card.card--fill .table-scroll th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--surface-subtle);
  }
  /* 詳細パネル表示中は表頭がパネルへ被らないようにする */
  #accounts-root:has(.am-inline-row) .table-scroll > table > thead > tr > th {
    z-index: 1;
  }

  .page-heading { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-1) var(--space-5); margin-bottom: var(--space-8); }
  .page-title { font-size: var(--fs-xl); font-weight: var(--fw-black); color: var(--navy); }
  .page-subtitle { font-size: var(--fs-sm); color: var(--muted); }
  .page-heading__filters { margin-left: auto; display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }

  .subheader {
    position: sticky; top: 0; z-index: 50;
    background: var(--navy); color: white; border-bottom: 3px solid rgba(0,0,0,0.15);
    height: var(--subheader-h);
    padding: 0 var(--space-9); display: flex; align-items: center; gap: var(--space-3);
    font-size: var(--fs-base); flex-wrap: nowrap; overflow-x: auto;
  }
  .subheader--pref { background: var(--green); }
  .subheader--shokokai { background: var(--purple); }
  .subheader .text-muted { color: rgba(255,255,255,0.75); }
  .spacer { flex: 1; }

  .subheader .btn,
  .subheader select.form-input,
  .subheader input.form-input {
    height: var(--control-h); padding-top: 0; padding-bottom: 0; flex-shrink: 0;
  }

  .help-btn {
    flex-shrink: 0; margin-left: auto;
    border: 1px solid rgba(255,255,255,0.4); background: rgba(255,255,255,0.15); color: white;
  }
  .help-btn:hover { background: rgba(255,255,255,0.3); }

  /* 画面操作待機（AI提案・ナレッジ検索など） */
  .wait-overlay {
    display: none; position: fixed; inset: 0; z-index: 280;
    background: rgba(20, 30, 40, 0.35);
    align-items: center; justify-content: center;
    pointer-events: all;
  }
  .wait-overlay.is-open { display: flex; }
  .wait-overlay__panel {
    display: flex; flex-direction: column; align-items: center; gap: var(--space-4);
    background: white; border-radius: var(--radius-lg);
    padding: var(--space-6) var(--space-8);
    box-shadow: 0 8px 30px rgba(0,0,0,0.22);
    min-width: 220px; max-width: 90vw;
  }
  .wait-overlay__spinner {
    width: 36px; height: 36px;
    border: 3px solid rgba(26, 111, 168, 0.2);
    border-top-color: var(--navy, #1a3a5c);
    border-radius: 50%;
    animation: wait-overlay-spin 0.8s linear infinite;
  }
  .wait-overlay__msg {
    font-size: var(--fs-sm); font-weight: var(--fw-semibold);
    color: var(--navy, #1a3a5c); text-align: center;
  }
  @keyframes wait-overlay-spin { to { transform: rotate(360deg); } }
  @media (prefers-reduced-motion: reduce) {
    .wait-overlay__spinner { animation: none; border-top-color: transparent; }
  }
  html.is-wait-overlay-open { overflow: hidden; }

  .modal-overlay {
    display: none; position: fixed; inset: 0; z-index: 200;
    background: rgba(20,30,40,0.45); align-items: center; justify-content: center;
  }
  .modal-overlay.is-open { display: flex; animation: modal-overlay-in 0.18s ease; }
  .modal-overlay.is-open .modal-box { animation: modal-box-in 0.18s ease; }
  @keyframes modal-overlay-in { from { background: rgba(20,30,40,0); } to { background: rgba(20,30,40,0.45); } }
  @keyframes modal-box-in { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
  @media (prefers-reduced-motion: reduce) {
    .modal-overlay.is-open, .modal-overlay.is-open .modal-box { animation: none; }
  }
  .modal-box { background: white; border-radius: var(--radius-lg); width: 640px; max-width: 90vw; box-shadow: 0 8px 30px rgba(0,0,0,0.25); }
  .modal-box--confirm { width: 420px; }
  .modal-box__header { display: flex; align-items: center; justify-content: space-between; padding: var(--space-5) var(--space-6); border-bottom: 1px solid var(--border); }
  .modal-box__title { font-weight: var(--fw-bold); color: var(--navy); font-size: var(--fs-md); }
  .modal-box__close { border: none; background: none; font-size: 18px; line-height: var(--lh-tight); cursor: pointer; color: var(--muted); }
  .modal-box__body { padding: var(--space-6); }
  .modal-box__body p { line-height: var(--lh-loose); }
  .modal-box__body strong { color: var(--navy); }
  .modal-box__message { margin: 0; white-space: pre-line; color: var(--text); font-size: var(--fs-sm); }
  .modal-box__actions {
    display: flex; justify-content: flex-end; gap: var(--space-3);
    padding: 0 var(--space-6) var(--space-5); border-top: none;
  }
  /* 添付操作：削除を左端、ダウンロード／キャンセルを右寄せ */
  .modal-box__actions .mi-attach-action-delete {
    margin-right: auto;
  }

  .toast-container {
    position: fixed; top: var(--space-7); left: 50%; transform: translateX(-50%); z-index: 300;
    display: flex; flex-direction: column; align-items: center; gap: var(--space-3);
    pointer-events: none;
  }
  .toast {
    display: flex; align-items: center; gap: var(--space-3);
    background: white; border-left: 4px solid var(--green); border-radius: var(--radius-md);
    box-shadow: 0 8px 24px rgba(0,0,0,0.18);
    padding: var(--space-4) var(--space-6);
    font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--text);
    min-width: 240px; max-width: 360px;
    opacity: 0; transform: translateY(-16px);
    transition: opacity 0.25s ease, transform 0.25s ease;
  }
  .toast.is-visible { opacity: 1; transform: translateY(0); }
  .toast--error { border-left-color: var(--red); }
  .toast__icon { flex-shrink: 0; }

  .kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-5); margin-bottom: var(--space-8); }
  .kpi-card {
    background: white; border-radius: var(--radius-lg); padding: var(--space-5) var(--space-7);
    border: 1px solid var(--border); box-shadow: var(--shadow-card);
  }
  .kpi-card .label { font-size: var(--fs-xs); color: var(--muted); font-weight: var(--fw-semibold); margin-bottom: var(--space-2); }
  .kpi-card .value-row { display: flex; align-items: baseline; flex-wrap: wrap; gap: var(--space-3); }
  .kpi-card .value { font-size: var(--fs-display); font-weight: var(--fw-black); color: var(--navy); line-height: var(--lh-tight); }
  .kpi-card .value.is-danger { color: var(--red); }
  .kpi-card .unit { font-size: var(--fs-sm); color: var(--muted); margin-left: 2px; }
  .kpi-card .change { font-size: var(--fs-xs); white-space: nowrap; }
  .kpi-card .change.up { color: var(--green); }
  .kpi-card .change.down { color: var(--red); }

  .kpi-card--navy { background: var(--navy); border-color: var(--navy); }
  .kpi-card--navy .label, .kpi-card--navy .unit { color: rgba(255,255,255,0.65); }
  .kpi-card--navy .value { color: white; }

  .kpi-card--notice { grid-column: span 2; background: var(--gold-bg); border-color: var(--gold-border); }
  .kpi-card--notice .kpi-notice-title { font-size: var(--fs-xs); font-weight: var(--fw-bold); color: var(--gold-text); margin-bottom: var(--space-3); }
  .kpi-notice-list { display: flex; flex-direction: column; gap: var(--space-3); }
  .kpi-notice-item { font-size: var(--fs-sm); color: var(--text); line-height: var(--lh-snug); }
  .kpi-notice-item--empty { color: var(--muted); }

  .card.notice-card { border: 2px solid var(--gold-border); background: var(--gold-bg); margin-bottom: var(--space-8); }
  .notice-panel { display: grid; grid-template-columns: 1fr 1fr; align-items: center; gap: var(--space-6); }
  .notice-item { font-size: var(--fs-md); font-weight: var(--fw-bold); color: var(--text); line-height: 1; }
  .notice-stat__main { font-size: var(--fs-lg); font-weight: var(--fw-bold); }
  .notice-stat__main .value { font-size: var(--fs-display); font-weight: var(--fw-bold); color: var(--navy); margin: 0 var(--space-1); }
  .notice-stat__change { font-size: var(--fs-base); font-weight: var(--fw-bold); color: var(--green); margin-left: var(--space-2); }
  .notice-stat__sub { font-size: var(--fs-sm); color: var(--muted); margin-top: var(--space-2); }
  @media (max-width: 900px) {
    .notice-panel { grid-template-columns: 1fr; }
  }

  #dash-quick-actions .action-card {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    min-height: 100px; box-sizing: border-box;
  }
  #dash-quick-actions .action-card__icon { font-size: 56px; }
  #dash-quick-actions .simple-grid { display: grid; grid-template-columns: 3fr 1fr 2fr; gap: var(--space-8); align-items: start; }
  #dash-quick-actions .ac-grid-2 { display: flex; gap: var(--space-8); height: 100%; }
  #dash-quick-actions .ac-grid-2 > .action-card { flex: 1; }
  #dash-quick-actions .simple-col-cards { display: flex; flex-direction: column; gap: var(--space-4); height: 100%; }
  @media (max-width: 900px) {
    #dash-quick-actions .simple-grid { grid-template-columns: 1fr; }
  }
  @media (max-width: 600px) {
    #dash-quick-actions .ac-grid-2 { flex-wrap: wrap; }
    #dash-quick-actions .ac-grid-2 > .action-card { flex: 1 1 100%; }
  }

  .card { background: white; border-radius: var(--radius-lg); border: 1px solid var(--border); margin-bottom: var(--space-6); box-shadow: var(--shadow-card); overflow: hidden; }

  .grid > .card { margin-bottom: 0; }

  .card-header { min-height: 52px; padding: var(--space-5) var(--space-7); border-bottom: 1px solid var(--border); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3) var(--space-5); row-gap: var(--space-3); }

  #reports-filter-header { background: var(--gold-bg); border-bottom-color: var(--gold-border); }

  #monthly-filter-header, #accounts-filter-header { align-items: flex-end; }
  #monthly-filter-header .filter-row { align-items: flex-start; width: 100%; }

  #ks-search-header { display: flex; flex-direction: column; gap: var(--space-4); }

  #ks-search-card { flex-shrink: 0; }
  #ks-results { flex: 1; min-height: 0; min-width: 0; overflow-y: auto; }
  #ks-results.grid { grid-template-columns: minmax(0, 1fr); }

  #ks-results.grid-gap-md { gap: var(--space-7); }
  #ks-results mark { background: var(--gold-bg); color: var(--gold-text); border-radius: 2px; padding: 0 2px; font-weight: var(--fw-bold); }
  #ks-results .proposal-card__title mark { background: var(--accent); color: var(--navy); }

  #reports-filter-card, #monthly-filter-card, #accounts-filter-card, #ap-result-card { border-color: var(--gold-border); }

  #reports-count-wrap { font-size: var(--fs-md); color: var(--text); }

  .card-header--navy #reports-count-wrap { color: white; }

  #ap-result-header { background: var(--gold-bg); border-bottom-color: var(--gold-border); }

  .ap-stream-status {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-top: var(--space-3);
    margin-bottom: var(--space-3);
    color: var(--navy, #1a3a5c);
    font-size: var(--fs-md);
    font-weight: var(--fw-semibold);
    min-height: 1.5em;
  }
  .ap-stream-status__spinner {
    flex: 0 0 auto;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(26, 111, 168, 0.22);
    border-top-color: var(--navy, #1a3a5c);
    border-radius: 50%;
    animation: ap-stream-spin 0.75s linear infinite;
  }
  .ap-stream-status__text { min-width: 0; }
  .ap-stream-status__dots {
    display: inline-flex;
    gap: 3px;
    margin-left: 2px;
    transform: translateY(1px);
  }
  .ap-stream-status__dots i {
    display: inline-block;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.25;
    font-style: normal;
    animation: ap-stream-dot 1.05s ease-in-out infinite;
  }
  .ap-stream-status__dots i:nth-child(2) { animation-delay: 0.18s; }
  .ap-stream-status__dots i:nth-child(3) { animation-delay: 0.36s; }
  .ap-stream-status.is-busy .ap-stream-status__text {
    animation: ap-stream-pulse 1.4s ease-in-out infinite;
  }
  .ap-stream-turn + .ap-stream-turn {
    margin-top: var(--space-6);
    padding-top: var(--space-6);
    border-top: 1px solid var(--border);
  }
  .ap-preview-card {
    margin-bottom: var(--space-3);
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
  }
  .ap-preview-summary {
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    font-size: var(--fs-md);
    font-weight: var(--fw-semibold);
    color: var(--navy, #1a3a5c);
    background: var(--bg, #f7f8fa);
  }
  .ap-preview-summary::-webkit-details-marker { display: none; }
  .ap-preview-summary::after {
    content: '▼';
    font-size: var(--fs-2xs);
    color: var(--muted);
    flex: 0 0 auto;
  }
  .ap-preview-card[open] > .ap-preview-summary::after { content: '▲'; }
  .ap-preview-list { padding: 0 var(--space-4) var(--space-4); }
  .ap-preview-empty { margin-bottom: var(--space-3); color: var(--muted); }
  .ap-preview-gap { height: var(--space-4); }
  .ap-preview-entry-title {
    margin-top: var(--space-3);
    font-weight: var(--fw-bold);
  }
  .ap-preview-entry-title a { color: var(--blue, #1a6fa8); text-decoration: underline; }
  .ap-preview-entry-body {
    margin-top: 4px;
  }
  .ap-preview-entry-line {
    margin-top: 2px;
    color: var(--text);
    font-size: var(--fs-sm);
    line-height: var(--lh-relaxed);
    white-space: pre-wrap;
  }
  .ap-preview-entry--in {
    animation: ap-preview-in 0.28s ease-out both;
  }
  .ap-stream-anchor {
    width: 1px;
    height: 1px;
    margin: 0;
    padding: 0;
    overflow: hidden;
    pointer-events: none;
  }
  @keyframes ap-stream-spin { to { transform: rotate(360deg); } }
  @keyframes ap-stream-dot {
    0%, 80%, 100% { opacity: 0.2; transform: translateY(0); }
    40% { opacity: 1; transform: translateY(-3px); }
  }
  @keyframes ap-stream-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.55; }
  }
  @keyframes ap-preview-in {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
  }
  @media (prefers-reduced-motion: reduce) {
    .ap-stream-status__spinner,
    .ap-stream-status__dots i,
    .ap-stream-status.is-busy .ap-stream-status__text,
    .ap-preview-entry--in {
      animation: none;
    }
    .ap-stream-status__spinner { border-top-color: transparent; }
    .ap-stream-status__dots i { opacity: 0.55; }
  }

  #accounts-filter-header { background: var(--gold-bg); border-bottom-color: var(--gold-border); }

  #kd-documents-header { background: var(--gold-bg); border-bottom-color: var(--gold-border); }
  #kd-documents-card { border-color: var(--gold-border); }
  #monthly-filter-header { background: var(--gold-bg); border-bottom-color: var(--gold-border); }
  .card-header--tint-violet { background: var(--digital-bg); }
  .card-header--navy { background: var(--navy); border-bottom-color: var(--navy); }
  .card-title { font-size: var(--fs-md); font-weight: var(--fw-bold); color: var(--navy); }
  .card-title .count, .card-header .count { font-size: var(--fs-sm); color: var(--muted); font-weight: var(--fw-regular); }
  .card-title--violet { color: var(--purple); }
  .card-title--white { color: white; }
  .card-body { padding: var(--space-6) var(--space-7); }
  .btn-group { display: flex; gap: var(--space-3); align-items: center; }

  .export-groups { display: flex; flex-direction: column; align-items: flex-end; gap: var(--space-2); }
  .export-group { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }
  .export-group__label { font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; min-width: 5.5em; text-align: right; }

  #annual-forms, #monthly-forms, #monthly-table-card { scroll-margin-top: calc(var(--subheader-h) + var(--space-5)); }

  .calendar-nav { display: flex; align-items: center; justify-content: center; gap: var(--space-5); margin-bottom: var(--space-5); }
  .calendar-nav__label { font-size: var(--fs-md); font-weight: var(--fw-bold); color: var(--navy); min-width: 8em; text-align: center; }
  .calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
  .calendar-weekday { text-align: center; font-size: var(--fs-xs); font-weight: var(--fw-semibold); color: var(--muted); padding: var(--space-2) 0; }
  .calendar-day {
    min-height: 68px; border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: var(--space-2) var(--space-3); cursor: pointer; background: white;
  }
  .calendar-day:hover { background: var(--surface-hover); border-color: var(--navy); }
  .calendar-day--empty { border-color: transparent; cursor: default; background: transparent; }
  .calendar-day--empty:hover { background: transparent; }
  .calendar-day__num { font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--navy); }
  .calendar-day__count { font-size: var(--fs-lg); font-weight: var(--fw-bold); color: var(--navy); margin-top: var(--space-1); }

  .calendar-day--zero { background: var(--surface-subtle); }
  .calendar-day--zero .calendar-day__count { color: var(--red); }

  @media (max-width: 480px) {
    .calendar-day { min-height: 44px; padding: 2px var(--space-1); }
    .calendar-day__num { font-size: var(--fs-xs); }
    .calendar-day__count { font-size: var(--fs-xs); margin-top: 0; }
    .calendar-weekday { font-size: var(--fs-2xs); padding: var(--space-1) 0; }
    .calendar-nav__label { font-size: var(--fs-sm); min-width: 0; }
  }

  .detail-row { display: flex; border-bottom: 1px solid var(--border); }
  .detail-row:last-child { border-bottom: none; }
  .detail-row__label { width: 180px; flex-shrink: 0; background: var(--surface-subtle); padding: var(--space-5) var(--space-6); font-weight: var(--fw-semibold); color: var(--muted); font-size: var(--fs-sm); }
  @media (max-width: 600px) {
    .detail-row { flex-direction: column; }
    .detail-row__label { width: auto; }
  }
  .detail-row__required { color: var(--red); margin-left: 2px; }
  .detail-row__value { flex: 1; padding: var(--space-4) var(--space-6); display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2); }
  .detail-row__value .form-input, .detail-row__static {
    width: 100%; max-width: 420px; box-sizing: border-box;
    padding: var(--space-3) var(--space-4); border-radius: var(--radius-sm);
    font-size: var(--fs-base); line-height: var(--lh-snug);
  }
  .detail-row__static { border: 1px solid transparent; color: var(--text); }

  .form-input--emphasized {
    border: 1px solid var(--navy); background: var(--surface-emphasis); color: var(--text);
  }
  .detail-row__value .form-input {
    color: var(--text);
  }
  .form-input--emphasized:focus,
  .detail-row__value .form-input:focus {
    outline: none; box-shadow: var(--focus-ring);
  }

  #ap-industry, #ap-summary, #ap-different-reason { color: var(--text); }

  #ap-form-grid { gap: var(--space-8); }

  #ap-form-grid .checkbox-grid { display: flex; flex-wrap: wrap; gap: var(--space-3) var(--space-6); }
  #ap-form-grid .checkbox-grid label { flex: 0 0 auto; white-space: nowrap; }
  #ap-industry:focus, #ap-summary:focus { outline: none; box-shadow: var(--focus-ring); }

  .col-action { width: 1px; white-space: nowrap; }

  .flow-steps { display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-6); flex-wrap: wrap; }
  .flow-step { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-4) var(--space-6); border-radius: var(--radius-md); border: 1px solid var(--border); background: white; cursor: pointer; transition: all 0.15s; text-decoration: none; }
  .flow-step:hover { border-color: var(--navy); }

  .flow-step.is-active { background: var(--purple); border-color: var(--purple); }
  .flow-step.is-active .flow-step__label { color: white; }
  .flow-step.is-active .flow-step__num { background: white; color: var(--purple); }
  .flow-step__num { width: 24px; height: 24px; border-radius: 50%; background: var(--purple); color: white; display: flex; align-items: center; justify-content: center; font-size: var(--fs-xs); font-weight: var(--fw-bold); flex-shrink: 0; }
  .flow-step__label { font-weight: var(--fw-semibold); font-size: var(--fs-sm); color: var(--navy); white-space: nowrap; }
  .flow-step__arrow { color: var(--muted); font-weight: var(--fw-bold); }

  table { width: 100%; border-collapse: collapse; }

  #view-reports .table-scroll table,
  .recent-reports-card .table-scroll table { table-layout: fixed; width: 100%; }
  /* 商工会：様式 / 実施日 / テーマ / 内容 / 担当 / 操作 */
  #view-reports .table-scroll table.reports-list-table--shokokai th:nth-child(1),
  #view-reports .table-scroll table.reports-list-table--shokokai td:nth-child(1),
  .recent-reports-card .table-scroll th:nth-child(1), .recent-reports-card .table-scroll td:nth-child(1) { width: 12%; }
  #view-reports .table-scroll table.reports-list-table--shokokai th:nth-child(2),
  #view-reports .table-scroll table.reports-list-table--shokokai td:nth-child(2),
  .recent-reports-card .table-scroll th:nth-child(2), .recent-reports-card .table-scroll td:nth-child(2) { width: 8%; }
  #view-reports .table-scroll table.reports-list-table--shokokai th:nth-child(3),
  #view-reports .table-scroll table.reports-list-table--shokokai td:nth-child(3),
  .recent-reports-card .table-scroll th:nth-child(3), .recent-reports-card .table-scroll td:nth-child(3) { width: 15%; }
  #view-reports .table-scroll table.reports-list-table--shokokai th:nth-child(4),
  #view-reports .table-scroll table.reports-list-table--shokokai td:nth-child(4),
  .recent-reports-card .table-scroll th:nth-child(4), .recent-reports-card .table-scroll td:nth-child(4) { width: 50%; }
  #view-reports .table-scroll table.reports-list-table--shokokai th:nth-child(5),
  #view-reports .table-scroll table.reports-list-table--shokokai td:nth-child(5),
  .recent-reports-card .table-scroll th:nth-child(5), .recent-reports-card .table-scroll td:nth-child(5) { width: 10%; }
  #view-reports .table-scroll table.reports-list-table--shokokai th:nth-child(6),
  #view-reports .table-scroll table.reports-list-table--shokokai td:nth-child(6),
  .recent-reports-card .table-scroll th:nth-child(6), .recent-reports-card .table-scroll td:nth-child(6) { width: 88px; }
  /* 県連：様式 / 商工会 / 実施日 / テーマ / 内容 / 操作（担当なし） */
  #view-reports .table-scroll table.reports-list-table--pref th:nth-child(1),
  #view-reports .table-scroll table.reports-list-table--pref td:nth-child(1) { width: 12%; }
  #view-reports .table-scroll table.reports-list-table--pref th:nth-child(2),
  #view-reports .table-scroll table.reports-list-table--pref td:nth-child(2) { width: 14%; }
  #view-reports .table-scroll table.reports-list-table--pref th:nth-child(3),
  #view-reports .table-scroll table.reports-list-table--pref td:nth-child(3) { width: 8%; }
  #view-reports .table-scroll table.reports-list-table--pref th:nth-child(4),
  #view-reports .table-scroll table.reports-list-table--pref td:nth-child(4) { width: 14%; }
  #view-reports .table-scroll table.reports-list-table--pref th:nth-child(5),
  #view-reports .table-scroll table.reports-list-table--pref td:nth-child(5) { width: 42%; }
  #view-reports .table-scroll table.reports-list-table--pref th:nth-child(6),
  #view-reports .table-scroll table.reports-list-table--pref td:nth-child(6) { width: 88px; }
  /* 全国連：様式 / 県 / 商工会 / 実施日 / テーマ / 内容 / 操作（担当なし） */
  #view-reports .table-scroll table.reports-list-table--national th:nth-child(1),
  #view-reports .table-scroll table.reports-list-table--national td:nth-child(1) { width: 10%; }
  #view-reports .table-scroll table.reports-list-table--national th:nth-child(2),
  #view-reports .table-scroll table.reports-list-table--national td:nth-child(2) { width: 8%; }
  #view-reports .table-scroll table.reports-list-table--national th:nth-child(3),
  #view-reports .table-scroll table.reports-list-table--national td:nth-child(3) { width: 12%; }
  #view-reports .table-scroll table.reports-list-table--national th:nth-child(4),
  #view-reports .table-scroll table.reports-list-table--national td:nth-child(4) { width: 8%; }
  #view-reports .table-scroll table.reports-list-table--national th:nth-child(5),
  #view-reports .table-scroll table.reports-list-table--national td:nth-child(5) { width: 12%; }
  #view-reports .table-scroll table.reports-list-table--national th:nth-child(6),
  #view-reports .table-scroll table.reports-list-table--national td:nth-child(6) { width: 36%; }
  #view-reports .table-scroll table.reports-list-table--national th:nth-child(7),
  #view-reports .table-scroll table.reports-list-table--national td:nth-child(7) { width: 88px; }

  #view-reports .table-scroll th:first-child, #view-reports .table-scroll td:first-child,
  #accounts-root .table-scroll th:first-child,
  #accounts-root .table-scroll > table > tbody > tr:not(.am-inline-row) > td:first-child,
  #monthly-root .table-scroll th:first-child, #monthly-root .table-scroll td:first-child,
  .recent-reports-card .table-scroll th:first-child, .recent-reports-card .table-scroll td:first-child {
    padding-left: var(--space-6);
  }
  #view-reports .table-scroll th:last-child, #view-reports .table-scroll td:last-child,
  #accounts-root .table-scroll th:last-child,
  #accounts-root .table-scroll > table > tbody > tr:not(.am-inline-row) > td:last-child,
  #monthly-root .table-scroll th:last-child, #monthly-root .table-scroll td:last-child,
  .recent-reports-card .table-scroll th:last-child, .recent-reports-card .table-scroll td:last-child {
    padding-right: var(--space-6);
  }
  #view-reports .table-scroll th.col-action,
  #view-reports .table-scroll td.col-action,
  .recent-reports-card .table-scroll th.col-action,
  .recent-reports-card .table-scroll td.col-action {
    width: 88px;
    min-width: 88px;
    text-align: right;
    white-space: nowrap;
    overflow: visible;
  }

  .account-login-cell { min-width: 145px; }
  .account-login-failures { display: block; margin-top: 2px; color: #000; font-size: var(--fs-xs); }

  /*
   * アカウント詳細パネル（モックアップ準拠）
   * 左右独立 detail-row + grid-2（中央は間隔のみ、縦線なし）
   * 見出し列: surface-subtle / 入力セル: 同色 / form-input: 白
   */
  #accounts-root .table-scroll tr.am-inline-row > td,
  #accounts-root .table-scroll tr.am-inline-row > td:first-child,
  #accounts-root .table-scroll tr.am-inline-row > td:last-child,
  #accounts-root .table-scroll tr.am-inline-row:hover > td,
  #accounts-root .table-scroll tr.am-inline-row:hover > td:first-child,
  #accounts-root .table-scroll tr.am-inline-row:hover > td:last-child {
    position: relative;
    z-index: 5;
    background: var(--surface-subtle) !important;
    padding: var(--space-7) !important;
    border-bottom: 1px solid var(--border);
    overflow: visible !important;
    white-space: normal !important;
    text-overflow: clip !important;
  }
  #accounts-root .am-inline-panel {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
    background: transparent;
    box-sizing: border-box;
  }
  #accounts-root .am-inline-panel__title {
    background: var(--gold-bg);
    border: 0;
    border-bottom: 1px solid var(--gold-border);
    padding: var(--space-5) var(--space-7);
    margin: calc(-1 * var(--space-7)) calc(-1 * var(--space-7)) var(--space-4);
    font-weight: var(--fw-bold);
    color: var(--navy);
  }
  #accounts-root .am-inline-panel__body {
    display: block;
    margin: 0;
    padding: 0;
    width: 100%;
    background: transparent;
  }
  #accounts-root .am-inline-panel .detail-row__label {
    background: var(--surface-subtle);
    min-height: calc(var(--control-h) + var(--space-2) * 2);
    padding-top: var(--space-2);
    padding-bottom: var(--space-2);
    box-sizing: border-box;
    display: flex;
    align-items: center;
  }
  #accounts-root .am-inline-panel .detail-row__value {
    background: var(--surface-subtle);
    min-height: calc(var(--control-h) + var(--space-2) * 2);
    padding-top: var(--space-2);
    padding-bottom: var(--space-2);
    box-sizing: border-box;
  }
  #accounts-root .am-inline-panel .detail-row:has(.am-field-note) .detail-row__label {
    align-items: flex-start;
  }
  /* 編集時: 現エラー回数＝職員名＋メールアドレスの2行分の高さ */
  #accounts-root .am-inline-panel .detail-row:has(#am-failed-login-count) .detail-row__label,
  #accounts-root .am-inline-panel .detail-row:has(#am-failed-login-count) .detail-row__value {
    min-height: calc((var(--control-h) + var(--space-2) * 2) * 2 + 1px);
  }
  #accounts-root .am-inline-panel .detail-row:has(#am-failed-login-count) .detail-row__label {
    align-items: flex-start;
  }
  #accounts-root .am-inline-panel .detail-row:has(#am-failed-login-count) .detail-row__value {
    align-items: flex-start;
  }
  #accounts-root .am-inline-panel .detail-row__static {
    background: transparent;
    min-height: var(--control-h);
    height: var(--control-h);
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
  }
  #accounts-root .am-inline-panel .detail-row__value .form-input {
    background: #fff;
    min-height: var(--control-h);
    height: var(--control-h);
    box-sizing: border-box;
    padding-top: 0;
    padding-bottom: 0;
  }
  #accounts-root .am-inline-panel .detail-row__value select.form-input {
    line-height: calc(var(--control-h) - 2px);
  }
  #accounts-root .am-inline-panel .detail-row__value select.am-detail-select {
    width: 200px;
    min-width: 200px;
    max-width: 100%;
  }
  #accounts-root .am-inline-panel .detail-row__value select.am-detail-select--status {
    width: 133px;
    min-width: 133px;
  }
  #accounts-root .am-inline-panel .am-field-note {
    flex: 1 0 100%;
    line-height: var(--lh-snug);
    margin-top: 2px;
    white-space: normal;
  }
  #accounts-root .table-scroll table {
    table-layout: fixed;
    width: 100%;
  }
  #accounts-root .table-scroll > table > thead > tr > th:nth-child(1),
  #accounts-root .table-scroll > table > tbody > tr:not(.am-inline-row) > td:nth-child(1) { width: 10%; }
  #accounts-root .table-scroll > table > thead > tr > th:nth-child(2),
  #accounts-root .table-scroll > table > tbody > tr:not(.am-inline-row) > td:nth-child(2) { width: 12%; }
  #accounts-root .table-scroll > table > thead > tr > th:nth-child(3),
  #accounts-root .table-scroll > table > tbody > tr:not(.am-inline-row) > td:nth-child(3) { width: 22%; }
  #accounts-root .table-scroll > table > thead > tr > th:nth-child(4),
  #accounts-root .table-scroll > table > tbody > tr:not(.am-inline-row) > td:nth-child(4) { width: 14%; }
  #accounts-root .table-scroll > table > thead > tr > th:nth-child(5),
  #accounts-root .table-scroll > table > tbody > tr:not(.am-inline-row) > td:nth-child(5) { width: 10%; }
  #accounts-root .table-scroll > table > thead > tr > th:nth-child(6),
  #accounts-root .table-scroll > table > tbody > tr:not(.am-inline-row) > td:nth-child(6) { width: 10%; }
  #accounts-root .table-scroll > table > thead > tr > th:nth-child(7),
  #accounts-root .table-scroll > table > tbody > tr:not(.am-inline-row) > td:nth-child(7) { width: 14%; }
  #accounts-root .table-scroll > table > thead > tr > th.col-action,
  #accounts-root .table-scroll > table > tbody > tr:not(.am-inline-row) > td.col-action {
    width: 88px;
    overflow: visible;
    white-space: nowrap;
    text-overflow: clip;
  }
  #accounts-root .table-scroll > table > thead > tr > th:not(.col-action),
  #accounts-root .table-scroll > table > tbody > tr:not(.am-inline-row) > td:not(.col-action) {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  #accounts-root .table-scroll > table > tbody > tr:not(.am-inline-row) > td.account-login-cell {
    white-space: normal;
    overflow: hidden;
  }

  th { background: var(--surface-subtle); font-size: var(--fs-sm); font-weight: var(--fw-bold); color: var(--muted); padding: var(--space-3) var(--space-5); text-align: left; border-bottom: 1px solid var(--border); }
  th.num { text-align: right; }
  td { padding: var(--space-4) var(--space-5); border-bottom: 1px solid #f0f0f0; vertical-align: middle; }
  tr:last-child td { border-bottom: none; }
  /* 一覧がウィンドウ高さまで伸びる画面では、最終行下線を残して空白との区切りを見せる */
  #accounts-root .table-scroll > table > tbody > tr:last-child:not(.am-inline-row) > td,
  #view-reports .table-scroll > table > tbody > tr:last-child > td,
  #view-home .recent-reports-card .table-scroll > table > tbody > tr:last-child > td,
  #view-home #dash-monthly-table-scroll > table > tbody > tr:last-child > td {
    border-bottom: 1px solid #f0f0f0;
  }
  tr:hover td { background: var(--surface-hover); }
  td.num { text-align: right; font-weight: var(--fw-semibold); color: var(--navy); }

  .monthly-table th { font-size: var(--fs-2xs); padding: var(--space-3) var(--space-4); }
  .monthly-table td { font-size: var(--fs-sm); padding: var(--space-3) var(--space-4); }

  #monthly-table-card td.num, #dash-monthly-table-card td.num { font-weight: var(--fw-regular); }
  tr.total td { background: var(--bg); font-weight: var(--fw-bold); }
  tfoot td { border-top: 1px solid var(--border); }

  #monthly-table-card td { height: 40px; box-sizing: border-box; }

  #monthly-table-card { display: flex; flex-direction: column; flex: 1; min-height: 0; }

  .badge {
    display: inline-block;
    padding: 2px var(--space-3);
    border-radius: var(--radius-pill);
    font-size: var(--fs-xs);
    font-weight: var(--fw-semibold);
    white-space: nowrap;
    background: color-mix(in srgb, var(--badge-color, #7a8896) 16%, white);
    color: var(--badge-color, #4a5568);
  }
  .badge-status-ok { background: var(--labor-bg); color: var(--labor-text); }
  .badge-status-pending { background: var(--wage-bg); color: var(--wage-text); }
  .badge-status-new { background: var(--tariff-bg); color: var(--tariff-text); }

  #dash-theme-chart { display: flex; }
  #dash-theme-chart .card { flex: 1; display: flex; flex-direction: column; margin-bottom: 0; }
  #dash-theme-chart .card-body { flex: 1; display: flex; align-items: center; }

  #dash-theme-chart .card-header, #dash-heatmap-card .card-header {
    background: var(--gold-bg); border-bottom-color: var(--gold-border);
  }

  #dash-monthly-table-scroll { overflow-y: auto; }
  #dash-monthly-table-scroll table { table-layout: fixed; width: 100%; }
  #dash-monthly-table-scroll th:first-child, #dash-monthly-table-scroll td:first-child { width: 16%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #dash-monthly-table-scroll th:nth-child(2), #dash-monthly-table-scroll th:nth-child(3),
  #dash-monthly-table-scroll th:nth-child(4), #dash-monthly-table-scroll th:nth-child(5) { width: 8%; }
  #dash-monthly-table-scroll th:nth-child(6) { width: 10%; }
  #dash-monthly-table-scroll th:nth-child(7) { width: 26%; }
  #dash-monthly-table-scroll th:nth-child(8) { width: 12%; }

  #dash-monthly-table-scroll td:nth-child(7) { white-space: nowrap; }
  #dash-monthly-table-scroll td:nth-child(7) .flex { flex-wrap: nowrap; }
  #dash-monthly-table-scroll th { position: sticky; top: 0; z-index: 1; }

  .bar-chart { display: flex; align-items: flex-start; gap: var(--space-3); width: 100%; }
  .bar-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: var(--space-1); }
  .bar-track { width: 100%; height: 100px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; }
  .bar { width: 100%; border-radius: 4px 4px 0 0; background: var(--navy); transition: height 0.3s; }

  .bar-label { font-size: var(--fs-2xs); color: var(--text); text-align: center; overflow-wrap: break-word; }
  .bar-val { font-size: var(--fs-xs); font-weight: var(--fw-bold); color: var(--text); white-space: nowrap; margin-bottom: 2px; }
  .bar--wage       { background: var(--accent); }
  .bar--minwage    { background: var(--accent-dark); }
  .bar--labor      { background: var(--green); }
  .bar--laborshort { background: #6fb48a; }
  .bar--energy     { background: var(--blue); }
  .bar--priceup    { background: #6ba9d6; }
  .bar--digital    { background: var(--purple); }
  .bar--tariff     { background: var(--red); }
  .bar--invoice    { background: var(--teal); }
  .bar--ebooks     { background: #888; }
  .bar--covid      { background: #b5566f; }

  .pref-grid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 3px; }
  @media (max-width: 600px) {
    .pref-grid { grid-template-columns: repeat(5, 1fr); }
  }

  .grid-pager { display: none; align-items: center; gap: var(--space-3); }
  .grid-pager.is-active { display: flex; }
  .grid-pager .page-indicator { font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; }
  .pref-cell {
    background: #dbe8f8; border-radius: 3px; padding: 3px 2px; text-align: center;
    font-size: var(--fs-2xs); color: var(--navy); font-weight: var(--fw-regular); cursor: pointer;
    transition: filter 0.15s;
  }
  .pref-cell:hover { filter: brightness(0.9); }

  .pref-cell.h1 { background: #DCE9F7; color: #1A3A5C; }
  .pref-cell.h2 { background: #C9DFF2; color: #1A3A5C; }
  .pref-cell.h3 { background: #7BAED4; color: #FFFFFF; }
  .pref-cell.h4 { background: #367DB3; color: #FFFFFF; }
  .pref-cell.h5 { background: #1A3A5C; color: #FFFFFF; }
  .pref-cell.is-off { opacity: 0.25; filter: grayscale(70%); }
  tr.is-off { display: none; }

  .pref-filter {
    display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3) var(--space-5);
    padding-bottom: var(--space-4); margin-bottom: var(--space-4); border-bottom: 1px dashed var(--border);
    font-size: var(--fs-xs); color: var(--text);
  }
  .pref-filter label { display: flex; align-items: center; gap: 4px; cursor: pointer; white-space: nowrap; }
  .pref-filter__all { font-weight: var(--fw-bold); color: var(--navy); }
  .pref-filter__sep { width: 1px; align-self: stretch; background: var(--border); }

  .legend { display: flex; gap: 3px; align-items: center; font-size: var(--fs-md); color: var(--muted); }

  .legend-swatch { width: 18px; height: 14px; border-radius: 3px; }
  .legend-label { font-weight: var(--fw-semibold); }
  .legend-swatch--h1 { background: #DCE9F7; }
  .legend-swatch--h2 { background: #C9DFF2; }
  .legend-swatch--h3 { background: #7BAED4; }
  .legend-swatch--h4 { background: #367DB3; }
  .legend-swatch--h5 { background: #1A3A5C; }

  .progress { background: #ddd; border-radius: 4px; height: 6px; overflow: hidden; }
  .progress__fill { height: 100%; background: var(--navy); }
  .progress__fill--accent { background: var(--accent); }
  .progress__fill--green { background: var(--green); }

  .form-section { margin-bottom: var(--space-7); }
  .form-section-title {
    font-size: var(--fs-sm); font-weight: var(--fw-bold); color: var(--navy); padding: var(--space-3) var(--space-4);
    background: var(--bg); border-radius: var(--radius-md) var(--radius-md) 0 0; border: 1px solid var(--border);
    border-bottom: none;
  }
  .form-body { background: white; border: 1px solid var(--border); border-radius: 0 0 var(--radius-md) var(--radius-md); padding: var(--space-5); }
  .form-grid { display: grid; gap: var(--space-4); margin-bottom: var(--space-4); }
  .form-grid:last-child { margin-bottom: 0; }
  .form-grid.col2 { grid-template-columns: 1fr 1fr; }
  .form-grid.col3 { grid-template-columns: 1fr 1fr 1fr; }
  .form-row { display: flex; flex-direction: column; gap: 3px; }
  .form-label { font-size: var(--fs-xs); font-weight: var(--fw-semibold); color: var(--muted); margin-bottom: var(--space-2); }
  .form-label .req { color: var(--red); margin-left: 2px; }

  .mi-timer { font-size: var(--fs-md); font-weight: var(--fw-bold); color: var(--navy); font-variant-numeric: tabular-nums; }
  .mi-timer--warning { color: var(--red); animation: mi-timer-pulse 1s ease-in-out infinite; }
  @keyframes mi-timer-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

  #mi-voice-btn.is-recording { background: var(--red); border-color: var(--red); animation: mi-timer-pulse 1s ease-in-out infinite; }
  #mi-voice-btn.is-recording.is-paused { animation: none; opacity: 0.6; }
  .form-input {
    border: 1px solid var(--border-input); border-radius: var(--radius-sm); padding: var(--space-3) var(--space-4);
    font-size: var(--fs-base); color: var(--text); background: white;
    font-family: inherit; width: 100%;
  }
  .form-input:focus { outline: none; border-color: var(--navy); box-shadow: var(--focus-ring-soft); }

  .form-input::placeholder { color: var(--placeholder-color); opacity: 1; font: inherit; }

  /* ネイティブselectは親のcolorが選択肢にも効くため、optionは常に本文色。未選択表示だけplaceholder色にする */
  select.form-input option,
  select.form-input option[value=""] { color: var(--text); }

  select.form-input.is-placeholder { color: var(--placeholder-color); }
  textarea.form-input { resize: vertical; }
  .form-input[disabled] { background: var(--surface-subtle); border-color: var(--border); color: var(--muted); }
  .form-input--compact { padding: var(--space-2) var(--space-4); }

  .form-input.is-invalid { border-color: var(--red); box-shadow: 0 0 0 3px rgba(192,57,43,0.12); }

  .checkbox-grid.is-invalid { border-color: var(--red); box-shadow: 0 0 0 3px rgba(192,57,43,0.12); }
  .detail-row--invalid .detail-row__label { color: var(--red); font-weight: var(--fw-bold); }

  input[type="checkbox"], input[type="radio"] {
    width: 15px; height: 15px; accent-color: var(--navy); cursor: pointer; flex-shrink: 0;
  }

  .checkbox-grid {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-4);
    border: 1px solid transparent; border-radius: var(--radius-sm);
    padding: var(--space-2);

    margin: calc(var(--space-2) * -1) 0 calc(var(--space-2) * -1) 0;
  }

  .mi-extra-field--hidden { display: none; }

  .mi-line-card {
    display: grid; grid-template-columns: var(--mi-label-w) minmax(0, 1fr); align-items: baseline; row-gap: var(--space-3);
    box-shadow: inset 0 0 0 1px var(--border-input); border-radius: var(--radius-sm);
    padding: var(--space-3) var(--space-4) var(--space-3) 0; background: var(--surface-subtle);
  }
  .mi-line-card--invalid { box-shadow: inset 0 0 0 1px var(--red), 0 0 0 2px rgba(192,57,43,0.12); }
  #mi-line-list { display: flex; flex-direction: column; gap: var(--space-2); }
  .mi-line-card__row { display: contents; }
  .mi-line-card__label { text-align: right; padding-right: calc(var(--space-6) / 2); font-size: var(--fs-sm); font-weight: var(--fw-bold); color: var(--text); }
  .mi-line-card__row--invalid > .mi-line-card__label { color: var(--red); }
  .mi-line-card__row > .mi-line-row { padding-left: calc(var(--space-6) / 2); }
  .mi-line-card__head { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding-left: var(--space-4); }
  .mi-line-card__title { font-size: var(--fs-sm); font-weight: var(--fw-bold); color: var(--navy); }
  .mi-line-card__remove { background: none; border: none; color: var(--red); font-size: var(--fs-sm); font-weight: var(--fw-bold); cursor: pointer; }
  .mi-line-themes { display: flex; flex-wrap: wrap; gap: var(--space-3) var(--space-4); }
  .mi-line-themes.is-invalid { outline: 2px solid var(--red); outline-offset: 2px; border-radius: var(--radius-sm); }
  .mi-line-support-class.is-invalid {
    outline: 2px solid var(--red);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
    padding: 2px 4px;
  }
  .mi-line-themes label { display: flex; align-items: center; gap: var(--space-1); white-space: nowrap; cursor: pointer; font-size: var(--fs-base); }
  .mi-line-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); flex: 1 1 100%; }
  .mi-line-field { display: flex; align-items: center; gap: var(--space-2); flex: 0 1 auto; }
  .mi-line-field--wide { flex: 1 1 100%; flex-wrap: wrap; }
  .mi-line-field--scale { flex-wrap: wrap; gap: var(--space-2) var(--space-3); }
  .mi-line-field--scale > select.form-input { flex: 0 1 auto; }
  /* 様式G-7→I-5: 支援テーマ興味順（一番目／二番目／三番目）— 125%拡大でも1行維持 */
  .mi-line-field--theme-rank {
    flex-wrap: nowrap;
    gap: var(--space-2) var(--space-3);
    min-width: 0;
  }
  .mi-line-field--theme-rank > select.form-input.mi-line-theme-rank {
    flex: 1 1 0;
    min-width: 0 !important;
    width: auto !important;
    max-width: none !important;
  }
  .mi-line-format-actions .mi-hint-text { flex: 1; }
  .mi-line-format-actions { flex: 1 1 100%; display: flex; align-items: center; gap: var(--space-3); }
  .mi-line-row > #mi-line-add { margin-left: auto; }
  .mi-line-field--grow { flex: 0 1 auto; min-width: 0; max-width: 100%; }
  .mi-line-field select.form-input { max-width: none; }
  .mi-line-field__label { font-size: var(--fs-sm); font-weight: var(--fw-bold); color: var(--text); white-space: nowrap; }
  .mi-line-field .form-input { width: auto; flex: 0 1 auto; max-width: none; min-width: 0; }
  .mi-line-field--grow .form-input { flex: 0 1 auto; max-width: 100%; }
  .mi-line-field--wide .form-input { flex: 1 1 auto; }
  .mi-line-field input[type="time"].form-input { flex: 0 0 auto; width: 74px; padding-left: var(--space-4); padding-right: var(--space-2); }

  .mi-layout { display: grid; grid-template-columns: 60fr 40fr; grid-template-rows: auto 1fr; gap: var(--space-6); align-items: stretch; }
  @media (max-width: 900px) { .mi-layout { grid-template-columns: 1fr; } }

  .mi-side-panel {
    display: flex; flex-direction: column; gap: var(--space-5);
    position: sticky; top: var(--space-6); align-self: start;
    max-height: calc(100vh - var(--space-8) * 2); overflow-y: auto;
  }
  .mi-side-panel textarea.form-input { width: 100%; }

  #mi-detail-card .detail-row { border-bottom: none; }

  #mi-detail-card .detail-row__label { width: var(--mi-label-w); display: flex; align-items: center; justify-content: flex-end; text-align: right; padding: 0 calc(var(--space-6) / 2) 0 0; background: none; font-size: var(--fs-sm); font-weight: var(--fw-bold); }

  #mi-detail-card > .card-body { padding-left: 8px; padding-bottom: var(--space-5); }
  #mi-detail-card .form-input { font-size: var(--fs-md); }

  /* 入力・下拉を同一高さにし、select の上下paddingによる文字欠けを防ぐ */
  #mi-detail-card .detail-row__value > .form-input:not(textarea),
  #mi-detail-card .detail-row__value .mi-autocomplete > .form-input,
  #mi-detail-card .detail-row__value .mi-time-fields > .form-input,
  #mi-detail-card select.form-input {
    height: 36px;
    min-height: 36px;
    box-sizing: border-box;
    padding-top: 0;
    padding-bottom: 0;
    line-height: 34px;
    vertical-align: middle;
  }
  #mi-detail-card select.form-input {
    padding-right: 28px;
  }

  #mi-detail-card .detail-row__value {
    padding: var(--space-2) var(--space-6) var(--space-2) calc(var(--space-6) / 2);
    min-height: 34px;
    box-sizing: border-box;
    align-items: center;
    min-width: 0;
    flex-wrap: wrap;
  }

  #mi-attendees { min-width: 0; }

  .mi-voice-card { display: flex; flex-direction: column; flex: 1 1 auto; }

  .mi-voice-card.is-maximized { z-index: 120; box-shadow: 0 16px 48px rgba(0,0,0,0.3); }
  .mi-voice-card__body { flex: 1; display: flex; flex-direction: column; }
  #mi-voice-panel { flex: 1; display: flex; flex-direction: column; }

  .mi-transcript-row { flex: 1; display: flex; flex-direction: column; }
  .mi-transcript-input { flex: 1; min-height: 90px; resize: none; }

  .mi-chatbot-fab {
    position: fixed; bottom: var(--space-7); right: var(--space-7);
    width: 52px; height: 52px; border-radius: 50%;
    background: var(--navy); color: white; border: none;
    font-size: 22px; cursor: pointer; box-shadow: 0 8px 20px rgba(0,0,0,0.25);
    display: flex; align-items: center; justify-content: center;
    z-index: 150; transition: background 0.15s;
  }
  .mi-chatbot-fab:hover { background: var(--navy-light); }
  .mi-chatbot-window {
    position: fixed; bottom: 92px; right: var(--space-7);
    width: 640px; max-width: calc(100vw - 24px); height: 420px; max-height: calc(100vh - 24px);
    background: white; border-radius: var(--radius-lg); box-shadow: 0 12px 32px rgba(0,0,0,0.3);
    display: none; flex-direction: column; overflow: hidden; z-index: 150; box-sizing: border-box;
    border: 1px solid var(--border);
  }
  .mi-chatbot-window.is-open { display: flex; }
  .mi-chatbot-window__header { background: var(--navy); color: white; padding: var(--space-4) var(--space-5); font-weight: var(--fw-bold); display: flex; justify-content: space-between; align-items: center; cursor: move; touch-action: none; user-select: none; }
  .mi-chatbot-window__close { background: none; border: none; color: white; font-size: 16px; cursor: pointer; }
  .mi-chatbot-window__body { flex: 1; min-height: 0; padding: var(--space-5); overflow-y: auto; display: flex; flex-direction: column; gap: var(--space-3); }
  .mi-chatbot-msg { font-size: var(--fs-sm); background: #f0f3f6; border-radius: var(--radius-md); padding: var(--space-3) var(--space-4); align-self: flex-start; max-width: 85%; }
  .mi-chatbot-msg--user { background: var(--navy); color: white; align-self: flex-end; }
  .mi-chatbot-quick-replies { display: flex; flex-wrap: wrap; gap: var(--space-2); align-self: flex-start; max-width: 85%; }
  .mi-chatbot-window__footer { border-top: 1px solid var(--border); padding: var(--space-3) 28px var(--space-4) var(--space-3); display: flex; gap: var(--space-2); }
  .mi-chatbot-window__footer input { flex: 1; }
  .mi-chatbot-window__resize { position: absolute; right: 3px; bottom: 3px; width: 18px; height: 18px; padding: 0; border: 0; background: transparent; cursor: nwse-resize; touch-action: none; z-index: 2; }
  .mi-chatbot-window__resize::after { content: ''; position: absolute; right: 3px; bottom: 3px; width: 9px; height: 9px; border-right: 2px solid #64748b; border-bottom: 2px solid #64748b; }
  .checkbox-grid label { display: flex; align-items: center; gap: var(--space-2); font-size: var(--fs-base); cursor: pointer; }

  .btn { display: inline-flex; align-items: center; gap: var(--space-2); padding: var(--space-4) var(--space-7); border-radius: var(--radius-md); font-size: var(--fs-base); font-weight: var(--fw-bold); cursor: pointer; border: none; transition: all 0.15s; font-family: inherit; box-shadow: 0 1px 2px rgba(20,30,50,0.08); }
  .btn[hidden] { display: none !important; }
  .btn:hover { transform: translateY(-1px); box-shadow: 0 4px 8px rgba(20,30,50,0.15); }
  .btn:active { transform: translateY(0); box-shadow: 0 1px 2px rgba(20,30,50,0.12); }
  .btn-primary { background: var(--navy); color: white; box-shadow: 0 2px 4px rgba(26,58,90,0.25); }

  .btn-primary:hover { filter: brightness(1.15); box-shadow: 0 4px 10px rgba(26,58,90,0.35); }
  .btn-primary--violet { background: var(--purple); color: white; }

  .btn-primary--violet:hover { filter: brightness(1.15); }
  .btn-accent { background: var(--accent); color: #1a1a1a; }
  .btn-accent:hover { background: var(--accent-dark); }
  .btn-outline { background: white; color: var(--navy); border: 1px solid var(--border); }

  .btn-outline:hover { background: var(--surface-hover); }
  .btn-danger { background: var(--red); color: white; }
  .btn-green { background: var(--green); color: white; }
  .btn-sm { padding: var(--space-2) var(--space-5); font-size: var(--fs-sm); border-radius: var(--radius-sm); }

  /* 版管理：アップロード行のボタン文字が枠内に収まるようにする */
  .kd-version-upload {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4);
  }
  .kd-version-upload__file {
    width: auto;
    flex: 1 1 12rem;
    min-width: 0;
    max-width: 100%;
  }
  .kd-version-upload__hint {
    flex-shrink: 0;
    white-space: nowrap;
  }
  .kd-version-upload .btn {
    flex-shrink: 0;
    white-space: nowrap;
  }
  .btn-block { width: 100%; justify-content: center; }
  .btn:disabled { opacity: 0.4; cursor: default; pointer-events: none; }

  .action-card {
    display: block; background: white; border-radius: var(--radius-lg); border: 1px solid var(--border);
    box-shadow: var(--shadow-card); cursor: pointer;
    text-align: center; text-decoration: none;
  }

  .action-card.is-active { border: 2px solid var(--purple); background: color-mix(in srgb, var(--purple) 6%, transparent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--purple) 12%, transparent); }
  .action-card--disabled { cursor: default; opacity: 0.5; }
  .action-card__icon { font-size: var(--icon-lg); margin-bottom: var(--space-1); }
  .action-card__title { font-weight: var(--fw-bold); font-size: var(--fs-md); color: var(--navy); }
  .action-card__sub { font-size: var(--fs-xs); color: var(--muted); margin-top: var(--space-1); }

  .import-zone { border: 2px dashed var(--border); border-radius: var(--radius-lg); padding: 28px; text-align: center; background: var(--surface-hover); cursor: pointer; transition: all 0.2s; }
  .import-zone:hover { border-color: var(--navy); background: var(--bg); }
  .import-zone--violet { border-color: var(--violet-border); }
  .import-zone--violet:hover { border-color: var(--purple); }
  .import-zone--gold { border-color: var(--gold-border); }
  .import-zone--gold:hover { border-color: var(--accent-dark); }
  .import-zone .import-icon { font-size: var(--icon-xl); margin-bottom: var(--space-3); }
  .import-zone .import-text { font-size: var(--fs-md); font-weight: var(--fw-semibold); color: var(--navy); }
  .import-zone .import-sub { font-size: var(--fs-xs); color: var(--muted); margin-top: var(--space-2); }
  .import-zone .btn { margin-top: var(--space-4); }
  .import-zone--violet .btn { border-color: var(--violet-border); color: var(--purple); }
  .import-zone--gold .btn { border-color: var(--gold-border); color: var(--gold-text); }

  .import-zone--lg { padding: 56px 28px; }
  .import-zone.is-dragover { border-color: var(--navy); background: var(--bg); }

  .proposal-card {
    background: white; border-radius: var(--radius-md); padding: var(--space-5);
    border: 1px solid var(--border); border-left: 4px solid var(--navy);
  }
  /* AI回答：Web/RAG と同じ見出しバー + 本文カード */
  .ap-answer-block {
    margin-bottom: var(--space-3);
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
  }
  .ap-answer-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    font-size: var(--fs-md);
    font-weight: var(--fw-semibold);
    color: var(--navy, #1a3a5c);
    background: var(--bg, #f7f8fa);
    border-bottom: 1px solid var(--border);
  }
  /* AI提案 freeform：見出し付きブロック内は枠なし */
  #ap-result-body .ap-answer-block .proposal-card.ap-freeform {
    border: none;
    border-radius: 0;
    box-shadow: none;
    margin: 0;
    padding: var(--space-4);
  }
  #ap-result-body .proposal-card.ap-freeform {
    border: none;
    border-radius: 0;
    box-shadow: none;
  }
  .proposal-card--mid { border-left-color: var(--blue); }
  .proposal-card__header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: var(--space-3); margin-bottom: var(--space-3); }
  .proposal-card__title {
    font-weight: var(--fw-bold); font-size: var(--fs-md); background: var(--gold-bg);
    border-bottom: 1px solid var(--gold-border); padding: var(--space-5) var(--space-7);
    border-radius: var(--radius-md) var(--radius-md) 0 0; flex: 1 1 auto;
    box-sizing: border-box; margin: calc(-1 * var(--space-5)) calc(-1 * var(--space-5)) 0;
  }
  .proposal-card__body { font-size: var(--fs-md); color: var(--text); line-height: var(--lh-relaxed); margin-bottom: var(--space-4); }

  .ap-freeform__body { font-size: var(--fs-md); color: var(--text); line-height: var(--lh-relaxed); }
  .ap-freeform__h1 { font-size: 1.25rem; font-weight: var(--fw-bold); margin: 0 0 var(--space-4); }
  .ap-freeform__h2 { font-size: 1.1rem; font-weight: var(--fw-bold); margin: var(--space-5) 0 var(--space-3); }
  .ap-freeform__h3 { font-size: 1rem; font-weight: var(--fw-bold); margin: var(--space-4) 0 var(--space-2); }
  .ap-freeform__p { margin: 0 0 var(--space-3); }
  .ap-freeform__ul { margin: 0 0 var(--space-4); padding-left: 1.25em; }
  .ap-freeform__ul li { margin-bottom: var(--space-2); }
  .ap-freeform__table-wrap {
    overflow-x: auto; margin: 0 0 var(--space-4); -webkit-overflow-scrolling: touch;
  }
  .ap-freeform__table {
    width: 100%; border-collapse: collapse; font-size: var(--fs-sm);
    line-height: var(--lh-relaxed);
  }
  .ap-freeform__table th,
  .ap-freeform__table td {
    border: 1px solid var(--border); padding: var(--space-2) var(--space-3);
    text-align: left; vertical-align: top; word-break: break-word;
  }
  .ap-freeform__table th {
    background: var(--bg); font-weight: var(--fw-bold); white-space: nowrap;
  }
  .ap-freeform__body a { color: var(--blue); text-decoration: underline; word-break: break-all; }
  .ap-freeform__citations {
    margin-top: var(--space-5); padding-top: var(--space-4); border-top: 1px solid var(--border);
    font-size: var(--fs-sm); color: var(--text);
  }
  .ap-freeform__citations-title { font-weight: var(--fw-bold); margin-bottom: var(--space-2); }
  .ap-freeform__citations ul { margin: 0; padding-left: 1.2em; }
  .ap-freeform__citations li { margin-bottom: var(--space-2); }
  .ap-freeform__cite-note { color: var(--muted, #667); }
  .ap-freeform-knowledge-ref {
    background: none; border: none; padding: 0; margin: 0;
    color: var(--blue); text-decoration: underline; cursor: pointer;
    font: inherit; text-align: left;
  }
  .ap-freeform-knowledge-ref:hover { opacity: 0.85; }
  .ap-freeform__body code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.92em; background: var(--bg); padding: 0 0.25em; border-radius: 3px;
  }

  #ks-results .proposal-card {
    display: block; min-width: 0; max-width: 100%; height: auto; overflow: visible;
  }
  #ks-results .proposal-card__header {
    display: block; min-width: 0; height: auto; overflow: visible;
  }
  #ks-results .proposal-card__title {
    display: block; width: auto; max-width: none; min-width: 0; flex: none;
    height: auto; max-height: none; overflow: visible;
    white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word;
    line-height: var(--lh-relaxed);
    -webkit-line-clamp: unset; line-clamp: unset;
  }
  #ks-results .ks-result-line,
  #ap-result-body .ks-result-line { display: block; margin-top: var(--space-7); }
  .modal-box--knowledge {
    width: min(760px, 92vw); max-height: 86vh;
    display: flex; flex-direction: column; border-radius: 16px;
  }
  .modal-box--knowledge .modal-box__body { overflow: auto; background: #fff; }
  .ap-knowledge-modal__mark {
    display: inline-block; width: 18px; height: 18px; margin-right: 8px; vertical-align: -3px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%233b82c4' stroke-width='2'%3E%3Cpath d='M7 3h7l5 5v13a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1z'/%3E%3Cpath d='M14 3v6h6'/%3E%3C/svg%3E") center / contain no-repeat;
  }
  .ap-knowledge-sections { display: flex; flex-direction: column; gap: 12px; }
  .ap-knowledge-section { border-radius: 12px; padding: 16px 18px; }
  .ap-knowledge-section__head {
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 8px; font-weight: var(--fw-bold); color: #1f2a37;
  }
  .ap-knowledge-section__icon { width: 18px; height: 18px; flex: 0 0 18px; background: center / contain no-repeat; }
  .ap-knowledge-section__body {
    white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.75;
    font-size: var(--fs-sm); color: #243042;
  }
  .ap-knowledge-section--issue { background: #fff6df; }
  .ap-knowledge-section--issue .ap-knowledge-section__icon {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23e0a100'%3E%3Cpath d='M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20zm1 14h-2v-2h2v2zm0-4h-2V6h2v6z'/%3E%3C/svg%3E");
  }
  .ap-knowledge-section--support { background: #eef5fb; }
  .ap-knowledge-section--support .ap-knowledge-section__icon {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%233b82c4'%3E%3Cpath d='M19.4 13a7.8 7.8 0 0 0 .1-1 7.8 7.8 0 0 0-.1-1l2-1.6-2-3.4-2.4 1a7.7 7.7 0 0 0-1.7-1L15 3h-4l-.3 2.4a7.7 7.7 0 0 0-1.7 1l-2.4-1-2 3.4L6.6 11a7.8 7.8 0 0 0-.1 1 7.8 7.8 0 0 0 .1 1l-2 1.6 2 3.4 2.4-1a7.7 7.7 0 0 0 1.7 1L11 21h4l.3-2.4a7.7 7.7 0 0 0 1.7-1l2.4 1 2-3.4-2-1.6zM13 15.5A3.5 3.5 0 1 1 13 8a3.5 3.5 0 0 1 0 7.5z'/%3E%3C/svg%3E");
  }
  .ap-knowledge-section--result { background: #eef8f0; }
  .ap-knowledge-section--result .ap-knowledge-section__icon {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%233d9a62'%3E%3Cpath d='M4 19h16v2H4v-2zm2-2h3V9H6v8zm5 0h3V5h-3v12zm5 0h3v-6h-3v6z'/%3E%3C/svg%3E");
  }
  .ap-knowledge-section--outcome { background: #f4f1f8; }
  .ap-knowledge-section--outcome .ap-knowledge-section__icon {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%237c6bb5'%3E%3Cpath d='M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20zm-1.2 14.2-3.5-3.5 1.4-1.4 2.1 2.1 4.5-4.5 1.4 1.4-5.9 5.9z'/%3E%3C/svg%3E");
  }
  .ap-knowledge-ref-label { color: var(--text); }
  .ap-knowledge-ref {
    display: inline;
    background: none; border: none; padding: 0; color: var(--purple);
    font: inherit; text-align: left; text-decoration: underline; cursor: pointer;
  }
  #ap-result-body .proposal-card__meta { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: var(--space-2); row-gap: var(--space-1); }
  #ap-result-body .ap-knowledge-ref-list { display: inline-flex; flex: 1 1 auto; flex-wrap: wrap; align-items: baseline; min-width: 0; }
  #ap-result-body .ap-knowledge-ref { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
  #ap-result-body .ap-knowledge-ref + .ap-knowledge-ref::before { content: '、'; color: var(--muted); padding: 0 var(--space-2); text-decoration: none; }
  #ap-result-body .proposal-card__header { display: block; height: auto; max-height: none; overflow: visible; }
  #ap-result-body .proposal-card__title {
    display: block; height: auto; max-height: none; overflow: visible; white-space: pre-wrap;
    overflow-wrap: anywhere; word-break: break-word;
  }
  #ks-results .proposal-card__body { flex: 1; }
  .proposal-card__meta { font-size: var(--fs-md); color: var(--muted); }

  details summary { cursor: pointer; padding: var(--space-4); font-weight: var(--fw-semibold); font-size: var(--fs-base); list-style: none; display: flex; justify-content: space-between; align-items: center; }
  details summary::after { content: '▼'; font-size: var(--fs-2xs); color: var(--muted); }
  details[open] summary::after { content: '▲'; }

  .table-scroll { overflow-x: auto; }
  #accounts-root .table-scroll,
  #view-reports .table-scroll {
    overflow-x: hidden;
  }

  @media (max-width: 900px) {
    .nav-toggle-fixed { display: flex; }
    .subheader { padding-left: 64px; }
    .screen:not(:has(.subheader)) .screen-body { padding-top: 64px; }
    .sidebar {
      position: fixed; top: 0; bottom: 0; left: 0; width: 240px;
      max-width: 80vw; z-index: 90; overflow-y: auto;
      transform: translateX(-100%); transition: transform 0.2s ease;
      box-shadow: 2px 0 12px rgba(0,0,0,0.2);
    }
    body.nav-open .sidebar { transform: translateX(0); }
    body.nav-open .sidebar-scrim {
      display: block; position: fixed; z-index: 80;
      top: 0; left: 0; right: 0; bottom: 0;
      background: rgba(20,30,40,0.4);
    }
    .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-form-result, .grid-2 { grid-template-columns: 1fr; }
    .checkbox-grid { grid-template-columns: repeat(2, 1fr); }
  }

  @media (max-width: 600px) {
    .screen-body { padding: var(--space-6) var(--space-7); }
    .subheader { padding: 0 var(--space-7); }
    .kpi-grid { grid-template-columns: 1fr; }
    .checkbox-grid { grid-template-columns: 1fr; }
    .page-title { font-size: var(--fs-lg); }

    .mode-select-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  }

  .login-screen {
    min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: var(--space-5); padding: var(--space-6);
    background: linear-gradient(160deg, var(--navy) 0%, #0f2038 100%);
  }
  .login-card {
    width: 100%; max-width: 380px; background: white; border-radius: var(--radius-lg);
    box-shadow: 0 20px 50px rgba(0,0,0,0.35); padding: var(--space-8) var(--space-7);
  }
  .login-brand { font-size: var(--fs-lg); font-weight: var(--fw-black); color: var(--navy); text-align: center; }
  .login-brand span { color: var(--purple); }
  .login-brand-sub { font-size: var(--fs-xs); color: var(--muted); text-align: center; margin-top: var(--space-2); margin-bottom: var(--space-7); }
  .login-step-title { font-size: var(--fs-md); font-weight: var(--fw-bold); color: var(--navy); margin-bottom: var(--space-5); }
  .login-field { margin-bottom: var(--space-5); }
  .login-label { display: block; font-size: var(--fs-sm); color: var(--muted); margin-bottom: var(--space-2); }
  .login-field .form-input { width: 100%; }
  .login-notice {
    background: var(--gold-bg); border: 1px solid var(--gold-border); border-radius: var(--radius-md);
    padding: var(--space-4) var(--space-5); margin-top: var(--space-5);
  }
  .login-notice__title { font-size: var(--fs-xs); font-weight: var(--fw-bold); color: var(--gold-text); margin-bottom: var(--space-2); }
  .login-notice__item { font-size: var(--fs-xs); color: var(--text); line-height: var(--lh-snug); }
  .login-notice__item + .login-notice__item { margin-top: var(--space-2); }
  .login-checkbox-field { margin-bottom: var(--space-4); font-size: var(--fs-sm); color: var(--text); }
  .login-checkbox-field label { display: flex; align-items: center; gap: var(--space-2); cursor: pointer; }
  .login-otp-row { display: flex; gap: var(--space-3); justify-content: center; }
  .login-otp-box {
    width: 44px; height: 52px; text-align: center; font-size: var(--fs-xl);
    font-variant-numeric: tabular-nums; padding: 0;
  }
  @media (max-width: 400px) {
    .login-otp-row { gap: var(--space-2); }
    .login-otp-box { width: 38px; height: 46px; }
  }
  .login-mfa-input { letter-spacing: 6px; font-size: var(--fs-xl); text-align: center; font-variant-numeric: tabular-nums; }
  .login-mfa-desc { font-size: var(--fs-sm); color: var(--text); line-height: var(--lh-base); margin-bottom: var(--space-5); }
  .login-hint { font-size: var(--fs-xs); color: var(--muted); margin-top: var(--space-4); text-align: center; }
  .login-error {
    font-size: var(--fs-sm); color: var(--red); background: rgba(192,57,43,0.08); border-radius: var(--radius-md);
    padding: var(--space-3) var(--space-4); margin-bottom: var(--space-5);
  }
  .login-back {
    display: block; width: 100%; text-align: center; margin-top: var(--space-6); padding: 0;
    background: none; border: none; color: var(--muted); font-size: var(--fs-sm); cursor: pointer;
  }
  .login-back:hover { color: var(--navy); text-decoration: underline; }
  .login-footnote { font-size: var(--fs-xs); color: rgba(255,255,255,0.5); text-align: center; }

.cat-lbl { font-size: var(--fs-md); font-weight: var(--fw-bold); color: var(--navy); display:flex; align-items:center; min-width: 0; }

  .recent-reports-card .badge { font-size: var(--fs-base); }
  .btn-sm { font-size: var(--fs-base); padding: var(--space-4) var(--space-7); }

  .card.notice-card { border: 2px solid var(--red); background: white; margin-bottom: var(--space-8); }

  .notice-panel { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: var(--space-7); }

  .kpi-notice-list { gap: var(--space-4) !important; }
  .notice-item { font-size: var(--fs-md); font-weight: var(--fw-bold); color: var(--text); line-height: 1.4; }
  .notice-item--alert { color: var(--red); }
  .notice-stat__main { font-size: var(--fs-lg); font-weight: var(--fw-bold); }
  .notice-stat__main .value { font-size: var(--fs-display); font-weight: var(--fw-bold); color: var(--navy); margin: 0 var(--space-1); }
  .notice-stat__main { text-align: right; }
  .notice-stat__change { font-size: var(--fs-base); font-weight: var(--fw-bold); color: var(--green); margin-left: var(--space-2); }
  .notice-stat__sub { font-size: var(--fs-sm); color: var(--muted); margin-top: var(--space-2); }
  .btn-outline:hover { background: var(--surface-hover); }
  a.btn { text-decoration: none; }

  .notice-item-link { color: inherit; text-decoration: none; }
  .notice-item-link:hover { text-decoration: underline; }

  #home-shokokai-content .notice-block:not(.kpi-notice-list) { flex-shrink: 0; }
  #home-shokokai-content .notice-stat__main { white-space: nowrap; }
  #home-shokokai-content .home-notice-stat-group { display: flex; flex-direction: column; justify-content: center; }

  #dash-quick-actions {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(80px, 1fr)); gap: var(--space-6);
  }
  #dash-quick-actions .qa-primary-row {
    grid-column: 1; grid-row: 1 / span 2; display: flex; min-width: 0; min-height: 0;
  }
  #dash-quick-actions .qa-primary-row > .action-card {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    width: 100%; height: 100%; min-height: 0; box-sizing: border-box;
  }
  #dash-quick-actions .qa-primary-row .action-card__icon { font-size: 58px; }
  #dash-quick-actions .qa-primary-row .action-card__title { font-size: var(--fs-xl) !important; }
  #dash-quick-actions .qa-secondary-col {
    grid-column: 2; grid-row: 1 / span 2; display: flex; min-width: 0; min-height: 0;
  }
  #dash-quick-actions .qa-secondary-row {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(80px, 1fr)); gap: var(--space-6);
    width: 100%; height: 100%; min-height: 0;
  }
  #dash-quick-actions .qa-secondary-row > .action-card {
    display: flex; flex-direction: row; align-items: center; justify-content: center;
    gap: var(--space-2); min-height: 80px; box-sizing: border-box;
  }
  #dash-quick-actions .qa-secondary-row .action-card__icon { font-size: 30px; margin-bottom: 0; }
  #dash-quick-actions .qa-secondary-row .action-card__title { font-size: var(--fs-lg) !important; }
  @media (max-width: 900px) {
    #dash-quick-actions { grid-template-columns: 1fr; grid-template-rows: auto auto; }
    #dash-quick-actions .qa-primary-row { grid-column: 1; grid-row: 1; min-height: 150px; }
    #dash-quick-actions .qa-secondary-col { grid-column: 1; grid-row: 2; }
    #dash-quick-actions .qa-secondary-row { height: auto; }
  }
  @media (max-width: 600px) {
    #dash-quick-actions .qa-secondary-row { grid-template-columns: 1fr; grid-template-rows: none; }
    #dash-quick-actions .qa-secondary-row > .action-card { min-height: 80px; }
  }

  .sidebar {
    background: var(--purple);
    color: white;
    width: 200px;
  }
  .sidebar-brand {
    background: transparent; border-bottom: none; color: white;
    display: flex; align-items: center; gap: var(--space-3);
    padding: var(--space-6) var(--space-6) var(--space-2);font-size:12pt;
  }
  .sidebar-brand span { color: white; }
  .sidebar-brand__icon {
    width: 30px; height: 30px; border-radius: 50%; background: rgba(255,255,255,0.15);
    display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0;
  }

  .sidebar-header { background: transparent; }

  .sidebar-header--shokokai { text-align: right; padding-top: 2px; padding-bottom: var(--space-3); border-bottom: 1px solid rgba(255,255,255,0.25); gap: 0; }
  .sidebar-header__top { justify-content: flex-end; }
  .sidebar-header .org-name, .sidebar-header .user-info { font-size: var(--fs-sm); }

  .sidebar .nav-section { border-bottom: none; }
  .sidebar .nav-section-label {
    display: inline-block; background: rgba(255,255,255,0.24); color: white;
    border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
    padding: 4px 14px; font-size: var(--fs-xs); font-weight: var(--fw-bold);
    text-transform: none; letter-spacing: 0;
    text-shadow: 0 1px 2px rgba(0,0,0,0.25);
  }
  .sidebar .nav-item {
    color: white; border-radius: var(--radius-lg) 0 0 var(--radius-lg);

    margin: 4px 0 4px 8px;
    padding: 4px var(--space-6) 4px 12px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.25);
  }
  .sidebar .nav-item:hover { background: rgba(255,255,255,0.16); }

  .sidebar .nav-item .icon {
    border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
    width: 26px; height: 26px; margin-right: 0; background: transparent;
  }
  .sidebar .nav-item.active {

    background: white; color: var(--navy); font-weight: var(--fw-bold);
    text-shadow: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  }

  .sidebar .nav-item.active .icon { background: transparent; }

  body { background: white; }
  .subheader { display: none; }

  .top-bar {
    display: flex; align-items: center; justify-content: space-between;
    height: 100px; padding: 0 var(--space-8); box-sizing: border-box;
  }

  .screen-body { padding-top: 0; max-width: none; }
  .top-bar__heading { display: flex; align-items: baseline; gap: var(--space-5); flex-wrap: wrap; }
  .top-bar__title { font-size: var(--fs-xl); font-weight: var(--fw-black); color: var(--navy); }
  .top-bar__subtitle { font-size: var(--fs-sm); color: var(--muted); }

  .top-bar__actions { display: flex; align-items: center; gap: var(--space-3); }

  .top-bar-btn {
    display: flex; align-items: center; gap: 6px; white-space: nowrap;
    background: white; border: 2px solid var(--purple); border-radius: var(--radius-md);
    padding: 7px 18px; font-size: var(--fs-sm); font-weight: var(--fw-bold); color: var(--purple);
    cursor: pointer; text-decoration: none; box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  }
  .top-bar-btn:hover { background: var(--purple); color: white; }

.btn-outline:hover { background: var(--surface-hover); }
  a.btn { text-decoration: none; }

  .btn-outline { border-color: var(--purple); color: var(--purple); }

  .btn-sm, .btn { height: 38px; box-sizing: border-box; }

  .mi-voice-upload-progress { margin-top: var(--space-3); }
  .mi-voice-upload-progress__label { font-size: 13px; color: #666; margin-bottom: 4px; }
  .mi-voice-upload-progress__track { height: 8px; background: #e6e6e6; border-radius: 4px; overflow: hidden; }
  .mi-voice-upload-progress__bar { height: 100%; width: 0; background: var(--purple); }
  .mi-voice-file-list { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
  .mi-voice-file-row { display: inline-flex; align-items: baseline; gap: 8px; max-width: 100%; }
  .mi-voice-file {
    display: inline; background: none; border: none; padding: 0; color: var(--navy);
    font: inherit; text-align: left; cursor: pointer; text-decoration: none;
  }
  .mi-voice-file:hover .mi-voice-file__name,
  .mi-voice-file:focus-visible .mi-voice-file__name { color: var(--purple); }
  .mi-voice-file__name { text-decoration: underline; }
  .mi-voice-file__line { color: var(--purple); font-weight: var(--fw-bold); white-space: nowrap; pointer-events: none; cursor: default; }
  .mi-voice-file.is-selected { font-weight: var(--fw-bold); }
  .mi-voice-launch {
    display: flex; align-items: flex-start; flex-wrap: nowrap;
    gap: var(--space-4); margin-top: var(--space-3);
  }
  .mi-voice-launch__side {
    display: flex; flex-direction: column; gap: var(--space-3);
    flex: 1 1 auto; min-width: 0;
  }
  .mi-voice-launch__actions {
    display: flex; align-items: center; flex-wrap: nowrap;
    gap: 6px; min-width: 0;
  }
  .mi-voice-launch__actions .mi-timer { white-space: nowrap; flex: 0 0 auto; }
  .mi-voice-launch__actions .btn-sm {
    height: 32px; padding: 0 8px; font-size: 12px;
    white-space: nowrap; flex: 0 0 auto;
  }
  #mi-voice-btn.mi-voice-btn-square {
    height: 96px; width: 96px; flex: 0 0 96px;
    flex-direction: column; align-items: center; justify-content: center;
    gap: var(--space-1); white-space: normal; text-align: center; padding: var(--space-2);
  }
  .mi-voice-btn-square__icon { font-size: 32px; line-height: 1; }

  .mi-voice-btn-square__label { font-size: var(--fs-md); font-weight: var(--fw-bold); line-height: 1.2; }
  #mi-voice-btn.is-soft-disabled { opacity: 0.4; }
  .btn-sm { font-size: var(--fs-md); padding: var(--space-4) var(--space-7); }

  .sidebar {
    background: var(--purple);
    color: white;
    width: 200px;
  }
  .sidebar-brand {
    background: transparent; border-bottom: none; color: white;
    display: flex; align-items: center; gap: var(--space-3);
    padding: var(--space-6) var(--space-6) var(--space-2);font-size:12pt;
  }
  .sidebar-brand span { color: white; }
  .sidebar-header { background: transparent; }
  .sidebar-header--shokokai { text-align: right; padding-top: 2px; padding-bottom: var(--space-3); border-bottom: 1px solid rgba(255,255,255,0.25); gap: 0; }
  .sidebar-header__top { justify-content: flex-end; }
  .sidebar-header .org-name, .sidebar-header .user-info { font-size: var(--fs-sm); }

  .sidebar .nav-section { border-bottom: none; }
  .sidebar .nav-section-label {
    display: inline-block; background: rgba(255,255,255,0.24); color: white;
    border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
    padding: 4px 14px; font-size: var(--fs-xs); font-weight: var(--fw-bold);
    text-transform: none; letter-spacing: 0;
    text-shadow: 0 1px 2px rgba(0,0,0,0.25);
  }
  .sidebar .nav-item {
    color: white; border-radius: var(--radius-lg) 0 0 var(--radius-lg);
    margin: 4px 0 4px 8px;
    padding: 4px var(--space-6) 4px 12px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.25);
  }
  .sidebar .nav-item:hover { background: rgba(255,255,255,0.16); }

  .sidebar .nav-item .icon {
    border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
    width: 26px; height: 26px; margin-right: 0; background: transparent;
  }
  .sidebar .nav-item.active {
    background: white; color: var(--navy); font-weight: var(--fw-bold);
    text-shadow: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  }

  .sidebar .nav-item.active .icon { background: transparent; }

  body { background: #f3eee5; font-size: var(--fs-md); }
  .subheader { display: none; }
  .top-bar {
    display: flex; align-items: center; justify-content: space-between;
    height: 100px; padding: 0 var(--space-8);
  }

  .screen-body { padding-top: 0; max-width: none; }

  #main-mount, #main-mount form, .mi-detail-grid, #mi-detail-card, #mi-utility-card {
    max-width: none; width: 100%; min-width: 0; box-sizing: border-box;
  }

  #mi-content, #mi-remarks { max-width: none; }
  .top-bar__heading { display: flex; align-items: baseline; gap: var(--space-5); flex-wrap: wrap; }

  .top-bar__title { font-size: var(--fs-xl); font-weight: var(--fw-black); color: var(--text); }
  .top-bar__subtitle { font-size: var(--fs-sm); color: var(--muted); }
  .top-bar__actions { display: flex; align-items: center; gap: var(--space-3); }

  .top-bar-btn {
    display: flex; align-items: center; gap: 6px; white-space: nowrap;
    background: white; border: 2px solid var(--purple); border-radius: var(--radius-md);
    padding: 7px 18px; font-size: var(--fs-md); font-weight: var(--fw-bold); color: var(--purple);
    cursor: pointer; text-decoration: none; box-shadow: 0 1px 3px rgba(0,0,0,0.1);

    height: 38px; box-sizing: border-box;
  }
  .top-bar-btn:hover { background: var(--purple); color: white; }

  @media (max-width: 900px) {
    .top-bar { height: auto; flex-wrap: wrap; gap: var(--space-3); padding: var(--space-4) var(--space-6); }
    .top-bar__actions { flex-wrap: wrap; }
  }

  .card-header--navy { background: var(--purple); border-bottom-color: var(--purple); }

  .card:has(> .card-header--navy) { border-color: var(--purple); }

  .card-header--gold { background: var(--gold-text); border-bottom-color: var(--gold-text); }
  .btn-primary { background: var(--purple); box-shadow: 0 2px 4px color-mix(in srgb, var(--purple) 25%, transparent); }
  .form-input:focus { border-color: var(--purple); border-width: 2px; box-shadow: 0 0 0 4px color-mix(in srgb, var(--purple) 30%, transparent); }
  .form-input.is-invalid:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(192,57,43,0.12); }

  @media (max-width: 560px) {
    .checkbox-grid { grid-template-columns: 1fr; }
  }

  #mi-detail-card .checkbox-grid { display: flex; flex-wrap: wrap; gap: var(--space-3) var(--space-6); }
  #mi-detail-card .checkbox-grid label { flex: 0 0 auto; white-space: nowrap; }
  .mi-export-note { color: white; font-size: var(--fs-sm); font-weight: var(--fw-bold); }
  /* 支援内容: ラベル左・表右。表幅に合わせて折り返し（container query） */
  #mi-detail-card .mi-support-matrix-block.detail-row {
    align-items: flex-start;
  }
  #mi-detail-card .mi-support-matrix-block > .detail-row__label {
    align-items: flex-start;
    padding-top: 10px;
    height: auto;
  }
  #mi-detail-card .mi-support-matrix-block > .detail-row__value {
    display: block;
    min-width: 0;
    max-width: 100%;
    flex: 1 1 auto;
  }
  /*
   * 支援内容マトリクス（方案A）:
   * - 等幅列揃え・スクロールなし
   * - 意図改行は短め＋字号を容器幅に比例 → 100%/125% で同じ行数、欠字しにくく
   */
  #mi-support-matrix {
    /* ラジオ・テーマは見出し／ラベルが収まる幅。余りを支援内容の例へ */
    --mi-sm-radio-w: 4.5rem;
    --mi-sm-theme-w: 5.5rem;
    --mi-sm-kind-cols: 8;
    /* 分母を大きめにし、狭い／拡大時は字を少し下げて1行3〜4字を確保 */
    --mi-sm-kind-fs: clamp(10px, calc(100cqw / 72), var(--fs-sm));
    display: flex;
    flex-direction: column;
    width: 100%;
    min-width: 0;
    border: 1px solid #b7c8dc;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--white);
    container-type: inline-size;
    container-name: mi-support-matrix;
  }
  #mi-support-matrix .mi-sm-row {
    display: grid;
    grid-template-columns: var(--mi-sm-radio-w) var(--mi-sm-radio-w) var(--mi-sm-theme-w) minmax(0, 1fr);
    grid-template-areas: "main sub theme kinds";
    align-items: stretch;
    gap: 0;
    padding: 0;
    border-bottom: 1px solid #c5d3e4;
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
  }
  #mi-support-matrix .mi-sm-row:last-child { border-bottom: none; }
  #mi-support-matrix .mi-sm-row--head {
    background: #e8f0fa;
    /* 列名も支援内容の例と同じ字号 */
    font-size: var(--mi-sm-kind-fs);
    font-weight: var(--fw-bold);
    color: var(--navy);
    line-height: 1.3;
  }
  #mi-support-matrix .mi-sm-row--band { background: #f5f8fc; }
  #mi-support-matrix .mi-sm-radio-col,
  #mi-support-matrix .mi-sm-theme,
  #mi-support-matrix .mi-sm-kinds {
    padding: 8px 6px;
    box-sizing: border-box;
    min-width: 0;
  }
  #mi-support-matrix .mi-sm-radio-col:nth-child(1) { grid-area: main; }
  #mi-support-matrix .mi-sm-radio-col:nth-child(2) { grid-area: sub; }
  #mi-support-matrix .mi-sm-theme { grid-area: theme; }
  #mi-support-matrix .mi-sm-kinds { grid-area: kinds; }
  #mi-support-matrix .mi-sm-radio-col {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: var(--mi-sm-kind-fs);
    line-height: 1.3;
    padding-left: 4px;
    padding-right: 4px;
    border-right: 1px solid #c5d3e4;
  }
  #mi-support-matrix .mi-sm-row--head .mi-sm-radio-col {
    /* 「主担当の／主なテーマ」が2行で収まるように */
    white-space: normal;
    word-break: keep-all;
    overflow-wrap: break-word;
  }
  #mi-support-matrix .mi-sm-row--head .mi-sm-theme {
    font-size: var(--mi-sm-kind-fs);
  }
  #mi-support-matrix .mi-sm-theme {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    text-align: right;
    font-weight: var(--fw-semibold);
    color: var(--navy);
    /* 内容も支援内容の例と同じ字号 */
    font-size: var(--mi-sm-kind-fs);
    line-height: 1.3;
    padding-left: 6px;
    padding-right: 8px;
    border-right: 1px solid #b7c8dc;
    overflow: hidden;
    min-width: 0;
  }
  #mi-support-matrix .mi-sm-theme__label {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    max-width: 100%;
    min-width: 0;
    gap: 0;
  }
  /* 指定の2行を維持（途中で3行目に割れない） */
  #mi-support-matrix .mi-sm-theme__line {
    display: block;
    max-width: 100%;
    white-space: nowrap;
    line-height: 1.3;
    text-align: right;
  }
  /* 等幅グリッドで行間の項目揃え（空欄も列を維持） */
  #mi-support-matrix .mi-sm-kinds {
    display: grid;
    grid-template-columns: repeat(var(--mi-sm-kind-cols, 8), minmax(0, 1fr));
    column-gap: 4px;
    row-gap: 2px;
    align-items: start;
    justify-items: stretch;
    min-width: 0;
    padding-left: 6px;
    padding-right: 6px;
  }
  #mi-support-matrix .mi-sm-kinds--head {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    font-weight: var(--fw-bold);
    gap: 0;
  }
  #mi-support-matrix .mi-sm-kind {
    display: flex;
    align-items: flex-start;
    gap: 3px;
    font-size: var(--mi-sm-kind-fs);
    cursor: pointer;
    margin: 0;
    color: var(--text);
    line-height: 1.3;
    white-space: normal;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    overflow: hidden;
  }
  #mi-support-matrix .mi-sm-kind--empty {
    display: block;
    min-height: 1em;
    pointer-events: none;
    visibility: hidden;
  }
  #mi-support-matrix .mi-sm-kind input {
    flex-shrink: 0;
    width: 0.95em;
    height: 0.95em;
    margin-top: 0.12em;
  }
  #mi-support-matrix .mi-sm-kind__text {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    min-width: 0;
    max-width: 100%;
    line-height: 1.3;
  }
  /* 指定改行のみ（nowrap）。短い行＋cqw字号で125%でも欠字しにくくする */
  #mi-support-matrix .mi-sm-kind__line {
    display: block;
    max-width: 100%;
    white-space: nowrap;
    line-height: 1.3;
  }
  #mi-support-matrix .mi-sm-theme-radio {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    cursor: pointer;
  }
  #mi-support-matrix .mi-sm-theme-radio input { margin: 0; }
  #mi-support-matrix.mi-sm--main-disabled .mi-sm-row:not(.mi-sm-row--head) .mi-sm-radio-col:nth-child(1) .mi-sm-theme-radio,
  #mi-support-matrix.mi-sm--sub-disabled .mi-sm-row:not(.mi-sm-row--head) .mi-sm-radio-col:nth-child(2) .mi-sm-theme-radio {
    opacity: 0.38;
  }
  #mi-support-matrix .mi-sm-theme-radio input:disabled {
    cursor: not-allowed;
    accent-color: #9aa7b8;
  }
  /* 主なテーマ未選択行の「支援内容の例」はグレーアウト・操作不可 */
  #mi-support-matrix .mi-sm-kind--disabled {
    opacity: 0.38;
    cursor: not-allowed;
    color: #9aa7b8;
  }
  #mi-support-matrix .mi-sm-kind--disabled input:disabled {
    cursor: not-allowed;
    accent-color: #9aa7b8;
  }
  .mi-hint-text.mi-staff-either-hint,
  .mi-staff-either-hint {
    display: block;
    width: 100%;
    color: var(--muted) !important;
    font-weight: var(--fw-regular);
  }
  .mi-hint-text.mi-signature-hint,
  .mi-signature-hint {
    color: var(--red) !important;
    white-space: normal;
    font-weight: var(--fw-semibold);
  }

  .mi-history-strip { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-2) var(--space-6); flex: 1; min-height: 300px; box-sizing: border-box; }

  .mi-history-item {
    border: 1px solid var(--border); border-radius: var(--radius-md);
    padding: calc(var(--space-3) + 4px) var(--space-3); display: flex; flex-direction: column; gap: var(--space-1);
  }

  .mi-history-item__top { display: flex; align-items: center; gap: var(--space-3); }
  .mi-history-item__top .badge { margin-left: auto; }
  .mi-history-item__date { font-size: var(--fs-md); color: var(--text); }
  .mi-history-item__theme { font-size: var(--fs-md); color: var(--text); }
  .mi-history-item__summary { font-size: var(--fs-md); font-weight: var(--fw-semibold); color: var(--navy); }

  .mi-detail-grid { display: grid; grid-template-columns: minmax(0, 60fr) minmax(0, 40fr); column-gap: var(--space-6); align-items: stretch; padding-bottom: var(--space-5); }

  .mi-detail-grid > .mi-detail-left-wrap { display: flex; flex-direction: column; min-width: 0; }
  .mi-detail-left-wrap > .card { display: flex; flex-direction: column; margin-bottom: 0; flex: 1; min-width: 0; }
  .mi-detail-left-wrap > .card > .card-body { flex: 1; min-width: 0; }

  .mi-detail-left-wrap, .mi-detail-col--utility { position: relative; padding-top: 24px; min-width: 0; }

  #mi-required-note { display: flex; align-items: center; }

  #mi-required-note, .mi-utility-label {
    font-size: var(--fs-md); font-weight: var(--fw-bold); color: var(--navy); line-height: var(--lh-loose);
  }

  .detail-row:has(.is-invalid) .detail-row__label { color: var(--red); }

  .mi-autocomplete { position: relative; }
  .mi-line-field--grow .mi-autocomplete { flex: 0 1 auto; min-width: 0; max-width: 100%; }
  .mi-line-field--grow .mi-autocomplete .form-input { width: 100%; }
  /* 担当候補は入力枠と同じ幅（left/right:0 で親に合わせる）。講師のみ内容幅可 */
  #mi-lecturer-wrap .mi-autocomplete__dropdown { right: auto; width: max-content; min-width: 160px; max-width: 240px; }
  #mi-staff-main-wrap .mi-autocomplete__dropdown,
  #mi-staff-sub-wrap .mi-autocomplete__dropdown {
    left: 0;
    right: 0;
    width: auto;
    min-width: 0;
    max-width: none;
    box-sizing: border-box;
  }
  #mi-staff-main-wrap, #mi-staff-sub-wrap { flex: 0 0 106px; width: 106px; min-width: 106px; }
  .mi-staff-name-input { flex: 0 0 106px; width: 106px; min-width: 106px; }
  #mi-member-category, #mi-capital, #mi-employees, #mi-sales, #mi-qualification { max-width: none; }
  .mi-number-input--right { text-align: right; }
  .mi-autocomplete__dropdown {
    display: none; position: absolute; top: 100%; left: 0; right: 0; z-index: 20;
    background: white; border: 1px solid var(--navy); border-radius: var(--radius-sm);
    box-shadow: var(--shadow-card); max-height: 200px; overflow-y: auto; margin-top: 2px;
  }
  .mi-autocomplete__dropdown.is-open { display: block; }
  .mi-autocomplete__item { padding: var(--space-4) var(--space-5); cursor: pointer; font-size: var(--fs-base); }
  .mi-autocomplete__item:hover, .mi-autocomplete__item.is-active { background: var(--surface-hover); }
  .mi-autocomplete__item--empty { color: var(--muted); cursor: default; }
  .mi-autocomplete__item--empty:hover { background: none; }
  #mi-required-note, .mi-utility-label {
    position: absolute; top: 0; left: 0; right: 0; margin: 0 !important; height: 24px;
  }

  .mi-detail-grid--swapped { grid-template-columns: minmax(0, 45fr) minmax(0, 55fr); }
  .mi-detail-grid--swapped > .mi-detail-left-wrap { order: 2; }
  .mi-detail-grid--swapped > .mi-detail-col--utility { order: 1; }
  .mi-detail-grid--wide-form:not(.mi-detail-grid--swapped) { grid-template-columns: minmax(0, 68fr) minmax(0, 32fr); }

  .mi-detail-grid--import-pending > .mi-detail-left-wrap { display: none; }
  .mi-detail-grid--import-pending > .mi-detail-col--utility { grid-column: 1 / -1; }

  .mi-detail-col { display: flex; flex-direction: column; gap: var(--space-3); }
  .mi-detail-col > .detail-row { margin: 0; }
  #mi-form-actions { display: flex !important; flex-direction: row !important; flex-wrap: nowrap !important; justify-content: flex-end; align-items: center; min-width: 0; }
  #mi-form-actions .mi-form-actions__btns { flex: 0 0 auto; flex-wrap: nowrap; }
  #mi-delete { margin-right: clamp(32px, 8vw, 96px); }
  @media (max-width: 600px) {
    #mi-form-actions { overflow-x: auto; }
    #mi-delete { margin-right: var(--space-3); }
  }

  .mi-detail-col--utility {
    padding-right: var(--space-6); gap: var(--space-5); box-sizing: border-box;
    min-height: 0; overflow-y: auto;
  }

  .mi-utility-label { font-size: var(--fs-md); font-weight: var(--fw-bold); color: var(--navy); line-height: var(--lh-loose); display: flex; align-items: center; }

  @media (max-width: 900px) {
    .mi-detail-grid { grid-template-columns: 1fr; row-gap: var(--space-3); }
  }

  .mi-dropdown { width: 100%; box-sizing: border-box; border: 1px solid var(--gold-border); border-radius: var(--radius-md); background: var(--gold-bg); }

  .mi-dropdown > summary { width: 100%; box-sizing: border-box; font-size: var(--fs-md); padding: var(--space-6); min-height: 52px; }

  .mi-dropdown > summary .flex { gap: 1.5em; }

  .mi-dropdown > summary::after {
    content: 'クリックして開く ▼'; font-size: var(--fs-xs); color: var(--gold-text); font-weight: var(--fw-bold);
  }
  .mi-dropdown[open] > summary::after { content: '閉じる ▲'; }

  .mi-dropdown > summary > span::before {
    content: '▼ '; font-size: var(--fs-xs); color: var(--gold-text); font-weight: var(--fw-bold);
  }
  .mi-dropdown[open] > summary > span::before { content: '▲ '; }
  .mi-dropdown[open] > summary { border-bottom: 1px solid var(--gold-border); }

  .mi-hint-text { font-size: var(--fs-sm); color: var(--text); }
  /* 対応日時行の下に全幅で赤字を出す（オンライン等と同一行に並ばない） */
  #mi-detail-card #mi-date-prev-month-notice.mi-date-prev-month-notice {
    flex: 0 0 100%;
    width: 100%;
    color: var(--red) !important;
  }
  .mi-support-class-group { display: inline-flex; align-items: center; gap: var(--space-3); white-space: nowrap; }
  .mi-support-class-group.is-invalid {
    outline: 2px solid var(--red);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
    padding: 2px 4px;
  }
  .mi-inline-radio { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-sm); color: var(--text); cursor: pointer; }
  .mi-inline-radio input { margin: 0; }
  .mi-inline-radio input:disabled {
    cursor: not-allowed;
    accent-color: #9aa7b8;
  }
  .mi-inline-radio:has(input:disabled) {
    color: #9aa7b8;
    cursor: not-allowed;
  }
  .mi-inline-check {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: var(--fs-sm);
    color: var(--text);
    cursor: pointer;
    white-space: nowrap;
  }
  .mi-inline-check input { margin: 0; }
  .mi-inline-check input:disabled {
    cursor: not-allowed;
    accent-color: #9aa7b8;
  }
  .mi-line-support-class {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
  }
  .mi-line-field--inline {
    flex: 0 0 auto;
    min-width: 0;
  }
  /* オンラインは相談窓口／巡回より少し離す */
  .mi-line-field--online {
    margin-left: 10px;
  }
  .mi-line-card .mi-line-row {
    flex-wrap: wrap;
    gap: 8px 12px;
  }

  /* G-2/G-5/G-7（OBが同一行にあるときだけ）: 1行維持。帳票は縮めても伸ばさない */
  #mi-detail-card #mi-form-value:has(#mi-ob-item) {
    container-type: inline-size;
    container-name: mi-form-ob-row;
    flex-wrap: nowrap;
    min-width: 0;
  }
  #mi-detail-card #mi-form-value:has(#mi-ob-item) > .mi-autocomplete {
    flex: 0 0 106px;
    min-width: 106px;
  }
  /* 帳票は必要なら縮めるが、空き幅へ伸ばさない（G-3/G-6 等へ影響させない） */
  #mi-detail-card #mi-form-value:has(#mi-ob-item) #mi-form {
    flex: 0 1 auto;
    min-width: 9.5em !important;
  }
  #mi-detail-card #mi-form-value:has(#mi-ob-item) #mi-qualification {
    flex: 0 1 auto;
    min-width: 7em !important;
  }
  /* OBは文字欠けさせない（fitMax幅を保ち、縮めない） */
  #mi-detail-card #mi-form-value:has(#mi-ob-item) #mi-ob-item {
    flex: 0 0 auto;
    flex-shrink: 0;
  }
  /* 大きく拡大して入らないときだけ折り返す */
  @container mi-form-ob-row (max-width: 640px) {
    #mi-form-value:has(#mi-ob-item) {
      flex-wrap: wrap;
    }
  }

  /* 様式F: 主/副は従来どおり detail-row__value の flex-wrap。行分けだけ追加 */
  #mi-detail-card #mi-row-staff.is-form-f {
    align-items: flex-start;
  }
  #mi-detail-card #mi-row-staff.is-form-f > .detail-row__label {
    align-items: flex-start;
    padding-top: 8px;
    height: auto;
  }
  #mi-detail-card #mi-row-staff .mi-form-staff-value {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
  }
  #mi-detail-card #mi-row-staff .mi-form-staff-line {
    display: contents;
  }
  #mi-detail-card #mi-row-staff.is-form-f .mi-form-staff-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
    flex: 1 1 100%;
  }
  #mi-detail-card #mi-row-staff .mi-staff-either-hint {
    flex: 1 1 100%;
  }
  #mi-detail-card #mi-row-staff:not(.is-form-f) #mi-form-staff-line-sub:not(.is-visible) {
    display: none;
  }

  #mi-history-empty { font-size: var(--fs-md); }

  .mi-dropdown__panel {
    background: white;
    overflow-y: auto;
    width: 100%; box-sizing: border-box;
  }

  .mi-panel-tall .mi-dropdown__panel { padding: var(--space-2) var(--space-6); }

  #mi-voice-card { display: flex; flex-direction: column; min-height: 0; flex: none; }
  #mi-voice-card[open] { flex: 1 1 auto; }

  #mi-voice-card { background: white; }
  #mi-voice-card > summary { background: var(--gold-bg); }
  #mi-voice-card > summary ~ * { padding-left: var(--space-6); padding-right: var(--space-6); box-sizing: border-box; }
  #mi-voice-card > summary ~ *:first-of-type { margin-top: var(--space-2); }
  #mi-voice-card .form-row:has(#mi-voice-transcript-box),
  #mi-voice-card .form-row:has(#mi-transcript-display) { flex: 1 1 auto; display: flex; flex-direction: column; min-height: 0; }
  #mi-voice-transcript-box,
  #mi-transcript-display { height: auto; flex: 1 1 auto; min-height: 0; }

  #mi-history-dropdown { display: flex; flex-direction: column; min-height: 0; flex: none; }
  #mi-history-dropdown[open] { flex: 1 1 auto; }

  #mi-history-dropdown { background: white; }
  #mi-history-dropdown > summary { background: var(--gold-bg); }
  #mi-history-dropdown > summary ~ * { padding-left: var(--space-6); padding-right: var(--space-6); box-sizing: border-box; }
  #mi-history-dropdown > summary ~ *:first-of-type { margin-top: var(--space-2); padding-bottom: var(--space-2); }

  #mi-detail-info-dropdown { display: flex; flex-direction: column; min-height: 0; background: white; flex: none; }
  #mi-detail-info-dropdown > summary { background: var(--gold-bg); }
  #mi-detail-info-dropdown > summary ~ * { padding-left: var(--space-6); padding-right: var(--space-6); box-sizing: border-box; }
  #mi-detail-info-dropdown__body { display: flex; align-items: center; justify-content: flex-start; margin-top: var(--space-2); padding-bottom: var(--space-2); }

  #mi-import-steps-dropdown { background: white; }
  #mi-import-steps-dropdown > summary { background: var(--gold-bg); }
  #mi-import-steps-dropdown > summary ~ * { padding-left: var(--space-6); padding-right: var(--space-6); box-sizing: border-box; }
  #mi-import-steps-dropdown[open] > #mi-import-steps-panel {
    min-height: 540px; max-height: 540px; box-sizing: border-box; overflow-y: auto;
    display: flex; flex-direction: column;
  }

  #mi-voice-transcript-box,
  #mi-transcript-display { border-color: var(--navy); font-size: var(--fs-md); line-height: var(--lh-snug); }
  #mi-audio-seek { accent-color: var(--navy); }

  #mi-date, #mi-time-start, #mi-time-end { padding-right: var(--space-2); height: 36px; box-sizing: border-box; }
  #mi-date::-webkit-calendar-picker-indicator,
  #mi-time-start::-webkit-calendar-picker-indicator,
  #mi-time-end::-webkit-calendar-picker-indicator {
    padding: 0; margin-left: 2px;
  }

  .mi-consent-bar {
    display: flex; align-items: center; gap: var(--space-3);
    border: none; border-radius: var(--radius-md);
    background: none; color: var(--red);
    padding: 0 var(--space-4);
    cursor: pointer; font-size: var(--fs-md); font-weight: var(--fw-bold);
  }
  .mi-consent-bar:hover { opacity: 0.75; }
  .mi-consent-bar input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--purple); cursor: pointer; flex-shrink: 0; }

  .mi-expert-import-panels { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-6); align-items: stretch; flex: 1; }

  .mi-expert-panel {
    display: flex; flex-direction: column;
  }
  .mi-expert-panel__header { padding: var(--space-4) var(--space-5); font-weight: var(--fw-bold); font-size: var(--fs-md); }
  .mi-expert-panel--g4 .mi-expert-panel__header { color: var(--purple); }
  .mi-expert-panel--g5 .mi-expert-panel__header { color: var(--gold-text); }

  .mi-expert-panel__dropzone {
    display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: var(--space-2);
    margin: var(--space-5); padding: var(--space-6) var(--space-4);
    border: 2px dashed var(--border); border-radius: var(--radius-md);
    cursor: pointer; background: var(--surface-subtle);
    flex: 1;
  }
  .mi-expert-panel--g4 .mi-expert-panel__dropzone { border-color: var(--purple); }
  .mi-expert-panel--g5 .mi-expert-panel__dropzone { border-color: var(--gold-border); }
  .mi-expert-panel__dropzone.is-dragover { background: var(--surface-hover); }
  .mi-expert-panel__icon { font-size: 58px; }
  .mi-expert-panel__title { font-weight: var(--fw-bold); font-size: var(--fs-md); color: var(--text); }
  .mi-expert-panel__hint { font-size: var(--fs-xs); color: var(--muted); line-height: 1.5; }
  .mi-expert-panel__dropzone .btn { margin-top: var(--space-2); pointer-events: none; }

  #mi-expert-import-panels { display: flex; flex-direction: column; flex: 1; min-height: 0; }

  .mi-expert-steps { margin-bottom: 0; flex: 1; display: flex; flex-direction: column; min-height: 594px; border: none; box-shadow: none; }

  .mi-expert-steps > .card-body { flex: 1; display: flex; flex-direction: column; }

  #mi-import-steps-content { display: flex; flex-direction: column; flex: 1; min-height: 0; }

  #mi-import-steps-content > .mi-expert-steps__list { flex: 1; align-items: stretch; }

  .mi-expert-steps__list { display: flex; flex-wrap: nowrap; gap: var(--space-5); }
  #mi-import-steps-dropdown .mi-expert-steps__list { flex-direction: column; }

  .mi-expert-step {
    flex: 1 1 0; min-width: 0; background: white; border-radius: var(--radius-md);
    padding: var(--space-4); text-align: center;
    display: flex; flex-direction: column;
  }
  #mi-import-steps-dropdown .mi-expert-step { width: 100%; flex: none; }

  .mi-expert-step--gold { background: var(--gold-bg); }

  .mi-expert-step__num.flow-step { margin-bottom: var(--space-4); cursor: default; justify-content: center; width: 100%; }
  .mi-expert-step__num.flow-step .flow-step__label { font-size: var(--fs-xl); }

  .mi-expert-step__num.flow-step .flow-step__num {
    width: auto; height: auto; border-radius: 0; background: none; color: white;
    font-size: var(--fs-xl);
  }

  #mi-import-steps-dropdown .mi-expert-step__num.flow-step.is-active { background: none; border: none; }
  #mi-import-steps-dropdown .mi-expert-step__num.flow-step.is-active .flow-step__label,
  #mi-import-steps-dropdown .mi-expert-step__num.flow-step.is-active .flow-step__num { background: none; color: #000; }

  .mi-expert-steps__list > .flow-step__arrow { align-self: center; display: flex; align-items: center; font-size: var(--fs-xl); }
  #mi-import-steps-dropdown .mi-expert-steps__list > .flow-step__arrow { transform: rotate(90deg); }
  .mi-expert-step__icon { font-size: 58px; margin-bottom: var(--space-2); }
  .mi-expert-step__title { font-weight: var(--fw-bold); font-size: var(--fs-md); color: var(--text); margin-bottom: var(--space-2); }
  .mi-expert-step__desc { font-size: var(--fs-xs); color: var(--muted); line-height: 1.5; }

  #mi-detail-card .mi-row--top-align .detail-row__label { align-items: flex-start; }

  #mi-detail-card .mi-row--top-align .detail-row__label { padding-top: var(--space-2); }

  #mi-detail-card .mi-row--label-center-input .detail-row__label {
    align-self: flex-start; height: 36px; box-sizing: border-box; margin-top: var(--space-2);
  }

.btn-outline:hover { background: var(--surface-hover); }

  .sidebar-header { padding-top: var(--space-5); padding-bottom: var(--space-5); display: flex; flex-direction: column; justify-content: center; gap: var(--space-2); }
  .sidebar-header .user-info { margin-top: 0; }
  .nav-item-desc { display:inline; font-size: var(--fs-xs); color: var(--muted); font-weight: var(--fw-regular); white-space:nowrap; }
  .filter-row { display:flex; flex-wrap:wrap; align-items:flex-end; gap: var(--space-3) var(--space-5); }
  .filter-field { display:flex; flex-direction:column; gap:4px; }

  #reports-filter-header .filter-row { align-items: center; width: 100%; }

  .card-header--navy .count { color: white; }

  .filter-field__label { font-size: var(--fs-sm); color: var(--muted); font-weight: var(--fw-bold); }

  a.btn { text-decoration: none; }

  .btn-sm { font-size: var(--fs-base); padding: var(--space-4) var(--space-7); }

  .sidebar {
    background: var(--purple);
    color: white;
    width: 200px;
  }
  .sidebar-brand {
    background: transparent; border-bottom: none; color: white;
    display: flex; align-items: center; gap: var(--space-3);
    padding: var(--space-6) var(--space-6) var(--space-2);font-size:12pt;
  }
  .sidebar-brand span { color: white; }
  .sidebar-header { background: transparent; padding-top: 2px; }
  .sidebar-header--shokokai { text-align: right; padding-top: 2px; padding-bottom: var(--space-3); border-bottom: 1px solid rgba(255,255,255,0.25); gap: 0; }
  .sidebar-header__top { justify-content: flex-end; }
  .sidebar-header .org-name, .sidebar-header .user-info { font-size: var(--fs-sm); }

  .sidebar .nav-section { border-bottom: none; }
  .sidebar .nav-section-label {
    display: inline-block; background: rgba(255,255,255,0.24); color: white;
    border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
    padding: 4px 14px; font-size: var(--fs-xs); font-weight: var(--fw-bold);
    text-transform: none; letter-spacing: 0;
    text-shadow: 0 1px 2px rgba(0,0,0,0.25);
  }
  .sidebar .nav-item {
    color: white; border-radius: var(--radius-lg) 0 0 var(--radius-lg);
    margin: 4px 0 4px 8px;
    padding: 4px var(--space-6) 4px 12px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.25);
  }
  .sidebar .nav-item:hover { background: rgba(255,255,255,0.16); }
  .sidebar .nav-item .icon {
    border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
    width: 26px; height: 26px; margin-right: 0; background: transparent;
  }
  .sidebar .nav-item.active {
    background: white; color: var(--navy); font-weight: var(--fw-bold);
    text-shadow: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  }

  .sidebar .nav-item.active .icon { background: transparent; }
  body { background: #f3eee5; }
  .subheader { display: none; }
  .top-bar {
    display: flex; align-items: center; justify-content: space-between;
    height: 100px; padding: 0 var(--space-8);
  }
  .screen-body { padding-top: 0; }
  .top-bar__heading { display: flex; align-items: baseline; gap: var(--space-5); flex-wrap: wrap; }
  .top-bar__title { font-size: var(--fs-xl); font-weight: var(--fw-black); color: var(--navy); }
  .top-bar__subtitle { font-size: var(--fs-sm); color: var(--muted); }
  .top-bar__actions { display: flex; align-items: center; gap: var(--space-3); }
  .top-bar-btn {
    display: flex; align-items: center; gap: 6px; white-space: nowrap;
    background: white; border: 2px solid var(--purple); border-radius: var(--radius-md);
    padding: 7px 18px; font-size: var(--fs-sm); font-weight: var(--fw-bold); color: var(--purple);
    cursor: pointer; text-decoration: none; box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  }
  .top-bar-btn:hover { background: var(--purple); color: white; }
  @media (max-width: 900px) {
    .top-bar { height: auto; flex-wrap: wrap; gap: var(--space-3); padding: var(--space-4) var(--space-6); }
    .top-bar__actions { flex-wrap: wrap; }
  }

.sidebar-header { padding-top: var(--space-5); padding-bottom: var(--space-5); display: flex; flex-direction: column; justify-content: center; gap: var(--space-2); }
  .sidebar-header .user-info { margin-top: 0; }
  .btn-outline:hover { background: var(--surface-hover); }
  .nav-item-desc { display:inline; font-size: var(--fs-xs); color: var(--muted); font-weight: var(--fw-regular); white-space:nowrap; }

  .export-groups { display:flex; flex-direction:column; align-items:flex-end; gap:var(--space-2); margin-bottom:var(--space-6); }
  .export-group { display:flex; align-items:center; gap:var(--space-3); }
  .export-group__label { font-size:var(--fs-xs); color:var(--muted); white-space:nowrap; min-width:5.5em; text-align:right; }

  a.btn { text-decoration: none; }

  .btn-sm { font-size: var(--fs-base); padding: var(--space-4) var(--space-7); }

body { background: white; }
.screen-body { padding-top: 0; max-width: none; }
.top-bar { display: flex; align-items: center; justify-content: space-between; height: 100px; padding: 0 var(--space-8); box-sizing: border-box; }
.card.notice-card { border: none; box-shadow: none; background: white; margin-bottom: var(--space-8); }
.notice-panel { align-items: stretch; }
#home-shokokai-content .card.notice-card,
#home-federation-content .card.notice-card { padding: 0; background: transparent; }
#home-shokokai-content .notice-panel,
#home-federation-content .notice-panel {
  grid-template-columns: minmax(0, 1fr) auto; align-items: stretch; gap: var(--space-7);
}
#home-shokokai-content .notice-panel > .notice-block,
#home-federation-content .notice-panel > .notice-block {
  min-height: 94px; box-sizing: border-box; padding: var(--space-6); overflow: hidden;
  border: 2px solid var(--red); border-radius: var(--radius-lg); background: white;
}
#home-shokokai-content .notice-panel > .kpi-notice-list,
#home-federation-content .notice-panel > .kpi-notice-list {
  display: flex; flex-direction: column; justify-content: center; min-width: 0;
}
#home-shokokai-content .notice-panel > .notice-block:not(.kpi-notice-list),
#home-federation-content .notice-panel > .notice-block:not(.kpi-notice-list) {
  display: flex; align-items: center; justify-content: center; white-space: nowrap;
}
@media (max-width: 900px) {
  #home-shokokai-content .notice-panel,
  #home-federation-content .notice-panel { grid-template-columns: 1fr; }
  #home-shokokai-content .notice-panel > .notice-block:not(.kpi-notice-list),
  #home-federation-content .notice-panel > .notice-block:not(.kpi-notice-list) {
    justify-content: flex-start; flex-wrap: wrap; gap: var(--space-3); white-space: normal;
  }
}
.sidebar { background: var(--purple); color: white; width: 200px; }

.sidebar-brand-group { padding: 8px; }

.action-card__icon { margin: 0; white-space: nowrap; }

.sidebar .nav-item .icon { white-space: nowrap; overflow: visible; }
.cat-lbl { line-height: var(--lh-loose); }

.top-bar__heading-actions { display: flex; align-items: center; justify-content: space-between; width: 100%; }

.top-bar__actions { margin-left: auto; justify-content: flex-end; }

.recent-reports-card td { height: 38px; box-sizing: border-box; }

.table-scroll td { padding: 4px; }
.table-scroll th { padding: 4px; }

.recent-reports-card { margin-bottom: 0; }
.recent-reports-card .table-scroll th { position: sticky; top: 0; z-index: 1; }

/* ホーム一覧は固定高さを外し、ウィンドウ下端まで伸ばす */
#view-home .recent-reports-card.card--fill .table-scroll,
#view-home #dash-monthly-table-scroll {
  max-height: none !important;
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
}

.notice-panel { padding: 0; }

.top-bar-btn { width: 130px; justify-content: center; }

#mi-draft { border-color: var(--purple); color: var(--purple); }
#mi-form-export-btn { background: white; border: 2px solid var(--purple); color: var(--purple); }

/* 明細の必須エラー時は、未入力の対象コントロールだけ赤枠（行内の他項目は巻き込まない） */
#mi-line-list .form-input.is-invalid {
  border: 2px solid var(--red) !important;
  box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.12) !important;
}

.card-header.card-header--navy { padding: 0 8px 0 16px; }

.top-bar { padding: 0 var(--space-9); }
@media (max-width: 900px) {
  .top-bar { padding: var(--space-4) var(--space-9); }
}

.mi-time-fields{display:inline-flex;align-items:center;gap:var(--space-2)}
.mi-time-fields > #mi-time-start,
.mi-time-fields > #mi-time-end {
  box-sizing: border-box;
}
#mi-line-list .mi-line-field > input[name="line_time_start"],
#mi-line-list .mi-line-field > input[name="line_time_end"] {
  width: 82px !important;
  box-sizing: border-box;
}
@media (max-width: 600px) {
  .top-bar { padding: var(--space-4) var(--space-7); }

  #monthly-root > .screen-body {
    padding: var(--space-5) var(--space-5);
  }
  #monthly-filter-header {
    align-items: stretch;
  }
  #monthly-filter-header .filter-row {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-4);
  }
  #monthly-filter-header .filter-field {
    width: 100%;
    max-width: 100%;
  }
  #monthly-filter-header .monthly-csv-field {
    margin-left: 0 !important;
    border-left: none !important;
    padding-left: 0 !important;
  }
  #monthly-export-groups {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-2);
  }
  #monthly-export-groups .btn,
  #monthly-csv-btn {
    width: 100%;
    justify-content: center;
    white-space: normal;
    text-align: center;
  }
  #monthly-table-card .table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  #monthly-table-card table {
    min-width: 720px;
    width: max-content;
    max-width: none;
  }
  #monthly-table-card th,
  #monthly-table-card td {
    white-space: nowrap;
  }
  #monthly-table-card th:first-child,
  #monthly-table-card td:first-child {
    white-space: normal;
    min-width: 7.5em;
  }
}

/* 実績確認・帳票出力：上部ヘッダーのモバイル崩れ（他画面は変更しない） */
@media (max-width: 900px) {
  .main:has(#view-monthly.active) > .top-bar {
    height: auto !important;
    min-height: 0;
    align-items: stretch;
    overflow: visible;
    flex-wrap: nowrap;
    /* ハンバーガーとタイトルが重ならないように左余白を確保 */
    padding-left: 56px;
    padding-right: var(--space-6);
    padding-top: var(--space-4);
    padding-bottom: var(--space-4);
    box-sizing: border-box;
  }
  .main:has(#view-monthly.active) > .top-bar .top-bar__heading-actions {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: var(--space-3);
    width: 100%;
  }
  .main:has(#view-monthly.active) > .top-bar .top-bar__heading {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-1);
    min-width: 0;
    width: 100%;
  }
  .main:has(#view-monthly.active) > .top-bar .top-bar__title,
  .main:has(#view-monthly.active) > .top-bar .top-bar__subtitle {
    white-space: normal;
    overflow-wrap: anywhere;
    max-width: 100%;
  }
  .main:has(#view-monthly.active) > .top-bar .top-bar__actions {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    margin-left: 0;
    width: 100%;
    gap: var(--space-2);
  }
  .main:has(#view-monthly.active) > .top-bar .top-bar-btn {
    display: flex;
    width: 100%;
    max-width: none;
    flex: 0 0 auto;
    box-sizing: border-box;
    padding: 7px 12px;
  }
  .main:has(#view-monthly.active) > #main-mount {
    clear: both;
  }
  #monthly-root > .screen-body--fill {
    height: auto !important;
    max-height: none;
    overflow: visible;
  }
  #monthly-root > .screen-body > .cat-lbl {
    display: block;
    width: 100%;
    margin-top: 0;
    position: relative;
    z-index: 0;
  }
}

#dash-quick-actions .qa-primary-row > .action-card { gap: var(--space-1); }
#dash-quick-actions .qa-secondary-row > .action-card { gap: var(--space-2); min-height: 80px; }

.sidebar-header .org-name, .sidebar-header .user-info { line-height: 2; }

.sidebar-header { background: transparent; padding: 0; margin: 0; display: flex; flex-direction: column; justify-content: center; }
.sidebar-header--shokokai { padding: 0; margin: 0; border-bottom: none; display: flex; flex-direction: column; justify-content: center; gap: 0; }

.sidebar-brand-group { border-bottom: 1px solid rgba(255,255,255,0.25); }

.sidebar-brand { padding: 0; margin: 0; justify-content: flex-start; height: 26px; }

#mi-required-note, #mi-utility-label {
  font-size: var(--fs-md) !important; font-weight: var(--fw-bold) !important;
  color: var(--navy) !important; line-height: var(--lh-loose) !important;
}
.app-view { display: none; }
.app-view.active { display: block; }
