/* ============================================================
   MarketWatch 共通スタイル

   方針
   - 既定はダーク。:root[data-theme="light"] で上書きする（base.html が属性を付ける）
   - 上昇 = 赤 / 下落 = 緑（日本の相場慣行）。色覚に依存させないため必ず ▲▼ を併記する
   - 等幅フォントは数値にだけ当てる（.num / .snapshot__price / .table__num）
   - 幅 380px でも横スクロールを出さない。広い表は .table-wrap の内側だけを流す
   ============================================================ */

/* ---------------------------------------------- 配色トークン（ダーク＝既定） */
:root {
  --bg:            #0e1116;
  --bg-sunken:     #0a0d11;
  --panel:         #161b22;
  --panel-2:       #1c222b;
  --border:        #262d38;
  --border-strong: #38404d;

  --text:        #e6eaf0;
  --text-muted:  #9aa4b2;
  --text-faint:  #6b7482;

  --accent:      #4d8dff;
  --accent-weak: rgba(77, 141, 255, 0.14);
  --accent-text: #ffffff;

  /* 相場の色。日本式に 上昇=赤 / 下落=緑 */
  --up:      #ff5c5c;
  --up-bg:   rgba(255, 92, 92, 0.13);
  --down:    #2fc08a;
  --down-bg: rgba(47, 192, 138, 0.13);
  --flat:    #9aa4b2;
  --flat-bg: rgba(154, 164, 178, 0.12);

  /* 重大度 */
  --sev-minor:       #7f8b9a;
  --sev-minor-bg:    rgba(127, 139, 154, 0.16);
  --sev-major:       #f0a441;
  --sev-major-bg:    rgba(240, 164, 65, 0.16);
  --sev-critical:    #ff5c5c;
  --sev-critical-bg: rgba(255, 92, 92, 0.16);

  --ok:   #2fc08a;
  --warn: #f0a441;
  --err:  #ff6b6b;
  --info: #4d8dff;

  --radius:    10px;
  --radius-sm: 6px;
  --radius-pill: 999px;
  --shadow:    0 1px 2px rgba(0, 0, 0, 0.35), 0 8px 24px rgba(0, 0, 0, 0.22);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);

  --gap:   16px;
  --gap-sm: 8px;
  --maxw:  1080px;
  --header-h: 56px;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Kaku Gothic ProN",
               "Hiragino Sans", "Yu Gothic UI", "Yu Gothic", Meiryo, system-ui, sans-serif;
  --font-num:  ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
               "Roboto Mono", "Courier New", monospace;
}

:root[data-theme="light"] {
  --bg:            #f5f7fa;
  --bg-sunken:     #eceff4;
  --panel:         #ffffff;
  --panel-2:       #f2f5f9;
  --border:        #dde3ea;
  --border-strong: #c3ccd8;

  --text:        #16202c;
  --text-muted:  #5c6a7a;
  --text-faint:  #8a95a3;

  --accent:      #1f66e0;
  --accent-weak: rgba(31, 102, 224, 0.10);
  --accent-text: #ffffff;

  --up:      #d62828;
  --up-bg:   rgba(214, 40, 40, 0.10);
  --down:    #0f8a55;
  --down-bg: rgba(15, 138, 85, 0.10);
  --flat:    #5c6a7a;
  --flat-bg: rgba(92, 106, 122, 0.10);

  --sev-minor:       #6b7784;
  --sev-minor-bg:    rgba(107, 119, 132, 0.12);
  --sev-major:       #b96c00;
  --sev-major-bg:    rgba(185, 108, 0, 0.12);
  --sev-critical:    #c62222;
  --sev-critical-bg: rgba(198, 34, 34, 0.12);

  --ok:   #0f8a55;
  --warn: #b96c00;
  --err:  #c62222;
  --info: #1f66e0;

  --shadow:    0 1px 2px rgba(16, 32, 44, 0.08), 0 8px 20px rgba(16, 32, 44, 0.08);
  --shadow-sm: 0 1px 2px rgba(16, 32, 44, 0.08);
}

/* ---------------------------------------------- リセット */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.7;
  /* 横スクロールは表・チャートの内側だけに閉じ込める */
  overflow-x: hidden;
}

