/* ═══════════════════════════════════════════════════════
   ARO Connect WEB — Design System
   ═══════════════════════════════════════════════════════ */

:root {
    --primary:        #004B87;
    --primary-light:  #0066B3;
    --primary-hover:  #387BD6;
    --primary-muted:  #E8F0F9;
    --accent:         #E69500;
    --accent-light:   #FFF3D6;
    --danger:         #DC2626;
    --danger-light:   #FEE2E2;
    --success:        #16A34A;
    --success-light:  #DCFCE7;
    --bg:             #F1F5F9;
    --surface:        #FFFFFF;
    --border:         #E2E8F0;
    --border-focus:   #004B87;
    --text:           #0F172A;
    --text-secondary: #475569;
    --text-muted:     #94A3B8;
    --radius-sm:      6px;
    --radius:         10px;
    --radius-lg:      14px;
    --shadow-sm:      0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
    --shadow:         0 4px 12px rgba(0,0,0,.08), 0 1px 4px rgba(0,0,0,.04);
    --shadow-lg:      0 12px 32px rgba(0,0,0,.14), 0 2px 8px rgba(0,0,0,.06);
    --transition:     150ms ease;
}

/* ── Reset & Base ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; scroll-behavior: smooth; }

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.5;
}

button { cursor: pointer; font-family: inherit; }
input, select { font-family: inherit; }
a { text-decoration: none; }
svg { display: block; flex-shrink: 0; }

/* ── Header ───────────────────────────────────────────── */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 40px;
    padding: 0 28px;
    height: 60px;
    background: var(--primary);
    box-shadow: 0 2px 12px rgba(0,0,0,.2);
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.logo-mark {
    background: #fff;
    color: var(--primary);
    font-weight: 800;
    font-size: .8rem;
    letter-spacing: .08em;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
}

.brand-name {
    color: #fff;
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: .01em;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 2px;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    border: none;
    background: transparent;
    color: rgba(255,255,255,.7);
    font-size: .9rem;
    font-weight: 500;
    transition: background var(--transition), color var(--transition);
}

.nav-item svg { width: 16px; height: 16px; }

.nav-item:hover:not(.disabled) {
    background: rgba(255,255,255,.12);
    color: #fff;
}

.nav-item.active {
    background: rgba(255,255,255,.18);
    color: #fff;
}

.nav-item.disabled {
    opacity: .45;
    cursor: not-allowed;
}

/* ── Header: usuário logado ───────────────────────────── */
.header-user {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
    flex-shrink: 0;
}

.header-user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 1px;
}

.header-user-empresa {
    font-size: .72rem;
    color: rgba(255,255,255,.6);
    font-weight: 500;
    letter-spacing: .02em;
    line-height: 1;
}

.header-user-nome {
    font-size: .85rem;
    color: rgba(255,255,255,.9);
    font-weight: 600;
    line-height: 1;
}

.header-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,.2);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .78rem;
    font-weight: 700;
    flex-shrink: 0;
    border: 1.5px solid rgba(255,255,255,.25);
}

.btn-header-icon {
    background: rgba(255,255,255,.1);
    border: 1px solid rgba(255,255,255,.15);
    color: rgba(255,255,255,.7);
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
    flex-shrink: 0;
}
.btn-header-icon svg { width: 15px; height: 15px; display: block; }
.btn-header-icon:hover { background: rgba(255,255,255,.2); color: #fff; }

/* manter compatibilidade — btn-logout agora é alias de btn-header-icon */
.btn-logout { /* herda de .btn-header-icon */ }

/* ── Senha Gerada (modal) ─────────────────────────────── */

.senha-desc {
    font-size: .9rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
    text-align: center;
}

.senha-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--primary-muted);
    border: 1.5px solid var(--primary-light);
    border-radius: var(--radius);
    padding: 12px 14px;
    margin-bottom: 14px;
    gap: 10px;
}

.senha-valor {
    font-family: 'Courier New', monospace;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: .12em;
    flex: 1;
}

.btn-copy-senha {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--primary);
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    transition: background var(--transition);
}
.btn-copy-senha:hover { background: rgba(0,0,0,.06); }
.btn-copy-senha svg { width: 16px; height: 16px; }

