/* ============================================
   ImobiSISMAX - Estilos Globais
   Tema Liquid Glass | Dark & Light Mode
   ============================================ */

/* ============================================
   FONTS
   ============================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ============================================
   CSS CUSTOM PROPERTIES (Variáveis de Tema)
   ============================================ */
:root {
    /* Light Mode (default) */
    --bg-base: #FFFFFF;
    --bg-surface: rgba(255, 255, 255, 0.7);
    --bg-surface-hover: rgba(255, 235, 235, 0.5);
    --bg-glass: rgba(255, 255, 255, 0.6);
    --bg-glass-strong: rgba(255, 255, 255, 0.8);
    --bg-sidebar: rgba(255, 255, 255, 0.5);
    --bg-header: rgba(255, 255, 255, 0.6);
    --bg-input: rgba(255, 255, 255, 0.8);

    --border-glass: rgba(0, 0, 0, 0.08);
    --border-glass-strong: rgba(0, 0, 0, 0.12);
    --border-input: rgba(0, 0, 0, 0.15);

    --text-primary: #000000;
    --text-secondary: #4a5568;
    --text-muted: #718096;
    --text-inverse: #ffffff;

    --shadow-glass: 0 8px 32px rgba(0, 0, 0, 0.08);
    --shadow-glass-sm: 0 4px 16px rgba(0, 0, 0, 0.06);
    --shadow-glass-lg: 0 16px 48px rgba(0, 0, 0, 0.12);
    --shadow-glow: 0 0 20px rgba(195, 0, 1, 0.15);

    --blur-glass: 20px;
    --blur-glass-strong: 40px;

    --accent: #C30001;
    --accent-hover: #9B0001;
    --accent-light: #FFEBEB;
    --accent-border: #F29E9F;
    --success: #22c55e;
    --success-hover: #16a34a;
    --success-light: rgba(34, 197, 94, 0.1);
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --danger-light: rgba(239, 68, 68, 0.1);
    --warning: #f59e0b;
    --warning-light: rgba(245, 158, 11, 0.1);
    --info: #3b82f6;
    --info-light: rgba(59, 130, 246, 0.1);

    --sidebar-width: 260px;
    --sidebar-collapsed-width: 70px;
    --header-height: 64px;
    --tab-bar-height: 44px;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Mode */
.dark {
    --bg-base: #111111;
    --bg-surface: rgba(255, 255, 255, 0.05);
    --bg-surface-hover: rgba(255, 255, 255, 0.08);
    --bg-glass: rgba(255, 255, 255, 0.04);
    --bg-glass-strong: rgba(255, 255, 255, 0.07);
    --bg-sidebar: rgba(255, 255, 255, 0.03);
    --bg-header: rgba(17, 17, 17, 0.85);
    --bg-input: rgba(255, 255, 255, 0.06);

    --border-glass: rgba(255, 255, 255, 0.08);
    --border-glass-strong: rgba(255, 255, 255, 0.12);
    --border-input: rgba(255, 255, 255, 0.14);

    --text-primary: #e4e4e7;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --text-inverse: #111111;

    --shadow-glass: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-glass-sm: 0 4px 16px rgba(0, 0, 0, 0.25);
    --shadow-glass-lg: 0 16px 48px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(195, 0, 1, 0.2);

    --accent-light: rgba(195, 0, 1, 0.15);
    --accent-border: rgba(242, 158, 159, 0.3);
    --success-light: rgba(34, 197, 94, 0.15);
}

/* ============================================
   RESET & BASE
   ============================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-base);
    color: var(--text-primary);
    min-height: 100vh;
    transition: var(--transition);
    line-height: 1.6;
}

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

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

/* ============================================
   GLASS COMPONENTS
   ============================================ */

/* Card Glass */
.glass-card {
    background: var(--bg-surface);
    backdrop-filter: blur(var(--blur-glass));
    -webkit-backdrop-filter: blur(var(--blur-glass));
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-glass);
    transition: var(--transition);
}

.glass-card:hover {
    background: rgb(246, 246, 246);
    box-shadow: var(--shadow-glass-lg);
    border-color: var(--border-glass-strong);
}

.dark .glass-card:hover {
    background: var(--bg-surface-hover);
}

/* Sidebar Glass */
.glass-sidebar {
    background: var(--bg-sidebar);
    backdrop-filter: blur(var(--blur-glass-strong));
    -webkit-backdrop-filter: blur(var(--blur-glass-strong));
    border-right: 1px solid var(--border-glass);
    display: flex;
    flex-direction: column;
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 40;
    overflow-y: hidden;
    overflow-x: hidden;
    transition: var(--transition);
}

/* Header Glass */
.glass-header {
    background: var(--bg-header);
    backdrop-filter: blur(var(--blur-glass-strong));
    -webkit-backdrop-filter: blur(var(--blur-glass-strong));
    border-bottom: 1px solid var(--border-glass);
    height: var(--header-height);
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    z-index: 100;
    transition: var(--transition);
}

