/* =====================================================================
   AGREE PORTAL — 共通スタイル
   ブランドガイドライン Ver.1.0 準拠
   - メインは AGREE Blue、Logo Yellow は CTA/アクセントのみ
   - Pink は相談まわりの柔らかい表現だけに使う
   - 文字は Dark Navy、背景の補助エリアは Light Blue
   - 角丸 24〜32px / 影は薄く / 8px グリッド
   ===================================================================== */

:root {
  /* --- ブランド --- */
  --agree-blue: #7093CB;
  --logo-yellow: #F5AF1A;
  --pink: #e18ca4;
  --light-blue: #DDE9F8;
  --dark-navy: #4E6E93;
  --gray: #7C7C7C;
  --white: #FFFFFF;

  /* --- インク（文字） --- */
  --ink: #2F4463;
  --ink-secondary: #4E6E93;
  --ink-muted: #7C7C7C;

  /* --- 面 --- */
  --surface: #FCFCFB;
  --surface-card: #FFFFFF;
  --surface-sunken: #F4F8FD;
  --border: #E4EBF4;
  --grid: #EDF1F7;

  /* --- グラフ用パレット ---
     validate_palette.js で検証済み（light / adjacent）
     CVD worst ΔE 12.9 · normal-vision worst 16.7 · 全チェック PASS  */
  --cat-1: #3E76C4;  /* AGREE Blue 系 — 既定の単系列色 */
  --cat-2: #1E9E8A;
  --cat-3: #7B5EA7;
  --cat-4: #C98A00;  /* 対 surface 2.87:1 — 直接ラベル必須 */
  --cat-5: #C2628A;

  /* ファネル用 順序ランプ（AGREE Blue 単色・検証済み） */
  --ord-1: #93B2DC;
  --ord-2: #6F92CB;
  --ord-3: #4C76B4;
  --ord-4: #31578F;
  --ord-5: #1D3A66;

  /* 非強調 */
  --mute-mark: #C7D3E2;

  /* --- ステータス --- */
  --good: #0F7B5F;
  --warn: #B26A00;
  --critical: #B3261E;

  /* --- かたち --- */
  --r-card: 24px;
  --r-control: 28px;
  --r-chip: 999px;
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-raised: 0 6px 20px rgba(46, 68, 99, 0.08);

  --sidebar-w: 232px;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--surface);
  color: var(--ink);
  font-family: "Noto Sans JP", "Hiragino Sans", "Yu Gothic", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: "Zen Kaku Gothic New", "Noto Sans JP", sans-serif;
  font-weight: 700;
  letter-spacing: 0.01em;
  margin: 0;
}

a { color: var(--cat-1); }

/* ---------- レイアウト ---------- */

.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--white);
  border-right: 1px solid var(--border);
  padding: 32px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand { padding: 0 12px 24px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.brand__name {
  font-family: "Zen Kaku Gothic New", sans-serif;
  font-size: 26px; font-weight: 700; letter-spacing: 0.12em;
  color: var(--agree-blue); line-height: 1.2;
}
.brand__sub { font-size: 10px; letter-spacing: 0.34em; color: var(--ink-muted); }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; border-radius: 14px;
  color: var(--ink-secondary); text-decoration: none; font-weight: 500;
}
.nav a:hover { background: var(--surface-sunken); }
.nav a[aria-current="page"] { background: var(--light-blue); color: var(--ink); font-weight: 700; }
.nav__dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }

.nav__section {
  margin: 24px 0 8px; padding: 0 14px;
  font-size: 11px; letter-spacing: 0.1em; color: var(--ink-muted);
}

.sidebar__foot {
  margin-top: 28px; padding: 14px; border-radius: 16px;
  background: var(--surface-sunken); font-size: 11px; color: var(--ink-muted);
}

