:root {
  font: 16px/1.72 -apple-system, BlinkMacSystemFont, "Noto Sans JP", "Yu Gothic", Meiryo, sans-serif;
  color: #24313a;
  background: #edf2f4;
  --ink: #24313a;
  --deep: #173b57;
  --accent: #b34335;
  --teal: #1f7777;
  --paper: #ffffff;
  --line: #cad5db;
  --muted: #5d6d76;
  --wash: #f4f8fa;
  --ok: #17674f;
  --wait: #8a571c;
  --bad: #973a3a;
}

* { box-sizing: border-box; }
body { margin: 0; overflow-x: hidden; }
h1, h2, h3, p, dl { margin: 0; }
h1 { margin: 8px 0; font-size: 1.68rem; line-height: 1.45; }
h2 { margin-bottom: 18px; font-size: 1.3rem; line-height: 1.5; }
h3 { margin: 15px 0 8px; font-size: 1.08rem; line-height: 1.55; }
p { margin: 10px 0 16px; }
a { color: #8a352d; text-underline-offset: 4px; }
a, button, input, select, textarea, p, dt, dd, strong { overflow-wrap: anywhere; }
button, input, select, textarea { font: inherit; }
button, input, select, textarea, a { touch-action: manipulation; }
button {
  padding: 10px 16px;
  border: 1px solid var(--accent);
  border-radius: 5px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}
button.secondary { border-color: #7f919c; background: #fff; color: var(--deep); }
button:disabled { cursor: not-allowed; opacity: .55; }
:focus-visible { outline: 3px solid #e1a23d; outline-offset: 3px; }
label { display: block; margin: 12px 0 5px; font-size: .875rem; font-weight: 700; }
input, select, textarea {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid #9eafb9;
  border-radius: 4px;
  background: #fff;
  color: var(--ink);
}
textarea { min-height: 88px; resize: vertical; }

.app { width: min(100%, 1420px); margin: 0 auto; padding: 24px; }
.mast {
  position: relative;
  overflow: hidden;
  padding: 24px 28px;
  border-radius: 8px;
  background: var(--deep);
  color: #fff;
}
.mast::after {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(120deg, transparent 0 82px, rgba(255,255,255,.04) 82px 126px);
  content: "";
  pointer-events: none;
}
.mast > * { position: relative; z-index: 1; }
.mast p { margin: 0; }
.eyebrow { color: #dcebf2; font-size: .875rem; letter-spacing: .09em; }
.steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 14px 0;
}
.steps a {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  font-size: .875rem;
  text-decoration: none;
}
.steps a[aria-current="page"] {
  border-color: #c17064;
  background: #fbebe7;
  color: #752d26;
  font-weight: 700;
}
.toolbar { display: flex; flex-wrap: wrap; align-items: end; gap: 14px; margin: 20px 0; }
.toolbar > div { flex: 1 1 430px; min-width: 0; }
.toolbar label, .toolbar p { margin: 0 0 5px; font-size: .875rem; }
.toolbar p { margin: 0; }
.message {
  position: sticky;
  top: 5px;
  z-index: 8;
  margin: 12px 0;
  padding: 13px 18px;
  border: 1px solid #79aa99;
  border-radius: 5px;
  background: #e6f2ed;
  color: #225a47;
}
.message:empty { display: none; }
.message--error { border-color: #d29b96; background: #fff0ef; color: #8d332d; }
.layout { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.layout--overview { grid-template-columns: minmax(0, 1.35fr) minmax(360px, .8fr); }
.layout > div { min-width: 0; }
.panel {
  min-width: 0;
  margin-bottom: 20px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 18px 0; }
.metric { min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.metric span, .metric small { display: block; color: var(--muted); font-size: .875rem; }
.metric strong { display: block; color: var(--deep); font-size: 1.48rem; }
.card, .koi-card, .box-card {
  min-width: 0;
  margin-bottom: 14px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}
.card.selected, .koi-card.selected { border-color: #b86156; background: #fff9f7; }
.cardhead { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.cardhead strong { font-size: 1.06rem; }
.status { display: inline-block; padding: 3px 9px; border-radius: 4px; background: #e8eef1; color: #43545e; font-size: .875rem; font-weight: 700; }
.status.ok { background: #def1e9; color: var(--ok); }
.status.wait { background: #fff0d8; color: var(--wait); }
.status.bad { background: #f9e0e0; color: var(--bad); }
.kv { display: grid; grid-template-columns: minmax(115px, .75fr) minmax(0, 1.55fr); gap: 0 14px; margin: 8px 0; }
.kv dt, .kv dd { margin: 0; padding: 9px 0; border-bottom: 1px solid #e1e7ea; }
.kv dt { color: var(--muted); font-size: .875rem; font-weight: 700; }
.fieldgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 15px; }
.fieldgrid > div { min-width: 0; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 15px 0 7px; }
.notice { margin: 14px 0; padding: 14px 16px; border: 1px solid #d5c19f; border-radius: 5px; background: #fff9ec; }
.notice.error { border-color: #d4a39e; background: #fff0ef; color: #87332d; }
.notice.teal { border-color: #9cc4c2; background: #ebf6f5; }
.small, small { color: var(--muted); font-size: .875rem; }
.tasks { padding-left: 22px; }
.tasks li { margin: 8px 0; }
.empty { padding: 18px; border: 1px dashed #a9b7bf; background: #fafcfd; color: var(--muted); text-align: center; }
.koi-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.koi-grid--single { grid-template-columns: 1fr; }
.koi-card { margin-bottom: 0; }
.koi-photo { position: relative; overflow: hidden; margin: 10px 0 14px; border: 1px solid #b6c7d0; background: #dcecf3; }
.koi-photo img { display: block; width: 100%; aspect-ratio: 3 / 2; object-fit: contain; background: #1b9ddd; }
.koi-photo figcaption { padding: 7px 10px; background: #eef5f7; color: var(--muted); font-size: .875rem; font-weight: 700; }
.checkgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 12px 0 18px; }
.checkcard { min-width: 0; padding: 13px; border: 1px solid var(--line); border-radius: 5px; background: var(--wash); }
.checkcard strong { display: block; margin-bottom: 6px; }
.checkcard p { margin: 7px 0 0; }
.timeline { display: grid; gap: 11px; }
.event { padding: 12px 14px; border: 1px solid #a4b2ba; background: #fff; }
.event strong, .event span { display: block; }
.event span { color: var(--muted); font-size: .875rem; }
.event p { margin-bottom: 0; }
details { margin: 14px 0; }
summary { color: #83372f; font-size: 1rem; font-weight: 700; cursor: pointer; }
.footer { margin-top: 24px; color: var(--muted); font-size: .875rem; }

@media (max-width: 1050px) {
  .layout, .layout--overview { grid-template-columns: 1fr; }
  .panel { padding: 20px; }
}

@media (max-width: 760px) {
  .app { padding: 14px; }
  .mast { padding: 20px; }
  h1 { font-size: 1.42rem; }
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metrics, .koi-grid, .checkgrid { grid-template-columns: 1fr; }
  .panel { padding: 16px; }
  .fieldgrid { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 100px minmax(0, 1fr); }
  .card, .koi-card, .box-card { padding: 15px; }
}
