:root {
    --fd-black: #0b0b0c;
    --fd-black-soft: #171719;
    --fd-surface: #ffffff;
    --fd-canvas: #f5f5f6;
    --fd-border: #e5e7eb;
    --fd-muted: #6b7280;
    --fd-radius: 16px;
    --fd-sidebar-width: 276px;
    --fd-shadow: 0 8px 30px rgba(15, 23, 42, .07);
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body.flashdesk-app {
    margin: 0;
    color: #18181b;
    background: var(--fd-canvas);
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}

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

.app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1040;
    display: flex;
    width: var(--fd-sidebar-width);
    flex-direction: column;
    overflow-y: auto;
    color: #fff;
    background: var(--fd-black);
    border-right: 1px solid #27272a;
    transition: transform .25s ease;
}

.sidebar-brand-block { padding: 22px 20px 14px; text-align: center; }
.sidebar-logo-wrap { display: inline-flex; max-width: 100%; padding: 10px 14px; border-radius: 12px; background: #fff; }
.sidebar-logo-wrap img { width: auto; max-width: 100%; height: auto; max-height: 56px; object-fit: contain; }
.sidebar-company-name { margin-top: 10px; color: #a1a1aa; font-size: .78rem; }
.sidebar-brand-fallback { display: block; padding: 8px; color: #fff; font-size: 1.2rem; font-weight: 750; text-decoration: none; }
.sidebar-brand-fallback i { margin-right: 6px; }

.sidebar-nav { padding: 2px 12px 24px; }
.sidebar-section { padding: 18px 12px 6px; color: #71717a; font-size: .68rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.app-sidebar .nav-link {
    display: flex;
    gap: 12px;
    align-items: center;
    margin: 3px 0;
    padding: 10px 12px;
    color: #d4d4d8;
    border-radius: 10px;
    font-size: .91rem;
    font-weight: 550;
    transition: color .15s ease, background-color .15s ease;
}
.app-sidebar .nav-link i { width: 20px; margin: 0; font-size: 1.05rem; text-align: center; }
.app-sidebar .nav-link:hover { color: #fff; background: #232326; }
.app-sidebar .nav-link.active { color: #111; background: #fff; box-shadow: 0 4px 16px rgba(255,255,255,.08); }
.sidebar-footer { margin-top: auto; padding: 16px 20px 22px; border-top: 1px solid #27272a; }

.app-main { min-width: 0; min-height: 100vh; margin-left: var(--fd-sidebar-width); }
.app-topbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    display: flex;
    min-height: 72px;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px clamp(18px, 3vw, 38px);
    background: rgba(255,255,255,.92);
    border-bottom: 1px solid var(--fd-border);
    backdrop-filter: blur(12px);
}
.app-topbar h1 { margin: 0; font-size: clamp(1.25rem, 2vw, 1.65rem); font-weight: 750; letter-spacing: -.025em; }
.topbar-user { display: flex; align-items: center; gap: 10px; color: #52525b; font-size: .9rem; }
.topbar-avatar { display: grid; width: 34px; height: 34px; place-items: center; color: #fff; border-radius: 50%; background: #111; font-weight: 700; }
.sidebar-toggle { display: none; width: 42px; height: 42px; place-items: center; padding: 0; }
.sidebar-backdrop { display: none; position: fixed; inset: 0; z-index: 1035; background: rgba(0,0,0,.5); }
.app-content { width: 100%; max-width: 1720px; margin: 0 auto; padding: clamp(18px, 3vw, 38px); }

.card { overflow: hidden; border: 1px solid var(--fd-border); border-radius: var(--fd-radius); box-shadow: var(--fd-shadow); }
.card-header { padding: 18px 22px; background: #fff; border-bottom: 1px solid var(--fd-border); font-weight: 650; }
.card-body { padding: clamp(18px, 2.2vw, 26px); }
.card-footer { border-top-color: var(--fd-border); }
.card:hover { transform: none; }

.btn { min-height: 40px; border-radius: 10px; font-weight: 600; }
.btn-sm { min-height: 32px; }
.btn-primary, .btn-dark { color: #fff; background: var(--fd-black); border-color: var(--fd-black); }
.btn-primary:hover, .btn-primary:focus, .btn-dark:hover, .btn-dark:focus { background: #28282b; border-color: #28282b; }
.form-control, .form-select, .select2-container--bootstrap-5 .select2-selection { min-height: 42px; border-color: #d4d4d8; border-radius: 10px; }
.form-control:focus, .form-select:focus { border-color: #52525b; box-shadow: 0 0 0 .2rem rgba(24,24,27,.1); }
.form-label { color: #3f3f46; font-size: .88rem; font-weight: 650; }
.alert { border: 1px solid transparent; border-radius: 12px; }
.table { --bs-table-bg: transparent; margin-bottom: 0; }
.table > :not(caption) > * > * { padding: .9rem 1rem; border-bottom-color: #ededee; }
.table thead th { color: #52525b; background: #fafafa; font-size: .75rem; font-weight: 750; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; }
.table-responsive { scrollbar-width: thin; }
th.sortable-header { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable-header::after { content: " ⇅"; color: #a1a1aa; font-size: .8em; }
th.sortable-header.sorted-asc::after { content: " ↑"; color: #18181b; }
th.sortable-header.sorted-desc::after { content: " ↓"; color: #18181b; }
.status-badge { padding: 4px 12px; border-radius: 999px; font-size: .82rem; font-weight: 650; }
.pagination { flex-wrap: wrap; }
.page-link { color: #18181b; }
.page-link.active, .active > .page-link { color: #fff; background: #18181b; border-color: #18181b; }
.eyebrow { display: block; margin-bottom: 4px; color: #71717a; font-size: .72rem; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; }
.page-intro { display: flex; align-items: center; justify-content: space-between; gap: 16px; }

.workflow-stage-list { display: grid; gap: 10px; }
.workflow-stage {
    display: grid;
    grid-template-columns: 32px 34px minmax(180px, 1fr) 56px 100px 40px;
    gap: 10px;
    align-items: center;
    padding: 10px;
    border: 1px solid var(--fd-border);
    border-radius: 12px;
    background: #fafafa;
}
.workflow-stage.is-dragging { opacity: .5; }
.stage-drag { padding: 4px; color: #71717a; background: transparent; border: 0; cursor: grab; }
.stage-number { display: grid; width: 30px; height: 30px; place-items: center; border-radius: 50%; color: #fff; background: #18181b; font-size: .78rem; font-weight: 700; }
.stage-color .form-control-color { width: 52px; padding: 5px; }

.accordion-item { overflow: hidden; border-color: var(--fd-border); }
.accordion-item:first-of-type, .accordion-item:first-of-type .accordion-button { border-radius: 14px 14px 0 0; }
.accordion-item:last-of-type, .accordion-item:last-of-type .accordion-button.collapsed { border-radius: 0 0 14px 14px; }
.accordion-button { gap: 8px; font-weight: 650; }
.accordion-button:not(.collapsed) { color: #111; background: #f4f4f5; box-shadow: inset 0 calc(-1 * var(--bs-accordion-border-width)) 0 var(--fd-border); }
.accordion-button:focus { border-color: #a1a1aa; box-shadow: 0 0 0 .2rem rgba(24,24,27,.08); }
.module-permission-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; }
.module-permission-option { display: flex; gap: 10px; align-items: flex-start; min-height: 68px; padding: 12px; border: 1px solid var(--fd-border); border-radius: 12px; background: #fafafa; cursor: pointer; }
.module-permission-option:has(input:checked) { border-color: #18181b; background: #f4f4f5; }
.module-permission-option input { margin-top: 3px; }
.module-permission-option span { display: grid; gap: 2px; }
.module-permission-option small { color: var(--fd-muted); line-height: 1.3; }

/* Landing page: mesma linguagem visual monocromática do sistema autenticado. */
body.flashdesk-landing { margin: 0; color: #18181b; background: #fff; font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
.landing-container { max-width: 1240px; }
.landing-navbar { background: rgba(255,255,255,.94); border-bottom: 1px solid var(--fd-border); backdrop-filter: blur(14px); }
.landing-brand { display: flex; gap: 10px; align-items: center; color: #111; font-size: 1.05rem; font-weight: 800; letter-spacing: -.03em; }
.brand-mark { display: inline-grid; width: 34px; height: 34px; place-items: center; color: #fff; border-radius: 9px; background: #111; }
.landing-navbar .nav-link { padding: .7rem .8rem; color: #52525b; font-size: .9rem; font-weight: 600; }
.landing-navbar .nav-link:hover { color: #111; }
.landing-hero { display: flex; min-height: calc(100vh - 73px); align-items: center; padding: 72px 0; background: linear-gradient(180deg, #fff 0%, #f6f6f7 100%); border-bottom: 1px solid var(--fd-border); }
.landing-eyebrow { display: flex; gap: 9px; align-items: center; margin-bottom: 18px; color: #52525b; font-size: .73rem; font-weight: 750; letter-spacing: .11em; text-transform: uppercase; }
.landing-eyebrow > span { width: 26px; height: 2px; background: #18181b; }
.landing-hero h1 { max-width: 720px; margin-bottom: 24px; font-size: clamp(2.65rem, 5.5vw, 4.8rem); font-weight: 800; letter-spacing: -.06em; line-height: .99; }
.landing-lead { max-width: 640px; margin-bottom: 30px; color: #52525b; font-size: clamp(1.05rem, 2vw, 1.22rem); line-height: 1.65; }
.landing-trust { display: flex; gap: 8px; align-items: center; margin-top: 24px; color: #71717a; font-size: .83rem; }
.product-preview { display: grid; grid-template-columns: 160px 1fr; min-height: 430px; overflow: hidden; border: 1px solid #27272a; border-radius: 20px; background: #f4f4f5; box-shadow: 0 28px 80px rgba(0,0,0,.16); transform: perspective(1400px) rotateY(-3deg) rotateX(1deg); }
.preview-sidebar { padding: 22px 12px; color: #d4d4d8; background: #0b0b0c; }
.preview-logo { margin-bottom: 28px; padding: 0 8px; color: #fff; font-size: .8rem; font-weight: 750; }
.preview-logo i { margin-right: 5px; }
.preview-menu { display: flex; gap: 9px; align-items: center; margin: 5px 0; padding: 9px 10px; border-radius: 8px; font-size: .69rem; font-weight: 600; }
.preview-menu.active { color: #111; background: #fff; }
.preview-content { min-width: 0; padding: 0 18px 22px; }
.preview-top { display: flex; align-items: center; justify-content: space-between; margin: 0 -18px 18px; padding: 15px 18px; background: #fff; border-bottom: 1px solid var(--fd-border); font-size: .88rem; font-weight: 750; }
.preview-avatar { display: grid; width: 28px; height: 28px; place-items: center; color: #fff; border-radius: 50%; background: #111; font-size: .7rem; }
.preview-metrics { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.preview-metrics > div { display: grid; gap: 6px; padding: 14px; border: 1px solid var(--fd-border); border-radius: 10px; background: #fff; }
.preview-metrics small { color: #71717a; font-size: .62rem; }
.preview-metrics strong { font-size: .95rem; }
.preview-board { display: grid; grid-template-columns: repeat(3, minmax(90px, 1fr)); gap: 8px; margin-top: 14px; overflow: hidden; }
.preview-column { min-height: 220px; padding: 10px; border-radius: 9px; background: #e4e4e7; }
.preview-column > span { display: flex; justify-content: space-between; font-size: .58rem; font-weight: 750; }
.preview-column b { display: grid; width: 17px; height: 17px; place-items: center; border-radius: 50%; background: #fff; font-size: .55rem; }
.preview-column i { display: block; height: 62px; margin-top: 9px; border: 1px solid #dedee1; border-radius: 7px; background: #fff; box-shadow: 0 2px 5px rgba(0,0,0,.04); }
.landing-section { padding: clamp(72px, 9vw, 118px) 0; }
.landing-section-soft { background: #f5f5f6; border-block: 1px solid var(--fd-border); }
.landing-section h2, .landing-contact h2 { margin-bottom: 20px; font-size: clamp(2rem, 4vw, 3.25rem); font-weight: 780; letter-spacing: -.05em; line-height: 1.08; }
.landing-copy { max-width: 760px; color: #52525b; font-size: 1.06rem; line-height: 1.75; }
.landing-feature { height: 100%; padding: 28px; border: 1px solid var(--fd-border); border-radius: var(--fd-radius); background: #fff; box-shadow: var(--fd-shadow); }
.feature-icon { display: grid; width: 42px; height: 42px; margin-bottom: 42px; place-items: center; color: #fff; border-radius: 11px; background: #111; }
.landing-feature h3 { margin-bottom: 10px; font-size: 1.08rem; font-weight: 750; }
.landing-feature p { margin: 0; color: #71717a; font-size: .92rem; line-height: 1.6; }
.client-card { display: flex; width: fit-content; gap: 13px; align-items: center; margin-top: 34px; padding: 18px 24px; border: 1px solid #d4d4d8; border-radius: 14px; background: #fff; box-shadow: var(--fd-shadow); text-align: left; }
.client-card div { display: grid; }
.client-card small { color: #71717a; }
.landing-cta { display: flex; gap: 34px; align-items: center; justify-content: space-between; padding: clamp(32px, 6vw, 64px); color: #fff; border-radius: 24px; background: #0b0b0c; box-shadow: 0 26px 70px rgba(0,0,0,.17); }
.landing-cta h2 { max-width: 720px; margin: 16px 0 12px; color: #fff; }
.landing-cta p { max-width: 650px; margin: 0; color: #a1a1aa; }
.landing-status { display: inline-flex; gap: 7px; align-items: center; color: #d4d4d8; font-size: .76rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.landing-status i { color: #fff; font-size: .45rem; }
.landing-contact { padding: 76px 0; color: #fff; background: #171719; border-top: 1px solid #27272a; }
.landing-contact p { max-width: 440px; color: #a1a1aa; }
.landing-eyebrow-light { color: #a1a1aa; }
.landing-eyebrow-light > span { background: #fff; }
.landing-footer { padding: 24px 0; color: #71717a; background: #0b0b0c; border-top: 1px solid #27272a; font-size: .82rem; }
.landing-footer strong { color: #fff; }

@media (max-width: 991.98px) {
    .landing-navbar .navbar-collapse { padding: 14px 0 8px; }
    .landing-navbar .btn { width: 100%; margin-top: 7px; }
    .landing-hero { min-height: 0; }
    .product-preview { transform: none; }
    .landing-cta { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 575.98px) {
    .landing-hero { padding: 56px 0; }
    .landing-hero h1 { font-size: 2.7rem; }
    .landing-hero .btn { width: 100%; }
    .product-preview { grid-template-columns: 70px 1fr; min-height: 370px; border-radius: 15px; }
    .preview-sidebar { padding: 16px 8px; }
    .preview-logo { overflow: hidden; width: 27px; height: 24px; margin-right: auto; margin-bottom: 24px; margin-left: auto; white-space: nowrap; }
    .preview-logo i { font-size: 1rem; }
    .preview-menu { justify-content: center; padding: 9px 4px; font-size: 0; }
    .preview-menu i { font-size: .9rem; }
    .preview-content { padding-right: 10px; padding-left: 10px; }
    .preview-top { margin-right: -10px; margin-left: -10px; padding-right: 10px; padding-left: 10px; }
    .preview-metrics { grid-template-columns: 1fr; }
    .preview-metrics > div:nth-child(2) { display: none; }
    .preview-board { grid-template-columns: repeat(3, 115px); overflow-x: hidden; }
    .landing-section { padding: 68px 0; }
    .landing-feature { padding: 22px; }
    .feature-icon { margin-bottom: 30px; }
    .landing-cta { border-radius: 18px; }
    .landing-cta .btn { width: 100%; }
}

@media (max-width: 991.98px) {
    .app-sidebar { transform: translateX(-100%); box-shadow: 18px 0 50px rgba(0,0,0,.24); }
    body.sidebar-open .app-sidebar { transform: translateX(0); }
    body.sidebar-open .sidebar-backdrop { display: block; }
    .app-main { margin-left: 0; }
    .sidebar-toggle { display: grid; }
    .app-topbar { justify-content: flex-start; }
    .topbar-user { margin-left: auto; }
    .topbar-user-name { display: none; }
}

@media (max-width: 767.98px) {
    .app-content { padding: 16px 12px 28px; }
    .app-topbar { min-height: 64px; padding: 10px 12px; }
    .card { border-radius: 13px; }
    .card-header { padding: 15px 16px; }
    .card-body { padding: 16px; }
    .page-intro { align-items: flex-start; flex-direction: column; }
    .d-flex:not(.app-topbar):not(.topbar-user):not(.input-group) > .btn { max-width: 100%; }
    .workflow-stage { grid-template-columns: 28px 30px minmax(0, 1fr) 48px 38px; }
    .stage-kind { grid-column: 3 / 5; }
    .stage-remove { grid-column: 5; grid-row: 1; }
    .table-responsive { margin-right: -16px; margin-left: -16px; }
    .table-responsive > .table { min-width: 680px; }
    .form-actions, .card-footer.d-flex { align-items: stretch !important; flex-direction: column; }
    .form-actions .btn, .card-footer.d-flex .btn { width: 100%; }
}

@media (max-width: 420px) {
    :root { --fd-sidebar-width: min(88vw, 310px); }
    .app-topbar h1 { max-width: 62vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .workflow-stage { grid-template-columns: 26px 28px minmax(0, 1fr) 42px; }
    .stage-color { grid-column: 4; grid-row: 1; }
    .stage-remove { grid-column: 4; grid-row: 2; }
    .stage-kind { grid-column: 3; grid-row: 2; }
}

@media print {
    .app-sidebar, .app-topbar, .sidebar-backdrop { display: none !important; }
    .app-main { margin: 0; }
    .app-content { max-width: none; padding: 0; }
    .card { border: 0; box-shadow: none; }
}
