:root {
  --ink: #0b0b0b;          /* preto cartunesco para contornos */
  --bg: #fff9e6;           /* papel quente */
  --paper: #fff5d6;
  --panel: #fffef8;
  --muted: #6b7280;
  --text: #1f2937;
  --accent: #ff7a59;       /* coral Virô! */
  --accent-2: #fbbf24;     /* âmbar (detalhes) */
  --accent-3: #34d399;     /* verde menta p/ botões topo */
  --danger: #ef4444;
  --warning: #f59e0b;
  --ok: #22c55e;
  --border: var(--ink);
}

* { box-sizing: border-box; min-width: 0; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Shantell Sans', ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, "Helvetica Neue", Arial, "Apple Color Emoji", "Segoe UI Emoji";
  color: var(--text);
  background:
    radial-gradient(circle at 10% 10%, #ffe9b8 0 12%, transparent 13%),
    radial-gradient(circle at 80% 0%, #ffd1dc 0 10%, transparent 11%),
    radial-gradient(circle at 90% 70%, #d1ffd6 0 12%, transparent 13%),
    linear-gradient(0deg, var(--bg), var(--bg));
  background-size: 120px 120px, 160px 160px, 180px 180px, auto;
}
/* Mobile polish */
body { -webkit-text-size-adjust: 100%; overscroll-behavior-y: contain; }
button, input, select, textarea { font-size: 16px; }
button { -webkit-tap-highlight-color: rgba(0,0,0,0.08); cursor: pointer; }
img, svg, video { max-width: 100%; height: auto; }

.app-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 16px 14px; background: var(--paper);
  position: sticky; top: 0; z-index: 10;
  border-bottom: 3px solid var(--ink);
  box-shadow: 0 6px 0 0 var(--ink), 0 10px 18px rgba(0,0,0,.1);
}
.app-header h1 { font-size: 22px; margin: 0; text-shadow: 1px 1px 0 #fff, 3px 3px 0 rgba(0,0,0,.15); }
.app-header .header-actions { display: flex; gap: 8px; align-items: center; }
.app-header button { padding: 8px 12px; background: var(--accent-3); color: #06263a; border: 3px solid var(--ink); border-radius: 12px; box-shadow: 0 4px 0 0 var(--ink); }
.app-header button:active { transform: translateY(2px); box-shadow: 0 2px 0 0 var(--ink); }
.icon-btn { background: #fff; color: #111; }
.icon-btn.danger { background: #fecaca; }

.container { max-width: 860px; margin: 20px auto; padding: 0 16px 96px; }
.card {
  background: var(--panel);
  border: 3px solid var(--ink);
  border-radius: 18px 22px 16px 24px;
  padding: 16px;
  margin: 16px 0;
  box-shadow: 0 8px 0 0 var(--ink), 0 10px 24px rgba(0,0,0,.12);
  position: relative;
}
.card::after {
  content: "";
  position: absolute; inset: -2px; border-radius: inherit; pointer-events: none;
  background: repeating-linear-gradient(135deg, transparent 0 10px, rgba(0,0,0,0.03) 10px 20px);
  border-radius: 18px 22px 16px 24px;
}
.card h2 { margin: 6px 0 12px; font-size: 18px; color: #0f172a; }
.card h2::after { content: ""; display: block; height: 6px; width: 120px; margin-top: 6px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='6' viewBox='0 0 120 6'%3E%3Cpath d='M2 4 C20 1, 40 6, 60 2 S100 6, 118 3' stroke='%23ff7a59' stroke-width='3' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat;
}

.form-row { display: grid; grid-template-columns: 1fr 160px auto; gap: 8px; }
.form-row input[type="text"], .form-row input[type="number"] {
  background: #fff; border: 3px solid var(--ink); border-radius: 12px; color: var(--text); padding: 10px 12px;
  box-shadow: inset 0 2px 0 rgba(0,0,0,.06);
}
.form-row input[type="number"] { width: 100%; }
.form-row button { background: var(--accent); color: #3b0b00; border: 3px solid var(--ink); border-radius: 12px; padding: 10px 12px; box-shadow: 0 4px 0 0 var(--ink); font-weight: 700; min-height: 44px; }
.form-row button:active { transform: translateY(2px); box-shadow: 0 2px 0 0 var(--ink); }
.interval { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.options-row { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }
.options-row button, .preset-btn { background: #fff; color: #111; border: 3px solid var(--ink); border-radius: 999px; padding: 8px 12px; box-shadow: 0 3px 0 0 var(--ink); min-height: 38px; }
.preset-btn:nth-child(2) { background: #ffe4e6; }
.preset-btn:nth-child(3) { background: #dcfce7; }
.preset-btn:nth-child(4) { background: #dbeafe; }
.preset-btn:nth-child(5) { background: #fef3c7; }
.options-row button:active, .preset-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 0 var(--ink); }

.items { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.item { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; padding: 12px; border: 3px solid var(--ink); border-radius: 16px; background:
    repeating-linear-gradient(45deg, #ffffff, #ffffff 12px, #fffaf0 12px, #fffaf0 24px);
  box-shadow: 0 6px 0 0 var(--ink), 0 10px 18px rgba(0,0,0,.08);
}
.title { font-weight: 800; word-break: break-word; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.center { text-align: center; }
.row { display: flex; gap: 8px; align-items: center; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; border: 3px solid var(--ink); background: #fde68a; color: #3b2900; }
.badge.due { background: #ffb4b4; color: #3b0000; }
.time { font-variant-numeric: tabular-nums; font-size: 15px; font-weight: 700; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.actions button { background: #fff; color: #111; border: 3px solid var(--ink); border-radius: 12px; padding: 10px 12px; box-shadow: 0 4px 0 0 var(--ink); font-weight: 700; min-height: 44px; }
.actions button.warn { background: #fde68a; }
.actions button.danger { background: #fecaca; }
.actions button.primary { background: #bbf7d0; }
.actions button:active { transform: translateY(2px); box-shadow: 0 2px 0 0 var(--ink); }

.due-ring { animation: wiggle 0.8s ease-in-out infinite; }
@keyframes wiggle { 0%,100%{ transform: rotate(0deg);} 25%{ transform: rotate(-1.5deg);} 50%{ transform: rotate(0.8deg);} 75%{ transform: rotate(-0.8deg);} }

@keyframes pulse2 {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  70% { box-shadow: 0 0 0 14px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

@media (max-width: 680px) {
  .form-row { grid-template-columns: 1fr 1fr; }
  .form-row button { grid-column: 1 / -1; }
  .item { grid-template-columns: 1fr; }
  .actions button { flex: 1 1 calc(50% - 8px); }
}

/* Safe area for bottom footer on iOS */
footer { padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
body.modal-open { overflow: hidden; }

/* Splash */
.splash { position: fixed; inset: 0; background:
    radial-gradient(circle at 10% 10%, #ffe9b8 0 12%, transparent 13%),
    radial-gradient(circle at 80% 0%, #ffd1dc 0 10%, transparent 11%),
    radial-gradient(circle at 90% 70%, #d1ffd6 0 12%, transparent 13%),
    linear-gradient(0deg, var(--bg), var(--bg));
  display: grid; place-items: center; z-index: 100; min-height: 100vh;
}
.splash { height: 100vh; }
@supports (height: 100dvh) {
  .splash { min-height: 100dvh; height: 100dvh; }
}
.splash-inner { text-align: center; background: var(--panel); border: 3px solid var(--ink); border-radius: 28px; padding: 24px 20px; box-shadow: 0 10px 0 0 var(--ink), 0 14px 28px rgba(0,0,0,.2); }
.splash-logo { width: 120px; height: 120px; display: block; margin: 0 auto 12px; }
.splash-title { margin: 0 0 6px; font-size: 32px; }
.splash-tag { margin: 0 0 14px; color: #6b7280; font-weight: 700; }
.splash-skip { background: var(--accent); color: #3b0b00; border: 3px solid var(--ink); border-radius: 999px; padding: 10px 16px; box-shadow: 0 4px 0 0 var(--ink); font-weight: 700; }
.splash-skip:active { transform: translateY(2px); box-shadow: 0 2px 0 0 var(--ink); }
.splash.hidden { display: none; }

/* Floating Action Button */
.fab {
  position: fixed; right: calc(16px + env(safe-area-inset-right)); bottom: calc(16px + env(safe-area-inset-bottom));
  width: 64px; height: 64px; border-radius: 50%; font-size: 28px; line-height: 1;
  display: grid; place-items: center; background: var(--accent); color: #3b0b00;
  border: 3px solid var(--ink); box-shadow: 0 6px 0 0 var(--ink), 0 10px 18px rgba(0,0,0,.15);
}
.fab:active { transform: translateY(2px); box-shadow: 0 4px 0 0 var(--ink); }

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.25); display: grid; place-items: end; padding: 16px; z-index: 50; overscroll-behavior: contain; }
.modal.hidden { display: none; }
.modal-card {
  width: 100%; max-width: 720px; background: var(--panel); border: 3px solid var(--ink);
  border-radius: 24px 24px 12px 12px; box-shadow: 0 -6px 0 0 var(--ink), 0 -10px 24px rgba(0,0,0,.2);
  padding: 16px; animation: pop 120ms ease-out;
}
.modal-close { position: absolute; right: 28px; margin-top: -6px; background: #fff; border: 3px solid var(--ink); border-radius: 10px; box-shadow: 0 3px 0 0 var(--ink); }
@keyframes pop { from { transform: translateY(12px); opacity: .8; } to { transform: translateY(0); opacity: 1; } }

/* Donate modal */
.donate-card { padding-bottom: 24px; }
.donate-header { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.donate-avatar { width: 64px; height: 64px; border-radius: 16px; border: 3px solid var(--ink); box-shadow: 0 4px 0 0 var(--ink); background: #fff; object-fit: cover; }
.pix-row { display: flex; gap: 8px; align-items: stretch; }
.pix-box { flex: 1; background: #fff; border: 3px solid var(--ink); border-radius: 12px; padding: 12px; font-weight: 800; letter-spacing: .4px; }
.copy-btn { background: #bbf7d0; border: 3px solid var(--ink); border-radius: 12px; padding: 10px 16px; box-shadow: 0 4px 0 0 var(--ink); font-weight: 700; }
.copy-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 0 var(--ink); }