/* Tab Bar (Chrome-like tabs) */
.tab-bar {
    position: fixed;
    top: var(--header-height);
    left: var(--sidebar-width);
    right: 0;
    height: var(--tab-bar-height);
    background: var(--bg-header);
    backdrop-filter: blur(var(--blur-glass-strong));
    -webkit-backdrop-filter: blur(var(--blur-glass-strong));
    border-bottom: 1px solid var(--border-glass);
    z-index: 99;
    display: flex;
    align-items: flex-end;
    overflow: hidden;
    padding: 0;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.tab-bar::-webkit-scrollbar {
    display: none;
}

.tab-bar .tab-scroll-btn {
    flex-shrink: 0;
    width: 32px;
    height: 100%;
    display: none;
    align-items: center;
    justify-content: center;
    background: var(--bg-glass-strong);
    border: none;
    border-left: 1px solid var(--border-glass);
    border-right: 1px solid var(--border-glass);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 11px;
    padding: 0;
    z-index: 2;
    transition: background 0.2s, color 0.2s;
}
.tab-bar .tab-scroll-btn:hover {
    color: var(--accent);
    background: var(--accent-light);
}
.tab-bar .tab-scroll-btn:active {
    background: var(--accent);
    color: var(--text-inverse);
}
.tab-bar.has-overflow .tab-scroll-btn {
    display: flex;
}

.tab-close-all-btn {
    flex-shrink: 0;
    width: 32px;
    height: 100%;
    display: none;
    align-items: center;
    justify-content: center;
    background: var(--bg-glass-strong);
    border: none;
    border-left: 1px solid var(--border-glass);
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    transition: background 0.2s, color 0.2s;
}
.tab-close-all-btn:hover {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}
.tab-close-all-btn:active {
    background: var(--danger);
    color: var(--text-inverse);
}
.tab-bar.has-multiple .tab-close-all-btn {
    display: flex;
}

.tab-list {
    display: flex;
    height: 100%;
    align-items: flex-end;
    gap: 1px;
    flex: 1;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    padding: 0 4px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.tab-list::-webkit-scrollbar {
    display: none;
}

.tab-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 33px;
    padding: 0 12px;
    border-radius: 8px 8px 0 0;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    background: transparent;
    cursor: pointer;
    max-width: none;
    min-width: 60px;
    white-space: nowrap;
    overflow: hidden;
    transition: background 0.15s, color 0.15s;
    border: 1px solid transparent;
    border-bottom: none;
    flex-shrink: 0;
    position: relative;
    user-select: none;
}

.tab-item:hover {
    background: var(--bg-surface-hover);
    color: var(--text-secondary);
}

.tab-item.active {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
    border-color: var(--border-glass);
    font-weight: 600;
}

.tab-item.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--bg-surface-hover);
}

.tab-item .tab-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.tab-item .tab-icon svg {
    width: 13px;
    height: 13px;
}

.tab-item .tab-title {
    overflow: visible;
    text-overflow: clip;
    flex: 1;
    min-width: 0;
}

.tab-item .tab-close {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    line-height: 1;
    opacity: 0;
    transition: opacity 0.15s, background 0.15s;
    flex-shrink: 0;
    margin-left: 2px;
}

.tab-item:hover .tab-close,
.tab-item.active .tab-close {
    opacity: 0.5;
}

.tab-item .tab-close:hover {
    opacity: 1;
    background: var(--danger-light);
    color: var(--danger);
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    padding-top: calc(var(--header-height) + var(--tab-bar-height) + 24px);
    padding-left: 24px;
    padding-right: 24px;
    padding-bottom: 24px;
    min-height: 100vh;
    transition: var(--transition);
}

/* ============================================
   INPUTS GLASS
   ============================================ */
.input-glass {
    background: var(--bg-input);
    border: 1px solid var(--border-input);
    border-radius: var(--radius);
    color: var(--text-primary);
    padding: 12px 16px;
    font-size: 14px;
    width: 100%;
    outline: none;
    transition: var(--transition);
    font-family: inherit;
}

select.input-glass {
    padding-right: 36px;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    cursor: pointer;
}

.dark select.input-glass,
.dark .phone-country-select {
    color-scheme: dark;
}

.dark select.input-glass option,
.dark .phone-country-select option,
.dark select.input-glass optgroup,
.dark .phone-country-select optgroup {
    background: #1a1a1a;
    color: var(--text-primary);
}

.input-glass::placeholder {
    color: var(--text-muted);
}

.input-glass:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light), var(--shadow-glass-sm);
    background: var(--bg-glass-strong);
}

.input-glass:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.searchable-select-wrapper {
    position: relative;
    width: 280px;
    flex: 0 0 280px;
    z-index: 2;
}

.searchable-select-wrapper.searchable-select-fluid {
    width: 100%;
    flex: 1 1 auto;
}

.searchable-select-card-context {
    position: relative;
    z-index: 35;
    overflow: visible;
}

.searchable-select-wrapper.is-open {
    z-index: 140;
}

.searchable-select-native {
    display: none !important;
}

.searchable-select-combobox {
    position: relative;
}

.searchable-select-input {
    width: 100%;
    padding-right: 42px;
}

.searchable-select-toggle {
    position: absolute;
    top: 50%;
    right: 10px;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transform: translateY(-50%);
    transition: background 0.16s ease, color 0.16s ease;
}

.searchable-select-toggle:hover {
    background: rgba(15, 23, 42, 0.06);
    color: var(--text-primary);
}

.searchable-select-toggle svg {
    transition: transform 0.16s ease;
}

.searchable-select-wrapper.is-open .searchable-select-toggle svg {
    transform: rotate(180deg);
}

.searchable-select-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    display: none;
    max-height: 260px;
    overflow: auto;
    padding: 8px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.14);
}

.searchable-select-wrapper.is-open .searchable-select-menu {
    display: block;
}

.searchable-select-option {
    width: 100%;
    min-height: 36px;
    display: flex;
    align-items: center;
    padding: 8px 10px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--text-primary);
    font: inherit;
    font-size: 14px;
    text-align: left;
    cursor: pointer;
    transition: background 0.14s ease, color 0.14s ease;
}

.searchable-select-option + .searchable-select-option {
    margin-top: 4px;
}

