/**
 * DKSOFT Chatbot
 * Copyright © 2026.
 * É proibida a reprodução ou distribuição sem autorização.
 */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    color-scheme: light only;
    --bg-color: #f3f4f6;
    --primary-gradient: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    --secondary-gradient: linear-gradient(135deg, #0284c7 0%, #0284c7 100%);
    --card-bg: rgba(255, 255, 255, 0.75);
    --border-color: rgba(0, 0, 0, 0.08);
    --text-primary: #1f2937;
    --text-secondary: #4b5563;
    --glass-blur: blur(20px);
    --user-bubble: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
    --bot-bubble: rgba(243, 244, 246, 0.85);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-color);
    background-image: 
        radial-gradient(at 0% 0%, rgba(79, 70, 229, 0.08) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(6, 182, 212, 0.08) 0px, transparent 50%),
        radial-gradient(at 50% 100%, rgba(124, 58, 237, 0.05) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
}

/* Glassmorphism Containers */
.container {
    width: 90%;
    max-width: 500px;
    height: 85vh;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

/* Header */
.header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.4);
}

.header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-logo {
    width: 44px;
    height: 44px;
    background: var(--primary-gradient);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.25);
}

.header-title h1 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.header-title p {
    font-size: 12px;
    color: #10b981;
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 2px;
}

.header-title p::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    background-color: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 8px #10b981;
}

.config-btn {
    background: rgba(0, 0, 0, 0.04);
    border: 1px solid var(--border-color);
    width: 38px;
    height: 38px;
    border-radius: 10px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.config-btn:hover {
    color: var(--text-primary);
    background: rgba(0, 0, 0, 0.08);
    transform: rotate(45deg);
}

/* Chat Log Area */
.chat-log {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
}

.chat-log::-webkit-scrollbar {
    width: 6px;
}

.chat-log::-webkit-scrollbar-track {
    background: transparent;
}

.chat-log::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
}

/* Message Bubbles */
.message {
    max-width: 80%;
    padding: 14px 18px;
    border-radius: 18px;
    font-size: 15px;
    line-height: 1.5;
    animation: fadeIn 0.3s ease-out forwards;
    position: relative;
    word-wrap: break-word;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.bot {
    align-self: flex-start;
    background: var(--bot-bubble);
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 4px;
    color: var(--text-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.message.user {
    align-self: flex-end;
    background: var(--user-bubble);
    border-bottom-right-radius: 4px;
    color: #ffffff;
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.2);
}

.message strong {
    font-weight: 600;
}

.message code {
    background: rgba(0, 0, 0, 0.06);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 13px;
    color: #1e1b4b;
}

.message a {
    color: #2563eb;
    text-decoration: underline;
    font-weight: 500;
}

.message.user a {
    color: #e0f2fe;
}

/* Quick Actions / Interactive Buttons */
.options-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 12px;
    width: 100%;
}

.option-btn {
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(0, 0, 0, 0.08);
    padding: 8px 12px;
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 6px;
    width: 100%;
    min-height: 40px;
}

.option-btn:hover {
    background: #4f46e5;
    color: #ffffff;
    border-color: #4f46e5;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.25);
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 5px;
    padding: 6px 10px;
    align-items: center;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: var(--text-secondary);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    50% {
        transform: translateY(-4px);
        opacity: 1;
    }
}

/* Chat Input Bar */
.input-area {
    padding: 20px 24px;
    border-top: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.4);
    display: flex;
    gap: 12px;
    align-items: center;
}

.input-field {
    flex: 1;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.12);
    padding: 14px 20px;
    border-radius: 16px;
    color: var(--text-primary);
    font-size: 15px;
    outline: none;
    transition: all 0.3s ease;
}

.input-field:focus {
    border-color: rgba(99, 102, 241, 0.5);
    background: #ffffff;
    box-shadow: 0 0 12px rgba(99, 102, 241, 0.15);
}

.input-field::placeholder {
    color: #9ca3af;
}

