/* Virtual SAU — app.css */
/* ── Tokens & auth ── */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-soft: #eff6ff;
    --primary-ring: rgba(37,99,235,.12);
    --accent: #0ea5e9;
    --success: #10b981;
    --success-soft: #ecfdf5;
    --warning: #f59e0b;
    --warning-soft: #fffbeb;
    --danger: #ef4444;
    --danger-soft: #fef2f2;
    --purple: #8b5cf6;
    --purple-soft: #f5f3ff;
    --bg: #f4f6f9;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --surface-3: #f1f5f9;
    --border: #e5e7eb;
    --border-light: #f3f4f6;
    --text: #111827;
    --text-secondary: #374151;
    --text-muted: #6b7280;
    --sidebar-bg: #ffffff;
    --sidebar-border: #e5e7eb;
    --sidebar-hover: #f3f4f6;
    --sidebar-active: #eff6ff;
    --sidebar-active-text: #2563eb;
    --topbar-bg: rgba(255,255,255,.92);
    --table-row-hover: #fafbfc;
    --input-hover-border: #d1d5db;
    --input-bg: #ffffff;
    --elevated: #ffffff;
    --glow: transparent;
    --chip-icon-bg: var(--surface-2);
    --hover-border: rgba(37,99,235,.25);
    --sidebar-width: 260px;
    --topbar-height: 68px;
    --radius-xl: 20px;
    --radius-lg: 16px;
    --radius: 14px;
    --radius-md: 12px;
    --radius-sm: 10px;
    --radius-xs: 8px;
    --shadow-xs: 0 1px 2px rgba(17,24,39,.04);
    --shadow: 0 1px 3px rgba(17,24,39,.06), 0 4px 16px rgba(17,24,39,.04);
    --shadow-md: 0 4px 20px rgba(17,24,39,.07);
    --shadow-lg: 0 12px 40px rgba(17,24,39,.1);
    --transition: .2s cubic-bezier(.4,0,.2,1);
}

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

html { scroll-behavior: smooth; }

body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.55;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    transition: background-color .3s ease, color .2s ease;
}

a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-dark); }

/* ── Auth ── */
.auth-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: linear-gradient(145deg, #0f172a 0%, #1e3a5f 50%, #0c4a6e 100%);
    position: relative;
    overflow: hidden;
}

.auth-page::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 70% 50% at 15% 20%, rgba(37,99,235,.3), transparent),
        radial-gradient(ellipse 50% 40% at 85% 75%, rgba(14,165,233,.2), transparent);
}

.login-wrapper { width: 100%; max-width: 440px; padding: 1.5rem; position: relative; z-index: 1; }

.login-card {
    background: var(--surface);
    border-radius: var(--radius-xl);
    padding: 2.75rem 2.5rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255,255,255,.15);
}

.login-header { text-align: center; margin-bottom: 2rem; }
.login-header h1 { font-size: 1.6rem; font-weight: 700; margin-top: 1rem; letter-spacing: -.03em; }
.login-header p { color: var(--text-muted); font-size: .9rem; margin-top: .35rem; }
.login-footer {
    text-align: center;
    margin-top: 1.75rem;
    display: flex;
    flex-direction: column;
    gap: .4rem;
    color: var(--text-muted);
    font-size: .8rem;
}
.demo-hint {
    display: inline-block;
    margin-top: .5rem;
    padding: .4rem .9rem;
    background: var(--primary-soft);
    color: var(--primary-dark);
    border-radius: var(--radius-full, 999px);
    font-weight: 600;
    font-size: .75rem;
}

.brand-icon {
    width: 44px; height: 44px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; color: #fff; font-size: .78rem;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(37,99,235,.3);
}
.brand-icon.large { width: 60px; height: 60px; font-size: .9rem; margin: 0 auto; border-radius: var(--radius-lg); }

/* ── Layout ── */
/* ── App shell ── */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 200;
    transition: transform .3s ease, background-color .3s ease, border-color .3s ease, box-shadow .3s ease;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: .85rem;
    padding: 1.35rem 1.15rem;
    border-bottom: 1px solid var(--border-light);
}
.sidebar-brand strong { display: block; font-size: .95rem; color: var(--text); font-weight: 700; letter-spacing: -.02em; }
.sidebar-brand small { color: var(--text-muted); font-size: .7rem; }

.sidebar-nav { flex: 1; padding: .85rem .75rem; overflow-y: auto; }

.nav-section {
    font-size: .62rem;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--text-muted);
    padding: 1.1rem .85rem .4rem;
    font-weight: 700;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .6rem .85rem;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: .855rem;
    font-weight: 500;
    margin-bottom: 3px;
    transition: all var(--transition);
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; color: var(--text-muted); transition: color var(--transition); }
.nav-item:hover { background: var(--sidebar-hover); color: var(--text); text-decoration: none; }
.nav-item:hover svg { color: var(--text-secondary); }
.nav-item.active {
    background: var(--sidebar-active);
    color: var(--sidebar-active-text);
    font-weight: 600;
    box-shadow: inset 0 0 0 1px var(--primary-ring);
}
.nav-item.active svg { color: var(--sidebar-active-text); }

.nav-group { margin-bottom: 3px; }

.nav-group-toggle {
    display: flex;
    align-items: center;
    gap: .7rem;
    width: 100%;
    padding: .6rem .85rem;
    border: none;
    background: transparent;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: .855rem;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    transition: all var(--transition);
}

.nav-group-toggle svg:first-child {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    color: var(--text-muted);
    transition: color var(--transition);
}

.nav-group-toggle:hover {
    background: var(--sidebar-hover);
    color: var(--text);
}

.nav-group-toggle:hover svg:first-child { color: var(--text-secondary); }

.nav-group-toggle.active {
    background: var(--sidebar-active);
    color: var(--sidebar-active-text);
    font-weight: 600;
}

.nav-group-toggle.active svg:first-child { color: var(--sidebar-active-text); }

.nav-group-chevron {
    width: 14px;
    height: 14px;
    margin-left: auto;
    color: var(--text-muted);
    transition: transform var(--transition);
}

.nav-group.open .nav-group-chevron { transform: rotate(180deg); }

.nav-subitems {
    display: none;
    padding: .15rem 0 .25rem .35rem;
}

.nav-group.open .nav-subitems { display: block; }

.nav-subitem {
    display: block;
    padding: .42rem .85rem .42rem 2.35rem;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-size: .82rem;
    font-weight: 500;
    margin-bottom: 2px;
    transition: all var(--transition);
}

.nav-subitem:hover {
    background: var(--sidebar-hover);
    color: var(--text);
    text-decoration: none;
}

.nav-subitem.active {
    background: var(--sidebar-active);
    color: var(--sidebar-active-text);
    font-weight: 600;
}

.nav-badge {
    margin-left: auto;
    background: var(--danger);
    color: #fff;
    font-size: .62rem;
    font-weight: 700;
    padding: .15rem .5rem;
    border-radius: var(--radius-full, 999px);
    min-width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 1rem 1.15rem;
    border-top: 1px solid var(--border-light);
    font-size: .7rem;
    color: var(--text-muted);
    text-align: center;
}

.main-area {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-width: 0;
}

.topbar {
    background: var(--topbar-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    padding: 0 2rem;
    height: var(--topbar-height);
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
    transition: background-color .3s ease, border-color .3s ease;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 0;
}

.topbar-center {
    justify-self: center;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: .65rem;
    flex-shrink: 0;
    justify-self: end;
}

.menu-toggle {
    display: none;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    width: 38px; height: 38px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all var(--transition);
}
.menu-toggle:hover { background: var(--surface-2); }

.page-title { font-size: 1rem; font-weight: 600; flex: 0 1 auto; letter-spacing: -.01em; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.topbar-meta { font-size: .78rem; color: var(--text-muted); font-weight: 500; }

.topbar-search {
    flex: 0 1 380px;
    width: min(380px, 42vw);
    max-width: 380px;
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .4rem .7rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xs);
    transition: all var(--transition);
}

.topbar-search:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-ring);
}

.topbar-search svg { width: 16px; height: 16px; color: var(--text-muted); flex-shrink: 0; }

.topbar-search input {
    flex: 1;
    min-width: 0;
    border: none;
    outline: none;
    background: transparent;
    font: inherit;
    font-size: .85rem;
    color: var(--text);
}

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

.icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    box-shadow: var(--shadow-xs);
    flex-shrink: 0;
}

.icon-btn:hover {
    background: var(--surface-2);
    color: var(--text);
    border-color: var(--input-hover-border);
}

.icon-btn svg { width: 18px; height: 18px; }

/* ── Notificações ── */
.notif-menu { position: relative; }

.notif-btn { position: relative; }

.notif-btn.has-notif {
    border-color: color-mix(in srgb, var(--primary) 35%, var(--border));
    color: var(--primary);
}

.notif-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--danger);
    color: #fff;
    font-size: .6rem;
    font-weight: 700;
    line-height: 17px;
    text-align: center;
    border: 2px solid var(--elevated);
    pointer-events: none;
}

.notif-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: min(360px, calc(100vw - 2rem));
    background: var(--elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    z-index: 1100;
    animation: notifDropIn .18s ease;
}

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

.notif-dropdown-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .85rem 1rem;
    border-bottom: 1px solid var(--border-light);
    background: var(--surface-2);
}

.notif-dropdown-header strong {
    font-size: .82rem;
    font-weight: 700;
    letter-spacing: -.01em;
}

.notif-mark-all {
    border: 0;
    background: transparent;
    color: var(--primary);
    font-size: .72rem;
    font-weight: 600;
    cursor: pointer;
    padding: .2rem .35rem;
    border-radius: var(--radius-xs);
    font-family: inherit;
}

.notif-mark-all:hover {
    background: var(--primary-soft);
}

.notif-list {
    max-height: 380px;
    overflow-y: auto;
}

.notif-item {
    display: flex;
    align-items: flex-start;
    gap: .65rem;
    padding: .8rem 1rem;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid var(--border-light);
    transition: background var(--transition);
}

.notif-item:last-child { border-bottom: 0; }

.notif-item:hover {
    background: var(--surface-2);
    text-decoration: none;
}

.notif-item.is-unread {
    background: color-mix(in srgb, var(--primary) 5%, transparent);
}

.notif-item.is-unread:hover {
    background: color-mix(in srgb, var(--primary) 9%, transparent);
}

.notif-item-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-top: .45rem;
    flex-shrink: 0;
    background: transparent;
}

.notif-item.is-unread .notif-item-dot {
    background: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

.notif-item-body {
    display: flex;
    flex-direction: column;
    gap: .3rem;
    min-width: 0;
}

.notif-item-text {
    font-size: .82rem;
    font-weight: 500;
    line-height: 1.45;
    color: var(--text);
}

.notif-item.is-read .notif-item-text {
    color: var(--text-secondary);
    font-weight: 400;
}

.notif-item-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .35rem .55rem;
    font-size: .68rem;
    color: var(--text-muted);
}

.notif-item-tag {
    display: inline-flex;
    padding: .1rem .4rem;
    border-radius: var(--radius-full, 999px);
    background: var(--surface-2);
    border: 1px solid var(--border-light);
    font-weight: 600;
    letter-spacing: .02em;
    text-transform: uppercase;
    font-size: .58rem;
}

.notif-empty {
    padding: 2rem 1rem;
    text-align: center;
    font-size: .82rem;
    color: var(--text-muted);
}

.theme-icon-sun,
.theme-icon-moon { display: block; }

.theme-icon-sun[hidden],
.theme-icon-moon[hidden] { display: none; }

/* ── Profile dropdown ── */
.profile-menu { position: relative; }

.profile-trigger {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .4rem .65rem .4rem .5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-full, 999px);
    box-shadow: var(--shadow-xs);
    cursor: pointer;
    font-family: inherit;
    transition: all var(--transition);
    color: inherit;
}

.profile-trigger:hover,
.profile-trigger[aria-expanded="true"] {
    background: var(--surface-2);
    border-color: var(--input-hover-border);
}

.profile-chevron {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    transition: transform var(--transition);
    flex-shrink: 0;
}

.profile-trigger[aria-expanded="true"] .profile-chevron {
    transform: rotate(180deg);
}

.profile-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 220px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: .5rem;
    z-index: 300;
    animation: dropdownIn .2s ease;
}

.profile-dropdown[hidden] { display: none; }

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

.profile-dropdown-header {
    padding: .75rem 1rem;
    line-height: 1.35;
}

.profile-dropdown-header strong {
    display: block;
    font-size: .855rem;
    font-weight: 600;
    color: var(--text);
}

.profile-dropdown-header span {
    font-size: .75rem;
    color: var(--text-muted);
}

.profile-dropdown-divider {
    height: 1px;
    background: var(--border-light);
    margin: .35rem .5rem;
}

.profile-dropdown-item {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .6rem 1rem;
    border-radius: var(--radius-sm);
    font-size: .845rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--transition);
}

.profile-dropdown-item svg {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.profile-dropdown-item:hover {
    background: var(--surface-2);
    color: var(--text);
    text-decoration: none;
}

.profile-dropdown-item:hover svg { color: var(--text-secondary); }

.profile-dropdown-item--danger { color: var(--danger); }
.profile-dropdown-item--danger svg { color: var(--danger); }

.profile-dropdown-item--danger:hover {
    background: var(--danger-soft);
    color: var(--danger);
}

.user-avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: .68rem; font-weight: 700;
    position: relative;
    flex-shrink: 0;
}