.main { flex: 1; min-width: 0; padding: 40px 32px 64px; background: #FBFCFE; }

.page-head {
  display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap;
  margin-bottom: 24px;
}
.page-head h1 { font-size: 20px; }
.page-head__meta { font-size: 12px; color: var(--ink-muted); }

/* ---------- フィルタ行（1本だけ・配下すべてに効く） ---------- */

.filterbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 14px 18px; margin-bottom: 24px;
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--r-control); box-shadow: var(--shadow);
}
.filterbar__label {
  font-size: 12px; font-weight: 700; color: var(--ink-secondary);
  letter-spacing: 0.04em; margin-right: 2px;
}
.segmented { display: flex; gap: 2px; background: var(--surface-sunken); padding: 3px; border-radius: var(--r-chip); }
.segmented button {
  border: 0; background: transparent; cursor: pointer;
  padding: 7px 16px; border-radius: var(--r-chip);
  font: inherit; font-size: 13px; color: var(--ink-secondary);
}
.segmented button:hover { color: var(--ink); }
.segmented button[aria-pressed="true"] {
  background: var(--white); color: var(--ink); font-weight: 700;
  box-shadow: 0 1px 3px rgba(46, 68, 99, 0.12);
}
.filterbar__spacer { flex: 1; }

.btn {
  border: 0; cursor: pointer; font: inherit; font-weight: 700;
  padding: 10px 22px; border-radius: var(--r-control);
}
.btn--main { background: var(--agree-blue); color: var(--white); }
.btn--main:hover { background: #5E82BC; }
.btn--cta { background: var(--logo-yellow); color: #4A3400; }
.btn--cta:hover { background: #E5A20C; }
.btn--ghost { background: transparent; color: var(--ink-secondary); border: 1px solid var(--border); }
.btn--ghost:hover { background: var(--surface-sunken); }

/* ---------- KPI タイル ---------- */

.kpi-row {
  display: grid; gap: 16px; margin-bottom: 24px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}
.kpi {
  background: var(--surface-card); border: 1px solid var(--border);
  border-radius: var(--r-card); padding: 20px 22px;
  box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.kpi::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 4px;
  background: var(--accent, var(--agree-blue));
}
.kpi__label { font-size: 12px; color: var(--ink-secondary); font-weight: 500; }
.kpi__value {
  font-size: 30px; font-weight: 700; line-height: 1.25; color: var(--ink);
  font-variant-numeric: proportional-nums; margin-top: 2px;
  white-space: nowrap;
}
/* 金額が長いときに桁が切れないよう段階的に落とす */
.kpi__value--md { font-size: 25px; }
.kpi__value--sm { font-size: 21px; letter-spacing: -0.01em; }
.kpi__value small { font-size: 15px; font-weight: 700; margin-left: 2px; }
.kpi__sub { font-size: 11px; color: var(--ink-muted); }

/* ---------- カード ---------- */

.grid { display: grid; gap: 16px; margin-bottom: 16px; }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }

.card {
  background: var(--surface-card); border: 1px solid var(--border);
  border-radius: var(--r-card); padding: 22px 24px 26px;
  box-shadow: var(--shadow);
}
.card__head {
  display: flex; align-items: baseline; gap: 10px;
  margin-bottom: 4px;
}
.card__head h2 { font-size: 15px; }
.card__note { font-size: 11px; color: var(--ink-muted); }
.card__desc { font-size: 12px; color: var(--ink-muted); margin: 0 0 18px; }
.card__actions { margin-left: auto; display: flex; gap: 6px; }

.linkbtn {
  border: 0; background: transparent; cursor: pointer; font: inherit;
  font-size: 11px; color: var(--ink-secondary); text-decoration: underline;
  text-underline-offset: 3px; padding: 2px 4px; border-radius: 6px;
}
.linkbtn:hover { color: var(--cat-1); }

/* ---------- グラフ ---------- */

.chart { width: 100%; display: block; overflow: visible; }
.chart text { font-family: inherit; fill: var(--ink-secondary); }
.chart .axis-label { font-size: 11px; fill: var(--ink-muted); }
.chart .value-label { font-size: 11.5px; font-weight: 700; fill: var(--ink); font-variant-numeric: tabular-nums; }
.chart .grid-line { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.chart .axis-line { stroke: var(--border); stroke-width: 1; shape-rendering: crispEdges; }
.chart .hit { fill: transparent; cursor: default; }

.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 14px; }
.legend__item { display: flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--ink-secondary); }
.legend__swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; }

