/* ===== 応募トラッカー ダッシュボード / ダークテーマ ===== */

:root {
  --bg: #12141a;
  --panel: #1a1d26;
  --panel-2: #21252f;
  --line: #2c313d;
  --text: #e6e9f0;
  --muted: #8b93a7;
  --accent: #5b8cff;
  --accent-dim: #2f4a8f;
  --green: #3ecf8e;
  --amber: #f0b34a;
  --red: #ff5f5f;
  --purple: #b48ce8;
  --radius: 10px;
  --font: "Segoe UI", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", Meiryo, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }

/* ===== ログイン画面 ===== */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 36px 32px; width: 100%; max-width: 360px; text-align: center;
}
.login-card h1 { font-size: 18px; margin: 0 0 6px; }
.login-card p.sub { color: var(--muted); font-size: 13px; margin: 0 0 22px; }
.login-card input {
  width: 100%; padding: 11px 13px; background: var(--bg); border: 1px solid var(--line);
  border-radius: 8px; color: var(--text); font-size: 15px; text-align: center; letter-spacing: 2px;
}
.login-card input:focus { outline: none; border-color: var(--accent); }
.login-card button { width: 100%; margin-top: 14px; }
.login-err { color: var(--red); font-size: 13px; min-height: 20px; margin-top: 10px; }

