      :root {
        --bg: #f4f5f7;
        --panel: #fff;
        --ink: #172b4d;
        --muted: #5e6c84;
        --line: #dfe1e6;
        --purple: #0079bf;
        --purple2: #e4f0f6;
        --purple-light: #ddf1fa;
        --green: #519839;
        --orange: #b26a00;
        --red: #eb5a46;
        --shadow: 0 1px 1px #091e4240, 0 0 1px #091e4233;
      }
      * {
        box-sizing: border-box;
      }
      body {
        margin: 0;
        background: var(--bg);
        color: var(--ink);
        font:
          14px/1.45 Inter,
          -apple-system,
          BlinkMacSystemFont,
          "Segoe UI",
          sans-serif;
      }
      button,
      input,
      select,
      textarea {
        font: inherit;
      }
      button {
        cursor: pointer;
        border: 0;
      }
      .app {
        min-height: 100vh;
        display: grid;
        grid-template-columns: 238px 1fr;
      }
      .sidebar {
        background: #fff;
        border-right: 1px solid var(--line);
        padding: 24px 15px;
        display: flex;
        flex-direction: column;
        gap: 26px;
      }
      .brand {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 0 9px;
        font-weight: 800;
        font-size: 19px;
        letter-spacing: -0.6px;
      }
      .logo {
        background: var(--purple);
        color: #fff;
        width: 32px;
        height: 32px;
        border-radius: 10px;
        display: grid;
        place-items: center;
        font-size: 17px;
      }
      .workspace {
        margin: 0 7px;
        padding: 12px;
        background: #f4f5f7;
        border: 1px solid var(--line);
        border-radius: 12px;
      }
      .tiny {
        font-size: 11px;
        color: var(--muted);
        text-transform: uppercase;
        letter-spacing: 0.08em;
      }
      .workspace strong {
        display: block;
        margin-top: 4px;
      }
      .nav {
        display: grid;
        gap: 5px;
      }
      .nav button {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 11px 12px;
        border-radius: 10px;
        text-align: left;
        background: transparent;
        color: #676d83;
      }
      .nav button.active {
        background: var(--purple2);
        color: var(--purple);
        font-weight: 700;
      }
      .nav .ico {
        width: 19px;
        text-align: center;
        font-size: 17px;
      }
      .nav .ico svg {
        display: block;
        width: 18px;
        height: 18px;
        stroke: currentColor;
        flex: 0 0 auto;
      }
      .nav-divider {
        height: 1px;
        background: var(--line);
        margin: 9px 8px;
        list-style: none;
      }
      .side-bottom {
        margin-top: auto;
        padding: 12px;
        color: var(--muted);
        font-size: 12px;
        border-top: 1px solid var(--line);
      }
      main {
        min-width: 0;
        padding: 27px 32px 42px;
      }
      .topbar {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 14px;
        margin-bottom: 26px;
      }
      .eyebrow {
        color: var(--muted);
        font-size: 12px;
        margin-bottom: 4px;
      }
      .topbar h1 {
        font-size: 26px;
        letter-spacing: -0.8px;
        margin: 0;
      }
      .actions {
        display: flex;
        gap: 9px;
        align-items: center;
      }
      .btn {
        padding: 10px 14px;
        border-radius: 10px;
        background: #fff;
        border: 1px solid var(--line);
        color: var(--ink);
        font-weight: 650;
      }
      .btn.primary {
        background: var(--purple);
        color: #fff;
        border-color: var(--purple);
      }
      .btn.small {
        padding: 7px 10px;
        font-size: 12px;
      }
      .content {
        display: none;
      }
      .content.active {
        display: block;
      }
      .hero {
        background: linear-gradient(115deg, #0079bf, #026aa7);
        color: white;
        border-radius: 18px;
        padding: 23px 25px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 15px;
        margin-bottom: 20px;
        box-shadow: 0 12px 26px #0079bf22;
      }
      .hero h2 {
        margin: 5px 0 7px;
        font-size: 21px;
      }
      .hero p {
        margin: 0;
        color: #e9e5ff;
      }
      .hero .heroicon {
        font-size: 54px;
        opacity: 0.9;
      }
      .stats {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 14px;
        margin-bottom: 22px;
      }
      .stat,
      .panel,
      .column {
        background: var(--panel);
        border: 1px solid var(--line);
        border-radius: 15px;
        box-shadow: var(--shadow);
      }
      .stat {
        padding: 17px;
      }
      .stat-top {
        display: flex;
        justify-content: space-between;
        align-items: center;
        color: var(--muted);
        font-size: 12px;
      }
      .stat-icon {
        background: #e4f0f6;
        color: var(--purple);
        width: 31px;
        height: 31px;
        display: grid;
        place-items: center;
        border-radius: 9px;
        font-size: 16px;
      }
      .num {
        font-size: 28px;
        font-weight: 800;
        letter-spacing: -1px;
        margin-top: 11px;
      }
      .sub {
        color: var(--muted);
        font-size: 12px;
        margin-top: 3px;
      }
      .section-head {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin: 24px 0 12px;
      }
      .section-head h3 {
        font-size: 16px;
        margin: 0;
      }
      .panel {
        padding: 18px;
      }
      .project-row {
        display: grid;
        grid-template-columns: 1fr 100px 100px 90px;
        align-items: center;
        gap: 14px;
        padding: 13px 0;
        border-bottom: 1px solid var(--line);
      }
      .project-row:last-child {
        border: 0;
      }
      .project-selectable {
        cursor: pointer;
        margin: 0 -10px;
        padding: 17px 10px;
        border: 1px solid transparent;
        border-bottom-color: var(--line);
        border-radius: 12px;
        transition:
          background 0.16s ease,
          border-color 0.16s ease,
          box-shadow 0.16s ease;
      }
      .project-selectable:hover {
        background: #f4f5f7;
        border-color: #ddd8ff;
      }
      .project-selectable:focus-visible {
        outline: 3px solid #4bbfdb;
        outline-offset: 2px;
      }
      .project-selectable.selected {
        background: var(--purple2);
        border-color: #7fb8d8;
        box-shadow: inset 3px 0 0 var(--purple);
      }
      .project-selectable.selected .project-title {
        color: var(--purple);
      }
      .project-selectable .btn {
        transition:
          background 0.16s ease,
          border-color 0.16s ease;
      }
      .project-selectable.selected .btn {
        border-color: #7fb8d8;
        color: var(--purple);
      }
      .active-project-banner {
        cursor: pointer;
        transition:
          box-shadow 0.16s ease,
          border-color 0.16s ease;
        display: none;
        align-items: center;
        justify-content: flex-start;
        gap: 12px;
        background: var(--purple2);
        border: 1px solid #d8d2ff;
        border-radius: 13px;
        padding: 12px 15px;
        margin-bottom: 15px;
      }
      .active-project-banner.show {
        display: flex;
      }
      .active-project-banner.show:hover {
        border-color: #b7adff;
        box-shadow: 0 4px 16px #0079bf14;
      }
      .active-project-banner:focus-visible {
        outline: 3px solid #4bbfdb;
        outline-offset: 3px;
      }
      .active-project-info {
        display: flex;
        align-items: center;
        gap: 10px;
        min-width: 0;
      }
      .active-project-icon {
        display: grid;
        place-items: center;
        width: 34px;
        height: 34px;
        background: var(--purple);
        color: white;
        border-radius: 10px;
        flex: 0 0 auto;
      }
      .active-project-label {
        font-size: 10px;
        letter-spacing: 0.08em;
        color: var(--purple);
        font-weight: 800;
      }
      .active-project-name {
        font-size: 14px;
        font-weight: 800;
        color: var(--purple);
        overflow-wrap: anywhere;
      }
      .project-title {
        font-weight: 700;
      }
      .project-sub {
        font-size: 12px;
        color: var(--muted);
        margin-top: 3px;
      }
      .pill {
        display: inline-flex;
        align-items: center;
        gap: 5px;
        padding: 5px 8px;
        border-radius: 20px;
        background: #e4f0f6;
        color: var(--purple);
        font-size: 11px;
        font-weight: 700;
      }
      .pill.green {
        background: #e7f7f0;
        color: var(--green);
      }
      .pill.orange {
        background: #fff2e4;
        color: var(--orange);
      }
      .pill.red {
        background: #fff0f1;
        color: var(--red);
      }
      .progress {
        height: 6px;
        background: #eeeef5;
        border-radius: 8px;
        overflow: hidden;
        margin-top: 8px;
      }
      .progress span {
        display: block;
        height: 100%;
        background: var(--purple);
        border-radius: 8px;
      }
      .board-tools {
        display: flex;
        justify-content: space-between;
        gap: 12px;
        align-items: center;
        margin-bottom: 17px;
      }
      .board-tools input {
        max-width: 270px;
      }
      .field {
        padding: 10px 12px;
        border: 1px solid var(--line);
        border-radius: 10px;
        background: white;
        outline: none;
        color: var(--ink);
      }
      .field:focus {
        border-color: #9c93ed;
        box-shadow: 0 0 0 3px #0079bf18;
      }
      .board {
        display: grid;
        grid-template-columns: repeat(4, minmax(220px, 1fr));
        gap: 14px;
        overflow-x: auto;
        padding-bottom: 12px;
        align-items: start;
      }
      .column {
        padding: 12px;
        min-height: 360px;
        background: #f9f9fc;
        box-shadow: none;
      }
      .colhead {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 12px;
        font-weight: 750;
      }
      .count {
        font-size: 11px;
        background: #e9eaf1;
        border-radius: 7px;
        padding: 3px 7px;
        color: #72778a;
      }
      .task {
        background: white;
        border: 1px solid var(--line);
        border-radius: 12px;
        padding: 13px;
        margin-bottom: 9px;
        box-shadow: 0 3px 9px #091e4206;
      }
      .delivery-selectable {
        cursor: pointer;
        transition:
          background 0.16s ease,
          border-color 0.16s ease,
          box-shadow 0.16s ease;
        border-radius: 10px;
        padding-left: 10px;
        padding-right: 10px;
        margin-left: -10px;
        margin-right: -10px;
      }
      .delivery-selectable:hover {
        background: #f4f5f7;
        border-bottom-color: #b3d4e0;
      }
      .delivery-selectable:hover .project-title {
        color: var(--purple);
      }
      .delivery-selectable:focus-visible {
        outline: 3px solid #4bbfdb;
        outline-offset: 2px;
      }
      .delivery-row {
        grid-template-columns: minmax(0, 1fr) 112px minmax(110px, 145px) 112px;
      }
      .delivery-header {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 112px minmax(110px, 145px) 112px;
        gap: 14px;
        padding: 2px 0 10px;
        color: var(--muted);
        font-size: 11px;
        font-weight: 750;
        border-bottom: 1px solid var(--line);
        letter-spacing: 0.02em;
      }
      .delivery-date {
        white-space: nowrap;
        font-weight: 600;
      }
      .delivery-date.overdue {
        color: var(--red);
        font-weight: 600;
        background: transparent;
        border-radius: 0;
        padding: 0;
        justify-self: start;
      }
      .delivery-owner {
        font-size: 12px;
        color: var(--muted);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
      .delivery-status {
        justify-self: start;
      }
      .task-focus-dim {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(25, 26, 47, 0.48);
        z-index: 8;
        pointer-events: none;
      }
      .task-focus-dim.show {
        display: block;
      }
      .task.task-focus-target {
        position: relative;
        z-index: 9;
        border: 2px solid var(--purple);
        outline: 3px solid #a69df4;
        outline-offset: 4px;
        box-shadow:
          0 0 0 8px #0079bf33,
          0 15px 38px #091e4240;
        background: #fff;
        animation: taskFocusPulse 1.55s ease-in-out 2;
      }
      .task-focus-target .task-title {
        color: var(--purple);
      }
      @keyframes taskFocusPulse {
        0%,
        100% {
          box-shadow:
            0 0 0 5px #0079bf33,
            0 15px 38px #091e4240;
        }
        50% {
          box-shadow:
            0 0 0 10px #0079bf20,
            0 15px 38px #091e4240;
        }
      }
      .task-focus-bar {
        display: none;
        position: fixed;
        top: 14px;
        left: 50%;
        transform: translateX(-50%);
        z-index: 11;
        align-items: center;
        justify-content: space-between;
        gap: 15px;
        max-width: calc(100vw - 24px);
        width: max-content;
        padding: 10px 13px;
        background: #fff;
        border: 1px solid #b3d4e0;
        border-radius: 14px;
        box-shadow: 0 12px 36px #17172b32;
      }
      .task-focus-bar.show {
        display: flex;
      }
      .task-focus-copy {
        display: flex;
        flex-direction: column;
        min-width: 0;
        gap: 2px;
      }
      .task-focus-label {
        font-size: 9px;
        letter-spacing: 0.08em;
        color: var(--purple);
        font-weight: 800;
      }
      .task-focus-title {
        font-size: 13px;
        font-weight: 800;
        max-width: min(48vw, 520px);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }
      .task-focus-bar .btn {
        white-space: nowrap;
      }
      .task-focus-bar .btn:hover {
        border-color: #b8afff;
        color: var(--purple);
      }
      @media (max-width: 720px) {
        .task-focus-bar {
          top: 112px;
          left: 12px;
          right: 12px;
          transform: none;
          width: auto;
          gap: 8px;
          padding: 9px;
        }
        .task-focus-title {
          font-size: 12px;
          max-width: 42vw;
        }
        .task-focus-bar .btn {
          font-size: 10px;
          padding: 7px 8px;
        }
      }
      .task-title {
        font-weight: 700;
        margin: 8px 0 6px;
      }
      .task-meta {
        font-size: 12px;
        color: var(--muted);
        display: flex;
        justify-content: space-between;
        gap: 6px;
        margin-top: 8px;
      }
      .task-delivery-line {
        display: flex;
        align-items: center;
        gap: 6px;
        margin-top: 7px;
        font-size: 12px;
        color: var(--muted);
        font-weight: 500;
        min-width: 0;
      }
      .task-delivery-line svg {
        width: 14px;
        height: 14px;
        flex: 0 0 auto;
      }
      .task-code-date {
        font-size: 12px;
        color: var(--muted);
        font-weight: 500;
        font-variant-numeric: tabular-nums;
        white-space: nowrap;
      }
      .task-foot {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-top: 11px;
      }
      .priority {
        font-size: 10px;
        font-weight: 750;
      }
      .priority.high {
        color: var(--red);
      }
      .priority.medium {
        color: var(--orange);
      }
      .priority.low {
        color: var(--green);
      }
      .task select {
        width: 100%;
        padding: 6px;
        border: 1px solid var(--line);
        border-radius: 7px;
        margin-top: 10px;
        color: var(--muted);
        font-size: 11px;
        background: #fff;
      }
      .addtask {
        width: 100%;
        text-align: left;
        padding: 9px;
        border: 1px dashed #d6d7e4;
        background: transparent;
        border-radius: 9px;
        color: var(--muted);
      }
      .calendar-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 15px;
      }
      .calendar-head h2 {
        font-size: 20px;
        margin: 0;
      }
      .cal-grid {
        display: grid;
        grid-template-columns: repeat(7, minmax(70px, 1fr));
        border-top: 1px solid var(--line);
        border-left: 1px solid var(--line);
        background: white;
        border-radius: 12px;
        overflow: hidden;
      }
      .weekday {
        padding: 11px 5px;
        text-align: center;
        color: var(--muted);
        font-size: 11px;
        background: #fafbfc;
        border-right: 1px solid var(--line);
        border-bottom: 1px solid var(--line);
      }
      .day {
        min-height: 112px;
        padding: 8px;
        border-right: 1px solid var(--line);
        border-bottom: 1px solid var(--line);
        background: #fff;
      }
      .day.muted {
        background: #fafafd;
        color: #b8bac8;
      }
      .day.today .daynum {
        background: var(--purple);
        color: white;
      }
      .daynum {
        display: grid;
        place-items: center;
        width: 25px;
        height: 25px;
        border-radius: 8px;
        margin-bottom: 7px;
        font-size: 12px;
      }
      .cal-event {
        font-size: 10px;
        line-height: 1.3;
        padding: 4px 5px;
        background: #e4f0f6;
        color: #5f52c8;
        border-radius: 5px;
        margin-bottom: 4px;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
      }
      .cal-event.done {
        background: #e7f7f0;
        color: #258866;
      }
      .empty {
        padding: 26px;
        text-align: center;
        color: var(--muted);
      }
      .sharebox {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 10px;
        background: #f4f5f7;
        border-radius: 10px;
      }
      .sharebox input {
        flex: 1;
        min-width: 0;
        background: white;
      }
      .note {
        color: var(--muted);
        font-size: 12px;
        margin-top: 10px;
      }
      .toast {
        position: fixed;
        bottom: 22px;
        right: 22px;
        background: #22243a;
        color: white;
        padding: 12px 16px;
        border-radius: 10px;
        box-shadow: var(--shadow);
        display: none;
        z-index: 10;
      }
      .modal-back {
        position: fixed;
        inset: 0;
        background: #16172a66;
        display: none;
        align-items: center;
        justify-content: center;
        padding: 18px;
        z-index: 20;
      }
      .modal {
        background: white;
        border-radius: 16px;
        padding: 22px;
        width: min(460px, 100%);
        box-shadow: 0 25px 80px #0002;
      }
      .modal h2 {
        margin: 0 0 17px;
      }
      .formgrid {
        display: grid;
        gap: 12px;
      }
      .formgrid label {
        display: grid;
        gap: 6px;
        font-size: 12px;
        color: var(--muted);
      }
      .formgrid input,
      .formgrid select,
      .formgrid textarea {
        width: 100%;
      }
      .modal-actions {
        display: flex;
        justify-content: flex-end;
        gap: 8px;
        margin-top: 18px;
      }
      .archive-btn {
        display: none;
        align-items: center;
        gap: 8px;
        white-space: nowrap;
      }
      .archive-btn .archive-count {
        display: inline-grid;
        place-items: center;
        min-width: 22px;
        height: 22px;
        padding: 0 6px;
        border-radius: 7px;
        background: var(--purple2);
        color: var(--purple);
        font-size: 11px;
        font-weight: 800;
      }
      .archive-modal {
        width: min(720px, 100%);
        max-height: calc(100vh - 36px);
        overflow: auto;
      }
      .archive-modal-head {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 12px;
        margin-bottom: 6px;
      }
      .archive-modal-head h2 {
        margin: 0;
      }
      .archive-modal-intro {
        color: var(--muted);
        margin: 0 0 17px;
      }
      .archived-list {
        display: grid;
        gap: 9px;
      }
      .archived-card {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 16px;
        padding: 13px;
        border: 1px solid var(--line);
        border-radius: 12px;
        background: #fff;
      }
      .archived-card-main {
        min-width: 0;
      }
      .archived-card-title {
        font-weight: 750;
        overflow-wrap: anywhere;
      }
      .archived-card-meta {
        color: var(--muted);
        font-size: 12px;
        margin-top: 4px;
      }
      .archived-card-actions {
        display: flex;
        align-items: center;
        gap: 8px;
        flex: 0 0 auto;
      }
      .archive-empty {
        padding: 32px 18px;
        text-align: center;
        border: 1px dashed #d8d9e5;
        border-radius: 12px;
        color: var(--muted);
      }
      .archive-empty strong {
        display: block;
        color: var(--ink);
        margin-bottom: 4px;
      }
      @media (max-width: 600px) {
        .archive-modal {
          padding: 16px;
        }
        .archived-card {
          align-items: flex-start;
          flex-direction: column;
          gap: 10px;
        }
        .archived-card-actions {
          width: 100%;
        }
        .archived-card-actions .btn {
          flex: 1;
        }
      }
      .mobile-menu {
        display: none;
      }
      @media (max-width: 1050px) {
        .app {
          grid-template-columns: 205px 1fr;
        }
        .stats {
          grid-template-columns: repeat(2, 1fr);
        }
        main {
          padding: 23px;
        }
        .board {
          grid-template-columns: repeat(4, 240px);
        }
      }
      @media (max-width: 720px) {
        .owner-filter-wrap {
          align-items: flex-start;
          flex-direction: column;
          gap: 4px;
        }
        .owner-filter {
          min-width: 185px;
          max-width: 52vw;
          width: 100%;
          padding: 8px 28px 8px 9px;
        }
        .section-head:has(.owner-filter-wrap) {
          align-items: flex-start;
          gap: 12px;
        }
        .delivery-header {
          display: none !important;
        }
        .delivery-row {
          grid-template-columns: minmax(0, 1fr) auto !important;
          gap: 7px 12px;
        }
        .delivery-row > div:nth-child(1) {
          grid-column: 1;
          grid-row: 1;
        }
        .delivery-row > div:nth-child(2) {
          grid-column: 2;
          grid-row: 1;
          text-align: right;
          font-size: 12px;
        }
        .delivery-row > div:nth-child(3) {
          grid-column: 1;
          grid-row: 2;
          display: block !important;
        }
        .delivery-row > div:nth-child(4) {
          grid-column: 2;
          grid-row: 2;
          justify-self: end;
        }
        .app {
          display: block;
        }
        .sidebar {
          position: sticky;
          top: 0;
          z-index: 5;
          padding: 10px 12px;
          border-right: 0;
          border-bottom: 1px solid var(--line);
          gap: 10px;
        }
        .brand {
          font-size: 16px;
        }
        .logo {
          width: 29px;
          height: 29px;
        }
        .workspace,
        .side-bottom {
          display: none;
        }
        .nav {
          display: flex;
          overflow: auto;
        }
        .nav button {
          white-space: nowrap;
          padding: 8px 10px;
          font-size: 12px;
        }
        .nav .ico {
          font-size: 14px;
        }
        .nav button span:last-child {
          display: inline;
        }
        main {
          padding: 18px 14px;
        }
        .topbar {
          align-items: flex-start;
        }
        .topbar h1 {
          font-size: 22px;
        }
        .actions {
          flex-wrap: wrap;
          justify-content: flex-end;
        }
        .actions .btn {
          padding: 8px 10px;
          font-size: 12px;
        }
        .hero {
          padding: 18px;
        }
        .hero .heroicon {
          display: none;
        }
        .stats {
          gap: 9px;
        }
        .stat {
          padding: 13px;
        }
        .num {
          font-size: 24px;
        }
        .project-row {
          grid-template-columns: 1fr auto;
          gap: 7px;
        }
        .project-row > div:nth-child(3),
        .project-row > div:nth-child(4) {
          display: none;
        }
        .board-tools {
          align-items: stretch;
          flex-direction: column;
        }
        .board-tools input {
          max-width: none;
        }
        .cal-grid {
          grid-template-columns: repeat(7, minmax(38px, 1fr));
        }
        .day {
          min-height: 83px;
          padding: 4px;
        }
        .weekday {
          font-size: 9px;
          padding: 8px 1px;
        }
        .cal-event {
          font-size: 8px;
          padding: 3px;
        }
        .daynum {
          width: 22px;
          height: 22px;
        }
        .sharebox {
          flex-wrap: wrap;
        }
        .sharebox input {
          flex-basis: 100%;
        }
      }

      /* Editor de tarefa: painel dividido, mantendo rolagem dentro da janela */
      .modal.task-modal {
        width: min(820px, 100%);
        max-height: calc(100vh - 36px);
        overflow-y: auto;
        padding: 22px;
      }
      .task-editor-grid {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        gap: 18px;
        align-items: start;
      }
      .task-details-col,
      .task-context-col {
        min-width: 0;
      }
      .task-details-col .formgrid {
        gap: 11px;
      }
      .task-context-col {
        display: flex;
        flex-direction: column;
        gap: 12px;
      }
      .formgrid label,
      .briefing-wrap {
        font-size: 12px;
        color: var(--muted);
        display: grid;
        gap: 6px;
        min-width: 0;
      }
      .briefing-wrap textarea {
        width: 100%;
        min-height: 172px;
        height: 20vh;
        max-height: 250px;
        resize: vertical;
        line-height: 1.5;
      }
      .asset-section {
        border: 1px solid var(--line);
        border-radius: 11px;
        padding: 10px;
        min-width: 0;
      }
      .asset-section-head {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 8px;
        margin-bottom: 8px;
      }
      .asset-section-title {
        font-size: 12px;
        font-weight: 750;
        color: var(--ink);
      }
      .asset-section-hint {
        color: var(--muted);
        font-size: 10px;
        margin-top: 2px;
      }
      .asset-action {
        white-space: nowrap;
        padding: 6px 9px !important;
        font-size: 11px !important;
      }
      .asset-list {
        display: grid;
        gap: 6px;
        max-height: 94px;
        overflow-y: auto;
        min-width: 0;
      }
      .asset-empty {
        font-size: 11px;
        color: var(--muted);
        padding: 5px 0;
      }
      .asset-row {
        display: flex;
        align-items: center;
        gap: 6px;
        padding: 6px 7px;
        border-radius: 7px;
        background: #f4f5f7;
        min-width: 0;
      }
      .asset-name {
        flex: 1;
        min-width: 0;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
        text-align: left;
        background: transparent;
        color: var(--ink);
        font-size: 11px;
        padding: 0;
        text-decoration: none;
      }
      .asset-name.link {
        color: var(--purple);
      }
      .asset-size {
        font-size: 10px;
        color: var(--muted);
        white-space: nowrap;
        flex: 0 0 auto;
      }
      .asset-remove {
        background: transparent;
        color: #8b8da0;
        padding: 0 3px;
        font-size: 16px;
        line-height: 1.2;
        flex: 0 0 auto;
      }
      .asset-remove:hover {
        color: var(--red);
      }
      .url-add-row {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 6px;
        margin-bottom: 8px;
      }
      .url-add-row input {
        padding: 8px 9px;
        font-size: 11px;
        min-width: 0;
      }
      .task-modal .modal-actions {
        position: sticky;
        bottom: -22px;
        background: #fff;
        padding-top: 12px;
        padding-bottom: 2px;
        margin-top: 14px;
      }
      .task-storage-note {
        color: var(--muted);
        font-size: 10px;
        line-height: 1.4;
        margin-top: 2px;
      }
      @media (max-width: 720px) {
        .modal.task-modal {
          max-height: calc(100vh - 20px);
          padding: 17px;
        }
        .task-editor-grid {
          grid-template-columns: 1fr;
          gap: 14px;
        }
        .briefing-wrap textarea {
          height: 145px;
          min-height: 120px;
        }
        .task-modal .modal-actions {
          bottom: -17px;
        }
      }

      .owner-chat-btn {
        background: var(--purple2);
        color: var(--purple);
        border-radius: 999px;
        padding: 5px 9px;
        font-size: 11px;
        font-weight: 800;
        max-width: 125px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
      .owner-chat-btn:hover {
        background: var(--purple);
        color: #fff;
      }
      .task-card-top {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 8px;
        position: relative;
      }
      .owner-picker-wrap {
        position: relative;
        min-width: 0;
      }
      .owner-name-pill {
        display: inline-flex;
        align-items: center;
        gap: 5px;
        max-width: 180px;
        padding: 6px 10px;
        border-radius: 999px;
        background: var(--purple2);
        color: var(--purple);
        font-size: 11px;
        font-weight: 800;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        border: 1px solid transparent;
        cursor: pointer;
      }
      .owner-name-pill:hover,
      .owner-name-pill[aria-expanded="true"] {
        background: var(--purple);
        color: #fff;
      }
      .owner-picker-menu {
        position: absolute;
        z-index: 25;
        top: calc(100% + 7px);
        left: 0;
        width: 220px;
        max-width: min(240px, calc(100vw - 44px));
        padding: 6px;
        background: #fff;
        border: 1px solid var(--line);
        border-radius: 12px;
        box-shadow: 0 12px 34px #172b4d24;
        max-height: 255px;
        overflow: auto;
      }
      .owner-picker-option {
        display: block;
        width: 100%;
        text-align: left;
        padding: 8px 9px;
        border-radius: 7px;
        background: transparent;
        color: var(--ink);
        font-size: 12px;
        white-space: normal;
        overflow-wrap: anywhere;
      }
      .owner-picker-option:hover,
      .owner-picker-option.selected {
        background: var(--purple2);
        color: var(--purple);
      }
      .owner-picker-custom {
        display: flex;
        gap: 5px;
        border-top: 1px solid var(--line);
        padding: 7px 2px 1px;
        margin-top: 5px;
      }
      .owner-picker-custom .field {
        width: 100%;
        min-width: 0;
        padding: 7px;
        font-size: 11px;
      }
      .owner-picker-custom button {
        flex: 0 0 30px;
        border-radius: 7px;
        background: var(--purple);
        color: #fff;
        font-weight: 800;
      }
      .task-chat-icon-btn {
        display: inline-grid;
        place-items: center;
        width: 29px;
        height: 29px;
        flex: 0 0 29px;
        border-radius: 9px;
        background: var(--purple2);
        color: var(--purple);
        border: 1px solid #e6e1ff;
      }
      .task-chat-icon-btn:hover {
        background: var(--purple);
        color: #fff;
      }
      .task-chat-icon-btn svg {
        width: 15px;
        height: 15px;
        display: block;
      }
      .task-card-left-actions {
        display: flex;
        align-items: center;
        gap: 6px;
        min-width: 0;
      }
      .task-card-left-actions .owner-picker-wrap {
        flex: 0 1 auto;
      }
      .task-card-left-actions .task-chat-icon-btn {
        width: 27px;
        height: 27px;
        flex-basis: 27px;
      }
      .task-todo-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 5px;
        min-height: 29px;
        padding: 5px 10px;
        border-radius: 9px;
        background: var(--purple2);
        border: 1px solid #c1dbf0;
        color: var(--purple);
        font-size: 11px;
        font-weight: 800;
      }
      .task-todo-btn:hover {
        background: var(--purple);
        color: #fff;
      }
      .task-todo-btn svg {
        width: 14px;
        height: 14px;
        display: block;
      }
      .todo-focus-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        z-index: 1000;
        background: rgba(20, 22, 42, 0.62);
        backdrop-filter: blur(2px);
        align-items: center;
        justify-content: center;
        padding: 18px;
      }
      .todo-focus-backdrop.show {
        display: flex;
      }
      .todo-focus-modal {
        width: min(620px, 100%);
        max-height: min(82vh, 760px);
        display: flex;
        flex-direction: column;
        background: #fff;
        border: 1px solid #dcd7ff;
        border-radius: 20px;
        box-shadow: 0 25px 85px #090a1f55;
        overflow: hidden;
        animation: todoPop 0.16s ease-out;
      }
      .todo-focus-head {
        padding: 20px 22px 15px;
        border-bottom: 1px solid var(--line);
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 16px;
      }
      .todo-focus-eyebrow {
        font-size: 10px;
        letter-spacing: 0.08em;
        color: var(--purple);
        font-weight: 850;
        margin-bottom: 5px;
      }
      .todo-focus-title {
        font-size: 20px;
        line-height: 1.25;
        margin: 0;
        font-weight: 850;
        overflow-wrap: anywhere;
      }
      .todo-focus-project {
        margin-top: 6px;
        font-size: 12px;
        color: var(--muted);
      }
      .todo-focus-list {
        padding: 14px 22px;
        overflow: auto;
        min-height: 100px;
        max-height: 42vh;
      }
      .todo-item {
        display: flex;
        align-items: flex-start;
        gap: 10px;
        padding: 10px 0;
        border-bottom: 1px solid #f0f0f6;
      }
      .todo-item:last-child {
        border-bottom: 0;
      }
      .todo-item input[type="checkbox"] {
        accent-color: var(--purple);
        width: 16px;
        height: 16px;
        margin: 2px 0 0;
        flex: 0 0 auto;
      }
      .todo-item-text {
        flex: 1;
        min-width: 0;
        font-size: 13px;
        line-height: 1.45;
        overflow-wrap: anywhere;
      }
      .todo-item.done .todo-item-text {
        color: var(--muted);
        text-decoration: line-through;
      }
      .todo-remove {
        background: transparent;
        color: #9295a8;
        border-radius: 7px;
        padding: 2px 6px;
        font-size: 17px;
        line-height: 1.3;
      }
      .todo-remove:hover {
        background: #fff0f1;
        color: var(--red);
      }
      .todo-empty {
        padding: 22px 8px;
        color: var(--muted);
        font-size: 12px;
        text-align: center;
      }
      .todo-focus-compose {
        padding: 0 22px 18px;
        display: flex;
        gap: 8px;
      }
      .todo-focus-compose input {
        flex: 1;
        min-width: 0;
      }
      .todo-focus-foot {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 14px 22px;
        background: #fafbfc;
        border-top: 1px solid var(--line);
      }
      .todo-save-note {
        font-size: 11px;
        color: var(--muted);
      }
      .todo-focus-foot .btn {
        white-space: nowrap;
      }
      .todo-focus-backdrop input,
      .todo-focus-backdrop button {
        font: inherit;
      }
      .todo-focus-backdrop .btn.primary {
        background: var(--purple);
        color: #fff;
      }
      @keyframes todoPop {
        from {
          opacity: 0;
          transform: translateY(8px) scale(0.985);
        }
        to {
          opacity: 1;
          transform: translateY(0) scale(1);
        }
      }
      @media (max-width: 600px) {
        .todo-focus-backdrop {
          padding: 10px;
        }
        .todo-focus-head {
          padding: 17px 16px 13px;
        }
        .todo-focus-title {
          font-size: 17px;
        }
        .todo-focus-list {
          padding: 10px 16px;
          max-height: 38vh;
        }
        .todo-focus-compose {
          padding: 0 16px 14px;
          flex-wrap: wrap;
        }
        .todo-focus-compose button {
          flex: 0 0 auto;
        }
        .todo-focus-foot {
          padding: 12px 16px;
        }
        .todo-save-note {
          font-size: 10px;
        }
      }
      .chat-context {
        font-size: 11px;
        color: var(--muted);
        background: #f4f5f7;
        border: 1px solid #e5e0ff;
        border-radius: 8px;
        padding: 8px 10px;
        margin-top: 9px;
        overflow-wrap: anywhere;
      }
      .chat-context strong {
        color: var(--purple);
      }
      .chat-reference-link {
        display: inline;
        text-align: left;
        padding: 0;
        background: transparent;
        border: 0;
        color: var(--purple);
        font: inherit;
        cursor: pointer;
        text-decoration: underline;
        text-decoration-color: #c7bfff;
        text-underline-offset: 2px;
      }
      .chat-reference-link:hover {
        color: #4e42bf;
        text-decoration-color: currentColor;
      }
      .chat-context .chat-reference-link {
        font-size: inherit;
      }
      .chat-context .chat-reference-hint {
        font-size: 10px;
        color: var(--muted);
      }
      .chat-msg .msg-ref.chat-reference-link {
        display: block;
        margin: 0 0 3px;
        font-size: 10px;
        font-weight: 800;
        overflow-wrap: anywhere;
      }
      .chat-layout {
        display: grid;
        grid-template-columns: 250px minmax(0, 1fr);
        gap: 14px;
        min-height: 430px;
      }
      .chat-people h3 {
        margin: 0 0 12px;
      }
      .chat-person {
        display: block;
        width: 100%;
        text-align: left;
        background: transparent;
        padding: 10px;
        border-radius: 9px;
        color: var(--ink);
        margin-bottom: 4px;
      }
      .chat-person.active,
      .chat-person:hover {
        background: var(--purple2);
        color: var(--purple);
      }
      .chat-person small {
        display: block;
        color: var(--muted);
        margin-top: 2px;
      }
      .chat-main {
        display: flex;
        flex-direction: column;
        min-height: 430px;
      }
      .chat-title {
        font-weight: 800;
        border-bottom: 1px solid var(--line);
        padding-bottom: 12px;
      }
      .chat-messages {
        flex: 1;
        overflow: auto;
        padding: 14px 0;
        display: flex;
        flex-direction: column;
        gap: 9px;
        min-height: 280px;
      }
      .chat-msg {
        max-width: 85%;
        background: #f3f2ff;
        border-radius: 12px;
        padding: 9px 12px;
        align-self: flex-start;
        overflow-wrap: anywhere;
      }
      .chat-msg .msg-ref {
        font-size: 10px;
        color: var(--purple);
        font-weight: 800;
        display: block;
        margin-bottom: 3px;
      }
      .chat-msg time {
        display: block;
        font-size: 10px;
        color: var(--muted);
        margin-top: 4px;
      }
      .chat-compose {
        display: flex;
        gap: 8px;
        border-top: 1px solid var(--line);
        padding-top: 12px;
      }
      .chat-compose input {
        flex: 1;
        min-width: 0;
      }
      .history-item {
        display: grid;
        grid-template-columns: 12px 1fr;
        gap: 10px;
        padding: 12px 0;
        border-bottom: 1px solid var(--line);
      }
      .history-dot {
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background: var(--purple);
        margin-top: 6px;
      }
      .history-item small {
        display: block;
        color: var(--muted);
        margin-top: 3px;
      }
      .login-screen {
        position: fixed;
        inset: 0;
        z-index: 1000;
        background: var(--bg);
        display: grid;
        place-items: center;
        padding: 20px;
      }
      .login-card {
        width: min(380px, 100%);
        background: #fff;
        border: 1px solid var(--line);
        border-radius: 20px;
        padding: 30px;
        box-shadow: 0 20px 70px #172b4d18;
        display: flex;
        flex-direction: column;
        gap: 12px;
      }
      .login-logo {
        width: 42px;
        height: 42px;
      }
      .login-card h1 {
        margin: 6px 0 0;
        font-size: 24px;
      }
      .login-card p {
        margin: 0;
        color: var(--muted);
      }
      .login-error {
        font-size: 12px;
        color: var(--red);
        min-height: 16px;
      }
      .login-card button {
        width: 100%;
        padding: 12px;
      }
      @media (max-width: 760px) {
        .chat-layout {
          grid-template-columns: 1fr;
        }
        .chat-people {
          max-height: 180px;
          overflow: auto;
        }
        .chat-main {
          min-height: 360px;
        }
      }
      .owner-filter-wrap {
        display: flex;
        align-items: center;
        gap: 9px;
        color: var(--muted);
        font-size: 12px;
        font-weight: 700;
      }
      .owner-filter {
        min-width: 205px;
        max-width: 280px;
        padding: 10px 34px 10px 12px;
        border: 1px solid var(--line);
        border-radius: 10px;
        background: #fff;
        color: var(--ink);
        font-weight: 650;
        cursor: pointer;
        box-shadow: var(--shadow);
      }
      .owner-filter:focus-visible {
        outline: 3px solid #4bbfdb;
        outline-offset: 2px;
      }
      .delivery-header {
        display: none;
      }
      @media (max-width: 760px) {
        #accessNotesList .project-row {
          grid-template-columns: 1fr !important;
        }
      }

      /* Notas: linhas clicáveis para edição inline dos quatro campos */
      #accessNotesList {
        padding: 8px 14px;
      }
      .access-note-row {
        display: grid;
        grid-template-columns: minmax(130px, 1fr) minmax(130px, 1fr) minmax(110px, 0.85fr) minmax(160px, 1.35fr) auto;
        gap: 16px;
        align-items: center;
        padding: 19px 8px;
        border-bottom: 1px solid var(--line);
        border-radius: 10px;
        transition:
          background 0.15s,
          border-color 0.15s;
        min-width: 0;
      }
      .access-note-row:last-child {
        border-bottom: 0;
      }
      .access-note-display {
        cursor: pointer;
        border: 1px solid transparent;
      }
      .access-note-display:hover,
      .access-note-display:focus-visible {
        background: #fafbfc;
        border-color: #ded9ff;
        outline: none;
      }
      .access-note-display .project-title {
        overflow-wrap: anywhere;
      }
      .access-note-field {
        min-width: 0;
        display: grid;
        gap: 5px;
      }
      .access-note-label {
        font-size: 11px;
        color: var(--muted);
      }
      .access-note-field .field {
        width: 100%;
        min-width: 0;
      }
      .access-note-actions {
        display: flex;
        gap: 7px;
        justify-content: flex-end;
        align-items: center;
      }
      .access-note-empty {
        padding: 22px 8px;
        color: var(--muted);
      }
      @media (max-width: 900px) {
        .access-note-row {
          grid-template-columns: repeat(2, minmax(0, 1fr));
          gap: 12px;
        }
        .access-note-actions {
          grid-column: 1/-1;
          justify-content: flex-end;
        }
      }
      @media (max-width: 520px) {
        .access-note-row {
          grid-template-columns: minmax(0, 1fr);
        }
        .access-note-actions {
          grid-column: auto;
        }
      }

      .workspace {
        display: block;
      }
      .workspace-switcher {
        display: block;
        width: 100%;
        margin-top: 4px;
        border: 0;
        background: transparent;
        color: var(--ink);
        font-weight: 750;
        font-size: 13px;
        outline: none;
        cursor: pointer;
        padding: 0 16px 0 0;
        appearance: auto;
      }
      .workspace-switcher:focus-visible {
        outline: 2px solid #4bbfdb;
        outline-offset: 3px;
        border-radius: 4px;
      }
      .finance-nav {
        border-top: 1px solid var(--line);
        padding-top: 12px;
      }
      .finance-content h2 {
        margin: 0;
        font-size: 20px;
        letter-spacing: -0.4px;
      }
      .finance-intro {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 16px;
        margin: 0 0 18px;
      }
      .finance-receivable-total {
        display: flex;
        align-items: center;
        gap: 12px;
        margin-right: auto;
        margin-left: 0;
        padding: 12px 18px;
        border: 1px solid #c1dbf0;
        border-radius: 12px;
        background: #e4f0f6;
        min-width: 260px;
      }
      .finance-receivable-total-label {
        font-size: 12px;
        font-weight: 750;
        color: #5e6c84;
      }
      .finance-receivable-total-value {
        font-size: 23px;
        font-weight: 850;
        letter-spacing: -0.5px;
        color: var(--purple);
        font-variant-numeric: tabular-nums;
      }
      .finance-actions-only {
        justify-content: flex-start;
      }
      .finance-actions-only [data-fin-new-contract] {
        margin-left: auto;
      }
      .finance-intro p {
        margin: 5px 0 0;
        color: var(--muted);
        font-size: 12px;
        max-width: 760px;
      }
      .finance-kpis {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 12px;
        margin: 0 0 18px;
      }
      .finance-kpi {
        background: #fff;
        border: 1px solid var(--line);
        border-radius: 14px;
        padding: 16px;
        box-shadow: var(--shadow);
        min-width: 0;
      }
      .finance-kpi-label {
        font-size: 11px;
        color: var(--muted);
        font-weight: 700;
      }
      .finance-kpi-value {
        font-size: 23px;
        letter-spacing: -0.7px;
        font-weight: 850;
        margin-top: 7px;
        overflow-wrap: anywhere;
      }
      .finance-kpi-note {
        color: var(--muted);
        font-size: 11px;
        margin-top: 4px;
      }
      .finance-kpi-value.red {
        color: var(--red);
      }
      .finance-alert {
        background: #fff8ee;
        border: 1px solid #f4dbb8;
        color: #8a541e;
        border-radius: 12px;
        padding: 13px 15px;
        margin: 0 0 18px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 14px;
      }
      .finance-alert strong {
        display: block;
        color: #8a541e;
      }
      .finance-alert p {
        font-size: 12px;
        margin: 3px 0 0;
      }
      .finance-table-panel {
        padding: 0;
        overflow: hidden;
      }
      .finance-filterbar {
        display: flex;
        gap: 10px;
        align-items: center;
        margin-bottom: 13px;
      }
      .finance-filterbar input {
        flex: 1;
        min-width: 170px;
      }
      .finance-filterbar select {
        width: 175px;
      }
      .finance-row-count {
        font-size: 11px;
        color: var(--muted);
        white-space: nowrap;
      }
      .finance-scroll {
        overflow: auto;
        max-width: 100%;
      }
      .finance-table {
        width: 100%;
        border-collapse: collapse;
        min-width: 860px;
      }
      .finance-table th,
      .finance-table td {
        padding: 11px 12px;
        text-align: left;
        vertical-align: top;
        border-bottom: 1px solid var(--line);
        font-size: 12px;
      }
      .finance-table th {
        font-size: 10px;
        letter-spacing: 0.03em;
        color: var(--muted);
        background: #fafbfc;
        white-space: nowrap;
      }
      .finance-table tr:last-child td {
        border-bottom: 0;
      }
      .finance-table td.numeric,
      .finance-table th.numeric {
        text-align: right;
        white-space: nowrap;
        font-variant-numeric: tabular-nums;
      }
      .finance-primary {
        font-weight: 750;
        overflow-wrap: anywhere;
      }
      .finance-secondary {
        font-size: 11px;
        color: var(--muted);
        margin-top: 3px;
        white-space: pre-line;
        max-width: 400px;
      }
      .finance-status {
        display: inline-flex;
        align-items: center;
        padding: 4px 7px;
        border-radius: 20px;
        background: #e7f7f0;
        color: #519839;
        font-size: 10px;
        font-weight: 800;
        white-space: nowrap;
      }
      .finance-status.pending {
        background: #fff2e4;
        color: #c27627;
      }
      .finance-status.forgiven {
        background: #cffafe;
        color: #0e7490;
      }
      .finance-status.review {
        background: #fff0f1;
        color: #b04632;
      }
      .finance-inconsistency {
        font-size: 10px;
        color: var(--red);
        font-weight: 700;
        margin-top: 4px;
      }
      .finance-actions {
        display: flex;
        gap: 6px;
        align-items: center;
        white-space: nowrap;
      }
      .finance-billing-cards {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
        margin-bottom: 18px;
      }
      .finance-billing-card {
        background: #fff;
        border: 1px solid var(--line);
        border-radius: 14px;
        padding: 16px;
      }
      .finance-billing-card-head {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 10px;
      }
      .finance-billing-year {
        font-size: 17px;
        font-weight: 850;
      }
      .finance-billing-total {
        font-size: 11px;
        color: var(--muted);
        margin-top: 4px;
      }
      .finance-billing-remaining {
        font-size: 17px;
        font-weight: 850;
        margin-top: 12px;
      }
      .finance-billing-remaining.red {
        color: var(--red);
      }
      .finance-progress {
        height: 7px;
        background: #eeeef5;
        border-radius: 8px;
        overflow: hidden;
        margin-top: 11px;
      }
      .finance-progress span {
        height: 100%;
        display: block;
        background: var(--purple);
        border-radius: 8px;
      }
      .finance-progress span.over {
        background: var(--red);
      }
      .finance-month-table {
        border-collapse: collapse;
        min-width: 1080px;
        width: 100%;
      }
      .finance-month-table th,
      .finance-month-table td {
        padding: 10px 8px;
        border-bottom: 1px solid var(--line);
        text-align: center;
        font-size: 11px;
      }
      .finance-month-table th {
        color: var(--muted);
        background: #fafbfc;
      }
      .finance-month-table th:first-child,
      .finance-month-table td:first-child {
        text-align: left;
        font-weight: 800;
        min-width: 100px;
      }
      .finance-month-table input {
        width: 79px;
        max-width: 100%;
        text-align: right;
        padding: 7px;
        border: 1px solid var(--line);
        border-radius: 7px;
        background: #fff;
        font: inherit;
        color: var(--ink);
      }
      .finance-month-table input:focus {
        outline: 2px solid #4bbfdb;
      }
      .finance-month-table .limit-input {
        width: 108px;
      }
      .finance-expense-row {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 180px 115px;
        gap: 14px;
        align-items: center;
        padding: 12px 16px;
        border-bottom: 1px solid var(--line);
      }
      .finance-expense-row:last-child {
        border-bottom: 0;
      }
      .finance-expense-row input {
        width: 100%;
        min-width: 0;
      }
      .finance-expense-total {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 15px;
      }
      .finance-contract-modal {
        width: min(760px, 100%);
        max-height: calc(100vh - 32px);
        overflow: auto;
      }
      .finance-contract-fields {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
      }
      .finance-contract-fields label {
        display: grid;
        gap: 6px;
        font-size: 12px;
        color: var(--muted);
      }
      .finance-contract-fields .finance-contract-service {
        grid-column: 1/-1;
      }
      .finance-contract-fields textarea {
        resize: vertical;
      }
      .finance-installments-grid {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 8px;
      }
      .finance-installments-grid label {
        display: grid;
        gap: 4px;
        font-size: 11px;
        color: var(--muted);
      }
      .finance-installments-grid input {
        min-width: 0;
        width: 100%;
        padding: 8px;
        border: 1px solid var(--line);
        border-radius: 8px;
      }
      .finance-inline-status {
        font-size: 11px;
        color: var(--muted);
      }
      @media (max-width: 1050px) {
        .finance-kpis {
          grid-template-columns: repeat(2, minmax(0, 1fr));
        }
        .finance-billing-cards {
          grid-template-columns: 1fr;
        }
        .finance-expense-row {
          grid-template-columns: minmax(0, 1fr) 140px 100px;
        }
      }
      @media (max-width: 680px) {
        .finance-intro {
          align-items: flex-start;
          flex-direction: column;
        }
        .finance-filterbar {
          flex-wrap: wrap;
        }
        .finance-filterbar input {
          flex-basis: 100%;
        }
        .finance-filterbar select {
          flex: 1;
        }
        .finance-kpis {
          grid-template-columns: repeat(2, minmax(0, 1fr));
        }
        .finance-kpi-value {
          font-size: 18px;
        }
        .finance-contract-fields {
          grid-template-columns: 1fr;
        }
        .finance-contract-fields .finance-contract-service {
          grid-column: auto;
        }
        .finance-installments-grid {
          grid-template-columns: repeat(3, minmax(0, 1fr));
        }
        .finance-expense-row {
          grid-template-columns: 1fr;
          gap: 7px;
        }
        .finance-alert {
          align-items: flex-start;
          flex-direction: column;
        }
      }

      /* Melhorias da tabela de contratos e recebimentos */
      .finance-status-select {
        appearance: auto;
        border: 1px solid #eadfff;
        border-radius: 999px;
        padding: 6px 9px;
        background: #fff8ee;
        color: #b96b20;
        font: inherit;
        font-size: 11px;
        font-weight: 800;
        cursor: pointer;
        max-width: 125px;
      }
      .finance-status-select[data-status="Pago"] {
        background: #e7f7f0;
        color: #519839;
        border-color: #d3f1d9;
      }
      .finance-status-select:focus {
        outline: 2px solid #4bbfdb;
        outline-offset: 2px;
      }
      .finance-service-cell {
        background: #f4f5f7;
        border-left: 0;
        border-radius: 8px;
        padding: 9px 11px !important;
        min-width: 190px;
        max-width: 330px;
        color: #4d438e;
        font-weight: 650;
        white-space: pre-line;
        line-height: 1.45;
      }
      .finance-installment-open {
        white-space: nowrap;
        color: var(--purple);
        background: #e4f0f6;
        border: 1px solid #e1dbff;
        border-radius: 9px;
        padding: 7px 9px;
        font-size: 11px;
        font-weight: 800;
        min-width: 88px;
        max-width: 104px;
        text-align: center;
        line-height: 1.2;
      }
      .finance-installment-open:hover {
        background: var(--purple);
        color: #fff;
      }
      .finance-installments-modal {
        width: min(760px, 100%);
        max-height: calc(100vh - 32px);
        overflow: auto;
      }
      .finance-installment-row {
        display: grid;
        grid-template-columns: 74px minmax(110px, 0.7fr) minmax(180px, 1.3fr) 34px;
        gap: 9px;
        align-items: center;
        padding: 10px 0;
        border-bottom: 1px solid var(--line);
      }
      .finance-installment-row label {
        font-size: 11px;
        color: var(--muted);
        display: grid;
        gap: 5px;
        min-width: 0;
      }
      .finance-installment-row input {
        width: 100%;
        min-width: 0;
      }
      .finance-installment-number {
        font-weight: 800;
        color: var(--purple);
        font-size: 12px;
      }
      .finance-installment-remove {
        background: #fff0f1;
        color: #b04632;
        border-radius: 8px;
        padding: 7px;
      }
      .finance-installment-empty {
        padding: 22px;
        text-align: center;
        color: var(--muted);
      }
      @media (max-width: 650px) {
        .finance-installment-row {
          grid-template-columns: 50px minmax(90px, 1fr) minmax(130px, 1.3fr) 30px;
          gap: 6px;
        }
        .finance-installment-row .field {
          padding: 7px;
          font-size: 11px;
        }
      }

      .finance-overview-actions {
        justify-content: flex-end;
        margin-bottom: 0;
      }
      .finance-row-pending td {
        background: #fffaf2;
      }
      .finance-row-pending td:first-child {
        box-shadow: inset 3px 0 0 #e6a04b;
      }
      .finance-group-row td {
        padding: 10px 12px;
        background: #f5f3ff;
        color: #0079bf;
        border-bottom: 1px solid #e4e0ff;
        font-size: 11px;
        font-weight: 850;
        letter-spacing: 0.04em;
        text-transform: uppercase;
      }
      .finance-group-row.pending td {
        background: #fff1dc;
        color: #9c5b12;
        border-bottom-color: #f2d6ad;
      }
      .finance-group-row.forgiven td {
        background: #cffafe;
        color: #0e7490;
        border-bottom-color: #a5f3fc;
      }
      .finance-group-row .finance-group-count {
        float: right;
        text-transform: none;
        letter-spacing: 0;
        font-weight: 700;
        color: var(--muted);
      }
      .finance-row-pending .finance-status-select {
        background: #fff0d8;
        border: 1px solid #f0bf7d;
        color: #9d5a10;
        font-weight: 850;
      }
      .finance-installment-row {
        grid-template-columns: 74px minmax(110px, 0.7fr) 84px minmax(180px, 1.3fr) 34px;
      }
      .finance-installment-received {
        display: flex !important;
        align-items: center;
        gap: 6px;
        white-space: nowrap;
        color: #5c6380 !important;
      }
      .finance-installment-received input {
        width: 15px !important;
        height: 15px;
        accent-color: var(--purple);
      }
      .finance-installment-received span {
        font-size: 11px;
        font-weight: 750;
      }
      @media (max-width: 650px) {
        .finance-installment-row {
          grid-template-columns: 50px minmax(85px, 0.7fr) 74px minmax(120px, 1.3fr) 28px;
          gap: 6px;
        }
      }

      .finance-actions-only {
        display: flex;
        justify-content: flex-end;
        align-items: center;
        margin-bottom: 14px;
      }
      .finance-service-cell {
        border-left: 0 !important;
        background: transparent !important;
        color: var(--text);
        padding-left: 12px !important;
      }
      .finance-installment-open {
        padding: 7px 10px !important;
        min-height: 34px !important;
        font-size: 12px !important;
        line-height: 1.1 !important;
        border-radius: 10px !important;
        white-space: nowrap;
      }
      .finance-expenses-intro {
        align-items: flex-end;
        gap: 18px;
      }
      .finance-expense-toolbar {
        display: flex;
        align-items: flex-end;
        justify-content: flex-end;
        gap: 8px;
        flex-wrap: wrap;
      }
      .finance-year-control {
        display: grid;
        gap: 4px;
        color: var(--muted);
        font-size: 11px;
        font-weight: 750;
      }
      .finance-year-control .field {
        min-width: 105px;
      }
      .finance-month-tabs {
        display: flex;
        gap: 7px;
        flex-wrap: wrap;
        margin: 14px 0 18px;
      }
      .finance-month-tab {
        border: 1px solid var(--line);
        background: white;
        color: var(--muted);
        border-radius: 11px;
        padding: 8px 12px;
        font-size: 12px;
        font-weight: 750;
        cursor: pointer;
      }
      .finance-month-tab.active {
        background: var(--purple-light);
        border-color: #b3d4e0;
        color: var(--purple);
        box-shadow: inset 0 0 0 1px #b3d4e0;
      }
      .finance-expense-section {
        margin-top: 19px;
      }
      .finance-expense-section .section-head {
        align-items: baseline;
        gap: 10px;
        flex-wrap: wrap;
      }
      .finance-expense-section .section-head h3 {
        margin: 0;
      }
      .finance-expense-list {
        border: 1px solid var(--line);
        background: white;
        border-radius: 15px;
        overflow: hidden;
      }
      .finance-month-expense-row {
        display: grid;
        grid-template-columns: 110px minmax(150px, 1fr) 145px 150px 170px;
        gap: 10px;
        align-items: center;
        padding: 11px 13px;
        border-bottom: 1px solid var(--line);
      }
      .finance-month-expense-row:last-child {
        border-bottom: 0;
      }
      .finance-month-expense-row input.field {
        width: 100%;
        min-width: 0;
      }
      .finance-expense-paid {
        display: flex;
        align-items: center;
        gap: 7px;
        color: var(--muted);
        font-size: 12px;
        font-weight: 700;
        white-space: nowrap;
      }
      .finance-expense-paid input {
        accent-color: var(--purple);
      }
      .finance-expense-row-actions {
        display: flex;
        gap: 6px;
        justify-content: flex-end;
      }
      .finance-expense-list .empty {
        padding: 16px;
      }
      .finance-expense-kpi-grid {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 12px;
      }
      #financeExpenseKpis {
        display: block;
        width: 100%;
        min-width: 0;
      }
      #financeExpenseKpis .finance-expense-kpi-grid {
        width: 100%;
        grid-template-columns: repeat(3, minmax(220px, 1fr));
      }
      .finance-expense-kpi-grid .finance-kpi {
        min-width: 0;
      }
      .finance-variable-expense-row {
        display: grid;
        grid-template-columns: minmax(130px, 1fr) 130px 150px minmax(150px, 1.2fr) 150px;
        gap: 9px;
        align-items: center;
        padding: 11px 13px;
        border-bottom: 1px solid var(--line);
      }
      .finance-variable-expense-row:last-child {
        border-bottom: 0;
      }
      .finance-variable-expense-row input.field {
        min-width: 0;
        width: 100%;
      }
      .finance-employee-service {
        max-width: 330px;
        white-space: pre-wrap;
        overflow-wrap: anywhere;
        background: #f6f3ff;
        color: #244f6b;
        padding: 8px 10px;
        border-radius: 9px;
      }
      .finance-employee-installment-row {
        border: 1px solid var(--line);
        border-radius: 12px;
        padding: 12px;
        margin: 10px 0;
        display: grid;
        gap: 10px;
      }
      .finance-employee-installment-fields {
        display: grid;
        grid-template-columns: minmax(120px, 1fr) minmax(130px, 0.8fr) 110px 34px;
        gap: 8px;
        align-items: end;
      }
      .finance-employee-installment-fields label {
        display: grid;
        gap: 5px;
        font-size: 11px;
        color: var(--muted);
        font-weight: 750;
      }
      .finance-employee-installment-fields .field {
        min-width: 0;
        width: 100%;
      }
      .finance-employee-installment-note {
        display: grid;
        gap: 5px;
        font-size: 11px;
        color: var(--muted);
        font-weight: 750;
      }
      .finance-employee-installment-note textarea {
        min-height: 52px;
        resize: vertical;
      }
      .finance-row-pending td:first-child {
        background: #fffaf2;
      }
      .finance-status-select {
        font-weight: 800;
      }
      @media (max-width: 900px) {
        .finance-expenses-intro {
          align-items: stretch;
          flex-direction: column;
        }
        .finance-expense-toolbar {
          justify-content: flex-start;
        }
        .finance-month-expense-row {
          grid-template-columns: 100px minmax(120px, 1fr) 120px;
        }
        .finance-month-expense-row .finance-expense-row-actions {
          grid-column: 1/-1;
        }
        .finance-variable-expense-row {
          grid-template-columns: minmax(120px, 1fr) 120px 130px;
        }
        .finance-variable-expense-row .finance-variable-note {
          grid-column: 1/3;
        }
        .finance-variable-expense-row .finance-expense-row-actions {
          grid-column: 3;
        }
        .finance-employee-installment-fields {
          grid-template-columns: 1fr 1fr;
        }
        .finance-employee-installment-fields .finance-expense-paid {
          min-height: 36px;
        }
      }
      @media (max-width: 600px) {
        .finance-month-expense-row,
        .finance-variable-expense-row {
          grid-template-columns: 1fr;
          gap: 7px;
        }
        .finance-variable-expense-row .finance-variable-note,
        .finance-variable-expense-row .finance-expense-row-actions,
        .finance-month-expense-row .finance-expense-row-actions {
          grid-column: auto;
        }
        .finance-expense-row-actions {
          justify-content: flex-start;
        }
        .finance-expense-kpi-grid {
          grid-template-columns: 1fr;
        }
        .finance-employee-installment-fields {
          grid-template-columns: 1fr;
        }
        .finance-actions-only {
          margin-bottom: 10px;
        }
      }
      .finance-row-pending td:first-child {
        background: #fff6e9 !important;
      }
      .finance-row-pending .finance-status-select {
        border-color: #f1c58d !important;
        background: #fff4e4 !important;
        color: #9c560d !important;
        font-weight: 850 !important;
      }
      .finance-group-row.pending td {
        background: #fff2dc !important;
        color: #8d4b0c !important;
        font-weight: 900 !important;
      }
      .finance-group-row td {
        background: #f4f5f7;
        font-weight: 800;
      }

      .finance-expense-list-head {
        display: grid;
        gap: 10px;
        padding: 10px 13px;
        background: #fafbfc;
        border-bottom: 1px solid var(--line);
        color: var(--muted);
        font-size: 10px;
        letter-spacing: 0.025em;
        font-weight: 850;
      }
      .finance-recurring-head {
        grid-template-columns: 110px minmax(150px, 1fr) 145px 150px 170px;
      }
      .finance-variable-head {
        grid-template-columns: minmax(130px, 1fr) 130px 150px minmax(150px, 1.2fr) 150px;
      }
      @media (max-width: 900px) {
        .finance-month-expense-row {
          grid-template-columns: 100px minmax(120px, 1fr) 120px 140px;
        }
        .finance-month-expense-row .finance-expense-row-actions {
          grid-column: 1/-1;
        }
        .finance-recurring-head {
          grid-template-columns: 100px minmax(120px, 1fr) 120px 140px;
        }
        .finance-recurring-head span:last-child {
          grid-column: 1/-1;
        }
        .finance-variable-head {
          grid-template-columns: minmax(120px, 1fr) 120px 130px;
        }
        .finance-variable-head span:nth-child(4) {
          grid-column: 1/3;
        }
        .finance-variable-head span:last-child {
          grid-column: 3;
        }
      }
      @media (max-width: 600px) {
        .finance-recurring-head,
        .finance-variable-head {
          display: none;
        }
      }

      /* Contratos: destaque do saldo agregado e ícone de saída nas despesas fixas */
      #fin-receivables .finance-actions-only {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        min-height: 74px;
        margin-bottom: 14px;
        gap: 18px;
      }
      #fin-receivables .finance-receivable-total {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        align-items: center;
        justify-content: space-between;
        gap: 18px;
        flex: 0 1 auto;
        margin: 0 auto 0 0;
        padding: 13px 20px;
        min-width: 320px;
        max-width: min(560px, 70%);
        background: #e4f0f6;
        border: 1px solid #c1dbf0;
        border-radius: 14px;
      }
      #fin-receivables .finance-receivable-total-label {
        display: block;
        font-size: 13px;
        font-weight: 800;
        color: #0079bf;
      }
      #fin-receivables .finance-receivable-total-value {
        display: block;
        font-size: 25px;
        font-weight: 900;
        color: #0079bf;
        white-space: nowrap;
      }
      #fin-receivables [data-fin-new-contract] {
        flex: 0 0 auto;
        margin-left: auto;
      }
      @media (max-width: 650px) {
        #fin-receivables .finance-actions-only {
          align-items: stretch !important;
          flex-direction: column !important;
        }
        #fin-receivables .finance-receivable-total {
          max-width: none;
          width: 100%;
          min-width: 0;
        }
        #fin-receivables [data-fin-new-contract] {
          margin-left: 0;
          align-self: flex-end;
        }
      }
      /* Patrimônio total */
      .patrimony-total-box {
        background: linear-gradient(120deg, #e4f0f6, #fff);
        border: 1px solid #ddd6ff;
        border-radius: 16px;
        padding: 22px 24px;
        margin-bottom: 16px;
        box-shadow: var(--shadow);
      }
      .patrimony-total-label {
        display: flex;
        align-items: center;
        gap: 9px;
        color: #0079bf;
        font-size: 13px;
        font-weight: 800;
      }
      .patrimony-total-icon {
        display: grid;
        place-items: center;
        width: 30px;
        height: 30px;
        border-radius: 9px;
        background: #e8e2ff;
        font-size: 18px;
      }
      .patrimony-total-value {
        font-size: clamp(28px, 3.2vw, 38px);
        line-height: 1.15;
        font-weight: 900;
        letter-spacing: -1px;
        color: #0079bf;
        font-variant-numeric: tabular-nums;
        margin-top: 9px;
      }
      .patrimony-total-note {
        font-size: 12px;
        color: var(--muted);
        margin-top: 5px;
      }
      .patrimony-form-panel {
        margin-bottom: 16px;
      }
      .patrimony-form {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(180px, 0.45fr) auto;
        gap: 12px;
        align-items: end;
      }
      .patrimony-form label {
        display: grid;
        gap: 6px;
        font-size: 12px;
        color: var(--muted);
        font-weight: 700;
        min-width: 0;
      }
      .patrimony-form .field {
        width: 100%;
        min-width: 0;
      }
      .patrimony-form-actions {
        display: flex;
        align-items: center;
        gap: 8px;
        flex-wrap: wrap;
      }
      .patrimony-form-actions button {
        white-space: nowrap;
      }
      .patrimony-actions {
        display: flex;
        align-items: center;
        justify-content: flex-end;
        gap: 7px;
        white-space: nowrap;
      }
      .patrimony-actions .btn {
        min-width: 66px;
      }
      .patrimony-list-panel {
        padding: 17px;
      }
      .patrimony-row {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(150px, 0.4fr) auto;
        gap: 14px;
        align-items: center;
        padding: 13px 2px;
        border-bottom: 1px solid var(--line);
      }
      .patrimony-row:last-child {
        border-bottom: 0;
      }
      .patrimony-name {
        font-weight: 750;
        overflow-wrap: anywhere;
      }
      .patrimony-value {
        font-size: 14px;
        font-weight: 800;
        font-variant-numeric: tabular-nums;
        white-space: nowrap;
      }
      .patrimony-empty {
        padding: 23px 8px;
        text-align: center;
        color: var(--muted);
      }
      @media (max-width: 700px) {
        .patrimony-form {
          grid-template-columns: 1fr;
        }
        .patrimony-form button {
          justify-self: start;
        }
        .patrimony-row {
          grid-template-columns: minmax(0, 1fr) auto;
          gap: 8px;
        }
        .patrimony-row .patrimony-actions {
          grid-column: 1/-1;
        }
        .patrimony-total-box {
          padding: 18px;
        }
      }

      /* Campo de busca de contratos na faixa superior, entre o total e o botão de cadastro */
      #fin-receivables .finance-actions-only {
        display: flex !important;
        justify-content: stretch !important;
        align-items: center !important;
        gap: 18px;
      }
      #fin-receivables .finance-receivable-total {
        flex: 0 0 auto;
        max-width: 35%;
        margin: 0;
      }
      #fin-receivables .finance-receivable-search {
        display: block;
        flex: 1 1 340px;
        min-width: 180px;
        width: auto;
        height: 54px;
        margin: 0;
        background: #fff;
        border: 1px solid var(--line);
        border-radius: 12px;
        padding: 0 18px;
        font-size: 15px;
        box-sizing: border-box;
      }
      #fin-receivables [data-fin-new-contract] {
        flex: 0 0 auto;
        margin-left: 0;
        white-space: nowrap;
      }
      @media (max-width: 1050px) {
        #fin-receivables .finance-receivable-total {
          max-width: none;
          min-width: 0;
          flex: 0 0 auto;
        }
        #fin-receivables .finance-actions-only {
          flex-wrap: wrap;
        }
        #fin-receivables .finance-receivable-search {
          flex: 1 1 260px;
        }
      }
      @media (max-width: 650px) {
        #fin-receivables .finance-actions-only {
          align-items: stretch !important;
          flex-direction: column !important;
          flex-wrap: nowrap;
        }
        #fin-receivables .finance-receivable-total {
          max-width: none;
          width: 100%;
          min-width: 0;
          box-sizing: border-box;
        }
        #fin-receivables .finance-receivable-search {
          width: 100%;
          min-width: 0;
          flex: 0 0 auto;
        }
        #fin-receivables [data-fin-new-contract] {
          margin-left: 0;
          align-self: flex-end;
        }
      }

      /* Ajustes solicitados: totais dinâmicos, faturamento e navegação limpa */
      .finance-billing-header {
        justify-content: flex-end;
        align-items: center;
        margin-bottom: 14px;
      }
      .finance-employee-header {
        justify-content: flex-end;
        align-items: center;
        margin-bottom: 12px;
      }
      .finance-employee-filterbar {
        display: grid;
        grid-template-columns: max-content minmax(240px, 1fr) 175px auto;
        align-items: center;
        gap: 10px;
      }
      .finance-employee-filterbar #financeEmployeeSearch {
        width: 100%;
        min-width: 0;
      }
      .finance-employee-total {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 10px 14px;
        border: 1px solid #c1dbf0;
        border-radius: 12px;
        background: #e4f0f6;
        white-space: nowrap;
        min-width: 0;
      }
      .finance-employee-total-label {
        font-size: 12px;
        font-weight: 800;
        color: var(--purple);
      }
      .finance-employee-total-value {
        font-size: 18px;
        font-weight: 900;
        color: var(--purple);
        font-variant-numeric: tabular-nums;
      }
      .finance-row-paid td:first-child {
        background: #edf9f4 !important;
        box-shadow: inset 3px 0 0 #35a47e;
      }
      .finance-row-paid .finance-status-select[data-status="Pago"] {
        background: #e7f7f0 !important;
        color: #519839 !important;
        border-color: #d3f1d9 !important;
      }
      .finance-group-row.paid td {
        background: #e7f7f0 !important;
        color: #519839 !important;
        border-bottom: 1px solid #d3f1d9 !important;
      }
      @media (max-width: 1100px) {
        .finance-employee-filterbar {
          grid-template-columns: minmax(0, 1fr) 175px;
        }
        .finance-employee-total {
          grid-column: 1/-1;
          width: max-content;
          max-width: 100%;
        }
        .finance-employee-filterbar #financeEmployeeSearch {
          grid-column: 1;
          grid-row: 2;
        }
        .finance-employee-filterbar #financeEmployeeStatusFilter {
          grid-column: 2;
          grid-row: 2;
        }
        .finance-employee-filterbar #financeEmployeeCount {
          grid-column: 1/-1;
          grid-row: 3;
        }
      }
      @media (max-width: 680px) {
        .finance-employee-filterbar {
          grid-template-columns: 1fr;
        }
        .finance-employee-total,
        .finance-employee-filterbar #financeEmployeeSearch,
        .finance-employee-filterbar #financeEmployeeStatusFilter,
        .finance-employee-filterbar #financeEmployeeCount {
          grid-column: 1;
          grid-row: auto;
          width: 100%;
        }
        .finance-employee-total {
          justify-content: space-between;
        }
        .finance-employee-total-value {
          font-size: 17px;
        }
      }

      /* Fluxo atualizado: faturamento anual compacto, históricos e ações financeiras */
      .finance-billing-header {
        align-items: center;
        margin-bottom: 14px;
      }
      .finance-billing-actions {
        display: flex;
        align-items: center;
        gap: 8px;
        flex-wrap: wrap;
      }
      .finance-billing-cards {
        grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
        gap: 10px;
        margin-bottom: 14px;
      }
      .finance-billing-card {
        position: relative;
        cursor: pointer;
        padding: 13px 14px;
        border-radius: 13px;
        transition:
          border-color 0.15s,
          box-shadow 0.15s,
          background 0.15s;
        min-width: 0;
      }
      .finance-billing-card:hover {
        border-color: #d2cbff;
      }
      .finance-billing-card.selected {
        border-color: #b8adff;
        box-shadow:
          inset 0 0 0 1px #d8d0ff,
          0 5px 18px #0079bf10;
        background: #fafbfc;
      }
      .finance-billing-year {
        font-size: 16px;
        font-weight: 900;
      }
      .finance-billing-total {
        font-size: 11px;
        color: var(--muted);
        margin-top: 3px;
      }
      .finance-billing-card-head {
        padding-right: 20px;
        gap: 8px;
      }
      .finance-billing-card-head .finance-status {
        font-size: 9px;
        padding: 4px 6px;
      }
      .finance-billing-card-meta {
        display: flex;
        justify-content: space-between;
        align-items: baseline;
        gap: 8px;
        margin-top: 9px;
        color: var(--muted);
        font-size: 10px;
      }
      .finance-billing-card-meta strong {
        color: var(--ink);
        font-size: 11px;
        white-space: nowrap;
      }
      .finance-billing-card-meta .finance-billing-remaining {
        font-size: 13px;
        font-weight: 850;
        margin: 0;
        white-space: nowrap;
      }
      .finance-billing-card-meta small {
        font-size: 9px;
        font-weight: 600;
        color: var(--muted);
      }
      .finance-billing-delete {
        position: absolute;
        top: 8px;
        right: 8px;
        z-index: 1;
        width: 22px;
        height: 22px;
        border-radius: 7px;
        background: #fff0f1;
        color: #c34450;
        font-weight: 900;
        line-height: 1;
      }
      .finance-billing-delete:hover {
        background: #eb5a46;
        color: #fff;
      }
      .finance-billing-empty {
        padding: 18px;
        border: 1px dashed var(--line);
        border-radius: 12px;
        color: var(--muted);
        font-size: 12px;
      }
      .finance-billing-detail-head {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 180px auto;
        align-items: center;
        gap: 14px;
        padding: 16px;
        border-bottom: 1px solid var(--line);
      }
      .finance-billing-detail-title {
        font-size: 16px;
        font-weight: 850;
      }
      .finance-billing-limit {
        display: grid;
        gap: 5px;
        font-size: 11px;
        color: var(--muted);
        font-weight: 750;
      }
      .finance-billing-limit input {
        width: 100%;
        min-width: 0;
      }
      .finance-billing-detail-total {
        display: grid;
        gap: 3px;
        text-align: right;
        font-size: 10px;
        color: var(--muted);
        white-space: nowrap;
      }
      .finance-billing-detail-total strong {
        font-size: 17px;
        color: var(--ink);
      }
      .finance-billing-detail-total .red {
        color: var(--red);
        font-weight: 800;
      }
      .finance-month-grid {
        display: grid;
        grid-template-columns: repeat(6, minmax(0, 1fr));
        gap: 9px;
        padding: 14px;
      }
      .finance-month-cell {
        display: grid;
        gap: 5px;
        padding: 9px;
        border: 1px solid var(--line);
        border-radius: 10px;
        background: #fff;
        min-width: 0;
        font-size: 11px;
        color: var(--muted);
        font-weight: 750;
      }
      .finance-month-cell input {
        width: 100%;
        min-width: 0;
        padding: 8px 7px;
        border: 1px solid var(--line);
        border-radius: 7px;
        font-variant-numeric: tabular-nums;
      }
      .finance-month-cell input:focus {
        outline: 2px solid #4bbfdb;
      }
      .finance-history-modal {
        width: min(740px, 100%);
        max-height: calc(100vh - 32px);
        overflow: auto;
      }
      .finance-history-entry {
        padding: 13px 0;
        border-bottom: 1px solid var(--line);
      }
      .finance-history-entry:last-child {
        border-bottom: 0;
      }
      .finance-history-entry-head {
        display: flex;
        justify-content: space-between;
        align-items: start;
        gap: 12px;
      }
      .finance-history-entry-head strong {
        font-size: 13px;
      }
      .finance-history-entry-head span,
      .finance-history-action,
      .finance-history-item-values {
        font-size: 11px;
        color: var(--muted);
      }
      .finance-history-action {
        margin-top: 3px;
      }
      .finance-history-values {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        margin-top: 9px;
      }
      .finance-history-values span {
        display: flex;
        flex-direction: column;
        gap: 3px;
        font-size: 10px;
        color: var(--muted);
        padding: 9px;
        background: #f4f5f7;
        border-radius: 8px;
      }
      .finance-history-values strong {
        font-size: 12px;
        color: var(--purple);
      }
      .finance-history-item-values {
        margin-top: 7px;
      }
      .finance-history-entry-actions {
        display: flex;
        justify-content: flex-end;
        margin-top: 10px;
      }
      .btn.danger {
        background: #fff0f1;
        border: 1px solid #ffd5d9;
        color: #b04632;
      }
      .btn.danger:hover {
        background: #eb5a46;
        color: #fff;
      }
      .finance-employee-modal-actions {
        flex-wrap: wrap;
      }
      .finance-expense-add-menu {
        position: relative;
        display: inline-flex;
      }
      .finance-expense-add-menu > button {
        display: inline-flex;
        align-items: center;
        gap: 10px;
      }
      .finance-expense-type-menu {
        position: absolute;
        right: 0;
        top: calc(100% + 7px);
        z-index: 40;
        min-width: 190px;
        padding: 6px;
        background: #fff;
        border: 1px solid var(--line);
        border-radius: 12px;
        box-shadow: 0 12px 34px #172b4d24;
        display: grid;
        gap: 3px;
      }
      .finance-expense-type-menu[hidden] {
        display: none;
      }
      .finance-expense-type-menu button {
        background: transparent;
        color: var(--ink);
        text-align: left;
        padding: 10px 11px;
        border-radius: 8px;
        font-size: 12px;
        font-weight: 700;
      }
      .finance-expense-type-menu button:hover {
        background: var(--purple2);
        color: var(--purple);
      }
      .patrimony-page-head {
        align-items: center;
        margin-bottom: 14px;
      }
      .patrimony-summary-grid {
        display: grid;
        grid-template-columns: minmax(0, 1.25fr) minmax(250px, 1fr);
        gap: 12px;
        margin-bottom: 16px;
      }
      .patrimony-summary-grid .patrimony-total-box {
        margin: 0;
      }
      .patrimony-month-movement-box {
        border: 1px solid #dfe8f3;
        background: linear-gradient(120deg, #f7fbff, #fff);
        border-radius: 16px;
        padding: 22px 24px;
        box-shadow: var(--shadow);
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: 7px;
      }
      .patrimony-month-movement-label {
        font-size: 13px;
        font-weight: 800;
        color: #5b6e87;
      }
      .patrimony-month-movement-value {
        font-size: 25px;
        font-weight: 900;
        letter-spacing: -0.5px;
        color: #405f86;
        font-variant-numeric: tabular-nums;
      }
      .patrimony-total-box {
        padding: 22px 24px;
      }
      .finance-employee-filterbar #financeEmployeeSearch {
        min-width: 200px;
      }
      .finance-employee-total-label {
        max-width: 260px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
      @media (max-width: 1100px) {
        .finance-month-grid {
          grid-template-columns: repeat(4, minmax(0, 1fr));
        }
        .finance-billing-detail-head {
          grid-template-columns: minmax(0, 1fr) 160px;
        }
        .finance-billing-detail-total {
          grid-column: 1/-1;
          text-align: left;
          display: flex;
          flex-wrap: wrap;
          align-items: center;
          gap: 8px;
        }
        .patrimony-summary-grid {
          grid-template-columns: 1fr 1fr;
        }
      }
      @media (max-width: 700px) {
        .finance-month-grid {
          grid-template-columns: repeat(3, minmax(0, 1fr));
          padding: 10px;
          gap: 7px;
        }
        .finance-month-cell {
          padding: 7px;
        }
        .finance-billing-detail-head {
          grid-template-columns: 1fr;
        }
        .finance-billing-limit {
          max-width: 100%;
        }
        .finance-billing-actions {
          width: 100%;
          justify-content: flex-start;
        }
        .finance-billing-header {
          align-items: flex-start;
        }
        .patrimony-summary-grid {
          grid-template-columns: 1fr;
        }
        .finance-history-values {
          grid-template-columns: 1fr;
        }
        .finance-history-entry-head {
          flex-direction: column;
          gap: 4px;
        }
        .finance-expense-toolbar {
          align-items: stretch;
        }
        .finance-expense-add-menu {
          width: 100%;
        }
        .finance-expense-add-menu > button {
          width: 100%;
          justify-content: space-between;
        }
        .finance-expense-type-menu {
          left: 0;
          right: 0;
        }
        .finance-employee-modal-actions {
          justify-content: flex-end;
        }
        .finance-employee-modal-actions #financeEmployeeDelete {
          width: 100%;
          margin-right: 0 !important;
        }
        .finance-employee-filterbar {
          grid-template-columns: 1fr;
        }
        .finance-employee-filterbar #financeEmployeeSearch,
        .finance-employee-filterbar #financeEmployeeStatusFilter,
        .finance-employee-filterbar #financeEmployeeCount,
        .finance-employee-total {
          grid-column: 1;
          grid-row: auto;
          width: 100%;
        }
      }

      /* Despesas variáveis: alinhamento idêntico ao quadro de despesas fixas */
      .finance-variable-head {
        grid-template-columns: 110px minmax(150px, 1fr) 145px 150px 170px !important;
      }
      .finance-variable-expense-row {
        grid-template-columns: 110px minmax(150px, 1fr) 145px 150px 170px !important;
        gap: 10px !important;
      }
      .finance-variable-expense-row .finance-expense-paid {
        grid-column: auto !important;
      }
      .finance-variable-expense-row input.field {
        width: 100%;
        min-width: 0;
      }
      @media (max-width: 900px) {
        .finance-variable-head {
          grid-template-columns: 100px minmax(120px, 1fr) 120px 140px !important;
        }
        .finance-variable-head span:last-child {
          grid-column: 1/-1;
        }
        .finance-variable-expense-row {
          grid-template-columns: 100px minmax(120px, 1fr) 120px 140px !important;
        }
        .finance-variable-expense-row .finance-expense-row-actions {
          grid-column: 1/-1 !important;
          justify-content: flex-end;
        }
      }
      @media (max-width: 600px) {
        .finance-variable-head {
          display: none !important;
        }
        .finance-variable-expense-row {
          grid-template-columns: 1fr !important;
          gap: 7px !important;
        }
        .finance-variable-expense-row .finance-expense-row-actions {
          grid-column: auto !important;
          justify-content: flex-start;
        }
      }
    

