/* =========================================================
  SEO日報 Tools 最終統合CSS（assets/common.css）- CLEAN
  対象：
  - seo-nippou-tools/index.html（一覧）
  - lead/index.html（問い合わせ予測）
  - local/index.html（地域別ボリューム）
  目的：
  - ボタン / カード / 見出し / テーブル / トースト を完全共通化
  - HTML側は最小クラス運用、CSSで一括管理
  - 旧 tp-hero / tp-section / tp-grid 等も互換維持（壊さない）
========================================================= */

/* -------------------------
  1) Design Tokens（ここだけ触れば全体が変わる）
------------------------- */
:root{
  /* Brand */
  --tp-primary: #10b981;      /* emerald */
  --tp-primary-d: #059669;
  --tp-accent: var(--tp-primary);
  --tp-accent-2: var(--tp-primary-d);

  /* Text */
  --tp-ink: #0f172a;
  --tp-text: var(--tp-ink);
  --tp-muted: #64748b;

  /* Surface */
  --tp-bg: #f1f5f9;
  --tp-soft: #f6f8fb;
  --tp-card: #ffffff;
  --tp-border: #e2e8f0;

  /* Layout */
  --tp-wrap: 1152px;
  --tp-gutter: 16px;

  /* Radius / Shadow */
  --tp-radius-sm: 12px;
  --tp-radius: 16px;
  --tp-radius-xl: 20px;
  --tp-shadow: 0 10px 20px rgba(2,6,23,.06);
  --tp-shadow-sm: 0 6px 14px rgba(2,6,23,.08);

  /* Focus ring */
  --tp-ring: 0 0 0 3px rgba(16,185,129,.22);

  /* Typography */
  --tp-font: system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans JP","Hiragino Kaku Gothic ProN","Yu Gothic",sans-serif;
  --tp-lh: 1.7;
}

/* -------------------------
  2) Minimal Reset（安全寄り）
------------------------- */
*,
*::before,
*::after{ box-sizing:border-box; }

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

body{
  margin: 0;
  font-family: var(--tp-font);
  color: var(--tp-text);
  background: var(--tp-bg);
  line-height: var(--tp-lh);
}

img{ max-width:100%; height:auto; display:block; }

a{ color: inherit; text-decoration: none; }
a:hover{ text-decoration: underline; text-underline-offset: 3px; }

p{ margin: 0; }
ul,ol{ margin: 0; padding-left: 1.2em; }

:focus-visible{
  outline: 3px solid rgba(16,185,129,.25);
  outline-offset: 2px;
}

.mono{ font-variant-numeric: tabular-nums; }

.is-hidden{ display:none !important; }

/* reduce motion */
@media (prefers-reduced-motion: reduce){
  *{ scroll-behavior: auto !important; }
  .tp-btn,
  .toast{ transition: none !important; }
}

/* -------------------------
  3) Base Layout
------------------------- */
.tp-body{
  margin: 0;
  min-height: 100vh;
  background: var(--tp-bg);
  color: var(--tp-text);
  font-family: var(--tp-font);
  line-height: var(--tp-lh);
}

.tp-container{
  max-width: var(--tp-wrap);
  margin: 0 auto;
  padding: var(--tp-gutter);
}
@media (min-width: 768px){
  .tp-container{ padding: 32px; }
}

.tp-stack{ display: grid; gap: 32px; }