.searchable-select-option:hover,
.searchable-select-option.is-selected {
    background: rgba(14, 116, 144, 0.1);
    color: #0e7490;
}

.searchable-select-empty {
    padding: 10px;
    color: var(--text-muted);
    font-size: 13px;
}

.dark .searchable-select-toggle:hover {
    background: rgba(255, 255, 255, 0.08);
}

.dark .searchable-select-menu {
    border-color: rgba(255, 255, 255, 0.12);
    background: rgba(24, 24, 27, 0.98);
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.35);
}

.dark .searchable-select-option:hover,
.dark .searchable-select-option.is-selected {
    background: rgba(14, 116, 144, 0.18);
    color: #67e8f9;
}

@media (max-width: 720px) {
    .searchable-select-wrapper {
        width: 100%;
        flex-basis: 100%;
    }
}

.phone-group {
    display: flex;
    gap: 0;
}

.phone-country-wrap {
    position: relative;
    flex: 0 0 104px;
    min-width: 104px;
}

.phone-country {
    width: auto;
    min-width: 95px;
    border-radius: 8px 0 0 8px;
    border-right: none;
    padding-right: 4px;
    font-size: 13px;
}

.phone-country-wrap .phone-country {
    display: block;
    width: 100%;
    min-width: 0;
    height: 100%;
    color: transparent;
    padding-left: 10px;
    padding-right: 28px;
    text-shadow: none;
}

.phone-country-wrap .phone-country option {
    color: #111827;
}

.dark .phone-country-wrap .phone-country option {
    background: #1a1a1a;
    color: var(--text-primary);
}

.phone-country-display {
    position: absolute;
    inset: 0 26px 0 12px;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 7px;
    pointer-events: none;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 600;
}

.phone-country-flag {
    position: relative;
    display: inline-block;
    width: 22px;
    height: 16px;
    flex: 0 0 22px;
    overflow: hidden;
    border-radius: 3px;
    background-color: #f3f4f6;
    background-position: center;
    background-size: cover;
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.16);
}

.phone-country-flag-br {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 28 20'%3E%3Cpath fill='%23009b3a' d='M0 0h28v20H0z'/%3E%3Cpath fill='%23ffdf00' d='M14 2l11 8-11 8-11-8z'/%3E%3Ccircle cx='14' cy='10' r='4' fill='%23002776'/%3E%3C/svg%3E");
}

