    :root {
      --bg: #f5f7fb;
      --bg-accent: rgba(36, 86, 214, 0.08);
      --surface: #ffffff;
      --surface-2: #f7f9fd;
      --surface-3: #eef3fb;
      --surface-4: #e7eefb;
      --text: #17254a;
      --muted: #6c7892;
      --border: #dbe4f1;
      --blue: #0d4fd7;
      --blue-2: #215fe0;
      --blue-3: #093eaf;
      --blue-soft: #edf3ff;
      --danger: #dc2626;
      --warning: #facc15;
      --sidebar-bg: rgba(10, 17, 29, 0.94);
      --sidebar-text: #edf3ff;
      --sidebar-hover-bg: rgba(255, 255, 255, 0.12);
      --sidebar-hover-text: #edf3ff;
      --input-bg: #ffffff;
      --shadow: 0 18px 40px rgba(19, 34, 68, 0.08);
      --shadow-soft: 0 8px 22px rgba(19, 34, 68, 0.06);
      --radius: 10px;
    }

    html[data-theme="dark"] {
      --bg: #0a111d;
      --bg-accent: rgba(34, 98, 255, 0.12);
      --surface: #0e1724;
      --surface-2: #111c2a;
      --surface-3: #152235;
      --surface-4: #18283f;
      --text: #edf3ff;
      --muted: #94a4be;
      --border: #24364c;
      --blue: #1f63f1;
      --blue-2: #2d79ff;
      --blue-3: #4f92ff;
      --blue-soft: #122440;
      --danger: #ff6b78;
      --warning: #facc15;
      --sidebar-bg: rgba(255, 255, 255, 0.95);
      --sidebar-text: #16264d;
      --sidebar-hover-bg: #eef3fb;
      --sidebar-hover-text: #16264d;
      --input-bg: #0d1827;
      --shadow: 0 24px 54px rgba(0, 0, 0, 0.35);
      --shadow-soft: 0 16px 34px rgba(0, 0, 0, 0.24);
    }

    * { box-sizing: border-box; }

    body {
      margin: 0;
      min-height: 100vh;
      background:
        radial-gradient(circle at top right, var(--bg-accent), transparent 28%),
        radial-gradient(circle at bottom left, rgba(19, 86, 232, 0.05), transparent 30%),
        var(--bg);
      color: var(--text);
      font-family: "Segoe UI", Arial, sans-serif;
      display: flex;
      overflow-x: hidden;
    }

    .sidebar {
      width: 250px;
      min-height: 100vh;
      background: var(--sidebar-bg);
      border-right: 1px solid var(--border);
      position: fixed;
      left: 0;
      top: 0;
      bottom: 0;
      display: flex;
      flex-direction: column;
      z-index: 30;
      backdrop-filter: blur(16px);
      box-shadow: var(--shadow-soft);
      transition: transform .26s cubic-bezier(.22,.61,.36,1), width .18s ease;
    }

    .sidebar-backdrop {
      display: block;
      position: fixed;
      inset: 0;
      z-index: 25;
      border: 0;
      margin: 0;
      padding: 0;
      background: rgba(7, 14, 27, 0.42);
      opacity: 0;
      pointer-events: none;
      transition: opacity .2s ease;
      cursor: pointer;
    }

    .logo-area {
      min-height: 88px;
      display: flex;
      align-items: center;
      justify-content: center;
      border-bottom: 1px solid var(--border);
      padding: 14px 16px;
      position: relative;
    }

    .sidebar-hamburger {
      position: absolute;
      top: 50%;
      right: -12px;
      transform: translateY(-50%);
      width: 22px !important;
      height: 26px !important;
      min-width: 22px;
      min-height: 26px;
      padding: 0 !important;
      border-radius: 999px;
      border: 1px solid var(--border);
      background: linear-gradient(180deg, #ffffff 0%, #f3f7ff 100%);
      box-shadow: 0 2px 10px rgba(15, 23, 42, 0.18);
      color: #243b72;
      font-size: 12px;
      font-weight: 800;
      display: grid;
      place-items: center;
      line-height: 1;
      z-index: 35;
    }

    .sidebar-hamburger span {
      display: block;
      line-height: 1;
      transform: translateY(-1px);
    }

    .sidebar-hamburger:hover {
      background: #f8fbff;
      color: #1e3a5f;
      transform: translateY(-50%) scale(1.05);
    }

    body.sidebar-collapsed .sidebar-hamburger {
      right: -12px;
    }

    .topbar-mobile-hamburger {
      display: none;
    }

    .logo-wordmark {
      display: flex;
      align-items: center;
      text-decoration: none;
      color: var(--sidebar-text);
      gap: 0;
      max-width: 100%;
      width: 100%;
      justify-content: center;
      padding-right: 10px;
    }

    .logo-wordmark:hover {
      color: var(--blue);
    }

    .logo-badge {
      width: 48px;
      height: 48px;
      border-radius: 14px;
      display: grid;
      place-items: center;
      color: #ffffff;
      font-size: 26px;
      font-weight: 900;
      background: linear-gradient(135deg, #bcc4d6 0%, #8d98af 36%, var(--blue) 36%, var(--blue-2) 100%);
      box-shadow: 0 10px 22px rgba(13, 79, 215, 0.22);
      flex-shrink: 0;
    }

    .brand-image {
      width: auto;
      height: 52px;
      max-width: 210px;
      object-fit: contain;
      display: block;
      flex-shrink: 0;
    }

    .logo-wordmark-copy,
    .auth-brand-copy {
      display: grid;
      gap: 4px;
    }

    .logo-wordmark-title {
      font-size: 1.16rem;
      font-weight: 900;
      letter-spacing: 0;
      line-height: 1.15;
      color: var(--sidebar-text);
    }

    .logo-wordmark-sub {
      font-size: 10px;
      font-weight: 800;
      color: var(--muted);
      letter-spacing: 0.02em;
      text-transform: uppercase;
    }

    .nav {
      padding: 16px 10px 12px;
      display: flex;
      flex-direction: column;
      gap: 4px;
      flex: 1;
    }

    .nav a {
      display: flex;
      align-items: center;
      gap: 10px;
      min-height: 0;
      padding: 10px 12px;
      border-radius: 8px;
      color: var(--sidebar-text);
      text-decoration: none;
      font-size: 14px;
      font-weight: 700;
      line-height: 1.25;
      transition: background-color .18s ease, color .18s ease, box-shadow .18s ease, transform .18s ease;
    }

    .nav a.active {
      background: linear-gradient(135deg, var(--blue), var(--blue-2));
      color: #ffffff;
      box-shadow: 0 12px 24px rgba(13, 79, 215, 0.24);
    }

    .nav a:hover:not(.active) {
      background: var(--sidebar-hover-bg);
      color: var(--sidebar-hover-text);
      transform: translateX(1px);
    }

    .nav-icon {
      width: 18px;
      flex-shrink: 0;
      text-align: center;
      opacity: .9;
      font-size: 15px;
      line-height: 1;
    }

    .collapse {
      border: 0;
      background: transparent;
      width: 100%;
      padding: 14px 18px 18px;
      color: var(--blue);
      font-size: 12px;
      font-weight: 800;
      display: flex;
      align-items: center;
      gap: 8px;
      text-align: left;
      cursor: pointer;
      display: none;
    }

    .main {
      margin-left: 250px;
      width: calc(100% - 250px);
      min-height: 100vh;
    }

    body.sidebar-collapsed .sidebar {
      width: 88px;
    }

    body.sidebar-collapsed .main:not(.main--no-sidebar) {
      margin-left: 88px;
      width: calc(100% - 88px);
    }

    body.sidebar-collapsed .nav a {
      justify-content: center;
      padding: 9px 8px;
    }

    body.sidebar-collapsed .nav a span.label,
    body.sidebar-collapsed .collapse span:last-child {
      display: none;
    }

    body.sidebar-collapsed .logo-wordmark-copy,
    body.sidebar-collapsed .auth-brand-sub,
    body.sidebar-collapsed .logo-wordmark-sub {
      display: none;
    }

    body.sidebar-collapsed .brand-image {
      height: 42px;
      max-width: 42px;
    }

    body.sidebar-collapsed .logo-area {
      min-height: 58px;
      padding: 10px 8px 10px 10px;
    }

    body.sidebar-collapsed .logo-wordmark {
      justify-content: center;
      padding-right: 10px;
    }

    .main.main--no-sidebar {
      margin-left: 0;
      width: 100%;
      max-width: 100%;
    }

    body.app-guest .topbar .hamburger {
      display: none;
    }

    .topbar {
      height: 72px;
      background: rgba(255, 255, 255, 0.66);
      border-bottom: 1px solid var(--border);
      display: flex;
      align-items: center;
      padding: 0 24px;
      gap: 18px;
      position: sticky;
      top: 0;
      z-index: 20;
      backdrop-filter: blur(16px);
    }

    html[data-theme="dark"] .topbar {
      background: rgba(10, 17, 29, 0.72);
    }

    .topbar-left,
    .topbar-tools {
      display: flex;
      align-items: center;
      gap: 12px;
    }

    .hamburger {
      width: 40px;
      height: 40px;
      border: 1px solid var(--border);
      border-radius: 8px;
      background: var(--surface);
      font-size: 22px;
      color: var(--text);
      font-weight: 900;
      cursor: pointer;
      transition: background-color .18s ease, border-color .18s ease, box-shadow .18s ease, transform .18s ease;
    }

    .hamburger:hover {
      background: var(--surface-2);
      box-shadow: var(--shadow-soft);
    }

    .top-title {
      font-size: 18px;
      font-weight: 900;
      letter-spacing: 0;
    }

    .spacer { flex: 1; }

    .top-actions {
      display: flex;
      align-items: center;
      gap: 16px;
      color: var(--text);
    }

    .icon-btn {
      width: 38px;
      height: 38px;
      border: 0;
      background: transparent;
      color: var(--blue);
      border-radius: 999px;
      display: grid;
      place-items: center;
      cursor: pointer;
      font-size: 20px;
      position: relative;
      transition: background-color .18s ease, color .18s ease, box-shadow .18s ease;
    }

    .icon-btn:hover {
      background: var(--surface-3);
    }

    .theme-btn.active {
      background: var(--blue-soft);
      color: var(--blue);
      box-shadow: inset 0 0 0 1px rgba(13, 79, 215, 0.12);
    }

    .notif {
      position: absolute;
      top: 2px;
      right: 2px;
      background: var(--blue);
      color: white;
      border-radius: 50%;
      min-width: 18px;
      height: 18px;
      font-size: 10px;
      display: grid;
      place-items: center;
      font-weight: 900;
    }

    .user-box {
      display: flex;
      align-items: center;
      gap: 10px;
      padding-left: 16px;
      border-left: 1px solid var(--border);
    }

    .avatar {
      width: 42px;
      height: 42px;
      border-radius: 50%;
      background: linear-gradient(135deg, #e2e8f0, #c5d0e4);
      display: grid;
      place-items: center;
      color: #243b72;
      font-weight: 900;
    }

    html[data-theme="dark"] .avatar {
      background: linear-gradient(135deg, #26364d, #31486e);
      color: #f3f7ff;
    }

    .user-box strong {
      display: block;
      font-size: 13px;
    }

    .user-box small {
      display: block;
      color: var(--muted);
      font-size: 11px;
      margin-top: 2px;
      font-weight: 700;
    }

    .page {
      padding: 18px 18px 24px;
    }

    .breadcrumb {
      text-align: right;
      color: var(--muted);
      font-size: 12px;
      font-weight: 750;
      margin-bottom: 10px;
    }

    .card {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      box-shadow: var(--shadow);
    }

    .steps {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      padding: 18px 20px;
      margin-bottom: 12px;
    }

    .step {
      display: flex;
      align-items: center;
      gap: 14px;
      position: relative;
    }

    .step:not(:last-child)::after {
      content: "";
      position: absolute;
      left: 52px;
      right: 22px;
      top: 50%;
      height: 1px;
      background: var(--border);
      transform: translateY(-50%);
      z-index: 0;
    }

    .step-circle {
      width: 40px;
      height: 40px;
      border-radius: 50%;
      background: #b9c1d0;
      color: #fff;
      display: grid;
      place-items: center;
      font-size: 20px;
      font-weight: 950;
      z-index: 1;
      flex: 0 0 auto;
    }

    .step.active .step-circle {
      background: linear-gradient(135deg, var(--blue), var(--blue-2));
      box-shadow: 0 0 0 4px rgba(13, 79, 215, 0.14);
    }

    .step-text {
      z-index: 1;
      background: transparent;
      padding-right: 8px;
    }

    .step-text strong {
      display: block;
      font-size: 13px;
      color: var(--text);
    }

    .step-text span {
      display: block;
      color: var(--muted);
      font-size: 12px;
      font-weight: 700;
      margin-top: 2px;
    }

    .selection {
      padding: 14px 16px;
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
      gap: 16px;
      align-items: start;
      margin-bottom: 12px;
    }

    .selection--calculo {
      grid-template-columns: repeat(5, minmax(200px, 1fr));
    }

    .selection--calculo .field--cbhpm {
      grid-column: span 1;
    }

    .selection--calculo .field--procedimento {
      grid-column: span 1;
    }

    .selection--calculo .field--acoes {
      grid-column: span 1;
      align-self: end;
      min-width: 190px;
    }

    .selection--calculo .field--procedimento .searchable-panel {
      right: auto;
      width: min(720px, calc(100vw - 72px));
      min-width: min(460px, calc(100vw - 72px));
    }

    .field label {
      display: flex;
      align-items: center;
      gap: 5px;
      color: var(--text);
      font-size: 11px;
      font-weight: 800;
      margin-bottom: 5px;
    }

    .required::before {
      content: "*";
      color: var(--danger);
      font-weight: 950;
    }

    .input, .select {
      width: 100%;
      height: 38px;
      border: 1px solid var(--border);
      background: var(--input-bg);
      color: var(--text);
      border-radius: 8px;
      padding: 0 10px;
      font-weight: 650;
      font-size: 12px;
      outline: none;
    }

    .searchable-select {
      position: relative;
    }

    .searchable-select .select {
      display: none;
    }

    .searchable-trigger {
      width: 100%;
      min-height: 38px;
      border: 1px solid var(--border);
      background: var(--input-bg);
      color: var(--text);
      border-radius: 8px;
      padding: 0 10px;
      font-weight: 650;
      font-size: 12px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      cursor: pointer;
      transition: border-color .18s ease, box-shadow .18s ease, background-color .18s ease;
    }

    .searchable-trigger:hover {
      background: var(--surface-2);
    }

    .searchable-trigger:focus-visible,
    .searchable-select.open .searchable-trigger {
      border-color: var(--blue);
      box-shadow: 0 0 0 3px rgba(13,79,215,.12);
    }

    .searchable-trigger.disabled {
      opacity: .65;
      cursor: not-allowed;
      background: var(--surface-2);
    }

    .searchable-trigger-label {
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      text-align: left;
      flex: 1;
    }

    .searchable-trigger-icon {
      color: var(--muted);
      flex-shrink: 0;
      font-size: 11px;
    }

    .searchable-panel {
      position: absolute;
      left: 0;
      right: 0;
      top: calc(100% + 6px);
      z-index: 40;
      display: none;
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 10px;
      box-shadow: var(--shadow);
      padding: 8px;
    }

    .searchable-select.open .searchable-panel {
      display: block;
    }

    .searchable-panel input {
      margin-bottom: 6px;
      font-size: 12px;
    }

    .searchable-options {
      max-height: 220px;
      overflow-y: auto;
      display: grid;
      gap: 2px;
    }

    .searchable-option {
      width: 100%;
      border: 0;
      background: transparent;
      color: var(--text);
      text-align: left;
      padding: 7px 8px;
      border-radius: 8px;
      cursor: pointer;
      font: inherit;
      font-size: 11px;
      line-height: 1.3;
    }

    .searchable-option:hover,
    .searchable-option.active {
      background: var(--surface-3);
    }

    .searchable-option.is-selected {
      background: var(--blue-soft);
      color: var(--blue);
      font-weight: 800;
    }

    .searchable-empty {
      color: var(--muted);
      font-size: 11px;
      font-weight: 700;
      padding: 8px;
      text-align: center;
    }

    .input:focus, .select:focus {
      border-color: var(--blue);
      box-shadow: 0 0 0 3px rgba(13,79,215,.12);
    }

    .input.blue {
      color: var(--blue);
      border-color: var(--blue);
      font-weight: 900;
    }

    .input.disabled {
      background: var(--surface-2);
      color: var(--muted);
    }

    .link-action {
      color: var(--blue);
      font-size: 11px;
      font-weight: 800;
      margin-top: 6px;
      display: inline-block;
      text-decoration: none;
    }

    .link-button {
      border: 0;
      background: transparent;
      padding: 0;
      cursor: pointer;
      text-align: left;
      font-family: inherit;
    }

    .btn {
      height: 44px;
      border: 1px solid var(--blue);
      background: transparent;
      color: var(--blue);
      border-radius: 8px;
      font-weight: 900;
      padding: 0 18px;
      cursor: pointer;
      transition: background-color .18s ease, color .18s ease, box-shadow .18s ease, border-color .18s ease;
    }

    .btn.primary {
      background: linear-gradient(135deg, var(--blue), var(--blue-2));
      color: #fff;
      box-shadow: 0 12px 24px rgba(13, 79, 215, 0.18);
    }

    .btn.small {
      height: 36px;
      padding: 0 12px;
      font-size: 12px;
    }

    .btn.ghost {
      border-color: var(--border);
      color: var(--text);
      background: var(--surface);
    }

    .btn:hover {
      box-shadow: var(--shadow-soft);
    }

    .btn-clear-top {
      min-width: 168px;
      height: 38px;
      padding: 0 14px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      white-space: nowrap;
      font-size: 13px;
      font-weight: 800;
      letter-spacing: .2px;
      box-shadow: 0 12px 24px rgba(13, 79, 215, 0.24);
      transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
    }

    .btn-clear-top:hover {
      transform: translateY(-1px);
      filter: brightness(1.04);
      box-shadow: 0 16px 30px rgba(13, 79, 215, 0.3);
    }

    .button-note {
      color: var(--muted);
      font-size: 10px;
      font-weight: 700;
      margin-top: 6px;
      line-height: 1.35;
    }

    .procedures {
      padding: 16px;
      margin-bottom: 12px;
    }

    .section-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 12px;
    }

    .section-head h2 {
      margin: 0;
      font-size: 15px;
      color: var(--blue);
    }

    .table-wrap {
      overflow-x: auto;
      border: 1px solid var(--border);
      border-radius: 8px;
      background: var(--surface);
    }

    table {
      width: 100%;
      border-collapse: collapse;
    }

    .simple-table {
      min-width: 1000px;
    }

    th {
      background: var(--surface-2);
      color: var(--text);
      font-size: 12px;
      padding: 13px 12px;
      text-align: left;
      border-bottom: 1px solid var(--border);
      white-space: nowrap;
    }

    td {
      padding: 12px;
      border-bottom: 1px solid var(--border);
      font-size: 12px;
      font-weight: 750;
      vertical-align: middle;
    }

    tr:last-child td {
      border-bottom: 0;
    }

    .row-num {
      width: 26px;
      height: 26px;
      border-radius: 50%;
      background: var(--blue);
      color: #fff;
      display: grid;
      place-items: center;
      font-size: 12px;
      font-weight: 900;
    }

    .proc-code {
      font-weight: 950;
    }

    .proc-desc {
      color: var(--text);
      margin-top: 2px;
    }

    .blue-text {
      color: var(--blue);
      font-weight: 950;
    }

    .action-cell {
      display: flex;
      gap: 10px;
      align-items: center;
    }

    .more {
      width: 34px;
      height: 34px;
      border: 1px solid var(--border);
      background: var(--surface);
      border-radius: 6px;
      cursor: pointer;
      font-size: 18px;
      color: var(--text);
    }

    .procedure-form {
      margin-top: 16px;
      border: 1px solid var(--border);
      border-radius: 10px;
      overflow: hidden;
    }

    .procedure-form-head {
      background: linear-gradient(135deg, var(--blue-3), var(--blue));
      color: #fff;
      padding: 11px 16px;
      display: flex;
      justify-content: space-between;
      gap: 12px;
      align-items: center;
      font-weight: 900;
    }

    .form-body {
      padding: 12px;
      display: grid;
      grid-template-columns: 1.2fr 1.5fr .85fr;
      gap: 10px;
    }

    .form-box {
      border: 1px solid var(--border);
      border-radius: 8px;
      padding: 14px;
      background: linear-gradient(180deg, var(--surface), var(--surface-2));
    }

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

    .form-box h3 {
      margin: 0 0 14px;
      color: var(--blue);
      text-transform: uppercase;
      font-size: 12px;
    }

    .inline-grid {
      display: grid;
      grid-template-columns: repeat(5, 1fr);
      gap: 10px;
    }

    .inline-grid.uco {
      grid-template-columns: .8fr 1.3fr 1fr .8fr .8fr;
    }

    .inline-grid.filme {
      grid-template-columns: 1fr 1.2fr .8fr .8fr 1fr;
    }

    .field.compact label {
      font-size: 11px;
      color: var(--muted);
      min-height: 26px;
      align-items: flex-end;
    }

    .field.compact .input,
    .field.compact .select {
      height: 40px;
      font-size: 12px;
    }

    .config-grid {
      display: grid;
      gap: 12px;
    }

    .check-row {
      display: flex;
      align-items: center;
      gap: 18px;
      color: var(--text);
      font-size: 12px;
      font-weight: 750;
    }

    .check-row input {
      accent-color: var(--blue);
    }

    .total-proc {
      background: var(--blue-soft);
      border: 1px solid var(--border);
      border-radius: 8px;
      padding: 14px;
      color: var(--blue);
      font-weight: 950;
    }

    .total-proc strong {
      display: block;
      font-size: 25px;
      margin-top: 4px;
    }

    .form-actions {
      padding: 0 14px 14px;
      display: flex;
      justify-content: flex-end;
    }

    .summary {
      padding: 18px;
    }

    .summary-table {
      min-width: 1480px;
    }

    .summary-table th {
      background: linear-gradient(180deg, var(--blue), var(--blue-3));
      color: #fff;
      text-align: center;
      border-right: 1px solid rgba(255,255,255,.16);
      padding: 10px 8px;
      font-size: 11px;
    }

    .summary-table th.calc {
      background: linear-gradient(180deg, var(--blue-2), var(--blue));
      color: #fff;
      font-weight: 950;
    }

    .summary-table td {
      text-align: center;
      border-right: 1px solid var(--border);
      white-space: nowrap;
    }

    .total-general {
      display: flex;
      justify-content: flex-end;
      align-items: center;
      gap: 22px;
      margin-top: 14px;
      font-weight: 950;
      color: var(--blue);
    }

    .total-value {
      background: var(--blue-soft);
      padding: 14px 28px;
      border-radius: 8px;
      font-size: 26px;
      min-width: 220px;
      text-align: center;
      border: 1px solid var(--border);
    }

    .memory {
      display: none;
      margin-top: 14px;
      border: 1px solid var(--border);
      border-radius: 10px;
      overflow: hidden;
    }

    .memory.open {
      display: block;
    }

    .memory-head {
      background: var(--surface-2);
      padding: 14px;
      font-weight: 950;
      color: var(--blue);
      border-bottom: 1px solid var(--border);
    }

    .memory-body {
      padding: 14px;
      display: grid;
      gap: 10px;
    }

    .memory-line {
      display: grid;
      grid-template-columns: 260px 1fr;
      gap: 12px;
      border: 1px solid var(--border);
      padding: 10px;
      border-radius: 8px;
      background: var(--surface);
      font-size: 13px;
    }

    .memory-line span {
      color: var(--muted);
      font-weight: 850;
    }

    .quick-drawer {
      position: fixed;
      inset: 0;
      display: none;
      z-index: 80;
    }

    .quick-drawer.open {
      display: block;
    }

    .quick-drawer-backdrop {
      position: absolute;
      inset: 0;
      background: rgba(15, 23, 42, .42);
    }

    .quick-drawer-panel {
      position: absolute;
      top: 0;
      right: 0;
      width: min(560px, 100vw);
      height: 100%;
      overflow-y: auto;
      background: var(--surface);
      border-left: 1px solid var(--border);
      box-shadow: -18px 0 44px rgba(15, 23, 42, .22);
      padding: 20px;
    }

    .quick-drawer-head {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 16px;
      margin-bottom: 16px;
    }

    .quick-drawer-head h2 {
      margin: 0;
      color: var(--blue);
      font-size: 18px;
    }

    .quick-drawer-head p {
      margin: 6px 0 0;
      color: var(--muted);
      font-size: 12px;
      font-weight: 700;
    }

    .quick-form {
      display: none;
      gap: 14px;
    }

    .quick-form.active {
      display: grid;
    }

    .quick-grid-2,
    .quick-component-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 12px;
    }

    .quick-component-grid {
      grid-template-columns: repeat(3, 1fr);
    }

    .quick-component-grid .field {
      display: grid;
      gap: 8px;
    }

    .quick-error {
      margin: 0 0 14px;
      padding: 10px 12px;
      border: 1px solid rgba(220,38,38,.35);
      border-radius: 8px;
      color: var(--danger);
      background: rgba(220,38,38,.08);
      font-size: 13px;
      font-weight: 750;
    }

    .quick-drawer-actions {
      display: flex;
      justify-content: flex-end;
      gap: 10px;
      margin-top: 18px;
      padding-top: 14px;
      border-top: 1px solid var(--border);
    }

    .cb-grid-2,
    .cb-grid-3 {
      display: grid;
      gap: 16px;
    }

    .cb-grid-2 {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .cb-grid-3 {
      grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .cb-card-block {
      padding: 18px;
      border-radius: 8px;
      border: 1px solid var(--border);
      background: var(--surface);
    }

    .cb-card-block h3 {
      margin: 0 0 6px;
      color: var(--text);
      font-size: 16px;
    }

    .cb-card-block p {
      margin: 0;
      color: var(--muted);
      line-height: 1.5;
      font-size: 13px;
    }

    .cb-badge-line {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      margin-top: 10px;
    }

    .cb-badge {
      display: inline-flex;
      align-items: center;
      min-height: 30px;
      padding: 0 10px;
      border-radius: 999px;
      background: var(--surface-3);
      border: 1px solid var(--border);
      color: var(--text);
      font-size: 12px;
      font-weight: 700;
    }

    .cb-actions-inline {
      display: flex;
      align-items: center;
      gap: 10px;
      flex-wrap: wrap;
      margin-top: 12px;
    }

    .cb-list-copy {
      display: grid;
      gap: 8px;
    }

    .cb-filters-bar {
      display: grid;
      grid-template-columns: minmax(180px, .9fr) minmax(0, 2fr) minmax(220px, 1fr) auto;
      gap: 14px;
      align-items: end;
    }

    .filter-drill {
      display: grid;
      gap: 12px;
    }

    .filter-drill-item {
      border: 1px solid var(--border);
      border-radius: 10px;
      overflow: hidden;
      background: var(--surface);
    }

    .filter-drill-header {
      width: 100%;
      min-height: 52px;
      border: 0;
      background: var(--surface-2);
      color: var(--text);
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0 16px;
      font: inherit;
      font-weight: 800;
      cursor: pointer;
    }

    .filter-drill-label {
      text-align: left;
    }

    .filter-drill-icon {
      color: var(--blue);
      font-size: 20px;
      line-height: 1;
    }

    .filter-drill-body {
      padding: 16px;
    }

    .cb-doc-card {
      display: grid;
      gap: 10px;
      align-content: start;
    }

    .cb-doc-cover {
      width: 100%;
      max-height: 180px;
      object-fit: contain;
      border-radius: 8px;
      border: 1px solid var(--border);
      background: var(--surface-2);
    }

    @media (max-width: 1180px) {
      .selection,
      .steps,
      .form-body {
        grid-template-columns: 1fr 1fr;
      }

      .selection--calculo .field--cbhpm,
      .selection--calculo .field--procedimento,
      .selection--calculo .field--acoes {
        grid-column: auto;
      }

      .selection--calculo .field--procedimento .searchable-panel {
        right: 0;
        width: auto;
        min-width: 0;
      }

      .cb-grid-3 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
      }

      .form-box:last-child {
        grid-column: 1 / -1;
      }
    }

    @media (max-width: 860px) {
      body.mobile-sidebar-open {
        overflow: hidden;
      }

      .sidebar {
        width: 250px;
        transform: translateX(-100%);
      }

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

      body.mobile-sidebar-open .sidebar-backdrop {
        opacity: 1;
        pointer-events: auto;
      }

      .logo-area {
        min-height: 74px;
        padding: 12px 12px 10px;
      }

      .sidebar-hamburger {
        display: none;
      }

      .topbar-mobile-hamburger {
        display: inline-grid;
        place-items: center;
      }

      .brand-image {
        height: 46px;
        max-width: 180px;
      }

      .nav {
        padding: 10px 8px 10px;
        gap: 2px;
      }

      .nav a {
        padding: 10px 10px;
        justify-content: flex-start;
      }

      .collapse {
        display: none;
      }

      .main:not(.main--no-sidebar) {
        margin-left: 0;
        width: 100%;
      }

      .selection,
      .steps,
      .form-body,
      .inline-grid,
      .inline-grid.uco,
      .inline-grid.filme,
      .cb-grid-2,
      .cb-grid-3,
      .cb-filters-bar,
      .quick-grid-2,
      .quick-component-grid {
        grid-template-columns: 1fr;
      }

      .top-title {
        font-size: 15px;
        line-height: 1.2;
      }

      .user-box small,
      .user-box strong {
        display: none;
      }

      .topbar {
        padding: 0 12px;
        gap: 8px;
      }

      .topbar-left {
        min-width: 0;
      }

      .top-title {
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
      }

      .hamburger {
        width: 38px;
        height: 38px;
        font-size: 20px;
        flex-shrink: 0;
      }
    }

    .flash-messages {
      padding: 12px 18px 0 !important;
    }

    .flash-messages p {
      margin: 0 0 8px !important;
      padding: 10px 14px !important;
      border-radius: 8px !important;
      background: var(--surface) !important;
      border: 1px solid var(--border) !important;
      box-shadow: var(--shadow-soft);
    }

/* Django: bloco de regras fechado até «Criar Regras» */
#procedureForm {
  display: none;
}

/* Login / importação — campos alinhados ao tema */
.page-narrow {
  max-width: 520px;
  margin: 0 auto;
}

.cb-form-stack .field {
  margin-top: 14px;
}

.cb-form-stack label {
  display: block;
  font-size: 12px;
  font-weight: 850;
  margin-bottom: 7px;
  color: var(--text);
}

.cb-form-stack input[type="text"],
.cb-form-stack input[type="email"],
.cb-form-stack input[type="password"],
.cb-form-stack input[type="number"],
.cb-form-stack input[type="file"],
.cb-form-stack select,
.cb-form-stack textarea {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  min-height: 44px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  border-radius: 6px;
  padding: 0 12px;
  font-weight: 750;
}

.cb-form-stack textarea {
  min-height: 88px;
  padding: 10px 12px;
}

.cb-form-stack .erro-form {
  color: var(--danger);
  font-size: 13px;
  margin-top: 6px;
  font-weight: 700;
}

/* ——— Layout só autenticação (sem sidebar do app) ——— */
/* `body` global usa `display: flex` em linha; aqui forçamos coluna + largura total para não “colapsar” à esquerda */
body.auth-body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  max-width: 100vw;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 86% 8%, rgba(37, 99, 235, 0.10), transparent 28%),
    radial-gradient(circle at 8% 88%, rgba(19, 86, 232, 0.07), transparent 34%),
    linear-gradient(180deg, rgba(7, 14, 27, 0.30), rgba(7, 14, 27, 0.08)),
    var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Arial, sans-serif;
}

