:root { color-scheme: light dark; }
body {
  font-family: -apple-system, "Segoe UI", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  max-width: 980px;
  margin: 0 auto;
  padding: 24px 16px 64px;
  line-height: 1.6;
}
h1 { font-size: 1.4rem; margin-bottom: 4px; }
p.sub { color: #666; margin-top: 0; }
nav.page-nav { font-size: 0.85rem; margin-bottom: 16px; }
nav.page-nav a { color: #2563eb; text-decoration: none; margin-right: 16px; }
nav.page-nav a:hover { text-decoration: underline; }
nav.page-nav a.current { color: inherit; font-weight: 600; text-decoration: none; cursor: default; }

section {
  border: 1px solid #ccc4;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 24px;
}
h2 { font-size: 1.05rem; margin-top: 0; margin-bottom: 4px; }
h2.section-title { background: #8882; padding: 6px 10px; border-radius: 6px; }
p.hint { font-size: 0.8rem; color: #666; margin-top: 0; }

label { font-size: 0.8rem; font-weight: 600; display: block; margin-bottom: 4px; }
input[type="text"], input[type="number"], select, textarea {
  padding: 7px 8px;
  border: 1px solid #8886;
  border-radius: 6px;
  font-size: 0.9rem;
  background: transparent;
  color: inherit;
  width: 100%;
  box-sizing: border-box;
  font-family: inherit;
}
textarea { resize: vertical; min-height: 44px; }

/* --- 対象期間・所属情報ヘッダー --- */
.period-row { display: flex; align-items: end; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.period-row .num { width: 80px; }
.period-row .unit { font-size: 0.85rem; padding-bottom: 8px; }
.affiliation-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
}

/* --- シート選択(期末記入・評価ランク算出画面で共通) --- */
.sheet-select-row { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; margin-bottom: 8px; }
.sheet-select-row .field { flex: 1; min-width: 260px; }
.readonly-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px 16px;
  font-size: 0.85rem;
  background: #8881;
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 16px;
}
.readonly-summary .k { color: #666; font-size: 0.75rem; }

/* --- 目標カード(共通) --- */
.goal-card {
  border: 1px solid #8885;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 16px;
  position: relative;
}
.goal-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  flex-wrap: wrap;
  gap: 6px;
}
.goal-card-header .badge {
  background: #2563eb;
  color: white;
  border-radius: 999px;
  padding: 2px 12px;
  font-size: 0.85rem;
  font-weight: 600;
}
.goal-card-header .badge.muted { background: #8886; }
.goal-field { margin-bottom: 10px; }
.goal-field-row { display: flex; gap: 12px; flex-wrap: wrap; }
.goal-field-row .goal-field { flex: 1; min-width: 160px; }
.goal-field.readonly { background: #8881; padding: 8px 10px; border-radius: 6px; font-size: 0.9rem; }
.goal-field.readonly .label-inline { font-size: 0.75rem; font-weight: 600; color: #666; display: block; margin-bottom: 2px; }

table.criteria-table { width: 100%; border-collapse: collapse; margin-bottom: 10px; }
table.criteria-table th, table.criteria-table td { padding: 3px 4px; }
table.criteria-table th {
  font-size: 0.75rem;
  text-align: left;
  color: #666;
  width: 40px;
}
table.criteria-table td input { font-size: 0.85rem; }
table.criteria-table td.readonly-value { font-size: 0.82rem; padding: 3px 6px; }

.remove-goal-btn {
  background: transparent;
  border: none;
  color: #dc2626;
  cursor: pointer;
  font-size: 0.85rem;
}

.btn {
  padding: 8px 18px;
  border-radius: 6px;
  border: none;
  background: #2563eb;
  color: white;
  cursor: pointer;
  font-size: 0.9rem;
}
.btn.secondary { background: transparent; color: #2563eb; border: 1px solid #2563eb; }
.btn:disabled { opacity: 0.5; cursor: wait; }
.actions { display: flex; gap: 8px; margin-top: 8px; align-items: center; flex-wrap: wrap; }

.weight-total { font-size: 0.9rem; font-weight: 600; margin-left: auto; }
.weight-total.ok { color: #16a34a; }
.weight-total.warn { color: #dc2626; }

.msg { margin-top: 12px; font-size: 0.9rem; }
.msg.error { color: #dc2626; white-space: pre-wrap; }
.msg.success { color: #16a34a; }

.sheet-card {
  border: 1px solid #ccc6;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 10px;
}
.sheet-card-head { font-size: 0.9rem; margin-bottom: 6px; }
.sheet-card-head .muted { color: #666; font-size: 0.8rem; }
.sheet-card-head .print-link { margin-left: 12px; font-size: 0.8rem; color: #2563eb; text-decoration: none; }
.sheet-card-head .print-link:hover { text-decoration: underline; }
table.goal-mini { width: 100%; border-collapse: collapse; font-size: 0.78rem; }
table.goal-mini th, table.goal-mini td { border: 1px solid #ccc6; padding: 3px 6px; text-align: left; vertical-align: top; }
table.goal-mini th { background: #8882; }
