:root {
  --bg: #f4f6ee;
  --surface: #ffffff;
  --surface-2: #eef1e6;
  --border: #e1e5d6;
  --text: #14171a;
  --text-muted: #6b7280;
  --accent: #a7e635;
  --accent-ink: #1c2b06;
  --good: #65b81f;
  --warn: #f5a623;
  --bad: #ef4444;
  --shadow: 0 8px 24px rgba(20, 23, 26, 0.08);
  --shadow-lg: 0 20px 50px rgba(20, 23, 26, 0.14);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d0e10;
    --surface: #18191d;
    --surface-2: #212226;
    --border: #2c2d32;
    --text: #f2f3ef;
    --text-muted: #93959c;
    --accent: #b8ec3f;
    --accent-ink: #14210a;
    --good: #8fd94a;
    --warn: #ffab4d;
    --bad: #ff5d5d;
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.5);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* Login */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 32px 26px;
  width: 100%;
  max-width: 360px;
  text-align: center;
  box-shadow: var(--shadow-lg);
}
.login-card h1 {
  margin: 0 0 8px;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.login-card p { color: var(--text-muted); font-size: 14px; margin: 0 0 18px; }
.login-card code {
  background: var(--surface-2);
  padding: 1px 6px;
  border-radius: 5px;
  font-size: 13px;
}
.login-card input {
  width: 100%;
  padding: 13px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  margin-bottom: 14px;
}
.login-card input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.login-card button {
  width: 100%;
  padding: 13px;
  border-radius: 12px;
  border: none;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 15px;
  font-weight: 800;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.1s ease;
}
.login-card button:active { transform: scale(0.98); }
.error { color: var(--bad); font-size: 13px; min-height: 18px; margin: 10px 0 0; font-weight: 600; }

/* App shell */
.app { max-width: 760px; margin: 0 auto; padding: 0 16px 40px; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 0 16px;
}
.topbar h1 {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.logo-mark {
  font-size: 18px;
  background: var(--accent);
  color: var(--accent-ink);
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
}
.ghost-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 10px;
  padding: 6px 12px;
  font-size: 16px;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.ghost-btn:active { background: var(--surface-2); }

.tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 5px;
  margin-bottom: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.tab-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  padding: 10px 11px;
  border-radius: 12px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.15s ease, color 0.15s ease;
}
.tab-btn.active {
  color: var(--accent-ink);
  background: var(--accent);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeIn 0.2s ease; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.muted { color: var(--text-muted); font-size: 14px; }
h3.section-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 800;
  margin: 22px 0 10px;
}

.card-icon {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: inline-grid;
  place-items: center;
  font-size: 15px;
  background: var(--surface-2);
}

/* Score */
.score-overall-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 22px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.score-overall-label { font-size: 13px; color: var(--text-muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.score-overall-value {
  font-size: 52px;
  font-weight: 800;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.score-overall-sub { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

.bubble-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 24px 16px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: space-evenly;
  gap: 12px;
  flex-wrap: wrap;
}
.bubble {
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--accent-ink);
  font-weight: 800;
  text-align: center;
  line-height: 1.1;
  flex-shrink: 0;
}
.bubble .bubble-value { font-size: 1.4em; font-variant-numeric: tabular-nums; }
.bubble .bubble-label { font-size: 0.32em; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 700; opacity: 0.75; }

/* Financeiro */
.finance-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 8px; }
.finance-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px;
  box-shadow: var(--shadow);
}
.finance-card h3 {
  margin: 0 0 12px;
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 800;
}
.finance-line { display: flex; align-items: center; justify-content: space-between; font-size: 14px; margin-bottom: 8px; }
.finance-line .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.finance-line .dot.expense { background: var(--bad); }
.finance-line .dot.income { background: var(--good); }
.finance-line .amount { font-weight: 800; font-variant-numeric: tabular-nums; }
.finance-line .expense-text { color: var(--bad); }
.finance-line .income-text { color: var(--good); }
.finance-bar-track {
  height: 8px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
  display: flex;
  margin-top: 10px;
}
.finance-bar-expense { background: var(--bad); height: 100%; }
.finance-bar-income { background: var(--good); height: 100%; }

.goal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px 18px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
}
.goal-card .goal-title { font-size: 14px; font-weight: 700; margin-bottom: 10px; display: flex; justify-content: space-between; }
.goal-card .goal-title span:last-child { color: var(--good); font-weight: 800; }
.goal-bar-track { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.goal-bar-fill { height: 100%; border-radius: 999px; background: var(--accent); }
.goal-sub { font-size: 12px; color: var(--text-muted); margin-top: 8px; }

/* Clientes */
.search-input {
  width: 100%;
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.search-input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.memory-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 14px 16px;
  margin-bottom: 10px;
  display: flex;
  gap: 12px;
  box-shadow: var(--shadow);
}
.memory-avatar {
  width: 38px;
  height: 38px;
  min-width: 38px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 15px;
}
.memory-body { flex: 1; min-width: 0; }
.memory-item .contact { font-weight: 800; font-size: 14px; }
.memory-item .summary { font-size: 14px; color: var(--text); margin: 4px 0; line-height: 1.4; }
.memory-item .date { font-size: 12px; color: var(--text-muted); font-weight: 600; }

/* Agenda board */
.board {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
}
.board-col {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 14px;
  min-width: 220px;
  flex: 1;
  box-shadow: var(--shadow);
}
.board-col h3 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 800;
  margin: 0 0 12px;
}
.board-card {
  background: var(--surface-2);
  border-radius: 12px;
  padding: 11px 13px;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 600;
  position: relative;
  padding-left: 20px;
}
.board-card::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 14px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--col-color, var(--accent));
}
.board-card .item-date { color: var(--text-muted); font-size: 12px; margin-top: 3px; font-weight: 500; }
.energy-note {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--warn);
  border-radius: 14px;
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text);
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}

@media (min-width: 600px) {
  .score-overall-card { padding: 28px 32px; }
}