html[data-theme="dark"] body.auth-body {
  background:
    radial-gradient(circle at 86% 8%, rgba(28, 92, 245, 0.12), transparent 30%),
    radial-gradient(circle at 8% 88%, rgba(28, 92, 245, 0.08), transparent 36%),
    linear-gradient(180deg, rgba(4, 8, 16, 0.68), rgba(4, 8, 16, 0.36)),
    var(--bg);
}

.auth-layout {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
}

.auth-header {
  flex-shrink: 0;
  width: 100%;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  padding: 12px 20px;
  background: rgba(255, 255, 255, 0.72);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(16px);
}

html[data-theme="dark"] .auth-header {
  background: rgba(10, 17, 29, 0.76);
}

.auth-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text);
  font-weight: 800;
}

.auth-login-brand {
  display: grid;
  justify-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.auth-login-logo {
  height: 96px;
  width: auto;
  max-width: 360px;
  object-fit: contain;
}

html[data-theme="dark"] .auth-login-logo {
  filter: brightness(1.08) contrast(1.16) saturate(1.08)
    drop-shadow(0 0 14px rgba(56, 139, 253, 0.28));
}

html[data-theme="dark"] .brand-image {
  filter: brightness(1.06) contrast(1.14) saturate(1.05)
    drop-shadow(0 0 12px rgba(56, 139, 253, 0.24));
}

html[data-theme="dark"] .sidebar .brand-image {
  filter: none;
}

html[data-theme="dark"] .auth-login-logo[data-using-dark="1"],
html[data-theme="dark"] .brand-image[data-using-dark="1"] {
  mix-blend-mode: normal;
  filter: brightness(1.9) contrast(1.38) saturate(1.25)
    drop-shadow(0 0 18px rgba(56, 139, 253, 0.34));
}

html[data-theme="dark"] .auth-login-brand {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0));
  border: 1px solid rgba(148, 164, 190, 0.18);
  border-radius: 12px;
  padding: 10px 12px 12px;
}

