/* ===== Brisa · Rotina — tema quente, escuro por padrão ===== */
:root {
  --bg: #16130f;
  --surface: #201c16;
  --surface-2: #2a251d;
  --line: #383127;
  --text: #f3ede2;
  --text-dim: #a89c8a;
  --accent: #e07a4f;          /* terracota */
  --accent-soft: rgba(224,122,79,.14);
  --ok: #9db787;              /* verde-sálvia */
  --ok-soft: rgba(157,183,135,.14);
  --danger: #d96c6c;
  --radius: 18px;
  --font-display: "Cabinet Grotesk", sans-serif;
  --font-body: "Supreme", sans-serif;
}
[data-theme="light"] {
  --bg: #f6f1e8;
  --surface: #fffdf8;
  --surface-2: #efe8db;
  --line: #e0d7c6;
  --text: #2b2419;
  --text-dim: #8d8170;
  --accent: #c95f36;
  --accent-soft: rgba(201,95,54,.11);
  --ok: #6d8f55;
  --ok-soft: rgba(109,143,85,.13);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { color-scheme: dark; }
[data-theme="light"] { color-scheme: light; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  min-height: 100dvh;
  transition: background .35s ease, color .35s ease;
}

/* grão sutil de textura */
.grain {
  position: fixed; inset: 0; pointer-events: none; z-index: 1; opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

main {
  position: relative; z-index: 2;
  max-width: 620px; margin: 0 auto;
  padding: 20px 18px calc(40px + env(safe-area-inset-bottom));
}

.banner {
  position: sticky; top: 0; z-index: 50;
  background: #7a3b2e; color: #ffe9df;
  text-align: center; font-size: 14px; font-weight: 500;
  padding: 9px 14px;
}
.hidden { display: none !important; }

/* ===== tipografia ===== */
h1, h2, .display { font-family: var(--font-display); letter-spacing: -.01em; }

.eyebrow {
  font-size: 13px; font-weight: 500; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: .14em;
}

/* ===== tela: escolher pessoa ===== */
.home-head { margin: 26px 0 6px; }
.home-title {
  font-size: clamp(38px, 9vw, 52px); font-weight: 800; line-height: 1.02;
}
.home-title em { font-style: normal; color: var(--accent); }
.home-sub { color: var(--text-dim); margin-top: 10px; font-size: 15px; }

.people { display: flex; flex-direction: column; gap: 12px; margin-top: 28px; }
.person-card {
  display: flex; align-items: center; gap: 16px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px;
  cursor: pointer; text-align: left; width: 100%;
  color: var(--text); font-family: inherit; font-size: inherit;
  transition: transform .15s ease, border-color .2s;
  animation: rise .45s ease backwards;
}
.person-card:active { transform: scale(.98); }
.person-card:hover { border-color: var(--accent); }
.avatar {
  width: 52px; height: 52px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 800; font-size: 21px;
  color: #16130f;
}
.person-name { font-family: var(--font-display); font-weight: 700; font-size: 19px; }
.person-meta { font-size: 13.5px; color: var(--text-dim); margin-top: 2px; }
.person-meta .all-done { color: var(--ok); font-weight: 500; }
.chev { margin-left: auto; color: var(--text-dim); font-size: 20px; }

.home-foot { margin-top: 34px; display: flex; gap: 10px; }

/* ===== tela: checklist ===== */
.top-bar {
  display: flex; align-items: center; gap: 8px; margin-bottom: 22px;
}
.icon-btn {
  background: var(--surface); border: 1px solid var(--line); color: var(--text);
  width: 42px; height: 42px; border-radius: 13px; font-size: 17px;
  cursor: pointer; display: grid; place-items: center; flex-shrink: 0;
  transition: border-color .2s;
}
.icon-btn:hover { border-color: var(--accent); }
.top-bar .spacer { flex: 1; }

.day-head { margin-bottom: 22px; }
.greeting {
  font-size: clamp(30px, 7.5vw, 40px); font-weight: 800; line-height: 1.05;
  font-family: var(--font-display);
}
.date-line { color: var(--text-dim); margin-top: 6px; font-size: 14.5px; }

.progress-wrap { margin: 20px 0 8px; }
.progress-label {
  display: flex; justify-content: space-between; font-size: 13.5px;
  color: var(--text-dim); margin-bottom: 8px;
}
.progress-label b { color: var(--text); font-weight: 700; }
.progress-track {
  height: 7px; border-radius: 99px; background: var(--surface-2); overflow: hidden;
}
.progress-fill {
  height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, var(--accent), #e8a25f);
  transition: width .5s cubic-bezier(.22,1,.36,1);
}
.progress-fill.complete { background: linear-gradient(90deg, var(--ok), #b8cf9f); }

.section-label { margin: 26px 0 10px; }

.task-list { display: flex; flex-direction: column; gap: 10px; }
.task-item {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 15px 16px;
  cursor: pointer; user-select: none;
  animation: rise .4s ease backwards;
  transition: opacity .3s, border-color .2s;
}
.task-item:hover { border-color: var(--accent); }
.task-item.done { opacity: .55; }
.task-item.done:hover { border-color: var(--ok); }

.checkbox {
  width: 27px; height: 27px; border-radius: 50%; flex-shrink: 0;
  border: 2px solid var(--text-dim); position: relative;
  transition: border-color .2s, background .25s cubic-bezier(.34,1.56,.64,1), transform .25s cubic-bezier(.34,1.56,.64,1);
}
.task-item.done .checkbox {
  background: var(--ok); border-color: var(--ok); transform: scale(1.06);
}
.checkbox::after {
  content: ""; position: absolute; left: 8px; top: 3.5px;
  width: 6px; height: 12px;
  border: solid #16130f; border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg) scale(0); transition: transform .2s .05s cubic-bezier(.34,1.56,.64,1);
}
.task-item.done .checkbox::after { transform: rotate(45deg) scale(1); }

.task-text { flex: 1; min-width: 0; }
.task-title { font-weight: 500; font-size: 16px; position: relative; width: fit-content; max-width: 100%; }
.task-title::after {
  content: ""; position: absolute; left: 0; top: 55%; height: 1.5px;
  width: 0; background: var(--text-dim); transition: width .3s ease;
}
.task-item.done .task-title::after { width: 100%; }
.task-notes { font-size: 13px; color: var(--text-dim); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-badge {
  font-size: 11px; color: var(--text-dim); background: var(--surface-2);
  border-radius: 7px; padding: 3px 8px; flex-shrink: 0;
}

.empty-state { text-align: center; padding: 48px 20px; color: var(--text-dim); animation: rise .5s ease; }
.empty-state .big { font-size: 44px; margin-bottom: 12px; }
.empty-state .display { font-size: 22px; color: var(--text); margin-bottom: 6px; font-weight: 700; }

.all-done-hero {
  text-align: center; padding: 40px 20px 30px; animation: pop .5s cubic-bezier(.34,1.56,.64,1);
}
.all-done-hero .big { font-size: 56px; }
.all-done-hero .display { font-size: 26px; font-weight: 800; margin-top: 10px; }
.all-done-hero p { color: var(--text-dim); margin-top: 6px; font-size: 14.5px; }

/* ===== abas ===== */
.tabs {
  display: flex; gap: 6px; background: var(--surface-2);
  border-radius: 14px; padding: 5px; margin: 24px 0 20px;
}
.tab {
  flex: 1; text-align: center; padding: 9px 4px; border-radius: 10px;
  font-size: 14px; font-weight: 500; color: var(--text-dim);
  cursor: pointer; border: none; background: transparent; font-family: inherit;
  transition: background .2s, color .2s;
}
.tab.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 6px rgba(0,0,0,.18); }

/* ===== gerenciar tarefas ===== */
.manage-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px;
  animation: rise .4s ease backwards;
}
.manage-info { flex: 1; min-width: 0; }
.manage-title { font-weight: 500; }
.manage-sub { font-size: 13px; color: var(--text-dim); }
.mini-btn {
  border: 1px solid var(--line); background: transparent; color: var(--text-dim);
  border-radius: 10px; padding: 7px 11px; font-size: 13px; cursor: pointer;
  font-family: inherit; transition: border-color .2s, color .2s;
}
.mini-btn:hover { border-color: var(--accent); color: var(--text); }
.mini-btn.danger:hover { border-color: var(--danger); color: var(--danger); }

/* ===== histórico ===== */
.hist-day { margin-bottom: 20px; animation: rise .4s ease backwards; }
.hist-date {
  font-family: var(--font-display); font-weight: 700; font-size: 15px;
  margin-bottom: 8px; display: flex; align-items: center; gap: 10px;
}
.hist-score { font-size: 12.5px; font-weight: 500; color: var(--text-dim); background: var(--surface-2); padding: 3px 9px; border-radius: 8px; }
.hist-score.full { color: var(--ok); background: var(--ok-soft); }
.hist-items { display: flex; flex-direction: column; gap: 5px; }
.hist-item { display: flex; gap: 9px; font-size: 14px; padding: 6px 4px; align-items: baseline; }
.hist-item .dot { font-size: 12px; }
.hist-item.missed { color: var(--text-dim); }

/* ===== botões ===== */
.btn {
  border: none; border-radius: 14px; padding: 14px 22px;
  font-family: var(--font-display); font-weight: 700; font-size: 16px;
  cursor: pointer; transition: transform .15s, filter .2s;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--accent); color: #fff7f2; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost {
  background: transparent; border: 1px solid var(--line); color: var(--text);
  font-weight: 500; font-family: var(--font-body);
}
.btn-ghost:hover { border-color: var(--accent); }
.btn-block { width: 100%; }

.fab {
  position: fixed; right: 20px; bottom: calc(24px + env(safe-area-inset-bottom));
  z-index: 40;
  width: 58px; height: 58px; border-radius: 19px;
  background: var(--accent); color: #fff; border: none;
  font-size: 26px; cursor: pointer;
  box-shadow: 0 8px 24px rgba(224,122,79,.35);
  transition: transform .2s cubic-bezier(.34,1.56,.64,1);
  display: grid; place-items: center;
}
.fab:hover { transform: scale(1.07) rotate(90deg); }

/* ===== folha inferior (bottom sheet) ===== */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(10,8,5,.55); backdrop-filter: blur(3px);
  animation: fade .25s ease;
}
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 100;
  max-width: 620px; margin: 0 auto;
  background: var(--surface); border-radius: 24px 24px 0 0;
  border: 1px solid var(--line); border-bottom: none;
  padding: 14px 22px calc(26px + env(safe-area-inset-bottom));
  max-height: 88dvh; overflow-y: auto;
  animation: slideUp .35s cubic-bezier(.22,1,.36,1);
}
.sheet-handle {
  width: 42px; height: 4.5px; border-radius: 99px; background: var(--line);
  margin: 0 auto 18px;
}
.sheet h2 { font-size: 22px; font-weight: 800; margin-bottom: 18px; }

