:root {
  color-scheme: light;
  --bg: #ebe7dd;
  --ink: #202124;
  --muted: #6e746d;
  --line: rgba(40, 40, 35, 0.14);
  --surface: rgba(255, 252, 244, 0.78);
  --paper: #fff8d9;
  --paper-2: #f8f0c7;
  --paper-done: #edf0e8;
  --accent: #295f5c;
  --accent-strong: #153d3a;
  --accent-soft: rgba(41, 95, 92, 0.12);
  --danger: #a33a2d;
  --shadow: 0 24px 70px rgba(33, 34, 30, 0.14);
  --paper-shadow: 0 18px 40px rgba(58, 49, 23, 0.14), 0 2px 0 rgba(255, 255, 255, 0.65) inset;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(120deg, rgba(41, 95, 92, 0.14), transparent 32%),
    linear-gradient(315deg, rgba(163, 58, 45, 0.08), transparent 34%),
    radial-gradient(circle at center, rgba(255, 255, 255, 0.55), transparent 58%),
    var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: var(--accent);
  padding: 0 18px;
  cursor: pointer;
}

button:hover {
  background: var(--accent-strong);
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: wait;
  opacity: 0.55;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.84);
  padding: 11px 12px;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

textarea {
  resize: vertical;
}

.shell {
  min-height: 100vh;
}

.login-panel {
  width: min(440px, calc(100vw - 32px));
  margin: 12vh auto 0;
  border: 1px solid rgba(255, 255, 255, 0.64);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 32px;
  backdrop-filter: blur(18px);
}

.login-panel h1,
.title-block h1,
.dialog-card h2,
.empty h2 {
  margin: 0;
}

.login-form {
  display: grid;
  gap: 18px;
  margin-top: 26px;
}

.app {
  width: min(1240px, 100%);
  margin: 0 auto;
  padding: 34px clamp(14px, 4vw, 42px) 92px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(420px, 1.25fr);
  gap: 24px;
  align-items: end;
  padding-bottom: 22px;
}

.title-block h1 {
  font-size: clamp(34px, 5vw, 58px);
  font-weight: 760;
  letter-spacing: 0;
}

.title-block .muted {
  min-height: 22px;
  margin: 8px 0 0;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.muted {
  color: var(--muted);
}

.top-actions {
  display: grid;
  grid-template-columns: minmax(140px, 0.7fr) minmax(170px, 1fr) auto auto;
  gap: 10px;
  align-items: center;
}

.ghost {
  border: 1px solid var(--line);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.58);
}

.ghost:hover {
  color: var(--accent-strong);
  background: rgba(255, 255, 255, 0.86);
}

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

.page-tabs {
  display: flex;
  gap: 10px;
  margin: 6px 0 24px;
}

.page-tab {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 138px;
  border: 1px solid transparent;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.4);
  padding: 0 14px;
}

.page-tab strong {
  display: grid;
  place-items: center;
  min-width: 28px;
  height: 24px;
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.74);
  font-size: 12px;
}

.page-tab:hover,
.page-tab.active {
  border-color: rgba(41, 95, 92, 0.2);
  color: #fff;
  background: var(--accent);
}

.page-tab:hover strong,
.page-tab.active strong {
  color: var(--accent-strong);
}

.note-board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
  align-items: start;
}

.note-card {
  position: relative;
  display: grid;
  gap: 12px;
  min-height: 250px;
  border: 1px solid rgba(118, 100, 48, 0.16);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.38), transparent 36%),
    linear-gradient(90deg, transparent 0, transparent 22px, rgba(117, 97, 38, 0.08) 23px, transparent 24px),
    var(--paper);
  box-shadow: var(--paper-shadow);
  padding: 18px;
}

.note-card::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  width: 42px;
  height: 42px;
  border-radius: 8px 0 8px 0;
  background: linear-gradient(135deg, rgba(130, 107, 45, 0.16), rgba(255, 255, 255, 0.58) 52%, rgba(255, 255, 255, 0));
}

.note-card.done {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.42), transparent 38%),
    var(--paper-done);
}

.note-card.done .todo-title {
  color: var(--muted);
  text-decoration: line-through;
}

.note-pin {
  position: absolute;
  top: 10px;
  left: 50%;
  width: 42px;
  height: 4px;
  border-radius: 999px;
  background: rgba(32, 33, 36, 0.18);
  transform: translateX(-50%);
}

