/* 全世界自動リサーチシステム ベトナム版 — Lite（中国版フロント・LISTA AI 風）と同じ見た目（2026-10-23 オーナー「完全に見た目や仕様を一緒にして」）
   色・余白・角丸・影は Lite の LISTA_CSS／_HEADER_CSS／CUSTOM_CSS の値をそのまま写している */
:root {
  --ink: #1a2333;
  --muted: #5a6577;
  --faint: #8a94a6;
  --line: #e3e8f1;
  --bg: #eef2f9;
  --card: #ffffff;
  /* 2026-10-23: ベトナム版は赤×黄（国旗の色）で、Lite（緑）・Pro（紫×金）と見分ける */
  --accent: #da251d;
  --accent-deep: #b3261e;
  --soft: #f6f2ff;
  --soft-line: #cdbcff;
  --field: #f3f5fb;
  --grad: linear-gradient(90deg, #da251d, #ff5a4e, #ffcd00);
  --grad2: linear-gradient(135deg, #da251d 0%, #ff5a4e 100%);
  --shadow: 0 4px 18px rgba(30, 50, 90, 0.06);
  --green: #137333; --orange: #ea8600; --amber: #d97706; --red: #b91c1c; --purple: #7c4dff;
  --sheet: #0f9d58; --sheet-deep: #0b8043; --pick: #2fae2f;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  color: var(--ink);
  background: var(--grad) top / 100% 4px no-repeat, var(--bg);
  line-height: 1.7;
  letter-spacing: 0.02em;
  min-height: 100vh;
  font-size: 15px;
}
a { color: var(--accent); }
button { font-family: inherit; }
.wrap { max-width: 1280px; margin: 0 auto; padding: 16px 16px 48px; }
.hidden { display: none !important; }

/* ===== ヘッダー（Lite の _HEADER_CSS: 国旗＋流れるグラデーションタイトル＋版バッジ＋チップのサブタイトル＋細線） ===== */
.header { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin: 2px 0 4px; }
.logo {
  position: relative; width: 66px; height: 44px; border-radius: 10px; flex: 0 0 66px; margin-top: -3px; line-height: 0;
  background: #fff; display: flex; align-items: center; justify-content: center; overflow: hidden;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.95), 0 6px 18px rgba(222,41,16,0.35);
}
.logo img { width: 66px; height: 44px; display: block; object-fit: cover; }
.logo::after { content: ""; position: absolute; inset: 0; border-radius: 10px; pointer-events: none;
  background: linear-gradient(135deg, rgba(255,255,255,0.45) 0%, rgba(255,255,255,0.08) 38%, rgba(255,255,255,0) 55%, rgba(0,0,0,0.10) 100%); }
.headtext { flex: 1 1 360px; min-width: 0; }
.title {
  font-size: 2.05rem; font-weight: 800; letter-spacing: 0.5px; line-height: 1.15;
  color: #1a2333; -webkit-text-fill-color: #1a2333; background: none; animation: none; filter: none; }
@keyframes flow { to { background-position: 200% center; } }
@media (prefers-reduced-motion: reduce) { .title { animation: none; } }
.jtc-edition { display: inline-block; vertical-align: middle; margin-left: 10px; padding: 2px 10px; font-size: 0.78rem; font-weight: 800; letter-spacing: 2px; border-radius: 999px;
  -webkit-text-fill-color: #ffffff; color: #ffffff; filter: none; font-size: 1.05rem; padding: 3px 14px; letter-spacing: 2px;
  background: linear-gradient(135deg, #da251d, #ff5a4e); border: none; box-shadow: 0 2px 8px rgba(218,37,29,0.25); }
.jtc-ver { display: inline-block; font-size: 0.68rem; font-weight: 800; color: #5b34d6; -webkit-text-fill-color: #5b34d6; background: #f1ebff; border-radius: 999px; padding: 1px 9px; margin-left: 8px; vertical-align: middle; white-space: nowrap; letter-spacing: 0; }
.jtc-sub { margin-top: 6px; display: flex; align-items: center; flex-wrap: wrap; gap: 6px; color: #8a94a6; font-size: 0.82rem; }
.jtc-chip { padding: 1px 10px; border-radius: 999px; background: #f3f5fb; border: 1px solid var(--line); color: #4a5568; font-weight: 600; }
.jtc-x { font-weight: 800; font-size: 1rem; background: linear-gradient(90deg, #da251d, #ffcd00); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.jtc-line { height: 2px; margin: 8px 0 10px; border-radius: 2px; opacity: 0.7; background: linear-gradient(90deg, #da251d, #ff5a4e, #ffcd00 70%, rgba(255,205,0,0)); }
.headright { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.status-badge { display: inline-flex; align-items: center; gap: 8px; border-radius: 999px; padding: 6px 16px; white-space: nowrap; font-size: 0.85rem; font-weight: 600; }
.status-badge .dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.status-badge.idle { background: #f1f3f7; color: #5a6577; } .status-badge.idle .dot { background: #9aa3b2; }
.status-badge.running { background: #e6f4ea; color: #137333; } .status-badge.running .dot { background: #34a853; animation: jtc-pulse 1.4s ease-out infinite; }
.status-badge.done { background: #e8f0fe; color: #1a4fb8; } .status-badge.done .dot { background: #2f6bff; }
@keyframes jtc-pulse { 0% { box-shadow: 0 0 0 0 rgba(52,168,83,0.55); } 70% { box-shadow: 0 0 0 8px rgba(52,168,83,0); } 100% { box-shadow: 0 0 0 0 rgba(52,168,83,0); } }
.run-banner { display: flex; align-items: center; gap: 10px; background: #fff7e6; border: 1px solid #ffd591; border-radius: 10px; padding: 10px 16px; margin: 4px 0 12px; color: #7a4b00; font-weight: 600; font-size: 0.9rem; }
.run-banner .ic { font-size: 1.1rem; }
.quota { background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; font-weight: 600; font-size: 0.82rem; color: var(--muted); }
#logoutBtn { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 5px 12px; font-size: 0.8rem; cursor: pointer; color: var(--muted); }
.ext { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 4px 12px; font-size: 0.8rem; font-weight: 600; border: 1px solid var(--line); background: #fff; }
.ext.on { background: #e6f4ea; color: #137333; border-color: #b7e1c1; }
.ext.off, .ext.warn { background: #fff4e5; color: #9a5b00; border-color: #ffd699; }

/* お知らせ（Lite の .jtc-notice・relnote_box・last_run・resume の帯） */
.notices { display: grid; gap: 10px; margin: 0 0 12px; }
.jtc-notice { background: #fff8e6; border: 1px solid #f3d58a; color: #6b4e00; border-radius: 12px; padding: 10px 14px; font-size: 0.9rem; }
.nbox { border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 14px 16px; background: var(--grad) top / 100% 3px no-repeat, #fff; }
.nbox ul { margin: 4px 0 8px; padding-left: 1.3em; font-size: 0.9rem; }
.nbox .nb-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.alert { border-radius: 10px; padding: 10px 14px; font-size: 0.9rem; }
.alert.error { background: #fdecea; border: 1px solid #f5c2c0; color: #a32d2d; }
.alert.warning { background: #fff4e5; border: 1px solid #ffd699; color: #7a4b00; }
.alert.info { background: #e8f0fe; border: 1px solid #c7d7f5; color: #1a4fb8; }
.alert.success { background: #e6f4ea; border: 1px solid #b7e1c1; color: #137333; }

/* ===== 共通 ===== */
.lx-label { font-size: 0.8rem; font-weight: 800; letter-spacing: 1px; color: var(--accent); margin: 2px 0 6px; }
.card { background: var(--grad) top / 100% 3px no-repeat, var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 18px 20px; }
.card.flat { background: var(--card); }
.card h4 { margin: 0 0 8px; font-size: 0.95rem; }
label.lbl { display: block; font-size: 0.9rem; color: #1f2937; font-weight: 600; margin: 10px 0 4px; }
select, input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="date"], input[type="url"], textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; height: 40px; font-size: 0.9rem; font-family: inherit; background: var(--field); color: var(--ink);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
textarea { height: auto; padding: 9px 12px; }
/* チェック・ラジオ（Streamlit の primaryColor #2563eb と同じ） */
input[type="checkbox"], input[type="radio"] { accent-color: #2563eb; width: 16px; height: 16px; cursor: pointer; }
/* 数字の入力欄の −／＋（st.number_input と同じ） */
.stepper { display: flex; align-items: stretch; border: 1px solid var(--line); border-radius: 10px; background: var(--field); overflow: hidden; height: 40px; transition: border-color .15s, box-shadow .15s; }
.stepper:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(218,37,29,0.15); background: #fff; }
.stepper input[type="number"] { border: none; border-radius: 0; background: transparent; flex: 1 1 auto; min-width: 0; height: 38px; text-align: left; -moz-appearance: textfield; }
.stepper input[type="number"]::-webkit-outer-spin-button, .stepper input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper input:focus { box-shadow: none; background: transparent; }
.stepper .stp { width: 38px; border: none; border-left: 1px solid var(--line); background: #fff; color: var(--muted); font-size: 1.05rem; font-weight: 700; cursor: pointer; transition: background .12s, color .12s; }
.stepper .stp:first-child { border-left: none; border-right: 1px solid var(--line); }
.stepper .stp:hover { background: var(--soft); color: var(--accent-deep); }
.stepper .stp:active { background: #fde7e5; }
/* ⓘ の説明（st の help=）: マウスを乗せると吹き出し */
.help { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; margin-left: 6px; border-radius: 50%; font-size: 0.72rem; color: var(--faint); border: 1px solid var(--line); background: #fff; cursor: help; position: relative; vertical-align: middle; font-weight: 400; }
.help:hover { color: var(--accent); border-color: var(--accent); }
.help::after { content: attr(data-tip); position: absolute; left: 0; top: 22px; z-index: 50; width: max-content; max-width: 260px; background: #1a2333; color: #fff; font-size: 0.76rem; font-weight: 500; line-height: 1.5; padding: 6px 10px; border-radius: 8px; box-shadow: 0 6px 18px rgba(0,0,0,0.18); opacity: 0; visibility: hidden; transform: translateY(-4px); transition: opacity .15s, transform .15s, visibility .15s; white-space: normal; }
.help:hover::after { opacity: 1; visibility: visible; transform: translateY(0); }
/* 右下の通知（st.toast） */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 100001; display: grid; gap: 8px; max-width: min(380px, 92vw); }
.toast { background: #1a2333; color: #fff; border-radius: 12px; padding: 10px 14px; font-size: 0.88rem; line-height: 1.5; box-shadow: 0 8px 24px rgba(0,0,0,0.22); animation: toastin .22s ease-out; display: flex; gap: 8px; align-items: flex-start; }
.toast.success { background: #0f9d58; } .toast.error { background: #c62828; } .toast.info { background: #2563eb; }
.toast.out { animation: toastout .25s ease-in forwards; }
@keyframes toastin { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes toastout { to { opacity: 0; transform: translateY(10px); } }
textarea { min-height: 70px; resize: vertical; }
select:focus, input:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(218,37,29,0.15); background: #fff; }
/* ボタン: いちばん大事な操作＝紫グラデ（44px）／補助＝薄紫＋紫枠／シートに追加＝緑 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px;
  border: none; border-radius: 12px; padding: 10px 18px; font-size: 0.98rem; font-weight: 800; cursor: pointer; color: #fff;
  background: var(--grad2); box-shadow: 0 3px 10px rgba(218,37,29,0.35);
}
.btn, .mini, .chev, .selbtn, .sb-toggle, .tabs button, .rtabs button, .histbtn { transition: transform .08s, background .15s, color .15s, border-color .15s, box-shadow .15s, opacity .15s; }
.btn:not(:disabled):active, .mini:active, .chev:active, .selbtn:active, .histbtn:active { transform: translateY(1px) scale(0.985); }
.btn:not(:disabled):not(.ghost):not(.green):hover { filter: brightness(1.06); box-shadow: 0 5px 14px rgba(218,37,29,0.42); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; box-shadow: none; }
/* 処理中（st.spinner）: 左にくるくる */
.busy { position: relative; pointer-events: none; opacity: 0.8 !important; }
.busy::before { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.45); border-top-color: #fff; animation: spin 0.8s linear infinite; flex: 0 0 14px; }
.busy.ghost::before, .chev.busy::before, .mini.busy::before { border-color: rgba(218,37,29,0.3); border-top-color: var(--accent); }
.chev.busy, .mini.busy { display: inline-flex; align-items: center; gap: 6px; }
.btn.wide { width: 100%; margin-top: 12px; }
.btn.ghost { background: var(--soft); color: var(--accent-deep); border: 1px solid var(--soft-line); box-shadow: none; font-weight: 700; padding: 7px 12px; font-size: 0.85rem; min-height: 36px; }
.btn.ghost:hover { background: #fde7e5; border-color: var(--accent); }
.btn.small { padding: 6px 12px; font-size: 0.82rem; border-radius: 10px; min-height: 34px; }
.btn.green { background: var(--sheet); box-shadow: 0 3px 10px rgba(15,157,88,0.3); }
.btn.green:hover { background: var(--sheet-deep); }
.btn.toggle-open { background: var(--grad2); color: #fff; border-color: transparent; box-shadow: 0 3px 10px rgba(218,37,29,0.35); }
.btn.full { width: 100%; }
.mini { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 2px 10px; font-size: 0.76rem; cursor: pointer; color: var(--muted); }
.mini:hover { border-color: var(--accent); color: var(--accent); }
.hint { font-size: 0.78rem; color: var(--faint); margin-top: 6px; line-height: 1.8; }
.err { display: none; margin-top: 12px; padding: 12px 14px; border-radius: 12px; background: #fdecea; border: 1px solid #f5c2c0; color: #a32d2d; font-size: 0.9rem; white-space: pre-wrap; }
.err.on { display: block; }
.empty { font-size: 0.82rem; color: var(--faint); }
.chip { display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: 0.75rem; font-weight: 600; background: #eef0f5; color: var(--muted); }
.chip.ok { background: #e6f4ea; color: #137333; }
.chip.ng { background: #fdecea; color: #a32d2d; }
.chip.warn { background: #fff4e5; color: #9a5b00; }
.chip.shop { background: #e8f0fe; color: #1a56c4; margin-left: 4px; }
.chip small { color: var(--faint); font-weight: 400; }
.good { color: #0a7a43; } .bad { color: #a32d2d; }
.footer { text-align: center; font-size: 0.75rem; color: var(--faint); margin-top: 30px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 12px; }
.tabs button { border: 1px solid var(--line); background: #fff; color: var(--muted); border-radius: 999px; padding: 7px 14px; font-size: 0.86rem; font-weight: 700; cursor: pointer; }
.tabs button.active { background: var(--grad2); color: #fff; border-color: transparent; box-shadow: 0 3px 10px rgba(218,37,29,0.35); }
.tbl { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.tbl th, .tbl td { border-bottom: 1px solid var(--line); padding: 7px 8px; text-align: left; vertical-align: middle; }
.tbl th { color: var(--muted); font-weight: 600; font-size: 0.78rem; background: #f5f7fb; }
.scroll { overflow-x: auto; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; align-items: end; }
.inline { display: inline-flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.guide { background: #fff; border: 1px dashed var(--line); border-radius: 12px; padding: 12px 14px; font-size: 0.86rem; color: var(--muted); margin-top: 10px; }
.guide ol { margin: 6px 0 0; padding-left: 1.3em; }
.guide.warn { border: 1px solid #ffd699; background: #fff8ec; color: #6b4b00; }
.guide code, code.email { background: #f0f2f7; border-radius: 6px; padding: 2px 8px; font-size: 0.84rem; word-break: break-all; }
code.email { display: block; margin: 6px 0; }
.guide.compact { font-size: 0.8rem; padding: 10px 12px; }
.guide.compact ol { padding-left: 1.2em; }

/* ===== ログイン ===== */
.login { max-width: 460px; margin: 40px auto; text-align: center; }
.login .authform { text-align: left; }
.login .authform .lbl { margin-top: 12px; }
.login .authnote { text-align: left; background: #f0fdf4; color: #166534; border-radius: 10px; padding: 10px 14px; font-size: 0.84rem; }
.authtabs { display: flex; border-bottom: 2px solid var(--line); margin-bottom: 14px; }
.authtabs button { flex: 1; padding: 10px 0; border: none; background: none; font-size: 0.95rem; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; font-family: inherit; }
.authtabs button.active { color: var(--accent); border-bottom-color: var(--accent); }
.authform .lbl:first-child { margin-top: 0; }

/* ===== Lite 型レイアウト: 左サイドバー（白・300px）＋右メイン ===== */
.lite { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 0; align-items: start; background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; }
.sidebar { background: #fff; border-right: 1px solid var(--line); padding: 14px; min-height: 70vh; }
.mainarea { padding: 16px 18px; background: var(--bg); min-height: 70vh; min-width: 0; }
/* サイドバーの開閉（Streamlit の « » と同じ。畳むと細い帯だけ残る） */
.sb-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.sb-toggle { border: 1px solid var(--line); background: #fff; color: var(--muted); border-radius: 999px; width: 30px; height: 30px; font-size: 1rem; font-weight: 800; cursor: pointer; line-height: 1; }
.sb-toggle:hover { border-color: var(--accent); color: var(--accent); }
.lite { grid-template-columns: 0px 300px minmax(0, 1fr); transition: grid-template-columns .28s ease; }
.sidebar { overflow: hidden; min-width: 0; }
.sb-inner { width: 272px; }
.sb-rail { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 12px 0; border-right: 1px solid var(--line); background: #fff; min-height: 70vh; overflow: hidden; opacity: 0; transition: opacity .2s; }
.lite.collapsed { grid-template-columns: 44px 0px minmax(0, 1fr); }
.lite.collapsed .sidebar { padding-left: 0; padding-right: 0; border-right: none; }
.lite.collapsed .sb-rail { opacity: 1; }
.lite:not(.collapsed) .sb-rail { border-right: none; }
.sb-rail-label { writing-mode: vertical-rl; font-size: 0.76rem; font-weight: 700; color: var(--faint); letter-spacing: 0.1em; }
@media (max-width: 1000px) {
  .lite { grid-template-columns: 1fr; }
  .lite.collapsed { grid-template-columns: 1fr; }
  .sb-inner { width: auto; }
  .sb-rail { display: none; }
  .lite.collapsed .sidebar { display: none; }
  .lite.collapsed .sb-rail { display: flex; flex-direction: row; min-height: 0; border-right: none; border-bottom: 1px solid var(--line); padding: 8px 12px; opacity: 1; }
  .sb-rail-label { writing-mode: horizontal-tb; }
  .sidebar { border-right: none; border-bottom: 1px solid var(--line); min-height: 0; }
  .mainarea { min-height: 0; padding: 14px 12px; }
}
.scard { border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; background: var(--grad) top / 100% 3px no-repeat, #fff; margin-bottom: 10px; box-shadow: var(--shadow); }
.scard.plain { background: #fff; box-shadow: none; }
.sc-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sc-sub { font-size: 0.8rem; color: var(--faint); margin-top: 2px; }
.who { font-weight: 700; font-size: 0.9rem; color: var(--muted); }
.who .usage { margin-left: 8px; background: #e6f4ea; color: #137333; border-radius: 999px; padding: 1px 9px; font-size: 0.75rem; }
.who-mail { font-size: 0.75rem; color: #8a93a3; margin-top: 2px; }
.sidebar .lbl { margin-top: 10px; }
.sidebar .hint { margin-top: 4px; }
.mode { display: flex; gap: 6px; flex-wrap: wrap; }
.mode label { flex: 1 1 100%; border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px 6px 10px; cursor: pointer; background: #fff; font-size: 0.86rem; color: var(--muted); }
.mode label.sel { border-color: var(--accent); background: rgba(218,37,29,0.08); color: var(--ink); box-shadow: 0 0 0 2px rgba(218,37,29,0.12); }
.mode input { margin-right: 6px; }
.mode small { display: block; color: var(--faint); font-size: 0.74rem; margin: 0 0 0 22px; line-height: 1.4; }
.picklist { max-height: 180px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; padding: 4px 6px; background: #fff; }
.picklist label { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 5px 4px; border-radius: 8px; font-size: 0.86rem; cursor: pointer; }
.picklist label:hover { background: #f5f7fb; }
.picklist label small { flex-basis: 100%; margin-left: 22px; color: var(--faint); font-size: 0.74rem; }
.picklist .empty { padding: 6px 4px; }
details.adv { margin-top: 12px; font-size: 0.86rem; color: var(--muted); border-top: 1px dashed var(--line); padding-top: 8px; }
details.adv summary { cursor: pointer; font-weight: 600; }
details.adv .lbl { margin-top: 8px; }
label.chk { display: flex; align-items: center; gap: 8px; font-size: 0.86rem; color: var(--ink); margin: 8px 0 0; cursor: pointer; font-weight: 500; }
label.chk input { width: auto; }
/* サイドバーの折りたたみ（Lite の st.expander） */
details.sbx { margin-top: 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
details.sbx summary { cursor: pointer; font-weight: 700; font-size: 0.88rem; padding: 10px 12px; list-style: none; }
details.sbx summary::-webkit-details-marker { display: none; }
details.sbx summary::after { content: "⌄"; float: right; color: var(--faint); }
details.sbx[open] summary::after { content: "⌃"; }
details.sbx .sbx-body { padding: 0 12px 12px; font-size: 0.84rem; color: var(--muted); }
details.sbx .sbx-body ol { margin: 4px 0 6px; padding-left: 1.3em; }
.histlist { display: grid; gap: 6px; max-height: 420px; overflow: auto; }
.histbtn { display: block; width: 100%; text-align: left; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 0.35rem 0.7rem; cursor: pointer; font-size: 0.8rem; line-height: 1.45; color: var(--ink); }
.histbtn:hover { border-color: var(--accent); background: rgba(218,37,29,0.04); }
.histbtn.cur { border: 2px solid #7c4dff; background: #f3efff; }
.histbtn .h1 { display: block; }
.histbtn .h2 { display: block; color: var(--faint); font-size: 0.76rem; }
.active-card { font-size: 0.82rem; }
.active-card .hl { font-weight: 700; }
.active-card .ln { font-size: 0.78rem; color: var(--muted); margin-left: 1.2rem; }
.two-btn { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }

/* ===== 実行中パネル（Lite の CENTER_STATUS: 画面中央に固定） ===== */
.center-status { position: fixed; inset: 0; z-index: 100000; display: flex; align-items: center; justify-content: center; background: rgba(238,242,249,0.55); backdrop-filter: blur(2px); padding: 16px; }
.cs-card { width: min(820px, 96vw); max-height: 92vh; overflow: auto; background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 18px 20px; box-shadow: 0 8px 30px rgba(30,50,90,0.18); }
.prog-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.prog-phase { font-weight: 700; font-size: 0.98rem; color: #5b34d6; }
.spinner { width: 20px; height: 20px; border-radius: 50%; border: 3px solid rgba(218,37,29,0.25); border-top-color: var(--accent); animation: spin 0.9s linear infinite; flex: 0 0 20px; }
@keyframes spin { to { transform: rotate(360deg); } }
.bar { height: 8px; border-radius: 999px; background: #eef0f5; overflow: hidden; margin-top: 10px; }
.bar i { display: block; height: 100%; width: 0; background: var(--grad); transition: width .4s; }
.steps { display: grid; gap: 8px; margin-top: 12px; }
.steps7 { grid-template-columns: repeat(7, 1fr); }
.step { border: 1px solid var(--line); border-radius: 12px; padding: 8px 9px; background: #fff; font-size: 0.78rem; }
.step.on { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(218,37,29,0.12); }
.step.done { border-color: #b7e1c1; background: #f3faf5; }
.step .n { font-weight: 700; }
.step .d { color: var(--faint); font-size: 0.74rem; }
@media (max-width: 900px) { .steps7 { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 600px) { .steps7 { grid-template-columns: repeat(2, 1fr); } }
.blocked { margin-top: 10px; padding: 12px 14px; border-radius: 12px; background: #fff3cd; border: 2px solid #f0b429; color: #6b4b00; font-size: 0.95rem; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(240,180,41,0.18); } }
.warnnote { color: #9a5b00; }
.cs-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; border-top: 1px dashed var(--line); padding-top: 10px; }

/* ===== 結果（Lite の reshead: 題・3 色の数字カード・丸いタブ） ===== */
.rhead { margin-bottom: 12px; padding: 14px 16px; }
.result-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.lx-res-title { font-size: 1.35rem; font-weight: 800; color: var(--ink); line-height: 1.4; flex: 1 1 auto; }
.lx-res-title .sub { display: block; font-size: 0.8rem; color: var(--faint); font-weight: 600; }
.result-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.lx-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 6px 0 12px; }
.lx-kpi { border-radius: 14px; padding: 14px 16px; color: #fff; display: flex; flex-direction: column; gap: 2px; }
.lx-kpi .l { font-size: 0.78rem; font-weight: 700; opacity: 0.92; }
.lx-kpi .v { font-size: 1.7rem; font-weight: 800; line-height: 1.25; }
.lx-kpi .v small { font-size: 0.85rem; margin-left: 2px; }
.lx-kpi .s { font-size: 0.72rem; opacity: 0.9; }
.lx-kpi.blue { background: linear-gradient(135deg, #2f6bff 0%, #55a4ff 100%); }
.lx-kpi.purple { background: linear-gradient(135deg, #7c4dff 0%, #c86dd7 100%); }
.lx-kpi.orange { background: linear-gradient(135deg, #f6588a 0%, #ff9a3d 100%); }
@media (max-width: 720px) { .lx-kpis { grid-template-columns: 1fr; } }
.rtabs { display: flex; gap: 4px; flex-wrap: wrap; background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 4px; box-shadow: var(--shadow); }
.rtabs button { flex: 1 1 0; border: none; background: none; color: var(--muted); padding: 8px 14px; font-size: 0.95rem; font-weight: 800; cursor: pointer; border-radius: 999px; }
.rtabs button.active { background: var(--grad2); color: #fff; box-shadow: 0 3px 10px rgba(218,37,29,0.35); }
.rtabs .cnt { font-weight: 800; }
.sheetbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.sheetbar .btn.green { flex: 1 1 320px; }
.sheetbar .sel-count { font-size: 0.84rem; color: var(--muted); }
.sheetmsg { display: grid; gap: 8px; margin-top: 8px; }
.sp-open-sheet { display: block; text-align: center; margin: 4px 0 8px; padding: 10px 14px; border-radius: 12px; background: var(--sheet); color: #fff !important; font-weight: 800; text-decoration: none !important; }
.sp-open-sheet:hover { background: var(--sheet-deep); }
.cards { display: grid; gap: 10px; margin-top: 10px; }
.cards .empty.card { margin-top: 10px; }
.note { font-size: 0.78rem; color: var(--faint); margin-top: 10px; }

/* 行カード（Lite の lrow: 上端の虹色ライン＋白。詳細を開いている行は緑の枠） */
.lrow { border: 1px solid var(--line); border-radius: 16px; background: var(--grad) top / 100% 3px no-repeat, #fff; padding: 12px 14px; box-shadow: var(--shadow); }
.lrow.active { background: linear-gradient(90deg, #2fae2f, #2fae2f) top / 100% 4px no-repeat, #f3fbf3; border: 2px solid #2fae2f; box-shadow: 0 0 0 3px rgba(47,174,47,0.14); }
.lrow.dim { opacity: 0.75; }
.lrow-grid { display: grid; grid-template-columns: 120px 120px 120px minmax(0, 1fr); gap: 14px; align-items: start; }
.lrow-grid.nopick { grid-template-columns: 120px 120px minmax(0, 1fr); }
@media (max-width: 760px) { .lrow-grid, .lrow-grid.nopick { grid-template-columns: 1fr 1fr; } .lrow-grid .col-main { grid-column: 1 / -1; } .lrow-grid .col-pick { grid-column: 1 / -1; } }
.col-img, .col-pick { min-width: 0; }
.thumbwrap { display: block; text-decoration: none; color: inherit; }
.thumb-img { display: block; width: 100%; max-width: 180px; aspect-ratio: 1 / 1; border-radius: 12px; border: 1px solid #cfd7e3; overflow: hidden; background: #fff; margin: 0 auto; }
.thumb-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-img.none { border-style: dashed; border-color: #c9d1de; display: flex; align-items: center; justify-content: center; }
.thumb-img .noimg { font-size: 0.78rem; color: #6b7280; }
.sp-src { display: block; text-align: center; font-size: 0.78rem; font-weight: 800; margin: 4px auto 0; border-radius: 999px; padding: 1px 8px; width: fit-content; max-width: 100%; color: var(--muted); background: #f3f5fb; }
.sp-src-mercari { background: #fff4e6; color: #b45309; }
.sp-src-lazada, .sp-src-shopee, .sp-src-sup { background: #eaf0ff; color: #1f4fd6; }
/* 行の左端「＋ シートに追加」（Lite の selbtn: 選ぶ前＝薄い緑の地＋緑の文字／選んだら緑の塗り） */
.selbtn { width: 100%; min-height: 36px; border-radius: 12px; padding: 0 6px; font-size: 0.8rem; font-weight: 800; cursor: pointer; white-space: nowrap; border: 1px solid #bfe3bf; background: #eef8ee; color: #0a8a0a; }
.selbtn:hover { background: #e2f3e2; border-color: #0ca30c; }
.selbtn.on { background: var(--pick); border-color: var(--pick); color: #fff; }
.selbtn.on:hover { opacity: 0.92; }
.selbtn.bottom { min-height: 42px; height: 42px; font-size: 0.9rem; margin-top: 8px; }
.sp-added { background: #eaf7ef; border: 1px solid #bfe3cc; border-radius: 12px; padding: 10px 6px; text-align: center; font-size: 0.8rem; font-weight: 800; color: #0a6b3a; line-height: 1.4; }
.col-pick .hint { font-size: 0.74rem; margin-top: 0; }
.col-main { min-width: 0; }
.ttl { font-weight: 700; font-size: 0.98rem; line-height: 1.5; }
.ttl a { color: var(--ink); text-decoration: none; }
.ttl a:hover { text-decoration: underline; }
.pill { display: inline-block; border-radius: 999px; padding: 3px 10px; font-size: 0.78rem; font-weight: 800; margin: 2px 0 2px 6px; vertical-align: middle; white-space: nowrap; }
/* 数値タイル（Lite の st.metric: 平らな面で色分け。利益額＝緑・粗利率＝紫） */
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 8px 0 6px; }
@media (max-width: 560px) { .metrics { grid-template-columns: repeat(2, 1fr); } }
.metric { border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; background: var(--field); }
.metric .k { font-size: 0.78rem; font-weight: 700; color: var(--muted); }
.metric .v { font-size: 1.45rem; font-weight: 700; line-height: 1.3; }
.metric.profit { background: #e9f7ef; border-color: #c6ead4; } .metric.profit .k { color: #0a6b3a; } .metric.profit .v { color: #0a7a43; }
.metric.rate { background: var(--soft); border-color: #e3d9ff; } .metric.rate .k, .metric.rate .v { color: var(--accent-deep); }
.metric .v.neg { color: #a32d2d !important; }
.sp-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; font-size: 0.8rem; color: var(--muted); }
.sp-tag { display: inline-flex; align-items: center; gap: 6px; background: var(--field); border-radius: 999px; padding: 3px 10px; text-decoration: none; color: var(--muted); font-size: 0.8rem; }
.sp-tag .k { color: #6b7280; font-size: 0.78rem; }
.sp-tag b { color: var(--ink); font-weight: 700; }
a.sp-tag:hover { background: rgba(218,37,29,0.08); }
.copyrows { margin-top: 8px; display: grid; gap: 6px; }
.copyrow { display: grid; grid-template-columns: 110px 1fr auto; gap: 8px; align-items: center; font-size: 0.84rem; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; }
.copyrow .k { color: var(--muted); font-weight: 600; }
.copyrow .v { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; background: #f3f6fb; border: 1px solid #d5dce8; border-radius: 6px; padding: 2px 8px; }
@media (max-width: 640px) { .copyrow { grid-template-columns: 1fr auto; } .copyrow .k { grid-column: 1 / -1; } }
.lrow-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.foot-btns { display: inline-flex; gap: 6px; margin-left: auto; }
/* ▼詳細（Lite の chev_*: 紫の枠＋薄紫の地の横長ピル） */
.chev { min-height: 40px; padding: 0 14px; white-space: nowrap; border: 1.5px solid #7c4dff; border-radius: 999px; background: var(--soft); color: var(--accent-deep); font-weight: 700; font-size: 0.85rem; cursor: pointer; box-shadow: 0 2px 6px rgba(218,37,29,0.15); }
.chev:hover { background: #7c4dff; color: #fff; }

@keyframes slidein { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.lrow-detail, .subbox, details[open] > .exp-body, details[open] > .sbx-body, details[open] > .pop-body, .nbox, .alert { animation: slidein .2s ease-out; }
details.expander summary, details.sbx summary, details.pop summary { transition: background .15s; }
details.expander summary:hover, details.sbx summary:hover, details.pop summary:hover { background: #f7f8fc; }
dialog.vdlg[open] { animation: slidein .2s ease-out; }
dialog.vdlg[open]::backdrop { animation: fadein .2s ease-out; }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
/* 詳細（Lite の detail_: 影なしの薄い面。左＝内訳表、右＝仕入れ先の操作） */
.lrow-detail { margin-top: 10px; background: #fbfcff; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; display: grid; grid-template-columns: 1.35fr 1fr; gap: 18px; font-size: 0.86rem; }
@media (max-width: 860px) { .lrow-detail { grid-template-columns: 1fr; } }
.bd-table { border: 1px solid var(--line); border-radius: 12px; background: #fff; overflow: hidden; }
.bd-row { display: grid; grid-template-columns: 1fr 1.6fr; gap: 8px; align-items: center; padding: 7px 12px; border-bottom: 1px solid #eef1f6; }
.bd-row:last-child { border-bottom: none; }
.bd-hdr { font-size: 0.74rem; font-weight: 800; color: var(--faint); letter-spacing: 0.04em; }
.bd-l { color: var(--muted); font-weight: 600; }
.bd-v { color: var(--ink); }
.bd-strong { font-weight: 800; }
.bd-spec { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.bd-spec-tag { font-size: 0.74rem; font-weight: 800; border-radius: 999px; padding: 2px 9px; white-space: nowrap; }
.bd-spec-tag.ok { background: #e3f5e3; color: #0a6b0a; }
.bd-spec-tag.ai { background: #f1ebff; color: #5b34d6; }
.bd-inline { display: flex; gap: 6px; align-items: center; }
.bd-inline input { width: 140px; padding: 6px 10px; }
.dstack { display: grid; gap: 8px; }
.dstack .btn.full { min-height: 44px; font-weight: 800; }
.subbox { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: #fff; display: grid; gap: 8px; }
.alt { display: grid; grid-template-columns: 56px 1fr auto; gap: 10px; align-items: center; border-bottom: 1px solid #eef1f6; padding: 6px 0; }
.alt:last-child { border-bottom: none; }
.alt .cap { font-size: 0.78rem; color: var(--muted); line-height: 1.5; }
.thumb.small { display: block; width: 56px; height: 56px; border-radius: 8px; border: 1px solid var(--line); overflow: hidden; background: #fff; }
.thumb.small img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.small.none { background: #f5f7fb; }
.ais-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 6px 0 4px; }
.ais-tile { position: relative; display: block; aspect-ratio: 1 / 1; border-radius: 10px; border: 1.5px solid #e3e8f2; overflow: hidden; background: #fff; transition: transform .15s; }
.ais-tile img { width: 100%; height: 100%; object-fit: cover; border-radius: 9px; display: block; }
.ais-tile:hover { transform: scale(1.6); z-index: 5; border-color: #7c4dff; box-shadow: 0 8px 24px rgba(0,0,0,.22); }
.ais-zoom { position: absolute; right: 4px; bottom: 4px; background: rgba(0,0,0,.55); color: #fff; border-radius: 999px; padding: 1px 6px; font-size: 0.7rem; opacity: 0; }
.ais-tile:hover .ais-zoom { opacity: 1; }
.ais-main { position: absolute; left: 4px; top: 4px; background: #7c4dff; color: #fff; border-radius: 999px; padding: 0 6px; font-size: 0.66rem; font-weight: 800; }
.ais-tile:nth-child(4n+1) { transform-origin: left center; } .ais-tile:nth-child(4n) { transform-origin: right center; }
.linkrow { display: flex; flex-wrap: wrap; gap: 6px; }
details.pop { border: 1px solid var(--line); border-radius: 12px; background: #fff; }
details.pop summary { cursor: pointer; padding: 10px 12px; font-weight: 700; font-size: 0.86rem; list-style: none; }
details.pop summary::-webkit-details-marker { display: none; }
details.pop .pop-body { padding: 0 12px 12px; display: grid; gap: 10px; }
.lbl2 { font-size: 0.76rem; color: var(--muted); font-weight: 700; margin-bottom: 4px; }
.comps .chip { margin: 2px 2px 2px 0; }
.mini-tbl { border-collapse: collapse; font-size: 0.82rem; }
.mini-tbl td, .mini-tbl th { border-bottom: 1px solid var(--line); padding: 3px 10px 3px 0; text-align: left; vertical-align: top; }
.mini-tbl th { color: var(--faint); font-weight: 600; }
.mini-tbl td:nth-child(odd) { color: var(--muted); }
details.desc summary { cursor: pointer; font-size: 0.8rem; color: var(--muted); }
.site { display: inline-block; border-radius: 6px; padding: 1px 8px; font-size: 0.72rem; font-weight: 700; color: #fff; background: #8a94a6; vertical-align: middle; }
.site.lazada { background: #0f146d; }
.site.shopee { background: #ee4d2d; }
.top3-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
@media (max-width: 760px) { .top3-row { grid-template-columns: 1fr; } }
.cnd { display: grid; grid-template-columns: auto auto 1fr; gap: 8px; align-items: center; border: 1px solid var(--line); border-radius: 10px; padding: 6px 8px; text-decoration: none; color: var(--ink); background: #fff; font-size: 0.8rem; }
.cnd:hover { border-color: var(--accent); }
.medal { font-size: 1.1rem; }
.cnd-body { min-width: 0; line-height: 1.45; }
.cnd-body .pill { margin-left: 4px; }

/* その他タブの折りたたみ（Lite の st.expander） */
details.expander { border: 1px solid var(--line); border-radius: 16px; background: #fff; padding: 0; box-shadow: var(--shadow); }
details.expander summary { cursor: pointer; font-weight: 700; font-size: 0.92rem; padding: 12px 16px; list-style: none; }
details.expander summary::-webkit-details-marker { display: none; }
details.expander summary::before { content: "▸ "; color: var(--faint); }
details.expander[open] summary::before { content: "▾ "; }
details.expander .exp-body { padding: 0 12px 12px; display: grid; gap: 8px; }
.grp { display: grid; gap: 8px; }
.grp-h { font-size: 0.82rem; font-weight: 700; color: var(--muted); border-left: 3px solid var(--line); padding-left: 8px; margin-top: 4px; }

/* 🧩 バリエーションを選ぶ（Lite の st.dialog: 横幅いっぱい近く） */
dialog.vdlg { width: min(1280px, 96vw); max-width: 96vw; border: 1px solid var(--line); border-radius: 18px; padding: 18px 20px; box-shadow: 0 8px 30px rgba(30,50,90,0.25); }
dialog.vdlg::backdrop { background: rgba(26,35,51,0.35); }
.vd-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.vd-head h3 { margin: 0; font-size: 1.05rem; flex: 1 1 auto; }
.vd-top { display: grid; grid-template-columns: 1.5fr 3fr; gap: 12px; align-items: end; margin-bottom: 8px; }
@media (max-width: 760px) { .vd-top { grid-template-columns: 1fr; } }
.vd-list { border: 1px solid var(--line); border-radius: 12px; padding: 4px 6px; background: #fff; max-height: 60vh; overflow: auto; }
.vd-row { display: grid; grid-template-columns: 70px 2.6fr 1fr 1.5fr; gap: 10px; align-items: center; border-bottom: 1px solid #eef1f6; border-radius: 8px; padding: 6px 8px; }
.vd-row.hdr { border-bottom: none; }
.vd-row.cur { background: var(--soft); }
.vd-row img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.vd-row .mark-ai { color: #7c4dff; font-weight: 800; }
.vd-row .mark-cur { color: #0a7a43; font-weight: 800; }
@media (max-width: 640px) { .vd-row { grid-template-columns: 56px 1fr; } .vd-row .vd-price, .vd-row .vd-btn { grid-column: 2; } }