.presence-indicator {
    position: absolute;
    right: -1px;
    bottom: -1px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid var(--surface);
    background: var(--success);
    box-sizing: border-box;
}

.user-avatar[data-presenca="ausente"] .presence-indicator { background: var(--warning); }
.user-avatar[data-presenca="offline"] .presence-indicator { background: var(--text-muted); }

.profile-presence {
    display: flex;
    flex-direction: column;
    gap: .1rem;
    padding: .15rem 0;
}

.profile-presence-label {
    padding: .35rem 1rem .2rem;
    font-size: .68rem;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.profile-presence-option {
    width: 100%;
    border: 0;
    background: transparent;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    position: relative;
}

.profile-presence-option .profile-presence-check {
    width: 14px;
    height: 14px;
    margin-left: auto;
    color: var(--primary);
    opacity: 0;
    flex-shrink: 0;
}

.profile-presence-option.is-active {
    color: var(--text);
    background: var(--surface-2);
}

.profile-presence-option.is-active .profile-presence-check { opacity: 1; }

.presence-option-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.presence-option-dot--online { background: var(--success); }
.presence-option-dot--ausente { background: var(--warning); }
.presence-option-dot--offline { background: var(--text-muted); }

.badge-presenca {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-weight: 600;
}

.presenca-dot-inline {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}

.badge-presenca--online {
    background: var(--success-soft);
    color: #047857;
    border: 1px solid #a7f3d0;
}

.badge-presenca--ausente {
    background: var(--warning-soft);
    color: #b45309;
    border: 1px solid #fde68a;
}

.badge-presenca--offline {
    background: var(--surface-2);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.user-info { line-height: 1.25; text-align: left; }
.user-name { font-weight: 600; font-size: .8rem; color: var(--text); display: block; }
.user-login { color: var(--text-muted); font-size: .7rem; }

.content {
    padding: 2rem;
    flex: 1;
    max-width: 1480px;
    width: 100%;
    margin: 0 auto;
    min-width: 0;
}

/* ── Page header (todas as páginas) ── */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.75rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.page-header-text h2 {
    font-size: 1.45rem;
    font-weight: 700;
    letter-spacing: -.03em;
    color: var(--text);
    margin-bottom: .3rem;
}

.page-header-text p {
    color: var(--text-muted);
    font-size: .875rem;
    max-width: 560px;
}

.page-header-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

/* ── Dashboard KPIs ── */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.kpi-card {
    background: var(--elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.2rem 1.25rem;
    box-shadow: var(--shadow-xs);
    transition: transform var(--transition), box-shadow var(--transition), background-color .3s, border-color .3s;
}

.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

.kpi-top { margin-bottom: .75rem; }

.kpi-icon {
    width: 40px; height: 40px;
    border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    background: color-mix(in srgb, var(--kpi-color, var(--primary)) 10%, transparent);
    color: var(--kpi-color, var(--primary));
}

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

.kpi-value {
    font-size: 1.85rem;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -.04em;
}

.kpi-label { color: var(--text-muted); font-size: .78rem; font-weight: 500; margin-top: .35rem; }
.kpi-trend { font-size: .72rem; font-weight: 600; margin-top: .5rem; color: var(--text-muted); }

.kpi-pendente { --kpi-color: var(--warning); }
.kpi-tratado { --kpi-color: var(--primary); }
.kpi-visitas { --kpi-color: var(--purple); }
.kpi-ciencia { --kpi-color: var(--danger); }
.kpi-ok { --kpi-color: var(--success); }
.kpi-total { --kpi-color: var(--accent); }

/* ── Charts ── */
.charts-row { display: grid; grid-template-columns: 2fr 1fr; gap: 1rem; margin-bottom: 1.5rem; }
.charts-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1.5rem; }

.chart-card {
    background: var(--elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
    overflow: hidden;
    transition: background-color .3s, border-color .3s;
}

.chart-card-header {
    padding: 1.1rem 1.35rem;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chart-card-header h3 { font-size: .925rem; font-weight: 600; letter-spacing: -.01em; }
.chart-card-header span { font-size: .75rem; color: var(--text-muted); }

.chart-wrap { padding: 1.15rem 1.35rem 1.35rem; position: relative; height: 260px; }
.chart-wrap-sm { height: 220px; }

.charts-row-3 { grid-template-columns: repeat(3, 1fr); }

.report-period-filter {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
}

.report-period-label { font-size: .78rem; }

.report-metrics-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.report-metric {
    display: flex;
    flex-direction: column;
    gap: .25rem;
    padding: 1rem 1.15rem;
    background: var(--surface-2);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.report-metric-value {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -.02em;
    color: var(--text);
}

.report-metric-label {
    font-size: .78rem;
    color: var(--text-muted);
}

.rank-bar-warning { background: linear-gradient(90deg, var(--warning), #f97316); }

.report-dashboard-filters { display: flex; flex-direction: column; gap: 1rem; }

.report-filter-row {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 1rem;
    align-items: end;
}

.report-filter-buttons { display: flex; gap: .5rem; flex-wrap: wrap; }

.report-dashboard-export { margin-top: 1.25rem; }

.report-pdf-header {
    display: none;
    margin-bottom: 1rem;
    padding-bottom: .75rem;
    border-bottom: 1px solid var(--border);
}

.report-pdf-header strong {
    display: block;
    font-size: 1rem;
    margin-bottom: .2rem;
}

.report-pdf-header span {
    font-size: .78rem;
    color: var(--text-muted);
}

@media print {
    .no-print,
    .sidebar,
    .topbar,
    .alert { display: none !important; }

    .main-area { margin-left: 0 !important; }
    .content { padding: 0 !important; }

    .report-pdf-header { display: block !important; }
    .analise-filters { display: none !important; }
}

/* ── Análise aprofundada ── */
.analise-filters { gap: 1.25rem; }

.analise-period-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

.analise-period-block {
    padding: 1rem 1.1rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-2, color-mix(in srgb, var(--surface) 92%, var(--border)));
}

.analise-period-title {
    font-size: .82rem;
    font-weight: 700;
    margin: 0 0 .85rem;
    letter-spacing: .02em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.analise-period-block .report-filter-row {
    grid-template-columns: 1fr 1fr;
}

.analise-period-compare .form-group { margin-bottom: .75rem; }

.analise-comp-hint {
    font-size: .78rem;
    margin: .5rem 0 0;
}

.analise-submit-row { margin-top: .25rem; }

.analise-period-banner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: 1.25rem 0 1rem;
    padding: .85rem 1.1rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface);
}

.analise-period-banner strong { display: block; font-size: .95rem; }
.analise-period-banner span { font-size: .75rem; color: var(--text-muted); }

.analise-period-banner-vs {
    display: flex;
    align-items: center;
    gap: .75rem;
}

.analise-vs-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 999px;
    font-size: .7rem;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
    background: color-mix(in srgb, var(--primary) 12%, transparent);
    color: var(--primary);
}

.analise-kpi-grid { margin-bottom: .5rem; }

.analise-delta {
    display: inline-flex;
    align-items: baseline;
    gap: .2rem;
    font-size: .72rem;
    font-weight: 700;
    white-space: nowrap;
}

.analise-delta small { font-weight: 500; opacity: .85; }
.analise-delta.is-up { color: var(--success); }
.analise-delta.is-down { color: var(--danger); }
.analise-delta.is-flat { color: var(--text-muted); }

.analise-compare-table td:nth-child(2),
.analise-compare-table td:nth-child(3),
.analise-compare-table td:nth-child(4) {
    white-space: nowrap;
}

.analise-funnel { display: flex; flex-direction: column; gap: .65rem; }

.analise-funnel-meta {
    display: flex;
    justify-content: space-between;
    gap: .75rem;
    font-size: .8rem;
    margin-bottom: .25rem;
}

.analise-funnel-meta strong { font-variant-numeric: tabular-nums; }

.analise-funnel-bar {
    height: 8px;
    border-radius: 999px;
    background: var(--surface-2, #f1f5f9);
    overflow: hidden;
}

.analise-funnel-bar span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--primary), var(--accent, #0ea5e9));
}

.analise-meta-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: .75rem;
}

.analise-meta {
    padding: .65rem .75rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface-2, transparent);
}

.analise-meta span {
    display: block;
    font-size: .7rem;
    color: var(--text-muted);
    margin-bottom: .2rem;
}

.analise-meta strong {
    font-size: .9rem;
    font-variant-numeric: tabular-nums;
}

.analise-subheading {
    font-size: .8rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .03em;
    margin: 0 0 .65rem;
}

[data-theme="dark"] .analise-period-block,
[data-theme="dark"] .analise-meta,
[data-theme="dark"] .analise-funnel-bar {
    background: rgba(255,255,255,.03);
}

@media (max-width: 960px) {
    .analise-period-grid { grid-template-columns: 1fr; }
    .analise-meta-row { grid-template-columns: 1fr; }
}

/* ── Ranking ── */
.rank-list { padding: .35rem 0 .65rem; }

.rank-item {
    display: flex;
    align-items: center;
    gap: .85rem;
    padding: .7rem 1.35rem;
    border-radius: var(--radius-sm);
    margin: 0 .5rem;
    transition: background var(--transition);
}

.rank-item:hover { background: var(--surface-2); }

.rank-pos {
    width: 28px; height: 28px;
    border-radius: var(--radius-xs);
    background: var(--surface-3);
    display: flex; align-items: center; justify-content: center;
    font-size: .72rem; font-weight: 700;
    color: var(--text-muted);
    flex-shrink: 0;
}

.rank-item:nth-child(1) .rank-pos { background: #fef3c7; color: #b45309; }
.rank-item:nth-child(2) .rank-pos { background: #f3f4f6; color: #4b5563; }
.rank-item:nth-child(3) .rank-pos { background: #ffedd5; color: #c2410c; }

.rank-info { flex: 1; min-width: 0; }
.rank-name { font-size: .855rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-sub { font-size: .72rem; color: var(--text-muted); margin-top: .1rem; }

.rank-bar-wrap {
    width: 72px; height: 6px;
    background: var(--border-light);
    border-radius: var(--radius-full, 999px);
    overflow: hidden;
    flex-shrink: 0;
}

.rank-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: var(--radius-full, 999px);
    transition: width .7s cubic-bezier(.4,0,.2,1);
}

.rank-count { font-size: .825rem; font-weight: 700; min-width: 28px; text-align: right; }

/* ── Quick actions ── */
.quick-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: .75rem;
    margin-bottom: 1.5rem;
}

.quick-btn {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .95rem 1rem;
    min-width: 0;
    background: var(--elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    color: var(--text);
    transition: all var(--transition);
    box-shadow: var(--shadow-xs);
}

.quick-btn:hover {
    border-color: var(--hover-border);
    background: var(--primary-soft);
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.quick-btn-icon {
    width: 42px; height: 42px;
    border-radius: var(--radius-md);
    background: var(--chip-icon-bg);
    display: flex; align-items: center; justify-content: center;
    color: var(--primary);
    flex-shrink: 0;
    transition: background var(--transition);
}

.quick-btn:hover .quick-btn-icon { background: var(--primary-soft); }
.quick-btn-icon svg { width: 19px; height: 19px; }
.quick-btn strong { display: block; font-size: .82rem; font-weight: 600; line-height: 1.25; }
.quick-btn small { color: var(--text-muted); font-size: .7rem; line-height: 1.25; }

/* ── Components ── */
/* ── Cards ── */
.card {
    background: var(--elevated);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
    border: 1px solid var(--border);
    overflow: hidden;
    transition: background-color .3s, border-color .3s, box-shadow .3s;
}

.card-header {
    padding: 1.15rem 1.5rem;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: var(--elevated);
}

.card-header h2, .card-header h3 {
    font-size: .95rem;
    font-weight: 600;
    letter-spacing: -.01em;
}

.card-header-actions { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.card-body { padding: 1.5rem; }

.card-count {
    display: inline-flex;
    align-items: center;
    padding: .25rem .7rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-full, 999px);
    font-size: .75rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 1.15rem 1.5rem;
    border-top: 1px solid var(--border-light);
    background: var(--surface-2);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.mt-2 { margin-top: .75rem; }
.mt-4 { margin-top: 1.5rem; }
.max-w-md { max-width: 480px; }
.max-w-lg { max-width: 640px; }
.mx-auto { margin-left: auto; margin-right: auto; }

/* ── Tables ── */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.data-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .855rem; }

.data-table th {
    background: var(--surface-2);
    padding: .75rem 1.35rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-muted);
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .07em;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.data-table td {
    padding: .9rem 1.35rem;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

.data-table tbody tr { transition: background var(--transition); }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: var(--table-row-hover); }
.data-table .empty { text-align: center; color: var(--text-muted); padding: 3rem 1.5rem; }

.row-urgent td:first-child { box-shadow: inset 4px 0 0 var(--danger); }
.row-urgent.row-sla-vencendo td:first-child { box-shadow: inset 4px 0 0 var(--warning, #d97706); }
.row-urgent.row-sla-vencido td:first-child { box-shadow: inset 4px 0 0 var(--danger); }

.ticket-num {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--primary);
    padding: .2rem .5rem;
    background: var(--primary-soft);
    border-radius: var(--radius-xs);
    font-size: .8rem;
    transition: all var(--transition);
}

.ticket-num:hover { background: var(--primary); color: #fff; text-decoration: none; }

.link { font-weight: 600; color: var(--primary); }

/* ── Badges ── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: .25rem .65rem;
    border-radius: var(--radius-full, 999px);
    font-size: .68rem;
    font-weight: 600;
    letter-spacing: .02em;
    white-space: nowrap;
}

.badge-pendente { background: var(--warning-soft); color: #b45309; border: 1px solid #fde68a; }
.badge-atendimento { background: rgba(8,145,178,.12); color: #0e7490; border: 1px solid rgba(8,145,178,.25); }
.badge-supervisor,
.badge-especialistas { background: var(--purple-soft); color: #6d28d9; border: 1px solid rgba(139,92,246,.25); }
.badge-visita { background: rgba(14,165,233,.12); color: #0369a1; border: 1px solid rgba(14,165,233,.25); }
.badge-tratado { background: var(--primary-soft); color: #1d4ed8; border: 1px solid #bfdbfe; }
.badge-ok { background: var(--success-soft); color: #047857; border: 1px solid #a7f3d0; }
.badge-warning { background: var(--danger-soft); color: #b91c1c; border: 1px solid #fecaca; }
.badge-default { background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border); }
.badge-admin { background: var(--purple-soft); color: #6d28d9; border: 1px solid rgba(139,92,246,.25); }

.tipo-badge {
    font-size: .78rem;
    color: var(--text-secondary);
    display: inline-block;
    max-width: 240px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.setor-tag {
    display: inline-block;
    font-size: .62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--purple);
    background: var(--purple-soft);
    padding: .2rem .5rem;
    border-radius: var(--radius-xs);
    margin-right: .4rem;
    border: 1px solid rgba(139,92,246,.15);
}

.status-dot {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    font-size: .78rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.status-dot::before {
    content: '';
    width: 7px; height: 7px;
    border-radius: 50%;
    background: currentColor;
}

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

/* ── Forms ── */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.15rem; }
.form-group { display: flex; flex-direction: column; gap: .4rem; }
.form-group.full { grid-column: 1 / -1; }

.form-group label {
    font-size: .78rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-hint {
    font-size: .72rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: .65rem .9rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: .875rem;
    font-family: inherit;
    transition: border-color var(--transition), box-shadow var(--transition), background-color .3s;
    background: var(--input-bg);
    color: var(--text);
}

.form-group input:hover,
.form-group select:hover,
.form-group textarea:hover { border-color: var(--input-hover-border); }

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-ring);
}

.form-group input::placeholder,
.form-group textarea::placeholder { color: #9ca3af; }

.form-group small { font-size: .75rem; color: var(--text-muted); margin-top: .15rem; }

.form-actions { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.form-actions.full { grid-column: 1 / -1; }
.form-row { display: flex; gap: 1rem; align-items: flex-end; flex-wrap: wrap; }
.flex-2 { flex: 2; min-width: 200px; }
.flex-3 { flex: 3; min-width: 250px; }
.flex-0 { flex: 0; }

.checkbox-label {
    display: flex;
    align-items: center;
    gap: .6rem;
    cursor: pointer;
    padding: .65rem .9rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-2);
    transition: all var(--transition);
}

.checkbox-label:hover { border-color: var(--primary); background: var(--primary-soft); }
.checkbox-label input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--primary); }

.filters-form { gap: 1rem; }

.filters-toolbar {
    margin-top: .15rem;
}

.filters-advanced {
    grid-column: 1 / -1;
    margin-top: .35rem;
    padding: 1.1rem 1.15rem 1.15rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-2);
}

.filters-advanced-grid {
    gap: 1rem;
}

#toggleAdvancedFilters[aria-expanded="true"] {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-soft);
}

.section-title {
    font-size: .95rem;
    font-weight: 600;
    margin: 1.5rem 0 1rem;
    padding-bottom: .65rem;
    border-bottom: 1px solid var(--border-light);
    letter-spacing: -.01em;
}

.section-desc {
    font-size: .85rem;
    color: var(--text-muted);
    margin: -.35rem 0 1rem;
}

.modulos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: .75rem;
    margin-bottom: 1.5rem;
}

.modulo-card {
    display: flex;
    gap: .75rem;
    align-items: flex-start;
    padding: .85rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-2);
    cursor: pointer;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.modulo-card:hover { border-color: var(--primary); }

.modulo-card input {
    width: 16px;
    height: 16px;
    margin-top: .15rem;
    accent-color: var(--primary);
    flex-shrink: 0;
}

.modulo-card.is-disabled {
    opacity: .55;
    cursor: not-allowed;
}

.modulo-card-body {
    display: flex;
    flex-direction: column;
    gap: .2rem;
}

.modulo-card-body strong {
    font-size: .875rem;
    color: var(--text);
}

.modulo-card-body small {
    font-size: .75rem;
    color: var(--text-muted);
    line-height: 1.35;
}

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    padding: .6rem 1.2rem;
    border-radius: var(--radius-md);
    font-size: .855rem;
    font-weight: 600;
    font-family: inherit;
    border: none;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.btn svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(37,99,235,.2);
}
.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(37,99,235,.3);
    color: #fff;
    text-decoration: none;
}

