:root {
  --bordo: #5E1F2E;
  --bordo-dark: #431623;
  --marrom: #7A4A2B;
  --rose: #E9C6C0;
  --rose-soft: #F7E7E3;
  --creme: #FAF3EE;
  --paper: #FFFDFB;
  --ink: #2D211F;
  --muted: #74625E;
  --line: #E8D8D2;
  --success: #37624A;
  --warning: #8A5A12;
  --danger: #9B2436;
  --shadow: 0 18px 45px rgba(94, 31, 46, 0.12);
  --radius: 22px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(233, 198, 192, 0.55), transparent 34rem),
    linear-gradient(180deg, #FFF9F5 0%, var(--creme) 100%);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid rgba(122, 74, 43, 0.55); outline-offset: 3px; }
.skip-link {
  position: fixed; left: 1rem; top: -5rem; z-index: 100;
  background: var(--bordo); color: white; padding: .75rem 1rem; border-radius: 999px;
}
.skip-link:focus { top: 1rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 292px minmax(0, 1fr); }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  padding: 1.25rem; background: rgba(255, 253, 251, 0.88);
  border-right: 1px solid var(--line); backdrop-filter: blur(18px);
}
.brand-card {
  background: var(--creme); border: 1px solid var(--line); border-radius: 26px;
  padding: 1rem; text-align: center; box-shadow: var(--shadow);
}
.brand-logo { width: min(210px, 100%); height: auto; display: block; margin: 0 auto; border-radius: 14px; }
.brand-card p { margin: .65rem 0 0; color: var(--bordo); font-weight: 800; letter-spacing: .04em; text-transform: uppercase; font-size: .82rem; }
.nav-list { display: grid; gap: .45rem; margin: 1.25rem 0; }
.nav-button {
  width: 100%; min-height: 52px; border: 1px solid transparent; border-radius: 16px;
  background: transparent; color: var(--ink); display: flex; align-items: center; gap: .8rem;
  padding: .75rem .9rem; text-align: left; font-weight: 700;
}
.nav-button:hover { background: var(--rose-soft); }
.nav-button.active { background: var(--bordo); color: white; box-shadow: 0 12px 26px rgba(94, 31, 46, .22); }
.nav-icon { width: 1.65rem; height: 1.65rem; display: grid; place-items: center; border-radius: 999px; background: rgba(233,198,192,.65); color: var(--bordo); flex: 0 0 auto; font-size: .9rem; }
.nav-button.active .nav-icon { background: rgba(255,255,255,.16); color: white; }
.sidebar-note {
  border: 1px solid var(--line); background: white; border-radius: 20px; padding: 1rem;
  display: grid; gap: .35rem; color: var(--muted); font-size: .92rem;
}
.sidebar-note strong { color: var(--bordo); }

.main { width: min(1180px, 100%); margin: 0 auto; padding: 1.25rem clamp(1rem, 3vw, 2.5rem) 7rem; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.mobile-brand { display: none; align-items: center; gap: .7rem; }
.mobile-brand img { width: 48px; height: 42px; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); }
.mobile-brand div { display: grid; line-height: 1.15; }
.mobile-brand span { color: var(--muted); font-size: .85rem; }
.topbar-actions { display: flex; gap: .65rem; margin-left: auto; flex-wrap: wrap; justify-content: flex-end; }
.button {
  min-height: 48px; border-radius: 999px; border: 1px solid transparent;
  padding: .72rem 1.15rem; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  text-decoration: none; transition: transform .16s ease, background .16s ease, border-color .16s ease;
}
.button:hover { transform: translateY(-1px); }
.button-primary { background: var(--bordo); color: white; box-shadow: 0 12px 24px rgba(94,31,46,.2); }
.button-primary:hover { background: var(--bordo-dark); }
.button-secondary { background: var(--rose-soft); color: var(--bordo); border-color: var(--rose); }
.button-ghost { background: white; color: var(--bordo); border-color: var(--line); }
.button-danger { background: var(--danger); color: white; }
.button-small { min-height: 42px; padding: .5rem .85rem; font-size: .92rem; }
.icon-button {
  width: 44px; height: 44px; border-radius: 999px; border: 1px solid var(--line);
  background: white; color: var(--bordo); font-size: 1.45rem; line-height: 1;
}

