@import url("https://fonts.googleapis.com/css2?family=Fraunces:ital,wght@0,400;0,600;1,400&family=DM+Sans:wght@400;500;700&family=Caveat:wght@500&display=swap");

:root {
  /* Paleta do Brandbook Cátia Lopes */
  --areia: #F6EFE6;      /* Areia Clara · fundo */
  --salmao: #F3D8BB;     /* Salmão Claro · principal */
  --cafe: #3B2A24;       /* Café Torrado · texto e força */
  --leite: #C9A88A;      /* Café com Leite · apoio */
  --baunilha: #EFE4C6;   /* Baunilha · fundo suave */
  --rosa: #EBC3C6;       /* Rosa Algodão · toque */
  --ceu: #C3E0EA;        /* Céu de Manhã · toque fresco */

  /* Papéis na app */
  --magenta: var(--cafe);        /* destaque e botões */
  --magenta-soft: var(--salmao); /* realces suaves */
  --teal: var(--cafe);
  --ink: var(--cafe);
  --muted: rgba(59, 42, 36, .72);
  --line: rgba(201, 168, 138, .55);
  --card: var(--baunilha);
  --bg: var(--areia);
  --ok: var(--cafe);
  --ok-soft: var(--ceu);
  --warn: var(--cafe);
  --warn-soft: var(--salmao);
  --radius: 10px;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "DM Sans", "Helvetica Neue", Arial, sans-serif;
  --mono: "DM Sans", "Helvetica Neue", Arial, sans-serif;
  --nota: "Caveat", "Segoe Print", cursive;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; }
code { font-family: var(--mono); font-size: 0.9em; background: var(--card); padding: 1px 5px; border-radius: 4px; }

.eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 6px;
}
.eyebrow.teal { color: var(--teal); }
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -0.01em; font-family: var(--serif); }
h1 { font-size: 30px; font-weight: 400; }
h2 { font-size: 21px; font-weight: 400; }
h3 { font-size: 17px; font-weight: 600; }
.muted { color: var(--muted); }

