:root {
    --bg: #121212;
    --sidebar: #111111;
    --panel: #1d1d1d;
    --panel-soft: #252525;
    --input-bg: #2a2a2a;
    --hover: #303030;
    --ink: #f7f7f7;
    --muted: #b7b7b7;
    --line: #343434;
    --primary: #ee3124;
    --primary-hover: #f34b3f;
    --primary-strong: #d92a1f;
    --primary-soft: #3a1412;
    --primary-line: #6a201a;
    --primary-text: #ff7a70;
    --accent: #ffcf22;
    --danger: #ee3124;
    --warning: #ff8a00;
    --shadow: 0 18px 48px rgba(0, 0, 0, .28);
}

body.light-theme {
    --bg: #f4f5f7;
    --sidebar: #ffffff;
    --panel: #ffffff;
    --panel-soft: #f7f8fa;
    --input-bg: #ffffff;
    --hover: #eef0f3;
    --ink: #171717;
    --muted: #5f6368;
    --line: #d9d9d9;
    --primary: #ee3124;
    --primary-hover: #f34b3f;
    --primary-strong: #d92a1f;
    --primary-soft: #fff0ef;
    --primary-line: #f3b3ae;
    --primary-text: #b42318;
    --accent: #ffb21a;
    --danger: #d92a1f;
    --warning: #f97316;
    --shadow: 0 16px 40px rgba(18, 18, 18, .10);
}

/* login screen always stays dark, independent of the user's saved theme preference */
body.login-shell.light-theme {
    --bg: #121212;
    --sidebar: #111111;
    --panel: #1d1d1d;
    --panel-soft: #252525;
    --input-bg: #2a2a2a;
    --hover: #303030;
    --ink: #f7f7f7;
    --muted: #b7b7b7;
    --line: #343434;
    --primary: #ee3124;
    --primary-hover: #f34b3f;
    --primary-strong: #d92a1f;
    --primary-soft: #3a1412;
    --primary-line: #6a201a;
    --primary-text: #ff7a70;
    --accent: #ffcf22;
    --danger: #ee3124;
    --warning: #ff8a00;
    --shadow: 0 18px 48px rgba(0, 0, 0, .28);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    color: var(--ink);
    background: var(--bg);
}

body.light-theme {
    background: var(--bg);
}

button, input, select, textarea {
    font: inherit;
}

.app-shell {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: var(--sidebar);
    color: white;
    padding: 22px 16px;
    position: sticky;
    top: 0;
    height: 100vh;
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    min-height: 0;
}

body.light-theme .sidebar {
    background: var(--sidebar);
    color: var(--ink);
    border-right: 1px solid var(--line);
    box-shadow: 10px 0 28px rgba(18, 18, 18, .05);
}

.sidebar-collapse-btn {
    position: fixed;
    top: 50%;
    left: 260px;
    transform: translate(-50%, -50%);
    z-index: 500;
    width: 22px;
    height: 44px;
    padding: 0;
    border-radius: 6px;
    border: 1px solid var(--line);
    background: var(--card);
    color: var(--ink);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    line-height: 1;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .18);
    transition: left .2s ease;
}

body.sidebar-hidden.app-shell {
    grid-template-columns: 1fr;
}

body.sidebar-hidden .sidebar {
    display: none;
}

body.sidebar-hidden .sidebar-collapse-btn {
    left: 10px;
    transform: translateY(-50%);
}

body.sidebar-hidden .sidebar-collapse-btn::before {
    content: '\276F';
}

.sidebar-collapse-btn::before {
    content: '\276E';
}

@media (max-width: 760px) {
    .sidebar-collapse-btn {
        display: none;
    }
}

body.light-theme nav a {
    color: #282828;
}

body.light-theme nav a:hover,
body.light-theme nav a.active {
    background: var(--hover);
    color: var(--ink);
    border-color: transparent;
}

body.light-theme nav a.active {
    background: var(--primary-soft);
    color: #111111;
    border-color: var(--primary-line);
    box-shadow: inset 4px 0 0 var(--primary);
}

body.light-theme .brand small {
    color: var(--muted);
}

body.light-theme .brand strong {
    color: var(--ink);
}

body.light-theme nav {
    scrollbar-color: rgba(238, 49, 36, .55) transparent;
}

body.light-theme nav::-webkit-scrollbar-thumb {
    background: rgba(238, 49, 36, .55);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 26px;
}

.brand-mark {
    width: 54px;
    height: 54px;
    display: inline-grid;
    place-items: center;
    border-radius: 12px;
    background: #050505;
    box-shadow: 0 0 0 1px rgba(238, 49, 36, .38), 0 12px 28px rgba(0, 0, 0, .28);
    overflow: hidden;
}

.brand-mark img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.brand strong { display: block; font-size: 22px; letter-spacing: 0; }
.brand small {
    display: block;
    margin-top: 2px;
    color: #c7c7c7;
    font-family: Arial, Helvetica, sans-serif;
    font-style: italic;
    font-weight: 400;
    white-space: nowrap;
}

nav {
    display: grid;
    gap: 5px;
    overflow-y: auto;
    padding-right: 4px;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(238, 49, 36, .70) transparent;
}

nav::-webkit-scrollbar {
    width: 7px;
}

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

nav::-webkit-scrollbar-thumb {
    background: rgba(238, 49, 36, .70);
    border-radius: 999px;
}

nav a {
    color: #e8e8e8;
    text-decoration: none;
    padding: 11px 12px;
    border-radius: 8px;
    border: 1px solid transparent;
}

nav a:hover,
nav a.active {
    background: var(--hover);
    color: #ffffff;
    border-color: transparent;
}

nav a.active {
    box-shadow: inset 4px 0 0 var(--primary);
}

nav a.nav-discador {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 6px 0;
    padding: 14px 36px 14px 13px;
    border-color: #2d2d2d;
    background: #181818;
    box-shadow: inset 4px 0 0 var(--primary), 0 10px 24px rgba(0, 0, 0, .18);
    font-weight: 900;
}

nav a.nav-discador::before {
    content: "\260E";
    width: 28px;
    height: 28px;
    display: inline-grid;
    place-items: center;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-size: 14px;
    box-shadow: 0 0 0 5px rgba(238, 49, 36, .14);
}

nav a.nav-discador::after {
    content: "";
    position: absolute;
    right: 13px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 0 5px rgba(34, 197, 94, .14);
}

nav a.nav-discador:hover,
nav a.nav-discador.active {
    background: #242424;
    border-color: var(--primary-line);
    box-shadow: inset 4px 0 0 var(--primary), 0 12px 30px rgba(0, 0, 0, .22);
    transform: translateX(2px);
}

body.light-theme nav a.nav-discador {
    border-color: var(--primary-line);
    background: #fff7f6;
    color: #111111;
    box-shadow: inset 4px 0 0 var(--primary), 0 10px 24px rgba(238, 49, 36, .08);
}

body.light-theme nav a.nav-discador:hover,
body.light-theme nav a.nav-discador.active {
    background: var(--primary-soft);
    border-color: var(--primary);
    color: #111111;
    box-shadow: inset 4px 0 0 var(--primary), 0 12px 28px rgba(238, 49, 36, .12);
}

body.light-theme nav a.nav-discador::after {
    box-shadow: 0 0 0 5px rgba(34, 197, 94, .12);
}

nav a.nav-account {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    border-color: rgba(255, 255, 255, .12);
    background: rgba(255, 255, 255, .04);
    color: #f6f6f6;
    font-weight: 700;
}

nav a.nav-account::before {
    content: "\25CF";
    width: 18px;
    height: 18px;
    display: inline-grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(238, 49, 36, .14);
    color: var(--primary);
    font-size: 9px;
    box-shadow: 0 0 0 4px rgba(238, 49, 36, .08);
}

nav a.nav-account:hover,
nav a.nav-account.active {
    background: var(--hover);
    border-color: rgba(255, 255, 255, .16);
}

body.light-theme nav a.nav-account {
    background: #f7f8fa;
    border-color: var(--line);
    color: #282828;
}

body.light-theme nav a.nav-account:hover,
body.light-theme nav a.nav-account.active {
    background: var(--primary-soft);
    border-color: var(--primary-line);
    color: #111111;
}

main {
    padding: 26px;
    min-width: 0;
}

.active-call-banner {
    margin: -26px -26px 22px;
    padding: 12px 26px;
    background: linear-gradient(90deg, var(--primary-strong), var(--primary));
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 12px 30px rgba(238, 49, 36, .22);
}

.active-call-banner strong {
    text-transform: uppercase;
    letter-spacing: 0;
}

.active-call-banner span {
    opacity: .92;
}

