/* ==========================================================================
   PORTAL DE GESTÃO - MINIMALIST LIGHT DESIGN SYSTEM
   ========================================================================== */

:root {
    --portal-primary: var(--tenant-primary, #2563EB);
    --portal-primary-dark: color-mix(in srgb, var(--portal-primary) 85%, #000);
    --portal-primary-light: color-mix(in srgb, var(--portal-primary) 10%, #FFFFFF);
    --portal-bg: #F8FAFC;
    --portal-surface: #FFFFFF;
    --portal-sidebar-bg: #FFFFFF;
    --portal-sidebar-text: #475569;
    --portal-sidebar-hover: #F1F5F9;
    --portal-text: #0F172A;
    --portal-text-muted: #64748B;
    --portal-border: #E2E8F0;
    --portal-radius: 0.75rem;
    --portal-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.05);
    --portal-shadow-hover: 0 10px 25px -5px rgba(0, 0, 0, 0.08);
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    background-color: var(--portal-bg);
    color: var(--portal-text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   1. LOGIN PAGE (Clean Light Card)
   ========================================================================== */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: #F1F5F9;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--portal-surface);
    border-radius: 1rem;
    padding: 2.5rem;
    box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--portal-border);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-tenant-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.85rem;
    background: var(--portal-primary-light);
    color: var(--portal-primary);
    border-radius: 50px;
    font-size: 0.775rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: 1rem;
    border: 1px solid color-mix(in srgb, var(--portal-primary) 20%, transparent);
}

.login-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: #0F172A;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.login-subtitle {
    font-size: 0.875rem;
    color: var(--portal-text-muted);
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #334155;
    margin-bottom: 0.5rem;
}

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--portal-border);
    border-radius: 0.5rem;
    font-size: 0.95rem;
    font-family: inherit;
    transition: all 0.2s ease;
    background: #FFFFFF;
}

.form-input:focus {
    outline: none;
    border-color: var(--portal-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--portal-primary) 15%, transparent);
}

.form-checkbox {
    width: 1.1rem;
    height: 1.1rem;
    accent-color: var(--portal-primary);
    cursor: pointer;
}

.btn-portal {
    width: 100%;
    padding: 0.85rem 1.25rem;
    background: var(--portal-primary);
    color: #ffffff;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-portal:hover {
    background: var(--portal-primary-dark);
}

.alert-danger {
    padding: 0.85rem 1rem;
    background: #FEF2F2;
    border: 1px solid #FCA5A5;
    color: #991B1B;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 1.25rem;
}

/* ==========================================================================
   2. PORTAL LAYOUT (Clean Light Sidebar & Header)
   ========================================================================== */
.portal-layout {
    display: flex;
    min-height: 100vh;
}

.portal-sidebar {
    width: 260px;
    background: var(--portal-sidebar-bg);
    color: var(--portal-sidebar-text);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
    border-right: 1px solid var(--portal-border);
}

.sidebar-header {
    padding: 1.5rem 1.25rem;
    border-bottom: 1px solid var(--portal-border);
}

.sidebar-brand {
    font-size: 1.05rem;
    font-weight: 800;
    color: #0F172A;
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.sidebar-brand-badge {
    width: 32px;
    height: 32px;
    border-radius: 0.5rem;
    background: var(--portal-primary-light);
    color: var(--portal-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.9rem;
    border: 1px solid color-mix(in srgb, var(--portal-primary) 20%, transparent);
}

.sidebar-nav {
    padding: 1.25rem 0.75rem;
    flex: 1;
    overflow-y: auto;
}

.nav-category {
    font-size: 0.685rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #94A3B8;
    padding: 0.85rem 0.75rem 0.35rem 0.75rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.875rem;
    color: #475569;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 0.5rem;
    transition: all 0.15s ease;
    margin-bottom: 0.2rem;
}

.nav-item svg {
    color: #64748B;
    transition: color 0.15s ease;
}

.nav-item:hover {
    background: var(--portal-sidebar-hover);
    color: #0F172A;
}

.nav-item:hover svg {
    color: #0F172A;
}

.nav-item.active {
    background: var(--portal-primary-light);
    color: var(--portal-primary);
    font-weight: 700;
    border: 1px solid color-mix(in srgb, var(--portal-primary) 20%, transparent);
}

.nav-item.active svg {
    color: var(--portal-primary);
}

.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--portal-border);
    background: #FAFAFA;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--portal-primary);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
}

.user-info {
    flex: 1;
    overflow: hidden;
}

.user-name {
    font-size: 0.85rem;
    font-weight: 700;
    color: #0F172A;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-status {
    font-size: 0.725rem;
    color: #16A34A;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-weight: 500;
}

.user-status-dot {
    width: 6px;
    height: 6px;
    background: #16A34A;
    border-radius: 50%;
}

.portal-main {
    flex: 1;
    margin-left: 260px;
    display: flex;
    flex-direction: column;
}

