:root {
  color-scheme: light;
  --blue: #2563eb;
  --blue-deep: #1d4ed8;
  --blue-soft: #dbeafe;
  --ink: #172033;
  --muted: #64748b;
  --line: #d9e2ef;
  --paper: #ffffff;
  --wash: #f4f8fc;
  --success: #0f766e;
  --danger: #b91c1c;
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

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

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1040px, 100%);
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 20px 36px;
}

.hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 0 10px;
}

.date {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 20px;
  font-weight: 700;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  color: var(--blue-deep);
  font-size: clamp(34px, 5vw, 52px);
  line-height: 1.1;
}

.encourage {
  margin-top: 10px;
  color: #334155;
  font-size: 22px;
  font-weight: 700;
}

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

.ghost-button,
.text-button {
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--blue-deep);
  border-radius: 8px;
  padding: 10px 12px;
  min-height: 44px;
  font-weight: 800;
  text-decoration: none;
}

.file-input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 18px 0;
}

.summary-card,
.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 22px rgba(37, 99, 235, 0.07);
}

.summary-card {
  display: grid;
  gap: 8px;
  padding: 22px;
}

.summary-label {
  color: var(--blue);
  font-size: 21px;
  font-weight: 900;
}

.summary-card strong {
  font-size: 44px;
  line-height: 1;
}

.summary-card span:last-child {
  color: var(--muted);
  font-size: 19px;
  font-weight: 700;
}

.panel {
  margin-top: 14px;
  padding: 20px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

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

.danger-text-button {
  color: var(--danger);
}

h2 {
  font-size: 25px;
  line-height: 1.2;
}

.task-list {
  display: grid;
  gap: 10px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.task-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 72px 72px;
  align-items: center;
  gap: 10px;
  min-height: 66px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.check-button {
  width: 38px;
  height: 38px;
  border: 3px solid #8a96a8;
  border-radius: 7px;
  background: #fff;
}

.task-row.completed .check-button {
  border-color: var(--blue);
  background: var(--blue);
}

.task-row.completed .check-button::after {
  content: "✓";
  display: block;
  color: #fff;
  font-size: 28px;
  font-weight: 900;
  line-height: 30px;
  text-align: center;
}

.task-title {
  overflow-wrap: anywhere;
  font-size: 22px;
  font-weight: 800;
}

.task-row.completed .task-title {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-thickness: 2px;
}

.task-row.overdue {
  border-color: #f5c16c;
  background: #fff9ed;
}

.task-row.overdue .task-title {
  color: #92400e;
}

.tomorrow-list {
  margin-top: 12px;
}

.tomorrow-task-row {
  grid-template-columns: minmax(0, 1fr) 72px 72px;
}

.tomorrow-task-row .task-title {
  grid-column: 1;
}

.empty-row {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #fbfdff;
  font-size: 20px;
  font-weight: 800;
}

.icon-button {
  min-width: 64px;
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  background: #eef2f7;
  color: var(--ink);
  font-size: 18px;
  font-weight: 900;
}

.delete-button {
  color: var(--danger);
}

.add-panel h2,
.record-panel h2 {
  margin-bottom: 14px;
}

.panel-note,
.tomorrow-date {
  margin-top: 8px;
  color: var(--muted);
  font-size: 18px;
  font-weight: 800;
}

.add-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px;
  gap: 10px;
}

.sync-panel .section-heading {
  align-items: flex-start;
}

.sync-status {
  margin-top: 8px;
  color: var(--muted);
  font-size: 18px;
  font-weight: 700;
}

.sync-status.connected {
  color: var(--success);
}

.sync-status.error {
  color: var(--danger);
}

.sync-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px;
  gap: 10px;
}

.add-form input,
.sync-form input {
  width: 100%;
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  font-size: 22px;
}

.add-form button,
.sync-form button {
  border: 0;
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
  font-size: 22px;
  font-weight: 900;
}

.record-list {
  display: grid;
  gap: 10px;
}

.record-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.record-date {
  font-size: 21px;
  font-weight: 900;
}

.record-detail {
  color: var(--muted);
  font-size: 18px;
  font-weight: 700;
}

.completed-history-list {
  display: grid;
  gap: 5px;
  margin: 10px 0 0;
  padding-left: 22px;
  color: var(--ink);
  font-size: 18px;
  font-weight: 800;
}

.success-badge {
  align-self: start;
  border-radius: 999px;
  padding: 7px 10px;
  color: var(--success);
  background: #ccfbf1;
  font-weight: 900;
}

.success-badge.pending {
  color: var(--muted);
  background: #eef2f7;
}

@media (max-width: 720px) {
  .app-shell {
    padding-inline: 14px;
  }

  .hero {
    display: grid;
  }

  .hero-actions {
    justify-content: start;
  }

  .summary-grid {
    grid-template-columns: 1fr;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .section-actions {
    width: 100%;
    justify-content: stretch;
  }

  .section-actions .text-button {
    flex: 1 1 120px;
    text-align: center;
  }

  .task-row {
    grid-template-columns: 46px minmax(0, 1fr) 1fr;
    grid-template-areas:
      "check title title"
      "check edit delete";
    gap: 8px;
  }

  .tomorrow-task-row {
    grid-template-columns: minmax(0, 1fr) 1fr;
    grid-template-areas:
      "title title"
      "edit delete";
  }

  .check-button {
    grid-area: check;
    align-self: center;
  }

  .task-title {
    grid-area: title;
  }

  .edit-button {
    grid-area: edit;
  }

  .delete-button {
    grid-area: delete;
  }

  .icon-button {
    width: 100%;
  }

  .task-title {
    font-size: 20px;
  }

  .add-form {
    grid-template-columns: 1fr;
  }

  .sync-form {
    grid-template-columns: 1fr;
  }

  .add-form button,
  .sync-form button {
    min-height: 54px;
  }
}