/* ==========================================================================
   Camada web/mobile (v2) — drawer, barra inferior, cartões e Safari/iOS
   ========================================================================== */
[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior-y: none;
}

.app {
  min-height: 100vh;
  min-height: 100dvh;
}

button,
a,
label,
select {
  -webkit-tap-highlight-color: transparent;
}

.dialer,
.menu-btn,
.drawer-close,
.drawer-scrim,
.bottom-nav,
.mobile-fab {
  display: none;
}

/* Sidebar: controles de conta e sincronização */
.sidebar {
  position: relative;
}

.drawer-close {
  position: absolute;
  top: 14px;
  right: 12px;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: #f2f2f8;
  color: var(--ink);
  font-size: 24px;
  line-height: 1;
  place-items: center;
}

.side-tools {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 2px;
}

.side-link {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  width: 100%;
  padding: 9px 10px;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.side-link:hover {
  background: #f4f5f7;
  color: var(--ink);
}

.side-link.danger {
  color: var(--red);
}

.side-version {
  padding: 10px;
  color: #a3a7b8;
  font-size: 10px;
  letter-spacing: 0.04em;
}

/* Status de sincronização */
.sync-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
}

.sync-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #b8bccd;
  flex: 0 0 auto;
}

.sync-status[data-state="saved"] .sync-dot {
  background: var(--green);
}