.phone-country-flag-us {
    background: repeating-linear-gradient(to bottom, #b22234 0 1.55px, #fff 1.55px 3.1px);
}

.phone-country-flag-us::after {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    width: 44%;
    height: 54%;
    background: #3c3b6e;
}

.phone-country-flag-pt {
    background: linear-gradient(to right, #006600 0 40%, #ff0000 40% 100%);
}

.phone-country-flag-ar {
    background: linear-gradient(to bottom, #74acdf 0 33.33%, #fff 33.33% 66.66%, #74acdf 66.66% 100%);
}

.phone-country-flag-py {
    background: linear-gradient(to bottom, #d52b1e 0 33.33%, #fff 33.33% 66.66%, #0038a8 66.66% 100%);
}

.phone-country-flag-uy {
    background: repeating-linear-gradient(to bottom, #fff 0 2.22px, #0038a8 2.22px 4.44px);
}

.phone-country-flag-uy::after,
.phone-country-flag-cl::after {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    width: 42%;
    height: 50%;
    background: #fff;
}

.phone-country-flag-cl {
    background: linear-gradient(to bottom, #fff 0 50%, #d52b1e 50% 100%);
}

.phone-country-flag-cl::after {
    background: #0039a6;
}

.phone-country-flag-co {
    background: linear-gradient(to bottom, #fcd116 0 50%, #003893 50% 75%, #ce1126 75% 100%);
}

.phone-country-flag-mx {
    background: linear-gradient(to right, #006847 0 33.33%, #fff 33.33% 66.66%, #ce1126 66.66% 100%);
}

.phone-country-flag-es {
    background: linear-gradient(to bottom, #aa151b 0 25%, #f1bf00 25% 75%, #aa151b 75% 100%);
}

.phone-input {
    border-radius: 0 8px 8px 0;
    flex: 1;
}

.phone-country-select {
    width: 80px;
    display: inline-block;
    vertical-align: top;
}

.phone-number-input {
    width: calc(100% - 90px);
    display: inline-block;
}

/* Input Label */
.input-label {
    display: block;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 6px;
    letter-spacing: 0.02em;
}

/* ============================================
   TOGGLE SWITCH
   ============================================ */
.toggle {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
    flex-shrink: 0;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--border-glass-strong);
    border-radius: 22px;
    transition: var(--transition);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: var(--transition);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.toggle input:checked + .toggle-slider {
    background: var(--accent);
}

.toggle input:checked + .toggle-slider::before {
    transform: translateX(18px);
}

.toggle input:focus-visible + .toggle-slider {
    box-shadow: 0 0 0 3px var(--accent-light);
}

/* Input Group (label + input + error) */
.input-group {
    margin-bottom: 20px;
}

.modal-content .input-group {
    margin-bottom: 0;
}

.modal-content .grid {
    gap: 12px;
}

.input-error {
    color: var(--danger);
    font-size: 12px;
    margin-top: 4px;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    font-family: inherit;
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 2px 8px rgba(195, 0, 1, 0.3);
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-hover);
    box-shadow: 0 4px 16px rgba(195, 0, 1, 0.4);
    transform: translateY(-1px);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover:not(:disabled) {
    background: var(--danger-hover);
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.4);
    transform: translateY(-1px);
}

.btn-warning {
    background: var(--warning);
    color: #1a1a2e;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

.btn-warning:hover:not(:disabled) {
    background: #d97706;
    box-shadow: 0 4px 16px rgba(245, 158, 11, 0.4);
    transform: translateY(-1px);
}

.btn-ghost {
    background: var(--bg-glass);
    color: var(--text-primary);
    border: 1px solid var(--border-glass);
}

.btn-ghost:hover:not(:disabled) {
    background: var(--bg-surface-hover);
    border-color: var(--border-glass-strong);
}

.modal-footer .btn-ghost {
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    color: #374151;
}

.modal-footer .btn-ghost:hover {
    background: #e5e7eb;
    border-color: #9ca3af;
}

.dark .modal-footer .btn-ghost {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
}

.dark .modal-footer .btn-ghost:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.25);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 13px;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
}

.btn-block {
    width: 100%;
}

/* ============================================
   STAT CARDS (Dashboard)
   ============================================ */
.stat-card {
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.stat-card .stat-info h3 {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.stat-card .stat-info .stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.stat-icon-green { background: var(--success-light); color: var(--success); }
.stat-icon-red { background: var(--danger-light); color: var(--danger); }
.stat-icon-blue { background: var(--info-light); color: var(--info); }
.stat-icon-yellow { background: var(--warning-light); color: var(--warning); }

/* ============================================
   TABLE GLASS
   ============================================ */
.table-glass {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.table-glass thead th {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-glass);
}

.table-glass tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-glass);
    font-size: 14px;
    color: var(--text-primary);
    vertical-align: middle;
}

.table-glass tbody tr {
    transition: var(--transition);
}

.table-glass tbody tr:hover {
    background: rgb(238, 238, 238);
}

.dark .table-glass tbody tr:hover {
    background: var(--bg-surface-hover);
}

.table-glass tbody tr:last-child td {
    border-bottom: none;
}

/* ============================================
   BADGES
   ============================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1;
}

.badge-success {
    background: var(--success-light);
    color: var(--success);
}

.badge-danger {
    background: var(--danger-light);
    color: var(--danger);
}

.badge-warning {
    background: var(--warning-light);
    color: var(--warning);
}

.badge-info {
    background: var(--info-light);
    color: var(--info);
}

.badge-secondary {
    background: rgba(113, 128, 150, 0.14);
    color: var(--text-secondary);
}

.dark .badge-secondary {
    background: rgba(161, 161, 170, 0.18);
    color: #d4d4d8;
}

.badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}

.badge-dot-green { background: var(--success); }
.badge-dot-red { background: var(--danger); }
.badge-dot-yellow { background: var(--warning); }
.badge-dot-blue { background: var(--info); }

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 14px 20px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    color: #fff;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: var(--shadow-glass-lg);
    animation: slideIn 0.3s ease, fadeOut 0.3s ease 3.7s;
    max-width: 400px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast-success { background: rgba(34, 197, 94, 0.9); }
.toast-primary { background: rgba(195, 0, 1, 0.9); }
.toast-error { background: rgba(239, 68, 68, 0.9); }
.toast-warning { background: rgba(245, 158, 11, 0.9); color: #1a1a2e; }
.toast-info { background: rgba(59, 130, 246, 0.9); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* ============================================
   MODAL
   ============================================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: var(--bg-base);
    border: 1px solid var(--border-glass-strong);
    border-radius: var(--radius-lg);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(0, 0, 0, 0.05);
    max-width: 560px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    overscroll-behavior: contain;
    animation: scaleIn 0.2s ease;
}

.modal-header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 28px 16px;
    border-bottom: 1px solid var(--border-glass);
    background: var(--bg-base);
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-body,
.modal-content > p,
.modal-content > form {
    padding: 20px 28px;
}

.modal-body p,
.modal-content > p {
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.6;
    margin: 0;
}

.modal-header .modal-close {
    width: 32px;
    height: 32px;
    border-radius: var(--radius);
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.modal-header .modal-close:hover {
    background: var(--danger-light);
    color: var(--danger);
}

.modal-footer {
    position: sticky;
    bottom: 0;
    z-index: 20;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    padding: 16px 28px 24px;
    border-top: 1px solid var(--border-glass);
    background: var(--bg-base);
}

.modal-footer .btn {
    position: relative;
    flex-shrink: 0;
    box-shadow: none;
    transform: none;
}

.modal-footer .btn:hover {
    transform: none;
    box-shadow: none;
}

/* Footer dentro de form: compensa o padding do form */
.modal-content > form .modal-footer {
    margin: 24px -28px -20px;
    padding: 16px 28px 20px;
}

.clientes-duplicate-content {
    max-width: 760px;
}

.clientes-duplicate-alert {
    padding: 14px 16px;
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 16px;
    background: rgba(245, 158, 11, 0.08);
    color: #92400e;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.45;
}

.clientes-duplicate-list {
    display: grid;
    gap: 12px;
    margin-top: 14px;
}

.clientes-duplicate-card {
    padding: 14px;
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    background: var(--bg-secondary);
}

.clientes-duplicate-card-header,
.clientes-duplicate-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.clientes-duplicate-card-header strong {
    color: var(--text-primary);
    font-size: 15px;
}

.clientes-duplicate-card-header span,
.clientes-duplicate-meta,
.clientes-duplicate-match {
    color: var(--text-muted);
    font-size: 12px;
}

.clientes-duplicate-meta,
.clientes-duplicate-match {
    margin-top: 8px;
}

.clientes-duplicate-match {
    padding: 8px 10px;
    border-radius: 12px;
    background: rgba(14, 116, 144, 0.08);
    color: #0e7490;
    font-weight: 700;
}

.clientes-duplicate-brokers {
    display: grid;
    gap: 6px;
    margin: 10px 0 0;
    padding: 0;
    list-style: none;
}

.clientes-duplicate-brokers li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 10px;
    border-radius: 12px;
    background: var(--bg-base);
    color: var(--text-primary);
    font-size: 12px;
}

.clientes-duplicate-brokers span {
    color: var(--text-muted);
    text-align: right;
}

.dark .clientes-duplicate-alert {
    background: rgba(245, 158, 11, 0.14);
    color: #fbbf24;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scaleIn {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* ============================================
   SIDEBAR MENU
   ============================================ */
.sidebar-logo {
    padding: 0 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    height: var(--header-height);
    border-bottom: 1px solid var(--border-glass);
}

.sidebar-logo img {
    width: 32px;
    height: 32px;
}

.sidebar-logo h1 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.sidebar-logo .logo-accent {
    color: var(--accent);
}

.sidebar-logo-mark {
    width: 32px;
    height: 32px;
    background: var(--accent);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-nav {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px 12px;
}

.sidebar-section {
    margin-bottom: 8px;
}

.sidebar-section-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 8px 12px 4px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    text-decoration: none;
}

.sidebar-link:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
}

.sidebar-link.active {
    background: var(--accent-light);
    color: var(--accent);
}

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

.sidebar-link .link-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.sidebar-tree {
    display: block;
}

.sidebar-tree summary {
    list-style: none;
    cursor: pointer;
}

.sidebar-tree summary::-webkit-details-marker {
    display: none;
}

.sidebar-tree-chevron {
    margin-left: auto;
    color: var(--text-muted);
    transition: transform .2s ease;
}

.sidebar-tree[open] .sidebar-tree-chevron {
    transform: rotate(180deg);
}

.sidebar-submenu {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin: 3px 0 5px 32px;
    padding-left: 10px;
    border-left: 1px solid var(--border-glass);
}

.sidebar-sublink {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 7px 10px;
    border-radius: 9px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: var(--transition);
}

.sidebar-sublink:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
}

.sidebar-sublink.active {
    background: var(--accent-light);
    color: var(--accent);
}

.sidebar-subtree {
    display: block;
}

.sidebar-subtree summary {
    list-style: none;
    cursor: pointer;
}

.sidebar-subtree summary::-webkit-details-marker {
    display: none;
}

.sidebar-subtree-summary {
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 100%;
    overflow: hidden;
    padding: 7px 10px;
    border-radius: 9px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    transition: var(--transition);
}

.sidebar-subtree-summary span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-subtree-summary:hover,
.sidebar-subtree-summary.active {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
}

.sidebar-subtree-chevron {
    margin-left: auto;
    flex-shrink: 0;
    color: var(--text-muted);
    transition: transform .2s ease;
}

.sidebar-subtree[open] .sidebar-subtree-chevron {
    transform: rotate(180deg);
}

.sidebar-subtree-links {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: 2px 0 2px 12px;
    padding-left: 8px;
    border-left: 1px solid var(--border-glass);
}

.sidebar-sublink-branch {
    font-size: 12px;
    font-weight: 500;
    padding: 6px 9px;
}

.sidebar-submenu-empty {
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.35;
    padding: 7px 10px;
}

.sidebar-bottom {
    position: relative;
    flex-shrink: 0;
    padding: 12px;
    border-top: 1px solid var(--border-glass);
    background: var(--bg-sidebar);
    backdrop-filter: blur(var(--blur-glass-strong));
    -webkit-backdrop-filter: blur(var(--blur-glass-strong));
}

/* Toggle button */
.sidebar-toggle-btn {
    background: none;
    border: none;
    cursor: pointer;
    width: 100%;
    text-align: left;
    font-family: inherit;
}

.sidebar-toggle-btn .toggle-icon-expand {
    display: none;
}

/* ============================================
   SIDEBAR COLLAPSED STATE
   ============================================ */
/* Estado imediato via html class (evita flash) */
.sidebar-will-collapse .glass-sidebar {
    width: var(--sidebar-collapsed-width);
}

.sidebar-will-collapse .glass-header {
    left: var(--sidebar-collapsed-width);
}

.sidebar-will-collapse .tab-bar {
    left: var(--sidebar-collapsed-width);
}

.sidebar-will-collapse .main-content {
    margin-left: var(--sidebar-collapsed-width);
}

.sidebar-will-collapse .glass-sidebar .sidebar-logo h1,
.sidebar-will-collapse .glass-sidebar .sidebar-section-title {
    display: none;
}

.sidebar-will-collapse .glass-sidebar .sidebar-logo {
    justify-content: center;
    padding: 0;
}

.sidebar-will-collapse .glass-sidebar .sidebar-link span:not(.link-icon) {
    display: none;
}

.sidebar-will-collapse .glass-sidebar .sidebar-link {
    justify-content: center;
    padding: 10px;
    gap: 0;
}

.sidebar-will-collapse .glass-sidebar .sidebar-toggle-btn .toggle-icon-collapse {
    display: none;
}

.sidebar-will-collapse .glass-sidebar .sidebar-toggle-btn .toggle-icon-expand {
    display: block;
}

/* Estado via JS (após init) */
.glass-sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.glass-sidebar.collapsed ~ .glass-header,
.glass-sidebar.collapsed ~ .tab-bar {
    left: var(--sidebar-collapsed-width);
}

/* Fix: header/tab-bar/main são siblings do sidebar no DOM? Não — usamos body class */
body.sidebar-collapsed .glass-header {
    left: var(--sidebar-collapsed-width);
}

body.sidebar-collapsed .tab-bar {
    left: var(--sidebar-collapsed-width);
}

body.sidebar-collapsed .main-content {
    margin-left: var(--sidebar-collapsed-width);
}

/* Sidebar interno quando colapsado */
.glass-sidebar.collapsed .sidebar-logo h1 {
    display: none;
}

.glass-sidebar.collapsed .sidebar-logo {
    justify-content: center;
    padding: 0;
}

.glass-sidebar.collapsed .sidebar-nav {
    padding: 16px 8px;
}

.glass-sidebar.collapsed .sidebar-section-title {
    display: none;
}

.glass-sidebar.collapsed .sidebar-link {
    justify-content: center;
    padding: 10px;
    gap: 0;
}

.glass-sidebar.collapsed .sidebar-link span:not(.link-icon) {
    display: none;
}

.glass-sidebar.collapsed .sidebar-link .link-icon {
    width: 24px;
    height: 24px;
}

.glass-sidebar.collapsed .sidebar-tree-chevron,
.glass-sidebar.collapsed .sidebar-submenu,
.glass-sidebar.collapsed .sidebar-subtree {
    display: none;
}

.glass-sidebar.collapsed .sidebar-bottom {
    padding: 8px;
}

.glass-sidebar.collapsed .sidebar-toggle-btn .toggle-icon-collapse {
    display: none;
}

.glass-sidebar.collapsed .sidebar-toggle-btn .toggle-icon-expand {
    display: block;
}

/* Tooltip no hover quando colapsado */
.glass-sidebar.collapsed .sidebar-link {
    position: relative;
}

.glass-sidebar.collapsed .sidebar-link::after {
    display: none;
}

.sidebar-floating-tooltip {
    position: fixed;
    z-index: 180;
    max-width: 260px;
    padding: 8px 12px;
    border: 1px solid var(--border-glass-strong);
    border-radius: 10px;
    background: #ffffff;
    color: var(--text-primary);
    box-shadow: var(--shadow-glass-lg);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.25;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transform: translateX(-4px);
    transition: opacity 0.14s ease, transform 0.14s ease;
}

.sidebar-floating-tooltip.is-visible {
    opacity: 1;
    transform: translateX(0);
}

.dark .sidebar-floating-tooltip {
    background: #171717;
}

/* ============================================
   HEADER
   ============================================ */
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 0 24px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-search {
    position: relative;
}

.header-search input {
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: 10px;
    padding: 8px 16px 8px 40px;
    color: var(--text-primary);
    font-size: 14px;
    width: 280px;
    outline: none;
    transition: var(--transition);
}

.header-search input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
    width: 320px;
}

.header-search .search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.theme-toggle {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.theme-toggle:hover {
    background: var(--bg-surface-hover);
    color: var(--accent);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--accent);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    outline: none;
    overflow: hidden;
    padding: 0;
}

.user-avatar:hover {
    box-shadow: var(--shadow-glow);
}

.user-avatar-has-media {
    background: transparent;
}

.user-avatar-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.header-user-name {
    color: var(--text-primary);
}

.header-user-meta {
    color: var(--text-muted);
}

.impersonation-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: min(420px, 42vw);
    padding: 6px 8px 6px 12px;
    border: 1px solid rgba(245, 158, 11, 0.32);
    border-radius: 999px;
    background: #fff7ed;
    color: #9a3412;
    font-size: 12px;
    line-height: 1;
    box-shadow: 0 10px 24px rgba(245, 158, 11, 0.12);
}

.impersonation-pill strong {
    max-width: 170px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #7c2d12;
}

.impersonation-pill-label {
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.impersonation-pill-action {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 10px;
    border: 0;
    border-radius: 999px;
    background: #c2410c;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.16s ease, transform 0.16s ease;
}

.impersonation-pill-action:hover {
    background: #9a3412;
    transform: translateY(-1px);
}

.user-dropdown-button {
    width: 100%;
    border: 0;
    background: transparent;
    text-align: left;
    font-family: inherit;
    cursor: pointer;
}

.dark .impersonation-pill {
    border-color: rgba(251, 191, 36, 0.3);
    background: #422006;
    color: #fed7aa;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.24);
}

.dark .impersonation-pill strong {
    color: #ffedd5;
}

.dark .impersonation-pill-action {
    background: #ea580c;
}

.dark .impersonation-pill-action:hover {
    background: #f97316;
}

.user-dropdown {
    position: fixed;
    min-width: 200px;
    padding: 8px 0;
    z-index: 99999;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
    background: var(--bg-base);
    border: 1px solid var(--border-glass-strong);
}

.user-dropdown-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-glass);
}

.user-dropdown-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.user-dropdown-subtitle {
    font-size: 12px;
    color: var(--text-muted);
}

.user-dropdown-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    font-size: 13px;
    color: var(--text-primary);
    text-decoration: none;
    transition: background 0.15s;
}

.user-dropdown-link:hover {
    background: var(--bg-surface-hover);
}

.user-dropdown-divider {
    border-top: 1px solid var(--border-glass);
    margin: 4px 0;
}

.user-dropdown-link-danger {
    color: var(--danger);
}

/* ============================================
   HAMBURGER (Mobile)
   ============================================ */
.hamburger {
    display: none;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
    font-size: 20px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
}

/* ============================================
   PAGINATION
   ============================================ */
.pagination {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 20px;
    justify-content: center;
}

.pagination a, .pagination span {
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
}

.pagination a {
    color: var(--text-secondary);
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
}

.pagination a:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
}

