:root {
  --cream: #f6efe3;
  --paper: #fffaf2;
  --ink: #40352f;
  --muted: #786c64;
  --line: rgba(79, 62, 50, 0.12);
  --forest: #486b50;
  --blue: #7896ae;
  --pink: #dca5af;
  --purple: #b4a8ce;
  --shadow: 0 18px 48px rgba(79, 62, 50, 0.12);
  --radius: 26px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(rgba(255, 250, 242, 0.8), rgba(255, 250, 242, 0.94)),
    repeating-linear-gradient(0deg, transparent 0 24px, rgba(72, 107, 80, 0.04) 24px 25px),
    repeating-linear-gradient(90deg, transparent 0 24px, rgba(120, 150, 174, 0.04) 24px 25px),
    var(--cream);
  font-family: Georgia, "Times New Roman", serif;
}

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

.app-header,
.app-shell {
  width: min(1240px, calc(100% - 36px));
  margin-inline: auto;
}

.app-header {
  display: flex;
  justify-content: space-between;
  gap: 28px;
  align-items: end;
  padding: 46px 0 28px;
}

.eyebrow,
.section-label {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 10px; font-size: clamp(2.5rem, 6vw, 5rem); line-height: 0.95; }
h2 { margin-bottom: 0; font-size: clamp(2rem, 4vw, 3.25rem); line-height: 1; }
h3 { margin-bottom: 9px; font-size: 1.45rem; }

.header-copy {
  max-width: 58ch;
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.6;
}

.header-actions,
.button-row,
.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.button,
.zone-tab,
.nav-item,
.icon-button,
.text-button {
  appearance: none;
  border: 0;
  cursor: pointer;
}

.button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-weight: 700;
}