.senha-aviso {
    font-size: .8rem;
    color: var(--text-muted);
    text-align: center;
}

/* ── Alterar Senha (modal) ────────────────────────────── */

.form-field { margin-bottom: 16px; }
.form-field:last-of-type { margin-bottom: 0; }

.form-label {
    display: block;
    font-size: .8rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-bottom: 5px;
}

.form-hint {
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    color: var(--text-muted);
}

.form-input {
    width: 100%;
    padding: 10px 13px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: .92rem;
    font-family: inherit;
    color: var(--text);
    background: var(--bg);
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-muted);
    background: var(--surface);
}

.field-error {
    font-size: .83rem;
    color: var(--danger);
    margin-top: 10px;
    padding: 8px 12px;
    background: #FEE2E2;
    border-radius: var(--radius-sm);
}

/* ── Botão reset senha (tabela de usuários) ───────────── */

.btn-reset-senha {
    font-size: .75rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 3px 8px;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}
.btn-reset-senha:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-muted);
}

/* ── Main Layout ──────────────────────────────────────── */
.main { max-width: 1280px; margin: 0 auto; padding: 28px 24px 60px; }

.module { display: none; }
.module.active { display: block; }

/* ── Page Header ──────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 20px;
}

.page-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -.02em;
}

.page-subtitle {
    font-size: .9rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* ── Buttons ──────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    border: none;
    font-size: .9rem;
    font-weight: 600;
    transition: background var(--transition), box-shadow var(--transition), transform var(--transition);
    white-space: nowrap;
}

.btn:active { transform: scale(.97); }

.btn svg { width: 15px; height: 15px; }

.btn-primary {
    background: var(--primary);
    color: #fff;
}
.btn-primary:hover { background: var(--primary-light); box-shadow: 0 4px 12px rgba(0,75,135,.35); }

.btn-secondary {
    background: var(--primary-muted);
    color: var(--primary);
}
.btn-secondary:hover { background: #d3e4f5; }

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #B91C1C; }

/* ── Filters Card ─────────────────────────────────────── */
.filters-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    padding: 16px 18px;
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.search-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.search-wrap {
    position: relative;
    flex: 1;
}

.search-icon {
    position: absolute;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    width: 17px;
    height: 17px;
    color: var(--text-muted);
    pointer-events: none;
}

#search-input {
    width: 100%;
    padding: 9px 36px 9px 36px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: .9rem;
    color: var(--text);
    background: var(--bg);
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}

#search-input:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(0,75,135,.12);
    background: var(--surface);
}

.search-clear {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: .85rem;
    line-height: 1;
    padding: 2px 4px;
    border-radius: 4px;
    transition: color var(--transition), background var(--transition);
}

.search-clear:hover { color: var(--text); background: var(--border); }

.filial-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-label {
    font-size: .8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-right: 2px;
}

.chip-check { display: inline-flex; align-items: center; gap: 0; cursor: pointer; }

.chip-check input { display: none; }

.chip-check span {
    display: inline-block;
    padding: 4px 13px;
    border-radius: 20px;
    border: 1.5px solid var(--border);
    font-size: .82rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--surface);
    transition: all var(--transition);
    user-select: none;
}

.chip-check input:checked + span {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.chip-check:hover span { border-color: var(--primary-hover); color: var(--primary); }
.chip-check input:checked + span:hover { background: var(--primary-light); }

/* ── Department Filters ───────────────────────────────── */
.dept-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding-top: 2px;
}

.dept-row .filter-label {
    padding-top: 5px;
    flex-shrink: 0;
}

.dept-filters {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    flex: 1;
}

.dept-btn {
    padding: 4px 13px;
    border-radius: 20px;
    border: 1.5px solid var(--border);
    background: var(--surface);
    color: var(--text-secondary);
    font-size: .8rem;
    font-weight: 500;
    transition: all var(--transition);
    white-space: nowrap;
    line-height: 1.6;
}

.dept-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-muted);
}

.dept-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(0,75,135,.3);
}

/* ── Bulk Action Bar ──────────────────────────────────── */
.bulk-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 16px;
    margin-bottom: 12px;
    background: var(--primary-muted);
    border: 1.5px solid var(--primary);
    border-radius: var(--radius);
    animation: fadeIn .2s ease;
}

