:root {
    --ink: #1f2328;
    --muted: #667085;
    --line: #d9dee7;
    --canvas: #f4f6f8;
    --surface: #ffffff;
    --graphite: #29313d;
    --graphite-2: #394352;
    --green: #147d64;
    --green-soft: #e4f4ef;
    --gold: #a66f00;
    --gold-soft: #fff2d1;
    --red: #b3343a;
    --red-soft: #ffe5e7;
    --sky: #2f6f9f;
    --focus: #174ea6;
    --shadow: 0 18px 42px rgba(31, 35, 40, .08);
    --radius: 8px;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--ink);
    background: var(--canvas);
    letter-spacing: 0;
}

a {
    color: var(--sky);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

img {
    max-width: 100%;
    height: auto;
}

:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--focus) 70%, white);
    outline-offset: 3px;
}

.skip-link {
    position: absolute;
    left: 1rem;
    top: .75rem;
    z-index: 999;
    transform: translateY(-180%);
    padding: .55rem .85rem;
    border-radius: 6px;
    background: var(--ink);
    color: #fff;
}

.skip-link:focus {
    transform: translateY(0);
}

.auth-shell {
    display: grid;
    place-items: center;
    padding: 2rem;
    background:
        linear-gradient(135deg, rgba(20, 125, 100, .16), transparent 34%),
        linear-gradient(315deg, rgba(166, 111, 0, .14), transparent 36%),
        #eef2f4;
}

.legal-shell {
    min-height: 100vh;
    background:
        linear-gradient(135deg, rgba(20, 125, 100, .12), transparent 34%),
        #eef2f4;
}

.legal-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    width: min(1120px, calc(100% - 2rem));
    margin: 0 auto;
    padding: 1.2rem 0;
}

.legal-topbar .auth-brand,
.legal-topbar .auth-legal {
    margin: 0;
    padding: 0;
    border: 0;
}

.legal-main {
    width: min(1120px, calc(100% - 2rem));
    margin: 0 auto;
    padding: 1rem 0 3rem;
}

.auth-main {
    width: min(100%, 480px);
}

.auth-panel {
    border: 1px solid rgba(41, 49, 61, .12);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, .92);
    box-shadow: var(--shadow);
    padding: 2rem;
    backdrop-filter: blur(14px);
}

.auth-brand,
.brand-lockup {
    display: flex;
    align-items: center;
    gap: .7rem;
    color: var(--ink);
    font-weight: 800;
}

.auth-brand {
    justify-content: space-between;
    margin-bottom: 2rem;
}

.auth-brand span,
.brand-lockup span {
    border-left: 1px solid var(--line);
    padding-left: .7rem;
    color: var(--green);
}

.auth-copy {
    margin-bottom: 1.5rem;
}

.auth-copy h1,
.topbar h1,
.profile-band h2 {
    margin: 0;
    font-size: 1.55rem;
    line-height: 1.2;
}

.auth-copy p:last-child {
    margin: .65rem 0 0;
    color: var(--muted);
}

.auth-legal {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--line);
    font-size: .9rem;
}

.stacked-form {
    display: grid;
    gap: 1rem;
}

.subtle-link,
.muted-text {
    color: var(--muted);
}

.app-shell {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    min-height: 100vh;
}

.app-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 1.4rem;
    padding: 1.4rem;
    background: var(--graphite);
    color: #fff;
}

.brand-lockup {
    color: #fff;
}

.brand-lockup:hover {
    text-decoration: none;
}

.brand-lockup img {
    filter: brightness(0) invert(1);
}

.brand-lockup span {
    color: #d5f7ef;
    border-color: rgba(255, 255, 255, .22);
}

.sidebar-nav {
    display: grid;
    gap: .35rem;
}

.sidebar-group {
    display: grid;
    gap: .45rem;
    padding: .55rem;
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 8px;
    background: rgba(255, 255, 255, .04);
}

.sidebar-group-title {
    margin: 0 .3rem;
    color: rgba(255, 255, 255, .52);
    font-size: .68rem;
    font-weight: 850;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.sidebar-group-links {
    display: grid;
    gap: .2rem;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: .75rem;
    min-height: 42px;
    padding: .7rem .8rem;
    border-radius: 6px;
    color: rgba(255, 255, 255, .78);
    font-weight: 650;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    color: #fff;
    text-decoration: none;
    background: rgba(255, 255, 255, .1);
}

.sidebar-nav .muted-link {
    opacity: .55;
}

.sidebar-subnav {
    display: flex;
    flex-direction: column;
    gap: 1px;
    margin: .1rem 0 .45rem 1.7rem;
    padding-left: .6rem;
    border-left: 1px solid rgba(255, 255, 255, .14);
}

.sidebar-subnav a {
    min-height: 32px;
    padding: .35rem .6rem;
    font-size: .82rem;
    font-weight: 600;
    color: rgba(255, 255, 255, .64);
    gap: .5rem;
}

.sidebar-subnav a:hover,
.sidebar-subnav a.active {
    color: #fff;
    background: rgba(255, 255, 255, .1);
}

.sidebar-badge {
    font-size: 9px;
    font-weight: 800;
    background: #16a34a;
    color: #fff;
    border-radius: 4px;
    padding: 1px 5px;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.sidebar-footer {
    margin-top: auto;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    font-size: .86rem;
}

.sidebar-footer a {
    color: rgba(255, 255, 255, .68);
}

.app-content {
    min-width: 0;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 86px;
    padding: 1rem 1.6rem;
    border-bottom: 1px solid var(--line);
    background: rgba(244, 246, 248, .92);
    backdrop-filter: blur(14px);
}

.topbar-actions,
.profile-actions,
.form-actions,
.surface-header {
    display: flex;
    align-items: center;
    gap: .75rem;
}

.profile-actions form,
.topbar-actions form {
    margin: 0;
}

.surface-header {
    justify-content: space-between;
    margin-bottom: 1rem;
}

.surface-header h2,
.surface h2,
.form-section h2 {
    margin: 0;
    font-size: 1.08rem;
    line-height: 1.25;
}

.eyebrow {
    margin: 0 0 .25rem;
    color: var(--green);
    font-size: .75rem;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.main-region {
    display: grid;
    gap: 1.2rem;
    padding: 1.5rem;
}

.user-chip,
.status-pill,
.readiness-tags span {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    min-height: 28px;
    border-radius: 999px;
    padding: .25rem .65rem;
    background: #edf0f4;
    color: var(--graphite);
    font-size: .82rem;
    font-weight: 750;
    white-space: nowrap;
}

.status-pill.is-ok {
    background: var(--green-soft);
    color: var(--green);
}

.status-pill.is-muted {
    background: #eef0f3;
    color: var(--muted);
}

.status-pill.is-info {
    background: #e8f1ff;
    color: #1e5aa8;
}

.status-pill.is-danger {
    background: #fdecee;
    color: #b4232f;
}

.icon-button {
    display: inline-grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface);
    color: var(--graphite);
}

.icon-button.inline {
    width: 36px;
    height: 36px;
}

.icon-button:hover {
    border-color: var(--green);
    color: var(--green);
    text-decoration: none;
}

.btn {
    border-radius: 6px;
    font-weight: 750;
}

.btn-primary {
    --bs-btn-bg: var(--green);
    --bs-btn-border-color: var(--green);
    --bs-btn-hover-bg: #0f6b55;
    --bs-btn-hover-border-color: #0f6b55;
    --bs-btn-focus-shadow-rgb: 20, 125, 100;
}

.btn-outline-primary {
    --bs-btn-color: var(--green);
    --bs-btn-border-color: color-mix(in srgb, var(--green) 45%, white);
    --bs-btn-hover-bg: var(--green);
    --bs-btn-hover-border-color: var(--green);
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
}

.metric-card,
.surface {
    border: 1px solid rgba(41, 49, 61, .1);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: 0 12px 28px rgba(31, 35, 40, .05);
}

.metric-card {
    display: grid;
    gap: .45rem;
    min-height: 140px;
    padding: 1.1rem;
    border-top: 4px solid var(--sky);
}

.metric-card span {
    color: var(--muted);
    font-weight: 750;
}

.metric-card strong {
    font-size: 2rem;
    line-height: 1;
}

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

.metric-card.accent-green {
    border-top-color: var(--green);
}

.metric-card.accent-gold {
    border-top-color: var(--gold);
}

.metric-card.accent-red {
    border-top-color: var(--red);
}

.surface {
    padding: 1.1rem;
}

.workspace-grid,
.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.list-stack {
    display: grid;
    gap: .55rem;
}

.data-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 58px;
    padding: .75rem;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--ink);
}