.pagination .active {
    background: var(--accent);
    color: #fff;
    border: 1px solid var(--accent);
}

/* ============================================
   LOADING SPINNER
   ============================================ */
.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border-glass);
    border-top: 3px solid var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ============================================
   SCROLLBAR CUSTOMIZADA
   ============================================ */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-glass-strong);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ============================================
   PAGE TITLE
   ============================================ */
.page-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 24px;
}

.page-subtitle {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: -16px;
    margin-bottom: 24px;
}

/* ============================================
   PAGE TABS
   ============================================ */
.page-tabs-card {
    overflow: hidden;
}

.page-tabs-nav {
    display: flex;
    border-bottom: 1px solid var(--border);
}

.tab-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 20px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.tab-btn:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

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

/* ============================================
   FORM HELPERS
   ============================================ */
.is-hidden {
    display: none;
}

.input-uppercase {
    text-transform: uppercase;
}

.social-label {
    display: flex;
    align-items: center;
    gap: 6px;
}

.social-label svg {
    flex-shrink: 0;
}

.section-heading-sm {
    font-size: 14px;
    font-weight: 600;
    margin: 0;
}

.section-heading-spaced {
    margin-bottom: 12px;
}

.section-description {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.loading-text {
    color: var(--text-muted);
    font-size: 13px;
}

.caption-text {
    font-size: 12px;
    color: var(--text-muted);
}

.helper-text {
    color: var(--text-muted);
    font-size: 11px;
}

.table-empty-message {
    color: var(--text-muted);
    padding: 32px 0;
}

.empty-state-illustration {
    opacity: 0.2;
}

.empty-state-title {
    color: var(--text-primary);
}

.empty-state-subtitle {
    color: var(--text-secondary);
}

.empty-state-description {
    color: var(--text-muted);
    max-width: 420px;
}

.counter-text {
    font-size: 12px;
    color: var(--text-muted);
}

.modal-content-xs {
    max-width: 420px;
}

.modal-content-sm {
    max-width: 450px;
}

.modal-content-md {
    max-width: 500px;
}

.modal-content-lg {
    max-width: 760px;
}

.btn-ghost-danger {
    color: var(--danger);
}

.btn-ghost-warning {
    color: var(--warning);
}

.section-title-icon {
    vertical-align: -3px;
    margin-right: 6px;
}

.btn-icon-leading {
    vertical-align: -2px;
    margin-right: 4px;
}

/* ============================================
   SORTABLE PHONE ROWS
   ============================================ */
.telefone-row {
    display: flex;
    flex-wrap: wrap;
    position: relative;
    gap: 8px;
    align-items: flex-end;
    margin-bottom: 8px;
    padding: 10px 12px;
    border: 1px dashed var(--border);
    border-radius: 12px;
    background: var(--bg-glass-strong);
    transition: border-color 0.16s ease, box-shadow 0.16s ease, opacity 0.16s ease;
}

.telefone-row.dragging {
    opacity: 0.55;
}

.telefone-row.drop-before,
.telefone-row.drop-after {
    background: var(--bg-hover);
}

.telefone-row .telefone-drag-handle {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: grab;
    border-radius: 8px;
}

.telefone-row .telefone-drag-handle:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.telefone-row .telefone-drag-handle:active {
    cursor: grabbing;
}

.telefone-row .input-group {
    margin-bottom: 0;
}

.telefone-row .phone-input-group {
    width: 280px;
    flex: 1 1 280px;
}

.telefone-row .telefone-label-input {
    flex: 1;
    min-width: 180px;
}

.telefone-row .btn-remove-tel {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: none;
    color: var(--danger);
    cursor: pointer;
    border-radius: 6px;
}

.telefone-row .btn-remove-tel:hover {
    background: rgba(239, 68, 68, 0.1);
}

.text-nowrap {
    white-space: nowrap;
}

.text-prewrap {
    white-space: pre-wrap;
}

.text-muted-inline {
    color: var(--text-muted);
}

.text-muted-sm {
    color: var(--text-muted);
    font-size: 13px;
}

.text-muted-xs {
    color: var(--text-muted);
    font-size: 11px;
}

.text-muted-2xs {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.text-sm {
    font-size: 0.9rem;
}

.text-xs {
    font-size: 0.8rem;
}

.badge-xs {
    font-size: 10px;
}

.action-buttons-inline {
    display: flex;
    gap: 6px;
}

.muted-dash {
    color: var(--text-muted);
}

.inline-code-pill {
    display: inline-block;
    background: var(--bg-surface-hover);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 13px;
}

.loading-state-centered {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 80px 0;
}

.error-state-centered {
    text-align: center;
    padding: 80px 0;
    color: var(--text-muted);
}

.option-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
}

.option-card-start {
    align-items: flex-start;
}

.option-card-disabled {
    opacity: 0.5;
}

.option-card-dimmed {
    opacity: 0.8;
}

.option-card-toggle {
    margin-top: 2px;
}

.option-card-body {
    font-size: 13px;
    color: var(--text-primary);
}

.option-card-meta {
    display: block;
    margin-top: 4px;
    color: var(--text-muted);
    font-size: 11px;
}

.permission-card {
    background: var(--bg-glass-strong);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    overflow: visible;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.permission-card[open] {
    border-color: rgba(214, 0, 0, 0.18);
    box-shadow: var(--shadow-glass-sm);
}

.permission-card-summary {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 15px 16px;
    cursor: pointer;
    list-style: none;
    user-select: none;
}

.permission-card-summary::-webkit-details-marker {
    display: none;
}

.permission-card-summary:hover {
    background: rgba(148, 163, 184, 0.08);
}

.permission-card-title {
    flex: 1;
    min-width: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.permission-card-summary-meta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    height: 24px;
    border-radius: 999px;
    background: var(--bg-surface-hover);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
}

.permission-card-bulk-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    cursor: pointer;
}

.permission-card-bulk-toggle .toggle-sm {
    width: 34px;
    height: 20px;
    flex: 0 0 34px;
}

.permission-card-bulk-toggle .toggle-sm .toggle-slider:before {
    width: 14px;
    height: 14px;
    left: 3px;
    bottom: 3px;
}

.permission-card-bulk-toggle .toggle-sm input:checked + .toggle-slider:before {
    transform: translateX(14px);
}

.permission-card-bulk-toggle:has(input:disabled) {
    opacity: 0.55;
    cursor: not-allowed;
}

.permission-card-chevron {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: transform 0.18s ease, color 0.18s ease;
}

.permission-card[open] .permission-card-chevron {
    transform: rotate(180deg);
    color: var(--accent);
}

.permission-card-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0 16px 16px;
    border-top: 1px solid var(--border-glass);
}

