/*!*************************************************************************************************************************************************************************************************************************************************************!*\
  !*** css ./node_modules/next/dist/build/webpack/loaders/css-loader/src/index.js??ruleSet[1].rules[14].oneOf[12].use[2]!./node_modules/next/dist/build/webpack/loaders/postcss-loader/src/index.js??ruleSet[1].rules[14].oneOf[12].use[3]!./app/globals.css ***!
  \*************************************************************************************************************************************************************************************************************************************************************/
/* ---------------------------------------------------------------
   転売リサーチダッシュボード — デザイントークンと共通クラス
   元の webapp はインラインstyleのみだったので、色・余白・角丸を
   トークンに切り出して画面間で揃うようにした。
   --------------------------------------------------------------- */

:root {
  --bg: #fbfbfb;
  --surface: #ffffff;
  --surface-2: #fafafa;
  --border: #ececec;
  --border-strong: #e4e4e7;
  --line: #f1f1f1;

  --text: #18181b;
  --text-body: #3f3f46;
  --text-muted: #71717a;
  --text-faint: #a1a1aa;

  --brand: #5b5bd6;
  --brand-dark: #4f4fc4;
  --brand-soft: #eeeef9;
  --brand-border: #d4d4f1;
  --brand-rgb: 91, 91, 214;

  --green: #0e9f6e;
  --green-soft: #ecfaf3;
  --green-border: #c9eddd;
  --red: #e5484d;
  --red-soft: #fef6f6;
  --red-border: #f6cdcd;
  --amber: #b7791f;
  --amber-soft: #fffaf0;
  --amber-border: #f2ddb0;

  --r-sm: 7px;
  --r: 9px;
  --r-lg: 12px;
  --r-pill: 999px;

  --shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 16px 48px -16px rgba(0, 0, 0, 0.3);

  /* 画面枠の寸法(サイドバー幅・ヘッダー高さ)。本文は画面幅いっぱい使う */
  --side-w: 248px;
  --header-h: 58px;
  --content-pad-x: 16px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", system-ui, -apple-system,
    "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ===============================================================
   画面枠 — 左サイドバー / 上ヘッダー / 本文スクロール
   ヘッダーとサイドバーは固定し、本文だけが縦に流れる。
   一覧が長くなっても、現在地(画面名)と件数が常に見えるようにするため。
   =============================================================== */
.shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
  background: var(--surface);
}

/* ---------- サイドバー ---------- */
.sidebar {
  width: var(--side-w);
  flex: 0 0 auto;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 8px 20px;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.01em;
  color: var(--brand);
}

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
}
.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* 区切りの小見出し(リサーチ / 仕入れ・販売 …) */
.nav-group {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.09em;
  color: var(--text-faint);
  padding: 4px 8px 8px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.nav + .nav-group,
.side-soon + .nav-group,
.side-guide + .nav-group,
.nav-group + .nav-group {
  padding-top: 18px;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* 1行に「番号・アイコン・画面名・ひとこと説明」を収める。
   説明を添えるのは、どの画面で何をするのかを覚えていなくても選べるようにするため。 */
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 8px;
  border: none;
  border-radius: var(--r);
  background: transparent;
  color: var(--text-body);
  text-decoration: none;
  text-align: left;
  transition: background 0.12s;
}
.nav-item:hover {
  background: #f7f7f8;
}
.nav-item[data-active="true"] {
  background: var(--brand-soft);
}

.nav-step {
  width: 22px;
  height: 22px;
  border-radius: var(--r-sm);
  background: #f4f4f5;
  color: var(--text-faint);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  flex: 0 0 auto;
}
.nav-item[data-active="true"] .nav-step {
  background: var(--brand);
  color: #fff;
}

.nav-icon {
  display: flex;
  flex: 0 0 auto;
  color: var(--text-faint);
}
.nav-item[data-active="true"] .nav-icon {
  color: var(--brand);
}

.nav-txt {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  min-width: 0;
}
.nav-txt b {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-body);
  line-height: 1.25;
}
.nav-item[data-active="true"] .nav-txt b {
  font-weight: 600;
  color: var(--brand);
}
.nav-txt i {
  font-size: 10.5px;
  color: var(--text-faint);
  font-style: normal;
  line-height: 1.3;
}

/* 使い方の導線。メニューと色を変えて、押せることが分かるようにする */
.side-guide {
  display: block;
  margin: 10px 0;
  padding: 9px 11px;
  border-radius: 8px;
  background: var(--brand-soft);
  color: var(--brand);
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 600;
}
.side-guide:hover {
  filter: brightness(0.97);
}
.side-guide[data-active="true"] {
  background: var(--brand);
  color: #fff;
}

/* まだ無い機能。押せないことが見て分かる形で置く */
.side-soon {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.side-soon > span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--text-faint);
  font-size: 12.5px;
}
.soon {
  font-size: 9.5px;
  color: var(--text-faint);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 6px;
  font-weight: 500;
  white-space: nowrap;
}

/* ---------- サイドバー下部(ログイン情報) ---------- */
.sidebar-foot {
  margin-top: auto;
  padding-top: 14px;
}
.side-user {
  padding: 14px 8px 4px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.avatar-sq {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--brand-soft);
  color: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  flex: 0 0 auto;
}
.user-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1 1;
}
.side-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  word-break: break-all;
}
.acct-status {
  font-size: 10.5px;
  font-style: normal;
  font-weight: 600;
  color: var(--green);
}
.acct-status.admin {
  color: var(--brand);
}
.side-logout {
  font-size: 11px;
  color: var(--text-faint);
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  cursor: pointer;
  flex: 0 0 auto;
}
.side-logout:hover {
  color: var(--brand);
  text-decoration: underline;
}
.side-links {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 12px 8px 2px;
}
.side-links a {
  font-size: 11.5px;
  color: var(--text-muted);
  text-decoration: none;
}
.side-links a:hover {
  color: var(--brand);
  text-decoration: underline;
}

/* ---------- 右側(ヘッダー + 本文) ---------- */
.main {
  flex: 1 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.app-header {
  height: var(--header-h);
  flex: 0 0 auto;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 16px;
  padding: 0 var(--content-pad-x);
  background: var(--surface);
}
/* 画面名が長いときは、件数を押し出さずに自分が省略される */
.screen-title {
  font-size: 14.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.hspace {
  flex: 1 1;
}

/* 件数の表示。今どれだけ溜まっているかを、画面を移らずに見えるようにする */
.quota {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
  flex: 0 0 auto;
}
.quota .q {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface);
  white-space: nowrap;
}
.quota .q span {
  font-size: 11px;
  color: var(--text-muted);
}
.quota .q b {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
}
.quota .q[data-busy="true"] {
  border-color: var(--brand-border);
  background: var(--brand-soft);
}
.quota .q[data-busy="true"] b {
  color: var(--brand);
}

.app-scroll {
  flex: 1 1;
  overflow: auto;
  background: var(--bg);
}
.app-content {
  /* 最大幅で中央寄せすると右に余白が残るので、サイドバー以外は幅いっぱい使う */
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 24px var(--content-pad-x) 90px;
}

/* 本文の幅は .app-content が決める。
   画面側に残っている .page / .page-wide は、そのための入れ物として素通しにする */
.page,
.page-wide {
  max-width: none;
  margin: 0;
}

/* ---------- 小さい画面(サイドバーを引き出しにする) ---------- */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 21px;
  line-height: 1;
  color: var(--text);
  padding: 4px 8px;
  cursor: pointer;
}
.nav-overlay {
  display: none;
}

@media (max-width: 900px) {
  .nav-toggle {
    display: inline-flex;
  }
  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 60;
    transform: translateX(-100%);
    transition: transform 0.18s ease;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.12);
  }
  body.nav-open .sidebar {
    transform: none;
  }
  body.nav-open .nav-overlay {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 55;
    background: rgba(0, 0, 0, 0.35);
    border: none;
    padding: 0;
    margin: 0;
  }
  .app-header {
    padding: 0 14px;
    gap: 10px;
  }
  .app-content {
    padding: 20px 16px 70px;
  }
  .quota {
    gap: 6px;
  }
  .quota .q {
    padding: 4px 8px;
    gap: 5px;
  }
  .quota .q span {
    font-size: 10px;
  }
  .quota .q b {
    font-size: 12px;
  }
}

