/* SuguNavi 管理画面 — 落ち着いた B2B SaaS 風。ライト/ダーク両対応 */
:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --surface-3: #f1f3f6;
  --border: #e3e6eb;
  --border-strong: #cfd4dc;
  --text: #18202b;
  --text-2: #3d4756;
  --muted: #6b7482;
  --accent: #2563eb;
  --accent-hover: #1d4fd8;
  --accent-soft: #eaf1ff;
  --accent-text: #1e47b8;
  --on-accent: #ffffff;
  --ok: #15803d;
  --ok-soft: #e8f6ec;
  --warn: #b45309;
  --warn-soft: #fdf3e2;
  --danger: #c2362b;
  --danger-hover: #a52b22;
  --danger-soft: #fdecea;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 4px 12px rgba(16, 24, 40, .05);
  --shadow-lg: 0 12px 40px rgba(16, 24, 40, .18);
  --radius: 10px;
  --radius-sm: 7px;
  --font: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "PingFang SC", "PingFang TC", "Apple SD Gothic Neo", "Noto Sans JP", "Noto Sans SC", "Noto Sans TC", "Noto Sans KR", "Yu Gothic UI", "Yu Gothic", Meiryo, "Microsoft YaHei", "Malgun Gothic", system-ui, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1218;
    --surface: #171b23;
    --surface-2: #1b2029;
    --surface-3: #222833;
    --border: #2a313d;
    --border-strong: #3a4250;
    --text: #e7eaf0;
    --text-2: #c3c9d3;
    --muted: #8d96a5;
    --accent: #5b8cff;
    --accent-hover: #7aa2ff;
    --accent-soft: #1b2948;
    --accent-text: #9dbbff;
    --on-accent: #0b1220;
    --ok: #4ade80;
    --ok-soft: #14301f;
    --warn: #f0b04a;
    --warn-soft: #33270f;
    --danger: #f2766b;
    --danger-hover: #ff8f85;
    --danger-soft: #3a1a18;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow: 0 1px 3px rgba(0, 0, 0, .35), 0 4px 12px rgba(0, 0, 0, .25);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 14px; line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-text); }