.button-primary { color: #fff; background: var(--forest); box-shadow: 0 10px 24px rgba(72, 107, 80, 0.2); }
.button-quiet { background: rgba(255, 255, 255, 0.72); }
.button-danger { color: #fff; background: #9c514e; }

.zone-tabs {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  gap: 9px;
  padding: 12px 0;
  overflow-x: auto;
  background: rgba(246, 239, 227, 0.88);
  backdrop-filter: blur(18px);
  scrollbar-width: none;
}

.zone-tabs::-webkit-scrollbar { display: none; }

.zone-tab {
  flex: 0 0 auto;
  padding: 11px 15px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
}

.zone-tab.active { color: #fff; background: var(--forest); }
.zone-work.active { background: var(--forest); }
.zone-ever.active { background: var(--blue); }
.zone-family.active { color: #56343b; background: var(--pink); }
.zone-personal.active { color: #3d3153; background: var(--purple); }

.view { display: none; padding: 28px 0 110px; }
.view.active { display: block; animation: rise 240ms ease; }

@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.intro-row {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: end;
  margin-bottom: 22px;
}

.save-state,
.status-line {
  color: var(--muted);
  font-size: 0.88rem;
}

.zone-grid,
.content-grid,
.settings-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 18px;
}

.zone-card,
.paper-card,
.item-card {
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.zone-card {
  position: relative;
  grid-column: span 6;
  min-height: 390px;
  overflow: hidden;
  padding: 22px;
  border-radius: var(--radius);
}

.zone-card::before {
  content: "";
  position: absolute;
  top: 13px;
  left: 28px;
  width: 82px;
  height: 17px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.4);
  transform: rotate(-3deg);
}

.zone-card.work { color: #fffaf2; background: linear-gradient(145deg, #476b50, #8ba482); }
.zone-card.ever { color: #fff; background: linear-gradient(145deg, #7896ae, #b7cad8); }
.zone-card.family { color: #5c3740; background: linear-gradient(145deg, #dca5af, #f0d2d7); }
.zone-card.personal { color: #3d3153; background: linear-gradient(145deg, #b4a8ce, #e2daef); }

.zone-head {
  position: relative;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  margin-top: 12px;
}

.zone-head p { max-width: 36ch; margin-bottom: 0; line-height: 1.45; opacity: 0.86; }
.zone-head h3 { font-size: 2.45rem; }

.count-badge {
  flex: 0 0 auto;
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  font-size: 0.8rem;
}

.zone-sections {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 11px;
  margin-top: 22px;
}

.zone-section {
  min-height: 112px;
  padding: 13px;
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.zone-section h4 { margin: 0 0 8px; font-size: 0.88rem; letter-spacing: 0.06em; text-transform: uppercase; }
.zone-section p { margin: 0; font-size: 0.9rem; line-height: 1.4; opacity: 0.86; }

.paper-card {
  grid-column: span 6;
  padding: 20px;
  border-radius: 22px;
  background: rgba(255, 250, 242, 0.94);
}

.paper-card p { color: var(--muted); line-height: 1.55; }
.danger-card { border-color: rgba(156, 81, 78, 0.24); }

.item-card {
  grid-column: span 4;
  padding: 17px;
  border-radius: 20px;
  background: rgba(255, 250, 242, 0.94);
}

.item-card.done { opacity: 0.58; }
.item-card.done .item-title { text-decoration: line-through; }
.item-meta { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 10px; }
.item-tag { padding: 5px 8px; border-radius: 999px; background: rgba(64, 53, 47, 0.07); font-size: 0.75rem; }
.item-title { margin-bottom: 5px; font-size: 1.15rem; font-weight: 700; }
.item-detail { margin-bottom: 13px; color: var(--muted); line-height: 1.45; }
.item-actions { display: flex; gap: 8px; }
.text-button { padding: 0; color: inherit; background: none; text-decoration: underline; text-underline-offset: 3px; }
.delete-button { color: #8c4845; }

.empty-state {
  grid-column: 1 / -1;
  display: grid;
  justify-items: center;
  gap: 8px;
  min-height: 240px;
  place-content: center;
  border: 1px dashed rgba(64, 53, 47, 0.2);
  border-radius: var(--radius);
  color: var(--muted);
  background: rgba(255, 250, 242, 0.58);
  text-align: center;
}

.empty-state p { margin: 0; }
.empty-mark { display: grid; width: 46px; height: 46px; place-items: center; border-radius: 50%; background: rgba(72, 107, 80, 0.12); font-size: 1.6rem; }

.bottom-nav {
  position: fixed;
  z-index: 40;
  left: 50%;
  bottom: max(14px, env(safe-area-inset-bottom));
  display: flex;
  gap: 4px;
  width: min(560px, calc(100% - 18px));
  padding: 7px;
  transform: translateX(-50%);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 250, 242, 0.92);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.nav-item {
  flex: 1 1 0;
  padding: 10px 7px;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
}

.nav-item.active { color: var(--ink); background: rgba(72, 107, 80, 0.12); }

.capture-dialog {
  width: min(620px, calc(100% - 20px));
  padding: 0;
  border: 0;
  border-radius: 28px;
  color: var(--ink);
  background: var(--paper);
  box-shadow: 0 30px 100px rgba(64, 53, 47, 0.3);
}

.capture-dialog::backdrop { background: rgba(64, 53, 47, 0.36); backdrop-filter: blur(4px); }
.capture-dialog form { padding: 22px; }
.dialog-head { display: flex; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.icon-button { width: 42px; height: 42px; border-radius: 50%; background: rgba(64, 53, 47, 0.07); font-size: 1.5rem; }

.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field-wide { grid-column: 1 / -1; }
label { display: grid; gap: 6px; color: var(--muted); font-size: 0.86rem; font-weight: 700; }
input, select, textarea { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 13px; color: var(--ink); background: #fffdf8; }
textarea { resize: vertical; }
.dialog-actions { justify-content: end; margin-top: 20px; }
.file-button input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

@media (max-width: 920px) {
  .app-header { align-items: start; flex-direction: column; }
  .zone-card { grid-column: 1 / -1; }
  .item-card { grid-column: span 6; }
}

@media (max-width: 640px) {
  .app-header, .app-shell { width: min(100% - 18px, 100%); }
  .app-header { padding-top: 26px; gap: 18px; }
  .header-actions, .header-actions .button { width: 100%; }
  h1 { font-size: clamp(2.7rem, 15vw, 4rem); }
  h2 { font-size: 2.15rem; }
  .zone-tabs { margin-inline: -9px; padding-inline: 9px; }
  .intro-row { align-items: start; flex-direction: column; }
  .zone-card, .paper-card, .item-card { grid-column: 1 / -1; padding: 17px; border-radius: 21px; }
  .zone-sections, .field-grid { grid-template-columns: 1fr; }
  .field-wide { grid-column: auto; }
  .zone-head { flex-direction: column; }
  .count-badge { align-self: start; }
  .nav-item { font-size: 0.76rem; padding-inline: 3px; }
  .dialog-actions .button { flex: 1; }
}
