:root {
  --bg: #f6f3ee;
  --bg-2: #ebe4da;
  --panel: #fffdfa;
  --panel-strong: #ffffff;
  --ink: #17212b;
  --muted: #52606d;
  --muted-soft: #6f7d89;
  --line: #d8d0c4;
  --line-strong: #c4b8a8;
  --accent: #a63c21;
  --accent-2: #0f766e;
  --good: #157f3b;
  --mid: #b7791f;
  --bad: #b42318;
  --sidebar-bg: #162028;
  --sidebar-bg-2: #21313d;
  --sidebar-ink: #f6f8fb;
  --sidebar-muted: #a6b4c2;
  --shadow: 0 20px 60px rgba(56, 38, 16, 0.08);
}
* { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, sans-serif;
  line-height: 1.5;
  background:
    radial-gradient(circle at top left, #fff8ef 0, transparent 24rem),
    linear-gradient(180deg, var(--bg), var(--bg-2));
  color: var(--ink);
}
a { color: inherit; text-decoration: none; }
button, .button {
  appearance: none;
  border: 0;
  border-radius: 14px;
  padding: 0.9rem 1rem;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.95rem;
  background: linear-gradient(135deg, var(--accent), #d95c31);
  color: #fff;
  box-shadow: 0 10px 24px rgba(166, 60, 33, 0.18);
}
button:hover, .button:hover { filter: brightness(1.03); }
button.ghost, .ghost {
  background: var(--panel-strong);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  box-shadow: none;
}
label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--ink);
}
input, select, textarea {
  width: 100%;
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  margin: 0;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
input::placeholder, textarea::placeholder { color: var(--muted-soft); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: rgba(166, 60, 33, 0.55);
  box-shadow: 0 0 0 4px rgba(166, 60, 33, 0.12);
}
textarea { min-height: 7rem; resize: vertical; }
table { width: 100%; border-collapse: collapse; min-width: 42rem; }
th, td {
  text-align: left;
  padding: 0.95rem 0.85rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
th {
  color: var(--muted);
  font-weight: 700;
  font-size: 0.84rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: rgba(23, 33, 43, 0.03);
}
tbody tr:hover { background: rgba(166, 60, 33, 0.03); }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.7rem, 2.4vw, 2.5rem); line-height: 1.08; letter-spacing: -0.02em; }
h2 { font-size: 1.12rem; margin-bottom: 1rem; }
h3 { font-size: 1rem; margin-bottom: 0.75rem; }
.layout { min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 17.5rem;
  height: 100vh;
  overflow-y: auto;
  padding: 1.5rem 1.2rem;
  background:
    radial-gradient(circle at top, rgba(255,255,255,0.08), transparent 18rem),
    linear-gradient(180deg, var(--sidebar-bg), var(--sidebar-bg-2));
  color: var(--sidebar-ink);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  border-right: 1px solid rgba(255,255,255,0.08);
}
.sidebar-top { display: grid; gap: 1rem; }
.brand-block {
  padding: 1rem;
  border-radius: 1.25rem;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
}
.brand { font-size: 1.3rem; font-weight: 800; color: #fff; }
.subbrand { color: var(--sidebar-muted); font-size: 0.92rem; margin-top: 0.3rem; }
.muted { color: var(--muted); }
.nav { display: grid; gap: 0.45rem; }
.nav a {
  padding: 0.9rem 1rem;
  border-radius: 1rem;
  color: var(--sidebar-ink);
  background: rgba(255,255,255,0.03);
  border: 1px solid transparent;
  font-weight: 600;
}
.nav a:hover { background: rgba(255,255,255,0.09); }
.nav a.active {
  background: linear-gradient(135deg, rgba(255,255,255,0.16), rgba(255,255,255,0.08));
  border-color: rgba(255,255,255,0.16);
}
.profile {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: grid;
  gap: 0.35rem;
}
.profile .muted { color: var(--sidebar-muted); text-transform: capitalize; }
.sidebar .ghost {
  background: rgba(255,255,255,0.04);
  color: #fff;
  border-color: rgba(255,255,255,0.12);
}
.content {
  margin-left: 17.5rem;
  padding: 2rem;
}
.content-shell {
  max-width: 96rem;
  margin: 0 auto;
}
.content.full-width {
  margin-left: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 1.5rem;
  gap: 1rem;
  flex-wrap: wrap;
}
.page-head > div { display: grid; gap: 0.4rem; }
.eyebrow {
  color: var(--accent);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 800;
}
.cards {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 1rem;
}
.card, .panel, .login-card {
  background: linear-gradient(180deg, var(--panel), var(--panel-strong));
  border: 1px solid rgba(166, 60, 33, 0.08);
  border-radius: 1.5rem;
  box-shadow: var(--shadow);
}
.card { padding: 1.3rem; }
.card span { color: var(--muted); font-weight: 600; }
.card strong {
  display: block;
  font-size: clamp(1.6rem, 2.4vw, 2.2rem);
  margin-top: 0.55rem;
  color: var(--ink);
}
.panel {
  padding: 1.25rem;
  margin-bottom: 1rem;
}
.grid.two {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.filters {
  display: grid;
  gap: 0.8rem;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  align-items: end;
  margin-bottom: 1rem;
}
.filters button { min-width: 8.5rem; }
.stack { display: grid; gap: 0.95rem; }
.facts { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.8rem; }
.facts li {
  padding: 0.8rem 0.95rem;
  background: rgba(15, 118, 110, 0.04);
  border: 1px solid rgba(15, 118, 110, 0.08);
  border-radius: 1rem;
}
.rule-row, .similar-card, .similar-item {
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--line);
}
.rule-row { display: flex; justify-content: space-between; gap: 1rem; }
.inline { display: flex; align-items: center; gap: 0.65rem; color: var(--ink); }
.inline input { width: auto; }
.inline-form {
  display: flex;
  gap: 0.65rem;
  align-items: center;
  flex-wrap: wrap;
}
.inline-form input { min-width: 7rem; }
.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin: 0.9rem 0 1rem;
  flex-wrap: wrap;
}
.button-like {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.8rem 1rem;
  border-radius: 0.9rem;
  text-decoration: none;
}
.table-wrap {
  overflow-x: auto;
  border: 1px solid rgba(23, 33, 43, 0.06);
  border-radius: 1rem;
  background: #fff;
}
.search-list {
  display: grid;
  gap: 0.65rem;
  max-height: 20rem;
  overflow: auto;
}
.search-result {
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: #fff;
  color: var(--ink);
}
.search-result.active {
  border-color: rgba(166, 60, 33, 0.45);
  background: #fff2eb;
}
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0.4rem 0.7rem;
  color: white;
  font-weight: 700;
  font-size: 0.8rem;
  min-width: 4.2rem;
}
.badge.alto { background: var(--good); }
.badge.medio { background: var(--mid); }
.badge.baixo { background: var(--bad); }
.full { width: 100%; }
.login-wrap { width: 100%; display: flex; justify-content: center; }
.login-card {
  width: min(30rem, 100%);
  padding: 2rem;
}
.login-card .muted { color: var(--muted); }
.alert {
  background: #fee4e2;
  color: #912018;
  border-radius: 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid rgba(180, 35, 24, 0.14);
}
.tabs { display: grid; gap: 1rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 980px) {
  .sidebar {
    position: static;
    width: auto;
    height: auto;
    inset: auto;
    border-right: 0;
    border-bottom: 1px solid rgba(255,255,255,0.08);
  }
  .content,
  .content.full-width {
    padding: 1rem;
    margin-left: 0;
    min-height: auto;
  }
  .cards, .grid.two, .tabs, .filters { grid-template-columns: 1fr; }
  .page-head { align-items: stretch; }
  .panel, .card, .login-card { border-radius: 1.25rem; }
  table { min-width: 34rem; }
}
