:root {
  --bg: #f4fbf4;
  --bg-accent: #d9f0dc;
  --surface: #ffffff;
  --surface-muted: #f0f7f0;
  --text: #1f3425;
  --text-soft: #5f7865;
  --line: #d6e8d7;
  --primary: #65b36d;
  --primary-strong: #499453;
  --danger: #d36161;
  --shadow: 0 18px 40px rgba(68, 126, 79, 0.15);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --touch: 48px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Nunito", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(151, 212, 161, 0.35), transparent 28%),
    linear-gradient(180deg, #fbfffb 0%, var(--bg) 100%);
}

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

button,
select,
input,
textarea {
  border-radius: var(--radius-sm);
}

button {
  min-height: var(--touch);
  border: 0;
  cursor: pointer;
  transition: transform 0.18s ease, background-color 0.18s ease, opacity 0.18s ease;
}

button:hover {
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  padding: 0.9rem 1rem;
}

input:focus,
select:focus,
textarea:focus,
button:focus {
  outline: 3px solid rgba(101, 179, 109, 0.18);
  outline-offset: 2px;
}

textarea {
  resize: vertical;
  min-height: 150px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-shell {
  width: min(100%, 920px);
  margin: 0 auto;
  padding: 24px 16px 120px;
}

.screen {
  min-height: calc(100vh - 48px);
}

.auth-screen {
  display: grid;
  place-items: center;
}

.auth-card,
.panel,
.dialog-card {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(214, 232, 215, 0.9);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.auth-card {
  width: min(100%, 440px);
  padding: 32px 24px;
  border-radius: 32px;
  text-align: center;
}

.leaf-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  background: var(--bg-accent);
  color: var(--primary-strong);
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.auth-card h1,
.hero h2,
.panel h3,
.dialog-heading h3 {
  margin: 0;
}

.auth-card p,
.panel-heading p,
.eyebrow,
#listSummary,
.empty-state p {
  color: var(--text-soft);
}

.pin-form,
.add-form,
.bulk-form,
.dialog-card,
.content {
  display: grid;
  gap: 14px;
}

.pin-form button,
.add-form button,
.bulk-form button,
.dialog-actions button,
.fab {
  background: var(--primary);
  color: #fff;
  font-weight: 800;
}

.ghost-button {
  background: #edf7ee;
  color: var(--primary-strong);
  font-weight: 700;
}

.error-message {
  min-height: 24px;
  color: var(--danger);
  font-weight: 700;
}

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

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

.eyebrow {
  margin: 0 0 6px;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 800;
}

.panel {
  border-radius: var(--radius-lg);
  padding: 18px;
}

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

.panel-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.add-form,
.bulk-form {
  align-items: start;
}

.toggle {
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--text-soft);
  font-weight: 700;
}

.toggle input {
  width: 20px;
  height: 20px;
  padding: 0;
}

.category-list {
  display: grid;
  gap: 14px;
}

.category-section {
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  background: var(--surface);
}

.category-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  color: #fff;
  font-weight: 800;
  text-align: left;
}

.category-body {
  padding: 12px;
  background: #fcfffc;
}

.category-section.collapsed .category-body {
  display: none;
}

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

.item-card {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-muted);
}

.item-main {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.item-name {
  font-weight: 700;
  word-break: break-word;
}

.item-card.checked {
  opacity: 0.62;
  background: #eef2ee;
}

.item-card.checked .item-name {
  text-decoration: line-through;
}

.item-check {
  width: 22px;
  height: 22px;
  accent-color: var(--primary);
  flex: 0 0 auto;
}

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

.small-button {
  min-height: 40px;
  padding: 0 14px;
  font-size: 0.92rem;
  font-weight: 800;
}

.edit-button {
  background: #e6f5e8;
  color: var(--primary-strong);
}

.add-week-button {
  background: #dff2e1;
  color: var(--primary-strong);
}

.add-week-button:disabled {
  background: #edf2ed;
  color: #8b9c8d;
  cursor: default;
  transform: none;
  opacity: 1;
}

.danger-button {
  background: #fdecec;
  color: #af4a4a;
}

.weekly-item .item-main {
  align-items: center;
}

.master-item .item-main {
  display: block;
}

#weeklyPanel {
  border: 2px solid #b8dfbd;
}

.empty-state {
  padding: 20px 6px 6px;
  text-align: center;
}

.fab {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  box-shadow: 0 16px 34px rgba(73, 148, 83, 0.34);
  font-size: 2rem;
}

.edit-dialog {
  width: min(100% - 24px, 420px);
  border: 0;
  padding: 0;
  border-radius: 24px;
}

.edit-dialog::backdrop {
  background: rgba(30, 54, 35, 0.35);
  backdrop-filter: blur(4px);
}

.dialog-card {
  padding: 18px;
}

.dialog-heading,
.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.dialog-card label {
  display: grid;
  gap: 8px;
  font-weight: 700;
}

.icon-button {
  min-height: 36px;
  width: 36px;
  border-radius: 50%;
  background: #eff7f0;
  color: var(--text-soft);
}

@media (min-width: 700px) {
  .content {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }

  .list-panel {
    grid-column: 1 / -1;
  }

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

@media (max-width: 699px) {
  .hero,
  .panel-heading,
  .item-card {
    flex-direction: column;
    align-items: stretch;
  }

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

  .item-actions .small-button,
  .panel-heading .ghost-button {
    width: 100%;
  }

  .hero-actions {
    width: 100%;
  }

  .hero-actions .ghost-button {
    width: 100%;
  }
}
