/* ============================================================
   Rakuos for Exi — Design System (Refined)
   トーン: エクシ・コーポレートオレンジ基調 (#ed2c00)
          差し色: ブルー(#1f93dd/#00468c) / イエロー(#f5a800)
   原則: タイル排除・ベタ塗り排除・装飾排除
   ============================================================ */

:root {
  /* Warm neutral scale */
  --c-bg:        #fbfaf9;
  --c-surface:   #ffffff;
  --c-surface-2: #f6f5f3;
  --c-line:      #ecebe8;
  --c-line-2:    #f2f1ee;
  --c-ink:       #1c1b19;
  --c-ink-2:     #57534e;
  --c-ink-3:     #8a857e;
  --c-ink-4:     #b4afa8;

  /* Accent — エクシ・コーポレートオレンジ (#ed2c00) */
  --c-accent:      #ed2c00;
  --c-accent-ink:  #c42400;
  --c-accent-weak: #fdeae6;
  --c-accent-line: #f8cabf;

  /* 差し色 — ブルー (エクシ #33a8e5 / 濃紺 #00468c) */
  --c-blue:      #1f93dd;
  --c-blue-ink:  #00468c;
  --c-blue-weak: #e7f3fc;
  --c-blue-line: #c4e1f5;

  /* 差し色 — イエロー (ハイライト/強調) */
  --c-yellow:      #f5a800;
  --c-yellow-ink:  #b87c00;
  --c-yellow-weak: #fef4dc;
  --c-yellow-line: #f6e2ad;

  /* Semantic — コーポレート寄り (info=ブルー, warn=イエロー) */
  --c-ok:    #2f9e6b;
  --c-ok-bg: #e8f5ee;
  --c-warn:  #d98e00;
  --c-warn-bg:#fef3da;
  --c-err:   #ed2c00;
  --c-err-bg:#fdeae6;
  --c-info:  #1f93dd;
  --c-info-bg:#e7f3fc;

  /* Elevation — ソフトな多層シャドウ (最新SaaSの浮遊感) */
  --shadow-1: 0 1px 2px rgba(28,27,25,.04), 0 1px 1px rgba(28,27,25,.03);
  --shadow-2: 0 12px 40px -20px rgba(28,27,25,.22);
  --shadow-sm: 0 1px 2px rgba(28,27,25,.05);
  --shadow-md: 0 4px 12px -4px rgba(28,27,25,.10), 0 2px 4px -2px rgba(28,27,25,.06);
  --shadow-lg: 0 18px 40px -16px rgba(28,27,25,.18), 0 4px 10px -4px rgba(28,27,25,.08);
  --ring: 0 0 0 3px var(--c-accent-weak);

  /* Motion */
  --ease: cubic-bezier(.32,.72,0,1);
  --t-fast: .14s var(--ease);
  --t: .2s var(--ease);

  --sidebar-w: 256px;
  --header-h: 60px;
  --fs: 13px;
  /* やわらかな角丸スケール（控えめに） */
  --radius-xs: 5px;   /* バッジ・チップ・小要素 */
  --radius-sm: 7px;   /* ボタン・入力・タグ */
  --radius:    9px;   /* 標準（カード等） */
  --radius-lg: 14px;  /* 大きめパネル・モーダル */
}

[data-theme="dark"] {
  --c-bg:        #17161a;
  --c-surface:   #1d1c20;
  --c-surface-2: #232227;
  --c-line:      #2c2b30;
  --c-line-2:    #262529;
  --c-ink:       #ecebe8;
  --c-ink-2:     #b6b2ad;
  --c-ink-3:     #837f79;
  --c-ink-4:     #5b5853;
  --c-accent:      #ff5630;
  --c-accent-ink:  #ff7a5c;
  --c-accent-weak: #2e1712;
  --c-accent-line: #45211a;
  /* 差し色 (dark) */
  --c-blue:      #4fb0ef;
  --c-blue-ink:  #7cc6f5;
  --c-blue-weak: #122631;
  --c-blue-line: #1d3a4a;
  --c-yellow:      #ffbe2e;
  --c-yellow-ink:  #ffd06a;
  --c-yellow-weak: #2c2310;
  --c-yellow-line: #423619;
  --c-ok:    #45b483;
  --c-ok-bg:  #14271e;
  --c-warn:  #ffbe2e;
  --c-warn-bg:#2c2310;
  --c-err:   #ff5630;
  --c-err-bg: #2e1712;
  --c-info:  #4fb0ef;
  --c-info-bg:#122631;
  --shadow-1: 0 1px 2px rgba(0,0,0,.4);
  --shadow-2: 0 16px 44px -22px rgba(0,0,0,.7);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.35);
  --shadow-md: 0 4px 14px -4px rgba(0,0,0,.55);
  --shadow-lg: 0 20px 44px -18px rgba(0,0,0,.7);
  --ring: 0 0 0 3px var(--c-accent-weak);
}

* { box-sizing: border-box; }

/* ============================================================
   やわらかな角丸（旧 sharp-edge から優しい印象へ）
   円形(.dot/.avatar/.ring 等)とピル(.bn-badge)は別途 50%/999px 指定
   ============================================================ */
.btn, .icon-btn,
.input, .select, .search-box input, textarea,
.card, .panel,
.badge:not(:has(.dot)), .chip-blue, .chip-yellow,
.insight, .hero, .auth-form-wrap, .auth-mark, .auth-art,
.tab-panel, .module-switch, .toast,
.kpi, .hero-metric, .stat-card, .summary .cell,
.drawer, .scrim ~ .sidebar, .dropdown, .menu,
img.rounded, .thumb, .photo, .album-item,
table.tbl tbody tr {
  border-radius: var(--radius);
}
/* 小要素はやや小さめの角丸 */
.btn-sm, .badge:not(:has(.dot)), .chip-blue, .chip-yellow,
.input, .select, .search-box input, .icon-btn {
  border-radius: var(--radius-sm);
}
/* 大きめパネル */
.card, .panel, .auth-form-wrap, .hero, .drawer { border-radius: var(--radius); }
/* カード内のテーブルは角を持たせない（カード側に合わせる） */
.card table.tbl tbody tr { border-radius: 0; }
/* 円形・ピルは維持 */
.avatar, .dot, .tl-dot, .ring, .ring::before,
.icon-btn .ping, .hero-eyebrow .dot, .bn-badge { border-radius: 999px; }

html, body {
  margin: 0; padding: 0;
  background: var(--c-bg);
  color: var(--c-ink);
  font-family: "Inter", "Noto Sans JP", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: var(--fs);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  letter-spacing: -.005em;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
::selection { background: var(--c-accent-weak); color: var(--c-accent-ink); }

/* Scrollbar */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--c-line); border: 3px solid var(--c-bg); }
::-webkit-scrollbar-thumb:hover { background: var(--c-ink-4); }

/* ============ Layout shell ============ */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--c-surface);
  border-right: 1px solid var(--c-line);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  transition: margin-left var(--t);
}
.app.collapsed .sidebar { margin-left: calc(-1 * var(--sidebar-w)); }

.brand {
  height: var(--header-h);
  display: flex; align-items: center; gap: 10px;
  padding: 0 18px;
  border-bottom: 1px solid var(--c-line);
}
.brand-mark {
  width: 30px; height: 30px;
  background: linear-gradient(150deg, var(--c-accent) 0%, var(--c-accent-ink) 100%);
  border: none; color: #fff; font-weight: 700; font-size: 14px;
  display: grid; place-items: center;
  letter-spacing: -.02em; border-radius: var(--radius-sm);
  box-shadow: 0 2px 8px -3px rgba(196,36,0,.5), inset 0 1px 0 rgba(255,255,255,.25);
}
.brand-name { font-weight: 600; font-size: 14px; letter-spacing: -.01em; }
.brand-sub { font-size: 9.5px; color: var(--c-ink-4); letter-spacing: .18em; text-transform: uppercase; }

