:root {
  --ink: #0d0f12;
  --graphite: #171a1f;
  --graphite-2: #24282e;
  --surface: #ffffff;
  --surface-2: #f4f5f6;
  --surface-3: #eceef0;
  --line: #dedede;
  --line-strong: #c7c7c7;
  --muted: #6f7378;
  --muted-2: #969a9f;
  --dark: #000000;
  --semantic-red: #c81e2f;
  --semantic-red-soft: #fde8eb;
  --semantic-orange: #d46b08;
  --semantic-orange-soft: #fff0dc;
  --semantic-yellow: #a67800;
  --semantic-yellow-soft: #fff6cf;
  --semantic-green: #1f7a4d;
  --semantic-green-soft: #e6f4ed;
  --semantic-blue: #2563a8;
  --semantic-blue-soft: #e7f0fb;
  --shadow: 0 18px 38px rgba(0, 0, 0, 0.08);
  --shadow-soft: 0 10px 22px rgba(0, 0, 0, 0.05);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--surface-2);
  color: var(--ink);
  overflow-x: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.is-hidden {
  display: none !important;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(135deg, #ffffff 0%, #f2f2f2 46%, #e8e8e8 100%);
}

.login-card {
  width: min(440px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 32px;
}

.brand-lockup {
  display: flex;
  gap: 14px;
  align-items: center;
}

.brand-lockup strong {
  display: block;
  letter-spacing: 0;
}

.brand-lockup span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.brand-logo {
  width: 154px;
  height: auto;
  object-fit: contain;
  display: block;
}

.login-card h1 {
  margin: 36px 0 8px;
  font-size: 30px;
}

.login-card p {
  color: var(--muted);
  margin-bottom: 18px;
}

label {
  display: block;
  color: #364150;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 7px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 10px 12px;
  outline: none;
}

textarea {
  min-height: 92px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--graphite);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.08);
}

.primary-button,
.secondary-button,
.text-button,
.sidebar-action {
  border: 0;
  border-radius: 6px;
  min-height: 40px;
  padding: 0 16px;
  font-weight: 700;
}

.primary-button {
  width: 100%;
  margin-top: 18px;
  background: var(--dark);
  color: #fff;
  transition: background 160ms ease, transform 160ms ease;
}

.primary-button:hover {
  background: var(--graphite-2);
}

.secondary-button {
  background: var(--surface-3);
  color: var(--ink);
}

.secondary-button:hover {
  background: #e2e2e2;
}

.text-button {
  background: transparent;
  color: var(--ink);
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 268px 1fr;
}

.sidebar {
  background: #ffffff;
  color: var(--ink);
  border-right: 1px solid var(--line);
  box-shadow: 8px 0 24px rgba(0, 0, 0, 0.035);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: sticky;
  top: 0;
}

.sidebar-brand {
  padding: 24px;
  border-bottom: 1px solid var(--line);
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}

.sidebar-brand .brand-logo {
  width: 190px;
  filter: grayscale(1) contrast(1.08);
}

.sidebar-brand strong {
  color: var(--ink);
  font-size: 20px;
}

.sidebar-brand span {
  color: var(--muted);
}

.nav-list {
  padding: 16px 0;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 50px;
  padding: 0 22px;
  border: 0;
  border-left: 4px solid transparent;
  color: #33383e;
  background: transparent;
  text-align: left;
  font-weight: 700;
}

.nav-item svg {
  width: 19px;
  height: 19px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
}

.nav-item.active {
  color: #000000;
  border-left-color: #000000;
  background: #f0f1f2;
}

.sidebar-action {
  margin: 16px 18px 22px;
  color: #222222;
  background: #f0f1f2;
  border: 1px solid var(--line);
}

.main-panel {
  min-width: 0;
}

.topbar {
  height: 76px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 24px;
  background: #ffffff;
  color: var(--ink);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

.search-box {
  max-width: 640px;
  flex: 1;
  position: relative;
  min-width: 0;
}

.search-box svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  stroke: #8c9299;
  fill: none;
  stroke-width: 2;
}

.search-box input {
  padding-left: 42px;
  background: #f7f8f9;
  border-color: var(--line);
  color: var(--ink);
}

.current-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.current-user strong,
.current-user span {
  display: block;
}

.current-user span {
  color: var(--muted);
  font-size: 12px;
}

.avatar {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #101010;
  color: #ffffff !important;
  font-size: 14px !important;
  font-weight: 800;
  line-height: 1;
  text-align: center;
}