/* いちばん狭いところでは件数を畳む。画面名と現在地を優先する */
@media (max-width: 430px) {
  .quota .q:not(:last-child) {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar {
    transition: none;
  }
}

/* ---------- 見出し ---------- */
.page-head {
  margin-bottom: 18px;
}
/* 画面名は上のヘッダー(.screen-title)に出る。
   本文の先頭に残すのは「その画面で何をするか」の説明だけ。 */
.page-title {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 6px;
}
.page-title svg {
  color: var(--brand);
}
.page-desc {
  margin: 0;
  color: var(--text-muted);
  font-size: 12.5px;
  line-height: 1.75;
  max-width: 86ch;
}

/* ---------- カード ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
}
.card-pad {
  padding: 20px 22px;
}
.card-repeat {
  border-color: var(--brand-border);
  box-shadow: 0 0 0 3px rgba(var(--brand-rgb), 0.05), var(--shadow);
}
.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ---------- テーブル ---------- */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
}
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
table.data thead th {
  background: var(--surface);
  text-align: left;
  padding: 11px 14px;
  font-weight: 600;
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.data tbody td {
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  vertical-align: middle;
}
table.data tbody tr:first-child td {
  border-top: none;
}
table.data tbody tr:hover {
  background: var(--surface-2);
}
.num {
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
}

/* ---------- バッジ ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: var(--r-pill);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.7;
  white-space: nowrap;
}
.badge-brand {
  background: var(--brand-soft);
  color: var(--brand);
}
.badge-green {
  background: var(--green-soft);
  color: var(--green);
}
.badge-red {
  background: var(--red-soft);
  color: var(--red);
}
.badge-muted {
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

/* ---------- ボタン ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: var(--r);
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, border-color 0.12s, opacity 0.12s;
}
.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.btn-primary {
  background: var(--brand);
  color: #fff;
}
.btn-primary:hover:not(:disabled) {
  background: var(--brand-dark);
}
.btn-dark {
  background: var(--text);
  color: #fff;
}
.btn-dark:hover:not(:disabled) {
  background: #000;
}
.btn-ghost {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--surface-2);
}
.btn-sm {
  padding: 6px 11px;
  font-size: 12px;
}

/* ---------- フォーム ---------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}
.input {
  padding: 7px 10px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  width: 110px;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(var(--brand-rgb), 0.12);
}
.input-wide {
  width: 100%;
}
textarea.input {
  width: 100%;
  min-height: 88px;
  resize: vertical;
  line-height: 1.45;
  font-family: inherit;
}
.form-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
}

/* セラーリサーチ: キーワード欄を広く、複数入力が分かるようにする */
.search-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.search-keywords-row {
  align-items: stretch;
  flex-wrap: nowrap;
}
.field-keyword {
  flex: 1.4 1 280px;
  min-width: 0;
}
.field-aruaru {
  flex: 1 1 220px;
  min-width: 0;
}
.field-label {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
.field-sub {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-faint, var(--text-muted));
  opacity: 0.85;
}
.input-keywords {
  min-height: 96px;
  padding: 10px 12px;
  font-size: 13.5px;
}
.keyword-examples {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
@media (max-width: 720px) {
  .search-keywords-row {
    flex-wrap: wrap;
  }
  .field-keyword,
  .field-aruaru {
    flex: 1 1 100%;
  }
}

/* ---------- 通知/空状態 ---------- */
.note {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  border-radius: var(--r);
  padding: 11px 14px;
  font-size: 13px;
  margin-bottom: 16px;
  line-height: 1.55;
}
.note svg {
  flex-shrink: 0;
  margin-top: 2px;
}
.note-info {
  background: var(--amber-soft);
  border: 1px solid var(--amber-border);
  color: var(--amber);
}
.note-error {
  background: var(--red-soft);
  border: 1px solid #f3c1bb;
  color: var(--red);
}
.empty {
  padding: 40px 24px;
  text-align: center;
  color: var(--text-faint);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
}
.empty svg {
  color: var(--border-strong);
  margin-bottom: 10px;
}

/* ---------- 指標 ---------- */
/* 原価・黒字ライン・1個利益・月利益は、この画面でいちばん見たい数字。
   横並びの小さな文字ではなく、枠で囲った大きな数字にして拾いやすくする。 */
.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  grid-gap: 10px;
  gap: 10px;
  align-items: stretch;
  border-top: 1px solid var(--border);
  padding-top: 14px;
  margin-top: 14px;
}
.metrics > div {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 11px 13px;
  min-width: 0;
}
/* 最後の枠は黒字/赤字のバッジだけなので、枠は付けずに右端へ寄せる */
.metrics > div:last-child {
  background: none;
  border: none;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}
.metric-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 3px;
}
.metric-value {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
}
.metric-value.pos {
  color: var(--green);
}
.metric-value.neg {
  color: var(--red);
}

.thumb {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: var(--r);
  border: 1px solid var(--border);
  background: var(--surface-2);
  flex-shrink: 0;
}

/* サムネイルをメルカリの商品ページへのリンクにしたときの見た目。
   押せることが分かるよう、カーソルと明るさだけ変える(大きさは動かさない。
   一覧の行がガタつくため)。 */
