:root{
  --bg: #0A0A0C;
  --surface: #17181C;
  --surface-2: #202226;
  --border: #2C2E33;
  --ink: #ECEAE2;
  --ink-muted: #98998F;
  --accent: #F0B90B;
  --accent-contrast: #171204;
  --accent-soft: #2C2308;
  --muted-soft: #24262B;
  --info: #4FA6E8;
  --info-soft: #12283A;
  --good: #3ED598;
  --good-soft: #12301F;
  --warn: #FF9F45;
  --warn-soft: #3A2410;
  --bad: #FF5C5C;
  --bad-soft: #3A1414;
  --shadow: 0 1px 2px rgba(0,0,0,0.5), 0 16px 32px -16px rgba(0,0,0,0.8);
  --glow: 0 0 0 1px rgba(240,185,11,0.4), 0 0 22px -4px rgba(240,185,11,0.35);
}

*{ box-sizing: border-box; }
html, body{ margin:0; padding:0; height:100%; }
body{
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background:
    radial-gradient(ellipse 900px 500px at 12% -10%, rgba(240,185,11,0.06), transparent 60%),
    linear-gradient(rgba(6,6,8,0.86), rgba(6,6,8,0.92)),
    var(--bg);
  color: var(--ink);
  min-height: 100vh;
}
[hidden]{ display:none !important; }
button, input, select, textarea{ font-family: inherit; }
a{ color: var(--accent); }

/* ---------- Login (gate) ---------- */
.gate{
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(rgba(6,6,8,0.78), rgba(6,6,8,0.90)), url('/assets/gate-frame.jpg') center/cover no-repeat;
  padding: 20px;
}
.gate-card{
  width: 100%;
  max-width: 380px;
  background: rgba(23,24,28,0.92);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px 28px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
}
.gate-title{
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--accent);
  margin: 0 0 4px;
  text-align: center;
}
.gate-sub{
  color: var(--ink-muted);
  font-size: 13px;
  text-align: center;
  margin: 0 0 24px;
}
.field{ margin-bottom: 14px; }
.field label{ display:block; font-size:12px; color: var(--ink-muted); margin-bottom:6px; }
.field input, .field select, .field textarea{
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--ink);
  padding: 10px 12px;
  font-size: 14px;
}
.field input:focus, .field select:focus, .field textarea:focus{
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--glow);
}
.btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--ink);
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.btn:hover{ border-color: var(--accent); }
.btn-primary{
  background: var(--accent);
  color: var(--accent-contrast);
  border-color: var(--accent);
  width: 100%;
}
.btn-primary:hover{ filter: brightness(1.06); }
.btn-danger{ border-color: var(--bad); color: var(--bad); background: transparent; }
.btn-small{ padding: 6px 10px; font-size: 12px; }
.gate-error{
  color: var(--bad);
  font-size: 13px;
  text-align: center;
  margin-top: 10px;
  min-height: 18px;
}

