:root {
    --color-primary: #00d1b2;
    --color-link: #3273dc;
    --color-sidebar-bg: #2e323a;
    --color-sidebar-text: #ffffff;
    --color-navbar-bg: #ffffff;
    --color-body-bg: #f8f8f8;
    --color-login-bg: #f5f5f5;
    --color-login-card: #ffffff;
}

html {
    font-family: 'Nunito', sans-serif;
}

body {
    background-color: var(--color-body-bg);
}

a,
.has-text-link,
.content a:not(.button) {
    color: var(--color-link);
}

.button.is-link {
    background-color: var(--color-link) !important;
    color: #ffffff !important;
    border-color: transparent !important;
}

.button.is-link:hover {
    filter: brightness(0.9);
}

.button.is-link.is-light {
    background-color: color-mix(in srgb, var(--color-link) 16%, white) !important;
    color: var(--color-link) !important;
}

.aside {
    background-color: var(--color-sidebar-bg) !important;
}

.aside .aside-tools {
    background-color: var(--color-sidebar-bg) !important;
    height: auto !important;
    min-height: 4rem;
    padding: 0.5rem 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.aside .aside-tools .aside-tools-label {
    width: 100%;
    display: flex;
    justify-content: center;
}

.aside .menu-label,
.aside .menu-list a,
.aside .aside-tools,
.aside .aside-tools .aside-tools-label,
.aside .aside-tools .aside-tools-label a {
    color: var(--color-sidebar-text) !important;
}

.aside .menu-list a:hover {
    background-color: rgba(255, 255, 255, 0.1) !important;
    color: var(--color-sidebar-text) !important;
}

.aside .menu-list a.is-active {
    background-color: var(--color-primary) !important;
    color: #ffffff !important;
}

#navbar-main {
    background-color: var(--color-navbar-bg) !important;
}

.navbar.site-navbar,
.navbar.site-navbar .navbar-menu,
.navbar.site-navbar .navbar-dropdown,
section.hero.is-hero-bar {
    background-color: var(--color-navbar-bg) !important;
}

.panel-header {
    width: 100%;
}

.panel-breadcrumb {
    font-size: 0.92rem;
    margin-top: 0.5rem !important;
}

.panel-breadcrumb ul {
    flex-wrap: wrap;
}

.panel-breadcrumb a {
    color: #6b7280;
}

.panel-breadcrumb li.is-active a {
    color: #1f2937;
    font-weight: 700;
}

.panel-breadcrumb li+li::before {
    color: #9ca3af;
}

.brand-mark,
.site-brand,
.auth-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
}

.auth-brand {
    flex-direction: column;
    gap: 0.9rem;
}

.brand-mark-text {
    color: inherit;
    font-weight: 700;
}

.system-logo {
    display: block;
    width: auto;
    object-fit: contain;
}

.system-logo-panel {
    max-height: 64px;
    max-width: 100%;
}

.system-logo-site {
    max-height: 52px;
    max-width: 180px;
}

.system-logo-auth {
    max-height: 140px;
    max-width: 300px;
}

.button.is-primary {
    background-color: var(--color-primary) !important;
    color: #ffffff !important;
    border-color: transparent !important;
}

.button.is-primary:hover {
    filter: brightness(0.9);
}

.button.is-primary.is-light,
.tag.is-primary.is-light,
.notification.is-primary.is-light {
    background-color: color-mix(in srgb, var(--color-primary) 16%, white) !important;
    color: var(--color-primary) !important;
}

.has-text-primary {
    color: var(--color-primary) !important;
}

.is-primary {
    background-color: var(--color-primary) !important;
}

.input:focus,
.textarea:focus,
.select select:focus {
    border-color: var(--color-primary) !important;
    box-shadow: 0 0 0 0.125em color-mix(in srgb, var(--color-primary) 25%, transparent) !important;
}

.pagination-link.is-current,
.menu-list a.is-active,
.tag.is-info,
.hero.is-primary,
.hero.is-primary.is-bold {
    background-color: var(--color-primary) !important;
    background-image: none !important;
}

.hero.is-primary .title,
.hero.is-primary .subtitle,
.hero.is-primary a:not(.button) {
    color: #ffffff !important;
}

.navbar-item .tag.is-light,
.tag.is-info.is-light {
    color: var(--color-primary) !important;
    background-color: color-mix(in srgb, var(--color-primary) 16%, white) !important;
}

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-login-bg);
}

.auth-page .auth-card {
    background: var(--color-login-card);
}

.auth-page .auth-logo {
    color: var(--color-primary);
    display: inline-block;
    font-weight: 800;
    font-size: 1.5rem;
}

.site-navbar {
    background-color: var(--color-navbar-bg) !important;
}

.settings-stack {
    display: grid;
    gap: 1.5rem;
}

.settings-card {
    padding: 1.5rem;
    margin-bottom: 0 !important;
}

.settings-card-head {
    margin-bottom: 1.5rem;
}

.settings-card .title {
    margin-bottom: 0.5rem !important;
}

.settings-card .title+.subtitle {
    margin-top: 0 !important;
}

.settings-grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr);
}

.settings-side-panel {
    align-self: start;
}

.logo-preview-card {
    min-height: 180px;
    padding: 1rem;
    border: 1px dashed #d1d5db;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(246, 248, 250, 0.95));
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-preview-image {
    max-width: 100%;
    max-height: 120px;
    width: auto;
    object-fit: contain;
}

.logo-preview-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    color: #6b7280;
    text-align: center;
}