/* ===== レイアウト ===== */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 210px; flex-shrink: 0; background: var(--panel); border-right: 1px solid var(--line);
  padding: 20px 12px; display: flex; flex-direction: column;
}
.brand { font-size: 15px; font-weight: 600; padding: 0 10px 18px; letter-spacing: .02em; }
.brand span { color: var(--accent); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav button {
  background: none; border: none; color: var(--muted); text-align: left;
  padding: 10px 12px; border-radius: 8px; font-size: 14px; font-family: inherit; cursor: pointer;
  display: flex; justify-content: space-between; align-items: center;
}
.nav button:hover { background: var(--panel-2); color: var(--text); }
.nav button.active { background: var(--accent-dim); color: #fff; }
.nav .badge {
  background: var(--red); color: #fff; font-size: 11px; border-radius: 99px;
  padding: 0 7px; line-height: 18px; min-width: 18px; text-align: center;
}
.nav .badge:empty { display: none; }
.sidebar-foot { margin-top: auto; padding: 12px 10px 0; }
.sidebar-foot button {
  background: none; border: none; color: var(--muted); font-size: 12px; cursor: pointer; font-family: inherit; padding: 0;
}
.sidebar-foot button:hover { color: var(--text); }

.main { flex: 1; padding: 24px 28px 60px; min-width: 0; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; gap: 12px; flex-wrap: wrap; }
.page-head h2 { font-size: 19px; margin: 0; font-weight: 600; }
.view { display: none; }
.view.active { display: block; }

/* ===== 部品 ===== */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.card h3 { font-size: 14px; margin: 0 0 12px; color: var(--muted); font-weight: 600; }
.card + .card { margin-top: 16px; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 20px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.kpi .label { color: var(--muted); font-size: 12px; }
.kpi .value { font-size: 26px; font-weight: 600; margin-top: 4px; letter-spacing: -.01em; }
.kpi .note { color: var(--muted); font-size: 11px; margin-top: 2px; }
.kpi.green .value { color: var(--green); }
.kpi.amber .value { color: var(--amber); }
.kpi.red .value { color: var(--red); }
.kpi.accent .value { color: var(--accent); }

button, .btn {
  background: var(--accent); color: #fff; border: none; border-radius: 8px;
  padding: 9px 16px; font-size: 13px; font-family: inherit; cursor: pointer;
}
button:hover, .btn:hover { filter: brightness(1.12); }
button.ghost { background: transparent; border: 1px solid var(--line); color: var(--text); }
button.ghost:hover { background: var(--panel-2); filter: none; }
button:disabled { opacity: .45; cursor: default; filter: none; }
button.danger { color: var(--red); border-color: rgba(255,95,95,.4); }
button.danger:hover { background: rgba(255,95,95,.12); }
button.mini {
  padding: 3px 9px; font-size: 12px; border-radius: 6px; background: transparent;
  border: 1px solid var(--line); color: var(--muted); line-height: 1.5;
}
button.mini:hover { background: var(--panel-2); color: var(--text); filter: none; }
button.mini.ok:hover { color: var(--green); border-color: var(--green); }
button.mini.ng:hover { color: var(--red); border-color: var(--red); }
.actions-inline { display: flex; gap: 5px; flex-wrap: nowrap; }

input, select, textarea {
  background: var(--bg); border: 1px solid var(--line); border-radius: 7px;
  color: var(--text); padding: 8px 10px; font-size: 13px; font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
label.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; color: var(--muted); font-weight: 600; font-size: 12px;
  padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:hover { background: var(--panel-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tfoot td { font-weight: 600; border-top: 2px solid var(--line); border-bottom: none; }
.table-wrap { overflow-x: auto; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--text); }

/* 結果の色（シートの条件付き書式と揃える） */
.pill { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 11px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.pill.r-採用 { color: var(--green); border-color: rgba(62,207,142,.4); }
.pill.r-不採用 { color: #9aa4bd; }
.pill.r-選考中 { color: var(--amber); border-color: rgba(240,179,74,.4); }
.pill.r-返信なし { color: var(--red); border-color: rgba(255,95,95,.4); }
.pill.r-辞退 { color: var(--purple); border-color: rgba(180,140,232,.4); }

/* 経過日数 */
.days { font-variant-numeric: tabular-nums; font-weight: 600; }
.days.warn { color: var(--amber); }
.days.late { color: var(--red); }

.muted { color: var(--muted); }
.empty { color: var(--muted); padding: 28px 10px; text-align: center; font-size: 13px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar input[type="search"] { min-width: 220px; }

.grid-2 { display: grid; grid-template-columns: 1.5fr 1fr; gap: 16px; }
.grid-2 .card + .card { margin-top: 0; }
@media (max-width: 900px) {
  .grid-2 { grid-template-columns: 1fr; }
  .app { flex-direction: column; }
  .sidebar { width: 100%; flex-direction: row; align-items: center; overflow-x: auto; padding: 10px; }
  .nav { flex-direction: row; }
  .nav button { white-space: nowrap; }
  .sidebar-foot { margin: 0 0 0 auto; padding: 0 8px; white-space: nowrap; }
  .main { padding: 16px; }
}

/* 新規追加フォーム */
.addform { display: none; margin-bottom: 16px; }
.addform.open { display: block; }
.addform .rows { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.addform .actions { margin-top: 14px; display: flex; gap: 10px; }

/* 編集パネル */
.modal {
  display: none; position: fixed; inset: 0; z-index: 40; background: rgba(8, 9, 13, .72);
  align-items: center; justify-content: center; padding: 24px;
}
.modal.open { display: flex; }
.modal-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  width: 100%; max-width: 720px; max-height: 88vh; display: flex; flex-direction: column;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 15px; font-weight: 600; }
.modal-head .x { background: none; border: none; color: var(--muted); font-size: 22px; line-height: 1; padding: 0 4px; cursor: pointer; }
.modal-head .x:hover { color: var(--text); filter: none; }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-body .rows { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 13px; }
.modal-body .rows .wide { grid-column: 1 / -1; }
.modal-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-top: 1px solid var(--line); }
.modal-actions { display: flex; gap: 10px; margin-left: auto; }

/* トースト */
#toast {
  position: fixed; right: 20px; bottom: 20px; z-index: 50;
  background: var(--panel-2); border: 1px solid var(--line); border-left: 3px solid var(--accent);
  padding: 11px 16px; border-radius: 8px; font-size: 13px;
  opacity: 0; transform: translateY(8px); transition: .2s; pointer-events: none;
}
#toast.show { opacity: 1; transform: none; }
#toast.err { border-left-color: var(--red); }

.chartbox { position: relative; height: 260px; }
.chartbox.tall { height: 320px; }

/* 媒体別の横バー（表の中） */
.bar { display: flex; align-items: center; gap: 8px; min-width: 120px; }
.bar i { display: block; height: 8px; border-radius: 4px; background: var(--accent); }
.bar i.g { background: var(--green); }
.bar span { font-size: 12px; font-variant-numeric: tabular-nums; }