.send-btn {
    background: var(--primary-gradient);
    border: none;
    width: 48px;
    height: 48px;
    border-radius: 16px;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.2);
    transition: all 0.3s ease;
}

.send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.35);
}

.send-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
    transition: transform 0.3s ease;
}

.send-btn:hover svg {
    transform: translate(2px, -2px);
}

/* Admin Dashboard CSS */
.admin-card {
    padding: 30px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    height: auto;
    max-height: 90vh;
    overflow-y: auto;
}

.admin-header {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 16px;
    margin-bottom: 10px;
}

.admin-header h2 {
    font-size: 22px;
    font-weight: 600;
    color: var(--text-primary);
}

.admin-header p {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group input {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.12);
    padding: 12px 16px;
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 15px;
    outline: none;
    transition: all 0.3s ease;
}

.form-group input:focus {
    border-color: rgba(6, 182, 212, 0.5);
    background: #ffffff;
    box-shadow: 0 0 12px rgba(6, 182, 212, 0.15);
}

.form-row {
    display: grid;
    grid-template-columns: 3fr 1fr;
    gap: 16px;
}

.btn-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 15px;
}

.admin-btn {
    border: none;
    padding: 14px 20px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-test {
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.08);
    color: var(--text-primary);
}

.btn-test:hover {
    background: rgba(0, 0, 0, 0.06);
}

.btn-save {
    background: var(--secondary-gradient);
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(2, 132, 199, 0.2);
}

.btn-save:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(2, 132, 199, 0.35);
}

.btn-back {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid rgba(0, 0, 0, 0.08);
    margin-top: 10px;
}

.btn-back:hover {
    color: var(--text-primary);
    background: rgba(0, 0, 0, 0.03);
}

/* Alert Notification UI */
.alert {
    padding: 14px 18px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.4;
    display: none;
    align-items: center;
    gap: 10px;
}

.alert.success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.25);
    color: #065f46;
}

.alert.error {
    background: rgba(220, 38, 38, 0.08);
    border: 1px solid rgba(220, 38, 38, 0.2);
    color: #991b1b;
}

/* Responsive adjustments */
@media(max-height: 600px) {
    .container {
        height: 95vh;
    }
}

/* Emoji Picker styling */
.emoji-picker-container {
    position: absolute;
    bottom: 50px;
    left: 0;
    width: auto;
    z-index: 20;
    display: grid;
    grid-template-columns: repeat(5, 38px);
    gap: 6px;
    padding: 12px;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    animation: fadeIn 0.2s ease-out;
}
.emoji-option {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    border-radius: 8px;
    transition: background 0.2s ease, transform 0.15s ease;
}
.emoji-option:hover {
    background: rgba(99, 102, 241, 0.12);
    transform: scale(1.08);
}

/* Custom form-select styles */
.form-select {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.12);
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 15px;
    outline: none;
    cursor: pointer;
    color: var(--text-primary);
    width: 100%;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234b5563' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 16px;
    transition: all 0.3s ease;
}
.form-select:focus {
    border-color: rgba(6, 182, 212, 0.5);
    box-shadow: 0 0 12px rgba(6, 182, 212, 0.15);
}

/* Modificações para exibição como Widget / Iframe */
body.iframe-mode {
    min-height: 100vh !important;
    height: 100vh !important;
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    background-image: none !important;
    overflow: hidden !important;
}

body.iframe-mode .container {
    width: 100% !important;
    height: 100vh !important;
    max-width: none !important;
    border-radius: 0 !important;
    border: none !important;
    box-shadow: none !important;
}

/* Blocos de Configuração Administrativa */
body.admin-panel-active {
    align-items: flex-start;
    padding: 20px 0 36px 0;
    overflow-x: clip;
}

#configSection.admin-card {
    padding: 24px 28px 28px 28px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    height: auto;
    max-height: none;
    max-width: 1400px !important;
    width: 95% !important;
    box-sizing: border-box;
    overflow: visible !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background: rgba(255, 255, 255, 0.82);
}