.btn-success {
    background: var(--success);
    color: #fff;
    box-shadow: 0 2px 8px rgba(16,185,129,.22);
}
.btn-success:hover {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(16,185,129,.32);
    color: #fff;
    text-decoration: none;
}

.btn-secondary {
    background: var(--surface);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-xs);
}
.btn-secondary:hover { background: var(--surface-2); border-color: var(--input-hover-border); text-decoration: none; color: var(--text); }

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid transparent;
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }

.btn-danger {
    background: var(--danger-soft);
    color: var(--danger);
    border: 1px solid #fecaca;
}
.btn-danger:hover { background: var(--danger); color: #fff; text-decoration: none; }

.btn-danger-solid {
    background: var(--danger);
    color: #fff;
    border: 1px solid transparent;
    box-shadow: 0 2px 8px rgba(239,68,68,.22);
}
.btn-danger-solid:hover {
    background: #dc2626;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(239,68,68,.32);
    color: #fff;
    text-decoration: none;
}

.btn-warning {
    background: #f59e0b;
    color: #fff;
    border: 1px solid transparent;
    box-shadow: 0 2px 8px rgba(245,158,11,.22);
}
.btn-warning:hover {
    background: #d97706;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(245,158,11,.32);
    color: #fff;
    text-decoration: none;
}

.btn-sm { padding: .4rem .85rem; font-size: .78rem; border-radius: var(--radius-sm); }
.btn-block { width: 100%; }

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: .4rem;
    min-width: 32px;
}

.btn-icon svg { width: 16px; height: 16px; }

.ack-row-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: .45rem;
}

.ack-row-actions form { margin: 0; }

.ticket-ack-table th,
.ticket-ack-table td {
    vertical-align: middle;
}

.ticket-ack-table tbody tr {
    cursor: default;
}

.ticket-ack-table tbody tr:hover td {
    background: inherit;
}

.ticket-ack-table .ticket-num-static {
    cursor: default;
}

.ticket-ack-table .ticket-num-static:hover {
    background: var(--primary-soft);
    color: var(--primary);
}

.ticket-agents-stack {
    display: flex;
    flex-direction: column;
    gap: .45rem;
    max-width: 180px;
}

.ticket-agent-cell--stacked {
    padding: .28rem .45rem .28rem .28rem;
    border-radius: var(--radius-md);
    background: var(--surface-2);
    border: 1px solid var(--border-light);
}

.ticket-agent-cell--stacked .ticket-agent-avatar {
    width: 28px;
    height: 28px;
    font-size: .58rem;
}

.ticket-agent-cell--stacked .ticket-agent-name {
    font-size: .8rem;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ticket-ack-table .ack-col-actions {
    width: 168px;
    text-align: right;
}

.ticket-list-actions {
    display: inline-flex;
    flex-direction: column;
    align-items: stretch;
    gap: .35rem;
}

.ticket-list-actions .inline-form {
    margin: 0;
}

.ticket-ack-table .ticket-status-cell {
    justify-content: flex-start;
}

.ticket-ack-table .ack-row-actions {
    justify-content: flex-end;
}

/* ── Ticket preview modal ── */
body.ticket-preview-open { overflow: hidden; }

.ticket-preview-modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
}

.ticket-preview-modal[hidden] { display: none; }

.ticket-preview-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, .55);
    backdrop-filter: blur(6px);
}

.ticket-preview-dialog {
    position: relative;
    width: min(720px, 100%);
    max-height: min(88vh, 860px);
    display: flex;
    flex-direction: column;
    background: var(--elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 24px 64px rgba(15, 23, 42, .28);
    overflow: hidden;
    animation: ticketPreviewIn .22s ease;
}

@keyframes ticketPreviewIn {
    from { opacity: 0; transform: translateY(12px) scale(.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.ticket-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.1rem 1.25rem;
    border-bottom: 1px solid var(--border-light);
    background: linear-gradient(180deg, var(--surface-2) 0%, var(--elevated) 100%);
}

.ticket-preview-title {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .55rem;
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -.02em;
}

.ticket-preview-num { color: var(--primary); }

.ticket-preview-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
    flex-shrink: 0;
}

.ticket-preview-close:hover {
    color: var(--text);
    border-color: var(--hover-border);
    background: var(--surface-2);
}

.ticket-preview-close svg { width: 16px; height: 16px; }

.ticket-preview-body {
    padding: 1.15rem 1.25rem 1.25rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.ticket-preview-footer {
    display: flex;
    justify-content: flex-end;
    gap: .5rem;
    padding: .9rem 1.25rem 1.1rem;
    border-top: 1px solid var(--border-light);
    background: var(--surface-2);
}

.ticket-preview-section-title {
    margin: 0 0 .85rem;
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-muted);
}

.ticket-preview-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .75rem 1rem;
}

.ticket-preview-field {
    display: flex;
    flex-direction: column;
    gap: .2rem;
    min-width: 0;
}

.ticket-preview-field-label {
    font-size: .68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-muted);
}

.ticket-preview-field-value {
    font-size: .855rem;
    font-weight: 500;
    color: var(--text);
    word-break: break-word;
}

.ticket-preview-solicitacao {
    margin-top: 1rem;
    padding: .95rem 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
    background: var(--surface-2);
}

.ticket-preview-solicitacao p {
    margin: .45rem 0 0;
    font-size: .855rem;
    line-height: 1.65;
    color: var(--text-secondary);
    white-space: pre-wrap;
}

.ticket-preview-timeline {
    display: flex;
    flex-direction: column;
    gap: .75rem;
}

.ticket-preview-timeline-item {
    position: relative;
    padding: .9rem 1rem .9rem 1.15rem;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    background: var(--surface-2);
}

.ticket-preview-timeline-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: .85rem;
    bottom: .85rem;
    width: 3px;
    border-radius: 999px;
    background: linear-gradient(180deg, var(--primary), var(--accent));
}

.ticket-preview-timeline-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .45rem .65rem;
    margin-bottom: .55rem;
    font-size: .78rem;
}

.ticket-preview-timeline-meta strong {
    color: var(--text);
    font-weight: 600;
}

.ticket-preview-timeline-meta span {
    color: var(--text-muted);
}

.ticket-preview-timeline-body {
    font-size: .855rem;
    line-height: 1.65;
    color: var(--text-secondary);
}

.ticket-preview-loading,
.ticket-preview-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .75rem;
    min-height: 180px;
    text-align: center;
    color: var(--text-muted);
    font-size: .875rem;
}

.ticket-preview-spinner {
    width: 34px;
    height: 34px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: ticketPreviewSpin .7s linear infinite;
}

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

[data-theme="dark"] .ticket-preview-backdrop {
    background: rgba(2, 6, 23, .72);
}

[data-theme="dark"] .ticket-preview-dialog {
    box-shadow: 0 24px 64px rgba(0, 0, 0, .55);
}

/* ── Alerts ── */
.alert {
    padding: .9rem 1.15rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.25rem;
    font-size: .855rem;
    display: flex;
    align-items: center;
    gap: .5rem;
    animation: slideDown .35s ease;
}

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

.alert-success { background: var(--success-soft); color: #065f46; border: 1px solid #a7f3d0; }
.alert-error { background: var(--danger-soft); color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: var(--warning-soft); color: #92400e; border: 1px solid #fde68a; }

/* ── Ticket detail ── */
.ticket-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1.35rem 1.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
}

.ticket-header-left { display: flex; align-items: center; gap: .65rem; flex-wrap: wrap; }

.ticket-number {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -.03em;
    font-variant-numeric: tabular-nums;
    color: var(--text);
}

.ticket-actions { display: flex; gap: .45rem; flex-wrap: wrap; align-items: center; justify-content: flex-end; }
.ticket-actions .inline-form { margin: 0; display: inline-flex; }
.ticket-actions .btn-sm {
    min-height: 2rem;
}
.ticket-side { display: flex; flex-direction: column; gap: 1.25rem; }
.ticket-side > .card { margin: 0; }

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

/* ── Detalhe do chamado ── */
.ticket-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
    gap: 1.5rem;
    align-items: start;
}

.ticket-layout-single {
    grid-template-columns: minmax(0, 1fr);
    max-width: 760px;
}

.ticket-side { display: flex; flex-direction: column; gap: 1.25rem; min-width: 0; }

.ticket-form-side {
    position: sticky;
    top: 1rem;
    min-width: 0;
    z-index: 5;
}

.ticket-procedure {
    border-top: 3px solid var(--primary);
    /* Permite o dropdown do search-select (reclassificação) ultrapassar a borda do card */
    overflow: visible;
}
.ticket-procedure .form-group + .form-group { margin-top: 1rem; }