.field { margin-bottom: 16px; }
.field label {
  display: block; font-size: 13px; font-weight: 500; color: var(--text-dim);
  margin-bottom: 6px; text-transform: uppercase; letter-spacing: .08em;
}
.field input, .field select, .field textarea {
  width: 100%; background: var(--surface-2); border: 1px solid var(--line);
  color: var(--text); border-radius: 12px; padding: 13px 14px;
  font-family: inherit; font-size: 16px; outline: none;
  transition: border-color .2s;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); }
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; }
.field .hint { font-size: 12.5px; color: var(--text-dim); margin-top: 5px; text-transform: none; letter-spacing: 0; }

.seg { display: flex; gap: 6px; background: var(--surface-2); border-radius: 12px; padding: 5px; }
.seg button {
  flex: 1; border: none; background: transparent; color: var(--text-dim);
  padding: 9px 4px; border-radius: 9px; font-family: inherit; font-size: 14px;
  font-weight: 500; cursor: pointer; transition: background .2s, color .2s;
}
.seg button.on { background: var(--accent); color: #fff7f2; }

.weekdays { display: flex; gap: 6px; margin-top: 10px; }
.weekdays button {
  flex: 1; aspect-ratio: 1; border-radius: 10px; border: 1px solid var(--line);
  background: transparent; color: var(--text-dim); font-family: inherit;
  font-size: 13px; font-weight: 500; cursor: pointer;
  transition: background .2s, color .2s, border-color .2s;
}
.weekdays button.on { background: var(--accent); border-color: var(--accent); color: #fff7f2; }

.switch-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 0 16px;
}
.switch-row span { font-size: 15px; }
.switch { position: relative; width: 50px; height: 29px; flex-shrink: 0; }
.switch input { opacity: 0; width: 100%; height: 100%; position: absolute; cursor: pointer; z-index: 2; }
.switch .track {
  position: absolute; inset: 0; border-radius: 99px; background: var(--surface-2);
  border: 1px solid var(--line); transition: background .25s;
}
.switch .thumb {
  position: absolute; top: 3.5px; left: 4px; width: 21px; height: 21px;
  border-radius: 50%; background: var(--text-dim); transition: left .25s cubic-bezier(.34,1.56,.64,1), background .25s;
}
.switch input:checked ~ .track { background: var(--ok-soft); border-color: var(--ok); }
.switch input:checked ~ .thumb { left: 24px; background: var(--ok); }

.sheet-actions { display: flex; gap: 10px; margin-top: 22px; }
.sheet-actions .btn { flex: 1; }

.toast {
  position: fixed; bottom: calc(96px + env(safe-area-inset-bottom)); left: 50%;
  transform: translateX(-50%); z-index: 200;
  background: var(--surface-2); color: var(--text); border: 1px solid var(--line);
  border-radius: 12px; padding: 11px 18px; font-size: 14px; white-space: nowrap;
  animation: pop .3s cubic-bezier(.34,1.56,.64,1);
  box-shadow: 0 8px 30px rgba(0,0,0,.3);
}

/* ===== animações ===== */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateX(-50%) scale(.85); } to { opacity: 1; transform: translateX(-50%) scale(1); } }
.all-done-hero { animation-name: heroPop; }
@keyframes heroPop { from { opacity: 0; transform: scale(.9); } to { opacity: 1; transform: scale(1); } }
@keyframes slideUp { from { transform: translateY(60px); opacity: 0; } to { transform: none; opacity: 1; } }

@media (min-width: 700px) {
  main { padding-top: 44px; }
  .fab { right: calc(50% - 310px + 20px); }
}