.worker-stalled-banner {
    margin: -26px -26px 22px;
    padding: 12px 26px;
    background: linear-gradient(90deg, #b45309, #f59e0b);
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 12px 30px rgba(180, 83, 9, .25);
}

.worker-stalled-banner[hidden] {
    display: none;
}

.worker-stalled-banner strong {
    text-transform: uppercase;
    letter-spacing: 0;
}

.worker-stalled-banner span {
    opacity: .95;
}

.text-success {
    color: #16a34a;
}

.text-error {
    color: var(--danger);
}

.billing-banner {
    position: fixed;
    inset: 0 0 auto 0;
    z-index: 300;
    min-height: 72px;
    padding: 16px 32px;
    display: flex;
    gap: 12px;
    align-items: center;
    background: #d92a1f;
    color: #fff;
    font-size: 1.05rem;
    box-shadow: 0 10px 30px rgba(180, 35, 24, .35);
}

.billing-banner-active { padding-top: 72px; }
.billing-banner a { color: inherit; font-weight: 800; margin-left: auto; }
.billing-warning, .billing-overdue, .billing-blocked { background: #d92a1f; color: #fff; }

.billing-details { display: grid; grid-template-columns: max-content 1fr; gap: 8px 20px; }
.billing-details dt { color: var(--muted); }
.billing-plan-summary.needs-renewal {
    border: 2px solid #d92a1f;
    box-shadow: 0 12px 30px rgba(180, 35, 24, .18);
}
.billing-renewal-callout {
    margin-top: 20px;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    border-top: 1px solid rgba(217, 42, 31, .35);
    background: rgba(217, 42, 31, .08);
}
.billing-renewal-callout > div { display: grid; gap: 4px; }
.billing-renewal-callout strong { color: #d92a1f; }
.billing-renewal-callout span { color: var(--muted); }
.billing-renewal-callout .button { flex: 0 0 auto; }
@media (max-width: 720px) {
    .billing-renewal-callout { align-items: stretch; flex-direction: column; }
    .billing-renewal-callout .button { width: 100%; text-align: center; }
}
.payment-methods { display: flex; flex-wrap: wrap; gap: 12px; margin: 18px 0; }
.payment-checkout-disclosure > summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    list-style: none;
}
.payment-checkout-disclosure > summary::-webkit-details-marker { display: none; }
.payment-checkout-disclosure > summary > span:first-child { display: grid; gap: 4px; }
.payment-checkout-disclosure > summary strong { font-size: 1.25rem; }
.payment-checkout-disclosure > summary small { color: var(--muted); font-weight: 400; }
.payment-checkout-chevron {
    width: 10px;
    height: 10px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    transition: transform .18s ease;
}
.payment-checkout-disclosure[open] .payment-checkout-chevron { transform: rotate(225deg); }
.payment-checkout-content { padding-top: 20px; }
.payment-method-selector {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    max-width: 760px;
    margin: 24px auto 0;
    border-bottom: 1px solid var(--line);
}
.payment-method-option {
    position: relative;
    min-height: 104px;
    padding: 12px 10px 18px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--ink);
    text-align: center;
    cursor: pointer;
}
.payment-method-option strong,
.payment-method-option small { display: block; }
.payment-method-option strong { max-width: 120px; margin: 7px auto 0; }
.payment-method-option small { margin-top: 4px; color: var(--muted); }
.payment-method-icon {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    margin: 0 auto;
    color: var(--primary);
    font-size: 2rem;
    line-height: 1;
}
.payment-method-icon-pix { color: #24a99a; transform: rotate(45deg); }
.payment-method-option.active {
    color: var(--primary-text);
    box-shadow: inset 0 -3px 0 var(--primary);
}
.payment-method-option:disabled { cursor: not-allowed; opacity: .48; }
.payment-method-panel {
    max-width: 980px;
    margin: 0 auto;
    padding: 30px 24px 8px;
    text-align: center;
}
.payment-method-panel[hidden] { display: none; }
.payment-guide-brand {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-bottom: 26px;
    font-size: 2rem;
    color: var(--muted);
}
.payment-guide-logo { color: var(--primary); font-size: 2.5rem; line-height: 1; }
.payment-guide-logo-pix { color: #24a99a; transform: rotate(45deg); }
.payment-guide-intro { max-width: 680px; margin: -10px auto 22px; color: var(--muted); }
.payment-guide-steps {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 28px;
    margin: 0 0 28px;
}
.payment-guide-steps div { position: relative; }
.payment-guide-steps div:not(:last-child)::after {
    content: '>';
    position: absolute;
    top: 7px;
    right: -18px;
    color: var(--muted);
}
.payment-guide-steps span {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    margin: 0 auto 10px;
    border: 1px solid var(--line);
    border-radius: 50%;
    color: #24a99a;
}
.payment-guide-steps p { margin: 0; color: var(--muted); font-size: .92rem; }
.payment-progress-note { margin: 0 auto 18px; color: var(--primary-text); font-weight: 700; }
.payment-method-panel > form:not(.form-grid) { display: flex; justify-content: center; }
.payment-boleto-form { max-width: 900px; }
.payment-card-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 9px;
    width: 100%;
    max-width: 340px;
    margin: 8px auto 0;
    text-align: left;
}
.payment-card-wide { grid-column: 1 / -1; }
.payment-card-technical { display: none; }
.payment-card-form label { gap: 3px; color: var(--ink); font-size: 10.5px; font-weight: 700; }
.payment-card-form input,
.payment-card-form select,
.mp-field {
    height: 32px;
    min-height: 32px;
    border: 1px solid color-mix(in srgb, var(--line) 72%, var(--muted));
    border-radius: 9px;
    background: var(--input-bg);
    box-shadow: 0 1px 2px rgba(0, 0, 0, .08);
}
.payment-card-form input,
.payment-card-form select { padding: 4px 9px; font-size: 11.5px; }
.mp-field { padding: 4px 8px; overflow: hidden; }
.mp-field iframe { display: block; width: 100%; height: 22px !important; }
.payment-card-form input:focus,
.payment-card-form select:focus,
.mp-field:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 18%, transparent);
    outline: none;
}
.payment-card-form .button { min-height: 32px; padding: 5px 11px; border-radius: 9px; font-size: 11.5px; }
.payment-result { display: grid; gap: 12px; margin-top: 18px; padding: 16px; border: 1px solid var(--line); }
.payment-result textarea { min-height: 90px; }
.payment-result-pix {
    justify-items: center;
    width: min(100%, 620px);
    margin: 22px auto 0;
    text-align: center;
}
.payment-result-pix textarea { width: min(100%, 520px); }
.pix-qr { width: 220px; max-width: 100%; background: #fff; padding: 8px; }
.payment-pix-modal {
    position: fixed;
    inset: 0;
    z-index: 600;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(0, 0, 0, .62);
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
}
.payment-modal-open { overflow: hidden; }
.payment-pix-dialog {
    display: grid;
    justify-items: center;
    gap: 16px;
    width: min(100%, 575px);
    max-height: calc(100vh - 40px);
    overflow: auto;
    padding: 28px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: var(--shadow);
    text-align: center;
}
.payment-pix-dialog header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    width: 100%;
    text-align: left;
}
.payment-pix-dialog header div { display: grid; gap: 4px; }
.payment-pix-dialog header strong { font-size: 1.35rem; }
.payment-pix-dialog header small { color: var(--muted); }
.payment-pix-dialog .pix-qr { width: 240px; }
.payment-pix-dialog textarea { width: 100%; min-height: 96px; }
.payment-pix-dialog .payment-pix-actions { display: flex; flex-wrap: nowrap; justify-content: center; gap: 12px; }
.payment-pix-dialog > [data-payment-pix-close] { margin-top: 2px; }

@media (max-width: 620px) {
    .payment-pix-modal { padding: 12px; }
    .payment-pix-dialog { padding: 20px; }
    .payment-pix-dialog .payment-pix-actions { flex-wrap: wrap; }
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin: 0 -26px 20px;
    padding: 18px 26px 16px;
    position: sticky;
    top: 0;
    z-index: 30;
    background: var(--bg);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 10px 26px rgba(0, 0, 0, .08);
}

.topbar h1 {
    margin: 0;
    font-size: 28px;
}

.topbar p {
    margin: 4px 0 0;
    color: var(--muted);
}

.topbar-account,
.account-chip {
    display: flex;
    align-items: center;
    gap: 10px;
}

body.light-theme .account-chip {
    background: #ffffff;
}

.theme-toggle {
    width: 58px;
    height: 32px;
    border: 2px solid var(--line);
    border-radius: 999px;
    background: #0f0f0f;
    padding: 3px;
    cursor: pointer;
    position: relative;
}

.theme-toggle-knob {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--primary);
    color: #ffffff;
    transition: transform .18s ease;
    font-size: 14px;
    font-weight: 900;
}

.theme-icon.sun {
    display: none;
}

body.light-theme .theme-toggle {
    background: #ffffff;
    border-color: #111;
}

body.light-theme .theme-toggle-knob {
    transform: translateX(24px);
    background: #111;
    color: #fff;
}

body.light-theme .theme-icon.moon {
    display: none;
}

body.light-theme .theme-icon.sun {
    display: inline;
}

.account-chip {
    color: var(--ink);
    text-decoration: none;
    font-weight: 800;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 6px 10px 6px 6px;
}

.user-menu {
    position: relative;
}

.user-menu-trigger {
    cursor: pointer;
}

.avatar-wrap {
    position: relative;
    display: inline-grid;
}

.online-dot {
    position: absolute;
    right: 0;
    bottom: 2px;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: #16a34a;
    border: 2px solid var(--panel);
}

.user-menu-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 10px);
    z-index: 70;
    width: 250px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-4px);
    transition: opacity .16s ease, transform .16s ease;
}