/* -------------------------
  4) Topbar / Footer（共通）
------------------------- */
.tp-topbar{
  width: 100%;
  background: var(--tp-primary-d);
  color: #fff;
}
.tp-topbar__inner{
  padding-top: 8px;
  padding-bottom: 8px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
  font-size: 12px;
}
.tp-topbar a{ color:#fff; text-decoration:none; }
.tp-topbar__brand{ font-weight: 900; }
.tp-topbar__brand:hover{ text-decoration: underline; }
.tp-topbar__back{ opacity: .9; }
.tp-topbar__back:hover{ opacity: 1; text-decoration: underline; }

.tp-footer{
  width: 100%;
  background: #0f172a;
  color: #cbd5e1;
}
.tp-footer__inner{
  padding-top: 16px;
  padding-bottom: 16px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
  font-size: 14px;
}
.tp-link{
  color: inherit;
  text-decoration: none;
}
.tp-link:hover{ text-decoration: underline; }
.tp-link--danger{
  color: #ef4444;
  background: transparent;
  border: 0;
  padding: 0;
  font: inherit;
  cursor: pointer;
}
.tp-link--danger:hover{ color: #dc2626; text-decoration: underline; }

/* -------------------------
  5) Card / Section（共通）
------------------------- */
.tp-card{
  background: var(--tp-card);
  border: 1px solid rgba(226,232,240,.7);
  border-radius: var(--tp-radius-xl);
  box-shadow: var(--tp-shadow);
  padding: 20px;
}
@media (min-width: 768px){
  .tp-card{ padding: 28px; }
}

/* Header pattern */
.tp-header{
  display:flex;
  flex-direction: column;
  gap: 14px;
}
@media (min-width: 768px){
  .tp-header{
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
  }
}
.tp-header__side{
  display:flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-start;
}
@media (min-width: 768px){
  .tp-header__side{ align-items: flex-end; }
}
.tp-header__actions{
  display:flex;
  align-items:center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Section head */
.tp-sectionHead{
  display:flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 12px;
}
@media (min-width: 768px){
  .tp-sectionHead{
    flex-direction: row;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
  }
}
.tp-sectionHead__actions{
  display:flex;
  align-items:center;
  gap: 8px;
  flex-wrap: wrap;
}
.tp-actionsWrap{ flex-wrap: wrap; }

/* -------------------------
  6) Headings / Text（共通）
------------------------- */
.tp-h1{
  margin: 0;
  font-size: 24px;
  line-height: 1.25;
  font-weight: 900;
  color: #1e293b;
}
@media (min-width: 768px){
  .tp-h1{ font-size: 32px; }
}

.tp-h2{
  margin: 0;
  font-size: 18px;
  line-height: 1.25;
  font-weight: 900;
  color: #1e293b;
}
@media (min-width: 768px){
  .tp-h2{ font-size: 24px; }
}

.tp-h3{
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 900;
  color: #1e293b;
}

.tp-lead{
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--tp-muted);
}
@media (min-width: 768px){
  .tp-lead{ font-size: 14px; }
}

.tp-sub{
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--tp-muted);
}
@media (min-width: 768px){
  .tp-sub{ font-size: 14px; }
}

.tp-meta{ font-size: 12px; color: #94a3b8; }
.tp-text{ margin-top: 8px; color: var(--tp-muted); }

.tp-only-desktop{ display:none; }
@media (min-width: 768px){
  .tp-only-desktop{ display:inline; }
}

/* inline code */
code{
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 2px 6px;
}

/* -------------------------
  7) Buttons（共通）
------------------------- */
.tp-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap: 8px;
  border-radius: 14px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 900;
  text-decoration:none;
  border: 1px solid transparent;
  cursor:pointer;
  transition: transform .06s ease, box-shadow .15s ease, background .15s ease, border-color .15s ease, opacity .15s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.tp-btn:active{ transform: translateY(1px); }

.tp-btn--sm{ font-size: 12px; padding: 7px 12px; border-radius: 12px; }
.tp-btn--pill{ border-radius: 999px; }

.tp-btn--primary{
  background: var(--tp-primary);
  color: #fff;
  box-shadow: var(--tp-shadow-sm);
}
.tp-btn--primary:hover{ background: var(--tp-primary-d); text-decoration:none; }

.tp-btn--ghost{
  background: #fff;
  color: #334155;
  border-color: #cbd5e1;
}
.tp-btn--ghost:hover{ background: #f8fafc; text-decoration:none; }

.tp-btn--dark{
  background: #334155;
  color: #fff;
  box-shadow: var(--tp-shadow-sm);
}
.tp-btn--dark:hover{ background: #1f2937; text-decoration:none; }

/* -------------------------
  8) Form（共通）
------------------------- */
.tp-label{
  display:block;
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 900;
  color: #334155;
}
.tp-label--inline{ margin: 0; }

.tp-help{
  margin: 6px 0 0;
  font-size: 11px;
  color: #94a3b8;
}
.tp-warn{
  margin: 6px 0 0;
  font-size: 11px;
  color: #e11d48;
}

.tp-input,
.tp-select{
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
  background: #fff;
  color: #0f172a;
  outline: none;
}
.tp-select{ appearance: none; }
.tp-input:focus,
.tp-select:focus{
  border-color: var(--tp-primary);
  box-shadow: var(--tp-ring);
}
.tp-select--sm{
  font-size: 12px;
  padding: 7px 10px;
  border-radius: 10px;
}
.tp-input--sm{
  font-size: 12px;
  padding: 6px 8px;
  border-radius: 10px;
}

.tp-check{
  display:inline-flex;
  align-items:center;
  gap: 6px;
  font-size: 12px;
  color: #475569;
  user-select: none;
}
.tp-check input{ accent-color: var(--tp-primary-d); }

.tp-textarea{
  width: 100%;
  max-width: 100%;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  font-size: 14px;
  outline: none;
  background: #fff;
  min-height: 120px;
  font-family: ui-monospace, Menlo, Consolas, "Courier New", monospace;
}
.tp-textarea:focus{
  border-color: var(--tp-primary);
  box-shadow: var(--tp-ring);
}

/* layout helpers */
.tp-rowBetween{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
}
.tp-split{ display:flex; gap: 10px; }
.tp-split > *{ flex: 1; }

.tp-grid2{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.tp-grid3{
  display:grid;
  gap: 16px;
}
@media (min-width: 768px){
  .tp-grid3{ grid-template-columns: repeat(3, 1fr); }
  .tp-col-3{ grid-column: 1 / -1; }
}

.tp-mb-xs{ margin-bottom: 6px; }
.tp-mb-sm{ margin-bottom: 12px; }
.tp-mb-md{ margin-bottom: 16px; }
.tp-mb-lg{ margin-bottom: 22px; }

.tp-text-right{ text-align: right; }
.tp-text-center{ text-align: center; }

/* -------------------------
  9) KPI / Box（共通）
------------------------- */
.tp-kpi{
  background: #f8fafc;
  border: 1px solid rgba(226,232,240,.6);
  border-radius: var(--tp-radius-xl);
  padding: 16px;
}
.tp-kpi__label{
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 900;
  color: #64748b;
}
.tp-kpi__value{
  margin: 0;
  font-size: 18px;
  font-weight: 900;
  color: #0f172a;
}
.tp-kpi__help{
  margin: 6px 0 0;
  font-size: 11px;
  color: #94a3b8;
}

.tp-kpi--accent{
  background: #ecfdf5;
  border-color: #d1fae5;
}
.tp-kpi__label--accent{ color: #047857; }
.tp-kpi__value--accent{ color: #047857; }

.tp-box{
  background: #f8fafc;
  border: 1px solid rgba(226,232,240,.7);
  border-radius: var(--tp-radius-xl);
  padding: 16px;
  font-size: 12px;
  color: #475569;
}
.tp-box__title{
  margin: 0 0 6px;
  font-weight: 900;
  color: #334155;
}
.tp-box__text{
  margin: 0;
  white-space: pre-line;
}

/* -------------------------
  10) Table（共通）
------------------------- */
.tp-tableWrap{
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid var(--tp-border);
  background: #fff;
}

.tp-table{
  width: 100%;
  min-width: 760px;
  border-collapse: separate;
  border-spacing: 0;
  background: #fff;
  font-size: 12px;
}

.tp-th{
  background: #f8fafc;
  padding: 10px 8px;
  border-bottom: 1px solid var(--tp-border);
  text-align: left;
  font-weight: 900;
  color: #334155;
  white-space: nowrap;
}
.tp-th--right{ text-align: right; }
.tp-th--center{ text-align: center; }
.tp-th__hint{
  font-size: 11px;
  color: #94a3b8;
  font-weight: 800;
}

.tp-td{
  padding: 10px 8px;
  border-top: 1px solid var(--tp-border);
  vertical-align: middle;
}
.tp-td--right{ text-align: right; }
.tp-td--center{ text-align: center; }

.tp-strong{ font-weight: 900; color: #334155; }

.sticky-head thead th{
  position: sticky;
  top: 0;
  z-index: 10;
}

/* row input widths（leadツール用） */
.tp-w-kw{ width: 10.5rem; }
@media (min-width: 768px){ .tp-w-kw{ width: 14rem; } }
.tp-w-sv{ width: 7rem; }
.tp-w-rank{ width: 5.2rem; }
.tp-w-ctr{ width: 5.2rem; }
.tp-w-ir{ width: 5.2rem; }

/* -------------------------
  11) Total（共通）
------------------------- */
.tp-total{
  margin-top: 16px;
  background: #f8fafc;
  border: 1px solid rgba(226,232,240,.7);
  border-radius: var(--tp-radius-xl);
  padding: 16px;
}
.tp-total__title{
  margin: 0 0 6px;
  font-weight: 900;
  color: #334155;
  font-size: 12px;
}
.tp-total__value{
  margin: 0;
  font-size: 16px;
  font-weight: 900;
  color: #047857;
}

/* -------------------------
  12) Toast（共通）
------------------------- */
.toast{ transition: opacity .2s ease, transform .2s ease; }

.tp-toast{
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%) translateY(8px);
  opacity: 0;
  pointer-events: none;
  z-index: 9999;
}
.tp-toast__inner{
  background: #0f172a;
  color: #fff;
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 12px;
  box-shadow: 0 14px 30px rgba(2,6,23,.28);
}
.tp-toast.is-on{
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.tp-toast.is-off{
  opacity: 0;
  transform: translateX(-50%) translateY(8px);
}

/* -------------------------
  13) Chips / Steps（共通）
------------------------- */
.tp-kLinks{
  display:flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.tp-chip{
  display:inline-flex;
  align-items:center;
  padding: 8px 12px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--tp-border);
  color: #475569;
  font-weight: 800;
  font-size: 13px;
  text-decoration:none;
}
.tp-chip:hover{
  background: rgba(16,185,129,.06);
  color: #065f46;
  text-decoration:none;
}

.tp-steps{
  margin: 12px 0 0;
  padding-left: 1.2em;
}
.tp-steps li{ margin: 10px 0; }
.tp-stepTitle{
  display:inline-block;
  margin-right: 6px;
}
.tp-stepText{ color: var(--tp-muted); }

.tp-sep{ margin: 0 6px; color: #94a3b8; }

/* =========================================================
  14) 互換レイヤー（旧 tools 一覧HTML向け）
  - tp-hero / tp-section / tp-grid / tp-actions などが残っていても崩れない
========================================================= */
.tp{ padding: clamp(18px, 3vw, 28px) 0; }

.tp-hero,
.tp-section{
  width: min(var(--tp-wrap), calc(100% - var(--tp-gutter)*2));
  margin: 0 auto;
}

.tp-main{ display:block; }

.tp-section{ padding: clamp(18px, 3.2vw, 26px) 0; }
.tp-section + .tp-section{ border-top: 1px solid var(--tp-border); }
.tp-section--soft{
  background: var(--tp-soft);
  border-top: 0;
  border-bottom: 0;
}

.tp-hero{
  padding: clamp(18px, 3.2vw, 28px);
  border: 1px solid var(--tp-border);
  border-radius: var(--tp-radius);
  box-shadow: var(--tp-shadow-sm);
  background: linear-gradient(180deg, rgba(16,185,129,.06), rgba(16,185,129,0));
}

.tp-eyebrow{
  display:flex;
  align-items:center;
  gap:10px;
  margin-bottom: 10px;
}
.tp-eyebrowText{
  display:inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(16,185,129,.10);
  color: #065f46;
  font-weight: 900;
  font-size: 13px;
}

.tp-heroLinks{
  display:flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}

/* old badge list */
.tp-badges{
  display:flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style:none;
  padding:0;
  margin-top: 14px;
}
.tp-badge{
  display:inline-flex;
  align-items:center;
  padding: 6px 10px;
  border: 1px solid var(--tp-border);
  border-radius: 999px;
  background: rgba(255,255,255,.8);
  font-size: 13px;
  color: #475569;
  font-weight: 800;
}

/* old grid cards */
.tp-grid{
  display:grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 14px;
}
.tp-grid > .tp-card{
  grid-column: span 6;
}
@media (max-width: 860px){
  .tp-grid > .tp-card{ grid-column: span 12; }
}

/* old card head */
.tp-cardHead{ margin-bottom: 10px; }
.tp-cardTitleLink{ text-decoration: none; }
.tp-cardTitleLink:hover{ text-decoration: underline; }

/* old points / note */
.tp-points{
  margin: 10px 0 0;
  padding-left: 1.2em;
  color: var(--tp-ink);
}
.tp-points li{ margin: 6px 0; }
.tp-note{
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--tp-border);
  color: #64748b;
  font-size: 13px;
}

/* old actions wrapper */
.tp-actions{
  display:flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

/* old CTA box */
.tp-cta{
  padding: clamp(18px, 3.2vw, 26px);
  border: 1px solid var(--tp-border);
  border-radius: var(--tp-radius);
  background: #fff;
  box-shadow: var(--tp-shadow-sm);
}

/* =========================================================
  15) local tool 専用（最小限だけ）
  - local の SP カード切替や配置用
========================================================= */
.tp-badge{ /* local側でも使われる可能性があるため軽く統一 */
  display:inline-flex;
  align-items:center;
  border: 1px solid rgba(16,185,129,.35);
  color: #065f46;
  background: #ecfdf5;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 900;
}

.tp-lede{
  margin: 12px 0 0;
  color: #334155;
  background: #f8fafc;
  border: 1px solid rgba(226,232,240,.8);
  border-radius: 14px;
  padding: 14px 16px;
  line-height: 1.9;
  overflow-wrap: anywhere;
}

.tp-local-head__top{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.tp-local-grid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 900px){
  .tp-local-grid{ grid-template-columns: 1fr; }
}

.tp-local-row{
  display:grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 10px;
}
@media (max-width: 600px){
  .tp-local-row{ grid-template-columns: 1fr; }
}

.tp-local-kpi{
  display:grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 10px;
}
@media (max-width: 720px){
  .tp-local-kpi{ grid-template-columns: repeat(2, 1fr); }
}

.tp-local-subcontrols{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.tp-local-mini{ min-width: 220px; }

.tp-local-tableWrap{ margin-top: 8px; }
.tp-local-cards{ display:none; gap: 10px; margin-top: 8px; }
@media (max-width: 720px){
  .tp-local-tableWrap{ display:none; }
  .tp-local-cards{ display:grid; }
}

.tp-local-cardRow{
  border: 1px solid rgba(226,232,240,.9);
  border-radius: 16px;
  padding: 14px;
  background: #fff;
}
.tp-local-cardRow__title{
  font-weight: 900;
  margin: 0 0 10px;
  color: #0f172a;
}
.tp-local-kv{
  display:grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items:center;
  padding: 6px 0;
  border-top: 1px dashed rgba(226,232,240,.9);
}
.tp-local-kv:first-of-type{ border-top: 0; }
.tp-local-kv__label{ font-size: 12px; color: #64748b; }
.tp-local-kv__val{ font-weight: 900; color: #0f172a; text-align:right; }

.tp-local-cardRow__actions{
  margin-top: 10px;
  display:flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* tfoot readability */
.tp-local-table tfoot td{
  font-weight: 900;
  background: #fbfdff;
}