.module-switch { padding: 16px 18px 4px; display: flex; gap: 20px; }
.module-switch a {
  background: transparent; padding: 6px 0; text-align: left;
  font-size: 12px; font-weight: 500; color: var(--c-ink-4);
  letter-spacing: 0; transition: .12s; border-bottom: 1.5px solid transparent;
}
.module-switch a.active { color: var(--c-ink); border-bottom-color: var(--c-accent); }
.module-switch a:not(.active):hover { color: var(--c-ink-2); }

.nav { flex: 1; overflow-y: auto; padding: 4px 0 16px; }
.nav-group { padding: 18px 22px 8px; font-size: 9.5px; font-weight: 600; letter-spacing: .16em; color: var(--c-ink-4); text-transform: uppercase; }
.nav-item {
  display: flex; align-items: center; gap: 12px; position: relative;
  margin: 1px 12px; padding: 8px 12px; color: var(--c-ink-2); font-size: 12.8px; font-weight: 450;
  transition: background var(--t-fast), color var(--t-fast);
  border-radius: var(--radius-sm);
}
.nav-item i { width: 15px; text-align: center; font-size: 13px; color: var(--c-ink-4); transition: color var(--t-fast); }
.nav-item:hover { background: var(--c-surface-2); color: var(--c-ink); }
.nav-item:hover i { color: var(--c-ink-3); }
.nav-item.active { background: var(--c-accent-weak); color: var(--c-accent-ink); font-weight: 550; }
.nav-item.active::before { content: ""; position: absolute; left: -12px; top: 5px; bottom: 5px; width: 2.5px; background: var(--c-accent); box-shadow: 0 0 8px -1px var(--c-accent); }
.nav-item.active i { color: var(--c-accent); }
.nav-badge { margin-left: auto; font-size: 10.5px; font-weight: 600; background: transparent; color: var(--c-accent-ink); padding: 0; }

.sidebar-foot { border-top: 1px solid var(--c-line); padding: 10px 12px; display: flex; align-items: center; gap: 8px; }
.theme-btn { flex: 1; display: flex; align-items: center; justify-content: flex-start; gap: 10px; padding: 8px 12px; background: transparent; border: 1px solid transparent; color: var(--c-ink-3); font-size: 12px; font-weight: 450; }
.theme-btn:hover { background: var(--c-surface-2); color: var(--c-ink); }

/* ============ Main ============ */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.header {
  height: var(--header-h);
  display: flex; align-items: center; gap: 14px;
  padding: 0 24px;
  background: color-mix(in srgb, var(--c-surface) 78%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--c-line);
  position: sticky; top: 0; z-index: 20;
}
.icon-btn { position: relative; width: 33px; height: 33px; display: grid; place-items: center; color: var(--c-ink-3); border: 1px solid transparent; transition: all var(--t-fast); }
.icon-btn:hover { background: var(--c-surface-2); border-color: var(--c-line); color: var(--c-ink); }
.icon-btn .ping { position: absolute; top: 7px; right: 8px; width: 6px; height: 6px; background: var(--c-accent); border-radius: 50% !important; box-shadow: 0 0 0 2px var(--c-surface); }
.crumb { font-size: 12px; color: var(--c-ink-3); }
.crumb b { color: var(--c-ink); font-weight: 600; }
.header-search { margin-left: auto; position: relative; }
.header-search input { width: 260px; padding: 7px 10px 7px 32px; background: var(--c-surface-2); border: 1px solid var(--c-line); color: var(--c-ink); font-size: 12px; transition: all var(--t-fast); }
.header-search input:focus { outline: none; border-color: var(--c-accent); background: var(--c-surface); box-shadow: var(--ring); width: 300px; }
.header-search i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--c-ink-4); font-size: 12px; }
.header-user { display: flex; align-items: center; gap: 9px; padding-left: 6px; }
.avatar { width: 30px; height: 30px; border-radius: 50% !important; background: var(--c-accent-weak); border: 1px solid var(--c-accent-line); color: var(--c-accent-ink); display: grid; place-items: center; font-size: 11px; font-weight: 600; }
.header-user .nm { font-size: 12px; font-weight: 600; line-height: 1.2; }
.header-user .rl { font-size: 10.5px; color: var(--c-ink-4); }

.content { padding: 32px 40px 72px; flex: 1; max-width: 1340px; width: 100%; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 28px; }
.page-title { font-size: 23px; font-weight: 650; letter-spacing: -.03em; }
.page-desc { font-size: 12.5px; color: var(--c-ink-3); margin-top: 5px; }
.page-actions { margin-left: auto; display: flex; gap: 8px; }

/* ============ Components ============ */
/* ボタン: 微グラデ + ヘアライン + ホバーリフトで質感を付与 */
.btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 15px; font-size: 12.5px; font-weight: 550;
  border: 1px solid var(--c-line);
  background: linear-gradient(180deg, var(--c-surface) 0%, var(--c-surface-2) 100%);
  color: var(--c-ink-2);
  box-shadow: 0 1px 0 rgba(28,27,25,.02), inset 0 1px 0 rgba(255,255,255,.5);
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s, color .12s, background .12s;
}
.btn:hover {
  border-color: var(--c-ink-4); color: var(--c-ink);
  background: linear-gradient(180deg, var(--c-surface) 0%, var(--c-surface-2) 120%);
  box-shadow: 0 4px 12px -6px rgba(28,27,25,.18), inset 0 1px 0 rgba(255,255,255,.6);
  transform: translateY(-1px);
}
.btn:active { transform: translateY(0); box-shadow: inset 0 1px 3px rgba(28,27,25,.1); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--c-accent-weak); }
.btn i { font-size: .95em; }

.btn-primary {
  border-color: var(--c-accent-ink);
  background: linear-gradient(180deg, var(--c-accent) 0%, var(--c-accent-ink) 100%);
  color: #fff; font-weight: 600;
  box-shadow: 0 2px 8px -3px rgba(196,36,0,.5), inset 0 1px 0 rgba(255,255,255,.22);
}
.btn-primary:hover {
  border-color: var(--c-accent-ink);
  background: linear-gradient(180deg, var(--c-accent-ink) 0%, #a31e00 100%);
  color: #fff;
  box-shadow: 0 6px 18px -6px rgba(196,36,0,.6), inset 0 1px 0 rgba(255,255,255,.25);
  transform: translateY(-1px);
}
.btn-primary:active { box-shadow: 0 1px 4px -1px rgba(196,36,0,.5), inset 0 1px 3px rgba(0,0,0,.18); }

.btn-ghost { border-color: transparent; background: transparent; box-shadow: none; }
.btn-ghost:hover { background: var(--c-surface-2); box-shadow: none; transform: none; }
.btn-sm { padding: 5px 11px; font-size: 11.5px; }
.btn-lg { padding: 12px 20px; font-size: 13.5px; }
.btn-block { width: 100%; }
[data-theme="dark"] .btn { box-shadow: inset 0 1px 0 rgba(255,255,255,.04); }
[data-theme="dark"] .btn:hover { box-shadow: 0 4px 14px -6px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.05); }

