/* ============================================================
   Olive Studio CRM — estilo
   Layout clínica moderna (sidebar clara, pílulas, Sora/Manrope)
   com a paleta oliva / sage / linho
   ============================================================ */

:root {
  --ink: #232a1c;
  --olive-900: #2e3722;
  --olive-700: #43512f;
  --olive: #5c6c40;
  --sage: #a3b085;
  --sage-soft: #e4e8d8;
  --linen: #f5f4ec;
  --card: #ffffff;
  --line: #e3e1d4;
  --muted: #7a7c6e;
  --gold: #a8861f;
  --gold-soft: #f4ecd4;
  --clay: #a64b2a;
  --clay-soft: #f6e4dc;
  --ok-soft: #e2ecd9;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(35, 42, 28, .08), 0 4px 16px rgba(35, 42, 28, .05);
  --display: "Sora", "Segoe UI", sans-serif;
  --body: "Manrope", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--body);
  background: var(--linen);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
}
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; color: var(--ink); }

/* ---------- login ---------- */
.login-screen {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(1200px 600px at 85% -10%, var(--sage-soft), transparent 60%),
    var(--linen);
  padding: 24px;
}
.login-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 48px 44px 40px;
  width: 100%; max-width: 400px;
}
.login-brand { text-align: center; margin-bottom: 32px; }
.login-brand h1 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 32px;
  margin: 10px 0 4px;
  letter-spacing: -.02em;
}
.login-brand h1 span { color: var(--olive); font-style: italic; font-weight: 400; margin-left: 6px; }
.login-tagline { color: var(--muted); font-size: 13.5px; margin: 0; font-style: italic; }
#login-form label { display: block; font-weight: 600; font-size: 13px; margin: 14px 0 5px; }
#login-form input {
  width: 100%; padding: 10px 16px;
  border: 1px solid var(--line); border-radius: 99px;
  background: var(--linen);
}
#login-form input:focus { outline: 2px solid var(--olive); outline-offset: 1px; }
#login-form button { margin-top: 22px; }
.login-erro { color: var(--clay); font-size: 13px; min-height: 18px; margin: 10px 0 0; text-align: center; }

.setup-card { max-width: 480px; }
.setup-title { font-family: var(--display); font-size: 24px; font-weight: 500; }
.setup-steps { padding-left: 20px; }
.setup-steps li { margin-bottom: 10px; }
.setup-steps code { background: var(--sage-soft); padding: 1px 6px; border-radius: 4px; font-size: 13px; }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--card);
  border-right: 1px solid var(--line);
  color: var(--ink);
  display: flex; flex-direction: column;
  padding: 28px 18px 20px;
  position: sticky; top: 0; height: 100vh;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 0 10px 26px; }
.sidebar-brand-name { font-family: var(--display); font-size: 19px; font-weight: 600; letter-spacing: -.02em; }
.sidebar-brand-name span { font-style: italic; font-weight: 400; color: var(--olive); margin-left: 4px; }
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar-nav a {
  color: #5a5f4b; text-decoration: none;
  padding: 10px 14px; border-radius: 99px;
  font-weight: 600; font-size: 14.5px;
}
.sidebar-nav a:hover { background: var(--sage-soft); }
.sidebar-nav a.ativa { background: var(--olive); color: #fff; }
.nav-sep { border-top: 1px solid var(--line); margin: 10px 6px; }
.var-chip { background: var(--sage-soft); padding: 1px 7px; border-radius: 5px; font-size: 12.5px; }
.sidebar-foot { margin-top: auto; padding: 0 6px; }
.btn-ghost {
  background: none; border: 1px solid var(--line);
  color: var(--muted); border-radius: 99px;
  padding: 8px 16px; font-size: 13.5px; width: 100%;
}
.btn-ghost:hover { border-color: var(--olive); color: var(--olive); }

.view { padding: 36px 44px 60px; max-width: 1180px; }
.view:focus { outline: none; }

/* ---------- componentes ---------- */
.page-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head h2 { font-family: var(--display); font-weight: 600; font-size: 26px; margin: 0; letter-spacing: -.02em; }
.page-sub { color: var(--muted); font-size: 14px; margin: 2px 0 0; }
.head-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.btn {
  border: none; border-radius: 99px;
  padding: 9px 18px; font-weight: 600; font-size: 14px;
}
.btn-primary { background: var(--olive); color: #fff; }
.btn-primary:hover { background: var(--olive-700); }
.btn-sec { background: var(--sage-soft); color: var(--olive-900); }
.btn-sec:hover { background: var(--sage); }
.btn-block { width: 100%; }
.btn-mini { padding: 4px 12px; font-size: 12.5px; }
.btn-danger { background: var(--clay-soft); color: var(--clay); }
.btn-danger:hover { background: var(--clay); color: #fff; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 28px; }
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow);
}
.card .card-label { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.card .card-num { font-family: var(--display); font-size: 28px; font-weight: 600; margin-top: 4px; letter-spacing: -.02em; }
.card .card-num small { font-size: 16px; color: var(--muted); font-family: var(--body); }
.card.alerta .card-num { color: var(--clay); }

.painel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px 24px; margin-bottom: 22px; }
.painel h3 { font-family: var(--display); font-weight: 600; font-size: 17px; margin: 0 0 14px; letter-spacing: -.01em; }

table.tabela { width: 100%; border-collapse: collapse; }
.tabela th {
  text-align: left; font-size: 12px; letter-spacing: .05em; text-transform: uppercase;
  color: var(--muted); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--line);
}
.tabela td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tabela tr:last-child td { border-bottom: none; }
.tabela tr.clicavel { cursor: pointer; }
.tabela tr.clicavel:hover td { background: var(--linen); }
.tabela .num { text-align: right; font-variant-numeric: tabular-nums; }

