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

@media (max-width: 768px) {
    .support-app {
        grid-template-columns: 1fr;
        min-height: calc(100vh - 116px);
    }

    .support-chat-panel {
        display: none;
    }

    .support-app.is-chat-open .support-list-panel {
        display: none;
    }

    .support-app.is-chat-open .support-chat-panel {
        display: grid;
    }

    .support-back {
        display: inline-flex;
        width: auto;
    }

    .support-list-head {
        padding: 14px;
    }

    .support-list-head h2 {
        font-size: 20px;
    }

    .support-message {
        max-width: 88%;
    }

    .support-compose {
        grid-template-columns: 1fr;
    }

    .support-compose .btn {
        width: 100%;
    }
}

@media (max-width: 576px) {
    .support-app {
        border-radius: 8px;
        min-height: calc(100vh - 128px);
    }

    .support-conversation-item {
        grid-template-columns: 38px minmax(0, 1fr);
        padding: 10px;
    }

    .support-avatar {
        width: 38px;
        height: 38px;
        flex-basis: 38px;
    }

    .support-chat-head {
        padding: 10px;
        gap: 8px;
    }

    .support-messages {
        padding: 12px 10px;
    }

    .support-message {
        max-width: 92%;
        padding: 9px 10px;
    }

    .support-message p {
        font-size: 12px;
        line-height: 1.35;
    }
}

.support-app {
    display: grid;
    grid-template-columns: minmax(280px, 34%) minmax(0, 1fr);
    height: calc(100vh - 196px);
    min-height: 520px;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
}

.support-list-panel,
.support-chat-panel {
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

.support-list-panel {
    border-right: 1px solid #e0e0e0;
    background: #f8f9fa;
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
}

.support-list-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px;
    border-bottom: 1px solid #e7e7e7;
}

.support-list-head h2 {
    margin: 0;
    font-size: 22px;
    font-weight: 600;
    color: #333;
}

.support-refresh-btn {
    width: 38px;
    height: 36px;
    padding: 0;
    align-items: center;
    justify-content: center;
}

.support-refresh-btn svg {
    display: block;
}

.support-search {
    padding: 12px 14px;
    border-bottom: 1px solid #e7e7e7;
}

.support-conversation-list {
    overflow-y: auto;
    min-height: 0;
}

.support-conversation-item {
    width: 100%;
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 10px;
    padding: 12px 14px;
    border: 0;
    border-bottom: 1px solid #ededed;
    background: transparent;
    color: #333;
    text-align: left;
}

.support-conversation-item:hover,
.support-conversation-item.active {
    background: #eef6ff;
}

.support-conversation-item.unread {
    background: #fff8db;
    border-left: 4px solid #38bdf8;
}

.support-conversation-item.unread.active {
    background: #fff0b8;
}

.support-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 42px;
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: #fff;
    font-weight: 800;
    overflow: hidden;
}

.support-avatar img,
.contact-profile-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.contact-list-name {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.contact-list-name > span:last-child {
    min-width: 0;
}

.contact-list-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    overflow: hidden;
    flex: 0 0 34px;
    background: #e9ecef;
}

.contact-list-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.support-conversation-main {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.support-conversation-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
}

