/* ===== KOUKI Insight - 求人データ収集・分析基盤 デモ ===== */
:root {
  --surface-1:      #fcfcfb;
  --page-plane:     #f4f5f7;
  --text-primary:   #0b0b0b;
  --text-secondary: #52514e;
  --text-muted:     #898781;
  --gridline:       #e1e0d9;
  --border:         rgba(11,11,11,0.10);
  --success:        #006300;

  --series-1: #2a78d6; /* blue */
  --series-2: #eb6834; /* orange */
  --series-3: #1baf7a; /* aqua */
  --series-4: #eda100; /* yellow */
  --series-5: #e87ba4; /* magenta */
  --series-6: #008300; /* green */
  --series-7: #4a3aa7; /* violet */
  --series-8: #e34948; /* red */

  --seq-100: #cde2fb;
  --seq-250: #86b6ef;
  --seq-400: #3987e5;
  --seq-450: #2a78d6;
  --seq-550: #1c5cab;

  --status-good: #0ca30c;
  --status-warning: #fab219;
  --status-serious: #ec835a;
  --status-critical: #d03b3b;

  --sidebar-w: 232px;
  --topbar-h: 64px;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(11,11,11,.06), 0 4px 16px rgba(11,11,11,.05);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--page-plane);
  color: var(--text-primary);
  font-family: system-ui, -apple-system, "Segoe UI", "Hiragino Sans", "Yu Gothic", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
ul { list-style: none; margin: 0; padding: 0; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }

/* ---------- Layout shell ---------- */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: #12151c;
  color: #f2f2f0;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 40;
  transition: transform .25s ease;
}

.sidebar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.sidebar .brand-mark {
  width: 34px; height: 34px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--series-1), var(--series-3));
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.sidebar .brand-text { line-height: 1.25; }
.sidebar .brand-text strong { display: block; font-size: 14.5px; letter-spacing: .02em; }
.sidebar .brand-text span { display: block; font-size: 11px; color: #9a9a95; }

.sidebar nav { padding: 14px 10px; flex: 1; }
.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13.5px;
  color: #c7c7c2;
  margin-bottom: 2px;
}
.sidebar nav a svg { width: 17px; height: 17px; flex-shrink: 0; opacity: .85; }
.sidebar nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar nav a.active { background: rgba(42,120,214,.22); color: #fff; }
.sidebar nav a.active svg { opacity: 1; color: var(--seq-250); }

.sidebar .sidebar-foot {
  padding: 14px 18px 18px;
  border-top: 1px solid rgba(255,255,255,.08);
  font-size: 11px;
  color: #83837e;
}

.main-col {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: var(--topbar-h);
  background: var(--surface-1);
  border-bottom: 1px solid var(--gridline);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 30;
}

.topbar .page-title { font-size: 16px; font-weight: 600; }
.topbar .page-title .muted { color: var(--text-muted); font-weight: 400; font-size: 12.5px; margin-left: 8px;}

.topbar .user-chip {
  display: flex; align-items: center; gap: 9px;
  padding: 6px 12px 6px 6px;
  border: 1px solid var(--gridline);
  border-radius: 999px;
  font-size: 12.5px;
}
.user-chip .avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: #e5e8ee; display: flex; align-items: center; justify-content: center;
  font-size: 13px;
}
.user-chip strong { font-weight: 600; }
.user-chip span { color: var(--text-muted); }

.menu-toggle {
  display: none;
  background: none; border: none; padding: 8px;
  color: var(--text-primary);
}

.content {
  padding: 26px 28px 60px;
  max-width: 1280px;
  width: 100%;
}

/* ---------- Cards / grid ---------- */
.grid { display: grid; gap: 18px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: 1.3fr 1fr; }

.card {
  background: var(--surface-1);
  border: 1px solid var(--gridline);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.card-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 14px;
  gap: 10px; flex-wrap: wrap;
}
.card-head h3 { margin: 0; font-size: 14.5px; font-weight: 600; }
.card-head .sub { font-size: 12px; color: var(--text-muted); }

.kpi-card .kpi-label { font-size: 12.5px; color: var(--text-secondary); display:flex; align-items:center; gap:6px;}
.kpi-card .kpi-value { font-size: 30px; font-weight: 700; margin: 6px 0 4px; letter-spacing: -0.01em; }
.kpi-card .kpi-delta { font-size: 12px; }
.kpi-card .kpi-delta.up { color: var(--success); }
.kpi-card .kpi-delta.flat { color: var(--text-muted); }
.kpi-icon {
  width: 34px; height: 34px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 10px;
}