.card { position: relative; background: var(--c-surface); border: 1px solid var(--c-line); box-shadow: var(--shadow-sm); transition: box-shadow var(--t), border-color var(--t), transform var(--t); }
.card:hover { box-shadow: var(--shadow-md); border-color: var(--c-line); }
.card-pad { padding: 22px; }
/* カードヘッダ: 左にテラコッタのアクセントバー + アイコンを格上げ */
.card-head { display: flex; align-items: center; gap: 11px; padding: 16px 20px; border-bottom: 1px solid var(--c-line); }
.card-head h3 { margin: 0; font-size: 13px; font-weight: 600; letter-spacing: -.01em; display: flex; align-items: center; gap: 9px; }
.card-head h3 > i, .card-head > i { color: var(--c-accent-ink); font-size: 13px; }
.card-head h3::before { content: ""; width: 3px; height: 13px; background: var(--c-accent); border-radius: 0 !important; flex: 0 0 3px; }
.card-head .sub { font-size: 11px; color: var(--c-ink-4); }
.card-head .right { margin-left: auto; }
/* アイコンチップ（カード見出しやインサイト等の四角アイコン枠） */
.icon-chip { width: 34px; height: 34px; flex: 0 0 34px; display: grid; place-items: center; border: 1px solid var(--c-accent-line); background: var(--c-accent-weak); color: var(--c-accent-ink); font-size: 14px; }

.grid { display: grid; gap: 20px; }
.g-4 { grid-template-columns: repeat(4, 1fr); }
.g-3 { grid-template-columns: repeat(3, 1fr); }
.g-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 1100px){ .g-4{grid-template-columns:repeat(2,1fr);} .g-3{grid-template-columns:repeat(2,1fr);} }
@media (max-width: 720px){ .g-4,.g-3,.g-2{grid-template-columns:1fr;} }

/* ===== Summary bar (タイル廃止: 横一列のサマリー) ===== */
.summary { display: flex; background: var(--c-surface); border: 1px solid var(--c-line); box-shadow: var(--shadow-sm); }
.summary .cell { flex: 1; padding: 22px 26px; border-left: 1px solid var(--c-line); transition: background var(--t-fast); }
.summary .cell:hover { background: var(--c-surface-2); }
.summary .cell:first-child { border-left: none; }
.summary .lbl { font-size: 10.5px; color: var(--c-ink-3); font-weight: 500; letter-spacing: .05em; text-transform: uppercase; display: flex; align-items: center; gap: 7px; }
.summary .lbl .ic { color: var(--c-ink-4); font-size: 11px; }
.summary .val { font-size: 30px; font-weight: 600; letter-spacing: -.035em; margin-top: 14px; line-height: 1; color: var(--c-ink); font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.summary .val small { font-size: 12px; font-weight: 450; color: var(--c-ink-4); margin-left: 4px; letter-spacing: 0; }
.summary .val.accent { color: var(--c-accent-ink); }
.summary .delta { font-size: 11px; margin-top: 12px; font-weight: 450; color: var(--c-ink-3); }
.summary .delta.up { color: var(--c-ok); }
.summary .delta.down { color: var(--c-err); }
@media (max-width: 900px){ .summary { flex-wrap: wrap; } .summary .cell { flex: 1 1 50%; border-top: 1px solid var(--c-line); } }

/* legacy .stat -> 枠線なしのプレーンブロック化（タイル感を消す） */
.stat { background: transparent; border: none; padding: 4px 0; position: relative; }
.stat::after { display: none; }
.stat .lbl { font-size: 10.5px; color: var(--c-ink-3); font-weight: 500; letter-spacing: .05em; text-transform: uppercase; display: flex; align-items: center; gap: 7px; }
.stat .val { font-size: 29px; font-weight: 500; letter-spacing: -.03em; margin-top: 12px; line-height: 1; }
.stat .val small { font-size: 12px; font-weight: 450; color: var(--c-ink-4); margin-left: 4px; }
.stat .delta { font-size: 11px; margin-top: 11px; font-weight: 450; color: var(--c-ink-3); }
.stat .delta.up { color: var(--c-ok); }
.stat .delta.down { color: var(--c-err); }

/* Table */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.tbl th { text-align: left; font-weight: 600; font-size: 10.5px; letter-spacing: .07em; color: var(--c-ink-4); text-transform: uppercase; padding: 13px 18px; border-bottom: 1px solid var(--c-line); background: var(--c-surface-2); white-space: nowrap; }
table.tbl td { padding: 14px 18px; border-bottom: 1px solid var(--c-line-2); color: var(--c-ink-2); vertical-align: middle; }
table.tbl tbody tr { transition: background var(--t-fast); }
table.tbl tbody tr:hover { background: var(--c-surface-2); }
table.tbl tbody tr:last-child td { border-bottom: none; }
.tbl .strong { color: var(--c-ink); font-weight: 600; }
.tbl .mono { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ===== モバイル: テーブル → ラベル付きカード（横スクロール排除） =====
   各 td に JS で data-label を付与。
   先頭2セル(=簡易情報)を常時表示し、残りは行タップで展開(アコーディオン)。 */
@media (max-width: 768px){
  .tbl-wrap { overflow-x: visible; }
  table.tbl, table.tbl tbody { display: block; width: 100%; }
  table.tbl thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; } /* 見出し行は視覚的に隠す */
  table.tbl tbody tr {
    display: block; position: relative;
    background: var(--c-surface);
    border: 1px solid var(--c-line);
    box-shadow: var(--shadow-sm);
    padding: 14px 16px 12px;
    margin-bottom: 10px;
  }
  table.tbl tbody tr:last-child { margin-bottom: 0; }
  table.tbl tbody tr:hover { background: var(--c-surface); }
  table.tbl tbody td {
    display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
    padding: 7px 0; border: none; text-align: right;
    white-space: normal; word-break: break-word; min-width: 0;
  }
  /* 値側は残り幅いっぱいに広げ、折り返しを最小化 */
  table.tbl tbody td > * { min-width: 0; }
  table.tbl tbody td::before {
    content: attr(data-label);
    flex: 0 0 auto; max-width: 40%;
    text-align: left;
    font-size: 10.5px; font-weight: 600; letter-spacing: .04em;
    color: var(--c-ink-4); text-transform: uppercase;
    line-height: 1.4; padding-top: 2px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  /* ラベルが空（操作列）はラベル非表示・全幅 */
  table.tbl tbody td[data-label=""]::before,
  table.tbl tbody td.td-actions::before { content: ""; flex: 0; }
  table.tbl tbody td.num { text-align: right; }
  /* 折り畳み: 行カードは「先頭2セル + 詳細トグル」。3番目以降は隠す */
  table.tbl tbody tr.row-collapsible td:nth-child(n+3) { display: none; }
  table.tbl tbody tr.row-collapsible.row-open td:nth-child(n+3) { display: flex; animation: fadeUp .25s var(--ease) both; }
  /* 操作列(td-actions)は展開時のみ表示でも良いが、先頭2内に来ない場合に備え展開対象 */
  /* 詳細トグルのシェブロン */
  table.tbl tbody tr.row-collapsible::after {
    content: "\f078"; font-family: "Font Awesome 6 Free"; font-weight: 900;
    position: absolute; top: 14px; right: 14px;
    font-size: 10px; color: var(--c-ink-4);
    transition: transform var(--t-fast);
  }
  table.tbl tbody tr.row-collapsible.row-open::after { transform: rotate(180deg); }
  table.tbl tbody tr.row-collapsible { padding-right: 34px; cursor: pointer; }
  /* 値側（ラベル以外の子）を右寄せで縦積みにし、横潰れ・折返しを防ぐ */
  table.tbl tbody td > a,
  table.tbl tbody td > span:not(.badge),
  table.tbl tbody td > .badge { margin-left: auto; }
  table.tbl tbody td .sub-cell {
    flex: 1 1 100%; width: 100%; text-align: right;
    margin-top: 2px; margin-left: 0;
    font-size: 11px; color: var(--c-ink-4);
  }
  table.tbl tbody td .cust-name { font-weight: 600; color: var(--c-ink); }
  /* td 内で本体 + sub-cell が並ぶ場合は折り返して縦積み */
  table.tbl tbody td { flex-wrap: wrap; }
  /* ページネーション等のツールバーは縦積み */
  .toolbar { gap: 8px; }
  .toolbar .btn, .toolbar .search-box, .toolbar .select, .toolbar .input { flex: 1 1 100%; min-width: 0; }
  .toolbar .search-box input { min-width: 0; width: 100%; }
  .toolbar .spacer { display: none; }
}

/* Badge / chip — 無彩色ベース + 6pxドットで色を点に */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 0; font-size: 11.5px; font-weight: 500; border: none; background: transparent; color: var(--c-ink-2); letter-spacing: 0; }
/* ステータスドット: リング状のハロー（発光感） */
.badge .dot { position: relative; width: 7px; height: 7px; background: var(--c-ink-4); border-radius: 50% !important; flex: 0 0 7px; box-shadow: 0 0 0 3px rgba(180,175,168,.16); }
.badge.ok .dot { background: var(--c-ok); box-shadow: 0 0 0 3px rgba(47,158,107,.16); }
.badge.warn .dot { background: var(--c-warn); box-shadow: 0 0 0 3px rgba(245,168,0,.18); }
.badge.err .dot { background: var(--c-err); box-shadow: 0 0 0 3px rgba(237,44,0,.16); }
.badge.info .dot { background: var(--c-info); box-shadow: 0 0 0 3px rgba(31,147,221,.18); }
.badge.accent .dot { background: var(--c-accent); box-shadow: 0 0 0 3px rgba(237,44,0,.18); }
.badge.blue .dot { background: var(--c-blue); box-shadow: 0 0 0 3px rgba(31,147,221,.18); }
.badge.yellow .dot { background: var(--c-yellow); box-shadow: 0 0 0 3px rgba(245,168,0,.20); }
/* カテゴリ等のタグ的バッジ（ドット無し）は淡い面で */
.badge:not(.ok):not(.warn):not(.err):not(.info):not(.accent):not(.blue):not(.yellow):not(:has(.dot)) { padding: 3px 10px; background: var(--c-surface-2); border: 1px solid var(--c-line); color: var(--c-ink-3); font-size: 11px; font-weight: 550; }
/* 差し色のチップ（淡い面） */
.chip-blue { padding: 3px 10px; background: var(--c-blue-weak); border: 1px solid var(--c-blue-line); color: var(--c-blue-ink); font-size: 11px; font-weight: 600; }
.chip-yellow { padding: 3px 10px; background: var(--c-yellow-weak); border: 1px solid var(--c-yellow-line); color: var(--c-yellow-ink); font-size: 11px; font-weight: 600; }

/* Toolbar / filter */
.toolbar { display: flex; align-items: center; gap: 8px; padding: 14px 20px; border-bottom: 1px solid var(--c-line); flex-wrap: wrap; }
.input, .select { padding: 8px 11px; background: var(--c-surface); border: 1px solid var(--c-line); color: var(--c-ink); font-size: 12.5px; transition: border-color .12s; }
.input:focus, .select:focus { outline: none; border-color: var(--c-accent); box-shadow: 0 0 0 3px var(--c-accent-weak); }
.search-box { position: relative; }
.search-box input { padding-left: 32px; min-width: 240px; }
.search-box i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--c-ink-4); font-size: 12px; }
.field-label { font-size: 11px; font-weight: 500; color: var(--c-ink-3); letter-spacing: .02em; margin-bottom: 6px; display: block; }
.field { margin-bottom: 16px; }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--c-line); padding: 0 20px; }
.tab { padding: 14px 14px; font-size: 12.5px; font-weight: 500; color: var(--c-ink-3); border-bottom: 1.5px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--c-ink); }
.tab.active { color: var(--c-ink); border-bottom-color: var(--c-accent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Progress / flow — 罫線区切りのみ、ベタ塗り廃止 */
.flow { display: grid; grid-template-columns: repeat(5,1fr); gap: 0; }
.flow-step { background: transparent; padding: 4px 26px 4px 0; border-right: 1px solid var(--c-line); margin-right: 26px; }
.flow-step:last-child { border-right: none; margin-right: 0; }
.flow-step .n { font-size: 31px; font-weight: 600; line-height: 1; letter-spacing: -.04em; font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.flow-step .t { font-size: 11px; color: var(--c-ink-3); font-weight: 450; margin-top: 8px; letter-spacing: .02em; }
.flow-step .bar { height: 3px; background: var(--c-line); margin-top: 14px; overflow: hidden; }
.flow-step .bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--c-accent), var(--c-accent-ink)); animation: growbar .9s var(--ease) both; }
@keyframes growbar { from { transform: scaleX(0); transform-origin: left; } to { transform: scaleX(1); transform-origin: left; } }
@media (max-width: 768px){
  .flow { grid-template-columns: repeat(2,1fr); gap: 18px 0; }
  .flow-step { border-right: none; margin-right: 0; padding-right: 16px; }
  .flow-step:nth-child(odd) { border-right: 1px solid var(--c-line); }
  .flow-step .n { font-size: 24px; }
}