.support-conversation-row strong,
.support-conversation-row em {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.support-conversation-row strong {
    font-size: 14px;
    font-style: normal;
    font-weight: 700;
}

.support-conversation-row em {
    color: #666;
    font-size: 12px;
    font-style: normal;
}

.support-conversation-row small {
    flex: 0 0 auto;
    color: #888;
    font-size: 11px;
}

.support-conversation-row b {
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 999px;
    background: #28a745;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
}

.support-phone {
    color: #888;
    font-size: 11px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.support-assignee {
    display: block;
    color: #0f766e;
    font-size: 11px;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.support-chat-panel {
    background: #f4f8fb;
    display: grid;
}

.support-chat-empty {
    display: grid;
    place-items: center;
    align-content: center;
    gap: 8px;
    min-height: 420px;
    padding: 24px;
    color: #666;
    text-align: center;
}

.support-chat-empty strong {
    color: #333;
    font-size: 20px;
}

.support-chat {
    height: 100%;
    min-height: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
}

.support-chat-head {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    padding: 14px 16px;
    border-bottom: 1px solid #e0e0e0;
    background: #fff;
}

.support-back {
    display: none !important;
}

.support-status.connected,
.support-status.working {
    background: #d4edda !important;
    color: #155724 !important;
}

.support-status.disconnected,
.support-status.stopped,
.support-status.not_created,
.support-status.unknown {
    background: #f8d7da !important;
    color: #721c24 !important;
}

.support-chat-title {
    display: grid;
    gap: 2px;
    min-width: 0;
    flex: 1;
}

.support-chat-title strong,
.support-chat-title span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.support-chat-title span {
    color: #777;
    font-size: 12px;
}

.support-chat-actions {
    display: grid;
    justify-items: end;
    gap: 6px;
    flex: 0 0 auto;
}

.support-tag-menu-wrap {
    position: relative;
}

.support-tag-menu-wrap > .btn {
    min-height: 30px;
    padding: 5px 9px;
    width: auto;
    font-size: 12px;
}

.support-tag-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 20;
    width: min(220px, 72vw);
    padding: 6px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 8px 22px rgba(0,0,0,0.12);
}

.support-tag-menu[hidden] {
    display: none;
}

.support-tag-menu button {
    width: 100%;
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    padding: 8px;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: #333;
    text-align: left;
    font-size: 12px;
}

.support-tag-menu button:hover {
    background: #f0f4ff;
}

.support-tag-menu .tag-color-dot {
    width: 18px;
    height: 18px;
    border-radius: 5px;
}

.support-tag-empty {
    display: block;
    padding: 8px;
    color: #777;
    font-size: 12px;
}

.support-chat-tags,
.contact-tags {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 4px;
}

.contact-tag {
    --tag-color: #28a745;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    max-width: 100%;
    padding: 3px 7px;
    border-radius: 4px;
    background: color-mix(in srgb, var(--tag-color) 18%, #fff);
    border: 1px solid color-mix(in srgb, var(--tag-color) 42%, #fff);
    color: var(--tag-color);
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
}

.contact-tag button {
    width: 16px;
    height: 16px;
    min-height: 16px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--tag-color);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0;
    line-height: 1;
}

.contact-tag button::before {
    content: "\00d7";
    display: block;
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
    transform: translateY(-1px);
}

.support-tag-editor {
    display: grid;
    grid-template-columns: minmax(0, 180px) auto;
    gap: 6px;
    align-items: center;
    width: fit-content;
    max-width: 100%;
    padding: 8px 16px;
    border-bottom: 1px solid #e0e0e0;
    background: #fff;
}

.support-tag-editor select {
    height: 34px;
    padding: 6px 10px;
    font-size: 12px;
}

.support-tag-editor .btn {
    min-height: 34px;
    padding: 6px 10px;
    width: auto;
    white-space: nowrap;
}

.tag-card-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
}

.tag-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 220px;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    border-bottom: 1px solid #e0e0e0;
    border-radius: 0;
    background: #fff;
}

.tag-card:last-child {
    border-bottom: 0;
}

.tag-card-main {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.tag-card-main > div {
    display: grid;
    gap: 6px;
    min-width: 0;
}

.tag-card-main strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tag-color-dot {
    --tag-color: #28a745;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: var(--tag-color);
    flex: 0 0 34px;
}

.tag-card-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
}

.tag-card-actions form {
    display: contents;
    margin: 0;
}

.tag-card-actions .btn {
    width: 100%;
}

.tag-modal-form {
    display: grid;
    gap: 14px;
}

.tag-modal-form input[type="color"] {
    height: 42px;
    padding: 4px;
}

.tag-chip-board {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    min-height: 72px;
    padding: 14px;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    background: #f8fafc;
}

.tag-chip-item {
    --tag-color: #28a745;
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    border-radius: 999px;
    background: color-mix(in srgb, var(--tag-color) 16%, #fff);
    border: 1px solid color-mix(in srgb, var(--tag-color) 36%, #fff);
    color: var(--tag-color);
    overflow: hidden;
}

.tag-chip-main {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    max-width: 260px;
    padding: 7px 8px 7px 11px;
    border: 0;
    background: transparent;
    color: inherit;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.2;
}

.tag-chip-main span:last-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tag-chip-dot {
    width: 9px;
    height: 9px;
    flex: 0 0 9px;
    border-radius: 50%;
    background: var(--tag-color);
}

.tag-chip-delete {
    display: contents;
}

.tag-chip-delete button {
    width: 24px;
    height: 24px;
    min-height: 24px;
    margin-right: 5px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: color-mix(in srgb, var(--tag-color) 85%, #111);
    color: #fff;
    font-size: 16px;
    font-weight: 900;
    line-height: 1;
}

.tag-preview-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    background: #f8fafc;
}

.tag-preview-row > span:first-child {
    color: #64748b;
    font-size: 12px;
    font-weight: 700;
}

.tag-preview-chip {
    --tag-color: #28a745;
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    padding: 6px 10px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--tag-color) 16%, #fff);
    border: 1px solid color-mix(in srgb, var(--tag-color) 36%, #fff);
    color: var(--tag-color);
    font-size: 12px;
    font-weight: 800;
    line-height: 1.2;
}

.contact-profile-photo {
    width: 72px;
    height: 72px;
    border-radius: 50%;
}

.support-messages {
    min-height: 0;
    overflow-y: auto;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.support-message {
    width: fit-content;
    max-width: min(72%, 680px);
    padding: 10px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    color: #333;
}

.support-message.outgoing {
    margin-left: auto;
    background: #d4edda;
    border-color: #bfe4c8;
}

.support-message small {
    display: block;
    color: #777;
    font-size: 10px;
    margin-bottom: 4px;
}

.support-message p {
    margin: 0;
    font-size: 14px;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.support-compose {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: end;
    padding: 12px;
    border-top: 1px solid #e0e0e0;
    background: #fff;
}

.support-emoji-wrap {
    position: relative;
    align-self: center;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
}

.support-emoji-toggle {
    width: 42px;
    height: 42px;
    min-width: 42px;
    min-height: 42px;
    padding: 0;
    font-size: 18px;
}

.support-emoji-menu {
    position: absolute;
    left: 0;
    bottom: calc(100% + 8px);
    z-index: 30;
    width: 238px;
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 4px;
    padding: 8px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 8px 22px rgba(0,0,0,0.14);
}

.support-emoji-menu[hidden] {
    display: none;
}

.support-emoji-menu button {
    width: 100%;
    min-height: 26px;
    padding: 0;
    border: 0;
    border-radius: 5px;
    background: transparent;
    font-size: 17px;
    line-height: 1;
}

.support-emoji-menu button:hover {
    background: #eef6ff;
}

.support-compose textarea {
    flex: 1 1 260px;
    min-width: 180px;
    min-height: 42px;
    max-height: 120px;
    resize: vertical;
}

.support-file-btn {
    flex: 0 0 42px;
    width: 42px;
    min-width: 42px;
    height: 42px;
    min-height: 42px;
    padding: 0;
    margin: 0 !important;
    font-size: 18px;
    align-self: center;
}

.support-compose .support-file-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.support-file-btn input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.support-file-name {
    flex: 1 0 100%;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #64748b;
    font-size: 12px;
    font-weight: 700;
}

.support-compose .btn-primary {
    flex: 0 0 auto;
    width: auto;
    min-width: 70px;
}

.support-receipt {
    display: inline-flex;
    align-items: center;
    margin-left: 6px;
    color: #94a3b8;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0;
}

.support-receipt.read,
.support-receipt.played {
    color: #0ea5e9;
}

.support-receipt.error {
    color: #dc3545;
    letter-spacing: 0;
}

.support-attachment {
    display: grid;
    grid-template-columns: 26px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    padding: 8px;
    border: 1px solid #dbeafe;
    border-radius: 8px;
    background: #f8fafc;
    color: #1f2937;
}

.support-attachment-icon {
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: #e0f2fe;
}

.support-attachment strong,
.support-attachment small {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.support-attachment small {
    margin: 2px 0 0;
    font-size: 10px;
}

.support-loading {
    padding: 18px;
    color: #777;
    font-size: 13px;
}

:root[data-theme="dark"] .support-app,
body.dark-mode .support-app {
    background: #222;
    border-color: #333;
}

:root[data-theme="dark"] .support-list-panel,
body.dark-mode .support-list-panel {
    background: #242424;
    border-right-color: #333;
}

:root[data-theme="dark"] .support-list-head,
:root[data-theme="dark"] .support-search,
:root[data-theme="dark"] .support-chat-head,
:root[data-theme="dark"] .support-compose,
:root[data-theme="dark"] .support-emoji-menu,
body.dark-mode .support-list-head,
body.dark-mode .support-search,
body.dark-mode .support-chat-head,
body.dark-mode .support-compose,
body.dark-mode .support-emoji-menu {
    background: #222;
    border-color: #333;
}

:root[data-theme="dark"] .support-list-head h2,
:root[data-theme="dark"] .support-chat-empty strong,
body.dark-mode .support-list-head h2,
body.dark-mode .support-chat-empty strong {
    color: #fff;
}

:root[data-theme="dark"] .support-chat-panel,
body.dark-mode .support-chat-panel {
    background: #151922;
}

:root[data-theme="dark"] .support-conversation-item,
body.dark-mode .support-conversation-item {
    color: #e7e7e7;
    border-bottom-color: #333;
}

:root[data-theme="dark"] .support-conversation-item:hover,
:root[data-theme="dark"] .support-conversation-item.active,
body.dark-mode .support-conversation-item:hover,
body.dark-mode .support-conversation-item.active {
    background: #1d2d4f;
}

:root[data-theme="dark"] .support-conversation-item.unread,
body.dark-mode .support-conversation-item.unread {
    background: #3b3217;
}

:root[data-theme="dark"] .support-conversation-row em,
:root[data-theme="dark"] .support-phone,
:root[data-theme="dark"] .support-assignee,
:root[data-theme="dark"] .support-chat-title span,
:root[data-theme="dark"] .support-message small,
body.dark-mode .support-conversation-row em,
body.dark-mode .support-phone,
body.dark-mode .support-assignee,
body.dark-mode .support-chat-title span,
body.dark-mode .support-message small {
    color: #aeb8c7;
}

:root[data-theme="dark"] .support-message,
body.dark-mode .support-message {
    background: #2b313d;
    border-color: #3d4656;
    color: #f8fafc;
}

:root[data-theme="dark"] .support-file-name,
body.dark-mode .support-file-name {
    color: #aeb8c7;
}

:root[data-theme="dark"] .support-attachment,
body.dark-mode .support-attachment {
    background: #202632;
    border-color: #3a4557;
    color: #f8fafc;
}

:root[data-theme="dark"] .support-attachment-icon,
body.dark-mode .support-attachment-icon {
    background: #16323a;
}

:root[data-theme="dark"] .support-message.outgoing,
body.dark-mode .support-message.outgoing {
    background: #1f3a2e;
    border-color: #2d5a45;
}

:root {
    --admin-bg: #f5f5f5;
    --admin-sidebar: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
    --admin-surface: #ffffff;
    --admin-text: #333333;
    --admin-muted: #888888;
    --admin-line: #e0e0e0;
    --admin-line-soft: #eeeeee;
    --admin-accent: #38bdf8;
    --admin-primary: #007bff;
    --admin-success: #28a745;
    --admin-danger: #dc3545;
    --admin-radius: 10px;
    --admin-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

html,
body {
    min-height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--admin-bg);
    color: var(--admin-text);
    min-height: 100vh;
    letter-spacing: 0;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
}

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

button {
    cursor: pointer;
}

.admin-wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: var(--admin-sidebar);
    color: #fff;
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 20;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    min-height: 88px;
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
}

.brand-mark {
    width: 112px;
    height: 58px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.brand-mark img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.brand-copy {
    min-width: 0;
}

.sidebar-header strong {
    display: block;
    max-width: 160px;
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-header span {
    color: #888;
    font-size: 12px;
}

.sidebar-menu {
    padding: 20px 0;
    flex: 1 1 auto;
}

.sidebar-signature {
    margin-top: auto;
    padding: 16px 20px 18px;
    border-top: 1px solid rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.58);
    font-size: 11px;
    line-height: 1.45;
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: #ccc;
    text-decoration: none;
    transition: all 0.3s;
    border-left: 3px solid transparent;
    gap: 12px;
    font-size: 15px;
    font-weight: 400;
}

.menu-item:hover,
.menu-item.active {
    background: rgba(56,189,248,0.14);
    color: var(--admin-accent);
    border-left-color: var(--admin-accent);
}

.menu-item svg,
.nav-icon svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.nav-icon {
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 20px;
}

.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 20px;
    min-width: 0;
}

.top-bar {
    background: #fff;
    border: 1px solid #e0e0e0;
    padding: 15px 25px;
    border-radius: 10px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    min-height: 84px;
}

.topbar-title {
    display: flex;
    align-items: center;
    gap: 14px;
}

.top-bar h1 {
    font-size: 24px;
    color: #333;
    margin: 0;
    font-weight: 500;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
    position: relative;
}

.theme-toggle {
    background: rgba(0,0,0,0.05);
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    color: #ffa500;
}

.theme-toggle:hover {
    background: rgba(0,0,0,0.1);
}

.theme-toggle svg {
    width: 22px;
    height: 22px;
}

:root[data-theme="light"] [data-theme-moon],
:root[data-theme="dark"] [data-theme-sun] {
    display: none;
}

.profile-form {
    margin: 0;
}

.profile-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    background: none;
    border: none;
    padding: 8px 15px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.profile-btn:hover {
    background: rgba(0,0,0,0.05);
}

.profile-avatar {
    width: 35px;
    height: 35px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: bold;
    font-size: 14px;
}

.profile-arrow {
    color: #666;
    width: 12px;
    height: 12px;
}

.profile-btn.active .profile-arrow {
    transform: rotate(180deg);
}

.profile-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 10px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 5px 25px rgba(0,0,0,0.15);
    min-width: 200px;
    z-index: 1000;
    overflow: hidden;
}

.profile-dropdown.active {
    display: block;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    color: #333;
    text-decoration: none;
    transition: background 0.3s;
    border: none;
    background: none;
    width: 100%;
    cursor: pointer;
    font-size: 14px;
}

.dropdown-item:hover {
    background: #f8f9fa;
}

.dropdown-item.logout {
    color: #dc3545;
    border-top: 1px solid #eee;
}

.dropdown-item svg {
    width: 18px;
    height: 18px;
    color: currentColor;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.sidebar-toggle {
    width: 44px;
    height: 44px;
    display: none;
    place-items: center;
    gap: 2px;
    align-content: center;
    justify-content: center;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #f8f9fa;
    color: #333;
}

.sidebar-toggle span {
    width: 18px;
    height: 2px;
    display: block;
    border-radius: 99px;
    background: currentColor;
}

.content-area,
.panel,
.chart-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.content-area {
    display: block;
}

.content-area > * + * {
    margin-top: 20px;
}

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

.panel-head h2,
.section-title {
    color: #333;
    font-size: 24px;
    font-weight: 500;
    margin: 0;
}

.dashboard-cards,
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.dashboard-card,
.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: 1px solid rgba(51, 51, 51, 0.2);
    border-radius: 15px;
    padding: 25px;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: transform 0.3s, box-shadow 0.3s;
    min-height: 112px;
}

.dashboard-card:hover,
.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.dashboard-card.green,
.stat-card:nth-child(1) {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
}

.dashboard-card.blue,
.stat-card:nth-child(2) {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.dashboard-card.orange,
.stat-card:nth-child(4) {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.dashboard-card.yellow,
.stat-card:nth-child(5) {
    background: linear-gradient(135deg, #f7971e 0%, #ffd200 100%);
}

.dashboard-card.purple,
.stat-card:nth-child(6) {
    background: linear-gradient(135deg, #a18cd1 0%, #fbc2eb 100%);
}

.card-icon {
    width: 60px;
    height: 60px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.card-icon svg {
    width: 30px;
    height: 30px;
    fill: none;
    stroke: #fff;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.card-content h3,
.stat-card strong {
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 5px 0;
    color: #fff;
    line-height: 1.12;
}

.card-content p,
.stat-card span,
.stat-card small {
    font-size: 14px;
    margin: 0;
    opacity: 0.9;
    color: #fff;
}

.grid-two,
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.dashboard-chart-frame {
    position: relative;
    height: 220px;
    width: 100%;
    min-width: 0;
}

.dashboard-chart-frame canvas {
    display: block;
    max-width: 100%;
    max-height: 100%;
}

.grid-two > * {
    min-width: 0;
}

.table-wrap,
.table-container {
    overflow-x: auto;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
}

.table-wrap table,
.table-wrap .table,
.table-container table,
.table-container .table {
    min-width: 720px;
}

.dashboard-recent-wrap {
    overflow: hidden;
    max-width: 100%;
}

.dashboard-recent-table {
    table-layout: fixed;
    width: 100% !important;
    max-width: 100%;
    min-width: 0 !important;
}

.dashboard-recent-wrap .dashboard-recent-table {
    width: 100% !important;
    min-width: 0 !important;
}

.dashboard-recent-table th:first-child,
.dashboard-recent-table td:first-child {
    width: 78px;
}

.dashboard-recent-table th:nth-child(2),
.dashboard-recent-table td:nth-child(2) {
    width: auto;
}

.dashboard-recent-table th:last-child,
.dashboard-recent-table td:last-child {
    width: 110px;
}

.dashboard-recent-table th,
.dashboard-recent-table td {
    padding: 9px 6px;
    font-size: 12px;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.dashboard-recent-table td:last-child {
    font-size: 11px;
}

table,
.table {
    width: 100%;
    border-collapse: collapse;
    color: #333;
    margin: 0;
}

table th,
table td,
.table th,
.table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
}

table th,
.table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #333;
    font-size: 14px;
    text-transform: none;
}

table tr:hover,
.table tr:hover {
    background: #f8f9fa;
}

.muted {
    color: #777;
    font-size: 13px;
    margin-top: 4px;
}

.panel-head .muted {
    margin-bottom: 0;
}

.selected-row td {
    background: rgba(0, 123, 255, 0.04);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 5px;
    text-decoration: none;
    font-size: 14px;
    cursor: pointer;
    border: none;
    transition: all 0.3s;
    line-height: 1.25;
    min-height: 36px;
}

.btn-primary {
    background: #007bff;
    color: #fff;
}

.btn-primary:hover {
    background: #0056b3;
    color: #fff;
}

.btn-success {
    background: #28a745;
    color: #fff;
}

.btn-success:hover {
    background: #1e7e34;
    color: #fff;
}

.btn-danger {
    background: #dc3545;
    color: #fff;
}

.btn-danger:hover {
    background: #c82333;
    color: #fff;
}

.btn-warning {
    background: #ffc107;
    color: #000;
}

.btn-ghost {
    background: #f8f9fa;
    color: #333;
    border: 1px solid #dee2e6;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
    min-height: 30px;
}

.button-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.flow-table {
    table-layout: fixed;
    min-width: 960px;
}

.flow-table th:first-child,
.flow-table td:first-child {
    width: 28%;
}

.flow-table th:nth-child(2),
.flow-table td:nth-child(2) {
    width: 120px;
}

.flow-table th:nth-child(3),
.flow-table td:nth-child(3) {
    width: 210px;
}

.flow-table th:last-child,
.flow-table td:last-child {
    width: 360px;
    min-width: 360px;
}

.flow-actions {
    display: grid;
    grid-template-columns: repeat(4, minmax(72px, 1fr));
    align-items: center;
    gap: 6px;
}

.flow-actions form {
    display: contents;
    margin: 0;
}

.flow-actions .btn {
    width: 100%;
    min-width: 0;
    padding: 5px 8px;
    font-size: 12px;
    white-space: nowrap;
}

.whatsapp-table-wrap {
    overflow-x: auto;
}

.whatsapp-connections-table {
    table-layout: fixed;
    min-width: 760px;
}

.whatsapp-connections-table th:first-child,
.whatsapp-connections-table td:first-child {
    width: 34%;
}

.whatsapp-connections-table th:nth-child(2),
.whatsapp-connections-table td:nth-child(2) {
    width: 120px;
}

.whatsapp-connections-table th:last-child,
.whatsapp-connections-table td:last-child {
    width: 360px;
    min-width: 360px;
}

.whatsapp-connections-table tr.selected-row td {
    background: transparent;
    box-shadow: none;
}

.whatsapp-actions {
    display: grid;
    grid-template-columns: repeat(4, minmax(72px, 1fr));
    align-items: center;
    gap: 6px;
}

.whatsapp-actions form {
    display: contents;
    margin: 0;
}

.whatsapp-actions form.is-hidden,
.whatsapp-actions form[hidden] {
    display: none !important;
}

.whatsapp-actions .btn {
    width: 100%;
    min-width: 0;
    padding: 5px 8px;
    font-size: 12px;
    white-space: nowrap;
}

.whatsapp-actions .btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.conn-name-edit {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 6px;
    align-items: center;
}

.conn-name-edit[hidden] {
    display: none !important;
}

.conn-name-edit input[type="text"] {
    min-width: 0;
    padding: 8px 10px;
}

.conn-name-edit .btn {
    width: auto;
}

.contacts-table {
    table-layout: fixed;
    min-width: 900px;
}

.contact-search-form {
    display: grid;
    grid-template-columns: minmax(240px, 420px) max-content max-content;
    align-items: end;
    gap: 10px;
    margin-bottom: 16px;
}

.contact-search-form label {
    margin-bottom: 0;
}

.contact-search-form .btn {
    min-height: 42px;
    min-width: 92px;
    width: auto;
    padding-inline: 18px;
}

.contacts-table tbody tr:nth-child(odd) td {
    background: #fff;
}

.contacts-table tbody tr:nth-child(even) td {
    background: #f7f8fa;
}

.contacts-table tbody tr:hover td {
    background: #eef6ff;
}

.contacts-table th:first-child,
.contacts-table td:first-child {
    width: 28%;
}

.contacts-table th:nth-child(2),
.contacts-table td:nth-child(2) {
    width: 190px;
}

.contacts-table th:nth-child(3),
.contacts-table td:nth-child(3) {
    width: 120px;
}

.contacts-table th:nth-child(4),
.contacts-table td:nth-child(4) {
    width: 190px;
}

.contacts-table th:last-child,
.contacts-table td:last-child {
    width: 250px;
    min-width: 250px;
}

.contact-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(64px, 1fr));
    gap: 6px;
}

.contact-actions form {
    display: contents;
    margin: 0;
}

.contact-actions .btn {
    width: 100%;
    min-width: 0;
    padding: 5px 8px;
    font-size: 12px;
    white-space: nowrap;
}

.contact-name-edit {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 6px;
    align-items: center;
}

.contact-name-edit[hidden] {
    display: none !important;
}

.contact-name-edit input[type="text"] {
    min-width: 0;
    padding: 8px 10px;
}

.contact-name-edit .btn {
    width: auto;
}

.contact-conversation {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

.contact-conversation .bubble {
    width: fit-content;
    max-width: 84%;
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: normal;
}

.contact-conversation .bubble.outgoing {
    margin-left: auto;
    margin-right: 0;
}

.contact-conversation .bubble p,
.contact-conversation .bubble small {
    overflow-wrap: anywhere;
}

.attendant-create-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(180px, 260px) auto;
    gap: 12px;
    align-items: end;
    margin-bottom: 20px;
}

.attendant-create-form .btn {
    white-space: nowrap;
}

.attendant-table {
    table-layout: fixed;
    min-width: 860px;
}

.attendant-table th:first-child,
.attendant-table td:first-child {
    width: 34%;
}

.attendant-table th:nth-child(2),
.attendant-table td:nth-child(2) {
    width: 28%;
}

.attendant-table th:nth-child(3),
.attendant-table td:nth-child(3) {
    width: 170px;
}

.attendant-table th:last-child,
.attendant-table td:last-child {
    width: 180px;
    min-width: 180px;
}

.attendant-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(64px, 1fr));
    gap: 6px;
}

.attendant-actions form {
    display: contents;
    margin: 0;
}

.attendant-actions .btn {
    width: 100%;
    min-width: 0;
    padding: 5px 8px;
    font-size: 12px;
}

.attendant-edit-row td {
    background: #fbfcfe;
}

.attendant-edit-row[hidden] {
    display: none !important;
}

.attendant-edit-form {
    display: grid;
    grid-template-columns: minmax(120px, 1fr) minmax(160px, 1fr) minmax(140px, 1fr) auto auto;
    gap: 6px;
    align-items: center;
}

.attendant-edit-form[hidden] {
    display: none !important;
}

.attendant-edit-form input {
    min-width: 0;
    padding: 8px 10px;
}

.attendant-edit-form .btn {
    width: auto;
}

.whatsapp-qr-modal {
    width: min(420px, 92vw);
}

.whatsapp-qr-card {
    margin: 0 auto;
}

.alert,
.flash {
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
}

.alert-success,
.flash.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error,
.flash.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #333;
    font-size: 14px;
}

label span {
    display: block;
    margin-bottom: 5px;
}

input,
select,
textarea,
.form-control {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    background: #fff;
    color: #333;
    outline: none;
}

input:focus,
select:focus,
textarea:focus,
.form-control:focus {
    outline: none;
    border-color: #007bff;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    border: 0;
}

.badge::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    margin-right: 6px;
}

.badge-success,
.badge.success,
.badge.active,
.badge.connected,
.badge.working,
.badge.received,
.badge.sent {
    background: #d4edda;
    color: #155724;
}

.badge-warning,
.badge.warning,
.badge.draft,
.badge.scan_qr_code,
.badge.starting {
    background: #fff3cd;
    color: #856404;
}

.badge-danger,
.badge.error,
.badge.failed,
.badge.inactive,
.badge.disconnected {
    background: #f8d7da;
    color: #721c24;
}

.badge.neutral,
.badge.unknown,
.badge.not_created,
.badge.stopped {
    background: #e9ecef;
    color: #495057;
}

.empty-state {
    min-height: 120px;
    display: grid;
    place-items: center;
    color: #666;
    background: #f8f9fa;
    border: 1px dashed #ddd;
    border-radius: 10px;
    text-align: center;
    padding: 24px;
}

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

.session-card p,
.setting-item {
    background: #fff;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #eee;
}

.qr-card {
    width: min(320px, 100%);
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 15px;
    margin-top: 10px;
}

.conversation {
    display: grid;
    gap: 12px;
}

.bubble {
    max-width: 84%;
    padding: 12px 14px;
    background: #f8f9fa;
    border: 1px solid #eee;
    border-radius: 10px;
}

.bubble p {
    margin: 6px 0 0;
}

.bubble small {
    color: #888;
}

.bubble.outgoing {
    margin-left: auto;
    background: #d4edda;
}

:root[data-theme="dark"] .bubble,
body.dark-mode .bubble {
    background: #2b313d;
    border-color: #3d4656;
    color: #f1f5f9;
}

:root[data-theme="dark"] .bubble small,
body.dark-mode .bubble small {
    color: #aeb8c7;
}

:root[data-theme="dark"] .bubble p,
body.dark-mode .bubble p {
    color: #f8fafc;
}

:root[data-theme="dark"] .bubble.outgoing,
body.dark-mode .bubble.outgoing {
    background: #1f3a2e;
    border-color: #2d5a45;
    color: #ecfdf5;
}

:root[data-theme="dark"] .bubble.outgoing small,
body.dark-mode .bubble.outgoing small {
    color: #b6d7c4;
}

:root[data-theme="dark"] .bubble.outgoing p,
body.dark-mode .bubble.outgoing p {
    color: #f0fdf4;
}

.builder-page {
    display: grid;
    gap: 20px;
}

.builder-toolbar {
    display: block;
}

.builder-meta {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    align-items: end;
    gap: 15px;
}

.builder-meta label {
    min-width: 0;
}

.flow-name-field,
.flow-description-field {
    grid-column: span 5;
}

.flow-status-field,
.flow-save-action {
    grid-column: span 2;
}

.flow-whatsapp-field {
    grid-column: 1 / -1;
}

.flow-schedule-field {
    grid-column: span 4;
}

.flow-time-field {
    grid-column: span 3;
}

.flow-save-action {
    display: flex;
    align-items: end;
    height: 100%;
}

.flow-save-action .btn {
    width: 100%;
    min-height: 42px;
}

.flow-whatsapp-field {
    min-width: 260px;
}

.flow-whatsapp-field > span {
    display: block;
    margin-bottom: 6px;
    color: #4b5563;
    font-size: .9rem;
    font-weight: 700;
}

.flow-whatsapp-picker {
    display: grid;
    gap: 8px;
}

.flow-whatsapp-add {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 42px;
    gap: 8px;
    align-items: center;
}

.flow-whatsapp-add select {
    height: 42px;
}

.flow-whatsapp-add .btn-icon {
    width: 42px;
    height: 42px;
    min-height: 42px;
    padding: 0;
    border-radius: 8px;
    font-size: 22px;
    font-weight: 700;
    line-height: 1;
}

.flow-whatsapp-add .btn-icon:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.flow-whatsapp-selected {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
    min-height: 38px;
    padding: 8px;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    background: #f8fafc;
}

.flow-whatsapp-placeholder,
.flow-whatsapp-empty {
    color: #64748b;
    font-size: 12px;
    font-weight: 600;
}

.flow-whatsapp-chip {
    --chip-bg: #e0f2fe;
    --chip-color: #0369a1;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    max-width: 100%;
    padding: 5px 6px 5px 10px;
    border-radius: 999px;
    background: var(--chip-bg);
    color: var(--chip-color);
    font-size: 12px;
    font-weight: 800;
    line-height: 1.2;
}

.flow-whatsapp-chip[data-color-index="2"] {
    --chip-bg: #dcfce7;
    --chip-color: #166534;
}

.flow-whatsapp-chip[data-color-index="3"] {
    --chip-bg: #fef3c7;
    --chip-color: #92400e;
}

.flow-whatsapp-chip[data-color-index="4"] {
    --chip-bg: #fee2e2;
    --chip-color: #991b1b;
}

.flow-whatsapp-chip[data-color-index="5"] {
    --chip-bg: #ede9fe;
    --chip-color: #5b21b6;
}

.flow-whatsapp-chip[data-color-index="6"] {
    --chip-bg: #ccfbf1;
    --chip-color: #0f766e;
}

.flow-whatsapp-chip span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.flow-whatsapp-chip button {
    width: 20px;
    height: 20px;
    min-height: 20px;
    flex: 0 0 20px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: color-mix(in srgb, var(--chip-color) 85%, #111);
    color: #fff;
    font-size: 13px;
    font-weight: 900;
    line-height: 1;
}

.flow-whatsapp-help {
    display: block;
    color: #64748b;
    font-size: 12px;
    line-height: 1.35;
}

.builder-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    min-height: 72vh;
}

.node-picker-wrap {
    position: relative;
}

.node-picker-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 18px rgba(0,0,0,0.13);
    z-index: 100;
    min-width: 210px;
    padding: 6px;
}

.node-picker-item {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 9px 14px;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    border-radius: 5px;
    color: #333;
    font-size: 14px;
}

.node-picker-item:hover {
    background: #f0f4ff;
    color: #007bff;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.38);
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.modal-panel {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 8px 36px rgba(0,0,0,0.2);
    width: min(440px, 92vw);
    max-height: 86vh;
    overflow-y: auto;
}

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 1;
}

.modal-head h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
}

.modal-body {
    padding: 20px;
}

.btn-close-modal {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    min-height: 32px;
    padding: 0;
    border: 1px solid #fecaca;
    border-radius: 999px;
    background: #fee2e2;
    color: #b91c1c;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
}

.btn-close-modal:hover {
    background: #fecaca;
    color: #991b1b;
    border-color: #fca5a5;
}

.btn-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #888;
    padding: 2px 6px;
    line-height: 1;
    border-radius: 4px;
}