/* テーブル表示（すべてのグラフの等価物） */
.tableview { display: none; margin-top: 16px; }
.tableview[data-open="true"] { display: block; }
.tableview table { width: 100%; border-collapse: collapse; font-size: 12px; }
.tableview th, .tableview td {
  text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--grid);
}
.tableview th { color: var(--ink-muted); font-weight: 500; }
.tableview td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ツールチップ */
.tip {
  position: fixed; z-index: 60; pointer-events: none; opacity: 0;
  transition: opacity .12s; background: var(--white);
  border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow-raised); padding: 9px 13px;
  font-size: 12px; color: var(--ink); max-width: 260px;
}
.tip[data-open="true"] { opacity: 1; }
.tip__title { font-weight: 700; margin-bottom: 2px; }
.tip__row { display: flex; justify-content: space-between; gap: 16px; color: var(--ink-secondary); }
.tip__row b { color: var(--ink); font-variant-numeric: tabular-nums; }

/* ---------- ランキング ----------
   3指標を横並びにして「量の1位」と「質の1位」の違いを見せる。
   Logo Yellow はガイド上アクセント専用なので、各列の1位だけに使う。 */

.rank-grid {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.rank {
  background: var(--surface-sunken); border-radius: 18px; padding: 16px 18px 14px;
}
.rank__title {
  display: flex; align-items: baseline; gap: 8px;
  font-family: "Zen Kaku Gothic New", sans-serif; font-weight: 700;
  font-size: 13px; color: var(--ink); margin-bottom: 10px;
}
.rank__note { font-family: inherit; font-weight: 400; font-size: 10.5px; color: var(--ink-muted); }
.rank__empty { font-size: 12px; color: var(--ink-muted); margin: 0; }

.rank__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.rank__row {
  display: grid; grid-template-columns: 22px 1fr auto; align-items: center; gap: 10px;
  padding: 7px 8px; border-radius: 12px;
}
.rank__row--top { background: var(--white); box-shadow: 0 1px 3px rgba(46, 68, 99, 0.07); }

.rank__pos {
  display: grid; place-items: center;
  width: 22px; height: 22px; border-radius: 50%;
  font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums;
  background: var(--white); color: var(--ink-muted); border: 1px solid var(--border);
}
.rank__row--top .rank__pos {
  background: var(--logo-yellow); color: #4A3400; border-color: transparent;
}

.rank__name {
  font-size: 12.5px; color: var(--ink-secondary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.rank__row--top .rank__name { color: var(--ink); font-weight: 700; }

.rank__val {
  text-align: right; font-size: 13px; font-weight: 700; color: var(--ink);
  font-variant-numeric: tabular-nums; line-height: 1.3;
}
.rank__val small {
  display: block; font-size: 10px; font-weight: 400; color: var(--ink-muted);
}

/* ---------- キャリアアンケート ---------- */

.survey-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.survey-panel {
  background: var(--surface-sunken);
  border-radius: 18px;
  padding: 16px 18px 14px;
  min-width: 0;
}

.survey-panel__chart { margin-top: 10px; }
.survey-panel__actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 4px;
}
.survey-panel__table .tableview { margin-top: 8px; }
.survey-panel__note {
  margin: 8px 0 0;
  font-size: 11px;
  color: var(--ink-muted);
}

/* ---------- メーター（入力率） ---------- */

.meter { display: grid; grid-template-columns: 1fr auto; gap: 4px 14px; align-items: center; }
.meter__row { display: contents; }
.meter__label { font-size: 12px; color: var(--ink-secondary); }
.meter__track {
  grid-column: 1; height: 8px; border-radius: 999px;
  background: var(--surface-sunken); overflow: hidden;
}
.meter__fill { height: 100%; border-radius: 999px; background: var(--cat-1); }
.meter__val { font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink); }

.meter-list { display: flex; flex-direction: column; gap: 12px; }
.meter-item { display: grid; grid-template-columns: 118px 1fr 44px; gap: 12px; align-items: center; }
.meter-item__name { font-size: 12px; color: var(--ink-secondary); }
/* span のままだと inline 扱いで高さも overflow も効かないので block にする */
.meter-item__track {
  display: block; height: 8px; border-radius: 999px;
  background: var(--surface-sunken); overflow: hidden;
}
.meter-item__fill { display: block; height: 100%; border-radius: 999px; }
.meter-item__val { font-size: 12px; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }

.callout {
  margin-top: 18px; padding: 14px 16px; border-radius: 16px;
  background: var(--surface-sunken); font-size: 12px; color: var(--ink-secondary);
  border-left: 3px solid var(--agree-blue);
}
.callout b { color: var(--ink); }

/* ---------- 求人検索 ---------- */

.search-shell { display: grid; grid-template-columns: 300px 1fr; gap: 20px; align-items: start; }

.facets {
  position: sticky; top: 24px;
  background: var(--surface-card); border: 1px solid var(--border);
  border-radius: var(--r-card); box-shadow: var(--shadow);
  padding: 20px; max-height: calc(100vh - 48px); overflow-y: auto;
}
.facet + .facet { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--grid); }
.facet__title {
  font-size: 12px; font-weight: 700; color: var(--ink);
  display: flex; align-items: center; gap: 7px; margin-bottom: 10px;
}
.facet__title .fill-badge {
  margin-left: auto; font-size: 10px; font-weight: 500; color: var(--ink-muted);
}
.facet__opts { display: flex; flex-direction: column; gap: 2px; }

