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

* { box-sizing: border-box; }
body {
  margin: 0;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--brand) 12%, #ffffff) 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: color-mix(in srgb, #ffffff 92%, var(--brand));
  border-bottom: 3px solid var(--gold);
  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);
  color: #263445;
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .02em;
}
.kpi strong {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 10px;
  width: fit-content;
  min-width: 88px;
  font-size: 30px;
  line-height: 1;
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--accent));
  border-radius: 8px;
  padding: 10px 14px;
  box-shadow: 0 10px 20px color-mix(in srgb, var(--brand) 22%, transparent);
  letter-spacing: 0;
  text-transform: none;
}
.dashboard-kpi-grid {
  margin-bottom: 18px;
}
.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(--accent));
}
.kpi-card::after {
  content: "";
  position: absolute;
  right: 16px;
  top: 16px;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--gold);
  opacity: .9;
}
.kpi-card span {
  display: block;
  color: #263445;
  font-size: 13px;
  text-transform: uppercase;
  font-weight: 800;
  letter-spacing: .02em;
}
.kpi-card strong {
  display: block;
  margin-top: 14px;
  width: fit-content;
  min-width: 92px;
  border-radius: 8px;
  padding: 8px 12px;
  background: linear-gradient(135deg, var(--brand), var(--accent));
  color: #fff;
  font-size: 38px;
  line-height: 1;
  box-shadow: 0 12px 24px color-mix(in srgb, var(--brand) 22%, transparent);
}
.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, var(--accent), var(--brand));
  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(--accent));
}
.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(--accent) 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 color-mix(in srgb, var(--brand) 22%, transparent);
  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(--accent); }