.btn-close:hover {
    background: #f0f0f0;
    color: #333;
}

.node-button {
    width: 100%;
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 12px 15px;
    text-align: left;
    color: #333;
}

.builder-canvas-wrap {
    display: grid;
    grid-template-rows: auto minmax(560px, 1fr);
    gap: 12px;
}

.builder-canvas-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.builder-hint {
    color: #666;
    font-size: 14px;
}

.zoom-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.zoom-value {
    min-width: 54px;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background: #f8f9fa;
    color: #333;
    text-align: center;
    font-weight: 600;
}

.builder-canvas {
    min-height: 620px;
    overflow: hidden;
    border: 1px solid #dbe5ef;
    border-radius: 10px;
    background:
        linear-gradient(rgba(79,111,143,0.08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(79,111,143,0.08) 1px, transparent 1px),
        #f4f8fb;
    background-size: 28px 28px;
}

.drawflow .drawflow-node {
    min-width: 230px;
    color: #223042;
    background: #fff;
    border: 1px solid #d7e2ed;
    border-radius: 8px;
    box-shadow: 0 10px 28px rgba(31,45,61,0.10);
    overflow: visible;
}

.drawflow .drawflow-node.selected {
    border-color: #76a9fa;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.16), 0 12px 30px rgba(31,45,61,0.14);
}

.drawflow-node .title-box {
    color: #1f2937;
    background: #eef6ff;
    border-bottom: 1px solid #dbeafe;
    border-radius: 7px 7px 0 0;
    padding: 10px 14px;
    font-weight: 700;
}

.node-title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.node-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    color: currentColor;
}