h1, h2, h3, h4 { line-height: 1.4; margin: 0 0 8px; font-weight: 700; }
h1 { font-size: 1.35rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1.02rem; }
p { margin: 0 0 10px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg, canvas { max-width: 100%; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.sr-only:focus {
  position: static; width: auto; height: auto; margin: 0; clip: auto;
  padding: 6px 10px; background: var(--panel);
}

/* ---------------------------------------------- レイアウト */
.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 16px; }
.main { padding: 20px 0 48px; min-height: 60vh; }
.stack > * + * { margin-top: var(--gap); }
.row { display: flex; align-items: center; gap: var(--gap-sm); flex-wrap: wrap; }
.row--between { justify-content: space-between; }
.spacer { flex: 1 1 auto; }
.center { text-align: center; }
.muted { color: var(--text-muted); }
.small { font-size: 0.85rem; }
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }

.section { margin-bottom: 28px; }
.section__head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.section__title { margin: 0; }
.section__note { color: var(--text-muted); font-size: 0.85rem; }

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}

/* ---------------------------------------------- ヘッダ */
.site-header {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--border);
}
.site-header__inner {
  max-width: var(--maxw); margin: 0 auto; padding: 8px 16px;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.site-header__brand { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 700; }
.site-header__brand:hover { text-decoration: none; }
.site-header__logo { font-size: 1.1rem; }
.site-header__title { white-space: nowrap; }
.site-header__right { display: flex; align-items: center; gap: 10px; margin-left: auto; flex-wrap: wrap; }
.site-header__user { display: flex; align-items: center; gap: 8px; }
.site-header__username { color: var(--text-muted); font-size: 0.85rem; max-width: 10em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.site-header__logout { margin: 0; }
.site-header__clock {
  display: block; max-width: var(--maxw); margin: 0 auto; padding: 0 16px 6px;
  color: var(--text-faint); font-size: 0.75rem; text-align: right;
}

.site-nav { display: flex; gap: 2px; }
.nav-link {
  color: var(--text-muted); padding: 6px 10px; border-radius: var(--radius-sm);
  font-size: 0.9rem; white-space: nowrap;
}
.nav-link:hover { background: var(--panel-2); color: var(--text); text-decoration: none; }
.nav-link--active { color: var(--text); background: var(--accent-weak); font-weight: 600; }

.theme-toggle {
  border: 1px solid var(--border); background: var(--panel-2); color: var(--text-muted);
  width: 32px; height: 32px; border-radius: var(--radius-sm); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; font-size: 0.95rem;
}
.theme-toggle:hover { color: var(--text); border-color: var(--border-strong); }

/* ---------------------------------------------- スナップショット（ヘッダ内の現在値） */
.snapshot { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; min-height: 28px; }
.snapshot__loading { color: var(--text-faint); font-size: 0.8rem; }
.snapshot__item { display: flex; align-items: baseline; gap: 6px; }
.snapshot__name { color: var(--text-muted); font-size: 0.78rem; }
.snapshot__price { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-size: 0.92rem; font-weight: 600; }
.snapshot__change { font-family: var(--font-num); font-size: 0.8rem; }
.snapshot__stale { color: var(--text-faint); font-size: 0.72rem; }

/* ---------------------------------------------- 騰落の色（上昇=赤 / 下落=緑） */
.chg { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.chg--up   { color: var(--up); }
.chg--down { color: var(--down); }
.chg--flat { color: var(--flat); }
/* 色だけに頼らないよう記号を付ける。テンプレート側で書かなくてよいように擬似要素で出す */
.chg--up::before   { content: "▲"; margin-right: 2px; font-size: 0.85em; }
.chg--down::before { content: "▼"; margin-right: 2px; font-size: 0.85em; }
.chg--flat::before { content: "—"; margin-right: 2px; font-size: 0.85em; }
/* 既に記号を書いた場合はこれを足して擬似要素を消す */
.chg--nosign::before { content: none; }

.pill-chg {
  display: inline-flex; align-items: center; gap: 2px;
  padding: 1px 8px; border-radius: var(--radius-pill); font-size: 0.85rem;
  font-family: var(--font-num); font-weight: 600;
}
.pill-chg--up   { color: var(--up);   background: var(--up-bg); }
.pill-chg--down { color: var(--down); background: var(--down-bg); }
.pill-chg--flat { color: var(--flat); background: var(--flat-bg); }

/* ---------------------------------------------- バッジ */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 8px; border-radius: var(--radius-pill);
  font-size: 0.75rem; font-weight: 600; white-space: nowrap;
  border: 1px solid transparent;
}
.badge--minor    { color: var(--sev-minor);    background: var(--sev-minor-bg); }
.badge--major    { color: var(--sev-major);    background: var(--sev-major-bg); }
.badge--critical { color: var(--sev-critical); background: var(--sev-critical-bg); border-color: var(--sev-critical); }

/* 確度（高 / 中 / 低 / 特定できず）。断定に見えないよう控えめな配色にする */
.badge--conf-high    { color: var(--ok);         background: var(--down-bg); }
.badge--conf-mid     { color: var(--warn);       background: var(--sev-major-bg); }
.badge--conf-low     { color: var(--text-muted); background: var(--flat-bg); }
.badge--conf-unknown { color: var(--text-faint); background: var(--flat-bg); border-color: var(--border); }

/* 状態（detected / analyzing / analyzed / skipped / failed） */
.badge--status-detected  { color: var(--text-muted); background: var(--flat-bg); }
.badge--status-analyzing { color: var(--info);       background: var(--accent-weak); }
.badge--status-analyzed  { color: var(--ok);         background: var(--down-bg); }
.badge--status-skipped   { color: var(--text-faint); background: var(--flat-bg); }
.badge--status-failed    { color: var(--err);        background: var(--sev-critical-bg); }

.badge--official { color: var(--info); background: var(--accent-weak); }
.badge--outline  { color: var(--text-muted); background: transparent; border-color: var(--border-strong); }

.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  display: inline-block; padding: 1px 8px; border-radius: var(--radius-sm);
  background: var(--panel-2); border: 1px solid var(--border);
  color: var(--text-muted); font-size: 0.75rem;
}

/* ---------------------------------------------- タイムライン */
.timeline { display: flex; flex-direction: column; gap: 14px; }
.timeline__day {
  position: sticky; top: var(--header-h); z-index: 10;
  margin: 8px 0 -4px; padding: 4px 0;
  background: var(--bg);
  color: var(--text-muted); font-size: 0.8rem; font-weight: 600;
}
.timeline__empty {
  padding: 40px 16px; text-align: center; color: var(--text-muted);
  border: 1px dashed var(--border); border-radius: var(--radius);
}

.event-card {
  background: var(--panel); border: 1px solid var(--border);
  border-left: 3px solid var(--border-strong);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  padding: 14px 16px;
}
.event-card--up       { border-left-color: var(--up); }
.event-card--down     { border-left-color: var(--down); }
.event-card--critical { border-left-color: var(--sev-critical); }
.event-card--pending  { opacity: 0.85; }

.event-card__head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.event-card__time { color: var(--text-muted); font-family: var(--font-num); font-size: 0.82rem; }
.event-card__inst { font-weight: 700; }
.event-card__move { font-family: var(--font-num); font-weight: 700; font-size: 1.02rem; }
.event-card__price { color: var(--text-muted); font-family: var(--font-num); font-size: 0.8rem; }
.event-card__headline { margin: 2px 0 6px; font-size: 1.05rem; font-weight: 700; }
.event-card__summary { margin: 0 0 10px; }
.event-card__body { margin-top: 10px; }
.event-card__section { margin-top: 12px; }
.event-card__section-title {
  color: var(--text-muted); font-size: 0.78rem; font-weight: 700;
  letter-spacing: 0.04em; margin-bottom: 4px;
}
.event-card__foot {
  margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border);
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  color: var(--text-faint); font-size: 0.78rem;
}
.event-card__meta { display: flex; gap: 8px; flex-wrap: wrap; color: var(--text-faint); font-size: 0.78rem; }
.event-card__link { font-size: 0.82rem; }