.thumb-link {
  display: block;
  flex-shrink: 0;
  line-height: 0;
  border-radius: var(--r);
}
.thumb-link .thumb {
  transition: filter 0.15s ease, border-color 0.15s ease;
}
.thumb-link:hover .thumb {
  filter: brightness(1.06);
  border-color: var(--brand);
}
.thumb-link:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
.meta {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}
.meta .sep {
  color: var(--border-strong);
}
.item-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.45;
  margin-bottom: 3px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.link {
  color: var(--brand);
  text-decoration: none;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.link:hover {
  text-decoration: underline;
}

/* ---------- ジョブ実行パネル ---------- */
.runner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  padding: 20px 22px;
  margin-bottom: 20px;
}
.runner-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 14px;
}
.log {
  margin-top: 12px;
  background: #12141a;
  color: #d7dae0;
  border-radius: var(--r);
  padding: 11px 13px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11.5px;
  line-height: 1.65;
  max-height: 260px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
.log-empty {
  color: #6b7280;
}

.spin {
  animation: spin 1s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

details.settings > summary {
  cursor: pointer;
  font-weight: 650;
  font-size: 13.5px;
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
}
details.settings > summary::-webkit-details-marker {
  display: none;
}
details.settings > summary::after {
  content: "▾";
  color: var(--text-faint);
  font-size: 11px;
}
details.settings[open] > summary::after {
  content: "▴";
}

/* ===============================================================
   セラーのアバター
   画像が無いセラー(メルカリ既定画像)は、名前の頭文字を色付きの丸で出す。
   全員が同じ灰色アイコンだと一覧で見分けがつかないため。
   =============================================================== */
.avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--r-pill);
  flex-shrink: 0;
  object-fit: cover;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 14px;
  color: #fff;
  overflow: hidden;
  -webkit-user-select: none;
     -moz-user-select: none;
          user-select: none;
}
.avatar-lg {
  width: 56px;
  height: 56px;
  font-size: 21px;
}
.avatar-sm {
  width: 26px;
  height: 26px;
  font-size: 11px;
}
/* 名前から決まる色。同じセラーは常に同じ色になる */
.avatar[data-hue="0"] { background: linear-gradient(135deg, #6366f1, #8b5cf6); border-color: transparent; }
.avatar[data-hue="1"] { background: linear-gradient(135deg, #0ea5e9, #22d3ee); border-color: transparent; }
.avatar[data-hue="2"] { background: linear-gradient(135deg, #10b981, #34d399); border-color: transparent; }
.avatar[data-hue="3"] { background: linear-gradient(135deg, #f59e0b, #fbbf24); border-color: transparent; }
.avatar[data-hue="4"] { background: linear-gradient(135deg, #ef4444, #f87171); border-color: transparent; }
.avatar[data-hue="5"] { background: linear-gradient(135deg, #ec4899, #f472b6); border-color: transparent; }
.avatar[data-hue="6"] { background: linear-gradient(135deg, #14b8a6, #2dd4bf); border-color: transparent; }
.avatar[data-hue="7"] { background: linear-gradient(135deg, #8b5cf6, #c084fc); border-color: transparent; }

.seller-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.seller-cell .name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 26ch;
}
.seller-cell .sub {
  font-size: 11.5px;
  color: var(--text-faint);
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
}

/* ===============================================================
   状態を表すピル(セラー分類・実送料の取得状況)
   色は意味に対応させる: 良い=緑 / 注意=橙 / 不可=灰 / 特別=紫
   =============================================================== */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.7;
  white-space: nowrap;
  border: 1px solid transparent;
}
.pill-hot {
  background: linear-gradient(135deg, #fff1e6, #ffe4d1);
  color: #b45309;
  border-color: #f7d3ae;
}
.pill-good { background: var(--green-soft); color: var(--green); border-color: #bfe6cb; }
.pill-warn { background: var(--amber-soft); color: var(--amber); border-color: var(--amber-border); }
.pill-mute { background: var(--surface-2); color: var(--text-faint); border-color: var(--border); }
.pill-info { background: #e8f2ff; color: #1d4ed8; border-color: #c7dcfb; }
.pill-brand { background: var(--brand-soft); color: var(--brand); border-color: var(--brand-border); }

/* NG判定(新品率が低い/回転が遅い)の行。消さずに薄くして残す */
tr[data-ng="true"] td:not(:last-child) {
  opacity: 0.5;
}
tr[data-ng="true"] .name {
  text-decoration: line-through;
  -webkit-text-decoration-color: var(--text-faint);
          text-decoration-color: var(--text-faint);
}

/* ===============================================================
   指標タイル
   =============================================================== */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  grid-gap: 10px;
  gap: 10px;
  margin-bottom: 16px;
}
.tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 11px 13px;
  box-shadow: var(--shadow);
}
.tile-label {
  font-size: 11px;
  color: var(--text-faint);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 3px;
}
.tile-value {
  font-size: 19px;
  font-weight: 700;
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.tile-sub {
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 1px;
}
.tile-accent { color: var(--brand); }
.tile-pos { color: var(--green); }
.tile-neg { color: var(--red); }

/* ===============================================================
   待ち時間の演出
   処理は数十秒かかるので、止まって見えないようにする。
   動きが苦手な人のために prefers-reduced-motion では止める。
   =============================================================== */

/* 読み込み中の骨組み(シマー) */
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, #eef0f3 37%, var(--surface-2) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: var(--r-sm);
}
@keyframes shimmer {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}
.skel-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-top: 1px solid var(--border);
}
.skel-line { height: 10px; }
.skel-circle { border-radius: var(--r-pill); }

/* 進捗バー。総量が分かるときは値を、分からないときは往復させる */
.progress {
  height: 6px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  overflow: hidden;
  border: 1px solid var(--border);
}
.progress-bar {
  height: 100%;
  border-radius: var(--r-pill);
  background: linear-gradient(90deg, var(--brand), #8b7bf0);
  transition: width 0.5s cubic-bezier(0.22, 1, 0.36, 1);
  position: relative;
  overflow: hidden;
}
/* 進んでいる最中は、バーの中を光が流れる */
.progress-bar::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.45), transparent);
  animation: sweep 1.5s linear infinite;
}
@keyframes sweep {
  from { transform: translateX(-100%); }
  to { transform: translateX(100%); }
}
/* 終わったら、バーの中を流れる光を止める。
   動いたままだと、100%まで伸びていても「まだ処理中」に見えるため。 */
.progress-bar[data-state="done"]::after,
.progress-bar[data-state="error"]::after {
  content: none;
}
/* 失敗して終わったときは、満ちていても成功と区別できるようにする */
.progress-bar[data-state="error"] {
  background: var(--red);
}

/* 総量が分からないとき(起動直後など)は往復させる */
.progress-indeterminate .progress-bar {
  width: 35% !important;
  animation: slide 1.5s ease-in-out infinite;
}
@keyframes slide {
  0% { margin-left: -35%; }
  100% { margin-left: 100%; }
}

/* 実行中の段階表示 */
.phases {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin: 10px 0 8px;
}
.phase {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-faint);
  padding: 3px 9px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border);
  background: var(--surface-2);
  transition: color 0.2s, background 0.2s, border-color 0.2s;
}
.phase[data-state="active"] {
  color: var(--brand);
  background: var(--brand-soft);
  border-color: var(--brand-border);
}
.phase[data-state="done"] {
  color: var(--green);
  background: var(--green-soft);
  border-color: #bfe6cb;
}
.phase-arrow {
  color: var(--border-strong);
  font-size: 11px;
}
/* 進行中の段階だけ、点がゆっくり脈打つ */
.phase[data-state="active"] .phase-dot {
  animation: pulse 1.2s ease-in-out infinite;
}
.phase-dot {
  width: 6px;
  height: 6px;
  border-radius: var(--r-pill);
  background: currentColor;
  flex-shrink: 0;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.75); }
}

/* 「取得中です」の3点リーダ */
.dots::after {
  content: "";
  animation: dots 1.4s steps(4, end) infinite;
}
@keyframes dots {
  0% { content: ""; }
  25% { content: "."; }
  50% { content: ".."; }
  75% { content: "..."; }
}

/* ボタンを押した直後の反応。押せたことがすぐ分かるようにする */
.btn:active:not(:disabled) {
  transform: translateY(1px);
}
.btn-primary {
  box-shadow: 0 1px 2px rgba(var(--brand-rgb), 0.22);
}
.btn-primary:hover:not(:disabled) {
  box-shadow: 0 2px 8px rgba(var(--brand-rgb), 0.26);
}
/* 実行中のボタンは、進行を示す帯が流れる */
.btn[data-busy="true"] {
  position: relative;
  overflow: hidden;
}
.btn[data-busy="true"]::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.28), transparent);
  animation: sweep 1.2s linear infinite;
}

/* 結果が出たときに、下から出す */
.fade-up {
  animation: fadeUp 0.32s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* 完了したときの一瞬の強調 */
.flash-ok {
  animation: flashOk 1.1s ease-out;
}
@keyframes flashOk {
  0% { background: var(--green-soft); }
  100% { background: transparent; }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton,
  .progress-bar::after,
  .progress-indeterminate .progress-bar,
  .phase[data-state="active"] .phase-dot,
  .dots::after,
  .btn[data-busy="true"]::after,
  .spin {
    animation: none !important;
  }
  .fade-up,
  .flash-ok {
    animation: none !important;
  }
  .btn:active:not(:disabled) {
    transform: none;
  }
}

/* ===============================================================
   テーブルの仕上げ
   =============================================================== */
table.data thead th {
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  z-index: 1;
}
table.data td.right,
table.data th.right {
  text-align: right;
}
table.data tbody tr {
  transition: background 0.12s;
}
.table-scroll {
  max-height: 640px;
  overflow-y: auto;
}
/* 数字の列は幅を詰めて、名前の列に幅を回す */
table.data td.tight,
table.data th.tight {
  width: 1%;
  white-space: nowrap;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.toolbar .spacer {
  flex: 1 1;
}

/* 価格レンジなどの補助テキスト */
.hint {
  font-size: 11.5px;
  color: var(--text-faint);
}
.bar-mini {
  height: 4px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  overflow: hidden;
  margin-top: 4px;
}
.bar-mini > i {
  display: block;
  height: 100%;
  border-radius: var(--r-pill);
  background: var(--brand);
}

/* 商品カードのヘッダ行 */
.group-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
}
.group-stats {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}
.gs {
  min-width: 68px;
}
.gs-label {
  font-size: 10.5px;
  color: var(--text-faint);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}
.gs-value {
  font-size: 13.5px;
  font-weight: 700;
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
}
.gs-value.muted {
  color: var(--text-faint);
  font-weight: 500;
}

details.titles > summary {
  cursor: pointer;
  font-size: 11.5px;
  color: var(--text-muted);
  list-style: none;
  margin-top: 8px;
}
details.titles > summary::-webkit-details-marker { display: none; }
details.titles > summary::before {
  content: "▸ ";
  color: var(--text-faint);
}
details.titles[open] > summary::before { content: "▾ "; }
details.titles ul {
  margin: 6px 0 0;
  padding-left: 18px;
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.7;
}

/* select も .input と同じ見た目に揃える(既定の矢印は残す) */
select.input {
  -webkit-appearance: auto;
     -moz-appearance: auto;
          appearance: auto;
  cursor: pointer;
  padding-right: 6px;
}
select.input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* 折り返しても崩れないように、深掘り画面のフォーム行は下端を揃える */
.runner .form-row {
  align-items: flex-end;
}

/* ===============================================================
   ログイン画面
   サイドバーの無い、中央1枚のカード。
   =============================================================== */
.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
}
.auth-card {
  width: 100%;
  max-width: 360px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  padding: 28px;
}
/* ロゴは中央に大きく。ここが何のサービスかを最初に伝える */
.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.auth-brand img {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  object-fit: cover;
  border: 1px solid var(--border);
}
.auth-brand b {
  font-size: 17px;
  font-weight: 700;
  color: var(--brand);
  letter-spacing: 0.01em;
}
.auth-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 8px;
}
.auth-title svg {
  color: var(--brand);
}
.auth-desc {
  margin: 0 0 18px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.7;
}
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.auth-foot {
  margin: 18px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 11.5px;
  color: var(--text-faint);
  line-height: 1.7;
}

/* 入力欄の中にアイコン／表示切り替えボタンを置く */
.input-icon {
  position: relative;
  display: block;
}
.input-icon > svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-faint);
  pointer-events: none;
}
.input-icon > svg ~ .input {
  padding-left: 30px;
}
.input-icon .input {
  padding-top: 9px;
  padding-bottom: 9px;
  padding-right: 38px;
}
.input-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 5px;
  border-radius: var(--r-sm);
  color: var(--text-faint);
  cursor: pointer;
  display: grid;
  place-items: center;
}
.input-toggle:hover {
  color: var(--text);
  background: var(--surface-2);
}

.btn-block {
  width: 100%;
  justify-content: center;
}

/* ===============================================================
   サイドバー下部のログイン情報
   =============================================================== */
/* ===============================================================
   会員管理
   =============================================================== */

/* 切り替えタブ(ランダム発行 / 指定して発行) */
.seg {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: var(--r);
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.seg-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.seg-btn:hover {
  color: var(--text);
}
.seg-btn[data-active="true"] {
  background: var(--surface);
  color: var(--brand);
  box-shadow: var(--shadow);
}

/* 発行した資格情報のパネル。目立たせて、控え忘れを防ぐ */
.cred-panel {
  border: 1px solid var(--brand-border);
  background: linear-gradient(180deg, var(--brand-soft), var(--surface));
  border-radius: var(--r-lg);
  padding: 15px 17px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.cred-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 13.5px;
  color: var(--brand);
  margin-bottom: 12px;
}
.cred-grid {
  display: grid;
  grid-gap: 8px;
  gap: 8px;
  margin-bottom: 10px;
}
.cred-item {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 9px 12px;
}
.cred-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-faint);
  width: 76px;
  flex-shrink: 0;
}
.cred-value {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  -webkit-user-select: all;
     -moz-user-select: all;
          user-select: all;
  flex: 1 1;
  min-width: 140px;
  word-break: break-all;
}