.procedure-register-actions .form-hint {
    margin-top: .45rem;
    margin-bottom: 0;
}

.status-sla-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem .75rem;
    margin-bottom: .75rem;
}
.status-sla-meta {
    font-size: .8rem;
    color: var(--text-muted);
}
.status-sla-meta .text-danger { color: var(--danger, #dc2626); }
.status-sla-meta .text-warning { color: var(--warning, #d97706); }
.status-actions {
    display: flex;
    flex-direction: column;
    gap: .5rem;
}
.status-action-btn {
    width: 100%;
    justify-content: center;
    text-align: center;
}
.status-action-btn:disabled {
    opacity: .55;
    cursor: not-allowed;
}
.status-action-btn.is-selected {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-ring);
}
.status-lock-hint { color: var(--warning, #d97706); }
.status-unlock-hint { color: var(--success, #059669); }
.status-assumido-hint { margin: 0 0 .35rem; }
.status-assumir-btn {
    width: 100%;
    justify-content: center;
    text-align: center;
}
.status-form-actions {
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

/* Cards com select pesquisável não podem clipar o dropdown absoluto */
.card:has(.search-select) {
    overflow: visible;
}

/* ── Procedimento + anexos integrados ── */
.procedure-compose {
    position: relative;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--input-bg);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.procedure-compose:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-ring);
}

.procedure-compose.is-panel-open {
    border-color: var(--hover-border);
}

.procedure-compose-editor {
    position: relative;
}

.procedure-compose-textarea {
    display: block;
    width: 100%;
    min-height: 168px;
    padding: .65rem .9rem 2.75rem;
    border: none !important;
    border-radius: var(--radius-md) var(--radius-md) 0 0 !important;
    box-shadow: none !important;
    resize: vertical;
    background: transparent;
}

.procedure-compose:not(.is-panel-open) .procedure-compose-textarea {
    border-radius: var(--radius-md) !important;
}

.procedure-compose-textarea:focus {
    outline: none;
    box-shadow: none !important;
}

.procedure-compose-toolbar {
    position: absolute;
    right: .55rem;
    bottom: .55rem;
    display: flex;
    align-items: center;
    gap: .35rem;
    pointer-events: none;
    z-index: 1;
}

.procedure-anexo-trigger {
    pointer-events: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .2rem;
    min-width: 2rem;
    height: 2rem;
    padding: 0 .45rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    background: var(--surface);
    color: var(--text-muted);
    cursor: pointer;
    transition: color var(--transition), background var(--transition), border-color var(--transition), transform var(--transition);
}

.procedure-anexo-trigger svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

.procedure-anexo-trigger:hover,
.procedure-anexo-trigger[aria-expanded="true"] {
    color: var(--primary);
    border-color: var(--hover-border);
    background: var(--primary-soft);
}

.procedure-anexo-trigger:active { transform: scale(.96); }

.procedure-anexo-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1rem;
    height: 1rem;
    padding: 0 .28rem;
    border-radius: 99px;
    background: var(--primary);
    color: #fff;
    font-size: .62rem;
    font-weight: 700;
    line-height: 1;
}

.procedure-anexo-panel {
    border-top: 1px solid var(--border-light);
    padding: .75rem;
    background: var(--surface-2);
    animation: procedurePanelIn .18s ease;
}

.procedure-compose.is-panel-open .procedure-anexo-panel {
    border-radius: 0 0 var(--radius-md) var(--radius-md);
}

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

.procedure-anexo-dropzone {
    position: relative;
    border: 1.5px dashed var(--border);
    border-radius: var(--radius-sm);
    padding: 1rem .85rem;
    text-align: center;
    cursor: pointer;
    transition: border-color var(--transition), background var(--transition);
}

.procedure-anexo-dropzone:hover {
    border-color: var(--hover-border);
    background: var(--surface);
}

.procedure-anexo-dropzone.is-dragover {
    border-color: var(--primary);
    background: var(--primary-soft);
}

.procedure-anexo-dropzone input[type="file"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.procedure-anexo-dropzone-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .35rem;
    pointer-events: none;
}

.procedure-anexo-dropzone-inner svg {
    width: 26px;
    height: 26px;
    color: var(--primary);
    opacity: .85;
}

.procedure-anexo-dropzone-inner p {
    margin: 0;
    font-size: .82rem;
    color: var(--text-secondary);
}

.procedure-anexo-browse {
    color: var(--primary);
    font-weight: 600;
}

.procedure-anexo-dropzone-inner small {
    font-size: .7rem;
    color: var(--text-muted);
}

.procedure-anexo-files {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: .35rem;
    margin: .65rem 0 0;
    padding: 0;
}

.procedure-anexo-file {
    display: flex;
    align-items: center;
    gap: .55rem;
    padding: .45rem .6rem;
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xs);
    font-size: .78rem;
}

.procedure-anexo-file-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    border-radius: 6px;
    background: var(--chip-icon-bg);
    color: var(--primary);
}

.procedure-anexo-file-icon svg { width: 14px; height: 14px; }

.procedure-anexo-file-info {
    display: flex;
    flex-direction: column;
    gap: .05rem;
    min-width: 0;
    flex: 1;
}

.procedure-anexo-file-name {
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.procedure-anexo-file-size {
    font-size: .68rem;
    color: var(--text-muted);
}

.procedure-anexo-file-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    flex-shrink: 0;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: color var(--transition), background var(--transition);
}

.procedure-anexo-file-remove:hover {
    color: var(--danger);
    background: var(--danger-soft);
}

.procedure-anexo-file-remove svg { width: 14px; height: 14px; }

[data-theme="dark"] .procedure-compose {
    background: var(--input-bg);
}

[data-theme="dark"] .procedure-anexo-panel {
    background: var(--elevated);
}

.detail-list {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: .75rem 1.25rem;
    font-size: .855rem;
}

.detail-list dt {
    color: var(--text-muted);
    font-weight: 500;
    font-size: .76rem;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.detail-list dd { margin: 0; color: var(--text); font-weight: 500; }

.ticket-contato-form {
    display: flex;
    flex-direction: column;
    gap: .85rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.ticket-contato-form .form-actions {
    margin-top: .15rem;
}

.ticket-about {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
}

.ticket-about-head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .6rem .75rem;
}

.ticket-about-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.35;
    color: var(--text);
    letter-spacing: -.015em;
}

.sla-badge {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .25rem .6rem;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    border: 1px solid transparent;
}

.sla-badge::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
}

.sla-ok {
    background: var(--success-soft);
    color: var(--success);
    border-color: color-mix(in srgb, var(--success) 25%, transparent);
}

.sla-warning {
    background: var(--warning-soft);
    color: var(--warning);
    border-color: color-mix(in srgb, var(--warning) 25%, transparent);
}

.sla-danger {
    background: var(--danger-soft);
    color: var(--danger);
    border-color: color-mix(in srgb, var(--danger) 25%, transparent);
}

[data-theme="dark"] .sla-ok { background: rgba(16,185,129,.12); color: #34d399; }
[data-theme="dark"] .sla-warning { background: rgba(245,158,11,.12); color: #fbbf24; }
[data-theme="dark"] .sla-danger { background: rgba(239,68,68,.12); color: #f87171; }

.ticket-about-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    padding: 1rem 0;
    border-top: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
}

.ticket-about-meta-item {
    display: flex;
    flex-direction: column;
    gap: .3rem;
    min-width: 0;
}

.ticket-about-meta-item + .ticket-about-meta-item {
    padding-left: 1rem;
    border-left: 1px solid var(--border-light);
}

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

.ticket-about-meta-value {
    font-size: .875rem;
    font-weight: 600;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    line-height: 1.35;
}

.ticket-about-block {
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

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

.ticket-about-block-content {
    padding: .9rem 1rem;
    background: var(--surface-2);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: .875rem;
    line-height: 1.6;
}

.detail-date-item { display: inline-flex; align-items: baseline; gap: .5rem; font-weight: 500; }

.detail-date-label {
    color: var(--text-muted);
    font-weight: 500;
    font-size: .76rem;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.detail-highlight {
    background: var(--surface-2);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 1rem 1.15rem;
    margin-top: .5rem;
    grid-column: 1 / -1;
}

.text-block { white-space: pre-wrap; line-height: 1.65; }
.text-muted { color: var(--text-muted); }
.text-truncate { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Timeline ── */
.timeline {
    display: flex;
    flex-direction: column;
    gap: .55rem;
    padding: .1rem 0;
}

.timeline-item {
    position: relative;
    padding: .7rem .9rem .7rem 1.1rem;
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    margin-left: .7rem;
    box-shadow: var(--shadow-xs);
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -1.2rem;
    top: .95rem;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid var(--surface);
    box-shadow: 0 0 0 2px var(--primary-soft);
}

.timeline-item:not(:last-child)::after {
    content: '';
    position: absolute;
    left: -.78rem;
    top: 1.55rem;
    bottom: -.7rem;
    width: 2px;
    background: var(--border);
}

.timeline-meta {
    display: flex;
    gap: .4rem .55rem;
    align-items: center;
    margin-bottom: .35rem;
    font-size: .75rem;
    flex-wrap: wrap;
    line-height: 1.3;
}

.timeline-meta strong { color: var(--text); font-weight: 650; }
.timeline-meta span { color: var(--text-muted); }
.timeline-meta .badge { font-size: .68rem; padding: .12rem .45rem; }

.timeline-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .35rem .55rem;
    margin-bottom: .3rem;
}

.timeline-type {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-size: .78rem;
    color: var(--text-muted);
    line-height: 1.3;
    margin-bottom: .2rem;
}

.timeline-type .setor-tag { flex-shrink: 0; }

.timeline-body {
    font-size: .84rem;
    line-height: 1.45;
    color: var(--text-secondary);
}

.timeline-text {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
}

.timeline-type + .timeline-text { margin-top: .15rem; }

.timeline-text:empty { display: none; }

/* ── Tipo selector ── */
.tipo-selector {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: .85rem;
    margin-bottom: 1.5rem;
}

.tipo-chip {
    display: flex;
    align-items: center;
    gap: .85rem;
    padding: 1rem 1.15rem;
    background: var(--elevated);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-lg);
    color: var(--text);
    transition: all var(--transition);
    box-shadow: var(--shadow-xs);
}

.tipo-chip:hover {
    border-color: var(--hover-border);
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.tipo-chip.active {
    border-color: var(--primary);
    background: var(--primary-soft);
    box-shadow: 0 0 0 3px var(--primary-ring);
}

.tipo-chip .chip-icon {
    width: 40px; height: 40px;
    border-radius: var(--radius-md);
    background: var(--chip-icon-bg);
    display: flex; align-items: center; justify-content: center;
    font-size: .7rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -.02em;
    flex-shrink: 0;
    text-transform: uppercase;
    transition: background .2s;
}

.tipo-chip.active .chip-icon { background: var(--primary-soft); color: var(--primary-dark); }
.tipo-chip strong { display: block; font-size: .855rem; font-weight: 600; }
.tipo-chip small { color: var(--text-muted); font-size: .72rem; line-height: 1.3; }

.cliente-result {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin-top: 1rem;
    background: var(--surface-2);
}

.cliente-info { display: flex; flex-wrap: wrap; gap: .5rem 1.75rem; margin-bottom: 1rem; font-size: .855rem; }
.cliente-info span { color: var(--text-muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; }

.sector-row td {
    background: var(--surface-2) !important;
    font-weight: 700;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-muted);
    border-radius: 0;
}

.sector-panel { margin-bottom: 1rem; }
.sector-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: nowrap;
}
.sector-panel-title {
    display: flex;
    align-items: baseline;
    gap: .65rem;
    min-width: 0;
}
.sector-panel-title h2 {
    margin: 0;
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sector-panel-count {
    flex-shrink: 0;
    font-size: .72rem;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--surface-2);
    border: 1px solid var(--border-light);
    border-radius: 999px;
    padding: .15rem .55rem;
}
.sector-toolbar {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    flex-shrink: 0;
    padding: .3rem;
    background: var(--surface-2);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
}
.sector-toolbar .btn {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    min-height: 2rem;
    padding: .35rem .75rem;
    box-shadow: none;
}
.sector-toolbar .btn svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}
.sector-toolbar .btn-primary {
    box-shadow: none;
}
.sector-toolbar .btn-primary:hover {
    transform: none;
    box-shadow: none;
}
.sector-toolbar-form {
    display: inline-flex;
    margin: 0;
}
.sector-toolbar .btn-danger {
    background: rgba(239, 68, 68, .12);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, .28);
}
.sector-toolbar .btn-danger:hover:not(:disabled) {
    background: #ef4444;
    color: #fff;
    border-color: #ef4444;
}
.sector-toolbar .btn-danger:disabled {
    opacity: .38;
    cursor: not-allowed;
    filter: grayscale(.15);
}
.sector-panel-body { padding-top: 0; }

.perm-toolbar { margin-bottom: 1rem; }
.perm-toolbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}
.perm-toolbar-hint { font-size: .875rem; max-width: 36rem; }
.perm-toolbar-actions {
    display: inline-flex;
    flex-wrap: wrap;
    gap: .4rem;
    align-items: center;
}
.perm-sector-masters {
    display: inline-flex;
    flex-wrap: wrap;
    gap: .5rem .85rem;
    align-items: center;
    flex-shrink: 0;
    max-width: 26rem;
    justify-content: flex-end;
}
.perm-sector-toggle {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    min-width: 0;
    flex: 1 1 auto;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    text-align: left;
    cursor: pointer;
    font: inherit;
}
.perm-sector-toggle:focus-visible {
    outline: 2px solid var(--accent, #2563eb);
    outline-offset: 3px;
    border-radius: .35rem;
}
.perm-sector-chevron {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
    color: var(--text-muted);
    transition: transform .18s ease;
}
.perm-sector.is-open .perm-sector-chevron {
    transform: rotate(0deg);
}
.perm-sector.is-collapsed .perm-sector-chevron {
    transform: rotate(-90deg);
}
.perm-sector.is-collapsed .perm-sector-body,
.perm-sector-body[hidden] {
    display: none;
}
.perm-sector.is-collapsed .card-header {
    border-bottom: 0;
}
.perm-tipo-total {
    opacity: .85;
}
.perm-check-label {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-size: .8125rem;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}
.perm-table .perm-col-check {
    width: 5.25rem;
    text-align: center;
    font-size: .72rem;
    white-space: nowrap;
}
.perm-table input[type="checkbox"] {
    width: 1.05rem;
    height: 1.05rem;
    cursor: pointer;
}

@media (max-width: 720px) {
    .perm-toolbar-inner { align-items: flex-start; }
    .sector-panel-header {
        flex-wrap: wrap;
    }
    .perm-sector-masters {
        width: 100%;
        padding-left: 1.55rem;
    }
}

@media (max-width: 720px) {
    .sector-panel-header {
        flex-direction: column;
        align-items: stretch;
    }
    .sector-toolbar {
        width: 100%;
        justify-content: stretch;
    }
    .sector-toolbar .btn,
    .sector-toolbar-form {
        flex: 1 1 0;
    }
    .sector-toolbar .btn {
        justify-content: center;
    }
}

.perm-table { font-size: .8rem; }
.perm-table input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }

.perm-filter-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: .85rem;
    flex-wrap: wrap;
}

.perm-filter-field { flex: 1; min-width: 240px; position: relative; }

.perm-filter-input {
    width: 100%;
    padding: .65rem .9rem .65rem 2.35rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: .875rem;
    font-family: inherit;
    background: var(--input-bg);
    color: var(--text);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.perm-filter-field::before {
    content: '';
    position: absolute;
    left: .85rem;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    opacity: .45;
    background: currentColor;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E") center / contain no-repeat;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E") center / contain no-repeat;
    pointer-events: none;
}

.perm-filter-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-ring);
}