.hero {
  display: flex; justify-content: space-between; gap: 1.25rem; align-items: flex-end;
  padding: clamp(1.25rem, 4vw, 2.4rem); border-radius: 32px; color: white;
  background:
    linear-gradient(135deg, rgba(94,31,46,.97), rgba(122,74,43,.92)),
    var(--bordo);
  box-shadow: var(--shadow); margin-bottom: 1.25rem; overflow: hidden; position: relative;
}
.hero::after {
  content: ""; position: absolute; width: 280px; height: 280px; border-radius: 50%;
  right: -90px; top: -130px; border: 42px solid rgba(233,198,192,.22);
}
.hero > * { position: relative; z-index: 1; }
.eyebrow { margin: 0 0 .35rem; text-transform: uppercase; letter-spacing: .12em; font-size: .78rem; font-weight: 900; color: var(--marrom); }
.hero .eyebrow { color: var(--rose); }
h1, h2, h3 { line-height: 1.12; margin: 0; }
h1 { font-family: Georgia, "Times New Roman", serif; font-size: clamp(2.25rem, 6vw, 4.4rem); font-weight: 700; }
h2 { font-size: clamp(1.35rem, 3vw, 2rem); color: var(--bordo); }
h3 { font-size: 1.08rem; color: var(--bordo); }
.hero-text { max-width: 680px; margin: .75rem 0 0; color: rgba(255,255,255,.88); font-size: 1.05rem; }
.profile-chip {
  min-width: 210px; max-width: 300px; background: rgba(255,255,255,.13); border: 1px solid rgba(255,255,255,.24);
  border-radius: 22px; padding: 1rem; display: grid; gap: .2rem;
}
.profile-chip strong { font-size: 1.05rem; }
.profile-chip span { color: rgba(255,255,255,.82); font-size: .92rem; }