.node-icon svg {
    width: 18px;
    height: 18px;
    display: block;
}

.drawflow-node .box {
    padding: 10px 14px 12px;
    color: #475569;
    background: #fff;
    border-radius: 0 0 7px 7px;
}

.drawflow-node .box small {
    color: #475569;
    line-height: 1.45;
}

.drawflow .drawflow-node.incoming_message .title-box,
.drawflow .drawflow-node.keyword_trigger .title-box {
    background: #fff1f2;
    border-bottom-color: #ffe4e6;
    color: #9f1239;
}

.drawflow .drawflow-node.text_reply .title-box {
    background: #ecfeff;
    border-bottom-color: #cffafe;
    color: #155e75;
}

.drawflow .drawflow-node.condition .title-box {
    background: #fff7ed;
    border-bottom-color: #ffedd5;
    color: #9a3412;
}

.drawflow .drawflow-node.delay .title-box {
    background: #f5f3ff;
    border-bottom-color: #ede9fe;
    color: #5b21b6;
}

.drawflow .drawflow-node.set_variable .title-box,
.drawflow .drawflow-node.webhook_request .title-box {
    background: #eff6ff;
    border-bottom-color: #dbeafe;
    color: #1d4ed8;
}

.drawflow .drawflow-node.ai_agent .title-box {
    background: #f0f9ff;
    border-bottom-color: #bae6fd;
    color: #0369a1;
}