.data-row:hover {
    border-color: color-mix(in srgb, var(--green) 45%, white);
    text-decoration: none;
}

.data-row span,
.data-table td strong {
    display: grid;
    gap: .12rem;
}

.data-row small,
.data-table td small {
    display: block;
    color: var(--muted);
}

.legal-readiness {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
}

.legal-readiness p {
    max-width: 760px;
    margin-bottom: 0;
    color: var(--muted);
}

.readiness-tags {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.filter-bar {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(170px, 220px) auto;
    gap: .75rem;
    margin-bottom: 1rem;
}

.filter-bar.wide-filter {
    grid-template-columns: minmax(220px, 1fr) minmax(150px, 180px) minmax(180px, 220px) auto;
}

.filter-bar .btn {
    min-width: 118px;
}

.form-control,
.form-select {
    min-height: 44px;
    border-color: var(--line);
    border-radius: 6px;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--green);
    box-shadow: 0 0 0 .22rem rgba(20, 125, 100, .14);
}

.data-table {
    margin: 0;
}

.data-table thead th {
    color: var(--muted);
    font-size: .8rem;
    font-weight: 800;
    text-transform: uppercase;
}

.data-table tbody tr {
    border-color: var(--line);
}

.form-surface {
    max-width: 980px;
}

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

.form-section,
.span-2,
.form-actions {
    grid-column: 1 / -1;
}

.form-actions {
    justify-content: flex-end;
    padding-top: .5rem;
}

.consent-box {
    display: flex;
    align-items: flex-start;
    gap: .65rem;
    padding: .85rem;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #f8fafb;
}

.utm-grid,
.interaction-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

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

.interaction-form {
    margin-bottom: 1.2rem;
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #f8fafb;
}

.timeline {
    display: grid;
    gap: .75rem;
}

.timeline-item {
    position: relative;
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    gap: .7rem;
    padding: .75rem;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface);
}

.timeline-dot {
    width: 12px;
    height: 12px;
    margin-top: .35rem;
    border-radius: 999px;
    background: var(--green);
    box-shadow: 0 0 0 4px var(--green-soft);
}

.timeline-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.timeline-head time,
.timeline-item small {
    color: var(--muted);
    font-size: .84rem;
}

.timeline-item p {
    margin: .35rem 0 .25rem;
    color: var(--graphite);
}

.profile-band {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.15rem;
    border: 1px solid rgba(41, 49, 61, .12);
    border-radius: var(--radius);
    background: linear-gradient(135deg, #ffffff 0%, #f6faf8 100%);
}

.profile-band p:last-child {
    margin: .4rem 0 0;
    color: var(--muted);
}

.detail-list {
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr);
    gap: .7rem 1rem;
    margin: 1rem 0 0;
}

.detail-list dt {
    color: var(--muted);
    font-weight: 750;
}

.detail-list dd {
    margin: 0;
    min-width: 0;
    overflow-wrap: anywhere;
}

.notes-block {
    margin: .8rem 0 0;
    color: var(--muted);
}

.readonly-box,
.proposal-preview {
    min-height: 74px;
    padding: .9rem;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #f8fafb;
}

.readonly-box {
    display: grid;
    align-content: center;
    gap: .15rem;
}

.readonly-box small {
    color: var(--muted);
}

.proposal-preview {
    color: var(--graphite);
    line-height: 1.7;
    white-space: normal;
}

.legal-document {
    max-width: 880px;
    line-height: 1.7;
}

.legal-document h2 {
    font-size: 1.55rem;
}

.legal-document h3 {
    margin-top: 1.35rem;
    font-size: 1rem;
}

.legal-list {
    padding-left: 1.2rem;
}

.empty-state {
    display: grid;
    place-items: center;
    gap: .75rem;
    min-height: 360px;
    text-align: center;
}

.empty-icon {
    display: grid;
    place-items: center;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: var(--gold-soft);
    color: var(--gold);
    font-size: 1.4rem;
}

.notification-matrix {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) 120px 120px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
}

.matrix-head,
.matrix-event,
.switch-cell {
    display: flex;
    align-items: center;
    min-height: 52px;
    padding: .75rem;
    border-bottom: 1px solid var(--line);
}

.matrix-head {
    background: #f3f6f8;
    color: var(--muted);
    font-size: .8rem;
    font-weight: 800;
    text-transform: uppercase;
}

.switch-cell {
    justify-content: center;
    border-left: 1px solid var(--line);
}

.matrix-event {
    font-weight: 700;
}

.alert {
    border-radius: 6px;
}

.kanban-preview {
    display: grid;
    grid-template-columns: repeat(4, minmax(260px, 1fr));
    gap: .9rem;
    overflow-x: auto;
    padding-bottom: .4rem;
}

.kanban-column {
    min-height: 520px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #f8fafb;
}

.kanban-column header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    min-height: 54px;
    padding: .85rem;
    border-bottom: 1px solid var(--line);
}

.kanban-column h3 {
    margin: 0;
    font-size: .95rem;
}

.kanban-lane {
    display: grid;
    gap: .7rem;
    min-height: 450px;
    padding: .75rem;
}

.deal-card {
    display: grid;
    gap: .55rem;
    padding: .85rem;
    border: 1px solid rgba(41, 49, 61, .12);
    border-left: 4px solid var(--green);
    border-radius: 6px;
    background: var(--surface);
    box-shadow: 0 8px 20px rgba(31, 35, 40, .06);
    cursor: grab;
}

.deal-card:active {
    cursor: grabbing;
}

.deal-card.is-stale {
    border-left-color: var(--red);
}

.deal-card.is-warn {
    border-left-color: var(--gold);
}

.deal-card strong {
    font-size: .95rem;
}

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

.deal-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    flex-wrap: wrap;
}

.temp-chip {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: .2rem .5rem;
    border-radius: 999px;
    background: var(--green-soft);
    color: var(--green);
    font-size: .78rem;
    font-weight: 800;
}

.temp-chip.warn {
    background: var(--gold-soft);
    color: var(--gold);
}

.temp-chip.cold {
    background: var(--red-soft);
    color: var(--red);
}

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

    .app-sidebar {
        position: static;
        height: auto;
        padding: 1rem;
    }

    .sidebar-nav {
        grid-template-columns: 1fr;
    }

    .sidebar-nav a {
        justify-content: center;
    }

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

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

@media (max-width: 760px) {
    .auth-shell {
        padding: 1rem;
    }

    .auth-panel {
        padding: 1.25rem;
    }

    .topbar,
    .profile-band,
    .legal-readiness,
    .surface-header,
    .legal-topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .topbar-actions,
    .profile-actions {
        width: 100%;
        justify-content: space-between;
    }

    .main-region {
        padding: 1rem;
    }

    .sidebar-nav {
        grid-template-columns: 1fr;
    }

    .metric-grid,
    .workspace-grid,
    .detail-grid,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .filter-bar {
        grid-template-columns: 1fr;
    }

    .filter-bar.wide-filter,
    .utm-grid,
    .interaction-form {
        grid-template-columns: 1fr;
    }

    .detail-list {
        grid-template-columns: 1fr;
    }

    .notification-matrix {
        grid-template-columns: minmax(160px, 1fr) 86px 86px;
        font-size: .9rem;
    }
}