/* 一覧の行内ボタン — アイコンのみを1行で並べる */
.row-actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: nowrap;
  width: 100%;
}
.row-actions form {
  display: inline-flex;
  margin: 0;
}
.btn-icon {
  padding: 6px;
  gap: 0;
  min-width: 30px;
  min-height: 30px;
  justify-content: center;
}
table.data td.actions-col,
table.data th.actions-col {
  width: 1%;
  white-space: nowrap;
}
.edit-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-top: 10px;
  padding: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  text-align: left;
}
/* 会員管理の中央モーダル */
.modal-root {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  border: none;
  padding: 0;
  margin: 0;
  background: rgba(20, 24, 36, 0.45);
  cursor: pointer;
}
.modal-dialog {
  position: relative;
  z-index: 1;
  width: min(100%, 420px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: 0 18px 48px rgba(20, 24, 36, 0.18);
  max-height: min(90vh, 720px);
  overflow: auto;
}
.modal-dialog-wide {
  width: min(100%, 520px);
}
.modal-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.modal-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 14.5px;
  flex: 1 1;
  min-width: 0;
}
.modal-title svg {
  color: var(--brand);
  flex-shrink: 0;
}
.modal-body {
  padding: 16px;
}
.modal-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.modal-stack {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-wrap: wrap;
}
.modal-stack .field {
  flex: 1 1;
  min-width: 160px;
}
.modal-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-top: 4px;
}
.modal-message {
  margin: 0;
  font-size: 13.5px;
  color: var(--text);
  line-height: 1.55;
}

.password-row {
  width: max(100%, 420px);
  max-width: 720px;
  margin-left: auto;
}
.password-current,
.password-change-form {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-wrap: wrap;
  width: 100%;
}
.password-row-copy {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  width: 100%;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}
.password-row-copy svg {
  margin-top: 2px;
  flex-shrink: 0;
  color: var(--text-faint);
}
.check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-muted);
  padding-bottom: 8px;
  cursor: pointer;
}
.check input {
  width: 15px;
  height: 15px;
  accent-color: var(--brand);
  cursor: pointer;
}

.btn-danger {
  background: var(--red-soft);
  color: var(--red);
  border-color: #f3c1bb;
}
.btn-danger:hover:not(:disabled) {
  background: #fbdcd8;
}

.note-ok {
  background: var(--green-soft);
  border: 1px solid #bfe6cb;
  color: var(--green);
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
}

/* ===============================================================
   3-3 仕入れ候補(AliExpress / 1688)
   一覧の各行の下に、候補をカードで並べる。
   画像・価格・一致度を1目で比べられるよう、横並びの小さなカードにする。
   注文作業時は画像グリッドが邪魔なので、既定では折りたたむ。
   =============================================================== */
.sourcing {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}

.sourcing-picked {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 10px;
  margin-bottom: 10px;
  border: 1px solid var(--brand-border);
  border-radius: var(--r);
  background: var(--brand-soft);
}
.sourcing-picked-body {
  min-width: 0;
  flex: 1 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sourcing-picked .cand-title {
  -webkit-line-clamp: 1;
}

.sourcing-fold > summary.sourcing-head {
  list-style: none;
  cursor: pointer;
  -webkit-user-select: none;
     -moz-user-select: none;
          user-select: none;
  margin-bottom: 0;
}
.sourcing-fold > summary.sourcing-head::-webkit-details-marker {
  display: none;
}
.sourcing-fold > summary.sourcing-head::before {
  content: "▶";
  font-size: 9px;
  color: var(--text-faint);
  margin-right: 2px;
}
.sourcing-fold[open] > summary.sourcing-head::before {
  content: "▼";
}
.sourcing-fold-hint {
  margin-left: auto;
  font-weight: 400;
}
.sourcing-body {
  margin-top: 10px;
}

.sourcing-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.sourcing-head svg {
  color: var(--brand);
}

.cand-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  grid-gap: 8px;
  gap: 8px;
}

.cand {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface);
}
/* 採用中の候補は、どれを選んだか一目で分かるようにする */
.cand[data-picked] {
  border-color: var(--brand-border);
  background: var(--brand-soft);
}

.cand-img {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  object-fit: cover;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.cand-img-sm {
  width: 40px;
  height: 40px;
}

.cand-body {
  min-width: 0;
  flex: 1 1;
}

.cand-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--text);
  text-decoration: none;
}
.cand-title:hover {
  color: var(--brand);
  text-decoration: underline;
}
.cand-title svg {
  vertical-align: -1px;
  margin-left: 3px;
  color: var(--text-faint);
}

