:root {
  --navy: #0b2f57;
  --blue: #0f5d9a;
  --green: #15803d;
  --green-soft: #548235;
  --orange: #f07822;
  --gold: #c8a24b;
  --bg: #eef4fb;
  --card: #ffffff;
  --text: #162033;
  --muted: #6b7280;
  --line: #d8e0ea;
  --ok: #15803d;
  --warn: #b45309;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Noto Sans JP", "Hiragino Sans", "Yu Gothic UI", Meiryo, sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, #e8f0f8 0%, #f7fafc 40%, #fff 100%);
  min-height: 100vh;
}

a { color: var(--blue); }
button, .btn {
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  background: #fff;
  color: var(--navy);
  box-shadow: 0 2px 8px #0001;
}
button.primary, .btn.primary { background: var(--gold); color: #101827; }
button.ghost { background: transparent; border: 1px solid #cfe0f0; box-shadow: none; }
button.danger { background: #fee2e2; color: #991b1b; }
button:disabled { opacity: .5; cursor: not-allowed; }

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: linear-gradient(135deg, var(--navy), #061a33);
  color: #fff;
  padding: 16px 20px 14px;
  box-shadow: 0 8px 24px #001b3630;
}
.app-header .wrap { max-width: 1180px; margin: 0 auto; }
.app-header h1 {
  margin: 0;
  font-size: clamp(18px, 3vw, 28px);
  letter-spacing: .02em;
}
.app-header .sub {
  margin: 6px 0 0;
  color: #dce8f7;
  font-size: 13px;
  line-height: 1.6;
}
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  align-items: center;
}
.save-status {
  margin-left: auto;
  font-size: 12px;
  color: #b7d0ea;
}
.save-status.ok { color: #86efac; }
.save-status.warn { color: #fde68a; }

/* 案A: コンパクトヘッダー（2段） */
.app-header--compact {
  padding: 8px 12px 10px;
}
.app-header--compact .hdr-row1 {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.app-header--compact .btn-back {
  flex: 0 0 auto;
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 8px;
}
.app-header--compact .title-block {
  flex: 1 1 160px;
  min-width: 0;
}
.app-header--compact h1 {
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.app-header--compact .status-strip-compact {
  margin-top: 2px;
  min-height: 1.2em;
}
.app-header--compact .status-strip-compact .save-status {
  margin-left: 0;
  font-size: 11px;
  color: #9fefc0;
  line-height: 1.35;
}
.app-header--compact .status-strip-compact .save-status.warn {
  color: #fde68a;
}
.app-header--compact .toolbar.hdr-actions {
  margin-top: 0;
  margin-left: auto;
  gap: 6px;
}
.app-header--compact .toolbar.hdr-actions .btn,
.app-header--compact .toolbar.hdr-actions button {
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 8px;
}
.app-header--compact .toolbar.hdr-actions #btn-server-submit,
.app-header--compact .toolbar.hdr-actions .btn-submit {
  background: #16a34a;
  color: #fff;
  border-color: #16a34a;
}
.app-header--compact .nav-steps {
  margin-top: 8px;
  gap: 4px;
}
.app-header--compact .nav-steps button {
  padding: 5px 8px;
  font-size: 11px;
}
.app-header--compact .status-strip-compact #jissen-zemi-sync-banner {
  display: block;
  width: auto;
  max-width: 100%;
  margin: 0;
  padding: 0;
  border: 0 !important;
  border-radius: 0;
  background: transparent !important;
  font-size: 11px;
  line-height: 1.35;
  color: #9fefc0 !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.app-header--compact .status-strip-compact:has(#jissen-zemi-sync-banner) > .save-status {
  display: none;
}

.nav-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}
.nav-steps button {
  font-size: 12px;
  padding: 7px 10px;
  background: #123a63;
  color: #e8f1fb;
  box-shadow: none;
  border: 1px solid #2a5685;
}
.nav-steps button.active {
  background: var(--gold);
  color: #101827;
  border-color: transparent;
}

main.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px 16px 96px;
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  margin: 14px 0;
  box-shadow: 0 8px 28px #0b2f5710;
}
.panel h2 {
  margin: 0 0 10px;
  color: var(--navy);
  font-size: 22px;
}
.lead { color: var(--muted); line-height: 1.75; margin: 0 0 12px; }
.credit {
  background: #f8fafc;
  border-left: 4px solid var(--green-soft);
  padding: 12px 14px;
  border-radius: 0 12px 12px 0;
  font-size: 14px;
  line-height: 1.7;
  color: #334155;
}
.badge {
  display: inline-block;
  font-size: 12px;
  background: #edf5ff;
  color: var(--blue);
  border: 1px solid #cfe4ff;
  border-radius: 999px;
  padding: 3px 10px;
  font-weight: 700;
}
.note-local {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.6;
  margin: 12px 0;
}

.grid-kpi {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 14px 0;
}
.kpi {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
}
.kpi .label { color: var(--muted); font-size: 12px; }
.kpi .value { font-size: 26px; font-weight: 800; color: var(--navy); margin-top: 4px; }

.table-wrap { overflow-x: auto; }
.entry-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 920px;
  border: 1px solid var(--line);
}
.entry-table th {
  background: var(--green-soft);
  color: #fff;
  font-size: 13px;
  padding: 10px 6px;
  border: 1px solid #ffffff33;
  text-align: center;
}
.entry-table td {
  border: 1px solid var(--line);
  padding: 8px;
  vertical-align: middle;
  background: #fff;
  font-size: 13px;
}
.entry-table tr:nth-child(even) td { background: #fbfdff; }
.entry-table .cat {
  font-weight: 800;
  color: var(--navy);
  text-align: center;
  background: #f6faf3;
  width: 110px;
}
.entry-table .q { line-height: 1.55; }
.entry-table select,
.entry-table input[type="text"],
.entry-table textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 7px 6px;
  font: inherit;
  background: #fff;
}
.cell-ro {
  text-align: center;
  font-weight: 800;
  color: var(--navy);
  min-height: 34px;
  line-height: 34px;
}

.chart-box {
  max-width: 640px;
  margin: 0 auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
}
.meta-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}
.meta-form label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
  font-weight: 700;
}
.meta-form input {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 9px 10px;
  font: inherit;
}
.meta-form input[readonly] {
  background: #eef3ef;
  color: #1a2b1f;
  cursor: default;
}