/* Studio Simões Admin-inspired skin */
:root {
    --ink: #0b0b0b;
    --muted: #777777;
    --line: rgba(11, 11, 11, .10);
    --canvas: #fbfaf7;
    --surface: #ffffff;
    --graphite: #3a3a3a;
    --graphite-2: #555555;
    --green: #197a3f;
    --green-soft: rgba(25, 122, 63, .08);
    --gold: #9a6a0a;
    --gold-soft: rgba(154, 106, 10, .10);
    --red: #d61f26;
    --red-soft: rgba(214, 31, 38, .08);
    --sky: #d61f26;
    --focus: #d61f26;
    --shadow: 0 30px 70px rgba(0, 0, 0, .07);
    --radius: 18px;
}

* {
    letter-spacing: 0 !important;
}

body {
    font-family: 'Inter', Arial, sans-serif;
    background: var(--canvas);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
}

a:hover {
    color: var(--red);
}

.auth-shell,
.legal-shell {
    background: linear-gradient(180deg, #fff, var(--canvas) 60%);
}

.auth-panel {
    border: 1px solid var(--line);
    border-radius: 24px;
    background: #fff;
    padding: 42px 36px;
    box-shadow: var(--shadow);
    backdrop-filter: none;
}

.auth-brand,
.brand-lockup {
    justify-content: flex-start;
    gap: 12px;
    color: var(--ink);
    font-size: 14px;
}

.brand-mark,
.auth-brand .brand-mark,
.brand-lockup .brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding-left: 0;
    border-left: 0;
    border-radius: 9px;
    background: var(--ink);
    color: #fff;
    font-size: 13px;
    font-weight: 900;
}

.brand-logo {
    display: block;
    width: auto;
    max-width: 172px;
    max-height: 42px;
}

.auth-brand .brand-logo,
.brand-lockup .brand-logo {
    filter: none;
}

.brand-lockup .brand-logo {
    max-width: 142px;
    max-height: 36px;
}

.auth-brand span:not(.brand-mark),
.brand-lockup span:not(.brand-mark) {
    padding-left: 12px;
    border-left: 1px solid var(--line);
    color: var(--ink);
}

.auth-brand em,
.brand-lockup em {
    color: var(--muted);
    font-style: normal;
    font-weight: 600;
}

.auth-copy h1 {
    font-size: 30px;
    line-height: 1.08;
    font-weight: 800;
}

.app-shell {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    min-height: 100vh;
}

.app-sidebar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: stretch;
    flex-direction: column;
    gap: 22px;
    height: 100vh;
    padding: 24px 20px;
    border-right: 1px solid var(--line);
    border-bottom: 0;
    background: #fff;
    color: var(--ink);
    overflow-y: auto;
}

.brand-lockup {
    flex: 0 0 auto;
    min-height: 44px;
    color: var(--ink);
}

.sidebar-nav {
    display: grid;
    align-items: stretch;
    justify-content: stretch;
    gap: 10px;
    font-size: 13px;
}

.sidebar-group {
    display: grid;
    gap: 6px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: color-mix(in srgb, var(--canvas) 62%, white);
}

.sidebar-group-title {
    margin: 0 6px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.sidebar-group-links {
    display: grid;
    gap: 4px;
}

.sidebar-nav a {
    min-height: 40px;
    padding: 0 11px;
    border-radius: 11px;
    color: var(--graphite);
    font-weight: 700;
    transition: .2s;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    color: var(--red);
    background: var(--red-soft);
    text-decoration: none;
}

.sidebar-footer {
    margin-top: auto;
    gap: 14px;
    font-size: 12.5px;
}

.sidebar-footer a {
    color: var(--muted);
    font-weight: 700;
}

.topbar {
    position: static;
    width: min(1180px, calc(100% - 48px));
    min-height: 0;
    margin: 0 auto;
    padding: 42px 0 30px;
    align-items: flex-end;
    border-bottom: 0;
    background: transparent;
    backdrop-filter: none;
}

.topbar h1,
.profile-band h2 {
    font-size: 36px;
    line-height: 1.05;
    font-weight: 800;
}

.main-region {
    width: min(1180px, calc(100% - 48px));
    margin: 0 auto;
    padding: 0 0 80px;
    gap: 22px;
}

.app-content {
    min-width: 0;
}

.eyebrow {
    color: var(--red);
    font-size: 12px;
    font-weight: 800;
}

.btn,
.icon-button {
    border-radius: 999px;
}

.btn-primary {
    --bs-btn-bg: var(--red);
    --bs-btn-border-color: var(--red);
    --bs-btn-hover-bg: #b3151c;
    --bs-btn-hover-border-color: #b3151c;
    --bs-btn-focus-shadow-rgb: 214, 31, 38;
}

.btn-outline-primary {
    --bs-btn-color: var(--ink);
    --bs-btn-border-color: var(--line);
    --bs-btn-hover-bg: var(--red);
    --bs-btn-hover-border-color: var(--red);
    --bs-btn-hover-color: #fff;
}

.icon-button:hover {
    border-color: var(--red);
    color: var(--red);
}

.metric-card,
.surface,
.profile-band {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: none;
}

.metric-card {
    padding: 24px;
    border-top: 0;
    border-left: 3px solid var(--red);
}

.metric-card.accent-green {
    border-left-color: var(--green);
}

.metric-card.accent-gold {
    border-left-color: var(--gold);
}

.metric-card.accent-red {
    border-left-color: var(--red);
}

.metric-card strong {
    font-size: 34px;
    font-weight: 800;
}

.surface {
    padding: 24px;
}

.data-row {
    padding: 14px 18px;
    border-radius: 12px;
}

.data-row:hover {
    border-color: rgba(214, 31, 38, .25);
    background: rgba(214, 31, 38, .02);
}

.form-control,
.form-select {
    border-radius: 11px;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--red);
    box-shadow: 0 0 0 .22rem rgba(214, 31, 38, .12);
}

.data-table {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
}

.data-table thead th {
    padding: 14px 18px;
    background: #fafafa;
    font-size: 11.5px;
}

.data-table td {
    padding: 18px;
}

.data-table tbody tr:hover {
    background: rgba(214, 31, 38, .02);
}

.consent-box,
.interaction-form,
.timeline-item,
.deal-card,
.data-row {
    background: #fff;
}

.consent-box,
.timeline-item,
.deal-card {
    border-radius: 12px;
}

.kanban-column {
    background: #fff;
}

.deal-card {
    border-left-width: 3px;
    box-shadow: none;
}

.matrix-head {
    background: #fafafa;
}

.kanban-filters {
    padding: 20px;
}

.kanban-filter-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(160px, 1fr));
    gap: 14px;
    align-items: end;
}

.kanban-filter-grid .form-label {
    color: var(--graphite);
    font-size: 11.5px;
    font-weight: 800;
    text-transform: uppercase;
}

.kanban-filter-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.kanban-board {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    align-items: start;
    overflow-x: auto;
    padding-bottom: 4px;
}

.kanban-stage {
    min-width: 280px;
    min-height: 620px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
}

.kanban-stage-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    min-height: 72px;
    padding: 16px;
    border-bottom: 1px solid var(--line);
    background: #fafafa;
    border-radius: var(--radius) var(--radius) 0 0;
}

.kanban-stage-head h2 {
    margin: 0;
    font-size: 14px;
    font-weight: 800;
}

