:root {
  --ink: #17261f;
  --muted: #6c7871;
  --paper: #f4f1e9;
  --card: #fffdf8;
  --line: #dcd8cd;
  --green: #28634a;
  --green-light: #dce9dd;
  --orange: #df704d;
  --shadow: 0 18px 50px rgba(34, 53, 43, 0.08);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
.auth-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: min(420px, 100%); padding: 38px; border-radius: 22px; text-align: center; }
.auth-card .brand-mark { margin: 0 auto 24px; }
.auth-card h1 { margin: 0 0 12px; font-size: 42px; }
.auth-card > p:not(.eyebrow) { color: var(--muted); font-size: 13px; }
.auth-card input { width: 100%; margin: 18px 0 12px; padding: 13px; border: 1px solid var(--line); border-radius: 10px; background: #faf8f2; }
.auth-card .primary-button { width: 100%; }
.auth-error { min-height: 20px; color: var(--orange) !important; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 5% 0%, rgba(223, 112, 77, .12), transparent 25rem),
    var(--paper);
  font-family: "Yu Gothic UI", "Hiragino Sans", system-ui, sans-serif;
}
button, input, select { font: inherit; }
button { cursor: pointer; }

.topbar {
  height: 72px;
  display: flex;
  align-items: center;
  padding: 0 max(24px, calc((100vw - 1080px) / 2));
  gap: 24px;
  border-bottom: 1px solid rgba(23, 38, 31, .1);
  background: rgba(244, 241, 233, .75);
  backdrop-filter: blur(18px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-size: 20px; font-weight: 800; }
.brand-mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; color: #fff; background: var(--green); font-family: Georgia, serif; }
.connection { margin-left: auto; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
#connection-dot { width: 8px; height: 8px; border-radius: 50%; background: #b7b7b7; }
#connection-dot.online { background: #47a76c; box-shadow: 0 0 0 4px rgba(71, 167, 108, .12); }
.ghost-button, .text-button { border: 0; color: var(--green); background: transparent; font-weight: 700; }
.ghost-button { padding: 9px 14px; border: 1px solid rgba(40, 99, 74, .3); border-radius: 20px; }

main { width: min(1080px, calc(100% - 40px)); margin: 0 auto; padding: 64px 0 90px; }
.hero { display: flex; justify-content: space-between; align-items: end; margin-bottom: 44px; }
.eyebrow { margin: 0 0 12px; color: var(--orange); font: 700 12px/1.2 system-ui; letter-spacing: .2em; }
h1 { margin: 0; font: 700 clamp(42px, 7vw, 76px)/.98 Georgia, "Yu Mincho", serif; letter-spacing: -.04em; }
h1 em { color: var(--green); font-style: italic; }
.hero-copy { margin: 22px 0 0; color: var(--muted); }
.date-card { width: 150px; height: 150px; padding: 24px; display: flex; flex-direction: column; justify-content: center; color: #fff; background: var(--green); border-radius: 50%; transform: rotate(4deg); box-shadow: var(--shadow); text-align: center; }
.date-card strong { font: 700 48px/1 Georgia, serif; }
.date-card span { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; }

.card { background: var(--card); border: 1px solid rgba(23, 38, 31, .1); box-shadow: var(--shadow); }
.composer { padding: 28px; border-radius: 20px; }
.form-main label, .form-row label { display: block; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .08em; }
.form-main input { width: 100%; padding: 10px 0 15px; border: 0; border-bottom: 1px solid var(--line); outline: none; color: var(--ink); background: transparent; font-size: 24px; font-weight: 700; }
.form-main input:focus { border-color: var(--green); }
.form-row { display: grid; grid-template-columns: 1.5fr 1fr auto; gap: 18px; align-items: end; margin-top: 20px; }
.form-row input, .form-row select { width: 100%; margin-top: 7px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: #faf8f2; }
.primary-button { border: 0; padding: 13px 20px; border-radius: 10px; color: white; background: var(--orange); font-weight: 800; box-shadow: 0 8px 20px rgba(223, 112, 77, .22); }
.primary-button span { font-size: 19px; }

.toolbar { margin: 34px 0 18px; display: flex; justify-content: space-between; align-items: center; }
.tabs { display: flex; gap: 5px; }
.tab { border: 0; padding: 9px 14px; border-radius: 20px; color: var(--muted); background: transparent; font-weight: 700; }
.tab.active { color: var(--green); background: var(--green-light); }
.tab span { display: inline-grid; place-items: center; min-width: 20px; height: 20px; margin-left: 4px; border-radius: 10px; color: #fff; background: var(--green); font-size: 11px; }
.todo-list { display: grid; gap: 12px; }
.todo-card { display: flex; align-items: center; gap: 16px; padding: 20px; border-radius: 14px; transition: transform .18s, opacity .18s; }
.todo-card:hover { transform: translateY(-2px); }
.todo-card.completed { opacity: .55; }
.todo-card.completed h2 { text-decoration: line-through; }
.check-button { flex: 0 0 25px; height: 25px; border: 2px solid #b9c1bc; border-radius: 50%; background: transparent; }
.completed .check-button { border-color: var(--green); background: var(--green); }
.completed .check-button::after { content: "✓"; color: white; }
.todo-content { min-width: 0; flex: 1; }
.todo-title-row { display: flex; align-items: center; gap: 9px; }
.todo-title-row h2 { overflow: hidden; margin: 0; font-size: 16px; white-space: nowrap; text-overflow: ellipsis; }
.priority-badge { width: 7px; height: 7px; border-radius: 50%; background: transparent; }
.priority-badge.high { background: var(--orange); }
.priority-badge.low { background: #80a9b7; }
.todo-date { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.todo-date.overdue { color: var(--orange); font-weight: 700; }
.delete-button, .archive-button { opacity: 0; border: 0; color: var(--orange); background: transparent; font-size: 12px; font-weight: 700; transition: opacity .18s; }
.archive-button { color: var(--green); }
.todo-card:hover .delete-button, .todo-card:hover .archive-button { opacity: 1; }
.empty-state { padding: 60px 20px; text-align: center; color: var(--muted); }
.empty-state h2 { color: var(--ink); }
.empty-check { display: grid; place-items: center; width: 48px; height: 48px; margin: auto; border-radius: 50%; color: white; background: var(--green); font-size: 24px; }
.toast { position: fixed; right: 24px; bottom: 24px; padding: 13px 18px; border-radius: 10px; color: #fff; background: var(--ink); box-shadow: var(--shadow); opacity: 0; transform: translateY(10px); pointer-events: none; transition: .2s; }
.toast.show { opacity: 1; transform: translateY(0); }
.shopping-section { margin-top: 80px; padding-top: 46px; border-top: 1px solid var(--line); }
.section-heading { display: flex; justify-content: space-between; align-items: end; margin-bottom: 20px; }
.section-heading h2 { margin: 0; font: 700 32px/1.1 Georgia, "Yu Mincho", serif; }
.section-heading h2 span { display: inline-grid; place-items: center; min-width: 28px; height: 28px; border-radius: 50%; color: white; background: var(--orange); font: 700 12px/1 system-ui; vertical-align: middle; }
.section-heading > p { margin: 0; color: var(--muted); font-size: 13px; }
.shopping-composer { display: grid; grid-template-columns: 1fr 1.4fr 260px auto; gap: 14px; align-items: end; padding: 20px; border-radius: 16px; }
.shopping-composer > input, .shopping-composer textarea, .shopping-composer label input { width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: #faf8f2; resize: vertical; }
.shopping-composer label { color: var(--muted); font-size: 12px; font-weight: 700; }
.shopping-composer label input { display: block; margin-top: 6px; }
.shopping-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 18px; align-items: start; }
.shopping-list-card { padding: 20px; border-radius: 16px; }
.shopping-list-header { display: flex; justify-content: space-between; gap: 10px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.shopping-list-header h3 { margin: 0 0 5px; font-size: 20px; }
.shopping-list-header p { margin: 0 0 7px; color: var(--green); font-size: 12px; font-weight: 700; }
.shopping-list-header small { display: block; color: var(--muted); font-size: 10px; line-height: 1.5; }
.shopping-list-header .delete-button, .shopping-list-header .archive-button { opacity: 1; align-self: start; }
.shopping-items { display: grid; gap: 3px; padding: 12px 0; }
.shopping-item { min-width: 0; display: flex; align-items: center; gap: 10px; padding: 8px 4px; border: 0; color: var(--ink); background: transparent; text-align: left; }
.shopping-check { flex: 0 0 24px; height: 24px; display: grid; place-items: center; border: 2px solid #b9c1bc; border-radius: 7px; color: transparent; }
.shopping-item.completed { opacity: .45; }
.shopping-item.completed .shopping-check { color: white; border-color: var(--green); background: var(--green); }
.shopping-item.completed span:last-child { text-decoration: line-through; text-decoration-thickness: 2px; }
.shopping-item-form { display: flex; gap: 7px; padding-top: 12px; border-top: 1px solid var(--line); }
.shopping-item-form input { min-width: 0; flex: 1; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: #faf8f2; }
.shopping-item-form button { width: 38px; border: 0; border-radius: 8px; color: white; background: var(--green); font-weight: 800; }
.shopping-empty { margin: 20px 0 0; color: var(--muted); font-size: 13px; text-align: center; }
.archive-page { min-height: 65vh; }
.archive-heading { display: flex; justify-content: space-between; align-items: end; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.archive-heading h2 { margin: 0; font: 700 44px/1 Georgia, "Yu Mincho", serif; }
.archive-copy { margin: 16px 0 28px; color: var(--muted); font-size: 13px; }
.archive-list { display: grid; gap: 12px; }
.archive-card { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 20px; border-radius: 14px; }
.archive-card h3 { margin: 4px 0; font-size: 16px; }
.archive-card small { color: var(--muted); }
.archive-type { color: var(--orange); font-size: 10px; font-weight: 800; letter-spacing: .12em; }
.archive-actions { display: flex; gap: 8px; }
.archive-actions button { padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: transparent; font-weight: 700; }
.archive-actions .restore-button { color: var(--green); }
.archive-actions .delete-button { opacity: 1; color: var(--orange); }

@media (max-width: 680px) {
  .topbar { height: 62px; padding: 0 16px; gap: 10px; }
  .connection { display: none; }
  .ghost-button { margin-left: auto; padding: 7px 10px; font-size: 12px; }
  main { width: min(100% - 28px, 1080px); padding-top: 38px; }
  .hero { align-items: start; margin-bottom: 30px; }
  .hero-copy { max-width: 230px; font-size: 13px; }
  .date-card { width: 82px; height: 82px; padding: 10px; }
  .date-card strong { font-size: 28px; }
  .date-card span { font-size: 8px; }
  .composer { padding: 20px; }
  .form-main input { font-size: 19px; }
  .form-row { grid-template-columns: 1fr 1fr; }
  .primary-button { grid-column: 1 / -1; }
  .delete-button, .archive-button { opacity: 1; }
  .shopping-section { margin-top: 58px; }
  .section-heading { display: block; }
  .section-heading > p { margin-top: 8px; }
  .shopping-composer { grid-template-columns: 1fr; }
  .shopping-list { grid-template-columns: 1fr; }
  .archive-card { align-items: start; }
  .archive-actions { display: grid; }
}
