:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --ink: #1e2528;
  --muted: #667174;
  --line: #d9ded8;
  --panel: #ffffff;
  --accent: #176b5d;
  --accent-strong: #0f4c42;
  --urgent: #c2412d;
  --warn: #b26b00;
  --danger-bg: #fde7e2;
  --danger-line: #e25a43;
  --warning-bg: #fff4cf;
  --warning-line: #d49a18;
  --done: #7b8586;
  --shadow: 0 18px 45px rgba(28, 39, 42, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  background: var(--bg);
  color: var(--ink);
}

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

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  padding: 24px;
}

.workspace {
  width: min(1180px, 100%);
  margin: 0 auto;
}

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

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(32px, 5vw, 58px);
  line-height: 1;
  letter-spacing: 0;
}

.today-card {
  min-width: 116px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  text-align: right;
  box-shadow: var(--shadow);
}

.today-card span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.today-card strong {
  display: block;
  margin-top: 2px;
  color: var(--accent-strong);
  font-size: 26px;
}

.webapp-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  padding: 12px 14px;
  border: 1px solid #9bc5bb;
  border-radius: 8px;
  background: #e6f0ed;
  color: var(--accent-strong);
}

.sync-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  margin-bottom: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.sync-panel strong {
  display: block;
  margin-bottom: 3px;
}

.sync-panel span {
  color: var(--muted);
  font-size: 13px;
}

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

.sync-actions input {
  width: 180px;
}

.webapp-banner strong {
  display: block;
  margin-bottom: 2px;
}

.webapp-banner span {
  color: #43615b;
  font-size: 13px;
}

.composer,
.quick-organizer,
.task-panel,
.daily-panel,
.calendar-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.composer {
  padding: 18px;
}

.quick-organizer {
  margin-top: 18px;
  padding: 18px;
}

form {
  display: grid;
  grid-template-columns: minmax(240px, 2fr) repeat(3, minmax(140px, 1fr)) minmax(110px, auto);
  gap: 14px;
  align-items: end;
}

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

.field-wide {
  grid-column: span 1;
}

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

.daily-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfa;
  padding: 0 12px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
}

.daily-toggle input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--accent);
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfa;
  color: var(--ink);
  outline: none;
  padding: 10px 12px;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(23, 107, 93, 0.15);
}

.primary-action,
.ghost-action,
.segment,
.file-button {
  min-height: 44px;
  border-radius: 6px;
  border: 1px solid transparent;
  padding: 0 16px;
  font-weight: 800;
}

.form-actions {
  display: flex;
  gap: 8px;
}

.primary-action {
  background: var(--accent);
  color: #fff;
}

.primary-action:hover {
  background: var(--accent-strong);
}

.control-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 18px 0;
}

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.segment,
.ghost-action,
.file-button {
  background: #fff;
  color: var(--ink);
  border-color: var(--line);
}

.segment.active,
.ghost-action:hover,
.file-button:hover {
  background: #e6f0ed;
  border-color: #9bc5bb;
  color: var(--accent-strong);
}

.hidden {
  display: none !important;
}

.organizer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 14px;
  align-items: end;
}

.organizer-input {
  min-width: 0;
}

.organizer-actions {
  display: grid;
  gap: 10px;
}

.organizer-actions p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.file-button {
  display: grid;
  place-items: center;
  text-align: center;
}

.file-button input {
  display: none;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
}

.task-panel,
.daily-panel,
.calendar-panel {
  min-height: 360px;
  padding: 18px;
}

.daily-panel {
  min-height: 0;
}

.side-stack {
  display: grid;
  gap: 18px;
  align-content: start;
}

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

.section-heading h2 {
  font-size: 20px;
}

.section-heading span {
  color: var(--muted);
  font-size: 13px;
}

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

.task-item {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto 34px;
  gap: 12px;
  align-items: start;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.task-item.due-warning,
.daily-item.due-warning {
  border-color: var(--warning-line);
  background: var(--warning-bg);
}

.task-item.due-danger,
.daily-item.due-danger {
  border-color: var(--danger-line);
  background: var(--danger-bg);
}

.task-item.is-done {
  opacity: 0.66;
}

.task-item.is-done h3 {
  text-decoration: line-through;
}

.check-button {
  width: 28px;
  height: 28px;
  border: 2px solid #9aa6a6;
  border-radius: 50%;
  background: #fff;
}

.task-item.is-done .check-button {
  border-color: var(--accent);
  background: var(--accent);
}

.task-item.is-done .check-button::after {
  content: "✓";
  color: #fff;
  font-weight: 900;
}

.task-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.task-title-row h3 {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 17px;
}

.type-pill {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 4px 8px;
  background: #edf3f1;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
}

.task-memo {
  margin-top: 6px;
  color: var(--muted);
  overflow-wrap: anywhere;
  font-size: 14px;
}

.task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.meta-chip {
  border-radius: 999px;
  padding: 5px 9px;
  background: #f1f4f1;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.meta-chip.urgent {
  background: #fcebe7;
  color: var(--urgent);
}

.meta-chip.warn {
  background: #fff2d9;
  color: var(--warn);
}

.edit-button,
.delete-button {
  height: 28px;
  border: 0;
  background: transparent;
}

.edit-button {
  align-self: center;
  border-radius: 999px;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 900;
  padding: 0 8px;
}

.edit-button:hover {
  background: #e6f0ed;
}

.delete-button {
  width: 28px;
  border-radius: 50%;
  color: #9aa1a2;
  font-size: 24px;
  line-height: 1;
}

.delete-button:hover {
  background: #f1e4e1;
  color: var(--urgent);
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 220px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.empty-state.small {
  min-height: 130px;
}

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

.daily-item {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.daily-item strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 15px;
}

.daily-check {
  width: 26px;
  height: 26px;
  border: 2px solid #9aa6a6;
  border-radius: 6px;
  background: #fff;
}

.daily-item.is-checked {
  opacity: 0.72;
}

.daily-item.is-checked strong {
  text-decoration: line-through;
}

.daily-item.is-checked .daily-check {
  border-color: var(--accent);
  background: var(--accent);
}

.daily-item.is-checked .daily-check::after {
  content: "✓";
  color: #fff;
  font-weight: 900;
}

.timeline {
  display: grid;
  gap: 10px;
}

.timeline-item {
  border-left: 3px solid var(--accent);
  padding: 8px 0 8px 12px;
}

.timeline-date {
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 900;
}

.timeline-title {
  margin-top: 4px;
  overflow-wrap: anywhere;
  font-weight: 800;
}

@media (max-width: 900px) {
  .app-shell {
    padding: 16px;
  }

  form,
  .organizer-grid,
  .content-grid {
    grid-template-columns: 1fr;
  }

  .control-strip,
  .webapp-banner,
  .sync-panel,
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

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

  .sync-actions {
    justify-content: stretch;
  }

  .sync-actions input,
  .sync-actions button {
    width: 100%;
  }

  .today-card {
    text-align: left;
  }
}

@media (max-width: 520px) {
  .composer,
  .quick-organizer,
  .task-panel,
  .daily-panel,
  .calendar-panel {
    padding: 14px;
  }

  .section-heading,
  .task-title-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .task-item {
    grid-template-columns: 30px minmax(0, 1fr) 42px 30px;
    gap: 9px;
  }
}
