:root {
  --ink: #1a1611;
  --paper: #faf8f3;
  --card: #ffffff;
  --amber: #f2a900;
  --slate: #75695a;
  --line: #e7e1d2;
  --danger: #b4402a;
  --danger-bg: #fbeee9;
  --sidebar-w: 240px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  background: var(--paper);
  color: var(--ink);
}
button { font-family: inherit; cursor: pointer; }
a { color: inherit; }
input, select, textarea, button { font-family: inherit; }

.hidden { display: none !important; }

/* ---------- Login ---------- */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-box { width: 100%; max-width: 380px; }
.login-logo { width: 84px; height: auto; margin-bottom: 24px; display: block; }
.login-box h1 { font-size: 26px; font-weight: 900; letter-spacing: -0.02em; margin: 0 0 6px; }
.login-sub { color: var(--slate); font-size: 14px; margin: 0 0 28px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; font-weight: 700; color: var(--slate); margin-bottom: 5px; text-transform: uppercase; letter-spacing: .04em; }
.error-box {
  background: var(--danger-bg); color: var(--danger); border: 1px solid #e3c9c2;
  padding: 10px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 14px;
}

/* ---------- Layout do app ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0; background: var(--ink);
  padding: 18px 14px; display: flex; flex-direction: column;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 0 4px; margin-bottom: 28px; }
.sidebar-brand img { width: 30px; height: 30px; }
.sidebar-brand span { color: var(--paper); font-weight: 900; font-size: 14px; letter-spacing: -0.01em; }
.nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.nav-btn {
  display: flex; align-items: center; gap: 10px; background: transparent; border: none;
  color: #c9c2b4; font-size: 14px; font-weight: 600; padding: 10px 12px; border-radius: 8px; text-align: left;
}
.nav-btn svg { flex-shrink: 0; }
.nav-btn.active { background: var(--amber); color: var(--ink); }
.sidebar-footer { border-top: 1px solid #33291c; padding-top: 14px; margin-top: 14px; }
.sidebar-user { display: flex; align-items: center; gap: 8px; padding: 0 4px; margin-bottom: 10px; }
.sidebar-user-name { color: var(--paper); font-size: 13px; font-weight: 700; }
.sidebar-user-role { color: #9c9384; font-size: 11px; }
.sidebar-link { background: none; border: none; color: #c9c2b4; font-size: 12px; font-weight: 600; padding: 4px; text-align: left; width: 100%; }

.main { flex: 1; padding: 32px; overflow-x: hidden; }
.main-inner { max-width: 1100px; }

/* ---------- Avatares / badges ---------- */
.avatar {
  border-radius: 999px; background: var(--ink); color: var(--amber);
  display: flex; align-items: center; justify-content: center; font-weight: 900; flex-shrink: 0;
}

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 14px;
  padding: 9px 16px; border-radius: 8px; border: none; opacity: 1; transition: opacity .15s;
}
.btn:hover { opacity: .8; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn-primary { background: var(--ink); color: var(--paper); }
.btn-accent { background: var(--amber); color: var(--ink); }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn-danger { background: transparent; color: var(--danger); border: 1px solid #e3c9c2; }
.btn-small { font-size: 12px; padding: 6px 10px; border-radius: 6px; }
.icon-btn { background: none; border: none; opacity: .4; padding: 2px; }
.icon-btn:hover { opacity: 1; }

/* ---------- Inputs ---------- */
.input, .textarea, select.select {
  width: 100%; font-size: 14px; padding: 9px 12px; border-radius: 8px;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
}
.textarea { resize: vertical; }

/* ---------- Headings ---------- */
.page-title { font-size: 24px; font-weight: 900; letter-spacing: -0.02em; margin: 0 0 2px; }
.page-sub { color: var(--slate); font-size: 14px; margin: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 24px; }

/* ---------- Cards / grids ---------- */
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px;
  position: relative;
}
.client-card { cursor: pointer; transition: box-shadow .15s; }
.client-card:hover { box-shadow: 0 2px 10px rgba(0,0,0,.06); }
.client-card .icon-btn { position: absolute; top: 12px; right: 12px; opacity: 0; }
.client-card:hover .icon-btn { opacity: .5; }
.client-card .icon-btn:hover { opacity: 1; }
.empty { text-align: center; color: var(--slate); font-style: italic; padding: 40px 0; font-size: 14px; }

/* ---------- Kanban ---------- */
.kanban { display: flex; gap: 16px; overflow-x: auto; padding-bottom: 12px; }
.kanban-col { flex-shrink: 0; width: 250px; }
.kanban-col-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; padding: 0 2px; }
.kanban-col-head h3 { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--slate); margin: 0; }
.kanban-count { font-size: 11px; font-weight: 800; background: var(--line); color: var(--ink); border-radius: 999px; width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; }
.kanban-items { display: flex; flex-direction: column; gap: 8px; min-height: 20px; }
.kanban-card { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; box-shadow: 0 1px 2px rgba(0,0,0,.03); }
.kanban-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.kanban-card-title { font-size: 13px; font-weight: 600; margin: 0; }
.kanban-card-meta { font-size: 11px; color: var(--slate); margin-top: 5px; }
.kanban-card select { margin-top: 8px; width: 100%; font-size: 12px; padding: 4px 6px; border-radius: 6px; border: 1px solid var(--line); background: transparent; }
.kanban-empty { font-size: 12px; font-style: italic; color: var(--slate); padding: 0 2px; }

