:root {
    --bg: #f4f6f8;
    --panel: #ffffff;
    --ink: #17202a;
    --muted: #6b7785;
    --line: #dce2e8;
    --accent: #1f8a70;
    --accent-strong: #146c57;
    /* Cor da marca por instalacao. Os valores aqui sao os da ATCONSYS; outro
       cliente sobrescreve pelo app/Theme.php (Configuracoes > Integracoes >
       Aparencia). --accent-contrast e o texto sobre o destaque: o Theme
       escolhe branco ou escuro pelo contraste, para cor clara nao sumir. */
    --accent-contrast: #fff;
    /* Fundo do botao no hover. Separado do --accent-strong porque aquele e
       usado como TEXTO sobre fundo branco (precisa ser escuro), e este e
       FUNDO sob o --accent-contrast (com texto escuro, precisa clarear). */
    --accent-hover: #146c57;
    --sidebar: #0b2a4a;
    --sidebar-active: #16466f;
    --blue: #2f6fed;
    --amber: #b66a00;
    --red: #b2362d;
    --shadow: 0 12px 30px rgba(18, 30, 45, .08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr) 72px;
    background: var(--bg);
    color: var(--ink);
    font-family: Arial, Helvetica, sans-serif;
    overflow-x: hidden;
}

.login-body {
    display: grid;
    grid-template-columns: 1fr;
    place-items: center;
    min-height: 100vh;
    padding: 24px;
    background:
        linear-gradient(135deg, rgba(23, 35, 45, .92), rgba(31, 138, 112, .78)),
        #17232d;
}

.login-shell {
    width: min(420px, 100%);
}

.login-panel {
    display: grid;
    gap: 24px;
    padding: 28px;
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .22);
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #10243a;
}

.login-brand strong {
    display: block;
    font-size: 22px;
}

.login-brand small {
    display: block;
    margin-top: 4px;
    color: var(--muted);
}

.login-form {
    display: grid;
    gap: 16px;
}

.login-form label {
    display: grid;
    gap: 6px;
    color: #51627a;
    font-weight: 700;
}

.login-form input {
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
    color: var(--ink);
}

.login-error {
    margin: 0;
    padding: 10px 12px;
    border-radius: 8px;
    background: #ffe5e5;
    color: #b2362d;
    font-weight: 700;
}

.logout-link {
    display: inline-block;
    margin-top: 8px;
    color: #64d7f4;
    font-size: 13px;
    font-weight: 800;
    text-decoration: none;
}

button,
input,
textarea,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

.sidebar {
    background: var(--sidebar);
    color: #eef3f8;
    padding: 22px 18px;
    display: flex;
    flex-direction: column;
    gap: 28px;
    min-height: 100vh;
}

.brand,
.profile {
    display: flex;
    gap: 12px;
    align-items: center;
}

.brand small,
.profile small {
    display: block;
    color: #aeb9c4;
    margin-top: 3px;
}

.brand-mark,
.avatar {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: var(--accent);
    color: var(--accent-contrast);
    font-weight: 700;
}

.nav {
    display: grid;
    gap: 6px;
}

.nav-item {
    width: 100%;
    min-height: 62px;
    border: 0;
    border-radius: 8px;
    color: #dce5ee;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    text-align: left;
}

.nav-item[hidden] {
    display: none !important;
}

.nav-item:hover,
.nav-item.active {
    background: var(--sidebar-active);
    color: #fff;
}

.nav-item.nav-group {
    margin-top: 8px;
    color: #64d7f4;
    font-weight: 800;
}

.profile {
    margin-top: auto;
    padding-top: 18px;
    border-top: 1px solid rgba(255,255,255,.12);
}

.profile-status {
    display: block;
    width: 100%;
    margin: 7px 0 3px;
    padding: 5px 24px 5px 8px;
    border: 1px solid rgba(255,255,255,.2);
    border-radius: 4px;
    color: #eaf4ff;
    background: #173e62;
    font-size: 12px;
}

.shell {
    min-width: 0;
    max-width: 100%;
    padding: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.topbar {
    min-height: 58px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 0;
    padding: 0 12px;
    border-bottom: 1px solid var(--line);
    background: #f8fafc;
}

.eyebrow {
    margin: 0 0 4px;
    color: var(--accent);
    font-weight: 700;
    font-size: 13px;
}

h1,
h2 {
    margin: 0;
}

h1 {
    font-size: 22px;
}

h2 {
    font-size: 18px;
}

.topbar-actions {
    display: flex;
    align-items: end;
    gap: 10px;
}

.search {
    display: grid;
    gap: 5px;
    color: var(--muted);
    font-size: 12px;
}

.search input,
textarea,
select,
.settings-form input,
dialog input {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    padding: 10px 12px;
    color: var(--ink);
    outline: none;
}

.search input {
    width: min(36vw, 360px);
}

.primary,
.secondary {
    min-height: 40px;
    border-radius: 8px;
    border: 1px solid transparent;
    padding: 0 14px;
    font-weight: 700;
}

.primary {
    color: var(--accent-contrast);
    background: var(--accent);
}

.primary:hover {
    background: var(--accent-hover);
}

.secondary {
    color: var(--ink);
    background: #fff;
    border-color: var(--line);
}

.new-chat-alert {
    min-height: 58px;
    margin-bottom: 0;
    padding: 10px 12px;
    border: 1px solid #f4b740;
    border-radius: 8px;
    background: #fff7df;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow);
}

.new-chat-alert[hidden] {
    display: none;
}

.new-chat-alert span {
    color: var(--muted);
    flex: 1;
}

.new-chat-alert.pulse {
    animation: alertPulse 1s ease-in-out infinite;
}

@keyframes alertPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(244, 183, 64, .25), var(--shadow);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(244, 183, 64, .12), var(--shadow);
    }
}

.view {
    display: none;
}

.view.active {
    display: block;
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    overflow-x: hidden;
}

#view-chats.active {
    display: grid;
    grid-template-rows: minmax(0, 1fr);
    grid-template-columns: minmax(0, 320px) minmax(0, 1fr);
    height: auto;
    min-height: 0;
    overflow: hidden;
    max-width: 100%;
}

