:root {
  --bg: #f8fafc;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-muted: #64748b;
  --primary: #0f172a;
  --primary-hover: #334155;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", "Yu Gothic", "Noto Sans JP", sans-serif;
  font-size: 14px;
  line-height: 1.6;
}

a { color: inherit; }

.header {
  background: #fff;
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.brand { font-weight: 700; font-size: 16px; }
.nav { display: flex; gap: 16px; margin-left: 24px; }
.nav a { text-decoration: none; color: var(--text-muted); }
.nav a:hover { color: var(--text); }
.header-left { display: flex; align-items: center; }
.header-right { display: flex; align-items: center; gap: 12px; color: var(--text-muted); font-size: 13px; }

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 16px;
}

h1.page-title { font-size: 18px; font-weight: 700; margin: 0 0 16px; }
h2.section-title { font-size: 15px; font-weight: 700; margin: 0 0 8px; }

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

.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 16px; flex-wrap: wrap; align-items: flex-end; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
@media (max-width: 700px) {
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
}

label.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; color: #334155; }

.input, select.input, textarea.input {
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 13px;
  font-family: inherit;
  width: 100%;
}
.input:focus { outline: 2px solid #94a3b8; outline-offset: 0; }
.input-sm { width: 80px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 6px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-outline { background: #fff; border-color: #cbd5e1; color: var(--text); }
.btn-outline:hover { background: #f1f5f9; }
.btn-danger { background: #fff; border-color: #fecaca; color: #b91c1c; }
.btn-danger:hover { background: #fef2f2; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

table.table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.table thead { background: #f8fafc; text-align: left; color: var(--text-muted); }
table.table th, table.table td { padding: 8px 12px; }
table.table tbody tr { border-top: 1px solid var(--border); }
table.table tbody tr:hover { background: #f8fafc; }
tr.category-row td { background: #f1f5f9; font-size: 12px; font-weight: 700; color: #475569; padding: 6px 12px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 8px; background: #fff; }
.table-wrap table.table { border: none; }

.badge { display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 600; }
.badge-amber { background: #fef3c7; color: #92400e; }
.badge-green { background: #d1fae5; color: #065f46; }
.badge-gray { background: #e2e8f0; color: #334155; }
.badge-red { background: #fee2e2; color: #b91c1c; }

.text-muted { color: var(--text-muted); }
.text-danger { color: #b91c1c; }
.flash-error { background: #fef2f2; color: #b91c1c; padding: 10px 14px; border-radius: 6px; font-size: 13px; }
.flash-success { background: #ecfdf5; color: #065f46; padding: 10px 14px; border-radius: 6px; font-size: 13px; }

.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); }
.login-card { width: 100%; max-width: 360px; background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 32px; }

.stat-value { font-size: 24px; font-weight: 700; }
.stat-label { font-size: 12px; color: var(--text-muted); }

/* ヒアリングフォーム: ラジオ/チェックボックスを大きく・見やすく */
#hearing-form input[type="radio"],
#hearing-form input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
  flex-shrink: 0;
}
#hearing-form label.status-radio-label,
#hearing-form label.field-inline-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
}
.checkbox-group { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 4px; }
.field-label-block { display: block; font-size: 13px; font-weight: 600; color: #334155; margin-bottom: 2px; }

/* 大枠のステータス: 一番重要な操作なので目立たせる */
.category-status-box {
  border: 1px solid;
  border-radius: 8px;
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

/* ステータスに応じた色分け（大枠のボックス・各項目のヘッダー共通） */
.status-tint-unset { background: #fff; border-color: #e2e8f0; }
.status-tint-request { background: #fee2e2; border-color: #f87171; }
.status-tint-done { background: #d1fae5; border-color: #6ee7b7; }
.status-tint-unnecessary { background: #e2e8f0; border-color: #cbd5e1; }
.status-tint-hold { background: #fef3c7; border-color: #fcd34d; }
.category-status-box .status-radio-label { font-size: 15px; font-weight: 700; }
.category-status-label { font-weight: 700; font-size: 14px; color: var(--text); }

/* 小項目のアコーディオン */
details.hearing-item { border: 1px solid #e2e8f0; border-radius: 8px; padding: 0; overflow: hidden; }
details.hearing-item > summary {
  cursor: pointer;
  list-style: none;
  padding: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
details.hearing-item > summary::-webkit-details-marker { display: none; }
details.hearing-item .hearing-item-body { padding: 0 12px 12px; border-top: 1px solid #e2e8f0; padding-top: 12px; }

.totals-card { margin-top: 24px; }

/* ヒアリング内容の確認モーダル */
.confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  display: none;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  padding: 32px 16px;
  z-index: 100;
}
.confirm-overlay.open { display: flex; }
.confirm-panel {
  background: #fff;
  border-radius: 10px;
  max-width: 720px;
  width: 100%;
  padding: 24px;
}
.confirm-category { margin-bottom: 20px; }
.confirm-category h3 { font-size: 15px; margin: 0 0 8px; border-bottom: 2px solid #0f172a; padding-bottom: 4px; }
.confirm-item { margin-bottom: 12px; padding: 10px 12px; background: #f8fafc; border-radius: 6px; }
.confirm-item-title { font-weight: 700; margin-bottom: 6px; }
.confirm-field { font-size: 13px; margin-bottom: 2px; }
.confirm-field-label { color: var(--text-muted); }
.confirm-totals { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border); font-weight: 700; text-align: right; }

/* 複数追加可能なテキスト項目（ABテスト等） */
.repeatable-text-group { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.repeatable-text-row { display: flex; gap: 6px; align-items: center; }
.repeatable-text-row .input { flex: 1; }
.repeatable-add-btn { align-self: flex-start; }
