:root {
  color-scheme: light;
  --ink: #0c0c0c;
  --muted: #5b5b5b;
  --line: #777;
  --soft-line: #d8d8d8;
  --paper: #ffffff;
  --bg: #f6f7f8;
  --no: #df111b;
  --maybe: #f39818;
  --yes: #1565c0;
  --ok-bg: #edf8ef;
  --maybe-bg: #fff8e7;
  --bad-bg: #fff0f0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
.tool-select,
.import-button {
  min-height: 38px;
  border: 1px solid #aeb7c0;
  border-radius: 6px;
  padding: 7px 12px;
  background: #fff;
  color: #16324a;
  font-weight: 800;
  cursor: pointer;
}

button:hover,
.tool-select:hover,
.import-button:hover {
  background: #eef6ff;
}

.tool-select {
  min-width: 190px;
  color: #17324a;
  font-weight: 800;
}

button.danger {
  color: #a91e2c;
}

.app {
  width: min(1540px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 36px;
}

.header-visual {
  height: clamp(150px, 24vw, 300px);
  margin-bottom: 18px;
  overflow: hidden;
  border: 1px solid #d3dde5;
  border-radius: 8px;
  background: #fff;
}

.header-visual img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) 150px;
  gap: 16px;
  align-items: end;
  margin-bottom: 14px;
}

.label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.title-input,
.number-input,
.text-input,
.member-name,
.member-sub,
.member-preset,
.date-input,
.date-picker,
.time-picker,
.memo-input,
.note-title,
textarea {
  width: 100%;
  border: 1px solid #cfd7dd;
  border-radius: 6px;
  background: #fff;
}

.title-input {
  min-height: 54px;
  padding: 0 12px;
  font-size: clamp(26px, 4vw, 44px);
  font-weight: 950;
}

.number-input {
  min-height: 54px;
  padding: 0 10px;
  text-align: center;
  font-size: 24px;
  font-weight: 950;
}

.settings-grid {
  display: grid;
  grid-template-columns: 180px minmax(230px, .8fr) minmax(230px, .8fr) minmax(320px, 1.4fr);
  gap: 16px;
  margin-bottom: 14px;
}

.description-field {
  min-width: 0;
}

.text-input {
  min-height: 46px;
  padding: 0 12px;
  font-weight: 850;
}

.description-input {
  min-height: 84px;
  padding: 12px;
  font-size: 16px;
  font-weight: 650;
  line-height: 1.55;
}

.tools,
.legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.import-button {
  position: relative;
  display: inline-grid;
  place-items: center;
}

.import-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.legend {
  justify-content: flex-end;
  color: #1b1b1b;
  font-size: 18px;
  font-weight: 800;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.mark {
  display: inline-block;
  min-width: 30px;
  text-align: center;
  font-size: 30px;
  line-height: 1;
}

.mark.no {
  color: var(--no);
}

.mark.maybe {
  color: var(--maybe);
}

.mark.yes {
  color: var(--yes);
}

.mark.blank {
  color: #222;
}

.best-summary {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(320px, .9fr);
  gap: 16px;
  align-items: stretch;
  margin: 10px 0 16px;
  border: 1px solid #cdd8df;
  border-radius: 8px;
  padding: 16px;
  background: #fff;
}

.best-summary h2 {
  margin: 0 0 8px;
  font-size: 24px;
}

.best-summary p {
  margin: 0;
  color: #414141;
  line-height: 1.6;
  white-space: pre-wrap;
}

.best-summary ol {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 24px;
}

.best-summary li {
  padding: 8px 10px;
  border-radius: 6px;
  background: #f5f8fb;
}

.best-summary li b,
.best-summary li span {
  display: block;
}

.best-summary li span {
  margin-top: 2px;
  color: #555;
  font-size: 14px;
  font-weight: 750;
}

.table-card {
  max-height: min(72vh, 760px);
  overflow: auto;
  border: 1px solid var(--line);
  background: var(--paper);
}

.schedule-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  table-layout: auto;
}

.schedule-table th,
.schedule-table td {
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 10px;
  vertical-align: middle;
}

.schedule-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
}

.schedule-table th:last-child,
.schedule-table td:last-child {
  border-right: 0;
}

.schedule-table tr:last-child td {
  border-bottom: 0;
}

.date-head,
.date-cell {
  width: 174px;
  min-width: 174px;
}

.date-head,
.date-cell {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--paper);
}

.date-head {
  z-index: 4;
}

.member-head {
  width: 190px;
  min-width: 190px;
}

