:root {
  --bg: #161007;
  --bg-2: #1d160c;
  --surface: #241b10;
  --surface-2: #2e2416;
  --line: #3a2e1e;
  --text: #fff8ef;
  --muted: #b8a993;
  --faint: #7d6f5c;
  --orange: #fe9100;
  --orange-2: #ffab3d;
  --green: #2fbf71;
  --red: #e5484d;
  --blue: #4c9aff;
  --radius: 12px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  font-family: 'DM Sans', system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background:
    radial-gradient(1200px 600px at 100% -10%, rgba(254, 145, 0, 0.08), transparent 60%),
    var(--bg);
  font-size: 14px;
}
h1, h2, h3, h4 { font-family: 'Poppins', sans-serif; margin: 0; letter-spacing: -0.01em; }
h1 { font-weight: 800; font-size: 22px; text-transform: uppercase; }
h2 { font-weight: 700; font-size: 18px; }
h3 { font-weight: 700; font-size: 15px; }
a { color: var(--orange-2); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12px; }
.hidden { display: none !important; }
.row { display: flex; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ---------- Botões e campos ---------- */
.btn {
  border: 1px solid var(--line); background: var(--surface-2); padding: 8px 14px; border-radius: 10px;
  cursor: pointer; font-weight: 500; white-space: nowrap; transition: background .15s, border-color .15s;
}
.btn:hover { border-color: var(--orange); }
.btn.primary { background: var(--orange); border-color: var(--orange); color: #1a1006; font-weight: 700; }
.btn.primary:hover { background: var(--orange-2); }
.btn.ghost { background: transparent; }
.btn.danger { border-color: rgba(229, 72, 77, .5); color: #ff8a8d; background: transparent; }
.btn.success { border-color: rgba(47, 191, 113, .5); color: #6fe3a3; background: transparent; }
.btn.sm { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: default; }
.input, select.input, textarea.input {
  width: 100%; background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; outline: none;
}
.input:focus { border-color: var(--orange); }
textarea.input { min-height: 70px; resize: vertical; }
label.field { display: grid; gap: 5px; font-size: 12px; color: var(--muted); }
.chk { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }

/* ---------- Layout ---------- */
.shell { display: grid; grid-template-columns: 220px 1fr; height: 100vh; }
.shell.embedded { grid-template-columns: 1fr; }
.side {
  background: rgba(0, 0, 0, .25); border-right: 1px solid var(--line); padding: 18px 12px; display: flex; flex-direction: column; gap: 4px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.brand .logo {
  width: 34px; height: 34px; border-radius: 9px; background: var(--orange); color: #1a1006; display: grid; place-items: center;
  font-family: 'Poppins'; font-weight: 800; font-size: 18px;
}
.brand b { font-family: 'Poppins'; font-weight: 800; letter-spacing: .02em; }
.brand small { display: block; color: var(--muted); font-size: 11px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; color: var(--muted); font-weight: 500;
}
.nav a:hover { background: var(--surface); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--orange); color: #1a1006; font-weight: 700; }
.nav .ico { width: 18px; text-align: center; }
.side .foot { margin-top: auto; display: grid; gap: 8px; padding: 8px; }
.main { display: flex; flex-direction: column; min-width: 0; height: 100vh; }
.top {
  display: flex; align-items: center; gap: 10px; padding: 14px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.content { flex: 1; overflow: auto; padding: 18px 20px; }
.content.board-wrap { padding: 14px 20px 0; overflow: hidden; display: flex; flex-direction: column; }

/* ---------- Kanban ---------- */
.board { display: flex; gap: 12px; overflow-x: auto; flex: 1; padding-bottom: 14px; align-items: flex-start; }
.col {
  flex: 0 0 280px; background: rgba(255, 255, 255, .02); border: 1px solid var(--line); border-radius: var(--radius);
  display: flex; flex-direction: column; max-height: 100%;
}
.col-head { padding: 12px 12px 8px; border-top: 3px solid var(--c, var(--orange)); border-radius: var(--radius) var(--radius) 0 0; }
.col-head .name { font-family: 'Poppins'; font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .03em; }
.col-head .meta { color: var(--muted); font-size: 12px; margin-top: 2px; }
.col-body { padding: 6px 8px 10px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; min-height: 60px; }
.col-body.over { background: rgba(254, 145, 0, .06); outline: 1px dashed var(--orange); outline-offset: -4px; border-radius: 10px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 11px; cursor: grab;
  display: grid; gap: 5px; transition: border-color .12s, transform .12s;
}
.card:hover { border-color: rgba(254, 145, 0, .6); }
.card.dragging { opacity: .4; }
.card .t { font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }
.card .v { color: var(--orange-2); font-weight: 700; font-size: 13px; }
.card .meta { display: flex; justify-content: space-between; gap: 6px; color: var(--muted); font-size: 12px; }
.drop-marker { height: 3px; background: var(--orange); border-radius: 3px; margin: -2px 0; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; font-size: 11px; padding: 2px 8px; border-radius: 999px;
  background: rgba(254, 145, 0, .14); color: var(--orange-2); border: 1px solid rgba(254, 145, 0, .25);
}
.chip button { background: none; border: 0; color: inherit; cursor: pointer; padding: 0; font-size: 12px; line-height: 1; }
.status-won { color: #6fe3a3; }
.status-lost { color: #ff8a8d; }
.badge { font-size: 11px; padding: 2px 7px; border-radius: 6px; background: var(--surface-2); color: var(--muted); }
.badge.won { background: rgba(47, 191, 113, .15); color: #6fe3a3; }
.badge.lost { background: rgba(229, 72, 77, .15); color: #ff8a8d; }
.badge.late { background: rgba(229, 72, 77, .15); color: #ff8a8d; }

/* ---------- Drawer / modal ---------- */
.overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); z-index: 40; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); background: var(--bg-2); border-left: 1px solid var(--line);
  z-index: 41; display: flex; flex-direction: column; box-shadow: var(--shadow); animation: slide .18s ease-out;
}
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }
.drawer-head { padding: 16px 18px; border-bottom: 1px solid var(--line); display: grid; gap: 10px; }
.drawer-body { padding: 14px 18px 40px; overflow-y: auto; display: grid; gap: 16px; align-content: start; }
.section { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: grid; gap: 10px; }
.section > h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.title-input { font-family: 'Poppins'; font-weight: 700; font-size: 18px; background: transparent; border: 1px solid transparent; border-radius: 8px; padding: 4px 6px; width: 100%; }
.title-input:hover, .title-input:focus { border-color: var(--line); outline: none; }
.modal {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(520px, 94vw); max-height: 90vh; overflow: auto;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 16px; z-index: 51; padding: 20px; display: grid; gap: 14px; box-shadow: var(--shadow);
}
.modal.wide { width: min(820px, 96vw); }
.overlay.m { z-index: 50; }
.list { display: grid; gap: 6px; }
.item { display: flex; gap: 10px; align-items: flex-start; padding: 9px 10px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; }
.item .grow { flex: 1; min-width: 0; }
.item.done .ttl { text-decoration: line-through; color: var(--faint); }
.kv { display: grid; grid-template-columns: 130px 1fr auto; gap: 6px; align-items: center; }

/* ---------- Tabelas / relatórios ---------- */
.tabs { display: flex; gap: 4px; background: var(--surface); padding: 4px; border-radius: 10px; border: 1px solid var(--line); width: fit-content; }
.tabs button { background: none; border: 0; padding: 7px 12px; border-radius: 7px; cursor: pointer; color: var(--muted); }
.tabs button.on { background: var(--orange); color: #1a1006; font-weight: 700; }
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th, .tbl td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); }
.tbl th { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 500; }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: var(--surface); }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.kpi .l { color: var(--muted); font-size: 12px; }
.kpi .n { font-family: 'Poppins'; font-weight: 800; font-size: 24px; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi.hl { background: var(--orange); color: #1a1006; border-color: var(--orange); }
.kpi.hl .l { color: rgba(26, 16, 6, .75); }
.funnel { display: grid; gap: 8px; }
.fstep { display: grid; grid-template-columns: 130px 1fr 110px; gap: 10px; align-items: center; }
.fbar { height: 30px; background: var(--surface); border-radius: 8px; overflow: hidden; border: 1px solid var(--line); }
.fbar > div { height: 100%; background: linear-gradient(90deg, var(--orange), var(--orange-2)); border-radius: 7px; min-width: 2px; }
.cards2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 14px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: grid; gap: 12px; align-content: start; }
.panel > h3 { display: flex; align-items: center; gap: 8px; }
.empty { color: var(--faint); text-align: center; padding: 22px; border: 1px dashed var(--line); border-radius: 10px; }
.day-head { font-family: 'Poppins'; font-weight: 700; text-transform: uppercase; font-size: 12px; letter-spacing: .05em; color: var(--orange-2); margin: 14px 0 6px; }
code.k { background: var(--bg); border: 1px solid var(--line); padding: 2px 6px; border-radius: 6px; font-size: 12px; overflow-wrap: anywhere; }
pre.code { background: var(--bg); border: 1px solid var(--line); padding: 10px; border-radius: 10px; overflow: auto; font-size: 12px; margin: 0; }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-box { width: min(380px, 100%); display: grid; gap: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 28px; box-shadow: var(--shadow); }
.login-box .hero { background: var(--orange); color: #1a1006; border-radius: 12px; padding: 16px; }
.login-box .hero h1 { font-size: 24px; }

/* ---------- Toasts ---------- */
#toasts { position: fixed; bottom: 18px; right: 18px; display: grid; gap: 8px; z-index: 99; }
.toast { background: var(--surface-2); border: 1px solid var(--line); border-left: 4px solid var(--orange); padding: 10px 14px; border-radius: 10px; box-shadow: var(--shadow); max-width: 360px; }
.toast.err { border-left-color: var(--red); }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { flex-direction: row; overflow-x: auto; padding: 8px; align-items: center; }
  .side .brand small, .side .foot { display: none; }
  .brand { padding: 0 8px 0 0; }
  .nav { display: flex; gap: 2px; }
  .nav a .lbl { display: none; }
  .main { height: calc(100vh - 54px); }
  .fstep { grid-template-columns: 90px 1fr 80px; }
}
