/* PEMA Patrimônio — mesma identidade do Portal do Cliente e do PCM */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@500;600;700;800&family=Open+Sans:wght@400;500;600;700&display=swap');

:root {
  --brand: #1A7440;
  --brand-mid: #1F8A4C;
  --brand-soft: #239956;
  --brand-ink: #092A17;
  --brand-deep: #0E3E22;
  --text: #141F1A;
  --muted: #5B6B62;
  --line: rgba(20, 31, 26, 0.12);
  --sand: #F7F8F7;
  --panel: #FFFFFF;
  --active-soft: #EAF3ED;
  --table-head: #EEF5F0;
  --ok-bg: #E8F6EE;
  --danger: #DC2626;
  --danger-bg: #FEE2E2;
  --warn: #EA580C;
  --warn-bg: #FFEDD5;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-soft: 0 8px 22px rgba(9, 42, 23, 0.08);
  --shadow-btn: 0 6px 16px rgba(26, 116, 64, 0.25);
  --font: "Open Sans", system-ui, sans-serif;
  --display: "Montserrat", system-ui, sans-serif;
  --sidebar: 268px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--text);
  background: var(--sand);
  font-size: 14px;
  line-height: 1.5;
}
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-mid); text-decoration: underline; }
h1, h2, h3, button, .btn {
  font-family: var(--display);
}
h1 {
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--brand-ink);
  margin: 0 0 6px;
}
h2 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--brand-ink);
  margin: 0 0 16px;
}
.subtitle { color: var(--muted); margin: 0 0 22px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar);
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  z-index: 20;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 92px;
  padding: 12px 16px;
  background: var(--brand);
  color: #fff;
}
.sidebar-brand img {
  height: 54px;
  width: auto;
  max-width: 86px;
  object-fit: contain;
  flex: 0 0 auto;
  background: #fff;
  border-radius: 10px;
  padding: 3px 5px;
}
.sidebar-brand strong {
  display: block;
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
}
.sidebar-brand span {
  display: block;
  margin-top: 3px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.82);
}
.sidebar nav {
  display: grid;
  gap: 4px;
  padding: 16px 12px;
}
.sidebar nav a {
  font-family: var(--display);
  font-weight: 600;
  font-size: 0.84rem;
  color: var(--muted);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  text-decoration: none;
}
.sidebar nav a:hover {
  background: var(--sand);
  color: var(--brand);
}
.sidebar nav a.active {
  background: var(--active-soft);
  color: var(--brand);
  font-weight: 700;
}
.sidebar-foot {
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding: 16px 18px 18px;
  font-size: 13px;
  font-weight: 600;
  color: var(--brand-ink);
}
.sidebar-foot .muted { font-weight: 500; }

.content {
  margin-left: var(--sidebar);
  padding: 0 32px 40px;
  min-height: 100vh;
  max-width: 1680px;
}
.topbar {
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 72px;
  margin: 0 -32px 28px;
  padding: 0 32px;
  background: var(--brand);
  color: #fff;
}
.topbar .who { color: rgba(255, 255, 255, 0.92); font-weight: 600; white-space: nowrap; }
.finder { position: relative; flex: 1; max-width: 560px; }
.finder input { background: #fff; color: var(--text); }
.finder-results {
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}
.finder-item {
  display: grid;
  grid-template-columns: 78px 1fr;
  gap: 2px 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
}
.finder-item:hover, .finder-item.active { background: var(--active-soft); text-decoration: none; }
.finder-kind {
  font-family: var(--display);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--brand);
  align-self: center;
}
.finder-title { font-weight: 700; }
.finder-meta { grid-column: 2; font-size: 12px; color: var(--muted); }
.finder-empty { padding: 12px 14px; color: var(--muted); font-size: 13px; }

