:root {
  --ink: #1a2421;
  --muted: #5c6b66;
  --paper: #f3f6f4;
  --panel: rgba(255, 255, 255, 0.82);
  --line: rgba(26, 36, 33, 0.12);
  --accent: #0f6b5c;
  --accent-deep: #0a4f44;
  --danger: #b42318;
  --done: #6b7c76;
  --shadow: 0 18px 50px rgba(15, 40, 34, 0.12);
  --radius: 18px;
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "DM Sans", system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.5;
}

a {
  color: inherit;
}

button,
input {
  font: inherit;
}

.brand-mark {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(3rem, 8vw, 4.75rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--ink);
}

.brand-mark.compact {
  font-size: 1.65rem;
}

.site-footer {
  position: relative;
  z-index: 1;
  padding: 1.25rem 1.5rem 1.75rem;
  text-align: center;
}

.auth-footer {
  margin-top: auto;
  padding-top: 2rem;
}

.site-footer a {
  color: var(--muted);
  font-size: 0.875rem;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.site-footer a:hover {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

.btn-primary,
.btn-ghost {
  border: 0;
  cursor: pointer;
  transition: transform 0.18s ease, background 0.18s ease, opacity 0.18s ease;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-radius: 999px;
  padding: 0.85rem 1.4rem;
  font-weight: 600;
}

.btn-primary:hover {
  background: var(--accent-deep);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  padding: 0.4rem 0.7rem;
  border-radius: 8px;
}

.btn-ghost:hover {
  color: var(--ink);
  background: rgba(26, 36, 33, 0.06);
}

/* ---- Auth / login ---- */
.auth-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden;
}

.auth-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse 80% 55% at 15% 20%, rgba(15, 107, 92, 0.18), transparent 55%),
    radial-gradient(ellipse 70% 50% at 90% 10%, rgba(196, 154, 88, 0.16), transparent 50%),
    linear-gradient(165deg, #e8efeb 0%, #f7f4ee 45%, #e4ebe7 100%);
  animation: drift 18s ease-in-out infinite alternate;
}

@keyframes drift {
  from { transform: scale(1) translate(0, 0); }
  to { transform: scale(1.04) translate(-1.5%, 1%); }
}

.auth-shell {
  position: relative;
  z-index: 1;
  flex: 1;
  display: grid;
  align-content: center;
  gap: 2.5rem;
  width: min(920px, calc(100% - 2.5rem));
  margin: 0 auto;
  padding: 3.5rem 0 2rem;
}

.auth-brand {
  animation: rise 0.7s ease both;
}

.auth-headline {
  margin: 1rem 0 0.5rem;
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 3.2vw, 1.85rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  max-width: 16ch;
}

.auth-sub {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
}

.auth-panel {
  width: min(420px, 100%);
  background: var(--panel);
  backdrop-filter: blur(14px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.35rem 1.35rem 1.5rem;
  animation: rise 0.85s ease 0.12s both;
}

.auth-panel-title {
  margin: 0 0 1.1rem;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.auth-form {
  display: grid;
  gap: 0.95rem;
}

.auth-form label {
  display: grid;
  gap: 0.35rem;
}

.auth-form label span {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 500;
}

.auth-form input,
.todo-form input {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 0.8rem 0.95rem;
  color: var(--ink);
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.auth-form input:focus,
.todo-form input:focus {
  border-color: rgba(15, 107, 92, 0.45);
  box-shadow: 0 0 0 3px rgba(15, 107, 92, 0.12);
}

.form-error {
  margin: 0;
  color: var(--danger);
  font-size: 0.875rem;
}

.auth-form .btn-primary {
  width: 100%;
  margin-top: 0.25rem;
}

/* ---- App / todos ---- */
.app-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
}

.app-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse 60% 40% at 80% 0%, rgba(15, 107, 92, 0.12), transparent 55%),
    linear-gradient(180deg, #eef3f0 0%, #f7f5f0 100%);
}

.app-top,
.app-main,
.app-page .site-footer {
  position: relative;
  z-index: 1;
}

.app-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(720px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.5rem 0 0.5rem;
  animation: rise 0.55s ease both;
}

.user-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.app-main {
  flex: 1;
  width: min(720px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1rem 0 2.5rem;
}

.compose {
  margin-bottom: 2rem;
  animation: rise 0.65s ease 0.05s both;
}

.app-title {
  margin: 0 0 1rem;
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.todo-form {
  display: grid;
  gap: 0.65rem;
}

.due-field {
  display: grid;
  gap: 0.3rem;
}

.due-field span {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 500;
}

.todo-form .btn-primary {
  justify-self: start;
  padding-inline: 1.6rem;
  align-self: end;
}

.todo-section {
  animation: rise 0.75s ease 0.12s both;
}

.empty-hint {
  color: var(--muted);
  margin: 0.5rem 0;
}

.todo-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.65rem;
}

.todo-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.85rem;
  align-items: start;
  padding: 1rem 1.05rem;
  border-bottom: 1px solid var(--line);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.todo-item.is-entering {
  animation: rise 0.35s ease both;
}

.todo-item.is-done .todo-body {
  opacity: 0.55;
}

.todo-item.is-done .todo-title {
  text-decoration: line-through;
  color: var(--done);
}

.todo-item.is-overdue .due-text {
  color: var(--danger);
  font-weight: 600;
}

.todo-check {
  width: 1.25rem;
  height: 1.25rem;
  margin-top: 0.2rem;
  accent-color: var(--accent);
  cursor: pointer;
}

.todo-title {
  margin: 0;
  font-weight: 600;
  font-size: 1.05rem;
}

.todo-desc {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.todo-meta {
  margin: 0.45rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.meta-sep {
  opacity: 0.5;
}

.todo-actions {
  display: flex;
  gap: 0.15rem;
}

.todo-actions button {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0.25rem 0.45rem;
  border-radius: 6px;
  font-size: 0.85rem;
}

.todo-actions button:hover {
  color: var(--danger);
  background: rgba(180, 35, 24, 0.08);
}

@media (min-width: 800px) {
  .auth-shell {
    grid-template-columns: 1.1fr 0.9fr;
    align-items: center;
    gap: 3.5rem;
  }

  .todo-form {
    grid-template-columns: 1.2fr 1fr minmax(150px, 0.7fr) auto;
    align-items: end;
  }
}

@media (max-width: 799px) {
  .auth-shell {
    padding-top: 2.25rem;
  }

  .auth-headline {
    max-width: none;
  }
}