.queue-header,
.metric,
.conversation,
.chat-panel,
.contact-panel,
.split > section,
.settings-grid > section,
.automation > section,
.table,
.channel-list,
.rule-list {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.queue-header {
    width: 100%;
    min-width: 0;
    min-height: 52px;
    padding: 12px;
    text-align: left;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 56px 24px;
    align-items: center;
    column-gap: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.queue-header > span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.queue-section.active .queue-header {
    border-color: var(--accent);
}

.queue-header strong {
    width: 56px;
    height: 32px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: #081522;
    color: #fff;
    font-size: 18px;
}

.queue-header em {
    width: 24px;
    justify-self: end;
    color: #63758a;
    font-style: normal;
    font-size: 20px;
    text-indent: -999px;
    overflow: hidden;
    position: relative;
}

.queue-header em::after {
    content: "\203A";
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    text-indent: 0;
}

.queue-section.active .queue-header em::after {
    content: "\2304";
}

.status-tabs {
    padding: 12px 10px;
    display: grid;
    align-content: start;
    gap: 9px;
    border-right: 1px solid var(--line);
    background: #f4f7fa;
    overflow: auto;
    overflow-x: hidden;
    height: 100%;
    min-height: 0;
    max-width: 320px;
}

.empty-queue {
    padding: 12px;
    border: 1px dashed var(--line);
    border-radius: 8px;
    color: var(--muted);
    background: #fff;
    font-size: 13px;
}

.status-tabs,
.status-tabs * {
    min-width: 0;
}

.queue-section,
.queue-items {
    min-width: 0;
    max-width: 100%;
    overflow: visible;
}

.channel-health-alert,
.channel-health-panel {
    margin: 0 0 12px;
    border: 1px solid #d7e2ee;
    background: #f8fbff;
    color: #0b2540;
}

.channel-health-alert {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: space-between;
    padding: 12px 16px;
}

.channel-health-alert[hidden],
.channel-health-panel[hidden] {
    display: none;
}

.channel-health-alert div {
    display: grid;
    gap: 2px;
}

.channel-health-alert strong {
    font-size: 1rem;
}

.channel-health-alert span {
    color: #51657c;
}

.channel-health-alert.error {
    border-color: #f59e0b;
    background: #fff7df;
}

.channel-health-alert.error strong {
    color: #a24100;
}

.channel-health-alert.online {
    border-color: #bbf7d0;
    background: #f0fdf4;
}

.channel-health-panel {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 1px;
    overflow: hidden;
}

.channel-health-panel div {
    display: grid;
    gap: 4px;
    padding: 12px;
    background: #fff;
    min-width: 0;
}

.channel-health-panel span {
    color: #64748b;
    font-size: .82rem;
}

.channel-health-panel strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.outbox-panel { margin: 0 0 12px; border: 1px solid #f0c36b; background: #fffaf0; }
.outbox-panel[hidden] { display: none; }
.outbox-panel > header,
.outbox-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; }
.outbox-panel > header { border-bottom: 1px solid #f2dfb5; }
.outbox-panel header div,
.outbox-item div { display: grid; gap: 3px; min-width: 0; }
.outbox-panel .outbox-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}
.outbox-panel span,
.outbox-item span { color: #64748b; font-size: 12px; overflow-wrap: anywhere; }
.outbox-note { margin: 0; padding: 10px 14px; color: #64748b; font-size: 14px; }
.outbox-item + .outbox-item { border-top: 1px solid #f2dfb5; }
.outbox-item.failed { background: #fff1f1; }

.queue-section:not(.active) .queue-items {
    display: none;
}

.workspace {
    display: grid;
    grid-template-columns: minmax(420px, 1fr);
    gap: 0;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.queue-items {
    display: grid;
    gap: 6px;
    margin: 4px 0 8px;
}

.conversation-list {
    display: grid;
    align-content: start;
    gap: 8px;
    padding: 12px 10px;
    border-right: 1px solid var(--line);
    background: #f4f7fa;
    overflow: auto;
}

.conversation {
    border: 1px solid var(--line);
    padding: 14px;
    text-align: left;
    max-width: 100%;
    overflow: hidden;
}

.conversation.compact {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 8px;
    padding: 7px 8px;
    min-width: 0;
    min-height: 76px;
    width: 100%;
    max-width: 100%;
    box-shadow: 0 2px 8px rgba(18, 30, 45, .06);
    align-items: start;
}

.conversation.compact header {
    align-items: center;
    min-width: 0;
    gap: 6px;
}

.conversation.compact header strong {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 15px;
    display: block;
}

.conversation.compact time {
    color: #334155;
    font-size: 12px;
    white-space: nowrap;
}

.conversation.compact small {
    display: block;
    color: var(--muted);
    margin-top: 1px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
    max-width: 100%;
}

.conversation-body {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}

.conversation-tools {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex: 0 0 auto;
}

.mini-delete {
    width: 20px;
    height: 20px;
    display: grid;
    place-items: center;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: #64748b;
    font-size: 13px;
    line-height: 1;
}

.mini-delete:hover {
    border-color: #fecaca;
    background: #fee2e2;
    color: #b91c1c;
}

.queue-avatar {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #b8bec5;
    color: #fff;
    font-size: 17px;
    font-weight: 800;
}

.conversation.active {
    border-color: var(--accent);
}

.conversation.waiting {
    animation: waitingBlink 1.1s linear infinite;
}

.conversation.sla-overdue {
    border-color: #ef4444;
    background: #fff5f5;
    box-shadow: inset 4px 0 0 #ef4444;
}

.conversation.sla-overdue.waiting {
    animation: slaBlink 1s linear infinite;
}

@keyframes waitingBlink {
    0%, 100% {
        border-color: var(--line);
    }
    50% {
        border-color: #f4b740;
        background: #fffaf0;
    }
}

@keyframes slaBlink {
    0%, 100% {
        border-color: #ef4444;
        background: #fff5f5;
    }
    50% {
        border-color: #b91c1c;
        background: #ffe4e6;
    }
}

.conversation header,
.conversation footer,
.chat-header,
.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.conversation:not(.compact) p {
    color: var(--muted);
    margin: 8px 0;
}

.conversation.compact p {
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 4px 0 0;
    font-size: 12px;
    line-height: 1.25;
    max-width: 100%;
}

.queue-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 5px;
    min-height: 0;
    max-height: 42px;
    overflow: hidden;
}

.priority-chip,
.wait-chip,
.sla-chip {
    display: inline-flex;
    align-items: center;
    min-height: 18px;
    border-radius: 999px;
    padding: 0 7px;
    font-size: 10px;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
}

.priority-chip {
    background: #e8eef6;
    color: #32445a;
}

.priority-chip.high {
    background: #ffe5e5;
    color: #c62828;
}

.priority-chip.medium {
    background: #fff3d6;
    color: #a15c00;
}

.priority-chip.low {
    background: #e8f6f1;
    color: #146c57;
}

.wait-chip {
    background: #edf5ff;
    color: #1d4f91;
}

.sla-chip {
    background: #e8f6f1;
    color: #146c57;
}

.sla-chip.overdue {
    background: #fee2e2;
    color: #b91c1c;
}

.badge {
    display: inline-flex;
    min-height: 24px;
    align-items: center;
    border-radius: 999px;
    padding: 0 9px;
    font-size: 12px;
    font-weight: 700;
    background: #e8f6f1;
    color: var(--accent-strong);
}

.badge.warn {
    background: #fff3df;
    color: var(--amber);
}

.badge.danger {
    background: #ffe8e5;
    color: var(--red);
}

.card-action {
    width: 100%;
    max-width: 100%;
    min-height: 26px;
    margin-top: 5px;
    border-radius: 6px;
    border: 1px solid var(--accent);
    background: #fff;
    color: var(--accent-strong);
    font-size: 13px;
    font-weight: 700;
    padding: 0 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-panel {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    height: 100%;
    min-height: 0;
    border-radius: 0;
    border-top: 0;
    border-bottom: 0;
    box-shadow: none;
}

.chat-header {
    padding: 16px;
    border-bottom: 1px solid var(--line);
    background: #fff;
    min-height: 74px;
}

.chat-header small {
    display: block;
    color: var(--muted);
    margin-top: 4px;
}

.chat-client-name {
    display: inline-flex;
    max-width: min(520px, 55vw);
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--ink);
    font: inherit;
    font-size: 16px;
    font-weight: 800;
    text-align: left;
    text-decoration: underline;
    text-decoration-color: transparent;
    text-underline-offset: 4px;
    cursor: pointer;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-client-name:hover,
.chat-client-name:focus-visible {
    color: var(--accent-strong);
    text-decoration-color: currentColor;
}

.chat-client-name:disabled {
    color: var(--ink);
    cursor: default;
    text-decoration: none;
}

.messages {
    padding: 18px 18px 142px;
    overflow: auto;
    scrollbar-gutter: stable;
    min-height: 0;
    overscroll-behavior: contain;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background-color: #eef2f4;
    background-image:
        radial-gradient(circle at 18px 18px, rgba(23,32,42,.08) 1px, transparent 1px),
        radial-gradient(circle at 42px 42px, rgba(23,32,42,.06) 1px, transparent 1px);
    background-size: 54px 54px;
}

.message {
    max-width: min(520px, 78%);
    padding: 10px 12px;
    border-radius: 8px;
    background: #eef2f6;
    line-height: 1.4;
}

.empty-chat {
    min-height: 100%;
    display: grid;
    place-items: center;
}

.empty-chat img {
    width: 148px;
    height: 148px;
    display: block;
    object-fit: contain;
}

.message.out {
    align-self: flex-end;
    background: #ddf3ea;
}

.message.whisper {
    align-self: center;
    width: min(520px, 92%);
    max-width: 92%;
    border: 1px dashed var(--blue);
    background: #eef4ff;
    color: #173c88;
}

.message.whisper::before {
    content: attr(data-whisper-label);
    display: block;
    margin-bottom: 4px;
    font-size: 12px;
    font-weight: 700;
}

.message.system {
    align-self: center;
    max-width: min(620px, 92%);
    border: 1px dashed var(--line);
    background: rgba(255, 255, 255, .84);
    color: #526272;
    text-align: center;
}

.message small {
    display: block;
    color: var(--muted);
    margin-top: 5px;
}

.delivery-error {
    display: block;
    margin-top: 8px;
    padding: 7px 9px;
    border-radius: 7px;
    background: #fff1f2;
    color: #b91c1c;
    font-style: normal;
    font-size: 12px;
    font-weight: 700;
}

.message strong {
    display: block;
    margin-bottom: 3px;
    font-size: 13px;
}

.message span {
    display: block;
    word-break: break-word;
}

.media-preview,
.media-file {
    color: inherit;
    text-decoration: none;
}

.media-preview img {
    display: block;
    width: min(260px, 100%);
    max-height: 220px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 6px;
}

.media-video {
    display: block;
    width: min(320px, 100%);
    max-height: 240px;
    border-radius: 8px;
    margin-bottom: 6px;
    background: #111827;
}

.media-file {
    display: inline-flex;
    min-height: 34px;
    align-items: center;
    border-radius: 8px;
    padding: 7px 10px;
    background: rgba(15, 23, 42, .08);
    font-weight: 700;
}

.file-card {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    width: 100%;
    min-height: 66px;
    padding: 10px 11px;
    border-radius: 0;
    background: rgba(241, 245, 249, .9);
    border: 0;
    box-shadow: none;
    color: var(--text);
}

.file-card-shell {
    display: block;
    width: min(360px, 72vw);
    overflow: hidden;
    border: 1px solid rgba(15, 23, 42, .09);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .08);
    color: inherit;
    text-decoration: none;
}

.message.out .file-card-shell {
    background: #d9fdd3;
}

.message.out .file-card {
    background: rgba(19, 78, 57, .08);
}

.file-card-disabled {
    cursor: default;
    opacity: .86;
}

.file-card-icon {
    position: relative;
    width: 36px;
    height: 42px;
    border-radius: 7px;
    background: #e8f2ff;
    border: 1px solid #bdd7f6;
}

.file-card-icon::before {
    content: attr(data-file-extension);
    display: grid;
    place-items: center;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: #1f78d1;
    font-size: 9px;
    font-weight: 800;
}

.file-card-icon::after {
    display: none;
}

.file-card-icon-sheet {
    background: #dcfce7;
    border-color: #86efac;
}

.file-card-icon-sheet::before {
    color: #15803d;
}

.file-card-icon-pdf {
    background: #fee2e2;
    border-color: #fca5a5;
}

.file-card-icon-pdf::before {
    color: #dc2626;
}

.file-card-content {
    min-width: 0;
}

.file-card-content strong {
    display: block;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
}

.file-card-content small {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
}

.file-card-action {
    display: grid;
    width: 24px;
    height: 24px;
    place-items: center;
    border-radius: 999px;
    color: #1f78d1;
    font-weight: 800;
}

.file-card-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border-top: 1px solid rgba(15, 23, 42, .1);
}

.file-card-actions span {
    display: grid;
    min-height: 42px;
    place-items: center;
    padding: 7px 10px;
    color: #07865f;
    text-align: center;
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
}

.file-card-actions span + span {
    border-left: 1px solid rgba(15, 23, 42, .1);
}

.file-card-shell:hover .file-card-actions {
    background: rgba(7, 134, 95, .08);
}

.file-card-disabled .file-card-actions span {
    grid-column: 1 / -1;
    color: var(--muted);
}

.audio-bubble {
    position: relative;
    display: grid;
    grid-template-columns: 38px minmax(180px, 1fr);
    align-items: center;
    gap: 10px;
    min-width: min(360px, 70vw);
    padding: 8px 42px 8px 8px;
    border-radius: 8px;
    background: #fff;
}

.message.out .audio-bubble {
    background: #d5f0e4;
}

.audio-avatar {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #7db4ff;
    color: #fff;
    font-size: 18px;
    font-weight: 900;
}

.audio-player {
    min-width: 0;
    display: grid;
    gap: 4px;
}

.audio-player audio {
    width: 100%;
    height: 32px;
}

.audio-player span,
.audio-unavailable {
    color: var(--muted);
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.audio-actions {
    position: absolute;
    right: 8px;
    top: 8px;
    display: flex;
    gap: 5px;
    opacity: 0;
    transform: translateY(-2px);
    transition: .15s ease;
    pointer-events: none;
}

.audio-bubble:hover .audio-actions {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.audio-icon-action {
    width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 6px;
    background: rgba(255,255,255,.92);
    color: var(--text);
    font-size: 15px;
    font-weight: 900;
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(0,0,0,.12);
    cursor: pointer;
}

.audio-icon-action:disabled {
    opacity: .45;
    cursor: not-allowed;
}

.composer {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px 14px 12px;
    border-top: 1px solid var(--line);
    background: #fff;
    flex-shrink: 0;
    min-height: 118px;
    position: sticky;
    bottom: 0;
    z-index: 24;
    box-shadow: 0 -12px 28px rgba(18, 30, 45, .08);
}

.ai-question-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.ai-question-bar #ai-question {
    flex: 1;
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    padding: 10px 12px;
    color: var(--ink);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.ai-question-restore {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: #2475cf;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}

.ai-question-restore:hover,
.ai-question-restore:focus-visible {
    background: #2475cf;
    color: #fff;
    outline: none;
}

.ai-question-restore[hidden] {
    display: none;
}

.ai-filter-select {
    flex: 0 0 auto;
    width: auto;
    min-width: 120px;
}

.ai-filter-select[hidden] {
    display: none;
}

@media (max-width: 900px) {
    .ai-question-bar {
        flex-wrap: wrap;
    }

    .ai-question-bar #ai-question {
        flex: 1 1 100%;
    }

    .ai-filter-select {
        flex: 1 1 auto;
    }
}

.composer-row {
    position: relative;
    display: flex;
    align-items: flex-end;
    gap: 10px;
    min-width: 0;
}

.composer-tools {
    display: flex;
    align-items: stretch;
    gap: 8px;
}

.composer textarea {
    flex: 1;
    min-width: 0;
    min-height: 72px;
    resize: none;
    max-height: 96px;
    overflow: auto;
    scrollbar-gutter: stable;
}

.composer .primary {
    flex: 0 0 auto;
    align-self: stretch;
}

.ai-response-panel {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 8px;
    max-height: 208px;
    padding: 10px 14px;
    border: 1px solid #b9dcff;
    border-radius: 10px;
    background: #eef7ff;
    color: #0f2942;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.7);
    overflow: hidden;
}

.ai-response-panel strong {
    font-size: 14px;
    font-weight: 800;
}

.ai-response-panel span {
    font-size: 13px;
    color: #54708d;
    line-height: 1.4;
}

.ai-response-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 2px 0;
    border: 0;
    background: transparent;
    color: #0f2942;
    text-align: left;
    cursor: pointer;
}

.ai-response-toggle-caret {
    font-size: 12px;
    color: #2475cf;
}

.ai-response-count {
    font-size: 12px;
    color: #54708d;
}

.ai-response-body {
    display: flex;
    min-height: 0;
    overflow: hidden;
}

.ai-response-panel.is-collapsed {
    max-height: none;
}

.ai-response-panel.is-collapsed .ai-response-body {
    display: none;
}

.ai-response-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    width: 100%;
    max-height: 156px;
    overflow-y: auto;
    padding-right: 4px;
}

.ai-response-item {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    border: 1px solid #c9e1ff;
    border-radius: 10px;
    background: #fff;
    color: #10243a;
    transition: border-color .18s ease, box-shadow .18s ease;
}

.ai-response-item.is-open {
    border-color: #62a8ff;
    box-shadow: 0 8px 18px rgba(34, 98, 186, .10);
}

.ai-response-item-head {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    padding: 9px 12px;
    cursor: pointer;
}

.ai-response-item-caret {
    font-size: 11px;
    color: #2475cf;
    transition: transform .15s ease;
}

.ai-response-item.is-open .ai-response-item-caret {
    transform: rotate(90deg);
}

.ai-response-item-titlewrap {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
    flex: 1 1 auto;
}

.ai-response-item-title {
    font-size: 13px;
    font-weight: 800;
    color: #0f2942;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ai-response-item-category {
    font-size: 11px;
    color: #6a86a3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ai-response-use {
    flex: 0 0 auto;
    flex-shrink: 0;
    padding: 4px 12px;
    border: 1px solid #62a8ff;
    border-radius: 999px;
    background: #eaf4ff;
    color: #1b62b8;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}

.ai-response-use:hover,
.ai-response-use:focus-visible {
    background: #2475cf;
    color: #fff;
    outline: none;
}

.ai-response-item-body {
    display: none;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    padding: 0 12px 11px 31px;
}

.ai-response-item.is-open .ai-response-item-body {
    display: flex;
}

.ai-response-item-content {
    font-size: 13px;
    line-height: 1.5;
    color: #46627e;
    min-width: 0;
    max-width: 100%;
    max-height: 160px;
    overflow-x: hidden;
    overflow-y: auto;
    overflow-wrap: break-word;
    word-break: break-word;
    white-space: pre-wrap;
}

.ai-response-item-source {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .02em;
    text-transform: uppercase;
    color: #2475cf;
}

.mic-button {
    width: 52px;
    min-height: 72px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: #10243a;
    font-size: 24px;
    font-weight: 800;
    cursor: pointer;
}

.mic-button:hover,
.mic-button.recording {
    border-color: var(--accent);
    color: var(--accent-strong);
}

.mic-button.recording {
    background: #fff1f2;
    border-color: #e53935;
    color: #e53935;
    box-shadow: 0 0 0 3px rgba(229, 57, 53, .12);
}

.whisper-toggle {
    flex: 0 0 auto;
    align-self: stretch;
    min-height: 72px;
    padding: 0 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.attach-button {
    width: 52px;
    min-height: 72px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    font-size: 28px;
    font-weight: 500;
    cursor: pointer;
}

.emoji-button {
    width: 52px;
    min-height: 72px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: #10243a;
    font-size: 24px;
    font-weight: 800;
    cursor: pointer;
}

.emoji-button:hover,
.emoji-button.active {
    border-color: var(--accent);
    color: var(--accent);
}

.emoji-panel {
    position: absolute;
    left: 0;
    bottom: calc(100% + 10px);
    width: min(420px, 100%);
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 6px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #17232d;
    box-shadow: 0 16px 42px rgba(0, 0, 0, .24);
    z-index: 8;
}

.emoji-panel[hidden] {
    display: none;
}

.emoji-panel button {
    min-width: 0;
    min-height: 36px;
    border: 0;
    border-radius: 6px;
    background: rgba(255, 255, 255, .08);
    font-size: 22px;
}

.emoji-panel button:hover {
    background: rgba(255, 255, 255, .18);
}

.clipboard-preview {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding: 8px 10px;
    border: 1px dashed var(--accent);
    border-radius: 8px;
    background: #eefdf8;
    color: var(--ink);
}

.clipboard-preview[hidden] {
    display: none;
}

.clipboard-preview img {
    width: 72px;
    height: 52px;
    object-fit: cover;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
}

.clipboard-preview .clipboard-preview-info {
    min-width: 0;
    display: grid;
    gap: 2px;
}

.clipboard-preview strong,
.clipboard-preview small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.clipboard-preview small {
    color: var(--muted);
}

.clipboard-preview button {
    margin-left: auto;
    min-width: 38px;
    min-height: 38px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    font-size: 22px;
    font-weight: 800;
    cursor: pointer;
}

.clipboard-preview button:hover {
    border-color: #e53935;
    color: #e53935;
}

.attach-button input {
    display: none;
}

.attach-button:hover {
    border-color: var(--accent);
    color: var(--accent-strong);
}

.whisper-toggle.is-active,
.whisper-toggle:has(input:checked) {
    border-color: var(--amber);
    color: #7a4a00;
    background: #fff3d6;
    font-weight: 800;
    box-shadow: 0 0 0 3px rgba(182, 106, 0, .18);
}

.composer textarea.whisper-active {
    border-color: var(--amber);
    background: #fff8ea;
    box-shadow: 0 0 0 3px rgba(182, 106, 0, .14);
}

.team-panel {
    position: fixed;
    top: 0;
    right: 72px;
    z-index: 40;
    width: min(360px, calc(100vw - 92px));
    height: 100vh;
    padding: 16px;
    border-left: 1px solid var(--line);
    background: #fff;
    display: grid;
    grid-template-rows: auto 1fr auto;
    min-height: 0;
    box-shadow: -18px 0 45px rgba(15, 23, 42, .18);
    transform: translateX(calc(100% + 72px));
    transition: transform .22s ease;
}

.team-panel.open {
    transform: translateX(0);
}

.team-panel header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--line);
}

.drawer-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.team-panel small {
    display: block;
    color: var(--muted);
    margin-top: 3px;
}

.online-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #3dbb55;
    box-shadow: 0 0 0 4px rgba(61,187,85,.18);
}

.team-online {
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}

.team-online > strong,
.team-online-empty {
    display: block;
    color: #10243a;
    font-size: 13px;
    font-weight: 800;
    margin-bottom: 8px;
}

.team-online-empty {
    color: var(--muted);
    margin-bottom: 0;
}

.team-online-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.team-online-list button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    min-height: 34px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    color: #10243a;
    padding: 6px 10px;
    font-weight: 800;
}

.team-online-list button:hover {
    border-color: var(--accent);
    color: var(--accent-strong);
}

.team-online-list i {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #ef4444;
}

.team-online-list i.online {
    background: #22c55e;
}

.team-online-list i.ausente {
    background: #f59e0b;
}

.team-online-list small {
    margin: 0;
    color: var(--muted);
    font-size: 11px;
}

.team-messages {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px 0;
    overflow: auto;
}

.team-note {
    padding: 10px 12px;
    border-radius: 8px;
    background: #f1f5f9;
    line-height: 1.35;
}

.team-note.me {
    margin-left: 28px;
    background: #e8f6f1;
}

.team-note strong,
.team-note small {
    display: block;
}

.team-note small {
    color: var(--muted);
    margin-top: 5px;
}

.team-composer {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

.team-composer input {
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
    outline: none;
}

.utility-rail {
    position: sticky;
    top: 0;
    height: 100vh;
    background: #f8fafc;
    border-left: 1px solid #d8dde4;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 22px;
    padding-top: 18px;
    z-index: 45;
}

.rail-button {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #183044;
    font-weight: 900;
    font-size: 22px;
}

.rail-button.active {
    border-radius: 0;
    border-left: 4px solid #183044;
}

.rail-button.play {
    color: #1aa259;
    font-size: 34px;
}

.rail-button.appstore {
    background: #0aa7ff;
    color: #fff;
    font-size: 24px;
}

.rail-button.help-rail {
    background: #f4f4f4;
    font-size: 28px;
}

.rail-separator {
    width: 30px;
    height: 1px;
    background: #d8dde4;
}

.history-layout {
    display: grid;
    grid-template-columns: 430px minmax(0, 1fr);
    min-height: calc(100vh - 58px);
    background: #eef2f4;
}

.history-sidebar {
    border-right: 1px solid var(--line);
    background: #f8fafc;
    overflow: hidden;
    display: grid;
    grid-template-rows: auto auto auto auto 1fr;
}

.history-toolbar {
    min-height: 72px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
    background: #e8edf2;
}

.history-toolbar strong {
    margin-right: auto;
}

.history-filter-toggle {
    min-width: 92px;
    color: #10243a;
    text-transform: uppercase;
}

.history-search {
    display: grid;
    gap: 6px;
    padding: 12px 16px;
    color: var(--muted);
    font-size: 13px;
    border-bottom: 1px solid var(--line);
}

.history-search input {
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 0 14px;
    outline: none;
}

.history-filter-panel {
    display: grid;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
    background: #fff;
    box-shadow: 0 8px 18px rgba(15, 23, 42, .08);
}

.history-filter-panel[hidden] {
    display: none;
}

.filter-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.filter-grid label {
    display: grid;
    gap: 5px;
    color: #51627a;
    font-size: 12px;
    font-weight: 700;
}

.filter-grid input,
.filter-grid select {
    min-width: 0;
    min-height: 38px;
    border: 1px solid #cfd6de;
    border-radius: 4px;
    background: #fff;
    color: #10243a;
    padding: 0 10px;
}

.filter-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.history-filter-summary {
    min-height: 36px;
    display: flex;
    align-items: center;
    padding: 0 16px;
    border-bottom: 1px solid var(--line);
    color: #51627a;
    font-size: 12px;
    background: #f8fafc;
}

.history-list {
    overflow: auto;
}

.history-selection-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    border-bottom: 1px solid var(--line);
    background: #f1f5f9;
    font-size: 12px;
    color: #51627a;
}

.history-select-all {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    cursor: pointer;
}

.history-selection-count {
    flex: 1;
}

.history-selection-bar button {
    padding: 4px 10px;
    font-size: 12px;
}

.history-row {
    display: grid;
    grid-template-columns: 34px 1fr;
    align-items: center;
    background: #fff;
    border-bottom: 1px solid var(--line);
}

.history-row.is-selected {
    background: #e8f3ee;
}

.history-row.is-selected .history-item {
    background: transparent;
}

.history-select {
    display: grid;
    place-items: center;
    height: 100%;
    padding-left: 12px;
    cursor: pointer;
}

.history-select input {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.history-row .history-item {
    border-bottom: 0;
    padding-left: 8px;
}

.history-item {
    width: 100%;
    min-height: 116px;
    display: grid;
    grid-template-columns: 58px 1fr auto;
    align-items: center;
    gap: 12px;
    border: 0;
    border-bottom: 1px solid var(--line);
    background: #fff;
    padding: 12px 16px;
    text-align: left;
}

.history-item.active {
    background: #d8dde2;
}

.history-avatar {
    width: 54px;
    height: 54px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #b8bec5;
    color: #fff;
    font-size: 24px;
    font-weight: 700;
}

.history-item strong,
.history-item small,
.history-item em {
    display: block;
}

.history-item small {
    color: #334155;
    margin-top: 5px;
}

.history-item em {
    color: var(--muted);
    font-size: 12px;
    font-style: normal;
    margin-top: 5px;
}

.history-item time {
    align-self: start;
    color: #334155;
}

.history-chat {
    display: grid;
    grid-template-rows: auto 1fr;
    min-width: 0;
}

.history-chat-header {
    min-height: 88px;
    padding: 16px 24px;
    background: #fff;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.history-chat-header small {
    display: block;
    margin-top: 4px;
    color: var(--muted);
}

.history-messages {
    padding: 24px;
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background-color: #eef2f4;
    background-image:
        radial-gradient(circle at 18px 18px, rgba(23,32,42,.08) 1px, transparent 1px),
        radial-gradient(circle at 42px 42px, rgba(23,32,42,.06) 1px, transparent 1px);
    background-size: 54px 54px;
}

.history-message {
    max-width: min(620px, 74%);
    border-radius: 8px;
    background: #fff;
    padding: 12px;
    line-height: 1.45;
}

.history-message.out {
    align-self: flex-end;
    background: #cceff8;
}

.history-message.system {
    align-self: center;
    max-width: 70%;
    background: rgba(255,255,255,.8);
    color: var(--muted);
    text-align: center;
}

.history-message.audio,
.history-message.image,
.history-message.file {
    border: 1px solid var(--line);
}

.history-message small {
    display: block;
    color: #0f172a;
    font-size: 12px;
    margin-top: 8px;
    text-align: right;
}

.media-pill {
    display: inline-flex;
    min-height: 34px;
    align-items: center;
    border-radius: 999px;
    padding: 0 12px;
    margin-top: 8px;
    background: #eef4ff;
    color: #173c88;
}

.media-thumb {
    width: 160px;
    height: 96px;
    display: grid;
    place-items: center;
    margin: 8px 0;
    border-radius: 8px;
    background: linear-gradient(135deg, #dbeafe, #bbf7d0);
    color: #173c88;
    font-weight: 700;
}

.system-line {
    font-size: 13px;
}

.empty-history {
    padding: 18px;
    color: var(--muted);
}

.company-page {
    min-height: calc(100vh - 58px);
    background: #f5f7f9;
}

.company-hero {
    height: 150px;
    padding: 0 26px;
    background: #142536;
    color: #fff;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: start;
    padding-top: 12px;
}

.company-hero h2 {
    font-size: 24px;
    justify-self: center;
}

.back-button,
.help-button {
    border: 0;
    background: transparent;
    color: #fff;
    font-weight: 800;
    font-size: 18px;
}

.help-button {
    justify-self: end;
    width: 28px;
    height: 28px;
    border: 2px solid rgba(255,255,255,.9);
    border-radius: 50%;
}

.company-card {
    width: calc(100% - 52px);
    min-height: 660px;
    margin: -66px auto 28px;
    background: #fff;
    border-radius: 8px 8px 0 0;
    box-shadow: 0 6px 22px rgba(15, 23, 42, .14);
    overflow: hidden;
}

.company-tabs {
    min-height: 64px;
    display: grid;
    grid-template-columns: repeat(7, minmax(110px, 1fr));
    border-bottom: 1px solid var(--line);
}

.company-tabs button {
    border: 0;
    background: #fff;
    color: #566985;
    font-weight: 800;
    font-size: 16px;
    border-bottom: 3px solid transparent;
}

.company-tabs button.active {
    color: #10243a;
    border-bottom-color: #10243a;
}

.company-tab {
    display: none;
    padding: 18px 30px 32px;
}

.company-tab.active {
    display: block;
}

.accordion-row {
    width: 100%;
    min-height: 78px;
    border: 0;
    border-bottom: 1px solid var(--line);
    background: #fff;
    color: #162844;
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-align: left;
    font-size: 20px;
}

.company-link-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(120px, 1fr));
    gap: 10px;
    padding: 0 0 16px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 6px;
}

.company-link-grid button {
    min-height: 42px;
    border: 1px solid #cfd6de;
    border-radius: 6px;
    background: #f8fafc;
    color: #10243a;
    font-weight: 800;
}

.company-section {
    display: none;
    padding: 16px 0 20px;
    border-bottom: 1px solid var(--line);
}

.company-section.active {
    display: block;
}

.company-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.company-form-grid label,
.company-wide-field,
.company-link-form label {
    display: grid;
    gap: 6px;
    color: #51627a;
    font-size: 13px;
    font-weight: 700;
}

.company-form-grid label:has(input[type="checkbox"]) {
    grid-template-columns: 1fr auto;
    align-items: center;
    min-height: 42px;
}

.company-toggle-row {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 12px;
    min-height: 44px;
    margin-bottom: 12px;
    color: #10243a;
    font-weight: 800;
}

.company-form-grid .wide,
.company-wide-field {
    grid-column: 1 / -1;
}

.company-form-grid input,
.company-form-grid select,
.company-form-grid textarea,
.company-wide-field textarea,
.company-link-form input,
.company-link-form select,
.company-link-form textarea {
    min-height: 42px;
    border: 1px solid #cfd6de;
    border-radius: 4px;
    background: #fff;
    color: #10243a;
    padding: 8px 12px;
}

.company-form-grid input[type="checkbox"] {
    width: 38px;
    height: 22px;
    min-height: 22px;
}

#company-section-openai .mila-settings-grid + .company-form-grid {
    display: none;
}

.mila-settings-grid .muted-note {
    color: #64748b;
    font-size: 13px;
    line-height: 1.45;
}

.notification-actions,
.inline-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.template-create-form {
    display: grid;
    grid-template-columns: 1fr 180px 180px;
    gap: 12px;
    margin: 18px 0;
    padding: 18px;
    border: 1px solid var(--line);
    background: #f8fafc;
}

.template-create-form[hidden] { display: none; }

.template-create-form label {
    display: grid;
    gap: 6px;
    color: #51627a;
    font-size: 13px;
    font-weight: 700;
}

.template-create-form .wide { grid-column: 1 / -1; }

.template-create-form input,
.template-create-form select,
.template-create-form textarea {
    min-height: 42px;
    padding: 8px 12px;
    border: 1px solid #cfd6de;
    border-radius: 4px;
    background: #fff;
}

.template-grid { grid-template-columns: 1.6fr .7fr .8fr .7fr 100px; }
.template-grid span:first-child { display: grid; gap: 3px; }
.template-grid small { color: #64748b; font-weight: 400; }

.template-status {
    display: inline-flex;
    padding: 4px 8px;
    border-radius: 999px;
    background: #e2e8f0;
    color: #475569;
    font-size: 11px;
}

.template-status.approved { background: #dcfce7; color: #15803d; }
.template-status.pending { background: #fef3c7; color: #b45309; }
.template-status.rejected { background: #fee2e2; color: #b91c1c; }

@media (max-width: 900px) {
    .template-create-form { grid-template-columns: 1fr; }
    .template-create-form .wide { grid-column: auto; }
}

.compact-admin-table .admin-row {
    grid-template-columns: 1fr 1fr 1fr 120px;
}

.satisfaction-trigger-row,
#satisfaction-triggers-table .admin-row,
#company-section-survey-triggers .admin-row.header {
    grid-template-columns: 1fr 1fr 1fr;
}

#satisfaction-report-table .admin-row,
#company-section-survey-report .admin-row.header {
    grid-template-columns: 1.2fr .7fr 1fr 1fr 1fr;
}

.satisfaction-trigger-row select,
.satisfaction-report-filters input {
    width: 100%;
    min-height: 42px;
    border: 1px solid #cfd6de;
    border-radius: 6px;
    padding: 8px 10px;
    background: #fff;
    color: #10243a;
    font-weight: 700;
}

.satisfaction-report-filters,
.satisfaction-summary {
    display: grid;
    gap: 10px;
    margin-bottom: 14px;
}

.satisfaction-report-filters {
    grid-template-columns: repeat(2, minmax(160px, 1fr)) auto auto;
    align-items: end;
}

.satisfaction-report-filters label {
    display: grid;
    gap: 6px;
    color: #51627a;
    font-weight: 800;
}

.satisfaction-summary {
    grid-template-columns: repeat(5, minmax(110px, 1fr));
}

.satisfaction-summary div {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
}

.satisfaction-summary strong,
.satisfaction-summary span {
    display: block;
}

.satisfaction-summary strong {
    color: #10243a;
    font-size: 24px;
}

.satisfaction-summary span {
    color: #607086;
    font-size: 13px;
    font-weight: 800;
}

.company-link-form {
    display: grid;
    gap: 14px;
}

.company-link-form .wide {
    grid-column: 1 / -1;
}

.meta-channel-panel {
    display: grid;
    grid-template-columns: 1.1fr .95fr .95fr;
    gap: 14px;
    margin-bottom: 18px;
}

.cloud-flow-strip {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
    margin: 14px 0;
}

.cloud-flow-strip span {
    min-height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #dce2e8;
    border-radius: 8px;
    background: #f8fafc;
    color: #334155;
    font-size: 12px;
    font-weight: 800;
    text-align: center;
}

.cloud-channel-table {
    margin-bottom: 18px;
}

#company-channels-list {
    display: contents;
}

.cloud-channel-table .admin-row {
    grid-template-columns: 1.4fr .9fr .9fr .8fr 1fr;
}

.cloud-channel-row small {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
}

.row-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.icon-action {
    min-height: 32px;
    padding: 0 10px;
    font-size: 12px;
}

.wide-dialog form {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

.action-card-dialog.wide-dialog {
    width: min(920px, calc(100vw - 36px));
}

.client-details-content {
    display: grid;
    gap: 0;
    margin: 18px 22px 6px;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
}

.client-detail-row {
    display: grid;
    grid-template-columns: minmax(110px, .65fr) minmax(0, 1.35fr) auto;
    align-items: center;
    gap: 12px;
    min-height: 54px;
    padding: 8px 12px;
    background: #fff;
}

.client-detail-row + .client-detail-row {
    border-top: 1px solid var(--line);
}

.client-detail-row span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.client-detail-row strong {
    min-width: 0;
    overflow-wrap: anywhere;
}

.client-detail-copy {
    min-height: 34px;
    padding: 0 10px;
}

.client-copy-status {
    min-height: 20px;
    margin: 0 22px;
    color: var(--accent-strong);
    font-size: 12px;
    font-weight: 700;
}

@media (max-width: 640px) {
    .client-detail-row {
        grid-template-columns: 1fr auto;
    }

    .client-detail-row span {
        grid-column: 1 / -1;
    }
}

.cloud-register-layout {
    display: grid;
    grid-template-columns: .95fr 1fr;
    gap: 18px;
    margin: 22px;
}

.cloud-register-layout > * {
    min-width: 0;
}

.cloud-register-steps,
.cloud-register-form {
    display: grid;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
}

.cloud-register-steps ol {
    margin: 0;
    padding-left: 20px;
    color: #334155;
    line-height: 1.55;
}

.cloud-register-form label {
    display: grid;
    gap: 6px;
    color: #51627a;
    font-size: 13px;
    font-weight: 700;
}

.cloud-register-form input {
    width: 100%;
    min-width: 0;
    min-height: 38px;
    border: 1px solid #cfd6de;
    border-radius: 4px;
    background: #fff;
    color: #10243a;
    padding: 8px 10px;
}

.cloud-register-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.link-button {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.meta-status-card,
.meta-webhook-card,
.meta-test-card {
    display: grid;
    align-content: start;
    gap: 12px;
    min-height: 210px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #f8fafc;
}

.meta-status-card header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.meta-status-card strong,
.meta-webhook-card strong,
.meta-test-card strong {
    color: #10243a;
    font-size: 18px;
}

.meta-status-badge {
    min-height: 28px;
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 0 12px;
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.meta-status-badge.online {
    background: #dff4df;
    color: #27943b;
}

.meta-status-badge.pending,
.meta-status-badge.unknown {
    background: #fff0d8;
    color: #d97706;
}

.meta-status-badge.error {
    background: #ffe5e5;
    color: #e03a3a;
}

.meta-status-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.meta-status-grid span {
    display: grid;
    gap: 5px;
    min-height: 58px;
    padding: 10px;
    border-radius: 8px;
    background: #fff;
    color: var(--muted);
    font-size: 12px;
}

.meta-status-grid strong {
    font-size: 13px;
    color: #10243a;
    overflow: hidden;
    text-overflow: ellipsis;
}

.meta-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.meta-webhook-card label,
.meta-test-card label {
    display: grid;
    gap: 6px;
    color: #51627a;
    font-size: 13px;
    font-weight: 700;
}

.meta-webhook-card input,
.meta-test-card input,
.meta-test-card textarea {
    min-height: 38px;
    border: 1px solid #cfd6de;
    border-radius: 4px;
    background: #fff;
    color: #10243a;
    padding: 8px 10px;
}

.meta-test-card small {
    color: var(--muted);
}

.qr-channel-panel {
    display: grid;
    grid-template-columns: .85fr 1.15fr;
    gap: 16px;
    margin: 0 0 18px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #f8fafc;
}

.qr-channel-panel strong,
.qr-channel-panel span {
    display: block;
}

.qr-channel-panel strong {
    color: #10243a;
    font-size: 18px;
}

.qr-channel-panel > div > span {
    margin-top: 6px;
    color: var(--muted);
    line-height: 1.45;
}

.qr-connection-card {
    display: grid;
    grid-template-columns: 132px 1fr;
    gap: 16px;
    align-items: center;
    min-width: 0;
}

.qr-preview {
    width: 132px;
    height: 132px;
    display: grid;
    place-items: center;
    border: 1px dashed #94a3b8;
    border-radius: 8px;
    background: #fff;
    color: #64748b;
    font-size: 24px;
    font-weight: 900;
    overflow: hidden;
    word-break: break-all;
}

.qr-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.qr-preview strong {
    font-size: 14px;
}

.qr-preview.generated {
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    padding: 14px;
    border-style: solid;
}

.qr-preview.generated span,
.qr-preview.generated strong {
    min-height: 22px;
    border-radius: 3px;
    background: #10243a;
}

.qr-preview.generated strong {
    display: grid;
    grid-column: span 4;
    place-items: center;
    color: #fff;
    font-size: 18px;
}

.qr-connection-info {
    display: grid;
    gap: 10px;
    min-width: 0;
}

.qr-connection-info p {
    margin: 0;
    color: #334155;
    line-height: 1.45;
}

.qr-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.webhook-diagnostic-card {
    display: grid;
    gap: 12px;
    margin: 0 0 18px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
}

.webhook-diagnostic-card header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.webhook-diagnostic-card strong,
.webhook-diagnostic-card span {
    display: block;
}

.webhook-diagnostic-card span {
    margin-top: 4px;
    color: var(--muted);
    font-size: 13px;
}

.webhook-diagnostic-card pre {
    max-height: 260px;
    overflow: auto;
    margin: 0;
    padding: 12px;
    border-radius: 6px;
    background: #0f172a;
    color: #e5edf6;
    font-size: 12px;
    white-space: pre-wrap;
}

.save-company {
    min-width: 124px;
    min-height: 54px;
    margin-top: 30px;
    border: 0;
    border-radius: 6px;
    background: #142536;
    color: #fff;
    font-weight: 900;
    text-transform: uppercase;
}

.admin-table {
    display: grid;
    margin-top: 12px;
    border: 1px solid var(--line);
}

.admin-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 120px;
    align-items: center;
    gap: 12px;
    min-height: 58px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--line);
}

.admin-row.sectors-grid {
    grid-template-columns: 1.2fr .8fr .7fr .7fr 170px;
}

.admin-row.header {
    background: #f7fafc;
    color: var(--muted);
    font-weight: 800;
}

.admin-row:last-child {
    border-bottom: 0;
}

.label-tab-head {
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 14px;
}

.label-tab-head strong,
.label-tab-head span {
    display: block;
}

.label-tab-head strong {
    color: #10243a;
    font-size: 20px;
}

.label-tab-head span {
    color: var(--muted);
    margin-top: 4px;
}

.company-labels-table {
    display: grid;
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
}

.label-row {
    min-height: 64px;
    display: grid;
    grid-template-columns: 1.3fr .75fr .65fr .65fr 150px;
    align-items: center;
    border-bottom: 1px solid #edf0f3;
    background: #f7f7f8;
}

.label-row:nth-child(odd) {
    background: #fff;
}

.label-row.header {
    min-height: 62px;
    background: #fff;
    color: #10243a;
    font-size: 16px;
}

.label-row > span {
    height: 100%;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 4px;
    padding: 10px 12px;
    border-right: 1px solid #edf0f3;
    text-align: center;
}

.label-row > span:last-child {
    border-right: 0;
    flex-direction: row;
}

.label-row small {
    max-width: 100%;
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.label-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
}

.label-chip {
    min-height: 28px;
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 0 10px;
    background: color-mix(in srgb, var(--label-color) 16%, white);
    color: var(--label-color);
    border: 1px solid color-mix(in srgb, var(--label-color) 35%, white);
    font-size: 12px;
    font-weight: 800;
}

.label-chip.mini {
    min-height: 22px;
    padding: 0 8px;
    font-size: 11px;
}

.color-swatch {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    border: 1px solid rgba(15, 23, 42, .12);
}

.label-status {
    min-height: 28px;
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 0 12px;
    font-size: 12px;
    text-transform: uppercase;
}

.label-status.active {
    background: #dff4df;
    color: #27943b;
}

.label-status.inactive {
    background: #eef2f6;
    color: #64748b;
}

.color-picker-row {
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.color-picker-row input {
    width: 56px;
    height: 42px;
    padding: 4px;
}

.color-picker-row span {
    color: #51627a;
    font-weight: 800;
}

#view-users > .section-head {
    display: none;
}

.users-page {
    min-height: calc(100vh - 58px);
    background: #f5f7f9;
}

.users-hero {
    min-height: 74px;
    display: grid;
    grid-template-columns: 1fr minmax(320px, 525px) 1fr;
    align-items: center;
    gap: 20px;
    padding: 0 28px;
    background: #142536;
    color: #fff;
}

.users-title {
    display: flex;
    align-items: center;
    gap: 14px;
}

.users-title h2 {
    font-size: 26px;
}

.users-icon {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border: 2px solid #fff;
    border-radius: 3px;
}

.users-search {
    min-height: 48px;
    display: grid;
    grid-template-columns: 42px 1fr;
    align-items: center;
    border-radius: 4px;
    background: #fff;
    color: #6b7280;
}

.users-search span {
    text-align: center;
    font-size: 28px;
    color: #5f6d7c;
}

.users-search input {
    min-width: 0;
    border: 0;
    outline: 0;
    font-size: 18px;
}

.users-table-wrap {
    width: calc(100% - 56px);
    min-height: 640px;
    margin: 30px auto;
    display: grid;
    grid-template-rows: 1fr auto;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
    overflow: hidden;
}

.users-table {
    display: grid;
    align-content: start;
}

.users-row {
    min-height: 61px;
    display: grid;
    grid-template-columns: 1.2fr 1.2fr 1.2fr 80px 160px;
    align-items: center;
    border-bottom: 1px solid #edf0f3;
    background: #f7f7f8;
}

.users-row:nth-child(odd) {
    background: #fff;
}

.users-row.header {
    min-height: 62px;
    background: #fff;
    color: #10243a;
    font-size: 18px;
    font-weight: 500;
}

.users-row > span {
    height: 100%;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 0 14px;
    border-right: 1px solid #edf0f3;
}

.users-row > span:last-child {
    border-right: 0;
}

.owner-crown {
    color: #ff9300;
    font-style: normal;
    font-size: 24px;
}

.mfa-shield {
    color: #e91545;
    font-size: 22px;
}

.user-actions {
    gap: 22px;
}

.icon-action {
    width: 28px;
    height: 28px;
    border: 0;
    background: transparent;
    color: #66717e;
    font-size: 25px;
}

.users-pagination {
    min-height: 66px;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 18px;
    border-top: 1px solid var(--line);
}

.users-pagination .primary {
    margin-left: auto;
}

.page-number {
    min-width: 50px;
    min-height: 38px;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: #fff;
}

.user-dialog {
    width: min(750px, calc(100vw - 40px));
}

.user-dialog form {
    gap: 16px;
}

.user-photo-editor {
    height: 96px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 10px;
    position: relative;
}

.user-photo-editor span {
    width: 84px;
    height: 84px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #b8bec5;
    color: #fff;
    font-size: 28px;
    font-weight: 800;
}

.camera-button {
    position: absolute;
    left: calc(50% + 34px);
    bottom: 14px;
    width: 48px;
    height: 48px;
    border: 3px solid #fff;
    border-radius: 50%;
    background: #19aee5;
    color: #fff;
    font-weight: 900;
}

.user-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.user-form-grid label {
    color: #51627a;
}

.user-form-grid input,
.user-form-grid select {
    min-height: 66px;
    border: 1px solid #cfd6de;
    border-radius: 6px;
    padding: 0 18px;
    color: #10243a;
    font-size: 18px;
}

.user-form-grid .wide {
    grid-column: 1 / -1;
}

.switch-line {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 42px;
    font-size: 18px;
}

.permission-list-page,
.permission-editor-page {
    min-height: calc(100vh - 58px);
    background: #f5f7f9;
}

.permission-table-wrap {
    width: calc(100% - 56px);
    min-height: 640px;
    margin: 30px auto;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
    overflow: hidden;
}

.permission-row {
    min-height: 61px;
    display: grid;
    grid-template-columns: 1fr 160px;
    align-items: center;
    border-bottom: 1px solid #edf0f3;
    background: #f7f7f8;
}

.permission-row:nth-child(odd) {
    background: #fff;
}

.permission-row.header {
    min-height: 62px;
    background: #fff;
    color: #10243a;
    font-size: 18px;
    font-weight: 500;
}

.permission-row > span {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 14px;
    border-right: 1px solid #edf0f3;
}

.permission-row > span:last-child {
    border-right: 0;
}

.permission-hero {
    height: 160px;
    padding: 18px 32px 0;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: start;
    background: #142536;
    color: #fff;
}

.permission-hero h2 {
    font-size: 26px;
}

.permission-card {
    width: calc(100% - 64px);
    min-height: 660px;
    margin: -64px auto 28px;
    background: #fff;
    border-radius: 8px 8px 0 0;
    box-shadow: 0 6px 22px rgba(15, 23, 42, .14);
    overflow: hidden;
}

.permission-tabs {
    min-height: 64px;
    display: flex;
    align-items: stretch;
    gap: 0;
    border-bottom: 1px solid var(--line);
}

.permission-tabs button {
    min-width: 190px;
    border: 0;
    background: #fff;
    color: #566985;
    font-weight: 800;
    font-size: 16px;
    border-bottom: 3px solid transparent;
}

.permission-tabs button.active {
    color: #10243a;
    border-bottom-color: #10243a;
}

.permission-tab {
    display: none;
    padding: 36px 30px;
}

.permission-tab.active {
    display: block;
}

.permission-description {
    display: grid;
    gap: 6px;
    color: #51627a;
}

.permission-description input {
    min-height: 66px;
    border: 1px solid #cfd6de;
    border-radius: 6px;
    padding: 0 18px;
    color: #10243a;
    font-size: 18px;
}

.permission-fieldset {
    border: 1px solid #cfd6de;
    border-radius: 4px;
    display: grid;
    gap: 20px;
    padding: 18px 28px;
}

.permission-fieldset label {
    display: flex;
    align-items: center;
    gap: 14px;
    color: #142536;
    font-size: 20px;
}

.permission-fieldset input {
    width: 24px;
    height: 24px;
    accent-color: #142536;
}

.permission-definition-row {
    width: 100%;
    min-height: 86px;
    display: grid;
    grid-template-columns: 52px 1fr auto;
    align-items: center;
    gap: 12px;
    border: 0;
    border-bottom: 1px solid var(--line);
    background: #fff;
    text-align: left;
    font-size: 24px;
}

.access-form {
    display: grid;
    gap: 22px;
    max-width: 980px;
}

.access-form h3 {
    margin: 12px 0 0;
    color: #10243a;
}

.access-form label {
    min-height: 46px;
    display: grid;
    grid-template-columns: minmax(260px, 1fr) 280px;
    align-items: center;
    gap: 24px;
}

.access-form select {
    min-height: 36px;
    border: 1px solid #cfd6de;
    border-radius: 4px;
    padding: 0 12px;
    background: #fff;
}

.access-form input[type="checkbox"] {
    width: 42px;
    height: 22px;
    justify-self: start;
}

#view-settings > .settings-grid {
    display: none;
}

.settings-admin-page {
    min-height: calc(100vh - 58px);
    background: #f5f7f9;
}

.settings-hero {
    min-height: 88px;
    display: grid;
    grid-template-columns: 1fr minmax(320px, 620px) 1fr;
    align-items: center;
    gap: 20px;
    padding: 0 28px;
    background: #142536;
    color: #fff;
}

.settings-gear {
    font-size: 34px;
}

.settings-admin-card {
    background: #fff;
    border-radius: 4px 4px 0 0;
    min-height: calc(100vh - 146px);
}

.settings-tabs {
    min-height: 48px;
    display: flex;
    align-items: stretch;
    /* Largura natural, alinhadas a esquerda. Com nowrap a sexta aba caia
       fora da area clicavel; com flex:1 1 auto os botoes esticavam e a aba
       que sobrava ficava centralizada sozinha, parecendo titulo solto. */
    flex-wrap: wrap;
    justify-content: flex-start;
    border-bottom: 1px solid var(--line);
}

.settings-tabs button {
    flex: 0 0 auto;
    min-height: 46px;
    padding: 0 13px;
    white-space: nowrap;
    border: 0;
    border-bottom: 3px solid transparent;
    background: #fff;
    color: #566985;
    font-weight: 800;
}

.settings-tabs button.active {
    color: #10243a;
    border-bottom-color: #10243a;
}

.settings-tab {
    display: none;
    padding: 22px;
    position: relative;
}

.settings-tab.active {
    display: block;
}

.settings-table .admin-row {
    grid-template-columns: 1fr 1fr 160px;
    min-height: 62px;
}

#settings-tab-cards .settings-table .admin-row,
#settings-tab-groups .settings-table .admin-row {
    grid-template-columns: 1fr 190px;
}

.backup-panel {
    display: grid;
    gap: 16px;
}

.backup-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
    background: #fff;
}

.backup-card strong {
    display: block;
    font-size: 20px;
    margin-bottom: 6px;
}

.backup-card p {
    margin: 0 0 14px;
    color: var(--muted);
}

.backup-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.backup-actions input[type="file"] {
    min-height: 44px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
}

.backup-status {
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    padding: 14px;
    background: #eff6ff;
    color: #17345c;
    font-weight: 700;
}

.backup-table .admin-row {
    grid-template-columns: 1.4fr 160px 220px 170px;
}

.storage-summary,
.storage-kind-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(150px, 1fr));
    gap: 12px;
}