.opt {
  display: flex; align-items: center; gap: 9px; cursor: pointer;
  padding: 6px 8px; border-radius: 10px; font-size: 12.5px; color: var(--ink-secondary);
}
.opt:hover { background: var(--surface-sunken); }
.opt input { accent-color: var(--agree-blue); width: 15px; height: 15px; margin: 0; flex: none; }
.opt__count { margin-left: auto; font-size: 11px; color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.opt--disabled { opacity: .4; }

.facet__more { margin: 4px 0 0 8px; }

/* ---------- 給与レンジスライダー ----------
   月給/時給を切り替える二つまみ式。入力率が低いので
   「給与未登録も含める」を既定 ON にして、動かした瞬間に
   候補が消える事故を防いでいる。 */

.segmented--sm { display: inline-flex; margin: 2px 0 14px; }
.segmented--sm button { padding: 5px 18px; font-size: 12px; }

.range { position: relative; height: 26px; margin: 0 6px; }

.range__track {
  position: absolute; top: 11px; left: 0; right: 0; height: 4px;
  background: var(--surface-sunken); border-radius: 999px;
}
.range__fill {
  position: absolute; height: 100%; border-radius: 999px;
  background: var(--agree-blue);
}

/* 2本の input を重ねる。つまみだけ触れるようにして、
   下のトラックはクリックを拾わせない。 */
.range input[type="range"] {
  position: absolute; top: 0; left: 0; width: 100%; height: 26px;
  margin: 0; background: none; appearance: none; -webkit-appearance: none;
  pointer-events: none;
}
.range input[type="range"]:focus-visible { outline: none; }

.range input[type="range"]::-webkit-slider-thumb {
  appearance: none; -webkit-appearance: none; pointer-events: auto;
  width: 18px; height: 18px; border-radius: 50%; cursor: grab;
  background: var(--white); border: 2px solid var(--agree-blue);
  box-shadow: 0 1px 4px rgba(46, 68, 99, 0.22);
}
.range input[type="range"]::-webkit-slider-thumb:active { cursor: grabbing; }
.range input[type="range"]::-moz-range-thumb {
  pointer-events: auto;
  width: 18px; height: 18px; border-radius: 50%; cursor: grab;
  background: var(--white); border: 2px solid var(--agree-blue);
  box-shadow: 0 1px 4px rgba(46, 68, 99, 0.22);
}
.range input[type="range"]:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 3px rgba(112, 147, 203, 0.4);
}