.portal-topbar {
    height: 64px;
    background: var(--portal-surface);
    border-bottom: 1px solid var(--portal-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: fixed;
    top: 0;
    left: 260px;
    right: 0;
    z-index: 900;
}

.topbar-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #0F172A;
    letter-spacing: -0.01em;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.btn-portal-secondary {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.85rem;
    background: #FFFFFF;
    border: 1px solid var(--portal-border);
    border-radius: 0.5rem;
    color: #334155;
    text-decoration: none;
    font-size: 0.825rem;
    font-weight: 600;
    transition: all 0.15s ease;
}

.btn-portal-secondary:hover {
    background: #F8FAFC;
    border-color: #CBD5E1;
}

.btn-logout {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.85rem;
    background: #FEF2F2;
    border: 1px solid #FECACA;
    border-radius: 0.5rem;
    color: #991B1B;
    text-decoration: none;
    font-size: 0.825rem;
    font-weight: 600;
    transition: all 0.15s ease;
}

.btn-logout:hover {
    background: #FEE2E2;
}

.portal-content {
    padding: 2rem;
    margin-top: 64px;
    flex: 1;
}

/* ==========================================================================
   3. DASHBOARD LIGHT WELCOME BANNER
   ========================================================================== */
.dash-welcome-card {
    background: var(--portal-surface);
    border-radius: var(--portal-radius);
    padding: 2rem 2.25rem;
    border: 1px solid var(--portal-border);
    margin-bottom: 1.75rem;
    box-shadow: var(--portal-shadow);
}

.dash-welcome-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0.75rem;
    background: var(--portal-primary-light);
    border: 1px solid color-mix(in srgb, var(--portal-primary) 20%, transparent);
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--portal-primary);
    margin-bottom: 0.875rem;
}

.dash-welcome-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: #0F172A;
    letter-spacing: -0.02em;
    margin-bottom: 0.4rem;
}

.dash-welcome-sub {
    font-size: 0.925rem;
    color: var(--portal-text-muted);
    max-width: 680px;
    line-height: 1.6;
    margin-bottom: 1.35rem;
}

.dash-welcome-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.btn-dash-action {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 1.15rem;
    background: var(--portal-primary);
    color: #ffffff;
    border-radius: 0.5rem;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.85rem;
    transition: all 0.15s ease;
}

.btn-dash-action:hover {
    background: var(--portal-primary-dark);
}

.btn-dash-ghost {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 1.15rem;
    background: #F8FAFC;
    border: 1px solid var(--portal-border);
    color: #334155;
    border-radius: 0.5rem;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.15s ease;
}

.btn-dash-ghost:hover {
    background: #F1F5F9;
}

/* ==========================================================================
   4. STATS GRID & METRIC CARDS
   ========================================================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.75rem;
}

.stat-card {
    background: var(--portal-surface);
    border-radius: var(--portal-radius);
    padding: 1.35rem;
    border: 1px solid var(--portal-border);
    box-shadow: var(--portal-shadow);
    display: flex;
    align-items: flex-start;
    gap: 1.125rem;
    transition: all 0.15s ease;
}

.stat-card:hover {
    box-shadow: var(--portal-shadow-hover);
    border-color: #CBD5E1;
}

.stat-icon {
    width: 46px;
    height: 46px;
    border-radius: 0.625rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.icon-amber { background: #FEF3C7; color: #D97706; }
.icon-blue { background: #EFF6FF; color: #2563EB; }
.icon-green { background: #DCFCE7; color: #16A34A; }
.icon-purple { background: #F3E8FF; color: #9333EA; }

.stat-info {
    flex: 1;
}

.stat-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--portal-text-muted);
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 1.65rem;
    font-weight: 800;
    color: #0F172A;
    line-height: 1.1;
}

.stat-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.15rem 0.5rem;
    border-radius: 50px;
    font-size: 0.725rem;
    font-weight: 600;
    margin-top: 0.4rem;
}

.pill-amber { background: #FFFBEB; color: #B45309; }
.pill-blue { background: #EFF6FF; color: #1D4ED8; }
.pill-green { background: #F0FDF4; color: #15803D; }
.pill-purple { background: #FAF5FF; color: #7E22CE; }

/* ==========================================================================
   5. QUICK SHORTCUTS GRID
   ========================================================================== */
.shortcuts-section {
    margin-bottom: 1.75rem;
}

.section-heading {
    font-size: 0.95rem;
    font-weight: 700;
    color: #0F172A;
    margin-bottom: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.shortcuts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.125rem;
}

.shortcut-card {
    background: var(--portal-surface);
    border: 1px solid var(--portal-border);
    border-radius: var(--portal-radius);
    padding: 1.125rem;
    text-decoration: none;
    color: var(--portal-text);
    display: flex;
    align-items: center;
    gap: 0.875rem;
    transition: all 0.15s ease;
    box-shadow: var(--portal-shadow);
}

.shortcut-card:hover {
    border-color: var(--portal-primary);
    box-shadow: var(--portal-shadow-hover);
}

.shortcut-icon {
    width: 38px;
    height: 38px;
    border-radius: 0.5rem;
    background: #F1F5F9;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
    transition: background 0.15s ease;
}

.shortcut-card:hover .shortcut-icon {
    background: var(--portal-primary-light);
}

.shortcut-title {
    font-size: 0.875rem;
    font-weight: 700;
    color: #0F172A;
    margin-bottom: 0.1rem;
}

.shortcut-desc {
    font-size: 0.75rem;
    color: var(--portal-text-muted);
}