.section-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  margin: 14px 0;
  overflow: hidden;
  background: #fff;
}
.section-title {
  background: #f7f9fc;
  border-left: 7px solid var(--orange);
  padding: 12px 14px;
  font-weight: 800;
  color: var(--navy);
}
.section-title .entry-q {
  display: block;
  margin-top: 6px;
  font-weight: 600;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}
.item-block {
  padding: 14px;
  border-top: 1px solid var(--line);
}
.item-block h4 {
  margin: 0 0 6px;
  color: var(--navy);
  font-size: 16px;
}
.item-block .commentary {
  margin: 0 0 8px;
  color: #334155;
  line-height: 1.7;
  font-size: 14px;
  white-space: pre-wrap;
}
.item-block ul {
  margin: 0 0 10px;
  padding-left: 1.2em;
  color: #475569;
  font-size: 13px;
  line-height: 1.65;
}
.fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.fields.full { grid-template-columns: 1fr; }
.fields.duo { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.fields label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 4px;
}
.fields input,
.fields select,
.fields textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
  background: #fff;
}
.fields textarea { min-height: 72px; resize: vertical; }

.plan-block,
.action-block {
  margin-top: 12px;
  border-radius: 14px;
  overflow: hidden;
}
.plan-block {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  padding: 12px;
}
.plan-block__head,
.action-block__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  font-weight: 800;
  color: var(--navy);
  margin-bottom: 10px;
}
.action-block {
  background: linear-gradient(180deg, #f3f8ff 0%, #fafcff 100%);
  border: 1px solid #d5e4f5;
  padding: 12px;
}
.action-block__hint {
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  background: #e8f1fb;
  border-radius: 999px;
  padding: 2px 8px;
}
.action-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.9fr 1.3fr 0.9fr 1.2fr;
  gap: 10px;
}
.action-field {
  position: relative;
  background: #fff;
  border: 1px solid #dbe7f3;
  border-radius: 12px;
  padding: 12px 10px 10px;
  box-shadow: 0 1px 0 #fff inset, 0 4px 12px #0b2f5708;
  border-top: 3px solid #94a3b8;
  transition: border-color .15s, box-shadow .15s;
}
.action-field:focus-within {
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px #bfdbfe66, 0 4px 12px #0b2f5710;
}
.action-field--why { border-top-color: #f07822; }
.action-field--who { border-top-color: #0f5d9a; }
.action-field--what { border-top-color: #548235; }
.action-field--when { border-top-color: #c8a24b; }
.action-field--how { border-top-color: #7c3aed; }
.action-field__badge {
  position: absolute;
  top: -9px;
  right: 10px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .04em;
  color: #fff;
  background: #64748b;
  border-radius: 999px;
  padding: 2px 8px;
  line-height: 1.3;
}
.action-field--why .action-field__badge { background: #f07822; }
.action-field--who .action-field__badge { background: #0f5d9a; }
.action-field--what .action-field__badge { background: #548235; }
.action-field--when .action-field__badge { background: #b45309; }
.action-field--how .action-field__badge { background: #7c3aed; }
.action-field label {
  display: block;
  font-size: 13px;
  font-weight: 800;
  color: var(--navy);
  margin: 0 0 6px;
}
.action-field label span {
  font-weight: 600;
  color: #64748b;
  font-size: 12px;
  margin-left: 2px;
}
.action-field input,
.action-field textarea {
  width: 100%;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
  font-size: 13px;
  background: #f8fafc;
  color: var(--text);
  resize: vertical;
}
.action-field input:focus,
.action-field textarea:focus {
  outline: none;
  background: #fff;
  border-color: #93c5fd;
}
.action-field textarea { min-height: 56px; line-height: 1.55; }
.action-field input::placeholder,
.action-field textarea::placeholder {
  color: #94a3b8;
}
.unified-scores {
  margin: 12px 14px;
  padding: 12px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 12px;
}
.unified-scores__label {
  font-size: 12px;
  font-weight: 800;
  color: #92400e;
  margin-bottom: 8px;
}
.unified-scores__grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.score-box {
  background: #fff;
  border: 1px solid #f6e7b0;
  border-radius: 10px;
  padding: 10px;
  text-align: center;
}
.score-box__k {
  display: block;
  font-size: 12px;
  font-weight: 800;
  color: #78716c;
}
.score-box__v {
  display: block;
  margin-top: 4px;
  font-size: 28px;
  font-weight: 800;
  color: var(--navy);
  line-height: 1.2;
}
.score-box__hint {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  color: var(--muted);
}
.score-box--input select {
  width: 100%;
  margin-top: 6px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 8px;
  font: inherit;
  font-weight: 700;
  text-align: center;
}
.item-list {
  padding: 0 10px 12px;
}
.item-card {
  margin: 12px 4px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fcfdff;
  box-shadow: 0 2px 10px #0b2f5708;
}
.item-card__title {
  margin: 0 0 8px;
  color: var(--navy);
  font-size: 17px;
  padding-bottom: 8px;
  border-bottom: 2px solid #e8eef5;
}
.item-card .commentary {
  margin: 0 0 8px;
  color: #334155;
  line-height: 1.7;
  font-size: 14px;
  white-space: pre-wrap;
}
.practices {
  margin: 0 0 12px;
  padding: 10px 12px;
  background: #f7faf3;
  border-radius: 10px;
  border: 1px solid #d9e8c8;
}
.practices__label {
  font-size: 12px;
  font-weight: 800;
  color: var(--green-soft);
  margin-bottom: 4px;
}
.practices ul {
  margin: 0;
  padding-left: 1.2em;
  color: #475569;
  font-size: 13px;
  line-height: 1.65;
}
.item-block {
  padding: 14px;
  border-top: 1px solid var(--line);
}
.item-block h4 {
  margin: 0 0 6px;
  color: var(--navy);
  font-size: 16px;
}
.item-block .commentary {
  margin: 0 0 8px;
  color: #334155;
  line-height: 1.7;
  font-size: 14px;
  white-space: pre-wrap;
}
.item-block ul {
  margin: 0 0 10px;
  padding-left: 1.2em;
  color: #475569;
  font-size: 13px;
  line-height: 1.65;
}

.app-footer {
  max-width: 1180px;
  margin: 0 auto 28px;
  padding: 0 16px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}
.view { display: none; }
.view.active { display: block; }

/* ===== 一覧（コンパクト） ===== */
.summary-panel .lead { margin-bottom: 10px; }
.summary-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 12px 0;
}
.summary-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--navy);
  margin-right: 6px;
}
.summary-profile {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin: 10px 0 16px;
  padding: 10px 12px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 13px;
}
.summary-profile span {
  display: block;
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
  margin-bottom: 2px;
}
.summary-block { margin: 18px 0; }
.summary-block > h3,
.summary-cat > h3 {
  margin: 0 0 10px;
  color: var(--navy);
  font-size: 18px;
  padding-bottom: 6px;
  border-bottom: 2px solid #e2e8f0;
}
.summary-cat { margin: 16px 0 22px; }
.summary-sec {
  margin: 10px 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}
.summary-sec__head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: baseline;
  justify-content: space-between;
  padding: 8px 12px;
  background: #f1f5f9;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.summary-sec__meta {
  font-size: 12px;
  color: #475569;
  font-weight: 600;
}
.summary-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  line-height: 1.45;
}
.summary-table th {
  background: #548235;
  color: #fff;
  font-weight: 700;
  padding: 6px 6px;
  border: 1px solid #ffffff33;
  text-align: center;
  white-space: nowrap;
}
.summary-table td {
  border: 1px solid #e2e8f0;
  padding: 5px 6px;
  vertical-align: top;
  background: #fff;
}
.summary-table tr:nth-child(even) td { background: #fbfdff; }
.summary-table .cat {
  font-weight: 800;
  text-align: center;
  background: #f6faf3 !important;
  color: var(--navy);
  width: 2.2em;
}
.summary-table .c { text-align: center; white-space: nowrap; }
.summary-table .strong { font-weight: 800; color: var(--navy); }
.summary-table .q-compact {
  min-width: 220px;
  max-width: 360px;
}
.summary-table--items th:first-child,
.summary-table--items .item-name {
  min-width: 140px;
  max-width: 200px;
  font-weight: 700;
  color: var(--navy);
  background: #f8fafc;
}
.summary-table--items td {
  max-width: 160px;
  word-break: break-word;
}
.summary-table tr.is-empty td { color: #94a3b8; }
.summary-table tr.is-filled td { background: #f0fdf4; }
.summary-table tr.is-filled:nth-child(even) td { background: #ecfdf5; }
.muted { color: #94a3b8; }

@media (max-width: 1100px) {
  .action-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .action-field--how { grid-column: 1 / -1; }
  .summary-profile { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .grid-kpi { grid-template-columns: repeat(2, 1fr); }
  .meta-form,
  .fields,
  .fields.duo,
  .action-grid,
  .unified-scores__grid { grid-template-columns: 1fr; }
  .action-field--how { grid-column: auto; }
  .save-status { margin-left: 0; width: 100%; }
}

/* Gemini 総評（一覧） */
.pkgh-gemini-block .lead { margin-bottom: 10px; }
.pkgh-gemini-box {
  border: 1px solid #c5d6c8;
  background: #f7fbf8;
  border-radius: 8px;
  padding: 14px 16px;
  margin-top: 8px;
}
.pkgh-gemini-progress {
  text-align: left;
}
.pkgh-gemini-progress__badge {
  display: inline-block;
  margin: 0 0 8px;
  padding: 4px 10px;
  font-weight: 700;
  font-size: 14px;
  color: #0b5c2e;
  background: #d8f0e2;
  border-radius: 4px;
  animation: pkgh-gemini-pulse 1.4s ease-in-out infinite;
}
@keyframes pkgh-gemini-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}
.pkgh-gemini-progress__phase { margin: 0 0 6px; font-size: 15px; }
.pkgh-gemini-progress__note { margin: 0 0 12px; color: #456; font-size: 13px; }
.pkgh-gemini-progress__list {
  margin: 0;
  padding-left: 1.2em;
  font-size: 13px;
  color: #567;
}
.pkgh-gemini-progress__list li { margin: 2px 0; }
.pkgh-gemini-progress__list li.is-done { color: #0b5c2e; }
.pkgh-gemini-progress__list li.is-active {
  color: #0b5c2e;
  font-weight: 700;
}
.pkgh-gemini-body h3 { margin: 1.1em 0 0.4em; font-size: 1.05rem; }
.pkgh-gemini-body h4 { margin: 0.9em 0 0.35em; font-size: 0.98rem; }
.pkgh-gemini-part {
  margin-top: 1.4em;
  padding-top: 0.6em;
  border-top: 1px solid #c5d6c8;
  color: #0b5c2e;
}
.pkgh-gemini-body p { margin: 0.35em 0; line-height: 1.55; }
.pkgh-gemini-body ul { margin: 0.35em 0 0.6em 1.2em; }
.pkgh-gemini-hr { border: none; border-top: 1px dashed #b8c9bb; margin: 1.2em 0; }
.pkgh-gemini-table-wrap { overflow-x: auto; margin: 0.6em 0 1em; }
.pkgh-gemini-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  background: #fff;
}
.pkgh-gemini-table th,
.pkgh-gemini-table td {
  border: 1px solid #c5d6c8;
  padding: 6px 8px;
  vertical-align: top;
  text-align: left;
}
.pkgh-gemini-table th { background: #e8f3ec; }
.pkgh-gemini-meta { margin: 12px 0 0; font-size: 12px; color: #567; }
.pkgh-gemini-stale { margin: 6px 0 0; font-size: 13px; color: #a15c00; }
.pkgh-gemini-actions { margin: 12px 0 0; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.pkgh-gemini-note { margin-top: 10px; font-size: 12px; color: #678; }

@media print {
  .app-header .toolbar,
  .nav-steps,
  .summary-toolbar,
  .summary-panel > .toolbar,
  .pkgh-gemini-actions,
  .pkgh-gemini-note,
  .note-local,
  .badge { display: none !important; }
  .app-header {
    position: static;
    box-shadow: none;
    padding: 8px 0;
    background: #fff;
    color: #000;
  }
  .app-header h1 { color: #000; font-size: 18px; }
  .app-header .sub { color: #333; }
  body { background: #fff; }
  main.wrap { padding: 0; max-width: none; }
  .panel {
    box-shadow: none;
    border: none;
    padding: 0;
  }
  .summary-sec,
  .summary-table td,
  .summary-table th { break-inside: avoid; }
  .summary-table { font-size: 10px; }
  .summary-table th { background: #ddd !important; color: #000 !important; }
}
