/*
 * ユーザーサイト (レスポンシブ: スマホ / PC 両対応)
 *
 * モバイルファースト: 基本のスタイルはスマホ向けに書き、
 * 画面が広い場合の調整を @media (min-width: ...) で上書きする。
 *
 * ブレークポイント
 *   〜767px  : スマホ (基本スタイル)
 *   768px〜  : タブレット・PC  → @media (min-width: 768px)
 *   1024px〜 : PC (広め)       → @media (min-width: 1024px)
 */

/* テーマ: ロゴ (public/user/img/logo-original.png) に合わせた温かい色。クリーム色の背景・クマのこげ茶・葉の緑
 *   色を変えるときは、ここの変数を変える (直接 #xxxxxx を書かない)。株価の上げ下げ (--color-up / --color-down) などの意味のある色はテーマに含めない */
:root {
    --color-text: #3b2f25;          /* こげ茶に近い黒 */
    --color-muted: #7a6a5a;
    --color-border: #eadfcd;
    --color-bg: #faf5ec;            /* クリーム (ロゴの背景) */
    --color-surface: #fffdf8;
    --color-primary: #8b5a2b;       /* クマの茶色 (リンク・ボタン・選択中) */
    --color-primary-soft: #f6ead8;  /* 選択中の背景 */
    --color-accent: #5f8a4e;        /* 葉の緑 (ヘッダーの下線など、差し色) */
    --color-hover: #f4ecdf;         /* マウスを乗せたときの背景 */
    --color-input-border: #d9cbb4;
    --color-thead: #f5ecdd;         /* 表の見出し */
    --color-thead-text: #5c4a3a;
    --shadow: 0 1px 2px rgb(91 62 34 / .06), 0 2px 8px rgb(91 62 34 / .06);
    --font-base: "Zen Maru Gothic", system-ui, -apple-system, "Hiragino Sans", "Noto Sans JP", sans-serif;
    --color-up: #dc2626;    /* 値上がり (日本式: 赤) */
    --color-down: #16a34a;  /* 値下がり (日本式: 緑) */
    --radius: 8px;
    --gutter: 16px;
    --container: 1100px;
    --header-height: 108px; /* スマホはヘッダー2段 (1段目: サイト名・ログイン / 2段目: 検索) */
    --tap: 44px;            /* スマホで押しやすい最小サイズ */
}

/* ---------- ベース ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: var(--font-base);
    font-size: 15px;
    line-height: 1.6;
    color: var(--color-text);
    background: var(--color-bg);
    overflow-wrap: anywhere; /* 長い銘柄名などで横にはみ出さない */
}
img, svg, video { max-width: 100%; height: auto; }
a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 20px; line-height: 1.4; margin: 0 0 16px; }
h2 { font-size: 17px; line-height: 1.4; margin: 0 0 12px; }