.user-menu.is-open .user-menu-panel {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.user-menu-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
}

.user-menu-head .avatar {
    width: 46px;
    height: 46px;
}

.user-menu-list {
    display: grid;
    padding: 8px;
}

.user-menu-item {
    display: grid;
    grid-template-columns: 26px 1fr;
    gap: 10px;
    align-items: center;
    padding: 11px 10px;
    border-radius: 8px;
    color: var(--ink);
    text-decoration: none;
    font-weight: 700;
}

.user-menu-item:hover {
    background: var(--hover);
}

.user-menu-status {
    color: var(--ink);
}

.menu-icon {
    width: 22px;
    text-align: center;
    color: var(--ink);
    font-weight: 900;
}

.online-icon {
    width: 12px;
    height: 12px;
    margin-left: 5px;
    border-radius: 50%;
    background: #16a34a;
    box-shadow: 0 0 0 5px rgba(22, 163, 74, .14);
}

body.light-theme .user-menu-panel,
body.light-theme .account-chip {
    background: #ffffff;
}

body.light-theme .online-dot {
    border-color: #ffffff;
}

.avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    overflow: hidden;
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 900;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar.large {
    width: 92px;
    height: 92px;
    font-size: 30px;
    margin-bottom: 12px;
}

.profile-card {
    display: grid;
    justify-items: start;
    align-content: start;
}

.profile-card h2 {
    margin: 0 0 4px;
}

.profile-card p {
    margin: 0 0 16px;
    color: var(--muted);
}

.panel, .metric, .login-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.panel, .metric {
    background: var(--panel);
}

.panel {
    padding: 20px;
    margin-bottom: 20px;
}

.panel h2 {
    margin: 0 0 16px;
    font-size: 18px;
}

.panel h3 {
    margin: 18px 0 8px;
    font-size: 15px;
}

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.section-head h2 {
    margin-bottom: 4px;
}

.section-head p {
    margin: 0;
    color: var(--muted);
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(140px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.metric-grid.compact {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.metric {
    padding: 18px;
}

.metric-grid.compact .metric {
    padding: 14px;
}

.metric span {
    color: var(--muted);
    display: block;
    font-size: 13px;
}

.metric strong {
    display: block;
    margin-top: 8px;
    font-size: 28px;
}

.grid {
    display: grid;
    gap: 20px;
}

.grid.two {
    grid-template-columns: minmax(320px, .8fr) minmax(420px, 1.2fr);
}

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

.panel-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.panel-header-row h2 {
    margin: 0;
}

.panel-header-row select {
    font-size: 12px;
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 5px 8px;
    background: var(--input-bg);
    color: var(--ink);
}

.dash-area-chart {
    width: 100%;
    height: 260px;
    display: block;
}

.dash-area-labels {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--muted);
    margin-top: 6px;
}

.dash-bars {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    height: 150px;
    padding-top: 10px;
}

.dash-bar-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    height: 100%;
}

.dash-bar {
    width: 100%;
    max-width: 36px;
    background: var(--primary);
    border-radius: 6px 6px 0 0;
    min-height: 2px;
}

.dash-bar-val {
    font-size: 11px;
    font-weight: 700;
    color: var(--ink);
}

.dash-bar-lbl {
    font-size: 10.5px;
    color: var(--muted);
    text-align: center;
    line-height: 1.2;
}

.dash-pie-wrap {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}

.dash-pie {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    flex-shrink: 0;
}

.dash-legend {
    display: flex;
    flex-direction: column;
    gap: 7px;
    font-size: 12.5px;
}

.dash-legend-item {
    display: flex;
    align-items: center;
    gap: 7px;
    color: var(--ink);
}

.dash-legend-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
}

@media (max-width: 960px) {
    .grid.three { grid-template-columns: 1fr; }
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    align-content: start;
}

.form-grid h2,
.form-grid .wide,
.form-grid .hint,
.form-grid .button {
    grid-column: 1 / -1;
}

.team-edit-row {
    padding-bottom: 16px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--line);
}

.team-edit-row:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 13px;
}

.account-password-control > .button {
    width: 100%;
    min-height: 46px;
}

.password-input-wrap {
    position: relative;
    display: grid;
    gap: 8px;
}

.password-input-wrap.is-hidden {
    display: none;
}

.password-input-wrap input {
    width: 100%;
    padding-right: 44px;
}

.password-visibility-button {
    position: absolute;
    top: 6px;
    right: 6px;
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    padding: 0;
    transform: none;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--ink);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}

.password-reset-panel {
    align-self: start;
    min-height: 46px;
    padding: 13px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--input-bg);
}

.password-reset-panel summary {
    cursor: pointer;
    color: var(--accent);
    font-weight: 700;
}

.compact-form {
    margin-top: 14px;
}

.password-visibility-button:hover,
.password-visibility-button:focus-visible {
    background: var(--hover);
    outline: none;
}

input, select, textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 11px;
    color: var(--ink);
    background: var(--input-bg);
}

body.light-theme input,
body.light-theme select,
body.light-theme textarea {
    background: #ffffff;
}

textarea {
    resize: vertical;
}

.check {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--ink);
}

.check input { width: auto; }

.button {
    border: 0;
    background: var(--primary);
    color: #ffffff;
    padding: 11px 14px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 700;
    cursor: pointer;
    text-align: center;
}

.button:hover {
    background: var(--primary-hover);
}

.button.secondary {
    background: var(--panel-soft);
    color: var(--ink);
    border: 1px solid var(--line);
}

body.light-theme .button.secondary {
    background: #ffffff;
    color: var(--ink);
    border: 1px solid var(--line);
}

body.light-theme .button.secondary:hover {
    background: var(--hover);
    color: var(--ink);
}

.button.danger {
    background: var(--danger);
}

.button.danger:hover {
    background: var(--primary-strong);
}

.button.secondary.is-muted {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
}

.button.is-locked {
    cursor: default;
    box-shadow: 0 0 0 4px rgba(238, 49, 36, .12);
}

.button.is-locked:hover {
    background: var(--danger);
}

.button.success {
    background: #16a34a;
    color: #fff;
}

.button.success:hover {
    background: #15803d;
}

.button.small {
    padding: 8px 10px;
    font-size: 12px;
}

.button.filter-accent {
    background: var(--warning);
    color: #171717;
}

.button.filter-accent:hover {
    background: var(--accent);
    color: #171717;
}

.mini-link {
    color: var(--primary);
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}

.mini-link:hover {
    text-decoration: underline;
}

.danger-link {
    border: 0;
    background: transparent;
    color: var(--danger);
    cursor: pointer;
    padding: 0;
    font: inherit;
}

.button.call {
    width: 100%;
    font-size: 20px;
    padding: 18px;
    background: var(--primary);
}

.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 14px 0;
    align-items: center;
}

.operation-online {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border: 1px solid rgba(34, 197, 94, .36);
    border-radius: 999px;
    background: rgba(34, 197, 94, .1);
    color: #22c55e;
    font-weight: 800;
}

.operation-online span {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 0 6px rgba(34, 197, 94, .16);
}

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

.stack {
    display: grid;
    gap: 14px;
}

.hint {
    color: var(--muted);
    margin: 0;
    font-size: 13px;
    line-height: 1.45;
}

.module-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(150px, 1fr));
    gap: 10px;
}

.module-option {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--input-bg);
    color: var(--ink);
    font-weight: 700;
}

.module-option input {
    width: auto;
    min-height: auto;
    accent-color: var(--primary);
}

.empty {
    color: var(--muted);
    margin: 12px 0;
}

.table-wrap {
    overflow: auto;
}

.report-tabs {
    display: inline-flex;
    gap: 4px;
    margin-bottom: 14px;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
}

.report-tabs a {
    padding: 9px 14px;
    border-radius: 6px;
    color: var(--muted);
    font-weight: 700;
    text-decoration: none;
}

.report-tabs a.is-active {
    background: var(--primary);
    color: #fff;
}

.report-metrics {
    grid-template-columns: repeat(4, minmax(140px, 1fr));
    margin-bottom: 14px;
}

/* Relatorios: refinamento visual isolado do restante do sistema. */
.reports-page {
    --reports-soft: color-mix(in srgb, var(--panel) 88%, var(--input-bg));
    display: grid;
    gap: 14px;
    min-width: 0;
}

.reports-page > *,
.reports-page .panel,
.reports-page .stack {
    min-width: 0;
}

.reports-content-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
}

.reports-content-heading h2 {
    margin: 0 0 4px;
    font-size: 24px;
}

.reports-content-heading p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

.reports-page .report-tabs {
    display: flex;
    gap: 26px;
    margin: 0;
    padding: 0 8px;
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    background: transparent;
}

.reports-page .report-tabs a {
    position: relative;
    padding: 10px 6px 12px;
    border-radius: 0;
    font-size: 14px;
}

.reports-page .report-tabs a.is-active {
    background: transparent;
    color: var(--primary);
}

.reports-page .report-tabs a.is-active::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: -1px;
    left: 0;
    height: 2px;
    background: var(--primary);
}