.section { margin-top: 1.25rem; }
.section-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: .9rem; }
.section-header p { margin: .35rem 0 0; color: var(--muted); max-width: 720px; }
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.card {
  background: rgba(255,253,251,.94); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.1rem; box-shadow: 0 12px 32px rgba(94,31,46,.07);
}
.stat-card { min-height: 150px; display: grid; align-content: space-between; gap: .8rem; }
.stat-label { color: var(--muted); font-weight: 800; font-size: .9rem; }
.stat-value { font-family: Georgia, "Times New Roman", serif; font-size: clamp(2rem, 5vw, 3.2rem); color: var(--bordo); line-height: 1; }
.stat-detail { color: var(--muted); font-size: .94rem; }
.empty-state {
  border: 1.5px dashed #D8B9B2; background: rgba(255,255,255,.72); border-radius: var(--radius);
  padding: 1.4rem; text-align: center; color: var(--muted); display: grid; justify-items: center; gap: .7rem;
}
.empty-state strong { color: var(--bordo); font-size: 1.05rem; }
.item-list { display: grid; gap: .8rem; }
.item-card { display: grid; grid-template-columns: auto minmax(0,1fr) auto; gap: .9rem; align-items: start; }
.item-card.done { opacity: .72; }
.item-card.done .item-title { text-decoration: line-through; }
.item-title { font-weight: 900; color: var(--ink); overflow-wrap: anywhere; }
.item-meta { color: var(--muted); font-size: .93rem; margin-top: .2rem; overflow-wrap: anywhere; }
.item-notes { margin-top: .55rem; color: #57443F; white-space: pre-wrap; overflow-wrap: anywhere; }
.badge {
  display: inline-flex; align-items: center; min-height: 28px; padding: .18rem .6rem; border-radius: 999px;
  background: var(--rose-soft); color: var(--bordo); font-size: .8rem; font-weight: 900; margin: .35rem .35rem 0 0;
}
.badge.success { background: #E2EFE7; color: var(--success); }
.badge.warning { background: #FFF0D2; color: var(--warning); }
.badge.danger { background: #FBE3E8; color: var(--danger); }
.check-button {
  width: 46px; height: 46px; border-radius: 999px; border: 2px solid var(--rose);
  background: white; color: transparent; font-weight: 900; font-size: 1.15rem;
}
.check-button.checked { background: var(--success); border-color: var(--success); color: white; }
.item-actions { display: flex; gap: .45rem; flex-wrap: wrap; justify-content: flex-end; }
.text-button {
  min-height: 42px; border: 1px solid var(--line); background: white; color: var(--bordo);
  border-radius: 999px; padding: .45rem .8rem; font-weight: 800;
}
.text-button.danger { color: var(--danger); }
.progress { height: 12px; background: var(--rose-soft); border-radius: 999px; overflow: hidden; margin-top: .7rem; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--marrom), var(--bordo)); border-radius: inherit; }

.tabs { display: flex; gap: .55rem; overflow-x: auto; padding: .2rem .1rem .8rem; scrollbar-width: thin; }
.tab-button {
  min-height: 48px; white-space: nowrap; border-radius: 999px; border: 1px solid var(--line);
  background: white; color: var(--bordo); padding: .65rem 1rem; font-weight: 900;
}
.tab-button.active { background: var(--bordo); color: white; border-color: var(--bordo); }
.toolbar { display: flex; gap: .7rem; flex-wrap: wrap; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.search-field { flex: 1 1 260px; }
label { font-weight: 800; color: var(--bordo); display: grid; gap: .4rem; }
input, select, textarea {
  width: 100%; min-height: 50px; border: 1px solid #DCC7C0; border-radius: 15px;
  background: white; color: var(--ink); padding: .75rem .9rem;
}
textarea { min-height: 112px; resize: vertical; }
input[type="checkbox"] { width: 24px; height: 24px; min-height: 24px; accent-color: var(--bordo); }
.checkbox-label { display: flex; align-items: center; gap: .65rem; min-height: 50px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 1rem; }
.form-grid .full { grid-column: 1 / -1; }
.help-text { color: var(--muted); font-size: .9rem; font-weight: 500; }

.calendar-card { padding: 1rem; }
.calendar-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.calendar-title { font-family: Georgia, "Times New Roman", serif; font-size: 1.65rem; color: var(--bordo); text-transform: capitalize; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0,1fr)); gap: .45rem; }
.weekday { text-align: center; color: var(--muted); font-weight: 900; font-size: .78rem; text-transform: uppercase; padding: .35rem 0; }
.calendar-day {
  min-height: 104px; border: 1px solid var(--line); border-radius: 16px; background: white;
  padding: .55rem; text-align: left; color: var(--ink); display: grid; align-content: start; gap: .35rem;
}
.calendar-day:hover { border-color: var(--rose); background: #FFF8F5; }
.calendar-day.outside { opacity: .42; background: #FBF4F0; }
.calendar-day.today { border: 2px solid var(--bordo); background: var(--rose-soft); }
.calendar-day.selected { box-shadow: inset 0 0 0 2px var(--marrom); }
.day-number { font-weight: 900; color: var(--bordo); }
.calendar-event { font-size: .74rem; line-height: 1.25; background: var(--rose-soft); color: var(--bordo); border-radius: 8px; padding: .22rem .35rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.calendar-more { font-size: .74rem; color: var(--muted); font-weight: 800; }

.summary-list { display: grid; gap: .75rem; }
.summary-row { display: flex; justify-content: space-between; gap: 1rem; border-bottom: 1px solid var(--line); padding-bottom: .7rem; }
.summary-row:last-child { border-bottom: 0; padding-bottom: 0; }
.amount-positive { color: var(--success); font-weight: 900; }
.amount-negative { color: var(--danger); font-weight: 900; }
.notice { border-left: 5px solid var(--marrom); background: #FFF7EC; border-radius: 16px; padding: 1rem; color: #5C4436; }
.footer-note { color: var(--muted); text-align: center; margin-top: 2rem; font-size: .92rem; }

.bottom-nav {
  display: none; position: fixed; left: .65rem; right: .65rem; bottom: .65rem; z-index: 50;
  background: rgba(67,22,35,.96); border: 1px solid rgba(255,255,255,.14); border-radius: 24px;
  padding: .45rem; box-shadow: 0 18px 40px rgba(67,22,35,.3); overflow-x: auto; scrollbar-width: none;
}
.bottom-nav::-webkit-scrollbar { display: none; }
.bottom-nav button {
  flex: 1 0 74px; min-height: 58px; border: 0; border-radius: 18px; background: transparent; color: rgba(255,255,255,.78);
  display: grid; place-items: center; gap: .1rem; font-size: .72rem; font-weight: 900; padding: .35rem .25rem;
}
.bottom-nav button.active { background: white; color: var(--bordo); }
.bottom-nav .nav-icon { width: 1.45rem; height: 1.45rem; font-size: .82rem; }

.modal {
  width: min(760px, calc(100vw - 1.5rem)); max-height: calc(100vh - 1.5rem); overflow-y: auto;
  border: 0; border-radius: 28px; padding: 1.35rem; color: var(--ink); box-shadow: var(--shadow);
}
.modal::backdrop { background: rgba(45,25,29,.58); backdrop-filter: blur(5px); }
.modal-small { width: min(480px, calc(100vw - 1.5rem)); }
.modal-header { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; margin-bottom: 1.2rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: .7rem; flex-wrap: wrap; margin-top: 1.25rem; }
.form-error { color: var(--danger); font-weight: 800; min-height: 1.5rem; margin: .8rem 0 0; }
.toast {
  position: fixed; left: 50%; bottom: 6.5rem; transform: translate(-50%, 20px); z-index: 80;
  background: var(--bordo-dark); color: white; border-radius: 999px; padding: .8rem 1.1rem;
  box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: .22s ease; max-width: calc(100vw - 2rem); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .mobile-brand { display: flex; }
  .bottom-nav { display: flex; }
  .main { padding-bottom: 8.5rem; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .main { padding-left: .85rem; padding-right: .85rem; }
  .topbar { align-items: flex-start; }
  .topbar-actions .button-ghost { display: none; }
  .hero { display: grid; border-radius: 26px; }
  .profile-chip { min-width: 0; max-width: none; }
  .grid-2, .grid-4 { grid-template-columns: 1fr; }
  .section-header { align-items: flex-start; flex-direction: column; }
  .section-header .button { width: 100%; }
  .item-card { grid-template-columns: auto minmax(0,1fr); }
  .item-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .form-grid { grid-template-columns: 1fr; }
  .calendar-grid { gap: .28rem; }
  .calendar-day { min-height: 76px; padding: .38rem; border-radius: 12px; }
  .calendar-event { display: none; }
  .calendar-day.has-items::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--marrom); }
  .calendar-more { display: none; }
  .weekday { font-size: .66rem; }
  .modal { padding: 1rem; border-radius: 22px; }
  .modal-actions .button { flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