.progress { height: 5px; background: var(--c-line); width: 100%; overflow: hidden; }
.progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--c-accent), var(--c-accent-ink)); box-shadow: 0 0 8px -2px var(--c-accent); }

/* Definition list — 罫線のみ、ラベル面を廃止 */
.dl { display: grid; grid-template-columns: 140px 1fr; }
.dl dt { padding: 13px 4px 13px 0; font-size: 11.5px; color: var(--c-ink-3); font-weight: 450; border-bottom: 1px solid var(--c-line-2); background: transparent; }
.dl dd { padding: 13px 0; margin: 0; font-size: 12.5px; color: var(--c-ink); border-bottom: 1px solid var(--c-line-2); }
@media (max-width: 560px){
  .dl { grid-template-columns: 1fr; }
  .dl dt { padding: 11px 0 2px; border-bottom: none; }
  .dl dd { padding: 0 0 11px; }
}

/* Timeline */
.timeline { padding: 12px 0; }
.tl-item { display: flex; gap: 16px; padding: 14px 22px; position: relative; }
.tl-item::before { content:""; position: absolute; left: 30px; top: 0; bottom: 0; width: 1px; background: var(--c-line); }
.tl-item:first-child::before { top: 20px; }
.tl-item:last-child::before { bottom: calc(100% - 20px); }
.tl-dot { width: 7px; height: 7px; border-radius: 50% !important; background: var(--c-accent); margin-top: 6px; z-index: 1; flex: 0 0 7px; outline: 4px solid var(--c-surface); }
.tl-dot.muted { background: var(--c-ink-4); }
.tl-body .tm { font-size: 11px; color: var(--c-ink-4); font-weight: 450; }
.tl-body .ti { font-size: 12.8px; color: var(--c-ink); font-weight: 550; margin: 3px 0; display: flex; align-items: center; gap: 10px; }
.tl-body .tx { font-size: 12px; color: var(--c-ink-3); }