.sync-status[data-state="saving"] .sync-dot,
.sync-status[data-state="loading"] .sync-dot {
  background: var(--orange);
  animation: syncPulse 1s ease-in-out infinite;
}

.sync-status[data-state="offline"] .sync-dot,
.sync-status[data-state="conflict"] .sync-dot,
.sync-status[data-state="error"] .sync-dot {
  background: var(--red);
}

@keyframes syncPulse {
  50% {
    opacity: 0.35;
  }
}

.topbar-sync {
  margin-top: 3px;
}

/* Barra de aviso de conflito/offline */
.sync-banner {
  position: sticky;
  top: 0;
  z-index: 45;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin: 0 0 14px;
  padding: 10px 12px;
  border: 1px solid #f0d6a8;
  border-radius: 12px;
  background: #fff8ea;
  color: #7a5312;
  font-size: 12px;
  box-shadow: var(--shadow);
}

.sync-banner .btn {
  margin-left: auto;
}

/* Botão de olho */
.privacy-toggle {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  flex: 0 0 auto;
}

.privacy-toggle svg {
  width: 20px;
  height: 20px;
}

.privacy-toggle .eye-off {
  display: none;
}

body.privacy-on .privacy-toggle .eye-open {
  display: none;
}

body.privacy-on .privacy-toggle .eye-off {
  display: block;
}