.kanban-stage-head small {
    color: var(--muted);
    font-size: 12px;
}

.kanban-stage-head strong {
    color: var(--red);
    font-size: 13px;
    white-space: nowrap;
}

.kanban-stage-lane {
    display: grid;
    align-content: start;
    gap: 12px;
    min-height: 540px;
    padding: 12px;
}

.kanban-stage-lane.is-over {
    background: rgba(214, 31, 38, .035);
}

.kanban-card {
    display: grid;
    gap: 10px;
    padding: 14px;
    border: 1px solid var(--line);
    border-left: 3px solid var(--green);
    border-radius: 12px;
    background: #fff;
    cursor: grab;
}

.kanban-card.is-warning {
    border-left-color: var(--gold);
}

.kanban-card.is-stale {
    border-left-color: var(--red);
}

.kanban-card.is-dragging {
    opacity: .55;
}

.kanban-card.was-moved {
    box-shadow: 0 0 0 3px rgba(25, 122, 63, .12);
}

.kanban-card-top {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.kanban-card-top strong {
    font-size: 14.5px;
    line-height: 1.25;
}

.kanban-card p {
    margin: 0;
    color: var(--graphite);
    font-size: 13px;
}

.kanban-card-meta {
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 5px 8px;
    margin: 0;
    font-size: 12px;
}

.kanban-card-meta dt {
    color: var(--muted);
    font-weight: 800;
}

.kanban-card-meta dd {
    margin: 0;
    color: var(--graphite);
    overflow-wrap: anywhere;
}

.kanban-card-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    color: var(--muted);
    font-size: 12px;
}

.kanban-card-open {
    justify-self: start;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--red);
    font-size: 12.5px;
    font-weight: 800;
}

.kanban-empty {
    margin: 0;
    padding: 22px 12px;
    border: 1px dashed var(--line);
    border-radius: 12px;
    color: var(--muted);
    text-align: center;
    font-size: 13px;
}

.kanban-panel {
    --bs-offcanvas-width: min(440px, 92vw);
}

.kanban-panel .offcanvas-header {
    align-items: flex-start;
    border-bottom: 1px solid var(--line);
}

.kanban-panel h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 800;
}

.kanban-panel-sections {
    display: grid;
    gap: 12px;
    margin: 22px 0;
}

.kanban-panel-sections section {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
}

.kanban-panel-sections h3 {
    margin: 0 0 6px;
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
}

.kanban-panel-sections p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.task-filter {
    grid-template-columns: minmax(220px, 1fr) minmax(140px, 180px) minmax(150px, 190px) minmax(140px, 180px) auto;
}

.adm-linklike,
.inline-delete button {
    display: inline-flex;
    margin-left: 12px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--graphite);
    font: inherit;
    font-size: 12.5px;
    font-weight: 800;
}

.adm-linklike:hover,
.inline-delete button:hover {
    color: var(--red);
    text-decoration: none;
}

.inline-delete {
    display: inline;
}

.priority-urgent,
.proposal-rejected {
    background: var(--red-soft);
    color: var(--red);
}

.priority-high,
.proposal-negotiation,
.proposal-sent {
    background: var(--gold-soft);
    color: var(--gold);
}

.priority-low,
.proposal-draft,
.proposal-cancelled {
    background: rgba(11, 11, 11, .05);
    color: var(--muted);
}

.priority-normal,
.proposal-approved {
    background: var(--green-soft);
    color: var(--green);
}

.email-sent,
.automation-success {
    background: var(--green-soft);
    color: var(--green);
}

.email-failed,
.automation-failed {
    background: var(--red-soft);
    color: var(--red);
}

.email-queued,
.automation-skipped {
    background: var(--gold-soft);
    color: var(--gold);
}

.integration-active {
    background: var(--green-soft);
    color: var(--green);
}

.integration-revoked,
.integration-inactive {
    background: rgba(11, 11, 11, .05);
    color: var(--muted);
}

.token-alert {
    border-left: 3px solid var(--red);
}

.code-sample {
    max-height: 520px;
    margin: 0;
    padding: 18px;
    overflow: auto;
    border-radius: 12px;
    background: #101010;
    color: #f2f2f2;
    font-size: 12.5px;
    line-height: 1.65;
    white-space: pre-wrap;
}

.code-sample code {
    color: inherit;
    font: inherit;
}

.template-body {
    min-height: 260px;
    font-family: "SF Mono", Monaco, Consolas, monospace;
    font-size: 13px;
    line-height: 1.6;
}

.automation-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
}

.automation-card {
    display: grid;
    gap: 16px;
    align-content: space-between;
    min-height: 260px;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
}

.automation-card h3 {
    margin: 14px 0 6px;
    font-size: 18px;
    font-weight: 800;
}

.automation-card p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.report-hero {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 24px;
}

.report-hero p:last-child {
    max-width: 560px;
    margin: 8px 0 0;
}

.report-filter {
    grid-template-columns: repeat(2, minmax(150px, 1fr)) auto;
    align-items: end;
    min-width: min(100%, 520px);
    margin: 0;
}

.audit-filter {
    grid-template-columns: minmax(210px, 1fr) minmax(160px, 210px) minmax(150px, 190px) 150px 150px auto;
}

.lgpd-filter {
    grid-template-columns: minmax(240px, 1fr) auto auto;
}

.section-tabs {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
    padding: .3rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
}

.section-tabs a {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: .45rem .85rem;
    border-radius: 6px;
    color: var(--graphite);
    font-weight: 800;
}

.section-tabs a:hover,
.section-tabs a.active {
    background: var(--green-soft);
    color: var(--green);
    text-decoration: none;
}

.finance-hero {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 1.25rem;
}

.finance-hero p:last-child {
    max-width: 720px;
    margin: .5rem 0 0;
}

.billing-run {
    display: grid;
    gap: .4rem;
    min-width: min(100%, 430px);
}

.billing-run > div {
    display: grid;
    grid-template-columns: minmax(150px, 1fr) auto;
    gap: .6rem;
}

.finance-filter {
    grid-template-columns: minmax(220px, 1fr) minmax(130px, 160px) minmax(130px, 160px) 150px 150px auto;
}

.fiscal-filter {
    grid-template-columns: minmax(240px, 1fr) minmax(140px, 170px) minmax(130px, 150px) minmax(140px, 170px) auto;
}

.shipping-filter {
    grid-template-columns: minmax(240px, 1fr) minmax(150px, 180px) minmax(150px, 190px) auto;
}

.product-filter {
    grid-template-columns: minmax(240px, 1fr) minmax(140px, 170px) minmax(130px, 160px) minmax(150px, 180px) auto;
}

.inventory-filter {
    grid-template-columns: minmax(260px, 1fr) minmax(150px, 180px) auto;
}

.order-filter {
    grid-template-columns: minmax(220px, 1fr) minmax(130px, 160px) minmax(150px, 180px) 150px 150px auto;
}

.finance-chart {
    display: grid;
    gap: .8rem;
}

.finance-chart.compact {
    gap: .7rem;
}

.chart-row {
    display: grid;
    grid-template-columns: minmax(76px, 96px) minmax(120px, 1fr) minmax(98px, auto);
    align-items: center;
    gap: .75rem;
    color: var(--graphite);
    font-size: .86rem;
    font-weight: 800;
}

.chart-bars {
    display: grid;
    gap: .25rem;
}

.bar {
    display: block;
    height: 9px;
    min-width: 5px;
    border-radius: 999px;
    background: var(--green);
}

.bar.billed {
    background: var(--green);
}

.bar.received {
    background: var(--sky);
}

.bar.payable {
    background: var(--red);
}

.chart-legend {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 1rem;
    color: var(--muted);
    font-size: .84rem;
    font-weight: 800;
}

.chart-legend span {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
}