/* AI chat — 落ち着いたトーン、ユーザー吹き出しも淡く */
.ai-box { display: flex; flex-direction: column; height: 380px; }
.ai-log { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.ai-msg { max-width: 84%; padding: 11px 14px; font-size: 12.5px; line-height: 1.6; }
.ai-msg.user { align-self: flex-end; background: var(--c-accent-weak); color: var(--c-accent-ink); }
.ai-msg.bot { align-self: flex-start; background: var(--c-surface-2); color: var(--c-ink-2); }
.ai-input { display: flex; gap: 0; border-top: 1px solid var(--c-line); }
.ai-input input { flex: 1; padding: 14px 18px; border: none; background: transparent; color: var(--c-ink); font-size: 12.5px; }
.ai-input input:focus { outline: none; }
.ai-input button { padding: 0 20px; background: transparent; color: var(--c-accent-ink); border: none; border-left: 1px solid var(--c-line); font-weight: 500; }
.ai-input button:hover { background: var(--c-surface-2); }
.ai-suggest { display: flex; gap: 8px; padding: 0 18px 16px; flex-wrap: wrap; }
.ai-suggest button { font-size: 11.5px; padding: 6px 12px; border: 1px solid var(--c-line); background: var(--c-surface); color: var(--c-ink-3); }
.ai-suggest button:hover { border-color: var(--c-accent-line); color: var(--c-accent-ink); background: var(--c-accent-weak); }

/* Map placeholder */
.map-ph { height: 480px; background:
  repeating-linear-gradient(0deg, var(--c-line-2) 0 1px, transparent 1px 44px),
  repeating-linear-gradient(90deg, var(--c-line-2) 0 1px, transparent 1px 44px),
  var(--c-surface-2);
  position: relative; }
.map-pin { position: absolute; transform: translate(-50%,-100%); color: var(--c-accent); font-size: 20px; }

/* Misc */
.muted { color: var(--c-ink-3); }
.hr { height: 1px; background: var(--c-line); border: none; margin: 0; }
.spacer { flex: 1; }
.row { display: flex; align-items: center; gap: 10px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.mt8{margin-top:8px}.mt14{margin-top:14px}.mt20{margin-top:20px}.mb14{margin-bottom:14px}
.cust-name { font-weight: 550; color: var(--c-ink); }
.cust-name:hover { color: var(--c-accent-ink); }
.sub-cell { font-size: 11px; color: var(--c-ink-4); margin-top: 2px; }
.bar-chart { display: flex; align-items: flex-end; gap: 14px; height: 190px; padding: 12px 4px 0; }
.bar-chart .bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 10px; height: 100%; justify-content: flex-end; }
.bar-chart .bar i { width: 52%; background: var(--c-accent); display: block; min-height: 2px; opacity: .85; }
.bar-chart .bar i.alt { background: var(--c-blue); opacity: .55; }
.bar-chart .bar span { font-size: 10.5px; color: var(--c-ink-4); }
.legend { display: flex; gap: 18px; font-size: 11px; color: var(--c-ink-3); }
.legend i { width: 8px; height: 8px; display: inline-block; margin-right: 6px; vertical-align: middle; }

.empty { text-align: center; padding: 48px; color: var(--c-ink-4); font-size: 12.5px; }

/* ============================================================
   Auth / Login — 2カラム スプリットレイアウト
   左: ブランドアートペイン / 右: サインインフォーム
   ============================================================ */
.auth { display: grid; grid-template-columns: 1.05fr .95fr; min-height: 100vh; background: var(--c-bg); }

/* --- 左ペイン: アートワーク --- */
.auth-art {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 48px 52px;
  background:
    url("/static/img/login-art.webp") center / cover no-repeat,
    #211c1a;
  color: #fff;
}
/* 暗→コーポレートオレンジのオーバーレイ（文字可読性 + ブランド統一） */
.auth-art-overlay {
  position: absolute; inset: 0; z-index: 0;
  background:
    linear-gradient(150deg, rgba(26,18,15,.42) 0%, rgba(120,28,5,.46) 52%, rgba(237,44,0,.66) 100%),
    radial-gradient(130% 100% at 82% 112%, rgba(255,90,48,.55) 0%, rgba(255,90,48,0) 62%);
}
.auth-art-inner { position: relative; z-index: 1; display: flex; flex-direction: column; justify-content: space-between; height: 100%; }
.auth-brand { display: flex; align-items: center; gap: 13px; }
.auth-mark {
  width: 46px; height: 46px; flex: 0 0 46px; display: grid; place-items: center;
  border: 1.5px solid rgba(255,255,255,.7); color: #fff; font-weight: 700; font-size: 21px;
  letter-spacing: -.02em; backdrop-filter: blur(4px); background: rgba(255,255,255,.08);
  border-radius: var(--radius);
}
.auth-brand-name { font-size: 19px; font-weight: 700; letter-spacing: -.01em; }
.auth-brand-name span { font-weight: 400; opacity: .8; }
.auth-brand-sub { font-size: 9.5px; letter-spacing: .22em; opacity: .65; text-transform: uppercase; margin-top: 3px; }

.auth-art-foot h2 { font-size: 34px; font-weight: 700; line-height: 1.32; letter-spacing: -.02em; margin: 0 0 16px; text-shadow: 0 2px 20px rgba(0,0,0,.3); }
.auth-art-foot p { font-size: 13px; line-height: 1.8; opacity: .88; max-width: 42ch; margin: 0; }
.auth-stats { display: flex; gap: 38px; margin-top: 34px; padding-top: 26px; border-top: 1px solid rgba(255,255,255,.18); }
.auth-stats b { display: block; font-size: 26px; font-weight: 700; letter-spacing: -.03em; line-height: 1; }
.auth-stats span { display: block; font-size: 11px; opacity: .7; margin-top: 7px; letter-spacing: .03em; }

/* --- 右ペイン: フォーム --- */
.auth-form { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 48px 32px; gap: 22px; }
.auth-form-bg { position: relative; }
.auth-card { width: 100%; max-width: 392px; }
/* フォーム入力のフォーカスリングを統一 */
.auth-card .input { transition: all var(--t-fast); }
.auth-mark-sm {
  width: 44px; height: 44px; display: grid; place-items: center; margin-bottom: 22px;
  border: 1px solid var(--c-accent-line); background: var(--c-accent-weak);
  color: var(--c-accent-ink); font-weight: 700; font-size: 20px; letter-spacing: -.02em;
  border-radius: var(--radius);
}
.auth-title { font-size: 26px; font-weight: 700; letter-spacing: -.03em; margin: 0; }
.auth-desc { font-size: 13px; color: var(--c-ink-3); margin: 8px 0 28px; }

/* アイコン付き入力欄 */
.input-icon { position: relative; }
.input-icon > i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--c-ink-4); font-size: 13px; pointer-events: none; transition: color .15s; }
.input-icon .input { width: 100%; padding: 12px 14px 12px 40px; font-size: 13.5px; background: var(--c-surface-2); border: 1px solid var(--c-line); border-radius: var(--radius-sm); }
.pw-toggle { border-radius: var(--radius-sm); }
.input-icon .input:focus { background: var(--c-surface); border-color: var(--c-accent); box-shadow: 0 0 0 3px var(--c-accent-weak); }
.input-icon:focus-within > i { color: var(--c-accent-ink); }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 32px; height: 32px; display: grid; place-items: center; background: transparent; border: none; color: var(--c-ink-4); font-size: 13px; }
.pw-toggle:hover { color: var(--c-ink-2); }

.auth-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: -2px 0 22px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--c-ink-2); cursor: pointer; }
.check input { width: 15px; height: 15px; accent-color: var(--c-accent); cursor: pointer; }
.auth-link { font-size: 12px; color: var(--c-accent-ink); font-weight: 500; }
.auth-link:hover { text-decoration: underline; }

