:root {
    --purple-950: #21113f;
    --purple-900: #30145b;
    --purple-800: #47207b;
    --purple-700: #6132a8;
    --purple-600: #7547d4;
    --purple-500: #895ff0;
    --green-700: #07855c;
    --green-600: #0da974;
    --green-500: #21c98b;
    --green-400: #54dda7;
    --ink: #201a2e;
    --muted: #756f80;
    --line: #e9e5ef;
    --surface: #ffffff;
    --surface-soft: #f8f7fa;
    --danger: #dc3e57;
    --gradient: linear-gradient(128deg, var(--purple-700) 0%, var(--purple-500) 48%, var(--green-500) 100%);
    --gradient-soft: linear-gradient(128deg, rgba(117, 71, 212, .11), rgba(33, 201, 139, .12));
    --shadow-soft: 0 18px 55px rgba(38, 20, 69, .10);
    --shadow-window: 0 28px 80px rgba(31, 15, 57, .22);
    --topbar-height: 76px;
    --taskbar-height: 58px;
    --radius-xl: 22px;
    --radius-lg: 17px;
    --radius-md: 13px;
}

* {
    box-sizing: border-box;
}

html {
    color-scheme: light;
}

body {
    margin: 0;
    min-width: 320px;
    min-height: 100vh;
    overflow: hidden;
    color: var(--ink);
    background: #f7f6f9;
    font-family: "Poppins", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}

button,
input {
    font: inherit;
}

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

button:focus-visible,
a:focus-visible,
input:focus-visible {
    outline: 3px solid rgba(117, 71, 212, .25);
    outline-offset: 2px;
}

.app-shell {
    min-height: 100vh;
    background:
        radial-gradient(circle at 7% 4%, rgba(117, 71, 212, .12), transparent 25%),
        radial-gradient(circle at 95% 18%, rgba(33, 201, 139, .12), transparent 25%),
        #f8f7fa;
}

.topbar {
    position: fixed;
    z-index: 900;
    inset: 0 0 auto 0;
    height: var(--topbar-height);
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 0 26px;
    border-bottom: 1px solid rgba(74, 52, 91, .09);
    background: rgba(255, 255, 255, .88);
    box-shadow: 0 8px 35px rgba(54, 32, 74, .045);
    backdrop-filter: blur(18px);
}

.topbar::before {
    position: absolute;
    inset: 0 0 auto;
    height: 3px;
    content: "";
    background: var(--gradient);
}

.topbar__side {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar__side--right {
    justify-content: flex-end;
}

.icon-button {
    position: relative;
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    color: #594e65;
    border: 1px solid transparent;
    border-radius: 13px;
    background: transparent;
    cursor: pointer;
    transition: .2s ease;
}

.icon-button:hover {
    color: var(--purple-700);
    border-color: rgba(117, 71, 212, .13);
    background: rgba(117, 71, 212, .07);
    transform: translateY(-1px);
}

.notification-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    border: 2px solid white;
    border-radius: 50%;
    background: #f14f6a;
}

.company-switcher {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.company-switcher__label {
    color: #8b8493;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .11em;
    line-height: 1;
    text-transform: uppercase;
}

.company-switcher__button {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 0;
    color: var(--ink);
    border: 0;
    background: transparent;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--ink);
    text-decoration: none;
}

.brand__mark {
    position: relative;
    width: 42px;
    height: 42px;
    overflow: hidden;
    flex: 0 0 42px;
    border-radius: 14px;
    background: var(--gradient);
    box-shadow: 0 9px 25px rgba(103, 61, 196, .25);
}

.brand__mark > span:first-child {
    position: absolute;
    top: 9px;
    left: 10px;
    width: 10px;
    height: 24px;
    border-radius: 7px 2px 7px 2px;
    background: rgba(255, 255, 255, .96);
    transform: skew(-12deg);
}

.brand__mark > span:last-child {
    position: absolute;
    top: 9px;
    right: 9px;
    width: 10px;
    height: 24px;
    border: 3px solid rgba(255, 255, 255, .96);
    border-left: 0;
    border-radius: 2px 8px 8px 2px;
    transform: skew(-12deg);
}

.brand__mark--small {
    width: 32px;
    height: 32px;
    flex-basis: 32px;
    border-radius: 10px;
    box-shadow: none;
    transform: scale(.86);
}

.brand__mark--small > span:first-child {
    top: 7px;
    left: 8px;
    width: 8px;
    height: 18px;
}

.brand__mark--small > span:last-child {
    top: 7px;
    right: 7px;
    width: 8px;
    height: 18px;
}

.brand__copy {
    display: flex;
    flex-direction: column;
    line-height: 1.05;
}

.brand__copy strong {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -.02em;
}

.brand__copy small {
    margin-top: 4px;
    color: #8a8292;
    font-size: 8px;
    font-weight: 600;
    letter-spacing: .15em;
    text-transform: uppercase;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 5px 7px 5px 5px;
    border: 1px solid transparent;
    border-radius: 15px;
    background: transparent;
    cursor: pointer;
    transition: .2s ease;
}

.user-menu:hover {
    border-color: rgba(117, 71, 212, .12);
    background: rgba(117, 71, 212, .055);
}

