
    :root {
      --navy: #0b2a4a;
      --navy-2: #113a63;
      --blue: #1877d2;
      --blue-soft: #e8f2ff;
      --ink: #152033;
      --muted: #607086;
      --line: #dce5ef;
      --bg: #f3f7fb;
      --card: #ffffff;
      --green: #18865b;
      --red: #c93333;
      --amber: #b46a00;
      --shadow: 0 18px 45px rgba(11, 42, 74, 0.12);
    }

    * { box-sizing: border-box; }

    body {
      margin: 0;
      min-height: 100vh;
      color: var(--ink);
      background: var(--bg);
      font-family: Arial, Helvetica, sans-serif;
      letter-spacing: 0;
    }

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

    button {
      cursor: pointer;
    }

    .app {
      min-height: 100vh;
      display: block;
    }

    body.locked .app {
      filter: blur(3px);
      pointer-events: none;
      user-select: none;
    }

    .license-screen {
      position: fixed;
      inset: 0;
      z-index: 100;
      display: none;
      align-items: center;
      justify-content: center;
      padding: 22px;
      background: rgba(6, 34, 61, 0.84);
    }

    body.locked .license-screen {
      display: flex;
    }

    .license-card {
      width: min(620px, 100%);
      background: #fff;
      border-radius: 8px;
      padding: 26px;
      box-shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
    }

    .license-card h2 {
      margin: 0 0 10px;
      color: var(--navy);
      font-size: 24px;
    }

    .license-card p {
      color: var(--muted);
      line-height: 1.5;
      margin: 0 0 16px;
    }

    .license-note {
      margin-top: 14px;
      padding: 12px;
      border-radius: 8px;
      background: var(--blue-soft);
      color: var(--navy);
      font-size: 14px;
      line-height: 1.45;
    }

    .sidebar {
      background: linear-gradient(135deg, #06223d 0%, #0a335a 62%, #0b2a4a 100%);
      color: #fff;
      padding: 12px 20px 14px;
      position: sticky;
      top: 0;
      z-index: 20;
      box-shadow: 0 16px 34px rgba(5, 24, 45, 0.2);
    }

    .brand {
      padding: 0;
      margin-bottom: 10px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 18px;
    }

    .brand img {
      width: 380px;
      max-width: 100%;
      display: block;
    }

    .brand-id { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; min-width: 0; }
    .brand .brand-name { padding-left: 22px; border-left: 1px solid rgba(255, 255, 255, 0.28); }
    .brand .brand-name strong { font-size: 30px; line-height: 1.1; letter-spacing: 0.2px; }
    .brand .brand-name strong b { color: #3fc6ff; font-weight: 800; }
    .brand .brand-name em { display: block; margin-top: 6px; font-style: normal; font-size: 14px; color: #dcecff; line-height: 1.35; max-width: 300px; }
    .brand .brand-name span { margin-top: 8px; font-size: 12px; }

    .client-logo-box {
      width: 200px;
      height: 64px;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 8px 12px;
      border: 1px solid rgba(255, 255, 255, 0.22);
      border-radius: 8px;
      background: rgba(255, 255, 255, 0.1);
    }

    .client-logo-box img {
      width: 100%;
      height: 100%;
      object-fit: contain;
    }

    .client-logo-empty {
      color: #b8d5f3;
      font-size: 12px;
      line-height: 1.25;
      text-align: center;
    }

    .brand strong {
      display: block;
      font-size: 16px;
      line-height: 1.25;
    }

    .brand span {
      display: block;
      margin-top: 6px;
      color: #b8d5f3;
      font-size: 13px;
      line-height: 1.4;
    }

    .license-badge {
      min-width: min(320px, 100%);
      text-align: center;
      padding: 9px 14px;
      border: 1px solid rgba(255, 255, 255, 0.22);
      border-radius: 8px;
      background: rgba(255, 255, 255, 0.1);
    }

    .license-badge span {
      margin: 0;
      color: #b8d5f3;
      font-size: 12px;
      font-weight: 700;
      text-transform: uppercase;
    }

    .license-badge strong {
      margin-top: 5px;
      color: #fff;
      font-size: 15px;
    }

    .trial-warning {
      margin: 0 0 18px;
      padding: 13px 15px;
      border: 1px solid #ffd28a;
      border-radius: 8px;
      background: #fff7e6;
      color: #704000;
      font-size: 14px;
      line-height: 1.45;
    }

    .trial-warning.hidden {
      display: none;
    }

    .edit-status {
      margin: 0 0 14px;
      padding: 10px 12px;
      border-radius: 8px;
      background: #f6f9fd;
      color: var(--muted);
      border: 1px solid var(--line);
      font-size: 14px;
    }

    .logo-preview {
      width: min(360px, 100%);
      aspect-ratio: 10 / 3;
      display: flex;
      align-items: center;
      justify-content: center;
      border: 1px dashed #b8cce1;
      border-radius: 8px;
      background: #f8fbff;
      overflow: hidden;
    }

    .logo-preview img {
      width: 100%;
      height: 100%;
      object-fit: contain;
      padding: 10px;
    }

    .document-modal {
      position: fixed;
      inset: 0;
      z-index: 80;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 22px;
      background: rgba(6, 34, 61, 0.72);
    }

    .document-modal.hidden {
      display: none !important;
    }

    .document-box {
      width: min(980px, 96vw);
      height: min(760px, 90vh);
      background: #fff;
      border-radius: 8px;
      border: 1px solid var(--line);
      box-shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
      display: grid;
      grid-template-rows: auto 1fr;
      overflow: hidden;
    }

    .document-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      padding: 12px 14px;
      border-bottom: 1px solid var(--line);
      background: #f6f9fd;
    }

    .document-head h2 {
      margin: 0;
      color: var(--navy);
      font-size: 16px;
    }

    .document-viewer {
      min-height: 0;
      background: #eef3f8;
    }

    .document-viewer iframe,
    .document-viewer img {
      width: 100%;
      height: 100%;
      border: 0;
      display: block;
    }

    .document-viewer img {
      object-fit: contain;
      padding: 12px;
    }

    .menu-heading {
      margin: 0 0 8px;
      color: #fff;
      font-size: 14px;
      font-weight: 800;
    }

    .dash-bar { display: flex; justify-content: flex-end; margin: 0 0 10px; }
    #dashboard.recolhido > :not(.dash-bar) { display: none; }
    .menu-head-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 8px; }
    .menu-head-row .menu-heading { margin: 0; }
    .hdr-toggle { border: 1px solid rgba(255, 255, 255, 0.35); background: rgba(255, 255, 255, 0.1); color: #fff; border-radius: 6px; font-size: 12px; font-weight: 700; padding: 4px 10px; cursor: pointer; }
    .hdr-toggle:hover { background: rgba(255, 255, 255, 0.2); }
    .sidebar.compacto .brand { display: none; }
    .sidebar.compacto { padding-top: 10px; }

    .module-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(150px, 214px));
      justify-content: start;
      gap: 10px;
      align-items: start;
    }

    .module {
      border-radius: 8px;
      overflow: hidden;
      background: var(--module-color);
      border: 2px solid var(--module-border, rgba(0, 0, 0, 0.35));
      box-shadow: 0 10px 22px rgba(0, 0, 0, 0.22);
    }

    .module-title {
      width: 100%;
      border: 0;
      color: #fff;
      background: transparent;
      display: flex;
      min-height: 58px;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      padding: 10px 12px;
      text-align: left;
      font-weight: 800;
      font-size: 14px;
      line-height: 1.25;
      letter-spacing: 0.3px;
      text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    }

    .module-title svg {
      width: 22px;
      height: 22px;
      flex: 0 0 auto;
      stroke: #fff;
    }

    .module-title::after {
      content: "Abrir";
      color: #fff;
      font-size: 11px;
      font-weight: 800;
      align-self: flex-end;
      margin-left: auto;
      margin-top: 0;
    }

    .module.open .module-title::after {
      content: "Fechar";
    }

    .module.receber { --module-color: #b8690f; --module-border: #7a420a; }
    .module.correntes { --module-color: #0c8587; --module-border: #07585a; }
    .module.pagar { --module-color: #b8433e; --module-border: #7e2622; }
    .module.relatorios { --module-color: #4a8f20; --module-border: #2e5f12; }
    .module.cadastro { --module-color: #0f6ea8; --module-border: #08486f; }
    .module.clinica { --module-color: #6c46b3; --module-border: #452a7d; }
    .orc-row { display: grid; grid-template-columns: 62px 190px minmax(160px, 1fr) 70px 110px 100px 34px; gap: 6px; align-items: center; margin-bottom: 6px; }
    .orc-row .orc-tipo { font-size: 12px; font-weight: 700; color: var(--muted, #5b6b80); }
    .orc-row .orc-tot { text-align: right; font-weight: 700; }
    @media (max-width: 900px) { .orc-row { grid-template-columns: 1fr 1fr; padding: 8px; border: 1px solid #d5dfeb; border-radius: 8px; } .orc-row .orc-tipo, .orc-row input[data-k="desc"], .orc-row select { grid-column: 1 / -1; } .orc-row .orc-tot { text-align: left; } }
    .module.nfse { --module-color: #a98200; --module-border: #6b5300; }

    .submenu {
      display: none;
      gap: 6px;
      padding: 8px;
      background: rgba(0, 0, 0, 0.16);
    }

    .module.open .submenu {
      display: flex;
      flex-wrap: wrap;
      max-height: 86px;
      overflow-y: auto;
    }

    .submenu button {
      border: 0;
      color: #fff;
      background: rgba(255, 255, 255, 0.12);
      text-align: left;
      padding: 7px 9px;
      border-radius: 6px;
      font-size: 13px;
      line-height: 1.25;
    }

    .submenu button:hover,
    .submenu button.active {
      background: rgba(255, 255, 255, 0.26);
      color: #fff;
    }

    .content {
      padding: 18px 26px 26px;
      overflow: hidden;
    }

    .topbar {
      min-height: 64px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 18px;
      margin-bottom: 14px;
    }

    .topbar h1 {
      margin: 0;
      color: var(--navy);
      font-size: 28px;
      line-height: 1.15;
    }

    .topbar p {
      margin: 8px 0 0;
      color: var(--muted);
      font-size: 15px;
      max-width: 720px;
      line-height: 1.45;
    }

    .quick-actions {
      display: flex;
      gap: 10px;
      flex-wrap: wrap;
      justify-content: flex-end;
    }

    .btn {
      border: 0;
      min-height: 42px;
      padding: 10px 14px;
      border-radius: 7px;
      background: var(--blue);
      color: #fff;
      font-weight: 700;
      display: inline-flex;
      align-items: center;
      gap: 8px;
      text-decoration: none;
      white-space: nowrap;
    }

    .btn.secondary {
      color: var(--navy);
      background: #fff;
      border: 1px solid var(--line);
    }

    .btn.danger {
      background: var(--red);
    }

    .btn.small {
      min-height: 34px;
      padding: 7px 10px;
      font-size: 13px;
    }

    .grid {
      display: grid;
      gap: 16px;
    }

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

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

    .metric {
      padding: 18px;
    }

    .metric span {
      color: var(--muted);
      font-size: 13px;
      display: block;
      margin-bottom: 10px;
    }

    .metric strong {
      display: block;
      font-size: 24px;
      color: var(--navy);
    }

    .metric em {
      display: block;
      margin-top: 8px;
      color: var(--muted);
      font-style: normal;
      font-size: 13px;
    }

    .panel {
      padding: 18px;
    }

    .panel h2 {
      margin: 0 0 14px;
      font-size: 19px;
      color: var(--navy);
    }

    .panel p {
      color: var(--muted);
      line-height: 1.5;
    }

    .two-cols {
      grid-template-columns: minmax(0, 1.15fr) minmax(330px, 0.85fr);
    }

    .form-grid {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 12px;
    }

    .field {
      display: grid;
      gap: 6px;
    }

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

    .field label {
      color: var(--navy);
      font-size: 13px;
      font-weight: 700;
    }

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

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

    input:focus, select:focus, textarea:focus {
      border-color: var(--blue);
      box-shadow: 0 0 0 3px rgba(24, 119, 210, 0.15);
    }

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

    table {
      width: 100%;
      border-collapse: collapse;
      min-width: 760px;
      background: #fff;
    }

    th, td {
      border-bottom: 1px solid var(--line);
      padding: 11px 12px;
      text-align: left;
      font-size: 14px;
      vertical-align: top;
    }

    th {
      background: #f6f9fd;
      color: var(--navy);
      font-size: 13px;
      text-transform: uppercase;
    }

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

    .status {
      display: inline-flex;
      align-items: center;
      border-radius: 999px;
      padding: 4px 9px;
      font-weight: 700;
      font-size: 12px;
    }

    .status.open { color: var(--amber); background: #fff2d9; }
    .status.done { color: var(--green); background: #dcf5eb; }
    .status.late { color: var(--red); background: #ffe4e4; }

    .toolbar {
      display: flex;
      gap: 10px;
      flex-wrap: wrap;
      align-items: end;
      margin-bottom: 14px;
    }

    .toolbar .field {
      min-width: 180px;
    }

    .chart-box {
      height: 260px;
      position: relative;
    }

    canvas {
      width: 100%;
      height: 100%;
      display: block;
    }

    .empty {
      padding: 24px;
      background: #f8fbff;
      border: 1px dashed #b8cce1;
      border-radius: 8px;
      color: var(--muted);
      line-height: 1.5;
    }

    .notice {
      padding: 12px 14px;
      background: var(--blue-soft);
      border: 1px solid #c8e0fb;
      border-radius: 8px;
      color: var(--navy);
      line-height: 1.45;
      margin-bottom: 14px;
      font-size: 14px;
    }

    .hidden { display: none !important; }

    @media (max-width: 1040px) {
      .sidebar {
        position: relative;
      }
      .brand img {
        width: 210px;
      }
      .module-grid {
        grid-template-columns: repeat(2, minmax(150px, 1fr));
      }
      .stats, .two-cols, .form-grid {
        grid-template-columns: 1fr 1fr;
      }
    }

    @media (max-width: 720px) {
      .content { padding: 18px; }
      .topbar {
        align-items: flex-start;
        flex-direction: column;
      }
      .quick-actions { justify-content: flex-start; }
      .stats, .two-cols, .form-grid {
        grid-template-columns: 1fr;
      }
      .sidebar {
        padding: 12px;
      }
      .brand {
        align-items: flex-start;
        flex-direction: column;
        gap: 10px;
      }
      .brand img {
        width: 220px;
      }
      .brand-id { gap: 12px; }
      .brand .brand-name { padding-left: 0; border-left: 0; }
      .brand .brand-name strong { font-size: 24px; }
      .client-logo-box {
        width: 150px;
        height: 48px;
      }
      .license-badge {
        text-align: left;
        min-width: 0;
      }
      .module-grid {
        grid-template-columns: 1fr;
      }
      .module-title {
        min-height: 50px;
      }
    }

    .rel-doc { font-size: 13px; color: #152033; }
    .rel-doc .rel-head h2 { margin: 6px 0 2px; font-size: 20px; color: var(--navy); }
    .rel-doc .rel-sub { color: #607086; font-size: 12px; }
    .rel-doc table { width: 100%; border-collapse: collapse; margin-top: 10px; }
    .rel-doc th { background: #0b2a4a; color: #fff; text-align: left; padding: 6px 8px; font-size: 12px; }
    .rel-doc td { padding: 5px 8px; border-bottom: 1px solid #dce5ef; }
    .rel-doc td.r, .rel-doc th.r { text-align: right; white-space: nowrap; }
    .rel-doc tr.grp td { background: #e8f2ff; font-weight: 700; }
    .rel-doc .rel-tot { margin: 12px 0 0 auto; width: 320px; }
    .rel-doc .rel-tot td { border: 0; padding: 2px 8px; }
    .rel-doc .rel-tot td:last-child { text-align: right; font-weight: 700; }
    .rel-bar { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 12px; }
    #printArea { display: none; }
    @media print {
      @page { size: A4 portrait; margin: 14mm 12mm; }
      body.printing-report > *:not(#printArea) { display: none !important; }
      body.printing-report #printArea { display: block; }
      body:not(.printing-report) .sidebar, body:not(.printing-report) .quick-actions, body:not(.printing-report) .trial-warning,
      body:not(.printing-report) .toolbar, body:not(.printing-report) .rel-bar, body:not(.printing-report) .btn { display: none !important; }
      body:not(.printing-report) .content { padding: 0; }
      .rel-doc { font-size: 11px; }
      .rel-doc table { table-layout: auto; }
      .rel-doc th, .rel-doc td { padding: 4px 5px; overflow-wrap: break-word; }
      .rel-doc th { white-space: nowrap; }
      .rel-doc td { max-width: 70mm; }
      .rel-doc thead { display: table-header-group; }
      .rel-doc tr { break-inside: avoid; page-break-inside: avoid; }
      .rel-doc th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
      .rel-doc tr.grp td { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    }
    .pw-lock { position: fixed; inset: 0; z-index: 300; display: flex; align-items: center; justify-content: center; background: var(--navy); padding: 16px; }
    .pw-lock.hidden { display: none; }
    .pw-card { background: #fff; border-radius: 12px; padding: 28px; width: min(380px, 100%); display: grid; gap: 12px; }
    .pw-card input { padding: 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 16px; }
    .btn.warn { background: #fff2d9; color: var(--amber); border: 1px solid var(--amber); }
    select.btn { appearance: auto; max-width: 220px; }
    #empresas .grid > .card { min-width: 0; }
    #empresas .grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); }
    #empresasTabela { overflow-x: auto; }
    #empresas input[type=checkbox] { width: 18px; height: 18px; min-height: 0; padding: 0; vertical-align: middle; margin-right: 6px; }
    .toast-rapido { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); background: var(--navy); color: #fff; padding: 12px 20px; border-radius: 10px; opacity: 0; pointer-events: none; transition: .25s; z-index: 250; }
    .toast-rapido.on { opacity: 1; transform: translateX(-50%); }
    .gf-box { width: 100%; }
    .gf-box canvas { display: block; width: 100%; }
    .pix-res { display: flex; gap: 20px; flex-wrap: wrap; align-items: flex-start; border: 1px solid var(--line); border-radius: 10px; padding: 16px; }
    .pix-res canvas { width: 220px; height: 220px; flex: none; border: 1px solid var(--line); }
    .pix-info { flex: 1; min-width: 240px; }
    .pix-info textarea { width: 100%; font-family: monospace; font-size: 12px; margin: 6px 0 10px; }
    .rel-doc img.chartimg { max-width: 100%; }
    .sidebar { position: relative; }
    .module { overflow: visible; position: relative; }
    .module-title { border-radius: 8px; }
    .module.open .module-title { border-radius: 8px 8px 0 0; }
    .module.has-active .module-title { box-shadow: inset 0 -4px 0 rgba(255, 255, 255, .75); }
    .module.open .submenu { display: flex; flex-direction: column; flex-wrap: nowrap; max-height: none; overflow: visible; position: absolute; left: 0; right: 0; top: 100%; z-index: 60; border-radius: 0 0 8px 8px; background: linear-gradient(rgba(0, 0, 0, .2), rgba(0, 0, 0, .2)), var(--module-color); box-shadow: 0 16px 30px rgba(0, 0, 0, .35); }
    .module.open .submenu button { width: 100%; }
    @media (max-width: 720px) { .module.open .submenu { position: static; border-radius: 0 0 8px 8px; } }
    .modal-baixa { position: fixed; inset: 0; z-index: 200; background: rgba(5, 24, 45, .55); display: flex; align-items: center; justify-content: center; padding: 16px; }
    .modal-baixa.hidden { display: none; }
    .baixa-card { background: #fff; border-radius: 12px; padding: 22px; width: min(520px, 100%); box-shadow: 0 24px 60px rgba(0, 0, 0, .35); }
    .baixa-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
    .baixa-head h2 { margin: 0; }
    .module-title { text-transform: uppercase; letter-spacing: .02em; }
    tr.cn-ok td { background: #f1faf5; }
    #conciliacao input[type=checkbox] { width: 18px; height: 18px; min-height: 0; padding: 0; margin: 0; }
    #conciliacao .stats { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }

    .clin-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
    .clin-stat { padding: 16px; display: flex; flex-direction: column; gap: 4px; border-top: 4px solid #8e5bd9; }
    .clin-stat span { color: var(--muted); font-size: 13px; font-weight: 700; text-transform: uppercase; }
    .clin-stat strong { font-size: 26px; color: var(--navy); }
    .clin-stat small { color: var(--muted); }
    .clin-pac-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
    .clin-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
    .clin-item { padding: 10px 0; border-bottom: 1px solid var(--line); }
    .clin-opts { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 6px; font-size: 13px; }
    .clin-opts input { width: auto; min-height: 0; }
    .clin-graf { width: 100%; max-width: 560px; height: auto; background: #faf7ff; border: 1px solid var(--line); border-radius: 8px; }
    .clin-doc { background: #fff; padding: 28px 34px; font-family: Georgia, 'Times New Roman', serif; color: #111; line-height: 1.65; }
    .clin-doc h1 { text-align: center; font-size: 18px; margin: 22px 0; letter-spacing: .03em; }
    .doc-logo { display: block; max-height: 56px; max-width: 190px; object-fit: contain; margin: 0 0 8px; }
    .clin-doc-head .doc-logo { margin: 0 auto 8px; }
    .clin-doc-head { text-align: center; font-size: 14px; border-bottom: 1px solid #999; padding-bottom: 10px; }
    .clin-doc-body { font-size: 15px; text-align: justify; }
    .clin-doc-ass { margin-top: 56px; text-align: center; font-size: 14px; }
    .clin-doc-ass .linha { width: 280px; max-width: 80%; border-top: 1px solid #111; margin: 0 auto 6px; }
    @media (max-width: 900px) { .clin-stats { grid-template-columns: 1fr 1fr; } }
    @media (max-width: 560px) { .clin-stats { grid-template-columns: 1fr; } .clin-doc { padding: 18px; } }

    /* ===== v4.8: menu em cartoes (modelo remodelado) ===== */
    .module-grid { grid-template-columns: repeat(auto-fill, minmax(176px, 208px)); gap: 10px; counter-reset: mod; align-items: stretch; }
    .module { display: flex; flex-direction: column; }
    .module-title { flex: 1; }
    .module { counter-increment: mod; background: linear-gradient(145deg, rgba(255,255,255,.15), rgba(255,255,255,.06)), #0a2f52; border: 1px solid rgba(255,255,255,.16); box-shadow: 0 12px 26px rgba(4,15,27,.28); border-radius: 8px; }
    .module::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: var(--module-color); border-radius: 8px 8px 0 0; pointer-events: none; }
    .module-title { display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 6px; min-height: 104px; padding: 12px 12px 9px; text-shadow: none; text-transform: none; letter-spacing: 0; }
    .module-title::after { content: none !important; }
    .mt-top { display: flex; align-items: center; justify-content: space-between; }
    .module-title svg { width: 22px; height: 22px; stroke: color-mix(in srgb, var(--module-color) 40%, #fff); }
    .mt-num { width: 24px; height: 24px; border-radius: 50%; background: var(--module-color); color: #fff; font-size: 11px; font-weight: 800; display: grid; place-items: center; }
    .mt-num::before { content: counter(mod, decimal-leading-zero); }
    .mt-name { font-size: 14px; font-weight: 800; text-transform: uppercase; letter-spacing: .02em; line-height: 1.15; }
    .mt-desc { font-size: 11.5px; font-weight: 500; line-height: 1.3; color: #c3dcee; flex: 1; }
    .mt-act { display: flex; align-items: center; justify-content: space-between; font-size: 11px; font-weight: 800; text-transform: uppercase; }
    .mt-act em { font-style: normal; }
    .mt-act em::before { content: "Abrir"; }
    .module.open .mt-act em::before { content: "Fechar"; }
    .mt-act i { width: 22px; height: 22px; border-radius: 50%; background: var(--module-color); display: grid; place-items: center; font-style: normal; font-size: 16px; line-height: 1; }
    .module.open .mt-act i { transform: rotate(45deg); }
    .module-title:hover { background: rgba(255,255,255,.07); }
    .module.has-active { box-shadow: 0 0 0 2px rgba(255,255,255,.75), 0 12px 26px rgba(4,15,27,.28); }
    .module.has-active .module-title { box-shadow: none; }
    .module.open .module-title { border-radius: 8px 8px 0 0; }
    .module.clinica { --module-color: #7c45c8; }
    .module.nfse { --module-color: #c49b00; }
    .module.cadastro { --module-color: #127eb7; }
    .module.receber { --module-color: #c86f0d; }
    .module.correntes { --module-color: #10958d; }
    .module.pagar { --module-color: #c74540; }
    .module.relatorios { --module-color: #4a9b22; }
    .menu-head-row { flex-wrap: wrap; }
    .menu-search { position: relative; margin-left: auto; width: min(340px, 100%); }
    .menu-search input { width: 100%; height: 32px; padding: 0 12px; border-radius: 8px; border: 1px solid rgba(255,255,255,.2); background: rgba(255,255,255,.1); color: #fff; font-size: 13px; }
    .menu-search input::placeholder { color: #bcd6e8; }
    .menu-search-res { position: absolute; top: 36px; left: 0; right: 0; z-index: 80; background: #0a2f52; border: 1px solid rgba(255,255,255,.22); border-radius: 8px; box-shadow: 0 16px 30px rgba(0,0,0,.4); max-height: 320px; overflow: auto; padding: 4px; }
    .menu-search-res button { display: flex; width: 100%; justify-content: space-between; gap: 10px; border: 0; background: transparent; color: #fff; text-align: left; padding: 7px 9px; border-radius: 6px; font-size: 13px; cursor: pointer; }
    .menu-search-res button:hover, .menu-search-res button.sel { background: rgba(255,255,255,.18); }
    .menu-search-res small { color: #9fd2f2; font-size: 11px; white-space: nowrap; }
    .menu-search-res .vazio { padding: 8px 10px; color: #bcd6e8; font-size: 13px; }
    .status-strip { display: flex; flex-wrap: wrap; gap: 8px 26px; margin-top: 10px; padding: 8px 14px; border: 1px solid rgba(255,255,255,.12); border-radius: 8px; background: rgba(3,15,27,.34); font-size: 12px; color: #c7deef; }
    .status-strip b { color: #fff; }
    .status-strip em { font-style: normal; }
    .status-strip .pend { color: #ffd27a; font-weight: 700; }
    .sidebar.compacto .status-strip { display: none; }
    @media (max-width: 720px) { .module-grid { grid-template-columns: 1fr 1fr; } .module-title { min-height: 96px; } .menu-search { width: 100%; margin-left: 0; order: 3; } }
    @media (max-width: 420px) { .module-grid { grid-template-columns: 1fr; } }
  
.dfx-barra{display:flex;align-items:center;gap:14px;flex-wrap:wrap;padding:8px 18px;background:#061a3a;color:#fff;font:14px "Segoe UI",system-ui,sans-serif}
.dfx-barra a,.dfx-barra button{color:#fff;background:transparent;border:1px solid #4f78b8;border-radius:8px;padding:6px 12px;min-height:36px;font:inherit;text-decoration:none;cursor:pointer}
.dfx-barra a:hover,.dfx-barra button:hover{background:rgba(77,179,255,.2)}
.dfx-barra .dfx-marca{font-weight:700;margin-right:auto}.dfx-barra .dfx-marca span{color:#4db3ff}
.dfx-aviso{position:fixed;left:50%;bottom:16px;transform:translateX(-50%);z-index:9999;background:#fff8e1;color:#5a4300;border:1px solid #c98a00;border-radius:10px;padding:10px 16px;max-width:92vw;box-shadow:0 4px 18px rgba(0,0,0,.25)}
.dfx-aviso-grave{background:#fdecea;color:#7a1410;border-color:#c62828}
@media print{.dfx-barra,.dfx-aviso{display:none!important}}
/* versao do servidor: tira o que so fazia sentido no Windows (arquivo da empresa, licenca local, varias empresas no navegador, clinica local) */
.dfx-web span:has(> #stEmpresa),.dfx-web span:has(> #stLicenca),.dfx-web span:has(> #stArquivo),.dfx-web #bkBadge,.dfx-web #empresaSel,.dfx-web #licenseType,.dfx-web #licenseExport,.dfx-web #trialWarning,
.dfx-web #empresasTabela,.dfx-web #empresaNovaForm,.dfx-web #empresaRenomearForm,.dfx-web #arquivoSalvarForm,.dfx-web #arquivoAbrirForm,.dfx-web #arquivoMsg,
.dfx-web label:has(#modClinica),.dfx-web #modClinicaMsg,
.dfx-web h2:has(+ #empresasTabela),.dfx-web h2:has(+ #empresaNovaForm),.dfx-web h2:has(+ #empresaRenomearForm),.dfx-web h2:has(+ #arquivoSalvarForm),.dfx-web h2:has(+ #arquivoAbrirForm),.dfx-web h2:has(+ label #modClinica){display:none!important}

/* perfil de recepcao: so contas a receber, clientes e recebimentos */
body.dfx-rec .module:not(.receber), body.dfx-rec [data-view]:not([data-rec-ok]), body.dfx-rec [data-view-jump] { display: none !important; }
    .cn-tag { display: inline-block; font-size: 12px; padding: 1px 7px; border-radius: 4px; margin-top: 3px; }
    .cn-tag-ok { background: #e6f6ec; color: #17653a; }
    .cn-tag-warn { background: #fff4d6; color: #8a5a00; }
    .ex-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 10px; }
    .ex-head h2 { margin: 0; font-size: 16px; }
    .ex-head span { font-size: 12px; color: var(--muted); }
    .ex-card strong { font-size: 24px; }
    .ex-main { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
    .ag-main { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1fr); }
    @media (max-width: 1100px) { .ex-main, .ag-main { grid-template-columns: 1fr; } }
    .ex-chart { display: flex; align-items: stretch; gap: 10px; min-height: 260px; }
    .ex-col { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; }
    .ex-pair { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 4px; border-bottom: 1px solid var(--line); min-height: 170px; }
    .ex-bar { width: 38%; max-width: 30px; border-radius: 4px 4px 0 0; position: relative; display: flex; flex-direction: column; justify-content: flex-start; overflow: hidden; }
    .ex-bar.in { background: var(--green); } .ex-bar.out { background: var(--red); }
    .ex-bar i { display: block; width: 100%; opacity: .45; background: repeating-linear-gradient(45deg, #fff 0 3px, transparent 3px 6px); }
    .ex-col span { font-size: 12px; color: var(--ink); }
    .ex-col small { font-size: 10px; color: var(--muted); text-align: center; line-height: 1.3; }
    .ex-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px; font-size: 12px; color: var(--muted); }
    .ex-legend i { display: inline-block; width: 10px; height: 10px; margin-right: 5px; border-radius: 2px; vertical-align: -1px; }
    .ex-legend i.in { background: var(--green); } .ex-legend i.out { background: var(--red); } .ex-legend i.prev { background: repeating-linear-gradient(45deg, #9aa8ba 0 2px, #fff 2px 4px); }
    .ex-row { display: grid; grid-template-columns: minmax(70px, 130px) 1fr 140px; gap: 10px; align-items: center; padding: 5px 0; font-size: 13px; }
    .ex-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
    .ex-row em { font-style: normal; font-weight: 700; white-space: nowrap; text-align: right; }
    .ex-row em small { font-weight: 400; color: var(--muted); margin-left: 4px; }
    .ex-track { height: 10px; background: #edf1f6; border-radius: 6px; overflow: hidden; }
    .ex-track b { display: block; height: 100%; border-radius: 6px; }
    .ex-sub { margin: 0 0 8px; font-size: 12px; color: var(--muted); }
    .ag-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
    .ag-tile { background: #f3f7fb; border-radius: 8px; padding: 12px; display: flex; flex-direction: column; gap: 4px; }
    .ag-tile span { font-size: 12px; color: var(--muted); } .ag-tile strong { font-size: 18px; } .ag-tile em { font-style: normal; font-size: 12px; color: var(--muted); }
    .ag-tile.hot { background: #fdf1f1; }
    .ag-acao { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
    .ag-acao:last-child { border-bottom: 0; }
    .ag-acao small { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
    .ag-acao-v { text-align: right; white-space: nowrap; }
    .cn-contab { border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; background: #fafcfe; }
    .cn-contab summary { cursor: pointer; padding: 4px 0; }
    .cn-contab-body h3 { margin: 16px 0 6px; font-size: 14px; }
    .cn-pl { width: 200px; } .cn-pl-ruim { border-color: var(--red); background: #fff6f6; }
    .cn-hist { width: 210px; }
    .cn-rule { min-width: 150px; font-size: 12px; } .cn-rule label { display: flex; gap: 4px; align-items: center; white-space: nowrap; } .cn-rule input[type=text], .cn-rule input:not([type]) { width: 140px; margin-top: 3px; }
    select[data-ln-cat], select[data-cat-mov] { max-width: 150px; }
    #cbRegras input:not([type=checkbox]) { min-width: 110px; }

    /* ===== DRE (resultado) ===== */
    .dre-bar .toolbar { align-items: flex-end; }
    .dre-seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #f3f7fb; }
    .dre-seg button { border: 0; background: none; color: var(--muted); font: inherit; font-weight: 600; padding: 9px 13px; cursor: pointer; }
    .dre-seg button.on { background: var(--blue); color: #fff; }
    .dre-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
    .dre-tabs button { border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 9px 13px; border-radius: 8px; font: inherit; font-weight: 700; cursor: pointer; }
    .dre-tabs button.on { background: var(--blue); color: #fff; border-color: var(--blue); }
    .dre-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 16px; align-items: start; }
    .dre-grid > * { min-width: 0; }
    .dre-col { display: grid; gap: 16px; min-width: 0; }
    .dre-hero { background: linear-gradient(135deg, #1877d2, #0b3a6b); color: #fff; border-radius: 12px; padding: 18px; }
    .dre-hero small { opacity: .85; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; font-size: 12px; }
    .dre-hero .big { font-size: 34px; font-weight: 800; margin: 4px 0 8px; font-variant-numeric: tabular-nums; }
    .dre-chip { display: inline-block; background: rgba(255,255,255,.2); border-radius: 999px; padding: 3px 11px; font-weight: 700; font-size: 12px; margin-right: 6px; }
    .dre-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
    .dre-stack { display: flex; height: 30px; border-radius: 8px; overflow: hidden; margin: 8px 0; }
    .dre-stack div { display: grid; place-items: center; font-size: 11px; font-weight: 700; color: #fff; overflow: hidden; min-width: 0; }
    .dre-leg { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--muted); }
    .dre-leg i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 5px; }
    .dre-note { border-left: 4px solid var(--green); background: #f3f9f6; }
    .dre-note p { margin: 4px 0 0; }
    .dre-ok { background: #e3f4ec; color: var(--green); border-radius: 8px; padding: 9px 11px; font-weight: 700; }
    .dre-alerta { background: #fff4dd; color: var(--amber); border-radius: 8px; padding: 8px 10px; margin-top: 8px; display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
    .dre-pos { color: var(--green); } .dre-neg { color: var(--red); }
    .dre-t { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
    .dre-t th { text-align: right; white-space: nowrap; }
    .dre-t th:first-child, .dre-t td:first-child { text-align: left; }
    .dre-t td { text-align: right; white-space: nowrap; padding: 8px 10px; border-bottom: 1px solid var(--line); }
    .dre-r.t td { background: #f2f6fb; font-weight: 700; }
    .dre-r.tt td { background: #e4eef9; font-weight: 700; }
    .dre-r.s td:first-child { font-weight: 700; color: var(--ink); }
    .dre-r.i td { color: var(--muted); }
    .dre-r.f td { background: #e3f4ec; color: var(--green); font-weight: 800; }
    .dre-r.amb td { background: #fff4dd; color: var(--amber); }
    .dre-clic { cursor: pointer; } .dre-clic:hover td { filter: brightness(.96); }
    .dre-det td { white-space: normal; text-align: left !important; background: #f8fafc; font-size: 12px; color: var(--muted); }
    .dre-mini { width: 100%; border-collapse: collapse; } .dre-mini td { padding: 8px 4px; border-bottom: 1px solid var(--line); text-align: right; } .dre-mini td:first-child { text-align: left; } .dre-mini tr.f td { background: #e3f4ec; font-weight: 800; }
    select.dre-sug { color: var(--muted); }
    body.dre-pres .sidebar, body.dre-pres .topbar, body.dre-pres .dre-adm, body.dre-pres .status-strip, body.dre-pres #drPdf, body.dre-pres #drCsv { display: none !important; }
    body.dre-pres .app { grid-template-columns: 1fr !important; }
    body.dre-pres .dre-hero .big { font-size: 46px; }
    @media (max-width: 900px) { .dre-grid { grid-template-columns: 1fr; } }
    .dre-col > * { min-width: 0; }
    .dre-col textarea, #drComent { width: 100%; box-sizing: border-box; font: inherit; border: 1px solid var(--line); border-radius: 8px; padding: 9px; resize: vertical; }
    .dre-col .panel, .dre-grid .panel { overflow-wrap: anywhere; }
    .tw { overflow-x: auto; }
    .dre-t, .dre-mini { min-width: 0; }
    .dre-t th, .dre-t td, .dre-mini td { font-size: 13px; padding: 8px 10px; }
    .dre-t th { text-transform: none; background: #e9f0f8; }
    .dre-map th, .dre-map td { text-align: left !important; }

    .dre-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
    .dre-grid2 > * { min-width: 0; }
    .dre-hb { display: grid; grid-template-columns: 64px 1fr auto; gap: 10px; align-items: center; margin: 7px 0; font-size: 12px; }
    .dre-hb > div { background: var(--blue-soft, #e8f1fb); border-radius: 99px; overflow: hidden; display: grid; gap: 2px; padding: 2px 0; }
    .dre-hb i { display: block; height: 7px; border-radius: 99px; background: var(--blue); }
    .dre-hb i.g { background: var(--green); } .dre-hb i.r { background: var(--red); }
    .dre-hb em { font-style: normal; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
    .dre-leg .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; background: var(--blue); }
    .dre-leg .dot.g { background: var(--green); } .dre-leg .dot.r { background: var(--red); }
    @media (max-width: 900px) { .dre-grid2 { grid-template-columns: 1fr; } }

    .module.fiscal { --module-color: #6b4fb8; --module-border: #43307a; }
    .fs-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin: 12px 0; }
    .fs-ass { display: grid; gap: 8px; margin-top: 8px; }
    .fs-ass img { max-width: 260px; max-height: 90px; background: #fff; border: 1px solid var(--line, #d8dee8); border-radius: 6px; padding: 4px; }
    .fs-vgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; margin-top: 8px; }
    .fs-vgrid label { display: grid; gap: 3px; font-size: 12px; }
    .fs-cad > summary { cursor: pointer; }
    .as-wrap { margin-top: 28px; break-inside: avoid; }
    .as-data { margin: 0 0 22px; }
    .as-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; }
    .as-b { display: grid; justify-items: center; text-align: center; gap: 2px; font-size: 13px; }
    .as-b img { max-width: 220px; max-height: 70px; object-fit: contain; }
    .as-img { height: 74px; display: flex; align-items: flex-end; justify-content: center; width: 100%; }
    .as-l { width: 100%; border-top: 1px solid currentColor; margin-top: 2px; }
    .as-b span { font-size: 12px; opacity: .75; }
    @media (max-width: 700px) { .as-grid { grid-template-columns: 1fr; } }
    body.dfx-op [data-op-fora], body.dfx-op .module.relatorios, body.dfx-op .module.fiscal { display: none !important; }

    .vd-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 16px 0; }
    .vd-cards > * { min-width: 0; }
    .vd-cards p { line-height: 1.45; overflow-wrap: anywhere; }
    .vd-chk { display: flex; align-items: center; gap: 6px; font-size: 13px; align-self: end; padding-bottom: 8px; }
    #vendas-desp .dre-grid { margin-bottom: 16px; }
    .dre-hb i.r { background: var(--red); }
    @media (max-width: 900px) { .vd-cards { grid-template-columns: 1fr; } }
    .vd-chk input { width: auto; min-width: 0; margin: 0; height: auto; }