.permission-card-option {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary);
    padding: 4px 0;
}

.permission-card-option-body {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.permission-card-option-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    line-height: 1.25;
}

@media (max-width: 720px) {
    .permission-card-summary {
        flex-wrap: wrap;
    }

    .permission-card-title {
        flex-basis: calc(100% - 74px);
    }

}

.permission-help {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 17px;
    height: 17px;
    border-radius: 50%;
    border: 1px solid var(--border-glass-strong);
    background: var(--bg-surface);
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
}

.permission-help:hover,
.permission-help:focus {
    background: var(--accent-light);
    color: var(--accent);
    outline: none;
}

.permission-help::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 50%;
    bottom: calc(100% + 8px);
    z-index: 90;
    width: max-content;
    max-width: 260px;
    transform: translateX(-50%) translateY(4px);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: #111827;
    color: #ffffff;
    padding: 8px 10px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.35;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
    white-space: normal;
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.28);
}

.dark .permission-help::after {
    border-color: rgba(0, 0, 0, 0.08);
    background: #f8fafc;
    color: #111827;
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.45);
}

.permission-help:hover::after,
.permission-help:focus::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.permission-card-option-meta {
    display: inline-flex;
    width: fit-content;
    border-radius: 999px;
    padding: 2px 7px;
    font-size: 10px;
    font-weight: 700;
    line-height: 1.2;
}