/* Header fixo e flutuante no topo do painel */
.admin-header-floating {
    position: sticky;
    top: 12px;
    z-index: 950;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
    width: 100%;
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(79, 70, 229, 0.14);
    border-radius: 18px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
    box-sizing: border-box;
}

.admin-header-brand {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    flex: 1 1 320px;
}

.admin-header-brand h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.25;
}

.admin-header-brand p {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0;
}

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

.admin-header-actions .btn-save {
    width: auto !important;
    margin: 0 !important;
    padding: 10px 20px !important;
    font-size: 14px !important;
    white-space: nowrap;
}

.admin-header-actions .btn-back {
    width: auto !important;
    margin: 0 !important;
    padding: 9px 14px !important;
    font-size: 13px !important;
    white-space: nowrap;
}

.admin-dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    align-items: stretch;
    margin-top: 4px;
    height: auto;
    min-height: 0;
}

.admin-dashboard-col {
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    height: auto;
    overflow: visible;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.02);
    box-sizing: border-box;
}

.config-block-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 5px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    padding-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

#portalAlunoLink {
  color: #6c757d;          /* cinza neutro para o texto */
  background-color: #f1f3f5; /* cinza bem claro no fundo */
  font-style: italic;      /* opcional, para diferenciar */
}

#portalAlunoLink::placeholder {
  color: #adb5bd;          /* cinza mais claro para o placeholder */
}

/* Escolas & Franquia no Painel Admin (Topo) */
.schools-section {
    display: flex;
    flex-direction: column;
    gap: 14px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 20px 22px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.02);
}

.schools-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.schools-section-title-group {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.schools-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 9px;
    border-radius: 999px;
    background: rgba(79, 70, 229, 0.12);
    color: #4f46e5;
    font-size: 12px;
    font-weight: 700;
}

.franchise-mode-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 999px;
    background: rgba(16, 185, 129, 0.12);
    color: #047857;
    font-size: 11px;
    font-weight: 700;
}

.btn-add-school {
    background: var(--primary-gradient);
    color: #ffffff;
    border: none;
    border-radius: 12px;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.22);
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-add-school:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.3);
}

.btn-add-school:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Nome da franquia alinhado perto do texto */
.franchise-name-box {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 18px;
    background: rgba(79, 70, 229, 0.05);
    border: 1px solid rgba(79, 70, 229, 0.18);
    border-radius: 14px;
    padding: 12px 16px;
}

.franchise-name-box-label {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 0 0 auto;
    max-width: 340px;
}

.franchise-name-box label {
    font-size: 12px;
    font-weight: 700;
    color: #312e81;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.franchise-name-box input {
    flex: 0 1 380px;
    width: 360px;
    max-width: 100%;
    min-width: 240px;
    background: #ffffff;
    border: 1px solid rgba(79, 70, 229, 0.28);
    padding: 10px 14px;
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
    outline: none;
    transition: all 0.2s ease;
}