.perm-filter-count {
    font-size: .75rem;
    color: var(--text-muted);
    font-weight: 500;
    white-space: nowrap;
}

/* ── Searchable select ── */
.search-select {
    position: relative;
    width: 100%;
}

.search-select-native {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.search-select-input {
    width: 100%;
    padding: .65rem .9rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: .875rem;
    font-family: inherit;
    background: var(--input-bg);
    color: var(--text);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.search-select-input:hover { border-color: var(--input-hover-border); }

.search-select-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-ring);
}

.search-select-dropdown {
    position: fixed;
    z-index: 1300;
    max-height: 280px;
    overflow-y: auto;
    background: var(--elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: .35rem;
}

.search-select-dropdown[hidden] {
    display: none !important;
}

.search-select-group {
    padding: .55rem .65rem .25rem;
    font-size: .65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-muted);
}

.search-select-option {
    display: block;
    width: 100%;
    text-align: left;
    padding: .55rem .65rem;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text);
    font-size: .845rem;
    font-family: inherit;
    cursor: pointer;
    transition: background var(--transition);
}

.search-select-option-id {
    display: inline-block;
    min-width: 1.75rem;
    margin-right: .35rem;
    font-size: .72rem;
    font-weight: 700;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.search-select-option:hover,
.search-select-option.is-active {
    background: var(--primary-soft);
    color: var(--text);
}

.search-select-option.is-selected {
    font-weight: 600;
    color: var(--primary);
}

.search-select-empty {
    margin-top: .35rem;
    padding: .65rem .9rem;
    font-size: .8rem;
    color: var(--text-muted);
    background: var(--surface-2);
    border: 1px dashed var(--border);
    border-radius: var(--radius-md);
}

/* ── Chamados ── */
/* ── Ticket list ── */
.ticket-list-stats {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: .65rem;
    margin-bottom: 1.35rem;
}

.ticket-stat-chip {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .95rem 1rem;
    min-width: 0;
    background: var(--elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
    transition: all var(--transition);
    text-decoration: none;
    color: inherit;
}

.ticket-stat-chip:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    text-decoration: none;
    border-color: var(--hover-border);
}

.ticket-stat-chip.active {
    border-color: var(--primary);
    background: var(--primary-soft);
    box-shadow: 0 0 0 3px var(--primary-ring);
}

.ticket-stat-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-2);
    color: var(--text-muted);
    flex-shrink: 0;
    transition: background var(--transition), color var(--transition);
}

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

.ticket-stat-body { min-width: 0; }

.ticket-stat-value {
    display: block;
    font-size: 1.55rem;
    font-weight: 700;
    letter-spacing: -.04em;
    line-height: 1;
}

.ticket-stat-label {
    display: block;
    font-size: .72rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-top: .25rem;
    line-height: 1.25;
}

.ticket-stat-chip.is-total { --stat-color: var(--accent); }
.ticket-stat-chip.is-pendente { --stat-color: var(--warning); }
.ticket-stat-chip.is-atendimento { --stat-color: #0891b2; }
.ticket-stat-chip.is-supervisor,
.ticket-stat-chip.is-especialistas { --stat-color: var(--purple); }
.ticket-stat-chip.is-visita { --stat-color: var(--accent); }
.ticket-stat-chip.is-tratado { --stat-color: var(--primary); }
.ticket-stat-chip.is-ok { --stat-color: var(--success); }

.ticket-stat-chip.is-total .ticket-stat-icon,
.ticket-stat-chip.is-pendente .ticket-stat-icon,
.ticket-stat-chip.is-atendimento .ticket-stat-icon,
.ticket-stat-chip.is-supervisor .ticket-stat-icon,
.ticket-stat-chip.is-especialistas .ticket-stat-icon,
.ticket-stat-chip.is-visita .ticket-stat-icon,
.ticket-stat-chip.is-tratado .ticket-stat-icon,
.ticket-stat-chip.is-ok .ticket-stat-icon {
    background: color-mix(in srgb, var(--stat-color) 12%, transparent);
    color: var(--stat-color);
}

.ticket-stat-chip.is-total .ticket-stat-value { color: var(--accent); }
.ticket-stat-chip.is-pendente .ticket-stat-value { color: var(--warning); }
.ticket-stat-chip.is-atendimento .ticket-stat-value { color: #0891b2; }
.ticket-stat-chip.is-supervisor .ticket-stat-value,
.ticket-stat-chip.is-especialistas .ticket-stat-value { color: var(--purple); }
.ticket-stat-chip.is-visita .ticket-stat-value { color: var(--accent); }
.ticket-stat-chip.is-tratado .ticket-stat-value { color: var(--primary); }
.ticket-stat-chip.is-ok .ticket-stat-value { color: var(--success); }

.ticket-list-card { overflow: hidden; }

.ticket-filter-panel {
    padding: 1.25rem 1.5rem;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border-light);
}

.ticket-filter-row {
    display: grid;
    grid-template-columns: 1fr minmax(220px, 260px);
    gap: 1.25rem;
    align-items: end;
}

.ticket-filter-label {
    display: block;
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-muted);
    margin-bottom: .45rem;
}

.ticket-list-search {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: .65rem;
    align-items: end;
}

.ticket-list-search .ticket-filter-label { grid-column: 1 / -1; }

.ticket-search-field {
    position: relative;
    grid-column: 1;
}

.ticket-search-actions {
    display: flex;
    align-items: center;
    gap: .35rem;
    grid-column: 2;
}

.ticket-search-field svg {
    position: absolute;
    left: .85rem;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    pointer-events: none;
}

.ticket-search-field input {
    width: 100%;
    padding: .7rem .9rem .7rem 2.4rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: .875rem;
    font-family: inherit;
    background: var(--input-bg);
    color: var(--text);
    box-shadow: var(--shadow-xs);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.ticket-search-field input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-ring);
}

.select-field {
    position: relative;
}

.select-field select {
    width: 100%;
    appearance: none;
    padding: .7rem 2.25rem .7rem .9rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: .875rem;
    font-family: inherit;
    background: var(--input-bg);
    color: var(--text);
    box-shadow: var(--shadow-xs);
    cursor: pointer;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.select-field select:hover { border-color: var(--input-hover-border); }

.select-field select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-ring);
}

.select-field-chevron {
    position: absolute;
    right: .75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    pointer-events: none;
}

.ticket-active-filters {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .5rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px dashed var(--border);
}

.ticket-active-filters-label {
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-muted);
    margin-right: .25rem;
}

.filter-pill {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .35rem .7rem .35rem .85rem;
    background: var(--elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-full, 999px);
    font-size: .78rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all var(--transition);
}

.filter-pill svg {
    width: 12px;
    height: 12px;
    opacity: .55;
}

.filter-pill:hover {
    background: var(--primary-soft);
    border-color: var(--hover-border);
    color: var(--primary);
    text-decoration: none;
}

.filter-pill:hover svg { opacity: 1; }

.filter-pill-clear {
    background: transparent;
    color: var(--text-muted);
    border-style: dashed;
}

.filter-pill-clear:hover {
    background: var(--danger-soft);
    border-color: rgba(239,68,68,.25);
    color: var(--danger);
}

.ticket-list-meta {
    border-top: none;
    background: var(--elevated);
}

.ticket-list-meta-text h2 {
    font-size: .95rem;
    font-weight: 600;
    letter-spacing: -.01em;
    margin-bottom: .15rem;
}

.ticket-list-meta-text p {
    font-size: .78rem;
    color: var(--text-muted);
    margin: 0;
}

.ticket-list-table { table-layout: fixed; width: 100%; }

/* Filas de especialistas/visitas: evita esmagar colunas — scroll horizontal. */
.ticket-list-table.ticket-ack-table {
    table-layout: auto;
    min-width: 1080px;
}

.ticket-list-card .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.ticket-mobile-list { display: none; }

.ticket-list-table tbody tr { transition: background var(--transition); }

.th-filterable {
    vertical-align: middle;
}

.th-col-filter {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.th-col-filter-trigger {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: 0;
    margin: 0;
    border: 0;
    box-shadow: none;
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
    color: var(--text-muted);
    font-family: inherit;
    font-size: .68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .07em;
    line-height: 1.2;
    cursor: pointer;
    border-radius: var(--radius-xs);
    transition: color var(--transition);
    white-space: nowrap;
}

.th-col-filter-trigger:hover,
.th-col-filter-trigger[aria-expanded="true"] {
    color: var(--primary);
}

.th-col-filter-trigger.is-active {
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .07em;
}

.th-col-filter-text {
    white-space: nowrap;
}

.th-col-filter-text.is-filtered {
    display: inline-block;
    padding: .2rem .5rem;
    border-radius: var(--radius-xs);
    background: var(--primary-soft);
    color: var(--primary-dark);
    font-size: .68rem;
    font-weight: 700;
    text-transform: none;
    letter-spacing: .01em;
}

.th-col-filter-chevron {
    width: 12px;
    height: 12px;
    min-width: 12px;
    min-height: 12px;
    flex-shrink: 0;
    display: block;
    color: var(--text-muted);
    opacity: .7;
    transition: transform var(--transition), color var(--transition), opacity var(--transition);
}

.th-col-filter-trigger:hover .th-col-filter-chevron,
.th-col-filter-trigger[aria-expanded="true"] .th-col-filter-chevron {
    opacity: 1;
    color: var(--primary);
}

.th-col-filter-trigger[aria-expanded="true"] .th-col-filter-chevron {
    transform: rotate(180deg);
}

.th-col-filter-menu {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    padding: .35rem;
    max-height: 280px;
    overflow-y: auto;
    animation: dropdownIn .15s ease;
}

.th-col-filter-menu[hidden] { display: none !important; }

.th-col-filter-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    padding: .5rem .65rem;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: .82rem;
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
    text-decoration: none;
    transition: background var(--transition), color var(--transition);
}

.th-col-filter-option:hover {
    background: var(--surface-2);
    color: var(--text);
    text-decoration: none;
}

.th-col-filter-option.is-selected {
    background: var(--primary-soft);
    color: var(--primary-dark);
    font-weight: 600;
}

.th-col-filter-option svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    color: var(--primary);
}

[data-theme="dark"] .th-col-filter-trigger {
    background: transparent;
}

[data-theme="dark"] .th-col-filter-text.is-filtered {
    background: rgba(37, 99, 235, .18);
    color: #93c5fd;
}

[data-theme="dark"] .th-col-filter-menu {
    background: var(--elevated);
    border-color: var(--border);
    box-shadow: var(--shadow-lg);
}

[data-theme="dark"] .th-col-filter-option:hover {
    background: rgba(255, 255, 255, .05);
}

[data-theme="dark"] .th-col-filter-option.is-selected {
    background: rgba(37, 99, 235, .2);
    color: #bfdbfe;
}

.ticket-active-filters-inline {
    padding: .85rem 1.25rem 0;
    border-bottom: none;
}

.ticket-list-row { cursor: pointer; }

.ticket-list-row:hover td { background: var(--table-row-hover); }

.ticket-list-row:hover .ticket-row-arrow {
    opacity: 1;
    transform: translateX(2px);
}

/* ── Busca global ── */
.search-global-form { margin-bottom: 1.25rem; }