.member-inner {
  display: grid;
  gap: 6px;
}

.member-preset {
  min-height: 32px;
  padding: 0 8px;
  color: #17324a;
  background: rgba(255,255,255,.72);
  font-size: 13px;
  font-weight: 850;
}

.member-name {
  min-height: 34px;
  border: 0;
  background: transparent;
  text-align: center;
  font-size: 24px;
  font-weight: 950;
}

.member-sub {
  min-height: 26px;
  border: 0;
  background: transparent;
  text-align: center;
  font-size: 15px;
  font-weight: 850;
}

.remove-column,
.remove-row {
  min-height: 28px;
  justify-self: center;
  border: 0;
  padding: 2px 8px;
  color: #7e2630;
  background: transparent;
  font-size: 13px;
}

.date-input {
  min-height: 46px;
  border: 0;
  background: transparent;
  text-align: center;
  font-size: 23px;
  font-weight: 900;
}

.date-picker-row {
  display: grid;
  gap: 6px;
  margin: 4px 0 6px;
}

.date-picker,
.time-picker {
  min-height: 34px;
  padding: 0 8px;
  color: #17324a;
  font-size: 14px;
  font-weight: 800;
}

.cell-editor {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  align-items: center;
  gap: 6px 8px;
}

.status-select {
  width: 46px;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  text-align: center;
  font-size: 31px;
  font-weight: 900;
}

.status-select.no {
  color: var(--no);
}

.status-select.maybe {
  color: var(--maybe);
}

.status-select.yes {
  color: var(--yes);
}

.status-select.blank {
  color: #222;
}

.memo-input {
  grid-column: 1 / -1;
  min-height: 42px;
  border: 0;
  background: transparent;
  font-size: 18px;
  font-weight: 850;
  line-height: 1.45;
}

.cell-content-select {
  width: 100%;
  min-height: 34px;
  border: 1px solid #d8e0e6;
  border-radius: 6px;
  padding: 0 8px;
  background: rgba(255,255,255,.78);
  color: #17324a;
  font-size: 13px;
  font-weight: 800;
}

.schedule-table td.good {
  background: var(--ok-bg);
}

.schedule-table td.possible {
  background: var(--maybe-bg);
}

.schedule-table td.closed {
  background: var(--bad-bg);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.summary-card {
  border: 1px solid #c9d3dc;
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.summary-card strong {
  display: block;
  margin-bottom: 4px;
  font-size: 18px;
}

.summary-card.good {
  border-color: #93c79a;
  background: #eef9ef;
}

.summary-card.possible {
  border-color: #e7c26c;
  background: #fff8e6;
}

.summary-card.closed {
  border-color: #e1a2a8;
  background: #fff1f2;
}

.note-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.note-card {
  overflow: hidden;
  border: 1px solid #b9c8d8;
  border-radius: 6px;
  background: #fff;
}

.note-card.green {
  border-color: #b7ceb5;
}

.note-card.purple {
  border-color: #c9b7d9;
}

.note-title {
  min-height: 54px;
  border: 0;
  border-bottom: 1px solid #edf0f2;
  border-radius: 0;
  text-align: center;
  font-size: 26px;
  font-weight: 950;
}

.note-card.blue .note-title {
  color: #2564a8;
  background: #f2f7ff;
}

.note-card.green .note-title {
  color: #158045;
  background: #f4fbf3;
}

.note-card.purple .note-title {
  color: #6d348f;
  background: #fbf5ff;
}

textarea {
  min-height: 170px;
  border: 0;
  border-radius: 0;
  padding: 18px 22px;
  font-size: 22px;
  font-weight: 800;
  line-height: 1.7;
  resize: vertical;
}

@media (max-width: 760px) {
  .app {
    width: min(100% - 18px, 720px);
    padding-top: 12px;
  }

  .topbar,
  .settings-grid,
  .best-summary,
  .note-grid {
    grid-template-columns: 1fr;
  }

  .legend {
    justify-content: flex-start;
    font-size: 15px;
  }

  .mark {
    min-width: 24px;
    font-size: 25px;
  }
}

@media print {
  body {
    background: #fff;
  }

  .app {
    width: 100%;
    padding: 0;
  }

  .tools,
  .settings-grid,
  .best-summary,
  .summary-grid,
  .remove-column,
  .remove-row,
  .label {
    display: none;
  }

  input,
  select,
  textarea {
    appearance: none;
  }

  .table-card {
    overflow: visible;
  }
}