.logo-preview-empty .icon {
    font-size: 2rem;
}

input.color-picker {
    width: 3rem;
    height: 2.5rem;
    padding: 0.1rem;
    border: 1px solid #dbdbdb;
    border-radius: 4px;
    cursor: pointer;
    background: none;
}

.flash-message {
    animation: fadeOut 0.5s ease 4.5s forwards;
}

@media screen and (max-width: 1023px) {
    .aside {
        display: none !important;
    }

    html.has-aside-mobile-expanded .aside {
        display: block !important;
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        z-index: 100;
        width: 15rem;
        background-color: var(--color-sidebar-bg) !important;
    }
}

@media screen and (max-width: 768px) {
    .panel-header .level-right {
        margin-top: 1rem;
    }

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

@keyframes fadeOut {
    to {
        opacity: 0;
        pointer-events: none;
    }
}

/* === Ticket: painel de detalhes === */
.ticket-detail-item {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    align-items: flex-start;
}

.ticket-detail-label {
    font-size: 0.76rem;
    color: #9ca3af;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    min-width: 5.5rem;
    flex-shrink: 0;
    padding-top: 0.1rem;
}

.ticket-detail-value {
    font-size: 0.88rem;
    color: #1f2937;
    flex: 1;
}

/* === Ticket: chat thread === */
.ticket-chat {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 62vh;
    overflow-y: auto;
}

.chat-message {
    display: flex;
    gap: 0.65rem;
    align-items: flex-start;
    max-width: 84%;
}

.chat-message.is-staff-msg {
    flex-direction: row-reverse;
    align-self: flex-end;
}

.chat-message.is-customer-msg {
    align-self: flex-start;
}

.chat-avatar {
    width: 2.1rem;
    height: 2.1rem;
    min-width: 2.1rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.72rem;
    color: #fff;
    text-transform: uppercase;
    flex-shrink: 0;
}

.chat-avatar.is-staff   { background-color: var(--color-primary); }
.chat-avatar.is-customer { background-color: #9ca3af; }

.chat-bubble {
    border-radius: 1rem;
    padding: 0.65rem 0.9rem;
    max-width: 100%;
    word-break: break-word;
}

.chat-bubble.is-staff {
    background: var(--color-primary);
    color: #fff;
    border-bottom-right-radius: 0.2rem;
}

.chat-bubble.is-customer {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    color: #374151;
    border-bottom-left-radius: 0.2rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.chat-bubble.is-internal {
    background: #fffbeb;
    border: 1.5px dashed #f59e0b;
    color: #374151;
    border-bottom-right-radius: 0.2rem;
}

.chat-meta {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0.28rem;
    flex-wrap: wrap;
}

.chat-meta strong { font-size: 0.8rem; }

.chat-time {
    font-size: 0.68rem;
    opacity: 0.6;
    margin-left: auto;
    white-space: nowrap;
}

.chat-bubble.is-staff .chat-time { opacity: 0.78; }

.chat-text {
    font-size: 0.875rem;
    line-height: 1.55;
}

/* === Ticket: anexos em miniatura === */
.chat-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.5rem;
}

.chat-attachment-thumb {
    width: 66px;
    height: 66px;
    border-radius: 6px;
    object-fit: cover;
    cursor: zoom-in;
    border: 2px solid rgba(255,255,255,0.2);
    transition: transform 0.15s, box-shadow 0.15s;
    display: block;
}

.chat-bubble.is-customer .chat-attachment-thumb {
    border-color: #e5e7eb;
}

.chat-attachment-thumb:hover {
    transform: scale(1.07);
    box-shadow: 0 4px 14px rgba(0,0,0,0.2);
}

.chat-attachment-video-thumb {
    position: relative;
    width: 66px;
    height: 66px;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    background: #374151;
    border: 2px solid rgba(255,255,255,0.2);
    flex-shrink: 0;
    transition: transform 0.15s;
}

.chat-bubble.is-customer .chat-attachment-video-thumb {
    border-color: #e5e7eb;
}

.chat-attachment-video-thumb:hover { transform: scale(1.07); }

.chat-attachment-video-thumb::after {
    content: '▶';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.35);
    color: #fff;
    font-size: 1.25rem;
}

.chat-attachment-file {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.74rem;
    padding: 0.28rem 0.6rem;
    border-radius: 6px;
    background: rgba(0,0,0,0.07);
    color: inherit;
    text-decoration: none;
}

.chat-attachment-file:hover { background: rgba(0,0,0,0.13); color: inherit; }

/* === Ticket: linha do tempo === */
.timeline-event {
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.timeline-event-line {
    flex: 1;
    height: 1px;
    background: #e5e7eb;
}

.timeline-event-label {
    display: inline-flex;
    align-items: center;
    gap: 0.28rem;
    font-size: 0.68rem;
    color: #9ca3af;
    white-space: nowrap;
    padding: 0.2rem 0.6rem;
    background: #f3f4f6;
    border-radius: 999px;
}

/* === Ticket: caixa de resposta === */
.ticket-reply-box {
    border-top: 1px solid #e5e7eb;
    padding: 1rem 1.25rem;
    background: #fafafa;
    border-radius: 0 0 0.5rem 0.5rem;
}

/* === Lightbox === */
.lightbox-modal .modal-content {
    max-width: 92vw;
    display: flex;
    justify-content: center;
    align-items: center;
}

.lightbox-modal .modal-content img,
.lightbox-modal .modal-content video {
    max-width: 100%;
    max-height: 85vh;
    border-radius: 8px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.5);
    display: block;
}