.reports-page .reports-filter-panel,
.reports-page .reports-calls-panel {
    margin: 0;
    padding: 14px;
    box-shadow: none;
}

.reports-filter-panel .section-head {
    margin-bottom: 10px;
}

.reports-filter-panel .section-head h2 {
    font-size: 15px;
}

.reports-filter-panel .section-head p {
    font-size: 12px;
}

.reports-page .reports-filter-grid {
    grid-template-columns: repeat(4, minmax(145px, 1fr));
    gap: 10px;
}

.reports-filter-grid > label {
    gap: 5px;
    color: var(--muted);
    font-size: 12px;
}

.reports-filter-grid input,
.reports-filter-grid select {
    min-height: 38px;
    padding: 8px 10px;
    font-size: 13px;
}

.reports-filter-grid > .wide {
    grid-column: 1 / -1;
}

.reports-filter-grid .status-chip-list {
    gap: 6px;
}

.reports-filter-grid .status-chip {
    min-height: 32px;
    padding: 6px 9px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--reports-soft);
    font-size: 12px;
}

.reports-filter-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
    margin: 0;
}

.reports-filter-actions .button {
    min-height: 36px;
    padding: 8px 14px;
}

.reports-calls-panel .section-head {
    margin-bottom: 10px;
}

.reports-calls-panel .section-head h2 {
    font-size: 16px;
}

.reports-table-wrap {
    width: 100%;
    max-width: 100%;
    border: 1px solid var(--line);
    border-radius: 7px;
    overflow-x: auto;
}

.reports-calls-table {
    min-width: 1080px;
}

.transcription-cell {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 110px;
}

.transcription-cell [data-transcription-status] {
    font-size: 11px;
    white-space: nowrap;
}

.transcription-cell .mini-link {
    align-self: flex-start;
}

.reports-calls-table th {
    padding: 10px 9px;
    background: var(--reports-soft);
    font-size: 11px;
    white-space: nowrap;
}

.reports-calls-table td {
    padding: 9px;
    font-size: 12px;
    vertical-align: middle;
}

.report-status {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 3px 7px;
    border: 1px solid var(--line);
    border-radius: 5px;
    background: var(--reports-soft);
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

.report-status-atendida,
.report-status-completed {
    border-color: rgba(22, 163, 74, .28);
    background: rgba(22, 163, 74, .1);
    color: #15803d;
}

.report-status-nao_atendida,
.report-status-nao-atendida,
.report-status-ocupado {
    border-color: rgba(234, 88, 12, .28);
    background: rgba(234, 88, 12, .1);
    color: #c2410c;
}

.report-status-falha,
.report-status-cancelada,
.report-status-numero_inexistente,
.report-status-numero-inexistente {
    border-color: rgba(220, 38, 38, .25);
    background: rgba(220, 38, 38, .08);
    color: #b91c1c;
}

.report-recording-action,
.report-details-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 28px;
    padding: 5px 9px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--panel);
    white-space: nowrap;
}

.report-details-action[hidden] {
    display: none;
}

.report-recording-action span {
    color: var(--primary);
}

.report-recording-empty {
    color: var(--muted);
}

.report-call-modal-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 250px;
    align-items: start;
}

.report-detail-block,
.report-detail-recording {
    min-width: 0;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--reports-soft);
}

.report-detail-block h3,
.report-detail-recording h3 {
    margin: 0 0 12px;
    font-size: 14px;
}

.report-detail-block dl {
    margin: 0;
}

.transcript-line {
    margin: 0 0 12px;
    padding: 6px 6px 6px 12px;
    border-left: 3px solid var(--line);
    line-height: 1.5;
}

.transcript-line strong {
    display: block;
    margin-bottom: 2px;
    font-size: 12px;
    letter-spacing: .02em;
    color: var(--muted, inherit);
}

.transcript-line-consultant {
    border-left-color: var(--primary);
}

.transcript-line-consultant strong {
    color: var(--primary);
}

.transcript-line-customer {
    border-left-color: #2563eb;
}

.transcript-line-customer strong {
    color: #2563eb;
}

.reports-indicator-metrics {
    gap: 12px;
    margin: 0;
}

.reports-indicator-metrics .metric {
    min-height: 110px;
    padding: 16px;
    box-shadow: none;
}

.reports-indicator-metrics .metric strong {
    font-size: 25px;
}

.reports-indicator-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.reports-indicator-grid .stack {
    display: grid;
    gap: 14px;
}

.reports-indicator-grid .panel {
    margin: 0;
    box-shadow: none;
}

.reports-indicator-wide {
    grid-column: 1 / -1;
}

.reports-page .report-disclosure summary {
    min-height: 54px;
    padding: 15px 16px;
    font-size: 15px;
}

.reports-page .report-disclosure[open] .import-history-content {
    padding-top: 12px;
}

.table-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 34px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--line);
}

.table-pagination span {
    color: var(--muted);
    font-size: 13px;
    line-height: 1;
    white-space: nowrap;
}

.table-pagination .button {
    min-height: 30px;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 13px;
    line-height: 1;
}

.table-wrap tr.call-history-attended {
    background: rgba(255, 193, 7, .14);
}

body.light-theme .table-wrap tr.call-history-attended {
    background: rgba(255, 193, 7, .2);
}

.table-wrap tr.call-history-attended td:first-child {
    position: relative;
    font-weight: 700;
}

.table-wrap tr.call-history-attended td:first-child::before {
    content: "";
    position: absolute;
    left: 0;
    top: 12px;
    bottom: 12px;
    width: 4px;
    border-radius: 999px;
    background: #f4b400;
}

.table-wrap tr.call-history-attended td:first-child {
    padding-left: 16px;
}

.table-wrap tr.call-history-latest {
    background: rgba(238, 49, 36, .12);
}

body.light-theme .table-wrap tr.call-history-latest {
    background: rgba(238, 49, 36, .08);
}

.table-wrap tr.call-history-latest td:first-child {
    border-left: 4px solid var(--primary);
    padding-left: 12px;
    font-weight: 700;
}

.call-history-latest-label {
    display: block;
    width: max-content;
    margin-top: 4px;
    color: var(--primary);
    font-size: 11px;
    font-weight: 800;
}

.table-wrap tr.callback-today {
    background: rgba(255, 193, 7, .14);
}

body.light-theme .table-wrap tr.callback-today {
    background: rgba(255, 193, 7, .2);
}

.table-wrap tr.callback-today td:first-child {
    border-left: 4px solid #f4b400;
    padding-left: 16px;
    font-weight: 700;
}

.table-wrap tr.radar-list-latest {
    background: rgba(238, 49, 36, .12);
}

body.light-theme .table-wrap tr.radar-list-latest {
    background: rgba(238, 49, 36, .08);
}

.table-wrap tr.radar-list-latest td:first-child {
    border-left: 4px solid var(--primary);
    padding-left: 16px;
    font-weight: 700;
}

.radar-latest-label {
    display: inline-flex;
    align-items: center;
    margin-left: 10px;
    padding: 3px 7px;
    border: 1px solid var(--primary-line);
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary-text);
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    vertical-align: middle;
}

