/* ===== Escritec Contabilidade — Identidade visual ===== */
:root {
  --teal:       #4C8B82;
  --teal-dark:  #3b6f68;
  --teal-soft:  #eaf2f0;
  --green:      #A3CF6E;
  --green-dark: #85b64f;
  --rose:       #D35771;
  --gray:       #808080;
  --ink:        #2f3b3a;
  --muted:      #6c7a78;
  --line:       #d9e2e0;
  --bg:         #f4f7f6;
  --white:      #ffffff;
  --danger:     #c0392b;
  --radius:     12px;
  --shadow:     0 2px 10px rgba(47, 59, 58, .06);
  --shadow-lg:  0 10px 30px rgba(47, 59, 58, .10);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--teal); }

/* ===== Topbar / Header ===== */
.topbar {
  background: var(--white);
  border-bottom: 3px solid var(--teal);
  box-shadow: var(--shadow);
}
.topbar-inner {
  max-width: 980px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand img { height: 42px; width: auto; display: block; }
.brand .brand-sep { width: 1px; height: 34px; background: var(--line); }
.brand .brand-title { font-size: 14px; color: var(--muted); font-weight: 600; letter-spacing: .3px; }
.brand .brand-title strong { display: block; color: var(--ink); font-size: 15px; font-weight: 700; }

.nav-link {
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  color: var(--teal);
  padding: 8px 14px;
  border: 1px solid var(--teal);
  border-radius: 8px;
  transition: all .15s;
  white-space: nowrap;
}
.nav-link:hover { background: var(--teal); color: #fff; }

/* ===== Hero ===== */
.hero {
  background: linear-gradient(120deg, var(--teal) 0%, var(--teal-dark) 100%);
  color: #fff;
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: "";
  position: absolute;
  right: -60px; bottom: -80px;
  width: 260px; height: 260px;
  background: var(--green);
  opacity: .18;
  border-radius: 50%;
}
.hero-inner {
  max-width: 980px;
  margin: 0 auto;
  padding: 34px 24px;
  position: relative;
  z-index: 1;
}
.hero h1 { margin: 0 0 6px; font-size: 26px; font-weight: 700; }
.hero p { margin: 0; opacity: .9; font-size: 15px; max-width: 640px; }

/* ===== Layout ===== */
.wrap { max-width: 980px; margin: 0 auto; padding: 28px 24px 60px; }

/* ===== Cards / Fieldsets ===== */
.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 22px;
  overflow: hidden;
}
.card > legend, .card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 22px;
  background: var(--teal-soft);
  border-bottom: 1px solid var(--line);
  font-weight: 700;
  font-size: 15px;
  color: var(--teal-dark);
  width: 100%;
}
.card-head .num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px; height: 24px;
  background: var(--teal);
  color: #fff;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 700;
  flex: none;
}
fieldset.card { padding: 0; border: 1px solid var(--line); }
.card-body { padding: 22px; }

/* ===== Grid de campos ===== */
.grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 16px; }
.field { grid-column: span 12; display: flex; flex-direction: column; gap: 6px; }
.col-2  { grid-column: span 2; }
.col-3  { grid-column: span 3; }
.col-4  { grid-column: span 4; }
.col-5  { grid-column: span 5; }
.col-6  { grid-column: span 6; }
.col-8  { grid-column: span 8; }
.col-9  { grid-column: span 9; }

label { font-size: 13px; font-weight: 600; color: var(--ink); }
label .req { color: var(--rose); margin-left: 2px; }
.hint { font-size: 12px; color: var(--muted); font-weight: 400; }

input, select, textarea {
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(76, 139, 130, .15);
}
textarea { resize: vertical; min-height: 70px; }

/* Radios/checks inline */
.choice-row { display: flex; flex-wrap: wrap; gap: 8px; }
.choice {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  background: #fff;
  transition: all .12s;
}
.choice:hover { border-color: var(--teal); }
.choice input { width: auto; margin: 0; accent-color: var(--teal); }
.choice:has(input:checked) { border-color: var(--teal); background: var(--teal-soft); font-weight: 600; }