/* ==========================================================================
   6. DASHBOARD MAIN SECTIONS (Tables & Info)
   ========================================================================== */
.dashboard-sections {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
}

.content-card {
    background: var(--portal-surface);
    border-radius: var(--portal-radius);
    border: 1px solid var(--portal-border);
    box-shadow: var(--portal-shadow);
    padding: 1.5rem;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: 0.85rem;
    border-bottom: 1px solid var(--portal-border);
}

.card-title {
    font-size: 1rem;
    font-weight: 700;
    color: #0F172A;
    letter-spacing: -0.01em;
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th {
    text-align: left;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--portal-text-muted);
    padding: 0.65rem 0.65rem;
    border-bottom: 1px solid var(--portal-border);
}

.table td {
    padding: 0.85rem 0.65rem;
    font-size: 0.875rem;
    border-bottom: 1px solid #F1F5F9;
}

.table tbody tr {
    transition: background 0.15s ease;
}

.table tbody tr:hover {
    background: #F8FAFC;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.55rem;
    border-radius: 50px;
    font-size: 0.725rem;
    font-weight: 700;
}

.badge-new { background: #FEF3C7; color: #92400E; }
.badge-read { background: #E0F2FE; color: #0369A1; }
.badge-replied { background: #DCFCE7; color: #15803D; }

.empty-state {
    text-align: center;
    padding: 2.25rem 1rem;
}

.empty-state-icon {
    font-size: 2.25rem;
    margin-bottom: 0.65rem;
    opacity: 0.7;
}

.empty-state-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: #334155;
    margin-bottom: 0.3rem;
}

.empty-state-sub {
    font-size: 0.8rem;
    color: var(--portal-text-muted);
}

/* ==========================================================================
   7. PORTAL TABS & IDENTITY CUSTOMIZER UI
   ========================================================================== */
.portal-tabs-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--portal-border);
    padding-bottom: 0.25rem;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    touch-action: pan-x;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.portal-tabs-nav::-webkit-scrollbar {
    display: none;
}

.portal-tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    font-size: 0.9rem;
    font-weight: 700;
    color: #64748B;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: -0.35rem;
    text-decoration: none;
    flex-shrink: 0;
    white-space: nowrap;
}

.portal-tab-btn:hover {
    color: #0F172A;
    background: rgba(0, 0, 0, 0.02);
    border-radius: 0.375rem 0.375rem 0 0;
}

.portal-tab-btn.active {
    color: var(--portal-primary);
    border-bottom-color: var(--portal-primary);
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
    animation: fadeInTab 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeInTab {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Alert Notification Toast */
.portal-toast-success {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    background: #F0FDF4;
    border: 1px solid #86EFAC;
    border-radius: var(--portal-radius);
    color: #166534;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 12px rgba(22, 101, 52, 0.08);
}

/* Customizer Grid Layout */
.identity-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 1.75rem;
    align-items: start;
}

/* Form Styles */
.customizer-card {
    background: var(--portal-surface);
    border-radius: var(--portal-radius);
    border: 1px solid var(--portal-border);
    box-shadow: var(--portal-shadow);
    padding: 1.75rem;
}

.customizer-section-title {
    font-size: 1rem;
    font-weight: 800;
    color: #0F172A;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--portal-border);
}

.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--portal-border);
    border-radius: 0.5rem;
    font-size: 0.9rem;
    font-family: inherit;
    transition: all 0.2s ease;
    resize: vertical;
}

.form-textarea:focus {
    outline: none;
    border-color: var(--portal-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--portal-primary) 15%, transparent);
}

.form-select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--portal-border);
    border-radius: 0.5rem;
    font-size: 0.9rem;
    font-family: inherit;
    background: #ffffff;
    cursor: pointer;
}

.form-select:focus {
    outline: none;
    border-color: var(--portal-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--portal-primary) 15%, transparent);
}