.storage-summary {
    margin-bottom: 12px;
}

.storage-metric,
.storage-kind {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
    background: #f8fafc;
}

.storage-metric span,
.storage-kind span {
    display: block;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.storage-metric strong,
.storage-kind strong {
    margin: 4px 0;
    font-size: 24px;
}

.storage-kind small {
    color: var(--muted);
}

.storage-cleanup-field {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 800;
}

.storage-cleanup-field select {
    min-height: 44px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.storage-cleanup-result {
    margin-top: 12px;
    color: var(--muted);
    font-weight: 700;
}

.secondary.danger {
    color: #b42318;
    border-color: #fecaca;
    background: #fff7f7;
}

.floating-add {
    position: fixed;
    right: 92px;
    bottom: 28px;
    width: 58px;
    height: 58px;
    border: 0;
    border-radius: 50%;
    background: #0d1d2b;
    color: #fff;
    font-size: 30px;
    box-shadow: var(--shadow);
}

.large-config-dialog {
    width: min(1200px, calc(100vw - 44px));
}

.large-config-dialog form,
.action-card-dialog form {
    padding: 0;
    gap: 0;
}

.large-config-dialog header,
.action-card-dialog header {
    min-height: 60px;
    padding: 0 22px;
    background: #142536;
    color: #fff;
}

.large-config-dialog header button,
.action-card-dialog header button {
    color: #fff;
    background: transparent;
    border-color: transparent;
}

.modal-tabs {
    min-height: 64px;
    display: flex;
    padding: 0 22px;
    border-bottom: 1px solid var(--line);
}

.modal-tabs button {
    flex: 1;
    border: 0;
    border-bottom: 3px solid transparent;
    background: #fff;
    color: #566985;
    font-weight: 800;
}

.modal-tabs button.active {
    color: #10243a;
    border-bottom-color: #10243a;
}

.hours-tab {
    display: none;
    padding: 16px 22px 24px;
}

.hours-tab.active {
    display: grid;
    gap: 18px;
}

.hours-tab label,
.action-card-dialog label {
    display: grid;
    gap: 6px;
    color: #51627a;
}

.hours-tab input,
.hours-tab select,
.hours-tab textarea,
.action-card-dialog input,
.action-card-dialog select {
    border: 1px solid #cfd6de;
    border-radius: 4px;
    padding: 12px;
    color: #10243a;
}

.schedule-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 42px;
    gap: 10px;
}

.business-hours-grid {
    grid-template-columns: minmax(130px, 1.2fr) repeat(4, minmax(92px, 1fr));
    align-items: end;
}

.schedule-grid button {
    border: 0;
    background: transparent;
    color: #6b7280;
    font-size: 22px;
}

.action-card-dialog {
    width: min(560px, calc(100vw - 40px));
}

.action-card-dialog.wide-dialog {
    width: min(920px, calc(100vw - 36px));
}

.action-card-dialog form > label,
.message-builder,
.upload-box {
    margin: 22px;
}

.message-builder {
    display: grid;
    gap: 12px;
}

.builder-item {
    min-height: 62px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 18px;
    border-radius: 4px;
    background: #fff;
    box-shadow: var(--shadow);
}

.upload-box {
    height: 150px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 8px;
    border: 1px dashed #cfd6de;
    border-radius: 8px;
    color: #8795a8;
    font-size: 34px;
}

.upload-box span {
    font-size: 14px;
}

.invalid-field {
    border-color: #ff3333 !important;
}

.action-card-dialog small {
    color: #ff3333;
}

.chat-tools {
    display: flex;
    align-items: center;
    gap: 8px;
}

.icon-button {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    font-weight: 700;
}

.indicator-grid {
    min-height: calc(100vh - 58px);
    padding: 24px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 24px 32px;
    background: #f5f5f5;
}

.indicator-grid > section:not(.indicator-panel) {
    display: none;
}

.indicator-panel {
    background: #fff;
    border: 1px solid #eef0f2;
    border-radius: 0;
    box-shadow: 0 6px 18px rgba(15, 23, 42, .12);
    padding: 18px 16px 16px;
}

.indicator-panel h2 {
    color: #0f2238;
    font-size: 20px;
    font-weight: 800;
}

.indicator-cards {
    margin-top: 30px;
    display: grid;
    grid-template-columns: repeat(3, minmax(130px, 1fr));
    gap: 16px;
}

.indicator-card {
    min-height: 108px;
    border: 1px solid #eef0f2;
    border-radius: 4px;
    background: #fbfbfc;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 6px;
    text-align: center;
}

.indicator-card span {
    color: #687385;
    font-size: 14px;
    text-transform: uppercase;
}

.indicator-card strong {
    color: #17283d;
    font-size: 26px;
    line-height: 1;
}

.indicator-icon {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border-radius: 6px;
    background: #17283d;
    color: #fff;
    font-style: normal;
    font-weight: 800;
}

.list-panel {
    min-height: 390px;
}

.panel-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.panel-title-row h2 {
    display: flex;
    align-items: center;
    gap: 6px;
}

.panel-title-row h2 span {
    min-width: 20px;
    height: 20px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #2394e8;
    color: #fff;
    font-size: 12px;
}

.status-pills {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.status-pill {
    min-height: 28px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 999px;
    padding: 0 12px;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.status-pill strong {
    width: 20px;
    height: 20px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: #fff;
}

.status-pill.online {
    background: #dff4df;
    color: #27943b;
}

.status-pill.online strong {
    background: #3dbb55;
}

.status-pill.ausente,
.status-pill.inconsistente {
    background: #fff0d8;
    color: #e27700;
}

.status-pill.ausente strong,
.status-pill.inconsistente strong {
    background: #f49a1d;
}

.status-pill.offline {
    background: #ffe5e5;
    color: #e03a3a;
}

.status-pill.offline strong {
    background: #ed4b4b;
}

.presence-report-actions {
    display: flex;
    align-items: end;
    gap: 10px;
    margin: 12px 4px 0;
}

.presence-report-actions label {
    display: grid;
    gap: 4px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.presence-report-actions input {
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px 10px;
}

.presence-report-actions button {
    min-height: 42px;
}

.panel-search {
    width: 100%;
    min-height: 44px;
    margin: 32px 4px 18px;
    border: 0;
    border-radius: 999px;
    background: #f1f1f2;
    padding: 0 16px;
    outline: none;
}

.monitor-list {
    display: grid;
    gap: 10px;
    padding: 0 18px;
}

.monitor-user,
.monitor-channel {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 42px;
}

.monitor-avatar {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #b8bec5;
    color: #fff;
    font-weight: 800;
    text-transform: uppercase;
}

.monitor-user strong,
.monitor-user small,
.monitor-channel strong,
.monitor-channel small {
    display: block;
}

.monitor-user small,
.monitor-channel small {
    color: var(--muted);
    font-size: 12px;
}

.monitor-user i {
    width: 8px;
    height: 8px;
    display: inline-block;
    border-radius: 50%;
    margin-right: 4px;
    background: #ed4b4b;
}

.monitor-user i.online {
    background: #3dbb55;
}

.monitor-user i.ausente {
    background: #f49a1d;
}

.whatsapp-mark {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border: 3px solid #1f83d8;
    border-radius: 50%;
    color: #1f83d8;
    font-weight: 900;
}

.dashboard-page,
.quick-page {
    min-height: calc(100vh - 58px);
    background: #f5f7f9;
}

.dashboard-hero {
    min-height: 86px;
    display: grid;
    grid-template-columns: 1fr minmax(320px, 620px) 1fr;
    align-items: center;
    gap: 20px;
    padding: 0 28px;
    background: #142536;
    color: #fff;
}

.dashboard-card,
.quick-table-wrap {
    width: calc(100% - 56px);
    margin: 28px auto;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 6px 22px rgba(15, 23, 42, .08);
}

.dashboard-card {
    padding: 22px;
}

.dashboard-filters {
    display: grid;
    grid-template-columns: repeat(5, minmax(150px, 1fr));
    gap: 14px;
    align-items: end;
}

.dashboard-filters label {
    display: grid;
    gap: 6px;
    color: #51627a;
    font-size: 13px;
    font-weight: 700;
}

.dashboard-filters select,
.dashboard-filters input {
    min-height: 42px;
    border: 1px solid #cfd6de;
    border-radius: 4px;
    background: #fff;
    padding: 0 12px;
    color: #10243a;
}

.calc-button {
    margin-top: 18px;
}

.dashboard-metrics {
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
    margin-top: 22px;
}

.dashboard-summary-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.dashboard-metric-group {
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    background: #fbfcfd;
}

.dashboard-metric-group h3 {
    margin: 0;
    padding: 14px 16px;
    background: #10243a;
    color: #fff;
}

.dashboard-metric-group.green h3 {
    background: #156f55;
}

.dashboard-metric-group.blue h3 {
    background: #1e5a9f;
}

.dashboard-metric-group.amber h3 {
    background: #a56612;
}

.dashboard-metric-group.red h3 {
    background: #9b2e2e;
}

.dashboard-metric-group > div {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
}

.dashboard-metric-group article {
    min-height: 96px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 6px;
    border-right: 1px solid var(--line);
    text-align: center;
}

.dashboard-metric-group article:last-child {
    border-right: 0;
}

.dashboard-metric-group span {
    color: var(--muted);
    font-size: 13px;
}

.dashboard-metric-group strong {
    font-size: 26px;
    color: #10243a;
}

.dashboard-loading,
.quality-table-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: var(--shadow);
}

.dashboard-loading {
    padding: 18px;
    color: var(--muted);
    font-weight: 700;
}

.mila-dashboard-panel {
    margin-top: 24px;
    padding-top: 22px;
    border-top: 1px solid var(--line);
}

.audit-dashboard-panel {
    margin-top: 24px;
    padding-top: 22px;
    border-top: 1px solid var(--line);
}

.audit-filters {
    display: grid;
    grid-template-columns: 170px 170px minmax(170px, 1fr) minmax(190px, 1fr) 100px;
    gap: 10px;
    margin-bottom: 16px;
}

.audit-filters label {
    display: grid;
    gap: 5px;
    color: #51627a;
    font-size: 12px;
    font-weight: 700;
}

.audit-filters input,
.audit-filters select {
    min-height: 40px;
    padding: 7px 10px;
    border: 1px solid #cfd6de;
    border-radius: 4px;
    background: #fff;
}

.audit-grid { grid-template-columns: 150px 1.1fr 1.1fr 140px 2fr; }
.audit-grid span:nth-child(2) { display: grid; gap: 2px; }
.audit-grid small { color: #64748b; }

@media (max-width: 1050px) {
    .audit-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .audit-grid { min-width: 850px; }
    #audit-report-list { overflow-x: auto; }
}

.mila-dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.mila-dashboard-header h3 {
    margin: 0 0 3px;
    color: #10243a;
    font-size: 20px;
}

.mila-dashboard-header span {
    color: #64748b;
    font-size: 13px;
}

.mila-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.mila-summary-grid article {
    min-height: 82px;
    padding: 14px 16px;
    border-left: 4px solid #0f8f78;
    background: #f8fafc;
}

.mila-summary-grid article.danger { border-left-color: #dc2626; }
.mila-summary-grid article.document { border-left-color: #d97706; }
.mila-summary-grid article.return { border-left-color: #7c3aed; }

.mila-summary-grid span,
.mila-summary-grid strong {
    display: block;
}

.mila-summary-grid span {
    color: #64748b;
    font-size: 13px;
}

.mila-summary-grid strong {
    margin-top: 5px;
    color: #10243a;
    font-size: 27px;
}

.mila-dashboard-columns {
    display: grid;
    grid-template-columns: minmax(300px, .8fr) minmax(420px, 1.2fr);
    gap: 18px;
}

.mila-recent-list {
    display: grid;
}

.mila-recent-list article {
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}

.mila-recent-list article:last-child { border-bottom: 0; }

.mila-recent-list article > div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.mila-recent-list time,
.mila-recent-list span,
.mila-recent-list p {
    color: #64748b;
    font-size: 12px;
}

.mila-recent-list p {
    margin: 6px 0 0;
    color: #334155;
    line-height: 1.4;
}

@media (max-width: 1050px) {
    .mila-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .mila-dashboard-columns { grid-template-columns: 1fr; }
}

.quality-table-card {
    overflow: hidden;
}

.quality-table-card header {
    min-height: 64px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
    background: #f8fafc;
}

.quality-table-card h3 {
    margin: 0;
    font-size: 17px;
}

.quality-table-card header span,
.quality-empty {
    color: var(--muted);
    font-size: 13px;
}

.quality-empty {
    margin: 0;
    padding: 18px;
}

.quality-table {
    display: grid;
}

.quality-row {
    display: grid;
    grid-template-columns: 1.4fr .7fr .9fr .6fr;
    min-height: 46px;
    border-bottom: 1px solid #edf0f3;
}

.sla-ranking-table .quality-row {
    grid-template-columns: 1.4fr .55fr .9fr .7fr .9fr;
}

.quality-row:last-child {
    border-bottom: 0;
}

.quality-row.header {
    min-height: 42px;
    background: #fff;
    color: #526272;
    font-weight: 800;
}

.quality-row span {
    min-width: 0;
    display: flex;
    align-items: center;
    padding: 9px 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.quick-table-wrap {
    min-height: 640px;
    display: grid;
    grid-template-rows: 1fr auto;
}

.quick-table {
    display: grid;
    align-content: start;
}

.quick-row {
    min-height: 62px;
    display: grid;
    grid-template-columns: 1.3fr .7fr 160px;
    align-items: center;
    border-bottom: 1px solid #edf0f3;
    background: #f7f7f8;
}

.quick-row:nth-child(odd) {
    background: #fff;
}

.quick-row.header {
    background: #fff;
    color: #10243a;
    font-size: 18px;
}

.quick-row > span {
    height: 100%;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 0 14px;
    border-right: 1px solid #edf0f3;
}

.quick-row > span:first-child {
    align-items: flex-start;
    justify-content: center;
    flex-direction: column;
}

.quick-row small {
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.inline-add {
    position: static;
    margin-left: auto;
}

.metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}

.metric {
    padding: 16px;
}

.metric span {
    color: var(--muted);
}

.metric strong {
    display: block;
    font-size: 30px;
    margin-top: 8px;
}

.split,
.settings-grid,
.automation {
    display: grid;
    grid-template-columns: 1.2fr .8fr;
    gap: 14px;
}

.split > section,
.settings-grid > section,
.automation > section {
    padding: 18px;
}

.section-head {
    margin-bottom: 12px;
}

.table {
    overflow: auto;
}

.row {
    display: grid;
    grid-template-columns: 1fr 1fr 140px;
    gap: 12px;
    padding: 13px 14px;
    border-bottom: 1px solid var(--line);
    align-items: center;
}

.row.header {
    background: #f8fafc;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.row:last-child {
    border-bottom: 0;
}

.channel-list,
.rule-list {
    margin-top: 12px;
    display: grid;
}

.channel-list div,
.rule-list label {
    padding: 13px 14px;
    border-bottom: 1px solid var(--line);
}

.channel-list div {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.channel-list div:last-child,
.rule-list label:last-child {
    border-bottom: 0;
}

.settings-form {
    display: grid;
    gap: 12px;
    margin-top: 14px;
}

.settings-form label,
dialog label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 13px;
}

.flow {
    margin: 16px 0 0;
    padding-left: 22px;
}

.flow li {
    margin-bottom: 12px;
}

.bot-preview {
    margin-top: 14px;
    display: grid;
    gap: 8px;
}

.bot-preview button {
    min-height: 38px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    text-align: left;
    padding: 0 12px;
}

.automation-page,
.automation-editor-page {
    min-height: calc(100vh - 58px);
    background: #f5f7f9;
}

.automation-hero,
.automation-editor-hero {
    min-height: 86px;
    display: grid;
    grid-template-columns: 1fr minmax(320px, 620px) 1fr;
    align-items: center;
    gap: 20px;
    padding: 0 28px;
    background: #142536;
    color: #fff;
}

.automation-card {
    width: calc(100% - 56px);
    min-height: 650px;
    margin: 28px auto;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 6px 22px rgba(15, 23, 42, .08);
    position: relative;
}

.automation-tabs {
    min-height: 58px;
    display: flex;
    align-items: stretch;
    border-bottom: 1px solid var(--line);
}

.automation-tabs button {
    min-width: 160px;
    border: 0;
    border-bottom: 3px solid transparent;
    background: #fff;
    color: #566985;
    font-weight: 800;
}

.automation-tabs button.active {
    color: #10243a;
    border-bottom-color: #10243a;
}

.automation-tab {
    display: none;
    padding: 22px;
}

.automation-tab.active {
    display: block;
}

.automation-table {
    display: grid;
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
}

.automation-row {
    min-height: 62px;
    display: grid;
    grid-template-columns: 1.2fr 1fr 160px 230px;
    align-items: center;
    border-bottom: 1px solid #edf0f3;
    background: #f7f7f8;
}

.automation-row:nth-child(odd) {
    background: #fff;
}

.automation-row.header {
    background: #fff;
    color: #10243a;
    font-size: 17px;
}

.automation-row > span {
    height: 100%;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 0 14px;
    border-right: 1px solid #edf0f3;
}

.automation-row > span:last-child {
    border-right: 0;
}

.automation-actions {
    gap: 14px;
}

.bot-status {
    min-height: 28px;
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 0 12px;
    background: #dff4df;
    color: #27943b;
}

.automation-pagination {
    min-height: 62px;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 18px;
    border-top: 1px solid var(--line);
    background: #fff;
}

.automation-empty {
    min-height: 220px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 8px;
    color: var(--muted);
    text-align: center;
}

.automation-empty strong {
    color: #10243a;
    font-size: 22px;
}

.automation-empty.warning {
    background: #fff8e6;
    border: 1px solid #f5d58e;
    border-radius: 8px;
}

.automation-editor-hero {
    grid-template-columns: 1fr auto 1fr;
}

.automation-editor-hero small {
    display: block;
    color: #cfd8e3;
    margin-top: 4px;
    text-align: center;
}

.automation-editor-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.bot-builder {
    min-height: calc(100vh - 144px);
    display: grid;
    grid-template-columns: 240px minmax(520px, 1fr) 320px;
    gap: 0;
    background: #eef2f6;
}

.bot-map,
.bot-preview-panel {
    background: #fff;
    border-right: 1px solid var(--line);
    overflow: auto;
}

.bot-preview-panel {
    border-right: 0;
    border-left: 1px solid var(--line);
}

.bot-map header,
.bot-preview-panel header {
    min-height: 62px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 14px;
    border-bottom: 1px solid var(--line);
}

.bot-preview-panel header span {
    color: var(--muted);
    font-size: 12px;
}

#bot-menu-map {
    display: grid;
    gap: 8px;
    padding: 12px;
}

.bot-map-item {
    min-height: 64px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: #10243a;
    display: grid;
    align-content: center;
    gap: 4px;
    padding: 8px 10px;
    text-align: left;
}

.bot-map-item.active {
    border-color: #1e5a9f;
    background: #eef6ff;
}

.bot-map-item small {
    color: var(--muted);
}

.bot-workspace {
    display: grid;
    align-content: start;
    gap: 18px;
    padding: 22px;
    overflow: auto;
}

.bot-menu-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: 0 4px 18px rgba(15, 23, 42, .08);
    overflow: hidden;
}

.bot-menu-card.active {
    border-color: #1e5a9f;
    box-shadow: 0 0 0 3px rgba(30, 90, 159, .12), 0 4px 18px rgba(15, 23, 42, .08);
}

.bot-menu-card > header {
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--line);
}

.bot-menu-card small {
    display: block;
    margin-top: 4px;
    color: var(--muted);
}

.bot-card-actions {
    display: flex;
    gap: 8px;
}

.bot-field,
.bot-options,
.bot-messages,
.bot-rule-grid,
.deprecated-box {
    margin: 16px 18px;
}

.bot-field {
    display: grid;
    gap: 6px;
    color: #51627a;
    font-size: 13px;
}

.bot-field input,
.bot-option-row input,
.bot-option-row select,
.bot-message-row textarea,
.bot-rule-grid input,
.deprecated-box input {
    min-height: 40px;
    border: 1px solid #cfd6de;
    border-radius: 4px;
    padding: 8px 10px;
    color: #10243a;
    background: #fff;
}

.bot-options,
.bot-messages {
    display: grid;
    gap: 10px;
}

.bot-option-row {
    display: grid;
    grid-template-columns: 28px 70px 1fr 180px 42px;
    align-items: center;
    gap: 8px;
}

.bot-option-row span,
.bot-message-row span {
    color: #98a2b3;
    font-size: 22px;
    text-align: center;
}

.message-title-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.bot-message-row {
    display: grid;
    grid-template-columns: 28px 1fr 120px 42px;
    align-items: center;
    gap: 8px;
}

.bot-message-row textarea {
    resize: vertical;
}

.empty-line {
    color: var(--muted);
}

.bot-rule-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.bot-rule-grid label,
.deprecated-box label {
    display: grid;
    gap: 6px;
    color: #51627a;
    font-size: 13px;
}

.deprecated-box {
    display: grid;
    gap: 10px;
    padding: 14px;
    border: 1px dashed #e0b14b;
    border-radius: 8px;
    background: #fffaf0;
}

.bot-variable-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px;
    border-bottom: 1px solid var(--line);
}

.bot-variable-list button {
    min-height: 32px;
    border: 1px solid #cfd6de;
    border-radius: 999px;
    background: #fff;
    color: #10243a;
    font-weight: 700;
}

.phone-preview {
    padding: 16px;
}

.phone-screen {
    min-height: 520px;
    border-radius: 16px;
    padding: 18px;
    background-color: #eef2f4;
    background-image:
        radial-gradient(circle at 18px 18px, rgba(23,32,42,.08) 1px, transparent 1px),
        radial-gradient(circle at 42px 42px, rgba(23,32,42,.06) 1px, transparent 1px);
    background-size: 54px 54px;
}

.phone-message {
    max-width: 100%;
    margin-bottom: 12px;
    padding: 12px;
    border-radius: 8px;
    line-height: 1.45;
    background: #cceff8;
    color: #10243a;
}

.phone-message.debug {
    background: #fff;
    color: #51627a;
    font-size: 13px;
}

.scheduling-page {
    min-height: calc(100vh - 58px);
    background: #f5f7f9;
}

.scheduling-hero {
    min-height: 86px;
    display: grid;
    grid-template-columns: 1fr minmax(320px, 620px) 1fr;
    align-items: center;
    gap: 20px;
    padding: 0 28px;
    background: #142536;
    color: #fff;
}

.scheduling-card {
    width: calc(100% - 56px);
    min-height: 650px;
    margin: 28px auto;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 6px 22px rgba(15, 23, 42, .08);
}

.schedule-toolbar {
    min-height: 74px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--line);
}

.schedule-status-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.schedule-status-tabs button {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    color: #10243a;
    padding: 0 12px;
    font-weight: 800;
}

.schedule-status-tabs button.active {
    border-color: #1e5a9f;
    background: #eef6ff;
    color: #1e5a9f;
}

.schedule-status-tabs strong {
    width: 22px;
    height: 22px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #10243a;
    color: #fff;
    font-size: 12px;
}

.schedule-actions {
    display: flex;
    gap: 10px;
}

.schedule-filter-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(150px, 1fr));
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--line);
    background: #f8fafc;
}