/* 材料リスト（Claude が挙げた駆動要因） */
.drivers { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.drivers__item {
  padding: 8px 10px; background: var(--panel-2);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.drivers__title { font-weight: 600; }
.drivers__why { color: var(--text-muted); font-size: 0.88rem; margin-top: 2px; }
.drivers__meta { display: flex; gap: 8px; flex-wrap: wrap; color: var(--text-faint); font-size: 0.76rem; margin-top: 4px; }
.drivers__source { color: var(--text-muted); }
.drivers__time { font-family: var(--font-num); }

/* 時間窓に入っていた記事の一覧 */
.article-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.article { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; font-size: 0.88rem; }
.article__time { font-family: var(--font-num); color: var(--text-faint); font-size: 0.78rem; white-space: nowrap; }
.article__pub { color: var(--text-muted); font-size: 0.78rem; white-space: nowrap; }
.article__title { flex: 1 1 14em; min-width: 0; }

/* キー・バリュー（変化率、z 値、トリガなど） */
.kv { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; font-size: 0.86rem; }
.kv__k { color: var(--text-muted); }
.kv__v { font-family: var(--font-num); }

/* ---------------------------------------------- チャート枠 */
.chart-frame {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px;
}
.chart-frame__head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.chart-frame__title { font-size: 0.9rem; font-weight: 700; }
.chart-frame__canvas { width: 100%; height: 240px; min-height: 180px; }
.chart-frame__caption { color: var(--text-faint); font-size: 0.75rem; margin-top: 6px; }
.chart-frame--sm .chart-frame__canvas { height: 160px; }

/* ---------------------------------------------- チャット */
.chat { display: flex; flex-direction: column; gap: 12px; }
.chat__log { display: flex; flex-direction: column; gap: 12px; padding-bottom: 8px; }
.bubble { max-width: 90%; padding: 10px 13px; border-radius: 14px; border: 1px solid var(--border); }
.bubble--user {
  align-self: flex-end; background: var(--accent-weak);
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
  border-bottom-right-radius: 4px;
}
.bubble--assistant { align-self: flex-start; background: var(--panel); border-bottom-left-radius: 4px; }
.bubble__meta { color: var(--text-faint); font-size: 0.72rem; margin-bottom: 4px; }
.bubble__body { white-space: pre-wrap; word-break: break-word; }
.bubble__body p:last-child { margin-bottom: 0; }
.bubble__images { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.bubble__image { max-width: 160px; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.bubble__tools { color: var(--text-faint); font-size: 0.72rem; margin-top: 6px; }

.chat__composer {
  position: sticky; bottom: 0; background: var(--bg);
  padding: 8px 0; border-top: 1px solid var(--border);
  display: flex; gap: 8px; align-items: flex-end;
}
.chat__input { flex: 1 1 auto; min-height: 44px; max-height: 180px; resize: vertical; }
.chat__attach { flex: 0 0 auto; }
.chat__files { display: flex; gap: 6px; flex-wrap: wrap; font-size: 0.78rem; color: var(--text-muted); }

.typing { display: inline-flex; gap: 3px; align-items: center; color: var(--text-muted); }
.typing__dot {
  width: 5px; height: 5px; border-radius: 50%; background: currentColor;
  animation: mw-blink 1.2s infinite ease-in-out;
}
.typing__dot:nth-child(2) { animation-delay: 0.2s; }
.typing__dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes mw-blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }

/* 会話一覧（サイドバー） */
.conv-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.conv-item { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: var(--radius-sm); }
.conv-item:hover { background: var(--panel-2); }
.conv-item--active { background: var(--accent-weak); }
.conv-item__title { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.88rem; }
.conv-item__time { color: var(--text-faint); font-size: 0.72rem; font-family: var(--font-num); }

/* ---------------------------------------------- フォーム */
.form { display: flex; flex-direction: column; gap: 14px; }
.form__row { display: flex; flex-direction: column; gap: 4px; }
.form__label { font-size: 0.85rem; font-weight: 600; color: var(--text-muted); }
.form__optional { font-weight: 400; color: var(--text-faint); margin-left: 4px; }
.form__hint { color: var(--text-faint); font-size: 0.78rem; margin: 0; }
.form__error { color: var(--err); font-size: 0.8rem; margin: 0; }

.input, .textarea, .select {
  width: 100%; padding: 9px 11px;
  background: var(--bg-sunken); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  font-family: inherit; font-size: 16px;   /* iOS で拡大されないよう 16px 以上 */
  line-height: 1.5;
}
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--accent); outline: none;
  box-shadow: 0 0 0 3px var(--accent-weak);
}
.input--error, .textarea--error { border-color: var(--err); }
.input::placeholder, .textarea::placeholder { color: var(--text-faint); }
.textarea { min-height: 96px; resize: vertical; }
.checkbox { display: inline-flex; align-items: center; gap: 6px; font-size: 0.88rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border-radius: var(--radius-sm); cursor: pointer;
  border: 1px solid var(--border-strong); background: var(--panel-2); color: var(--text);
  font-family: inherit; font-size: 0.9rem; font-weight: 600; line-height: 1.4;
  white-space: nowrap;
}
.btn:hover { border-color: var(--accent); color: var(--text); text-decoration: none; }
.btn:disabled, .btn--disabled { opacity: 0.5; cursor: not-allowed; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn--primary:hover { filter: brightness(1.08); }
.btn--ghost { background: transparent; border-color: var(--border); color: var(--text-muted); }
.btn--ghost:hover { background: var(--panel-2); color: var(--text); }
.btn--danger { background: transparent; border-color: var(--err); color: var(--err); }
.btn--danger:hover { background: var(--sev-critical-bg); }
.btn--sm { padding: 4px 9px; font-size: 0.8rem; }
.btn--block { width: 100%; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* 絞り込み */
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filters__group { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.filters__label { color: var(--text-muted); font-size: 0.8rem; }
.chip {
  padding: 3px 10px; border-radius: var(--radius-pill); cursor: pointer;
  border: 1px solid var(--border); background: var(--panel); color: var(--text-muted);
  font-size: 0.8rem; font-family: inherit;
}
.chip:hover { border-color: var(--border-strong); color: var(--text); text-decoration: none; }
.chip--on { background: var(--accent-weak); border-color: var(--accent); color: var(--text); font-weight: 600; }

.pager { display: flex; gap: 8px; justify-content: center; align-items: center; margin-top: 20px; }
.pager__info { color: var(--text-muted); font-size: 0.82rem; }

/* ---------------------------------------------- 通知・状態表示 */
.alert {
  padding: 10px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--panel-2);
  font-size: 0.88rem;
}
.alert--error { color: var(--err);  border-color: var(--err);  background: var(--sev-critical-bg); }
.alert--warn  { color: var(--warn); border-color: var(--warn); background: var(--sev-major-bg); }
.alert--ok    { color: var(--ok);   border-color: var(--ok);   background: var(--down-bg); }
.alert--info  { color: var(--info); border-color: var(--info); background: var(--accent-weak); }

.toast-area {
  position: fixed; right: 12px; bottom: 12px; z-index: 60;
  display: flex; flex-direction: column; gap: 8px; max-width: min(92vw, 360px);
}
.toast {
  padding: 9px 12px; border-radius: var(--radius-sm); box-shadow: var(--shadow);
  background: var(--panel); border: 1px solid var(--border); font-size: 0.85rem;
}
.toast--error { border-color: var(--err); color: var(--err); }
.toast--ok    { border-color: var(--ok);  color: var(--ok); }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--flat); }
.dot--ok   { background: var(--ok); }
.dot--ng   { background: var(--err); }
.dot--idle { background: var(--text-faint); }
.dot--warn { background: var(--warn); }

.spinner {
  display: inline-block; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--border-strong); border-top-color: var(--accent);
  animation: mw-spin 0.8s linear infinite;
}
@keyframes mw-spin { to { transform: rotate(360deg); } }

