  :root {
    --ink: #0F2233;
    --ink-soft: #56677A;
    --page: #F5F8FB;
    --panel: #FFFFFF;
    --panel-dim: #EAEFF5;
    --line: #D7DEE6;
    --brand: #1B6FC9;
    --brand-soft: rgba(27,111,201,0.10);
    --on-brand: #FFFFFF;
    --link: #1D4E78;
    --link-soft: rgba(29,78,120,0.08);
    --link-fill: #0F2A4A;
    --shadow: 0 1px 2px rgba(15,34,51,0.05);
    --seg1: #1B6FC9; --seg2: #4F93D9; --seg3: #0F2A4A; --seg4: #8FC1F2; --seg5: #A9B7C4;
  }
  @media (prefers-color-scheme: dark) {
    :root {
      --ink: #E7EDF3; --ink-soft: #93A4B7; --page: #0A121C; --panel: #101B29;
      --panel-dim: #16263A; --line: #223247; --brand: #1B6FC9; --brand-soft: rgba(27,111,201,0.18);
      --on-brand: #FFFFFF; --link: #7FB0DE; --link-soft: rgba(127,176,222,0.12); --link-fill: #163A5C;
      --shadow: 0 1px 2px rgba(0,0,0,0.5);
      --seg1: #4F93D9; --seg2: #8FC1F2; --seg3: #2E5E8C; --seg4: #B7D6F2; --seg5: #7A8B9D;
    }
  }
  :root[data-theme="dark"] {
    --ink: #E7EDF3; --ink-soft: #93A4B7; --page: #0A121C; --panel: #101B29;
    --panel-dim: #16263A; --line: #223247; --brand: #1B6FC9; --brand-soft: rgba(27,111,201,0.18);
    --on-brand: #FFFFFF; --link: #7FB0DE; --link-soft: rgba(127,176,222,0.12); --link-fill: #163A5C;
    --shadow: 0 1px 2px rgba(0,0,0,0.5);
    --seg1: #4F93D9; --seg2: #8FC1F2; --seg3: #2E5E8C; --seg4: #B7D6F2; --seg5: #7A8B9D;
  }
  :root[data-theme="light"] {
    --ink: #0F2233; --ink-soft: #56677A; --page: #F5F8FB; --panel: #FFFFFF;
    --panel-dim: #EAEFF5; --line: #D7DEE6; --brand: #1B6FC9; --brand-soft: rgba(27,111,201,0.10);
    --on-brand: #FFFFFF; --link: #1D4E78; --link-soft: rgba(29,78,120,0.08); --link-fill: #0F2A4A;
    --shadow: 0 1px 2px rgba(15,34,51,0.05);
    --seg1: #1B6FC9; --seg2: #4F93D9; --seg3: #0F2A4A; --seg4: #8FC1F2; --seg5: #A9B7C4;
  }

  * { box-sizing: border-box; }
  body {
    margin: 0;
    background:
      radial-gradient(1100px 560px at 12% -8%, var(--brand-soft), transparent 60%),
      radial-gradient(900px 480px at 100% 0%, var(--link-soft), transparent 55%),
      var(--page);
    background-attachment: fixed;
    color: var(--ink);
    font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic", "YuGothic",
      "Noto Sans JP", "Segoe UI", system-ui, sans-serif;
    line-height: 1.6;
    font-feature-settings: "palt" 1;
    -webkit-font-smoothing: antialiased;
  }
  .num { font-variant-numeric: tabular-nums; font-family: "SFMono-Regular", ui-monospace, "SF Mono", Consolas, "Liberation Mono", monospace; }
  a { color: var(--link); }
  button, input, select, textarea { font-family: inherit; }
  *:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

  .app { max-width: 1180px; margin: 0 auto; padding: 0 20px 140px; }

  /* ---------- Page shell: left tab nav / center app / right rail ---------- */
  .page-shell {
    display: flex; justify-content: center; align-items: flex-start;
    gap: 0; max-width: 1720px; margin: 0 auto; padding: 0 20px;
  }
  .page-shell .app { flex: 0 1 1180px; margin: 0; }
  .side-nav {
    flex: 0 0 200px; position: sticky; top: 0; padding: 64px 20px 20px 0;
    border-right: 1px solid var(--line); margin-right: 20px;
    display: flex; flex-direction: column; gap: 2px;
  }
  .side-nav .nav-tab {
    display: flex; align-items: center; gap: 8px;
    padding: 11px 14px; border: none; border-left: 4px solid transparent;
    background: transparent; color: var(--ink-soft); font-size: 13px; font-weight: 600;
    letter-spacing: .01em; cursor: pointer; text-align: left; white-space: nowrap; width: 100%;
    transition: color .12s, border-color .12s, background .12s;
  }
  .side-nav .nav-tab:hover { background: var(--panel-dim); color: var(--ink); }
  .side-nav .nav-tab.active {
    background: linear-gradient(90deg, var(--brand-soft), transparent 85%);
    color: var(--brand); font-weight: 700;
    border-left: 4px solid transparent; border-image: linear-gradient(180deg, var(--brand), var(--link-fill)) 1;
  }
  .side-nav .nav-count {
    margin-left: auto; font-size: 10.5px; font-weight: 700; background: var(--link-fill); color: var(--on-brand);
    border-radius: 2px; padding: 1px 6px; font-variant-numeric: tabular-nums;
  }
  .side-nav .nav-count:empty { display: none; }

  .tab-panel { display: none; }
  .tab-panel.active { display: block; }

  .right-rail {
    flex: 0 0 300px; position: sticky; top: 0; padding: 64px 0 20px 20px;
    border-left: 1px solid var(--line); margin-left: 20px;
    max-height: 100vh; overflow-y: auto; box-sizing: border-box;
  }
  .ai-panel-context { display: flex; flex-direction: column; gap: 6px; }
  .ai-panel-context .context-empty { font-size: 12.5px; color: var(--ink-soft); font-style: italic; margin: 0; }
  .ai-panel-context .context-chip {
    font-size: 12px; background: var(--panel-dim); padding: 6px 9px; border-radius: 2px; color: var(--ink);
    border: 1px solid var(--line);
  }
  .ai-panel-context .context-chip b { color: var(--brand); font-weight: 700; }
  .ai-panel-context .context-label {
    font-size: 10.5px; letter-spacing: .08em; color: var(--ink-soft); font-weight: 700; margin: 0 0 2px;
    text-transform: uppercase;
  }

  .compare-tab-head h2 {
    font-size: 18px; margin: 0 0 4px; font-weight: 700; color: var(--ink); letter-spacing: -.005em;
  }
  .compare-tab-sub { font-size: 13px; color: var(--ink-soft); margin: 0 0 18px; }

  /* ---------- 設定タブ ---------- */
  .settings-block { background: var(--panel); border: 1px solid var(--line); padding: 18px 20px; margin-bottom: 16px; }
  .settings-block h3 { font-size: 14px; font-weight: 700; color: var(--ink); margin: 0 0 6px; }
  .settings-note { font-size: 12.5px; color: var(--ink-soft); margin: 0 0 12px; line-height: 1.6; }
  .settings-value {
    font-family: "SFMono-Regular", ui-monospace, "SF Mono", Consolas, monospace; font-size: 15px; font-weight: 700;
    color: var(--brand); background: var(--brand-soft); display: inline-block; padding: 6px 12px; border-radius: 2px; margin: 0;
  }
  .settings-row { display: flex; gap: 10px; }
  .settings-row input[type="password"] {
    flex: 1; height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 2px;
    background: var(--page); color: var(--ink); font-size: 14px;
  }
  .settings-row input[type="password"]:focus { outline: none; border-color: var(--brand); }
  .settings-block button {
    background: linear-gradient(135deg, var(--brand), var(--link-fill)); color: var(--on-brand); border: none;
    padding: 10px 18px; border-radius: 2px; font-size: 13px; font-weight: 700; letter-spacing: .02em; cursor: pointer;
    white-space: nowrap; transition: filter .15s;
  }
  .settings-block button:hover { filter: brightness(1.12); }
  .settings-status { font-size: 12px; color: var(--link); margin: 10px 0 0; min-height: 1.2em; }

  /* ---------- お気に入り☆ ---------- */
  .card .star-btn {
    position: absolute; top: 10px; left: 10px; background: none; border: none; padding: 0;
    font-size: 18px; line-height: 1; cursor: pointer; color: var(--ink-soft); z-index: 1;
  }
  .card .star-btn.active { color: #C8961E; }
  .card .row1 { padding-left: 22px; }

  /* ---------- ハンバーガーメニュー（スマホ・タブレット幅） ---------- */
  /* ---------- 入口の合言葉ゲート（簡易・クライアント完結） ---------- */
  .auth-gate {
    position: fixed; inset: 0; z-index: 100; background: var(--page);
    display: flex; align-items: center; justify-content: center; padding: 20px;
  }
  .auth-box {
    width: 100%; max-width: 340px; background: var(--panel); border: 1px solid var(--line);
    border-top: 3px solid transparent; border-image: linear-gradient(90deg, var(--brand), var(--link-fill)) 1;
    padding: 28px 26px;
  }
  .auth-eyebrow { font-size: 11px; letter-spacing: .12em; color: var(--link); font-weight: 700; text-transform: uppercase; }
  .auth-box h2 { font-size: 17px; font-weight: 700; color: var(--ink); margin: 8px 0 10px; }
  .auth-sub { font-size: 12px; color: var(--ink-soft); margin: 0 0 16px; line-height: 1.6; }
  .auth-box input[type="password"] {
    width: 100%; height: 42px; padding: 0 12px; border: 1px solid var(--line); border-radius: 2px;
    background: var(--page); color: var(--ink); font-size: 14px; margin-bottom: 10px;
  }
  .auth-box input[type="password"]:focus { outline: none; border-color: var(--brand); }
  .auth-box button {
    width: 100%; background: linear-gradient(135deg, var(--brand), var(--link-fill)); color: var(--on-brand); border: none; padding: 11px;
    border-radius: 2px; font-size: 13px; font-weight: 700; letter-spacing: .02em; cursor: pointer; transition: filter .15s;
  }
  .auth-box button:hover { filter: brightness(1.12); }
  .auth-error { font-size: 12px; color: #B3261E; margin: 10px 0 0; min-height: 1.2em; }
  .hamburger-btn { display: none; }
  .nav-overlay { display: none; }
  /* ---------- 1720px未満〜1300px超：3カラムのまま、サイドコラムを縮めて詰まりを回避 ---------- */
  @media (max-width: 1720px) and (min-width: 1301px) {
    .page-shell { gap: 0; padding: 0 16px; }
    .side-nav { flex: 0 1 176px; padding-right: 14px; margin-right: 14px; }
    .right-rail { flex: 0 1 268px; padding-left: 14px; margin-left: 14px; }
    .page-shell .app { flex: 1 1 auto; min-width: 0; }
  }
  @media (max-width: 1300px) {
    .page-shell { flex-direction: column; max-width: none; padding: 0; gap: 0; }
    .page-shell .app { flex: none; margin: 0 auto; max-width: 880px; }

    .hamburger-btn {
      display: flex; align-items: center; justify-content: center;
      position: fixed; top: 14px; left: 16px; z-index: 21;
      width: 40px; height: 40px; border-radius: 2px;
      background: var(--panel); border: 1px solid var(--line); color: var(--ink);
      font-size: 17px; cursor: pointer;
    }
    .nav-overlay.show { display: block; position: fixed; inset: 0; background: rgba(10,18,28,0.45); z-index: 19; }

    .side-nav {
      position: fixed; top: 0; left: 0; z-index: 20; height: 100vh; width: 240px;
      background: var(--page); border-right: 1px solid var(--line); margin-right: 0;
      padding: 70px 16px 16px; flex-direction: column; gap: 2px;
      transform: translateX(-100%); transition: transform .2s ease; overflow-y: auto;
    }
    .side-nav.open { transform: translateX(0); box-shadow: 10px 0 30px rgba(10,18,28,0.18); }

    .right-rail {
      flex: none; position: static; width: 100%; max-width: 880px; margin: 30px auto 0; padding: 20px;
      border-left: none; border-top: 1px solid var(--line); box-sizing: border-box;
      max-height: none; overflow-y: visible;
    }

    /* 固定ハンバーガーボタン(左上・高さ40px)とヘッダー文字が重ならないよう上に余白を確保 */
    .page-shell .app { padding-top: 62px; }
  }
  @media (max-width: 640px) {
    .page-shell .app { padding-top: 58px; }
  }

  header.top {
    padding: 28px 0 20px; border-bottom: 2px solid transparent;
    border-image: linear-gradient(90deg, var(--brand), var(--link) 45%, transparent 92%) 1;
  }
  .eyebrow { font-size: 11px; letter-spacing: .12em; color: var(--link); font-weight: 700; text-transform: uppercase; }
  .logo-home-btn {
    background: none; border: none; padding: 0; margin: 10px 0 8px; cursor: pointer;
    display: inline-block; line-height: 0;
  }
  .logo-img { height: clamp(32px, 5vw, 44px); width: auto; display: block; }
  h1 { margin: 0; }
  p.deck { margin: 0 0 18px; color: var(--ink-soft); font-size: 14px; max-width: 70ch; }
  .stat-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0; font-size: 13px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
  .stat-row span { padding: 2px 20px; border-left: 1px solid var(--line); }
  .stat-row span:first-child { padding-left: 0; border-left: none; }
  .stat-row b { color: var(--ink); font-weight: 700; }

  .howto {
    margin-top: 20px; background: var(--panel); border: 1px solid var(--line);
    border-left: 4px solid transparent; border-image: linear-gradient(180deg, var(--brand), var(--link-fill)) 1;
    font-size: 13px; color: var(--ink-soft); border-radius: 0;
  }
  .howto b { color: var(--link); }
  .howto-toggle {
    width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px;
    background: none; border: none; padding: 10px 16px; font-size: 13px; font-family: inherit;
    color: var(--link); cursor: pointer; text-align: left;
  }
  .howto-chevron { transition: transform .15s; color: var(--ink-soft); font-size: 11px; }
  .howto-toggle[aria-expanded="true"] .howto-chevron { transform: rotate(180deg); }
  .howto-body { padding: 0 16px 14px; line-height: 1.7; }
  .howto-body[hidden] { display: none; }

  /* ---------- Idea finder ---------- */
  .idea-panel {
    margin-top: 20px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-top: 3px solid transparent;
    border-image: linear-gradient(90deg, var(--brand), var(--link) 70%, var(--link-fill)) 1;
    border-radius: 0;
    padding: 20px 22px;
    box-shadow: none;
  }
  .idea-panel .idea-title {
    font-size: 13.5px; font-weight: 700; color: var(--ink); letter-spacing: .01em;
    margin-bottom: 6px;
  }
  .idea-panel p.idea-sub { margin: 0 0 14px; font-size: 12.5px; color: var(--ink-soft); }
  .idea-row { display: flex; gap: 10px; align-items: center; }
  .idea-row input[type="text"] {
    flex: 1; height: 42px;
    padding: 0 12px; border: 1px solid var(--line); border-radius: 2px;
    background: var(--page); color: var(--ink); font-size: 14px;
  }
  .idea-row input[type="text"]:focus { outline: none; border-color: var(--brand); }
  .idea-row button {
    flex: none; background: linear-gradient(135deg, var(--brand), var(--link-fill)); color: var(--on-brand); border: none;
    padding: 10px 20px; border-radius: 2px; font-size: 13px; font-weight: 700; letter-spacing: .02em; cursor: pointer;
    white-space: nowrap; transition: filter .15s;
  }
  .idea-row button:hover { filter: brightness(1.12); }
  .idea-results { margin-top: 16px; display: none; }
  .idea-results.show { display: block; }
  .idea-results .idea-note { font-size: 12.5px; color: var(--ink-soft); margin-bottom: 10px; }

  .ai-panel {
    background: var(--panel); border: 1px solid var(--line);
    border-top: 3px solid transparent; border-image: linear-gradient(90deg, var(--link-fill), var(--link) 70%, var(--brand)) 1;
    border-radius: 0;
    padding: 18px; display: flex; flex-direction: column; gap: 12px;
  }
  .ai-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
  .ai-panel-title { font-weight: 700; font-size: 13.5px; color: var(--ink); letter-spacing: .01em; }
  .ai-panel-badge {
    font-size: 10px; letter-spacing: .04em; color: var(--link); background: var(--link-soft);
    padding: 2px 7px; border-radius: 2px; white-space: nowrap; text-transform: uppercase; font-weight: 700;
  }
  .ai-panel-sub { font-size: 12px; color: var(--ink-soft); margin: 0; line-height: 1.6; }
  .ai-questions { display: flex; flex-direction: column; gap: 5px; }
  .ai-questions .ai-q-label { font-size: 11px; font-weight: 700; color: var(--link); margin-top: 8px; letter-spacing: .01em; }
  .ai-questions textarea, .ai-questions input[type="text"] {
    min-height: 42px; resize: vertical; padding: 8px 10px; border: 1px solid var(--line); border-radius: 2px;
    background: var(--page); color: var(--ink); font-size: 13px; font-family: inherit;
  }
  .ai-questions textarea:focus, .ai-questions input[type="text"]:focus { outline: none; border-color: var(--brand); }
  .ai-questions textarea#aiFollowup { min-height: 54px; }
  .ai-questions input[type="text"] { height: 38px; min-height: 0; }
  .ai-panel button#aiCopyBtn {
    background: linear-gradient(135deg, var(--link-fill), var(--ink)); color: var(--on-brand); border: none; padding: 10px; border-radius: 2px;
    font-size: 13px; font-weight: 700; letter-spacing: .02em; cursor: pointer; transition: filter .15s;
  }
  .ai-panel button#aiCopyBtn:hover { filter: brightness(1.15); }
  .ai-panel-status { font-size: 12px; color: var(--link); margin: 0; min-height: 1.2em; }
  .manual-copy-box {
    display: none; width: 100%; min-height: 90px; margin-top: 6px; padding: 8px 10px;
    border: 1px solid var(--brand); border-radius: 2px; background: var(--panel-dim); color: var(--ink);
    font-size: 12px; font-family: "SFMono-Regular", ui-monospace, "SF Mono", Consolas, monospace; resize: vertical;
    box-sizing: border-box;
  }

  /* aggregate breakdown summary above the match cards */
  .idea-summary {
    background: var(--panel-dim); border: 1px solid var(--line); border-radius: 0; padding: 12px 16px; margin-bottom: 14px;
    font-size: 12.5px; color: var(--ink-soft); display: flex; flex-direction: column; gap: 6px;
  }
  .idea-summary b { color: var(--ink); }
  .idea-summary .dist-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
  .idea-summary .dist-pill {
    font-size: 11.5px; padding: 3px 9px; border-radius: 2px; background: var(--panel);
    border: 1px solid var(--line); white-space: nowrap; color: var(--ink-soft);
    font-family: inherit; cursor: pointer; transition: background .12s, color .12s, border-color .12s;
  }
  .idea-summary .dist-pill:hover { border-color: var(--brand); color: var(--ink); }
  .idea-summary .dist-pill.active { background: linear-gradient(135deg, var(--link-fill), var(--brand)); border-color: var(--link-fill); color: var(--on-brand); font-weight: 700; }
  .idea-summary .dist-clear {
    align-self: flex-start; font-size: 11px; background: none; border: none; color: var(--link);
    cursor: pointer; text-decoration: underline; padding: 2px 0; font-family: inherit;
  }

  .match-card {
    display: grid; grid-template-columns: 40px 1fr; gap: 14px;
    padding: 16px 0; border-bottom: 1px solid var(--line);
  }
  .match-card:last-child { border-bottom: none; }
  .match-card .match-rank {
    font-size: 12px; color: var(--link); font-weight: 700; text-align: center; padding-top: 2px;
    font-variant-numeric: tabular-nums;
  }
  .match-card .match-rank small { display: block; font-size: 9.5px; color: var(--ink-soft); font-weight: 400; margin-top: 4px; }
  .match-card .strength-bar {
    width: 28px; height: 4px; border-radius: 0; background: var(--panel-dim);
    margin: 6px auto 0; overflow: hidden;
  }
  .match-card .strength-fill { height: 100%; background: linear-gradient(90deg, var(--brand), var(--link)); border-radius: 0; }
  .match-card .match-head {
    display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; flex-wrap: wrap;
  }
  .match-card .match-name { font-weight: 700; font-size: 14.5px; color: var(--ink); }
  .match-card .match-industry {
    font-size: 10.5px; color: var(--ink-soft); font-weight: 600; background: var(--panel-dim);
    padding: 2px 7px; border-radius: 2px; margin-left: 6px; letter-spacing: .02em;
  }
  .match-card .bm-flow { margin: 8px 0; }
  .match-card .match-budget { font-size: 11.5px; color: var(--link); margin-bottom: 6px; font-variant-numeric: tabular-nums; }
  .match-card .match-note { font-size: 12.5px; color: var(--ink-soft); margin-bottom: 8px; }
  .match-card .match-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 8px; }
  .match-card button.add-btn {
    background: transparent; border: 1px solid var(--link); color: var(--link);
    padding: 5px 12px; border-radius: 2px; font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap;
  }
  .match-card button.add-btn:hover { background: var(--link-soft); }
  .match-card button.add-btn:disabled { opacity: .4; cursor: default; }

  /* ---------- Toolbar ---------- */
  .toolbar {
    position: sticky; top: 0; z-index: 6;
    background: var(--page);
    border-bottom: 1px solid var(--line);
    padding: 14px 0; margin-top: 24px;
    display: flex; flex-direction: column; gap: 10px;
  }
  .search-row { display: flex; gap: 10px; align-items: center; }
  .search-row input[type="search"] {
    flex: 1; min-width: 0; padding: 9px 12px; border: 1px solid var(--line); border-radius: 2px;
    background: var(--panel); color: var(--ink); font-size: 14px;
  }
  .search-row input[type="search"]:focus { outline: none; border-color: var(--brand); }
  .search-row select {
    padding: 9px 10px; border: 1px solid var(--line); border-radius: 2px;
    background: var(--panel); color: var(--ink); font-size: 13px;
  }
  .result-count { font-size: 12px; color: var(--ink-soft); white-space: nowrap; font-variant-numeric: tabular-nums; }

  .chip-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
  .chip-row .chip-label { font-size: 11px; letter-spacing: .05em; color: var(--ink-soft); margin-right: 2px; text-transform: uppercase; font-weight: 600; }
  .chip {
    font-size: 12px; padding: 5px 11px; border-radius: 2px; border: 1px solid var(--line);
    background: transparent; color: var(--ink-soft); cursor: pointer; white-space: nowrap; font-weight: 500;
    transition: background .12s, color .12s, border-color .12s;
  }
  .chip:hover { border-color: var(--brand); color: var(--ink); }
  .chip.active { background: linear-gradient(135deg, var(--link-fill), var(--brand)); border-color: var(--link-fill); color: var(--on-brand); font-weight: 700; }
  .chip.clear-all { color: var(--link); border-color: transparent; text-decoration: underline; }

  /* ---------- Grid / cards ---------- */
  .grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); gap: 1px;
    margin-top: 20px; background: var(--line); border: 1px solid var(--line);
  }
  .card {
    background: var(--panel); border: none; border-radius: 0; padding: 16px;
    box-shadow: none; display: flex; flex-direction: column; gap: 9px; cursor: pointer; position: relative;
  }
  .card.selected { box-shadow: inset 0 0 0 3px var(--brand), 0 0 0 5px var(--brand-soft); }
  .card .row1 { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
  .card .name { font-weight: 700; font-size: 14.5px; line-height: 1.4; color: var(--ink); }
  .card .code {
    font-size: 11.5px; color: var(--ink-soft); font-variant-numeric: tabular-nums;
    font-family: "SFMono-Regular", ui-monospace, "SF Mono", Consolas, monospace;
  }
  .card .industry-pill {
    font-size: 10.5px; padding: 2px 7px; border-radius: 2px; background: var(--panel-dim);
    color: var(--ink-soft); white-space: nowrap; align-self: flex-start; font-weight: 600; letter-spacing: .01em;
  }
  .earnings-badge {
    font-size: 10.5px; padding: 2px 7px; border-radius: 2px; background: var(--brand-soft);
    color: var(--brand); white-space: nowrap; font-weight: 700; letter-spacing: .01em; margin-left: 6px;
  }
  .card .note { font-size: 13px; color: var(--ink-soft); }
  .card .overview { font-size: 12.5px; color: var(--ink); line-height: 1.55; }
  .bm-flow { display: flex; align-items: center; gap: 6px; font-size: 12px; }
  .bm-flow .bm-box {
    background: var(--panel-dim); border-radius: 0; padding: 5px 8px; flex: 1;
    color: var(--ink); line-height: 1.35;
  }
  .bm-flow .bm-box.growth {
    background: linear-gradient(135deg, var(--brand-soft), transparent);
    color: var(--brand); font-weight: 600; border-left: 2px solid var(--brand);
  }
  .bm-flow .bm-arrow { color: var(--ink-soft); flex: none; }
  .card .budget-line { font-size: 11.5px; color: var(--link); font-variant-numeric: tabular-nums; }
  .card .meta-line { font-size: 11px; color: var(--ink-soft); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
  .card .meta-line .stock { font-variant-numeric: tabular-nums; font-family: "SFMono-Regular", ui-monospace, monospace; }
  .card .meta-line .meta-sep { opacity: .5; }
  .card .meta-line .site-link { color: var(--link); text-decoration: none; }
  .card .meta-line .site-link:hover { text-decoration: underline; }
  .card .news-line { font-size: 11px; color: var(--ink-soft); background: var(--panel-dim); padding: 5px 8px; border-radius: 0; }
  .card .tags { display: flex; flex-wrap: wrap; gap: 5px; }
  .card .tag-pill { font-size: 10.5px; padding: 2px 7px; border-radius: 2px; background: var(--brand-soft); color: var(--brand); white-space: nowrap; font-weight: 600; letter-spacing: .01em; }
  .card .check {
    position: absolute; top: 12px; right: 12px; width: 18px; height: 18px; border-radius: 2px;
    border: 1.5px solid var(--line); display: flex; align-items: center; justify-content: center;
    font-size: 12px; color: transparent; background: var(--panel);
  }
  .card.selected .check { background: linear-gradient(135deg, var(--brand), var(--link-fill)); border-color: var(--brand); color: var(--on-brand); }

  .empty-state { text-align: center; padding: 60px 20px; color: var(--ink-soft); font-size: 14px; background: var(--panel); }

  /* ---------- Compare tray ---------- */
  .tray {
    position: fixed; left: 50%; transform: translateX(-50%) translateY(120%); bottom: 16px; z-index: 8;
    background: linear-gradient(135deg, var(--link-fill), var(--ink)); color: #FFFFFF; border-radius: 2px; padding: 10px 14px;
    display: flex; align-items: center; gap: 14px; box-shadow: 0 4px 16px rgba(15,34,51,0.25);
    transition: transform .22s ease; width: calc(100% - 32px); max-width: 640px;
  }
  .tray.show { transform: translateX(-50%) translateY(0); }
  .tray .tray-label { font-size: 13px; white-space: nowrap; }
  .tray .tray-chips { display: flex; gap: 6px; flex-wrap: wrap; }
  .tray .tray-chip { font-size: 12px; background: rgba(255,255,255,0.14); padding: 3px 8px; border-radius: 2px; white-space: nowrap; }
  .tray button.compare-btn {
    background: linear-gradient(135deg, var(--brand), #4F93D9); color: #FFFFFF; border: none; padding: 8px 16px; border-radius: 2px;
    font-size: 13px; font-weight: 700; cursor: pointer; white-space: nowrap; transition: filter .15s;
  }
  .tray button.compare-btn:hover { filter: brightness(1.1); }
  .tray button.clear-btn {
    background: transparent; border: none; color: #FFFFFF; opacity: .7; font-size: 12px;
    cursor: pointer; text-decoration: underline; white-space: nowrap;
  }

  /* ---------- Compare table (used in 比較リスト tab) ---------- */
  .compare-table-wrap { overflow-x: auto; }
  table.compare { border-collapse: collapse; width: 100%; min-width: 620px; font-size: 13px; }
  table.compare th, table.compare td { border: 1px solid var(--line); padding: 10px 12px; text-align: left; vertical-align: top; }
  table.compare th.attr-col { width: 120px; background: var(--panel-dim); font-size: 11px; color: var(--ink-soft); letter-spacing: .04em; font-weight: 700; text-transform: uppercase; }
  table.compare th.co-col { background: var(--panel-dim); font-size: 13.5px; color: var(--ink); font-weight: 700; }
  table.compare th.co-col .co-code {
    font-size: 11px; color: var(--ink-soft); font-weight: 400; display: block; margin-top: 2px;
    font-variant-numeric: tabular-nums; font-family: "SFMono-Regular", ui-monospace, monospace;
  }
  table.compare td .tag-pill { display: inline-block; font-size: 10.5px; padding: 2px 7px; border-radius: 2px; background: var(--brand-soft); color: var(--brand); margin: 2px 4px 0 0; font-weight: 600; }
  table.compare td .growth-cell { color: var(--link); font-weight: 600; }
  table.compare td .asof { font-size: 11px; color: var(--ink-soft); }
  .seg-bar { display: flex; height: 8px; border-radius: 0; overflow: hidden; margin-bottom: 6px; background: var(--panel-dim); min-width: 160px; }
  .seg-seg { height: 100%; position: relative; }
  .seg-seg::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(255,255,255,0.32), rgba(255,255,255,0)); }
  .seg-legend { display: flex; flex-direction: column; gap: 2px; font-size: 11.5px; }
  .seg-legend .seg-item { display: flex; align-items: center; gap: 5px; }
  .seg-legend .seg-item i { width: 8px; height: 8px; border-radius: 0; display: inline-block; flex: none; }
  table.compare td .sh-pct { color: var(--ink-soft); font-variant-numeric: tabular-nums; }
  .compare-empty { color: var(--ink-soft); font-size: 13.5px; padding: 20px 0; }

  footer.foot { margin-top: 60px; padding-top: 20px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--ink-soft); }

  @media (max-width: 640px) {
    .app { padding: 0 14px 130px; }
    header.top { padding: 22px 0 16px; }
    .search-row { flex-wrap: wrap; }
    .search-row select { flex: 1; }
    .idea-row { flex-direction: column; }
    .idea-row button { align-self: stretch; padding: 12px; }
    .match-card { grid-template-columns: 1fr; }
    .match-card .match-rank { display: none; }
    .tray {
      flex-direction: column; align-items: stretch; gap: 8px; width: calc(100% - 24px);
      padding: 12px 14px;
    }
    .tray .tray-label { text-align: center; }
    .tray .tray-chips { justify-content: center; }
    .tray button.compare-btn { padding: 11px; }
    .tray button.clear-btn { text-align: center; padding: 4px; }
  }
  @media (max-width: 420px) {
    .stat-row span { padding: 2px 12px; }
  }

  /* ---------- 壁打ちトーク画面（履歴＋メモ） ---------- */
  .talk-shell { display: flex; border: 1px solid var(--line); background: var(--panel); min-height: 560px; }
  .talk-history {
    flex: 0 0 240px; border-right: 1px solid var(--line); display: flex; flex-direction: column;
    background: var(--panel-dim);
  }
  .talk-history-head {
    padding: 14px 14px 10px; display: flex; align-items: center; justify-content: space-between;
    border-bottom: 1px solid var(--line);
  }
  .talk-history-head span { font-size: 11px; letter-spacing: .06em; color: var(--ink-soft); font-weight: 700; text-transform: uppercase; }
  .talk-new-btn {
    font-size: 11.5px; font-weight: 700; color: var(--on-brand); background: linear-gradient(135deg, var(--brand), var(--link-fill)); border: none;
    border-radius: 2px; padding: 5px 10px; cursor: pointer; white-space: nowrap; transition: filter .15s;
  }
  .talk-new-btn:hover { filter: brightness(1.12); }
  .talk-history-sync { display: flex; gap: 6px; padding: 8px 14px; border-bottom: 1px solid var(--line); }
  .talk-history-sync button {
    flex: 1; font-size: 11px; font-weight: 600; color: var(--link); background: var(--panel);
    border: 1px solid var(--line); border-radius: 2px; padding: 5px 6px; cursor: pointer;
  }
  .talk-history-sync button:hover { border-color: var(--brand); color: var(--brand); }
  .talk-sync-status { font-size: 10.5px; color: var(--ink-soft); padding: 0 14px 8px; margin: 0; line-height: 1.5; min-height: 0; }
  .talk-switch-user { padding: 0 14px 8px; margin: 0; }
  .talk-switch-link { background: none; border: none; color: var(--link); font-size: 10.5px; text-decoration: underline; cursor: pointer; padding: 0; font-family: inherit; }
  .talk-session-list { flex: 1; overflow-y: auto; }
  .talk-session-item {
    padding: 10px 14px; border-bottom: 1px solid var(--line); cursor: pointer; position: relative;
    border-left: 2px solid transparent;
  }
  .talk-session-item:hover { background: var(--panel); }
  .talk-session-item.active { background: var(--panel); border-left-color: var(--brand); }
  .talk-session-auto {
    display: inline-block; font-size: 9.5px; font-weight: 700; letter-spacing: .03em; color: var(--link);
    background: var(--link-soft); border-radius: 2px; padding: 1px 5px; margin-bottom: 3px; text-transform: uppercase;
  }
  .talk-session-title { font-size: 12.5px; font-weight: 700; color: var(--ink); margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 20px; }
  .talk-session-meta { font-size: 10.5px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
  .talk-session-del {
    position: absolute; top: 8px; right: 8px; width: 18px; height: 18px; border: none; background: none;
    color: var(--ink-soft); font-size: 13px; cursor: pointer; line-height: 1; display: none;
  }
  .talk-session-item:hover .talk-session-del { display: block; }
  .talk-session-del:hover { color: var(--link-fill); }
  .talk-history-empty { padding: 16px 14px; font-size: 12px; color: var(--ink-soft); }

  .talk-main { flex: 1; min-width: 0; display: flex; flex-direction: column; padding: 18px 22px; gap: 12px; }
  .talk-title-input {
    font-size: 16px; font-weight: 700; color: var(--ink); border: none; border-bottom: 1px solid var(--line);
    padding: 0 0 8px; background: transparent; width: 100%;
  }
  .talk-title-input:focus { outline: none; border-color: var(--brand); }
  .talk-context { display: flex; flex-wrap: wrap; gap: 6px; }
  .talk-context .context-chip { font-size: 11.5px; }
  .talk-attach-row { display: flex; align-items: center; gap: 10px; }
  .talk-attach-btn {
    width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel);
    color: var(--link); font-size: 18px; font-weight: 700; cursor: pointer; display: flex; align-items: center;
    justify-content: center; line-height: 1; flex: none; padding: 0;
    transition: background .12s, color .12s, border-color .12s, transform .12s;
  }
  .talk-attach-btn:hover { border-color: var(--brand); color: var(--brand); }
  .talk-attach-btn.active { background: var(--brand); color: var(--on-brand); border-color: var(--brand); transform: rotate(45deg); }
  .talk-attach-label { font-size: 12px; color: var(--ink-soft); }
  .talk-financials-form { border: 1px solid var(--line); border-top: 2px solid var(--brand); padding: 14px 16px; background: var(--panel-dim); }
  .talk-fin-upload-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px dashed var(--line); }
  .talk-fin-upload-btn {
    display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: 2px;
    border: 1px solid var(--brand); color: var(--on-brand); font-size: 12.5px; font-weight: 700; cursor: pointer;
    background: linear-gradient(135deg, var(--brand), var(--link-fill)); transition: filter .12s;
  }
  .talk-fin-upload-btn:hover { filter: brightness(1.1); }
  .talk-fin-upload-hint { font-size: 11px; color: var(--ink-soft); }
  .talk-fin-upload-status { font-size: 12px; color: var(--link); flex-basis: 100%; }
  .talk-fin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; margin-bottom: 10px; }
  .talk-fin-grid label { display: block; font-size: 11px; font-weight: 700; color: var(--link); margin-bottom: 3px; }
  .talk-fin-grid input {
    width: 100%; height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: 2px;
    background: var(--panel); color: var(--ink); font-size: 13px;
  }
  .talk-fin-grid input:focus { outline: none; border-color: var(--brand); }
  .talk-fin-summary {
    font-size: 12.5px; color: var(--ink); background: var(--panel); border: 1px solid var(--line);
    padding: 10px 12px; margin-bottom: 10px; line-height: 1.8;
  }
  .talk-fin-summary:empty { display: none; }
  .talk-fin-summary b { color: var(--brand); }
  .talk-fin-actions { display: flex; gap: 10px; flex-wrap: wrap; }
  .talk-fin-actions button {
    background: linear-gradient(135deg, var(--brand), var(--link-fill)); color: var(--on-brand); border: none;
    padding: 9px 16px; border-radius: 2px; font-size: 12.5px; font-weight: 700; cursor: pointer; transition: filter .15s;
  }
  .talk-fin-actions button:hover { filter: brightness(1.12); }
  .talk-fin-actions button.talk-fin-advice-btn { background: linear-gradient(135deg, var(--link-fill), var(--ink)); }
  .talk-fin-status { font-size: 12px; color: var(--link); margin: 8px 0 0; min-height: 1.2em; }
  .talk-memo-label, .talk-q-label {
    font-size: 11px; font-weight: 700; color: var(--link); letter-spacing: .01em; margin-top: 4px; display: block;
  }
  textarea.talk-memo {
    min-height: 120px; resize: vertical; padding: 10px 12px; border: 1px solid var(--line); border-radius: 2px;
    background: var(--page); color: var(--ink); font-size: 13.5px; font-family: inherit; line-height: 1.6; width: 100%;
  }
  .talk-q-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
  .talk-q-grid textarea, .talk-q-grid input[type="text"] {
    padding: 8px 10px; border: 1px solid var(--line); border-radius: 2px; background: var(--page);
    color: var(--ink); font-size: 13px; font-family: inherit; width: 100%;
  }
  .talk-q-grid textarea { resize: vertical; }
  textarea.talk-memo:focus, .talk-q-grid textarea:focus, .talk-q-grid input:focus { outline: none; border-color: var(--brand); }
  .talk-actions { display: flex; align-items: center; gap: 12px; margin-top: 4px; }
  .talk-actions button {
    background: linear-gradient(135deg, var(--brand), var(--link-fill)); color: var(--on-brand); border: none; padding: 9px 18px; border-radius: 2px;
    font-size: 13px; font-weight: 700; letter-spacing: .02em; cursor: pointer; transition: filter .15s;
  }
  .talk-actions button:hover { filter: brightness(1.12); }
  .talk-copy-status { font-size: 12px; color: var(--link); }
  .talk-save-hint { font-size: 11px; color: var(--ink-soft); margin-left: auto; }
  @media (max-width: 760px) {
    .talk-shell { flex-direction: column; min-height: 0; }
    .talk-history { flex: none; max-height: 220px; border-right: none; border-bottom: 1px solid var(--line); }
    .talk-q-grid { grid-template-columns: 1fr; }
  }

  /* ---------- ヘッダー右上：ユーザーバッジ・ログアウト・管理者ボタン ---------- */
  header.top { position: relative; }
  .header-top-right { position: absolute; top: 28px; right: 0; display: flex; align-items: center; gap: 8px; }
  .user-badge { font-size: 12.5px; font-weight: 700; color: var(--ink); background: var(--panel-dim); border: 1px solid var(--line); border-radius: 2px; padding: 6px 10px; }
  .header-icon-btn {
    width: 32px; height: 32px; border-radius: 2px; border: 1px solid var(--line); background: var(--panel);
    color: var(--ink-soft); font-size: 15px; cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: border-color .12s, color .12s;
  }
  .header-icon-btn:hover { border-color: var(--brand); color: var(--brand); }
  @media (max-width: 1300px) { .header-top-right { position: static; justify-content: flex-end; margin-bottom: 10px; } }

  /* ---------- ログインゲート内フォーム（.auth-box内の要素、type属性なしのinput/buttonにも適用） ---------- */
  #login-gate .auth-box input[type="text"],
  #login-gate .auth-box input[type="password"] {
    width: 100%; height: 42px; padding: 0 12px; border: 1px solid var(--line); border-radius: 2px;
    background: var(--page); color: var(--ink); font-size: 14px;
  }
  #login-gate .auth-box input:focus { outline: none; border-color: var(--brand); }
  #login-gate .auth-box button {
    width: 100%; background: linear-gradient(135deg, var(--brand), var(--link-fill)); color: var(--on-brand); border: none; padding: 11px;
    border-radius: 2px; font-size: 13px; font-weight: 700; letter-spacing: .02em; cursor: pointer; transition: filter .15s;
  }
  #login-gate .auth-box button:hover { filter: brightness(1.12); }

  /* ---------- 分析タブ ---------- */
  .analytics-summary-row { display: flex; flex-wrap: wrap; gap: 0; margin-bottom: 16px; font-size: 13px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
  .analytics-summary-row span { padding: 2px 20px; border-left: 1px solid var(--line); }
  .analytics-summary-row span:first-child { padding-left: 0; border-left: none; }
  .analytics-summary-row b { color: var(--ink); font-weight: 700; }
  .analytics-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
  @media (max-width: 900px) { .analytics-grid { grid-template-columns: 1fr; } }
  .analytics-row { display: flex; justify-content: space-between; gap: 10px; padding: 7px 4px; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--ink); }
  .analytics-row:last-child { border-bottom: none; }
  .analytics-row b { font-variant-numeric: tabular-nums; }

  /* ---------- 直近アクティビティフィード ---------- */
  .scroll-area { max-height: 320px; overflow-y: auto; }
  .audit-row { display: flex; gap: 10px; align-items: baseline; padding: 8px 4px; border-bottom: 1px solid var(--line); font-size: 13px; }
  .audit-time { color: var(--ink-soft); white-space: nowrap; font-size: 12px; font-variant-numeric: tabular-nums; }
  .audit-user { font-weight: 700; white-space: nowrap; color: var(--ink); }
  .audit-action { color: var(--ink-soft); }

  /* ---------- ユーザー管理テーブル・モーダル ---------- */
  .table-wrap { overflow-x: auto; }
  .data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
  .data-table th, .data-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
  .data-table th { color: var(--ink-soft); font-weight: 700; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; }
  .icon-btn {
    font-size: 12px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 2px; background: var(--panel);
    color: var(--link); cursor: pointer;
  }
  .icon-btn:hover { border-color: var(--brand); color: var(--brand); }

  .modal-overlay {
    display: none; position: fixed; inset: 0; z-index: 50; background: rgba(10,18,28,0.45);
    align-items: center; justify-content: center; padding: 20px;
  }
  .modal-overlay.active { display: flex; }
  .modal { width: 100%; max-width: 560px; max-height: 80vh; overflow-y: auto; background: var(--panel); border: 1px solid var(--line); border-top: 3px solid transparent; border-image: linear-gradient(90deg, var(--brand), var(--link-fill)) 1; }
  .modal-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
  .modal-header h3 { margin: 0; font-size: 15px; font-weight: 700; color: var(--ink); }
  .modal-close { border: none; background: none; font-size: 16px; color: var(--ink-soft); cursor: pointer; }
  .modal-body { padding: 18px 20px; }

  /* ---------- 事業計画タブ ---------- */
  .bizplan-card {
    background: var(--panel); border: 1px solid var(--line); border-top: 3px solid transparent;
    border-image: linear-gradient(90deg, var(--brand), var(--link-fill)) 1; padding: 18px 20px; margin-bottom: 16px;
  }
  .bizplan-card h3 { font-size: 14px; font-weight: 700; color: var(--ink); margin: 0 0 12px; }
  .bizplan-swot-grid, .bizplan-canvas-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
  .bizplan-canvas-grid { grid-template-columns: 1fr 1fr 1fr; }
  .bizplan-swot-grid label, .bizplan-canvas-grid label {
    display: block; font-size: 11px; font-weight: 700; color: var(--link); margin-bottom: 4px;
  }
  .bizplan-swot-grid textarea, .bizplan-canvas-grid textarea {
    width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 2px; background: var(--page);
    color: var(--ink); font-size: 13px; font-family: inherit; resize: vertical; box-sizing: border-box;
  }
  .bizplan-swot-grid textarea:focus, .bizplan-canvas-grid textarea:focus { outline: none; border-color: var(--brand); }
  @media (max-width: 760px) {
    .bizplan-swot-grid { grid-template-columns: 1fr; }
    .bizplan-canvas-grid { grid-template-columns: 1fr; }
  }

  .bizplan-forecast-table { display: flex; flex-direction: column; gap: 0; }
  .bizplan-forecast-row {
    display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 10px; align-items: center;
    padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--ink);
  }
  .bizplan-forecast-row:last-child { border-bottom: none; }
  .bizplan-forecast-head { font-size: 11px; font-weight: 700; color: var(--link); text-transform: uppercase; letter-spacing: .04em; }
  .bizplan-forecast-row input[type="number"] {
    width: 100%; height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: 2px;
    background: var(--page); color: var(--ink); font-size: 13px; font-variant-numeric: tabular-nums; box-sizing: border-box;
  }
  .bizplan-forecast-row input:focus { outline: none; border-color: var(--brand); }
  .bizplan-forecast-result { font-size: 12.5px; color: var(--ink-soft); line-height: 1.8; display: block; }

  .bizplan-actions { display: flex; align-items: center; gap: 12px; }
  .bizplan-actions button {
    background: linear-gradient(135deg, var(--brand), var(--link-fill)); color: var(--on-brand); border: none; padding: 9px 18px; border-radius: 2px;
    font-size: 13px; font-weight: 700; letter-spacing: .02em; cursor: pointer; transition: filter .15s;
  }
  .bizplan-actions button:hover { filter: brightness(1.12); }
