:root {
  --bg-top: #f6efe5;
  --bg-bottom: #dcefe3;
  --surface: rgba(255, 252, 247, 0.82);
  --surface-strong: #fffdfa;
  --text: #213128;
  --muted: #66776d;
  --line: rgba(40, 68, 52, 0.14);
  --brand: #1f8f63;
  --brand-deep: #16563f;
  --accent: #f3b34f;
  --shadow: 0 22px 50px rgba(35, 71, 53, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Gowun Dodum", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.92), transparent 26%),
    linear-gradient(135deg, var(--bg-top) 0%, #eef7ef 45%, var(--bg-bottom) 100%);
}

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

button {
  cursor: pointer;
}

.app-shell {
  max-width: 1360px;
  margin: 0 auto;
  padding: 36px 24px 48px;
}

.session-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  padding: 11px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  box-shadow: 0 12px 28px rgba(42, 90, 57, 0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.back-link:hover,
.back-link:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 16px 32px rgba(42, 90, 57, 0.12);
}

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

.sync-status,
.storage-mode,
.user-pill {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  box-shadow: 0 12px 28px rgba(42, 90, 57, 0.08);
}

.storage-mode {
  font-weight: 700;
  color: var(--text);
}

.sync-status.is-error {
  color: #8e4d2b;
  border-color: rgba(172, 99, 64, 0.26);
  background: rgba(255, 241, 233, 0.86);
}

.secondary-button,
.auth-link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--text);
  text-decoration: none;
  box-shadow: 0 10px 24px rgba(45, 36, 24, 0.08);
}

#logoutButton[hidden] {
  display: none;
}

.hero {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 24px;
  margin-top: 18px;
  margin-bottom: 26px;
}

.hero-copy,
.summary-panel,
.panel {
  border: 1px solid var(--line);
  border-radius: 30px;
  background: var(--surface);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.hero-copy {
  padding: 32px;
}

.eyebrow {
  margin: 0 0 10px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.8rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--brand-deep);
}

.hero h1 {
  margin: 0;
  font-size: clamp(2rem, 3vw, 3.6rem);
  line-height: 1.08;
}

.hero p {
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.summary-panel {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  padding: 24px;
  align-content: center;
}

.summary-label {
  margin: 0 0 8px;
  color: var(--muted);
}

.summary-value {
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(1.8rem, 4vw, 3rem);
}

.layout {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.panel {
  padding: 28px;
}

.panel-header h2,
.bucket-top h3 {
  margin: 0;
}

.panel-header p {
  margin: 8px 0 0;
  color: var(--muted);
}

.bucket-form {
  display: grid;
  gap: 18px;
  margin-top: 22px;
}

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

.field span,
.filter-wrap span {
  font-size: 0.95rem;
  color: var(--muted);
}

.field input,
.field select,
.field textarea,
.filter-wrap select {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--text);
  outline: none;
}

.field textarea {
  resize: vertical;
  min-height: 120px;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.filter-wrap select:focus {
  box-shadow: 0 0 0 3px rgba(31, 143, 99, 0.16);
}

.check-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
}

.primary-button,
.delete-button,
.edit-button {
  border: 0;
  border-radius: 18px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.primary-button {
  padding: 14px 18px;
  background: linear-gradient(135deg, var(--brand) 0%, #2ca577 100%);
  color: white;
  box-shadow: 0 16px 28px rgba(31, 143, 99, 0.24);
}

.primary-button:hover,
.primary-button:focus-visible,
.edit-button:hover,
.edit-button:focus-visible,
.delete-button:hover,
.delete-button:focus-visible {
  transform: translateY(-1px);
}

.filters-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 24px;
  align-items: end;
}

.filter-wrap {
  min-width: 0;
}

.toggle-filter {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--text);
}

.toggle-filter input {
  width: 18px;
  height: 18px;
  margin: 0;
}

.bucket-list {
  display: grid;
  gap: 16px;
  margin-top: 24px;
}

.bucket-item,
.empty-state {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(247, 251, 247, 0.96));
}

.bucket-item {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
}

.bucket-view {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  width: 100%;
}

.bucket-main {
  display: flex;
  gap: 14px;
  min-width: 0;
}

.bucket-check {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin-top: 4px;
}

.bucket-check input {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.custom-check {
  width: 28px;
  height: 28px;
  border: 2px solid rgba(31, 143, 99, 0.38);
  border-radius: 10px;
  background: white;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.bucket-check input:checked + .custom-check {
  background: linear-gradient(135deg, var(--brand), #37ba88);
  border-color: transparent;
}

.bucket-check input:checked + .custom-check::after {
  content: "";
  position: absolute;
  width: 7px;
  height: 13px;
  border: solid white;
  border-width: 0 3px 3px 0;
  transform: rotate(45deg);
  top: 5px;
  left: 10px;
}

.bucket-content {
  min-width: 0;
}

.bucket-top {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.item-category,
.item-status {
  display: inline-flex;
  align-items: center;
  padding: 6px 11px;
  border-radius: 999px;
  font-size: 0.82rem;
}

.item-category {
  background: rgba(243, 179, 79, 0.18);
  color: #8a5a0d;
}

.item-title {
  font-size: 1.2rem;
}

.item-deadline,
.item-note {
  margin: 10px 0 0;
  color: var(--muted);
}

.item-deadline {
  font-weight: 700;
  color: var(--brand-deep);
}

.item-note {
  margin-top: 8px;
  line-height: 1.65;
  word-break: break-word;
}

.bucket-actions {
  display: grid;
  justify-items: end;
  align-content: space-between;
  gap: 16px;
}

.action-buttons {
  display: flex;
  gap: 10px;
}

.item-status {
  background: rgba(31, 143, 99, 0.12);
  color: var(--brand-deep);
}

.bucket-item.is-complete .item-title,
.bucket-item.is-complete .item-note {
  opacity: 0.65;
}

.bucket-item.is-complete .item-title {
  text-decoration: line-through;
}

.delete-button {
  padding: 10px 14px;
  background: rgba(133, 52, 30, 0.08);
  color: #8b4b34;
}

.edit-button {
  padding: 10px 14px;
  background: rgba(31, 143, 99, 0.12);
  color: var(--brand-deep);
}

.edit-form {
  display: grid;
  gap: 16px;
  width: 100%;
}

.edit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

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

.hidden {
  display: none;
}

.empty-state {
  padding: 32px 24px;
  text-align: center;
  color: var(--muted);
}

@media (max-width: 960px) {
  .hero,
  .layout {
    grid-template-columns: 1fr;
  }

  .filters-grid,
  .bucket-item {
    grid-template-columns: 1fr;
  }

  .bucket-item {
    flex-direction: column;
  }

  .bucket-view,
  .edit-grid,
  .action-buttons,
  .edit-actions {
    flex-direction: column;
    grid-template-columns: 1fr;
  }

  .bucket-actions {
    justify-items: start;
  }
}

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

  .hero-copy,
  .summary-panel,
  .panel {
    padding: 22px;
    border-radius: 24px;
  }

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