.search-global-box {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .65rem .8rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
    transition: all var(--transition);
}

.search-global-box:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-ring);
}

.search-global-box svg { width: 20px; height: 20px; color: var(--text-muted); flex-shrink: 0; }

.search-global-box input {
    flex: 1;
    min-width: 0;
    border: none;
    outline: none;
    background: transparent;
    font: inherit;
    font-size: .95rem;
    color: var(--text);
}

.search-global-box input::placeholder { color: var(--text-muted); }

/* ── Anexos ── */
.anexos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: .75rem;
}

.anexo-card {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .75rem .85rem;
    background: var(--surface-2);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    color: inherit;
    transition: all var(--transition);
}

.anexo-card:hover {
    border-color: var(--hover-border);
    background: var(--primary-soft);
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: var(--shadow-xs);
}

.anexo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    border-radius: var(--radius-sm);
    background: var(--chip-icon-bg);
    color: var(--primary);
}

.anexo-icon svg { width: 19px; height: 19px; }

.anexo-info {
    display: flex;
    flex-direction: column;
    gap: .15rem;
    min-width: 0;
    flex: 1;
}

.anexo-nome {
    font-size: .82rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.anexo-meta {
    font-size: .7rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.anexo-download {
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    flex-shrink: 0;
    transition: color var(--transition);
}

.anexo-card:hover .anexo-download { color: var(--primary); }

[data-theme="dark"] .anexo-card {
    background: var(--elevated);
    border-color: var(--border);
}

.ticket-id-cell {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: .4rem;
}

.ticket-alert-badge {
    display: inline-flex;
    align-items: center;
    padding: .15rem .5rem;
    border-radius: var(--radius-full, 999px);
    font-size: .62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    background: var(--danger-soft);
    color: var(--danger);
    border: 1px solid rgba(239,68,68,.18);
}

.ticket-client-cell { max-width: 100%; min-width: 0; }

.ticket-client-name {
    display: block;
    font-size: .875rem;
    margin-bottom: .15rem;
}

.ticket-client-login {
    display: inline-block;
    font-size: .72rem;
    color: var(--text-muted);
    padding: .1rem .45rem;
    background: var(--surface-2);
    border-radius: var(--radius-xs);
    margin-bottom: .35rem;
}

.ticket-excerpt {
    font-size: .78rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin: .35rem 0 0;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.ticket-phone-link {
    font-size: .875rem;
    font-weight: 500;
    color: var(--primary);
    text-decoration: none;
}

.ticket-phone-link:hover { text-decoration: underline; }

.ticket-client-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .25rem .75rem;
    margin: .25rem 0 .35rem;
}

.ticket-client-predio {
    font-size: .78rem;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.ticket-tipo-cell {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: .4rem;
    max-width: 220px;
}

.ticket-tipo-name {
    font-size: .82rem;
    font-weight: 500;
    color: var(--text-secondary);
    line-height: 1.35;
}

.ticket-dates-cell {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: .15rem .65rem;
    align-items: baseline;
    min-width: 150px;
}

.ticket-date-label {
    font-size: .62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-muted);
}

.ticket-date {
    font-size: .82rem;
    font-variant-numeric: tabular-nums;
    color: var(--text);
}

.ticket-date-sub {
    font-size: .82rem;
    font-variant-numeric: tabular-nums;
    color: var(--text-secondary);
}

.ticket-agent-cell {
    display: flex;
    align-items: center;
    gap: .65rem;
}

.ticket-agent-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-soft), var(--surface-3));
    border: 1px solid var(--border);
    color: var(--primary);
    font-size: .62rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ticket-agent-name {
    font-size: .845rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.ticket-status-cell {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
}

.ticket-row-arrow {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    opacity: 0;
    transition: opacity var(--transition), transform var(--transition);
    flex-shrink: 0;
}

.ticket-pagination {
    justify-content: center;
    gap: 1rem;
    background: var(--surface-2);
}

.pagination-btn {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
}

.pagination-btn svg { width: 14px; height: 14px; }

.pagination-btn-disabled {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .45rem .9rem;
    font-size: .8rem;
    color: var(--text-muted);
    opacity: .45;
}

.pagination-info {
    display: flex;
    align-items: center;
    gap: .35rem;
    padding: .35rem .85rem;
    background: var(--elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: .82rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.pagination-current { color: var(--primary); }
.pagination-sep { color: var(--text-muted); font-weight: 400; }
.pagination-total { color: var(--text-secondary); }

.text-center { text-align: center; }

/* ── Utilities ── */
/* ── Empty & error states ── */
.empty-state {
    text-align: center;
    padding: 3.5rem 2rem;
    color: var(--text-muted);
}

.empty-state-icon {
    width: 56px; height: 56px;
    margin: 0 auto 1.25rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted);
}

.empty-state-icon svg { width: 24px; height: 24px; opacity: .5; }
.empty-state h3 { font-size: 1rem; font-weight: 600; color: var(--text); margin-bottom: .35rem; }
.empty-state p { font-size: .875rem; max-width: 320px; margin: 0 auto; }

.maintenance-state { padding: 3.5rem 1.5rem; }
.maintenance-state .badge { margin-bottom: 1rem; }
.maintenance-state-icon {
    background: rgba(245, 158, 11, .12);
    color: var(--warning);
}

.error-page {
    text-align: center;
    padding: 4rem 2rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
    max-width: 480px;
    margin: 2rem auto;
}

.error-code {
    font-size: 4rem;
    font-weight: 800;
    letter-spacing: -.05em;
    color: var(--border);
    line-height: 1;
    margin-bottom: .5rem;
}

.error-page h2 { font-size: 1.25rem; font-weight: 700; margin-bottom: .5rem; }

/* ── Centered form pages ── */
.form-page {
    max-width: 520px;
    margin: 0 auto;
}

.form-page-wide { max-width: 900px; margin: 0 auto; }

/* ── Animations ── */
.fade-in { animation: fadeIn .45s ease both; }

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

.stagger-1 { animation-delay: .04s; }
.stagger-2 { animation-delay: .08s; }
.stagger-3 { animation-delay: .12s; }
.stagger-4 { animation-delay: .16s; }

/* ── Dark theme ── */
/* ── Dark theme ── */
[data-theme="dark"] {
    color-scheme: dark;

    --primary: #4d9fff;
    --primary-dark: #93c5fd;
    --primary-soft: rgba(77,159,255,.12);
    --primary-ring: rgba(77,159,255,.22);
    --accent: #38bdf8;
    --success: #34d399;
    --success-soft: rgba(52,211,153,.12);
    --warning: #fbbf24;
    --warning-soft: rgba(251,191,36,.12);
    --danger: #f87171;
    --danger-soft: rgba(248,113,113,.12);
    --purple: #a78bfa;
    --purple-soft: rgba(167,139,250,.12);

    --bg: #090b10;
    --surface: #12151c;
    --surface-2: #181c25;
    --surface-3: #1f2430;
    --elevated: #151922;
    --input-bg: #0e1118;
    --chip-icon-bg: #1c212c;
    --border: rgba(255,255,255,.08);
    --border-light: rgba(255,255,255,.05);
    --text: #eef0f4;
    --text-secondary: #b4bac6;
    --text-muted: #7d8594;
    --sidebar-bg: #0c0e14;
    --sidebar-border: rgba(255,255,255,.06);
    --sidebar-hover: rgba(255,255,255,.04);
    --sidebar-active: rgba(77,159,255,.12);
    --sidebar-active-text: #93c5fd;
    --topbar-bg: rgba(12,14,20,.88);
    --table-row-hover: rgba(255,255,255,.025);
    --input-hover-border: rgba(255,255,255,.14);
    --hover-border: rgba(77,159,255,.35);
    --glow: rgba(77,159,255,.06);

    --shadow-xs: 0 1px 2px rgba(0,0,0,.4);
    --shadow: 0 0 0 1px rgba(255,255,255,.04), 0 2px 8px rgba(0,0,0,.35);
    --shadow-md: 0 0 0 1px rgba(255,255,255,.05), 0 8px 32px rgba(0,0,0,.5);
    --shadow-lg: 0 0 0 1px rgba(255,255,255,.06), 0 16px 48px rgba(0,0,0,.6);
}

[data-theme="dark"] body {
    background:
        radial-gradient(ellipse 100% 80% at 50% -30%, rgba(77,159,255,.07), transparent 60%),
        radial-gradient(ellipse 60% 50% at 100% 80%, rgba(56,189,248,.04), transparent),
        var(--bg);
}

[data-theme="dark"] .sidebar {
    box-shadow: inset -1px 0 0 rgba(255,255,255,.04);
}

[data-theme="dark"] .kpi-card:hover,
[data-theme="dark"] .quick-btn:hover,
[data-theme="dark"] .card:hover {
    box-shadow: var(--shadow), 0 0 0 1px var(--glow);
}

[data-theme="dark"] .kpi-card:hover { border-color: rgba(77,159,255,.2); }

[data-theme="dark"] .chart-card-header,
[data-theme="dark"] .card-header {
    background: rgba(255,255,255,.015);
}

[data-theme="dark"] .data-table th {
    background: rgba(255,255,255,.03);
    color: var(--text-muted);
    border-bottom-color: var(--border);
}

[data-theme="dark"] .data-table td {
    border-bottom-color: var(--border-light);
}

[data-theme="dark"] .pagination {
    background: rgba(255,255,255,.02);
}

[data-theme="dark"] .icon-btn,
[data-theme="dark"] .menu-toggle,
[data-theme="dark"] .profile-trigger {
    background: var(--elevated);
}

[data-theme="dark"] .icon-btn:hover,
[data-theme="dark"] .menu-toggle:hover {
    background: var(--surface-2);
    border-color: var(--input-hover-border);
}

[data-theme="dark"] .profile-dropdown {
    background: var(--elevated);
    box-shadow: var(--shadow-md);
}

[data-theme="dark"] .profile-dropdown-item:hover {
    background: rgba(255,255,255,.05);
}

[data-theme="dark"] .profile-dropdown-item--danger:hover {
    background: var(--danger-soft);
}

[data-theme="dark"] .nav-item.active {
    box-shadow: inset 0 0 0 1px rgba(77,159,255,.18);
}

[data-theme="dark"] .nav-badge {
    box-shadow: 0 0 8px rgba(248,113,113,.35);
}

[data-theme="dark"] .badge-default {
    background: var(--surface-2);
    border-color: var(--border);
}

[data-theme="dark"] .badge-admin {
    color: #c4b5fd;
    background: var(--purple-soft);
    border-color: rgba(167,139,250,.22);
}

[data-theme="dark"] .badge-supervisor,
[data-theme="dark"] .badge-especialistas {
    color: #c4b5fd;
    background: var(--purple-soft);
    border-color: rgba(167,139,250,.22);
}

[data-theme="dark"] .badge-atendimento {
    color: #67e8f9;
    background: rgba(8,145,178,.15);
    border-color: rgba(34,211,238,.22);
}

[data-theme="dark"] .badge-visita {
    color: #7dd3fc;
    background: rgba(14,165,233,.15);
    border-color: rgba(56,189,248,.22);
}

[data-theme="dark"] .badge-pendente {
    color: #fcd34d;
    background: var(--warning-soft);
    border-color: rgba(251,191,36,.22);
}

[data-theme="dark"] .badge-tratado {
    color: #93c5fd;
    background: var(--primary-soft);
    border-color: rgba(147,197,253,.22);
}

[data-theme="dark"] .badge-ok {
    color: #6ee7b7;
    background: var(--success-soft);
    border-color: rgba(110,231,183,.22);
}

[data-theme="dark"] .badge-presenca--online {
    color: #6ee7b7;
    background: var(--success-soft);
    border-color: rgba(110,231,183,.22);
}

[data-theme="dark"] .badge-presenca--ausente {
    color: #fcd34d;
    background: var(--warning-soft);
    border-color: rgba(252,211,77,.25);
}

[data-theme="dark"] .badge-presenca--offline {
    color: var(--text-muted);
    background: rgba(255,255,255,.05);
    border-color: rgba(255,255,255,.08);
}

[data-theme="dark"] .presence-indicator {
    border-color: var(--elevated, var(--surface));
}

[data-theme="dark"] .badge-warning {
    color: #fca5a5;
    background: var(--danger-soft);
    border-color: rgba(252,165,165,.22);
}

[data-theme="dark"] .badge-default {
    background: var(--surface-2);
    border-color: var(--border);
}

[data-theme="dark"] .alert-success {
    color: #6ee7b7;
    background: var(--success-soft);
    border-color: rgba(110,231,183,.25);
}

[data-theme="dark"] .alert-error {
    color: #fca5a5;
    background: var(--danger-soft);
    border-color: rgba(252,165,165,.25);
}

[data-theme="dark"] .alert-warning {
    color: #fcd34d;
    background: var(--warning-soft);
    border-color: rgba(252,211,77,.25);
}

[data-theme="dark"] .rank-item:nth-child(1) .rank-pos {
    background: rgba(251,191,36,.15);
    color: #fbbf24;
}

[data-theme="dark"] .rank-item:nth-child(2) .rank-pos {
    background: var(--surface-3);
    color: var(--text-muted);
}

[data-theme="dark"] .rank-item:nth-child(3) .rank-pos {
    background: rgba(251,146,60,.15);
    color: #fb923c;
}

[data-theme="dark"] .rank-item:hover {
    background: rgba(255,255,255,.03);
}

[data-theme="dark"] .rank-bar-wrap {
    background: rgba(255,255,255,.08);
}

[data-theme="dark"] .ticket-alert-badge {
    border-color: rgba(248,113,113,.22);
}

[data-theme="dark"] .ticket-filter-panel {
    background: rgba(255,255,255,.02);
}

[data-theme="dark"] .ticket-client-login {
    background: rgba(255,255,255,.04);
}

[data-theme="dark"] .ticket-agent-avatar {
    background: linear-gradient(135deg, var(--primary-soft), rgba(255,255,255,.04));
}

[data-theme="dark"] .filter-pill {
    background: var(--elevated);
}

[data-theme="dark"] .pagination-info {
    background: var(--elevated);
}

[data-theme="dark"] .ticket-num {
    background: var(--primary-soft);
    color: var(--primary-dark);
}

[data-theme="dark"] .ticket-num:hover {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 0 12px rgba(77,159,255,.35);
}

[data-theme="dark"] .setor-tag {
    color: #c4b5fd;
    border-color: rgba(167,139,250,.2);
}

[data-theme="dark"] .btn-primary {
    box-shadow: 0 2px 12px rgba(77,159,255,.25);
}

[data-theme="dark"] .btn-primary:hover {
    box-shadow: 0 4px 20px rgba(77,159,255,.35);
}

[data-theme="dark"] .btn-secondary {
    background: var(--elevated);
    border-color: var(--border);
}

[data-theme="dark"] .btn-secondary:hover {
    background: var(--surface-2);
    border-color: var(--input-hover-border);
}

[data-theme="dark"] .btn-ghost:hover {
    background: rgba(255,255,255,.05);
}

[data-theme="dark"] .sector-toolbar {
    background: rgba(255,255,255,.03);
    border-color: var(--border);
}

[data-theme="dark"] .sector-toolbar .btn-danger {
    background: rgba(248, 113, 113, .12);
    color: #f87171;
    border-color: rgba(248, 113, 113, .28);
}

[data-theme="dark"] .sector-toolbar .btn-danger:hover:not(:disabled) {
    background: #ef4444;
    color: #fff;
    border-color: #ef4444;
}

[data-theme="dark"] .form-group input:focus,
[data-theme="dark"] .form-group select:focus,
[data-theme="dark"] .form-group textarea:focus {
    box-shadow: 0 0 0 3px var(--primary-ring);
}

[data-theme="dark"] .form-group input::placeholder,
[data-theme="dark"] .form-group textarea::placeholder {
    color: #525866;
}

[data-theme="dark"] .form-group select option {
    background: var(--surface);
    color: var(--text);
}

[data-theme="dark"] .filter-bar {
    background: var(--elevated);
    border-color: var(--border);
}

[data-theme="dark"] .detail-highlight {
    background: var(--primary-soft);
    border-color: rgba(77,159,255,.2);
}

[data-theme="dark"] .ticket-about-head {
    border-bottom-color: var(--border);
}

[data-theme="dark"] .ticket-about-meta {
    border-top-color: var(--border);
    border-bottom-color: var(--border);
}

[data-theme="dark"] .ticket-about-meta-item + .ticket-about-meta-item {
    border-left-color: var(--border);
}

[data-theme="dark"] .ticket-about-block-content {
    background: var(--elevated);
    border-color: var(--border);
}

[data-theme="dark"] .timeline-item {
    background: var(--elevated);
    border-color: var(--border);
}

[data-theme="dark"] .timeline-item::before {
    background: var(--primary);
    border-color: var(--elevated);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

[data-theme="dark"] .timeline-item:not(:last-child)::after {
    background: var(--border);
}

[data-theme="dark"] .cliente-result {
    background: rgba(255,255,255,.02);
    border-color: var(--border);
}

[data-theme="dark"] .sector-row td {
    background: rgba(255,255,255,.025) !important;
}

[data-theme="dark"] .empty-state-icon {
    background: var(--surface-2);
    border-color: var(--border);
}

[data-theme="dark"] .error-page {
    background: var(--elevated);
    box-shadow: var(--shadow-md);
}

[data-theme="dark"] .error-code {
    color: var(--surface-3);
}

[data-theme="dark"] .card-count {
    background: var(--surface-2);
    border-color: var(--border);
}

[data-theme="dark"] .auth-page {
    background:
        radial-gradient(ellipse 80% 60% at 20% 10%, rgba(77,159,255,.12), transparent),
        radial-gradient(ellipse 60% 50% at 85% 90%, rgba(56,189,248,.08), transparent),
        linear-gradient(145deg, #060810 0%, #0c1220 45%, #0a1628 100%);
}

[data-theme="dark"] .auth-page::before {
    opacity: .6;
}

[data-theme="dark"] .login-card {
    background: var(--elevated);
    border-color: rgba(255,255,255,.08);
    box-shadow: var(--shadow-lg);
}

[data-theme="dark"] .login-card .brand-icon {
    box-shadow: 0 4px 20px rgba(77,159,255,.3);
}

[data-theme="dark"] .auth-theme-toggle {
    background: rgba(255,255,255,.06);
    border-color: rgba(255,255,255,.1);
    color: var(--text-secondary);
    backdrop-filter: blur(12px);
}

[data-theme="dark"] .auth-theme-toggle:hover {
    background: rgba(255,255,255,.1);
    color: var(--text);
}

[data-theme="dark"] ::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

[data-theme="dark"] ::-webkit-scrollbar-track {
    background: transparent;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,.12);
    border-radius: 4px;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,.18);
}

[data-theme="dark"] .checkbox-label {
    background: var(--elevated);
}

[data-theme="dark"] .checkbox-label:hover {
    background: var(--primary-soft);
}

[data-theme="dark"] .link {
    color: var(--primary-dark);
}

[data-theme="dark"] a:hover {
    color: #bfdbfe;
}

[data-theme="dark"] .demo-hint {
    background: var(--primary-soft);
    color: var(--primary-dark);
}

[data-theme="dark"] .sidebar-nav,
[data-theme="dark"] .table-responsive {
    scrollbar-color: rgba(255,255,255,.12) transparent;
}

/* ── Responsive ── */
/* ── Auth theme toggle ── */
.auth-theme-toggle {
    position: fixed;
    top: 1.25rem;
    right: 1.25rem;
    z-index: 10;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255,255,255,.15);
    border-radius: var(--radius-md);
    background: rgba(255,255,255,.1);
    color: #fff;
    cursor: pointer;
    backdrop-filter: blur(8px);
    transition: all var(--transition);
}

.auth-theme-toggle:hover { background: rgba(255,255,255,.18); }

/* ── Responsive ── */
@media (max-width: 1280px) {
    .kpi-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 1024px) {
    .charts-row, .charts-row-2, .charts-row-3 { grid-template-columns: 1fr; }
    .report-metrics-grid { grid-template-columns: repeat(2, 1fr); }
    .report-filter-row { grid-template-columns: 1fr; }
    .quick-grid { grid-template-columns: repeat(2, 1fr); }
    .grid-2 { grid-template-columns: 1fr; }
    .ticket-layout { grid-template-columns: 1fr; }
    .ticket-form-side { position: static; }
    .tipo-selector { grid-template-columns: repeat(2, 1fr); }
    .ticket-list-stats {
        display: flex;
        overflow-x: auto;
        gap: .65rem;
        padding-bottom: .35rem;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
    }
    .ticket-list-stats .ticket-stat-chip {
        flex: 0 0 auto;
        min-width: 9.5rem;
    }
    .ticket-filter-row { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
    .sidebar.open { transform: translateX(0); }
    .main-area { margin-left: 0; }
    .menu-toggle { display: flex; }
    .kpi-grid, .quick-grid, .tipo-selector, .form-grid { grid-template-columns: 1fr; }
    .content { padding: 1.25rem; }
    .topbar { padding: 0 1rem; grid-template-columns: minmax(0, 1fr) auto; }
    .topbar-meta, .topbar-center { display: none; }
    .user-login { display: none; }
    .page-header { flex-direction: column; }
    .detail-list { grid-template-columns: 1fr; gap: .25rem; }
    .detail-list dt { margin-top: .5rem; }
    .ticket-about-meta { grid-template-columns: 1fr; gap: .75rem; }
    .ticket-about-meta-item + .ticket-about-meta-item {
        padding-left: 0;
        padding-top: .75rem;
        border-left: none;
        border-top: 1px solid var(--border-light);
    }
    .ticket-list-search { grid-template-columns: 1fr; }
    .ticket-search-actions { grid-column: 1; justify-content: flex-start; }
    .ticket-status-cell .ticket-row-arrow { opacity: .35; }
    .ticket-preview-summary { grid-template-columns: 1fr; }
    .ticket-preview-modal { padding: .75rem; }
    .ticket-preview-dialog { max-height: 92vh; }

    .ticket-list-desktop { display: none; }
    .ticket-mobile-list {
        display: flex;
        flex-direction: column;
        gap: .65rem;
        padding: .85rem 1rem 1.1rem;
    }
    .ticket-mobile-card {
        display: flex;
        flex-direction: column;
        gap: .4rem;
        padding: .95rem 1rem;
        background: var(--elevated);
        border: 1px solid var(--border);
        border-radius: var(--radius-lg);
        text-decoration: none;
        color: inherit;
        transition: border-color var(--transition), box-shadow var(--transition);
    }
    .ticket-mobile-card:hover {
        text-decoration: none;
        border-color: var(--primary);
        box-shadow: var(--shadow-xs);
    }
    .ticket-mobile-card.is-urgent {
        border-left: 3px solid var(--warning, #d97706);
    }
    .ticket-mobile-card.is-sla-vencendo {
        border-left-color: var(--warning, #d97706);
    }
    .ticket-mobile-card.is-sla-vencido {
        border-left-color: var(--danger);
    }
    .ticket-mobile-card-top {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: .5rem;
    }
    .ticket-mobile-client {
        font-size: .95rem;
        line-height: 1.3;
    }
    .ticket-mobile-card-meta {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: .4rem .65rem;
        font-size: .78rem;
        color: var(--text-muted);
    }
    .ticket-mobile-date { margin-left: auto; }

    .ticket-header {
        padding: 1rem 1.1rem;
        gap: .75rem;
    }
    .ticket-number { font-size: 1.35rem; }
    .ticket-actions {
        width: 100%;
        justify-content: flex-start;
    }
    .ticket-actions .btn {
        flex: 0 1 auto;
    }
    .ticket-tags-panel .card-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: .5rem;
    }
}
/* ── Subtipo selector ── */
/* Subtipo selector (Cliente / Rede) */
.tipo-subselector {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.tipo-subchip {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.65rem 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    text-decoration: none;
    transition: border-color 0.15s, background 0.15s;
    min-width: 10rem;
}

.tipo-subchip:hover {
    border-color: var(--primary);
}

.tipo-subchip.active {
    border-color: var(--primary);
    background: var(--primary-soft);
}

.tipo-subchip small {
    color: var(--text-muted);
    font-size: 0.78rem;
}

/* Logout form no dropdown */
.profile-logout-form {
    margin: 0;
}
.profile-logout-form .profile-dropdown-item {
    width: 100%;
    border: 0;
    background: transparent;
    cursor: pointer;
    font: inherit;
    text-align: left;
}

/* Tags */
.tag-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.25;
    color: var(--tag-color, #64748b);
    background: color-mix(in srgb, var(--tag-color, #64748b) 14%, transparent);
    border: 1px solid color-mix(in srgb, var(--tag-color, #64748b) 35%, transparent);
}
.tag-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.tag-check {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
    padding: 0.15rem;
    border-radius: var(--radius-md);
}
.tag-check:hover {
    background: var(--surface-2);
}
.tag-check input {
    width: 1rem;
    height: 1rem;
    accent-color: var(--primary);
}
.tag-color-field {
    display: flex;
    align-items: center;
    gap: .75rem;
}
.tag-color-field input[type="color"] {
    width: 3rem;
    height: 2.4rem;
    padding: .15rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--input-bg);
    cursor: pointer;
}
.tags-admin-table {
    width: 100%;
    border-collapse: collapse;
}
.tags-admin-table th,
.tags-admin-table td {
    padding: .85rem 1.1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}
.tags-admin-table th {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-muted);
    background: var(--surface-2);
}
.tags-admin-cor {
    font-size: .78rem;
    color: var(--text-muted);
}
.ticket-tags-panel .card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
}
.ticket-tags-form .form-actions {
    margin-top: .85rem;
}
.ticket-related-table { table-layout: fixed; width: 100%; }

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    cursor: pointer;
}

/* Reclassificação ISP */
.reclass-hint {
    margin: 0 0 0.65rem;
    color: var(--text-muted);
    font-size: 0.82rem;
    line-height: 1.4;
}
.reclass-fields label {
    display: block;
    margin-top: 0.65rem;
    margin-bottom: 0.3rem;
    font-size: 0.82rem;
    font-weight: 600;
}
.reclass-fields label:first-child { margin-top: 0; }
.reclass-preview {
    margin-top: 0.75rem;
    padding: 0.75rem 0.9rem;
    border-radius: 8px;
    background: var(--surface-2, #f1f5f9);
    border: 1px solid var(--border);
    font-size: 0.85rem;
}
.reclass-preview p { margin: 0.35rem 0 0; line-height: 1.45; }
.reclass-warn { color: var(--warning, #b45309); }
.badge-reclass {
    background: color-mix(in srgb, #d97706 16%, transparent);
    color: #b45309;
    border: 1px solid color-mix(in srgb, #d97706 40%, transparent);
}
.timeline-item--reclass {
    border-left-color: #d97706;
}
.reclass-event {
    margin-top: 0.25rem;
    padding: 0.4rem 0.6rem;
    border-radius: 8px;
    background: color-mix(in srgb, #d97706 8%, transparent);
    border: 1px solid color-mix(in srgb, #d97706 28%, transparent);
}
.reclass-event-path {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    font-weight: 600;
    font-size: 0.88rem;
}
.reclass-arrow { color: var(--text-muted); font-weight: 700; }
.reclass-event-meta {
    margin-top: 0.35rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* Providências do supervisor */
.providencia-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .75rem;
    margin-bottom: 1.25rem;
}
.providencia-metric {
    display: flex;
    flex-direction: column;
    gap: .35rem;
    padding: .85rem 1rem;
    background: var(--elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}
.providencia-metric-label {
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-muted);
}
.providencia-metric strong {
    font-size: .95rem;
    font-weight: 650;
    color: var(--text);
}
.providencia-layout {
    display: grid;
    grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
    gap: 1.25rem;
    align-items: start;
}
.providencia-context {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    min-width: 0;
}
.providencia-obs-card {
    border-top: 3px solid var(--warning, #d97706);
}
.providencia-obs-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: .5rem;
    margin-bottom: .45rem;
}
.providencia-obs-head strong {
    font-size: .82rem;
}
.providencia-obs-head span {
    font-size: .75rem;
    color: var(--text-muted);
}
.providencia-obs--escalacao {
    padding: .75rem .85rem;
    border-radius: 8px;
    background: color-mix(in srgb, #d97706 8%, transparent);
    border: 1px solid color-mix(in srgb, #d97706 28%, transparent);
}
.providencia-bottom {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(260px, 1fr);
    gap: 1.25rem;
    margin-top: 1.25rem;
    align-items: start;
}
.providencia-bottom-side {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    min-width: 0;
}
.timeline-item--escalacao {
    border-left-color: #d97706;
}
.ticket-sla-cell {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: .3rem;
}
.ticket-wait-meta {
    font-size: .72rem;
    color: var(--text-muted);
    line-height: 1.3;
}
@media (max-width: 1100px) {
    .providencia-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
    .providencia-layout,
    .providencia-bottom { grid-template-columns: 1fr; }
}
.providencia-opcoes {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}
.providencia-opcao {
    display: flex;
    gap: 0.65rem;
    align-items: flex-start;
    padding: 0.75rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    background: var(--surface);
}
.providencia-opcao:has(input:checked) {
    border-color: var(--primary);
    background: var(--primary-soft, color-mix(in srgb, var(--primary) 10%, transparent));
}
.providencia-opcao strong { display: block; font-size: 0.9rem; }
.providencia-opcao small { display: block; color: var(--text-muted); margin-top: 0.15rem; line-height: 1.35; }
.providencia-opcao em {
    display: block;
    margin-top: 0.3rem;
    font-style: normal;
    font-size: 0.75rem;
    color: var(--primary);
    font-weight: 600;
}
.timeline-item--providencia { border-left-color: var(--primary); }

/* API tokens (Configuração) */
.api-docs-title {
    font-size: 1rem;
    font-weight: 650;
    margin: 0 0 .5rem;
}
.api-docs-subtitle {
    font-size: .88rem;
    font-weight: 600;
    margin: 1.25rem 0 .4rem;
}
.api-token-reveal {
    border-color: #a7f3d0;
    background: var(--success-soft);
    margin-bottom: 1rem;
}
.api-token-copy-row {
    display: flex;
    gap: .65rem;
    align-items: center;
    flex-wrap: wrap;
    margin-top: .75rem;
}
.api-token-plain {
    display: block;
    flex: 1;
    min-width: 0;
    padding: .65rem .8rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: .78rem;
    word-break: break-all;
}
.api-code-block {
    margin: .4rem 0 0;
    padding: .85rem 1rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: .75rem;
    line-height: 1.45;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
}
.api-endpoint-list {
    margin: .35rem 0 0;
    padding-left: 1.15rem;
    color: var(--text);
    font-size: .85rem;
}
.api-endpoint-list li { margin: .25rem 0; }
.api-endpoint-list code { font-size: .78rem; }

/* ── Clientes ── */
.clientes-search-panel {
    overflow: hidden;
    margin-bottom: 1.35rem;
}

.clientes-search-hero {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.35rem 1.5rem 1.15rem;
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--primary) 8%, transparent), transparent 55%),
        linear-gradient(225deg, color-mix(in srgb, var(--accent) 7%, transparent), transparent 50%),
        var(--surface);
    border-bottom: 1px solid var(--border-light);
}

.clientes-search-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, var(--primary) 12%, transparent);
    color: var(--primary);
    flex-shrink: 0;
}

.clientes-search-icon svg { width: 22px; height: 22px; }

.clientes-search-copy h3 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -.02em;
}

.clientes-search-copy p {
    margin: .3rem 0 0;
    color: var(--text-muted);
    font-size: .86rem;
    max-width: 52rem;
    line-height: 1.45;
}

.clientes-search-form {
    padding: 1.25rem 1.5rem 1.4rem;
}

.clientes-search-fields {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.clientes-field-icon {
    position: relative;
}

.clientes-field-icon svg {
    position: absolute;
    left: .85rem;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    pointer-events: none;
}

.clientes-field-icon input {
    width: 100%;
    padding-left: 2.45rem;
}

.clientes-search-actions {
    display: flex;
    align-items: center;
    gap: .55rem;
    flex-wrap: wrap;
}

.clientes-hints {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .9rem;
}

.clientes-hint {
    display: flex;
    gap: .85rem;
    align-items: flex-start;
    padding: 1.1rem 1.15rem;
    background: var(--elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
}

.clientes-hint-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-soft);
    color: var(--primary);
    flex-shrink: 0;
}

.clientes-hint-icon svg { width: 18px; height: 18px; }

.clientes-hint strong {
    display: block;
    font-size: .88rem;
    font-weight: 650;
    margin-bottom: .2rem;
}

.clientes-hint p {
    margin: 0;
    color: var(--text-muted);
    font-size: .8rem;
    line-height: 1.4;
}

.clientes-results {
    margin-top: .25rem;
}

.clientes-results-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: .9rem;
}

.clientes-results-head h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -.02em;
}

.clientes-results-head p {
    margin: .2rem 0 0;
    color: var(--text-muted);
    font-size: .82rem;
}

.clientes-results-list {
    display: flex;
    flex-direction: column;
    gap: .75rem;
}

.clientes-result-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
    padding: 1.1rem 1.25rem;
    background: var(--elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
    text-decoration: none;
    color: inherit;
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.clientes-result-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    border-color: var(--hover-border);
    text-decoration: none;
    color: inherit;
}

.clientes-result-main {
    display: flex;
    align-items: flex-start;
    gap: .95rem;
    min-width: 0;
    flex: 1;
}

.clientes-avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff;
    font-size: .8rem;
    font-weight: 700;
    letter-spacing: .02em;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(37, 99, 235, .22);
}

.clientes-avatar-lg {
    width: 72px;
    height: 72px;
    font-size: 1.2rem;
    box-shadow: 0 8px 24px rgba(37, 99, 235, .25);
}

.clientes-result-body { min-width: 0; }

.clientes-result-title {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .45rem .55rem;
    margin-bottom: .45rem;
}

.clientes-result-title strong {
    font-size: .98rem;
    font-weight: 700;
    letter-spacing: -.02em;
}

.clientes-result-meta {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem .85rem;
    color: var(--text-muted);
    font-size: .8rem;
}

.clientes-result-meta span,
.clientes-result-meta a {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    min-width: 0;
}

.clientes-result-meta svg {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
    opacity: .75;
}

.clientes-result-addr {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.clientes-result-side {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

.clientes-result-stats {
    display: flex;
    gap: .45rem;
}

.clientes-mini-stat {
    min-width: 58px;
    text-align: center;
    padding: .45rem .55rem;
    background: var(--surface-2);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
}

.clientes-mini-stat.is-warn {
    background: var(--warning-soft);
    border-color: #fde68a;
}

.clientes-mini-stat-value {
    display: block;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -.03em;
    line-height: 1;
    color: var(--text);
}

.clientes-mini-stat.is-warn .clientes-mini-stat-value { color: #b45309; }

.clientes-mini-stat-label {
    display: block;
    margin-top: .2rem;
    font-size: .65rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
}

.clientes-result-cta {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    font-size: .8rem;
    font-weight: 650;
    color: var(--primary);
    white-space: nowrap;
}

.clientes-result-cta svg { width: 16px; height: 16px; }

.clientes-result-card:hover .clientes-result-cta { color: var(--primary-dark); }

.clientes-ficha { display: flex; flex-direction: column; gap: 0; }

.clientes-back {
    margin: 0 0 .85rem;
}

.clientes-back a {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    color: var(--text-muted);
    font-size: .84rem;
    font-weight: 550;
}

.clientes-back a:hover { color: var(--primary); }

.clientes-back svg { width: 15px; height: 15px; }

.clientes-profile-card {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.25rem;
    padding: 1.4rem 1.5rem;
    margin-bottom: 1rem;
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--primary) 9%, transparent), transparent 50%),
        linear-gradient(225deg, color-mix(in srgb, var(--accent) 8%, transparent), transparent 45%),
        var(--elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
}

.clientes-profile-main {
    display: flex;
    align-items: flex-start;
    gap: 1.1rem;
    min-width: 0;
}

.clientes-profile-title-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .5rem .65rem;
}

.clientes-profile-title-row h2 {
    margin: 0;
    font-size: 1.45rem;
    font-weight: 750;
    letter-spacing: -.03em;
    line-height: 1.2;
}

.clientes-profile-sub {
    margin: .35rem 0 .75rem;
    color: var(--text-muted);
    font-size: .86rem;
}

.clientes-profile-chips {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
}

.clientes-chip {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .35rem .7rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 550;
    color: var(--text-secondary);
    box-shadow: var(--shadow-xs);
}

.clientes-chip svg {
    width: 13px;
    height: 13px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.clientes-chip-link {
    text-decoration: none;
    color: var(--primary);
}

.clientes-chip-link:hover {
    border-color: var(--hover-border);
    background: var(--primary-soft);
}

.clientes-profile-actions {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.clientes-kpi-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .75rem;
    margin-bottom: 1.15rem;
}

.clientes-kpi {
    display: flex;
    align-items: center;
    gap: .85rem;
    padding: 1rem 1.1rem;
    background: var(--elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
    --kpi-tone: var(--primary);
}

.clientes-kpi.is-warn { --kpi-tone: var(--warning); }
.clientes-kpi.is-ok { --kpi-tone: var(--success); }
.clientes-kpi.is-total { --kpi-tone: var(--accent); }
.clientes-kpi.is-muted { --kpi-tone: var(--text-muted); }

.clientes-kpi-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, var(--kpi-tone) 12%, transparent);
    color: var(--kpi-tone);
    flex-shrink: 0;
}

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

.clientes-kpi-value {
    font-size: 1.45rem;
    font-weight: 750;
    letter-spacing: -.04em;
    line-height: 1;
    color: var(--kpi-tone);
}

.clientes-kpi-value-sm {
    font-size: .92rem;
    letter-spacing: -.01em;
    color: var(--text);
    font-weight: 650;
}

.clientes-kpi-label {
    margin-top: .3rem;
    font-size: .72rem;
    font-weight: 600;
    color: var(--text-muted);
}

.clientes-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .85rem;
}

.clientes-info-item {
    padding: .85rem .95rem;
    background: var(--surface-2);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    min-width: 0;
}

.clientes-info-wide { grid-column: 1 / -1; }

.clientes-info-label {
    display: block;
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-muted);
    margin-bottom: .3rem;
}

.clientes-info-item strong {
    display: block;
    font-size: .9rem;
    font-weight: 600;
    color: var(--text);
    word-break: break-word;
}

[data-theme="dark"] .clientes-search-hero,
[data-theme="dark"] .clientes-profile-card {
    background:
        linear-gradient(135deg, rgba(77,159,255,.1), transparent 55%),
        linear-gradient(225deg, rgba(14,165,233,.08), transparent 50%),
        var(--elevated);
}

[data-theme="dark"] .clientes-hint,
[data-theme="dark"] .clientes-result-card,
[data-theme="dark"] .clientes-kpi,
[data-theme="dark"] .clientes-chip {
    background: var(--elevated);
}

[data-theme="dark"] .clientes-mini-stat,
[data-theme="dark"] .clientes-info-item {
    background: var(--surface-3);
}

[data-theme="dark"] .clientes-mini-stat.is-warn {
    background: rgba(245, 158, 11, .12);
    border-color: rgba(245, 158, 11, .28);
}

@media (max-width: 1024px) {
    .clientes-hints { grid-template-columns: 1fr; }
    .clientes-kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .clientes-search-fields { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .clientes-result-card {
        flex-direction: column;
        align-items: stretch;
    }

    .clientes-result-side {
        justify-content: space-between;
        padding-top: .35rem;
        border-top: 1px solid var(--border-light);
    }

    .clientes-profile-card {
        flex-direction: column;
        padding: 1.15rem;
    }

    .clientes-profile-main {
        flex-direction: column;
        align-items: flex-start;
    }

    .clientes-kpi-row { grid-template-columns: 1fr 1fr; }
    .clientes-info-grid { grid-template-columns: 1fr; }
    .clientes-info-wide { grid-column: auto; }
}

/* Acessibilidade: foco visível + reduced motion */
:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