/* ===== Nota informativa ===== */
.note {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  background: #fff8ec;
  border: 1px solid #f0dfc0;
  border-left: 4px solid var(--green-dark);
  border-radius: 8px;
  font-size: 13px;
  color: #6b5b3e;
  margin-top: 4px;
}
.note.rose { background: #fdeef1; border-color: #f2cdd5; border-left-color: var(--rose); color: #7a3b47; }
.note .ico { flex: none; font-size: 15px; line-height: 1.3; }

/* ===== Filhos (repetível) ===== */
.child-row {
  display: grid;
  grid-template-columns: 1fr 180px 40px;
  gap: 12px;
  align-items: end;
  margin-bottom: 10px;
}
.btn-icon {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--danger);
  border-radius: 8px;
  height: 40px;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}
.btn-icon:hover { background: #fdeeee; border-color: var(--danger); }
.btn-add {
  border: 1px dashed var(--teal);
  background: var(--teal-soft);
  color: var(--teal-dark);
  border-radius: 8px;
  padding: 9px 14px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}
.btn-add:hover { background: #dcebe8; }

/* ===== Botões ===== */
.actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.btn {
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  padding: 12px 26px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  transition: transform .05s, filter .15s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--teal); color: #fff; box-shadow: var(--shadow); }
.btn-primary:hover { filter: brightness(1.06); }
.btn-ghost { background: #fff; color: var(--muted); border: 1px solid var(--line); font-weight: 600; }
.btn-ghost:hover { color: var(--ink); border-color: var(--muted); }
.btn-green { background: var(--green-dark); color: #fff; }
.btn-green:hover { filter: brightness(1.06); }

/* ===== Toast ===== */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(20px);
  background: var(--teal-dark);
  color: #fff;
  padding: 14px 22px;
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  font-weight: 600;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: all .25s;
  z-index: 50;
  display: flex; align-items: center; gap: 10px;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===== Footer ===== */
.foot {
  border-top: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-size: 13px;
}
.foot-inner {
  max-width: 980px;
  margin: 0 auto;
  padding: 20px 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.foot .dot { color: var(--green-dark); }

/* ===== Dashboard ===== */
.stats { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.stat {
  background: #fff;
  border: 1px solid var(--line);
  border-left: 4px solid var(--teal);
  border-radius: var(--radius);
  padding: 16px 20px;
  min-width: 160px;
  box-shadow: var(--shadow);
}
.stat .n { font-size: 28px; font-weight: 800; color: var(--teal-dark); }
.stat .l { font-size: 13px; color: var(--muted); }

.table-wrap {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: auto;
}
table { border-collapse: collapse; width: 100%; font-size: 13px; }
thead th {
  background: var(--teal-soft);
  color: var(--teal-dark);
  text-align: left;
  padding: 12px 14px;
  font-weight: 700;
  white-space: nowrap;
  position: sticky; top: 0;
  border-bottom: 2px solid var(--line);
}
tbody td { padding: 11px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
tbody tr:hover { background: var(--teal-soft); }
tbody td .del {
  border: none; background: none; color: var(--danger);
  cursor: pointer; font-size: 15px;
}
tbody td .ficha-btn {
  border: none; background: none; cursor: pointer; font-size: 15px;
}
tbody td .ficha-btn:hover { filter: brightness(1.1) saturate(1.3); }

.empty {
  text-align: center;
  padding: 60px 24px;
  color: var(--muted);
}
.empty .big { font-size: 44px; margin-bottom: 8px; }

/* ===== Detalhe da admissão (consulta) ===== */
#detalhe:empty { display: none; }
.detalhe { margin-top: 20px; border-top: 1px dashed var(--line); padding-top: 20px; }
.detalhe-head {
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
  margin-bottom: 4px;
}
.detalhe-head h3 { margin: 0; font-size: 18px; color: var(--teal-dark); }
.detalhe-head .sub { color: var(--muted); font-size: 13px; }
.det-sec { margin-top: 18px; }
.det-sec > .t {
  font-size: 13px; font-weight: 700; color: var(--teal-dark);
  text-transform: uppercase; letter-spacing: .4px;
  padding-bottom: 6px; margin-bottom: 12px;
  border-bottom: 2px solid var(--teal-soft);
}
.det-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 20px; }
.det-item { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.det-item .k { font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .3px; }
.det-item .v { font-size: 14px; color: var(--ink); word-break: break-word; }
.det-item .v.vazio { color: #b9c4c2; }
.det-item.wide { grid-column: 1 / -1; }
@media (max-width: 720px) {
  .det-grid { grid-template-columns: 1fr 1fr; }
}

/* ===== Nav group (vários links no topo) ===== */
.nav-group { display: flex; gap: 10px; align-items: center; }
.nav-link.ghost { color: var(--muted); border-color: var(--line); }
.nav-link.ghost:hover { background: var(--muted); color: #fff; border-color: var(--muted); }

/* ===== Home: cards de serviços ===== */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
}
.scard {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  transition: transform .12s, box-shadow .12s, border-color .12s;
}
.scard:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--teal); }
.scard-ico {
  flex: none;
  width: 54px; height: 54px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px;
  background: color-mix(in srgb, var(--c) 16%, #fff);
  border: 1px solid color-mix(in srgb, var(--c) 35%, #fff);
}
.scard-body { flex: 1; min-width: 0; }
.scard-body h3 { margin: 0 0 4px; font-size: 16px; color: var(--ink); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.scard-body p { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.45; }
.scard-go { flex: none; color: var(--teal); font-weight: 700; font-size: 14px; }
.scard.disabled { opacity: .65; cursor: default; box-shadow: none; background: #fbfcfc; }
.scard.disabled:hover { transform: none; box-shadow: none; border-color: var(--line); }
.tag-soon {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px;
  color: var(--muted); background: var(--bg);
  border: 1px solid var(--line); border-radius: 20px; padding: 2px 9px;
}

/* ===== Abas do painel ===== */
.tabs { display: flex; gap: 6px; margin-bottom: 22px; border-bottom: 2px solid var(--line); }
.tab {
  font-family: inherit; font-size: 14px; font-weight: 700;
  color: var(--muted); background: none; border: none; cursor: pointer;
  padding: 12px 20px; border-bottom: 3px solid transparent; margin-bottom: -2px;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--teal-dark); border-bottom-color: var(--teal); }

/* ===== CNAE (linhas) ===== */
.cnae-row { display: grid; grid-template-columns: 220px 1fr 40px; gap: 12px; margin-bottom: 10px; }
@media (max-width: 620px) { .cnae-row { grid-template-columns: 1fr 1fr 40px; } }

/* ===== Sócios (blocos) ===== */
.socio-block { border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-bottom: 14px; background: #fbfdfc; }
.socio-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.socio-n { font-weight: 700; color: var(--teal-dark); font-size: 14px; }
.socio-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.soma-part { font-size: 13px; color: var(--muted); }
.soma-part.ok strong { color: var(--green-dark); }
.soma-part.bad { color: var(--rose); }
.soma-part.bad strong { color: var(--rose); }
input.auto-field { background: #eef3f1; color: var(--muted); cursor: not-allowed; }
input.valor-input { background: #f4f7f6; font-weight: 600; color: var(--teal-dark); }

/* ===== Documentos (checklist) ===== */
.doc-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.doc-row:last-of-type { border-bottom: none; }
.doc-label { font-size: 14px; color: var(--ink); }
.doc-status { width: auto; min-width: 150px; flex: none; }

/* ===== Detalhe aninhado (empresas no painel) ===== */
.det-list, .det-docs { margin: 0; padding-left: 18px; font-size: 14px; color: var(--ink); }
.det-docs { list-style: none; padding-left: 0; }
.det-docs li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.doc-badge { font-size: 12px; font-weight: 700; border-radius: 20px; padding: 2px 10px; white-space: nowrap; }
.doc-badge.st-ok { background: #e7f4e0; color: #4a7a1f; }
.doc-badge.st-pend { background: #fdeef1; color: var(--rose); }
.doc-badge.st-na { background: var(--bg); color: var(--muted); }
.socio-detail { border: 1px solid var(--line); border-radius: 10px; padding: 14px; margin-bottom: 12px; background: #fbfdfc; }
.socio-detail-h { font-weight: 700; color: var(--teal-dark); font-size: 13px; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.badge-admin { font-size: 11px; font-weight: 700; background: var(--teal-soft); color: var(--teal-dark); border-radius: 20px; padding: 2px 9px; }

/* ===== Responsivo ===== */
@media (max-width: 720px) {
  .col-2,.col-3,.col-4,.col-5,.col-6,.col-8,.col-9 { grid-column: span 12; }
  .child-row { grid-template-columns: 1fr 1fr 40px; }
  .hero h1 { font-size: 22px; }
  .brand .brand-title { display: none; }
}
