:root {
  --fg:     #1f2937;
  --muted:  #6b7280;
  --line:   #e5e7eb;
  --bg:     #f9fafb;
  --accent: #2563eb;
  --card:   #fff;
}

* { box-sizing: border-box; }
body {
  font-family: -apple-system, "Hiragino Sans", "Noto Sans JP", sans-serif;
  color: var(--fg); background: var(--bg); margin: 0; line-height: 1.7;
}

/* ---- レイアウト ---- */
body.app { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
body.app header.site { flex-shrink: 0; }
.app-layout { flex: 1; display: grid; grid-template-columns: 260px 1fr; overflow: hidden; }

/* ---- ヘッダー ---- */
header.site { background: var(--card); border-bottom: 1px solid var(--line); }
header.site .inner {
  max-width: 1480px; margin: 0 auto; padding: 12px 16px;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.brand { font-weight: 700; font-size: 17px; color: var(--fg); margin-right: auto; display: flex; align-items: center; gap: 8px; text-decoration: none; }
.brand img { height: 28px; width: auto; }
header.site nav { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---- ナビドロップダウン ---- */
.nav-dropdown { position: relative; }
.nav-dropdown-trigger { cursor: pointer; }
.nav-dropdown-menu {
  display: none; position: absolute; top: calc(100% + 4px); right: 0;
  background: var(--card); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,.1); min-width: 160px; z-index: 50;
  padding: 4px 0; white-space: nowrap;
}
.nav-dropdown.open .nav-dropdown-menu { display: block; }
.nav-dropdown-item {
  display: block; width: 100%; padding: 8px 16px; border: none; background: none;
  text-align: left; font-size: 13px; font-family: inherit; color: var(--fg);
  cursor: pointer; text-decoration: none;
}
.nav-dropdown-item:hover { background: #f0f5ff; color: var(--accent); }

/* ---- ボタン ---- */
.btn {
  display: inline-block; padding: 8px 14px; border-radius: 6px;
  border: 1px solid var(--accent); background: var(--accent);
  color: #fff; text-decoration: none; font-size: 14px; cursor: pointer;
  font-family: inherit; transition: opacity .15s;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.secondary { background: #fff; color: var(--accent); }
.btn.small { padding: 5px 11px; font-size: 13px; }
.btn.btn-danger { background: #fff; color: #dc2626; border-color: #dc2626; }
.btn.btn-danger:hover { background: #fef2f2; }

/* ---- サイドバー ---- */
.sidebar { overflow-y: auto; background: var(--card); border-right: 1px solid var(--line); }
.sidebar-head {
  padding: 12px 16px 6px; font-size: 11px; font-weight: 700;
  color: var(--muted); text-transform: uppercase; letter-spacing: .06em;
}
.sidebar-empty { padding: 20px 16px; font-size: 13px; color: var(--muted); line-height: 1.7; }
button.nav-item {
  display: block; width: 100%; text-align: left; padding: 9px 16px;
  border: none; background: none; cursor: pointer; font-size: 13px;
  color: var(--fg); line-height: 1.4; border-left: 3px solid transparent;
  font-family: inherit;
}
button.nav-item:hover { background: #f0f5ff; color: var(--accent); }
button.nav-item.active {
  background: #eff6ff; color: var(--accent);
  border-left-color: var(--accent); font-weight: 600;
}

/* ---- エディタパネル ---- */
.editor-panel { overflow-y: auto; padding: 28px 36px; background: var(--bg); }
.editor-empty {
  display: flex; align-items: center; justify-content: center;
  height: 100%; color: var(--muted); font-size: 14px;
}

/* ---- タブ ---- */
.editor-tabs {
  display: flex; border-bottom: 2px solid var(--line); margin-bottom: 20px;
}
.tab-btn {
  padding: 8px 20px; border: none; background: none; cursor: pointer; font-size: 14px;
  color: var(--muted); font-family: inherit; border-bottom: 2px solid transparent;
  margin-bottom: -2px; transition: color .15s;
}
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

/* ---- フォーム ---- */
h1.page { font-size: 22px; margin: 18px 0 6px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 20px;
}
.row { margin-bottom: 16px; }
.row:last-child { margin-bottom: 0; }
.row-checkbox { margin-top: -8px; }
.row-checkbox label {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--fg); cursor: pointer;
}
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
input[type=text], input[type=url], input[type=month], textarea, input[type=password] {
  width: 100%; padding: 8px 10px; font-size: 14px;
  border: 1px solid #cbd5e1; border-radius: 6px; font-family: inherit;
  transition: border-color .15s;
}
input[type=text]:focus, input[type=url]:focus, input[type=month]:focus,
textarea:focus, input[type=password]:focus {
  outline: none; border-color: var(--accent);
}
input[type=month] { max-width: 220px; }
input[type=month]:disabled {
  background: #f3f4f6; color: var(--muted); cursor: not-allowed;
}
textarea { min-height: 90px; resize: vertical; line-height: 1.6; }
select {
  width: 100%; padding: 8px 10px; font-size: 14px;
  border: 1px solid #cbd5e1; border-radius: 6px; font-family: inherit;
  background: #fff; cursor: pointer;
}
.actions { margin: 18px 0; display: flex; gap: 10px; align-items: center; }

/* ---- フォームセクション ---- */
.form-section { margin-bottom: 24px; }
.section-title {
  font-size: 15px; font-weight: 700; color: var(--fg);
  margin: 0 0 10px; padding: 0;
}
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.section-header .section-title { margin-bottom: 0; }
.section-toggle {
  cursor: pointer; color: var(--muted); font-size: 14px;
  list-style: none; padding: 8px 0;
}
.section-toggle::before { content: '▶ '; font-size: 11px; }
details[open] > .section-toggle::before { content: '▼ '; }
.section-toggle::-webkit-details-marker { display: none; }

/* ---- エディタヘッダー ---- */
.editor-header {
  display: flex; align-items: baseline; gap: 12px; margin-bottom: 8px;
}
.completion-badge {
  font-size: 12px; color: var(--muted); white-space: nowrap;
}

/* ---- 元データ ---- */
details { margin-top: 16px; }
details summary { cursor: pointer; color: var(--muted); font-size: 13px; }
details pre {
  white-space: pre-wrap; background: #f3f4f6; padding: 12px;
  border-radius: 6px; font-size: 13px; line-height: 1.6;
}

/* ---- work_items カード ---- */
.work-item-card { margin-bottom: 12px; }
.work-item-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--line);
}
.work-item-title { font-size: 14px; font-weight: 600; color: var(--fg); }
.work-item-controls { display: flex; gap: 4px; }
.btn-icon {
  width: 28px; height: 28px; border: 1px solid var(--line); border-radius: 4px;
  background: #fff; cursor: pointer; font-size: 14px; color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  font-family: inherit; transition: background .15s, color .15s;
}
.btn-icon:hover { background: #f0f5ff; color: var(--accent); }
.btn-icon-danger:hover { background: #fef2f2; color: #dc2626; }
.work-items-actions { margin-top: 8px; }

/* ---- ローカル保存バッジ ---- */
.local-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: 16px; font-size: 12px; font-weight: 600;
  background: #ecfdf5; color: #059669; border: 1px solid #a7f3d0;
  cursor: pointer; font-family: inherit; transition: background .15s;
}
.local-badge:hover { background: #d1fae5; }
.local-badge-icon { font-size: 13px; }

.local-info-popup {
  position: fixed; top: 56px; right: 16px; z-index: 200;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0,0,0,.12); padding: 16px 20px;
  max-width: 340px; font-size: 13px; line-height: 1.7;
}
.local-info-title { font-weight: 700; margin-bottom: 8px; color: var(--fg); }
.local-info-popup ul { margin: 0; padding-left: 1.2em; color: var(--muted); }
.local-info-popup li { margin-bottom: 2px; }

/* ---- 新規登録方法選択 ---- */
.new-career-options { display: flex; flex-direction: column; gap: 10px; }
.new-career-option {
  display: flex; flex-direction: column; gap: 4px;
  padding: 16px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--card); cursor: pointer; text-align: left;
  font-family: inherit; transition: border-color .15s, background .15s;
}
.new-career-option:hover { border-color: var(--accent); background: #f0f5ff; }
.new-career-option-title { font-size: 15px; font-weight: 600; color: var(--fg); }
.new-career-option-desc { font-size: 12px; color: var(--muted); }

/* ---- ウィザード ---- */
.wizard-progress {
  font-size: 12px; color: var(--muted); margin-bottom: 16px; text-align: right;
}
.wizard-content { min-height: 200px; }
.wizard-question { font-size: 16px; font-weight: 600; color: var(--fg); margin: 0 0 16px; }
.wizard-period { display: flex; flex-direction: column; gap: 8px; }
.wizard-period label { font-size: 13px; color: var(--muted); margin-bottom: 0; }
.wizard-checkbox { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.wizard-content textarea { min-height: 120px; }
.wizard-content input[type=text] { font-size: 15px; padding: 10px 12px; }

/* ---- 品質チェック ---- */
.quality-check {
  background: var(--card); border: 1px solid var(--line); border-radius: 8px;
  padding: 16px 20px; margin-bottom: 20px;
}
.quality-check-title {
  font-size: 14px; font-weight: 700; color: var(--fg); margin: 0 0 10px;
  display: flex; align-items: center; gap: 8px;
}
.quality-check-score { font-size: 13px; color: var(--accent); font-weight: 600; }
.quality-check-filled { color: #059669; font-size: 13px; }
.quality-check-missing { color: #d97706; font-size: 13px; }
.quality-check-list { list-style: none; padding: 0; margin: 0; }
.quality-check-list li {
  padding: 3px 0; font-size: 13px; display: flex; align-items: center; gap: 6px;
}
.quality-check-list li.filled { color: #059669; }
.quality-check-list li.missing { color: #d97706; }
.quality-warnings { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.quality-warnings h4 { font-size: 13px; color: #b45309; margin: 0 0 6px; }
.quality-warnings ul { margin: 0; padding-left: 1.2em; }
.quality-warnings li { font-size: 12px; color: #92400e; margin-bottom: 2px; }

/* ---- 成果深掘り ---- */
.outcome-section { margin-bottom: 16px; }
.outcome-section label {
  display: flex; align-items: flex-start; gap: 8px; cursor: pointer;
  font-size: 14px; color: var(--fg); margin-bottom: 6px;
}
.outcome-section input[type=checkbox] { margin-top: 3px; }
.outcome-followup {
  margin-left: 24px; margin-top: 6px; margin-bottom: 12px;
}
.outcome-followup label { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.outcome-followup input[type=text] { font-size: 13px; padding: 6px 8px; }

/* ---- 二段階削除確認 ---- */
.delete-buttons { margin-bottom: 16px; }
.delete-confirm-input {
  width: 100%; padding: 8px 10px; font-size: 14px;
  border: 1px solid #fca5a5; border-radius: 6px; font-family: inherit;
  margin-bottom: 12px;
}

/* ---- モーダル ---- */
.hidden { display: none !important; }
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 100;
}
.modal {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: #fff; border-radius: 12px; padding: 28px; z-index: 101;
  width: min(500px, 92vw); max-height: 90vh; overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,.2);
}
.modal-wide { width: min(680px, 92vw); }
.modal-title { font-size: 18px; margin: 0 0 20px; }
.modal-desc { font-size: 13px; color: var(--muted); margin: 0 0 16px; line-height: 1.6; }
.settings-notice { background: #fef2f2; border: 1px solid #fecaca; border-radius: 8px; padding: 12px 16px; margin-bottom: 16px; }
.modal-actions { display: flex; gap: 10px; margin-top: 20px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.form-group input[type=file] {
  font-size: 13px; color: var(--fg); cursor: pointer;
}
.form-group select {
  width: 100%; padding: 8px 10px; font-size: 14px;
  border: 1px solid #cbd5e1; border-radius: 6px; font-family: inherit;
  background: #fff; cursor: pointer;
}
.radio-group { display: flex; gap: 20px; padding: 4px 0; flex-wrap: wrap; }
.radio-group label {
  display: flex; align-items: center; gap: 6px;
  font-size: 14px; color: var(--fg); cursor: pointer;
}

/* ドラッグ&ドロップゾーン */
#import-drop {
  border: 2px dashed var(--line); border-radius: 8px; padding: 16px;
  text-align: center; color: var(--muted); font-size: 13px;
  transition: border-color .15s, background .15s;
}
#import-drop.drag-over { border-color: var(--accent); background: #eff6ff; }

/* ---- トースト ---- */
#toast {
  position: fixed; bottom: 28px; right: 28px; z-index: 9999;
  padding: 12px 20px; border-radius: 8px; font-size: 14px; font-weight: 600;
  box-shadow: 0 4px 16px rgba(0,0,0,.15);
  opacity: 0; transform: translateY(8px);
  transition: opacity .2s ease, transform .2s ease;
  pointer-events: none;
}
#toast.show { opacity: 1; transform: translateY(0); }
#toast.toast-ok  { background: #059669; color: #fff; }
#toast.toast-err { background: #dc2626; color: #fff; }

/* ---- 職務経歴書取り込み ---- */
.ci-drop-zone {
  border: 2px dashed var(--line); border-radius: 8px; padding: 24px;
  text-align: center; color: var(--muted); font-size: 13px;
  transition: border-color .15s, background .15s; cursor: pointer;
}
.ci-drop-zone.drag-over { border-color: var(--accent); background: #eff6ff; }
.ci-file-info {
  background: #f8fafc; border: 1px solid var(--line); border-radius: 8px;
  padding: 12px 16px; font-size: 13px; line-height: 1.7; margin-bottom: 12px;
}
.ci-warning-box {
  background: #fffbeb; border: 1px solid #fcd34d; border-radius: 8px;
  padding: 12px 16px; font-size: 13px; line-height: 1.7; margin-bottom: 12px;
}
.ci-warning-danger {
  background: #fef2f2; border-color: #fca5a5;
}
.ci-warning-box h4 { margin: 0 0 6px; font-size: 13px; color: #b45309; }
.ci-warning-danger h4 { color: #dc2626; }
.ci-warning-box ul { margin: 4px 0 0; padding-left: 1.2em; }
.ci-warning-box li { margin-bottom: 2px; }
.ci-mask-btn {
  display: inline-block; padding: 2px 8px; margin: 2px 4px 2px 0; font-size: 12px;
  border: 1px solid #d97706; border-radius: 4px; background: #fff;
  color: #d97706; cursor: pointer; font-family: inherit;
}
.ci-mask-btn:hover { background: #fffbeb; }
.ci-loading {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 60px 20px; text-align: center;
}
.ci-spinner {
  width: 40px; height: 40px; border: 3px solid var(--line);
  border-top-color: var(--accent); border-radius: 50%;
  animation: ci-spin 0.8s linear infinite;
}
@keyframes ci-spin { to { transform: rotate(360deg); } }
.ci-loading p { margin-top: 16px; color: var(--muted); font-size: 14px; }
.ci-career-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 8px;
  padding: 16px; margin-bottom: 12px;
}
.ci-career-card label.ci-career-check {
  display: flex; align-items: flex-start; gap: 8px; cursor: pointer;
  font-size: 14px; color: var(--fg); margin-bottom: 8px; font-weight: 600;
}
.ci-career-card input[type="checkbox"] { margin-top: 3px; }
.ci-career-detail {
  font-size: 13px; color: var(--muted); line-height: 1.6;
  padding-left: 24px;
}
.ci-career-detail span { display: block; }

/* ---- ページ共通 ---- */
.page-body { max-width: 1200px; margin: 0 auto; padding: 28px 24px; }
.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); font-size: 14px; }

/* ---- 経歴一覧テーブル ---- */
.list-table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.list-table th { background: #f8fafc; text-align: left; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 10px 16px; border-bottom: 2px solid var(--line); }
.list-table td { padding: 12px 16px; border-bottom: 1px solid var(--line); font-size: 14px; vertical-align: top; }
.list-table tr:last-child td { border-bottom: none; }
.list-table tr:hover td { background: #f8fafc; }
.list-table .col-title { font-weight: 600; color: var(--fg); }
.list-table .col-period { white-space: nowrap; color: var(--muted); font-size: 13px; }
.list-table .col-meta { color: var(--muted); font-size: 13px; }

/* ---- 全体表示ページ ---- */
.career-block { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 32px; margin-bottom: 28px; }
.career-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.career-header h2 { font-size: 20px; margin: 0; color: var(--fg); }
.career-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.career-meta-item { font-size: 13px; color: var(--muted); }
.career-meta-label { font-weight: 600; color: var(--fg); margin-right: 4px; }
.career-section { margin-bottom: 20px; }
.career-section:last-child { margin-bottom: 0; }
.career-section-title { font-size: 14px; font-weight: 700; color: var(--accent); margin: 0 0 8px; padding-bottom: 4px; border-bottom: 2px solid #dbeafe; }
.career-section-body { font-size: 14px; line-height: 1.8; color: var(--fg); }

/* Markdown表現 */
.md-content p { margin: 0 0 8px; }
.md-content p:last-child { margin-bottom: 0; }
.md-content ul, .md-content ol { margin: 4px 0 8px; padding-left: 20px; }
.md-content li { margin-bottom: 4px; line-height: 1.7; }
.md-content strong { color: var(--fg); font-weight: 700; }
.md-content em { color: var(--muted); font-style: italic; }
.md-content code { background: #f1f5f9; border: 1px solid #e2e8f0; border-radius: 4px; padding: 1px 5px; font-size: 13px; font-family: "SF Mono", "Fira Code", monospace; color: #e11d48; }
.md-content pre { background: #1e293b; color: #e2e8f0; border-radius: 8px; padding: 16px; overflow-x: auto; font-size: 13px; line-height: 1.6; margin: 8px 0; }
.md-content pre code { background: none; border: none; padding: 0; color: inherit; font-size: inherit; }
.md-content blockquote { border-left: 3px solid var(--accent); background: #eff6ff; margin: 8px 0; padding: 10px 16px; border-radius: 0 6px 6px 0; color: var(--fg); }
.md-content h3 { font-size: 15px; font-weight: 700; color: var(--fg); margin: 16px 0 6px; }
.md-content h4 { font-size: 14px; font-weight: 600; color: var(--muted); margin: 12px 0 4px; }
.md-content hr { border: none; border-top: 1px solid var(--line); margin: 16px 0; }

/* work_items 表示カード */
.wi-card { background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; padding: 16px; margin-bottom: 10px; }
.wi-card:last-child { margin-bottom: 0; }
.wi-card-title { font-size: 14px; font-weight: 700; color: var(--fg); margin-bottom: 8px; }
.wi-field { margin-bottom: 6px; }
.wi-field:last-child { margin-bottom: 0; }
.wi-field-label { font-size: 12px; font-weight: 600; color: var(--accent); margin-bottom: 2px; }
.wi-field-body { font-size: 13px; line-height: 1.7; color: var(--fg); }
.btn-edit { flex-shrink: 0; }

/* 応募書類 */
.apply-action { text-align: center; margin: 32px 0; }
.btn-apply { padding: 12px 28px; font-size: 15px; font-weight: 600; }
.doc-list { margin-top: 24px; }
.doc-card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 16px; margin-bottom: 12px; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.doc-card-info { flex: 1; min-width: 0; }
.doc-card-name { font-size: 15px; font-weight: 600; color: var(--fg); margin-bottom: 4px; }
.doc-card-meta { font-size: 12px; color: var(--muted); }
.doc-card-actions { display: flex; gap: 6px; flex-wrap: wrap; flex-shrink: 0; }

/* キーワードマッチ結果 */
.keyword-match-section { margin-bottom: 20px; }
.keyword-match-title { font-size: 15px; font-weight: 700; margin: 0 0 10px; padding-bottom: 6px; border-bottom: 2px solid #dbeafe; }
.keyword-tag { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 12px; font-weight: 600; margin: 2px 4px 2px 0; }
.keyword-tag.matched { background: #dcfce7; color: #15803d; }
.keyword-tag.unmatched { background: #fee2e2; color: #b91c1c; }
.keyword-career-item { background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; padding: 14px; margin-bottom: 10px; }
.keyword-career-name { font-weight: 600; margin-bottom: 6px; }
.keyword-career-keywords { font-size: 13px; color: var(--muted); }

/* 応募書類ビルダー */
.doc-builder-section { margin-bottom: 20px; }
.doc-builder-career { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 16px; margin-bottom: 10px; }
.doc-builder-career label { display: flex; align-items: flex-start; gap: 8px; cursor: pointer; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.doc-builder-career input[type=checkbox] { margin-top: 3px; }
.doc-builder-order { display: flex; gap: 4px; margin-top: 6px; }
.editable-area { width: 100%; min-height: 60px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; font-size: 14px; font-family: inherit; resize: vertical; background: #fff; }