.content-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  padding: 24px 26px 10px;
}

.content-header h1 {
  margin: 0 0 6px;
  font-size: 28px;
}

.content-header p {
  margin: 0;
  color: var(--muted);
}

.view-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.view-actions .primary-button {
  width: auto;
  margin: 0;
}

.content-area {
  padding: 12px 26px 34px;
  min-width: 0;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.kpi-card {
  min-width: 0;
  min-height: 116px;
  padding: 18px;
  border-radius: 7px;
  background: linear-gradient(145deg, #ffffff, #f1f2f3);
  color: var(--ink);
  border: 1px solid #d9dcdf;
  border-left: 4px solid #111111;
  box-shadow: var(--shadow-soft);
}

.kpi-card.danger {
  border-color: rgba(200, 30, 47, 0.45);
  border-left-color: var(--semantic-red);
  box-shadow: 0 10px 24px rgba(200, 30, 47, 0.11);
}

.kpi-card.danger strong {
  color: var(--semantic-red);
}

.kpi-card.danger::after {
  content: none;
}

.kpi-card span {
  color: #3d4247;
  font-weight: 700;
}

.kpi-card strong {
  display: block;
  font-size: clamp(22px, 1.75vw, 28px);
  line-height: 1.08;
  white-space: nowrap;
  margin: 10px 0;
}

.kpi-card small {
  color: var(--muted);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
  min-width: 0;
}

.panel {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: hidden;
  box-shadow: var(--shadow-soft);
}

.panel-header {
  min-height: 48px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}

.panel-header h2 {
  font-size: 16px;
  margin: 0;
}

.panel-header a {
  color: #4c5157;
  font-size: 12px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.panel-body {
  padding: 14px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid #e7ebf0;
  padding: 10px 9px;
  text-align: left;
  vertical-align: top;
}

.data-table th {
  color: #34383d;
  background: #f5f6f7;
  font-size: 12px;
}

.data-table tr:hover td {
  background: #fbfcfd;
}

.tag,
.priority-pill,
.status-pill,
.risk-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  border-radius: 5px;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.tag {
  color: #303030;
  background: #eeeeee;
}

.tag.judicial,
.tag.peticao,
.tag.audiencia,
.tag.protocolo,
.tag.recurso,
.tag.manifestacao {
  color: var(--semantic-orange);
  background: var(--semantic-orange-soft);
}

.tag.pagamento,
.tag.cobranca,
.tag.financeiro {
  color: var(--semantic-red);
  background: var(--semantic-red-soft);
}

.tag.administrativo,
.tag.contrato,
.tag.extrajudicial {
  color: var(--semantic-blue);
  background: var(--semantic-blue-soft);
}

.priority-pill.urgente {
  color: var(--semantic-red);
  background: var(--semantic-red-soft);
}

.priority-pill.alta {
  color: var(--semantic-orange);
  background: var(--semantic-orange-soft);
}

.priority-pill.media {
  color: var(--semantic-yellow);
  background: var(--semantic-yellow-soft);
}

.priority-pill.baixa {
  color: var(--semantic-green);
  background: var(--semantic-green-soft);
}

.status-pill.pendente,
.status-pill.vencido,
.status-pill.inadimplente,
.status-pill.alto-risco {
  color: var(--semantic-red);
  background: var(--semantic-red-soft);
}

.risk-pill.alta {
  color: #ffffff;
  background: var(--semantic-red);
}

.status-pill.concluido,
.status-pill.pago,
.risk-pill.baixa {
  color: var(--semantic-green);
  background: var(--semantic-green-soft);
  border: 0;
}

.status-pill.andamento,
.status-pill.em-andamento,
.status-pill.aguardando-terceiro,
.status-pill.parcialmente,
.status-pill.parcialmente-pago,
.risk-pill.media {
  color: var(--semantic-orange);
  background: var(--semantic-orange-soft);
}

.status-pill.cancelado,
.status-pill.inativo,
.status-pill.encerrado,
.status-pill.suspenso,
.status-pill.arquivado {
  color: #555555;
  background: #eeeeee;
}

.status-pill.ativo,
.status-pill.estrategico {
  color: var(--semantic-blue);
  background: var(--semantic-blue-soft);
}

.status-pill.potencial,
.status-pill.rascunho {
  color: var(--semantic-yellow);
  background: var(--semantic-yellow-soft);
}

.deadline-urgent {
  color: var(--semantic-red);
}

.deadline-list {
  display: grid;
}

.deadline-item {
  display: grid;
  grid-template-columns: 76px 96px minmax(132px, 1fr) 94px 62px;
  gap: 10px;
  align-items: center;
  min-height: 68px;
  padding: 12px 10px;
  border-bottom: 1px solid #e7ebf0;
  border-left: 3px solid transparent;
}

.deadline-item:last-child {
  border-bottom: 0;
}

.deadline-item.urgente {
  border-left-color: var(--semantic-red);
}

.deadline-item.alta {
  border-left-color: var(--semantic-orange);
}

.deadline-date strong,
.deadline-date span,
.deadline-main strong,
.deadline-main span {
  display: block;
}

.deadline-date strong {
  color: var(--semantic-red);
}

.deadline-date span,
.deadline-process,
.deadline-main span,
.deadline-owner {
  color: #4f565d;
  font-size: 11px;
}

.deadline-main strong {
  margin-bottom: 4px;
  line-height: 1.2;
  font-size: 13px;
}

.deadline-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-start;
}

.deadline-meta .tag,
.deadline-meta .priority-pill {
  max-width: 92px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.deadline-owner {
  text-align: right;
  overflow-wrap: anywhere;
}

.money-danger {
  color: var(--semantic-red);
  font-weight: 900;
}

.module-toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.module-toolbar input,
.module-toolbar select {
  max-width: 260px;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 14px;
  min-width: 0;
}

.detail-card {
  padding: 16px;
}

.detail-card h3 {
  margin: 0 0 12px;
}

.detail-list {
  display: grid;
  gap: 10px;
}

.detail-list div {
  display: grid;
  gap: 3px;
}

.detail-list span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 7px;
  padding: 26px;
  color: var(--muted);
  background: #fbfcfd;
}

.record-dialog {
  border: 0;
  border-radius: 8px;
  width: min(920px, calc(100vw - 24px));
  padding: 0;
  box-shadow: var(--shadow);
}

.record-dialog::backdrop {
  background: rgba(7, 16, 25, 0.58);
}

.record-dialog header,
.record-dialog footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.record-dialog footer {
  border-top: 1px solid var(--line);
  border-bottom: 0;
  justify-content: flex-end;
  gap: 10px;
}

.record-dialog footer .primary-button {
  width: auto;
  margin: 0;
}

.record-dialog h2,
.record-dialog p {
  margin: 0;
}

.record-dialog p {
  color: var(--muted);
  margin-top: 4px;
}

.icon-x {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 6px;
  background: var(--surface-3);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 20px;
  max-height: min(68vh, 700px);
  overflow: auto;
}

.field-wide {
  grid-column: 1 / -1;
}

.form-grid .primary-button {
  width: auto;
}

.chart-row {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 18px;
  align-items: center;
}

.donut {
  width: 170px;
  height: 170px;
  border-radius: 50%;
  background: conic-gradient(var(--semantic-red) 0 42%, var(--semantic-orange) 42% 64%, #e1b12c 64% 78%, var(--semantic-green) 78% 100%);
  position: relative;
}

.donut::after {
  content: attr(data-total);
  position: absolute;
  inset: 30px;
  border-radius: 50%;
  background: white;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--ink);
  font-weight: 800;
  padding: 18px;
}

.mobile-only {
  display: none;
}

.icon-button {
  border: 0;
  background: transparent;
  width: 40px;
  height: 40px;
}

.icon-button span {
  display: block;
  height: 2px;
  width: 22px;
  margin: 5px auto;
  background: white;
}

@media (max-width: 1180px) {
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-grid,
  .split {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    z-index: 30;
    inset: 0 auto 0 0;
    width: 280px;
    transform: translateX(-100%);
    transition: transform 180ms ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .mobile-only {
    display: block;
  }

  .topbar {
    height: auto;
    min-height: 76px;
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr);
    padding: 14px;
  }

  .search-box {
    max-width: none;
  }

  .current-user {
    grid-column: 1 / -1;
    width: 100%;
    justify-content: flex-start;
  }

  .current-user .text-button {
    margin-left: auto;
  }

  .content-header {
    align-items: flex-start;
    flex-direction: column;
    padding: 22px 16px 8px;
  }

  .content-header p {
    max-width: 32ch;
  }

  .content-area {
    padding: 8px 16px 24px;
  }

  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .panel {
    overflow-x: auto;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .chart-row {
    grid-template-columns: 1fr;
  }
}
.form-message {
  min-height: 20px;
  margin: 10px 0 0;
  color: var(--semantic-red);
  font-size: 13px;
  font-weight: 700;
}