.note-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 6px;
}

.check-wrap {
  position: relative;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
}

.check-wrap input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.fake-check {
  width: 26px;
  height: 26px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.72);
}

.toggle:checked + .fake-check {
  background: var(--accent);
}

.toggle:checked + .fake-check::after {
  content: "";
  display: block;
  width: 7px;
  height: 12px;
  margin: 3px 0 0 8px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.list-pill {
  max-width: 180px;
  overflow: hidden;
  border-radius: 999px;
  color: var(--accent-strong);
  background: rgba(255, 255, 255, 0.64);
  padding: 4px 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 750;
}

.todo-title {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 22px;
  line-height: 1.22;
  letter-spacing: 0;
}

.todo-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 24px;
  color: var(--muted);
  font-size: 13px;
}

.todo-meta span {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.58);
  padding: 4px 8px;
}

.todo-meta .overdue {
  color: var(--danger);
  background: rgba(255, 230, 225, 0.9);
}

.progress-preview {
  min-height: 78px;
  border: 1px dashed rgba(61, 58, 42, 0.22);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.34);
  padding: 11px 12px;
  text-align: left;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.progress-preview:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.56);
}

.progress-preview.has-notes {
  color: var(--ink);
}

.progress-editor {
  display: grid;
  gap: 10px;
}

.progress-editor div {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.todo-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 2px;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 36px;
  min-width: 36px;
  height: 36px;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.54);
  padding: 0;
  font-size: 20px;
  line-height: 1;
}

.icon-button:hover {
  color: var(--accent-strong);
  background: rgba(255, 255, 255, 0.86);
}

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

.empty {
  max-width: 520px;
  margin: 12vh auto 0;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.36);
  padding: 42px;
  text-align: center;
  backdrop-filter: blur(10px);
}

.empty p {
  margin-bottom: 0;
}

.add-fab {
  position: fixed;
  right: clamp(18px, 4vw, 42px);
  bottom: clamp(18px, 4vw, 38px);
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  min-height: 68px;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 50%;
  background: rgba(41, 95, 92, 0.78);
  box-shadow: 0 18px 44px rgba(21, 61, 58, 0.28);
  padding: 0;
  font-size: 38px;
  line-height: 1;
  backdrop-filter: blur(12px);
}

.add-fab:hover {
  background: rgba(21, 61, 58, 0.9);
}

dialog {
  width: min(620px, calc(100vw - 28px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  color: var(--ink);
  background: transparent;
}

dialog::backdrop {
  background: rgba(32, 33, 36, 0.34);
  backdrop-filter: blur(4px);
}

.dialog-card {
  display: grid;
  gap: 16px;
  border: 1px solid rgba(118, 100, 48, 0.16);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
  padding: 22px;
}

.setup-dialog {
  width: min(660px, calc(100vw - 28px));
}

.setup-card {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.38), transparent 42%),
    #fff9df;
}

.setup-copy {
  margin: 0;
  color: var(--ink);
  line-height: 1.65;
}

.setup-note {
  border: 1px solid rgba(41, 95, 92, 0.18);
  border-radius: 8px;
  color: var(--accent-strong);
  background: rgba(41, 95, 92, 0.08);
  padding: 12px 14px;
  line-height: 1.55;
  font-size: 14px;
}

.setup-card #setupState {
  min-height: 20px;
  margin: 0;
}

.help-link {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--accent-strong);
  background: rgba(255, 255, 255, 0.54);
  padding: 0 14px;
  text-decoration: none;
}

.help-link:hover {
  background: rgba(255, 255, 255, 0.86);
}

.dialog-card header,
.dialog-card footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dialog-card footer {
  justify-content: flex-end;
}

.dialog-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

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

.field span,
.login-form span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

@media (max-width: 820px) {
  .app {
    padding-top: 22px;
  }

  .topbar,
  .top-actions,
  .dialog-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: start;
  }

  .page-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .page-tab {
    min-width: 0;
    justify-content: center;
  }
}

@media (max-width: 560px) {
  .note-board {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .note-card {
    min-height: 230px;
  }

  .empty {
    margin-top: 6vh;
    padding: 30px 18px;
  }

  .add-fab {
    width: 60px;
    height: 60px;
    min-height: 60px;
    font-size: 34px;
  }
}