/* ---------- Botões e campos ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); background: var(--bg);
  border-radius: 8px; padding: 9px 14px; cursor: pointer;
  font-weight: 600; font-size: 14px; text-decoration: none;
  transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--card); }
.btn.primary { background: var(--cafe); border-color: var(--cafe); color: var(--areia); }
.btn.primary:hover { background: #2A1D18; }
.btn.ghost { border-color: transparent; }
.btn.danger { color: var(--cafe); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.small { padding: 6px 10px; font-size: 13px; }

.field { display: block; margin: 0 0 22px; }
.field label, .field .label { display: block; font-weight: 600; margin-bottom: 4px; }
.field .help { font-size: 13px; color: var(--muted); margin: 0 0 8px; }
.field .examples { font-size: 13px; color: var(--muted); margin: 0 0 8px; }
.field .examples em { font-style: normal; color: var(--ink); }
input[type=text], input[type=email], input[type=password], input[type=date], textarea, select {
  width: 100%; border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; background: #FFFCF8; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 96px; resize: vertical; }
input:focus, textarea:focus, select:focus { border-color: var(--leite); box-shadow: 0 0 0 3px var(--salmao); }

.badge {
  display: inline-block; font-size: 12px; font-weight: 600;
  padding: 2px 9px; border-radius: 999px; background: var(--card); color: var(--muted);
  white-space: nowrap;
}
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.pink { background: var(--rosa); color: var(--cafe); }

/* ---------- Layout dashboard ---------- */
.shell { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.sidebar {
  border-right: 1px solid var(--line); background: var(--card);
  padding: 22px 16px; display: flex; flex-direction: column; gap: 18px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { display: flex; align-items: baseline; gap: 8px; padding: 0 6px; }
.brand-word { font-family: var(--serif); font-weight: 600; font-size: 22px; letter-spacing: 0.06em; }
.brand-word span { font-style: italic; font-weight: 400; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px;
  text-decoration: none; font-weight: 600; font-size: 14px; color: var(--ink);
}
.nav-item:hover { background: rgba(201,168,138,.22); }
.nav-item.active { background: #FFFCF8; box-shadow: 0 0 0 1px var(--line); }
.nav-item.disabled { color: rgba(59,42,36,.45); pointer-events: none; }
.nav-letter {
  width: 24px; height: 24px; border-radius: 6px; display: grid; place-items: center;
  background: var(--areia); color: var(--cafe); font-family: var(--serif); font-weight: 600; font-size: 14px;
  box-shadow: 0 0 0 1px var(--line); flex-shrink: 0;
}
.nav-sub { margin-left: 22px; padding-left: 12px; border-left: 1px solid var(--line); display: flex; flex-direction: column; gap: 1px; }
.nav-sub a { padding: 5px 10px; font-size: 13.5px; text-decoration: none; border-radius: 6px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-sub a:hover { background: rgba(201,168,138,.22); color: var(--ink); }
.nav-sub a.active { color: var(--magenta); font-weight: 700; }
.sidebar-foot { margin-top: auto; font-size: 13px; color: var(--muted); padding: 0 6px; display: flex; flex-direction: column; gap: 8px; }

.main { padding: 32px 40px 80px; max-width: 1080px; width: 100%; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 26px; flex-wrap: wrap; }

/* ---------- Pilares (como no teu método) ---------- */
.pillars { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 30px; }
.pillar {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; text-decoration: none; display: block;
}
.pillar .L { font-family: var(--serif); color: var(--magenta); font-weight: 600; font-size: 34px; line-height: 1; }
.pillar h3 { margin-top: 10px; }
.pillar .sub { font-size: 12px; color: var(--muted); }
.pillar .q { font-size: 12.5px; font-style: italic; margin-top: 6px; }
.pillar.off { opacity: .55; }
.pillar.on { border-color: var(--magenta); box-shadow: 0 0 0 1px var(--magenta); }

.hero-pillar { display: grid; grid-template-columns: 90px 1fr; gap: 18px; margin-bottom: 26px; }
.hero-pillar .big { font-family: var(--serif); color: var(--magenta); font-weight: 600; font-size: 96px; line-height: .9; }
.hero-pillar .big small { display: block; font-family: var(--mono); font-size: 10px; letter-spacing: .14em; color: var(--ink); margin-top: 8px; }
.question-box { background: var(--salmao); border-radius: var(--radius); padding: 14px 18px; font-family: var(--serif); font-weight: 400; font-size: 19px; margin-top: 12px; }

/* ---------- Tabela de clientes ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 500; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr.row { cursor: pointer; }
.table tr.row:hover td { background: var(--card); }
.dots { display: flex; gap: 4px; }
.dot { width: 22px; height: 22px; border-radius: 5px; display: grid; place-items: center; font-size: 11px; font-weight: 800; background: var(--card); color: rgba(59,42,36,.45); border: 1px solid var(--line); }
.dot.em_curso { background: var(--magenta-soft); color: var(--magenta); border-color: var(--leite); }
.dot.concluido { background: var(--cafe); color: var(--areia); border-color: var(--magenta); }

.bar { height: 6px; background: var(--baunilha); box-shadow: inset 0 0 0 1px var(--line); border-radius: 99px; overflow: hidden; min-width: 70px; }
.bar > i { display: block; height: 100%; background: var(--magenta); border-radius: 99px; }

.empty { text-align: center; padding: 50px 20px; border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted); }

/* ---------- Ficha do cliente ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 24px; overflow-x: auto; }
.tab { padding: 10px 14px; text-decoration: none; font-weight: 600; font-size: 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab.active { color: var(--magenta); border-color: var(--magenta); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card.white { background: #FFFCF8; }
.link-row { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.link-row input { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12.5px; background: #FFFCF8; }
.section-title { display: flex; align-items: center; gap: 10px; margin: 30px 0 14px; }
.section-title:first-child { margin-top: 0; }
.section-title .num { font-family: var(--serif); font-size: 15px; color: var(--leite); }
.answer { background: #FFFCF8; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; white-space: pre-wrap; min-height: 42px; }
.answer.emptyans { color: rgba(59,42,36,.45); font-style: italic; }
.save-status { font-size: 13px; color: var(--muted); }
.pillar-select { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.pillar-select label { font-size: 12px; font-weight: 700; display: block; margin-bottom: 4px; }
.pillar-select select { padding: 6px 8px; font-size: 13px; }
.export-box { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12.5px; min-height: 360px; background: #FFFCF8; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }

/* ---------- Modal ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(59,42,36,.45); display: grid; place-items: center; padding: 16px; z-index: 50; }
.modal { background: #FFFCF8; border-radius: 14px; padding: 24px; width: 100%; max-width: 440px; }
.modal h2 { margin-bottom: 16px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; }

.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--cafe); color: var(--areia); padding: 10px 16px; border-radius: 8px; font-size: 14px; z-index: 60; }

/* ---------- Login e setup ---------- */
.center-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: var(--card); }
.login-card, .setup-card { background: #FFFCF8; border: 1px solid var(--line); border-radius: 14px; padding: 30px; width: 100%; max-width: 400px; }
.setup-card { max-width: 520px; }
.login-card .brand { padding: 0; margin-bottom: 20px; }
.error { color: var(--cafe); font-size: 14px; margin: 0 0 12px; }

/* ---------- Formulário do cliente ---------- */
.form-page { background: var(--card); min-height: 100vh; }
.form-top { background: #FFFCF8; border-bottom: 1px solid var(--line); }
.form-top-inner, .form-wrap { max-width: 720px; margin: 0 auto; padding: 0 16px; }
.form-top-inner { display: flex; justify-content: space-between; align-items: center; height: 60px; }
.form-hero { padding: 40px 0 10px; }
.form-hero h1 { font-size: 38px; margin: 4px 0 10px; }
.form-hero p { color: var(--muted); max-width: 560px; }
.steps { display: flex; gap: 6px; margin: 24px 0; }
.steps button { flex: 1; height: 6px; border: 0; border-radius: 99px; background: var(--baunilha); cursor: pointer; padding: 0; }
.steps button.done { background: var(--leite); }
.steps button.current { background: var(--magenta); }
.form-card { background: #FFFCF8; border: 1px solid var(--line); border-radius: 14px; padding: 28px; margin-bottom: 18px; }
.form-card .section-head { margin-bottom: 22px; }
.form-card .section-head p { color: var(--muted); margin: 6px 0 0; }
.form-nav { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding-bottom: 60px; flex-wrap: wrap; }
.thanks { text-align: center; padding: 50px 28px; }
.thanks .L { font-family: var(--serif); font-size: 64px; color: var(--magenta); font-weight: 800; line-height: 1; }

/* ---------- Telemóvel ---------- */
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .main { padding: 22px 16px 60px; }
  .pillars { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .hero-pillar { grid-template-columns: 1fr; }
  .hero-pillar .big { font-family: var(--serif); font-size: 56px; }
  .pillar-select { grid-template-columns: repeat(3, 1fr); }
  .table .hide-sm { display: none; }
  .form-card { padding: 20px; }
}

/* Toques do Brandbook */
.nota { font-family: var(--nota); font-weight: 500; font-size: 22px; line-height: 1.2; }
.sidebar { background: var(--baunilha); }
.nav-item.active { background: var(--areia); }
.card.white, .answer, .form-card, .login-card, .setup-card, .modal, .form-top { background: #FFFCF8; }
input[type=text], input[type=email], input[type=password], input[type=date], textarea, select { background: #FFFCF8; }
.pillar.on { background: var(--salmao); border-color: var(--cafe); box-shadow: none; }
.table tr.row:hover td { background: rgba(239,228,198,.6); }
:focus-visible { outline: 2px solid var(--cafe); outline-offset: 2px; }

/* ---------- Cliente primeiro, pilares dentro ---------- */
.nav-clients { display: flex; flex-direction: column; gap: 1px; }
.nav-client { padding: 7px 10px; border-radius: 8px; text-decoration: none; font-size: 14px; font-weight: 500; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-client:hover { background: rgba(201,168,138,.22); }
.nav-client.active { background: var(--areia); font-weight: 700; box-shadow: 0 0 0 1px var(--line); }
.nav-pillars { display: flex; flex-direction: column; gap: 1px; margin: 4px 0 8px 14px; padding-left: 10px; border-left: 1px solid var(--line); }
.nav-pillars a { display: flex; align-items: center; gap: 8px; padding: 4px 8px; font-size: 13.5px; text-decoration: none; border-radius: 6px; color: var(--muted); }
.nav-pillars a:hover { background: rgba(201,168,138,.22); color: var(--ink); }
.nav-pillars a.active { color: var(--ink); font-weight: 700; }
.nav-pillars .dot { width: 20px; height: 20px; font-size: 10.5px; }

.pillar-tabs { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-bottom: 22px; }
.pillar-tab { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--baunilha); text-decoration: none; }
.pillar-tab .L { font-family: var(--serif); font-weight: 600; font-size: 26px; line-height: 1; }
.pillar-tab .n { font-family: var(--serif); font-size: 16px; }
.pillar-tab .s { font-size: 12px; color: var(--muted); }
.pillar-tab .s.em_curso::before, .pillar-tab .s.concluido::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; background: var(--leite); vertical-align: 1px; }
.pillar-tab .s.concluido::before { background: var(--cafe); }
.pillar-tab:hover { border-color: var(--leite); }
.pillar-tab.active { background: var(--salmao); border-color: var(--cafe); }

.pillar-bar { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin: 4px 0 18px; }
.pillar-bar-title { display: flex; align-items: center; gap: 14px; }
.big-letter { font-family: var(--serif); font-weight: 600; font-size: 56px; line-height: .9; }
.pillar-state { font-size: 13px; font-weight: 600; display: flex; flex-direction: column; gap: 4px; min-width: 170px; }
.pillar-state select { padding: 7px 10px; font-weight: 400; }
.plan { margin: 10px 0 0; padding-left: 18px; }
.plan li { margin: 4px 0; }

@media (max-width: 860px) {
  .pillar-tabs { grid-template-columns: repeat(5, minmax(64px, 1fr)); overflow-x: auto; }
  .pillar-tab .n, .pillar-tab .s { display: none; }
  .pillar-tab { align-items: center; padding: 10px 6px; }
  .big-letter { font-size: 42px; }
}