.cand-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 5px;
  font-size: 11.5px;
  color: var(--text-muted);
}
.cand-price {
  font-weight: 700;
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.cand-action {
  flex-shrink: 0;
}

.cand-more {
  margin-top: 8px;
}
.cand-more > summary {
  cursor: pointer;
  font-size: 12px;
  color: var(--text-muted);
  padding: 4px 0;
}
.cand-more > .cand-grid {
  margin-top: 8px;
}

/* 1688 は商品を取得できないので、検索URLだけを下にまとめる */
.cand-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 10px;
  font-size: 12px;
}

/* 探し方(タイトル検索 / 画像検索)ごとのまとまり */
.cand-group + .cand-group {
  margin-top: 12px;
}
.cand-group > summary.cand-group-head {
  list-style: none;
  cursor: pointer;
  -webkit-user-select: none;
     -moz-user-select: none;
          user-select: none;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-faint);
}
.cand-group > summary.cand-group-head::-webkit-details-marker {
  display: none;
}
.cand-group > summary.cand-group-head::before {
  content: "▶";
  font-size: 9px;
  color: var(--text-faint);
}
.cand-group[open] > summary.cand-group-head::before {
  content: "▼";
}
.cand-group[open] > summary.cand-group-head {
  margin-bottom: 6px;
}
.cand-group:not([open]) > summary.cand-group-head {
  margin-bottom: 0;
}
.cand-group-head svg {
  color: var(--text-faint);
}


/* 表の下に出る「もっと見る」。行として置いているので、
   区切り線を消して中央に寄せ、行のホバー色も付かないようにする。 */
.reveal-row td {
  text-align: center;
  padding: 10px 12px;
  border-bottom: none;
  background: var(--surface);
}
.reveal-row:hover td {
  background: var(--surface);
}
.reveal-rest {
  color: var(--text-muted);
  font-size: 11.5px;
  margin-left: 2px;
}


/* 見出しの並べ替えボタン。
   ▲▼を縦に重ねて置き、押されている向きだけ色を付ける。
   見出しの高さを変えないよう、行の高さは詰めてある。 */
.th-sort {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.th-sort[data-right] {
  flex-direction: row;
  justify-content: flex-end;
}
.sort-btns {
  display: inline-flex;
  flex-direction: column;
  gap: 1px;
  flex-shrink: 0;
}
.sort-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 9px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text-faint);
  cursor: pointer;
  line-height: 0;
  border-radius: 2px;
}
.sort-btn:hover {
  color: var(--text);
}
.sort-btn[data-active] {
  color: var(--brand);
}
.sort-btn:focus-visible {
  outline: 1px solid var(--brand);
  outline-offset: 1px;
}


/* カード一覧の下に置く「もっと見る」。表の中(.reveal-row)と違い、
   ボタンを中央に置くだけでよい。 */
.reveal-more {
  display: flex;
  justify-content: center;
  padding: 4px 0 2px;
}

/* ===============================================================
   使い方ガイド(/guide)
   長い文章を読ませる画面なので、他の画面より行間を広く、
   1行の文字数を抑える。図表は本文と同じ幅に収める。
   =============================================================== */
.guide {
  max-width: 860px;
}

.guide-hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  padding: 26px 28px;
  margin-bottom: 18px;
}
.guide-hero h1 {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 10px;
  letter-spacing: -0.01em;
}
.guide-hero p {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.9;
  color: var(--text-body);
}

/* 全体の流れ(①→②→③)を最初に見せる */
.guide-flow {
  display: flex;
  align-items: stretch;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 20px;
}
.guide-flow-step {
  flex: 1 1 180px;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 12px 14px;
  background: var(--surface-2);
}
.guide-flow-step b {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
}
.guide-flow-step .n {
  width: 20px;
  height: 20px;
  border-radius: var(--r-sm);
  background: var(--brand);
  color: #fff;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}
.guide-flow-step span {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.65;
}

/* 目次 */
.guide-toc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  padding: 18px 22px;
  margin-bottom: 26px;
}
.guide-toc h2 {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  margin: 0 0 10px;
}
.guide-toc ul {
  margin: 0;
  padding: 0;
  list-style: none;
  columns: 2;
  column-gap: 28px;
}
.guide-toc li {
  font-size: 13px;
  line-height: 2;
  page-break-inside: avoid;
  break-inside: avoid;
}
.guide-toc a {
  color: var(--text-body);
  text-decoration: none;
}
.guide-toc a:hover {
  color: var(--brand);
  text-decoration: underline;
}

/* 本文 */
.guide-section {
  margin-bottom: 34px;
  scroll-margin-top: 20px;
}
.guide-section > h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 6px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  letter-spacing: -0.01em;
}
.guide-section > h2 .guide-num {
  width: 26px;
  height: 26px;
  border-radius: var(--r-sm);
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}
.guide-section h3 {
  font-size: 14.5px;
  font-weight: 600;
  margin: 26px 0 8px;
}
.guide-section p {
  margin: 0 0 12px;
  font-size: 13.5px;
  line-height: 1.95;
  color: var(--text-body);
}
.guide-section ul,
.guide-section ol {
  margin: 0 0 14px;
  padding-left: 22px;
  font-size: 13.5px;
  line-height: 1.95;
  color: var(--text-body);
}
.guide-section li {
  margin-bottom: 4px;
}
.guide-section li > strong,
.guide-section p > strong {
  font-weight: 600;
  color: var(--text);
}
.guide-section a {
  color: var(--brand);
  font-weight: 500;
}

/* 表。本文中では罫線を細く、見出しだけ薄く塗る */
.guide-table {
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow-x: auto;
  margin: 0 0 16px;
}
.guide-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.guide-table th,
.guide-table td {
  padding: 9px 13px;
  text-align: left;
  vertical-align: top;
  line-height: 1.75;
  border-top: 1px solid var(--line);
}
.guide-table thead th {
  background: var(--surface-2);
  border-top: none;
  font-weight: 600;
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}
/* 条件や税率など、折り返すと読みにくい短い値の列 */
.guide-table td.nowrap {
  white-space: nowrap;
}
.guide-table tbody th {
  font-weight: 600;
  white-space: nowrap;
  color: var(--text);
  width: 1%;
}

/* 計算式。等幅で桁を揃える */
.guide-formula {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 14px 16px;
  margin: 0 0 16px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  line-height: 2;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text-body);
}
.guide-formula b {
  color: var(--brand);
  font-weight: 600;
}

/* 補足・注意。色で読み分けられるようにする */
.guide-callout {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border-radius: var(--r);
  padding: 13px 15px;
  margin: 0 0 16px;
  font-size: 13px;
  line-height: 1.85;
}
.guide-callout svg {
  flex-shrink: 0;
  margin-top: 3px;
}
.guide-callout p {
  margin: 0;
  font-size: 13px;
  line-height: 1.85;
}
.guide-callout p + p {
  margin-top: 6px;
}
.guide-callout-info {
  background: var(--brand-soft);
  border: 1px solid var(--brand-border);
  color: var(--text-body);
}
.guide-callout-info svg {
  color: var(--brand);
}
.guide-callout-warn {
  background: var(--amber-soft);
  border: 1px solid var(--amber-border);
  color: #7c5411;
}
.guide-callout-warn svg {
  color: var(--amber);
}

/* 操作手順。番号を振って順番があることを示す */
.guide-steps {
  list-style: none;
  counter-reset: gstep;
  margin: 0 0 16px;
  padding: 0;
}
.guide-steps > li {
  position: relative;
  counter-increment: gstep;
  padding: 0 0 14px 34px;
  margin: 0;
  font-size: 13.5px;
  line-height: 1.95;
  border-left: 1px solid var(--border);
  margin-left: 11px;
}
.guide-steps > li:last-child {
  border-left-color: transparent;
  padding-bottom: 0;
}
.guide-steps > li::before {
  content: counter(gstep);
  position: absolute;
  left: -11px;
  top: 1px;
  width: 22px;
  height: 22px;
  border-radius: var(--r-pill);
  background: var(--surface);
  border: 1px solid var(--brand-border);
  color: var(--brand);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 画面の項目名を本文中で示すときの体裁 */
.guide-ui {
  font-weight: 600;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 6px;
  font-size: 0.94em;
  white-space: nowrap;
}

.guide-top {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-faint);
  text-decoration: none;
  margin-top: 4px;
}
.guide-top:hover {
  color: var(--brand);
}