body.privacy-on .finance-content input[type="number"] {
  filter: blur(5px);
  transition: filter 0.15s ease;
}

body.privacy-on .finance-content input[type="number"]:focus {
  filter: none;
}

/* Menu mobile */
.menu-btn {
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  place-items: center;
  flex: 0 0 auto;
}

.menu-btn svg {
  width: 20px;
  height: 20px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

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

/* Barra inferior */
.bottom-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 0;
  min-height: 48px;
  padding: 5px 2px;
  border-radius: 12px;
  background: transparent;
  color: #7c8196;
  font-size: 10.5px;
  font-weight: 650;
  line-height: 1.1;
}

.bottom-tab .bottom-ico {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
}

.bottom-tab svg {
  width: 22px;
  height: 22px;
}

.bottom-tab.active {
  color: var(--purple);
  background: var(--purple2);
}

.bottom-tab.active svg {
  stroke-width: 2.1;
}

.mobile-fab {
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 18px;
  background: var(--purple);
  color: #fff;
  font-size: 28px;
  line-height: 1;
  box-shadow: 0 12px 28px #0079bf66;
}

@media (max-width: 900px) {
  .app {
    display: block;
  }

  .menu-btn {
    display: grid;
  }

  .drawer-close {
    display: grid;
  }

  .drawer-scrim {
    position: fixed;
    inset: 0;
    z-index: 70;
    background: #10122573;
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
  }

  body.drawer-open .drawer-scrim {
    display: block;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 80;
    display: flex;
    flex-direction: column;
    width: min(86vw, 330px);
    height: 100vh;
    height: 100dvh;
    padding: calc(18px + env(safe-area-inset-top)) 16px calc(18px + env(safe-area-inset-bottom));
    overflow-y: auto;
    overscroll-behavior: contain;
    border-right: 1px solid var(--line);
    border-bottom: 0;
    gap: 16px;
    transform: translateX(-102%);
    transition: transform 0.22s cubic-bezier(0.22, 0.7, 0.3, 1);
    box-shadow: 18px 0 50px #16172a1f;
    will-change: transform;
  }

  .sidebar.open {
    transform: none;
  }

  .sidebar .workspace {
    display: block;
    margin: 0;
  }

  .sidebar .brand {
    padding-right: 42px;
  }

  .sidebar .nav {
    display: grid;
    gap: 4px;
    overflow: visible;
  }

  .sidebar .nav button {
    padding: 12px;
    font-size: 14px;
    white-space: normal;
  }

  .sidebar .nav button span:last-child {
    display: inline;
  }

  .sidebar .nav .ico {
    font-size: 16px;
  }

  .side-tools {
    margin-top: 8px;
  }

  .side-version {
    display: block;
  }

  main {
    padding: 0;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 55;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
    background: #f4f5f7e8;
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid #dfe1e6;
  }

  .topbar-left {
    flex: 1;
  }

  .topbar h1 {
    font-size: 19px;
    letter-spacing: -0.5px;
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .topbar-sync {
    margin-top: 1px;
  }

  .topbar-sync span:last-child {
    display: none;
  }

  .actions {
    gap: 6px;
    flex-wrap: nowrap;
  }

  .actions .btn {
    padding: 8px 10px;
    font-size: 12px;
    min-height: 40px;
  }

  #newTask {
    display: none !important;
  }

  #archiveTopBtn {
    font-size: 0;
    gap: 0;
    width: 40px;
    height: 40px;
    padding: 0;
    justify-content: center;
    border-radius: 12px;
  }

  #archiveTopBtn .archive-count {
    font-size: 11px;
  }

  .content {
    padding: 14px 14px 22px;
  }

  .sync-banner {
    position: fixed;
    top: calc(62px + env(safe-area-inset-top));
    left: 10px;
    right: 10px;
    margin: 0;
    z-index: 75;
  }

  .bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    display: flex;
    gap: 2px;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    background: #fffffff2;
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border-top: 1px solid var(--line);
  }

  .bottom-tab {
    flex: 1 1 0;
  }

  .mobile-fab {
    position: fixed;
    right: 16px;
    bottom: calc(78px + env(safe-area-inset-bottom));
    z-index: 65;
    display: grid;
  }

  .mobile-fab[hidden] {
    display: none;
  }

  main {
    padding-bottom: calc(72px + env(safe-area-inset-bottom)) !important;
  }

  .modal-back {
    align-items: flex-end;
    padding: 0;
    z-index: 120;
  }

  .modal {
    width: 100%;
    max-width: none;
    max-height: 92vh;
    max-height: 92dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
    border-radius: 22px 22px 0 0;
    box-shadow: 0 -18px 60px #16172a33;
  }

  .modal-actions {
    position: sticky;
    bottom: 0;
    margin: 16px -16px calc(-20px - env(safe-area-inset-bottom));
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    background: #fff;
    border-top: 1px solid var(--line);
  }

  .modal-actions .btn {
    flex: 1;
    min-height: 46px;
  }

  .toast {
    bottom: calc(84px + env(safe-area-inset-bottom));
    z-index: 200;
  }

  /* Tipografia e toque */
  .field,
  input,
  select,
  textarea {
    font-size: 16px;
  }

  .field {
    min-height: 44px;
    padding: 10px 12px;
  }

  select.field,
  .owner-filter,
  .finance-status-select {
    min-height: 44px;
  }

  .btn {
    min-height: 42px;
  }

  .btn.small {
    min-height: 38px;
    padding: 8px 11px;
  }

  .section-head {
    gap: 10px;
  }

  .section-head h3 {
    font-size: 16px;
  }

  .owner-filter-wrap {
    width: 100%;
    align-items: stretch;
    flex-direction: column;
    gap: 5px;
  }

  .owner-filter {
    width: 100%;
    max-width: none;
    min-width: 0;
  }

  /* Login */
  .login-screen {
    padding: calc(20px + env(safe-area-inset-top)) 18px calc(20px + env(safe-area-inset-bottom));
    min-height: 100vh;
    min-height: 100dvh;
  }

  .login-card {
    width: 100%;
    padding: 26px 20px;
    border-radius: 22px;
  }

  .login-card input {
    min-height: 48px;
  }

  .login-card button {
    min-height: 48px;
  }

  /* Kanban: colunas com encaixe horizontal */
  .board-tools {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
  }

  .board-tools input {
    max-width: none;
    width: 100%;
  }

  .board {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding: 2px 2px 14px;
    -webkit-overflow-scrolling: touch;
  }

  .column {
    flex: 0 0 84vw;
    min-width: 0;
    min-height: 0;
    scroll-snap-align: start;
  }

  .task {
    padding: 14px;
  }

  /* Calendário */
  .cal-grid {
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 4px;
  }

  .day {
    min-height: 72px;
    padding: 4px;
    border-radius: 8px;
  }

  .weekday {
    font-size: 9px;
    padding: 6px 1px;
  }

  .cal-event {
    font-size: 8px;
    padding: 2px 3px;
    border-radius: 4px;
  }

  .daynum {
    width: 22px;
    height: 22px;
    font-size: 11px;
  }

  /* Chat */
  .chat-layout {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
  }

  .chat-people {
    padding: 10px;
  }

  .chat-people h3 {
    margin-bottom: 8px;
    font-size: 14px;
  }

  #chatPeople {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .chat-person {
    width: auto;
    flex: 0 0 auto;
    margin: 0;
    padding: 8px 12px;
    border-radius: 999px;
    background: #f5f5fa;
    font-size: 12px;
    white-space: nowrap;
  }

  .chat-person small {
    display: none;
  }

  .chat-main {
    min-height: 58vh;
    min-height: 58dvh;
  }

  .chat-messages {
    min-height: 0;
    max-height: 48vh;
  }

  .chat-compose {
    position: sticky;
    bottom: 0;
    background: #fff;
    padding: 10px 0 max(2px, env(safe-area-inset-bottom));
  }

  /* Financeiro: cabeçalhos */
  .finance-intro {
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
  }

  .finance-receivable-total {
    width: 100%;
    min-width: 0;
    margin: 0;
    padding: 12px 14px;
    justify-content: space-between;
    border-radius: 14px;
  }

  .finance-receivable-total-value {
    font-size: 21px;
  }

  .finance-receivable-search {
    width: 100%;
    flex: 1 1 100%;
  }

  .finance-actions-only [data-fin-new-contract],
  .finance-intro [data-fin-new-contract] {
    width: 100%;
    margin-left: 0;
    min-height: 46px;
  }

  .finance-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
  }

  .finance-kpi {
    padding: 13px;
    border-radius: 12px;
  }

  .finance-kpi-value {
    font-size: 19px;
    overflow-wrap: anywhere;
  }

  .finance-kpi-label {
    font-size: 10px;
  }

  .finance-kpi-note {
    font-size: 10px;
  }

  .finance-filterbar {
    grid-template-columns: 1fr;
  }

  .finance-expense-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .finance-expense-add-menu {
    width: 100%;
  }

  .finance-expense-add-menu > button {
    width: 100%;
    justify-content: space-between;
  }

  .finance-month-tabs {
    display: flex;
    overflow-x: auto;
    gap: 6px;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }

  .finance-month-tab {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .finance-month-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    padding: 8px;
  }

  .finance-month-cell {
    padding: 6px;
  }

  .finance-month-cell input {
    font-size: 15px;
  }

  .patrimony-summary-grid,
  .finance-history-values {
    grid-template-columns: 1fr;
  }

  .patrimony-form,
  .patrimony-form .formgrid {
    grid-template-columns: 1fr !important;
  }

  .finance-employee-modal-actions {
    flex-wrap: wrap;
  }

  .finance-billing-card {
    padding: 14px;
  }

  .finance-billing-detail-head {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .finance-billing-limit {
    max-width: none;
  }

  /* Cards em vez de tabela no telefone */
  .finance-scroll {
    overflow: visible;
  }

  .finance-table {
    min-width: 0;
    width: 100%;
    display: block;
  }

  .finance-table thead {
    display: none;
  }

  .finance-table tbody {
    display: block;
  }

  .finance-table tr {
    display: block;
    margin: 0 0 10px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: #fff;
    box-shadow: 0 3px 10px #091e4207;
  }

  .finance-table td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: auto;
    padding: 5px 0;
    border: 0;
    text-align: right;
    white-space: normal;
  }

  .finance-table td::before {
    content: attr(data-label);
    flex: 0 0 40%;
    color: var(--muted);
    font-size: 11px;
    font-weight: 650;
    text-align: left;
  }

  .finance-table td:not([data-label])::before,
  .finance-table td[colspan]::before {
    display: none;
  }

  .finance-table td[colspan] {
    display: block;
    text-align: left;
    padding: 0;
  }

  .finance-table tr.finance-group-row {
    margin: 14px 0 6px;
    padding: 9px 12px;
    border: 0;
    background: #e4f0f6;
    color: var(--purple);
    box-shadow: none;
  }

  .finance-table tr.finance-group-row td {
    display: block;
  }

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

  .finance-table .finance-status-select {
    width: 100%;
    max-width: 190px;
  }

  .finance-table .finance-primary,
  .finance-table .finance-secondary,
  .finance-table .finance-service-cell {
    overflow-wrap: anywhere;
  }

  .finance-table .finance-inconsistency {
    margin-top: 2px;
    width: 100%;
  }

  .finance-table td [data-fin-installments],
  .finance-table td [data-employee-installments] {
    width: 100%;
  }

  .finance-row-pending {
    box-shadow: inset 3px 0 0 #efc27c;
  }

  .finance-table td:last-child {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .finance-table td:last-child::before {
    display: none;
  }

  .finance-installment-row,
  .finance-employee-installment-row {
    grid-template-columns: 1fr !important;
  }

  .finance-installment-remove {
    justify-self: flex-end;
  }

  /* Acessos */
  .access-note-row {
    grid-template-columns: 1fr !important;
    gap: 8px;
  }

  .access-note-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  /* Histórico/projetos */
  .project-row {
    grid-template-columns: 1fr auto;
  }

  .history-item {
    padding: 10px 0;
  }
}