.callback-status-actions {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.callback-call-button {
    width: 32px;
    height: 32px;
    min-height: 32px;
    padding: 0;
    border: 1px solid rgba(238, 49, 36, .35);
    border-radius: 50%;
    background: rgba(238, 49, 36, .1);
    color: var(--primary);
    font-size: 17px;
    cursor: pointer;
}

.callback-call-button:hover {
    color: #fff;
    background: var(--primary);
}

.callback-notification-stack {
    position: fixed;
    left: 278px;
    bottom: 18px;
    z-index: 1300;
    display: flex;
    flex-direction: column-reverse;
    gap: 10px;
    width: min(360px, calc(100vw - 36px));
}

@media (max-width: 900px) {
    .callback-notification-stack {
        left: 18px;
    }
}

.callback-notification {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 36px;
    align-items: stretch;
    overflow: hidden;
    border: 1px solid var(--primary-line);
    border-left: 5px solid var(--warning);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: var(--shadow);
}

.callback-notification-main,
.callback-notification-close {
    border: 0;
    background: transparent;
    color: var(--ink);
    cursor: pointer;
}

.callback-notification-main {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    padding: 14px;
    text-align: left;
}

.callback-notification-main:hover {
    background: var(--hover);
}

.callback-notification-main span:last-child {
    display: grid;
    min-width: 0;
    gap: 4px;
}

.callback-notification-main small {
    overflow: hidden;
    color: var(--muted);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.callback-notification-bell {
    display: inline-grid;
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    place-items: center;
    border-radius: 50%;
    background: var(--primary);
    color: #ffffff;
    font-size: 20px;
}

.callback-notification-close {
    font-size: 16px;
    font-weight: 800;
}

.callback-notification-close:hover {
    background: var(--hover);
}

.transcription-notification-stack {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 1300;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: min(360px, calc(100vw - 36px));
}

@media (max-width: 900px) {
    .transcription-notification-stack {
        right: 18px;
        left: 18px;
        width: auto;
    }
}

.transcription-notification {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 36px;
    align-items: stretch;
    overflow: hidden;
    border: 1px solid var(--primary-line);
    border-left: 5px solid #2563eb;
    border-radius: 8px;
    background: var(--panel);
    box-shadow: var(--shadow);
}

.transcription-notification-main,
.transcription-notification-close {
    border: 0;
    background: transparent;
    color: var(--ink);
    cursor: pointer;
    text-decoration: none;
}

.transcription-notification-main {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    padding: 14px;
    text-align: left;
}

.transcription-notification-main:hover {
    background: var(--hover);
}

.transcription-notification-main span:last-child {
    display: grid;
    min-width: 0;
    gap: 4px;
}

.transcription-notification-main small {
    overflow: hidden;
    color: var(--muted);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.transcription-notification-icon {
    display: inline-grid;
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    place-items: center;
    border-radius: 50%;
    background: #2563eb;
    color: #ffffff;
    font-size: 20px;
}

.transcription-notification-close {
    font-size: 16px;
    font-weight: 800;
}

.transcription-notification-close:hover {
    background: var(--hover);
}

.call-history-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-right: 8px;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(255, 193, 7, .18);
    color: #f4b400;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0;
    vertical-align: middle;
}

body.light-theme .call-history-badge {
    background: rgba(255, 193, 7, .24);
    color: #725500;
}

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

.whatsapp-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(37, 211, 102, .14);
    color: #25d366;
    font-size: 11px;
    font-weight: 800;
    text-decoration: none;
}

.whatsapp-link:hover {
    text-decoration: none;
    background: rgba(37, 211, 102, .22);
}

.whatsapp-phone-link {
    color: #25a95c;
    font-weight: 700;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

.whatsapp-phone-link:hover {
    color: #1f8f4e;
}

.modal-phone-actions {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.modal-phone-actions .is-blocked {
    color: var(--muted);
    cursor: default;
}

.blocklist-search {
    display: flex;
    align-items: end;
    gap: 10px;
    margin: 14px 0 18px;
}

.blocklist-search label {
    flex: 1;
}

.blocklist-search .button {
    flex: 0 0 auto;
}

@media (max-width: 720px) {
    .blocklist-search {
        align-items: stretch;
        flex-direction: column;
    }
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 620px;
}

th, td {
    text-align: left;
    padding: 11px 10px;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
    font-size: 14px;
}

th {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

.editable-table {
    min-width: 1120px;
}

.editable-table input {
    min-width: 120px;
    padding: 8px;
}

.editable-table td {
    vertical-align: middle;
}

.editable-table small {
    display: block;
    color: var(--muted);
    margin-top: 4px;
    white-space: nowrap;
}

.actions {
    display: flex;
    gap: 8px;
    align-items: center;
    min-width: 150px;
}

.list-download-link {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 30px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--primary);
    font-size: 20px;
    font-weight: 800;
    line-height: 1;
    text-decoration: none;
}

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

.flash {
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 18px;
    border: 1px solid var(--primary-line);
    background: var(--primary-soft);
    color: var(--primary-text);
}

.flash.error {
    border-color: var(--primary-line);
    background: var(--primary-soft);
    color: var(--primary-text);
}

body.light-theme .flash {
    border-color: var(--primary-line);
    background: var(--primary-soft);
    color: var(--primary-text);
}

body.light-theme .flash.error {
    border-color: var(--primary-line);
    background: var(--primary-soft);
    color: var(--primary-text);
}

.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    position: relative;
    overflow: hidden;
    isolation: isolate;
    background:
        radial-gradient(circle at 14% 18%, rgba(238, 49, 36, .16), transparent 40%),
        radial-gradient(circle at 88% 82%, rgba(255, 138, 0, .13), transparent 38%),
        radial-gradient(circle at 50% 50%, #17181a 0%, #0c0d0e 62%, #08090a 100%);
    padding: 22px;
}

/* fine circuit-style grid, faded toward the edges so it reads as texture, not noise */
.login-shell::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, .05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, .05) 1px, transparent 1px);
    background-size: 44px 44px;
    mask-image: radial-gradient(circle at 50% 42%, black 0%, transparent 72%);
    -webkit-mask-image: radial-gradient(circle at 50% 42%, black 0%, transparent 72%);
}

/* prospecting radar: slow rotating sweep + concentric pulse rings, echoing the logo's radar mark */
.login-shell::after {
    content: "";
    position: absolute;
    top: -18%;
    right: -14%;
    width: 620px;
    height: 620px;
    max-width: 90vw;
    max-height: 90vw;
    z-index: 0;
    border-radius: 50%;
    background:
        conic-gradient(from 0deg, rgba(238, 49, 36, .28), transparent 22%),
        repeating-radial-gradient(circle, rgba(255, 255, 255, .05) 0, rgba(255, 255, 255, .05) 1px, transparent 1px, transparent 62px);
    -webkit-mask-image: radial-gradient(circle, black 60%, transparent 72%);
    mask-image: radial-gradient(circle, black 60%, transparent 72%);
    animation: login-radar-spin 10s linear infinite;
}

/* scattered lead nodes with thin connecting lines, suggesting a network of prospects being mapped */
.login-network {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: .55;
}

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

@media (prefers-reduced-motion: reduce) {
    .login-shell::after { animation: none; }
}

.login-card {
    position: relative;
    z-index: 1;
    width: min(440px, 100%);
    padding: 28px;
    background: color-mix(in srgb, var(--panel) 88%, transparent);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.login-brand {
    color: var(--ink);
}

.login-brand small {
    color: var(--muted);
}

.login-flash {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
}

.demo-users {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 13px;
}

.agent-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.contact-card .contact-fields {
    grid-template-columns: max-content 1fr max-content 1fr;
}

.field-empty {
    color: var(--muted);
    font-weight: 400;
}

.script-box {
    background: var(--panel-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
    margin-top: 16px;
}

.script-box p {
    color: var(--muted);
    line-height: 1.5;
}

.contact-name {
    font-size: 26px;
    font-weight: 800;
}

.contact-phone {
    color: var(--primary-text);
    font-size: 20px;
    margin: 8px 0 16px;
}

.parallel-dial-state {
    display: grid;
    gap: 14px;
    min-height: 230px;
    align-content: center;
    padding: 20px;
    border: 1px solid var(--line);
    border-left: 4px solid var(--primary);
    border-radius: 8px;
    background: var(--panel-soft);
}

.parallel-dial-heading {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
}

.parallel-dial-pulse {
    width: 12px;
    height: 12px;
    flex: 0 0 12px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 0 6px rgba(34, 197, 94, .16);
    animation: pulse 1s infinite alternate;
}

.parallel-dial-waiting {
    margin: 0;
    font-size: 20px;
    font-weight: 800;
}

.parallel-dial-campaign {
    margin: 0;
    color: var(--muted);
}

.parallel-dial-counts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.parallel-dial-counts span {
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--panel);
    color: var(--muted);
    white-space: nowrap;
}

.parallel-dial-counts strong {
    color: var(--text);
}

.parallel-call-card {
    min-height: 132px;
    align-content: center;
}

dl {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 8px 12px;
    margin: 0;
}

dt {
    color: var(--muted);
}

dd {
    margin: 0;
}

.call-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 800;
    color: var(--primary-text);
}

.call-status span {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary);
    animation: pulse 1s infinite alternate;
}

.timer {
    font-size: 48px;
    font-weight: 800;
    margin: 18px 0;
}

.live-call-card {
    border: 1px solid var(--line);
    background: var(--panel-soft);
    border-radius: 8px;
    padding: 14px;
    margin-bottom: 14px;
    display: grid;
    gap: 6px;
}

.live-call-card strong {
    font-size: 16px;
    overflow-wrap: anywhere;
}

.live-call-card small {
    color: var(--muted);
}

.call-flow-details {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 6px 12px;
    margin: 6px 0;
    font-size: 14px;
}

.call-flow-details dd {
    font-weight: 800;
    overflow-wrap: anywhere;
}

.live-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-weight: 700;
}

.live-indicator span,
.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #6b7280;
    display: inline-block;
}

.live-call-card.is-live .live-indicator {
    color: var(--primary-text);
}

.live-call-card.is-live .live-indicator span,
.status-dot.online {
    background: #22c55e;
    box-shadow: 0 0 0 6px rgba(34, 197, 94, .16);
}

.webphone {
    position: fixed;
    right: 30px;
    bottom: 84px;
    z-index: 50;
    width: min(350px, calc(100vw - 28px));
    max-height: calc(100vh - 108px);
    max-height: calc(100dvh - 108px);
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    transform-origin: bottom right;
    transition: transform .18s ease, opacity .18s ease;
}

body.light-theme .webphone {
    background: #ffffff;
}

.webphone.is-hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(14px) scale(.96);
}

.webphone-launcher {
    position: fixed;
    right: 32px;
    bottom: 26px;
    z-index: 49;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 0;
    background: var(--primary);
    color: #ffffff;
    font-size: 26px;
    line-height: 1;
    box-shadow: 0 14px 34px rgba(238, 49, 36, .30);
    cursor: pointer;
}

.webphone header,
.webphone footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-bottom: 1px solid var(--line);
}

.webphone footer {
    border-top: 1px solid var(--line);
    border-bottom: 0;
    color: var(--muted);
    font-size: 10px;
    gap: 4px;
}