.auth-divider { display: flex; align-items: center; gap: 14px; margin: 26px 0 14px; color: var(--c-ink-4); font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--c-line); }
.auth-note { font-size: 12px; color: var(--c-ink-3); text-align: center; }
.auth-copy { font-size: 11px; color: var(--c-ink-4); text-align: center; }

@media (max-width: 900px){
  .auth { grid-template-columns: 1fr; }
  /* アートペインを上部の帯に圧縮（コンパクトヘッダー化） */
  .auth-art { padding: 30px 24px; min-height: 220px; flex-direction: column; justify-content: space-between; }
  .auth-art-foot h2 { font-size: 23px; margin-bottom: 10px; }
  .auth-art-foot p { display: none; }
  .auth-stats { gap: 26px; margin-top: 18px; padding-top: 16px; }
  .auth-stats b { font-size: 20px; }
  .auth-form { padding: 36px 24px; }
}
@media (max-width: 560px){
  /* スマホ: アートペインはブランドのみの薄い帯に */
  .auth-art { min-height: auto; padding: 22px 22px; }
  .auth-art-foot { display: none; }
  .auth-mark-sm { display: none; }
  .auth-form { padding: 28px 22px 36px; justify-content: flex-start; }
  .auth-title { font-size: 23px; }
}

/* ============================================================
   v3 — Hero band / Asymmetric dashboard / Mini charts
   ============================================================ */

/* ヒーロー帯: 生成テクスチャ + グラデで上品な導入 */
.hero {
  position: relative;
  border: 1px solid var(--c-line);
  background:
    linear-gradient(105deg, rgba(255,255,255,.0) 0%, rgba(255,255,255,.7) 62%, var(--c-surface) 100%),
    url("/static/img/hero-texture.webp") left center / cover no-repeat,
    var(--c-surface);
  padding: 30px 34px;
  display: flex; align-items: center; gap: 28px;
  overflow: hidden;
}
[data-theme="dark"] .hero {
  background:
    linear-gradient(105deg, rgba(29,28,32,.4) 0%, rgba(29,28,32,.82) 62%, var(--c-surface) 100%),
    url("/static/img/hero-texture.webp") left center / cover no-repeat,
    var(--c-surface);
}
.hero-main { flex: 1; min-width: 0; }
.hero-eyebrow { font-size: 10.5px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--c-accent-ink); display: flex; align-items: center; gap: 8px; }
.hero-eyebrow .dot { width: 6px; height: 6px; background: var(--c-accent); border-radius: 50% !important; }
.hero-title { font-size: 21px; font-weight: 600; letter-spacing: -.02em; margin-top: 12px; line-height: 1.4; }
.hero-title b { color: var(--c-accent-ink); font-weight: 600; }
.hero-sub { font-size: 12.5px; color: var(--c-ink-3); margin-top: 8px; max-width: 52ch; }
.hero-side { flex: 0 0 auto; display: flex; gap: 30px; padding-left: 28px; border-left: 1px solid var(--c-line); }
.hero-metric .k { font-size: 10px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--c-ink-4); }
.hero-metric .v { font-size: 26px; font-weight: 500; letter-spacing: -.03em; margin-top: 8px; line-height: 1; }
.hero-metric .v.accent { color: var(--c-accent-ink); }
.hero-metric .s { font-size: 10.5px; color: var(--c-ink-3); margin-top: 7px; }
@media (max-width: 860px){
  .hero { flex-direction: column; align-items: flex-start; gap: 20px; padding: 22px 20px; }
  .hero-side { padding-left: 0; border-left: none; border-top: 1px solid var(--c-line); padding-top: 18px; width: 100%; gap: 26px; }
  .hero-title { font-size: 18px; }
}

/* 非対称グリッド（メイン + サイド） */
.layout-split { display: grid; grid-template-columns: 1.55fr .95fr; gap: 20px; align-items: start; }
@media (max-width: 980px){ .layout-split { grid-template-columns: 1fr; } }

/* スタック内縦並びカード */
.stack { display: flex; flex-direction: column; gap: 20px; }