.skeleton {
  background: linear-gradient(90deg, var(--panel-2) 25%, var(--panel) 37%, var(--panel-2) 63%);
  background-size: 400% 100%; animation: mw-shimmer 1.4s ease infinite;
  border-radius: var(--radius-sm); min-height: 14px;
}
@keyframes mw-shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

/* ---------------------------------------------- 取得状況 */
.status-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.status-card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 14px;
}
.status-card__job { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: 0.92rem; }
.status-card__time { color: var(--text-muted); font-family: var(--font-num); font-size: 0.8rem; }
.status-card__msg { color: var(--text-faint); font-size: 0.78rem; word-break: break-word; }

/* ---------------------------------------------- テーブル */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.table th, .table td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; }
.table th { color: var(--text-muted); font-weight: 600; font-size: 0.8rem; white-space: nowrap; }
.table tbody tr:hover { background: var(--panel-2); }
.table--compact th, .table--compact td { padding: 5px 8px; }
.table__num { text-align: right; font-family: var(--font-num); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------------------------------------------- ログイン画面 */
.page-auth .site-header__clock,
.page-auth .snapshot { display: none; }

.auth { display: flex; justify-content: center; padding: 6vh 0 4vh; }
.auth__card {
  width: 100%; max-width: 380px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 24px 22px;
}
.auth__title { margin-bottom: 4px; }
.auth__lead { color: var(--text-muted); font-size: 0.86rem; margin-bottom: 16px; }
.auth__note { color: var(--text-faint); font-size: 0.78rem; margin: 14px 0 0; }
.auth .alert { margin-bottom: 14px; }

/* ---------------------------------------------- フッタ */
.site-footer { border-top: 1px solid var(--border); padding: 14px 0 28px; background: var(--bg-sunken); }
.disclaimer { color: var(--text-faint); font-size: 0.75rem; margin: 0; }

/* ---------------------------------------------- 携帯（〜560px） */
@media (max-width: 560px) {
  body { font-size: 14.5px; }
  .container { padding: 0 12px; }
  .site-header__inner { padding: 6px 12px; gap: 8px; }
  .site-header__title { font-size: 0.95rem; }
  /* ナビは横いっぱいに折り返して押しやすくする */
  .site-header__right { width: 100%; margin-left: 0; }
  .site-nav { flex: 1 1 auto; }
  .nav-link { padding: 6px 8px; font-size: 0.85rem; }
  .snapshot { order: 3; width: 100%; gap: 10px; overflow-x: auto; padding-bottom: 2px; }
  .snapshot__item { flex: 0 0 auto; }
  .site-header__username { max-width: 6em; }
  .site-header__clock { display: none; }
  .event-card { padding: 12px 13px; }
  .event-card__headline { font-size: 1rem; }
  .bubble { max-width: 96%; }
  .kv { grid-template-columns: auto 1fr; gap: 2px 8px; }
  .chart-frame__canvas { height: 200px; }
}

/* 320〜380px でも数値が折り返さないよう、ヘッダの現在値だけ少し縮める */
@media (max-width: 400px) {
  .snapshot__price { font-size: 0.86rem; }
  .snapshot__name { font-size: 0.72rem; }
}

/* ---------------------------------------------- 動きを減らす設定の尊重 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---------------------------------------------- 印刷（イベントを紙で回覧することがある） */
@media print {
  .site-header, .site-footer, .toast-area, .chat__composer, .filters, .pager { display: none !important; }
  body { background: #fff; color: #000; }
  .event-card { break-inside: avoid; border-color: #999; }
}

/* 右上の「今月の Claude 利用量」（base.html の #mw-usage。app.js が毎分描き直す） */
.usage { display: inline-flex; align-items: baseline; gap: 4px; padding: 3px 10px; border: 1px solid var(--border);
         border-radius: var(--radius-pill); color: var(--text-muted); font-size: 0.8rem; line-height: 1.3;
         text-decoration: none; white-space: nowrap; }
.usage:hover { border-color: var(--border-strong); color: var(--text); text-decoration: none; }
.usage__label, .usage__unit, .usage__sep { font-size: 0.72rem; color: var(--text-faint); }
.usage__cost { color: var(--text); }
@media (max-width: 640px) {
  .usage { font-size: 0.75rem; padding: 2px 8px; }
}

/* ---------------------------------------------- 商品提案（/ifa。IFA 提案支援ツールの生成物の目次） */
.ifa-notice { margin-bottom: 16px; }
.ifa-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.ifa-card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
}
.ifa-card__title { font-size: 1.02rem; margin-bottom: 4px; }
.ifa-card__meta { color: var(--text-muted); font-size: 0.85rem; margin: 0 0 10px; }