.auth-login-app-title {
  margin: 0;
  text-align: center;
  color: var(--blue);
  font-size: 16px;
  font-weight: 900;
  line-height: 1.3;
}

.auth-brand:hover {
  color: var(--blue);
}

.auth-brand-text {
  color: var(--text);
  font-weight: 900;
  font-size: 1.06rem;
}

.auth-brand-sub {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.auth-header-tools {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

.auth-flash {
  flex-shrink: 0;
  width: 100%;
  box-sizing: border-box;
  padding: 12px 20px 0;
  font-size: 13px;
}

.auth-flash-line {
  margin: 0 0 8px;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.auth-main {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  box-sizing: border-box;
  padding: 38px 20px 54px;
  min-height: 0;
}

.auth-card {
  width: 100%;
  max-width: 460px;
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
  padding: 30px 28px 32px;
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 22px 52px rgba(16, 32, 67, 0.14);
}

.auth-card-title {
  margin: 0 0 8px;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--blue);
  letter-spacing: -0.02em;
  text-align: center;
}

.auth-card-lead {
  margin: 0 0 14px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.45;
  text-align: center;
}

.auth-card-back {
  margin: 0 0 18px;
  font-size: 13px;
}

.auth-card-error {
  margin: 0 0 14px;
}

.auth-card-form .field:first-of-type {
  margin-top: 0;
}

.auth-card-submit {
  margin-top: 24px;
}

.auth-card .btn.primary {
  height: 46px;
  border-radius: 10px;
  box-shadow: 0 14px 28px rgba(13, 79, 215, 0.22);
}

@media (max-width: 640px) {
  .auth-header {
    padding: 10px 12px;
    min-height: 56px;
  }

  .auth-main {
    padding: 18px 12px 24px;
    justify-content: flex-start;
  }

  .auth-card {
    max-width: 100%;
    padding: 20px 16px 18px;
    border-radius: 12px;
    box-shadow: 0 14px 32px rgba(16, 32, 67, 0.12);
  }

  .auth-login-brand {
    gap: 6px;
    margin-bottom: 12px;
  }

  .auth-login-logo {
    height: 74px;
    max-width: 290px;
  }

  .auth-login-app-title {
    font-size: 14px;
    line-height: 1.25;
  }

  .auth-card-title {
    font-size: 1.15rem;
    margin-bottom: 6px;
  }

  .auth-card-lead {
    font-size: 12px;
    margin-bottom: 10px;
  }

  .auth-card-back {
    margin-bottom: 12px;
  }

  .auth-card .btn.primary {
    height: 44px;
    border-radius: 9px;
    box-shadow: 0 10px 20px rgba(13, 79, 215, 0.20);
  }
}

@media (min-width: 641px) and (max-width: 900px) {
  .auth-main {
    padding: 30px 18px 36px;
  }

  .auth-card {
    max-width: 520px;
    padding: 26px 22px 24px;
    border-radius: 13px;
  }

  .auth-login-logo {
    height: 86px;
    max-width: 330px;
  }

  .auth-login-app-title {
    font-size: 15px;
  }

  .auth-card-title {
    font-size: 1.25rem;
  }

  .auth-card-lead {
    font-size: 12px;
  }
}

/* ——— Página inicial / painel ——— */
.home-page .breadcrumb {
  margin-bottom: 14px;
}

.home-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr;
}

@media (min-width: 880px) {
  .home-grid {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
}

.home-card {
  padding: 22px 24px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.home-card-title {
  margin: 0 0 10px;
  font-size: 1.35rem;
  font-weight: 900;
  color: var(--blue);
  letter-spacing: -0.03em;
}

.home-card-text {
  margin: 0 0 14px;
  font-size: 14px;
  font-weight: 650;
  color: var(--muted);
  line-height: 1.5;
  max-width: 52ch;
}

.home-card-meta {
  margin: 0;
  font-size: 13px;
  color: var(--text);
}

.home-actions-heading {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 850;
  color: var(--text);
}

.home-actions-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.home-action-link {
  display: block;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 800;
  color: var(--blue);
  text-decoration: none;
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.home-action-link:hover {
  background: var(--blue-soft);
  border-color: var(--blue);
}

.home-card--guest .home-guest-cta {
  margin: 18px 0 16px;
}

.home-card-foot {
  margin: 0;
  font-size: 13px;
}

.home-card-foot-note {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  margin-left: 6px;
}

/* ——— Página de ajuda ——— */
.help-page {
  display: grid;
  gap: 14px;
}

.help-card {
  padding: 18px 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
}

.help-title {
  margin: 0 0 10px;
  color: var(--blue);
  font-size: 1.15rem;
  font-weight: 900;
}

.help-text {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

.help-list {
  margin: 0;
  padding-left: 18px;
  color: var(--text);
  display: grid;
  gap: 6px;
  font-size: 14px;
}

.help-grid {
  display: grid;
  gap: 12px;
}

.help-role {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  background: var(--surface-2);
}

.help-role h3 {
  margin: 0 0 6px;
  color: var(--blue);
}

.help-role p {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}