/* ---------- Formulários inline ---------- */
.inline-form { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-bottom: 20px; display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
.inline-form.stacked { flex-direction: column; align-items: stretch; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.grow { flex: 1; min-width: 180px; }

/* ---------- Toggle pills ---------- */
.pill { font-size: 12px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--ink); font-weight: 700; }
.pill.active { background: var(--ink); color: var(--amber); border-color: var(--ink); }

/* ---------- Reuniões ---------- */
.meeting-card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-bottom: 12px; }
.meeting-card-top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 8px; }
.meeting-date { font-weight: 800; font-size: 14px; margin: 0; }
.meeting-participants { font-size: 12px; color: var(--slate); margin: 2px 0 0; }
.meeting-line { font-size: 14px; margin: 4px 0; }

/* ---------- Calendário ---------- */
.cal-nav { display: flex; align-items: center; gap: 8px; }
.cal-nav-btn { border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 6px; display: flex; }
.cal-range { font-size: 14px; font-weight: 700; width: 170px; text-align: center; }
.cal-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.cal-day { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px; min-height: 130px; }
.cal-day.today { border: 2px solid var(--amber); }
.cal-day-label { font-size: 11px; font-weight: 800; text-transform: uppercase; color: var(--slate); margin: 0 0 8px; }
.cal-item { font-size: 11px; padding: 5px 7px; border-radius: 6px; border: 1px solid var(--line); margin-bottom: 5px; }
.cal-item.meeting { background: var(--ink); color: var(--amber); border: none; }
.cal-item p { margin: 0; }
.cal-item .cal-item-sub { color: var(--slate); }
.cal-item.meeting .cal-item-sub { color: #c9c2b4; }

/* ---------- Estratégia / Notas ---------- */
.split { display: flex; gap: 24px; flex-wrap: wrap; }
.split-nav { width: 210px; display: flex; flex-direction: column; gap: 2px; }
.split-nav button { text-align: left; background: transparent; border: none; font-size: 14px; font-weight: 600; padding: 9px 12px; border-radius: 8px; color: var(--ink); }
.split-nav button.active { background: var(--ink); color: var(--amber); }
.split-main { flex: 1; min-width: 280px; }
.split-main textarea { min-height: 380px; }
.notes-list { width: 220px; display: flex; flex-direction: column; gap: 2px; }
.notes-list button { text-align: left; background: transparent; border: none; font-size: 14px; padding: 9px 12px; border-radius: 8px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notes-list button.active { background: var(--line); }

/* ---------- Admin ---------- */
.user-row { display: flex; align-items: center; justify-content: space-between; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); margin-bottom: 8px; }
.user-row-left { display: flex; align-items: center; gap: 10px; }
.user-row-name { font-size: 14px; font-weight: 700; margin: 0; }
.user-row-role { font-size: 12px; color: var(--slate); margin: 0; }
.notice { display: flex; gap: 8px; align-items: flex-start; padding: 14px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; color: var(--slate); }
.notice svg { flex-shrink: 0; margin-top: 2px; }
.credential-box {
  background: #fff8e6; border: 1px solid #f0d78c; border-radius: 8px; padding: 12px 14px;
  font-size: 13px; margin-bottom: 14px;
}
.credential-box strong { display: block; margin-bottom: 4px; }
.credential-box code { background: #fff; border: 1px solid #f0d78c; padding: 2px 6px; border-radius: 4px; }

/* ---------- Lock / restrito ---------- */
.locked { display: flex; align-items: center; gap: 8px; padding: 16px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; color: var(--slate); }

/* ---------- Doc list ---------- */
.doc-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); margin-bottom: 8px; }
.doc-row-left { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; }
.doc-row-left a { text-decoration: underline; }

@media (max-width: 720px) {
  .app-shell { flex-direction: column; }
  .sidebar { width: 100%; flex-direction: row; align-items: center; overflow-x: auto; }
  .nav { flex-direction: row; }
  .sidebar-footer { display: none; }
  .main { padding: 18px; }
}
