:root {
  color-scheme: light;
  --bg: #f6f9fc;
  --text: #172033;
  --muted: #64748b;
  --line: #d8e2ee;
  --primary: #0f766e;
  --primary-dark: #115e59;
  --urgent-bg: #fde8e6;
  --urgent-bar: #e11d48;
  --warning-bg: #fff6d6;
  --warning-bar: #d97706;
  --progress-bg: #e5f7f6;
  --progress-bar: #0f766e;
  --done-bg: #eceff3;
  --done-bar: #94a3b8;
  --drop-bg: #f4f1f6;
  --drop-bar: #7c6f86;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", system-ui, sans-serif;
}

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

button { cursor: pointer; }

.app {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 20px 0 48px;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.mark {
  display: grid;
  width: 48px;
  height: 48px;
  flex: none;
  place-items: center;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  font-size: 22px;
  font-weight: 800;
}

.brand h1 {
  margin: 0;
  font-size: 30px;
  font-weight: 800;
  line-height: 1.2;
  word-break: keep-all;
}

.tabs {
  display: flex;
  padding: 4px;
  border-radius: 999px;
  background: #eef5f3;
}

.tab {
  border: 0;
  background: transparent;
  color: #3f5f5c;
  border-radius: 999px;
  padding: 8px 16px;
  font-weight: 700;
}

.tab.is-active {
  background: #fff;
  color: var(--primary-dark);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.updated {
  margin-left: auto;
  text-align: right;
}

.updated span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.updated strong {
  font-size: 16px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px;
  margin-bottom: 12px;
}

.field {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.grow { flex: 1; }

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.check input { accent-color: var(--primary); }

.add,
.save {
  height: 36px;
  border: 0;
  border-radius: 8px;
  padding: 0 14px;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
}

.text-btn.danger:disabled,
.add:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.summary {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin: 0 0 14px;
  padding: 0;
  list-style: none;
}

.legend li {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #475569;
  font-size: 12px;
  font-weight: 700;
}

.swatch {
  width: 10px;
  height: 10px;
  border-radius: 99px;
}

.list,
.group-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.column-head {
  display: grid;
  grid-template-columns: minmax(180px, 1.6fr) 92px minmax(120px, 148px) 112px 88px 64px;
  gap: 8px;
  align-items: end;
  margin-top: 4px;
  padding: 8px 12px 8px 16px;
  border-left: 6px solid transparent;
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg);
}

.group-label {
  margin: 0 0 8px;
  color: #334155;
  font-size: 13px;
  font-weight: 800;
}

.meeting {
  margin: 0 0 16px;
  padding: 12px;
  border: 1px solid #d5ebe7;
  border-radius: 14px;
  background: #f3faf8;
}

.meeting.is-undated {
  border-style: dashed;
  background: transparent;
}

.meeting-bar,
.meeting-create {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 8px;
}

.meeting-bar .datebox,
.meeting-create .datebox {
  width: 11rem;
}

.meeting-bar {
  margin-bottom: 10px;
}

.hint {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.meeting .column-head {
  position: static;
  background: transparent;
}

.row {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.row-main {
  display: grid;
  grid-template-columns: minmax(180px, 1.6fr) 92px minmax(120px, 148px) 112px 88px 64px;
  gap: 8px;
  align-items: center;
  padding: 12px 12px 12px 16px;
  border-left: 6px solid transparent;
  border-radius: 12px;
}

.is-urgent .row-main { background: var(--urgent-bg); border-left-color: var(--urgent-bar); }
.is-warning .row-main { background: var(--warning-bg); border-left-color: var(--warning-bar); }
.is-progress .row-main { background: var(--progress-bg); border-left-color: var(--progress-bar); }
.is-done .row-main { background: var(--done-bg); border-left-color: var(--done-bar); }
.is-drop .row-main { background: var(--drop-bg); border-left-color: var(--drop-bar); }
.is-open > .row-main { border-radius: 12px 12px 0 0; }

.child .title { padding-left: 16px; }
.child .title::before { content: "└ "; color: #64748b; }

.title {
  font-size: 15px;
  font-weight: 800;
  line-height: 1.45;
  white-space: pre-line;
}

.is-drop .title {
  color: #6b6280;
  text-decoration: line-through;
}

.due {
  color: #334155;
  font-size: 13px;
  font-weight: 800;
}

.due.is-empty { color: #94a3b8; font-weight: 700; }

.cell { display: contents; }

.cell-label { display: none; }

select,
.datebox,
.owner-custom,
.text-input {
  width: 100%;
  height: 36px;
  border: 1px solid #c5d4e4;
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 0 8px;
  font-size: 13px;
  font-weight: 700;
}

.detail-btn,
.text-btn {
  height: 36px;
  border: 0;
  background: transparent;
  color: var(--primary-dark);
  font-size: 13px;
  font-weight: 800;
}

.detail {
  display: grid;
  gap: 12px;
  padding: 4px 16px 16px 22px;
  border-top: 1px solid var(--line);
}

.detail label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

textarea {
  width: 100%;
  min-height: 72px;
  border: 1px solid #c5d4e4;
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.6;
  resize: vertical;
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.detail-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.text-btn.danger {
  background: #b91c1c;
  color: #fff;
}

.empty,
.error {
  margin: 12px 0;
  padding: 14px 16px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--line);
}

.error {
  border-color: #fecaca;
  background: #fef2f2;
  color: #991b1b;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(15, 23, 42, 0.45);
  z-index: 20;
}

.modal {
  width: min(440px, 100%);
  padding: 22px;
  border-radius: 16px;
  background: #fff;
}

.modal h2 {
  margin: 0 0 8px;
  font-size: 18px;
}

.modal p { margin: 0 0 18px; line-height: 1.6; }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.secondary,
.danger {
  height: 36px;
  border-radius: 8px;
  padding: 0 14px;
  font-weight: 800;
}

.secondary {
  border: 1px solid var(--line);
  background: #fff;
}

.danger {
  border: 0;
  background: #b91c1c;
  color: #fff;
}

@media (max-width: 820px) {
  .topbar { flex-wrap: wrap; }
  .brand h1 { font-size: 24px; }
  .updated { margin-left: 0; text-align: left; }
  .column-head { display: none; }
  .cell { display: grid; gap: 4px; }
  .due { display: grid; gap: 2px; }
  .cell-label {
    display: block;
    color: #64748b;
    font-size: 11px;
    font-weight: 800;
  }
  .row-main {
    grid-template-columns: 1fr 1fr;
  }
  .title,
  .due,
  .detail-btn { grid-column: 1 / -1; }
  .split { grid-template-columns: 1fr; }
}
