/* ===== 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;
}

.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; }
}

/* ===== 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; }
}