.user-menu__avatar {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: white;
    border-radius: 12px;
    background: var(--gradient);
    font-size: 11px;
    font-weight: 700;
}

.user-menu__copy {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.2;
}

.user-menu__copy strong {
    font-size: 11px;
    font-weight: 600;
}

.user-menu__copy small {
    margin-top: 2px;
    color: #8a8292;
    font-size: 9px;
}

.app-icon {
    width: 20px;
    height: 20px;
    display: inline-flex;
    flex: 0 0 20px;
}

.app-icon svg {
    width: 100%;
    height: 100%;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.app-icon--small {
    width: 14px;
    height: 14px;
    flex-basis: 14px;
}

.home {
    height: 100vh;
    overflow: auto;
    padding: calc(var(--topbar-height) + 34px) 34px calc(var(--taskbar-height) + 42px);
    scroll-behavior: smooth;
}

.home::-webkit-scrollbar,
.taskbar__items::-webkit-scrollbar {
    width: 8px;
    height: 6px;
}

.home::-webkit-scrollbar-thumb,
.taskbar__items::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(91, 65, 111, .18);
}

.welcome,
.workspace {
    width: min(1280px, 100%);
    margin-inline: auto;
}

.welcome {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 28px;
    margin-bottom: 30px;
}

.welcome__eyebrow {
    display: inline-block;
    margin-bottom: 7px;
    color: var(--purple-700);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
}

.welcome h1 {
    margin: 0;
    font-size: clamp(25px, 2.5vw, 37px);
    line-height: 1.14;
    letter-spacing: -.045em;
}

.welcome p {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.module-search {
    width: min(390px, 100%);
    height: 50px;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 0 14px;
    color: #7e7487;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(255, 255, 255, .92);
    box-shadow: 0 10px 28px rgba(50, 27, 70, .055);
    transition: .2s ease;
}

.module-search:focus-within {
    border-color: rgba(117, 71, 212, .42);
    box-shadow: 0 0 0 4px rgba(117, 71, 212, .08), 0 13px 32px rgba(50, 27, 70, .07);
}

.module-search input {
    min-width: 0;
    flex: 1;
    color: var(--ink);
    border: 0;
    outline: 0;
    background: transparent;
    font-size: 12px;
}

.module-search input::placeholder {
    color: #9a929f;
}

.module-search kbd {
    padding: 4px 7px;
    color: #8b8292;
    border: 1px solid #e8e3eb;
    border-bottom-width: 2px;
    border-radius: 7px;
    background: #faf9fb;
    font-family: inherit;
    font-size: 9px;
}

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

.module-group {
    padding: 21px;
    border: 1px solid rgba(66, 43, 84, .085);
    border-radius: var(--radius-xl);
    background: rgba(255, 255, 255, .83);
    box-shadow: 0 12px 38px rgba(45, 28, 61, .052);
    backdrop-filter: blur(14px);
    transition: .25s ease;
}

.module-group:hover {
    border-color: rgba(109, 67, 190, .15);
    box-shadow: 0 18px 48px rgba(45, 28, 61, .075);
}

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

.module-group__header h2 {
    margin: 0;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: -.01em;
}

.module-group__header p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 9px;
}

.module-group__count {
    min-width: 28px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--purple-700);
    border-radius: 9px;
    background: rgba(117, 71, 212, .09);
    font-size: 9px;
    font-weight: 700;
}

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

.module-card {
    min-width: 0;
    min-height: 72px;
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr) 16px;
    align-items: center;
    gap: 11px;
    padding: 11px;
    text-align: left;
    color: var(--ink);
    border: 1px solid #efecf2;
    border-radius: var(--radius-md);
    background: #fff;
    cursor: pointer;
    transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}

.module-card:hover {
    z-index: 1;
    border-color: rgba(117, 71, 212, .23);
    box-shadow: 0 12px 25px rgba(54, 29, 79, .085);
    transform: translateY(-2px);
}

.module-card:active {
    transform: translateY(0) scale(.99);
}

.module-card__icon {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--purple-700);
    border-radius: 12px;
    background: var(--gradient-soft);
}

.module-card:nth-child(even) .module-card__icon {
    color: var(--green-700);
    background: linear-gradient(135deg, rgba(33, 201, 139, .13), rgba(117, 71, 212, .08));
}