.bulk-bar-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .88rem;
    font-weight: 600;
    color: var(--primary);
}

.bulk-bar-info svg { width: 16px; height: 16px; flex-shrink: 0; }

.bulk-bar-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.bulk-bar-actions .btn {
    padding: 6px 14px;
    font-size: .83rem;
}

/* ── Table Card ───────────────────────────────────────── */
.table-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    overflow: hidden;
}

.table-toolbar {
    padding: 12px 18px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.counter-text {
    font-size: .82rem;
    color: var(--text-muted);
    font-weight: 500;
}

.table-scroll { overflow-x: auto; }

#contacts-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .88rem;
}

#contacts-table thead th {
    background: var(--primary);
    color: rgba(255,255,255,.9);
    font-weight: 600;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    padding: 11px 14px;
    text-align: left;
    white-space: nowrap;
    user-select: none;
}

#contacts-table thead th[data-sort] { cursor: pointer; }
#contacts-table thead th[data-sort]:hover { background: var(--primary-light); }

.sort-icon { display: inline-block; width: 12px; height: 12px; margin-left: 4px; vertical-align: middle; opacity: .5; }

.col-nome   { min-width: 180px; }
.col-ramal  { width: 90px; }
.col-email  { min-width: 220px; }
.col-depto  { min-width: 150px; }
.col-filial { width: 110px; }
.col-acoes  { width: 120px; text-align: right !important; padding-right: 18px !important; }

#contacts-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background var(--transition);
    cursor: pointer;
}

#contacts-table tbody tr:last-child { border-bottom: none; }
#contacts-table tbody tr:hover { background: #F8FAFC; }

#contacts-table tbody td {
    padding: 11px 14px;
    color: var(--text);
    vertical-align: middle;
}

.td-nome { font-weight: 600; }

.ramal-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 20px;
    border: 1.5px solid var(--border);
    background: var(--surface);
    color: var(--primary);
    font-size: .82rem;
    font-weight: 600;
    transition: all var(--transition);
    text-decoration: none;
}

.ramal-btn svg { width: 12px; height: 12px; }
.ramal-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

/* align ramal button under RAMAL column header */
#contacts-table td:nth-child(2) { padding-left: 6px; }

.email-cell {
    display: flex;
    align-items: center;
    gap: 6px;
}

.email-text {
    color: var(--text-secondary);
    font-size: .85rem;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.copy-btn {
    flex-shrink: 0;
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 3px;
    border-radius: 4px;
    transition: color var(--transition), background var(--transition);
    line-height: 0;
}

.copy-btn svg { width: 14px; height: 14px; }
.copy-btn:hover { color: var(--primary); background: var(--primary-muted); }

.filial-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: .75rem;
    font-weight: 600;
    background: var(--primary-muted);
    color: var(--primary);
}

.actions-cell {
    text-align: right;
    display: flex;
    justify-content: flex-end;
    gap: 4px;
}

.icon-btn {
    background: none;
    border: none;
    padding: 6px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    transition: color var(--transition), background var(--transition);
    line-height: 0;
}

