/* T-BASE（チームT 受講生ポータル）デモ
   配色は元のチームTサイト（discord-nippo の webapp/src/index.css）に合わせたオレンジ基調。
   レイアウト（余白・カード・ナビの作り）は development/student-portal/student.css をコピーして自己完結させたもの。
   フォントはシステムの日本語フォントを使う（外部読み込みなし）。 */

:root {
  /* 元サイトの定義: --bg #fbf6f0 / --panel2 #f5efe7 / --border #efe6da / --text #2c2a28 / --accent #f97316 / --accent-soft #fff1e6 / --green #15a34a / --red #e0533d */
  --accent: #f97316;          /* メイン（線・バー・塗り。白文字は載せない） */
  --accent-dark: #cc4a0a;     /* 白文字を載せるボタン・選択中タブ */
  --accent-hover: #a83b07;
  --accent-text: #b3400b;     /* 白地の上の橙の文字・リンク（読める濃さ） */
  --accent-soft: #fff1e6;
  --accent-line: #fbd5b5;
  --green: #15a34a;           /* 収益・増加・連携済み */
  --green-text: #12803c;
  --green-bg: #e8f7ee;
  --red: #e0533d;             /* 減少・止まっている・要再連携 */
  --red-text: #c13b26;
  --red-bg: #fdeeea;
  --warn-text: #8a5a00;
  --warn-bg: #fff4d6;
  --ink: #2c2a28;
  --body: #4a4540;
  --muted: #7a7268;           /* 元サイトの #9b9389 は小さい文字だと読みにくいので少し濃く */
  --faint: #9b9389;
  --line: #efe6da;
  --bg: #fbf6f0;
  --surface: #fff;
  --sub: #f5efe7;
  --field-line: #e3d6c5;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
[hidden] { display: none !important; }
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}
html { background: var(--bg); }
body {
  background: var(--bg);
  color: var(--body);
  font-family: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic", Meiryo, sans-serif;
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 3px solid rgba(249, 115, 22, 0.4); outline-offset: 2px; }

.container {
  width: min(1100px, calc(100% - 40px));
  margin: 0 auto;
  padding: 30px 0 56px;
}
.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 22px;
}
.page-kicker { color: var(--accent-text); font-size: 12px; font-weight: 700; }
.page-title { color: var(--ink); font-size: 26px; line-height: 1.35; font-weight: 800; }
.page-description { color: var(--muted); font-size: 13px; margin-top: 4px; }
.section { padding: 22px 0; border-top: 1px solid var(--line); }
.section:first-child { border-top: 0; padding-top: 0; }
.section-heading { color: var(--ink); font-size: 17px; font-weight: 800; line-height: 1.5; }
.section-meta { color: var(--muted); font-size: 12px; margin-top: 2px; }
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 16px;
}
.card h2, .card h3 { color: var(--ink); font-size: 16px; font-weight: 800; margin-bottom: 12px; }
.card h3 .sub, .sub { color: var(--muted); font-size: 12px; font-weight: 500; margin-left: 6px; }

/* ボタン */
.btn {
  align-items: center;
  background: var(--accent-dark);
  border: 1px solid var(--accent-dark);
  border-radius: 6px;
  color: #fff;
  display: inline-flex;
  font-size: 14px;
  font-weight: 700;
  gap: 7px;
  justify-content: center;
  line-height: 1.2;
  min-height: 42px;
  padding: 10px 15px;
  text-decoration: none;
}
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.secondary { background: var(--surface); border-color: var(--field-line); color: var(--ink); }
.btn.secondary:hover { background: var(--sub); border-color: var(--faint); }
.btn.small { min-height: 34px; padding: 6px 11px; font-size: 12px; }
.btn.full { width: 100%; }
.btn svg, .nav-icon svg, .ico svg { height: 18px; width: 18px; stroke-width: 2; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; }
.link-btn { background: none; border: 0; color: var(--accent-text); font-size: 12px; font-weight: 700; padding: 2px 0; text-decoration: underline; }
.link-btn:hover { color: var(--accent-hover); }

/* フォーム */
.field label, .field-label { color: var(--ink); display: block; font-size: 12px; font-weight: 700; margin-bottom: 5px; }
input[type="text"], input[type="search"], input[type="number"], select {
  background: #fff;
  border: 1px solid var(--field-line);
  border-radius: 6px;
  color: var(--ink);
  font-size: 15px;
  padding: 9px 11px;
  width: 100%;
}
input:focus, select:focus { border-color: var(--accent); outline: 2px solid rgba(249, 115, 22, 0.18); }
input[type="search"] { -webkit-appearance: none; }
.check-inline { align-items: center; color: var(--ink); cursor: pointer; display: inline-flex; font-size: 13px; font-weight: 700; gap: 8px; min-height: 42px; }
.check-inline input { accent-color: var(--accent-dark); height: 18px; width: 18px; }