.webphone footer button {
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 10px;
    cursor: pointer;
    padding: 5px 3px;
}

.webphone footer button.active {
    color: var(--primary);
    border-top: 2px solid var(--primary);
}

.webphone-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
}

.icon-button {
    border: 0;
    background: transparent;
    font-weight: 800;
    font-size: 16px;
    color: var(--muted);
    cursor: pointer;
}

.webphone-form {
    position: relative;
    padding: 18px 16px 16px;
    display: grid;
    justify-items: center;
    align-content: start;
    gap: 11px;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-gutter: stable;
}

.phone-backspace {
    position: absolute;
    right: 16px;
    top: 12px;
    border: 0;
    background: transparent;
    color: #999;
    font-size: 17px;
    cursor: pointer;
}

.dial-display {
    border: 0;
    border-radius: 999px;
    text-align: left;
    color: var(--ink);
    font-size: 15px;
    font-weight: 700;
    padding: 12px 18px;
    background: var(--input-bg);
}

.dial-display::placeholder {
    color: var(--muted);
}

body.light-theme .dial-display {
    background: #f1f2f4;
}

.dialpad-call-status {
    justify-self: center;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    margin-bottom: 10px;
    border-radius: 999px;
    background: rgba(238, 49, 36, .10);
    color: var(--primary);
    font-weight: 600;
    font-size: .9rem;
}

.dialpad-call-status.is-hidden {
    display: none;
}

.dialpad-call-status::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
    animation: dialpad-call-status-pulse 1.2s ease-in-out infinite;
}

@keyframes dialpad-call-status-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .35; }
}

.dialpad {
    width: min(220px, 100%);
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px 18px;
    justify-self: center;
}

.webphone-tab-panel {
    display: none;
    width: 100%;
    min-height: 360px;
}

.webphone-tab-panel.active {
    display: grid;
    align-content: start;
    justify-items: stretch;
    gap: 11px;
}

.phone-keypad-panel.active {
    justify-items: center;
    align-content: start;
}

.phone-subtabs {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2px;
    width: 100%;
}

.phone-subtabs button {
    border: 0;
    border-bottom: 2px solid transparent;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    padding: 8px 4px;
    font-size: 12px;
}

.phone-subtabs button.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.phone-history-day {
    color: var(--muted);
    font-size: 13px;
    margin: 2px 0 4px;
}

.phone-subtab-panel {
    display: none;
    gap: 10px;
}

.phone-subtab-panel.active {
    display: grid;
}

.phone-history-item {
    width: 100%;
    border: 0;
    background: transparent;
    color: var(--ink);
    display: grid;
    grid-template-columns: 50px 1fr auto;
    gap: 14px;
    align-items: center;
    text-align: left;
    cursor: pointer;
    padding: 4px 2px;
}

.phone-history-item.is-filtered,
.phone-list-item.is-filtered {
    display: none;
}

.phone-history-badge {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: #fff;
    font-weight: 900;
}

.phone-history-badge.green { background: var(--primary); }
.phone-history-badge.orange { background: #ff5a12; }
.phone-history-badge.blue { background: #1d9bf0; }

.phone-history-main {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.phone-history-main strong {
    font-size: 17px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.phone-history-main small {
    color: var(--muted);
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.phone-history-actions {
    color: var(--primary);
    letter-spacing: 2px;
}

.phone-empty {
    align-self: center;
    color: var(--muted);
    font-size: 12px;
    text-align: center;
}

.phone-list-item {
    width: 100%;
    border: 1px solid var(--line);
    background: var(--panel-soft);
    color: var(--ink);
    border-radius: 8px;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    cursor: pointer;
    text-align: left;
}

body.light-theme .phone-list-item {
    background: #ffffff;
}

.phone-list-item span {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.phone-list-item strong,
.phone-list-item small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.phone-list-item strong {
    color: var(--ink);
    font-size: 12px;
}

.phone-list-item small,
.phone-list-item em {
    color: var(--muted);
    font-size: 10px;
    font-style: normal;
}

body.light-theme .phone-list-item small,
body.light-theme .phone-list-item em {
    color: var(--muted);
}

.phone-monitor {
    align-self: center;
    display: grid;
    justify-items: center;
    gap: 7px;
    text-align: center;
}

.phone-monitor span {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #6b7280;
}

.phone-monitor.online span {
    background: var(--primary);
    box-shadow: 0 0 0 8px rgba(238, 49, 36, .14);
}

.phone-monitor small {
    color: var(--muted);
    overflow-wrap: anywhere;
}

.phone-monitor-details {
    width: 100%;
    grid-template-columns: 70px 1fr;
    font-size: 11px;
}

.dialpad button {
    width: 56px;
    height: 56px;
    border: 0;
    border-radius: 50%;
    background: var(--input-bg);
    color: var(--ink);
    display: grid;
    place-items: center;
    cursor: pointer;
}

body.light-theme .dialpad button {
    background: #eceff3;
    color: #1f2937;
}

.dialpad button strong {
    font-size: 22px;
    line-height: 1;
}

.dialpad button small {
    font-size: 8px;
    font-weight: 800;
    color: #85858b;
    margin-top: -8px;
}

.call-fab {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    border: 0;
    background: #d8d8dc;
    color: #4a4a4f;
    font-size: 24px;
    cursor: pointer;
    justify-self: center;
    margin-top: 8px;
}

.call-fab:hover {
    background: #c8c8ce;
}

.call-fab.ready {
    background: #16a34a;
    color: #fff;
}

.call-fab.ready:hover {
    background: #15803d;
}

.call-fab.hangup {
    background: var(--danger);
    color: #fff;
}

.call-fab.hangup:hover {
    background: var(--primary-strong);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    padding: 4px 8px;
    border-radius: 999px;
    background: #eef2f7;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.status-badge.called {
    background: var(--primary-soft);
    color: var(--primary-text);
}

/* Balao de anotacao da ligacao, com a cara da marca LigFlow (fundo escuro + acento vermelho,
   independente do tema claro/escuro) em vez do tooltip nativo cinza do navegador. */
.ligflow-tooltip {
    position: relative;
    display: inline-block;
    cursor: help;
}

.ligflow-tooltip-marker {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
}

.ligflow-tooltip::before,
.ligflow-tooltip::after {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 10px);
    transform: translateX(-50%);
    opacity: 0;
    visibility: hidden;
    transition: opacity .12s ease, transform .12s ease;
    pointer-events: none;
    z-index: 40;
}

.ligflow-tooltip::before {
    content: attr(data-tooltip);
    width: max-content;
    max-width: 280px;
    padding: 10px 12px;
    border-radius: 10px;
    border-left: 3px solid var(--primary);
    background: #17171a;
    color: #f7f7f7;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
    text-align: left;
    white-space: pre-line;
    box-shadow: 0 12px 28px rgba(0, 0, 0, .35);
}

.ligflow-tooltip::after {
    content: '';
    bottom: 100%;
    width: 0;
    height: 0;
    border: 6px solid transparent;
    border-top-color: #17171a;
    border-bottom: 0;
    margin-bottom: -6px;
}

.ligflow-tooltip:hover::before,
.ligflow-tooltip:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-2px);
}

.recording-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 104px;
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--panel-soft);
    color: var(--muted);
    font: inherit;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
}

.recording-action span {
    display: inline-grid;
    place-items: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    color: currentColor;
    font-size: 18px;
    line-height: 1;
}

.recording-action.is-ready {
    border-color: color-mix(in srgb, var(--primary) 44%, var(--line));
    background: var(--primary-soft);
    color: var(--primary-text);
}

.recording-action.is-ready span {
    color: var(--primary);
}

.recording-action:hover {
    border-color: var(--primary);
    color: var(--primary-text);
}

.recording-modal {
    width: min(820px, 100%);
}

.recording-modal header p {
    margin: 4px 0 0;
    color: var(--muted);
}

.recording-player {
    display: grid;
    gap: 10px;
    justify-items: stretch;
}

.recording-player audio {
    width: 100%;
}

.recording-player .button-row {
    margin: 0;
}

.call-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: grid;
    place-items: center;
    padding: 22px;
    background: rgba(15, 23, 42, .42);
}

.call-modal {
    width: min(900px, 100%);
    max-height: calc(100vh - 44px);
    overflow: auto;
    background: var(--panel);
    border-radius: 12px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, .42);
    padding: 20px 22px;
}

.call-modal header {
    margin-bottom: 14px;
}

.call-modal-grid {
    margin-bottom: 14px;
}

.call-modal-grid .live-call-card {
    margin-bottom: 0;
    align-content: start;
}

.call-modal-grid .timer {
    font-size: 30px;
    margin: 6px 0 0;
}