.module-card__copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.module-card__copy strong {
    overflow: hidden;
    font-size: 11px;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.module-card__copy small {
    overflow: hidden;
    margin-top: 3px;
    color: var(--muted);
    font-size: 8px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.module-card__arrow {
    width: 15px;
    height: 15px;
    color: #b8b0bf;
    transition: .2s ease;
}

.module-card:hover .module-card__arrow {
    color: var(--purple-600);
    transform: translateX(2px);
}

.module-card[hidden],
.module-group[hidden],
.empty-search[hidden] {
    display: none;
}

.empty-search {
    grid-column: 1 / -1;
    display: flex;
    min-height: 260px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    border: 1px dashed #dcd5e2;
    border-radius: var(--radius-xl);
    background: rgba(255, 255, 255, .64);
}

.empty-search .app-icon {
    width: 34px;
    height: 34px;
    margin-bottom: 12px;
    color: var(--purple-600);
}

.empty-search strong {
    color: var(--ink);
    font-size: 13px;
}

.empty-search p {
    margin: 5px 0 0;
    font-size: 10px;
}

.window-layer {
    position: fixed;
    z-index: 500;
    inset: var(--topbar-height) 0 var(--taskbar-height);
    pointer-events: none;
}

.app-window {
    position: absolute;
    top: 34px;
    left: 50%;
    width: min(900px, calc(100vw - 64px));
    height: min(610px, calc(100vh - var(--topbar-height) - var(--taskbar-height) - 68px));
    overflow: hidden;
    color: var(--ink);
    border: 1px solid rgba(61, 38, 82, .16);
    border-radius: 18px;
    background: var(--surface);
    box-shadow: var(--shadow-window);
    opacity: 0;
    pointer-events: auto;
    transform: translate(-50%, 18px) scale(.975);
    transition: opacity .24s ease, transform .32s cubic-bezier(.2, .85, .25, 1), width .3s ease, height .3s ease, inset .3s ease, border-radius .3s ease;
}

.app-window.is-open {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
}

.app-window.is-closing {
    opacity: 0;
    transform: translate(-50%, 14px) scale(.965);
}

.app-window.is-minimized {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, calc(100vh - 160px)) scale(.3);
}

.app-window.is-maximized {
    inset: 8px 10px;
    width: auto;
    height: auto;
    border-radius: 13px;
    transform: none;
}

.app-window.is-maximized.is-open {
    transform: none;
}

.app-window__titlebar {
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px 0 17px;
    border-bottom: 1px solid var(--line);
    background: linear-gradient(180deg, #fff, #fbfafc);
    user-select: none;
    cursor: grab;
}

.app-window__titlebar:active {
    cursor: grabbing;
}

.app-window__identity {
    display: flex;
    align-items: center;
    gap: 10px;
}

.app-window__module-icon {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: white;
    border-radius: 11px;
    background: var(--gradient);
}

.app-window__module-icon .app-icon {
    width: 17px;
    height: 17px;
}

.app-window__identity h2 {
    margin: 0;
    font-size: 12px;
    font-weight: 600;
}

.app-window__identity small {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 8px;
}

.app-window__controls {
    display: flex;
    align-items: center;
    gap: 3px;
}

.app-window__controls button {
    width: 35px;
    height: 35px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    color: #655d6c;
    border: 0;
    border-radius: 10px;
    background: transparent;
    font-size: 19px;
    cursor: pointer;
    transition: .18s ease;
}

.app-window__controls button:hover {
    color: var(--purple-700);
    background: rgba(117, 71, 212, .08);
}

.app-window__controls button:last-child:hover {
    color: white;
    background: var(--danger);
}

.maximize-symbol {
    width: 11px;
    height: 11px;
    display: inline-block;
    border: 1.7px solid currentColor;
    border-radius: 2px;
}

.app-window__body {
    height: calc(100% - 56px);
    overflow: auto;
    padding: 24px;
    background:
        radial-gradient(circle at 85% 10%, rgba(33, 201, 139, .09), transparent 24%),
        radial-gradient(circle at 8% 88%, rgba(117, 71, 212, .08), transparent 26%),
        #fbfafc;
}

.module-placeholder {
    min-height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 38px;
    text-align: center;
    border: 1px dashed rgba(99, 71, 121, .18);
    border-radius: 18px;
    background: rgba(255, 255, 255, .78);
}

.module-placeholder__icon {
    width: 68px;
    height: 68px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 18px;
    color: white;
    border-radius: 21px;
    background: var(--gradient);
    box-shadow: 0 16px 35px rgba(95, 52, 177, .24);
}

.module-placeholder__icon .app-icon {
    width: 30px;
    height: 30px;
}

.module-placeholder__eyebrow {
    color: var(--green-700);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
}

.module-placeholder h3 {
    margin: 7px 0 5px;
    font-size: 25px;
    letter-spacing: -.04em;
}

.module-placeholder > p {
    max-width: 560px;
    margin: 0;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.65;
}

.module-placeholder .module-placeholder__note {
    max-width: 620px;
    margin-top: 16px;
    padding: 12px 15px;
    border: 1px solid rgba(117, 71, 212, .10);
    border-radius: 12px;
    background: var(--gradient-soft);
    font-size: 9px;
}

.button {
    min-height: 41px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 20px;
    padding: 0 18px;
    border: 0;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: .2s ease;
}

.button--primary {
    color: white;
    background: var(--gradient);
    box-shadow: 0 12px 24px rgba(103, 61, 196, .20);
}

.button--primary:hover {
    box-shadow: 0 15px 30px rgba(103, 61, 196, .28);
    transform: translateY(-2px);
}

.taskbar {
    position: fixed;
    z-index: 1000;
    inset: auto 0 0;
    height: var(--taskbar-height);
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 18px;
    color: white;
    background: linear-gradient(110deg, #251340 0%, #44206f 58%, #096f59 130%);
    box-shadow: 0 -12px 40px rgba(32, 17, 48, .14);
}

.taskbar__home {
    width: 43px;
    height: 43px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 43px;
    padding: 0;
    border: 0;
    border-radius: 13px;
    background: rgba(255, 255, 255, .08);
    cursor: pointer;
    transition: .18s ease;
}

.taskbar__home:hover {
    background: rgba(255, 255, 255, .14);
}

.taskbar__divider {
    width: 1px;
    height: 28px;
    flex: 0 0 1px;
    background: rgba(255, 255, 255, .18);
}

.taskbar__items {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 7px;
    flex: 1;
    overflow-x: auto;
}

.taskbar__empty {
    color: rgba(255, 255, 255, .48);
    font-size: 9px;
}

.taskbar-item {
    min-width: 150px;
    max-width: 210px;
    height: 40px;
    display: grid;
    grid-template-columns: 25px minmax(0, 1fr) 24px;
    align-items: center;
    gap: 7px;
    padding: 0 6px 0 9px;
    color: white;
    border: 1px solid rgba(255, 255, 255, .10);
    border-radius: 11px;
    background: rgba(255, 255, 255, .105);
    cursor: pointer;
    transition: .18s ease;
}

.taskbar-item:hover,
.taskbar-item.is-active {
    border-color: rgba(255, 255, 255, .18);
    background: rgba(255, 255, 255, .17);
}

.taskbar-item::after {
    position: absolute;
    content: "";
}

.taskbar-item__icon {
    width: 25px;
    height: 25px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #b8ffe3;
    border-radius: 8px;
    background: rgba(255, 255, 255, .09);
}

.taskbar-item__icon .app-icon {
    width: 14px;
    height: 14px;
}

.taskbar-item__title {
    overflow: hidden;
    font-size: 9px;
    font-weight: 500;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.taskbar-item__close {
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, .72);
    border: 0;
    border-radius: 7px;
    background: transparent;
    cursor: pointer;
}

.taskbar-item__close:hover {
    color: white;
    background: rgba(255, 255, 255, .12);
}

.taskbar__clock {
    min-width: 112px;
    padding-left: 13px;
    text-align: right;
    color: rgba(255, 255, 255, .82);
    border-left: 1px solid rgba(255, 255, 255, .18);
    font-size: 8px;
    line-height: 1.5;
}

@media (max-width: 900px) {
    .topbar {
        padding-inline: 15px;
    }

    .company-switcher,
    .user-menu__copy,
    .user-menu > .app-icon,
    .brand__copy small {
        display: none;
    }

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

    .welcome {
        align-items: stretch;
        flex-direction: column;
        gap: 18px;
    }

    .module-search {
        width: 100%;
    }

    .app-window {
        width: calc(100vw - 28px);
    }
}

@media (max-width: 580px) {
    :root {
        --topbar-height: 65px;
        --taskbar-height: 54px;
    }

    .topbar {
        grid-template-columns: 44px 1fr 82px;
        padding-inline: 9px;
    }

    .topbar__side {
        gap: 1px;
    }

    .brand {
        justify-self: center;
    }

    .brand__mark {
        width: 37px;
        height: 37px;
        flex-basis: 37px;
        border-radius: 12px;
    }

    .brand__copy strong {
        font-size: 12px;
    }

    .user-menu {
        padding: 2px;
    }

    .user-menu__avatar {
        width: 34px;
        height: 34px;
    }

    .home {
        padding: calc(var(--topbar-height) + 24px) 14px calc(var(--taskbar-height) + 26px);
    }

    .welcome {
        margin-bottom: 20px;
    }

    .welcome h1 {
        font-size: 26px;
    }

    .module-group {
        padding: 16px;
        border-radius: 18px;
    }

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

    .module-card {
        min-height: 66px;
    }

    .app-window,
    .app-window.is-maximized {
        inset: 6px;
        width: auto;
        height: auto;
        border-radius: 13px;
        transform: none;
    }

    .app-window.is-open {
        transform: none;
    }

    .app-window__body {
        padding: 13px;
    }

    .module-placeholder {
        padding: 24px 17px;
    }

    .module-placeholder h3 {
        font-size: 22px;
    }

    .taskbar {
        padding-inline: 8px;
    }

    .taskbar__clock,
    .taskbar__empty {
        display: none;
    }

    .taskbar-item {
        min-width: 130px;
    }
}

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

/* =========================================================
   Versão 2 — área de trabalho, temas, sidebar e autenticação
   ========================================================= */

html,
body {
    font-size: 14px;
}

html[data-theme="escuro"] {
    color-scheme: dark;
    --ink: #f5f1fb;
    --muted: #afa6bc;
    --line: #352d40;
    --surface: #17131d;
    --surface-soft: #211b29;
    --purple-700: #a678ff;
    --purple-600: #9364ef;
    --green-700: #43dda4;
    --green-600: #2ecb91;
    --gradient-soft: linear-gradient(128deg, rgba(147, 100, 239, .18), rgba(46, 203, 145, .13));
    --shadow-soft: 0 18px 55px rgba(0, 0, 0, .28);
    --shadow-window: 0 32px 95px rgba(0, 0, 0, .52);
}

@media (prefers-color-scheme: dark) {
    html[data-theme="sistema"] {
        color-scheme: dark;
        --ink: #f5f1fb;
        --muted: #afa6bc;
        --line: #352d40;
        --surface: #17131d;
        --surface-soft: #211b29;
        --purple-700: #a678ff;
        --purple-600: #9364ef;
        --green-700: #43dda4;
        --green-600: #2ecb91;
        --gradient-soft: linear-gradient(128deg, rgba(147, 100, 239, .18), rgba(46, 203, 145, .13));
        --shadow-soft: 0 18px 55px rgba(0, 0, 0, .28);
        --shadow-window: 0 32px 95px rgba(0, 0, 0, .52);
    }
}

.workspace-page,
.workspace-page .app-shell {
    background:
        radial-gradient(circle at 7% 4%, rgba(117, 71, 212, .12), transparent 25%),
        radial-gradient(circle at 95% 18%, rgba(33, 201, 139, .12), transparent 25%),
        var(--surface-soft);
}

html[data-theme="escuro"] .workspace-page,
html[data-theme="escuro"] .workspace-page .app-shell {
    background:
        radial-gradient(circle at 7% 4%, rgba(130, 75, 225, .16), transparent 28%),
        radial-gradient(circle at 95% 18%, rgba(26, 178, 126, .10), transparent 27%),
        #110e16;
}

@media (prefers-color-scheme: dark) {
    html[data-theme="sistema"] .workspace-page,
    html[data-theme="sistema"] .workspace-page .app-shell {
        background:
            radial-gradient(circle at 7% 4%, rgba(130, 75, 225, .16), transparent 28%),
            radial-gradient(circle at 95% 18%, rgba(26, 178, 126, .10), transparent 27%),
            #110e16;
    }
}

.topbar {
    transition: transform .3s cubic-bezier(.2, .8, .2, 1), opacity .2s ease;
}

.brand--button {
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
}

.company-switcher strong {
    max-width: 230px;
    overflow: hidden;
    font-size: 12px;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.workspace-active .topbar {
    opacity: 0;
    pointer-events: none;
    transform: translateY(-100%);
}

body.workspace-active .home {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: scale(.99);
}

.home {
    padding-bottom: 42px;
    transition: opacity .2s ease, transform .25s ease, visibility .2s ease;
}

.welcome p {
    font-size: 13px;
}

.module-group__header h2 {
    font-size: 15px;
}

.module-group__header p,
.module-card__copy small {
    font-size: 10px;
}

.module-card__copy strong {
    font-size: 13px;
}

.module-card {
    min-height: 78px;
}

.window-layer {
    inset: 0;
    overflow: hidden;
}

body.has-windows .window-layer {
    bottom: var(--taskbar-height);
}

.workspace-tools {
    position: fixed;
    z-index: 980;
    top: 10px;
    left: 10px;
    display: flex;
    gap: 5px;
    padding: 5px;
    border: 1px solid rgba(117, 71, 212, .18);
    border-radius: 14px;
    background: rgba(255, 255, 255, .80);
    box-shadow: 0 10px 30px rgba(36, 20, 54, .10);
    opacity: 0;
    pointer-events: none;
    transform: translateY(-12px);
    backdrop-filter: blur(16px);
    transition: .22s ease;
}

body.workspace-active .workspace-tools {
    opacity: .6;
    pointer-events: auto;
    transform: translateY(0);
}

body.workspace-active .workspace-tools:hover,
body.workspace-active .workspace-tools:focus-within {
    opacity: .96;
}

.workspace-tools button {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    color: var(--ink);
    border: 0;
    border-radius: 10px;
    background: transparent;
    cursor: pointer;
}

.workspace-tools button:hover {
    color: var(--purple-700);
    background: var(--gradient-soft);
}

.app-window {
    top: 68px;
    left: 78px;
    width: min(860px, calc(100vw - 110px));
    height: min(620px, calc(100vh - 142px));
    min-width: 520px;
    min-height: 340px;
    background: var(--surface);
    transform: translateY(16px) scale(.978);
    will-change: top, left, width, height;
}

.app-window.is-open {
    transform: none;
}

.app-window.is-closing {
    transform: translateY(12px) scale(.97);
}

.app-window.is-minimized {
    transform: translateY(calc(100vh - 110px)) scale(.25);
}

.app-window.is-maximized,
.app-window.is-maximized.is-open {
    inset: 0 !important;
    width: auto !important;
    height: auto !important;
    min-width: 0;
    min-height: 0;
    border-radius: 0;
    transform: none;
}

.app-window__titlebar {
    height: 60px;
    background: linear-gradient(180deg, var(--surface), var(--surface-soft));
}

.app-window__identity h2 {
    font-size: 14px;
}

.app-window__identity small {
    font-size: 9px;
}

.app-window__body {
    height: calc(100% - 60px);
    padding: 22px;
    background:
        radial-gradient(circle at 85% 10%, rgba(33, 201, 139, .07), transparent 24%),
        radial-gradient(circle at 8% 88%, rgba(117, 71, 212, .07), transparent 26%),
        var(--surface-soft);
}

.resize-handle {
    position: absolute;
    z-index: 8;
    display: block;
}

.resize-handle--n,
.resize-handle--s {
    right: 10px;
    left: 10px;
    height: 8px;
    cursor: ns-resize;
}

.resize-handle--n { top: -4px; }
.resize-handle--s { bottom: -4px; }

.resize-handle--e,
.resize-handle--w {
    top: 10px;
    bottom: 10px;
    width: 8px;
    cursor: ew-resize;
}

.resize-handle--e { right: -4px; }
.resize-handle--w { left: -4px; }

.resize-handle--ne,
.resize-handle--se,
.resize-handle--sw,
.resize-handle--nw {
    width: 16px;
    height: 16px;
}

.resize-handle--ne { top: -5px; right: -5px; cursor: nesw-resize; }
.resize-handle--se { right: -5px; bottom: -5px; cursor: nwse-resize; }
.resize-handle--sw { bottom: -5px; left: -5px; cursor: nesw-resize; }
.resize-handle--nw { top: -5px; left: -5px; cursor: nwse-resize; }

.window-loading {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--muted);
    font-size: 12px;
}

.window-loading span {
    width: 34px;
    height: 34px;
    border: 3px solid rgba(117, 71, 212, .15);
    border-top-color: var(--purple-600);
    border-radius: 50%;
    animation: spin .75s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.taskbar {
    opacity: 0;
    pointer-events: none;
    transform: translateY(110%);
    transition: opacity .2s ease, transform .28s cubic-bezier(.2, .8, .2, 1);
}

body.has-windows .taskbar {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.taskbar-item {
    position: relative;
    font-family: inherit;
    user-select: none;
}

.taskbar-item.is-active::before {
    position: absolute;
    right: 10px;
    bottom: 2px;
    left: 10px;
    height: 2px;
    content: "";
    border-radius: 99px;
    background: linear-gradient(90deg, #b98bff, #65f1bc);
}

.realtime-status {
    display: flex;
    align-items: center;
    gap: 6px;
    color: rgba(255, 255, 255, .72);
    font-size: 9px;
}

.realtime-status > span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #5af2b7;
    box-shadow: 0 0 0 4px rgba(90, 242, 183, .10);
}

.realtime-status.is-offline > span {
    background: #ff7086;
    box-shadow: 0 0 0 4px rgba(255, 112, 134, .10);
}

.sidebar-backdrop {
    position: fixed;
    z-index: 1190;
    inset: 0;
    background: rgba(13, 8, 20, .50);
    opacity: 0;
    visibility: hidden;
    backdrop-filter: blur(3px);
    transition: .25s ease;
}

.sidebar {
    position: fixed;
    z-index: 1200;
    inset: 0 auto 0 0;
    width: min(360px, calc(100vw - 28px));
    display: grid;
    grid-template-rows: auto auto 1fr auto;
    color: var(--ink);
    border-right: 1px solid var(--line);
    background: var(--surface);
    box-shadow: 26px 0 70px rgba(22, 12, 34, .22);
    visibility: hidden;
    transform: translateX(-103%);
    transition: transform .3s cubic-bezier(.2, .8, .2, 1), visibility .3s;
}

body.sidebar-open .sidebar,
body.sidebar-open .sidebar-backdrop {
    visibility: visible;
}

body.sidebar-open .sidebar { transform: translateX(0); }
body.sidebar-open .sidebar-backdrop { opacity: 1; }

.sidebar__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid var(--line);
}

.sidebar-search {
    height: 46px;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 15px 18px 8px;
    padding: 0 13px;
    color: var(--muted);
    border: 1px solid var(--line);
    border-radius: 13px;
    background: var(--surface-soft);
}

.sidebar-search input {
    min-width: 0;
    flex: 1;
    color: var(--ink);
    border: 0;
    outline: 0;
    background: transparent;
    font-size: 12px;
}

.sidebar__nav {
    overflow-y: auto;
    padding: 8px 13px 18px;
}

.sidebar-group {
    margin-top: 13px;
}

.sidebar-group h2 {
    margin: 0 8px 7px;
    color: var(--muted);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.sidebar-link,
.sidebar-theme,
.sidebar-logout {
    width: 100%;
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr) 18px;
    align-items: center;
    gap: 11px;
    min-height: 44px;
    padding: 0 11px;
    text-align: left;
    color: var(--ink);
    border: 0;
    border-radius: 11px;
    background: transparent;
    font-size: 12px;
    cursor: pointer;
}

.sidebar-link:hover,
.sidebar-theme:hover,
.sidebar-logout:hover {
    color: var(--purple-700);
    background: var(--gradient-soft);
}

.sidebar-link__arrow {
    width: 15px;
    color: var(--muted);
}

.sidebar__footer {
    padding: 13px;
    border-top: 1px solid var(--line);
}

.sidebar__footer form { margin-top: 4px; }
.sidebar-theme,
.sidebar-logout { grid-template-columns: 22px 1fr; }
.sidebar-logout { color: #d94b64; }

.module-page {
    min-height: 100%;
}

.module-page .button,
.inline-panel .button,
.user-permission-form .button {
    margin-top: 0;
}

.button:disabled {
    opacity: .48;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.module-page__toolbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
}

.module-page__toolbar h3 {
    margin: 4px 0 3px;
    font-size: 22px;
    letter-spacing: -.035em;
}

.module-page__toolbar p {
    margin: 0;
    color: var(--muted);
    font-size: 11px;
}

.module-page__eyebrow {
    color: var(--green-700);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .13em;
    text-transform: uppercase;
}

.module-construction {
    min-height: calc(100% - 90px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px;
    text-align: center;
    border: 1px dashed var(--line);
    border-radius: 18px;
    background: var(--surface);
}

.module-construction__icon {
    width: 66px;
    height: 66px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
    color: white;
    border-radius: 20px;
    background: var(--gradient);
}

.module-construction strong { font-size: 15px; }
.module-construction p { max-width: 520px; margin: 7px 0 0; color: var(--muted); font-size: 11px; line-height: 1.65; }

.inline-panel,
.user-access-card {
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface);
}

.inline-panel {
    margin-bottom: 16px;
    padding: 17px;
    box-shadow: var(--shadow-soft);
}

.inline-panel__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 15px;
}

.inline-panel__header strong { display: block; font-size: 14px; }
.inline-panel__header small { color: var(--muted); font-size: 9px; }
.inline-panel__header button { color: var(--muted); border: 0; background: transparent; font-size: 22px; cursor: pointer; }

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

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field > span {
    color: var(--muted);
    font-size: 10px;
    font-weight: 600;
}

.field input,
.field select {
    width: 100%;
    min-height: 44px;
    padding: 0 12px;
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: 11px;
    outline: 0;
    background: var(--surface-soft);
    font-size: 12px;
}

.field input:focus,
.field select:focus {
    border-color: var(--purple-600);
    box-shadow: 0 0 0 3px rgba(117, 71, 212, .10);
}

.field--full { grid-column: 1 / -1; }
.field--compact { width: 150px; }

.permission-fieldset {
    margin: 17px 0 0;
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: 13px;
}

.permission-fieldset legend {
    padding: 0 6px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 600;
}

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

.permission-check {
    min-width: 0;
    min-height: 39px;
    display: grid;
    grid-template-columns: 16px 18px minmax(0, 1fr);
    align-items: center;
    gap: 7px;
    padding: 7px 9px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface-soft);
    font-size: 9px;
    cursor: pointer;
}

.permission-check:has(input:checked) {
    color: var(--purple-700);
    border-color: rgba(117, 71, 212, .30);
    background: var(--gradient-soft);
}

.permission-check input { accent-color: var(--purple-600); }
.permission-check .app-icon { width: 16px; height: 16px; }

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 14px;
}

.button--ghost {
    color: var(--ink);
    border: 1px solid var(--line);
    background: var(--surface);
}

.users-list { display: grid; gap: 9px; }
.user-access-card { overflow: hidden; }
.user-access-card > summary {
    min-height: 64px;
    display: grid;
    grid-template-columns: 38px minmax(130px, 1fr) auto auto 18px;
    align-items: center;
    gap: 11px;
    padding: 10px 14px;
    list-style: none;
    cursor: pointer;
}
.user-access-card > summary::-webkit-details-marker { display: none; }
.user-access-card[open] > summary { border-bottom: 1px solid var(--line); }
.user-access-card__avatar {
    width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center;
    color: white; border-radius: 12px; background: var(--gradient); font-size: 12px; font-weight: 700;
}
.user-access-card__identity { min-width: 0; display: flex; flex-direction: column; }
.user-access-card__identity strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.user-access-card__identity small { color: var(--muted); font-size: 9px; }
.status-pill, .profile-pill { padding: 5px 9px; border-radius: 999px; font-size: 8px; font-weight: 600; }
.status-pill--ativo { color: #087d57; background: rgba(33, 201, 139, .14); }
.status-pill--inativo { color: #b03a51; background: rgba(220, 62, 87, .13); }
.profile-pill { color: var(--purple-700); background: rgba(117, 71, 212, .10); }
.user-access-card__chevron { color: var(--muted); transition: .2s ease; }
.user-access-card[open] .user-access-card__chevron { transform: rotate(180deg); }
.admin-access-note { display: flex; gap: 12px; padding: 17px; color: var(--purple-700); background: var(--gradient-soft); }
.admin-access-note strong { font-size: 11px; }
.admin-access-note p { margin: 3px 0 0; color: var(--muted); font-size: 9px; }
.user-permission-form { padding: 15px; }
.permission-toolbar { display: flex; align-items: flex-end; gap: 14px; margin-bottom: 12px; color: var(--muted); font-size: 9px; }

.toast-region {
    position: fixed;
    z-index: 2000;
    top: 16px;
    right: 16px;
    width: min(360px, calc(100vw - 32px));
    display: grid;
    gap: 8px;
}

.toast {
    padding: 12px 14px;
    color: var(--ink);
    border: 1px solid var(--line);
    border-left: 4px solid var(--green-500);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: var(--shadow-soft);
    font-size: 10px;
    animation: toast-in .25s ease both;
}
.toast--error { border-left-color: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } }

.auth-page {
    min-height: 100vh;
    overflow: auto;
    color: #251c30;
    background:
        radial-gradient(circle at 12% 12%, rgba(117, 71, 212, .27), transparent 33%),
        radial-gradient(circle at 88% 82%, rgba(33, 201, 139, .22), transparent 31%),
        #f6f3f9;
}

.auth-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px 16px;
}

.auth-card {
    width: min(460px, 100%);
    padding: 34px;
    border: 1px solid rgba(74, 44, 98, .10);
    border-radius: 24px;
    background: rgba(255, 255, 255, .92);
    box-shadow: 0 30px 85px rgba(50, 25, 72, .16);
    backdrop-filter: blur(18px);
}

.auth-card--install { width: min(620px, 100%); }
.auth-card--message { width: min(600px, 100%); }
.brand--auth { margin-bottom: 35px; }
.auth-card__eyebrow { color: var(--purple-700); font-size: 9px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.auth-card h1 { margin: 7px 0 5px; font-size: 30px; letter-spacing: -.045em; }
.auth-card > p { margin: 0 0 21px; color: #796f80; font-size: 12px; }
.auth-form { display: grid; gap: 13px; }
.auth-form--grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.button--wide { width: 100%; }
.alert { margin: 0 0 14px; padding: 11px 13px; border-radius: 11px; font-size: 10px; }
.alert--error { color: #9d2740; background: #ffe8ed; }
.alert--success { color: #087350; background: #e2f9f0; }
.auth-footer { margin: 16px 0 0; color: #716779; font-size: 9px; }
.setup-list { display: grid; gap: 9px; margin: 20px 0 0; padding-left: 20px; color: #665c6d; font-size: 11px; line-height: 1.6; }

/* Tipografia v2: ainda compacta, porém confortável para uso diário. */
.company-switcher__label,
.module-page__eyebrow,
.sidebar-group h2,
.auth-card__eyebrow {
    font-size: 10px;
}

.brand__copy small,
.app-window__identity small,
.realtime-status,
.status-pill,
.profile-pill,
.auth-footer {
    font-size: 10px;
}

.module-group__header p,
.module-card__copy small,
.inline-panel__header small,
.user-access-card__identity small,
.admin-access-note p,
.permission-toolbar,
.alert {
    font-size: 11px;
}

.module-page__toolbar p,
.module-construction p,
.field > span,
.permission-fieldset legend,
.permission-check,
.admin-access-note strong,
.toast,
.setup-list {
    font-size: 12px;
}

.sidebar-link,
.sidebar-theme,
.sidebar-logout,
.sidebar-search input,
.field input,
.field select,
.auth-card > p {
    font-size: 13px;
}

.company-switcher strong,
.module-card__copy strong,
.app-window__identity h2,
.inline-panel__header strong,
.user-access-card__identity strong {
    font-size: 14px;
}

html[data-theme="escuro"] .topbar,
html[data-theme="escuro"] .workspace-tools,
html[data-theme="escuro"] .module-group,
html[data-theme="escuro"] .module-card,
html[data-theme="escuro"] .module-search,
html[data-theme="escuro"] .app-window,
html[data-theme="escuro"] .app-window__titlebar,
html[data-theme="escuro"] .module-placeholder,
html[data-theme="escuro"] .empty-search {
    color: var(--ink);
    border-color: var(--line);
    background-color: var(--surface);
}

html[data-theme="escuro"] .topbar { background: rgba(23, 19, 29, .90); }
html[data-theme="escuro"] .module-group { background: rgba(23, 19, 29, .84); }
html[data-theme="escuro"] .module-card { background: #211b29; }
html[data-theme="escuro"] .module-search input { color: var(--ink); }

@media (prefers-color-scheme: dark) {
    html[data-theme="sistema"] .topbar,
    html[data-theme="sistema"] .workspace-tools,
    html[data-theme="sistema"] .module-group,
    html[data-theme="sistema"] .module-card,
    html[data-theme="sistema"] .module-search,
    html[data-theme="sistema"] .app-window,
    html[data-theme="sistema"] .app-window__titlebar,
    html[data-theme="sistema"] .module-placeholder,
    html[data-theme="sistema"] .empty-search {
        color: var(--ink);
        border-color: var(--line);
        background-color: var(--surface);
    }
    html[data-theme="sistema"] .topbar { background: rgba(23, 19, 29, .90); }
    html[data-theme="sistema"] .module-group { background: rgba(23, 19, 29, .84); }
    html[data-theme="sistema"] .module-card { background: #211b29; }
    html[data-theme="sistema"] .module-search input { color: var(--ink); }
}

@media (max-width: 900px) {
    .permission-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .realtime-status { display: none; }
}

@media (max-width: 580px) {
    .app-window,
    .app-window.is-open {
        inset: 4px !important;
        width: auto !important;
        height: auto !important;
        min-width: 0;
        min-height: 0;
        transform: none;
    }
    .app-window.is-maximized,
    .app-window.is-maximized.is-open {
        inset: 0 !important;
        border-radius: 0;
    }
    .resize-handle { display: none; }
    .workspace-tools { top: 5px; left: 5px; }
    .module-page__toolbar { align-items: stretch; flex-direction: column; }
    .module-page__toolbar .button { width: 100%; margin-top: 0; }
    .form-grid,
    .auth-form--grid,
    .permission-grid { grid-template-columns: 1fr; }
    .field--full { grid-column: auto; }
    .user-access-card > summary { grid-template-columns: 38px minmax(0, 1fr) auto 16px; }
    .profile-pill { display: none; }
    .taskbar__clock { display: none; }
    .auth-card { padding: 25px 20px; }
}