.chart-legend .bar {
    width: 26px;
}

.quick-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .8rem;
}

.quick-actions a {
    display: flex;
    align-items: center;
    gap: .85rem;
    min-height: 88px;
    padding: .9rem;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--ink);
}

.quick-actions a:hover {
    border-color: color-mix(in srgb, var(--green) 45%, white);
    text-decoration: none;
}

.quick-actions i {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 6px;
    background: var(--green-soft);
    color: var(--green);
    font-size: 1.1rem;
}

.quick-actions span {
    display: grid;
    gap: .12rem;
}

.quick-actions small {
    color: var(--muted);
}

.compact-details {
    grid-template-columns: 128px minmax(0, 1fr);
}

.inline-form {
    display: inline;
}

.inline-form .adm-linklike {
    cursor: pointer;
}

.adm-linklike.danger,
.inline-form .danger {
    color: var(--red);
}

.finance-open {
    background: var(--gold-soft);
    color: var(--gold);
}

.finance-paid {
    background: var(--green-soft);
    color: var(--green);
}

.finance-overdue {
    background: var(--red-soft);
    color: var(--red);
}

.finance-cancelled {
    background: rgba(11, 11, 11, .05);
    color: var(--muted);
}

.operation-draft {
    background: rgba(11, 11, 11, .05);
    color: var(--muted);
}

.operation-queued,
.operation-quoted,
.operation-pending,
.operation-processing,
.operation-label_ready,
.operation-posted,
.operation-in_transit {
    background: var(--gold-soft);
    color: var(--gold);
}

.operation-issued,
.operation-paid,
.operation-fulfilled,
.operation-delivered {
    background: var(--green-soft);
    color: var(--green);
}

.operation-rejected,
.operation-refunded,
.operation-error {
    background: var(--red-soft);
    color: var(--red);
}

.operation-cancelled {
    background: rgba(11, 11, 11, .05);
    color: var(--muted);
}

.compact-header {
    margin-bottom: .75rem;
}

.compact-header h3 {
    margin: 0;
    font-size: 1rem;
}

.order-items-grid {
    display: grid;
    grid-template-columns: minmax(170px, 1.2fr) minmax(180px, 1fr) 88px 110px 100px;
    gap: .5rem;
    align-items: start;
}

.order-item-head {
    color: var(--muted);
    font-size: .78rem;
    font-weight: 900;
    text-transform: uppercase;
}

.compact-actions {
    grid-template-columns: 1fr;
}

.surface-subgrid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.operation-panel {
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: rgba(255, 255, 255, .64);
}

.operation-panel h3 {
    margin-bottom: .8rem;
    font-size: 1rem;
}

.json-preview {
    min-height: 180px;
    max-height: 420px;
    padding: .85rem;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #0f1720;
    color: #e8eef6;
    font-size: .82rem;
    line-height: 1.45;
}

.report-bars {
    display: grid;
    gap: 14px;
}

.report-bar {
    display: grid;
    grid-template-columns: minmax(120px, 180px) minmax(140px, 1fr) 44px;
    align-items: center;
    gap: 12px;
    color: var(--graphite);
    font-size: 13px;
    font-weight: 800;
}

.report-bar div {
    height: 10px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(11, 11, 11, .06);
}

.report-bar i {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--red);
}

.report-bar strong {
    text-align: right;
}

.compact-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 12px;
}

.compact-kpi-grid div {
    display: grid;
    gap: 4px;
    min-height: 96px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
}

.compact-kpi-grid span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.compact-kpi-grid strong {
    align-self: end;
    font-size: 30px;
    line-height: 1;
    font-weight: 850;
}

.audit-json {
    display: block;
    max-width: 320px;
    max-height: 74px;
    overflow: auto;
    padding: 8px;
    border-radius: 10px;
    background: #f8f8f8;
    color: var(--graphite);
    font-size: 11.5px;
    white-space: pre-wrap;
}

.audit-entity {
    background: rgba(11, 11, 11, .05);
    color: var(--graphite);
}

.lgpd-actions {
    display: grid;
    align-content: start;
    gap: 16px;
}

.email-unsubscribed,
.email-bounced {
    background: var(--red-soft);
    color: var(--red);
}

.deploy-checklist {
    display: grid;
    gap: 10px;
    counter-reset: deploy-step;
}

.deploy-checklist li {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    min-height: 58px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    list-style: none;
}

.deploy-checklist li::before {
    counter-increment: deploy-step;
    content: counter(deploy-step);
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--red-soft);
    color: var(--red);
    font-weight: 900;
}

.deploy-checklist strong {
    display: block;
    font-size: 14px;
}

.deploy-checklist small {
    color: var(--muted);
}

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

    .app-sidebar {
        position: static;
        align-items: flex-start;
        flex-direction: column;
        height: auto;
        padding: 16px 24px;
    }

    .sidebar-nav {
        display: grid;
        grid-template-columns: 1fr;
        width: 100%;
    }

    .sidebar-group {
        width: 100%;
    }

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

    .sidebar-nav a {
        justify-content: flex-start;
    }

    .task-filter {
        grid-template-columns: 1fr 1fr;
    }

    .report-hero {
        align-items: stretch;
        flex-direction: column;
    }

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

    .billing-run > div,
    .finance-filter,
    .fiscal-filter,
    .shipping-filter,
    .product-filter,
    .inventory-filter,
    .order-filter,
    .order-items-grid,
    .quick-actions,
    .report-filter,
    .audit-filter,
    .lgpd-filter,
    .surface-subgrid {
        grid-template-columns: 1fr;
    }

    .report-bar {
        grid-template-columns: 1fr 52px;
    }

    .report-bar div {
        grid-column: 1 / -1;
    }

    .deploy-checklist li {
        grid-template-columns: 34px minmax(0, 1fr);
    }
}

@media (max-width: 760px) {
    .topbar,
    .main-region,
    .legal-topbar,
    .legal-main {
        width: min(100% - 32px, 1180px);
    }

    .topbar {
        padding: 30px 0 22px;
    }

    .topbar h1,
    .profile-band h2 {
        font-size: 30px;
    }

    .main-region {
        padding-bottom: 48px;
    }

    .kanban-filter-grid {
        grid-template-columns: 1fr;
    }

    .task-filter {
        grid-template-columns: 1fr;
    }

    .finance-filter,
    .fiscal-filter,
    .shipping-filter,
    .product-filter,
    .inventory-filter,
    .order-filter,
    .order-items-grid,
    .quick-actions,
    .report-filter,
    .audit-filter,
    .lgpd-filter,
    .surface-subgrid {
        grid-template-columns: 1fr;
    }

    .kanban-board {
        grid-template-columns: repeat(7, minmax(280px, 82vw));
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
    }
}