/* status dot */
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink:0; }
.status-dot.good { background: var(--status-good); }
.status-dot.warn { background: var(--status-warning); }
.status-dot.crit { background: var(--status-critical); }
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; padding: 3px 9px; border-radius: 999px;
  border: 1px solid var(--gridline); color: var(--text-secondary); background:#fff;
}
.badge.success { color: var(--success); border-color: rgba(12,163,12,.25); background: rgba(12,163,12,.07); }
.badge.warning { color: #8a5a00; border-color: rgba(250,178,25,.35); background: rgba(250,178,25,.13); }
.badge.critical { color: var(--status-critical); border-color: rgba(208,59,59,.3); background: rgba(208,59,59,.08); }
.badge.info { color: var(--series-1); border-color: rgba(42,120,214,.3); background: rgba(42,120,214,.08); }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--gridline); border-radius: var(--radius); background: var(--surface-1); }
table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 760px; }
thead th {
  text-align: left; padding: 11px 14px; font-size: 11.5px; text-transform: uppercase;
  letter-spacing: .04em; color: var(--text-muted); border-bottom: 1px solid var(--gridline);
  background: #fafaf9; white-space: nowrap;
}
tbody td { padding: 11px 14px; border-bottom: 1px solid var(--gridline); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #f7f9fc; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Forms ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 6px; color: var(--text-secondary); }
.field select, .field input[type=text], .field input[type=search] {
  width: 100%; padding: 9px 11px; border: 1px solid var(--gridline); border-radius: 8px;
  font-size: 13px; background: #fff; color: var(--text-primary);
}
.checkbox-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.checkbox-grid label { display:flex; align-items:center; gap:8px; font-size:13px; font-weight:400; color: var(--text-primary); }
.checkbox-grid input { accent-color: var(--series-1); }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: 8px; border: 1px solid transparent;
  font-size: 13.5px; font-weight: 600;
}
.btn-primary { background: var(--series-1); color: #fff; }
.btn-primary:hover { background: var(--seq-550); }
.btn-primary:disabled { background: #9fb9db; cursor: not-allowed; }
.btn-outline { background: #fff; border-color: var(--gridline); color: var(--text-primary); }
.btn-outline:hover { border-color: var(--series-1); color: var(--series-1); }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }

.filter-row {
  display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; align-items: flex-end;
}
.filter-row .field { margin-bottom: 0; min-width: 150px; }

/* ---------- Progress / log console ---------- */
.progress-track { height: 8px; border-radius: 999px; background: var(--gridline); overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--series-1), var(--series-3)); width: 0%; transition: width .3s ease; }
.console {
  background: #12151c; color: #d7ffd9; font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px; padding: 14px 16px; border-radius: 8px; height: 190px; overflow-y: auto;
}
.console .line { margin-bottom: 3px; white-space: pre-wrap; word-break: break-all; }
.console .line.info { color: #9fd9ff; }
.console .line.ok { color: #8ef2a3; }
.console .line.warn { color: #ffd479; }

/* ---------- Steps / timeline ---------- */
.timeline { display: flex; flex-direction: column; gap: 0; }
.timeline .step { display: flex; gap: 16px; position: relative; padding-bottom: 26px; }
.timeline .step:last-child { padding-bottom: 0; }
.timeline .step::before {
  content: ""; position: absolute; left: 15px; top: 32px; bottom: 0; width: 2px; background: var(--gridline);
}
.timeline .step:last-child::before { display: none; }
.timeline .num {
  width: 32px; height: 32px; border-radius: 50%; background: var(--series-1); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 700; flex-shrink: 0; font-size: 13px;
  z-index: 1;
}
.timeline .step-body h4 { margin: 4px 0 4px; font-size: 14px; }
.timeline .step-body p { margin: 0; color: var(--text-secondary); font-size: 13px; }

/* ---------- Checklist ---------- */
.check-list { display: grid; gap: 10px; }
.check-list li { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; }
.check-list .tick {
  width: 20px; height: 20px; border-radius: 50%; background: rgba(12,163,12,.12); color: var(--status-good);
  display:flex; align-items:center; justify-content:center; flex-shrink:0; margin-top: 1px;
}

/* ---------- Pipeline diagram ---------- */
.pipeline { display: flex; align-items: stretch; gap: 6px; overflow-x: auto; padding: 6px 2px 14px; }
.pipeline .pnode {
  flex: 1; min-width: 168px; background: #fff; border: 1px solid var(--gridline); border-radius: var(--radius);
  padding: 16px; text-align: center; box-shadow: var(--shadow);
}
.pipeline .pnode .picon {
  width: 44px; height: 44px; border-radius: 10px; margin: 0 auto 10px; display: flex; align-items: center; justify-content: center;
}
.pipeline .pnode h5 { margin: 0 0 6px; font-size: 13px; }
.pipeline .pnode p { margin: 0; font-size: 11.5px; color: var(--text-secondary); }
.pipeline .arrow { align-self: center; color: var(--text-muted); flex-shrink: 0; width: 20px; }

/* ---------- Legend ---------- */
.legend { display: flex; flex-wrap: wrap; gap: 12px 18px; font-size: 12px; color: var(--text-secondary); margin-top: 10px; }
.legend .item { display: flex; align-items: center; gap: 6px; }
.legend .swatch { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }

/* ---------- Chart tooltip ---------- */
.chart-tooltip {
  position: fixed; pointer-events: none; z-index: 100;
  background: #12151c; color: #fff; font-size: 12px; padding: 7px 10px; border-radius: 6px;
  box-shadow: 0 6px 20px rgba(0,0,0,.25); opacity: 0; transform: translateY(4px); transition: opacity .12s ease;
  max-width: 220px;
}
.chart-tooltip.show { opacity: 1; }
.chart-tooltip .tt-title { font-weight: 600; margin-bottom: 2px; }
.chart-tooltip .tt-sub { color: #b9b9b4; }

.viz-root text { fill: var(--text-secondary); font-family: inherit; }
.viz-root .axis-label { fill: var(--text-muted); font-size: 10.5px; }
.viz-root .gridline { stroke: var(--gridline); stroke-width: 1; }
.viz-root .bar { cursor: pointer; }
.viz-root .bar:hover { filter: brightness(0.92); }
.viz-root .dot-hit { cursor: pointer; }

/* ---------- Misc ---------- */
.hero-banner {
  background: linear-gradient(120deg, #0f1b33, #16223f 55%, #123024);
  color: #fff; border-radius: 14px; padding: 26px 28px; margin-bottom: 22px;
  display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap;
}
.hero-banner h2 { margin: 0 0 6px; font-size: 19px; }
.hero-banner p { margin: 0; color: #cdd6e6; font-size: 13px; max-width: 560px; }
.hero-banner .hero-cta { display: flex; gap: 10px; flex-wrap: wrap; }

.note {
  font-size: 12px; color: var(--text-muted); background: #fafaf9; border: 1px dashed var(--gridline);
  border-radius: 8px; padding: 10px 12px; margin-top: 14px;
}

.section-lead { color: var(--text-secondary); font-size: 13.5px; max-width: 720px; margin: 4px 0 20px; }

.pagination { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; font-size: 12.5px; color: var(--text-secondary); }
.pagination .pager-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.pagination button { border: 1px solid var(--gridline); background: #fff; border-radius: 6px; padding: 5px 11px; font-size: 12.5px; }
.pagination button:disabled { opacity: .4; cursor: not-allowed; }
.pagination button.active { background: var(--series-1); color: #fff; border-color: var(--series-1); }

/* ---------- Overlay for mobile sidebar ---------- */
.overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 35; }
.overlay.show { display: block; }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-col { margin-left: 0; }
  .menu-toggle { display: inline-flex; }
  .content { padding: 18px 14px 50px; }
  .grid-4, .grid-3 { grid-template-columns: 1fr 1fr; }
  .topbar { padding: 0 14px; }
  .topbar .user-chip span { display: none; }
  .hero-banner { padding: 20px; }
  .checkbox-grid { grid-template-columns: 1fr; }
  .pagination { justify-content: center; text-align: center; }
  .pagination .pager-btns { width: 100%; justify-content: center; }
}

@media (max-width: 480px) {
  .grid-4, .grid-3 { grid-template-columns: 1fr; }
}