h1, h2, h3, h4 { margin: 0; line-height: 1.35; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: .92em; }
.pad { padding: 16px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icon { flex: none; display: block; }

/* ---------- 共通レイアウト ---------- */
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: saturate(1.4) blur(8px); border-bottom: 1px solid var(--border); }
.topbar-inner { max-width: 1200px; margin: 0 auto; height: 56px; padding: 0 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font-weight: 700; font-size: 14px; }
.brand-sub { font-size: 11px; color: var(--muted); }
.topbar-user { display: flex; align-items: center; gap: 12px; min-width: 0; }
.auth-tools { position: fixed; top: 16px; right: 16px; z-index: 5; }
.lang-switch { position: relative; }
.lang-btn {
  height: 32px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer;
}
.lang-btn:hover { border-color: var(--accent); color: var(--accent-text); }
.lang-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 40; margin: 0; padding: 6px;
  list-style: none; min-width: 148px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: var(--shadow-lg);
}
.lang-item {
  display: block; width: 100%; text-align: left; border: 0; background: transparent; color: var(--text);
  font: inherit; font-size: 13.5px; font-weight: 600; padding: 8px 10px; border-radius: 7px; cursor: pointer;
}
.lang-item:hover, .lang-item[aria-checked="true"] { background: var(--accent-soft); color: var(--accent-text); }
.user-meta { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.25; min-width: 0; }
.user-company { font-size: 13px; font-weight: 600; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-email { font-size: 11px; color: var(--muted); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main { max-width: 1200px; margin: 0 auto; padding: 28px 20px 120px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-title { font-size: 22px; font-weight: 700; letter-spacing: .01em; }
.page-lead { color: var(--muted); margin-top: 4px; }

.loading-screen { min-height: 100vh; display: grid; place-items: center; }
.loading-inline { display: grid; place-items: center; padding: 48px 0; }
.spinner { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- ボタン ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px; border-radius: var(--radius-sm); border: 1px solid transparent;
  font-size: 13.5px; font-weight: 600; cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn-sm:has(> .icon:only-child) { width: 30px; padding: 0; }
.btn-block { width: 100%; height: 40px; }
.btn-primary { background: var(--accent); color: var(--on-accent); box-shadow: var(--shadow-sm); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-secondary { background: var(--surface); border-color: var(--border-strong); color: var(--text); box-shadow: var(--shadow-sm); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-3); }
.btn-secondary.is-pressed { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); }
.btn-primary.is-pressed { box-shadow: inset 0 0 0 2px rgba(255,255,255,.35); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-3); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: var(--danger-hover); }
.btn-danger-ghost { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.btn-danger-ghost:hover:not(:disabled) { background: var(--danger-soft); }
.btn.is-busy { cursor: progress; }
.btn.is-busy::before { content: ""; width: 12px; height: 12px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
.btn.is-busy > .icon { display: none; }
.icon-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: var(--radius-sm); border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.link-btn { border: 0; background: none; padding: 0; color: var(--accent-text); cursor: pointer; font-size: 12.5px; text-decoration: underline; text-underline-offset: 2px; }

/* ---------- フォーム ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field-hint { font-size: 12px; color: var(--muted); }
.input {
  width: 100%; min-width: 0; height: 36px; padding: 0 11px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
textarea.input { height: auto; padding: 8px 11px; resize: vertical; line-height: 1.55; }
select.input { padding-right: 28px; }
.input::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.input-narrow { width: 110px; flex: none; }
.inline-form { display: flex; gap: 8px; align-items: center; }
.inline-form .input { flex: 1; }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); cursor: pointer; }
.check input { margin-top: 4px; accent-color: var(--accent); }
.check strong { display: block; font-size: 13.5px; }
.form-error { background: var(--danger-soft); color: var(--danger); border-radius: var(--radius-sm); padding: 9px 12px; font-size: 13px; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.stack-sm > .inline-form { width: 100%; }
.stack-lg { display: flex; flex-direction: column; gap: 20px; min-width: 0; }

/* ---------- カード・セクション ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.section { padding: 20px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.section-head { display: flex; flex-direction: column; gap: 3px; }
.section-title { font-size: 15px; font-weight: 700; }
.section-desc { font-size: 12.5px; color: var(--muted); }
.section-danger { border-color: color-mix(in srgb, var(--danger) 30%, var(--border)); }
.danger-row { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.panel { padding: 18px 20px; margin-bottom: 16px; display: flex; flex-direction: column; gap: 14px; }
.panel-title { font-size: 14.5px; font-weight: 700; }
.panel-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.panel-preview { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.callout { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-3); color: var(--text-2); font-size: 12.5px; }
.callout .icon { margin-top: 2px; color: var(--muted); }
.callout-warn { background: var(--warn-soft); color: var(--warn); }
.callout-danger { background: var(--danger-soft); color: var(--danger); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.grid-2-1 { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 20px; align-items: start; }

.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; background: var(--surface-3); color: var(--text-2); border: 1px solid var(--border); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-mono { font-family: var(--mono); font-size: 11px; }
.chip-soft { background: var(--ok-soft); color: var(--ok); border-color: transparent; align-self: flex-start; margin-top: 8px; }
.chip-add { cursor: pointer; background: var(--surface); border-style: dashed; }
.chip-add:hover { border-color: var(--accent); color: var(--accent-text); }
.badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 5px; flex: none; }
.badge-new { background: var(--ok-soft); color: var(--ok); }
.badge-update { background: var(--accent-soft); color: var(--accent-text); }
.badge-same { background: var(--surface-3); color: var(--muted); }

/* ---------- 空状態 ---------- */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 44px 24px; }
.empty-icon { width: 56px; height: 56px; border-radius: 14px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); margin-bottom: 4px; }
.empty-title { font-size: 16px; font-weight: 700; }
.empty-body { color: var(--muted); max-width: 520px; font-size: 13.5px; }
.empty-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 8px; }

/* ---------- 認証画面 ---------- */
.auth-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 16px; gap: 20px;
  background: radial-gradient(1200px 500px at 50% -10%, var(--accent-soft), transparent 70%), var(--bg); }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); padding: 28px; display: flex; flex-direction: column; gap: 18px; }
.auth-title { font-size: 20px; font-weight: 700; }
.auth-lead { color: var(--muted); margin-top: -10px; font-size: 13px; }
.auth-footer { font-size: 13px; color: var(--muted); }

/* ---------- サービス一覧 ---------- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.card-grid-empty { display: block; background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius); }
.tenant-card { display: flex; flex-direction: column; gap: 12px; padding: 18px; text-decoration: none; color: inherit; transition: border-color .15s, box-shadow .15s, transform .15s; }
.tenant-card:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); box-shadow: var(--shadow); }
.tenant-card-head { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.tenant-card-name { font-size: 16px; font-weight: 700; overflow-wrap: anywhere; }
.tenant-card-origin { display: flex; gap: 6px; align-items: center; font-size: 12.5px; color: var(--text-2); min-width: 0; }
.tenant-card-origin span:first-of-type { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tenant-card-foot { font-size: 12px; color: var(--muted); border-top: 1px solid var(--border); padding-top: 10px; }
.skeleton { min-height: 150px; }
.sk-line { height: 12px; border-radius: 6px; background: var(--surface-3); animation: pulse 1.2s ease-in-out infinite; }
.sk-line.w60 { width: 60%; height: 16px; } .sk-line.w40 { width: 40%; } .sk-line.w80 { width: 80%; }
@keyframes pulse { 50% { opacity: .5; } }

/* メーター */
.meter { display: flex; flex-direction: column; gap: 6px; }
.meter-label { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); gap: 8px; }
.meter-value strong { color: var(--text); font-size: 15px; }
.meter:not(.meter-compact) .meter-value strong { font-size: 22px; }
.meter-track { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progress-row .meter-track { flex: 1; }
.meter-bar { height: 100%; border-radius: inherit; background: var(--accent); transition: width .4s ease; }
.meter-warn .meter-bar { background: var(--warn); }
.meter-danger .meter-bar { background: var(--danger); }

/* ---------- 詳細 ---------- */
.back-link { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--muted); text-decoration: none; margin-bottom: 10px; }
.back-link:hover { color: var(--text); }
.detail-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.detail-title-wrap { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.detail-title-wrap .page-title { overflow-wrap: anywhere; }
.saved-state { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--muted); }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 22px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { display: inline-flex; align-items: center; gap: 6px; padding: 10px 14px; font-size: 13.5px; font-weight: 600; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; border-radius: 6px 6px 0 0; }
.tab:hover { color: var(--text); background: var(--surface-3); }
.tab.is-active { color: var(--accent-text); border-bottom-color: var(--accent); }