.franchise-name-box input:focus {
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

/* Barra de pesquisa / filtro de unidades */
.schools-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.schools-search-wrap {
    position: relative;
    flex: 1 1 280px;
    max-width: 440px;
}

.schools-search-icon {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    color: #94a3b8;
    pointer-events: none;
}

.schools-search-input {
    width: 100%;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 999px;
    padding: 9px 14px 9px 36px;
    font-size: 13px;
    color: var(--text-primary);
    outline: none;
    transition: all 0.2s ease;
}

.schools-search-input:focus {
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.schools-filter-count {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

/* Lista horizontal e comprida de escolas */
.schools-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.schools-empty-state {
    border: 1.5px dashed rgba(79, 70, 229, 0.28);
    border-radius: 14px;
    padding: 22px;
    text-align: center;
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    background: rgba(255, 255, 255, 0.75);
}

.school-item-card {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 16px;
    padding: 16px 20px;
    display: grid;
    grid-template-columns: minmax(320px, 1.35fr) minmax(350px, 1.55fr) auto;
    align-items: center;
    gap: 18px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.school-item-card:hover {
    border-color: rgba(79, 70, 229, 0.26);
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.07);
}

.school-item-card.school-card-invalid {
    background: #eef2f6;
    border-color: #cbd5e1;
    box-shadow: none;
}

.school-item-card.school-card-invalid .school-order-badge {
    background: #94a3b8;
    color: #ffffff;
    box-shadow: none;
}

.school-item-card.school-card-invalid .school-item-name {
    color: #64748b;
}

.school-item-card.school-card-invalid .school-token-pill {
    background: #e2e8f0;
    color: #64748b;
}

.school-item-card.school-card-invalid .school-sub-field input {
    background: #e2e8f0;
    color: #475569;
}

.school-item-card.school-card-invalid .school-link-summary {
    background: #e2e8f0;
}

.school-row-identity {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-width: 0;
    flex-wrap: wrap;
}

.school-identity-main {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    flex: 1 1 180px;
}

.school-identity-health {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
    flex-shrink: 0;
}

.school-health-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid rgba(0, 0, 0, 0.07);
    white-space: nowrap;
}

.school-health-badge.checking {
    background: rgba(245, 158, 11, 0.14);
    color: #b45309;
    border-color: rgba(245, 158, 11, 0.25);
}

.school-health-badge.valid {
    background: rgba(16, 185, 129, 0.12);
    color: #047857;
    border-color: rgba(16, 185, 129, 0.26);
}

.school-health-badge.invalid {
    background: rgba(100, 116, 139, 0.16);
    color: #475569;
    border-color: rgba(100, 116, 139, 0.3);
}

.btn-test-school-token {
    background: rgba(79, 70, 229, 0.08);
    color: #4f46e5;
    border: 1px solid rgba(79, 70, 229, 0.24);
    border-radius: 8px;
    padding: 5px 10px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.btn-test-school-token:hover:not(:disabled) {
    background: #4f46e5;
    color: #ffffff;
}

.btn-test-school-token:disabled {
    opacity: 0.65;
    cursor: wait;
}

.school-order-badge {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #fbbf24;
    color: #1e293b;
    font-size: 13px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(245, 158, 11, 0.25);
}

.school-item-title-wrap {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
}

.school-item-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    word-break: break-word;
    line-height: 1.3;
}

.school-token-pill {
    display: inline-block;
    width: fit-content;
    font-family: monospace;
    font-size: 12px;
    color: #4b5563;
    background: #f3f4f6;
    border: 1px solid rgba(0, 0, 0, 0.06);
    padding: 2px 8px;
    border-radius: 6px;
}

.school-item-fields {
    display: grid;
    grid-template-columns: minmax(190px, 0.9fr) minmax(240px, 1.3fr);
    gap: 14px;
    align-items: start;
}

.school-sub-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
}

.school-sub-field label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.school-sub-field input {
    background: #f9fafb;
    border: 1px solid rgba(0, 0, 0, 0.1);
    padding: 8px 11px;
    border-radius: 9px;
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
    transition: all 0.2s ease;
    width: 100%;
    box-sizing: border-box;
}

.school-sub-field input:focus {
    background: #ffffff;
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.school-link-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    background: #f8fafc;
    border: 1px solid rgba(0, 0, 0, 0.07);
    border-radius: 9px;
    padding: 6px 10px;
}

.school-link-badge {
    font-size: 12px;
    font-weight: 600;
    color: #059669;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.school-link-badge.custom {
    color: #4f46e5;
}

.school-link-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.school-cadastro-editor {
    display: none;
    flex-direction: column;
    gap: 4px;
    margin-top: 4px;
}

.school-cadastro-editor.open {
    display: flex;
}

.school-row-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.btn-remove-school {
    background: rgba(239, 68, 68, 0.08);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.22);
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.btn-remove-school:hover:not(:disabled) {
    background: #ef4444;
    color: #ffffff;
}

.btn-remove-school:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Melhorias visuais nas colunas abaixo */
.appearance-row {
    display: grid;
    grid-template-columns: 1fr 110px;
    gap: 12px;
    align-items: end;
}

.option-toggle-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.option-toggle-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 11px;
    padding: 10px 12px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    transition: border-color 0.2s ease, background 0.2s ease;
    text-transform: none !important;
}