@media (max-width: 520px) {
  .topbar h1 {
    font-size: 17px;
  }

  .content {
    padding: 12px 11px 20px;
  }

  .finance-kpis {
    grid-template-columns: 1fr 1fr;
  }

  .finance-kpi-value {
    font-size: 17px;
  }

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

  .cal-grid {
    gap: 2px;
  }

  .day {
    min-height: 58px;
  }

  .daynum {
    width: 19px;
    height: 19px;
    font-size: 10px;
  }

  .bottom-tab {
    font-size: 9.5px;
  }

  .bottom-tab svg {
    width: 20px;
    height: 20px;
  }
}

/* iPhone com entalhe: evita conteúdo sob a barra de status no modo standalone */
@supports (padding: max(0px)) {
  .topbar {
    padding-top: max(10px, env(safe-area-inset-top));
  }
}

/* Ajustes finos do financeiro no telefone */
@media (max-width: 900px) {
  /* KPIs de despesas: 2 colunas em vez de 3 fixas */
  #financeExpenseKpis .finance-expense-kpi-grid,
  .finance-expense-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 9px !important;
  }

  .finance-billing-cards {
    grid-template-columns: 1fr !important;
  }

  /* Meses em fita horizontal, sem quebrar em 3 linhas */
  .finance-month-tabs {
    flex-wrap: nowrap !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin: 12px 0 14px;
  }

  .finance-month-tabs::-webkit-scrollbar {
    display: none;
  }

  /* Despesa fixa/variável vira cartão: nome largo, valor e dia lado a lado */
  .finance-month-expense-row,
  .finance-variable-expense-row {
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
    padding: 13px !important;
    align-items: center;
  }

  .finance-month-expense-row .finance-expense-paid,
  .finance-variable-expense-row .finance-expense-paid {
    grid-column: 1 / -1;
    min-height: 36px;
  }

  .finance-month-expense-row input[name="name"],
  .finance-variable-expense-row input[name="name"] {
    grid-column: 1 / -1;
  }

  .finance-month-expense-row input[name="amount"],
  .finance-variable-expense-row input[name="amount"] {
    grid-column: 1;
  }

  .finance-month-expense-row input[name="dueDay"],
  .finance-variable-expense-row input[name="dueDay"] {
    grid-column: 2;
  }

  .finance-month-expense-row .finance-expense-row-actions,
  .finance-variable-expense-row .finance-expense-row-actions {
    grid-column: 1 / -1 !important;
    justify-content: flex-start;
  }

  .finance-expense-row-actions .btn {
    flex: 1;
  }

  .finance-expense-list-head {
    display: none !important;
  }

  .finance-expense-list {
    border: 0;
    background: transparent;
    overflow: visible;
  }

  .finance-month-expense-row,
  .finance-variable-expense-row {
    border: 1px solid var(--line) !important;
    border-radius: 13px;
    background: #fff;
    margin-bottom: 9px;
    box-shadow: 0 3px 10px #091e4207;
  }

  .finance-month-expense-row:last-child,
  .finance-variable-expense-row:last-child {
    border-bottom: 1px solid var(--line) !important;
  }

  /* Tabela financeira em cartões: acabamento */
  .finance-table tr.finance-row-pending {
    background: #fffaf2 !important;
    border-left: 3px solid #e6a04b;
  }

  .finance-table tr.finance-row-pending td {
    background: transparent !important;
    box-shadow: none !important;
  }

  .finance-table tr.finance-group-row {
    padding: 0 !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
  }

  .finance-table tr.finance-group-row td {
    padding: 10px 12px !important;
    border-radius: 10px;
    border-bottom: 0 !important;
  }

  .finance-table td[data-label="Serviço"] {
    display: block !important;
    text-align: left !important;
    padding-top: 9px;
    margin-top: 5px;
    border-top: 1px dashed var(--line);
    font-size: 13px;
    line-height: 1.45;
  }

  .finance-table td[data-label="Serviço"]::before {
    display: block !important;
    margin-bottom: 3px;
  }

  .finance-table td[data-label="Ações"] {
    gap: 8px;
    padding-top: 10px;
  }

  .finance-table td[data-label="Ações"] .btn {
    flex: 1;
    justify-content: center;
  }

  .finance-table td[data-label="Parcelas"] .finance-installment-open {
    max-width: 100%;
  }

  .finance-table .finance-status-select {
    max-width: 200px;
  }

  /* Evita título duplicado dentro da página */
  .patrimony-page-head {
    justify-content: flex-end;
    margin-bottom: 10px;
  }

  .patrimony-page-head h2 {
    display: none;
  }

  .finance-overview-actions {
    margin-bottom: 12px;
  }

  .finance-overview-actions > div:empty {
    display: none;
  }

  .finance-overview-actions [data-fin-new-contract] {
    width: 100%;
  }

  .finance-kpi-value,
  .finance-receivable-total-value,
  .patrimony-total-value,
  .patrimony-month-movement-value {
    font-variant-numeric: tabular-nums;
  }

  .section-head .btn.small {
    flex: 0 0 auto;
  }

  /* Drawer: ações com aparência de lista */
  .side-link {
    background: #f4f5f7;
    margin-bottom: 4px;
  }

  .side-link.danger {
    background: #fff5f5;
  }
}