.tag { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; }
.tag-ok { background: var(--ok-soft); color: var(--olive-700); }
.tag-pend { background: var(--gold-soft); color: var(--gold); }
.tag-atraso { background: var(--clay-soft); color: var(--clay); }
.tag-neutro { background: var(--sage-soft); color: var(--olive-700); }

.busca {
  padding: 9px 16px; border: 1px solid var(--line); border-radius: 99px;
  background: var(--card); min-width: 260px;
}
.busca:focus { outline: 2px solid var(--olive); outline-offset: 1px; }

.vazio { color: var(--muted); text-align: center; padding: 28px 0; font-size: 14px; }

.btn-zap {
  display: inline-flex; align-items: center; gap: 5px;
  background: #ddefe0; color: #1d7a4f;
  border-radius: 99px; padding: 4px 12px;
  font-size: 12.5px; font-weight: 700; text-decoration: none;
  white-space: nowrap;
}
.btn-zap:hover { background: #c9e6cf; }
.btn-zap svg { width: 14px; height: 14px; flex: none; }

/* ---------- modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(35, 42, 28, .45);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 60px 20px; z-index: 50; overflow-y: auto;
}
.modal {
  background: var(--card); border-radius: 20px; box-shadow: var(--shadow);
  width: 100%; max-width: 520px; padding: 26px 28px;
}
.modal h3 { font-family: var(--display); font-weight: 600; font-size: 19px; margin: 0 0 18px; letter-spacing: -.01em; }
.modal .form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.modal .form-grid .campo-full { grid-column: 1 / -1; }
.campo label { display: block; font-weight: 600; font-size: 12.5px; margin-bottom: 4px; }
.campo input, .campo select, .campo textarea {
  width: 100%; padding: 8px 12px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--linen);
}
.campo input:focus, .campo select:focus, .campo textarea:focus { outline: 2px solid var(--olive); outline-offset: 1px; }
.campo textarea { resize: vertical; min-height: 64px; }
.modal-acoes { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }

/* ---------- agenda ---------- */
.agenda-nav { display: flex; align-items: center; gap: 12px; }
.agenda-nav .semana-label { font-weight: 700; min-width: 180px; text-align: center; }
.agenda-grade { overflow-x: auto; }
.agenda-grade table { border-collapse: separate; border-spacing: 6px; width: 100%; }
.agenda-grade th { font-size: 12.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 4px; }
.agenda-grade th.hoje { color: var(--olive); }
.agenda-grade td.hora-col { font-weight: 700; font-size: 13px; color: var(--muted); white-space: nowrap; padding-right: 8px; font-variant-numeric: tabular-nums; }
.slot {
  background: var(--card); border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; min-width: 128px; min-height: 62px; cursor: pointer;
  vertical-align: top; transition: border-color .12s;
}
.slot:hover { border-color: var(--olive); }
.slot.cheio { background: var(--sage-soft); }
.slot.vazio-slot { background: transparent; border-style: dashed; cursor: default; }
.slot .ocupacao { display: flex; gap: 3px; margin-bottom: 5px; }
.slot .ponto { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.slot .ponto.on { background: var(--olive); }
.slot .nomes { font-size: 12px; line-height: 1.35; color: var(--ink); }
.slot .nomes .falta-nome { color: var(--clay); text-decoration: line-through; }
.slot .modalidade-tag { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }

/* ---------- presença ---------- */
.aula-bloco { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 14px; background: var(--card); }
.aula-bloco h4 { margin: 0 0 10px; font-size: 15px; }
.aula-bloco h4 .modalidade-tag { margin-left: 8px; }
.chamada-linha { display: flex; align-items: center; justify-content: space-between; padding: 7px 0; border-bottom: 1px dashed var(--line); gap: 10px; }
.chamada-linha:last-child { border-bottom: none; }
.chamada-botoes { display: flex; gap: 6px; }
.btn-toggle { border: 1px solid var(--line); background: var(--card); border-radius: 99px; padding: 4px 14px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.btn-toggle.on-presente { background: var(--olive); border-color: var(--olive); color: #fff; }
.btn-toggle.on-falta { background: var(--clay); border-color: var(--clay); color: #fff; }

/* ---------- toast ---------- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(80px);
  background: var(--olive-900); color: var(--linen);
  padding: 11px 22px; border-radius: 99px; font-size: 14px; font-weight: 600;
  box-shadow: var(--shadow); transition: transform .25s ease; z-index: 99;
}
.toast.show { transform: translateX(-50%) translateY(0); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center; flex-wrap: wrap; gap: 8px; padding: 14px; }
  .sidebar-brand { padding: 0 8px 0 0; }
  .sidebar-nav { flex-direction: row; flex-wrap: wrap; }
  .sidebar-foot { margin-top: 0; margin-left: auto; }
  .view { padding: 20px; }
}