/* バッジ・タブ */
.badge {
  align-items: center;
  background: var(--accent-soft);
  border-radius: 4px;
  color: var(--accent-text);
  display: inline-flex;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.3;
  padding: 3px 7px;
  white-space: nowrap;
}
.badge.type { background: var(--sub); color: #6b5a48; }
.badge.green { background: var(--green-bg); color: var(--green-text); }
.badge.warn { background: var(--warn-bg); color: var(--warn-text); }
.badge.danger { background: var(--red-bg); color: var(--red-text); }
.badge.gray { background: var(--sub); color: var(--muted); }
.badge.dark { background: var(--ink); color: #fff; }

.tabs { border-bottom: 1px solid var(--line); display: flex; gap: 20px; margin-bottom: 18px; overflow-x: auto; }
.tabs .tab {
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: 700;
  padding: 10px 1px;
  white-space: nowrap;
}
.tabs .tab.active { border-bottom-color: var(--accent); color: var(--ink); }
.filter-tabs { gap: 8px; overflow: visible; flex-wrap: wrap; border-bottom: 0; margin-bottom: 14px; }
.filter-tabs .tab { border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; background: var(--surface); }
.filter-tabs .tab.active { background: var(--accent-dark); border-color: var(--accent-dark); color: #fff; }
.filter-tabs .tab .n { font-weight: 500; opacity: 0.8; margin-left: 3px; font-size: 11px; }

.notice { background: var(--sub); border-left: 3px solid var(--faint); color: var(--body); font-size: 13px; line-height: 1.7; margin: 10px 0; padding: 10px 12px; }
.notice.soft { background: var(--accent-soft); border-color: var(--accent); }
.notice.warn { background: var(--warn-bg); border-color: #d99a1c; }
.empty { align-items: center; color: var(--muted); display: flex; flex-direction: column; font-size: 13px; gap: 8px; justify-content: center; min-height: 140px; text-align: center; }

/* ===== 画面上部：デモ帯 + 上部ナビ ===== */
.top-stack { position: sticky; top: 0; z-index: 500; }
#demo-bar {
  align-items: center;
  background: #3b342f;
  border-bottom: 1px solid #2c2a28;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  justify-content: space-between;
  min-height: 44px;
  padding: 5px max(16px, calc((100% - 1100px) / 2));
}
#demo-bar.is-admin { background: #27343c; border-bottom-color: #1d272d; }
.demo-label { align-items: center; color: #fff; display: inline-flex; font-size: 12px; font-weight: 800; gap: 6px; }
.demo-label .dot { background: var(--accent); border-radius: 50%; height: 8px; width: 8px; }
#demo-bar.is-admin .demo-label .dot { background: #7ec3dc; }
.view-switch { background: #fff; border: 1px solid var(--line); border-radius: 999px; display: inline-flex; padding: 2px; }
.view-switch button {
  background: transparent;
  border: 0;
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  padding: 5px 13px;
  white-space: nowrap;
}
.view-switch button[aria-pressed="true"] { background: var(--accent-dark); color: #fff; }
#demo-bar.is-admin .view-switch button[aria-pressed="true"] { background: #27343c; }

#student-nav { background: var(--surface); border-bottom: 1px solid var(--line); display: block; }
#student-nav .nav-inner {
  align-items: center;
  display: flex;
  gap: 26px;
  margin: 0 auto;
  max-width: 1100px;
  min-height: 60px;
  padding: 0;
  width: min(1100px, calc(100% - 40px));
}
.site-brand { align-items: center; color: var(--ink); display: inline-flex; font-size: 18px; font-weight: 800; gap: 9px; text-decoration: none; }
.brand-mark { align-items: center; background: var(--accent-dark); border-radius: 5px; color: #fff; display: inline-flex; height: 26px; justify-content: center; width: 26px; }
.brand-mark svg { height: 16px; width: 16px; }
#student-nav .nav-item {
  align-items: center;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  display: inline-flex;
  font-size: 13px;
  font-weight: 700;
  gap: 7px;
  min-height: 60px;
  padding: 2px 0 0;
  text-decoration: none;
}
#student-nav .nav-item:hover, #student-nav .nav-item.active { border-bottom-color: var(--accent); color: var(--ink); }
#student-nav .nav-right { margin-left: auto; }
#student-nav .utage-link { color: var(--accent-text); font-size: 12px; font-weight: 700; text-decoration: none; }
#student-nav .utage-link:hover { text-decoration: underline; }
.nav-icon { display: inline-flex; }

#student-nav .l-short { display: none; }
.welcome + .section { border-top: 0; padding-top: 0; }

/* トースト */
#toast-container { align-items: center; bottom: 28px; display: flex; flex-direction: column; gap: 8px; left: 0; pointer-events: none; position: fixed; right: 0; z-index: 9999; }
.toast { background: var(--ink); border-radius: 6px; color: #fff; font-size: 13px; max-width: min(88vw, 420px); opacity: 0; padding: 10px 16px; pointer-events: auto; transform: translateY(8px); transition: opacity 0.2s, transform 0.2s; }
.toast.show { opacity: 1; transform: translateY(0); }

/* ===== ホーム ===== */
.welcome { border-bottom: 1px solid var(--line); padding-bottom: 20px; margin-bottom: 22px; }
.welcome-name { color: var(--ink); font-size: 26px; font-weight: 800; line-height: 1.35; }
.entry-grid { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.entry-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px;
  text-decoration: none;
}
.entry-card:hover { border-color: var(--accent); box-shadow: 0 2px 10px rgba(249, 115, 22, 0.12); }
.entry-card .ico { align-items: center; background: var(--accent-soft); border-radius: 8px; color: var(--accent-text); display: inline-flex; height: 40px; justify-content: center; width: 40px; }
.entry-card .ico svg { height: 22px; width: 22px; }
.entry-card h3 { color: var(--ink); font-size: 16px; font-weight: 800; margin: 4px 0 0; }
.entry-card p { color: var(--muted); font-size: 13px; }
.entry-card .go { color: var(--accent-text); font-size: 13px; font-weight: 700; margin-top: auto; padding-top: 6px; }
.entry-card.utage .ico { background: var(--sub); color: var(--ink); }
/* スクールクエストの帯：オレンジのカードに埋もれないよう、濃い色で区別する */
.quest-banner {
  align-items: center;
  background: linear-gradient(135deg, #2c2a28, #4a3a2f);
  border: 1px solid #2c2a28;
  border-radius: 8px;
  color: #fff;
  display: flex;
  gap: 16px;
  margin-top: 14px;
  padding: 16px 18px;
  text-decoration: none;
}
.quest-banner:hover { border-color: var(--accent); box-shadow: 0 2px 10px rgba(44, 42, 40, 0.25); }
.quest-banner .mon { align-items: center; background: var(--accent); border-radius: 10px; color: #fff; display: inline-flex; flex: none; height: 44px; justify-content: center; width: 44px; }
.quest-banner .mon svg, .flow-box .em svg { fill: none; height: 24px; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2; width: 24px; }
.quest-banner h3 { color: #fff; font-size: 16px; font-weight: 800; }
.quest-banner p { color: #e7ddd2; font-size: 13px; }
.utage-bar { align-items: center; border: 1px dashed var(--faint); border-radius: 8px; display: flex; gap: 12px; justify-content: space-between; margin-top: 14px; padding: 12px 16px; }
.utage-bar p { color: var(--muted); font-size: 13px; }

.stat-grid { display: grid; gap: 12px; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 14px; }
.stat-grid.five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.stat-tile { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; }
.stat-tile .k { color: var(--muted); font-size: 12px; font-weight: 700; }
.stat-tile .v { color: var(--ink); font-size: 26px; font-weight: 800; line-height: 1.3; }
.stat-tile .v small { color: var(--muted); font-size: 13px; font-weight: 600; margin-left: 2px; }
.stat-tile .d { font-size: 12px; font-weight: 700; }
.up { color: var(--green-text); }
.down { color: var(--red-text); }
.flat { color: var(--muted); }
.stalled-list { display: flex; flex-direction: column; }
.stalled-list .row { align-items: center; border-bottom: 1px solid var(--line); display: flex; gap: 10px; justify-content: space-between; padding: 9px 0; }
.stalled-list .row:last-child { border-bottom: 0; }
.stalled-list .nm { color: var(--ink); font-weight: 700; }
.stalled-list .meta { color: var(--muted); font-size: 12px; }

/* ===== 今月の目標（収入） ===== */
.goal-card { padding: 20px; }
.goal-head { align-items: baseline; display: flex; flex-wrap: wrap; gap: 6px 12px; justify-content: space-between; margin-bottom: 10px; }
.goal-head h2 { margin: 0; }
.goal-top { align-items: flex-end; display: flex; flex-wrap: wrap; gap: 6px 24px; justify-content: space-between; }
.goal-now .k, .goal-target .k { color: var(--muted); font-size: 12px; font-weight: 700; }
.goal-now .v { color: var(--green-text); font-size: 34px; font-weight: 800; line-height: 1.2; font-variant-numeric: tabular-nums; }
.goal-target .v { color: var(--ink); font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.meter { background: var(--sub); border-radius: 999px; height: 12px; margin: 10px 0 4px; overflow: hidden; }
.meter i { background: var(--green); border-radius: 999px; display: block; height: 100%; min-width: 2px; }
.meter.small { height: 8px; margin: 4px 0 0; }
.meter-label { color: var(--muted); display: flex; font-size: 12px; font-weight: 700; justify-content: space-between; }
.meter-label b { color: var(--green-text); }
.goal-facts { display: grid; gap: 10px; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 12px; }
.goal-fact { background: var(--sub); border-radius: 8px; padding: 10px 12px; }
.goal-fact .k { color: var(--muted); font-size: 11px; font-weight: 700; }
.goal-fact .v { color: var(--ink); font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; }
.goal-fact .n { color: var(--muted); font-size: 11px; }
.goal-done { background: var(--green-bg); border-left: 3px solid var(--green); color: var(--green-text); font-size: 13px; font-weight: 700; margin-top: 12px; padding: 8px 12px; }
.goal-record { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 14px; }
.goal-record form, .goal-edit form { align-items: flex-end; display: flex; gap: 10px; }
.goal-record .field, .goal-edit .field { flex: 1; max-width: 260px; }
.yen-input { position: relative; }
.yen-input span { color: var(--muted); font-weight: 700; left: 11px; position: absolute; top: 50%; transform: translateY(-50%); }
.yen-input input { padding-left: 26px; }
.goal-edit { background: var(--accent-soft); border-radius: 8px; margin-top: 10px; padding: 12px; }
.goal-days { margin-top: 16px; }
.goal-days .bars { height: 80px; }
.goal-days .bar { background: var(--green); opacity: 1; }
.goal-days .bar.today { background: var(--accent); }
.goal-days .bar.future { background: transparent; border-bottom: 2px solid var(--line); border-radius: 0; }
.goal-days .bar.zero { background: transparent; border-bottom: 2px solid var(--line); border-radius: 0; }
.goal-foot { align-items: center; display: flex; flex-wrap: wrap; gap: 6px 14px; justify-content: space-between; margin-top: 10px; }
.goal-foot .section-meta { margin: 0; }

/* 管理者：講座生ごとの目標 */
.cell-meter { min-width: 150px; }
.cell-meter .pc { color: var(--ink); font-size: 12px; font-weight: 800; }

/* ===== リサーチ ===== */
.filter-panel { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 16px; margin-bottom: 14px; }
.filter-row { display: grid; gap: 12px; grid-template-columns: minmax(0, 2fr) repeat(2, minmax(0, 1fr)) auto; align-items: end; }
.filter-row.admin { grid-template-columns: minmax(0, 2fr) repeat(3, minmax(0, 1fr)) auto; }
.result-meta { color: var(--muted); font-size: 12px; margin-bottom: 10px; }
.rs-list { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.rs-card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; display: flex; flex-direction: column; gap: 8px; padding: 16px; min-width: 0; }
.rs-card.is-dismissed { opacity: 0.55; }
.rs-head { align-items: flex-start; display: flex; gap: 8px; justify-content: space-between; }
.rs-user { color: var(--ink); font-weight: 800; font-size: 14px; word-break: break-all; }
.rs-dname { color: var(--muted); font-size: 12px; margin-left: 6px; }
.rs-dates { color: var(--muted); font-size: 12px; }
.rs-labels { display: flex; flex-wrap: wrap; gap: 5px; }
.rs-text { background: var(--sub); border-radius: 6px; color: var(--ink); font-size: 14px; line-height: 1.75; padding: 10px 12px; }
.rs-stats { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.rs-stat { color: var(--muted); font-size: 12px; }
.rs-stat b { color: var(--ink); font-size: 14px; margin-left: 4px; }
.rs-stat.main b { color: var(--accent-text); font-size: 17px; }
.rs-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.rs-chip { background: var(--accent-soft); border-radius: 999px; color: var(--accent-text); font-size: 12px; font-weight: 700; padding: 2px 10px; }
.rs-chip b { font-size: 14px; margin-left: 2px; }
.rs-chip.hot { background: var(--green-bg); color: var(--green-text); }
.rs-points { background: var(--accent-soft); border-left: 3px solid var(--accent); border-radius: 6px; display: grid; gap: 6px; padding: 10px 12px; }
.rs-points-title { align-items: center; color: var(--accent-text); display: flex; font-size: 12px; font-weight: 800; gap: 5px; }
.rs-points-title svg { fill: none; height: 15px; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2; width: 15px; }
.rs-note { display: grid; font-size: 13px; gap: 8px; grid-template-columns: 3.2em 1fr; line-height: 1.6; }
.rs-note .k { color: var(--accent-text); font-size: 11px; font-weight: 800; padding-top: 2px; }
.rs-memo { background: #fffbea; border: 1px dashed #e8d48a; border-radius: 6px; color: #5b4a00; font-size: 13px; padding: 8px 10px; }
.rs-memo .k { font-size: 11px; font-weight: 800; margin-right: 6px; }
.rs-foot { align-items: center; display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; margin-top: auto; padding-top: 4px; }
.rs-foot a { color: var(--accent-text); font-size: 13px; font-weight: 700; }

.rs-actions { align-items: center; display: flex; gap: 6px; }
.rs-copy { align-items: center; background: transparent; border: 1px solid var(--field-line); border-radius: 6px; color: var(--muted); display: inline-flex; font-size: 12px; font-weight: 700; gap: 5px; line-height: 1.2; padding: 4px 9px; white-space: nowrap; }
.rs-copy svg { fill: none; height: 14px; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2; width: 14px; }
.rs-copy:hover { background: var(--sub); color: var(--ink); }
.rs-copy.done { background: var(--green-bg); border-color: #bfe6cf; color: var(--green-text); }
.rs-full-toggle { background: none; border: 0; color: var(--accent-text); font-size: 12px; font-weight: 700; padding: 0; text-align: left; text-decoration: underline; width: fit-content; }
.rs-full { background: #fff; border: 1px solid var(--line); border-radius: 6px; color: var(--ink); font-size: 14px; line-height: 1.8; padding: 10px 12px; white-space: pre-wrap; overflow-wrap: anywhere; }

/* ===== 表 ===== */
.table-wrap { overflow-x: auto; }
table.tbl { border-collapse: collapse; font-size: 13px; width: 100%; }
.tbl th { background: var(--sub); color: var(--muted); font-size: 12px; font-weight: 700; padding: 8px 10px; text-align: left; white-space: nowrap; }
.tbl td { border-bottom: 1px solid var(--line); color: var(--ink); padding: 10px; vertical-align: middle; }
.tbl .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tbl tr.is-stalled td { background: #fff7ee; }
.tbl .nm { font-weight: 800; }
.tbl .sub { display: block; margin-left: 0; font-weight: 500; }
.tbl button.link { background: none; border: 0; color: var(--accent-text); font-weight: 700; padding: 0; text-decoration: underline; }
.tbl .cell-main { max-width: 360px; }
.tbl .nb { display: inline-block; min-width: 92px; text-align: right; }
.tbl .nb b { display: block; font-weight: 700; }
.mb { background: var(--sub); border-radius: 2px; display: block; height: 4px; margin-top: 3px; overflow: hidden; }
.mb u { background: var(--accent); display: block; height: 100%; text-decoration: none; }

/* ===== 分析 ===== */
.seg { display: inline-flex; border: 1px solid var(--field-line); border-radius: 6px; overflow: hidden; background: var(--surface); }
.seg button { background: transparent; border: 0; border-right: 1px solid var(--field-line); color: var(--muted); font-size: 13px; font-weight: 700; padding: 8px 14px; }
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-text); }
.toolbar { align-items: center; display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; margin-bottom: 14px; }
.bars { align-items: flex-end; display: flex; gap: 3px; height: 130px; padding-top: 6px; }
.bars .bar { background: var(--accent); border-radius: 3px 3px 0 0; flex: 1; min-height: 2px; min-width: 3px; opacity: 0.9; }
.bars .bar.zero { background: var(--line); }
.bars-axis { color: var(--muted); display: flex; font-size: 11px; justify-content: space-between; margin-top: 4px; }
.two-col { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.two-col > .card { margin-bottom: 0; }
.hbar-row { align-items: center; display: grid; gap: 10px; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) 54px; padding: 7px 0; font-size: 13px; }
.hbar-row .nm { color: var(--ink); font-weight: 700; }
.hbar { background: var(--sub); border-radius: 2px; height: 8px; overflow: hidden; }
.hbar i { background: var(--accent); display: block; height: 100%; }
.hbar-row .n { color: var(--ink); font-weight: 800; text-align: right; }
.top-post { border-bottom: 1px solid var(--line); padding: 10px 0; }
.top-post:last-child { border-bottom: 0; }
.top-post .t { color: var(--ink); font-size: 14px; }
.top-post .m { color: var(--muted); font-size: 12px; margin-top: 2px; }
.rank { background: var(--ink); border-radius: 4px; color: #fff; font-size: 11px; font-weight: 800; margin-right: 8px; padding: 1px 7px; }

/* ===== 投稿・アカウント ===== */
.acct-row { align-items: center; display: flex; flex-wrap: wrap; gap: 14px; justify-content: space-between; }
.acct-main { align-items: center; display: flex; gap: 14px; min-width: 0; }
.avatar { align-items: center; background: var(--accent-soft); border-radius: 50%; color: var(--accent-text); display: inline-flex; flex: 0 0 auto; font-size: 20px; font-weight: 800; height: 52px; justify-content: center; width: 52px; }
.acct-name { color: var(--ink); font-size: 16px; font-weight: 800; }
.acct-sub { color: var(--muted); font-size: 12px; }
.acct-follow { align-items: center; display: flex; flex-wrap: wrap; gap: 4px 18px; }
.acct-follow .k { color: var(--muted); font-size: 11px; font-weight: 700; }
.acct-follow .v { color: var(--ink); font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.3; }
.detail-head { align-items: center; display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; margin-bottom: 8px; }
.best-tile { align-items: center; background: var(--accent-soft); border: 1px solid var(--accent-line); border-radius: 8px; display: flex; flex-wrap: wrap; gap: 6px 14px; justify-content: space-between; margin-bottom: 14px; padding: 12px 16px; }
.best-tile .k { color: var(--accent-text); font-size: 11px; font-weight: 800; }
.best-tile .t { color: var(--ink); font-size: 14px; font-weight: 700; }
.best-tile .m { color: var(--muted); font-size: 12px; }
.pt-tools { align-items: flex-end; display: flex; flex-wrap: wrap; gap: 10px 14px; justify-content: space-between; margin-bottom: 10px; }
.pt-tools .field { min-width: 190px; }
.pt-sortsel { display: none; }

/* 投稿の一覧：数字が主役。列の見出しを押すと並び替え */
.pt { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.pt-cols { display: grid; gap: 0 12px; grid-template-columns: 96px minmax(0, 1.7fr) 120px repeat(4, minmax(78px, 1fr)); padding: 0 14px; }
.pt-head { background: var(--sub); border-bottom: 1px solid var(--line); }
.pt-head button, .pt-head span { background: none; border: 0; color: var(--muted); font-size: 12px; font-weight: 700; padding: 9px 0; text-align: left; white-space: nowrap; }
.pt-head button.num { text-align: right; }
.pt-head button:hover { color: var(--ink); }
.pt-head button.on { color: var(--accent-text); }
.pt-item { border-bottom: 1px solid var(--line); }
.pt-item:last-child { border-bottom: 0; }
.pt-row { align-items: center; background: transparent; border: 0; color: var(--ink); cursor: pointer; padding-bottom: 11px; padding-top: 11px; text-align: left; width: 100%; }
.pt-row:hover { background: #fffaf5; }
.pt-row .c-date { color: var(--muted); font-size: 12px; font-weight: 700; }
.pt-row .tx { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; font-size: 14px; line-height: 1.55; overflow: hidden; }
.pt-row .c-text .badge { margin-top: 4px; }
.pt-row .nv { display: block; font-variant-numeric: tabular-nums; text-align: right; }
.pt-row .nv b { font-size: 14px; font-weight: 700; }
.pt-row .nv .nbar { background: var(--sub); border-radius: 2px; display: block; height: 4px; margin-top: 3px; overflow: hidden; }
.pt-row .nv .nbar u { background: var(--accent); display: block; height: 100%; text-decoration: none; }
.pt-row .nv.zero b { color: var(--faint); font-weight: 500; }
.pt-row .lbl { display: none; }
.pt-item.is-high { box-shadow: inset 3px 0 0 var(--green); }
.pt-item.is-dim .tx, .pt-item.is-dim .nv b { color: var(--muted); font-weight: 500; }
.pt-item.is-dim .nbar u { background: var(--faint); }
.pt-item.is-open { background: #fffaf5; }
.pt-detail { border-top: 1px dashed var(--line); padding: 12px 14px 16px; }
.pt-detail .full { background: #fff; border: 1px solid var(--line); border-radius: 6px; color: var(--ink); font-size: 14px; line-height: 1.8; padding: 10px 12px; }
.pt-detail .grid { display: grid; gap: 8px; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 10px; }
.pt-detail .cell { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px; }
.pt-detail .cell .k { color: var(--muted); font-size: 11px; font-weight: 700; }
.pt-detail .cell .v { color: var(--ink); font-size: 15px; font-weight: 800; font-variant-numeric: tabular-nums; }
.pt-detail .meta { color: var(--muted); font-size: 12px; margin-top: 8px; }

/* ===== クエスト ===== */
.flow { align-items: stretch; display: grid; gap: 8px; grid-template-columns: 1fr auto 1fr auto 1fr; }
.flow-box { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 12px; text-align: center; }
.flow-box .em { color: var(--accent-text); line-height: 1; margin-bottom: 6px; }
.flow-box.xp .em { color: var(--warn-text); }
.flow-box.mon .em { color: var(--green-text); }
.flow-box h4 { color: var(--ink); font-size: 14px; font-weight: 800; }
.flow-box p { color: var(--muted); font-size: 12px; line-height: 1.55; }
.flow-box.act { border-top: 3px solid var(--accent); }
.flow-box.xp { background: var(--warn-bg); border-color: #f0dca0; }
.flow-box.mon { background: var(--green-bg); border-color: #bfe6cf; }
.flow-arrow { align-self: center; color: var(--faint); font-size: 22px; font-weight: 800; }
.flow-sources { display: grid; gap: 8px; }
.mon-preview { align-items: center; background: var(--sub); border-radius: 8px; display: flex; gap: 14px; margin-top: 14px; padding: 14px; }
.mon-preview .big { align-items: baseline; background: var(--accent-dark); border-radius: 50%; color: #fff; display: inline-flex; flex: none; font-size: 24px; font-weight: 800; height: 60px; justify-content: center; line-height: 60px; width: 60px; }
.mon-preview .big small { font-size: 11px; font-weight: 700; margin-right: 1px; }
.stages i { color: var(--faint); font-style: normal; }
.stages .now { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); font-weight: 700; }
.xpbar { background: #eadfce; border-radius: 4px; height: 9px; margin: 4px 0; overflow: hidden; width: 100%; }
.xpbar i { background: var(--accent); display: block; height: 100%; }
.stages { display: flex; flex-wrap: wrap; gap: 6px 10px; font-size: 13px; margin-top: 10px; }
.stages span { background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 2px 11px; }
.quest-cta { align-items: center; display: flex; flex-wrap: wrap; gap: 14px; justify-content: space-between; }
.quest-cta p { color: var(--muted); font-size: 13px; }
.xp-cell { min-width: 110px; }

/* ===== マイページ（プロフィール・SNS連携） ===== */
.readonly-grid { display: grid; gap: 0 18px; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 8px; }
.readonly-item { border-bottom: 1px solid var(--line); padding: 8px 0; }
.readonly-item .k { color: var(--muted); font-size: 11px; font-weight: 700; }
.readonly-item .v { color: var(--ink); font-size: 15px; font-weight: 700; }
.goal-inline { align-items: flex-end; display: flex; gap: 10px; margin-top: 10px; }
.goal-inline .field { flex: 1; max-width: 260px; }
.link-acct { border: 1px solid var(--line); border-radius: 8px; margin-top: 12px; padding: 14px 16px; }
.link-acct-head { align-items: center; display: flex; flex-wrap: wrap; gap: 8px 10px; margin-bottom: 10px; }
.link-acct-head .grow { flex: 1; }
.steps { display: grid; gap: 6px; grid-template-columns: repeat(5, minmax(0, 1fr)); list-style: none; margin-bottom: 12px; }
.steps li { align-items: center; color: var(--muted); display: flex; flex-direction: column; font-size: 11px; font-weight: 700; gap: 4px; line-height: 1.35; text-align: center; }
.steps .n { align-items: center; background: var(--sub); border-radius: 50%; color: var(--muted); display: inline-flex; font-size: 12px; height: 26px; justify-content: center; width: 26px; }
.steps .n svg { fill: none; height: 14px; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 3; width: 14px; }
.steps li.done .n { background: var(--green); color: #fff; }
.steps li.done { color: var(--green-text); }
.steps li.now .n { background: var(--accent-dark); box-shadow: 0 0 0 4px var(--accent-soft); color: #fff; }
.steps li.now { color: var(--ink); }
.link-panel { background: var(--accent-soft); border-radius: 8px; padding: 12px 14px; }
.link-panel.ok { background: var(--green-bg); }
.link-panel h4 { color: var(--ink); font-size: 14px; font-weight: 800; margin-bottom: 4px; }
.link-panel p { font-size: 13px; margin-bottom: 6px; }
.link-panel .btn { margin-top: 4px; }
.link-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.howto { color: var(--body); font-size: 13px; line-height: 1.8; margin: 4px 0 8px 20px; }
.howto li { margin-bottom: 3px; }
.howto.plain { list-style: disc; }
.link-form { align-items: flex-end; display: flex; gap: 10px; margin-top: 14px; }
.link-form .field { flex: 1; max-width: 320px; }
.fold { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; margin-top: 14px; }
.fold summary { color: var(--ink); cursor: pointer; font-size: 14px; font-weight: 700; padding: 11px 14px; }
.fold[open] summary { border-bottom: 1px solid var(--line); }
.fold-body { padding: 12px 14px 14px; }
.demo-card { background: var(--sub); border-style: dashed; }
.demo-card h3 { font-size: 14px; margin-bottom: 8px; }
.modal-back { align-items: center; background: rgba(44, 42, 40, 0.5); display: flex; inset: 0; justify-content: center; padding: 16px; position: fixed; z-index: 2000; }
.modal { background: #fff; border-radius: 12px; max-height: 90vh; max-width: 460px; overflow-y: auto; padding: 20px; width: 100%; }
.modal h3 { color: var(--ink); font-size: 17px; font-weight: 800; margin-bottom: 10px; }
.modal p { font-size: 14px; margin-bottom: 8px; }
.modal-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-top: 14px; }

/* ===== スマホ ===== */
@media (max-width: 800px) {
  .container { padding: 20px 0 92px; width: min(100% - 32px, 620px); }
  .page-title { font-size: 23px; }
  .page-header { align-items: flex-start; flex-direction: column; gap: 7px; }
  #demo-bar { padding: 5px 16px; }
  #student-nav { border-bottom: 0; border-top: 1px solid var(--line); bottom: 0; left: 0; position: fixed; right: 0; }
  #student-nav .nav-inner { gap: 0; justify-content: space-around; min-height: 58px; padding: 0 6px var(--safe-bottom); width: 100%; }
  #student-nav .site-brand, #student-nav .nav-right { display: none; }
  #student-nav .nav-item { border-bottom: 0; border-top: 2px solid transparent; flex: 1; flex-direction: column; font-size: 10px; gap: 2px; justify-content: center; min-height: 58px; min-width: 0; padding: 5px 2px 2px; }
  #student-nav .nav-label { line-height: 1.2; white-space: nowrap; }
  #student-nav .l-full { display: none; }
  #student-nav .l-short { display: inline; }
  #student-nav .nav-item:hover, #student-nav .nav-item.active { border-bottom: 0; border-top-color: var(--accent); }
  #toast-container { bottom: calc(72px + var(--safe-bottom)); }
  .entry-grid, .two-col, .rs-list { grid-template-columns: 1fr; }
  .filter-row, .filter-row.admin { grid-template-columns: 1fr 1fr; }
  .filter-row > .field:first-child { grid-column: 1 / -1; }
  .stat-grid, .stat-grid.five { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-grid.five .stat-tile:last-child { grid-column: 1 / -1; }
  /* 表は、スマホでは1行ごとのカードに組み替える（app.js が td に data-label を付ける） */
  .tbl.stack thead { display: none; }
  .tbl.stack, .tbl.stack tbody { display: block; }
  .tbl.stack tr { border-bottom: 1px solid var(--line); display: block; padding: 10px 0; }
  .tbl.stack tr:last-child { border-bottom: 0; }
  .tbl.stack tr.is-stalled { background: #fff7ee; }
  .tbl.stack td { align-items: center; background: transparent !important; border: 0; display: flex; gap: 12px; justify-content: space-between; padding: 3px 0; text-align: right; }
  .tbl.stack td::before { color: var(--muted); content: attr(data-label); flex: 0 0 auto; font-size: 12px; font-weight: 700; text-align: left; }
  .tbl.stack td[data-label=""] { display: block; text-align: left; }
  .tbl.stack td[data-label=""]::before { content: none; }
  .tbl.stack .xp-cell, .tbl.stack .cell-meter { min-width: 0; }
  .tbl.stack .xp-cell .xpbar { max-width: 140px; }
  .tbl.stack .cell-meter { display: block; text-align: left; }
  .tbl.stack .cell-meter::before { display: block; margin-bottom: 2px; }
  /* 投稿の一覧：1投稿1カード。数字4つを横並び */
  .pt-head { display: none; }
  .pt-sortsel { display: block; }
  .pt-cols { gap: 4px 8px; grid-template-columns: repeat(4, minmax(0, 1fr)); padding: 0 12px; }
  .pt-row { padding-bottom: 12px; padding-top: 12px; }
  .pt-row .c-date { grid-column: 1 / 3; grid-row: 1; }
  .pt-row .c-type { grid-column: 3 / 5; grid-row: 1; justify-self: end; }
  .pt-row .c-text { grid-column: 1 / -1; grid-row: 2; }
  .pt-row .nv { text-align: left; }
  .pt-row .lbl { color: var(--muted); display: block; font-size: 10px; font-weight: 700; line-height: 1.3; margin-bottom: 1px; white-space: nowrap; }
  .pt-row .c-num { margin-top: 4px; }
  .pt-detail .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .flow { grid-template-columns: 1fr; }
  .flow-arrow { transform: rotate(90deg); justify-self: center; }
  .welcome-name { font-size: 22px; }
  .stalled-list .row { align-items: flex-start; }
  .goal-now .v { font-size: 30px; }
  .goal-facts { grid-template-columns: 1fr; }
  .goal-fact { align-items: baseline; display: flex; justify-content: space-between; gap: 8px; }
  .goal-record .field, .goal-edit .field { max-width: none; }
}
@media (max-width: 480px) {
  .rs-head { flex-wrap: wrap; }
  .steps { gap: 2px; }
  .steps li { font-size: 10px; }
  .goal-inline .field, .link-form .field { max-width: none; }
  .link-acct { padding: 12px; }
  .container { width: min(100% - 24px, 620px); }
  .stat-tile .v { font-size: 22px; }
  .quest-banner { align-items: flex-start; }
  .utage-bar { align-items: flex-start; flex-direction: column; }
  .hbar-row { grid-template-columns: minmax(0, 1fr) 56px; }
  .hbar-row .hbar { grid-column: 1 / -1; order: 3; }
  .view-switch button { padding: 5px 10px; }
  .acct-follow { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