.schedule-filter-row label,
.schedule-form-grid label {
    display: grid;
    gap: 6px;
    color: #51627a;
    font-size: 13px;
    font-weight: 700;
}

.schedule-filter-row input,
.schedule-filter-row select,
.schedule-form-grid input,
.schedule-form-grid select,
.schedule-form-grid textarea {
    min-height: 42px;
    border: 1px solid #cfd6de;
    border-radius: 4px;
    background: #fff;
    color: #10243a;
    padding: 8px 12px;
}

.schedule-table {
    display: grid;
    align-content: start;
}

.schedule-row {
    min-height: 66px;
    display: grid;
    grid-template-columns: 1fr .75fr 1.4fr .9fr .8fr 120px;
    align-items: center;
    border-bottom: 1px solid #edf0f3;
    background: #f7f7f8;
}

.schedule-row:nth-child(odd) {
    background: #fff;
}

.schedule-row.header {
    min-height: 62px;
    background: #fff;
    color: #10243a;
    font-size: 16px;
    font-weight: 500;
}

.schedule-row > span {
    height: 100%;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 4px;
    padding: 10px 12px;
    border-right: 1px solid #edf0f3;
    text-align: center;
}

.schedule-row > span:last-child {
    border-right: 0;
    flex-direction: row;
}

