:root {
  --paper: #F0EEE5;
  --surface: #FAF9F5;
  --white: #FFFFFF;
  --ink: #1F1E1D;
  --muted: #87837B;
  --line: #E3DFD5;
  --accent: #D97757;
  --accent-2: #C15F3C;
  --accent-soft: #F4E5DE;
  --ok: #6A9B72;
  --ok-soft: #E7EFE8;
  --warn: #C98A2D;
  --warn-soft: #F6ECD9;
  --cinza: #B7B2A7;
  --novo: #7A8CA8;
  --rede: #9C7BB8;
  --pub: #5E9DA8;
  --prop: #C98A2D;
  --resp: #6A9B72;
  --fech: #4E8757;
  --serif: Georgia, 'Times New Roman', serif;
  --sans: -apple-system, 'Segoe UI', Roboto, Inter, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
}

aside {
  width: 232px;
  min-height: 100vh;
  background: var(--ink);
  color: #EDEAE3;
  padding: 22px 14px;
  position: fixed;
  top: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px 20px;
  border-bottom: 1px solid #3A3835;
  margin-bottom: 16px;
}

.logo .burst {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  color: #fff;
}

.logo b {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: .2px;
}

.logo span {
  display: block;
  font-size: 10.5px;
  color: #A8A399;
  margin-top: 1px;
}

nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

nav button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: none;
  border: 0;
  color: #CFC9BE;
  font-size: 13.5px;
  font-weight: 600;
  padding: 10px 12px;
  border-radius: 9px;
  cursor: pointer;
  text-align: left;
  font-family: var(--sans);
  transition: all .2s ease;
}

nav button:hover {
  background: #33312E;
  color: #fff;
}

nav button.on {
  background: var(--accent);
  color: #fff;
}

nav button .qt {
  font-size: 11px;
  background: #00000030;
  padding: 1px 8px;
  border-radius: 10px;
}

.side-foot {
  margin-top: auto;
  font-size: 11px;
  color: #8B867C;
  padding: 12px 10px;
  line-height: 1.5;
}

main {
  margin-left: 232px;
  flex: 1;
  min-width: 0;
  padding: 22px 28px 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#view {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding-bottom: 14px;
}

#view > .stats, #view > .painel, #view > .dica-drag, #view > .sites-grid {
  flex: 0 0 auto;
}

.mobile-nav-toggle {
  display: none;
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 110;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 8px 12px;
  cursor: pointer;
}

.overlay-mobile {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 90;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  flex: 0 0 auto;
}

.topbar h1 {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 600;
  margin: 0;
  letter-spacing: -.2px;
}

.topbar .upd {
  color: var(--muted);
  font-size: 12px;
}

.modo-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 700;
  font-family: var(--sans);
  transition: all .2s ease;
  margin-left: 4px;
}

.modo-badge.ok {
  background: var(--ok-soft);
  color: var(--fech);
  border: 1px solid var(--ok);
}

.modo-badge.erro {
  background: #FCE8E6;
  color: #B0483B;
  border: 1px solid #B0483B;
}

.modo-badge .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}

.modo-badge.ok .dot {
  background: var(--fech);
  box-shadow: 0 0 6px var(--ok);
}

.modo-badge.erro .dot {
  background: #B0483B;
  box-shadow: 0 0 6px #B0483B;
}

.busca {
  margin-left: auto;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 14px;
  font-size: 13.5px;
  width: 250px;
  color: var(--ink);
  font-family: var(--sans);
}