.icon-btn svg { width: 15px; height: 15px; }
.icon-btn:hover { background: var(--bg); }
.icon-btn.edit:hover { color: var(--primary); }
.icon-btn.delete:hover   { color: var(--danger); background: var(--danger-light); }
.icon-btn.approve:hover  { color: #15803D; background: #DCFCE7; }
.icon-btn.reject:hover   { color: var(--danger); background: var(--danger-light); }

/* ── Table States ─────────────────────────────────────── */
.loading-row td {
    padding: 48px;
    text-align: center;
}

.spinner {
    display: inline-block;
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin .7s linear infinite;
    margin: 0 auto;
}

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

.table-empty {
    padding: 64px 24px;
    text-align: center;
    color: var(--text-muted);
}

.table-empty svg { width: 40px; height: 40px; margin: 0 auto 12px; opacity: .4; }
.table-empty p { font-size: .95rem; }

.hidden { display: none !important; }

/* ── Modal ────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,.5);
    backdrop-filter: blur(4px);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn .15s ease;
}

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

.modal {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 540px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: slideUp .2s ease;
}

.modal-sm { max-width: 440px; }
.modal-xs { max-width: 360px; }

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

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

.modal-header h2 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
}

.modal-header-danger { border-bottom-color: var(--danger-light); }
.modal-header-danger h2 { color: var(--danger); }

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: color var(--transition), background var(--transition);
    line-height: 0;
}

.modal-close svg { width: 18px; height: 18px; }
.modal-close:hover { color: var(--text); background: var(--bg); }

.modal-body {
    padding: 20px 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 14px 24px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ── Form ─────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 5px; margin-bottom: 16px; }
.form-group:last-child { margin-bottom: 0; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

label {
    font-size: .82rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: .05em;
}

.required { color: var(--danger); }

input[type="text"],
input[type="email"],
select {
    padding: 9px 12px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: .9rem;
    color: var(--text);
    background: var(--surface);
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
    width: 100%;
}

input[type="text"]:focus,
input[type="email"]:focus,
select:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(0,75,135,.12);
}

input.error, select.error { border-color: var(--danger); }

.field-error {
    font-size: .78rem;
    color: var(--danger);
    min-height: 16px;
}

/* ── Contact Detail Card ──────────────────────────────── */
.contact-card {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.contact-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    font-weight: 700;
    flex-shrink: 0;
}

.contact-info { flex: 1; min-width: 0; }
.contact-info h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 6px; }

.dept-badge {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 20px;
    background: var(--primary-muted);
    color: var(--primary);
    font-size: .78rem;
    font-weight: 600;
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.detail-item { display: flex; flex-direction: column; gap: 4px; }
.detail-item-full { grid-column: 1 / -1; }

.detail-label {
    font-size: .75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .06em;
}

.detail-value {
    font-size: .95rem;
    font-weight: 500;
    color: var(--text);
    word-break: break-all;
}

/* ── Delete Modal ─────────────────────────────────────── */
.delete-msg { font-size: .95rem; margin-bottom: 8px; }
.delete-warn { font-size: .83rem; color: var(--text-muted); }

/* ── Toast ────────────────────────────────────────────── */
.toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(0);
    background: var(--text);
    color: #fff;
    padding: 12px 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    font-size: .88rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 500;
    white-space: nowrap;
    animation: toastIn .25s ease;
}

@keyframes toastIn {
    from { transform: translateX(-50%) translateY(20px); opacity: 0; }
    to   { transform: translateX(-50%) translateY(0);    opacity: 1; }
}

.toast.success { background: var(--success); }
.toast.error   { background: var(--danger); }
.toast.info    { background: var(--primary); }

.toast-icon { width: 16px; height: 16px; }

/* ── Coming Soon ──────────────────────────────────────── */
.coming-soon {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 50vh;
    color: var(--text-muted);
    text-align: center;
    gap: 12px;
}

.coming-soon svg { width: 56px; height: 56px; opacity: .3; }
.coming-soon h2  { font-size: 1.4rem; font-weight: 700; color: var(--text-secondary); }
.coming-soon p   { font-size: .95rem; }

/* ── Config Layout ────────────────────────────────────── */
.config-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 20px;
    align-items: start;
}

.config-sidebar {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    position: sticky;
    top: 76px;
}

.config-tab {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    font-size: .88rem;
    font-weight: 500;
    text-align: left;
    transition: background var(--transition), color var(--transition);
    width: 100%;
}

.config-tab svg { width: 16px; height: 16px; flex-shrink: 0; }
.config-tab:hover  { background: var(--bg); color: var(--text); }
.config-tab.active { background: var(--primary-muted); color: var(--primary); font-weight: 600; }

.config-body { min-width: 0; }

.config-panel { display: none; }
.config-panel.active { display: block; }

.panel-header {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.panel-header h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}

.panel-header p { font-size: .85rem; color: var(--text-secondary); }

.panel-footer {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
}

/* ── Theme Swatches ───────────────────────────────────── */
.theme-grid {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.theme-swatch {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text-secondary);
    font-size: .82rem;
    font-weight: 500;
    transition: all var(--transition);
    min-width: 80px;
}