.option-toggle-item:hover {
    background: #ffffff;
    border-color: rgba(79, 70, 229, 0.25);
}

.option-toggle-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #4f46e5;
    flex-shrink: 0;
}

.advanced-links-details {
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 10px 14px;
}

.advanced-links-details summary {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    user-select: none;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.advanced-links-details summary::-webkit-details-marker {
    display: none;
}

.advanced-links-details summary::after {
    content: '▾';
    font-size: 12px;
    color: var(--text-secondary);
    transition: transform 0.2s ease;
}

.advanced-links-details[open] summary::after {
    transform: rotate(180deg);
}

.advanced-links-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

/* Preview ao vivo do Widget */
.widget-preview-box {
    background: linear-gradient(180deg, rgba(241, 245, 249, 0.95) 0%, rgba(226, 232, 240, 0.75) 100%);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 14px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.widget-preview-stage {
    position: relative;
    height: 82px;
    background: #ffffff;
    border-radius: 10px;
    border: 1px dashed rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    padding: 10px 14px;
    overflow: hidden;
}

.widget-preview-stage.pos-left {
    justify-content: flex-start;
}

.widget-preview-cluster {
    display: flex;
    align-items: center;
    gap: 10px;
}

.widget-preview-stage.pos-left .widget-preview-cluster {
    flex-direction: row-reverse;
}

.widget-preview-bubble {
    background: #ffffff;
    color: #0f172a;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    max-width: 175px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.widget-preview-launcher {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary-gradient);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

.unsaved-badge {
    display: none;
    align-items: center;
    gap: 6px;
    background: rgba(245, 158, 11, 0.14);
    color: #b45309;
    border: 1px solid rgba(245, 158, 11, 0.3);
    padding: 7px 12px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.unsaved-badge.visible {
    display: inline-flex;
}

/* Responsividade do painel */
@media (max-width: 1120px) {
    .school-item-card {
        grid-template-columns: 1fr auto;
    }
    .school-item-fields {
        grid-column: 1 / -1;
        order: 3;
    }
}

@media (max-width: 1024px) {
    #configSection.admin-card {
        height: auto !important;
        max-height: none !important;
    }
    .admin-dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
        height: auto;
    }
    .admin-dashboard-col {
        height: auto !important;
        overflow: visible !important;
    }
}

@media (max-width: 768px) {
    #configSection.admin-card {
        height: auto !important;
        max-height: none !important;
        padding: 16px !important;
        gap: 16px !important;
    }
    .admin-header-floating {
        position: sticky;
        top: 8px;
        z-index: 950;
        padding: 10px 14px;
        gap: 8px;
        border-radius: 14px;
    }
    .admin-header-brand {
        flex: 1 1 100%;
    }
    .admin-header-brand h2 {
        font-size: 16px;
    }
    .admin-header-brand p {
        display: none;
    }
    .admin-header-actions {
        width: 100%;
        gap: 8px;
    }
    .admin-header-actions .btn-save,
    .admin-header-actions .btn-back {
        flex: 1 1 auto !important;
        padding: 8px 12px !important;
        font-size: 13px !important;
    }
    .admin-dashboard-grid {
        grid-template-columns: 1fr;
        height: auto;
        gap: 16px;
    }
    .admin-dashboard-col {
        height: auto !important;
        overflow: visible !important;
        padding: 16px !important;
        gap: 14px !important;
    }
    .school-item-card {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    .school-identity-health {
        flex-direction: row;
        align-items: center;
    }
    .school-item-fields {
        grid-template-columns: 1fr;
    }
    .school-row-actions {
        justify-content: flex-start;
    }
}

@media (max-width: 600px) {
    .appearance-row {
        grid-template-columns: 1fr;
    }
    .franchise-name-box {
        gap: 10px;
    }
    .franchise-name-box input {
        width: 100%;
        flex: 1 1 100%;
    }
}