.titleline { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 22px; }
.metric, .panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}
.metric { padding: 20px 22px; }
.metric span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.metric b {
  font-family: var(--display);
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--brand-ink);
}
.panel { padding: 22px; margin-bottom: 18px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; text-align: left; }
th {
  font-family: var(--display);
  font-size: 11px;
  font-weight: 700;
  color: var(--brand-ink);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--table-head);
}
td, th { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tr[hidden] { display: none; }

.btn, button {
  display: inline-block;
  border: 0;
  background: var(--brand);
  color: #fff;
  padding: 11px 18px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  cursor: pointer;
  font-size: 13px;
  text-decoration: none;
  box-shadow: var(--shadow-btn);
  min-height: 42px;
}
.btn:hover, button:hover {
  background: var(--brand-deep);
  color: #fff;
  text-decoration: none;
}
.btn:focus-visible, button:focus-visible { outline: 0; box-shadow: 0 0 0 0.2rem rgba(26, 116, 64, 0.28); }
.btn.secondary, button.danger {
  box-shadow: none;
}
.btn.secondary {
  background: transparent;
  color: var(--brand);
  border: 1.5px solid rgba(26, 116, 64, 0.35);
}
.btn.secondary:hover { background: var(--active-soft); color: var(--brand-deep); }
.smallbtn { font-size: 11px; padding: 7px 10px; min-height: 0; box-shadow: none; }
button.danger { background: var(--danger-bg); color: var(--danger); }
button.danger:hover { background: #fecaca; color: #991b1b; }

.notice, .alert { border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 18px; font-size: 13px; }
.notice { background: var(--ok-bg); color: var(--brand-ink); }
.alert { background: var(--danger-bg); color: var(--danger); }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 0 0 18px; }
.filters input, .filters select { width: auto; min-width: 220px; max-width: 460px; }
.section-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 12px; }
.section-head h2 { margin: 0; }
.inline-form { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
form.inline { display: inline; margin: 0; }
.row-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row-actions form { margin: 0; }
.empty { color: var(--muted); }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.checks { display: flex; gap: 14px; flex-wrap: wrap; margin: 8px 0 16px; }
label.check { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; }
label.check input { width: auto; }
.edit { margin-top: 16px; }
.formgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 18px; }
label { display: grid; gap: 6px; font-size: 12px; font-weight: 700; color: var(--muted); }
input, select, textarea {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  min-width: 0;
}
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: 0;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(26, 116, 64, 0.16);
}
.details { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.details div span { font-size: 11px; color: var(--muted); display: block; margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.04em; }
.details div strong { font-size: 14px; color: var(--brand-ink); }

.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-family: var(--display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.badge-ok { background: var(--ok-bg); color: var(--brand); }
.badge-warn { background: var(--warn-bg); color: #9a3412; }
.badge-info { background: var(--active-soft); color: var(--brand-deep); }
.badge-muted { background: #eef1ef; color: var(--muted); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.pills { display: flex; gap: 4px; flex-wrap: wrap; }
.pill { font-size: 10px; font-weight: 700; padding: 3px 6px; border-radius: 999px; background: #eef1ef; color: #9aa59e; }
.pill.on { background: var(--ok-bg); color: var(--brand); }

.label-card {
  border: 2px solid var(--brand-ink);
  border-radius: var(--radius);
  padding: 18px;
  margin: 0 0 18px;
  background: #fff;
  break-inside: avoid;
}
.label-card .kicker {
  margin: 0 0 12px;
  font-family: var(--display);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand);
  font-weight: 700;
}
.label-grid { display: grid; grid-template-columns: 1.4fr 1.3fr .8fr .7fr; gap: 12px; }
.label-grid span { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.label-grid strong { display: block; margin-top: 4px; font-size: 18px; font-family: var(--display); }

footer {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  margin-top: 36px;
}

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(1100px 560px at 12% 22%, rgba(26, 116, 64, 0.38), transparent 55%),
    radial-gradient(800px 420px at 92% 8%, rgba(196, 221, 156, 0.22), transparent 48%),
    linear-gradient(105deg, #0a241c 0%, #113e30 38%, var(--sand) 38.12%, var(--sand) 100%);
}
.login .panel {
  width: min(440px, 92vw);
  padding: 32px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 16px 40px rgba(9, 42, 23, 0.12);
}
.login .logo { width: 92px; height: 92px; object-fit: contain; margin-bottom: 8px; }
.login h1 { font-size: 1.55rem; }
.login .eyebrow {
  margin: 0 0 8px;
  font-family: var(--display);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brand);
}
.login .muted { margin: 0 0 22px; }
.login form { display: grid; gap: 14px; }
.login button { margin-top: 4px; width: 100%; }

@media (max-width: 1000px) {
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .split, .label-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 700px) {
  .sidebar { position: static; width: 100%; }
  .sidebar nav { display: flex; overflow-x: auto; }
  .sidebar nav a { white-space: nowrap; }
  .sidebar-foot { display: none; }
  .content { margin: 0; padding: 0 14px 22px; }
  .topbar { margin: 0 -14px 20px; padding: 12px 14px; flex-wrap: nowrap; }
  .finder { flex: 1 1 auto; max-width: none; min-width: 0; order: 0; }
  .topbar .who { max-width: 7.5rem; overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
  .metrics, .formgrid, .details, .split, .label-grid { grid-template-columns: 1fr; }
  .titleline { flex-wrap: wrap; }
  .login {
    background: linear-gradient(160deg, #0a241c, #1A7440 42%, var(--sand) 42%);
  }
}
@media print {
  .sidebar, .topbar, .noprint, footer { display: none !important; }
  .content { margin: 0; padding: 0; max-width: none; }
  body { background: #fff; }
  .label-card { box-shadow: none; }
}