.theme-swatch:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow); }
.theme-swatch.active { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-muted); }

.swatch-color {
    display: block;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0,0,0,.2);
}

.swatch-label { font-size: .8rem; color: var(--text-secondary); }

/* ── Custom Color ─────────────────────────────────────── */
.panel-divider {
    height: 1px;
    background: var(--border);
    margin: 20px 0 16px;
}

.custom-color-title {
    font-size: .88rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-bottom: 4px;
}

.custom-color-hint {
    font-size: .8rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.custom-color-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

#color-picker {
    width: 44px;
    height: 40px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 2px;
    background: var(--surface);
    cursor: pointer;
    flex-shrink: 0;
}

#color-picker::-webkit-color-swatch-wrapper { padding: 0; }
#color-picker::-webkit-color-swatch { border: none; border-radius: 4px; }
#color-picker::-moz-color-swatch { border: none; border-radius: 4px; }

#color-hex {
    width: 110px;
    flex-shrink: 0;
    font-family: monospace;
    font-size: .9rem;
    letter-spacing: .04em;
}

.bulk-change-desc {
    font-size: .9rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
    line-height: 1.5;
}

/* ── Config List (Deptos / Filiais) ───────────────────── */
.add-row {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.add-row input { flex: 1; }

.add-row-wide {
    display: grid;
    grid-template-columns: 1fr 1fr auto auto;
    gap: 8px;
    align-items: center;
}

.config-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.config-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: .9rem;
    color: var(--text);
    transition: background var(--transition);
}

.config-list-item:hover { background: var(--primary-muted); }
.config-list-item span  { font-weight: 500; }

/* ── Config Table (Usuários) ──────────────────────────── */
.config-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .88rem;
    margin-top: 4px;
}

.config-table thead th {
    background: var(--primary);
    color: rgba(255,255,255,.9);
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    padding: 10px 14px;
    text-align: left;
}

.config-table tbody tr { border-bottom: 1px solid var(--border); }
.config-table tbody tr:last-child { border-bottom: none; }
.config-table tbody tr:hover { background: #F8FAFC; }
.config-table tbody td { padding: 10px 14px; color: var(--text); vertical-align: middle; }

.nivel-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: .75rem;
    font-weight: 600;
}

.nivel-admin   { background: #FEF3C7; color: #92400E; }
.nivel-recep   { background: var(--primary-muted); color: var(--primary); }
.nivel-usuario { background: var(--success-light); color: var(--success); }

/* ── Toggle Switch ────────────────────────────────────── */
.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 20px;
}

.toggle-info { flex: 1; }
.toggle-info strong { display: block; font-size: .95rem; margin-bottom: 2px; }
.toggle-info span   { font-size: .82rem; color: var(--text-secondary); }

.toggle { position: relative; display: inline-block; width: 46px; height: 26px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }

.toggle-track {
    position: absolute;
    inset: 0;
    background: var(--border);
    border-radius: 13px;
    cursor: pointer;
    transition: background var(--transition);
}

.toggle-thumb {
    position: absolute;
    width: 20px;
    height: 20px;
    left: 3px;
    top: 3px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,.2);
    transition: transform var(--transition);
}

.toggle input:checked ~ .toggle-track { background: var(--primary); }
.toggle input:checked ~ .toggle-track .toggle-thumb { transform: translateX(20px); }

.config-fields { margin-top: 4px; }

/* ── Language Grid ────────────────────────────────────── */
.lang-grid {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.lang-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 18px 28px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text-secondary);
    transition: all var(--transition);
    min-width: 110px;
}

.lang-btn:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow); }
.lang-btn.active { border-color: var(--primary); background: var(--primary-muted); box-shadow: 0 0 0 3px var(--primary-muted); }

.lang-code   { font-size: 1.3rem; font-weight: 800; color: var(--primary); letter-spacing: .05em; }
.lang-name   { font-size: .9rem; font-weight: 600; color: var(--text); }
.lang-region { font-size: .75rem; color: var(--text-muted); }

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 860px) {
    .config-layout { grid-template-columns: 1fr; }
    .config-sidebar { flex-direction: row; flex-wrap: wrap; position: static; }
    .config-tab { width: auto; flex: 1; min-width: 80px; justify-content: center; }
    .config-tab svg { display: none; }
}

