:root {
  --border: #d7dbe0;
  --bg: #f5f6f8;
  --accent: #2f6fed;
  --accent-dark: #1d4fc4;
  --text: #1f2430;
  --muted: #737a86;
  --danger: #d0402a;
  --ok: #1d8a4c;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Yu Gothic", "Meiryo", "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 14px;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #1f2430;
  color: #fff;
  padding: 10px 20px;
  flex-wrap: wrap;
  gap: 8px;
}
.topbar .brand { color: #fff; font-weight: bold; font-size: 15px; }
.current-project { font-size: 13px; }
.current-project .badge {
  background: var(--accent);
  color: #fff;
  padding: 2px 8px;
  border-radius: 10px;
  margin-left: 8px;
  font-size: 12px;
}
.current-project .muted { color: #b9bec9; margin-left: 6px; }

.layout { display: flex; min-height: calc(100vh - 46px); }

.sidebar {
  width: 220px;
  background: #fff;
  border-right: 1px solid var(--border);
  padding: 14px 10px;
  flex-shrink: 0;
}
.sidebar a {
  display: block;
  padding: 7px 10px;
  border-radius: 6px;
  color: var(--text);
  font-size: 13.5px;
  margin-bottom: 2px;
}
.sidebar a:hover { background: #eef2ff; text-decoration: none; }
.sidebar a.active { background: var(--accent); color: #fff; font-weight: bold; }
.nav-group-title {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  margin: 14px 6px 4px;
  letter-spacing: .04em;
}
.export-link {
  background: var(--ok);
  color: #fff !important;
  text-align: center;
  font-weight: bold;
  margin-top: 4px;
}
.export-link:hover { background: #146a3a; }

.content { flex: 1; padding: 22px 28px; max-width: 1200px; }

h1 { font-size: 20px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 18px 0 10px; }
.page-desc { color: var(--muted); margin-bottom: 18px; font-size: 13px; }

.flash {
  background: #e6f4ea;
  border: 1px solid #b7e0c3;
  color: #1d5c33;
  padding: 8px 14px;
  border-radius: 6px;
  margin-bottom: 16px;
  font-size: 13px;
}

.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px 20px;
  margin-bottom: 18px;
}

.field-grid { display: grid; grid-template-columns: 180px 1fr; gap: 10px 16px; align-items: start; }
.field-grid label { padding-top: 8px; font-weight: bold; color: #414750; font-size: 13px; }
.field-grid input[type=text], .field-grid textarea, .field-grid select {
  width: 100%;
}

input[type=text], textarea, select {
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 6px 8px;
  font-family: inherit;
  font-size: 13.5px;
  background: #fff;
}
textarea { resize: vertical; min-height: 42px; }

.btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 13.5px;
  cursor: pointer;
  font-weight: bold;
}
.btn:hover { background: var(--accent-dark); }
.btn.secondary { background: #fff; color: var(--accent); border: 1px solid var(--accent); }
.btn.secondary:hover { background: #eef2ff; }
.btn.danger { background: #fff; color: var(--danger); border: 1px solid var(--danger); padding: 5px 10px; font-size: 12px; }
.btn.danger:hover { background: #fdeceb; }

table.data-table { border-collapse: collapse; width: 100%; background: #fff; }
table.data-table th, table.data-table td {
  border: 1px solid var(--border);
  padding: 6px 8px;
  vertical-align: top;
  font-size: 13px;
}
table.data-table th { background: #eef1f5; text-align: left; white-space: nowrap; }
table.data-table td input[type=text], table.data-table td textarea, table.data-table td select {
  width: 100%;
  min-width: 90px;
}
table.data-table td.no-cell { white-space: nowrap; font-weight: bold; text-align: center; background: #fafbfc; }
table.data-table td.op-cell { text-align: center; white-space: nowrap; }

.toolbar { display: flex; gap: 10px; margin-bottom: 12px; align-items: center; }

/* 上長確認チェックボックス（03_機能仕様/06_処理ルール/07_要件確認） */
table.data-table td.confirm-cell { min-width: 170px; vertical-align: middle; }
.confirm-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  margin-bottom: 5px;
}
.confirm-toggle input[type=checkbox] { width: 16px; height: 16px; cursor: pointer; }
.confirm-label { font-size: 13px; }
.confirm-cell .confirmer-input { width: 100%; margin-bottom: 4px; }
.confirm-meta { font-size: 11px; color: var(--muted); min-height: 14px; }
table.data-table td.confirm-cell.is-confirmed { background: #eef8ef; }

.warn-box {
  background: #fff6e5;
  border: 1px solid #f0cf8a;
  color: #7a5b06;
  padding: 8px 14px;
  border-radius: 6px;
  margin-bottom: 14px;
  font-size: 13px;
}

.project-list-table { width: 100%; border-collapse: collapse; background: #fff; }
.project-list-table th, .project-list-table td {
  border: 1px solid var(--border);
  padding: 8px 10px;
  font-size: 13.5px;
}
.project-list-table th { background: #eef1f5; text-align: left; }
.status-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  background: #e6ecff;
  color: #2b45a8;
  font-size: 12px;
}

/* ===== 文字入力欄（textarea / text input）共通の拡大編集アイコン ===== */
.ta-wrap { position: relative; }
.ta-wrap textarea,
.ta-wrap input[type=text] { padding-right: 24px; }
.ta-expand-btn {
  position: absolute;
  top: 3px;
  right: 3px;
  z-index: 2;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  font-size: 12px;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  opacity: .5;
}
.ta-expand-btn:hover {
  opacity: 1;
  background: #eef2ff;
  border-color: var(--accent);
}
/* 1行inputでは縦中央に配置（テキストと被らない範囲でより自然な位置） */
.ta-wrap-input .ta-expand-btn { top: 50%; transform: translateY(-50%); }
textarea.ta-unsaved, input.ta-unsaved { background: #fff8e6; border-color: #dfae3d; }

body.modal-open { overflow: hidden; }

.expand-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 24, 32, .48);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.expand-modal-overlay[hidden] { display: none; }
.expand-modal {
  background: #fff;
  border-radius: 10px;
  width: 78vw;
  max-width: 1000px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 14px 44px rgba(0,0,0,.28);
  overflow: hidden;
}
.expand-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.expand-modal-sheet { font-size: 12px; color: var(--muted); }
.expand-modal-row { font-size: 15px; font-weight: bold; margin: 2px 0; color: var(--text); }
.expand-modal-field { font-size: 13px; color: #414750; }
.expand-modal-close {
  background: none;
  border: none;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
  padding: 2px 8px;
  flex-shrink: 0;
}
.expand-modal-close:hover { color: var(--text); }
.expand-modal-textarea {
  flex: 1;
  margin: 16px 20px;
  min-height: 320px;
  max-height: 480px;
  font-size: 14px;
  line-height: 1.7;
  resize: vertical;
}
.expand-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 20px 18px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

@media (max-width: 700px) {
  .expand-modal { width: 95vw; max-height: 92vh; }
  .expand-modal-textarea { min-height: 200px; max-height: 42vh; margin: 12px 14px; }
  .expand-modal-header { padding: 12px 14px 10px; }
  .expand-modal-actions { padding: 10px 14px 14px; }
}
