:root {
    color-scheme: dark;
    --bg: #07111f;
    --bg-soft: #0a1728;
    --panel: #0f2035;
    --panel-2: #132a43;
    --line: rgba(153, 213, 255, .16);
    --text: #edf8ff;
    --muted: #9bb2c4;
    --accent: #18c8f5;
    --accent-2: #4a8dff;
    --success: #36d58a;
    --warning: #ffcb55;
    --danger: #ff6978;
    --shadow: 0 24px 60px rgba(0, 0, 0, .34);
    --radius: 20px;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    background:
        radial-gradient(circle at 15% -10%, rgba(24, 200, 245, .18), transparent 36%),
        radial-gradient(circle at 90% 0%, rgba(74, 141, 255, .14), transparent 30%),
        var(--bg);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }

.app-shell, .staff-shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px clamp(16px, 4vw, 52px);
    border-bottom: 1px solid var(--line);
    background: rgba(7, 17, 31, .86);
    backdrop-filter: blur(18px);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-icon {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    display: grid;
    place-items: center;
    border-radius: 13px;
    color: #031018;
    font-weight: 900;
    font-size: 21px;
    background: linear-gradient(135deg, var(--accent), #83e8ff);
    box-shadow: 0 9px 26px rgba(24, 200, 245, .26);
}
.brand strong { display: block; font-size: 1.02rem; letter-spacing: .01em; }
.brand small { display: block; margin-top: 2px; color: var(--muted); font-size: .77rem; }
.topbar-actions { display: flex; align-items: center; gap: 9px; }

.main-content, .staff-main {
    width: min(1180px, calc(100% - 30px));
    margin: 0 auto;
    padding: 28px 0 52px;
    flex: 1;
}
.staff-main { width: min(1400px, calc(100% - 24px)); }

.hero-card, .user-summary {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    padding: clamp(24px, 5vw, 52px);
    margin-bottom: 24px;
    overflow: hidden;
    position: relative;
    border: 1px solid var(--line);
    border-radius: 28px;
    background:
        linear-gradient(135deg, rgba(24, 200, 245, .13), transparent 52%),
        linear-gradient(160deg, var(--panel), #0b192a);
    box-shadow: var(--shadow);
}
.hero-card::after, .user-summary::after {
    content: "";
    position: absolute;
    right: -70px;
    top: -90px;
    width: 250px;
    height: 250px;
    border-radius: 999px;
    border: 38px solid rgba(24, 200, 245, .06);
}
.hero-card h1, .user-summary h1 { max-width: 760px; margin: 8px 0 12px; font-size: clamp(2rem, 5vw, 4.4rem); line-height: .98; letter-spacing: -.045em; }
.user-summary h1 { font-size: clamp(1.8rem, 4vw, 3.4rem); }
.hero-card p, .user-summary p { max-width: 700px; margin: 0; color: var(--muted); line-height: 1.65; }
.eyebrow { color: var(--accent); font-size: .75rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.hero-status, .live-chip, .connection-badge {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 10px 14px;
    border: 1px solid rgba(54, 213, 138, .22);
    border-radius: 999px;
    color: #caffdf;
    background: rgba(54, 213, 138, .08);
    font-size: .8rem;
    font-weight: 750;
}
.live-dot { width: 9px; height: 9px; border-radius: 999px; background: var(--success); box-shadow: 0 0 0 5px rgba(54, 213, 138, .12); }
.connection-badge.offline { color: #ffd4d8; border-color: rgba(255,105,120,.25); background: rgba(255,105,120,.09); }
.connection-badge.offline .live-dot { background: var(--danger); box-shadow: 0 0 0 5px rgba(255,105,120,.12); }

.auth-grid, .dashboard-grid { display: grid; grid-template-columns: .9fr 1.35fr; gap: 24px; align-items: start; }
.dashboard-grid { grid-template-columns: minmax(300px, .78fr) minmax(0, 1.5fr); }
.panel {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: linear-gradient(160deg, rgba(19, 42, 67, .78), rgba(10, 23, 40, .94));
    box-shadow: 0 18px 45px rgba(0, 0, 0, .22);
    padding: clamp(20px, 3.5vw, 32px);
}
.panel-heading { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 24px; }
.panel-heading.compact { margin-bottom: 20px; }
.panel-number {
    min-width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(24, 200, 245, .26);
    border-radius: 12px;
    color: var(--accent);
    background: rgba(24, 200, 245, .07);
    font-weight: 900;
}
.panel-heading h1, .panel-heading h2 { margin: 0; font-size: 1.25rem; }
.panel-heading p { margin: 5px 0 0; color: var(--muted); font-size: .9rem; line-height: 1.45; }

.form-stack { display: grid; gap: 15px; }
.form-stack label:not(.check-row), .field-grid label { display: grid; gap: 7px; }
.form-stack label > span { color: #c9dce9; font-size: .82rem; font-weight: 720; }
input, textarea, select {
    width: 100%;
    min-height: 48px;
    border: 1px solid rgba(155, 178, 196, .22);
    border-radius: 13px;
    outline: 0;
    color: var(--text);
    background: rgba(3, 12, 23, .7);
    padding: 12px 14px;
    transition: border-color .2s, box-shadow .2s, transform .2s;
}
textarea { resize: vertical; min-height: 132px; line-height: 1.52; }
select { appearance: auto; }
input:focus, textarea:focus, select:focus { border-color: rgba(24, 200, 245, .82); box-shadow: 0 0 0 4px rgba(24, 200, 245, .09); }
input::placeholder, textarea::placeholder { color: #6f879a; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check-row { display: flex; align-items: center; gap: 10px; padding: 3px 0; cursor: pointer; }
.check-row input { width: 19px; min-height: 19px; accent-color: var(--accent); }
.check-row span { color: var(--text) !important; }
.privacy-note { margin: -3px 0 0; color: var(--muted); font-size: .76rem; line-height: 1.5; }

.button, .icon-button {
    border: 0;
    color: var(--text);
    transition: transform .18s, filter .18s, background .18s;
}
.button:hover, .icon-button:hover { filter: brightness(1.08); }
.button:active, .icon-button:active { transform: translateY(1px) scale(.99); }
.button { min-height: 48px; padding: 11px 17px; border-radius: 13px; font-weight: 850; }
.button-primary { color: #00131b; background: linear-gradient(135deg, var(--accent), #7de8ff); box-shadow: 0 13px 30px rgba(24, 200, 245, .18); }
.button-secondary { color: #f5fbff; background: linear-gradient(135deg, var(--accent-2), #696eff); }
.button-danger { color: #fff; background: linear-gradient(135deg, #ff5f74, #e53b55); }
.button-success { color: #00140c; background: linear-gradient(135deg, var(--success), #83f1b9); }
.button-warning { color: #211600; background: linear-gradient(135deg, var(--warning), #ffe29a); }
.button-ghost { min-height: 42px; border: 1px solid var(--line); background: rgba(255, 255, 255, .035); }
.button-small { min-height: 38px; padding: 8px 13px; font-size: .8rem; }
.icon-button { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; font-size: 1.35rem; border: 1px solid var(--line); background: rgba(255,255,255,.035); }
.button[disabled], .icon-button[disabled] { opacity: .5; cursor: wait; }

.alert { margin-bottom: 20px; padding: 14px 17px; border-radius: 14px; border: 1px solid; font-size: .9rem; }
.alert-success { color: #d4ffe5; background: rgba(54,213,138,.1); border-color: rgba(54,213,138,.25); }
.alert-error { color: #ffd9dd; background: rgba(255,105,120,.1); border-color: rgba(255,105,120,.26); }

.section-title-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 15px; }
.section-title-row h2 { margin: 5px 0 0; font-size: 1.35rem; }
.ticket-list, .staff-queue { display: grid; gap: 13px; }
.ticket-card {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 17px;
    background: linear-gradient(160deg, rgba(18, 39, 63, .92), rgba(8, 19, 33, .96));
    box-shadow: 0 12px 30px rgba(0,0,0,.16);
    padding: 17px;
}
.ticket-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--warning); }
.ticket-card[data-status="on_the_way"]::before { background: var(--accent-2); }
.ticket-card[data-status="resolved"]::before { background: var(--success); }
.ticket-card[data-status="cancelled"]::before { background: var(--danger); }
.ticket-card.staff-ticket { cursor: pointer; }
.ticket-card.staff-ticket:hover { border-color: rgba(24, 200, 245, .35); transform: translateY(-1px); }
.ticket-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.ticket-protocol { margin: 0; font-size: .95rem; letter-spacing: .02em; }
.ticket-meta { margin-top: 5px; color: var(--muted); font-size: .76rem; }
.status-badge { display: inline-flex; align-items: center; white-space: nowrap; padding: 6px 9px; border-radius: 999px; color: #2b1b00; background: var(--warning); font-size: .69rem; font-weight: 900; text-transform: uppercase; letter-spacing: .06em; }
.status-badge.status-on-the-way { color: #fff; background: var(--accent-2); }
.status-badge.status-resolved { color: #002315; background: var(--success); }
.status-badge.status-cancelled { color: #fff; background: var(--danger); }
.ticket-sector { margin: 15px 0 5px; color: #dff7ff; font-weight: 820; }
.ticket-problem { margin: 0; color: #b8cad7; line-height: 1.52; white-space: pre-wrap; overflow-wrap: anywhere; }
.ticket-person { margin: 12px 0 0; color: var(--muted); font-size: .8rem; }
.ticket-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 15px; }
.ticket-actions .button { min-height: 39px; padding: 8px 12px; font-size: .78rem; }
.empty-state { text-align: center; padding: 45px 20px; border: 1px dashed rgba(155,178,196,.25); border-radius: 18px; color: var(--muted); background: rgba(255,255,255,.018); }
.empty-state strong { display: block; margin-bottom: 5px; color: var(--text); }
.footer { padding: 22px; color: #688095; text-align: center; font-size: .74rem; border-top: 1px solid rgba(153,213,255,.08); }

.staff-login { max-width: 560px; margin: 6vh auto 0; }
.stats-grid { display: grid; grid-template-columns: repeat(5, minmax(120px, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat-card {
    min-height: 82px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 10px;
    padding: 15px;
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: 15px;
    background: rgba(15, 32, 53, .75);
}
.stat-card span { color: var(--muted); font-size: .76rem; font-weight: 750; }
.stat-card strong { font-size: 1.75rem; line-height: 1; }
.stat-card.active { border-color: rgba(24,200,245,.7); box-shadow: inset 0 0 0 1px rgba(24,200,245,.18), 0 12px 30px rgba(0,0,0,.14); }
.stat-card.status-pending strong { color: var(--warning); }
.stat-card.status-on-the-way strong { color: #79a7ff; }
.stat-card.status-resolved strong { color: var(--success); }
.stat-card.status-cancelled strong { color: var(--danger); }
.queue-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 14px; }
.search-box { flex: 1; max-width: 680px; position: relative; }
.search-box span { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 1.15rem; }
.search-box input { padding-left: 42px; }
.last-update { color: var(--muted); font-size: .74rem; }
.staff-queue { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-message { min-height: 20px; margin: 0; color: var(--danger); font-size: .82rem; }

.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: end center; padding: 18px; background: rgba(0, 5, 12, .78); backdrop-filter: blur(10px); }
.ticket-modal { width: min(720px, 100%); max-height: calc(100vh - 36px); overflow: auto; border: 1px solid var(--line); border-radius: 24px; background: #0a1728; box-shadow: 0 30px 90px rgba(0,0,0,.55); }
.ticket-modal > header { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px; border-bottom: 1px solid var(--line); background: rgba(10,23,40,.94); backdrop-filter: blur(12px); }
.ticket-modal h2 { margin: 5px 0 0; }
.modal-content { padding: 20px; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.detail-box { padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.025); }
.detail-box.wide { grid-column: 1 / -1; }
.detail-box span { display: block; margin-bottom: 6px; color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; }
.detail-box strong, .detail-box p { margin: 0; line-height: 1.5; overflow-wrap: anywhere; }
.timeline { display: grid; gap: 10px; margin-top: 18px; }
.timeline-item { display: grid; grid-template-columns: 11px 1fr; gap: 10px; color: var(--muted); font-size: .8rem; }
.timeline-dot { width: 9px; height: 9px; margin-top: 5px; border-radius: 999px; background: var(--accent); box-shadow: 0 0 0 4px rgba(24,200,245,.1); }
.modal-actions { position: sticky; bottom: 0; display: flex; flex-wrap: wrap; gap: 9px; padding: 16px 20px 20px; border-top: 1px solid var(--line); background: rgba(10,23,40,.95); backdrop-filter: blur(12px); }
.modal-actions .button { flex: 1; min-width: 135px; }
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 200; transform: translateX(-50%); max-width: calc(100% - 30px); padding: 12px 16px; border-radius: 13px; color: #00150d; background: var(--success); box-shadow: var(--shadow); font-weight: 800; font-size: .82rem; }
.toast.error { color: #fff; background: var(--danger); }

@media (max-width: 920px) {
    .auth-grid, .dashboard-grid { grid-template-columns: 1fr; }
    .ticket-form-panel { position: static; }
    .stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .staff-queue { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
    .topbar { min-height: 64px; padding: 10px 13px; }
    .brand-icon { width: 38px; height: 38px; flex-basis: 38px; border-radius: 11px; }
    .brand strong { font-size: .92rem; }
    .brand small { font-size: .68rem; }
    .main-content, .staff-main { width: min(100% - 20px, 1180px); padding-top: 17px; }
    .hero-card, .user-summary { align-items: flex-start; flex-direction: column; padding: 23px; border-radius: 20px; }
    .hero-card h1 { font-size: 2.2rem; }
    .panel { padding: 19px; border-radius: 17px; }
    .field-grid, .detail-grid { grid-template-columns: 1fr; }
    .detail-box.wide { grid-column: auto; }
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .stat-card { min-height: 72px; }
    .stat-card:first-child { grid-column: 1 / -1; }
    .queue-toolbar { align-items: stretch; flex-direction: column; }
    .last-update { text-align: right; }
    .connection-badge { display: none; }
    .ticket-top { align-items: flex-start; }
    .ticket-modal { border-radius: 20px 20px 0 0; max-height: calc(100vh - 10px); }
    .modal-backdrop { padding: 10px 0 0; }
}

/* Administrativo */
.admin-main { display: grid; gap: 18px; }
.admin-stats { grid-template-columns: repeat(4, minmax(130px, 1fr)); margin-bottom: 0; }
.admin-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}
.admin-toolbar h1 { margin: 6px 0 6px; font-size: clamp(1.6rem, 4vw, 2.6rem); }
.admin-toolbar p { margin: 0; color: var(--muted); }
.admin-toolbar-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 10px; }
.delete-all-form { display: flex; align-items: center; gap: 8px; }
.delete-all-form input { width: 150px; min-height: 48px; text-transform: uppercase; }
.admin-grid { display: grid; gap: 18px; }
.admin-section { min-width: 0; }
.admin-search { width: min(280px, 42vw); min-height: 42px; }
.admin-table-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: 15px; }
.admin-table { width: 100%; min-width: 880px; border-collapse: collapse; background: rgba(3, 12, 23, .28); }
.admin-table th, .admin-table td { padding: 13px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid rgba(153, 213, 255, .1); }
.admin-table tr:last-child td { border-bottom: 0; }
.admin-table th { position: sticky; top: 0; z-index: 1; color: var(--muted); background: #0d1d30; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; }
.admin-table td { color: #d9eaf5; font-size: .82rem; }
.admin-table td strong { display: block; color: var(--text); font-size: .88rem; }
.admin-table td small { display: block; margin-top: 4px; color: var(--muted); line-height: 1.45; }
.admin-problem-cell { max-width: 390px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.45; }
.admin-row-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.admin-row-actions form, .topbar-actions form { margin: 0; }
.admin-table tr[hidden] { display: none; }

@media (max-width: 760px) {
    .admin-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .admin-toolbar { align-items: stretch; flex-direction: column; }
    .admin-toolbar-actions { justify-content: stretch; }
    .admin-toolbar-actions > form { flex: 1 1 100%; }
    .admin-toolbar-actions .button { width: 100%; }
    .delete-all-form { align-items: stretch; flex-direction: column; }
    .delete-all-form input { width: 100%; }
    .admin-section .section-title-row { align-items: stretch; flex-direction: column; }
    .admin-search { width: 100%; }
}

/* Central de Chamados 1.2.0 */
.site-shell { min-height: 100vh; display: flex; flex-direction: column; }
.auth-single { width: min(560px, 100%); margin: 0 auto; }
.login-panel { padding: clamp(24px, 5vw, 38px); }
.registration-backdrop { place-items: center; }
.registration-modal { width: min(680px, 100%); }
.turnstile-box { min-height: 65px; display: flex; justify-content: center; overflow: hidden; }
.form-message.success { color: var(--success); }

.attachment-toolbar { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.attachment-toolbar-three { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.attachment-button {
    min-height: 70px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    text-align: left;
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255,255,255,.035);
}
.attachment-button > span:first-child { font-size: 1.5rem; }
.attachment-button > span:last-child { font-weight: 820; }
.attachment-button small { display: block; margin-top: 3px; color: var(--muted); font-size: .68rem; font-weight: 600; }
.attachment-button.recording { border-color: rgba(255,105,120,.65); background: rgba(255,105,120,.1); box-shadow: 0 0 0 4px rgba(255,105,120,.06); }
.photo-preview { display: grid; gap: 8px; }
.selected-file { display: grid; grid-template-columns: 30px 1fr 32px; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.025); }
.selected-file strong, .selected-file small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.selected-file small { margin-top: 2px; color: var(--muted); font-size: .7rem; }
.selected-file button { width: 30px; height: 30px; border: 0; border-radius: 9px; color: #fff; background: rgba(255,105,120,.18); }
.audio-recorder { display: grid; gap: 10px; padding: 13px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.025); }
.recording-state { display: flex; align-items: center; gap: 9px; }
.recording-state #audio-timer { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; }
.recording-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 0 5px rgba(255,105,120,.12); animation: recordingPulse 1s infinite; }
.audio-recorder audio, .media-audio audio { width: 100%; }

.ticket-heading-with-signal { display: flex; align-items: center; gap: 12px; min-width: 0; }
.status-signal { position: relative; width: 38px; height: 38px; flex: 0 0 38px; display: grid; place-items: center; border-radius: 50%; color: #211600; background: var(--warning); isolation: isolate; }
.status-signal b { position: relative; z-index: 2; font-size: 1rem; line-height: 1; }
.status-signal i { position: absolute; inset: 0; z-index: -1; border-radius: inherit; background: inherit; opacity: .5; }
.status-signal.status-on-the-way { color: #fff; background: var(--accent-2); }
.status-signal.status-resolved { color: #002315; background: var(--success); }
.status-signal.status-cancelled { color: #fff; background: var(--danger); }
.status-signal.is-animated { animation: sosCore 1.15s ease-in-out infinite; }
.status-signal.is-animated i { animation: sosRing 1.15s ease-out infinite; }
.ticket-assignment { margin: 9px 0 0; color: #a9c9ff; font-size: .78rem; }
.ticket-assignment.available { color: var(--warning); }
.ticket-media-count { margin: 10px 0 0; color: var(--accent); font-size: .78rem; }
.ticket-media { display: grid; gap: 10px; margin-top: 14px; }
.media-gallery { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 7px; }
.media-photo { display: block; aspect-ratio: 1; overflow: hidden; border: 1px solid var(--line); border-radius: 11px; background: rgba(0,0,0,.2); }
.media-photo img { width: 100%; height: 100%; display: block; object-fit: cover; transition: transform .2s; }
.media-photo:hover img { transform: scale(1.04); }
.media-audio { display: grid; gap: 7px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.025); }
.media-audio > span { color: var(--muted); font-size: .75rem; }
.modal-status-heading { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; padding: 13px; border: 1px solid var(--line); border-radius: 15px; background: rgba(255,255,255,.025); }
.modal-status-heading p { margin: 7px 0 0; color: var(--muted); font-size: .78rem; }
.staff-stats { grid-template-columns: repeat(6, minmax(110px, 1fr)); }
.transfer-control { flex: 2 1 300px; display: grid; grid-template-columns: minmax(160px, 1fr) auto; gap: 8px; }
.transfer-control select { min-height: 48px; }
.assigned-warning { flex: 1 1 100%; padding: 12px; color: #d7e7f2; border: 1px solid rgba(74,141,255,.3); border-radius: 12px; background: rgba(74,141,255,.08); }

@keyframes sosRing {
    0% { transform: scale(.88); opacity: .72; }
    70%, 100% { transform: scale(1.85); opacity: 0; }
}
@keyframes sosCore {
    0%, 100% { transform: scale(1); filter: brightness(1); }
    45% { transform: scale(1.08); filter: brightness(1.2); }
}
@keyframes recordingPulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

@media (max-width: 1050px) {
    .staff-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
    .attachment-toolbar, .attachment-toolbar-three { grid-template-columns: 1fr; }
    .media-gallery { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .registration-backdrop { place-items: end center; }
    .registration-modal { border-radius: 20px 20px 0 0; max-height: calc(100vh - 8px); }
    .ticket-heading-with-signal { align-items: flex-start; }
    .status-signal { width: 34px; height: 34px; flex-basis: 34px; }
    .transfer-control { grid-template-columns: 1fr; flex-basis: 100%; }
    .staff-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .staff-stats .stat-card:first-child { grid-column: auto; }
}

@media (prefers-reduced-motion: reduce) {
    .status-signal.is-animated, .status-signal.is-animated i, .recording-dot { animation: none; }
}
.old-ticket-alert { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 18px 20px; border: 1px solid rgba(255,203,85,.38); border-radius: 17px; color: #fff4cf; background: linear-gradient(135deg, rgba(255,203,85,.14), rgba(255,105,120,.08)); }
.old-ticket-alert strong { font-size: 1rem; }
.old-ticket-alert p { margin: 6px 0 0; color: #d8cda9; font-size: .82rem; line-height: 1.5; }
.old-ticket-alert form { flex: 0 0 auto; }
@media (max-width: 760px) { .old-ticket-alert { align-items: stretch; flex-direction: column; } .old-ticket-alert .button { width: 100%; } }

/* Novidades 1.2.0: chat, compartilhamento, edição administrativa e encerramento do app */
.exit-app-button {
    color: #fff;
    border-color: rgba(255, 105, 120, .48);
    background: rgba(255, 105, 120, .12);
}
.exit-app-button:hover { background: rgba(255, 105, 120, .22); }
.shared-note { color: #8de7ff !important; }
.unread-badge {
    min-width: 21px;
    height: 21px;
    display: inline-grid;
    place-items: center;
    margin-left: 7px;
    padding: 0 6px;
    border-radius: 999px;
    color: #06131e;
    background: var(--warning);
    font-size: .68rem;
    font-weight: 900;
    vertical-align: middle;
    box-shadow: 0 0 0 4px rgba(255, 203, 85, .09);
}
.ticket-has-unread { border-color: rgba(255, 203, 85, .42); box-shadow: 0 0 0 2px rgba(255, 203, 85, .06), var(--shadow); }
.button.has-unread { border-color: rgba(255, 203, 85, .5); }

.chat-modal { width: min(720px, calc(100vw - 24px)); }
.chat-messages {
    min-height: 180px;
    max-height: min(48vh, 520px);
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    padding: 15px;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: rgba(0, 0, 0, .14);
    scroll-behavior: smooth;
}
.chat-bubble {
    width: fit-content;
    max-width: min(82%, 580px);
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 15px 15px 15px 4px;
    background: rgba(255, 255, 255, .045);
    overflow-wrap: anywhere;
}
.chat-bubble.mine {
    align-self: flex-end;
    border-radius: 15px 15px 4px 15px;
    border-color: rgba(24, 200, 245, .28);
    background: linear-gradient(135deg, rgba(24, 200, 245, .18), rgba(74, 141, 255, .14));
}
.chat-bubble strong { display: block; color: #ccefff; font-size: .73rem; }
.chat-bubble p { margin: 5px 0 6px; line-height: 1.45; white-space: pre-wrap; }
.chat-bubble small { display: block; color: var(--muted); font-size: .65rem; text-align: right; }
.chat-compose { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 9px; margin-top: 12px; }
.chat-compose textarea { min-height: 52px; max-height: 130px; resize: vertical; }
.chat-compose .button { align-self: stretch; }
.chat-empty { margin: auto; width: 100%; }
.chat-readonly { margin: 10px 0 0; color: var(--muted); font-size: .75rem; }
.ticket-chat-section { display: grid; gap: 10px; margin-top: 18px; }
.chat-section-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-weight: 850; }
.ticket-chat-section .chat-messages { min-height: 150px; max-height: 340px; }

#edit-user-modal .ticket-modal { width: min(620px, calc(100vw - 24px)); }
#edit-user-modal small { color: var(--muted); font-weight: 500; }

@media (max-width: 640px) {
    .topbar-actions { gap: 6px; }
    .topbar-actions .connection-badge { display: none; }
    .chat-compose { grid-template-columns: 1fr; }
    .chat-bubble { max-width: 92%; }
    .chat-modal { max-height: calc(100vh - 10px); }
}


.saved-members { margin-top: 18px; padding-top: 18px; border-top: 1px solid rgba(155,178,196,.14); }
.saved-members-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.saved-members-head strong { font-size: .92rem; }
.saved-members-list { display: grid; gap: 10px; }
.saved-member-card { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.03); }
.saved-member-meta { display: grid; gap: 2px; min-width: 0; }
.saved-member-meta strong { font-size: .92rem; }
.saved-member-meta small { color: var(--muted); font-size: .76rem; }
.saved-member-actions { display: flex; gap: 8px; align-items: center; }
.saved-member-actions .button { min-height: 38px; padding: 8px 12px; font-size: .76rem; }
.remember-check { margin-top: -2px; }


/* Portal público simplificado */
.public-page .main-content { padding-top: clamp(28px, 7vh, 72px); }
.login-panel { overflow: hidden; }
.login-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 24px;
    padding-bottom: 22px;
    border-bottom: 1px solid rgba(155, 178, 196, .14);
}
.login-brand h1 { margin: 0; font-size: clamp(1.45rem, 4vw, 2rem); letter-spacing: -.025em; }
.login-brand-icon { width: 50px; height: 50px; flex-basis: 50px; border-radius: 15px; font-size: 25px; }
.login-panel-heading { margin-bottom: 22px; }
.user-summary-actions { position: relative; z-index: 1; display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }

.exit-app-button {
    color: #ffc8d2;
    border-color: rgba(255, 105, 120, .38);
    background: rgba(255, 105, 120, .10);
}
.exit-app-button:hover {
    color: #ffe2e8;
    background: rgba(255, 105, 120, .17);
}
.power-symbol {
    position: relative;
    width: 20px;
    height: 20px;
    display: block;
}
.power-symbol::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 0;
    width: 2.5px;
    height: 10px;
    border-radius: 99px;
    background: currentColor;
    transform: translateX(-50%);
    box-shadow: 0 0 5px rgba(255, 200, 210, .18);
}
.power-symbol::after {
    content: "";
    position: absolute;
    left: 2px;
    top: 4px;
    width: 16px;
    height: 16px;
    border: 2.5px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    box-sizing: border-box;
}

@media (max-width: 640px) {
    .public-page .main-content { padding-top: 20px; }
    .user-summary-actions { justify-content: flex-start; }
}

/* Configuração dinâmica dos vínculos de cadastro */
.employment-settings-section { margin-bottom: 24px; }
.employment-settings-section .section-title-row p { margin: 7px 0 0; color: var(--muted); font-size: .86rem; line-height: 1.5; }
.employment-settings-layout { display: grid; grid-template-columns: minmax(290px, .75fr) minmax(0, 1.25fr); gap: 18px; align-items: start; }
.employment-type-form { display: grid; gap: 13px; }
.employment-type-new, .employment-type-card { padding: 18px; border: 1px solid var(--line); border-radius: 17px; background: rgba(3, 12, 23, .34); }
.employment-type-new { position: sticky; top: 88px; }
.employment-types-list { display: grid; gap: 13px; }
.employment-type-card.is-inactive { opacity: .72; border-style: dashed; }
.employment-form-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.employment-form-title strong { font-size: .98rem; }
.employment-form-title small { color: var(--muted); font-size: .72rem; text-align: right; }
.employment-checks { display: flex; flex-direction: column; justify-content: center; gap: 8px; padding-top: 21px; }
.employment-card-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 13px; padding-top: 13px; border-top: 1px solid rgba(155, 178, 196, .12); }
.employment-card-actions form { margin: 0; }
.employment-card-actions .button[disabled] { cursor: not-allowed; }

@media (max-width: 900px) {
    .employment-settings-layout { grid-template-columns: 1fr; }
    .employment-type-new { position: static; }
}
@media (max-width: 640px) {
    .employment-form-title { flex-direction: column; }
    .employment-form-title small { text-align: left; }
    .employment-checks { padding-top: 0; }
}

/* Ações compactas do chamado */
.ticket-actions-trigger { width: 100%; min-height: 54px; }
.action-modal-backdrop { z-index: 120; align-items: flex-end; padding: 12px; }
.member-picker-backdrop { z-index: 130; align-items: flex-end; padding: 12px; }
.action-sheet {
    width: min(620px, 100%);
    max-height: min(82vh, 760px);
    margin: auto auto 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 24px 24px 18px 18px;
    background: linear-gradient(160deg, #10243b, #081626);
    box-shadow: 0 -18px 60px rgba(0, 0, 0, .46);
}
.action-sheet > header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 18px 14px;
    border-bottom: 1px solid rgba(155,178,196,.14);
}
.action-sheet > header h2 { margin: 3px 0 0; font-size: 1.2rem; }
.action-sheet-content, .member-picker-list { display: grid; gap: 10px; padding: 14px; overflow-y: auto; max-height: calc(82vh - 82px); }
.action-option {
    width: 100%;
    min-height: 68px;
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) 18px;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    color: var(--text);
    text-align: left;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(255,255,255,.035);
}
.action-option:hover { border-color: rgba(24,200,245,.34); background: rgba(24,200,245,.07); }
.action-option-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; font-size: 1.2rem; font-weight: 900; background: rgba(24,200,245,.10); color: var(--accent); }
.action-option-copy { display: grid; gap: 4px; min-width: 0; }
.action-option-copy strong { font-size: .94rem; }
.action-option-copy small { color: var(--muted); font-size: .75rem; line-height: 1.35; }
.action-option-arrow { color: var(--muted); font-size: 1.45rem; }
.action-option.action-success .action-option-icon { color: var(--success); background: rgba(54,213,138,.10); }
.action-option.action-warning .action-option-icon { color: var(--warning); background: rgba(255,200,87,.10); }
.action-option.action-danger .action-option-icon { color: var(--danger); background: rgba(255,105,120,.10); }
.action-option.action-secondary .action-option-icon { color: #99a9ff; background: rgba(91,100,255,.12); }
.member-picker-sheet > header { grid-template-columns: auto minmax(0,1fr) auto; justify-content: initial; }
.member-picker-back { font-size: 1.1rem; }
.member-choice-card {
    display: grid;
    grid-template-columns: 44px minmax(0,1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(255,255,255,.03);
}
.member-choice-avatar { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 14px; color: #02131c; background: linear-gradient(135deg, var(--accent), #80e7ff); font-weight: 900; }
.member-choice-copy { display: grid; gap: 3px; min-width: 0; }
.member-choice-copy strong { font-size: .9rem; overflow-wrap: anywhere; }
.member-choice-copy small { color: var(--muted); font-size: .73rem; line-height: 1.35; }

/* Cadastro dinâmico dos membros da equipe */
.staff-members-section { margin-bottom: 24px; }
.staff-members-section .section-title-row p { margin: 7px 0 0; color: var(--muted); font-size: .86rem; line-height: 1.5; }
.staff-members-section code { color: var(--accent); }
.staff-settings-layout { display: grid; grid-template-columns: minmax(290px,.75fr) minmax(0,1.25fr); gap: 18px; align-items: start; }
.staff-member-form { display: grid; gap: 13px; }
.staff-settings-layout > .staff-member-form, .staff-member-card { padding: 18px; border: 1px solid var(--line); border-radius: 17px; background: rgba(3,12,23,.34); }
.staff-settings-layout > .staff-member-form { position: sticky; top: 88px; }
.staff-members-list { display: grid; gap: 13px; }
.staff-member-card.is-inactive { opacity: .72; border-style: dashed; }
.staff-active-check { padding-top: 25px; }

@media (max-width: 900px) {
    .staff-settings-layout { grid-template-columns: 1fr; }
    .staff-settings-layout > .staff-member-form { position: static; }
}
@media (max-width: 640px) {
    .action-modal-backdrop, .member-picker-backdrop { padding: 0; }
    .action-sheet { width: 100%; max-height: 88vh; border-radius: 22px 22px 0 0; }
    .action-sheet-content, .member-picker-list { max-height: calc(88vh - 82px); }
    .member-choice-card { grid-template-columns: 40px minmax(0,1fr); }
    .member-choice-card .button { grid-column: 1 / -1; width: 100%; }
    .staff-active-check { padding-top: 0; }
}


/* Central de Chamados 1.3.3 — organização dos anexos no desktop */
@media (min-width: 641px) {
    .attachment-toolbar-three {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        align-items: stretch;
    }
    .attachment-toolbar-three .attachment-button {
        min-width: 0;
        min-height: 122px;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 7px;
        padding: 14px 8px;
        text-align: center;
    }
    .attachment-toolbar-three .attachment-button > span:first-child {
        width: 34px;
        height: 34px;
        display: grid;
        place-items: center;
        flex: 0 0 34px;
        font-size: 1.28rem;
        line-height: 1;
    }
    .attachment-toolbar-three .attachment-button > span:last-child {
        width: 100%;
        font-size: .82rem;
        line-height: 1.18;
        white-space: nowrap;
    }
    .attachment-toolbar-three .attachment-button small {
        min-height: 2.5em;
        margin-top: 5px;
        font-size: .64rem;
        line-height: 1.25;
        white-space: normal;
    }
}


.shutdown-confirm-backdrop {
    z-index: 150;
    place-items: center;
    padding: 20px;
}
.shutdown-confirm-dialog {
    width: min(420px, 100%);
    padding: 26px;
    border: 1px solid rgba(155, 178, 196, .22);
    border-radius: 22px;
    background: linear-gradient(160deg, #10233a, #091827);
    box-shadow: 0 28px 80px rgba(0, 0, 0, .48);
    text-align: center;
}
.shutdown-confirm-icon {
    width: 58px;
    height: 58px;
    display: grid;
    place-items: center;
    margin: 0 auto 16px;
    border: 1px solid rgba(255, 105, 120, .36);
    border-radius: 17px;
    color: #ffc6d2;
    background: rgba(255, 105, 120, .10);
}
.shutdown-confirm-icon .power-symbol {
    transform: scale(1.08);
}
.shutdown-confirm-dialog h2 {
    margin: 0;
    font-size: 1.35rem;
}
.shutdown-confirm-dialog p {
    margin: 10px 0 22px;
    color: var(--muted);
    line-height: 1.55;
}
.shutdown-confirm-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
@media (max-width: 420px) {
    .shutdown-confirm-backdrop { align-items: end; padding: 12px; }
    .shutdown-confirm-dialog { border-radius: 22px; padding: 22px 18px; }
}