.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;
}
.status-inline-form {
  margin: 0;
}
.status-select {
  max-width: 240px;
  min-width: 170px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  padding: 6px 28px 6px 10px;
  cursor: pointer;
  color: #17202a;
}
.status-select.good { background: #e9f8ef; color: #14532d; border-color: #9bd7af; }
.status-select.warn { background: #fff7dc; color: #713f12; border-color: #e8c96d; }
.status-select.bad { background: #fff1f0; color: #7f1d1d; border-color: #f2aaa6; }
.status-select.info { background: #edf4ff; color: #173b76; border-color: #adc7f5; }
.badge {
  display: inline-block;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  background: #eef2f6;
  color: #344054;
  border: 1px solid #d7dee8;
  line-height: 1.2;
}
.badge.good { background: #e9f8ef; color: #14532d; border-color: #9bd7af; }
.badge.warn { background: #fff7dc; color: #713f12; border-color: #e8c96d; }
.badge.bad { background: #fff1f0; color: #7f1d1d; border-color: #f2aaa6; }
.badge.info { background: #edf4ff; color: #173b76; border-color: #adc7f5; }
.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;
}
.signature-shell {
  width: min(840px, calc(100% - 28px));
  margin: auto;
}
.signature-card {
  width: 100%;
}
#signature-pad {
  width: 100%;
  max-width: 100%;
  height: 220px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  touch-action: none;
}
.signature-actions {
  display: flex;
  justify-content: flex-end;
  margin: 8px 0;
}
.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, var(--brand), #1E5A96 58%, var(--accent));
  border-radius: 8px;
  box-shadow: 0 22px 54px color-mix(in srgb, var(--brand) 24%, transparent);
}
.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;
}
.segmented {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f6f8fb;
}
.segmented a {
  padding: 9px 14px;
  border-radius: 6px;
  color: var(--muted);
  font-weight: 800;
}
.segmented a.active {
  background: #fff;
  color: var(--text);
  box-shadow: var(--shadow);
}
.demand-filters .toolbar input { min-width: min(420px, 100%); flex: 1; }
.demand-bulkbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  border-left: 4px solid var(--primary);
}
.demand-bulkbar p { margin: 3px 0 0; }
.demand-bulkbar select { min-width: 220px; }
.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; }
.case-edit-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 12px 0;
  background: #fff;
}
.case-edit-section summary {
  cursor: pointer;
  padding: 14px 16px;
  font-weight: 900;
}
.case-edit-section .form-grid {
  padding: 0 16px 16px;
}
.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-stack {
  display: grid;
  gap: 18px;
}
.admin-toggle-panel {
  display: none;
}
.admin-toggle-panel.open {
  display: block;
}
.user-table-wrap {
  overflow-x: auto;
}
.admin-user-table {
  min-width: 980px;
}
.user-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-edit-row {
  display: none;
}
.user-edit-row.open {
  display: table-row;
}
.user-edit-row td {
  background: #f8fafc;
  border-top: 0;
}
.user-edit-panel {
  padding: 12px 0 4px;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.user-edit-actions {
  justify-content: space-between;
  padding-top: 8px;
}
.firm-card, .permission-list {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  padding: 14px;
}
.user-session {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-weight: 700;
}
.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;
}
.avatar.small {
  width: 38px;
  height: 38px;
  flex-basis: 38px;
  font-size: 13px;
}
.compact-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
}
.user-danger-actions {
  margin: 8px 0 6px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  justify-content: flex-end;
}
.email-send-panel {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid #fecaca;
  border-radius: 8px;
  background: #fff7f7;
}
.email-send-panel > strong {
  display: block;
  margin-bottom: 4px;
  color: var(--bad);
}
.email-send-panel form {
  align-items: center;
}
.signature-send-form {
  display: grid;
  gap: 8px;
  justify-items: start;
}
.signature-review-panel {
  display: grid;
  gap: 10px;
  padding: 12px 0 4px;
}
.create-user-panel {
  position: static;
}
.settings-form {
  display: grid;
  gap: 18px;
}
.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}
.settings-actions {
  justify-content: flex-end;
}
.settings-stack {
  display: grid;
  gap: 18px;
}
.settings-stack > .panel {
  margin-bottom: 0;
}
.settings-stack > .panel > h2,
.settings-stack > .panel > h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e5edf3;
}
.settings-stack > .panel > h2::before,
.settings-stack > .panel > h3::before {
  content: "";
  width: 8px;
  height: 28px;
  border-radius: 999px;
  background: #0e7490;
}
.settings-stack .panel:nth-child(1) { border-left: 4px solid #0e7490; }
.settings-stack .panel:nth-child(2) { border-left: 4px solid #1f2937; }
.settings-stack .panel:nth-child(3) { border-left: 4px solid #0f766e; }
.settings-stack .panel:nth-child(4) { border-left: 4px solid #b45309; }
.settings-stack .panel:nth-child(5),
.settings-stack .panel:nth-child(6),
.settings-stack .panel:nth-child(7) { border-left: 4px solid #155e75; }
.settings-stack hr {
  border: 0;
  border-top: 1px solid #e5edf3;
  margin: 18px 0;
}
.settings-stack .subpanel {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid #dbe4ec;
  border-radius: 8px;
  background: #f8fafc;
}
.settings-stack > .panel > .field,
.settings-stack > .panel > .check {
  margin-bottom: 12px;
}
.settings-stack .check {
  padding: 12px;
  border: 1px solid #dbe4ec;
  border-radius: 8px;
  background: #f8fafc;
}
.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-edit {
  display: grid;
  align-items: start;
}
.firm-edit-main {
  display: grid;
  gap: 8px;
}
.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;
}
.theme-dark header {
  background: linear-gradient(135deg, #0f172a, var(--brand));
  color: #fff;
  border-bottom-color: rgba(255,255,255,.16);
}
.theme-dark header a,
.theme-dark header .button.ghost {
  color: #fff;
}
.theme-dark header .button.ghost {
  border-color: rgba(255,255,255,.28);
  background: rgba(255,255,255,.08);
}
.density-compact table th,
.density-compact table td,
.density-compact .professional-table th,
.density-compact .professional-table td {
  padding: 8px 9px;
}
.density-compact .panel {
  padding: 14px;
}
.column-track i,
.kpi-card::before {
  background: linear-gradient(180deg, var(--brand), var(--accent));
}

/* Professional Reclanova theme layer */
body {
  background:
    radial-gradient(circle at 8% -12%, color-mix(in srgb, var(--gold) 22%, transparent) 0 220px, transparent 360px),
    linear-gradient(180deg, #f7f9fc 0, #eef3f8 340px, #f6f8fb 100%);
  color: #111827;
}
header {
  min-height: 68px;
  background: rgba(255, 255, 255, .92);
  border-bottom: 1px solid rgba(18, 60, 105, .14);
  box-shadow: 0 14px 38px rgba(18, 60, 105, .09);
}
header::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 3px;
  background: linear-gradient(90deg, var(--brand), var(--gold) 48%, var(--accent));
}
.brand {
  min-width: 210px;
  color: #0f172a;
  font-size: 19px;
  letter-spacing: 0;
}
.logo {
  max-width: 42px;
  max-height: 42px;
}
header nav.toolbar {
  gap: 8px;
}
header .button.ghost {
  min-height: 38px;
  border: 1px solid transparent;
  background: transparent;
  color: #243244;
  box-shadow: none;
  padding: 9px 11px;
}
header .button.ghost:hover {
  border-color: color-mix(in srgb, var(--brand) 22%, #ffffff);
  background: color-mix(in srgb, var(--brand) 8%, #ffffff);
  color: var(--brand);
}
.user-session {
  min-height: 40px;
  padding: 4px 10px 4px 4px;
  border: 1px solid rgba(18, 60, 105, .12);
  border-radius: 999px;
  background: #fff;
}
header nav > .button:not(.ghost) {
  min-height: 38px;
  background: linear-gradient(135deg, var(--brand), #1e5a96);
  box-shadow: 0 10px 22px rgba(18, 60, 105, .18);
}
.layout {
  max-width: 1440px;
  padding: 28px 26px 34px;
}
.panel {
  border: 1px solid rgba(18, 60, 105, .1);
  border-radius: 10px;
  box-shadow: 0 18px 44px rgba(18, 60, 105, .07);
}
.section-title h2,
.panel h2,
.panel h3 {
  color: #0f172a;
  letter-spacing: 0;
}
.admin-hero,
.demand-hero,
.case-create-hero {
  border-radius: 10px;
  background:
    linear-gradient(135deg, rgba(18,60,105,.98), rgba(30,90,150,.94) 54%, rgba(229,57,53,.92));
  box-shadow: 0 24px 58px rgba(18, 60, 105, .2);
}
.admin-hero h1,
.admin-hero h2,
.demand-hero h1,
.case-create-hero h1 {
  letter-spacing: 0;
}
.kpi,
.kpi-card,
.metric-card {
  border-color: rgba(18, 60, 105, .12);
  background:
    linear-gradient(180deg, rgba(255,255,255,.98), rgba(248,251,254,.98));
  box-shadow: 0 18px 42px rgba(18, 60, 105, .08);
}
.kpi {
  position: relative;
  min-height: 122px;
  display: grid;
  align-content: space-between;
  overflow: hidden;
}
.kpi::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: linear-gradient(180deg, var(--brand), var(--accent));
}
.kpi::after {
  content: "";
  position: absolute;
  right: 16px;
  top: 16px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--gold);
}
.kpi strong,
.kpi-card strong {
  background: linear-gradient(135deg, #123c69, #1e5a96);
  box-shadow: 0 14px 28px rgba(18, 60, 105, .2);
}
.kpi:nth-child(even) strong,
.kpi-card:nth-child(even) strong {
  background: linear-gradient(135deg, var(--accent), #c62828);
}
.professional-table {
  border: 1px solid rgba(18, 60, 105, .1);
  border-radius: 10px;
  overflow: hidden;
}
.professional-table th {
  background: #f3f6fa;
  color: #344054;
  font-weight: 900;
  letter-spacing: .04em;
}
.professional-table td {
  border-bottom-color: #e8edf3;
}
.professional-table tbody tr:nth-child(even) {
  background: #fbfcfe;
}
.professional-table tbody tr:hover {
  background: #f1f6fb;
}
.badge {
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.34);
}
.badge.info {
  background: #e9f1fb;
  color: #123c69;
  border-color: #b8cde4;
}
.badge.bad {
  background: #fff0ef;
  color: #8f1d1a;
  border-color: #f0b7b4;
}
.badge.warn {
  background: #fff8dd;
  color: #6f4b00;
  border-color: #efd47b;
}
.badge.good {
  background: #eaf7ef;
  color: #14532d;
  border-color: #a6d8b8;
}
button,
.button {
  border-radius: 7px;
  box-shadow: 0 10px 20px rgba(18, 60, 105, .12);
}
.button.secondary,
button.secondary {
  background: linear-gradient(135deg, var(--accent), #c62828);
}
.button.ghost,
button.ghost {
  color: var(--brand);
  background: #fff;
  border: 1px solid rgba(18, 60, 105, .18);
}
input,
select,
textarea {
  border-color: #d8e1ea;
  background: #fff;
}
input:focus,
select:focus,
textarea:focus {
  outline: 3px solid rgba(18, 60, 105, .13);
  border-color: var(--brand);
}
.flash {
  border: 1px solid #a6d8b8;
  background: #ecf8f0;
}
.theme-dark header {
  background: linear-gradient(135deg, #0f172a, var(--brand));
  border-bottom: 3px solid var(--gold);
}

/* Premium secure login */
body.login {
  min-height: 100vh;
  padding: 28px;
  place-items: center;
  background:
    radial-gradient(circle at 14% 18%, rgba(37, 99, 235, .34) 0 190px, transparent 360px),
    radial-gradient(circle at 92% 82%, rgba(217, 119, 6, .26) 0 180px, transparent 340px),
    linear-gradient(135deg, #070b14 0%, #0b1220 46%, #111827 100%);
}
body.login::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.045) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(180deg, rgba(0,0,0,.72), transparent 78%);
}
.login-shell {
  position: relative;
  z-index: 1;
  width: min(1080px, 100%);
  grid-template-columns: minmax(0, .95fr) minmax(420px, .72fr);
  gap: 34px;
}
.login-brand {
  min-height: 560px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 38px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,.035)),
    linear-gradient(135deg, rgba(37,99,235,.18), rgba(217,119,6,.08));
  box-shadow: 0 30px 90px rgba(0,0,0,.34);
  backdrop-filter: blur(18px);
}
.login-brand img {
  width: min(360px, 100%);
  margin-bottom: 34px;
  border-radius: 12px;
  padding: 18px;
  background: #fff;
  box-shadow: 0 26px 70px rgba(0,0,0,.34);
}
.login-brand h1 {
  max-width: 620px;
  font-size: 52px;
  line-height: 1;
  letter-spacing: 0;
}
.login-brand p {
  max-width: 560px;
  margin-top: 12px;
  color: rgba(255,255,255,.82);
  font-size: 18px;
  line-height: 1.55;
}
.login-brand::after {
  content: "Multi-despacho · Auditoría · Firma · Documentos";
  width: fit-content;
  margin-top: 34px;
  padding: 10px 14px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 999px;
  color: rgba(255,255,255,.82);
  background: rgba(255,255,255,.08);
  font-size: 13px;
  font-weight: 800;
}
.login-card {
  position: relative;
  padding: 34px;
  border: 1px solid rgba(255,255,255,.8);
  border-radius: 14px;
  background: rgba(255,255,255,.98);
  box-shadow: 0 32px 90px rgba(0,0,0,.32);
}
.login-card::before {
  content: "";
  position: absolute;
  left: 34px;
  right: 34px;
  top: 0;
  height: 4px;
  border-radius: 0 0 999px 999px;
  background: linear-gradient(90deg, var(--accent), var(--gold));
}
.login-card h2 {
  margin: 2px 0 8px;
  font-size: 28px;
  letter-spacing: 0;
}
.login-card .muted {
  color: #526173;
}
.login-card .field label {
  color: #344054;
  font-weight: 900;
}
.login-card input {
  min-height: 48px;
  border-color: #cfd8e3;
  border-radius: 9px;
  background: #f8fafc;
}
.login-card input:focus {
  outline: 4px solid rgba(37,99,235,.14);
  border-color: var(--accent);
  background: #fff;
}
.login-card button[type="submit"],
.login-card .button {
  min-height: 48px;
  border-radius: 9px;
  background: linear-gradient(135deg, #0b1220, #2563eb);
  box-shadow: 0 16px 34px rgba(37,99,235,.28);
}
.login-lock {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  font-weight: 900;
}
.login-note {
  color: #667085;
  line-height: 1.6;
}
.login-note a {
  font-weight: 900;
}
@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, .settings-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; }
}

/* Clean professional theme - high contrast */
body {
  background:
    linear-gradient(180deg, #eef4f7 0, #f7f9fb 260px, #f5f7fa 100%);
  color: #111827;
}

a { color: #0f5f76; }

header {
  background: rgba(255,255,255,.96);
  border-bottom: 1px solid #d8e1ea;
  box-shadow: 0 10px 28px rgba(17, 24, 39, .08);
}

header::before {
  background: linear-gradient(90deg, #1f2937, #0e7490);
}

.brand,
.section-title h1,
.section-title h2,
.panel h1,
.panel h2,
.panel h3 {
  color: #111827;
}

.muted,
.field label,
.login-note {
  color: #4b5563;
}

.panel,
.metric-card,
.kpi,
.kpi-card,
.professional-table,
.case-row,
.create-user-panel,
.floating-create-panel,
.signature-card {
  background: #ffffff;
  border-color: #dbe4ec;
  box-shadow: 0 14px 34px rgba(17, 24, 39, .07);
}

.admin-hero,
.demand-hero,
.case-create-hero {
  background: linear-gradient(135deg, #1f2937 0%, #24536a 58%, #0e7490 100%);
  color: #ffffff;
}

.admin-hero p,
.demand-hero p,
.case-create-hero p {
  color: rgba(255,255,255,.86);
}

button,
.button,
header nav > .button:not(.ghost),
.login-card button[type="submit"] {
  background: #0e7490;
  color: #ffffff;
  border: 1px solid #0e7490;
  box-shadow: 0 10px 22px rgba(14, 116, 144, .18);
}

button:hover,
.button:hover,
.login-card button[type="submit"]:hover {
  background: #155e75;
  border-color: #155e75;
}

.button.secondary,
button.secondary {
  background: #1f2937;
  border-color: #1f2937;
  color: #ffffff;
}

.button.ghost,
button.ghost,
header .button.ghost {
  background: #ffffff;
  color: #1f2937;
  border: 1px solid #cfd8e3;
  box-shadow: none;
}

.button.ghost:hover,
button.ghost:hover,
header .button.ghost:hover {
  background: #eef6f8;
  color: #155e75;
  border-color: #9bc6d1;
}

.kpi,
.kpi-card {
  color: #1f2937;
}

.kpi strong,
.kpi-card strong,
.kpi:nth-child(even) strong,
.kpi-card:nth-child(even) strong {
  background: #0f766e;
  color: #ffffff;
  box-shadow: 0 12px 24px rgba(15, 118, 110, .2);
}

.kpi::before,
.kpi-card::before,
.column-track i {
  background: linear-gradient(180deg, #0e7490, #1f2937);
}

.kpi::after,
.kpi-card::after {
  background: #0e7490;
}

table,
.professional-table {
  color: #1f2937;
}

th,
.professional-table th {
  background: #f1f5f9;
  color: #334155;
}

td,
.professional-table td {
  color: #1f2937;
}

.professional-table tbody tr:hover,
tbody tr:hover {
  background: #eef6f8;
}

.badge,
.case-table .badge {
  background: #eef2f7;
  color: #334155;
  border-color: #cfd8e3;
  box-shadow: none;
}

.badge.info,
.status-select.info {
  background: #e8f3ff;
  color: #17446b;
  border-color: #b8d7f0;
}

.badge.good,
.status-select.good {
  background: #e9f7ef;
  color: #14532d;
  border-color: #a7d8ba;
}

.badge.warn,
.status-select.warn {
  background: #fff7df;
  color: #713f12;
  border-color: #e6cf86;
}

.badge.bad,
.status-select.bad {
  background: #fff1f2;
  color: #881337;
  border-color: #f2b8c4;
}

input,
select,
textarea,
.status-select {
  background: #ffffff;
  color: #111827;
  border-color: #cfd8e3;
}

input:focus,
select:focus,
textarea:focus {
  outline: 3px solid rgba(14, 116, 144, .16);
  border-color: #0e7490;
}

.flash {
  background: #e9f7ef;
  color: #14532d;
  border: 1px solid #a7d8ba;
}

.flash.error {
  background: #fff1f2;
  color: #881337;
  border-color: #f2b8c4;
}

body.login {
  min-height: 100vh;
  padding: 30px;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 18% 18%, rgba(14, 116, 144, .16) 0 180px, transparent 360px),
    radial-gradient(circle at 86% 84%, rgba(31, 41, 55, .10) 0 220px, transparent 400px),
    linear-gradient(135deg, #f8fafc 0%, #eef4f7 48%, #f7f9fb 100%);
  color: #111827;
}

body.login::before {
  background-image:
    linear-gradient(rgba(31,41,55,.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(31,41,55,.045) 1px, transparent 1px);
  mask-image: linear-gradient(180deg, rgba(0,0,0,.4), transparent 82%);
}

.login-shell {
  width: min(1120px, 100%);
  grid-template-columns: minmax(0, 1fr) minmax(390px, .72fr);
  gap: 28px;
  align-items: stretch;
}

.login-brand {
  min-height: 560px;
  padding: 46px;
  border: 1px solid #dbe4ec;
  border-radius: 18px;
  background:
    linear-gradient(145deg, rgba(255,255,255,.96), rgba(239,246,248,.94)),
    linear-gradient(135deg, rgba(14,116,144,.12), transparent);
  box-shadow: 0 28px 80px rgba(17, 24, 39, .12);
  color: #111827;
}

.login-brand img {
  width: min(340px, 100%);
  margin-bottom: 40px;
  padding: 18px;
  border: 1px solid #dbe4ec;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 18px 44px rgba(17, 24, 39, .10);
}

.login-brand h1 {
  color: #111827;
  font-size: 54px;
  line-height: 1;
}

.login-brand p {
  max-width: 560px;
  color: #475569;
  font-size: 18px;
}

.login-brand::after {
  content: "Seguridad - Auditoria - Documentos - Multi despacho";
  margin-top: 34px;
  color: #155e75;
  background: #e6f3f6;
  border: 1px solid #b7d9e2;
}

.login-card {
  align-self: center;
  padding: 38px;
  border: 1px solid #dbe4ec;
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 30px 80px rgba(17, 24, 39, .16);
}

.login-card::before {
  left: 38px;
  right: 38px;
  background: linear-gradient(90deg, #0e7490, #1f2937);
}

.login-card h2 {
  color: #111827;
  font-size: 30px;
}

.login-card .muted,
.login-card .field label,
.login-note {
  color: #475569;
}

.login-card input {
  min-height: 50px;
  color: #111827;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
}

.login-card input:focus {
  outline: 4px solid rgba(14,116,144,.16);
  border-color: #0e7490;
  background: #ffffff;
}

.login-lock {
  width: fit-content;
  background: #e6f3f6;
  color: #155e75;
  border: 1px solid #b7d9e2;
}

.theme-dark header {
  background: #1f2937;
  border-bottom-color: #0e7490;
}

.theme-dark header::before {
  background: #0e7490;
}

/* Minimal premium login */
body.login {
  background:
    radial-gradient(circle at 50% -10%, rgba(14, 116, 144, .18) 0 260px, transparent 520px),
    linear-gradient(145deg, #f8fafc 0%, #edf4f7 52%, #ffffff 100%);
}

.login-shell {
  width: min(520px, 100%);
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

.login-brand {
  min-height: auto;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  align-items: center;
  text-align: center;
}

.login-brand img {
  width: min(300px, 82%);
  margin: 0 auto 18px;
  padding: 18px 22px;
  border-radius: 18px;
}

.login-brand h1 {
  margin: 0;
  font-size: 38px;
}

.login-brand p,
.login-brand::after {
  display: none;
}

.login-card {
  padding: 34px;
  border-radius: 20px;
  box-shadow: 0 30px 90px rgba(17, 24, 39, .18);
}

.login-card h2 {
  text-align: center;
  margin-bottom: 22px;
}

.login-lock {
  margin: 0 auto 14px;
}