/* ---------- App shell ---------- */
.app-shell{ display:flex; min-height:100vh; }
.sidebar{
  width: 220px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 20px 14px;
  display:flex; flex-direction:column; gap:4px;
}
.brand{
  color: var(--accent);
  font-weight: 800;
  font-size: 16px;
  letter-spacing: 0.03em;
  padding: 0 8px 18px;
}
.side-item{
  display:flex; align-items:center; gap:10px;
  padding: 10px 10px;
  border-radius: 8px;
  color: var(--ink-muted);
  background: transparent;
  border: none;
  text-align: left;
  cursor: pointer;
  font-size: 14px;
}
.side-item:hover{ background: var(--surface-2); color: var(--ink); }
.side-item.active{ background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.sidebar-foot{ margin-top:auto; padding-top: 14px; border-top: 1px solid var(--border); }
.whoami{ font-size: 12px; color: var(--ink-muted); padding: 0 10px 8px; }
.whoami b{ color: var(--ink); }

.main{ flex:1; min-width:0; padding: 26px 30px 60px; }
.view{ display:none; }
.view.active{ display:block; }
.page-title{ font-size: 20px; font-weight: 700; margin: 0 0 4px; }
.page-sub{ color: var(--ink-muted); font-size: 13px; margin: 0 0 22px; }

.grid{ display:grid; gap:16px; }
.grid-2{ grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid-3{ grid-template-columns: repeat(3, minmax(0,1fr)); }
@media (max-width: 900px){ .grid-2, .grid-3{ grid-template-columns: 1fr; } }

.card{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
}
.card h3{ margin: 0 0 12px; font-size: 14px; color: var(--ink); }
.card h3 small{ color: var(--ink-muted); font-weight: 400; }

.task-row{
  display:flex; align-items:center; gap:10px;
  padding: 9px 6px;
  border-bottom: 1px solid var(--border);
}
.task-row:last-child{ border-bottom: none; }
.task-row .cat-pill{
  font-size: 11px; padding: 2px 8px; border-radius: 999px;
  background: var(--muted-soft); color: var(--ink-muted); white-space:nowrap;
}
.task-row .txt{ flex:1; font-size: 14px; }
.task-row .txt[contenteditable]{ outline:none; }
.task-row .due{ font-size:12px; color: var(--ink-muted); white-space:nowrap; }
.status-select{
  font-size: 12px; border-radius: 999px; border: 1px solid var(--border);
  padding: 4px 8px; background: var(--surface-2); color: var(--ink);
}
.del-btn{
  background:none; border:none; color: var(--ink-muted); cursor:pointer; font-size: 14px;
  visibility: hidden;
}
.task-row:hover .del-btn{ visibility: visible; }
.del-btn:hover{ color: var(--bad); }

.add-row{ display:flex; gap:8px; margin-top:12px; flex-wrap: wrap; }
.add-row input{
  flex:1; min-width: 120px;
  background: var(--surface-2); border:1px solid var(--border); border-radius:8px;
  color: var(--ink); padding: 8px 10px; font-size: 13px;
}
.add-row input.due{ max-width: 90px; flex: 0 0 90px; }

/* ---------- Rotina diária (grade com dias em colunas) ---------- */
.rotina-scroll{ overflow-x: auto; }
table.rotina-table{ border-collapse: collapse; font-size: 12px; white-space: nowrap; }
table.rotina-table th, table.rotina-table td{
  border: 1px solid var(--border);
  padding: 6px 8px;
  text-align: center;
}
table.rotina-table thead th{ color: var(--ink-muted); font-weight:600; background: var(--surface); }
table.rotina-table th.rotina-col-tarefa, table.rotina-table td.rotina-col-tarefa{
  text-align: left;
  white-space: normal;
  min-width: 200px;
  max-width: 280px;
  position: sticky;
  left: 0;
  background: var(--surface);
}
td.rotina-cell{ width: 40px; color: var(--ink-muted); }
td.rotina-cell.clicavel{ cursor: pointer; }
td.rotina-cell.clicavel:hover{ background: var(--surface-2); }
td.rotina-cell.feito{ color: var(--good); font-weight: 700; background: var(--good-soft); }

.notepad{
  min-height: 140px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  font-size: 13px;
  line-height: 1.5;
  outline: none;
  white-space: pre-wrap;
}

.pessoas-grid{ display:grid; grid-template-columns: repeat(auto-fill, minmax(180px,1fr)); gap:14px; }
.pessoa-card{
  background: var(--surface); border:1px solid var(--border); border-radius: 12px;
  padding: 16px; cursor:pointer; text-align:center;
}
.pessoa-card:hover{ border-color: var(--accent); }
.avatar{
  width:48px; height:48px; border-radius:50%;
  display:flex; align-items:center; justify-content:center;
  margin: 0 auto 10px;
  background: var(--accent-soft); color: var(--accent); font-weight:700;
}
.pessoa-nome{ font-size: 14px; font-weight:600; }
.pessoa-meta{ font-size: 12px; color: var(--ink-muted); margin-top:2px; }

.back-btn{ margin-bottom: 16px; }

.recado-item{
  padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13px;
}
.recado-item:last-child{ border-bottom:none; }
.recado-meta{ color: var(--ink-muted); font-size: 11px; margin-top: 2px; }

table.rel-table{ width:100%; border-collapse: collapse; font-size: 13px; }
table.rel-table th, table.rel-table td{
  text-align:left; padding: 8px 10px; border-bottom: 1px solid var(--border);
}
table.rel-table th{ color: var(--ink-muted); font-weight:600; font-size:12px; }

.save-indicator{
  position: fixed; top: 14px; right: 18px;
  display:flex; align-items:center; gap:8px;
  background: var(--surface); border:1px solid var(--border); border-radius:999px;
  padding: 6px 12px; font-size: 12px; color: var(--ink-muted);
  box-shadow: var(--shadow); z-index: 50;
}
.save-indicator .dot{ width:8px; height:8px; border-radius:50%; background: var(--good); }
.save-indicator[data-state="saving"] .dot{ background: var(--warn); }
.save-indicator[data-state="error"] .dot{ background: var(--bad); }

.toolbar{ display:flex; gap:10px; align-items:center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar input, .toolbar select{
  background: var(--surface-2); border:1px solid var(--border); border-radius:8px;
  color: var(--ink); padding: 8px 10px; font-size: 13px;
}

/* ---------- Email Marketing (Brevo) ---------- */
.mkt-progress-row{ display:flex; align-items:center; gap:12px; margin-bottom:6px; }
.mkt-bar{ flex:1; height:10px; border-radius:6px; background: var(--surface-2); border:1px solid var(--border); overflow:hidden; }
.mkt-bar-fill{ height:100%; background: var(--accent); border-radius:6px; transition: width .3s ease; }
.mkt-progress-row span{ font-size:13px; color: var(--ink-muted); min-width:38px; text-align:right; }

@media (max-width: 760px){
  .app-shell{ flex-direction: column; }
  .sidebar{ width:100%; flex-direction: row; overflow-x:auto; border-right:none; border-bottom:1px solid var(--border); }
  .sidebar-foot{ display:none; }
  .brand{ display:none; }
  .main{ padding: 18px; }
}