@media (max-width: 700px) {
    .main { padding: 16px 12px 40px; }
    .page-header { flex-direction: column; align-items: stretch; gap: 12px; }
    .form-row { grid-template-columns: 1fr; }
    .header { padding: 0 16px; gap: 16px; }
    .brand-name { display: none; }
    .nav-item span { display: none; }
    .col-email, .col-depto { display: none; }
    .add-row-wide { grid-template-columns: 1fr 1fr; }
}

/* ── Page Eyebrow ─────────────────────────────────────── */
.page-eyebrow {
    font-size: .68rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .12em;
    margin-bottom: 4px;
}

/* ── Stats Row ────────────────────────────────────────── */
.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 16px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
}

.stat-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon svg { width: 20px; height: 20px; }

.stat-icon-contacts { background: var(--primary-muted); color: var(--primary); }
.stat-icon-deptos   { background: #EDE9FE; color: #5B21B6; }
.stat-icon-filiais  { background: #DCFCE7; color: #16A34A; }
.stat-icon-microsip { background: #FEF9C3; color: #CA8A04; }

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

.stat-label {
    font-size: .66rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .1em;
    margin-bottom: 3px;
}

.stat-value {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text);
    line-height: 1.1;
}

.stat-status {
    display: flex !important;
    align-items: center;
    gap: 7px;
    font-size: .92rem !important;
    font-weight: 600 !important;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    display: inline-block;
}

.status-dot.active   { background: var(--success); }
.status-dot.inactive { background: var(--text-muted); }

/* ── Filter count badge ───────────────────────────────── */
.filter-count {
    font-weight: 500;
    font-size: .75rem;
    opacity: .7;
    font-style: normal;
}

.dept-btn-more {
    border-style: dashed;
    color: var(--text-muted);
    font-weight: 500;
}
.dept-btn-more:hover { border-style: solid; }

/* ── Avatar in table (small) ──────────────────────────── */
.td-nome-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.avatar-sm {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .68rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    letter-spacing: .02em;
}

/* ── Dept badge colored ───────────────────────────────── */
.dept-badge-colored {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: .75rem;
    font-weight: 600;
}

/* ── Ramal button disabled (MicroSIP off) ─────────────── */
.ramal-btn-disabled {
    cursor: default;
    color: var(--text-secondary, #6b7280);
    border-color: var(--border);
    background: var(--bg, #f3f4f6);
    pointer-events: none;
}

/* ── Search keyboard hint ─────────────────────────────── */
.search-kbd {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    gap: 2px;
    pointer-events: none;
}

.kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: .66rem;
    font-weight: 600;
    color: var(--text-muted);
    padding: 1px 5px;
    line-height: 1.6;
    font-family: inherit;
}

/* ── Table toolbar right side ─────────────────────────── */
.toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-sm {
    padding: 5px 12px !important;
    font-size: .8rem !important;
}


/* ── Stats responsive ─────────────────────────────────── */
@media (max-width: 900px) {
    .stats-row { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 500px) {
    .stats-row { grid-template-columns: 1fr 1fr; }
    .stat-value { font-size: 1.3rem; }
}

/* ══════════════════════════════════════════════════════════
   MÓDULO REUNIÕES
   ══════════════════════════════════════════════════════════ */

/* ── Banner de aviso de fim de reunião ───────────────────── */
.meeting-end-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    margin-bottom: 20px;
    background: #FFFBEB;
    border: 1.5px solid var(--accent);
    border-radius: var(--radius);
    box-shadow: 0 2px 8px rgba(230,149,0,.15);
    animation: bannerIn .3s ease;
}

@keyframes bannerIn {
    from { transform: translateY(-8px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

.meeting-end-banner-icon {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: var(--accent-light);
    color: var(--accent);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.meeting-end-banner-icon svg { width: 20px; height: 20px; }

.meeting-end-banner-body {
    flex: 1; display: flex; flex-direction: column; gap: 2px;
}
.meeting-end-banner-body strong { font-size: .88rem; font-weight: 700; color: #92400E; }
.meeting-end-banner-body span   { font-size: .85rem; color: var(--text-secondary); }

.meeting-end-banner-close {
    background: none; border: none; color: var(--text-muted);
    padding: 4px; border-radius: var(--radius-sm); cursor: pointer;
    line-height: 0; flex-shrink: 0; transition: color var(--transition), background var(--transition);
}
.meeting-end-banner-close svg { width: 16px; height: 16px; }
.meeting-end-banner-close:hover { color: var(--text); background: rgba(0,0,0,.06); }

/* ── Meeting Alert Modal ─────────────────────────────────── */
.meeting-alert-overlay { z-index: 500; }

.meeting-alert-modal {
    animation: slideUp .2s ease, alertPulse 2s ease-in-out .5s infinite;
}

@keyframes alertPulse {
    0%, 100% { box-shadow: var(--shadow-lg); }
    50%       { box-shadow: 0 0 0 8px rgba(230,149,0,.22), var(--shadow-lg); }
}

.meeting-alert-header {
    background: #FFFBEB;
    border-bottom-color: var(--accent) !important;
    gap: 12px;
}

.meeting-alert-header h2 { color: #92400E; }

.meeting-alert-icon {
    width: 44px; height: 44px;
    border-radius: 50%;
    background: var(--accent-light);
    color: var(--accent);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    animation: bellRing 1.4s ease-in-out infinite;
}

@keyframes bellRing {
    0%, 60%, 100% { transform: rotate(0deg); }
    10%  { transform: rotate(-18deg); }
    25%  { transform: rotate(18deg); }
    40%  { transform: rotate(-10deg); }
    50%  { transform: rotate(10deg); }
}

.meeting-alert-icon svg { width: 22px; height: 22px; }

.meeting-alert-body p {
    font-size: 1rem;
    color: var(--text);
    line-height: 1.6;
    margin: 0;
}

/* ── Controles de reunião ─────────────────────────────────── */
.reunioes-controls {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; margin-bottom: 16px; flex-wrap: wrap;
}

.date-nav-row { display: flex; align-items: center; gap: 6px; }

.btn-date-nav {
    width: 32px; height: 32px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text-secondary);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: all var(--transition); flex-shrink: 0;
}
.btn-date-nav svg { width: 16px; height: 16px; }
.btn-date-nav:hover { background: var(--primary-muted); color: var(--primary); border-color: var(--primary); }

.date-input {
    padding: 6px 10px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: .9rem; font-family: inherit;
    color: var(--text); background: var(--surface);
    outline: none; cursor: pointer;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.date-input:focus { border-color: var(--border-focus); box-shadow: 0 0 0 3px var(--primary-muted); }

.reunioes-filters-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.filter-select {
    padding: 7px 10px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: .88rem; font-family: inherit;
    color: var(--text); background: var(--surface);
    outline: none; cursor: pointer; min-width: 160px;
    transition: border-color var(--transition);
}
.filter-select:focus { border-color: var(--border-focus); box-shadow: 0 0 0 3px var(--primary-muted); }

/* ── Tabela reuniões + carros ─────────────────────────────── */
#reunioes-table,
#carros-table   { width: 100%; border-collapse: collapse; font-size: .88rem; }

#reunioes-table thead th,
#carros-table   thead th {
    background: var(--primary); color: rgba(255,255,255,.9);
    font-weight: 600; font-size: .78rem;
    text-transform: uppercase; letter-spacing: .06em;
    padding: 11px 14px; text-align: left; white-space: nowrap;
}

#reunioes-table tbody tr,
#carros-table   tbody tr { border-bottom: 1px solid var(--border); transition: background var(--transition); }
#reunioes-table tbody tr:last-child,
#carros-table   tbody tr:last-child { border-bottom: none; }
#reunioes-table tbody tr:hover,
#carros-table   tbody tr:hover { background: #F8FAFC; }
#reunioes-table tbody td,
#carros-table   tbody td { padding: 11px 14px; color: var(--text); vertical-align: middle; }

.col-reun-sala   { min-width: 140px; }
.col-reun-titulo { min-width: 160px; }
.col-reun-resp   { min-width: 140px; }
.col-reun-inicio { width: 80px;  text-align: center !important; }
.col-reun-fim    { width: 80px;  text-align: center !important; }
.col-reun-status { width: 120px; text-align: center !important; }
.col-reun-acoes  { width: 80px;  text-align: center !important; padding-right: 14px !important; }

.reun-sala-filial { font-size: .75rem; font-weight: 500; color: var(--text-muted); display: block; margin-top: 1px; }
.reun-sala-nome   { font-weight: 600; font-size: .88rem; }

.reun-titulo-text  { font-weight: 500; }
.reun-titulo-empty { color: var(--text-muted); font-style: italic; font-size: .84rem; }

.reun-resp { display: flex; align-items: center; gap: 7px; }
.reun-resp-avatar {
    width: 24px; height: 24px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: .6rem; font-weight: 700; color: #fff; flex-shrink: 0;
}
.reun-resp-nome { font-size: .85rem; color: var(--text-secondary); }

.reun-time { display: inline-block; font-size: .88rem; font-weight: 600; color: var(--text); white-space: nowrap; }

.reun-status {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 9px; border-radius: 20px;
    font-size: .75rem; font-weight: 600; white-space: nowrap;
}
.reun-status-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.reun-status.em-andamento { background: #DCFCE7; color: #15803D; }
.reun-status.em-andamento .reun-status-dot { background: #16A34A; }
.reun-status.agendada     { background: var(--primary-muted); color: var(--primary); }
.reun-status.agendada     .reun-status-dot { background: var(--primary); }
.reun-status.concluida    { background: var(--bg); color: var(--text-muted); }
.reun-status.concluida    .reun-status-dot { background: var(--text-muted); }
.reun-status.pendente     { background: #FFFBEB; color: #92400E; }
.reun-status.pendente     .reun-status-dot { background: #D97706; }

/* ── No salas state ───────────────────────────────────────── */
.no-salas {
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; min-height: 40vh;
    color: var(--text-muted); text-align: center; gap: 12px;
}
.no-salas svg { width: 52px; height: 52px; opacity: .3; }
.no-salas p   { font-size: .95rem; max-width: 380px; line-height: 1.6; }

/* ── Config: Salas form ───────────────────────────────────── */
.add-sala-form { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.add-sala-row  { display: flex; gap: 8px; align-items: center; }
.add-sala-row input, .add-sala-row select { flex: 1; }

/* ── Config: Usuários — add form ─────────────────────────── */
.add-usuario-form { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }

/* ── Responsive reuniões ──────────────────────────────────── */
@media (max-width: 700px) {
    .reunioes-controls { flex-direction: column; align-items: stretch; }
    .reunioes-filters-right { justify-content: flex-start; }
    .col-reun-resp, .col-reun-titulo { display: none; }
}

/* ── Barra de notificações persistentes ───────────────────── */
.notif-bar {
    position: sticky;
    top: 60px;
    z-index: 99;
    display: flex;
    flex-direction: column;
}

.notif-bar.hidden { display: none; }

.notif-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 28px;
    font-size: .875rem;
    font-weight: 500;
    animation: notifSlideDown .2s ease;
}

@keyframes notifSlideDown {
    from { transform: translateY(-100%); opacity: 0; }
    to   { transform: translateY(0);     opacity: 1; }
}

.notif-item.notif-warning {
    background: #FEF3C7;
    color: #78350F;
    border-bottom: 1px solid #F59E0B;
}

.notif-item.notif-success {
    background: #D1FAE5;
    color: #065F46;
    border-bottom: 1px solid #6EE7B7;
}

.notif-item.notif-info {
    background: var(--primary-muted);
    color: var(--primary);
    border-bottom: 1px solid var(--border);
}

.notif-icon {
    width: 18px; height: 18px;
    flex-shrink: 0;
    opacity: .85;
}

.notif-msg { flex: 1; line-height: 1.4; }

.notif-ok {
    background: none;
    border: 1.5px solid currentColor;
    color: inherit;
    font-size: .78rem;
    font-weight: 600;
    padding: 3px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    opacity: .75;
    transition: opacity var(--transition), background var(--transition);
    flex-shrink: 0;
    font-family: inherit;
}
.notif-ok:hover { opacity: 1; background: rgba(0,0,0,.06); }