.guide-foot {
  border-top: 1px solid var(--border);
  padding-top: 16px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-faint);
  line-height: 1.9;
}

@media (max-width: 700px) {
  .guide-toc ul {
    columns: 1;
  }
  /* 折り返しを許して、まず幅に収めることを優先する */
  .guide-table td.nowrap,
  .guide-table tbody th {
    white-space: normal;
  }
  .guide-hero {
    padding: 20px;
  }
  .guide-hero h1 {
    font-size: 19px;
  }
}

/* ---------------------------------------------------------------- 利用回数 */

/* 実行ボタンの下: 「残り◯回 → この実行で◯回使用」 */
.quota-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  margin: 10px 0 0;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface-2);
  font-size: 12.5px;
  color: var(--text);
}
.quota-line b {
  font-weight: 600;
}
.quota-line[data-state="short"] {
  border-color: var(--amber-border);
  background: var(--amber-soft);
}
.quota-line[data-state="unlimited"] {
  gap: 8px;
  color: var(--text-muted);
}
.quota-words {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  flex-basis: 100%;
}
.quota-short {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-basis: 100%;
  color: var(--amber);
  font-weight: 500;
}

/* ヘッダーの残り回数。少なくなったら色で知らせる */
.quota .q[data-low="true"] {
  border-color: var(--amber-border);
  background: var(--amber-soft);
}
.quota .q[data-low="true"] b {
  color: var(--amber);
}
.quota .q small {
  font-size: 10.5px;
  color: var(--text-muted);
}

/* 会員管理: 利用回数の列 */
.quota-cell {
  display: grid;
  grid-template-columns: auto auto;
  grid-gap: 2px 8px;
  gap: 2px 8px;
  font-size: 12px;
  white-space: nowrap;
}
.quota-cell span {
  color: var(--text-muted);
}
.quota-cell b {
  font-weight: 600;
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
}
.quota-cell b[data-low="true"] {
  color: var(--amber);
}
.quota-grid {
  display: grid;
  grid-template-columns: auto 1fr 1fr;
  grid-gap: 8px 12px;
  gap: 8px 12px;
  align-items: center;
}
.quota-grid .qg-head {
  font-size: 11.5px;
  color: var(--text-muted);
}
.quota-grid .input {
  width: 100%;
}

/* ===============================================================
   色つきアイコン・管理画面・グラフ・料金プラン・ヘルプ
   =============================================================== */

:root {
  /* グラフの系列色(dataviz の検証済みパレットの 1・2・3・7 番)。
     リサーチ=青 / 深掘り=橙 / 登録ユーザー=緑 / アクティブ=紫。並び順が変わっても付け替えない */
  --viz-1: #2a78d6;
  --viz-2: #eb6834;
  --viz-3: #1baf7a;
  --viz-7: #4a3aa7;

  /* アイコンの下地の色(画面の種類を覚えやすくするための色。意味は文字が担う) */
  --tone-blue-bg: #e8f0fe;
  --tone-blue: #2a6fd6;
  --tone-violet-bg: #efecfd;
  --tone-violet: #5b4bc4;
  --tone-green-bg: #e4f6ed;
  --tone-green: #0e8a5f;
  --tone-orange-bg: #fff0e6;
  --tone-orange: #d45a1c;
  --tone-aqua-bg: #e1f5f3;
  --tone-aqua: #0e8580;
  --tone-gray-bg: #f1f1f3;
  --tone-gray: #52525b;
  --tone-navy-bg: #e6eaf3;
  --tone-navy: #1e2a44;

}

/* ---------- 色つきのアイコン(利用者のサイドバー・ヘルプなど) ---------- */
.nav-icon[data-tone],
.tone-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  align-items: center;
  justify-content: center;
  display: inline-flex;
  flex: 0 0 auto;
}
.tone-icon-sm {
  width: 24px;
  height: 24px;
  border-radius: 7px;
}
[data-tone="blue"].nav-icon, .tone-icon[data-tone="blue"], .kpi-icon[data-tone="blue"], .status-icon[data-tone="blue"] { background: var(--tone-blue-bg); color: var(--tone-blue); }
[data-tone="violet"].nav-icon, .tone-icon[data-tone="violet"], .kpi-icon[data-tone="violet"], .status-icon[data-tone="violet"] { background: var(--tone-violet-bg); color: var(--tone-violet); }
[data-tone="green"].nav-icon, .tone-icon[data-tone="green"], .kpi-icon[data-tone="green"], .status-icon[data-tone="green"] { background: var(--tone-green-bg); color: var(--tone-green); }
[data-tone="orange"].nav-icon, .tone-icon[data-tone="orange"], .kpi-icon[data-tone="orange"], .status-icon[data-tone="orange"] { background: var(--tone-orange-bg); color: var(--tone-orange); }
[data-tone="aqua"].nav-icon, .tone-icon[data-tone="aqua"], .kpi-icon[data-tone="aqua"], .status-icon[data-tone="aqua"] { background: var(--tone-aqua-bg); color: var(--tone-aqua); }
[data-tone="gray"].nav-icon, .tone-icon[data-tone="gray"] { background: var(--tone-gray-bg); color: var(--tone-gray); }
[data-tone="navy"].nav-icon, .tone-icon[data-tone="navy"] { background: var(--tone-navy-bg); color: var(--tone-navy); }
/* 選択中は、その色を下地にして白抜きにする(どの色でも同じ扱い) */
.nav-icon[data-tone="blue"] { --tc: var(--tone-blue); }
.nav-icon[data-tone="violet"] { --tc: var(--tone-violet); }
.nav-icon[data-tone="green"] { --tc: var(--tone-green); }
.nav-icon[data-tone="orange"] { --tc: var(--tone-orange); }
.nav-icon[data-tone="aqua"] { --tc: var(--tone-aqua); }
.nav-icon[data-tone="gray"] { --tc: var(--tone-gray); }
.nav-icon[data-tone="navy"] { --tc: var(--tone-navy); }
.nav-item[data-active="true"] .nav-icon[data-tone] {
  background: var(--tc);
  color: #fff;
}

/* ---------- ログイン画面のタブ ---------- */
.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-gap: 4px;
  gap: 4px;
  padding: 4px;
  margin-bottom: 18px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
}
.auth-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
}
.auth-tab:hover {
  color: var(--text);
}
.auth-tab[data-active="true"] {
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}
.auth-links {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--text-faint);
}
.auth-links a {
  color: var(--text-muted);
}

/* ---------- 管理画面の本文 ---------- */
.admin-page {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.admin-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.admin-period {
  font-size: 12.5px;
  color: var(--text-body);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 7px 12px;
}
.admin-lead {
  margin: -6px 0 0;
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.8;
  max-width: 110ch;
}
.admin-page > .note {
  margin: 0;
}

/* KPI */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-gap: 14px;
  gap: 14px;
}
.kpi {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
}
.kpi-icon {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}
.kpi-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.kpi-label {
  font-size: 12.5px;
  color: var(--text-body);
  font-weight: 500;
}
.kpi-value {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.25;
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.kpi-value small {
  font-size: 13px;
  font-weight: 600;
  margin-left: 4px;
  color: var(--text-body);
}
.kpi-trend {
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
}
.kpi-trend[data-dir="up"] { color: var(--green); }
.kpi-trend[data-dir="down"] { color: var(--red); }
.kpi-trend[data-dir="flat"] { color: var(--text-muted); }
.kpi-trend i {
  font-style: normal;
  font-weight: 400;
  color: var(--text-faint);
  font-size: 11px;
}
.kpi-grid-compact .kpi {
  padding: 14px 18px;
}
.kpi-grid-compact .kpi-value {
  font-size: 24px;
}

/* パネル */
.admin-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-gap: 16px;
  gap: 16px;
}
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  min-width: 0;
}
.panel-span2 {
  grid-column: span 2;
}
.panel-span3 {
  grid-column: 1 / -1;
}
.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.panel-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 7px;
}
.panel-head h2 svg {
  color: var(--tone-blue);
}
.panel-head p {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--text-muted);
}