.schedule-row small {
    max-width: 100%;
    color: var(--muted);
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.schedule-row strong {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.schedule-status {
    min-height: 28px;
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 0 12px;
    font-size: 12px;
    text-transform: uppercase;
}

.schedule-status.pending {
    background: #fff0d8;
    color: #d97706;
}

.schedule-status.sent {
    background: #dff4df;
    color: #27943b;
}

.schedule-status.cancelled {
    background: #eef2f6;
    color: #64748b;
}

.schedule-status.error {
    background: #ffe5e5;
    color: #e03a3a;
}

.schedule-dialog {
    width: min(780px, calc(100vw - 40px));
}

.schedule-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.schedule-form-grid .wide {
    grid-column: 1 / -1;
}

.schedule-form-grid textarea {
    resize: vertical;
}

dialog {
    width: min(520px, calc(100vw - 32px));
    border: 0;
    border-radius: 8px;
    padding: 0;
    box-shadow: 0 20px 70px rgba(0,0,0,.25);
}

dialog::backdrop {
    background: rgba(12, 18, 24, .42);
}

dialog form {
    padding: 20px;
    display: grid;
    gap: 14px;
}

dialog header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

dialog header button {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: #fff;
}

dialog p {
    color: var(--muted);
    margin: 0;
}

menu {
    padding: 0;
    margin: 0;
    display: flex;
    justify-content: end;
}

@media (max-width: 1180px) {
    body {
        grid-template-columns: 88px minmax(0, 1fr) 64px;
    }

    .brand div,
    .profile div,
    .nav-item span {
        display: none;
    }

    .nav-item {
        justify-content: center;
        font-size: 0;
    }

    .nav-item::first-letter {
        font-size: 16px;
    }

    .workspace {
        grid-template-columns: minmax(0, 1fr);
    }

    .meta-channel-panel,
    .qr-channel-panel,
    .cloud-register-layout {
        grid-template-columns: 1fr;
    }

    .cloud-flow-strip {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 820px) {
    body {
        display: block;
    }

    .utility-rail {
        position: fixed;
        right: 0;
        top: 0;
        width: 58px;
    }

    .team-panel {
        right: 58px;
        width: calc(100vw - 58px);
    }

    .sidebar {
        min-height: auto;
        flex-direction: row;
        align-items: center;
        overflow-x: auto;
    }

    .nav {
        display: flex;
    }

    .profile {
        display: none;
    }

    .shell {
        padding: 16px;
        height: auto;
        display: block;
        overflow: visible;
    }

    .topbar,
    .topbar-actions {
        display: grid;
        align-items: stretch;
        grid-template-columns: 1fr;
    }

    .composer {
        min-height: 210px;
        position: static;
        left: auto;
        right: auto;
        bottom: auto;
        padding: 14px;
        box-shadow: none;
    }

    .messages {
        padding-bottom: 18px;
    }

    .composer-row {
        flex-wrap: wrap;
    }

    .composer textarea {
        flex: 1 1 100%;
        order: -1;
    }

    .composer .primary {
        flex: 1;
    }

    .search input {
        width: 100%;
    }

    .cloud-flow-strip,
    .cloud-channel-table .admin-row {
        grid-template-columns: 1fr;
    }

    .metrics,
    .workspace,
    .split,
    .settings-grid,
    .automation,
    .dashboard-summary-grid {
        grid-template-columns: 1fr;
    }

    #view-chats.active {
        grid-template-columns: 1fr;
        height: auto;
        overflow: visible;
    }

    .status-tabs {
        height: auto;
        min-height: auto;
    }

    .workspace {
        height: calc(100vh - 260px);
        min-height: 520px;
    }

    .conversation-list {
        max-height: 260px;
    }
}

/* --- Integracoes do sistema (system_settings) --- */

.integrations-intro {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 14px;
}

.integrations-intro code {
    background: var(--bg);
    border-radius: 4px;
    padding: 1px 5px;
}

.integration-group {
    border: 1px solid var(--line);
    border-radius: 10px;
    margin-bottom: 14px;
    padding: 12px 14px 14px;
}

.integration-group legend {
    color: var(--ink);
    font-size: 13px;
    font-weight: 600;
    padding: 0 6px;
}

.integration-field span {
    align-items: baseline;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.integration-origin {
    border-radius: 999px;
    font-size: 11px;
    font-style: normal;
    padding: 1px 7px;
}

.integration-origin-banco {
    background: rgba(31, 138, 112, .12);
    color: var(--accent-strong);
}

.integration-origin-env {
    background: rgba(182, 106, 0, .12);
    color: var(--amber);
}

.integration-origin-vazio {
    background: var(--bg);
    color: var(--muted);
}

.integration-hint {
    color: var(--muted);
    display: block;
    font-size: 12px;
    line-height: 1.4;
    margin-top: 3px;
}

.integration-group-actions,
.integrations-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
}

.integration-test-result,
.integrations-status {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.4;
}

.integration-test-result.is-ok {
    color: var(--accent-strong);
}

.integration-test-result.is-fail {
    color: var(--red);
}

.integration-forget {
    align-self: flex-start;
    background: none;
    border: 0;
    color: var(--red);
    cursor: pointer;
    font-size: 12px;
    margin-top: 4px;
    padding: 0;
    text-decoration: underline;
}

/* Campo de cor das Integracoes: texto + amostra lado a lado. O texto e o
   valor (pode ficar vazio = cor padrao); a amostra so escreve nele. */
/* Segredo mascarado sem type=password (ver app.js, renderIntegrations). */
.integration-secret {
    -webkit-text-security: disc;
    text-security: disc;
}

.integration-color-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.integration-color-row input[data-integration-key] {
    flex: 1;
    min-width: 0;
}

.integration-color {
    flex: 0 0 46px;
    width: 46px;
    padding: 3px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
}

.integration-color::-webkit-color-swatch-wrapper {
    padding: 0;
}

.integration-color::-webkit-color-swatch {
    border: 0;
    border-radius: 5px;
}

.integration-color::-moz-color-swatch {
    border: 0;
    border-radius: 5px;
}
