:root {
  --bg: #f3f6f8;
  --panel: #ffffff;
  --ink: #17202a;
  --muted: #667085;
  --line: #dfe6ee;
  --brand: #155e75;
  --brand-2: #0f766e;
  --soft: #eef6f7;
  --good: #157347;
  --warn: #9a6700;
  --bad: #b42318;
  --info: #1d4ed8;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background:
    linear-gradient(180deg, #eef6f7 0, #f7f9fb 260px, var(--bg) 100%);
  color: var(--ink);
  font-family: Inter, Arial, Helvetica, sans-serif;
  font-size: 14px;
}
a { color: var(--brand); text-decoration: none; }
header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255,255,255,.9);
  border-bottom: 1px solid rgba(216, 226, 234, .9);
  padding: 12px 24px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  backdrop-filter: blur(14px);
  box-shadow: 0 12px 32px rgba(16, 24, 40, .05);
}
.brand { font-weight: 700; font-size: 18px; display: flex; align-items: center; gap: 10px; }
.logo { max-width: 34px; max-height: 34px; object-fit: contain; }
.logo-preview { max-width: 180px; max-height: 90px; object-fit: contain; border: 1px solid var(--line); border-radius: 6px; padding: 8px; background: #fff; }
.layout { max-width: 1380px; margin: 0 auto; padding: 22px; }
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  margin-bottom: 18px;
  box-shadow: 0 16px 38px rgba(16, 24, 40, .055);
}
.toolbar, .grid, .case-head, .actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; }
.field.wide { grid-column: 1 / -1; }
.kpi {
  background: linear-gradient(180deg, #fff, #fbfdfe);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: 0 16px 34px rgba(16, 24, 40, .055);
}
.kpi strong { display: block; font-size: 24px; margin-top: 5px; }
.dashboard-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.metric-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: 0 12px 28px rgba(16,24,40,.05);
}
.metric-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  font-weight: 700;
}
.metric-card strong {
  display: block;
  margin-top: 8px;
  font-size: 34px;
  line-height: 1;
}
.kpi-card {
  position: relative;
  min-height: 116px;
  overflow: hidden;
  background: linear-gradient(180deg, #ffffff, #f8fbfc);
  border: 1px solid #d7e4ea;
  border-radius: 8px;
  padding: 18px;
  box-shadow: 0 18px 42px rgba(16,24,40,.075);
}
.kpi-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 5px;
  height: 100%;
  background: linear-gradient(180deg, var(--brand), var(--brand-2));
}
.kpi-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  font-weight: 800;
}
.kpi-card strong {
  display: block;
  margin-top: 14px;
  font-size: 38px;
  line-height: 1;
  color: var(--ink);
}
.dashboard-objective-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
}
.data-table th,
.data-table td {
  padding: 12px 10px;
}
.activity-table td {
  max-width: 360px;
}
.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(340px, .65fr);
  gap: 18px;
}
.dashboard-visual {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, .55fr);
  gap: 18px;
}
.chart-panel { min-height: 280px; }
.column-chart {
  display: grid;
  grid-template-columns: repeat(12, minmax(42px, 1fr));
  gap: 12px;
  align-items: end;
  min-height: 300px;
}
.column-item {
  display: grid;
  grid-template-rows: auto 210px auto;
  gap: 8px;
  min-width: 0;
}
.column-item strong {
  text-align: center;
  font-size: 18px;
}
.column-item span {
  min-height: 42px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
  overflow: hidden;
  text-align: center;
}
.column-track {
  display: flex;
  align-items: end;
  justify-content: center;
  height: 210px;
  border-radius: 8px;
  background: #edf3f5;
  overflow: hidden;
}
.column-track i {
  width: 100%;
  display: block;
  border-radius: 8px 8px 0 0;
  background: linear-gradient(180deg, #0f766e, #155e75);
  box-shadow: 0 -10px 24px rgba(15,118,110,.22);
}
.focus-chart {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.big-ring {
  width: 210px;
  height: 210px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  margin: 10px auto 20px;
  background:
    radial-gradient(circle at center, #fff 0 55%, transparent 56%),
    conic-gradient(var(--brand) calc(var(--pct) * 1%), #e5edf2 0);
  box-shadow: inset 0 0 0 1px rgba(16,24,40,.05), 0 18px 40px rgba(16,24,40,.08);
}
.big-ring strong {
  font-size: 42px;
}
.big-ring span {
  margin-top: 48px;
  color: var(--muted);
}
.process-metrics {
  width: 100%;
  display: grid;
  gap: 10px;
}
.process-metrics span {
  display: flex;
  justify-content: space-between;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfdfe;
}
.process-metrics b { font-size: 18px; }
.bar-chart {
  display: grid;
  gap: 12px;
}
.bar-row {
  display: grid;
  grid-template-columns: minmax(150px, .8fr) minmax(160px, 1.4fr) 44px;
  gap: 12px;
  align-items: center;
}
.bar-row span {
  color: #344054;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bar-row strong { text-align: right; }
.bar-track {
  height: 12px;
  background: #edf3f5;
  border-radius: 999px;
  overflow: hidden;
}
.bar-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
}
.donut-list {
  display: grid;
  gap: 13px;
}
.donut-item {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}
.mini-donut {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, #fff 0 52%, transparent 53%),
    conic-gradient(var(--brand-2) calc(var(--pct) * 1%), #e8eef3 0);
  box-shadow: inset 0 0 0 1px rgba(16,24,40,.05);
}
.case-list {
  display: grid;
  gap: 10px;
}
.case-row {
  display: grid;
  grid-template-columns: minmax(260px, 1.2fr) minmax(360px, 1.6fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.case-row:hover {
  transform: translateY(-1px);
  border-color: #b9d8df;
  box-shadow: 0 14px 34px rgba(16,24,40,.08);
}
.case-main {
  display: grid;
  gap: 3px;
  min-width: 0;
}
.case-exp {
  font-weight: 800;
  color: var(--brand);
}
.case-main strong {
  font-size: 16px;
}
.case-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.case-meta > span:not(.badge) {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 8px;
  background: #fbfdfe;
  font-size: 12px;
}
.case-row-actions { justify-self: end; }
input, select, textarea, button {
  font: inherit;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  background: #fff;
}
input:focus, select:focus, textarea:focus {
  outline: 3px solid rgba(21, 94, 117, .14);
  border-color: var(--brand);
}
textarea { width: 100%; min-height: 110px; }
button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  color: #fff;
  background: var(--brand);
  border-radius: 6px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(21, 94, 117, .16);
}
.button.secondary, button.secondary { background: var(--brand-2); }
.button.ghost { background: #fff; color: var(--brand); border: 1px solid #c8dde3; box-shadow: none; }
button.danger, .button.danger { background: var(--bad); }
table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { border-bottom: 1px solid var(--line); padding: 10px 9px; text-align: left; vertical-align: top; }
th { color: #344054; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; background: #fbfcfd; }
tbody tr:hover { background: #f8fbfc; }
.case-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.professional-table {
  border-collapse: separate;
  border-spacing: 0;
  min-width: 980px;
}
.professional-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fafc;
  border-bottom: 1px solid #d7e4ea;
  padding: 12px 14px;
}
.professional-table td {
  padding: 13px 14px;
  vertical-align: middle;
}
.professional-table tbody tr:nth-child(even) {
  background: #fcfdfe;
}
.professional-table tbody tr:hover {
  background: #eef7f8;
}
.case-link {
  font-weight: 800;
  color: var(--brand);
}
.case-table .badge {
  max-width: 220px;
  white-space: normal;
  line-height: 1.25;
}
.case-table button.danger {
  padding: 7px 10px;
  box-shadow: none;
}
.badge {
  display: inline-block;
  padding: 4px 7px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: #eef2f6;
  color: #475467;
}
.badge.good { background: #e8f5ee; color: var(--good); }
.badge.warn { background: #fff4d6; color: var(--warn); }
.badge.bad { background: #fff0ed; color: var(--bad); }
.badge.info { background: #eaf1ff; color: var(--info); }
.split { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(320px, .75fr); gap: 18px; }
.field { margin-bottom: 12px; }
.field label { display: block; color: var(--muted); font-size: 12px; margin-bottom: 4px; text-transform: uppercase; }
.field input, .field select, .field textarea { width: 100%; }
.flash { padding: 10px 12px; border-radius: 6px; margin-bottom: 16px; background: #e8f5ee; color: var(--good); }
.flash.error { background: #fff0ed; color: var(--bad); }
.subpanel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 14px;
  background: #fbfcfd;
}
.subpanel summary { cursor: pointer; font-weight: 700; margin-bottom: 10px; }
.raw-grid { margin-top: 12px; }
.check { display: flex; align-items: center; gap: 8px; margin: 8px 0 16px; }
.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(rgba(5, 21, 30, .68), rgba(5, 21, 30, .52)),
    radial-gradient(circle at 18% 14%, rgba(21, 94, 117, .38), transparent 30%),
    linear-gradient(135deg, #061822 0%, #0f3d46 46%, #f7fafc 100%);
}
.login-shell {
  width: min(960px, 100%);
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  gap: 34px;
  align-items: center;
}
.login-brand {
  padding: 18px;
  color: #fff;
}
.login-brand img {
  width: min(390px, 100%);
  height: auto;
  display: block;
  margin-bottom: 28px;
  background: rgba(255,255,255,.94);
  border-radius: 8px;
  padding: 14px;
  box-shadow: 0 22px 70px rgba(0,0,0,.22);
}
.login-brand h1 {
  margin: 0 0 10px;
  font-size: 42px;
  line-height: 1.05;
}
.login-brand p {
  margin: 0;
  color: rgba(255,255,255,.82);
  font-size: 17px;
}
.login-card {
  background: rgba(255, 255, 255, .96);
  border: 1px solid rgba(255,255,255,.64);
  border-radius: 8px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .24);
  padding: 32px;
  backdrop-filter: blur(10px);
}
.login-card h2 { margin: 0 0 6px; }
.login-card input {
  width: 100%;
  min-height: 44px;
  background: #f8fafc;
}
.login-card button { width: 100%; min-height: 44px; margin-top: 6px; }
.login-lock {
  display: inline-flex;
  align-items: center;
  padding: 5px 9px;
  border-radius: 999px;
  background: #e8f5ee;
  color: var(--good);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 14px;
}
.login-note {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.section-title {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 14px;
}
.section-title h2 { margin: 0 0 4px; }
.section-title p { margin: 0; }
.demand-hero {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  gap: 18px;
  padding: 24px;
  margin-bottom: 18px;
  color: #fff;
  background: linear-gradient(135deg, #113f52, #0f766e);
  border-radius: 8px;
  box-shadow: 0 22px 54px rgba(15, 118, 110, .22);
}
.demand-hero h1 {
  margin: 0 0 8px;
  font-size: 30px;
}
.demand-hero p {
  margin: 0;
  color: rgba(255,255,255,.82);
}
.demand-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 10px;
  min-width: 290px;
}
.demand-summary span {
  display: grid;
  place-items: center;
  padding: 16px;
  border-radius: 8px;
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.2);
}
.demand-summary strong {
  display: block;
  font-size: 28px;
  color: #fff;
}
.demand-filters .toolbar input { min-width: min(420px, 100%); flex: 1; }
.demand-group { overflow-x: auto; }
.demand-actions {
  display: grid;
  gap: 8px;
  min-width: 250px;
}
.procurador-form {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) auto;
  gap: 8px;
}
.procurador-form input { min-width: 0; }
.procurador-list {
  display: grid;
  gap: 12px;
}
.procurador-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfe;
}
.empty-state {
  text-align: center;
  padding: 36px;
}
.case-create-hero, .admin-hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 22px;
  margin-bottom: 18px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-left: 5px solid var(--brand);
  border-radius: 8px;
  box-shadow: 0 12px 34px rgba(16, 24, 40, .06);
}
.case-create-hero h1, .admin-hero h2 { margin: 0 0 6px; }
.case-create-hero p, .admin-hero p { margin: 0; color: var(--muted); max-width: 760px; }
.case-create-form {
  display: grid;
  gap: 16px;
}
.case-form-section {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}
.case-form-section h2 {
  margin: 0 0 14px;
  font-size: 17px;
}
.firm-picker {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(240px, .8fr);
  gap: 18px;
  align-items: end;
  background: #f8fbfc;
}
.sticky-actions {
  position: sticky;
  bottom: 0;
  z-index: 3;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 14px;
  background: rgba(246, 247, 249, .92);
  border: 1px solid var(--line);
  border-radius: 8px;
  backdrop-filter: blur(8px);
}
.admin-users-layout { grid-template-columns: minmax(0, 1fr) minmax(330px, 380px); align-items: start; }
.user-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.user-card, .firm-card, .permission-list {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  padding: 14px;
}
.user-card-head {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}
.user-card-head strong { display: block; font-size: 16px; }
.user-card-head p { margin: 3px 0 7px; }
.avatar {
  width: 58px;
  height: 58px;
  flex: 0 0 58px;
  border-radius: 50%;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: #eaf1ff;
  color: var(--info);
  font-weight: 800;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--line);
}
.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.compact-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
}
.user-danger-actions {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.create-user-panel {
  position: sticky;
  top: 18px;
}
.permission-list {
  margin-top: 14px;
  background: #fff;
}
.permission-list p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.firm-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.firm-card {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  background: #fff;
}
.firm-card h3 {
  margin: 0 0 8px;
}
.firm-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(86px, 1fr));
  gap: 8px;
  text-align: center;
}
.firm-stats span {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  color: var(--muted);
}
.firm-stats strong {
  display: block;
  color: var(--ink);
  font-size: 22px;
}
@media (max-width: 900px) {
  .grid, .split, .firm-picker, .user-card-grid, .firm-card-grid, .compact-grid, .dashboard-grid, .dashboard-visual, .dashboard-summary, .dashboard-objective-grid, .bar-row, .case-row { grid-template-columns: 1fr; }
  .column-chart { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .case-row-actions { justify-self: stretch; }
  .case-create-hero, .admin-hero, .firm-card, .demand-hero, .section-title { align-items: flex-start; flex-direction: column; }
  .demand-summary { width: 100%; min-width: 0; }
  .sticky-actions { justify-content: stretch; }
  .sticky-actions button, .sticky-actions .button { flex: 1; }
  .create-user-panel { position: static; }
  .login-shell { grid-template-columns: 1fr; gap: 12px; }
  .login-brand h1 { font-size: 32px; }
  header { align-items: flex-start; }
  table { font-size: 12px; }
}