.call-modal-form {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.call-modal-form label:nth-of-type(2),
.call-modal-form button {
    grid-column: 1 / -1;
}

.call-modal-form textarea {
    resize: vertical;
    min-height: 72px;
}

.call-modal-lead-form {
    display: grid;
    gap: 10px;
    align-content: start;
}

.call-modal-lead-form input {
    padding: 8px 10px;
    font-size: 13px;
}

.call-modal-lead-form button {
    justify-self: start;
}

.call-modal [data-modal-countdown-text] {
    margin: 10px 0 0;
    text-align: center;
}

@media (max-width: 760px) {
    .call-modal-form {
        grid-template-columns: 1fr;
    }
}

.list-numbers-modal {
    width: min(1320px, 100%);
}

.client-modal,
.plan-modal,
.user-modal,
.campaign-modal,
.roteiro-modal {
    width: min(920px, 100%);
}

.client-modal form,
.plan-modal form,
.user-modal form,
.campaign-modal form {
    padding-bottom: 4px;
}

.list-numbers-modal .table-wrap {
    max-height: calc(100vh - 230px);
    overflow: auto;
}

.list-loading-more {
    padding: 14px;
    text-align: center;
    color: var(--muted);
    font-weight: 700;
}

.list-loading-more.is-hidden {
    display: none;
}

.import-history-disclosure > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    cursor: pointer;
    list-style: none;
    font-size: 1.25rem;
    font-weight: 800;
}

.import-history-disclosure > summary::-webkit-details-marker {
    display: none;
}

.import-history-chevron {
    width: 10px;
    height: 10px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    transition: transform .18s ease;
}

.import-history-disclosure[open] .import-history-chevron {
    transform: rotate(225deg);
}

.import-history-content {
    margin-top: 18px;
}

.list-remessa-toolbar {
    display: grid;
    gap: 14px;
    margin-bottom: 16px;
}

.list-status-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.list-status-filter-form {
    align-items: flex-start;
}

.status-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, .04);
    color: var(--text);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    user-select: none;
}

.status-chip strong {
    min-width: 24px;
    padding: 2px 7px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .08);
    font-size: 12px;
    text-align: center;
}

.status-chip.is-active {
    border-color: var(--primary);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, .02) inset;
}

.status-chip input[type="checkbox"] {
    margin: 0;
    accent-color: var(--primary);
}

body.light-theme .status-chip {
    background: #f8fafc;
}

body.light-theme .status-chip strong {
    background: #e2e8f0;
}

.remessa-create-form {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) auto auto auto;
    gap: 12px;
    align-items: end;
}

.remessa-create-form label {
    margin: 0;
}

.remessa-create-form .check {
    align-self: center;
    margin: 0;
}

.remessa-count-summary {
    align-self: center;
    color: var(--muted);
    font-size: 13px;
    white-space: nowrap;
}

.select-col {
    width: 38px;
}

.select-col input[type="checkbox"] {
    transform: scale(1.08);
}

.list-numbers-modal header p,
.client-modal header p,
.plan-modal header p,
.user-modal header p,
.campaign-modal header p {
    margin: 4px 0 0;
    color: var(--muted);
}

body.light-theme .call-modal {
    background: #ffffff;
}

.call-modal header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
}

.call-modal header h2 {
    margin: 3px 0 0;
}

[data-call-modal] .call-modal header h2,
[data-call-history-modal] .call-modal header h2 {
    margin: 0;
    font-size: 22px;
    font-weight: 800;
}

.call-modal header strong {
    color: var(--primary);
    font-size: 13px;
    text-transform: uppercase;
}

.modal-kicker {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.client-tabs {
    display: flex;
    gap: 4px;
    padding: 0 24px;
    border-bottom: 1px solid var(--line);
}

.client-tab {
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 700;
    color: var(--muted);
    text-decoration: none;
    border-bottom: 2px solid transparent;
}

.client-tab.active {
    color: var(--primary-text);
    border-bottom-color: var(--primary);
}

.client-tab:not(.active):hover {
    color: var(--ink);
}

/* Cliente/Acessos/Grupos unified shell (cd = cliente-detalhe) */
.cd-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 18px;
    align-items: start;
}

@media (max-width: 900px) {
    .cd-layout {
        grid-template-columns: 1fr;
    }
}

.cd-sidebar {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
}

.cd-sidebar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 14px 12px 10px 16px;
}

.cd-sidebar-head h2 {
    margin: 0;
    font-size: 11px;
    letter-spacing: .6px;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 700;
}

.cd-sidebar-list {
    max-height: 70vh;
    overflow-y: auto;
}

.cd-client-item {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 11px 16px;
    border-left: 3px solid transparent;
    text-decoration: none;
    color: inherit;
}

.cd-client-item:hover {
    background: var(--hover);
}

.cd-client-item.active {
    background: var(--primary-soft);
    border-left-color: var(--primary);
}

.cd-client-item .cd-client-name {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--ink);
}

.cd-client-item.active .cd-client-name {
    color: var(--primary-text);
}

.cd-client-item .cd-client-meta {
    font-size: 11.5px;
    color: var(--muted);
}

.cd-empty-sidebar {
    padding: 16px;
    font-size: 12.5px;
    color: var(--muted);
}

.cd-detail {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.cd-detail-head {
    padding: 20px 24px 0;
}

.cd-detail-head h1 {
    margin: 0;
    font-size: 20px;
    letter-spacing: -.2px;
}

.cd-detail-sub {
    color: var(--muted);
    font-size: 13px;
    margin-top: 4px;
    display: flex;
    gap: 10px;
    align-items: center;
}

.cd-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11.5px;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 99px;
    background: var(--panel-soft);
    color: var(--muted);
}

.cd-pill::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--muted);
}

.cd-pill.cd-pill-good {
    background: rgba(49, 196, 111, .14);
    color: #1a8a4a;
}

.cd-pill.cd-pill-good::before {
    background: #1a8a4a;
}

body.light-theme .cd-pill.cd-pill-good {
    background: #e8f6ee;
    color: #1a8a4a;
}

.cd-pill.cd-pill-warn {
    background: var(--primary-soft);
    color: var(--primary-text);
}

.cd-pill.cd-pill-warn::before {
    background: var(--primary);
}

.cd-detail .client-tabs {
    margin: 18px 24px 0;
    padding: 0;
}

.cd-detail-body {
    padding: 22px 24px 26px;
}

.cd-section-title {
    font-size: 13px;
    font-weight: 700;
    margin: 0 0 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.cd-explainer {
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-left: 3px solid var(--primary);
    background: var(--panel-soft);
    border-radius: 8px;
    font-size: 12.5px;
    line-height: 1.6;
    color: var(--muted);
    margin-bottom: 18px;
}

.cd-explainer strong {
    color: var(--ink);
}

.cd-explainer a {
    color: var(--primary-text);
    font-weight: 600;
}

.cd-profile-card {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.cd-profile-card .cd-profile-name {
    font-weight: 700;
    font-size: 13.5px;
}

.cd-profile-card .cd-profile-modules {
    color: var(--muted);
    font-size: 12px;
    margin-top: 4px;
    line-height: 1.5;
}

.cd-profile-card .cd-profile-count {
    font-size: 11.5px;
    color: var(--muted);
    white-space: nowrap;
}

.cd-profile-card .cd-profile-actions {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}

.cd-role-chip {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 6px;
    background: var(--panel-soft);
    border: 1px solid var(--line);
    color: var(--muted);
    font-weight: 600;
    text-decoration: none;
}

.cd-role-chip:hover {
    border-color: var(--primary);
    color: var(--primary-text);
}

.call-modal-heading {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.call-modal-phone-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.call-modal-phone-row .live-indicator {
    font-size: 11px;
    white-space: nowrap;
}

.call-modal-phone {
    color: var(--muted);
    font-size: 14px;
    font-weight: 600;
}

.whatsapp-icon-circle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #25d366;
    flex: 0 0 auto;
}

.whatsapp-icon-circle:hover {
    background: #1fb956;
}

.call-modal-backdrop.is-hidden {
    display: none;
}

.call-modal-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
}

.call-modal-actions .icon-button,
.call-modal-actions form {
    flex-shrink: 0;
}

.call-modal-actions .icon-button {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #eef2f7;
    color: var(--ink);
}

.live-call-compact {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    flex-shrink: 0;
}

.live-call-compact .live-indicator {
    font-size: 11px;
    white-space: nowrap;
}

.live-indicator.is-live-call {
    color: var(--primary-text);
}

.live-indicator.is-live-call span {
    background: #22c55e;
    box-shadow: 0 0 0 6px rgba(34, 197, 94, .16);
}

.live-indicator.is-call-ended {
    color: #f97316;
}

.live-indicator.is-call-ended span {
    background: #f97316;
    box-shadow: none;
}

.live-call-compact .timer {
    font-size: 16px;
    font-weight: 800;
    margin: 0;
}

.call-modal-grid {
    display: grid;
    grid-template-columns: 1fr 260px;
    gap: 18px;
    margin-bottom: 18px;
}

.call-modal-grid dl {
    grid-template-columns: 92px 1fr;
}

.call-modal-grid dl.contact-fields {
    grid-template-columns: max-content 1fr max-content 1fr;
}

[data-call-modal] .call-modal-grid,
[data-call-history-modal] .call-modal-grid {
    grid-template-columns: 1fr;
}

.hint-inline {
    color: var(--muted);
    font-weight: 400;
    font-size: 12px;
}

.call-modal-layout {
    display: flex;
    align-items: stretch;
    gap: 16px;
    max-width: 100%;
}

.campaign-script-panel {
    flex: 0 0 300px;
    width: 300px;
    max-height: calc(100vh - 44px);
    overflow: auto;
    background: var(--panel);
    border-radius: 12px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, .42);
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

body.light-theme .campaign-script-panel {
    background: #ffffff;
}

.campaign-script-panel.is-hidden {
    display: none;
}

.campaign-script-panel.is-collapsed {
    flex-basis: 52px;
    width: 52px;
    padding: 18px 10px;
    overflow: hidden;
}

.campaign-script-panel.is-collapsed .campaign-script-body,
.campaign-script-panel.is-collapsed .campaign-script-tag {
    display: none;
}

.campaign-script-panel.is-collapsed .campaign-script-toggle {
    transform: rotate(180deg);
}

.campaign-script-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.campaign-script-tag {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    overflow-wrap: anywhere;
}

.campaign-script-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}