.busca:focus {
  outline: 2px solid var(--accent);
  border-color: var(--accent);
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.stat {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  overflow: hidden;
}

.stat .n {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 600;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat .l {
  color: var(--muted);
  font-size: 11px;
  margin-top: 4px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat.laranja .n { color: var(--accent); }
.stat.verde .n { color: var(--fech); }
.stat.ambar .n { color: var(--warn); }

.painel {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 20px;
}

.painel h2 {
  font-family: var(--serif);
  font-size: 17px;
  margin: 0 0 14px;
  font-weight: 600;
}

.funil .linha {
  display: grid;
  grid-template-columns: 130px 1fr 40px;
  align-items: center;
  gap: 12px;
  margin: 9px 0;
  font-size: 12.5px;
}

.funil .barra {
  height: 22px;
  border-radius: 6px;
  background: var(--paper);
  overflow: hidden;
}

.funil .fill {
  height: 100%;
  border-radius: 6px;
  min-width: 2px;
}

.board {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  align-items: stretch;
  flex: 1;
  min-height: 0;
  padding-bottom: 4px;
}

.board::-webkit-scrollbar, .cards::-webkit-scrollbar {
  height: 9px;
  width: 9px;
}

.board::-webkit-scrollbar-thumb, .cards::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 8px;
}

.board::-webkit-scrollbar-thumb:hover, .cards::-webkit-scrollbar-thumb:hover {
  background: var(--cinza);
}

.col {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 8px 8px 12px;
  flex: 0 0 272px;
  width: 272px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.cards {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  padding-right: 6px;
}

.col > h3 {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .7px;
  margin: 2px 4px 12px;
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  flex: 0 0 auto;
}

.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-top: 3.5px solid var(--cor, var(--accent));
  border-radius: 11px;
  padding: 13px;
  margin-bottom: 10px;
  box-shadow: 0 1px 2px #0000000a;
}

.card .nm {
  font-weight: 700;
  font-size: 13.5px;
}

.card .mt {
  color: var(--muted);
  font-size: 12px;
  margin: 4px 0;
}

.card .motivo {
  color: var(--muted);
  font-size: 12px;
  font-style: italic;
  margin: 7px 0;
  border-left: 2px solid var(--line);
  padding-left: 8px;
  line-height: 1.45;
}

.acoes {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 9px;
}

.acoes a {
  font-size: 11.5px;
  font-weight: 700;
  text-decoration: none;
  padding: 4px 10px;
  border-radius: 7px;
  background: var(--paper);
  color: var(--accent-2);
  border: 1px solid var(--line);
}

.acoes a:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 6px;
  margin-left: 6px;
  vertical-align: 1px;
}

.fup {
  background: var(--warn-soft);
  color: var(--warn);
}

.valor {
  color: var(--fech);
  font-weight: 800;
  font-size: 13px;
  margin-top: 6px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--muted);
  text-align: left;
  padding: 9px 10px;
  border-bottom: 2px solid var(--line);
  cursor: pointer;
  white-space: nowrap;
}

td {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

tr:hover td {
  background: var(--surface);
}

.pill {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 12px;
  white-space: nowrap;
}

.sites-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.site-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow .15s, transform .15s;
}

.site-card:hover {
  box-shadow: 0 6px 18px #00000014;
  transform: translateY(-2px);
}

.site-card .prev {
  height: 190px;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.site-card iframe {
  width: 200%;
  height: 380px;
  border: 0;
  transform: scale(.5);
  transform-origin: 0 0;
  pointer-events: none;
}

.site-card .info {
  padding: 14px 16px 12px;
}

.s-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.s-nm {
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.s-sub {
  color: var(--muted);
  font-size: 12px;
  margin: 3px 0 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.s-main {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.s-main a {
  text-align: center;
  padding: 9px 6px;
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 700;
  text-decoration: none;
}

.s-main .prim {
  background: var(--accent);
  color: #fff;
}

.s-main .prim:hover {
  background: var(--accent-2);
}

.s-main .sec {
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--line);
}

.s-main .sec:hover {
  border-color: var(--accent);
  color: var(--accent-2);
}

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

#modal-bg {
  position: fixed;
  inset: 0;
  background: #00000055;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

#modal-bg.aberto {
  display: flex;
}

#modal {
  background: var(--white);
  border-radius: 16px;
  padding: 22px;
  width: 460px;
  max-width: 92vw;
  max-height: 88vh;
  overflow-y: auto;
}

#modal h2 {
  font-family: var(--serif);
  font-size: 18px;
  margin: 0 0 14px;
  color: var(--ink);
}

#modal label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--muted);
  margin: 10px 0 4px;
}

#modal input, #modal select, #modal textarea,
.painel input[type="text"], .painel input[type="number"], .painel input[type="tel"], .painel input[type="email"], .painel select, .painel textarea,
.field-input, .field-select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13.5px;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--surface);
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
  outline: none;
  box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}

.painel input:focus, .painel select:focus, .painel textarea:focus,
#modal input:focus, #modal select:focus, #modal textarea:focus,
.field-input:focus, .field-select:focus {
  border-color: var(--accent);
  background: #FFFFFF;
  box-shadow: 0 0 0 3.5px var(--accent-soft);
}

.painel input::placeholder, #modal input::placeholder {
  color: #B7B2A7;
  font-size: 13px;
}

