:root {
  --wine: #8e1b1f;
  --wine-2: #b0282d;
  --wine-dark: #2e1210;
  --side: #3a1714;
  --paper: #fdf6ea;
  --paper-2: #f7ead5;
  --line: #ead8bd;
  --ink: #3b2620;
  --muted: #8a7065;
  --pink: #f8d3cf;
  --green: #e1ebcf;
  --gold: #f6e2b5;
  --hand: 'Caveat', cursive;
  --script: 'Dancing Script', cursive;
  --sans: 'Nunito', system-ui, sans-serif;
  --radius: 14px;
  --shadow: 0 6px 18px rgba(40, 10, 5, .25);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--wine-dark) radial-gradient(circle at 70% 0%, #5b2416, var(--wine-dark) 60%);
  min-height: 100vh;
}
button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
input, select, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }

/* ---------- ícones ---------- */
.ic { display: inline-flex; width: 20px; height: 20px; flex: none; }
.ic svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }

.sidebar {
  background: linear-gradient(180deg, #3e1916, #2a0f0d);
  color: #f6e6d6;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  overflow-y: auto;
}
.logo {
  background: var(--paper);
  margin: 0 0 18px;
  padding: 18px 18px 14px;
  color: var(--wine);
  transform: rotate(-1.5deg);
  box-shadow: var(--shadow);
  border-radius: 0 0 6px 0;
}
.logo-name { font-family: var(--script); font-size: 46px; line-height: 1; }
.logo-sub { letter-spacing: .45em; font-weight: 700; color: var(--ink); font-size: 15px; margin: 2px 0 6px 40px; }
.logo-tag { font-family: var(--hand); font-size: 18px; color: var(--ink); text-transform: uppercase; }

.side-nav { display: flex; flex-direction: column; gap: 4px; padding: 0 10px; }
.nav-item {
  display: flex; align-items: center; gap: 14px;
  padding: 11px 16px; border-radius: 10px;
  font-size: 17px; text-align: left; color: #f4e3d3;
  transition: background .15s;
}
.nav-item .ic { width: 24px; height: 24px; }
.nav-item:hover { background: rgba(255,255,255,.07); }
.nav-item.active { background: var(--wine-2); color: #fff; box-shadow: 0 4px 12px rgba(0,0,0,.3); }

.side-note {
  margin: auto 22px 26px; padding: 22px 16px;
  background: var(--paper-2); color: var(--ink);
  font-family: var(--hand); font-size: 23px; line-height: 1.15; text-transform: uppercase; text-align: center;
  transform: rotate(-6deg); box-shadow: var(--shadow);
}

.main { min-width: 0; }

/* ---------- hero ---------- */
.hero {
  position: relative; height: 230px; overflow: hidden;
  background: linear-gradient(180deg, #4a2214 0%, #8c4320 45%, #c9762f 75%, #7a3a1c 100%);
}
.hero-glow { position: absolute; inset: 0; background: radial-gradient(circle at 56% 30%, rgba(255,214,150,.75), transparent 32%); }
.hero-window {
  position: absolute; left: 44%; top: 0; width: 26%; height: 70%;
  background:
    linear-gradient(90deg, transparent 48%, rgba(70,30,15,.7) 48% 52%, transparent 52%),
    linear-gradient(0deg, transparent 48%, rgba(70,30,15,.7) 48% 52%, transparent 52%),
    linear-gradient(180deg, #ffd9a0, #f2a95c);
  opacity: .55; border: 6px solid rgba(70,30,15,.6); border-top: 0;
}
.hero-desk { position: absolute; left: 0; right: 0; bottom: 0; height: 34%; background: linear-gradient(180deg, #6b2d17, #3e1a0f); }
.hero-deco { position: absolute; filter: drop-shadow(0 4px 6px rgba(0,0,0,.35)); user-select: none; }
.d1 { left: 2%; top: 4%; font-size: 70px; }
.d2 { left: 26%; bottom: 14%; font-size: 64px; }
.d3 { left: 42%; bottom: 18%; font-size: 46px; }
.d4 { left: 56%; bottom: 16%; font-size: 70px; }
.d5 { right: 6%; bottom: 18%; font-size: 64px; }
.d6 { left: 13%; bottom: 20%; font-size: 52px; }
.sticky {
  position: absolute; padding: 12px 16px; font-family: var(--hand); font-size: 21px; line-height: 1.15;
  box-shadow: var(--shadow); color: var(--ink);
}
.s-pink { background: #f9c9c3; left: 34%; top: 12px; transform: rotate(-5deg); }
.s-cream { background: var(--paper); right: 26%; top: 64px; width: 150px; transform: rotate(-8deg); }
.mobile-logo { display: none; }

.topbar { position: absolute; top: 14px; right: 18px; display: flex; gap: 12px; align-items: center; z-index: 5; }
.search { position: relative; }
.search > .ic { position: absolute; left: 12px; top: 10px; color: var(--ink); }
.search input {
  width: 240px; padding: 9px 12px 9px 40px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--paper); outline: none;
}
.search input:focus { border-color: var(--wine-2); }
.icon-btn { position: relative; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: #fff; }
.icon-btn .ic { width: 28px; height: 28px; }
.icon-btn:hover { background: rgba(255,255,255,.12); }
.badge {
  position: absolute; top: 0; right: 0; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px;
  background: #d8262c; color: #fff; font-size: 11px; font-weight: 800; display: grid; place-items: center;
}
.dropdown {
  position: absolute; top: 46px; right: 0; width: 320px; max-height: 360px; overflow: auto;
  background: var(--paper); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; z-index: 20;
}
.bell-dd { right: 52px; }
.dd-item { display: flex; gap: 10px; align-items: center; padding: 9px 10px; border-radius: 8px; font-size: 14px; width: 100%; text-align: left; }
.dd-item:hover { background: var(--paper-2); }
.dd-item small { color: var(--muted); margin-left: auto; }
.dd-empty { padding: 14px; color: var(--muted); font-size: 14px; }

/* ---------- views ---------- */
.view { padding: 0 18px 28px; margin-top: -24px; position: relative; display: grid; gap: 14px; }

.card {
  background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px 20px; min-width: 0;
}
.card-h { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.card-h h2 { margin: 0; font-size: 19px; font-weight: 800; }
.card-h .ic { color: var(--wine); width: 26px; height: 26px; }
.card-h .link { margin-left: auto; color: var(--wine); font-weight: 700; font-size: 14px; display: inline-flex; gap: 4px; align-items: center; }
.card-h .link .ic { width: 16px; height: 16px; }

/* saudação */
.greet-row { display: grid; grid-template-columns: 1fr 330px; gap: 14px; }
.greet { display: flex; align-items: center; gap: 22px; background: var(--paper-2); transform: rotate(-.4deg); }
.greet h1 { font-family: var(--script); color: var(--wine); font-size: 46px; margin: 0; line-height: 1.1; }
.greet p { margin: 6px 0 0; font-size: 16px; }
.focus {
  margin-left: auto; display: flex; gap: 14px; align-items: center; font-family: var(--hand); font-size: 20px;
}
.focus-tag { background: var(--gold); padding: 10px 14px; transform: rotate(4deg); box-shadow: 0 3px 8px rgba(0,0,0,.15); font-size: 24px; line-height: 1; text-align: center; }
.focus ul { list-style: none; margin: 0; padding: 0; }
.focus li::before { content: '✓ '; }
.date-card { display: grid; grid-template-columns: 130px 1fr; align-items: center; gap: 10px; padding: 12px 16px; }
.date-card .dc { text-align: center; border-right: 1px solid var(--line); padding-right: 10px; }
.date-card .dc b { display: block; font-size: 54px; color: var(--wine); line-height: 1; margin: 2px 0; }
.date-card .dc span { font-size: 14px; }
.date-card .quote { font-family: var(--hand); font-size: 19px; line-height: 1.15; }

/* atalhos */
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.quick-item { display: flex; align-items: center; gap: 14px; text-align: left; padding: 14px 18px; transition: transform .15s; }
.quick-item:hover { transform: translateY(-2px); }
.quick-icon { width: 48px; height: 48px; border-radius: 10px; background: var(--pink); color: var(--wine); display: grid; place-items: center; flex: none; }
.quick-icon .ic { width: 28px; height: 28px; }
.quick-item b { display: block; font-size: 17px; }
.quick-item small { color: var(--muted); font-size: 14px; }
.quick-item > .ic { margin-left: auto; color: var(--wine); }

.row3 { display: grid; grid-template-columns: 1.15fr 1fr 1.1fr; gap: 14px; }
.row4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }

/* tarefas */
.task { display: flex; align-items: center; gap: 10px; padding: 7px 2px; border-bottom: 1px solid var(--line); font-size: 15px; }
.task:last-child { border-bottom: 0; }
.check { width: 20px; height: 20px; border-radius: 50%; border: 2px solid #7d6a62; flex: none; display: grid; place-items: center; }
.check.on { background: var(--wine-2); border-color: var(--wine-2); color: #fff; }
.check.on::after { content: '✓'; font-size: 12px; font-weight: 800; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.p-alta { background: #e0484d; } .p-media { background: #7fa35a; } .p-baixa { background: #e3a43a; }
.task-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task.done .task-title { text-decoration: line-through; color: var(--muted); }
.chip { font-size: 12px; padding: 2px 10px; border-radius: 999px; font-weight: 700; white-space: nowrap; }
.chip-alta { background: #e0484d; color: #fff; }
.when { color: var(--muted); font-size: 13px; width: 72px; flex: none; }
.when.late { color: #c3262b; font-weight: 700; }
.mini-btn { color: var(--muted); padding: 4px; border-radius: 6px; display: inline-flex; }
.mini-btn:hover { color: var(--wine); background: var(--paper-2); }
.mini-btn .ic { width: 17px; height: 17px; }
.add-link { color: var(--wine); font-weight: 700; display: inline-flex; gap: 6px; align-items: center; margin-top: 10px; }
.add-link .ic { width: 18px; height: 18px; }

/* agenda */
.month-nav { display: flex; align-items: center; justify-content: space-between; font-weight: 700; margin-bottom: 6px; }
.month-nav button { color: var(--wine); padding: 4px; border-radius: 6px; }
.week { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; gap: 2px; margin-bottom: 10px; }
.week small { color: var(--muted); font-size: 13px; }
.day { width: 32px; height: 32px; margin: 2px auto 0; border-radius: 50%; font-weight: 700; display: grid; place-items: center; position: relative; }
.day:hover { background: var(--paper-2); }
.day.today { color: var(--wine); }
.day.sel { background: var(--wine-2); color: #fff; }
.day.has::after { content: ''; position: absolute; bottom: 1px; width: 4px; height: 4px; border-radius: 50%; background: var(--wine-2); }
.day.sel.has::after { background: #fff; }
.event { display: grid; grid-template-columns: 52px 1fr auto; align-items: center; gap: 8px; font-size: 14px; margin: 5px 0; }
.event .bar { padding: 3px 10px; border-radius: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-green { background: var(--green); } .c-pink { background: var(--pink); } .c-gold { background: var(--gold); }
.empty { color: var(--muted); font-size: 14px; padding: 8px 0; }

/* finanças */
.fin { display: grid; grid-template-columns: 1fr 130px; gap: 14px; align-items: center; }
.fin-row { display: flex; align-items: center; gap: 8px; font-size: 15px; padding: 4px 0; }
.fin-row b { margin-left: auto; font-weight: 600; }
.fin-row .ic { width: 16px; height: 16px; }
.up { color: #5d8a3a; } .down { color: #c3262b; }
.saldo { background: var(--green); border-radius: 8px; padding: 6px 10px; font-weight: 800; font-size: 17px; }
.donut { width: 120px; height: 120px; border-radius: 50%; display: grid; place-items: center; }
.donut > div { width: 92px; height: 92px; border-radius: 50%; background: var(--paper); display: grid; place-items: center; text-align: center; }
.donut b { font-size: 24px; display: block; }
.donut small { font-size: 11px; color: var(--muted); line-height: 1.1; }
.goal { display: grid; grid-template-columns: 34px 1fr auto; gap: 4px 10px; align-items: center; margin-top: 12px; font-size: 14px; }
.goal .ic { width: 32px; height: 32px; color: var(--wine-2); grid-row: span 2; }
.progress { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.progress > div { height: 100%; background: var(--wine-2); border-radius: 4px; }

/* projetos */
.proj { display: flex; align-items: center; gap: 10px; padding: 7px 0; font-size: 15px; }
.proj-ic { width: 30px; height: 30px; border-radius: 8px; background: var(--pink); color: var(--wine); display: grid; place-items: center; flex: none; }
.proj-ic .ic { width: 17px; height: 17px; }
.proj-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-andamento { background: var(--green); } .st-planejamento { background: var(--gold); }
.st-ideia { background: var(--paper-2); border: 1px solid var(--line); } .st-concluido { background: #cfe3e6; }
button.chip:hover { filter: brightness(.95); }

/* notas */
.notes-list { margin: 0; padding-left: 18px; font-family: var(--hand); font-size: 21px; line-height: 1.3; }
.notes-list li { cursor: default; }
.notes-list li:hover .mini-btn { opacity: 1; }
.notes-list .mini-btn { opacity: 0; vertical-align: middle; }

/* alertas */
.alert { display: flex; align-items: center; gap: 12px; padding: 8px 0; font-size: 15px; }
.alert-ic { width: 36px; height: 36px; border-radius: 50%; background: var(--pink); color: var(--wine-2); display: grid; place-items: center; flex: none; }
.alert-ic .ic { width: 19px; height: 19px; }
.alert span:nth-child(2) { flex: 1; }

/* mensagem */
.msg-text { font-family: var(--hand); font-size: 22px; line-height: 1.2; min-height: 120px; }
.btn {
  background: var(--wine-2); color: #fff; padding: 10px 22px; border-radius: 10px; font-weight: 700;
  box-shadow: 0 3px 8px rgba(0,0,0,.2); display: inline-flex; gap: 8px; align-items: center;
}
.btn:hover { background: var(--wine); }
.btn.ghost { background: var(--paper-2); color: var(--ink); box-shadow: none; }
.btn .ic { width: 18px; height: 18px; }

/* páginas internas */
.page-h { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.page-h h1 { margin: 0; font-size: 28px; color: var(--wine); font-family: var(--script); font-size: 38px; }
.page-h .btn { margin-left: auto; }
.tabs { display: flex; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; }
.tab { padding: 6px 14px; border-radius: 999px; background: var(--paper-2); font-weight: 700; font-size: 14px; }
.tab.on { background: var(--wine-2); color: #fff; }
.two { display: grid; grid-template-columns: 1.2fr 1fr; gap: 14px; align-items: start; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
.cal small { color: var(--muted); font-weight: 700; padding: 4px 0; }
.cal .day { width: 40px; height: 40px; }
.cal .day.out { color: #c9b8a8; }
.tx { display: grid; grid-template-columns: 24px 1fr auto auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.tx small { color: var(--muted); display: block; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.stat small { color: var(--muted); font-weight: 700; }
.stat b { display: block; font-size: 26px; margin-top: 4px; }
.notes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 18px; }
.note-card { background: var(--gold); padding: 16px; min-height: 140px; font-family: var(--hand); font-size: 22px; line-height: 1.2; box-shadow: var(--shadow); position: relative; white-space: pre-wrap; word-break: break-word; }
.note-card:nth-child(3n+2) { background: var(--pink); transform: rotate(1.5deg); }
.note-card:nth-child(3n) { background: var(--green); transform: rotate(-1.5deg); }
.note-card:nth-child(3n+1) { transform: rotate(-1deg); }
.note-card .mini-btn { position: absolute; top: 6px; right: 6px; }
.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.soon { text-align: center; padding: 40px 20px; }
.soon p { color: var(--muted); max-width: 460px; margin: 10px auto 0; }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-weight: 700; font-size: 14px; }
.field input, .field select, .field textarea {
  padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: #fff; outline: none; width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--wine-2); }

/* modal */
.modal { position: fixed; inset: 0; background: rgba(30,8,6,.55); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal-box { background: var(--paper); border-radius: 16px; padding: 22px; width: 100%; max-width: 420px; box-shadow: var(--shadow); max-height: 90vh; overflow: auto; }
.modal-box h3 { margin: 0 0 16px; font-family: var(--script); color: var(--wine); font-size: 32px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 80px); background: var(--wine-dark); color: #fff;
  padding: 10px 18px; border-radius: 10px; transition: transform .25s; z-index: 60; pointer-events: none;
}
.toast.show { transform: translate(-50%, 0); }

.bottom-nav { display: none; }

/* login */
body.logged-out .app, body.logged-out .bottom-nav { display: none !important; }
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-box {
  width: 100%; max-width: 380px; background: var(--paper); border-radius: 18px; padding: 28px 26px;
  box-shadow: var(--shadow); text-align: center;
}
.login-box .logo-name { font-family: var(--script); font-size: 56px; color: var(--wine); line-height: 1; }
.login-box .logo-sub { margin: 4px 0 0 0; }
.login-tag { font-family: var(--hand); font-size: 20px; margin: 4px 0 16px; }
.login-box h3 { margin: 0 0 14px; }
.login-box .field { text-align: left; }
.link-btn { color: var(--wine); font-weight: 700; margin-top: 12px; font-size: 14px; }
.login-msg { min-height: 20px; color: var(--muted); font-size: 14px; margin: 10px 0 0; }

/* google / sync */
.connect { background: var(--paper-2); border-radius: 12px; padding: 16px; text-align: center; }
.connect p { margin: 0 0 12px; font-size: 15px; }
.hint { color: var(--muted); font-size: 13px; margin: 10px 0 0; }
.sep { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
.row-btns { display: flex; gap: 10px; flex-wrap: wrap; }
.sync-ic { display: inline-flex; }
.sync-ic .ic { width: 24px !important; height: 24px !important; }
.sync-ic.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
button:disabled { opacity: .6; cursor: wait; }

/* ---------- telas médias ---------- */
@media (max-width: 1280px) {
  .quick { grid-template-columns: repeat(2, 1fr); }
  .row3 { grid-template-columns: 1fr 1fr; }
  .row3 > :last-child { grid-column: span 2; }
  .row4 { grid-template-columns: 1fr 1fr; }
  .greet-row { grid-template-columns: 1fr; }
  .focus { display: none; }
  .s-cream { display: none; }
}

/* ---------- celular ---------- */
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .hero { height: 170px; }
  .hero-deco, .sticky { display: none; }
  .d2, .d4, .d5 { display: block; font-size: 48px; }
  .d2 { left: 8%; } .d4 { left: 42%; } .d5 { right: 8%; }
  .mobile-logo { display: block; position: absolute; left: 16px; top: 12px; font-family: var(--script); font-size: 34px; color: #fff; text-shadow: 0 2px 6px rgba(0,0,0,.4); }
  .topbar { right: 10px; top: 12px; gap: 4px; }
  .search input { width: 40px; padding-right: 0; background: transparent; border-color: transparent; color: transparent; cursor: pointer; }
  .search > .ic { color: #fff; left: 10px; }
  .search input:focus { width: calc(100vw - 120px); background: var(--paper); color: var(--ink); cursor: text; padding-right: 12px; }
  .search:focus-within > .ic { color: var(--ink); }
  .search .dropdown { position: fixed; left: 12px; right: 12px; top: 64px; width: auto; }
  .bell-dd { position: fixed; left: 12px; right: 12px; top: 64px; width: auto; }
  .view { padding: 0 12px 96px; }
  .quick, .row3, .row4, .two, .stats { grid-template-columns: 1fr; }
  .row3 > :last-child { grid-column: auto; }
  .quick-item { padding: 12px 14px; }
  .greet { flex-direction: column; align-items: flex-start; gap: 4px; }
  .greet h1 { font-size: 38px; }
  .date-card { grid-template-columns: 110px 1fr; }
  .fin { grid-template-columns: 1fr 120px; }
  .cal .day { width: 36px; height: 36px; }
  .bottom-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: #2a0f0d; padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    justify-content: space-around; box-shadow: 0 -4px 14px rgba(0,0,0,.35);
  }
  .bottom-nav .nav-item { flex-direction: column; gap: 2px; padding: 6px 4px; font-size: 11px; flex: 1; align-items: center; }
  .bottom-nav .nav-item .ic { width: 22px; height: 22px; }
  .notes-list .mini-btn { opacity: 1; }
}