@media (max-width: 900px) {
  #archiveTopBtn::before {
    content: "▣";
    font-size: 16px;
    line-height: 1;
  }

  #archiveTopBtn .archive-count {
    display: inline-grid;
    place-items: center;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--purple2);
    color: var(--purple);
    font-size: 10px;
    font-weight: 800;
  }
}

/* ==========================================================================
   Visual Trello: azul, listas cinza e cartões brancos
   ========================================================================== */
body {
  background: var(--bg);
}

.sidebar {
  background: linear-gradient(180deg, #0079bf 0%, #026aa7 100%);
  border-right: 0;
  box-shadow: 2px 0 10px #091e4214;
}

.sidebar .brand,
.sidebar .brand span {
  color: #fff !important;
}

.sidebar .logo {
  background: #fff;
  color: #0079bf;
  box-shadow: 0 1px 2px #091e4233;
}

.sidebar .workspace {
  background: #ffffff1f;
  border-color: #ffffff33;
}

.sidebar .tiny {
  color: #ffffffb3;
}

.sidebar .workspace-switcher {
  color: #fff;
}

.sidebar .workspace-switcher option {
  color: #172b4d;
}

.sidebar .nav button {
  color: #ffffffd9;
}

.sidebar .nav button:hover {
  background: #ffffff1f;
  color: #fff;
}

.sidebar .nav button.active {
  background: #ffffff2e;
  color: #fff;
}

.sidebar .nav-divider {
  background: #ffffff2e;
}

.sidebar .finance-nav {
  border-top-color: #ffffff2e;
}

.sidebar .side-tools {
  border-top-color: #ffffff2e;
}

.sidebar .side-link {
  background: transparent;
  color: #ffffffd9;
}

.sidebar .side-link:hover {
  background: #ffffff1f;
  color: #fff;
}

.sidebar .side-link.danger {
  background: transparent;
  color: #ffd7d2;
}

.sidebar .side-version {
  color: #ffffff80;
}

.sidebar .sync-status {
  color: #ffffffcc;
}

.sidebar .sync-dot {
  background: #ffffffa6;
}

.sidebar .drawer-close {
  background: #ffffff26;
  color: #fff;
}

.sidebar .drawer-close:hover {
  background: #ffffff3d;
}

/* Botões, campos e painéis */
.btn {
  background: #ebecf0;
  border: 0;
  border-radius: 6px;
  color: #172b4d;
  font-weight: 600;
  box-shadow: none;
}

.btn:hover {
  background: #dfe1e6;
}

.btn.primary {
  background: #0079bf;
  color: #fff;
}

.btn.primary:hover {
  background: #026aa7;
}

.btn.archive-btn,
.menu-btn,
.privacy-toggle {
  background: #fff;
  border: 1px solid var(--line);
}

.btn.archive-btn:hover,
.menu-btn:hover,
.privacy-toggle:hover {
  background: #f4f5f7;
}

.field {
  border: 1px solid #dfe1e6;
  border-radius: 6px;
  background: #fafbfc;
  color: #172b4d;
}

.field:hover {
  background: #fff;
}

.field:focus {
  background: #fff;
  border-color: #0079bf;
  box-shadow: 0 0 0 2px #0079bf40;
}

.panel,
.stat,
.column {
  background: #fff;
  border: 0;
  border-radius: 12px;
  box-shadow:
    0 1px 1px #091e4240,
    0 0 1px #091e4233;
}

.hero {
  background: linear-gradient(115deg, #0079bf, #026aa7);
  box-shadow: 0 10px 24px #0079bf33;
}

.topbar h1 {
  color: #172b4d;
}

@media (min-width: 901px) {
  .topbar {
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
  }
}

/* Login */
.login-screen {
  background:
    radial-gradient(circle at 20% 15%, #4bbfdb55 0, transparent 45%),
    linear-gradient(150deg, #0079bf 0%, #026aa7 60%, #014a75 100%);
}

.login-card {
  border: 0;
  box-shadow: 0 18px 50px #091e4259;
}

.login-logo {
  background: #0079bf;
  color: #fff;
}

/* Quadro no estilo Trello */
.column {
  background: #ebecf0;
  padding: 10px;
}

.colhead {
  color: #172b4d;
  font-size: 13px;
  padding: 2px 4px 6px;
}

.task {
  border: 0;
  border-radius: 8px;
  padding: 9px 11px;
  box-shadow: 0 1px 0 #091e4240;
  cursor: default;
}

.task:hover {
  box-shadow: 0 4px 12px #091e4233;
}

.addtask {
  border: 0;
  border-radius: 8px;
  color: #5e6c84;
  padding: 8px;
}

.addtask:hover {
  background: #dfe1e6;
  color: #172b4d;
}

/* Cartão compacto: título + responsável; hover expande */
.board .task {
  display: flex;
  flex-direction: column;
  transition:
    box-shadow 0.15s ease,
    background 0.15s ease;
}

.board .task .task-title {
  order: 1;
  margin: 0;
  font-size: 13.5px;
  line-height: 1.35;
  color: #172b4d;
  overflow-wrap: anywhere;
}

.task-compact-meta {
  order: 2;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 5px;
  color: #5e6c84;
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.2;
  min-width: 0;
}

.task-compact-meta svg {
  width: 13px;
  height: 13px;
  flex: 0 0 auto;
  opacity: 0.75;
}

.task-compact-meta span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-details {
  order: 3;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  margin-top: 0;
  transition:
    max-height 0.3s cubic-bezier(0.2, 0.7, 0.3, 1),
    opacity 0.18s ease,
    margin-top 0.3s cubic-bezier(0.2, 0.7, 0.3, 1);
}

.board .task.task-open .task-details,
.board .task:focus-within .task-details,
.board .task.task-focus-target .task-details {
  max-height: 760px;
  opacity: 1;
  overflow: visible;
  margin-top: 8px;
}

.board .task.task-open .task-compact-meta,
.board .task:focus-within .task-compact-meta,
.board .task.task-focus-target .task-compact-meta {
  display: none;
}

.board .task.task-open .task-title,
.board .task:focus-within .task-title,
.board .task.task-focus-target .task-title {
  margin-bottom: 6px;
}

.board .task .task-details .task-delivery-line {
  margin-top: 8px;
}

.board .task .task-details .task-foot {
  margin-top: 8px;
}

.board .task .task-details select {
  margin-top: 9px;
  background: #fafbfc;
  border-color: #dfe1e6;
}

/* Em telas sem mouse (telefone/tablet), mantém o cartão completo */
@media (hover: none), (pointer: coarse) {
  .task-details {
    max-height: none;
    opacity: 1;
    overflow: visible;
    margin-top: 8px;
  }

  .task-compact-meta {
    display: none;
  }

  .task-title {
    margin-bottom: 6px !important;
  }
}

/* Barra inferior e drawer */
.bottom-nav {
  background: #fffffff2;
  border-top-color: #dfe1e6;
}

.bottom-tab.active {
  background: #e4f0f6;
  color: #0079bf;
}

@media (max-width: 900px) {
  .topbar {
    background: #ffffffe6;
    border-bottom: 1px solid #dfe1e6;
  }

  .content {
    background: #f4f5f7;
  }

  .modal {
    border-radius: 12px 12px 0 0;
  }

  .side-link {
    background: transparent !important;
  }

  .side-link:hover {
    background: #ffffff1f !important;
  }

  .side-link.danger {
    background: transparent !important;
  }
}

/* Ajustes após remoção de informações repetidas */
@media (min-width: 901px) {
  .finance-kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.finance-billing-detail-head {
  grid-template-columns: 190px minmax(0, 1fr);
}

.finance-billing-detail-total {
  justify-self: end;
}

.patrimony-page-head {
  justify-content: flex-end;
}

@media (max-width: 900px) {
  .finance-billing-detail-head {
    grid-template-columns: 1fr;
  }

  .finance-billing-detail-total {
    justify-self: start;
    text-align: left;
  }
}

/* Safari/iOS: selects nativos e barras opacas */
.workspace-switcher {
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23ffffff' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 2px center;
  background-size: 12px 8px;
  padding-right: 22px;
}

select.field,
.owner-filter,
.finance-status-select {
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%235e6c84' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 12px 8px;
  padding-right: 30px;
}

.finance-status-select {
  background-position: right 8px center;
}

@media (max-width: 900px) {
  .topbar {
    background: #fff;
  }

  .bottom-nav {
    background: #fff;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}

/* Seta visível mesmo nos selects com fundo customizado */
.finance-status-select {
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%235e6c84' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
}

@media (max-width: 900px) {
  .finance-kpis .finance-kpi:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
}

@media (max-width: 900px) {
  .section-head:has(.owner-filter-wrap) {
    flex-direction: column;
    align-items: stretch;
  }

  #financeExpenseKpis .finance-kpi:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }

  #financePendingList td[data-label="Serviço"] .finance-secondary {
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
}

.finance-table .finance-status-select {
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%235e6c84' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 9px center !important;
  background-size: 12px 8px !important;
  padding-right: 28px !important;
}

body.drawer-open {
  overflow: hidden;
}

.board-tools-title {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

#clearProjectFilter {
  flex: 0 0 auto;
}

@media (max-width: 900px) {
  .board-tools-title {
    justify-content: space-between;
    width: 100%;
  }
}

/* Arrastar e soltar: kanban e calendário */
.board .task {
  position: relative;
  padding-left: 18px;
}

.task-grip {
  position: absolute;
  left: 2px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 5px;
  color: #b3bac5;
  cursor: grab;
  touch-action: none;
  opacity: 0.65;
  z-index: 2;
}

.task-grip svg {
  width: 8px;
  height: 15px;
  fill: currentColor;
}

.task-grip:hover {
  background: #ebecf0;
  color: #0079bf;
  opacity: 1;
}

.task.dragging {
  opacity: 0.35;
}

body.is-dragging {
  cursor: grabbing;
  user-select: none;
  -webkit-user-select: none;
}

.drag-ghost {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-width: 300px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 30px #091e4240;
  pointer-events: none;
  font-size: 13px;
  color: #172b4d;
  overflow: hidden;
}

.drag-ghost strong {
  font-size: 13px;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drag-ghost span {
  font-size: 11px;
  color: #5e6c84;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drag-ghost-cal {
  font-size: 12px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.column.drag-over {
  background: #ddf1fa;
  outline: 3px solid #0079bf;
  outline-offset: -3px;
}

.cal-event {
  background: #ddf1fa;
  color: #055a8c;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.cal-event:hover {
  background: #b3d4e0;
}

.cal-event.done {
  background: #d3f1d9;
  color: #216e4e;
}

.cal-event.dragging {
  opacity: 0.4;
}

.day.drop-target {
  background: #ddf1fa;
  box-shadow: inset 0 0 0 2px #0079bf;
}

.task-archive-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

.task-archive-btn {
  padding: 5px 9px;
  border-radius: 6px;
  background: #ebecf0;
  color: #5e6c84;
  font-size: 11px;
  font-weight: 600;
}

.task-archive-btn:hover {
  background: #dfe1e6;
  color: #b04632;
}

@media (max-width: 900px) {
  .cal-event {
    min-height: 26px;
    display: flex;
    align-items: center;
    font-size: 9px;
    padding: 4px 5px;
  }

  .task-grip {
    opacity: 0.8;
  }
}

@media (max-width: 900px) {
  .board .task {
    padding-left: 22px;
  }

  .task-grip {
    left: 0;
    width: 20px;
    height: 40px;
  }

  .task-grip svg {
    width: 9px;
    height: 17px;
  }
}

/* Título da tarefa com Shift+Enter */
.task-title-input {
  min-height: 48px;
  max-height: 180px;
  resize: none;
  overflow-y: auto;
  line-height: 1.4;
  white-space: pre-wrap;
}

.board .task .task-title,
.project-title,
.task-focus-title {
  white-space: pre-line;
}

/* Botão de editar do cartão em destaque */
.task-edit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 28px;
  padding: 4px 9px;
  border-radius: 7px;
  background: #ff9f1a;
  color: #172b4d;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 1px 0 #b26a0055;
  flex: 0 0 auto;
}

.task-edit-btn:hover {
  background: #f28b0c;
  color: #fff;
}

.task-edit-btn svg {
  width: 13px;
  height: 13px;
  display: block;
}

@media (max-width: 380px) {
  .task-edit-btn span {
    display: none;
  }
}

/* Ações do cartão: Editar, To Do e Arquivar no mesmo padrão */
.task-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-top: 10px;
}

.task-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 0;
  min-height: 31px;
  padding: 5px 7px;
  border-radius: 9px;
  border: 1px solid #c1dbf0;
  background: var(--purple2);
  color: var(--purple);
  font-size: 10.5px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
}

.task-action-btn svg {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
}

.task-action-btn span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-action-btn:hover {
  background: var(--purple);
  border-color: var(--purple);
  color: #fff;
}

.task-action-btn:active {
  transform: translateY(1px);
}

/* Estilos antigos que não são mais usados por estes botões */
.task-edit-btn,
.task-todo-btn,
.task-archive-row,
.task-archive-btn {
  display: none !important;
}

.task-action-btn {
  gap: 4px;
  padding: 5px 4px;
  font-size: 10px;
}

.task-action-btn svg {
  width: 12px;
  height: 12px;
}

.task-action-btn {
  gap: 3px;
  padding: 5px 3px;
  font-size: 9.5px;
}

/* Cabeçalho de projeto/quadro no Kanban */
.board-project-bar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 1px 1px #091e4240, 0 0 1px #091e4233;
}

.board-project-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 auto;
  min-width: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.board-project-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  border-radius: 10px;
  background: var(--purple2);
  color: var(--purple);
  font-size: 18px;
}

.board-project-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1 1 auto;
}

.board-project-copy strong {
  font-size: 16px;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.board-project-copy small {
  color: var(--muted);
  font-size: 11px;
}

.board-project-progress {
  display: block;
  width: min(260px, 100%);
  height: 4px;
  margin-top: 5px;
  border-radius: 999px;
  background: #ebecf0;
  overflow: hidden;
}

.board-project-progress span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--purple);
  transition: width 0.2s ease;
}

.board-project-chevron {
  width: 12px;
  height: 8px;
  flex: 0 0 auto;
  color: var(--muted);
}

.board-project-stats {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.board-project-actions {
  display: flex;
  gap: 6px;
  flex: 0 0 auto;
}

.board-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 50;
  width: min(360px, 100%);
  max-height: 380px;
  overflow: auto;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 12px 30px #091e4226;
}

.board-menu-head {
  padding: 6px 8px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.board-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  text-align: left;
}

.board-menu-item:hover {
  background: #f4f5f7;
}

.board-menu-item.active {
  background: var(--purple2);
  color: var(--purple);
  font-weight: 800;
}

.board-menu-count {
  color: var(--muted);
  font-size: 11px;
}

.board-menu-divider {
  height: 1px;
  margin: 5px 8px;
  background: var(--line);
}

.board-menu-empty {
  padding: 10px;
  color: var(--muted);
  font-size: 12px;
}

.board-tools {
  justify-content: flex-end;
}

@media (max-width: 900px) {
  .board-project-bar {
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px;
  }

  .board-project-btn {
    flex: 1 1 100%;
  }

  .board-project-stats {
    order: 3;
    width: 100%;
    justify-content: space-between;
  }

  .board-project-actions {
    order: 4;
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .board-project-actions .btn {
    min-height: 42px;
  }

  .board-menu {
    left: 0;
    right: 0;
    width: auto;
  }

  .board-tools {
    justify-content: stretch;
  }

  .board-tools input {
    width: 100%;
    max-width: none;
  }
}

/* Correção com IA */
.ai-fix {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
  padding: 4px 8px;
  border-radius: 6px;
  background: #e4f0f6;
  color: #0079bf;
  font-size: 11px;
  font-weight: 700;
}

.ai-fix:hover {
  background: #0079bf;
  color: #fff;
}

.ai-fix:disabled {
  opacity: 0.65;
  cursor: wait;
}

/* Medidor minimalista de armazenamento no menu lateral */
.storage-meter {
  margin: 0 0 8px;
  padding: 9px 10px;
  border-radius: 9px;
  background: #ffffff14;
}

.storage-meter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: #ffffffd9;
  font-size: 10px;
  font-weight: 700;
}

#storageUsage {
  color: #fff;
  font-size: 9.5px;
  font-weight: 600;
  white-space: nowrap;
}

.storage-meter-track {
  height: 4px;
  margin-top: 6px;
  border-radius: 999px;
  background: #ffffff33;
  overflow: hidden;
}

.storage-meter-track span {
  display: block;
  width: 0;
  height: 100%;
  min-width: 2px;
  border-radius: 999px;
  background: #8fd3ff;
  transition: width 0.25s ease;
}

/* Lista de acessos agrupada por letra */
.access-letter {
  padding: 14px 8px 5px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line);
}