/* Cards e Seções de Formulários */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.form-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  transition: transform .15s ease, box-shadow .15s ease;
  display: flex;
  flex-direction: column;
}

.form-card:hover {
  box-shadow: 0 4px 14px rgba(0,0,0,0.04);
}

.form-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--line);
}

.form-card-tag {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.field-group {
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
}

.field-group:last-child {
  margin-bottom: 0;
}

.field-group label, .form-row label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}

@media(max-width: 720px) {
  .form-row { grid-template-columns: 1fr; gap: 12px; }
}

.btn-cta {
  border: 0;
  border-radius: 9px;
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--sans);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all .2s ease;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

.btn-cta.primario {
  background: var(--accent);
  color: #fff;
}

.btn-cta.primario:hover {
  background: var(--accent-2);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(217, 119, 87, 0.25);
}

.btn-cta.secundario {
  background: var(--accent-soft);
  color: var(--accent-2);
  border: 1px solid var(--accent);
}

.btn-cta.secundario:hover {
  background: #EED8CF;
  transform: translateY(-1px);
}

#modal .mrow {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 12px;
}

#modal .mbot {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 16px;
}

#modal .mbot button {
  border: 0;
  border-radius: 9px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--sans);
}

#modal .salvar {
  background: var(--accent);
  color: #fff;
}

#modal .cancelar {
  background: var(--paper);
  color: var(--ink);
}

#doc-bg {
  position: fixed;
  inset: 0;
  background: #000000AA;
  display: none;
  z-index: 300;
  flex-direction: column;
}

#doc-bg.aberto {
  display: flex;
}

.doc-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  background: var(--ink);
  color: #EDEAE3;
  flex: 0 0 auto;
}

.doc-bar b {
  font-family: var(--serif);
  font-size: 15px;
}

.doc-bar .sp {
  flex: 1;
}

.doc-bar button {
  border: 0;
  border-radius: 9px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--sans);
}

.doc-bar .imp {
  background: var(--accent);
  color: #fff;
}

.doc-bar .fech {
  background: #3A3835;
  color: #EDEAE3;
}

#doc-frame {
  flex: 1;
  border: 0;
  width: 100%;
  background: #E9E7E1;
}

.cmp-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.cmp-tabs button {
  border: 1px solid var(--line);
  background: var(--white);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  color: var(--muted);
  font-family: var(--sans);
}

.cmp-tabs button.on {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.cmp-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  flex: 1 1 auto;
  min-height: 0;
}

.cmp-col {
  display: flex;
  flex-direction: column;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  min-height: 0;
}

.cmp-col .cab {
  padding: 9px 14px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line);
}

.cmp-col iframe {
  flex: 1 1 auto;
  width: 100%;
  border: 0;
  min-height: 0;
  background: #fff;
}

.ct-pendente { background: var(--paper); color: var(--muted); }
.ct-enviado { background: var(--warn-soft); color: var(--warn); }
.ct-assinado { background: var(--ok-soft); color: var(--fech); }

.btn-ct {
  font-size: 11.5px;
  font-weight: 700;
  text-decoration: none;
  padding: 4px 8px;
  border-radius: 6px;
  display: inline-block;
  margin-right: 4px;
}

.btn-ct.ver { background: var(--paper); color: var(--ink); border: 1px solid var(--line); }
.btn-ct.baixar { background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent); }
.btn-ct.ass { background: var(--ok-soft); color: var(--fech); border: 1px solid var(--ok); }

@media(max-width: 860px) {
  aside { display: none; }
  main { margin-left: 0; padding: 60px 16px 14px; }
  .mobile-nav-toggle { display: flex; align-items: center; justify-content: center; width: 42px; height: 42px; font-size: 18px; }
  #sidebar-mobile.mobile-open { display: flex; z-index: 100; }
  .overlay-mobile.mobile-open { display: block; }
  .stats { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .topbar { flex-direction: column; align-items: stretch; }
  .busca { width: 100%; margin-left: 0; }
  .board { min-height: 420px; -webkit-overflow-scrolling: touch; }
  .col { flex: 0 0 260px; width: 260px; }
}

@media(max-width: 520px) {
  .stats { grid-template-columns: 1fr; }
  .col { flex: 0 0 240px; width: 240px; }
}

@media(max-width: 900px) {
  .cmp-grid { grid-template-columns: 1fr; }
}