.drawflow .drawflow-node.end .title-box {
    background: #ecfdf5;
    border-bottom-color: #d1fae5;
    color: #047857;
}

.drawflow .connection .main-path {
    stroke: #6ea8dc;
    stroke-width: 4px;
}

.drawflow .drawflow-node .input,
.drawflow .drawflow-node .output {
    width: 18px;
    height: 18px;
    border: 2px solid #fff;
    background: #8fb3d9;
    box-shadow: 0 0 0 1px rgba(65,91,118,0.22), 0 3px 8px rgba(31,45,61,0.18);
}

.drawflow .drawflow-node .input {
    background: #f59e0b;
}

.drawflow .drawflow-node .output {
    background: #38bdf8;
}

.drawflow .drawflow-delete {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    min-width: 28px;
    min-height: 28px;
    padding: 0;
    border: 1px solid #fecaca;
    border-radius: 999px;
    background: #fee2e2;
    color: transparent;
    font-size: 0;
    line-height: 1;
    box-shadow: 0 8px 18px rgba(185,28,28,0.18);
}

.drawflow .drawflow-delete::before {
    content: "\00d7";
    display: block;
    color: #b91c1c;
    font-size: 17px;
    line-height: 1;
    font-weight: 800;
    transform: translateY(-1px);
}

.drawflow .drawflow-delete:hover {
    background: #fecaca;
    border-color: #fca5a5;
}

.drawflow .drawflow-delete:hover::before {
    color: #991b1b;
}

pre {
    max-width: 560px;
    padding: 14px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
    background: #f8f9fa;
    border: 1px solid #eee;
    border-radius: 5px;
    color: #333;
}

details summary {
    cursor: pointer;
    color: #666;
}

.settings-section {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 25px;
}