/* システム設定・連携状況 */
.status-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.status-list li {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  grid-gap: 12px;
  gap: 12px;
  padding: 11px 0;
  border-top: 1px solid var(--line);
}
.status-list li:first-child {
  border-top: none;
  padding-top: 2px;
}
.status-list b {
  display: block;
  font-size: 13px;
}
.status-list i {
  display: block;
  font-style: normal;
  font-size: 11.5px;
  color: var(--text-muted);
}
.status-list a.pill {
  text-decoration: none;
}
.status-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* 料金プランのカード */
.plan-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  grid-gap: 12px;
  gap: 12px;
}
.plan-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 16px 16px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}
.plan-card[data-tone="blue"] { background: #f4f8ff; border-color: #dde8fb; }
.plan-card[data-tone="orange"] { background: #fff8f1; border-color: #f8e2cc; }
.plan-card[data-tone="violet"] { background: #f7f5ff; border-color: #e3defa; }
.plan-card[data-tone="aqua"] { background: #f1fbfa; border-color: #cdeeea; }
.plan-card[data-featured="true"] {
  box-shadow: 0 0 0 2px var(--tone-orange);
}
.plan-card-head {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.plan-card-head b {
  font-size: 16px;
}
.plan-price {
  font-size: 24px;
  font-weight: 700;
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
}
.plan-price small {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  margin-right: 6px;
}
.plan-quota {
  font-size: 12.5px;
  color: var(--text-body);
}
.plan-desc {
  margin: 0;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.7;
}
.plan-link {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}
.plan-link a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.plan-stats {
  font-size: 11.5px;
  color: var(--text-muted);
}
.plan-card .btn {
  margin-top: 6px;
}
.plan-features {
  list-style: none;
  margin: 4px 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12.5px;
}
.plan-features li {
  display: flex;
  align-items: center;
  gap: 6px;
}
.plan-features svg {
  color: var(--green);
}
.plan-provider {
  font-size: 11px;
}
.plan-cards-user {
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 14px;
}
.plan-cards-user .plan-card {
  padding: 20px;
}
.empty-plan p {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
}
.flow-list {
  margin: 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 12.5px;
}
.flow-list b {
  display: block;
}
.flow-list i {
  display: block;
  font-style: normal;
  color: var(--text-muted);
  line-height: 1.7;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-gap: 10px 14px;
  gap: 10px 14px;
}
.plan-delete {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.plan-assign {
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

/* 自分のプラン(利用者の料金ページ) */
.my-plan {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.my-plan-body {
  display: flex;
  flex-direction: column;
}
.my-plan-body b {
  font-size: 16px;
}
.my-plan-quota {
  margin-left: auto;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 13px;
}
.my-plan-quota span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.my-plan-quota i {
  font-style: normal;
  font-size: 11px;
  color: var(--text-faint);
}

/* 表(横に長いので横スクロールさせる) */
.admin-table {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
}
.admin-table table.data {
  min-width: 720px;
}
.users-table {
  min-width: 1180px !important;
}
.sub-num {
  font-size: 10.5px;
  color: var(--text-faint);
  font-weight: 400;
}
.remain {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  font-size: 12px;
}
.remain b {
  font-weight: 600;
}
.remain i {
  font-style: normal;
  font-size: 10.5px;
  color: var(--text-faint);
  margin-left: 3px;
}
.remain span[data-low="true"] b {
  color: var(--amber);
}
.usage-bars {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 170px;
}
.usage-bar {
  display: grid;
  grid-template-columns: 48px 1fr 36px;
  align-items: center;
  grid-gap: 6px;
  gap: 6px;
  font-size: 10.5px;
  color: var(--text-muted);
}
.usage-bar-track {
  height: 6px;
  border-radius: 3px;
  background: #eef0f4;
  overflow: hidden;
}
.usage-bar-fill {
  display: block;
  height: 100%;
  border-radius: 3px;
}
.usage-bar-fill[data-kind="research"] { background: var(--viz-1); }
.usage-bar-fill[data-kind="deepdive"] { background: var(--viz-2); }
.usage-bar-num {
  text-align: right;
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
  color: var(--text-body);
}
.filter-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.filter-row .input {
  height: 34px;
}
.filter-search .input {
  width: 240px;
  padding-left: 30px;
}
.btn-good {
  background: var(--green-soft);
  color: var(--green);
  border: 1px solid var(--green-border);
}

/* 今月よく使っているユーザー */
.rank-list {
  margin: 0;
  padding-left: 22px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12.5px;
}
.rank-list li {
  padding: 5px 0;
  border-bottom: 1px solid var(--line);
}
.rank-list li > * {
  vertical-align: middle;
}
.rank-list li {
  display: list-item;
}
.rank-name {
  display: inline-flex;
  flex-direction: column;
  width: calc(100% - 110px);
}
.rank-name i {
  font-style: normal;
  font-size: 11px;
  color: var(--text-faint);
}
.rank-num {
  display: inline-flex;
  gap: 10px;
  width: 110px;
  justify-content: flex-end;
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
}

.admin-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 16px 20px;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--border);
}
.admin-banner b {
  display: block;
  font-size: 14px;
}
.admin-banner i {
  font-style: normal;
  font-size: 12px;
  color: var(--text-muted);
}

/* ---------- グラフ ---------- */
.viz {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.viz-legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-body);
}
.viz-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.viz-legend i {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  display: inline-block;
}
.viz-plot {
  position: relative;
}
.viz-plot svg {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
}
.viz-plot rect[tabindex]:focus {
  outline: none;
}
.viz-plot rect[tabindex]:focus-visible {
  outline: 2px solid var(--brand);
}
.viz-grid {
  stroke: #eef0f4;
  stroke-width: 1;
}
.viz-base {
  stroke: #cfd4dc;
  stroke-width: 1;
}
.viz-cross {
  stroke: #b8bfcc;
  stroke-width: 1;
  stroke-dasharray: 3 3;
}
.viz-tick {
  font-size: 11px;
  fill: var(--text-muted);
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
}
.viz-endlabel {
  font-size: 12px;
  font-weight: 600;
  fill: var(--text);
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
}
.viz-dot {
  stroke: var(--surface);
  stroke-width: 2;
}
.viz-tip {
  position: absolute;
  top: 6px;
  pointer-events: none;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(15, 27, 51, 0.12);
  padding: 8px 10px;
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 150px;
  z-index: 2;
}
.viz-tip b {
  font-size: 12px;
  margin-bottom: 2px;
}
.viz-tip span {
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-body);
}
.viz-tip i {
  width: 8px;
  height: 8px;
  border-radius: 2px;
}
.viz-tip em {
  font-style: normal;
  margin-left: auto;
  font-weight: 600;
  color: var(--text);
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
}

/* ---------- ヘルプ・利用規約 ---------- */
.doc {
  max-width: 920px !important;
}
.doc-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.doc-toc a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 6px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--text-body);
  text-decoration: none;
  font-size: 12.5px;
}
.doc-toc a:hover {
  border-color: var(--border-strong);
  color: var(--text);
}
.doc-section {
  margin-bottom: 14px;
  scroll-margin-top: 16px;
}
.doc-section h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px;
  font-size: 16px;
}
.faq details {
  border-top: 1px solid var(--line);
}
.faq details:first-child {
  border-top: none;
}
.faq summary {
  cursor: pointer;
  padding: 11px 0;
  font-size: 13.5px;
  font-weight: 600;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.faq summary::-webkit-details-marker {
  display: none;
}
.faq summary::before {
  content: "Q";
  width: 20px;
  height: 20px;
  border-radius: 6px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}
.faq details[open] summary {
  color: var(--brand);
}
.faq-a {
  padding: 0 0 14px 28px;
  font-size: 13px;
  color: var(--text-body);
  line-height: 1.85;
}
.terms section + section {
  margin-top: 18px;
}
.terms h2 {
  margin: 0 0 6px;
  font-size: 14.5px;
}
.terms p {
  margin: 0 0 6px;
  font-size: 13px;
  line-height: 1.9;
  color: var(--text-body);
}
.terms-date {
  margin-top: 24px !important;
  text-align: right;
  color: var(--text-muted) !important;
}

/* ---------- 管理画面: 狭い画面 ---------- */
@media (max-width: 1180px) {
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .admin-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .panel-span2,
  .panel-span3 {
    grid-column: auto;
  }
}
@media (max-width: 900px) {
  .form-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .filter-search .input {
    width: 100%;
  }
}
@media (max-width: 560px) {
  .kpi-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}


/* ===============================================================
   アバター・ヘッダーのアカウントメニュー・上部タブ・マイページ
   =============================================================== */

.user-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(135deg, #6d8cf5, #5b5bd6);
  color: #fff;
  font-weight: 600;
  line-height: 1;
  -webkit-user-select: none;
     -moz-user-select: none;
          user-select: none;
}
.user-avatar[data-admin] {
  background: linear-gradient(135deg, #5b5bd6, #8b5cf6);
}
.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ---------- ヘッダー右上: アバターと名前 → メニュー ---------- */
.acct-menu {
  position: relative;
  flex: 0 0 auto;
}
.acct-trigger {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 4px 8px 4px 4px;
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  background: none;
  cursor: pointer;
  color: var(--text);
  font: inherit;
}
.acct-menu:hover .acct-trigger,
.acct-menu[data-open] .acct-trigger,
.acct-trigger:focus-visible {
  background: var(--surface);
  border-color: var(--border);
}
.acct-trigger-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.25;
  max-width: 14ch;
}
.acct-trigger-text b {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.acct-trigger-text i {
  font-style: normal;
  font-size: 10.5px;
  color: var(--text-muted);
}
.acct-caret {
  font-size: 10px;
  color: var(--text-faint);
}
/* 上に隙間(padding-top)を持たせ、ボタンからメニューへカーソルを動かしても閉じないようにする */
.acct-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  padding-top: 8px;
  z-index: 80;
  min-width: 250px;
}
.acct-menu:hover .acct-dropdown,
.acct-menu:focus-within .acct-dropdown,
.acct-menu[data-open] .acct-dropdown {
  display: block;
}
.acct-dropdown::before {
  content: "";
  position: absolute;
  inset: 8px 0 0 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 14px 36px -12px rgba(15, 27, 51, 0.28);
  z-index: -1;
}
.acct-dropdown-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 14px 12px;
  border-bottom: 1px solid var(--line);
}
.acct-dropdown-head span {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.acct-dropdown-head b {
  font-size: 13.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.acct-dropdown-head i {
  font-style: normal;
  font-size: 11.5px;
  color: var(--text-muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.acct-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: calc(100% - 12px);
  margin: 2px 6px;
  padding: 9px 10px;
  border: none;
  border-radius: 8px;
  background: none;
  color: var(--text-body);
  text-decoration: none;
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}
.acct-item svg {
  color: var(--text-muted);
}
.acct-item:hover,
.acct-item:focus-visible {
  background: var(--surface-2);
  color: var(--text);
  outline: none;
}
.acct-logout-form {
  margin: 4px 0 6px;
  padding-top: 4px;
  border-top: 1px solid var(--line);
}
.acct-logout,
.acct-logout svg {
  color: var(--red);
}

/* ---------- 画面最上部のタブ(管理者のみ) ---------- */
.top-tabs {
  display: flex;
  gap: 4px;
  padding: 3px;
  margin-left: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.top-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 7px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
}
.top-tab:hover {
  color: var(--text);
}
.top-tab[data-active="true"] {
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* ---------- マイページ・アカウント管理 ---------- */
.account-page {
  max-width: 860px !important;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.account-page .page-head {
  margin-bottom: 0;
}
.account-h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 16px;
  font-size: 15px;
}
.account-divider {
  height: 1px;
  background: var(--line);
  margin: 18px 0;
}
.avatar-uploader {
  display: flex;
  gap: 20px;
  align-items: center;
  flex-wrap: wrap;
}
.avatar-drop {
  padding: 6px;
  border: 2px dashed var(--border-strong);
  border-radius: 50%;
}
.avatar-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1 1;
  min-width: 240px;
}
.account-dl {
  display: grid;
  grid-template-columns: 120px 1fr;
  grid-gap: 10px 14px;
  gap: 10px 14px;
  margin: 0;
  font-size: 13px;
}
.account-dl dt {
  color: var(--text-muted);
}
.account-dl dd {
  margin: 0;
}
.account-quota {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  grid-gap: 12px;
  gap: 12px;
}
.account-quota-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
}
.account-quota-item > span:last-child {
  display: flex;
  flex-direction: column;
}
.account-quota-item i {
  font-style: normal;
  font-size: 12px;
  color: var(--text-muted);
}
.account-quota-item b {
  font-size: 24px;
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
}
.account-quota-item b small {
  font-size: 12px;
  margin-left: 3px;
  font-weight: 500;
}
.account-quota-item em {
  font-style: normal;
  font-size: 11.5px;
  color: var(--text-faint);
}
.account-next {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text);
}
.account-next span:nth-child(2) {
  display: flex;
  flex-direction: column;
  flex: 1 1;
}
.account-next i {
  font-style: normal;
  font-size: 12px;
  color: var(--text-muted);
}
.account-next:hover {
  border-color: var(--border-strong);
}
.account-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 420px;
}
.session-list {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
}
.session-list li {
  display: flex;
  flex-direction: column;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.session-list i {
  font-style: normal;
  font-size: 11.5px;
  color: var(--text-muted);
}

@media (max-width: 900px) {
  .acct-trigger-text,
  .acct-caret {
    display: none;
  }
}
@media (max-width: 640px) {
  .top-tab {
    padding: 6px 8px;
    font-size: 11.5px;
  }
  .top-tab svg {
    display: none;
  }
  .app-header .top-tabs {
    display: none;
  }
}

/* ---------- 管理のタブ: 補足 ---------- */
.viz-empty {
  position: absolute;
  inset: 0 0 30px 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12.5px;
  color: var(--text-faint);
  pointer-events: none;
}
/* 操作の列は横スクロールしても右端に残す(横に長い一覧で、ボタンが画面外に行かないように) */
.users-table th.actions-col,
.users-table td.actions-col {
  position: -webkit-sticky;
  position: sticky;
  right: 0;
  background: var(--surface);
  box-shadow: -8px 0 8px -8px rgba(0, 0, 0, 0.12);
}
.users-table td:first-child {
  min-width: 240px;
}
.filter-row select.input {
  width: auto;
  min-width: 150px;
}

/* ===============================================================
   スマホ・読みものの画面の見え方
   =============================================================== */

/* 利用規約・ヘルプ・マイページなど幅を絞った画面は、左に寄せず中央に置く
   (広い画面で右側だけが大きく空くと、左に偏って見えるため) */
.page.doc,
.page.account-page {
  margin-left: auto;
  margin-right: auto;
}

/*
 * スマホでは「画面全体」を普通にスクロールさせる。
 *
 * パソコン向けには 画面の高さ(100vh)に枠を固定して、本文だけを中でスクロールさせている。
 * ところがスマホのブラウザでは 100vh が「アドレスバーに隠れている部分」まで含んだ高さになるため、
 * 本文の最後の部分がアドレスバーやツールバーの裏に入り、スクロールしても見えなくなる
 * (利用規約の最後の条文などが読めない原因)。
 * 画面全体をスクロールさせれば、ブラウザがバーの出し入れを含めて面倒を見てくれる。
 * ヘッダーは sticky で上に残す。
 */
@media (max-width: 900px) {
  .shell {
    display: block;
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: visible;
  }
  .main {
    display: block;
    overflow: visible;
  }
  .app-header {
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    z-index: 40;
  }
  .app-scroll {
    overflow: visible;
    min-height: calc(100dvh - var(--header-h));
  }
  /* 左右の余白をそろえ、下はホームバーの分も空ける */
  .app-content {
    padding: 18px 16px calc(48px + env(safe-area-inset-bottom, 0px));
  }
  .page-desc {
    max-width: none;
  }
  /* カードの内側の余白を少し詰めて、本文の幅を確保する(左右は同じ幅) */
  .card-pad,
  .panel {
    padding: 16px;
  }
  .auth-shell {
    min-height: 100dvh;
    padding: 16px;
  }
}