/* インサイトリスト（アラート等を縦の行で） */
.insight { display: flex; align-items: center; gap: 14px; padding: 15px 20px; border-bottom: 1px solid var(--c-line-2); transition: background var(--t-fast); cursor: pointer; position: relative; }
.insight::after { content: "\f054"; font-family: "Font Awesome 6 Free"; font-weight: 900; position: absolute; right: 18px; top: 50%; transform: translateY(-50%) translateX(-4px); font-size: 10px; color: var(--c-ink-4); opacity: 0; transition: all var(--t-fast); }
.insight:hover { background: var(--c-surface-2); }
.insight:hover::after { opacity: 1; transform: translateY(-50%) translateX(0); }
.insight:last-child { border-bottom: none; }
.insight .ic { width: 34px; height: 34px; flex: 0 0 34px; display: grid; place-items: center; border: 1px solid var(--c-line); color: var(--c-ink-3); font-size: 13px; transition: all var(--t-fast); }
.insight:hover .ic { box-shadow: var(--shadow-sm); }
.insight.is-warn .ic { color: var(--c-warn); border-color: var(--c-warn); background: var(--c-warn-bg); }
.insight.is-err  .ic { color: var(--c-err);  border-color: var(--c-err); background: var(--c-err-bg); }
.insight.is-ok   .ic { color: var(--c-ok);   border-color: var(--c-ok); background: var(--c-ok-bg); }
.insight .body { flex: 1; min-width: 0; }
.insight .t { font-size: 12.8px; font-weight: 550; color: var(--c-ink); }
.insight .d { font-size: 11.5px; color: var(--c-ink-3); margin-top: 3px; }
.insight .n { font-size: 19px; font-weight: 650; letter-spacing: -.03em; color: var(--c-ink); font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.insight .n small { font-size: 10px; color: var(--c-ink-4); margin-left: 2px; font-weight: 400; }

/* スパークライン風ミニチャート（SVG/divベース） */
.spark { display: flex; align-items: flex-end; gap: 5px; height: 46px; }
.spark i { flex: 1; background: var(--c-accent-line); display: block; min-height: 3px; transition: background var(--t), opacity var(--t); position: relative; }
.spark i.hi { background: linear-gradient(180deg, var(--c-accent) 0%, var(--c-accent-ink) 100%); }
.spark:hover i { opacity: .45; }
.spark:hover i:hover { opacity: 1; background: linear-gradient(180deg, var(--c-accent) 0%, var(--c-accent-ink) 100%); }
.metric-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding: 18px 20px; }
.metric-row + .metric-row { border-top: 1px solid var(--c-line-2); }
.metric-row .mt-lbl { font-size: 11px; color: var(--c-ink-3); font-weight: 500; }
.metric-row .mt-val { font-size: 23px; font-weight: 650; letter-spacing: -.03em; margin-top: 6px; font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.metric-row .mt-val small { font-size: 11px; color: var(--c-ink-4); margin-left: 3px; font-weight: 400; }

/* リング進捗（成約率など） */
.ring-wrap { display: flex; align-items: center; gap: 20px; padding: 20px; }
.ring { position: relative; --p: 62; width: 88px; height: 88px; flex: 0 0 88px; border-radius: 50% !important; display: grid; place-items: center;
  background: conic-gradient(var(--c-accent) calc(var(--p) * 1%), var(--c-line) 0);
  filter: drop-shadow(0 4px 10px -4px rgba(237,44,0,.35)); }
.ring::before { content: ""; position: absolute; width: 66px; height: 66px; border-radius: 50% !important; background: var(--c-surface); box-shadow: inset 0 0 0 1px var(--c-line-2); }
.ring b { position: relative; font-size: 20px; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.ring-info .rk { font-size: 11px; color: var(--c-ink-3); font-weight: 500; }
.ring-info .rd { font-size: 12px; color: var(--c-ink-2); margin-top: 8px; }

/* 空状態（生成イラスト使用） */
.empty-state { text-align: center; padding: 48px 24px; }
.empty-state img { width: 96px; height: 96px; object-fit: contain; opacity: .9; margin-bottom: 16px; }
.empty-state .et { font-size: 13.5px; font-weight: 550; color: var(--c-ink); }
.empty-state .ed { font-size: 12px; color: var(--c-ink-3); margin-top: 6px; }

/* ============================================================
   Mobile drawer + bottom tab nav + responsive shell
   ============================================================ */
.menu-btn { display: none; }
.scrim { display: none; }
.bottom-nav { display: none; }
.mobile-only { display: none; }

@media (max-width: 1024px){
  /* サイドバーをオフキャンバスのドロワー化 */
  .sidebar {
    position: fixed; top: 0; left: 0; z-index: 60;
    width: 280px; flex-basis: 280px; height: 100vh;
    transform: translateX(-100%);
    transition: transform .24s cubic-bezier(.4,0,.2,1);
    box-shadow: var(--shadow-2);
  }
  .app.collapsed .sidebar { margin-left: 0; } /* PCトグル無効化 */
  .app.drawer-open .sidebar { transform: translateX(0); }
  .scrim {
    display: block; position: fixed; inset: 0; z-index: 55;
    background: rgba(28,27,25,.42); opacity: 0; pointer-events: none;
    transition: opacity .24s ease;
  }
  .app.drawer-open .scrim { opacity: 1; pointer-events: auto; }
  .menu-btn { display: grid; }
  #toggleSidebar { display: none; } /* PC用トグルは隠す */
}

@media (max-width: 768px){
  :root { --header-h: 56px; }
  .content { padding: 20px 16px 96px; }
  .page-head { flex-direction: column; align-items: stretch; gap: 14px; margin-bottom: 20px; }
  .page-actions { margin-left: 0; }
  .page-actions .btn { flex: 1; justify-content: center; }
  .page-title { font-size: 19px; }
  .header-search { display: none; }
  .header-user > div:not(.avatar) { display: none; } /* 名前/役職を隠しアバターのみ */
  .crumb { font-size: 11.5px; }
  .layout-split { gap: 16px; }
  .stack { gap: 16px; }
  .card-pad { padding: 16px; }
  table.tbl th, table.tbl td { padding: 11px 14px; }

  /* 下部タブナビ表示 */
  .bottom-nav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
    background: var(--c-surface); border-top: 1px solid var(--c-line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
  }
  .bottom-nav a,
  .bottom-nav .bn-menu {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 7px 2px; color: var(--c-ink-4); font-size: 10px; font-weight: 500;
    background: transparent; border: none; cursor: pointer;
    font-family: inherit; min-width: 0; -webkit-tap-highlight-color: transparent;
  }
  .bottom-nav .bn-ic {
    position: relative; display: inline-flex; align-items: center; justify-content: center;
    width: 24px; height: 20px;
  }
  .bottom-nav .bn-ic i { font-size: 17px; line-height: 1; }
  .bottom-nav .bn-badge {
    position: absolute; top: -5px; right: -8px; min-width: 15px; height: 15px;
    padding: 0 4px; display: inline-flex; align-items: center; justify-content: center;
    background: var(--c-accent); color: #fff; font-size: 9px; font-weight: 700;
    line-height: 1; border-radius: 999px; box-shadow: 0 0 0 2px var(--c-surface);
  }
  .bottom-nav a span:last-child,
  .bottom-nav .bn-menu span:last-child {
    max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .bottom-nav a.active { color: var(--c-accent-ink); }
  .bottom-nav a.active .bn-ic i { color: var(--c-accent); }
  .mobile-only { display: block; }
}

@media (max-width: 480px){
  .summary .cell { flex: 1 1 100%; }
  .hero-side { gap: 20px; }
  .hero-metric .v { font-size: 22px; }
}

/* ============================================================
   v5 — エントランス演出 / インタラクション仕上げ
   最新SaaSらしい控えめなモーションで「生きている」UIに
   ============================================================ */
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* メインコンテンツを段階的にフェードイン（過剰にならない範囲で） */
.content > * { animation: fadeUp .42s var(--ease) both; }
.content > *:nth-child(1) { animation-delay: .02s; }
.content > *:nth-child(2) { animation-delay: .07s; }
.content > *:nth-child(3) { animation-delay: .12s; }
.content > *:nth-child(4) { animation-delay: .17s; }
.content > *:nth-child(n+5) { animation-delay: .2s; }

/* モバイル下部ナビ: アクティブインジケータ + タップ反応 */
@media (max-width: 768px){
  .bottom-nav { box-shadow: 0 -1px 12px -6px rgba(28,27,25,.18); }
  .bottom-nav a,
  .bottom-nav .bn-menu { position: relative; transition: color var(--t-fast); }
  .bottom-nav a.active::before {
    content: ""; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
    width: 22px; height: 2.5px; background: var(--c-accent);
    box-shadow: 0 0 8px -1px var(--c-accent);
  }
  .bottom-nav a:active,
  .bottom-nav .bn-menu:active { transform: scale(.94); }
}

/* アクセシビリティ: モーション低減設定を尊重 */
@media (prefers-reduced-motion: reduce){
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; }
}

/* ============================================================
   v6 — Flat Modern UI refresh
   目的: AI生成UIに見えやすい「過剰なグラデーション・発光・浮遊感・
         画像テクスチャ・演出」を抑え、業務プロダクトらしい
         フラットで実用的な最近のUIへ寄せる。
   ============================================================ */
:root {
  --c-bg:        #f6f7f9;
  --c-surface:   #ffffff;
  --c-surface-2: #f1f3f5;
  --c-line:      #d9dee5;
  --c-line-2:    #e7eaef;
  --c-ink:       #111827;
  --c-ink-2:     #374151;
  --c-ink-3:     #6b7280;
  --c-ink-4:     #9ca3af;

  --c-accent:      #ed2c00;
  --c-accent-ink:  #bf2400;
  --c-accent-weak: #fff1ed;
  --c-accent-line: #ffd1c6;

  --c-blue:      #2563eb;
  --c-blue-ink:  #1d4ed8;
  --c-blue-weak: #eff6ff;
  --c-blue-line: #bfdbfe;

  --c-yellow:      #d97706;
  --c-yellow-ink:  #92400e;
  --c-yellow-weak: #fffbeb;
  --c-yellow-line: #fde68a;

  --c-ok:    #16a34a;
  --c-ok-bg: #f0fdf4;
  --c-warn:  #d97706;
  --c-warn-bg:#fffbeb;
  --c-err:   #dc2626;
  --c-err-bg:#fef2f2;
  --c-info:  #2563eb;
  --c-info-bg:#eff6ff;

  --shadow-1: none;
  --shadow-2: none;
  --shadow-sm: none;
  --shadow-md: none;
  --shadow-lg: none;
  --ring: 0 0 0 3px rgba(237,44,0,.14);

  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius:    8px;
  --radius-lg: 10px;
}

[data-theme="dark"] {
  --c-bg:        #0f1115;
  --c-surface:   #161a20;
  --c-surface-2: #1d222a;
  --c-line:      #2b323d;
  --c-line-2:    #242a33;
  --c-ink:       #f3f4f6;
  --c-ink-2:     #d1d5db;
  --c-ink-3:     #9ca3af;
  --c-ink-4:     #6b7280;
  --c-accent:      #ff4b26;
  --c-accent-ink:  #ff6a4d;
  --c-accent-weak: #2a1712;
  --c-accent-line: #513025;
  --c-blue:      #60a5fa;
  --c-blue-ink:  #93c5fd;
  --c-blue-weak: #132033;
  --c-blue-line: #263d61;
  --c-yellow:      #f59e0b;
  --c-yellow-ink:  #fbbf24;
  --c-yellow-weak: #2b2110;
  --c-yellow-line: #4a3816;
  --c-ok-bg: #102318;
  --c-warn-bg:#2b2110;
  --c-err-bg: #2b1515;
  --c-info-bg:#132033;
  --shadow-1: none;
  --shadow-2: none;
  --shadow-sm: none;
  --shadow-md: none;
  --shadow-lg: none;
  --ring: 0 0 0 3px rgba(255,75,38,.18);
}

html, body {
  background: var(--c-bg);
  letter-spacing: 0;
}

/* フラット化: 影・発光・浮遊・自動フェードを無効化 */
*, *::before, *::after {
  text-shadow: none !important;
}
.content > * {
  animation: none !important;
}

.sidebar,
.header,
.card,
.summary,
.btn,
.icon-btn,
.input,
.select,
.search-box input,
.hero,
.auth-art,
.auth-mark,
.auth-mark-sm,
.insight .ic,
.ring,
.toast,
.dropdown,
.menu,
.bottom-nav,
table.tbl tbody tr {
  box-shadow: none !important;
  filter: none !important;
}

.header {
  background: var(--c-surface);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.brand-mark,
.btn-primary,
.progress span,
.flow-step .bar span,
.spark i.hi,
.bar-chart .bar i,
.ring {
  background: var(--c-accent) !important;
}
.brand-mark {
  border: 1px solid var(--c-accent);
  color: #fff;
}

.card,
.summary,
.hero,
.panel,
.auth-card,
.auth-form-wrap {
  background: var(--c-surface) !important;
  border: 1px solid var(--c-line) !important;
}
.card:hover {
  border-color: #cfd6df;
  transform: none;
}
.card-head {
  background: var(--c-surface);
  padding: 15px 18px;
}
.card-head h3::before {
  width: 2px;
  height: 14px;
  background: var(--c-accent);
}
.icon-chip,
.insight .ic,
.auth-mark-sm {
  background: var(--c-surface-2) !important;
  border-color: var(--c-line) !important;
  color: var(--c-ink-2) !important;
}

.btn {
  background: var(--c-surface) !important;
  border: 1px solid var(--c-line);
  color: var(--c-ink-2);
  transition: background .12s ease, border-color .12s ease, color .12s ease;
}
.btn:hover {
  background: var(--c-surface-2) !important;
  border-color: #cbd5e1;
  color: var(--c-ink);
  transform: none;
}
.btn:active {
  transform: none;
}
.btn-primary {
  background: var(--c-accent) !important;
  border-color: var(--c-accent) !important;
  color: #fff !important;
}
.btn-primary:hover {
  background: var(--c-accent-ink) !important;
  border-color: var(--c-accent-ink) !important;
  transform: none;
}
.btn-ghost:hover {
  background: var(--c-surface-2) !important;
}

.icon-btn {
  background: transparent;
  border: 1px solid transparent;
}
.icon-btn:hover {
  background: var(--c-surface-2);
  border-color: var(--c-line);
}
.icon-btn .ping,
.bottom-nav .bn-badge,
.nav-item.active::before,
.bottom-nav a.active::before {
  box-shadow: none !important;
}

.nav-item,
.module-switch a,
.tab,
.bottom-nav a,
.bottom-nav .bn-menu,
.insight,
table.tbl tbody tr {
  transition: background .12s ease, color .12s ease, border-color .12s ease;
}
.nav-item.active {
  background: var(--c-surface-2);
  color: var(--c-accent-ink);
}
.nav-item.active::before {
  background: var(--c-accent);
}

.header-search input,
.input,
.select,
.search-box input,
.input-icon .input {
  background: var(--c-surface) !important;
  border-color: var(--c-line);
}
.header-search input:focus,
.input:focus,
.select:focus,
.input-icon .input:focus {
  background: var(--c-surface) !important;
  border-color: var(--c-accent);
  box-shadow: var(--ring) !important;
}

.hero {
  background: var(--c-surface) !important;
  padding: 26px 28px;
}
.hero-eyebrow {
  color: var(--c-ink-3);
}
.hero-title b {
  color: var(--c-accent-ink);
}
.hero-side {
  border-left-color: var(--c-line);
}

.summary .cell:hover,
.insight:hover,
table.tbl tbody tr:hover {
  background: var(--c-surface-2);
}
.summary .val,
.hero-metric .v,
.metric-row .mt-val,
.insight .n,
.flow-step .n {
  font-weight: 650;
}

/* ステータス色は面ではなく小さな色点に限定 */
.badge .dot,
.badge.ok .dot,
.badge.warn .dot,
.badge.err .dot,
.badge.info .dot,
.badge.accent .dot,
.badge.blue .dot,
.badge.yellow .dot {
  box-shadow: none !important;
}
.badge:not(.ok):not(.warn):not(.err):not(.info):not(.accent):not(.blue):not(.yellow):not(:has(.dot)),
.chip-blue,
.chip-yellow {
  background: var(--c-surface-2) !important;
  border-color: var(--c-line) !important;
  color: var(--c-ink-2) !important;
}

.spark i,
.bar-chart .bar i,
.bar-chart .bar i.alt,
.legend i,
.progress,
.flow-step .bar {
  border-radius: 2px;
}
.spark i {
  background: var(--c-line) !important;
}
.spark i.hi,
.spark:hover i:hover,
.bar-chart .bar i {
  background: var(--c-accent) !important;
}
.bar-chart .bar i.alt {
  background: var(--c-blue) !important;
}
.spark:hover i {
  opacity: 1;
}
.progress span {
  box-shadow: none !important;
}

.ring {
  background: conic-gradient(var(--c-accent) calc(var(--p) * 1%), var(--c-line) 0) !important;
}
.ring::before {
  box-shadow: none;
}

.ai-msg.user {
  background: var(--c-accent-weak);
}
.ai-msg.bot {
  background: var(--c-surface-2);
}
.ai-suggest button,
.ai-input button {
  background: var(--c-surface);
  border-color: var(--c-line);
}
.ai-suggest button:hover,
.ai-input button:hover {
  background: var(--c-surface-2);
}

.auth-art {
  background: var(--c-accent) !important;
}
.auth-art-overlay {
  background: transparent !important;
}
.auth-mark {
  background: transparent !important;
  border-color: rgba(255,255,255,.72) !important;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
.auth-form {
  background: var(--c-bg);
}
.auth-divider::before,
.auth-divider::after {
  background: var(--c-line);
}

.map-ph {
  background:
    repeating-linear-gradient(0deg, var(--c-line-2) 0 1px, transparent 1px 44px),
    repeating-linear-gradient(90deg, var(--c-line-2) 0 1px, transparent 1px 44px),
    var(--c-surface-2) !important;
}
.map-pin {
  color: var(--c-accent);
}

@media (max-width: 1024px){
  .sidebar { box-shadow: none !important; }
  .scrim { background: rgba(15,23,42,.38); }
}
@media (max-width: 768px){
  .bottom-nav { box-shadow: none !important; }
  .bottom-nav a:active,
  .bottom-nav .bn-menu:active { transform: none; }
}