.settings-section h3 {
    color: #333;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #ddd;
    font-size: 18px;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.help-text {
    font-size: 12px;
    color: #888;
    margin-top: 5px;
}

.guest-body {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}

.login-bubbles {
    position: fixed;
    inset: 0;
    z-index: 1;
    overflow: hidden;
    pointer-events: none;
}

.login-bubble {
    --size: 150px;
    --left: 10%;
    --duration: 12s;
    --delay: 0s;
    position: absolute;
    left: var(--left);
    bottom: calc(var(--size) * -1.4);
    width: var(--size);
    height: var(--size);
    border-radius: 50%;
    opacity: 0;
    background:
        radial-gradient(circle at 30% 28%, rgba(255,255,255,0.95) 0 5%, rgba(255,255,255,0.42) 6% 12%, transparent 23%),
        radial-gradient(circle at 62% 74%, rgba(125,211,252,0.18), transparent 36%),
        radial-gradient(circle at 50% 50%, rgba(255,255,255,0.04), rgba(255,255,255,0.02) 62%, rgba(255,255,255,0.18));
    border: 2px solid rgba(255,255,255,0.34);
    box-shadow:
        inset 0 0 24px rgba(255,255,255,0.26),
        inset 18px 12px 38px rgba(56,189,248,0.12),
        0 0 28px rgba(14,165,233,0.12);
    animation: login-bubble-rise var(--duration) linear infinite !important;
    animation-delay: var(--delay);
    animation-play-state: running !important;
    will-change: transform, opacity;
}

.login-bubble:nth-child(1) { --size: 138px; --left: 7%; --duration: 12s; --delay: -1s; }
.login-bubble:nth-child(2) { --size: 220px; --left: 18%; --duration: 16s; --delay: -7s; }
.login-bubble:nth-child(3) { --size: 112px; --left: 34%; --duration: 11s; --delay: -4s; }
.login-bubble:nth-child(4) { --size: 260px; --left: 54%; --duration: 18s; --delay: -10s; }
.login-bubble:nth-child(5) { --size: 170px; --left: 72%; --duration: 14s; --delay: -3s; }
.login-bubble:nth-child(6) { --size: 96px; --left: 86%; --duration: 10s; --delay: -6s; }
.login-bubble:nth-child(7) { --size: 188px; --left: -3%; --duration: 15s; --delay: -12s; }
.login-bubble:nth-child(8) { --size: 130px; --left: 45%; --duration: 13s; --delay: -9s; }

@keyframes login-bubble-rise {
    0% {
        opacity: 0;
        transform: translate3d(-12px, 0, 0) scale(0.82);
    }
    12% {
        opacity: 0.52;
    }
    74% {
        opacity: 0.46;
        transform: translate3d(18px, -84vh, 0) scale(1);
    }
    88% {
        opacity: 0.38;
        transform: translate3d(-10px, -102vh, 0) scale(1.1);
        border-color: rgba(255,255,255,0.48);
    }
    100% {
        opacity: 0;
        transform: translate3d(0, -112vh, 0) scale(1.75);
        border-color: rgba(255,255,255,0);
        box-shadow: inset 0 0 4px rgba(255,255,255,0), 0 0 0 rgba(14,165,233,0);
    }
}

.guest-shell {
    position: relative;
    z-index: 2;
}

.auth-card {
    background: #fff;
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    width: 100%;
    max-width: 400px;
    display: block;
}

.auth-copy {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo {
    width: 176px;
    height: 104px;
    margin: 0 auto 22px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.auth-copy .eyebrow {
    display: none;
}

.auth-copy h1 {
    color: #1a1a2e;
    font-size: 28px;
    margin-bottom: 5px;
}

.auth-copy p {
    color: #666;
    font-size: 14px;
}

.auth-form {
    display: grid;
    gap: 18px;
}

.input-wrapper {
    position: relative;
}

.input-wrapper svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: #666;
    pointer-events: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.input-wrapper input {
    padding-left: 40px;
}

.auth-form .btn-primary {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #38bdf8 0%, #0ea5e9 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 700;
}

.auth-form .btn-primary:hover {
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(56, 189, 248, 0.35);
}

.sidebar-backdrop {
    display: none;
}

:root[data-theme="dark"] body,
body.dark-mode {
    background: #1a1a1a;
    color: #e0e0e0;
}

:root[data-theme="dark"] .sidebar,
body.dark-mode .sidebar {
    background: #222;
}

:root[data-theme="dark"] .top-bar,
:root[data-theme="dark"] .content-area,
:root[data-theme="dark"] .panel,
:root[data-theme="dark"] .chart-card,
body.dark-mode .top-bar,
body.dark-mode .content-area,
body.dark-mode .panel,
body.dark-mode .chart-card {
    background: #222;
    border-color: #333;
    color: #e0e0e0;
}

:root[data-theme="dark"] .top-bar h1,
:root[data-theme="dark"] .panel-head h2,
:root[data-theme="dark"] .section-title,
body.dark-mode .top-bar h1,
body.dark-mode .panel-head h2,
body.dark-mode .section-title {
    color: #fff;
}

:root[data-theme="dark"] table,
:root[data-theme="dark"] .table,
body.dark-mode table,
body.dark-mode .table {
    color: #e0e0e0;
}

:root[data-theme="dark"] table th,
:root[data-theme="dark"] .table th,
body.dark-mode table th,
body.dark-mode .table th {
    background: #444;
    color: #fff;
    border-bottom-color: #555;
}

:root[data-theme="dark"] table td,
:root[data-theme="dark"] .table td,
body.dark-mode table td,
body.dark-mode .table td {
    border-bottom-color: #444;
}

:root[data-theme="dark"] table tr:hover,
:root[data-theme="dark"] .table tr:hover,
body.dark-mode table tr:hover,
body.dark-mode .table tr:hover {
    background: rgba(255,255,255,0.05);
}

:root[data-theme="dark"] input,
:root[data-theme="dark"] select,
:root[data-theme="dark"] textarea,
:root[data-theme="dark"] .form-control,
body.dark-mode input,
body.dark-mode select,
body.dark-mode textarea,
body.dark-mode .form-control {
    background: #333;
    border-color: #444;
    color: #fff;
    color-scheme: dark;
}

:root[data-theme="dark"] label,
body.dark-mode label {
    color: #ccc;
}

:root[data-theme="dark"] .theme-toggle,
:root[data-theme="dark"] .sidebar-toggle,
:root[data-theme="dark"] .profile-btn,
body.dark-mode .theme-toggle,
body.dark-mode .sidebar-toggle,
body.dark-mode .profile-btn {
    background: #333;
    border-color: #444;
    color: #f0f0f0;
}

:root[data-theme="dark"] .empty-state,
:root[data-theme="dark"] .settings-section,
:root[data-theme="dark"] .setting-item,
:root[data-theme="dark"] .session-card p,
:root[data-theme="dark"] .attendant-edit-row td,
:root[data-theme="dark"] .node-button,
:root[data-theme="dark"] .zoom-value,
body.dark-mode .empty-state,
body.dark-mode .settings-section,
body.dark-mode .setting-item,
body.dark-mode .session-card p,
body.dark-mode .attendant-edit-row td,
body.dark-mode .node-button,
body.dark-mode .zoom-value {
    background: #333;
    border-color: #444;
    color: #e0e0e0;
}

:root[data-theme="dark"] .node-picker-dropdown,
:root[data-theme="dark"] .modal-panel,
:root[data-theme="dark"] .modal-head,
:root[data-theme="dark"] .flow-whatsapp-selected,
:root[data-theme="dark"] .tag-chip-board,
:root[data-theme="dark"] .tag-preview-row,
body.dark-mode .node-picker-dropdown,
body.dark-mode .modal-panel,
body.dark-mode .modal-head,
body.dark-mode .flow-whatsapp-selected,
body.dark-mode .tag-chip-board,
body.dark-mode .tag-preview-row {
    background: #222;
    border-color: #444;
    color: #e0e0e0;
}

:root[data-theme="dark"] .flow-whatsapp-placeholder,
:root[data-theme="dark"] .flow-whatsapp-empty,
:root[data-theme="dark"] .flow-whatsapp-help,
body.dark-mode .flow-whatsapp-placeholder,
body.dark-mode .flow-whatsapp-empty,
body.dark-mode .flow-whatsapp-help {
    color: #aeb8c7;
}

:root[data-theme="dark"] .tag-card,
body.dark-mode .tag-card {
    background: #242424;
    border-color: #3b3b3b;
    color: #e7e7e7;
}

:root[data-theme="dark"] .tag-card-grid,
body.dark-mode .tag-card-grid {
    border-color: #3b3b3b;
}

:root[data-theme="dark"] .tag-card-main strong,
:root[data-theme="dark"] .tag-preview-row > span:first-child,
body.dark-mode .tag-card-main strong,
body.dark-mode .tag-preview-row > span:first-child {
    color: #f1f5f9;
}

:root[data-theme="dark"] .node-picker-item,
body.dark-mode .node-picker-item {
    color: #e0e0e0;
}

:root[data-theme="dark"] .node-picker-item:hover,
body.dark-mode .node-picker-item:hover {
    background: #333;
    color: #7db8ff;
}

:root[data-theme="dark"] .btn-close,
body.dark-mode .btn-close {
    color: #999;
}

:root[data-theme="dark"] .btn-close:hover,
body.dark-mode .btn-close:hover {
    background: #333;
    color: #e0e0e0;
}

:root[data-theme="dark"] .table,
:root[data-theme="dark"] table,
body.dark-mode .table,
body.dark-mode table {
    --bs-table-bg: #242424;
    --bs-table-color: #e7e7e7;
    --bs-table-striped-bg: #282828;
    --bs-table-hover-bg: #303030;
    background: #242424;
    color: #e7e7e7;
}

:root[data-theme="dark"] table tbody,
:root[data-theme="dark"] .table tbody,
:root[data-theme="dark"] table tr,
:root[data-theme="dark"] .table tr,
:root[data-theme="dark"] table td,
:root[data-theme="dark"] .table td,
body.dark-mode table tbody,
body.dark-mode .table tbody,
body.dark-mode table tr,
body.dark-mode .table tr,
body.dark-mode table td,
body.dark-mode .table td {
    background-color: #242424;
    color: #e7e7e7;
    border-color: #3b3b3b;
}

:root[data-theme="dark"] .contacts-table tbody tr:nth-child(odd) td,
body.dark-mode .contacts-table tbody tr:nth-child(odd) td {
    background: #242424;
}

:root[data-theme="dark"] .contacts-table tbody tr:nth-child(even) td,
body.dark-mode .contacts-table tbody tr:nth-child(even) td {
    background: #2b2b2b;
}

:root[data-theme="dark"] .contacts-table tbody tr:hover td,
body.dark-mode .contacts-table tbody tr:hover td {
    background: #303848;
}

:root[data-theme="dark"] .muted,
body.dark-mode .muted {
    color: #aeb8c7;
}

:root[data-theme="dark"] .settings-section h3,
body.dark-mode .settings-section h3 {
    color: #f5f5f5;
    border-bottom-color: #3f3f3f;
}

:root[data-theme="dark"] .btn-ghost,
body.dark-mode .btn-ghost {
    background: #2f2f2f;
    border-color: #484848;
    color: #f0f0f0;
}

:root[data-theme="dark"] .builder-canvas,
body.dark-mode .builder-canvas {
    border-color: #343a46;
    background:
        linear-gradient(rgba(148,163,184,0.10) 1px, transparent 1px),
        linear-gradient(90deg, rgba(148,163,184,0.10) 1px, transparent 1px),
        #151922;
    background-size: 28px 28px;
}

:root[data-theme="dark"] .drawflow .drawflow-node,
body.dark-mode .drawflow .drawflow-node {
    background: #202632;
    border-color: #3a4557;
    color: #e5edf7;
    box-shadow: 0 14px 30px rgba(0,0,0,0.28);
}

:root[data-theme="dark"] .drawflow-node .box,
body.dark-mode .drawflow-node .box {
    background: #202632;
    color: #cbd5e1;
}

:root[data-theme="dark"] .drawflow-node .box small,
body.dark-mode .drawflow-node .box small {
    color: #cbd5e1;
}

:root[data-theme="dark"] .drawflow .drawflow-node.incoming_message .title-box,
:root[data-theme="dark"] .drawflow .drawflow-node.keyword_trigger .title-box,
body.dark-mode .drawflow .drawflow-node.incoming_message .title-box,
body.dark-mode .drawflow .drawflow-node.keyword_trigger .title-box {
    background: #3a2028;
    border-bottom-color: #5b2b38;
    color: #fda4af;
}

:root[data-theme="dark"] .drawflow .drawflow-node.text_reply .title-box,
body.dark-mode .drawflow .drawflow-node.text_reply .title-box {
    background: #16323a;
    border-bottom-color: #22505c;
    color: #67e8f9;
}

:root[data-theme="dark"] .drawflow .drawflow-node.ai_agent .title-box,
body.dark-mode .drawflow .drawflow-node.ai_agent .title-box {
    background: #0f2f46;
    border-bottom-color: #16425f;
    color: #7dd3fc;
}

:root[data-theme="dark"] .drawflow .drawflow-node.end .title-box,
body.dark-mode .drawflow .drawflow-node.end .title-box {
    background: #17382c;
    border-bottom-color: #235744;
    color: #86efac;
}

@media (max-width: 992px) {
    .dashboard-cards,
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .grid-two {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    html,
    body {
        overflow-x: hidden;
    }

    body.sidebar-open {
        overflow: hidden;
    }

    .admin-wrapper {
        display: block;
    }

    .sidebar {
        width: min(260px, 86vw);
        position: fixed;
        inset: 0 auto 0 0;
        z-index: 700;
        transform: translateX(-105%);
        transition: transform 0.22s ease;
    }

    .sidebar-open .sidebar {
        transform: translateX(0);
    }

    .sidebar-open .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 650;
        background: rgba(0,0,0,0.48);
    }

    .main-content {
        margin-left: 0;
        padding: 98px 10px 10px;
    }

    .sidebar-toggle {
        display: grid;
    }

    .top-bar {
        align-items: center;
        flex-direction: row;
        gap: 10px;
        position: fixed;
        top: 8px;
        left: 10px;
        right: 10px;
        z-index: 500;
        margin-bottom: 0;
    }

    .panel-head,
    .builder-canvas-head {
        align-items: stretch;
        flex-direction: column;
    }

    .topbar-title {
        align-items: center;
        min-width: 0;
        flex: 1 1 auto;
    }

    .topbar-title > div {
        min-width: 0;
    }

    .top-bar h1 {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .user-info,
    .topbar-actions,
    .button-row,
    .inline-form {
        justify-content: flex-start;
    }

    .whatsapp-actions {
        grid-template-columns: repeat(4, minmax(72px, 1fr));
    }

    .flow-actions {
        grid-template-columns: repeat(4, minmax(72px, 1fr));
    }

    .settings-grid {
        grid-template-columns: 1fr;
    }

    .setting-item,
    .settings-section,
    label,
    input,
    select,
    textarea,
    .form-control {
        min-width: 0;
        max-width: 100%;
    }
}

@media (max-width: 576px) {
    .dashboard-cards,
    .stats-grid,
    .form-grid,
    .auth-card {
        grid-template-columns: 1fr;
    }

    .content-area,
    .panel,
    .chart-card {
        padding: 16px;
        border-radius: 8px;
    }

    .dashboard-card,
    .stat-card {
        padding: 20px;
    }

    .btn {
        width: 100%;
    }

    .top-bar {
        padding: 12px 14px;
        gap: 10px;
    }

    .topbar-title {
        gap: 10px;
    }

    .top-bar h1 {
        font-size: 20px;
        overflow-wrap: anywhere;
    }

    .user-info {
        gap: 10px;
    }

    .profile-btn {
        padding: 8px;
    }

    .profile-logout {
        display: none;
    }

    .content-area > * + * {
        margin-top: 14px;
    }

    .panel-head {
        gap: 10px;
        margin-bottom: 14px;
    }

    .panel-head h2,
    .section-title {
        font-size: 22px;
    }

    .builder-toolbar.panel {
        display: grid;
        align-items: stretch;
        gap: 12px;
    }

    .builder-meta {
        display: grid;
        grid-template-columns: 1fr;
        gap: 10px;
        width: 100%;
    }

    .builder-meta label,
    .flow-name-field,
    .flow-description-field,
    .flow-status-field,
    .flow-whatsapp-field,
    .flow-schedule-field,
    .flow-time-field,
    .flow-save-action {
        grid-column: 1 / -1;
        min-width: 0;
        width: 100%;
    }

    .builder-meta label span {
        font-size: 12px;
        line-height: 1.25;
    }

    .builder-meta input,
    .builder-meta select {
        min-width: 0;
        height: 36px;
        padding: 8px 10px;
        font-size: 12px;
    }

    .builder-toolbar > .btn,
    .flow-save-action .btn {
        width: 100%;
        min-width: 0;
        white-space: nowrap;
    }

    .flow-save-action {
        display: block;
    }

    .dashboard-cards {
        gap: 12px;
        margin-bottom: 18px;
    }

    .dashboard-card {
        min-height: 84px;
        padding: 16px;
        gap: 14px;
    }

    .card-icon {
        width: 46px;
        height: 46px;
    }

    .card-icon svg {
        width: 24px;
        height: 24px;
    }

    .card-content h3,
    .stat-card strong {
        font-size: 22px;
    }

    .dashboard-chart-frame {
        height: 112px;
        overflow: hidden;
    }

    .grid-two {
        gap: 12px;
    }

    .contacts-table-wrap,
    .attendant-table-wrap,
    .dashboard-recent-wrap,
    .flow-table-wrap {
        overflow: visible;
    }

    .whatsapp-table-wrap {
        overflow: visible;
    }

    .contacts-table-wrap .contacts-table,
    .attendant-table-wrap .attendant-table,
    .dashboard-recent-wrap .dashboard-recent-table,
    .flow-table-wrap .flow-table,
    .whatsapp-table-wrap .whatsapp-connections-table {
        min-width: 0 !important;
    }

    .contacts-table th:first-child,
    .contacts-table td:first-child,
    .contacts-table th:nth-child(2),
    .contacts-table td:nth-child(2),
    .contacts-table th:nth-child(3),
    .contacts-table td:nth-child(3),
    .contacts-table th:nth-child(4),
    .contacts-table td:nth-child(4),
    .contacts-table th:last-child,
    .contacts-table td:last-child,
    .attendant-table th:first-child,
    .attendant-table td:first-child,
    .attendant-table th:nth-child(2),
    .attendant-table td:nth-child(2),
    .attendant-table th:nth-child(3),
    .attendant-table td:nth-child(3),
    .attendant-table th:last-child,
    .attendant-table td:last-child {
        width: 100% !important;
        min-width: 0 !important;
    }

    .flow-table,
    .flow-table thead,
    .flow-table tbody,
    .flow-table tr,
    .flow-table td,
    .flow-table th {
        display: block;
        width: 100%;
        min-width: 0;
    }

    .flow-table {
        min-width: 0 !important;
    }

    .flow-table th:first-child,
    .flow-table td:first-child,
    .flow-table th:nth-child(2),
    .flow-table td:nth-child(2),
    .flow-table th:nth-child(3),
    .flow-table td:nth-child(3),
    .flow-table th:last-child,
    .flow-table td:last-child {
        width: 100% !important;
        min-width: 0 !important;
    }

    .flow-table thead {
        display: none;
    }

    .flow-table tr {
        padding: 12px 0;
        border-bottom: 1px solid #eee;
    }

    .flow-table td {
        display: grid;
        grid-template-columns: 84px minmax(0, 1fr);
        align-items: center;
        gap: 10px;
        padding: 6px 0;
        border-bottom: 0;
        overflow-wrap: normal;
        font-size: 12px;
    }

    .flow-table td::before {
        content: attr(data-label);
        color: #777;
        font-size: 12px;
        font-weight: 600;
    }

    .flow-table td:first-child {
        display: block;
    }

    .flow-table td:first-child::before {
        display: none;
    }

    .flow-actions {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .flow-actions .btn {
        min-height: 34px;
    }

    .flow-table td[data-label="Acoes"] {
        display: block;
    }

    .flow-table td[data-label="Acoes"]::before {
        display: block;
        margin-bottom: 8px;
    }

    .dashboard-recent-table,
    .dashboard-recent-table thead,
    .dashboard-recent-table tbody,
    .dashboard-recent-table tr,
    .dashboard-recent-table td,
    .dashboard-recent-table th,
    .contacts-table,
    .contacts-table thead,
    .contacts-table tbody,
    .contacts-table tr,
    .contacts-table td,
    .contacts-table th,
    .attendant-table,
    .attendant-table thead,
    .attendant-table tbody,
    .attendant-table tr,
    .attendant-table td,
    .attendant-table th,
    .whatsapp-connections-table,
    .whatsapp-connections-table thead,
    .whatsapp-connections-table tbody,
    .whatsapp-connections-table tr,
    .whatsapp-connections-table td,
    .whatsapp-connections-table th {
        display: block;
        width: 100%;
        min-width: 0;
    }

    .dashboard-recent-table,
    .contacts-table,
    .attendant-table,
    .whatsapp-connections-table {
        min-width: 0 !important;
    }

    .dashboard-recent-table thead,
    .contacts-table thead,
    .attendant-table thead,
    .whatsapp-connections-table thead {
        display: none;
    }

    .whatsapp-connections-table th:first-child,
    .whatsapp-connections-table td:first-child,
    .whatsapp-connections-table th:nth-child(2),
    .whatsapp-connections-table td:nth-child(2),
    .whatsapp-connections-table th:last-child,
    .whatsapp-connections-table td:last-child {
        width: 100% !important;
        min-width: 0 !important;
    }

    .dashboard-recent-table tr,
    .contacts-table tr,
    .attendant-table tr,
    .whatsapp-connections-table tr {
        padding: 10px 0;
        border-bottom: 1px solid #eee;
    }

    .dashboard-recent-table td,
    .contacts-table td,
    .attendant-table td,
    .whatsapp-connections-table td {
        display: block;
        padding: 4px 0;
        border-bottom: 0;
        font-size: 12px;
        line-height: 1.35;
        overflow-wrap: anywhere;
    }

    .dashboard-recent-table td::before,
    .contacts-table td::before,
    .attendant-table td::before,
    .whatsapp-connections-table td::before {
        content: attr(data-label);
        display: block;
        color: #777;
        font-size: 10px;
        font-weight: 600;
        line-height: 1.2;
        margin-bottom: 2px;
    }

    .contacts-table td[data-label="Acoes"] {
        padding-top: 8px;
    }

    .attendant-table td[data-label="Acoes"],
    .attendant-table td[data-label="Editar"] {
        padding-top: 8px;
    }

    .contact-actions {
        grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
        gap: 5px;
    }

    .contact-search-form {
        grid-template-columns: 1fr;
    }

    .contact-search-form .btn {
        width: 100%;
    }

    .contact-actions .btn {
        min-height: 34px;
        padding: 5px 8px;
        font-size: 12px;
    }

    .contact-name-edit {
        grid-template-columns: 1fr;
    }

    .contact-name-edit .btn {
        width: 100%;
    }

    .attendant-create-form,
    .attendant-edit-form {
        grid-template-columns: 1fr;
    }

    .attendant-create-form .btn,
    .attendant-edit-form .btn {
        width: 100%;
    }

    .contact-conversation .bubble {
        max-width: 92%;
    }

    .whatsapp-connections-table td:last-child {
        padding-top: 8px;
    }

    .whatsapp-actions {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 5px;
        width: 100%;
        max-width: 100%;
    }

    .whatsapp-actions .btn {
        min-height: 34px;
        padding: 5px 8px;
        font-size: 12px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .whatsapp-actions form {
        min-width: 0;
    }

    .stack {
        gap: 8px;
    }

    .session-card p,
    .setting-item,
    .stack p {
        padding: 10px;
        font-size: 12px;
        line-height: 1.35;
    }

    .contact-profile-panel .stack {
        gap: 4px;
    }

    .contact-profile-panel .stack p {
        padding: 4px 0;
        line-height: 1.28;
    }

    .conversation {
        gap: 8px;
    }

    .bubble {
        max-width: 92%;
        padding: 9px 11px;
        border-radius: 8px;
        font-size: 12px;
        line-height: 1.35;
    }

    .bubble small {
        display: block;
        font-size: 10px;
        line-height: 1.35;
    }

    .bubble p {
        margin-top: 5px;
        font-size: 12px;
        line-height: 1.35;
    }

    .theme-toggle,
    .sidebar-toggle,
    .btn-icon {
        width: 44px;
    }
}

@media (max-width: 768px) {
    .support-app {
        grid-template-columns: 1fr !important;
        min-height: calc(100vh - 116px) !important;
    }

    .support-chat-panel {
        display: none !important;
    }

    .support-app.is-chat-open .support-list-panel {
        display: none !important;
    }

    .support-app.is-chat-open .support-chat-panel {
        display: grid !important;
    }

    .support-back {
        display: inline-flex !important;
        width: auto !important;
    }

    .support-list-head {
        padding: 14px !important;
    }

    .support-list-head h2 {
        font-size: 20px !important;
    }

    .support-message {
        max-width: 88% !important;
    }

    .support-compose {
        display: flex !important;
        flex-wrap: wrap !important;
    }

    .support-tag-editor,
    .tag-create-form,
    .tag-edit-form {
        grid-template-columns: minmax(0, 1fr) auto !important;
    }

    .support-tag-editor .btn {
        width: auto !important;
    }

    .support-chat-actions {
        align-self: start;
    }

    .support-tag-menu {
        right: 0;
    }

    .support-compose .btn {
        width: auto !important;
    }

    .support-compose .btn-primary {
        flex: 1 0 100%;
        width: 100% !important;
    }

    .support-file-btn,
    .support-emoji-toggle {
        width: 42px !important;
        min-width: 42px !important;
    }

    .support-file-name {
        flex-basis: 100%;
    }

    .support-emoji-toggle {
        width: 42px !important;
    }

    .support-emoji-menu {
        width: min(238px, 86vw);
        grid-template-columns: repeat(8, 1fr);
    }
}

@media (max-width: 576px) {
    .support-app {
        border-radius: 8px !important;
        min-height: calc(100vh - 128px) !important;
    }

    .support-conversation-item {
        grid-template-columns: 38px minmax(0, 1fr) !important;
        padding: 10px !important;
    }

    .support-avatar {
        width: 38px !important;
        height: 38px !important;
        flex-basis: 38px !important;
    }

    .support-chat-head {
        padding: 10px !important;
        gap: 8px !important;
    }

    .support-chat-actions .support-status {
        justify-self: end;
    }

    .support-tag-menu-wrap > .btn {
        padding: 4px 8px !important;
        min-height: 28px !important;
        width: auto !important;
    }

    .support-messages {
        padding: 12px 10px !important;
    }

    .support-message {
        max-width: 92% !important;
        padding: 9px 10px !important;
    }

    .support-message p {
        font-size: 12px !important;
        line-height: 1.35 !important;
    }

    .tag-card-grid {
        border: 0;
        border-radius: 0;
        gap: 12px;
        overflow: visible;
    }

    .tag-card {
        grid-template-columns: 1fr;
        gap: 14px;
        padding: 14px;
        border: 1px solid #e0e0e0;
        border-radius: 8px;
    }
}