.tab-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.tab-head > div:first-child { display: flex; flex-direction: column; max-width: 680px; }
.tab-title { font-size: 17px; font-weight: 700; }
.tab-lead { color: var(--muted); font-size: 13px; margin-top: 3px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; }
.tab-body > .field-hint { margin: -8px 0 14px; }
.tab-body > .section, .tab-body > .card { margin-bottom: 20px; }
.table-foot { font-size: 12px; margin-top: 10px; }

/* ---------- 利用状況: 費用 ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
.kpi { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2, var(--surface)); min-width: 0; }
.kpi-label { font-size: 12px; color: var(--muted); }
.kpi-value { font-size: 20px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.table-scroll { overflow-x: auto; margin-top: 12px; }
.cost-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.cost-table th, .cost-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
.cost-table th { font-size: 12px; color: var(--muted); font-weight: 600; }
.cost-table .num { text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 720px) { .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* 保存バー */
.savebar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; justify-content: center; padding: 0 16px 16px; pointer-events: none; transform: translateY(120%); transition: transform .2s ease; }
.savebar.is-visible { transform: none; }
.savebar-inner { pointer-events: auto; display: flex; align-items: center; gap: 16px; justify-content: space-between; width: 100%; max-width: 640px; padding: 10px 10px 10px 18px; border-radius: 12px; background: var(--text); color: var(--bg); box-shadow: var(--shadow-lg); }
.savebar-msg { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; }
.savebar .dot { width: 8px; height: 8px; border-radius: 50%; background: #f59e0b; box-shadow: 0 0 0 4px rgba(245, 158, 11, .25); }
.savebar-actions { display: flex; gap: 6px; }
.savebar .btn-ghost { color: var(--bg); opacity: .8; }
.savebar .btn-ghost:hover { background: rgba(127,127,127,.2); color: var(--bg); opacity: 1; }

/* 導入タブ */
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 26px; counter-reset: none; }
.step { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 14px; }
.step-num { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 700; background: var(--accent-soft); color: var(--accent-text); }
.step-num-sm { width: 24px; height: 24px; font-size: 12px; }
.step-main { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.step-title { font-size: 14.5px; font-weight: 700; padding-top: 3px; }
.step-desc { color: var(--muted); font-size: 12.5px; margin-top: -6px; }
.code-block { position: relative; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.code-block pre { margin: 0; padding: 14px 14px 52px; overflow-x: auto; font-family: var(--mono); font-size: 12.5px; line-height: 1.6; white-space: pre-wrap; word-break: break-all; color: var(--text); }
.code-actions { position: absolute; right: 10px; bottom: 10px; }
.origin-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.origin-item { display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 12px; color: var(--text-2); }
.origin-item + .origin-item { border-top: 1px solid var(--border); }
.origin-item .mono { flex: 1; min-width: 0; overflow-wrap: anywhere; color: var(--text); }
.bookmarklet-box { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; padding: 14px; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); background: var(--surface-2); }
.bookmarklet-lead { font-size: 13px; color: var(--text-2); }
.bookmarklet { display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-weight: 700; font-size: 13px; text-decoration: none; cursor: grab; box-shadow: var(--shadow); max-width: 100%; }
.bookmarklet span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bookmarklet:active { cursor: grabbing; }
.bookmarklet.is-disabled { opacity: .5; pointer-events: none; }
.hint-list { margin: 0; padding-left: 18px; font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 3px; }
.key-row { display: flex; align-items: center; gap: 6px; padding: 6px 6px 6px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.key-value { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.section > .btn { align-self: flex-start; }
.progress-row { display: flex; align-items: center; gap: 10px; font-size: 12.5px; }
.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.check-item { display: flex; align-items: center; gap: 10px; padding: 9px 0; }
.check-item + .check-item { border-top: 1px solid var(--border); }
.check-mark { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; border: 1.5px dashed var(--border-strong); color: var(--muted); flex: none; }
.check-item.is-ok .check-mark { border: 0; background: var(--ok-soft); color: var(--ok); }
.check-label { flex: 1; display: flex; flex-direction: column; line-height: 1.35; min-width: 0; }
.check-label strong { font-size: 13px; }
.check-label .muted { font-size: 12px; }
.check-link { font-size: 12.5px; font-weight: 600; text-decoration: none; }
.check-link:hover { text-decoration: underline; }

/* 画面マップ */
.crawl-form { display: flex; flex-direction: column; gap: 14px; }
.crawl-fields { display: grid; grid-template-columns: minmax(0, 1fr) 140px; gap: 12px; }
.crawl-fields .input-narrow { width: 100%; }
.crawl-login-actions { justify-content: flex-start; align-items: center; }
.crawl-steps { margin-top: 2px; }
.crawl-status { font-size: 13px; color: var(--text-2); }
.sm-table { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.sm-row { display: grid; grid-template-columns: minmax(140px, 1.1fr) minmax(110px, .9fr) minmax(160px, 1.6fr) minmax(160px, 1.4fr) 40px; gap: 8px; padding: 8px 10px; align-items: center; }
.sm-row + .sm-row { border-top: 1px solid var(--border); }
.sm-head { background: var(--surface-2); font-size: 12px; font-weight: 600; color: var(--muted); padding-top: 9px; padding-bottom: 9px; }
.sm-cell { min-width: 0; }
.sm-cell .input { height: 34px; }
.preview-list { list-style: none; margin: 0; padding: 0; max-height: 420px; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.preview-item + .preview-item { border-top: 1px solid var(--border); }
.preview-item.is-same { opacity: .6; }
.preview-check { display: flex; gap: 10px; padding: 10px 12px; cursor: pointer; align-items: flex-start; }
.preview-check input { margin-top: 4px; accent-color: var(--accent); }
.preview-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.preview-line { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.preview-line .mono { color: var(--text-2); overflow-wrap: anywhere; }
.preview-sub { font-size: 12.5px; color: var(--text-2); }

/* 手順書 */
.proc-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); overflow: hidden; margin-bottom: 20px; }
.proc-list { border-right: 1px solid var(--border); background: var(--surface-2); display: flex; flex-direction: column; min-width: 0; }
.proc-list-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.proc-items { list-style: none; margin: 0; padding: 6px; display: flex; flex-direction: column; gap: 2px; max-height: 640px; overflow: auto; }
.proc-item { width: 100%; text-align: left; border: 0; background: transparent; padding: 9px 10px; border-radius: var(--radius-sm); cursor: pointer; display: flex; flex-direction: column; gap: 1px; }
.proc-item:hover { background: var(--surface-3); }
.proc-item.is-active { background: var(--surface); box-shadow: var(--shadow-sm), inset 3px 0 0 var(--accent); }
.proc-item-title { font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.proc-item-meta { font-size: 11.5px; color: var(--muted); }
.proc-editor { padding: 20px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.proc-editor > .btn { align-self: flex-start; }
.proc-editor-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.proc-steps-head h4 { font-size: 13px; font-weight: 700; margin-top: 6px; }
.proc-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.proc-step { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; background: var(--surface-2); display: flex; flex-direction: column; gap: 10px; }
.proc-step-head { display: flex; justify-content: space-between; align-items: center; }
.proc-step-tools { display: flex; gap: 2px; }
.proc-step-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.span-2 { grid-column: 1 / -1; }
.gl-head, .gl-row { display: grid; grid-template-columns: minmax(0, 1fr) 20px minmax(0, 1fr) 32px; gap: 8px; align-items: center; }
.gl-head { font-size: 12px; color: var(--muted); font-weight: 600; }
.gl-rows { display: flex; flex-direction: column; gap: 8px; }
.gl-arrow { text-align: center; color: var(--muted); }
.section > .btn-sm { align-self: flex-start; }

/* マニュアル */
.dropzone { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 28px 16px; border: 1.5px dashed var(--border-strong); border-radius: var(--radius); color: var(--muted); background: var(--surface-2); transition: border-color .15s, background-color .15s; }
.dropzone.is-over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone-title { color: var(--text); font-weight: 600; }
.dropzone .btn { margin-top: 8px; }
.doc-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.doc-item { display: flex; gap: 12px; align-items: center; padding: 10px 8px 10px 12px; }
.doc-item + .doc-item { border-top: 1px solid var(--border); }
.doc-icon { width: 34px; height: 34px; border-radius: 8px; background: var(--surface-3); display: grid; place-items: center; color: var(--muted); flex: none; }
.doc-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.doc-title { font-size: 13.5px; overflow-wrap: anywhere; }
.doc-meta { font-size: 12px; overflow-wrap: anywhere; }

/* 安全設定・タグ入力 */
.tags { display: flex; flex-wrap: wrap; gap: 6px; padding: 5px; min-height: 38px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); cursor: text; }
.tags:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.tag { display: inline-flex; align-items: center; gap: 2px; padding: 2px 4px 2px 9px; border-radius: 6px; background: var(--surface-3); border: 1px solid var(--border); font-size: 12.5px; max-width: 100%; }
.tag > span { overflow-wrap: anywhere; }
.tag-remove { display: grid; place-items: center; width: 20px; height: 20px; border: 0; background: none; border-radius: 4px; color: var(--muted); cursor: pointer; }
.tag-remove:hover { background: var(--border); color: var(--text); }
.tags-input { flex: 1; min-width: 120px; border: 0; outline: 0; background: transparent; padding: 3px 6px; height: 26px; }
.rule-warn .section-title::before, .rule-danger .section-title::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; vertical-align: middle; }
.rule-warn .section-title::before { background: var(--warn); }
.rule-danger .section-title::before { background: var(--danger); }
.rule-warn { border-top: 3px solid var(--warn); }
.rule-danger { border-top: 3px solid var(--danger); }
.suggest-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: -6px; font-size: 12.5px; }

/* 見た目 */
.appearance-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; align-items: start; }
.color-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.color-input { width: 44px; height: 36px; padding: 2px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.swatch { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--border-strong); cursor: pointer; }
.swatch:hover { transform: scale(1.1); }
.segmented { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 3px; background: var(--surface-2); align-self: flex-start; }
.segmented-opt { position: relative; }
.segmented-opt input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.segmented-opt span { display: block; padding: 5px 16px; border-radius: 5px; font-size: 13px; font-weight: 600; color: var(--muted); }
.segmented-opt input:checked + span { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.segmented-opt input:focus-visible + span { outline: 2px solid var(--accent); }
.preview-sticky { position: sticky; top: 76px; }
.preview-label { font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 8px; }
.wp-stage { position: relative; height: 520px; border-radius: var(--radius); border: 1px solid var(--border); overflow: hidden; background: var(--surface-3); }
.wp-page { position: absolute; inset: 0; padding: 18px; }
.wp-fake { display: flex; flex-direction: column; gap: 10px; }
.wp-fake i { display: block; height: 12px; border-radius: 6px; background: var(--border); width: 80%; }
.wp-fake i.short { width: 45%; }
/* プレビューはウィジェット本体に合わせて常にライト配色 */
.wp-panel { position: absolute; right: 14px; bottom: 82px; width: calc(100% - 28px); max-width: 300px; border-radius: 14px; background: #fff; color: #1f2937; box-shadow: 0 10px 30px rgba(0,0,0,.18); overflow: hidden; display: flex; flex-direction: column; font-size: 12.5px; }
.wp-panel.is-left { right: auto; left: 14px; }
.wp-head { display: flex; align-items: center; gap: 8px; padding: 11px 14px; border-bottom: 1px solid #eef0f3; }
.wp-head strong { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.wp-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.wp-mode { font-size: 10.5px; padding: 1px 7px; border-radius: 999px; background: #f1f3f6; color: #6b7280; }
.wp-body { padding: 12px; display: flex; flex-direction: column; gap: 8px; max-height: 300px; overflow: hidden; }
.wp-bubble { padding: 8px 11px; border-radius: 12px; max-width: 88%; overflow-wrap: anywhere; line-height: 1.5; white-space: pre-wrap; }
.wp-ai { background: #f1f3f6; border-bottom-left-radius: 4px; align-self: flex-start; }
.wp-user { color: #fff; border-bottom-right-radius: 4px; align-self: flex-end; }
.wp-sugg { display: flex; flex-wrap: wrap; gap: 5px; }
.wp-chip { border: 1px solid; border-radius: 999px; padding: 2px 9px; font-size: 11.5px; background: #fff; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wp-input { display: flex; align-items: center; gap: 8px; margin: 0 10px 10px; padding: 6px 6px 6px 12px; border: 1px solid #e3e6eb; border-radius: 10px; }
.wp-placeholder { flex: 1; color: #9aa1ad; }
.wp-send { width: 26px; height: 26px; border-radius: 7px; color: #fff; display: grid; place-items: center; }
.wp-launcher { position: absolute; right: 16px; bottom: 16px; width: 52px; height: 52px; border-radius: 50%; color: #fff; display: grid; place-items: center; box-shadow: 0 6px 18px rgba(0,0,0,.22); overflow: hidden; }
.wp-launcher.is-left { right: auto; left: 16px; }
.wp-launcher-img { width: 52px; height: 52px; object-fit: cover; display: block; }
.icon-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.icon-preview { width: 52px; height: 52px; border-radius: 50%; color: #fff; display: grid; place-items: center; flex: none; box-shadow: 0 4px 12px rgba(0,0,0,.16); overflow: hidden; }
.icon-preview-img { width: 52px; height: 52px; object-fit: cover; display: block; }
.wp-lang { display: inline-flex; align-items: center; gap: 3px; font-size: 10.5px; color: #6b7280; flex: none; }
/* 見た目タブ: プレビューの言語切替 */
.preview-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.preview-head .preview-label { margin-bottom: 0; }
.input-sm { height: 32px; font-size: 13px; padding: 0 10px; }
.preview-lang { width: auto; min-width: 120px; }
.preview-note { margin-top: 8px; }
/* 見た目タブ: 多言語（言語タブ） */
.lang-tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.lang-tab { position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 7px 11px; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; background: none; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; border-radius: 6px 6px 0 0; white-space: nowrap; }
.lang-tab:hover { color: var(--text); background: var(--surface-3); }
.lang-tab.is-active { color: var(--accent-text); border-bottom-color: var(--accent); }
.lang-tab-mark { width: 6px; height: 6px; border-radius: 50%; background: transparent; flex: none; }
.lang-tab.has-manual .lang-tab-mark { background: var(--accent); }
.lang-panel { display: flex; flex-direction: column; gap: 14px; }
.lang-panel textarea.input::placeholder, .lang-panel .input::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
.lang-status { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.lang-status-text { font-size: 12.5px; flex: 1; min-width: 180px; }
.lang-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.lang-note { display: flex; gap: 6px; align-items: flex-start; font-size: 12.5px; color: var(--text-2); overflow-wrap: anywhere; }
.lang-note.muted { color: var(--muted); }
.lang-note .icon { margin-top: 3px; }
.lang-slot-spacer { width: 30px; flex: none; }
/* 導入タブ: data-lang の説明 */
.setup-lang-hint { display: flex; gap: 6px; align-items: flex-start; margin-top: 10px; overflow-wrap: anywhere; }
.setup-lang-hint .icon { margin-top: 3px; }
.setup-lang-hint code { background: var(--surface-3); border-radius: 4px; padding: 0 4px; color: var(--text-2); }

/* 利用状況 */
.q-list { list-style: none; margin: 0; padding: 0; }
.q-item { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 12px 0; }
.q-item + .q-item { border-top: 1px solid var(--border); }
.q-main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.q-text { font-size: 13.5px; overflow-wrap: anywhere; }
.q-meta { font-size: 12px; overflow-wrap: anywhere; }

/* ---------- ダイアログ ---------- */
.dialog { width: min(480px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); }
.dialog-wide { width: min(720px, calc(100vw - 32px)); }
.dialog::backdrop { background: rgba(15, 18, 24, .45); backdrop-filter: blur(2px); }
.dialog[open] { animation: pop .16s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.98); } }
.dialog-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 16px 0 22px; }
.dialog-title { font-size: 16px; font-weight: 700; }
.dialog-body { padding: 14px 22px 22px; }
.dialog-message { color: var(--text-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; flex-wrap: wrap; }

/* ---------- トースト ---------- */
.toasts { position: fixed; top: 68px; right: 16px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: flex-start; gap: 10px; padding: 11px 8px 11px 14px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); font-size: 13px; animation: slidein .2s ease-out; }
.toast.is-leaving { opacity: 0; transform: translateX(8px); transition: opacity .2s, transform .2s; }
@keyframes slidein { from { opacity: 0; transform: translateY(-6px); } }
.toast-icon { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--accent-soft); color: var(--accent-text); }
.toast-success .toast-icon { background: var(--ok-soft); color: var(--ok); }
.toast-error { border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }
.toast-error .toast-icon { background: var(--danger-soft); color: var(--danger); }
.toast-text { flex: 1; padding-top: 1px; overflow-wrap: anywhere; }
.toast-close { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 2px; border-radius: 4px; display: grid; place-items: center; }
.toast-close:hover { background: var(--surface-3); }

/* ---------- 分析タブ ---------- */
.an-toolbar { align-items: center; }
.an-toolbar .segmented { align-self: center; }
.an-insight-slot { margin-bottom: 20px; } /* 段階3: AI レポートカード */
.an-body { display: flex; flex-direction: column; gap: 20px; margin-bottom: 20px; }
.an-body > .section { margin: 0; }
.an-body[aria-busy="true"] { opacity: .55; transition: opacity .15s; }
.an-kpis { margin-bottom: 0; }
.kpi-warn .kpi-value { color: var(--warn); }
.an-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.an-privacy { display: flex; gap: 6px; align-items: flex-start; font-size: 12px; margin-top: 4px; }
.an-privacy .icon { margin-top: 3px; }

.an-chart { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.an-chart-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.an-chart-readout { font-size: 12.5px; font-variant-numeric: tabular-nums; min-height: 1.6em; }
.an-chart-svg { width: 100%; min-width: 0; }
.an-svg { display: block; max-width: 100%; overflow: visible; }
.an-legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.an-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.an-swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.an-swatch-total, .an-bar-total { background: color-mix(in srgb, var(--accent) 28%, var(--surface)); fill: color-mix(in srgb, var(--accent) 28%, var(--surface)); }
.an-swatch-resolved, .an-bar-resolved { background: var(--accent); fill: var(--accent); }
.an-grid-line { stroke: var(--border); stroke-width: 1; stroke-dasharray: 2 3; }
.an-axis { stroke: var(--border-strong); stroke-width: 1; }
.an-tick { fill: var(--muted); font-size: 10.5px; font-family: var(--font); font-variant-numeric: tabular-nums; }
.an-hit { fill: transparent; }
.an-bar.is-hover .an-hit { fill: var(--surface-3); }
.an-bar.is-hover .an-bar-total { fill: color-mix(in srgb, var(--accent) 42%, var(--surface)); }

.an-rank { list-style: none; margin: 0; padding: 0; }
.an-rank-item + .an-rank-item { border-top: 1px solid var(--border); }
.an-rank-head { display: flex; align-items: center; gap: 12px; padding: 10px 0; min-width: 0; }
.an-details > summary { list-style: none; cursor: pointer; border-radius: var(--radius-sm); }
.an-details > summary::-webkit-details-marker { display: none; }
.an-details > summary:hover .an-rank-label { color: var(--accent-text); }
.an-rank-no { flex: none; width: 24px; height: 24px; border-radius: 6px; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--surface-3); color: var(--text-2); font-variant-numeric: tabular-nums; }
.an-rank-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.an-rank-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.an-rank-label { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.an-chev { flex: none; width: 16px; color: var(--muted); display: grid; place-items: center; }
.an-chev .icon { transition: transform .15s; }
.an-details[open] > summary .an-chev .icon { transform: rotate(180deg); }
.an-rank-bar { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.an-rank-fill { display: block; height: 100%; border-radius: inherit; background: color-mix(in srgb, var(--accent) 28%, var(--surface)); overflow: hidden; }
.an-rank-fill-ok { display: block; height: 100%; background: var(--accent); }
.an-rank-nums { flex: none; display: flex; flex-direction: column; align-items: flex-end; font-size: 12.5px; font-variant-numeric: tabular-nums; min-width: 64px; }
.an-rate { color: var(--muted); font-size: 12px; }
.an-rate.is-low, .an-big.is-low { color: var(--warn); }
.an-examples { margin: 0 0 12px 36px; padding: 10px 14px; list-style: none; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--text-2); }
.an-examples li { overflow-wrap: anywhere; }
.an-examples li::before { content: "「"; color: var(--muted); }
.an-examples li::after { content: "」"; color: var(--muted); }
.an-details-sm > summary { font-size: 12.5px; color: var(--accent-text); padding: 2px 0; align-self: flex-start; }
.an-details-sm .an-examples { margin: 6px 0 0; }

.an-list { list-style: none; margin: 0; padding: 0; }
.an-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; min-width: 0; }
.an-row + .an-row { border-top: 1px solid var(--border); }
.an-row-col { flex-direction: column; align-items: stretch; gap: 8px; }
.an-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.an-row-title { font-size: 13.5px; overflow-wrap: anywhere; }
.an-row-meta { font-size: 12px; overflow-wrap: anywhere; }
.an-row-side { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.an-row-actions { display: flex; gap: 6px; flex-wrap: wrap; flex: none; }
.an-meter { height: 6px; margin-top: 2px; }
.an-row.is-warn .meter-bar { background: var(--warn); }
.an-big { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; }
.an-badge-warn { background: var(--warn-soft); color: var(--warn); }
/* 分析: 言語別・言語バッジ */
.badge-lang { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.q-text .badge-lang { margin-right: 6px; vertical-align: 1px; }
.an-lang-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.an-lang-row { display: grid; grid-template-columns: 110px minmax(0, 1fr) 96px 72px; align-items: center; gap: 12px; font-size: 13px; font-variant-numeric: tabular-nums; }
.an-lang-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.an-lang-nums { text-align: right; white-space: nowrap; }
.an-lang-rate { text-align: right; white-space: nowrap; font-size: 12.5px; }
.an-stats { display: flex; gap: 6px; flex-wrap: wrap; }
/* AI レポート（段階3） */
.an-insight-slot:not([hidden]) { display: flex; flex-direction: column; gap: 20px; }
.an-insight-slot > .section { margin: 0; }
.an-ai { border-color: color-mix(in srgb, var(--accent) 30%, var(--border)); }
.an-ai-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.an-ai-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.an-ai-title .icon { color: var(--accent); }
.an-ai-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; flex: none; }
.an-ai-busy { align-items: center; }
.spinner-sm { width: 16px; height: 16px; border-width: 2px; flex: none; }
.an-ai-body { display: flex; flex-direction: column; gap: 14px; }
.an-ai-summary { font-size: 14px; line-height: 1.75; color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere; }
.an-ai-sub { font-size: 12.5px; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.an-ai-note { font-size: 12px; }
.an-ai-empty { font-size: 13px; }
.an-topics { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.an-topic { display: inline-flex; align-items: baseline; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-size: 12.5px; max-width: 100%; }
.an-topic-label { font-weight: 600; overflow-wrap: anywhere; }
.an-topic-count, .an-topic-rate { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.an-topic-rate.is-low { color: var(--warn); }
.an-ai-history { border-top: 1px solid var(--border); padding-top: 10px; }
.an-ai-history > summary { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--text-2); padding: 4px 0; }
.an-ai-history[open] > summary .an-chev .icon { transform: rotate(180deg); }
.an-hist { list-style: none; margin: 6px 0 0; padding: 0; }
.an-hist-row { display: flex; align-items: center; gap: 12px; padding: 10px 8px; border-radius: var(--radius-sm); min-width: 0; }
.an-hist-row + .an-hist-row { border-top: 1px solid var(--border); border-radius: 0; }
.an-hist-row.is-current { background: var(--accent-soft); border-radius: var(--radius-sm); }
.an-hist-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; font-variant-numeric: tabular-nums; }
.an-hist-summary { font-size: 12.5px; color: var(--text-2); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.an-pri-high { background: var(--danger-soft); color: var(--danger); }
.an-pri-medium { background: var(--warn-soft); color: var(--warn); }
.an-pri-low { background: var(--surface-3); color: var(--muted); }
.an-imp-list { list-style: none; margin: 0; padding: 0; }
.an-imp { display: flex; flex-direction: column; gap: 6px; padding: 14px 0; min-width: 0; }
.an-imp + .an-imp { border-top: 1px solid var(--border); }
.an-imp:first-child { padding-top: 0; }
.an-imp:last-child { padding-bottom: 0; }
.an-imp-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.an-imp-title { font-size: 14px; overflow-wrap: anywhere; }
.an-imp-detail { font-size: 13px; color: var(--text-2); line-height: 1.7; overflow-wrap: anywhere; white-space: pre-wrap; }
.an-imp-evidence { display: flex; gap: 8px; align-items: baseline; font-size: 12.5px; overflow-wrap: anywhere; }
.an-imp-evlabel { flex: none; font-size: 11px; font-weight: 700; padding: 0 6px; border-radius: 4px; background: var(--surface-3); color: var(--muted); }
.an-imp-action { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.an-imp-hint { font-size: 12.5px; overflow-wrap: anywhere; min-width: 0; }
.an-registered { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--ok); white-space: nowrap; }
.an-vocab-wrap { margin-top: 0; }
.an-vocab td { vertical-align: middle; }
.an-vocab .an-vocab-term { font-weight: 600; white-space: normal; overflow-wrap: anywhere; min-width: 5em; }
.an-vocab .an-vocab-sugg { white-space: normal; overflow-wrap: anywhere; color: var(--text-2); min-width: 8em; }
.an-vocab .an-vocab-act { text-align: right; white-space: nowrap; }
@media (max-width: 960px) { .an-grid { grid-template-columns: minmax(0, 1fr); } }
/* 言葉のズレ表は狭い幅では1行ずつカードにする（5列が横に収まらないため 560px より広めに切り替える） */
@media (max-width: 720px) {
  .an-vocab thead { display: none; }
  .an-vocab, .an-vocab tbody, .an-vocab tr, .an-vocab td { display: block; width: 100%; }
  .an-vocab tr { padding: 10px 0; border-bottom: 1px solid var(--border); display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 6px 12px; }
  .an-vocab tr:last-child { border-bottom: 0; }
  .an-vocab td { padding: 0; border: 0; text-align: left; min-width: 0; }
  .an-vocab .an-vocab-term, .an-vocab .an-vocab-sugg { min-width: 0; }
  .an-vocab td[data-label]::before { content: attr(data-label); display: block; font-size: 11px; color: var(--muted); font-weight: 600; margin-bottom: 2px; }
  .an-vocab .an-vocab-sugg, .an-vocab .an-vocab-act { grid-column: 1 / -1; }
  .an-vocab .num { text-align: left; }
  .an-vocab .an-vocab-act { text-align: left; }
  .an-vocab .an-vocab-act:empty { display: none; }
}
@media (max-width: 560px) {
  .an-toolbar { width: 100%; justify-content: space-between; }
  .an-examples { margin-left: 0; }
  .an-rank-label { white-space: normal; overflow-wrap: anywhere; }
  .an-rank-title { align-items: flex-start; flex-wrap: wrap; gap: 4px 8px; }
  .an-ai-head { flex-direction: column; align-items: stretch; }
  .an-ai-actions { justify-content: flex-start; }
  .an-hist-row { flex-wrap: wrap; padding: 10px 4px; }
  .an-lang-row { grid-template-columns: minmax(0, 1fr) auto auto; gap: 4px 10px; }
  .an-lang-row .an-rank-bar { grid-column: 1 / -1; grid-row: 2; }
}

/* ---------- レスポンシブ ---------- */
@media (max-width: 960px) {
  .grid-2-1, .appearance-grid { grid-template-columns: minmax(0, 1fr); }
  .preview-sticky { position: static; }
  .wp-stage { height: 460px; }
}
@media (max-width: 860px) {
  .sm-head { display: none; }
  .sm-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); padding: 12px; }
  .sm-cell::before { content: attr(data-label); display: block; font-size: 11.5px; color: var(--muted); font-weight: 600; margin-bottom: 3px; }
  .sm-cell-action { grid-column: 1 / -1; display: flex; justify-content: flex-end; }
  .sm-cell-action::before { content: none; }
  .proc-layout { grid-template-columns: minmax(0, 1fr); }
  .proc-list { border-right: 0; border-bottom: 1px solid var(--border); }
  .proc-items { max-height: 220px; }
}
@media (max-width: 720px) {
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .main { padding: 18px 16px 120px; }
  .topbar-inner { padding: 0 16px; }
  .brand-sub, .user-meta { display: none; }
  .page-title { font-size: 19px; }
  .page-head > .btn { width: 100%; }
  .card-grid { grid-template-columns: minmax(0, 1fr); }
  .section { padding: 16px; }
  .sm-row { grid-template-columns: minmax(0, 1fr); }
  .proc-step-grid { grid-template-columns: minmax(0, 1fr); }
  .proc-editor { padding: 16px; }
  .crawl-fields { grid-template-columns: minmax(0, 1fr); }
  .step { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .q-item { flex-direction: column; align-items: stretch; }
  .q-item .btn { align-self: flex-start; }
  .savebar { padding: 0 8px 8px; }
  .savebar-inner { flex-direction: column; align-items: stretch; gap: 8px; padding: 12px; }
  .savebar-actions { justify-content: flex-end; }
  .auth-card { padding: 22px; }
  .tab { padding: 10px 11px; }
  .gl-head { display: none; }
  .gl-row { grid-template-columns: minmax(0, 1fr) 14px minmax(0, 1fr) 30px; gap: 4px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