/* Color Pickers Grid Pro */
.colors-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.colors-grid-pro {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.color-card-pro {
    background: #FFFFFF;
    border: 1px solid var(--portal-border);
    border-radius: 0.75rem;
    padding: 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.color-card-pro:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
    border-color: #CBD5E1;
}

.color-card-header {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.color-card-icon {
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.color-card-title-group {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.color-card-label {
    font-size: 0.8rem;
    font-weight: 800;
    color: #0F172A;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.color-card-sub {
    font-size: 0.685rem;
    color: #64748B;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.color-swatch-box {
    position: relative;
    width: 100%;
    height: 48px;
    border-radius: 0.5rem;
    border: 1px solid rgba(0, 0, 0, 0.12);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06), 0 4px 10px rgba(0, 0, 0, 0.08);
    cursor: pointer;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.color-swatch-box:hover {
    transform: scale(1.02);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06), 0 6px 16px rgba(0, 0, 0, 0.15);
}

.color-swatch-box .color-swatch-overlay {
    opacity: 0;
    background: rgba(15, 23, 42, 0.65);
    color: #FFFFFF;
    font-size: 0.725rem;
    font-weight: 700;
    padding: 0.25rem 0.55rem;
    border-radius: 20px;
    backdrop-filter: blur(4px);
    transition: opacity 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    pointer-events: none;
}

.color-swatch-box:hover .color-swatch-overlay {
    opacity: 1;
}

.color-swatch-box .color-picker-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    border: none;
    padding: 0;
}

.color-input-group {
    display: flex;
    align-items: center;
    background: #F8FAFC;
    border: 1px solid var(--portal-border);
    border-radius: 0.5rem;
    padding: 0.15rem 0.45rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.color-input-group:focus-within {
    border-color: var(--portal-primary);
    background: #FFFFFF;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--portal-primary) 15%, transparent);
}

.color-hash-prefix {
    font-family: monospace;
    font-weight: 800;
    font-size: 0.85rem;
    color: #94A3B8;
    user-select: none;
}

.color-hex-input-pro {
    font-family: monospace;
    font-weight: 800;
    font-size: 0.825rem;
    color: #0F172A;
    background: transparent;
    border: none;
    outline: none;
    width: 100%;
    min-width: 0;
    text-transform: uppercase;
    padding: 0.25rem 0.2rem;
}

.btn-copy-hex {
    background: transparent;
    border: none;
    color: #94A3B8;
    cursor: pointer;
    font-size: 0.8rem;
    padding: 0.15rem 0.3rem;
    border-radius: 4px;
    transition: color 0.15s ease, background 0.15s ease;
}

.btn-copy-hex:hover {
    color: var(--portal-primary);
    background: #F1F5F9;
}

.color-dots-palette {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 0.15rem;
}

.color-dot-opt {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.15);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    flex-shrink: 0;
}

.color-dot-opt:hover {
    transform: scale(1.35);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.color-field-card {
    background: #F8FAFC;
    border: 1px solid var(--portal-border);
    border-radius: 0.5rem;
    padding: 0.65rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    min-width: 0;
    overflow: hidden;
}

.color-field-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: #475569;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.color-picker-wrapper {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    min-width: 0;
    width: 100%;
}

.color-picker-input {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    padding: 0;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    background: transparent;
}

.color-picker-input::-webkit-color-swatch-wrapper {
    padding: 0;
}

.color-picker-input::-webkit-color-swatch {
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 0.375rem;
}

.color-hex-text {
    font-family: monospace;
    font-weight: 700;
    font-size: 0.775rem;
    color: #0F172A;
    background: #FFFFFF;
    border: 1px solid var(--portal-border);
    padding: 0.3rem 0.4rem;
    border-radius: 0.375rem;
    width: 100%;
    min-width: 0;
    text-transform: uppercase;
}

/* Feasibility Results Card & Sticky Positioning */
.feasibility-results-card {
    background: var(--portal-surface);
    border-radius: var(--portal-radius);
    border: 1px solid var(--portal-border);
    box-shadow: var(--portal-shadow);
    padding: 1.5rem;
    position: sticky;
    top: 1rem;
}

/* Preset Themes Chips */
.presets-container {
    margin-bottom: 1.5rem;
    background: #F1F5F9;
    padding: 1rem;
    border-radius: 0.625rem;
    border: 1px solid #E2E8F0;
}

.presets-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.65rem;
}

.presets-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.preset-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.75rem;
    background: #FFFFFF;
    border: 1px solid #CBD5E1;
    border-radius: 50px;
    font-size: 0.775rem;
    font-weight: 700;
    color: #334155;
    cursor: pointer;
    transition: all 0.2s ease;
}

.preset-chip:hover {
    border-color: #0F172A;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.06);
}

.preset-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* File Upload Zone */
.upload-box {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: #F8FAFC;
    border: 1px stroke #CBD5E1;
    border-style: dashed;
    border-width: 2px;
    border-radius: 0.5rem;
    padding: 1rem;
    transition: border-color 0.2s ease;
}

.upload-box:hover {
    border-color: var(--portal-primary);
}

.upload-preview-thumb {
    width: 48px;
    height: 48px;
    border-radius: 0.375rem;
    object-fit: contain;
    background: #FFFFFF;
    border: 1px solid var(--portal-border);
    padding: 0.25rem;
}

/* LIVE PREVIEW STYLES */
.live-preview-card {
    position: sticky;
    top: 84px;
    background: #0F172A;
    border-radius: var(--portal-radius);
    padding: 1.25rem;
    color: #FFFFFF;
    box-shadow: 0 20px 40px -10px rgba(15, 23, 42, 0.3);
}

.mockup-window-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 1rem;
}

.mockup-dots {
    display: flex;
    gap: 0.4rem;
}