.range__vals {
  display: flex; align-items: center; gap: 8px; margin-top: 8px;
}
.range__val {
  flex: 1; display: flex; flex-direction: column;
  padding: 7px 10px; border: 1px solid var(--border); border-radius: 12px;
  font-size: 10.5px; color: var(--ink-muted); background: var(--white);
}
.range__val b {
  font-size: 13px; color: var(--ink); font-variant-numeric: tabular-nums;
}
.range__dash { width: 10px; height: 1px; background: var(--border); flex: none; }

.range__note {
  margin: 8px 0 0; font-size: 11px; line-height: 1.6; color: var(--ink-muted);
}
.range__note b { color: var(--warn); }

details.facet-more > summary {
  cursor: pointer; font-size: 12px; font-weight: 700; color: var(--ink-secondary);
  list-style: none; padding: 8px 0;
}
details.facet-more > summary::-webkit-details-marker { display: none; }
details.facet-more > summary::before { content: "＋ "; color: var(--agree-blue); }
details.facet-more[open] > summary::before { content: "− "; }

.results__head {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 14px 20px; margin-bottom: 14px;
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--r-control); box-shadow: var(--shadow);
  position: sticky; top: 24px; z-index: 20;
}
.results__count { font-size: 14px; color: var(--ink-secondary); }
.results__count b { font-size: 24px; font-weight: 700; color: var(--ink); margin-right: 2px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 8px 5px 12px; border-radius: var(--r-chip);
  background: var(--light-blue); color: var(--ink); font-size: 11.5px; font-weight: 500;
}
.chip button {
  border: 0; background: rgba(46, 68, 99, .12); color: var(--ink);
  width: 16px; height: 16px; border-radius: 50%; cursor: pointer;
  font-size: 11px; line-height: 1; display: grid; place-items: center; padding: 0;
}
.chip button:hover { background: rgba(46, 68, 99, .26); }

.cards {
  display: grid; gap: 12px; align-items: start;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
}
.job {
  background: var(--surface-card); border: 1px solid var(--border);
  border-radius: 20px; padding: 18px 20px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 10px;
}
.job:hover { box-shadow: var(--shadow-raised); }
.job__top { display: flex; align-items: flex-start; gap: 10px; }
.job__name { font-size: 14px; font-weight: 700; line-height: 1.5; }
.job__kind {
  flex: none; font-size: 10.5px; padding: 3px 9px; border-radius: var(--r-chip);
  background: var(--light-blue); color: var(--dark-navy); font-weight: 700;
}
.job__meta { display: flex; flex-wrap: wrap; gap: 6px; }
.job__tag {
  font-size: 11px; padding: 3px 9px; border-radius: var(--r-chip);
  background: var(--surface-sunken); color: var(--ink-secondary);
}
.job__tag--pay { background: #FDF3DE; color: #7A5300; font-weight: 700; }
.job__tag--none { background: transparent; color: var(--ink-muted); font-style: italic; }
.job__body {
  font-size: 12px; color: var(--ink-secondary); margin: 0;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.job__foot { display: flex; align-items: center; gap: 12px; margin-top: auto; padding-top: 6px; }
.job__id { font-size: 11px; color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.job__links { margin-left: auto; display: flex; gap: 10px; font-size: 11.5px; }

.empty {
  padding: 56px 24px; text-align: center; color: var(--ink-muted);
  background: var(--surface-card); border: 1px dashed var(--border); border-radius: var(--r-card);
}

@media (max-width: 1080px) {
  .search-shell { grid-template-columns: 1fr; }
  .facets { position: static; max-height: none; }
  .results__head { position: static; }
}
@media (max-width: 860px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex: none; padding: 20px; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .main { padding: 24px 18px 48px; }
}