.visually-hidden {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- レイアウト ---------- */
.container {
    width: 100%;
    max-width: var(--container);
    margin-inline: auto;
    padding-inline: max(var(--gutter), env(safe-area-inset-left)) max(var(--gutter), env(safe-area-inset-right));
}
.site-main { padding-block: 20px 40px; min-height: 60vh; }

/* ---------- ヘッダー ---------- */
/* スマホ: 2段 (サイト名 + ログイン / 検索)、PC: 1段 (サイト名 | 検索 | ログイン) */
.site-header {
    position: sticky; top: 0; z-index: 30;
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: 56px 52px;
    grid-template-areas: "brand auth" "search search";
    align-items: center;
    column-gap: 8px;
    height: var(--header-height);
    padding-inline: max(8px, env(safe-area-inset-left)) max(var(--gutter), env(safe-area-inset-right));
    background: var(--color-surface);
    border-bottom: 3px solid var(--color-accent); /* テーマの差し色 (葉の緑) */
    box-shadow: var(--shadow);
}
.site-header__brand { grid-area: brand; display: flex; align-items: center; gap: 4px; min-width: 0; }
.site-header__logo { font-weight: 700; font-size: 18px; color: var(--color-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.site-header__logo:hover { text-decoration: none; }
/* ロゴ画像 (ハンバーガーの右、サイト名の左)。サイト名は長ければ省略 (…) */
.site-header__logo { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.site-header__logo-image { flex: none; width: 40px; height: 40px; border-radius: 8px; object-fit: cover; }
.site-header__logo-text { overflow: hidden; text-overflow: ellipsis; }

/* ヘッダーの検索ボックス */
.header-search { grid-area: search; display: flex; padding-bottom: 8px; padding-left: 8px; }
/* 入力欄 + 左端の虫眼鏡アイコン (アイコンを入力欄の上に重ね、その分だけ文字を右にずらす) */
.header-search__field { position: relative; flex: 1; min-width: 0; display: flex; }
.header-search__icon {
    position: absolute; left: 9px; top: 50%; transform: translateY(-50%);
    font-size: 20px;
    color: var(--color-muted);
    pointer-events: none; /* アイコンを押しても入力欄に文字を打てるように */
}
.header-search__field:focus-within .header-search__icon { color: var(--color-primary); }
.header-search__input {
    min-height: 40px;
    padding-left: 36px;
    border-radius: 6px 0 0 6px;
    border-right: 0;
}
.header-search__input:focus { outline: 2px solid var(--color-primary); outline-offset: -1px; }
/* 最近の検索 (検索欄の下に出す。public/user/js/search-history.js) */
.search-history { position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 50; padding: 8px 0; border: 1px solid var(--color-border); border-radius: 8px; background: var(--color-surface); box-shadow: 0 6px 20px rgba(0, 0, 0, .12); }
.search-history__title { margin: 0 12px 4px; color: var(--color-muted); font-size: 12px; }
.search-history__list { list-style: none; margin: 0; padding: 0; }
.search-history__list li { display: flex; align-items: center; }
.search-history__word { flex: 1; min-width: 0; min-height: auto; padding: 8px 12px; border: 0; border-radius: 0; background: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--color-text); font: inherit; text-align: left; cursor: pointer; }
.search-history__word:hover, .search-history__word:focus-visible { background: var(--color-primary-soft); text-decoration: none; }
.search-history__remove { flex-shrink: 0; min-height: auto; width: 36px; height: 36px; padding: 0; border: 0; background: none; color: var(--color-muted); font-size: 18px; cursor: pointer; }
.search-history__remove:hover { color: var(--color-text); }
.search-history__clear { display: block; min-height: auto; margin: 4px 12px 0 auto; padding: 4px 0; border: 0; background: none; color: var(--color-muted); font: inherit; font-size: 12px; cursor: pointer; text-decoration: underline; }
.header-search .header-search__button {
    flex-shrink: 0;
    min-height: 40px;
    padding: 0 16px;
    border-radius: 0 6px 6px 0;
}

/* ヘッダー右: サインアップ・ログイン / ログアウト */
.site-header__auth { grid-area: auth; display: flex; align-items: center; gap: 6px; }
.site-header__auth form { margin: 0; }

/* サイドバー開閉ボタン (三本線) */
.sidebar-toggle {
    flex-shrink: 0;
    width: var(--tap); height: var(--tap);
    display: grid; place-items: center;
    padding: 0; border: 0; border-radius: 6px; background: none; cursor: pointer;
    color: var(--color-text);
}
.sidebar-toggle:hover { background: var(--color-hover); }
.sidebar-toggle__bar,
.sidebar-toggle__bar::before,
.sidebar-toggle__bar::after {
    display: block; width: 20px; height: 2px; background: currentColor; border-radius: 1px;
}
.sidebar-toggle__bar { position: relative; }
.sidebar-toggle__bar::before,
.sidebar-toggle__bar::after { content: ""; position: absolute; left: 0; }
.sidebar-toggle__bar::before { top: -6px; }
.sidebar-toggle__bar::after { top: 6px; }

/* ---------- 本体: サイドバー + メイン ---------- */
.site-body { display: flex; align-items: flex-start; }
.site-content { flex: 1; min-width: 0; }
/* 本文と右カラム (最近見た銘柄・スレッド)。狭い画面は本文の下、広い画面 (1200px〜) は本文の右 */
.recent-column { display: grid; gap: 12px; padding: 0 16px 24px; align-content: start; }
.recent-box { display: grid; gap: 6px; padding: 12px 14px; }
.recent-box__title { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 14px; }
.recent-box__title .material-symbols-outlined { font-size: 18px; color: var(--color-primary); }
.recent-box__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.recent-box__list a { display: flex; align-items: center; gap: 6px; padding: 4px 0; font-size: 13px; color: var(--color-text); overflow: hidden; }
.recent-box__list a:hover { color: var(--color-primary); text-decoration: none; }
.recent-box__code { flex-shrink: 0; color: var(--color-muted); font-variant-numeric: tabular-nums; font-size: 12px; }
.recent-box__name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-box__list .material-symbols-outlined { flex-shrink: 0; font-size: 16px; color: var(--color-muted); }
.recent-box__empty { margin: 0; font-size: 12px; }
.recent-box__rank { flex-shrink: 0; min-width: 1.4em; color: var(--color-primary); font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.recent-box__score { flex-shrink: 0; margin-left: auto; color: var(--color-muted); font-size: 12px; }
.recent-box__more { justify-self: end; font-size: 12px; }
.recent-box__clear { justify-self: end; min-height: auto; padding: 0; border: 0; background: none; color: var(--color-muted); font: inherit; font-size: 12px; text-decoration: underline; cursor: pointer; }
@media (min-width: 1200px) {
    .site-columns { display: grid; grid-template-columns: minmax(0, 1fr) 260px; align-items: start; }
    .recent-column { position: sticky; top: calc(var(--header-height, 56px) + 16px); padding: 20px 16px 24px 0; }
}

/* ---------- サイドバー ----------
 * スマホ: 左から引き出すドロワー (html.is-sidebar-open で表示)
 * PC   : 左に常に表示。html.is-sidebar-collapsed で折りたたむ (状態はブラウザに保存)
 */
.site-sidebar {
    position: fixed; z-index: 40;
    top: 0; bottom: 0; left: 0;
    width: min(280px, 85vw);
    padding: calc(var(--header-height) + 8px) 0 calc(16px + env(safe-area-inset-bottom));
    padding-left: env(safe-area-inset-left);
    overflow-y: auto; overscroll-behavior: contain;
    background: var(--color-surface);
    border-right: 1px solid var(--color-border);
    transform: translateX(-100%);
    transition: transform .2s ease;
    visibility: hidden;
}
.is-sidebar-open .site-sidebar { transform: none; visibility: visible; box-shadow: 4px 0 24px rgb(0 0 0 / .12); }
/* ドロワー表示中はヘッダーを上に出して、閉じるボタンを押せるようにする */
.is-sidebar-open .site-header { z-index: 50; }
.is-sidebar-open body { overflow: hidden; }

.site-overlay {
    position: fixed; inset: 0; z-index: 35;
    background: rgb(0 0 0 / .35);
    opacity: 0; visibility: hidden;
    transition: opacity .2s ease;
}
.is-sidebar-open .site-overlay { opacity: 1; visibility: visible; }

.site-sidebar__heading {
    margin: 12px 0 4px; padding-inline: 20px;
    font-size: 12px; font-weight: 700; letter-spacing: .06em; color: var(--color-muted);
}
/* 見出しのあるまとまり: 見出しを押すと折りたためる */
summary.site-sidebar__heading {
    display: flex; align-items: center; justify-content: space-between;
    min-height: 32px; margin: 8px 0 0; list-style: none; cursor: pointer; user-select: none;
}
summary.site-sidebar__heading::-webkit-details-marker { display: none; }
summary.site-sidebar__heading::after {
    content: ''; width: 6px; height: 6px; margin-right: 4px;
    border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
    transform: rotate(45deg); transition: transform .15s;
}
.site-sidebar__group:not([open]) > summary.site-sidebar__heading::after { transform: rotate(-45deg); }
summary.site-sidebar__heading:hover { color: var(--color-text); }
summary.site-sidebar__heading:focus-visible { outline: 2px solid var(--color-primary); outline-offset: -2px; }
.site-sidebar__items { list-style: none; margin: 0; padding: 0; }
.site-sidebar__link {
    display: flex; align-items: center;
    font-size: 14px; /* ページ名は本文 (15px) より少し小さく */
    min-height: var(--tap);
    padding-inline: 20px;
    color: var(--color-text);
    border-left: 3px solid transparent;
}
.site-sidebar__link:hover { background: var(--color-hover); text-decoration: none; }
.site-sidebar__link[aria-current="page"] { color: var(--color-primary); font-weight: 700; background: var(--color-primary-soft); border-left-color: var(--color-primary); }

/* ---------- フッター ---------- */
/* フッター: 左に ©、右端に「当サイトについて」 */
.site-footer__inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; } /* © は中央 */
.site-footer {
    padding-block: 20px calc(20px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-muted);
    text-align: center;
}

/* ---------- 部品 ---------- */
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: calc(var(--radius) + 4px);
    box-shadow: var(--shadow);
    padding: 16px;
}
.muted { color: var(--color-muted); font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }
.up { color: var(--color-up); }
.down { color: var(--color-down); }

/* グリッド: スマホは1列、広い画面で列を増やす */
.grid { display: grid; gap: 12px; grid-template-columns: 1fr; }

/* フォーム: スマホは縦積み・全幅 */
input, select, textarea, button { font: inherit; }
input, select, textarea {
    width: 100%;
    min-height: var(--tap);
    padding: 8px 12px;
    font-size: 16px; /* 16px未満だとiPhoneで入力時に自動ズームされる */
    border: 1px solid var(--color-input-border);
    border-radius: 6px;
    background: var(--color-surface);
}
.btn, button[type="submit"] {
    display: inline-flex; align-items: center; justify-content: center;
    min-height: var(--tap);
    padding: 8px 16px;
    border: 1px solid var(--color-primary);
    border-radius: 6px;
    background: var(--color-primary);
    color: #fff;
    cursor: pointer;
}
.form-row { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.btn:hover, button[type="submit"]:hover { text-decoration: none; filter: brightness(1.05); }
.btn--sm { min-height: 36px; padding: 4px 12px; font-size: 14px; white-space: nowrap; }
.btn--ghost { background: var(--color-surface); color: var(--color-primary); }
.btn--block { width: 100%; }
input[type="checkbox"], input[type="radio"] { width: auto; min-height: auto; margin: 0; padding: 0; flex-shrink: 0; } /* 入力欄の幅・高さを当てない */

/* お知らせ (ログインしました 等) */
.flash { margin: 0 0 16px; padding: 10px 14px; border-radius: var(--radius); background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }

/* ---------- 会員登録・ログイン ---------- */
.auth-box { max-width: 420px; margin-inline: auto; }
.auth-box--left { margin-inline: 0; } /* マイページ (設定など): 他のページと同じく左寄せ */
.auth-form { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; }
.field label { font-weight: 600; font-size: 14px; }
.field input[aria-invalid="true"] { border-color: #dc2626; }
.field-error { margin: 0; color: #dc2626; font-size: 13px; }
.checkbox { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.auth-switch { text-align: center; font-size: 14px; }

/* 表: スマホでは横スクロール (列が多い表向け) */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; background: var(--color-surface); }
th, td { padding: 10px; border-bottom: 1px solid var(--color-border); text-align: left; white-space: nowrap; }
th { background: var(--color-thead); font-size: 13px; color: var(--color-thead-text); }

/*
 * 表: スマホでは1行をカード型に縦表示する (列が少なめの一覧向け)
 * 使い方: <table class="table-stack"> にして、各 <td data-label="列名"> を付ける
 */
.table-stack thead { display: none; }
.table-stack tr { display: block; padding: 8px 0; border-bottom: 1px solid var(--color-border); }
.table-stack td { display: flex; justify-content: space-between; gap: 12px; padding: 4px 12px; border: 0; white-space: normal; }
.table-stack td::before { content: attr(data-label); color: var(--color-muted); font-size: 13px; flex-shrink: 0; }

/* ページ送り */
.pagination { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; list-style: none; padding: 0; margin: 16px 0 0; }
.pagination li > * {
    display: grid; place-items: center;
    min-width: var(--tap); min-height: var(--tap);
    padding: 0 10px;
    border: 1px solid var(--color-input-border); border-radius: 6px; background: var(--color-surface);
}
.pagination li.active > * { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.pagination li.disabled > * { color: #9ca3af; }

/* 行全体をリンクにする: 行内の最初のリンクの押せる範囲を行いっぱいに広げる */
.row-link { position: relative; }
.row-link a::after { content: ""; position: absolute; inset: 0; }
.row-link:hover { background: var(--color-hover); }

/* ---------- 銘柄検索 ---------- */
.search-form { margin-bottom: 16px; display: grid; gap: 12px; }
.search-form__field { position: relative; flex: 1; min-width: 0; display: flex; } /* 最近の検索を、検索欄の下に重ねて出す */
.search-form__field > input { flex: 1; min-width: 0; }
/* 1段目: キーワード + 検索ボタン (横並び) */
.search-form__keyword { display: flex; gap: 8px; }
.search-form__keyword input { flex: 1; min-width: 0; }
.search-form__keyword button { flex-shrink: 0; }
/* 2段目: リストボックス (スマホ 2列 / PC 4列) */
.search-form__selects { display: grid; gap: 8px 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.search-form__select { display: grid; gap: 4px; min-width: 0; }
.search-form__select label { font-size: 12px; font-weight: 600; color: var(--color-muted); }
.search-form__select select { text-overflow: ellipsis; }
.search-form__clear { margin: 0; font-size: 13px; text-align: right; }
@media (min-width: 1024px) {
    .search-form__selects { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.result-count { margin: 0 0 8px; }
/* 通知のベル (ヘッダ。ユーザー名の左) と、ベルの下に開く一覧 */
.notification-bell-wrap { position: relative; flex-shrink: 0; }
.notification-bell { position: relative; display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 999px; color: var(--color-text); }
.notification-bell:hover { background: var(--color-primary-soft); text-decoration: none; }
.notification-bell .material-symbols-outlined { font-size: 24px; }
.notification-bell__count { position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 999px; background: #dc2626; color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
.notification-panel { position: absolute; top: calc(100% + 6px); right: 0; z-index: 60; width: min(360px, calc(100vw - 32px)); max-height: 70vh; overflow-y: auto; border: 1px solid var(--color-border); border-radius: 10px; background: var(--color-surface); box-shadow: 0 8px 24px rgba(0, 0, 0, .15); }
.notification-list { list-style: none; margin: 0; padding: 0; }
.notification + .notification { border-top: 1px solid var(--color-border); }
.notification__link { display: grid; gap: 2px; padding: 10px 14px; color: var(--color-text); font-size: 13px; line-height: 1.5; }
.notification__link:hover { background: var(--color-primary-soft); text-decoration: none; }
.notification.is-unread .notification__link { background: #fff7ed; }
.notification__excerpt { color: var(--color-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notification__time { font-size: 12px; }
.notification-list__empty { margin: 0; padding: 14px; font-size: 13px; }
.notification-page { padding: 0; overflow: hidden; }
/* スレッドブックマーク: 見出しの行の右のボタン・一覧の最新のパートへのリンク */
.board-head .thread-bookmark { margin-left: auto; }
.thread-bookmark__latest { flex-shrink: 0; font-size: 13px; white-space: nowrap; }
/* 銘柄分類の項目のページ: 件数と、表の右上の市場の選択ボックス */
.master-list-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin: 0 0 8px; }
.master-list-tools .result-count { margin: 0; }
.master-list-filter { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.master-list-filter label { font-weight: 700; font-size: 14px; }
.empty { text-align: center; color: var(--color-muted); padding-block: 32px; }
.stock-list { border: 1px solid var(--color-border); border-radius: var(--radius); overflow: hidden; }
.stock-list__name a { font-weight: 600; }
/* スマホ: カードの1行目に銘柄名を大きく、コードは右上に */
.stock-list .row-link { display: grid; grid-template-columns: 1fr auto; padding: 12px 0; }
.stock-list .stock-list__name { order: -1; font-size: 16px; }
.stock-list .stock-list__name::before,
.stock-list .stock-list__code::before { content: none; }
.stock-list .stock-list__code { order: -1; color: var(--color-muted); }
.stock-list .row-link td:not(.stock-list__name):not(.stock-list__code) { grid-column: 1 / -1; }

/* ---------- 銘柄詳細 ---------- */
.back-link { margin: 0 0 12px; }
/* 銘柄の詳細ページの上部 (stock/partials/header。どのタブでも): 銘柄名・コード・分類のタグ と ポートフォリオに追加 (PC は右端、スマホは下) */
.stock-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 10px 16px; margin: 0 0 12px; }
.stock-head__main { flex: 1 1 320px; min-width: 0; display: grid; gap: 8px; }
.stock-title { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin: 0; }
.stock-title__icon { flex: none; font-size: 28px; color: var(--color-primary); }
.stock-title__code {
    display: inline-block; padding: 1px 10px; border-radius: 999px;
    background: var(--color-primary-soft); color: var(--color-primary);
    font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: .04em;
}
/* 分類のタグ (市場・33業種・17業種・規模区分)。アイコンはサイドバーの「銘柄分類」と同じ。押すとその一覧へ */
.stock-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.stock-tag {
    display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px 3px 7px;
    border: 1px solid var(--color-border); border-radius: 999px; background: var(--color-surface);
    color: var(--color-text); font-size: 13px; line-height: 1.5;
}
.stock-tag .material-symbols-outlined { font-size: 17px; color: var(--color-primary); }
.stock-tag:hover { background: var(--color-hover); text-decoration: none; }
.stock-head .portfolio-add { margin: 0; }

/* ==================== タブレット・PC (768px〜) ==================== */
@media (min-width: 768px) {
    /* 銘柄検索: 表に戻す */
    .stock-list .row-link { display: table-row; padding: 0; }
    .stock-list .stock-list__code { color: inherit; font-weight: 600; }
    .stock-list .stock-list__name { font-size: inherit; }

    :root { --gutter: 24px; --header-height: 64px; }

    /* ヘッダー: 1段 (サイト名 | 検索 | ログイン)。検索は中央に最大 560px */
    .site-header {
        grid-template-columns: 1fr minmax(240px, 560px) 1fr;
        grid-template-rows: var(--header-height);
        grid-template-areas: "brand search auth";
        column-gap: 16px;
    }
    .header-search { padding: 0; }
    .site-header__auth { justify-self: end; }
    body { font-size: 15px; }
    h1 { font-size: 24px; }
    h2 { font-size: 18px; }
    .site-main { padding-block: 32px 56px; }

    /* サイドバー: 左に常に表示 (ドロワーをやめる)。折りたたむと非表示にしてメインを広げる */
    .site-sidebar {
        position: sticky; z-index: auto;
        top: var(--header-height); bottom: auto;
        flex: 0 0 var(--sidebar-width, 220px); /* 幅はユーザーが右端のつまみで変えられる (200〜400px) */
        height: calc(100vh - var(--header-height));
        padding: 12px 0;
        transform: none; visibility: visible; transition: none;
    }
    .is-sidebar-collapsed .site-sidebar { display: none; }
    .site-overlay { display: none; }
    .is-sidebar-open body { overflow: auto; }
    .site-sidebar__link { min-height: 40px; }

    .grid { grid-template-columns: repeat(2, 1fr); }

    /* フォーム: 横並び */
    .form-row { flex-direction: row; align-items: center; flex-wrap: wrap; }
    .form-row > input, .form-row > select { width: auto; flex: 1 1 200px; }

    /* カード型の表を通常の表に戻す */
    .table-stack thead { display: table-header-group; }
    .table-stack tr { display: table-row; padding: 0; border: 0; }
    .table-stack td { display: table-cell; padding: 10px; border-bottom: 1px solid var(--color-border); white-space: nowrap; }
    .table-stack td::before { content: none; }

    .pagination li > * { min-width: 36px; min-height: 36px; }
}

/* ==================== PC (1024px〜) ==================== */
@media (min-width: 1024px) {
    .grid { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- お知らせ枠 (確認メール送信 等) ---------- */
.notice p { margin: 0 0 8px; }
.notice__email { overflow-wrap: anywhere; }
.notice__list { margin: 8px 0 0; padding-left: 1.2em; color: var(--color-muted); font-size: 14px; }

/* ---------- 入力欄の補足・@付き入力欄 ---------- */
.field-help { margin: 0; color: var(--color-muted); font-size: 13px; }
.field-label { font-weight: 600; font-size: 14px; }
.field-static { margin: 0; overflow-wrap: anywhere; }
.input-prefix { display: flex; align-items: stretch; }
.input-prefix__mark {
    display: grid; place-items: center;
    padding: 0 12px;
    border: 1px solid var(--color-input-border); border-right: 0; border-radius: 6px 0 0 6px;
    background: var(--color-hover); color: var(--color-muted);
}
.input-prefix input { border-radius: 0 6px 6px 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* ---------- ヘッダー: ログイン中のユーザー ---------- */
.site-header__user {
    display: none; /* スマホでは場所がないので出さない (サイドバーの「設定」から) */
    flex-direction: column; align-items: flex-end; line-height: 1.2;
    color: var(--color-text); max-width: 180px;
}
.site-header__user:hover { text-decoration: none; }
.site-header__username { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.site-header__handle { color: var(--color-muted); font-size: 12px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
@media (min-width: 768px) {
    .site-header__user { display: flex; }
}

/* ---------- ユーザー登録完了 ---------- */
.complete-mark {
    width: 56px; height: 56px; margin: 8px auto 12px;
    display: grid; place-items: center;
    border-radius: 50%;
    background: #ecfdf5; color: #059669;
    font-size: 28px; font-weight: 700;
}
.complete-title { text-align: center; }
.complete-summary { margin: 12px 0 0; padding: 12px 0 0; border-top: 1px solid var(--color-border); display: grid; gap: 8px; }
.complete-summary > div { display: grid; grid-template-columns: 7.5em 1fr; gap: 8px; }
.complete-summary dt { color: var(--color-muted); font-size: 13px; }
.complete-summary dd { margin: 0; overflow-wrap: anywhere; }
.complete-summary__handle { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.complete-actions { display: grid; gap: 10px; margin-top: 16px; }
.notice--error { margin-bottom: 16px; border-color: #fecaca; background: #fef2f2; color: #991b1b; }
.notice--error .btn { margin-top: 4px; }

/* ---------- 一覧ページ (/list/...) ---------- */
.master-list {
    list-style: none; margin: 0; padding: 0;
    display: grid; gap: 8px; grid-template-columns: 1fr;
}
.master-list__item {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    min-height: var(--tap);
    padding: 10px 14px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
}
.master-list__name { font-weight: 600; color: var(--color-text); }
/* 銘柄分類の値ごとのアイコン (App\User\Support\ClassificationIcons) */
.master-list__name { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.master-list__icon { flex: none; font-size: 22px; color: var(--color-primary); }
.master-list__count { flex-shrink: 0; white-space: nowrap; }
@media (min-width: 768px) { .master-list { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .master-list { grid-template-columns: repeat(3, 1fr); } }

/* ---------- 運営からのお知らせ (全ページ上部) ---------- */
.announcements { display: grid; gap: 8px; margin-bottom: 20px; }
.announcement {
    padding: 12px 14px;
    border: 1px solid #fde68a;
    border-left: 4px solid #f59e0b;
    border-radius: var(--radius);
    background: #fffbeb;
}
.announcement__title { margin: 0; font-weight: 700; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.announcement__label {
    flex-shrink: 0;
    padding: 1px 8px; border-radius: 999px;
    background: #f59e0b; color: #fff; font-size: 11px; font-weight: 700;
}
.announcement__body { margin: 8px 0 0; padding-top: 8px; border-top: 1px dashed #fde68a; font-size: 14px; }

/* 本文があるもの: 1行目を押すと開く (<details>) */
details.announcement > summary { list-style: none; cursor: pointer; }
details.announcement > summary::-webkit-details-marker { display: none; }
details.announcement > summary:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 4px; border-radius: 4px; }
.announcement__text { flex: 1 1 auto; min-width: 0; }
/* 開閉の矢印 (閉: ▼ / 開: ▲) */
.announcement__toggle {
    flex-shrink: 0; align-self: center; margin-left: auto;
    width: 8px; height: 8px;
    border-right: 2px solid #b45309; border-bottom: 2px solid #b45309;
    transform: rotate(45deg) translateY(-2px);
    transition: transform .15s;
}
details.announcement[open] .announcement__toggle { transform: rotate(-135deg) translateY(-2px); }
.announcement__date { flex-shrink: 0; color: var(--color-muted); font-size: 12px; font-weight: 400; font-variant-numeric: tabular-nums; }

/* ---------- アイコン (Material Symbols) ---------- */
/* 文字の大きさに合わせて縦位置をそろえる。フォントが読み込めない場合も幅を確保して崩れないように */
.material-symbols-outlined { width: 1em; overflow: hidden; flex-shrink: 0; user-select: none; }
.site-sidebar__link { gap: 10px; }
.site-sidebar__icon { font-size: 20px; color: var(--color-muted); }
.site-sidebar__link[aria-current="page"] .site-sidebar__icon { color: var(--color-primary); }

/* ---------- 退会 ---------- */
.notice--warning { margin-bottom: 16px; border-color: #fecaca; background: #fef2f2; color: #7f1d1d; }
.notice--warning .notice__list { color: #7f1d1d; }
.btn--danger { background: #dc2626; border-color: #dc2626; color: #fff; }

/* ---------- 掲示板 (運営への要望 / 不具合報告) ---------- */
.board-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.board-head h1 { margin: 0; display: flex; align-items: center; gap: 8px; }
.board-head__icon { font-size: 28px; color: var(--color-primary); }
.board-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.board-tabs a {
    display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px;
    border: 1px solid var(--color-border); border-radius: 999px; background: var(--color-surface); color: var(--color-text); font-size: 14px;
}
.board-tabs a[aria-current="page"] { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }
.board-tabs a:hover { text-decoration: none; }
.board-tabs a .material-symbols-outlined { font-size: 18px; margin-right: 4px; }
.board-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.board-list__item { padding: 12px 14px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); }
.board-list__main { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.board-list__title { font-weight: 700; color: var(--color-text); }
.board-list__meta { margin: 4px 0 0; font-size: 13px; }
.board-status { flex-shrink: 0; padding: 1px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.board-status--open { background: #fee2e2; color: #991b1b; }
.board-status--in_progress { background: #dbeafe; color: #1e40af; }
.board-status--done { background: #dcfce7; color: #166534; }
.board-author__handle { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.board-author--withdrawn { font-style: italic; }
.board-post { margin-bottom: 16px; }
.board-post__title { margin: 8px 0 4px; }
.board-post__page { font-size: 14px; }
.board-post__url { overflow-wrap: anywhere; }
.board-post__body { margin-top: 12px; }
.board-answer { margin-bottom: 16px; border-left: 4px solid #059669; }
.board-answer__title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; font-size: 15px; font-weight: 700; }
.board-answer__title .announcement__label { background: #059669; }
.board-answer__date { font-size: 12px; font-weight: 400; }
textarea { width: 100%; padding: 8px 12px; font: inherit; font-size: 16px; border: 1px solid var(--color-input-border); border-radius: 6px; resize: vertical; }

.board-list__no { font-size: 12px; font-variant-numeric: tabular-nums; }
.board-list__body { margin-top: 8px; line-height: 1.7; }
/* 削除されたレス (本文の代わりに「このレスは削除されました」) */
.board-deleted { color: var(--color-muted); font-style: italic; }
p.board-list__title { margin: 8px 0 0; }

/* 削除リンク (自分の投稿の右上) */

/* 一覧: 本文の下に区切り線を引いて、運営からの回答を表示 */
.board-list__divider { margin: 12px 0; border: 0; border-top: 1px dashed var(--color-border); }
.board-answer-inline .board-post__body { margin-top: 6px; }
.board-answer-inline .board-answer__title .announcement__label { background: #059669; }

/* ---------- プライバシーポリシー ---------- */
.legal h2 { font-size: 16px; margin: 20px 0 6px; }
.legal h3 { font-size: 14px; margin: 14px 0 4px; }
.legal ul ul { margin-top: 4px; }
.legal p, .legal li { line-height: 1.8; }
.legal ul { padding-left: 1.4em; margin: 0; }
/* ユーザー登録の画面: スクロールして読める枠 */

/* 状態・投稿番号の右に、投稿者と日時 */
.board-byline { display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: 0 6px; color: var(--color-muted); font-size: 13px; min-width: 0; }
.board-byline .board-author { color: var(--color-text); font-weight: 600; }
.board-byline .board-author--withdrawn { color: var(--color-muted); font-weight: 400; }
.board-byline__sep { color: var(--color-border); }
.board-byline time { font-variant-numeric: tabular-nums; }

/* ---------- 要望・不具合報告: 右下に浮いている「投稿する」ボタン ---------- */
.board-fab {
    position: fixed; z-index: 20; /* ヘッダー(30)・スマホのメニュー(35〜)より下 */
    left: 50%; transform: translateX(-50%); /* 画面の下の中央 */
    bottom: calc(16px + env(safe-area-inset-bottom));
    max-width: calc(100vw - 32px); white-space: nowrap;
    display: inline-flex; align-items: center; gap: 6px;
    min-height: 52px; padding: 0 22px;
    border: 0; border-radius: 999px;
    background: var(--color-primary); color: #fff;
    font: inherit; font-weight: 700;
    box-shadow: 0 6px 20px rgb(37 99 235 / .35);
    cursor: pointer;
}
.board-fab:hover { text-decoration: none; filter: brightness(1.08); }
.board-fab:focus-visible { outline: 3px solid #93c5fd; outline-offset: 3px; }
.board-fab .material-symbols-outlined { font-size: 20px; }
/* 一覧の最後の投稿がボタンに隠れないように */
.site-main:has(.board-fab) { padding-bottom: 100px; }

/* ---------- 投稿フォームのポップアップ (<dialog>) ---------- */
.board-dialog {
    width: min(560px, calc(100vw - 32px));
    max-height: calc(100dvh - 32px);
    padding: 0; border: 0; border-radius: 12px;
    box-shadow: 0 20px 50px rgb(0 0 0 / .25);
    color: var(--color-text);
}
.board-dialog::backdrop { background: rgb(15 23 42 / .5); }
.board-dialog__form { display: grid; gap: 14px; padding: 20px; }
.board-dialog__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.board-dialog__head h2 { margin: 0; }
.board-dialog__close {
    display: grid; place-items: center; width: var(--tap); height: var(--tap);
    border: 0; border-radius: 50%; background: none; color: var(--color-muted); cursor: pointer; min-height: auto; padding: 0;
}
.board-dialog__close:hover { background: var(--color-hover); color: var(--color-text); }
.board-dialog__notice { margin: 0; font-size: 13px; padding: 10px 12px; border-radius: 8px; border: 1px solid #fecaca; }
.board-dialog__notice p { margin: 0 0 4px; }
.board-dialog__actions { display: flex; justify-content: flex-end; gap: 8px; }
.board-dialog__actions .btn { min-width: 120px; }
.board-dialog [data-submit]:disabled { opacity: .6; cursor: wait; }
/* スマホ: 画面の下からせり上がる形 */
@media (max-width: 767px) {
    .board-dialog { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 16px 16px 0 0; padding-bottom: env(safe-area-inset-bottom); }
    .board-dialog__actions .btn { flex: 1; }
}

/* 投稿したばかりの投稿を、少しの間だけ目立たせる */
.board-list__item.is-new { animation: board-new 4s ease-out; }
@keyframes board-new { from { background: #fef9c3; border-color: #facc15; } to { background: var(--color-surface); border-color: var(--color-border); } }

/* ---------- 確認ダイアログ (confirm() の代わり。投稿フォームのポップアップと同じ見た目) ---------- */
.confirm-dialog { width: min(420px, calc(100vw - 32px)); }
.confirm-dialog__message { margin: 0; white-space: pre-line; line-height: 1.7; } /* 改行 (&#10;) をそのまま表示 */
.btn--danger:hover { filter: brightness(1.08); }
@media (max-width: 767px) { .confirm-dialog { width: 100vw; } }

/* ---------- 投稿の右上の操作 (削除 ・ 運営に通報) ---------- */
.board-actions { margin-left: auto; display: inline-flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px 12px; }
.board-action {
    padding: 0; border: 0; background: none; font: inherit; font-size: 13px; white-space: nowrap;
    color: var(--color-muted, #6b7280); text-decoration: underline; text-underline-offset: 2px; cursor: pointer;
}
.board-action:hover { color: #dc2626; }
.board-action--done { text-decoration: none; cursor: default; }
.board-action--done:hover { color: var(--color-muted, #6b7280); }

/* 運営に通報のポップアップ */
.report-dialog__target { margin: 0; font-size: 13px; }
.report-reasons { border: 0; padding: 0; margin: 0; display: grid; gap: 6px; }
.report-reasons legend { padding: 0; margin-bottom: 6px; font-weight: 600; }
/* 通報の理由: ラジオボタンと文言を左寄せで1行ずつ (.field label の太字より優先させる) */
.report-reasons .report-reasons__item {
    display: flex; align-items: center; justify-content: flex-start; gap: 8px; text-align: left;
    min-height: 36px; font-weight: normal; font-size: 15px; cursor: pointer;
}
.report-reasons .report-reasons__item input { width: 18px; height: 18px; accent-color: #dc2626; }

/* 絞り込みの「自分の投稿」(状態のタブと区切る) */
.board-tabs__sep { width: 1px; align-self: stretch; margin: 4px 4px; background: var(--color-border); }
.board-tabs__icon { font-size: 18px; margin-right: 4px; }
/* 絞り込み (左) と「コメントの流れ」(右) の行 */
.board-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin: 12px 0; }
.board-toolbar .board-tabs { margin: 0; }
.board-flow { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; font-size: 14px; white-space: nowrap; }
.board-flow label { color: var(--color-muted); font-weight: 600; }
.board-flow select { width: auto; min-height: 36px; padding: 4px 8px; font-size: 14px; }

/* ---------- 投稿の「good」「bad」 ---------- */
.board-reactions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 10px; } /* 右寄せ */
.board-reaction {
    display: inline-flex; align-items: center; gap: 4px; min-height: 32px; padding: 0 12px;
    border: 1px solid var(--color-border); border-radius: 999px; background: var(--color-surface);
    color: var(--color-muted, #6b7280); font: inherit; font-size: 13px; line-height: 1; cursor: pointer; white-space: nowrap;
}
.board-reaction:hover { text-decoration: none; border-color: #9ca3af; color: var(--color-text); }
.board-reaction .material-symbols-outlined { font-size: 18px; }
.board-reaction__count { min-width: 1ch; margin-left: 2px; font-weight: 700; font-variant-numeric: tabular-nums; }
.board-reaction:disabled { cursor: wait; }
.board-reaction.is-static { cursor: default; }
.board-reaction.is-static:hover { border-color: var(--color-border); color: var(--color-muted, #6b7280); }
/* 押している方 */
.board-reaction--like[aria-pressed="true"] { background: #eff6ff; border-color: #3b82f6; color: #1d4ed8; }
.board-reaction--meh[aria-pressed="true"] { background: #fff7ed; border-color: #f97316; color: #c2410c; }
.board-reaction[aria-pressed="true"] { font-weight: 700; }
.board-reaction.is-error { animation: board-reaction-shake .3s 2; }
@keyframes board-reaction-shake { 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }

/* 投稿の番号 (押すと、このレスへの返信)。ボタンもリンクと同じ見た目にする */
a.board-list__no, button.board-list__no { color: var(--color-muted, #6b7280); font-variant-numeric: tabular-nums; text-decoration: underline; text-underline-offset: 2px; }
button.board-list__no { min-height: auto; padding: 0; border: 0; background: none; font: inherit; font-size: 12px; line-height: inherit; cursor: pointer; }
.board-post__title button.board-list__no { font-size: inherit; } /* 投稿1件のページの見出し (レス #12) */
a.board-list__no:hover, button.board-list__no:hover { color: var(--color-primary); }

/* ---------- 投稿の本文の URL (リンク) と YouTube の動画 ---------- */
.rich-link { overflow-wrap: anywhere; word-break: break-all; }
.rich-embeds { display: block; margin-top: 10px; } /* 本文の後ろにまとめた動画 */
.rich-embed { display: block; width: 100%; max-width: 560px; margin: 8px 0; aspect-ratio: 16 / 9; }
.rich-embed iframe { display: block; width: 100%; height: 100%; border: 0; border-radius: 8px; background: #000; }

/* ---------- 投稿フォーム: 確認の画面 ---------- */
/* hidden を付けた要素は必ず隠す (display: grid などの指定より優先。入力 / 確認の切り替えなどで使う) */
[hidden] { display: none !important; }
.board-dialog__step { display: grid; gap: 14px; }
.board-confirm { max-height: 50vh; overflow: auto; outline: none; }
.board-confirm__item { border-style: dashed; }
.board-confirm__lead { border-color: var(--color-border); background: #f9fafb; }

/* 投稿前の確認: 項目名 (タイトル・本文など) と内容 */
.board-confirm__list { margin: 0; display: grid; gap: 4px; }
.board-confirm__list dt { margin-top: 10px; font-size: 13px; font-weight: 600; color: var(--color-muted, #6b7280); }
.board-confirm__list dt:first-child { margin-top: 0; }
.board-confirm__list dd { margin: 0; padding: 8px 12px; border: 1px solid var(--color-border); border-radius: 8px; background: #f9fafb; overflow-wrap: anywhere; }
.board-confirm__list dd.board-confirm__body { margin-top: 0; background: var(--color-surface); }

/* ---------- 送信中の表示 (POST): ぐるぐるを前面に出して、操作できないようにする (app.js の window.loading) ---------- */
.loading-overlay {
    padding: 22px 30px; border: 0; border-radius: 12px; background: var(--color-surface);
    box-shadow: 0 10px 30px rgb(0 0 0 / .2); color: #374151; font-size: 14px; outline: none;
}
.loading-overlay[open] { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.loading-overlay::backdrop { background: rgb(15 23 42 / .35); cursor: wait; }
.loading-overlay__spinner {
    width: 40px; height: 40px; border: 4px solid var(--color-primary-soft); border-top-color: var(--color-primary); border-radius: 50%;
    animation: loading-spin .8s linear infinite;
}
@keyframes loading-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .loading-overlay__spinner { animation-duration: 2s; } }
html.is-loading, html.is-loading * { cursor: wait !important; }

/* 投稿の本文の銘柄名・エイリアス (銘柄の詳細ページへのリンク) */
.stock-link { font-weight: 600; text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 3px; }

/* ---------- パンくずリスト (ホーム > 市場一覧 > 今のページ) ---------- */
.breadcrumb { margin: 0 0 12px; font-size: 13px; }
.breadcrumb ol { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 0; margin: 0; padding: 0; list-style: none; }
.breadcrumb li { display: inline-flex; align-items: center; min-width: 0; }
.breadcrumb li + li::before { content: '›'; margin: 0 8px; color: var(--color-muted, #6b7280); }
.breadcrumb a { color: var(--color-muted, #6b7280); }
.breadcrumb a:hover { color: var(--color-primary); }
.breadcrumb [aria-current="page"] { color: var(--color-text); overflow-wrap: anywhere; }

/* ページの表題 (h1) の左のアイコン (銘柄検索・一覧ページ。サイドバーと同じアイコン) */
.page-title { display: flex; align-items: center; gap: 8px; }
.page-title__icon { flex-shrink: 0; font-size: 28px; color: var(--color-primary); }

/* ---------- 銘柄の詳細ページのタブ (概要・掲示板・機関空売り) ---------- */
.stock-tabs {
    display: flex; gap: 4px; margin: 12px 0 16px; border-bottom: 1px solid var(--color-border);
    overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; /* スマホで入りきらなければ横にスクロール */
}
.stock-tabs::-webkit-scrollbar { display: none; }
.stock-tabs__tab {
    display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0;
    min-height: var(--tap); padding: 0 16px; margin-bottom: -1px;
    border-bottom: 3px solid transparent; color: var(--color-muted, #6b7280); font-weight: 600; white-space: nowrap;
}
.stock-tabs__tab .material-symbols-outlined { font-size: 20px; }
.stock-tabs__tab:hover { color: var(--color-text); text-decoration: none; }
.stock-tabs__tab[aria-current="page"] { color: var(--color-primary); border-bottom-color: var(--color-primary); }

/* ---------- 銘柄の掲示板: 続きを読み込む (上: 新しいコメント / 下: さらに10件) ---------- */
.board-feed__edge { display: grid; justify-items: center; gap: 6px; margin: 10px 0; }
.board-feed__more {
    display: inline-flex; align-items: center; justify-content: center; gap: 4px;
    min-height: var(--tap); min-width: min(320px, 100%); padding: 0 20px;
    border: 1px solid var(--color-border); border-radius: 999px; background: var(--color-surface);
    color: var(--color-primary); font: inherit; font-weight: 600; cursor: pointer;
}
.board-feed__more:hover { text-decoration: none; border-color: var(--color-primary); }
.board-feed__more .material-symbols-outlined { font-size: 20px; }
.board-feed__more.is-loading { opacity: .6; cursor: wait; }
.board-feed__more.is-loading .material-symbols-outlined { animation: loading-spin .8s linear infinite; }
.board-feed__note, .board-feed__end { margin: 0; font-size: 13px; }

/* ---------- ⓘ アイコンの吹き出し (partials/info-tip) ---------- */
.info-tip { position: relative; display: inline-flex; vertical-align: middle; color: var(--color-muted); cursor: help; outline: none; }
.info-tip .material-symbols-outlined { font-size: 18px; }
.info-tip:hover, .info-tip:focus-visible, .info-tip:focus { color: var(--color-primary); }
.info-tip__bubble {
    position: absolute; z-index: 20; top: calc(100% + 6px); left: 50%; transform: translateX(-50%);
    width: max-content; max-width: min(320px, 80vw); padding: 8px 10px; border-radius: 6px;
    background: #1f2937; color: #fff; font-size: 12px; font-weight: 400; line-height: 1.6; text-align: left; white-space: normal;
    box-shadow: 0 4px 12px rgb(0 0 0 / .2); opacity: 0; visibility: hidden; transition: opacity .15s;
}
.info-tip:hover .info-tip__bubble, .info-tip:focus .info-tip__bubble { opacity: 1; visibility: visible; }
@media (max-width: 767px) {
    .info-tip__bubble { left: auto; right: -8px; transform: none; }
}

/* ---------- 機関空売り ---------- */
.short-chart__svg { display: block; width: 100%; height: auto; aspect-ratio: 720 / 240; }
.short-chart__grid { stroke: var(--color-border); stroke-width: 1; }
.short-chart__label { font-size: 11px; fill: var(--color-muted); }
.short-chart__bar { fill: #93c5fd; }
/* 個人信用残: 買残 = 赤・売残 = 青 */
.short-chart__bar--buy { fill: #f87171; }
.short-chart__bar--sell { fill: #60a5fa; }
.short-chart__bar--buy:hover { fill: #dc2626; }
.short-chart__bar--sell:hover { fill: #2563eb; }
.short-chart__legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 13px; }
.short-chart__bar[style]:hover { opacity: .7; } /* 色を指定した棒 (積み上げ) は、マウスを乗せると薄く */
.short-chart__legend li { display: flex; align-items: center; gap: 6px; }
.short-chart__swatch { display: inline-block; width: 12px; height: 12px; border-radius: 2px; }
span.short-chart__bar--buy { background: #f87171; }
span.short-chart__bar--sell { background: #60a5fa; }
.short-chart__bar.is-latest { fill: #2563eb; }
.short-chart__bar:hover { fill: #1d4ed8; }
.short-section { margin-bottom: 16px; display: grid; gap: 10px; }
.short-section__title { margin: 0; font-size: 17px; }
.short-section__title .muted { font-size: 13px; font-weight: 400; }
.short-total { margin: 0; }
.short-total strong { font-size: 20px; margin: 0 4px; }
.short-table td { vertical-align: top; }
.short-table__institution { white-space: normal; min-width: 200px; }
.short-table__sub { font-size: 12px; margin-top: 2px; }
.short-table .is-up { color: #b91c1c; }
.short-table .is-down { color: #047857; }
.short-table tr.is-below td { color: var(--color-muted); }
.short-table tr.is-missing td { color: var(--color-muted); }
.short-note { font-size: 13px; }
.short-note p { margin: 0 0 6px; }

.overview-more { margin: 8px 0 16px; text-align: right; font-size: 14px; }

/* ---------- 信用取引残高 (個人信用残タブ) ---------- */
.margin-section { margin-top: 16px; margin-bottom: 16px; display: grid; gap: 12px; }
.margin-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.margin-summary > div { display: grid; gap: 2px; padding: 10px 12px; border: 1px solid var(--color-border); border-radius: 8px; }
.margin-summary__label { font-size: 13px; color: var(--color-muted); }
.margin-summary__value { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.margin-summary__value small { font-size: 12px; font-weight: 400; margin-left: 2px; }
.margin-summary__change { font-size: 12px; }
.margin-summary .is-up { color: #b91c1c; }
.margin-summary .is-down { color: #047857; }
@media (max-width: 767px) {
    .margin-summary { grid-template-columns: 1fr; }
}

/* ---------- ユーザー登録をうながすポップアップ ---------- */
.register-prompt__merits { margin: 0; padding-left: 1.4em; font-size: 14px; color: var(--color-muted); line-height: 1.8; }

/* ---------- 空売り機関 ---------- */
.institution-title { overflow-wrap: anywhere; }
.short-matrix__institution a { color: inherit; }

/* ---------- ランキング ---------- */
.ranking-grid { display: grid; gap: 16px; }
/* ホームの中見出し (投票受付中・ランキング) */
.home-section-title { display: flex; align-items: center; gap: 6px; margin: 24px 0 10px; font-size: 18px; }
.home-section-title .material-symbols-outlined { font-size: 22px; color: var(--color-primary); }
/* ホームの投票受付中 (提案の一覧) */
.home-proposals__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.home-proposals__list li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.home-proposals__type { flex-shrink: 0; padding: 1px 10px; border-radius: 999px; background: var(--color-primary-soft); color: var(--color-primary); font-size: 12px; font-weight: 700; white-space: nowrap; }
.home-proposals__title { flex: 1 1 12em; min-width: 0; overflow-wrap: anywhere; font-weight: 700; }
.home-proposals__date { font-size: 12px; white-space: nowrap; }
@media (min-width: 1024px) { .ranking-grid { grid-template-columns: 1fr 1fr; align-items: start; } }
.ranking { display: grid; gap: 8px; scroll-margin-top: 16px; }
.ranking__title { margin: 0; font-size: 18px; display: flex; align-items: center; gap: 6px; }
.ranking__more { margin: 0; text-align: right; font-size: 14px; }
.ranking__note { margin: 0; font-size: 13px; }
.ranking__list { list-style: none; margin: 0; padding: 0; }
.ranking__item { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--color-border); }
.ranking__rank { flex-shrink: 0; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: var(--color-hover); font-weight: 700; font-size: 13px; }
.ranking__rank.is-top { background: var(--color-primary); color: #fff; }
.ranking__link { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; }
.ranking__code { font-size: 13px; }
.ranking__name { font-weight: 600; }
.ranking__market { font-size: 12px; }
.ranking__score { flex-shrink: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.ranking__score small { font-size: 12px; font-weight: 400; margin-left: 2px; }

/* ---------- 当サイトについて ---------- */
.about-policy { max-width: 720px; margin-bottom: 24px; }
.about-policy h2 { margin-top: 0; }
.about-policy h3 { font-size: 15px; margin: 18px 0 6px; }
.about-policy p, .about-policy li { line-height: 1.8; }
.about-policy ul { padding-left: 1.4em; margin: 0; }
.about-feedback { max-width: 720px; scroll-margin-top: 16px; }

/* ---------- 要望・不具合報告のフォーム ---------- */
.feedback-form { display: grid; gap: 16px; max-width: 720px; }
.feedback-form select, .feedback-form textarea { width: 100%; }
.feedback-history { margin-top: 24px; max-width: 720px; }
.feedback-history h2 .muted { font-size: 13px; font-weight: 400; }
.feedback-item { display: grid; gap: 6px; margin-bottom: 12px; }
.feedback-item__head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; }
.feedback-item__title { margin: 0; font-size: 16px; }
.feedback-item__body { white-space: normal; overflow-wrap: anywhere; }
.feedback-item__answer { margin-top: 4px; padding: 10px 12px; border-left: 3px solid var(--color-primary); background: #f8fafc; border-radius: 4px; }
.feedback-item__answer strong { display: block; font-size: 13px; margin-bottom: 4px; }
/* 見出しの右の SNS に投稿するボタン (銘柄の各ページ・ランキング・各スレッド。銘柄は銘柄コードの右) */
.title-share { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 16px; min-width: 0; }
.title-share > h1 { margin: 0; min-width: 0; }
.board-head .title-share, .stock-head .title-share { margin: 0; }
.share-buttons { flex-shrink: 0; display: inline-flex; flex-wrap: wrap; gap: 6px; }
.share-btn { display: inline-grid; place-items: center; min-width: 32px; height: 32px; padding: 0 6px; border-radius: 999px; color: #fff; font-size: 13px; font-weight: 700; line-height: 1; font-family: system-ui, sans-serif; }
.share-btn:hover { opacity: .85; text-decoration: none; }
.share-btn:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.share-btn--x { background: #000; }
.share-btn--facebook { background: #1877f2; font-size: 18px; }
.share-btn--line { background: #06c755; font-size: 10px; }
.share-btn--hatena { background: #00a4de; }
.share-btn--threads { background: #000; font-size: 16px; }
.share-btn--bluesky { background: #0085ff; font-size: 15px; }
/* 銘柄のスレッドのレスのスタンス (買いたい / 様子見 / 売りたい) */
.board-reactions > .board-stance { margin-right: auto; align-self: center; } /* 左下。good・bad は右寄せのまま */
.post-peek__foot:empty { display: none; }
.post-peek__foot { margin-top: 6px; }
.board-stance { flex-shrink: 0; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 700; line-height: 1.8; white-space: nowrap; }
.board-stance--buy { background: #fee2e2; color: #b91c1c; }   /* 買い = 赤 (日本の株価の上げの色) */
.board-stance--hold { background: #f3f4f6; color: #4b5563; }
.board-stance--sell { background: #dbeafe; color: #1d4ed8; }  /* 売り = 青 */
/* 運営アカウントの印 (投稿者の名前の前) */
.board-author__staff { display: inline-block; margin-right: 4px; padding: 0 8px; border-radius: 999px; background: #059669; color: #fff; font-size: 11px; font-weight: 700; line-height: 1.6; vertical-align: 1px; }
.board-author--staff { font-weight: 700; }
/* スレッド一覧のカテゴリの絞り込み (選択ボックス) */
.board-category-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px 0; }
.board-category-filter label { font-weight: 700; font-size: 14px; }
.board-category-filter select { min-width: 12em; max-width: 100%; }
/* カテゴリ作成のアイコンの選択 (アイコンのボタンを並べる。選んだものは色が付く) */
.icon-picker { border: 0; padding: 0; margin: 0 0 16px; }
.icon-picker legend { padding: 0; margin-bottom: 6px; font-weight: 700; }
.icon-picker__options { display: flex; flex-wrap: wrap; gap: 8px; }
.icon-picker__option { position: relative; display: inline-grid; place-items: center; width: 44px; height: 44px; border: 1px solid var(--color-border); border-radius: 10px; background: var(--color-surface); color: var(--color-muted); cursor: pointer; }
.icon-picker__option input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.icon-picker__option:has(input:checked) { border-color: var(--color-primary); background: #eff6ff; color: var(--color-primary); box-shadow: 0 0 0 1px var(--color-primary); }
.icon-picker__option:has(input:focus-visible) { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.icon-picker__option .material-symbols-outlined { font-size: 24px; }
/* 提案 (スレッド作成・カテゴリ作成・銘柄エイリアス登録)。good・bad は投稿と同じ見た目 (.board-reactions。右寄せ) */
.proposal__icon { margin-right: 4px; font-size: 20px; vertical-align: -4px; color: var(--color-muted); }
.proposal__summary { margin: 0; }
.proposal__votes { align-items: center; margin-top: 4px; }
.proposal__approve { margin: 0 auto 0 0; } /* good・bad の前 (左)。good・bad は右寄せのまま */
.proposal__approve-button { display: inline-flex; align-items: center; gap: 4px; min-height: auto; padding: 4px 14px; border: 1px solid #059669; border-radius: 999px; background: #059669; color: #fff; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.proposal__approve-button:hover { background: #047857; }
.proposal__approve-button .material-symbols-outlined { font-size: 18px; }
.proposal__adopted { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 4px 0 0; font-size: 14px; color: #166534; }
.proposal__adopted .material-symbols-outlined { font-size: 18px; }

/* ---------- ポートフォリオ ---------- */
.portfolio-add { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 12px; }
.portfolio-add .btn .material-symbols-outlined { font-size: 20px; margin-right: 4px; }
.portfolio-choices { display: grid; gap: 8px; }
.portfolio-choice { padding: 10px 12px; border: 1px solid var(--color-border); border-radius: 8px; }
.portfolio-choice__name { flex: 1; font-weight: 600; }
.portfolio-choice__no {
    display: inline-grid; place-items: center; width: 22px; height: 22px; margin-right: 6px; border-radius: 50%;
    background: var(--color-primary); color: #fff; font-size: 12px; font-weight: 700; flex-shrink: 0; vertical-align: middle;
}
.portfolio-choice--new { display: grid; gap: 8px; border-style: dashed; }
.portfolio { margin-bottom: 16px; display: grid; gap: 10px; scroll-margin-top: 16px; }
.portfolio__head { display: flex; align-items: center; gap: 4px; }
.portfolio__head .portfolio__name { flex: 1; min-width: 0; }
.portfolio__name { margin: 0; font-size: 17px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.portfolio__count { font-size: 13px; font-weight: 400; }
.portfolio__tools { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }
.portfolio__tools form { margin: 0; }
.portfolio__rename summary { cursor: pointer; color: var(--color-primary); font-size: 14px; width: fit-content; }
.portfolio__rename-form { display: flex; gap: 8px; margin-top: 8px; }
.portfolio__rename-form input { flex: 1; min-width: 0; }
.portfolio-new { display: grid; gap: 4px; }
.portfolio-new label { font-weight: 600; font-size: 14px; }
.portfolio-stocks { list-style: none; margin: 0; padding: 0; }
.portfolio-stock { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px solid var(--color-border); }
.portfolio-stock__link { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; padding: 6px 0; }
.portfolio-stock__code { font-size: 13px; width: 3.4em; }
.portfolio-stock__name { font-weight: 600; }
.portfolio-stock__market { font-size: 13px; }
/* 全体の銘柄数 */
.portfolio-total { margin: 0 0 12px; font-size: 14px; }
/* ドラッグで並べ替えるつまみ (public/user/js/portfolio.js。SortableJS) */
.drag-handle {
    display: inline-grid; place-items: center; width: 28px; height: var(--tap); min-height: auto; padding: 0; flex-shrink: 0;
    border: 0; border-radius: 6px; background: none; color: var(--color-muted); cursor: grab; touch-action: none;
}
.drag-handle:hover { background: var(--color-hover); color: var(--color-text); filter: none; }
.drag-handle:active { cursor: grabbing; }
.is-drag-ghost { opacity: .35; }
.is-drag-chosen { box-shadow: 0 6px 18px rgb(0 0 0 / .15); background: var(--color-surface); }
.portfolio-stock.is-drag-chosen { border-radius: var(--radius); }
/* 銘柄を追加する検索欄と候補 */
.portfolio-add-stock { position: relative; margin: 0; }
.portfolio-add-stock__row { display: flex; align-items: center; gap: 8px; }
.portfolio-add-stock__row input { flex: 1; min-width: 0; padding-left: 34px; }
.portfolio-add-stock__icon { position: absolute; left: 9px; top: calc(var(--tap) / 2); transform: translateY(-50%); font-size: 20px; color: var(--color-muted); pointer-events: none; }
.stock-suggest {
    position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px); max-height: 320px; overflow: auto;
    list-style: none; margin: 0; padding: 4px; border: 1px solid var(--color-border); border-radius: var(--radius);
    background: var(--color-surface); box-shadow: 0 8px 24px rgb(0 0 0 / .14);
}
.stock-suggest__item { display: flex; align-items: baseline; gap: 10px; padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.stock-suggest__item[aria-selected="true"] { background: var(--color-primary-soft); }
.stock-suggest__code { font-size: 13px; color: var(--color-muted); width: 3.4em; flex-shrink: 0; }
.stock-suggest__name { font-weight: 600; }
.stock-suggest__market { margin-left: auto; font-size: 12px; color: var(--color-muted); }
.stock-suggest__empty { padding: 8px 10px; color: var(--color-muted); font-size: 14px; }
.icon-btn {
    display: inline-grid; place-items: center; width: var(--tap); height: var(--tap); min-height: auto; padding: 0;
    border: 0; border-radius: 50%; background: none; color: var(--color-muted); cursor: pointer;
}
button.icon-btn[type="submit"] { background: none; border: 0; color: var(--color-muted); }
.icon-btn:hover:not(:disabled) { background: var(--color-hover); color: var(--color-text); filter: none; }
.icon-btn:disabled { opacity: .3; cursor: default; }
.icon-btn--danger:hover:not(:disabled), button.icon-btn--danger[type="submit"]:hover { color: #dc2626; }
.short-table .num { text-align: right; }
.short-total__change { font-size: 13px; margin-right: 6px; }
.short-total__change.is-up { color: #b91c1c; }
.short-total__change.is-down { color: #047857; }
/* 日ごとの表 (1日 1行・機関ごとの列): 日付と総計の列は横にスクロールしても残す */
.short-matrix th, .short-matrix td { white-space: nowrap; }
/* 日ごとの空売り残高: 日付・総計の列は狭くして左に固定 (機関の列だけ左右にスライド) */
.short-matrix { --matrix-date-w: 88px; --matrix-total-w: 104px; }
.short-matrix__date, .short-matrix__total { position: sticky; z-index: 1; box-sizing: border-box; }
.short-matrix__date { left: 0; width: var(--matrix-date-w); min-width: var(--matrix-date-w); max-width: var(--matrix-date-w); padding-inline: 6px !important; font-size: 12px; background: var(--color-surface); }
.short-matrix__total { left: var(--matrix-date-w); width: var(--matrix-total-w); min-width: var(--matrix-total-w); max-width: var(--matrix-total-w); padding-inline: 6px !important; background: #f8fafc; box-shadow: 2px 0 4px -2px rgba(0, 0, 0, .25); } /* 右端の影 = ここから右がスライドする */
.short-matrix thead .short-matrix__date, .short-matrix thead .short-matrix__total { z-index: 2; }
/* 横スクロールのバーを表の上にも (dual-scroll.js が作る。下のバーと連動) */
.dual-scroll__top { overflow-x: auto; overflow-y: hidden; height: 14px; margin-bottom: 4px; }
.dual-scroll__top > div { height: 1px; }
.short-matrix__institution { font-size: 12px; max-width: 12em; overflow: hidden; text-overflow: ellipsis; }
.short-matrix td.is-reported .short-cell__shares { font-weight: 700; }
.short-matrix td { vertical-align: top; }
.short-matrix .short-cell__shares, .short-matrix .short-cell__change, .short-matrix .short-cell__ratio { display: block; }
.short-cell__change { font-size: 12px; min-height: 1em; }
.short-cell__change.is-plus, .short-legend.is-plus { color: #dc2626; }
.short-cell__change.is-minus, .short-legend.is-minus { color: #2563eb; }
.short-cell__ratio { font-size: 11px; color: var(--color-muted); }
/* 0.5% を切った報告の日 (総計には入れていない): 薄い色 */
.short-matrix td.is-below .short-cell__shares { color: var(--color-muted); font-weight: 400; }
.short-table tr.is-below td a { color: var(--color-muted); }
.short-matrix tr.is-missing td { color: var(--color-muted); }

/* ---------- 列ごとに並べ替えられる表 (public/user/js/sortable-table.js) ---------- */
.sort-button { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 2px; white-space: nowrap; }
.sort-button:hover { color: var(--color-primary); }
.sort-button:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; border-radius: 2px; }
.sort-button__mark::after { content: "↕"; font-size: 11px; opacity: .35; } /* 並べ替えられる */
th[aria-sort="ascending"] .sort-button__mark::after { content: "▲"; opacity: 1; }
th[aria-sort="descending"] .sort-button__mark::after { content: "▼"; opacity: 1; }
.table-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-bottom: 8px; }
.table-filter { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; white-space: nowrap; }
.table-filter select { width: auto; max-width: 70vw; padding: 4px 8px; border: 1px solid var(--color-border); border-radius: var(--radius); background: var(--color-surface); font: inherit; }
.institution-table__market { font-size: 13px; white-space: nowrap; color: var(--color-muted, #6b7280); }

/* ---------- 棒グラフのポップアップ (public/user/js/bar-chart.js) ---------- */
.short-chart { position: relative; }
.short-chart__hit { fill: transparent; cursor: pointer; }
.short-chart__hit.is-active { fill: rgba(17, 24, 39, .06); }
.chart-tip { position: absolute; z-index: 5; max-width: min(420px, calc(100% - 16px)); padding: 8px 10px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); box-shadow: 0 4px 16px rgba(0, 0, 0, .12); font-size: 12px; pointer-events: none; }
.chart-tip__date { font-weight: 700; margin-bottom: 4px; }
.chart-tip__empty { color: var(--color-muted); }
.chart-tip__table { border-collapse: collapse; }
.chart-tip__table td { padding: 1px 0; vertical-align: middle; }
.chart-tip__name { display: flex; align-items: center; gap: 6px; padding-right: 12px !important; overflow-wrap: anywhere; }
.chart-tip__name .short-chart__swatch { flex: none; width: 10px; height: 10px; }
.chart-tip__num { text-align: right; white-space: nowrap; padding-left: 10px !important; font-variant-numeric: tabular-nums; }
.chart-tip__total td { border-top: 1px solid var(--color-border); padding-top: 3px; font-weight: 700; }

/* ---------- 掲示板一覧 (/boards/list) ---------- */
.board-table__name a { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; white-space: nowrap; }
.board-table__name .material-symbols-outlined { font-size: 20px; }
.board-table__summary { min-width: 16em; white-space: normal; color: var(--color-muted); font-size: 13px; }
.board-table__latest { white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------- 「上へ」「下へ」のボタン (partials/scroll-nav。本文の右下に浮く) ---------- */
.scroll-nav {
    position: sticky; z-index: 20; /* 「投稿する」ボタンと同じ高さ。ヘッダー(30)より下 */
    bottom: calc(16px + env(safe-area-inset-bottom));
    display: flex; flex-direction: column; gap: 10px;
    width: fit-content; margin: 16px 0 0 auto; /* 右寄せ */
    pointer-events: none; /* ボタンの間のすき間は、下の文字を押せるように */
}
/* 薄いピンク・半透明 (下のコメントが少し透けて見える)。押しやすいよう大きめ */
.scroll-nav__button {
    pointer-events: auto;
    display: inline-flex; align-items: center; justify-content: center;
    width: 72px; height: 72px; padding: 0; border-radius: 50%;
    border: 2px solid rgb(236 72 153 / .45);
    background: rgb(252 231 243 / .82); color: #be185d;
    -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
    box-shadow: 0 4px 14px rgb(190 24 93 / .25); cursor: pointer;
}
.scroll-nav__button:hover { background: rgb(251 207 232 / .95); border-color: rgb(236 72 153 / .8); }
.scroll-nav__button:focus-visible { outline: 3px solid #ec4899; outline-offset: 2px; }
.scroll-nav__button .material-symbols-outlined { font-size: 40px; }
@media (max-width: 767px) {
    .scroll-nav__button { width: 60px; height: 60px; } /* スマホは少しだけ小さく (投稿するボタンと重ならないように) */
    .scroll-nav__button .material-symbols-outlined { font-size: 34px; }
}

/* ---------- 新規空売り (/institutions/new-shorts) ---------- */
.day-nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; max-width: 360px; margin: 0 0 12px; font-variant-numeric: tabular-nums; }
.new-short__first { display: inline-block; padding: 0 6px; border-radius: 4px; background: #dc2626; color: #fff; font-size: 12px; font-weight: 700; line-height: 1.6; vertical-align: 1px; }
.new-short-table .institution-table__market { display: block; }
.new-short__institutions { list-style: none; margin: 0; padding: 0; }
.new-short__institutions li { overflow-wrap: anywhere; }
.new-short__ratio { color: #dc2626; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.new-short__change { white-space: nowrap; font-variant-numeric: tabular-nums; }
.new-short-table th small { font-weight: 400; color: var(--color-muted); }

/* ---------- 掲示板のパート (1000 件に達したら次のパート。App\User\Model\Forum) ---------- */
/* スレッドのパート (前・次のパートのリンクは上に。すべてのパートは折りたためる) */
.board-parts { margin: 0 0 12px; border: 1px solid var(--color-border); border-radius: 8px; background: var(--color-surface); font-size: 14px; }
.board-parts__summary { padding: 8px 12px; cursor: pointer; }
.board-parts[open] .board-parts__summary { border-bottom: 1px solid var(--color-border); }
.board-parts__body { display: grid; gap: 10px; padding: 10px 12px; }
.board-parts__nav { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; margin: 0 0 8px; font-size: 14px; } /* 折りたたみの上 */
.board-parts__next { margin-left: auto; text-align: right; } /* 前のパートがなくても右に寄せる */
.board-parts__list { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; }
/* パートはふつうのリンク。今のパートは太字 (リンクなし) */
strong.board-parts__item { color: var(--color-text); }
.board-part-end { margin-top: 16px; text-align: center; background: var(--color-primary-soft); }
.board-part-end__next { margin: 12px 0 0; }

/* ---------- 日ごとの空売り残高: 報告のない日 (前の報告を引き継いだ残高) の表示 (resources/user/views/stock/short.blade.php) ----------
 * 最初は「----」。見出しの右のチェックボックスを入れると、引き継いだ残高を出す (:has() で切り替え。JavaScript は使わない) */
.short-section__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 16px; }
.short-carry-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--color-muted); cursor: pointer; white-space: nowrap; }
.short-cell__none { display: none; }
.short-matrix .short-cell__value { display: block; }
.short-matrix .is-carried .short-cell__value { display: none; }
.short-matrix .is-carried .short-cell__none { display: inline; color: var(--color-muted); }
.short-section:has([data-short-carry]:checked) .short-matrix .is-carried .short-cell__value { display: block; }
.short-section:has([data-short-carry]:checked) .short-matrix .is-carried .short-cell__none { display: none; }

/* 報告の履歴の備考: 報告義務消滅 (残高割合 0.5% 未満の報告) */
.short-table__note { white-space: nowrap; }
.short-note-badge { display: inline-block; padding: 0 6px; border: 1px solid var(--color-border); border-radius: 4px; background: var(--color-hover); color: var(--color-muted); font-size: 12px; line-height: 1.7; }
/* 日ごとの空売り残高: 報告義務が消滅した日の機関のセルに、数字の下にラベル */
.short-matrix .short-cell__note { margin-top: 4px; white-space: nowrap; }
/* 報告義務発生 (消滅の灰色と区別して、空売りが始まった印に赤系) */
.short-note-badge.is-started { border-color: #fecaca; background: #fef2f2; color: #b91c1c; }

/* 機関空売りタブの表示期間 (30・60・90・180 営業日)。グラフの上の右端 */
.short-period { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin: 0 0 8px; font-size: 14px; }
.short-period label { color: var(--color-muted); font-weight: 600; }
.short-period select { width: auto; min-height: 36px; padding: 4px 8px; font-size: 14px; }

/* スレッド一覧の表の右上 (スレッド作成依頼へのリンク) */
.board-table-tools { display: flex; justify-content: flex-end; margin: 0 0 10px; }
.board-table-tools .btn .material-symbols-outlined { font-size: 20px; margin-right: 4px; }
/* 信用買残 増加率ランキング: 増加率 (赤) と、前日比 (増えた株数) */
.ranking__score.is-plus { color: var(--color-up); }
.ranking__sub { display: block; font-size: 11px; font-weight: 400; color: var(--color-muted); text-align: right; }

/* ホーム: 機関新規空売りランキングだけは1行に1つ (PC の 2列でも右は空ける) */
@media (min-width: 1024px) {
    .ranking-grid > .ranking--solo { grid-column: 1; }
    .ranking-grid > .ranking--solo + * { grid-column-start: 1; }
}

/* サイドバーの幅を変えるつまみ (右端。PC だけ。public/user/js/app.js) */
.site-sidebar__resize { display: none; }
@media (min-width: 768px) {
    .site-sidebar__resize {
        display: block; position: absolute; top: 0; right: 0; bottom: 0; width: 6px; /* サイドバーの内側の右端 (外に出すと、スクロールする枠で切れる) */
        cursor: col-resize; z-index: 1; touch-action: none;
    }
    .site-sidebar__resize::after {
        content: ''; position: absolute; top: 0; bottom: 0; right: 0; width: 2px; background: transparent; transition: background .15s;
    }
    .site-sidebar__resize:hover::after, .site-sidebar__resize:focus-visible::after, .is-sidebar-resizing .site-sidebar__resize::after { background: var(--color-primary); }
    .site-sidebar__resize:focus-visible { outline: none; }
    .is-sidebar-resizing, .is-sidebar-resizing * { cursor: col-resize !important; user-select: none !important; }
}

/* スレッド作成依頼のアイコンの選択 (ラジオボタンをアイコンのボタンに) */
.thread-icon-field { border: 0; padding: 0; margin: 0; }
.thread-icon-field legend { padding: 0; margin-bottom: 6px; font-weight: 600; }
.thread-icon-options { display: flex; flex-wrap: wrap; gap: 8px; }
.thread-icon-option { position: relative; display: inline-grid; place-items: center; width: 44px; height: 44px; border: 1px solid var(--color-border); border-radius: var(--radius); background: var(--color-surface); cursor: pointer; }
.thread-icon-option input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.thread-icon-option .material-symbols-outlined { font-size: 24px; color: var(--color-muted); }
.thread-icon-option:has(input:checked) { border-color: var(--color-primary); background: var(--color-primary-soft); }
.thread-icon-option:has(input:checked) .material-symbols-outlined { color: var(--color-primary); }
.thread-icon-option:has(input:focus-visible) { outline: 2px solid var(--color-primary); outline-offset: 2px; }
/* アイコンと名前のボタン (スレッドのカテゴリ) */
.thread-icon-option--labeled { display: inline-flex; gap: 6px; width: auto; padding: 0 14px 0 10px; font-weight: 600; }
.thread-icon-option--labeled:has(input:checked) { color: var(--color-primary); }
.board-table__category { white-space: nowrap; }

/* ---------- スレッドのアンカー (>>123) と、そのポップアップ (public/user/js/board-anchor.js) ---------- */
.post-anchor { font-variant-numeric: tabular-nums; }
.post-peek {
    position: absolute; z-index: 60;
    width: max-content; max-width: min(520px, calc(100vw - 16px)); max-height: 60vh; overflow: auto;
    padding: 10px 12px; border: 1px solid var(--color-border); border-radius: var(--radius);
    background: var(--color-surface); box-shadow: 0 6px 20px rgb(0 0 0 / .16);
    font-size: 14px; line-height: 1.6; overflow-wrap: anywhere;
}
.post-peek__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; margin-bottom: 4px; font-size: 13px; }
.post-peek__body { white-space: normal; }
.post-peek__loading, .post-peek__missing { margin: 0; color: var(--color-muted); }

/* ---------- レスの書き方 (RichText の markdown: 太字・取り消し線・コード・引用) ---------- */
.rich-quote { margin: 4px 0; padding: 2px 0 2px 10px; border-left: 3px solid var(--color-border); color: var(--color-muted); }
.rich-code { padding: 1px 5px; border-radius: 4px; background: var(--color-hover); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .92em; overflow-wrap: anywhere; }
.board-list__body del, .board-post__body del, .post-peek__body del, .board-confirm__body del { color: var(--color-muted); }
/* 投稿フォームの「書き方」 */
.markdown-help { margin-top: 6px; font-size: 13px; }
.markdown-help summary { cursor: pointer; color: var(--color-primary); }
.markdown-help__table { width: auto; margin: 6px 0; background: transparent; }
.markdown-help__table td { padding: 3px 12px 3px 0; border: 0; white-space: normal; }
.markdown-help__note { margin: 0; }