.permission-card-option-meta.is-inherited {
    background: var(--success-light);
    color: var(--success);
}

.permission-card-option-meta.is-extra {
    background: var(--info-light);
    color: var(--info);
}

.permission-card-option-meta.is-blocked {
    background: var(--danger-light);
    color: var(--danger);
}

.permission-card-option-meta.is-empty {
    background: var(--bg-surface-hover);
    color: var(--text-muted);
}

.perfil-permissions-impact-alert {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    width: fit-content;
    max-width: 100%;
    border: 1px solid var(--warning-border, rgba(245, 158, 11, 0.24));
    border-radius: 14px;
    background: var(--warning-light);
    color: var(--warning);
    padding: 10px 13px;
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1.35;
}

.perfil-permissions-impact-alert svg {
    flex: 0 0 auto;
}

.permission-bulk-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.info-grid-two {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

.info-item-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.info-item-value {
    font-size: 0.9rem;
}

.section-top-divider {
    border-top: 1px solid var(--border-color);
    padding-top: 16px;
}

.section-heading-sm {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 12px;
}

.panel-surface {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    font-size: 0.85rem;
    overflow-x: auto;
}

.panel-table {
    width: 100%;
    border-collapse: collapse;
}

.panel-table-key {
    padding: 4px 8px;
    font-weight: 500;
    white-space: nowrap;
    vertical-align: top;
}

.panel-table-value {
    padding: 4px 8px;
}

.modal-content-xl {
    max-width: 700px;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
    .glass-sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-width) !important;
    }

    .glass-sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow-glass-lg);
    }

    /* No mobile, ignora estado colapsado */
    .glass-sidebar.collapsed {
        width: var(--sidebar-width) !important;
    }

    .glass-sidebar.collapsed .sidebar-logo h1,
    .glass-sidebar.collapsed .sidebar-section-title,
    .glass-sidebar.collapsed .sidebar-link span:not(.link-icon) {
        display: initial;
    }

    .glass-sidebar.collapsed .sidebar-link {
        justify-content: flex-start;
        padding: 10px 12px;
        gap: 12px;
    }

    .glass-sidebar.collapsed .sidebar-logo {
        justify-content: flex-start;
        padding: 0 24px;
    }

    .glass-sidebar.collapsed .sidebar-link::after {
        display: none;
    }

    .sidebar-toggle-btn {
        display: none;
    }

    .glass-header,
    body.sidebar-collapsed .glass-header {
        left: 0;
    }

    .tab-bar,
    body.sidebar-collapsed .tab-bar {
        left: 0;
    }

    .main-content,
    body.sidebar-collapsed .main-content {
        margin-left: 0;
    }

    .hamburger {
        display: flex;
    }

    .header-search input {
        width: 200px;
    }

    .header-search input:focus {
        width: 240px;
    }
}

@media (max-width: 640px) {
    .main-content {
        padding-left: 16px;
        padding-right: 16px;
    }

    .header-search {
        display: none;
    }

    .page-title {
        font-size: 24px;
    }
}

/* ============================================
   BACKDROP MOBILE OVERLAY
   ============================================ */
.sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 35;
}

.sidebar-backdrop.active {
    display: block;
}