/* ===== Ajustes v28.1: submenu no topo + melhor uso do espaço ===== */
.subnav-top {
    position: sticky;
    top: 86px;
    z-index: 9;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .4rem;
    padding: .55rem 1.6rem;
    border-bottom: 1px solid var(--line);
    background: rgba(244, 246, 248, .94);
    backdrop-filter: blur(14px);
}
.subnav-top-parent {
    font-weight: 800;
    font-size: .74rem;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--muted, #6b7280);
    margin-right: .5rem;
    display: inline-flex;
    align-items: center;
    gap: .4rem;
}
.subnav-top a {
    padding: .4rem .85rem;
    border-radius: 999px;
    font-weight: 650;
    font-size: .9rem;
    color: var(--ink, #1f2937);
    white-space: nowrap;
}
.subnav-top a:hover { background: #e9edf2; text-decoration: none; }
.subnav-top a.active { background: var(--brand, #1a1a1a); color: #fff; }

/* Formulários e conteúdo aproveitando mais a largura da tela */
.form-surface { max-width: none; }
.main-region { padding: 1.5rem 1.8rem; }
@media (min-width: 1280px) {
    .form-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1700px) {
    .form-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
    .subnav-top { top: 0; padding: .5rem .9rem; }
}

/* ===== Ajustes v28.2: navegação mobile (gaveta off-canvas) ===== */
.nav-toggle { display: none; }
.topbar-lead { display: flex; align-items: center; gap: .65rem; min-width: 0; }
.nav-toggle {
    align-items: center; justify-content: center;
    width: 42px; height: 42px; flex: 0 0 auto;
    border: 1px solid var(--line); border-radius: 10px;
    background: #fff; color: var(--ink, #1f2937); font-size: 1.3rem; cursor: pointer;
}
.nav-toggle:hover { background: #f0f2f5; }

@media (max-width: 992px) {
    .nav-toggle { display: inline-flex; }
    .app-shell { display: block; }
    .app-sidebar {
        position: fixed; top: 0; left: 0;
        width: min(86vw, 320px); height: 100vh;
        transform: translateX(-100%); transition: transform .25s ease;
        z-index: 1000; overflow-y: auto;
        box-shadow: 0 0 40px rgba(0,0,0,.20);
    }
    body.nav-open .app-sidebar { transform: translateX(0); }
    .nav-backdrop {
        position: fixed; inset: 0; z-index: 999;
        background: rgba(0,0,0,.45); border: 0; opacity: 0; visibility: hidden;
        transition: opacity .2s ease;
    }
    body.nav-open .nav-backdrop { opacity: 1; visibility: visible; }
    body.nav-open { overflow: hidden; }

    .topbar { position: sticky; top: 0; width: auto; padding: .8rem 1rem; min-height: 64px; }
    .topbar h1 { font-size: 1.25rem; }
    .topbar .eyebrow { font-size: .68rem; }
    .main-region { width: auto; padding: 1rem; }
    .surface { padding: 1rem; }

    /* Submenu do topo rola horizontalmente no celular */
    .subnav-top {
        top: 64px; padding: .5rem .8rem;
        flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch;
    }
    .subnav-top::-webkit-scrollbar { height: 0; }

    /* Tabelas: rolagem horizontal suave e fonte um pouco menor */
    .table-responsive { -webkit-overflow-scrolling: touch; }
    .data-table { font-size: .9rem; }

    /* Cabeçalhos de seção empilham botão de ação abaixo do título */
    .surface-header { flex-direction: column; align-items: flex-start; gap: .6rem; }
    .surface-header > * { width: 100%; }
}

@media (max-width: 560px) {
    .form-actions { flex-direction: column; align-items: stretch; }
    .form-actions .btn { width: 100%; }
    .topbar-actions .user-chip { display: none; }
}

/* ===== v28.3: desktop fluido + correções mobile ===== */

/* DESKTOP (>=993px): conteúdo mais largo, campos fluidos, sem hambúrguer */
@media (min-width: 993px) {
    .nav-toggle { display: none; }
    .topbar,
    .main-region {
        width: auto;
        max-width: 1680px;
        padding-left: 2rem;
        padding-right: 2rem;
    }
    /* Campos se auto-ajustam ao espaço disponível (fluido) */
    .form-grid { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
    .form-surface { max-width: none; }
}

/* MOBILE (<=992px): gaveta off-canvas, topbar compacta colada no topo */
@media (max-width: 992px) {
    .app-shell { display: block; }
    .app-content { width: 100%; }
    .app-sidebar {
        position: fixed; top: 0; left: 0;
        width: min(86vw, 320px); height: 100vh;
        transform: translateX(-100%); transition: transform .25s ease;
        z-index: 1000; overflow-y: auto; box-shadow: 0 0 40px rgba(0,0,0,.2);
    }
    body.nav-open .app-sidebar { transform: translateX(0); }
    .nav-toggle { display: inline-flex; }
    .topbar {
        position: sticky; top: 0; z-index: 30;
        width: 100%; margin: 0; padding: .7rem 1rem; min-height: 58px;
        align-items: center; background: rgba(244,246,248,.96);
        backdrop-filter: blur(14px); border-bottom: 1px solid var(--line);
    }
    .topbar h1 { font-size: 1.2rem; }
    .topbar .eyebrow { font-size: .66rem; }
    .main-region { width: 100%; margin: 0; padding: 1rem; }
    .subnav-top { top: 58px; flex-wrap: nowrap; overflow-x: auto; }
}

/* ===== v28.4: sidebar retrátil (gaveta) em qualquer tela ===== */
.app-shell { display: block; }
.app-content { width: 100%; min-width: 0; }

.app-sidebar {
    position: fixed; top: 0; left: 0;
    width: min(86vw, 300px); height: 100vh;
    transform: translateX(-100%); transition: transform .25s ease;
    z-index: 1000; overflow-y: auto; box-shadow: 0 0 40px rgba(0,0,0,.22);
}
body.nav-open .app-sidebar { transform: translateX(0); }
body.nav-open { overflow: hidden; }

.nav-backdrop {
    position: fixed; inset: 0; z-index: 999; border: 0;
    background: rgba(0,0,0,.42); opacity: 0; visibility: hidden;
    transition: opacity .2s ease;
}
body.nav-open .nav-backdrop { opacity: 1; visibility: visible; }

.nav-toggle { display: inline-flex; }
.topbar-brand-link { display: inline-flex; align-items: center; }
.topbar-brand { height: 30px; width: auto; display: block; }
.topbar-title { min-width: 0; }

/* Topbar e conteúdo ocupam a largura toda */
.topbar {
    position: sticky; top: 0; z-index: 30;
    width: auto; max-width: none; margin: 0;
    padding: .85rem 1.6rem; min-height: 64px; align-items: center;
    background: rgba(244,246,248,.96); backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
}
.topbar h1 { font-size: 1.4rem; }
.main-region { width: auto; max-width: none; margin: 0; padding: 1.4rem 1.6rem 3rem; }
.subnav-top { position: static; }

/* Campos fluidos preenchendo a tela */
.form-grid { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.form-surface { max-width: none; }

/* Ajustes finos no celular */
@media (max-width: 768px) {
    .topbar { padding: .6rem .9rem; min-height: 54px; }
    .topbar h1 { font-size: 1.15rem; }
    .topbar-brand { height: 24px; }
    .topbar-title .eyebrow { display: none; }
    .main-region { padding: 1rem .9rem 2.5rem; }
    .form-grid { grid-template-columns: 1fr; }
}

/* ===== v28.5: ajustes topbar (links no topo, título Dashboard centralizado) ===== */
.topbar-link {
    display: inline-flex; align-items: center; gap: .4rem;
    padding: .45rem .7rem; border-radius: 999px;
    color: var(--ink, #1f2937); font-weight: 650; font-size: .88rem;
    border: 1px solid var(--line);
}
.topbar-link:hover { background: #eef1f5; text-decoration: none; }

/* Título centralizado apenas no Dashboard (telas grandes) */
@media (min-width: 769px) {
    .topbar.is-dashboard .topbar-title {
        position: absolute; left: 0; right: 0; margin: 0 auto;
        text-align: center; pointer-events: none; max-width: 60%;
    }
}

/* No celular, os links viram só ícone para caber */
@media (max-width: 900px) {
    .topbar-link-text { display: none; }
    .topbar-link { padding: .45rem; }
}

/* ===== v28.6: títulos centralizados, logo +30%, editor (esquerda mínima / prévia ampla) ===== */
.topbar { display: grid; grid-template-columns: auto 1fr auto; gap: 1rem; align-items: center; }
.topbar-title { text-align: center; min-width: 0; }
.topbar-title h1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Logo 30% maior */
.topbar-brand { height: 40px; }
.app-sidebar .brand-lockup .brand-logo { max-width: 185px; max-height: 47px; }
.auth-brand .brand-logo { max-width: 224px; max-height: 55px; }

/* Editor de blocos: coluna de campos mínima, prévia ocupando o restante */
.editor-split {
    display: grid;
    grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
    gap: 1.2rem; align-items: start;
}
.editor-preview-wrap { position: sticky; top: 76px; }

@media (max-width: 900px) {
    .editor-split { grid-template-columns: 1fr; }
    .editor-preview-wrap { position: static; }
    .topbar-title h1 { font-size: 1.1rem; }
}

/* ===== v28.7: breadcrumb no título (ícone + seção) ===== */
.breadcrumb-eyebrow { display: inline-flex; align-items: center; gap: .35rem; justify-content: center; }

/* ===== v28.9: título em linha única (seção | página) ===== */
.topbar-crumb {
    display: flex; align-items: center; justify-content: center;
    gap: .55rem; margin: 0; font-weight: 800; line-height: 1.2;
    font-size: 1.35rem; min-width: 0;
}
.crumb-section {
    display: inline-flex; align-items: center; gap: .3rem;
    font-size: .8rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
    color: var(--brand, var(--red, #c0202f)); white-space: nowrap;
}
.crumb-sep { color: #c9ced6; font-weight: 400; }
.crumb-page { font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 768px) {
    .topbar-crumb { flex-wrap: wrap; gap: .25rem .5rem; font-size: 1.05rem; }
    .crumb-section { font-size: .68rem; }
}

/* === Fase A: busca global + sino de notificações === */
.topbar-search{display:flex;align-items:center;gap:.4rem;background:#f1f5f9;border:1px solid #e2e8f0;border-radius:10px;padding:.35rem .6rem;min-width:180px}
.topbar-search i{color:#64748b}
.topbar-search input{border:0;background:transparent;outline:none;font-size:.9rem;width:100%}
@media (max-width:720px){.topbar-search{display:none}}
.topbar-bell{position:relative}
.bell-badge{position:absolute;top:-4px;right:-4px;background:#ef4444;color:#fff;border-radius:999px;font-size:.62rem;line-height:1;padding:.2rem .35rem;font-weight:700}
.bell-panel{position:absolute;right:0;top:120%;width:320px;max-width:90vw;background:#fff;border:1px solid #e2e8f0;border-radius:12px;box-shadow:0 12px 32px rgba(15,23,42,.16);z-index:60;overflow:hidden}
.bell-panel-head{display:flex;justify-content:space-between;align-items:center;padding:.6rem .8rem;border-bottom:1px solid #f1f5f9}
.bell-readall{border:0;background:none;color:#2563eb;font-size:.78rem;cursor:pointer}
.bell-list{max-height:340px;overflow:auto}
.bell-empty{padding:1rem;color:#94a3b8;text-align:center;margin:0;font-size:.85rem}
.bell-item{display:flex;gap:.6rem;padding:.6rem .8rem;border-bottom:1px solid #f8fafc;color:#0f172a;text-decoration:none}
.bell-item:hover{background:#f8fafc}
.bell-item.unread{background:#eff6ff}
.bell-item i{color:#2563eb;font-size:1.1rem;margin-top:.1rem}
.bell-item small{display:block;color:#64748b}
.bell-all{display:block;text-align:center;padding:.55rem;border-top:1px solid #f1f5f9;color:#2563eb;text-decoration:none;font-size:.85rem}
/* Calendário geral */
.cal-grid{display:grid;grid-template-columns:repeat(7,1fr);gap:6px}
.cal-cell{min-height:96px;border:1px solid #e2e8f0;border-radius:8px;padding:.35rem;background:#fff}
.cal-cell .cal-day{font-weight:700;color:#475569;font-size:.8rem}
.cal-ev{display:block;font-size:.72rem;border-radius:6px;padding:.12rem .35rem;margin-top:.2rem;color:#fff;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.cal-dow{font-weight:700;color:#64748b;text-align:center;font-size:.78rem;padding:.2rem 0}
/* Booking público */
.booking-slot{display:inline-block;margin:.2rem;padding:.45rem .7rem;border:1px solid #cbd5e1;border-radius:8px;cursor:pointer;background:#fff}
.booking-slot input{display:none}
.booking-slot.sel{background:#2563eb;color:#fff;border-color:#2563eb}
/* WhatsApp inbox */
.wa-layout{display:grid;grid-template-columns:300px 1fr;gap:1rem}
@media (max-width:820px){.wa-layout{grid-template-columns:1fr}}
.wa-conv{display:block;padding:.6rem .7rem;border:1px solid #e2e8f0;border-radius:10px;margin-bottom:.5rem;text-decoration:none;color:#0f172a}
.wa-conv.active{border-color:#2563eb;background:#eff6ff}
.wa-thread{display:flex;flex-direction:column;gap:.5rem;max-height:52vh;overflow:auto;padding:.4rem}
.wa-msg{max-width:75%;padding:.5rem .7rem;border-radius:12px;font-size:.9rem}
.wa-msg.in{align-self:flex-start;background:#f1f5f9}
.wa-msg.out{align-self:flex-end;background:#dcfce7}
.wa-msg small{display:block;color:#94a3b8;font-size:.68rem;margin-top:.2rem}

/* === Fase B: projetos, quadro de tarefas, gantt === */
.project-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:1rem}
.project-card{border:1px solid #e2e8f0;border-radius:12px;overflow:hidden;background:#fff;display:flex}
.project-card-bar{width:6px;flex:0 0 6px}
.project-card-body{padding:.8rem 1rem;flex:1}
.project-card-title{font-weight:700;color:#0f172a;text-decoration:none}
.task-board{display:grid;grid-template-columns:repeat(5,minmax(180px,1fr));gap:.6rem;overflow-x:auto}
.task-col{background:#f8fafc;border:1px solid #e2e8f0;border-radius:10px;display:flex;flex-direction:column;min-height:120px}
.task-col-head{display:flex;justify-content:space-between;align-items:center;padding:.5rem .7rem;font-weight:700;color:#475569;border-bottom:1px solid #e2e8f0}
.task-col-count{background:#e2e8f0;border-radius:999px;font-size:.72rem;padding:.05rem .45rem}
.task-col-body{padding:.5rem;display:flex;flex-direction:column;gap:.5rem;flex:1;min-height:60px}
.task-col-body.drop-hover{background:#eff6ff;outline:2px dashed #93c5fd;outline-offset:-4px;border-radius:8px}
.task-card{position:relative;background:#fff;border:1px solid #e2e8f0;border-radius:9px;padding:.55rem .6rem .55rem .8rem;cursor:grab;box-shadow:0 1px 2px rgba(15,23,42,.05)}
.task-card.dragging{opacity:.5}
.task-card-prio{position:absolute;left:0;top:0;bottom:0;width:5px;border-radius:9px 0 0 9px}
.task-card-title{display:block;font-weight:600;color:#0f172a;text-decoration:none;font-size:.88rem;margin-bottom:.3rem}
.task-card-meta{display:flex;flex-wrap:wrap;gap:.5rem;font-size:.72rem;color:#64748b}
@media (max-width:900px){.task-board{grid-template-columns:repeat(5,minmax(160px,1fr))}}
.gantt-wrap{overflow-x:auto;border:1px solid #e2e8f0;border-radius:10px}
.gantt{border-collapse:collapse;font-size:.78rem}
.gantt th,.gantt td{border:1px solid #eef2f7;text-align:center;height:34px}
.gantt-task-col{position:sticky;left:0;background:#fff;text-align:left!important;min-width:200px;max-width:220px;padding:0 .6rem;z-index:2}
.gantt-day{color:#64748b;line-height:1}
.gantt-day small{display:block;font-size:.6rem;text-transform:uppercase}
.gantt-today{background:#eff6ff}
.gantt-cell{padding:0}
.gantt-bar{display:block;height:16px;border-radius:4px;margin:0 3px}

/* === Fase B Marketing: landing pública + BI === */
.landing-public{padding:1rem 0}
.landing-headline{font-size:2rem;font-weight:800;line-height:1.15;margin-bottom:.5rem}
.landing-sub{font-size:1.1rem;color:#475569;margin-bottom:1rem}
.landing-body{margin-bottom:1.2rem;line-height:1.6}
.landing-form{background:#fff;border:1px solid #e2e8f0;border-radius:14px;padding:1.2rem;box-shadow:0 8px 28px rgba(15,23,42,.08)}
.bi-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(280px,1fr));gap:1rem}
.bi-card{background:#fff;border:1px solid #e2e8f0;border-radius:12px;padding:1rem}
.bi-card h4{font-size:.95rem;margin-bottom:.6rem;color:#334155}
.bi-kpi{display:flex;flex-direction:column;justify-content:center;gap:.3rem;background:linear-gradient(135deg,#0f172a,#1e293b);color:#fff}
.bi-kpi-label{font-size:.8rem;color:#cbd5e1}
.bi-kpi-value{font-size:1.8rem;font-weight:800}

/* === Fase C: base de conhecimento === */
.kb-body{line-height:1.7;max-width:760px}
.kb-body h2{font-size:1.25rem;margin:1.2rem 0 .5rem}
.kb-body h3{font-size:1.05rem;margin:1rem 0 .4rem}
.kb-body p{margin-bottom:.8rem}
.kb-body ul,.kb-body ol{margin:0 0 .8rem 1.2rem}
.kb-body code{background:#f1f5f9;padding:.1rem .3rem;border-radius:4px}
.kb-body img{max-width:100%;border-radius:8px}

/* === v37: construtor de landing por blocos === */
.lp-block{border:1px solid #e2e8f0;border-radius:10px;margin-bottom:.7rem;background:#fff}
.lp-block-head{display:flex;justify-content:space-between;align-items:center;padding:.55rem .8rem;background:#f8fafc;border-bottom:1px solid #eef2f7;border-radius:10px 10px 0 0}
.lp-block-head strong{font-size:.92rem;color:#334155}
.lp-block-actions{display:flex;gap:.2rem}
.lp-block-body{padding:.8rem}

/* === v39: multi-atendimento + bot === */
.badge-soft{font-size:.68rem;font-weight:700}
.wa-event{align-self:center;background:#eef2f7;color:#64748b;font-size:.72rem;padding:.2rem .6rem;border-radius:999px;margin:.2rem 0}
.wa-note{align-self:flex-end;max-width:80%;background:#fef9c3;border:1px solid #fde68a;border-radius:10px;padding:.5rem .7rem;font-size:.85rem}
.wa-note small{display:block;color:#94a3b8;font-size:.66rem;margin-top:.2rem}
.wa-bot{display:inline-block;font-size:.62rem;font-weight:700;color:#7c3aed;background:#f3e8ff;border-radius:6px;padding:0 .3rem;margin-bottom:.2rem}

/* === v41: editor visual de landing === */
.lp-editor{display:grid;grid-template-columns:340px 1fr;gap:1rem;align-items:start}
@media(max-width:980px){.lp-editor{grid-template-columns:1fr}}
.lp-side{display:flex;flex-direction:column;gap:.8rem;position:sticky;top:70px;max-height:calc(100vh - 90px);overflow:auto}
.lp-side-block{background:#fff;border:1px solid #e2e8f0;border-radius:12px;padding:.8rem}
.lp-side-title{display:block;font-size:.85rem;color:#334155;margin-bottom:.5rem}
.lp-palette{display:grid;grid-template-columns:repeat(3,1fr);gap:.4rem}
.lp-pal-btn{display:flex;flex-direction:column;align-items:center;gap:.15rem;border:1px solid #e2e8f0;background:#f8fafc;border-radius:8px;padding:.45rem .2rem;cursor:pointer;font-size:.62rem;color:#475569}
.lp-pal-btn i{font-size:1rem;color:#2563eb}
.lp-pal-btn:hover{background:#eff6ff;border-color:#93c5fd}
.lp-list{list-style:none;margin:0;padding:0}
.lp-item{display:flex;align-items:center;gap:.4rem;border:1px solid #e2e8f0;border-radius:8px;padding:.4rem .5rem;margin-bottom:.35rem;background:#fff;cursor:pointer;font-size:.85rem}
.lp-item.sel{border-color:#2563eb;background:#eff6ff}
.lp-item.dragging{opacity:.4}
.lp-grip{cursor:grab;color:#cbd5e1}
.lp-item-label{flex:1}
.lp-item-actions{display:flex;gap:.1rem}
.lp-flabel{display:block;font-size:.74rem;color:#64748b;margin:.45rem 0 .15rem;font-weight:600}
.lp-stage{background:#fff;border:1px solid #e2e8f0;border-radius:12px;overflow:hidden}
.lp-stage-bar{display:flex;justify-content:space-between;align-items:center;padding:.5rem .8rem;border-bottom:1px solid #eef2f7;background:#f8fafc}
.lp-vp.active{background:#2563eb;color:#fff;border-color:#2563eb}
.lp-frame-wrap{margin:0 auto;transition:max-width .25s;max-width:100%}
.lp-frame{width:100%;height:72vh;border:0;display:block;background:#fff}
.lp-gallery{position:fixed;inset:0;background:rgba(15,23,42,.5);z-index:1000;display:grid;place-items:center;padding:20px}
.lp-gallery-box{background:#fff;border-radius:14px;padding:1rem;max-width:720px;width:100%;max-height:80vh;overflow:auto}
.lp-gallery-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(110px,1fr));gap:.5rem}
.lp-gallery-grid img{width:100%;height:80px;object-fit:cover;border-radius:8px;cursor:pointer;border:2px solid transparent}
.lp-gallery-grid img:hover{border-color:#2563eb}

/* === v43: matriz de permissões === */
.perm-table td{vertical-align:top}
.perm-table strong{font-size:.88rem}
.perm-disabled{opacity:.45;pointer-events:none}

/* === v44: assistentes de conexão === */
.wiz-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:1rem}
.wiz-card{background:#fff;border:1px solid #e2e8f0;border-radius:14px;padding:1rem;display:flex;flex-direction:column;gap:.4rem}
.wiz-card h3{font-size:1.02rem;margin:0}
.wiz-card p{font-size:.85rem;margin:0 0 .5rem;flex:1}
.wiz-icon{font-size:1.6rem;color:#2563eb}
.wiz-steps{display:flex;flex-direction:column;gap:.6rem;max-width:860px}
.wiz-step{border:1px solid #e2e8f0;border-radius:12px;background:#fff}
.wiz-step.current{border-color:#2563eb;box-shadow:0 0 0 1px #2563eb inset}
.wiz-step summary{display:flex;align-items:center;gap:.6rem;padding:.7rem .9rem;cursor:pointer;list-style:none}
.wiz-step summary::-webkit-details-marker{display:none}
.wiz-num{display:inline-grid;place-items:center;width:26px;height:26px;border-radius:50%;background:#e2e8f0;color:#475569;font-size:.8rem;font-weight:700;flex:0 0 26px}
.wiz-num.done{background:#1a7f37;color:#fff}
.wiz-body{padding:0 .9rem .9rem 2.6rem}
.wiz-doc{font-size:.92rem;color:#334155;line-height:1.6}
.wiz-doc ol,.wiz-doc ul{margin:0 0 .6rem 1.1rem}
.wiz-doc code{background:#f1f5f9;padding:.15rem .4rem;border-radius:6px;word-break:break-all}