.access-letter:first-child {
  padding-top: 2px;
}

/* Painel de acesso ao app (ADM) */
.app-access-panel {
  padding: 18px;
  margin-bottom: 18px;
}

.app-access-panel .section-head {
  align-items: flex-start;
}

.app-users-list {
  display: grid;
  gap: 6px;
  margin: 4px 0 14px;
}

.app-user-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) 90px 110px auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fafbfc;
}

.app-user-email {
  font-weight: 700;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.app-user-meta {
  color: var(--muted);
  font-size: 11px;
}

.app-user-pass {
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.08em;
}

.app-user-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.app-user-form {
  display: grid;
  grid-template-columns: minmax(180px, 1.2fr) minmax(160px, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.app-user-form .btn {
  min-height: 40px;
}

@media (max-width: 700px) {
  .app-user-row {
    grid-template-columns: 1fr auto;
    gap: 6px 10px;
  }

  .app-user-meta,
  .app-user-pass {
    grid-column: 1;
  }

  .app-user-actions {
    grid-column: 2;
    grid-row: 1 / span 3;
    flex-direction: column;
  }

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

.app-user-hint {
  margin-top: 10px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

/* Gate do workspace Financeiro */
.finance-gate {
  width: min(390px, 100%);
}

.finance-gate-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 12px;
  border-radius: 12px;
  background: var(--purple2);
  color: var(--purple);
  font-size: 24px;
  font-weight: 800;
}

.finance-gate h2 {
  margin-bottom: 6px;
}

.finance-gate p {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 13px;
}

.finance-gate form {
  display: grid;
  gap: 10px;
}

.app-user-finance {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.app-user-form {
  grid-template-columns: minmax(170px, 1.2fr) minmax(150px, 1fr) auto auto;
}

@media (max-width: 700px) {
  .app-user-form {
    grid-template-columns: 1fr;
  }
}