.mockup-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}
.dot-red { background: #EF4444; }
.dot-yellow { background: #F59E0B; }
.dot-green { background: #10B981; }

.mockup-address-bar {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 50px;
    padding: 0.2rem 0.8rem;
    font-size: 0.725rem;
    color: #94A3B8;
    font-family: monospace;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.mockup-canvas {
    background: var(--preview-bg, #F8FAFC);
    border-radius: 0.5rem;
    overflow: hidden;
    color: var(--preview-text, #0F172A);
    font-family: var(--preview-font-body, 'Inter', sans-serif);
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Mockup Header */
.mock-nav {
    background: #FFFFFF;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #E2E8F0;
}

.mock-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 800;
    font-size: 0.95rem;
    color: #0F172A;
    font-family: var(--preview-font-heading, 'Inter', sans-serif);
}

.mock-logo img {
    height: 24px;
    max-width: 90px;
    object-fit: contain;
}

.mock-nav-links {
    display: flex;
    gap: 0.75rem;
    font-size: 0.725rem;
    font-weight: 600;
    color: #64748B;
}

.mock-btn-contact {
    padding: 0.35rem 0.75rem;
    background: var(--preview-primary, #B91C1C);
    color: #FFFFFF;
    border-radius: 0.375rem;
    font-size: 0.725rem;
    font-weight: 700;
    border: none;
    transition: background 0.2s ease;
}

/* Mockup Hero */
.mock-hero {
    padding: 1.75rem 1.25rem;
    background: linear-gradient(135deg, color-mix(in srgb, var(--preview-primary, #B91C1C) 12%, #FFFFFF), var(--preview-bg, #F8FAFC));
    text-align: center;
}

.mock-hero-tag {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    background: var(--preview-primary, #B91C1C);
    color: #FFFFFF;
    border-radius: 50px;
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.mock-hero-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--preview-text, #0F172A);
    font-family: var(--preview-font-heading, 'Inter', sans-serif);
    margin-bottom: 0.35rem;
    line-height: 1.25;
}

.mock-hero-sub {
    font-size: 0.775rem;
    color: #64748B;
    margin-bottom: 1rem;
}

.mock-hero-cta {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.5rem 1rem;
    background: var(--preview-primary, #B91C1C);
    color: #FFFFFF;
    border-radius: 0.375rem;
    font-size: 0.775rem;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 4px 10px color-mix(in srgb, var(--preview-primary, #B91C1C) 30%, transparent);
}

/* Mockup Card Component */
.mock-content {
    padding: 1.25rem;
}

.mock-card {
    background: var(--preview-surface, #FFFFFF);
    border-radius: 0.5rem;
    padding: 1rem;
    border: 1px solid #E2E8F0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}

.mock-card-icon {
    width: 32px;
    height: 32px;
    border-radius: 0.375rem;
    background: color-mix(in srgb, var(--preview-primary, #B91C1C) 15%, transparent);
    color: var(--preview-primary, #B91C1C);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

.mock-card-title {
    font-size: 0.875rem;
    font-weight: 700;
    font-family: var(--preview-font-heading, 'Inter', sans-serif);
    color: var(--preview-text, #0F172A);
    margin-bottom: 0.2rem;
}

.mock-card-text {
    font-size: 0.725rem;
    color: #64748B;
}

@media (max-width: 991px) {
    .portal-sidebar { width: 0; display: none; }
    .portal-main { margin-left: 0; }
    .dashboard-sections { grid-template-columns: 1fr; }
    .identity-grid { grid-template-columns: 1fr; }
    .live-preview-card { position: static; margin-top: 1.5rem; }
}

/* ==========================================================================
   8. MODULAR DRAG & DROP LAYOUT BUILDER
   ========================================================================== */
.drag-list {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    margin-bottom: 1.5rem;
}

.drag-card {
    background: #FFFFFF;
    border: 1px solid var(--portal-border);
    border-radius: var(--portal-radius);
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.03);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    user-select: none;
    cursor: grab;
}

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

.drag-card.dragging {
    opacity: 0.4;
    transform: scale(0.98);
    border-color: var(--portal-primary);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.12);
}

.drag-card.drag-over {
    border-top: 3px solid var(--portal-primary);
    background: color-mix(in srgb, var(--portal-primary) 5%, #FFFFFF);
}

.drag-left {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
}

.drag-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 0.375rem;
    background: #F1F5F9;
    color: #64748B;
    font-size: 1.1rem;
    cursor: grab;
    flex-shrink: 0;
    transition: background 0.15s ease;
}

.drag-card:hover .drag-handle {
    background: var(--portal-primary-light);
    color: var(--portal-primary);
}

.drag-info {
    flex: 1;
}

.drag-title-row {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-bottom: 0.2rem;
}

.drag-type-badge {
    font-size: 0.685rem;
    font-weight: 800;
    padding: 0.15rem 0.5rem;
    background: #F1F5F9;
    border-radius: 50px;
    color: #475569;
    text-transform: uppercase;
}

.drag-section-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: #0F172A;
}

.drag-controls {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.visibility-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.75rem;
    border-radius: 50px;
    font-size: 0.775rem;
    font-weight: 700;
    border: 1px solid var(--portal-border);
    cursor: pointer;
    background: #F8FAFC;
    color: #64748B;
    transition: all 0.2s ease;
}

.visibility-toggle-btn.is-active {
    background: #DCFCE7;
    border-color: #86EFAC;
    color: #166534;
}

.bg-style-select {
    padding: 0.35rem 0.65rem;
    border-radius: 0.375rem;
    border: 1px solid var(--portal-border);
    font-size: 0.775rem;
    font-weight: 600;
    color: #334155;
    background: #FFFFFF;
    cursor: pointer;
}

/* ==========================================================================
   9. STUDIO BUILDER (CONSTRUTOR VISUAL EM TELA CHEIA)
   ========================================================================== */
.builder-page {
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #E2E8F0;
}

/* Topbar */
.builder-topbar {
    height: 60px;
    flex-shrink: 0;
    background: var(--portal-surface);
    border-bottom: 1px solid var(--portal-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.25rem;
    z-index: 20;
}

.builder-topbar-left,
.builder-topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.builder-back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: #475569;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.45rem 0.75rem;
    border-radius: 0.5rem;
    transition: all 0.15s ease;
}

.builder-back-link:hover {
    background: #F1F5F9;
    color: #0F172A;
}

.builder-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding-left: 0.85rem;
    border-left: 1px solid var(--portal-border);
}

.builder-brand-badge {
    width: 28px;
    height: 28px;
    border-radius: 0.45rem;
    background: var(--portal-primary);
    color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.builder-brand-title {
    font-size: 0.9rem;
    font-weight: 800;
    color: #0F172A;
    line-height: 1.2;
}

.builder-brand-sub {
    font-size: 0.7rem;
    color: var(--portal-text-muted);
    line-height: 1.2;
}

.device-toggle {
    display: inline-flex;
    background: #F1F5F9;
    padding: 0.25rem;
    border-radius: 0.65rem;
    gap: 0.15rem;
}

.device-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border: none;
    background: transparent;
    padding: 0.4rem 0.85rem;
    border-radius: 0.45rem;
    font-size: 0.8rem;
    font-weight: 700;
    color: #64748B;
    cursor: pointer;
    transition: all 0.15s ease;
}

.device-toggle-btn.active {
    background: #FFFFFF;
    color: var(--portal-primary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.builder-saved-hint {
    font-size: 0.72rem;
    color: #94A3B8;
}

/* Body: sidebar + canvas + properties */
.builder-body {
    flex: 1;
    display: flex;
    overflow: hidden;
}

.builder-sidebar {
    width: 300px;
    background: var(--portal-surface);
    border-right: 1px solid var(--portal-border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.builder-sidebar-header {
    padding: 1.15rem 1.25rem 0.85rem;
    border-bottom: 1px solid var(--portal-border);
}

.builder-sidebar-title {
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #94A3B8;
    margin-bottom: 0.3rem;
}

.builder-sidebar-sub {
    font-size: 0.8rem;
    color: var(--portal-text-muted);
}

.builder-blocks-list {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.builder-block-item {
    background: #FFFFFF;
    border: 1px solid var(--portal-border);
    border-radius: 0.65rem;
    padding: 0.75rem 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: grab;
    user-select: none;
    transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

.builder-block-item:active {
    cursor: grabbing;
}

.builder-block-item:hover {
    border-color: #CBD5E1;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.builder-block-item.selected {
    border-color: var(--portal-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--portal-primary) 15%, transparent);
}

.builder-block-item.dragging {
    opacity: 0.4;
    transform: scale(0.98);
}

.builder-block-item.drag-over {
    border-top: 3px solid var(--portal-primary);
}

.builder-block-item.is-hidden {
    opacity: 0.5;
}

.block-icon {
    width: 36px;
    height: 36px;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    flex-shrink: 0;
}

.accent-indigo { background: #E0E7FF; color: #4338CA; }
.accent-amber { background: #FEF3C7; color: #B45309; }
.accent-emerald { background: #D1FAE5; color: #047857; }
.accent-blue { background: #DBEAFE; color: #1D4ED8; }
.accent-purple { background: #EDE9FE; color: #6D28D9; }
.accent-pink { background: #FCE7F3; color: #BE185D; }
.accent-red { background: #FEE2E2; color: #B91C1C; }
.accent-slate { background: #F1F5F9; color: #475569; }

.builder-block-info {
    flex: 1;
    min-width: 0;
}

.builder-block-order {
    font-size: 0.66rem;
    font-weight: 800;
    color: #94A3B8;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.builder-block-name {
    font-size: 0.85rem;
    font-weight: 700;
    color: #0F172A;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.builder-block-vis-btn {
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 1rem;
    padding: 0.3rem;
    border-radius: 0.4rem;
    color: #94A3B8;
    flex-shrink: 0;
    line-height: 1;
}

.builder-block-vis-btn:hover {
    background: #F1F5F9;
}

/* Canvas */
.builder-canvas-wrap {
    flex: 1;
    background: #E2E8F0;
    overflow-y: auto;
    display: flex;
    justify-content: center;
    padding: 2.5rem 2.5rem 4rem;
}

.builder-device-frame {
    width: 100%;
    max-width: 1080px;
    height: fit-content;
    background: #FFFFFF;
    border-radius: 0.85rem;
    overflow: hidden;
    border: 1px solid #CBD5E1;
    box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.3);
    transition: max-width 0.3s ease, border-radius 0.3s ease;
}

.builder-device-frame.mobile {
    max-width: 390px;
    border-radius: 1.75rem;
    border: 8px solid #0F172A;
}

.builder-preview-block {
    position: relative;
    border: 2px solid transparent;
    cursor: pointer;
    transition: border-color 0.15s ease;
}

.builder-preview-block:hover {
    border-color: #C7D2FE;
}

.builder-preview-block.selected {
    border-color: var(--portal-primary);
}

.builder-preview-block.is-hidden {
    opacity: 0.35;
}

.builder-preview-block-badge {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: var(--portal-primary);
    color: #FFFFFF;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 0.2rem 0.6rem;
    border-radius: 50px;
    opacity: 0;
    pointer-events: none;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    transition: opacity 0.15s ease;
    z-index: 5;
}

.builder-preview-block:hover .builder-preview-block-badge,
.builder-preview-block.selected .builder-preview-block-badge {
    opacity: 1;
}

/* Properties Panel (right sidebar) */
.builder-props {
    width: 320px;
    background: var(--portal-surface);
    border-left: 1px solid var(--portal-border);
    flex-shrink: 0;
    overflow-y: auto;
}

.builder-props-header {
    padding: 1.1rem 1.25rem;
    border-bottom: 1px solid var(--portal-border);
    display: flex;
    align-items: center;
    gap: 0.7rem;
    position: sticky;
    top: 0;
    background: var(--portal-surface);
    z-index: 2;
}

.builder-props-icon {
    width: 32px;
    height: 32px;
    border-radius: 0.45rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    flex-shrink: 0;
}

.builder-props-title {
    font-size: 0.9rem;
    font-weight: 800;
    color: #0F172A;
    line-height: 1.25;
}

.builder-props-sub {
    font-size: 0.72rem;
    color: var(--portal-text-muted);
}

.builder-props-body {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1.35rem;
}

.builder-props-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.builder-props-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #334155;
}

.builder-props-field-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    color: #94A3B8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.builder-bg-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}

.builder-bg-option {
    padding: 0.55rem 0.35rem;
    border: 2px solid var(--portal-border);
    background: #F8FAFC;
    color: #475569;
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: 0.5rem;
    cursor: pointer;
    text-align: center;
    transition: all 0.15s ease;
}

.builder-bg-option.active {
    border-color: var(--portal-primary);
    background: var(--portal-primary-light);
    color: var(--portal-primary);
}

.builder-admin-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    padding: 0.75rem 0.9rem;
    background: #F8FAFC;
    border: 1px dashed #CBD5E1;
    border-radius: 0.6rem;
    color: #334155;
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 0.15s ease;
}

.builder-admin-link:hover {
    border-color: var(--portal-primary);
    color: var(--portal-primary);
    background: var(--portal-primary-light);
}

.builder-props-empty {
    padding: 2.5rem 1.5rem;
    text-align: center;
    color: #94A3B8;
    font-size: 0.85rem;
}

/* Toggle Switch */
.builder-switch {
    position: relative;
    display: inline-block;
    width: 42px;
    height: 24px;
    flex-shrink: 0;
}

.builder-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.builder-switch-track {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: #CBD5E1;
    border-radius: 50px;
    transition: background 0.2s ease;
}

.builder-switch-track::before {
    content: '';
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: #FFFFFF;
    border-radius: 50%;
    transition: transform 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.builder-switch input:checked + .builder-switch-track {
    background: var(--portal-primary);
}

.builder-switch input:checked + .builder-switch-track::before {
    transform: translateX(18px);
}

@media (max-width: 1200px) {
    .builder-props { width: 280px; }
    .builder-sidebar { width: 260px; }
}

/* ==========================================================================
   BUILDER DRAWER (edição de conteúdo dos blocos)
   ========================================================================== */
.drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease;
    z-index: 200;
}
.drawer-overlay.is-open {
    opacity: 1;
    visibility: visible;
}

.builder-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 420px;
    max-width: 100%;
    background: #FFFFFF;
    border-left: 1px solid var(--portal-border);
    box-shadow: -12px 0 32px rgba(15, 23, 42, 0.18);
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 210;
    display: flex;
    flex-direction: column;
}
.builder-drawer.is-open {
    transform: translateX(0);
}

.drawer-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--portal-border);
}
.drawer-title {
    font-size: 1.05rem;
    font-weight: 800;
    color: #0F172A;
}
.drawer-sub {
    font-size: 0.8rem;
    color: var(--portal-text-muted);
    margin-top: 0.2rem;
}
.drawer-close {
    background: transparent;
    border: none;
    font-size: 1.1rem;
    color: #64748B;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    transition: all 0.15s ease;
}
.drawer-close:hover {
    background: #F1F5F9;
    color: #0F172A;
}

.drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.5rem;
}
.drawer-hint {
    font-size: 0.8rem;
    color: var(--portal-text-muted);
    background: #F8FAFC;
    border: 1px solid var(--portal-border);
    border-radius: 0.5rem;
    padding: 0.65rem 0.85rem;
    margin-bottom: 1rem;
}
.drawer-loading,
.drawer-empty {
    text-align: center;
    color: var(--portal-text-muted);
    font-size: 0.875rem;
    padding: 2rem 1rem;
}

.drawer-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}
.drawer-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.75rem;
    background: #FFFFFF;
    border: 1px solid var(--portal-border);
    border-radius: 0.625rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.drawer-item:hover {
    border-color: #CBD5E1;
}
.drawer-item.dragging {
    opacity: 0.5;
}
.drawer-item.drag-over {
    border-color: var(--portal-primary);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--portal-primary) 20%, transparent);
}
.drawer-item-grip {
    color: #94A3B8;
    cursor: grab;
    font-size: 1rem;
    user-select: none;
}
.drawer-item-thumb {
    width: 44px;
    height: 44px;
    border-radius: 0.5rem;
    overflow: hidden;
    background: #F1F5F9;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.drawer-item-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.drawer-item-thumb span {
    font-size: 1.2rem;
}
.drawer-item-info {
    flex: 1;
    min-width: 0;
}
.drawer-item-name {
    font-size: 0.9rem;
    font-weight: 700;
    color: #0F172A;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.drawer-item-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.2rem;
    font-size: 0.72rem;
    color: var(--portal-text-muted);
}
.drawer-item-meta .drawer-status {
    background: #E0F2FE;
    color: #0369A1;
    padding: 0.1rem 0.4rem;
    border-radius: 0.3rem;
    font-weight: 600;
}

.drawer-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.6rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--portal-border);
    background: #F8FAFC;
}

/* Preview dinâmico de frota no canvas do builder */
.mock-fleet-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid #F1F5F9;
}
.mock-fleet-item:last-child {
    border-bottom: none;
}
.mock-fleet-item img {
    width: 40px;
    height: 40px;
    border-radius: 0.4rem;
    object-fit: cover;
}
.mock-fleet-item strong {
    display: block;
    font-size: 0.8rem;
    color: #0F172A;
}
.mock-fleet-cap {
    font-size: 0.72rem;
    color: var(--portal-text-muted);
}

/* Backdrop para a sidebar mobile */
.portal-sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    z-index: 999;
}

/* Botão de alternância do menu hambúrguer no portal */
.portal-sidebar-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    background: #F1F5F9;
    border: 1px solid var(--portal-border);
    border-radius: 0.5rem;
    color: #0F172A;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s ease;
}
.portal-sidebar-toggle:hover {
    background: #E2E8F0;
}

@media (max-width: 1024px) {
    .builder-drawer {
        width: 100%;
    }
}

@media (max-width: 768px) {
    html, body {
        overflow-x: hidden;
        width: 100%;
    }

    .portal-sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 1000;
        box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.15);
    }

    .portal-sidebar.open {
        transform: translateX(0);
    }

    .portal-sidebar-backdrop.open {
        display: block;
    }

    .portal-sidebar-toggle {
        display: flex;
    }

    .portal-main {
        margin-left: 0;
        width: 100%;
    }

    .portal-topbar {
        left: 0;
        padding: 0.75rem 1rem;
        height: 60px;
        min-height: 60px;
        gap: 0.75rem;
    }

    .topbar-title {
        font-size: 0.95rem;
    }

    .topbar-actions {
        gap: 0.4rem;
    }

    .btn-portal-secondary, .btn-logout {
        padding: 0.35rem 0.6rem;
        font-size: 0.75rem;
    }

    .portal-content {
        padding: 1rem;
        margin-top: 60px;
    }

    .dash-welcome-card {
        padding: 1.25rem;
    }

    .dash-welcome-title {
        font-size: 1.2rem;
    }

    .dash-welcome-sub {
        font-size: 0.85rem;
    }

    .dash-welcome-actions {
        flex-direction: column;
    }

    .btn-dash-action, .btn-dash-ghost {
        width: 100%;
        justify-content: center;
    }

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

    /* Utilitários de tabelas e formulários no mobile */
    .table-responsive, .portal-table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        width: 100%;
    }
}

@media (max-width: 480px) {
    .btn-portal-secondary span,
    .btn-logout span {
        display: none;
    }
}

/* Super Admin & Extended Dashboard Utilities */
.icon-purple {
    background: rgba(109, 40, 217, 0.10);
    color: #6D28D9;
}
.pill-purple {
    background: rgba(109, 40, 217, 0.08);
    color: #6D28D9;
}
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.domain-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.55rem;
    border-radius: 0.375rem;
    background: #F1F5F9;
    color: #334155;
    font-size: 0.775rem;
    font-weight: 600;
    border: 1px solid #E2E8F0;
}
.domain-chip.is-primary {
    background: rgba(109, 40, 217, 0.08);
    color: #5B21B6;
    border-color: rgba(109, 40, 217, 0.2);
    font-weight: 700;
}
.search-filter-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}
.filter-tabs {
    display: inline-flex;
    align-items: center;
    background: #F1F5F9;
    padding: 0.25rem;
    border-radius: 0.5rem;
    gap: 0.2rem;
}
.filter-tab-btn {
    padding: 0.35rem 0.85rem;
    border-radius: 0.375rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: #64748B;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
}
.filter-tab-btn:hover {
    color: #0F172A;
}
.filter-tab-btn.active {
    background: #FFFFFF;
    color: #6D28D9;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    font-weight: 700;
}
.search-input-box {
    position: relative;
    min-width: 260px;
}
.search-input-box input {
    width: 100%;
    padding: 0.45rem 0.75rem 0.45rem 2.2rem;
    border: 1px solid var(--portal-border);
    border-radius: 0.5rem;
    font-size: 0.85rem;
    outline: none;
    transition: all 0.15s ease;
}
.search-input-box input:focus {
    border-color: #6D28D9;
    box-shadow: 0 0 0 3px rgba(109, 40, 217, 0.12);
}
.search-input-box svg {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94A3B8;
    pointer-events: none;
}



