:root {
  --bg: #fafaf7;
  --ink: #1e2a23;
  --green: #2e6b4f;
  --green-soft: #e4efe9;
  --coffee: #8c5a3a;
  --line: #e7e5df;
  --sub: #7a7f79;
  --alert: #c24e3a;
  --alert-soft: #f9ece8;
  --done: #9aa79f;
  --panel: #ffffff;
  --radius: 14px;
  --tap: 44px;
  --font: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
}

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* —— ゲート —— */
.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.gate__panel,
.modal__panel {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 32px 24px;
}

.gate__eyebrow,
.top__eyebrow {
  margin: 0 0 8px;
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--green);
  font-weight: 700;
}

.gate__title {
  margin: 0;
  font-size: 1.6rem;
}

.gate__hint {
  margin: 10px 0 22px;
  color: var(--sub);
  font-size: 0.95rem;
}

.gate__form {
  display: grid;
  gap: 12px;
}

.gate__form input,
.field input,
.field textarea {
  width: 100%;
  min-height: var(--tap);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
}

.gate__form button,
.btn-primary,
.btn-secondary {
  min-height: var(--tap);
  border: 0;
  border-radius: 10px;
  padding: 0 16px;
  font-weight: 700;
  cursor: pointer;
}

.gate__form button,
.btn-primary {
  background: var(--green);
  color: #fff;
}

.btn-secondary {
  background: var(--green-soft);
  color: var(--green);
}

.gate__error {
  margin: 12px 0 0;
  color: var(--alert);
  font-weight: 700;
}

/* —— アプリ —— */
.app {
  max-width: 560px;
  margin: 0 auto;
  padding: 20px 16px 48px;
}

.top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.top__title {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
}

.top__count {
  text-align: right;
}

.top__remain {
  margin: 0;
  font-size: 34px;
  font-weight: 900;
  line-height: 1;
  color: var(--green);
}

.top__remain.is-urgent {
  color: var(--alert);
}

.top__sub {
  margin: 4px 0 0;
  font-size: 11px;
  color: var(--sub);
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin: 16px 0 12px;
}

.tabs__btn {
  min-height: var(--tap);
  display: grid;
  place-items: center;
  text-decoration: none;
  color: var(--ink);
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  font-weight: 700;
}

.tabs__btn.is-active {
  background: var(--green-soft);
  border-color: var(--green);
  color: var(--green);
}

.status {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--alert-soft);
  color: var(--alert);
  font-size: 13px;
  font-weight: 700;
}

.progress {
  margin-bottom: 14px;
}

.progress__row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--sub);
  margin-bottom: 4px;
}

.progress__row span:last-child {
  font-weight: 700;
  color: var(--ink);
}

.progress__track {
  height: 8px;
  background: var(--line);
  border-radius: 4px;
  overflow: hidden;
}

.progress__bar {
  height: 100%;
  width: 0;
  background: var(--green);
  border-radius: 4px;
  transition: width 0.3s;
}

.rail {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
  margin-bottom: 16px;
  -webkit-overflow-scrolling: touch;
}

.rail__chip {
  flex: 0 0 auto;
  min-width: 64px;
  min-height: var(--tap);
  padding: 8px 6px;
  border-radius: 10px;
  border: 1.5px solid var(--line);
  background: #fff;
  color: var(--ink);
  text-align: center;
  cursor: pointer;
}

.rail__chip.is-active {
  border-color: var(--green);
  background: var(--green-soft);
}

.rail__chip.is-mile {
  border-color: var(--coffee);
}

.rail__chip.is-behind {
  background: var(--alert-soft);
}

.rail__label {
  font-size: 13px;
  font-weight: 800;
}

.rail__dow {
  font-size: 10px;
  color: var(--sub);
}

.rail__chip.is-mile .rail__dow {
  color: var(--coffee);
  font-weight: 700;
}

.rail__meta {
  font-size: 11px;
  margin-top: 2px;
}

.day-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 16px;
}

.day-card__head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.day-card__title {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
}

.badge {
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  background: var(--green);
  border-radius: 99px;
  padding: 3px 8px;
}

.day-card__note {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--sub);
  line-height: 1.6;
}

.note-edit {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}

.task-list {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.task {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  text-align: left;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  cursor: pointer;
  width: 100%;
}

.task.is-critical:not(.is-done) {
  border-color: var(--alert);
}

.task.is-done {
  background: var(--bg);
}

.task__check {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  flex-shrink: 0;
  margin-top: 1px;
  border: 2px solid var(--line);
  background: #fff;
  color: #fff;
  font-size: 14px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
}

.task.is-done .task__check {
  border-color: var(--green);
  background: var(--green);
}

.task__text {
  font-size: 14px;
  line-height: 1.5;
}

.task.is-done .task__text {
  color: var(--done);
  text-decoration: line-through;
}

.task__warn {
  font-size: 10px;
  font-weight: 700;
  color: var(--alert);
  margin-top: 3px;
}

.task__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.task__actions button,
.btn-quiet {
  min-height: var(--tap);
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

.task-edit {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.day-card__done {
  margin: 12px 0 0;
  font-size: 12px;
  color: var(--sub);
  text-align: right;
}

.add-form {
  margin-top: 16px;
  display: grid;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.add-form__title {
  margin: 0;
  font-weight: 800;
}

.add-form__row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
}

.field {
  display: grid;
  gap: 6px;
}

.field span {
  font-size: 12px;
  color: var(--sub);
  font-weight: 700;
}

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

.check-field input {
  width: 20px;
  height: 20px;
}

.critical-path {
  margin: 16px 0 0;
  font-size: 12px;
  color: var(--sub);
  line-height: 1.7;
}

.critical-path__mark {
  color: var(--alert);
  font-weight: 700;
}

.foot {
  margin-top: 20px;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(30, 42, 35, 0.35);
  display: grid;
  place-items: center;
  padding: 24px;
}

.modal__panel {
  display: grid;
  gap: 12px;
}

.empty {
  margin: 8px 0 0;
  color: var(--sub);
  font-size: 13px;
}