.campaign-script-section h3 {
    margin: 0 0 6px;
    font-size: 12px;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 800;
}

.campaign-script-section p {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
}

.campaign-script-list {
    margin: 0;
    padding-left: 18px;
    display: grid;
    gap: 6px;
    font-size: 14px;
}

.campaign-script-accordion {
    display: grid;
    gap: 8px;
}

.campaign-script-accordion-item {
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
}

.campaign-script-accordion-question {
    width: 100%;
    text-align: left;
    padding: 10px 12px;
    background: var(--panel-soft);
    border: 0;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    color: var(--ink);
}

.campaign-script-accordion-question::after {
    content: '+';
    font-size: 16px;
    line-height: 1;
    flex: 0 0 auto;
}

.campaign-script-accordion-item.is-open .campaign-script-accordion-question::after {
    content: '\2212';
}

.campaign-script-accordion-answer {
    padding: 0 12px;
    max-height: 0;
    overflow: hidden;
    font-size: 13px;
    color: var(--muted);
    transition: max-height .2s ease, padding .2s ease;
}

.campaign-script-accordion-item.is-open .campaign-script-accordion-answer {
    max-height: 320px;
    padding: 10px 12px;
}

.campaign-script-toggle {
    flex: 0 0 auto;
}

@media (max-width: 900px) {
    .call-modal-layout {
        flex-direction: column;
    }
    .campaign-script-panel {
        width: 100%;
        flex-basis: auto;
        max-height: 240px;
    }
    .campaign-script-panel.is-collapsed {
        width: 100%;
        max-height: 52px;
    }
}

.sip-status-grid dd {
    font-weight: 800;
    overflow-wrap: anywhere;
}

.sip-log {
    margin: 0;
    padding-left: 20px;
    max-height: 260px;
    overflow: auto;
    color: var(--muted);
    display: grid;
    gap: 8px;
}

#nvoip-remote-audio {
    width: 100%;
}

@media (max-width: 760px) {
    .webphone {
        right: 14px;
        bottom: 84px;
    }
    .webphone-launcher {
        right: 18px;
        bottom: 18px;
    }
    .call-modal-grid {
        grid-template-columns: 1fr;
    }
}

@keyframes pulse {
    from { opacity: .4; }
    to { opacity: 1; }
}

.radar-loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: grid;
    place-items: center;
    background: rgba(15, 23, 42, .28);
    backdrop-filter: blur(5px);
}

.radar-loading-overlay.is-hidden {
    display: none;
}

.answered-calls-more {
    display: flex;
    justify-content: center;
    padding-top: 16px;
}

.answered-calls-more[hidden] { display: none; }

.answered-calls-loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: grid;
    place-items: center;
    background: rgba(15, 23, 42, .28);
    backdrop-filter: blur(5px);
}

.answered-calls-loading-overlay.is-hidden { display: none; }

.answered-calls-loading-indicator {
    display: grid;
    justify-items: center;
    gap: 14px;
    color: #fff;
}

.answered-calls-loading-indicator span {
    width: 52px;
    height: 52px;
    border: 5px solid rgba(255, 255, 255, .35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: radar-spin .8s linear infinite;
}

.terms-acceptance-required,
.terms-modal-open { overflow: hidden; }

.terms-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 5000;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(15, 23, 42, .56);
    backdrop-filter: blur(6px);
}

.terms-modal-backdrop.is-hidden { display: none; }

.terms-modal {
    width: min(920px, 100%);
    max-height: min(88vh, 860px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    color: var(--text);
    box-shadow: 0 24px 70px rgba(0, 0, 0, .32);
}

.terms-modal-header {
    padding: 24px 30px 20px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    border-bottom: 1px solid var(--line);
}

.terms-modal-header > div { display: grid; gap: 6px; }
.terms-modal-header span { color: #d92a1f; font-size: .78rem; font-weight: 800; text-transform: uppercase; }
.terms-modal-header h2 { margin: 0; font-size: 1.75rem; }
.terms-modal-header p { margin: 0; color: var(--muted); }

.terms-modal-content {
    padding: 12px 30px 28px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.terms-document { max-width: 780px; margin: 0 auto; line-height: 1.65; }
.terms-document h3 { margin: 28px 0 10px; color: #d92a1f; font-size: 1.12rem; }
.terms-document p { margin: 0 0 14px; }
.terms-document ul { margin: 0 0 16px; padding-left: 24px; }
.terms-document li { margin: 4px 0; }

.terms-modal-footer {
    padding: 18px 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    border-top: 1px solid var(--line);
    background: var(--panel);
}

.terms-acceptance-form {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.terms-acceptance-form .check { margin: 0; font-weight: 700; }
.terms-acceptance-form .button { flex: 0 0 auto; }
.terms-review-button { margin-top: 18px; font-size: .78rem; }

@media (max-width: 720px) {
    .terms-modal-backdrop { padding: 10px; }
    .terms-modal { max-height: 94vh; }
    .terms-modal-header { padding: 18px; }
    .terms-modal-header h2 { font-size: 1.3rem; }
    .terms-modal-content { padding: 8px 18px 22px; }
    .terms-modal-footer, .terms-acceptance-form { align-items: stretch; flex-direction: column; }
    .terms-acceptance-form .button, .terms-modal-footer > .button { width: 100%; text-align: center; }
}

.radar-loading-indicator {
    display: grid;
    justify-items: center;
    gap: 14px;
    color: #fff;
}

.radar-loading-spinner {
    width: 52px;
    height: 52px;
    border: 5px solid rgba(255, 255, 255, .35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: radar-spin .8s linear infinite;
}

.radar-is-loading {
    overflow: hidden;
}

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

@media (max-width: 1180px) {
    .metric-grid { grid-template-columns: repeat(3, 1fr); }
    .agent-layout, .grid.two { grid-template-columns: 1fr; }
    .payment-card-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .reports-page .reports-filter-grid { grid-template-columns: repeat(3, minmax(145px, 1fr)); }
    .report-call-modal-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .report-detail-recording { grid-column: 1 / -1; }
}

@media (max-width: 920px) {
    .reports-page .reports-filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .reports-indicator-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .reports-indicator-grid { grid-template-columns: 1fr; }
    .reports-indicator-wide { grid-column: auto; }
}

@media (max-width: 760px) {
    .parallel-dial-counts { grid-template-columns: 1fr; }
    .app-shell { grid-template-columns: 1fr; }
    .sidebar {
        position: static;
        height: auto;
        max-height: none;
    }
    nav {
        grid-template-columns: repeat(2, 1fr);
        overflow: visible;
        padding-right: 0;
    }
    main { padding: 18px; }
    .active-call-banner {
        margin: -18px -18px 18px;
        padding: 10px 18px;
        align-items: flex-start;
        flex-direction: column;
        gap: 4px;
    }
    .topbar { align-items: flex-start; }
    .metric-grid, .metric-grid.compact { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .payment-card-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .payment-method-selector { gap: 4px; }
    .payment-method-option { min-height: 96px; padding-inline: 4px; }
    .payment-method-option strong { font-size: .82rem; }
    .payment-method-option small { font-size: .72rem; }
    .payment-guide-steps { grid-template-columns: 1fr; gap: 18px; }
    .payment-guide-steps div:not(:last-child)::after { display: none; }
    .reports-content-heading h2 { font-size: 21px; }
    .reports-page .report-tabs { gap: 14px; overflow-x: auto; }
    .reports-page .reports-filter-grid { grid-template-columns: 1fr; }
    .reports-filter-actions { justify-content: stretch; }
    .reports-filter-actions .button { flex: 1 1 0; text-align: center; }
    .reports-indicator-metrics { grid-template-columns: 1fr; }
    .report-call-modal-grid { grid-template-columns: 1fr; }
    .report-detail-recording { grid-column: auto; }
}

/* Secao Roteiros - escopo estrito, nao reutiliza/edita regras de outros modais */
.roteiro-form .field-label {
    display: block;
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 6px;
}

.roteiro-form .repeater-list {
    display: grid;
    gap: 8px;
    margin-bottom: 8px;
}

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

.roteiro-form .repeater-row-pair {
    grid-template-columns: 1fr auto;
    grid-template-areas: "question remove" "answer answer";
    align-items: start;
}

.roteiro-form .repeater-row-pair input {
    grid-area: question;
}

.roteiro-form .repeater-row-pair button {
    grid-area: remove;
}

.roteiro-form .repeater-row-pair textarea {
    grid-area: answer;
    resize: vertical;
}
