/* ═══════════════════════════════════════════
   Dashboard — Automações A3M
   Tokens herdados do Design System
   ═══════════════════════════════════════════ */

:root {
    --bg:           #ebe8e3;
    --primary:      #1d9dc3;
    --primary-dk:   #1783a3;
    --text:         #707070;
    --border:       #d6d3ce;
    --white:        #ffffff;
    --error:        #e05555;
    --success:      #27ae60;
    --glass:        rgba(255,255,255,0.4);
    --glass-blur:   blur(10px);
    --card-r:       12px;
    --btn-r:        6px;
    --sidebar-w:    80px;
    --sidebar-w-exp: 200px;
    --panel-w:      420px;
    --transition:   all 0.3s cubic-bezier(.4,0,.2,1);
}

/* ─── Reset ─── */
*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
}

/* ═══════════════════════════════════════════
   SIDEBAR (barra lateral esquerda — retrátil)
   ═══════════════════════════════════════════ */
.sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--sidebar-w);
    background: var(--bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 100;
    transition: width 0.3s cubic-bezier(.4,0,.2,1);
    padding-top: 12px;
    overflow: hidden;
}

/* Estado expandido */
.sidebar.expanded {
    width: var(--sidebar-w-exp);
}

/* Logo */
.sidebar-logo {
    width: 100%;
    height: 110px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 16px;
    margin-bottom: 24px;
    cursor: pointer;
    flex-shrink: 0;
    overflow: hidden;
    position: relative;
}

.sidebar-logo img {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    object-fit: contain;
    transition: opacity 0.3s ease;
}

.logo-retraido {
    width: 36px;
    opacity: 1;
}

.sidebar.expanded .logo-retraido {
    opacity: 0;
    pointer-events: none;
}

.logo-expandido {
    width: 140px;
    opacity: 0;
    pointer-events: none;
}

.sidebar.expanded .logo-expandido {
    opacity: 1;
    pointer-events: auto;
}

/* Nav items */
.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    padding: 0 6px;
    flex: 1;
}

.sidebar-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    padding: 10px 0 10px 22px;
    border-radius: var(--btn-r);
    cursor: pointer;
    transition: background 0.2s, color 0.2s, box-shadow 0.2s;
    text-decoration: none;
    border: none;
    background: none;
    color: var(--white);
    width: 100%;
    overflow: hidden;
    white-space: nowrap;
}

/* Quando expandido, itens não mudam de layout, apenas liberam o texto e ganham o gap original, mantendo-se estáticos na tela! */

.sidebar-item .icon-box {
    width: 36px;
    height: 36px;
    min-width: 36px;
    background: var(--primary);
    border-radius: var(--btn-r);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.sidebar-item .icon-box svg {
    width: 18px;
    height: 18px;
    stroke: var(--white);
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Labels: escondidos quando retraído */
.sidebar-item .item-label {
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--text);
    text-align: left;
    line-height: 1.2;
    white-space: nowrap;
    opacity: 0;
    width: 0;
    overflow: hidden;
    transition: color 0.2s ease, opacity 0.2s ease, width 0.3s ease;
}

/* Labels: visíveis quando expandido */
.sidebar.expanded .sidebar-item .item-label {
    opacity: 1;
    width: auto;
}

.sidebar.expanded .sidebar-item {
    padding: 10px 0 10px 22px;
}


.sidebar-item:hover .icon-box {
    background: var(--primary-dk);
    transform: translateY(-1px);
}

/* ─── Botão Toggle da Sidebar ─── */
.sidebar-toggle {
    width: 100%;
    padding: 12px 0;
    padding-left: 21px;
    border: none;
    background: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    color: var(--primary);
    border-top: 1px solid var(--border);
    transition: background 0.2s, color 0.2s;
    flex-shrink: 0;
}

.sidebar-toggle:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text);
}

.sidebar-toggle svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform 0.3s ease;
}

/* Rotaciona o chevron quando expandido */
.sidebar.expanded .sidebar-toggle svg {
    transform: rotate(180deg);
}

/* ═══════════════════════════════════════════
   LAYOUT PRINCIPAL
   ═══════════════════════════════════════════ */
.dashboard-wrapper {
    display: flex;
    flex: 1;
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    transition: margin-left 0.3s cubic-bezier(.4,0,.2,1);
}

/* Ajusta margem quando sidebar está expandida */
.sidebar.expanded ~ .dashboard-wrapper {
    margin-left: var(--sidebar-w-exp);
}

/* ─── Painel Esquerdo (Agenda/Logs) ─── */
.left-panel {
    width: var(--panel-w);
    min-height: 100vh;
    border-right: 1px solid var(--border);
    background: #707070;
    color: var(--white);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

/* Ajustes de contraste para o fundo escuro do Left Panel */
.left-panel .day-header,
.left-panel .day-cell,
.left-panel .log-entry {
    color: var(--white) !important;
}
.left-panel .empty-state,
.left-panel .log-time {
    color: rgba(255,255,255,0.7) !important;
}
.left-panel .panel-section,
.left-panel .log-entry {
    border-color: rgba(255,255,255,0.15) !important;
}

.panel-section {
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

.panel-section:last-child {
    border-bottom: none;
    flex: 1;
}

.panel-title {
    font-size: 24px;
    font-weight: 400;
    color: var(--white);
    text-transform: capitalize;
    letter-spacing: 0.5px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.panel-title svg {
    stroke: var(--white);
    margin-right: 8px;
    flex-shrink: 0;
    display: block;
    transform: translateY(2px);
}

/* ─── Calendário ─── */
.calendar-widget {
    width: 100%;
}

.calendar-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 12px;
}

.calendar-nav .cal-month {
    font-size: 16px;
    font-weight: 600;
    color: var(--primary);
}

.cal-nav-btn {
    width: 24px;
    height: 24px;
    border: none;
    background: none;
    color: var(--primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: var(--transition);
    font-size: 14px;
    font-weight: 700;
}

.cal-nav-btn:hover {
    background: rgba(29,157,195,0.1);
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    text-align: center;
    background: radial-gradient(circle at var(--grid-x, -500px) var(--grid-y, -500px), rgba(29,157,195,0.9) 0%, rgba(29,157,195,0.3) 40px, transparent 120px);
    align-content: start;
    border-radius: 6px;
    min-height: 220px;
}

.calendar-grid .day-header {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    padding: 4px 0;
    background-color: #707070;
}

.calendar-grid .day-cell {
    font-size: 16px;
    padding: 5px 2px;
    border-radius: 0; /* Bordas retas combinam melhor com reveal border */
    cursor: default;
    color: var(--text);
    transition: var(--transition);
    background-color: #707070;
    position: relative;
    overflow: hidden;
}

.calendar-grid .day-cell:not(.empty):hover {
    color: var(--primary) !important;
    cursor: pointer;
    font-weight: 700;
}

.calendar-grid .day-cell.today {
    background: var(--primary) !important;
    color: var(--white);
    font-weight: 700;
}

.calendar-grid .day-cell.empty {
    visibility: visible; /* Mostrar para que as linhas do grid brilhem mesmo no vazio */
    background-color: #707070;
    min-height: 28px;
}

/* ═══════════════════════════════════════════
   CONTEÚDO PRINCIPAL (direita)
   ═══════════════════════════════════════════ */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--bg);
}

/* ─── Header com saudação ─── */
.content-header {
    height: 70px;
    padding: 0 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.greeting-text {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center;
    flex: 1;
}

.user-photo {
    width: 48px;
    height: 48px;
    border-radius: var(--btn-r);
    background: var(--primary);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid var(--primary);
}

.user-photo:hover {
    border-color: var(--primary-dk);
    transform: scale(1.05);
}

/* ─── User Menu Dropdown ─── */
.user-menu {
    position: relative;
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--card-r);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    min-width: 180px;
    overflow: hidden;
    display: none;
    z-index: 200;
}

.user-dropdown.open {
    display: block;
    animation: dropdownIn 0.2s ease;
}

@keyframes dropdownIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.dropdown-item:hover {
    background: var(--bg);
    color: var(--primary);
}

.dropdown-item svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
}

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

.dropdown-item.danger:hover {
    background: rgba(224,85,85,0.06);
    color: var(--error);
}

.dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}

/* ─── Área de conteúdo ─── */
.content-body {
    flex: 1;
    padding: 28px 32px;
}

.section-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 20px;
}

/* ─── Transições de Página (SPA) ─── */
.page-content {
    animation: fadeInPage 0.4s ease;
}

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

/* ─── Grid de Automações ─── */
.automations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 420px));
    gap: 20px;
}

.automation-card {
    background: var(--glass);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 32px;
    min-height: 180px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    transition: var(--transition);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.automation-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.05);
}

.automation-card .card-header-row {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.automation-card .card-icon {
    width: 64px;
    height: 64px;
    min-width: 64px;
    border-radius: 14px;
    background: rgba(29,157,195,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
}

.automation-card .card-icon svg {
    width: 36px;
    height: 36px;
    color: var(--primary);
}

.automation-card .card-icon--whatsapp {
    background: rgba(37, 211, 102, 0.12);
    color: #25D366;
}

.automation-card .card-icon--whatsapp svg {
    color: #25D366;
}

.automation-card .card-name {
    font-size: 24px;
    font-weight: 400;
    color: var(--primary);
    line-height: 1.3;
}

.automation-card .card-status {
    font-size: 12px;
    color: #b5b0a9;
    margin-top: 4px;
}

/* ─── Painel Logs (dentro do left-panel) ─── */
.logs-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.log-entry {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 12px;
    color: var(--text);
    padding: 6px 0;
    border-bottom: 1px solid rgba(214,211,206,0.5);
}

.log-entry:last-child {
    border-bottom: none;
}

.log-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--success);
    margin-top: 5px;
    flex-shrink: 0;
}

.log-dot.warn { background: var(--primary); }
.log-dot.error { background: var(--error); }

.log-text {
    flex: 1;
    line-height: 1.4;
}

.log-time {
    font-size: 10px;
    color: #b5b0a9;
    white-space: nowrap;
}

/* ═══════════════════════════════════════════
   EMPTY STATE
   ═══════════════════════════════════════════ */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
    color: #b5b0a9;
    text-align: center;
    opacity: 0.45;
    font-style: italic;
}

.empty-state svg {
    width: 36px;
    height: 36px;
    stroke: var(--border);
    fill: none;
    stroke-width: 1.5;
    margin-bottom: 10px;
}

.empty-state p {
    font-size: 13px;
}

/* ═══════════════════════════════════════════
   RESPONSIVIDADE DESKTOP
   ═══════════════════════════════════════════ */

/* Monitores Ultrawide (1920px+) */
@media (min-width: 1920px) {
    .automations-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 32px;
    }
    .content-body {
        padding: 40px 60px;
    }
    .content-header {
        padding: 32px 60px;
    }
    .greeting-text {
        font-size: 22px;
    }
}

/* Telas grandes (1440px a 1919px): mais espaço para cards */
@media (max-width: 1919px) and (min-width: 1440px) {
    .automations-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 24px;
    }
    .content-body {
        padding: 32px 40px;
    }
    .content-header {
        padding: 28px 40px;
    }
    .greeting-text {
        font-size: 20px;
    }
}

/* Telas médias-grandes (1280px-1439px) */
@media (max-width: 1439px) and (min-width: 1280px) {
    .automations-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }
}

/* Notebooks padrão (1024px-1279px) */
@media (max-width: 1279px) and (min-width: 1025px) {
    .left-panel {
        width: 250px;
    }
    .automations-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
    .content-body {
        padding: 24px 28px;
    }
    .content-header {
        padding: 20px 28px;
    }
    .greeting-text {
        font-size: 17px;
    }
    .automation-card {
        min-height: 160px;
    }
}

/* Notebooks compactos (768px-1024px) */
@media (max-width: 1024px) and (min-width: 769px) {
    .left-panel {
        width: 220px;
    }
    .automations-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 14px;
    }
    .content-body {
        padding: 20px 24px;
    }
    .content-header {
        padding: 18px 24px;
    }
    .greeting-text {
        font-size: 16px;
    }
    .automation-card {
        min-height: 150px;
        padding: 16px;
    }
    .section-title {
        font-size: 15px;
    }
}

/* Tablet / tela muito pequena (fallback mobile) */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.expanded {
        transform: translateX(0);
    }
    .dashboard-wrapper {
        margin-left: 0;
        flex-direction: column;
    }
    .sidebar.expanded ~ .dashboard-wrapper {
        margin-left: 0;
    }
    .left-panel {
        width: 100%;
        min-height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
    .automations-grid {
        grid-template-columns: 1fr;
    }
    .content-header {
        padding: 16px 20px;
    }
    .content-body {
        padding: 20px;
    }
    .greeting-text {
        font-size: 15px;
    }
    .mobile-menu-btn {
        display: flex;
    }
}

/* Mobile menu btn (escondido em desktop) */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 16px; left: 16px;
    z-index: 200;
    width: 40px; height: 40px;
    border: 1px solid var(--border);
    background: var(--white);
    border-radius: var(--btn-r);
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.mobile-menu-btn svg {
    width: 20px; height: 20px;
    stroke: var(--text);
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ═══════════════════════════════════════════
   STATUS BADGE
   ═══════════════════════════════════════════ */
.status-badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 100px;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    flex-shrink: 0;
}

.status-active    { background: #1d9dc3; color: #fff; border-radius: 6px; }
.status-paused    { background: rgba(112,112,112,0.12); color: var(--text); }
.status-error     { background: rgba(224,85,85,0.12);   color: var(--error); }
.status-cancelled { background: rgba(112,112,112,0.12); color: var(--text); }

/* ═══════════════════════════════════════════
   CARD — novos elementos
   ═══════════════════════════════════════════ */
.card-desc {
    font-size: 16px;
    color: #707070;
    margin-top: 0;
    margin-bottom: 16px;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 4px;
}

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

.btn-action {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    background: var(--white);
    border-radius: var(--btn-r);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    color: var(--text);
    flex-shrink: 0;
}

.btn-action:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--white);
    transform: translateY(-1px);
}

.btn-action:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    pointer-events: none;
}

.btn-action svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
    stroke: none;
}

/* ═══════════════════════════════════════════
   GRID — loading / empty states
   ═══════════════════════════════════════════ */
.grid-loading {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 60px 20px;
    color: #b5b0a9;
    font-size: 14px;
}

.loading-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}

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

.grid-empty {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #b5b0a9;
    text-align: center;
    gap: 6px;
}

.grid-empty svg {
    width: 44px;
    height: 44px;
    stroke: var(--border);
    fill: none;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    margin-bottom: 8px;
}

.grid-empty p {
    font-size: 14px;
    color: var(--text);
}

.grid-empty-sub {
    font-size: 13px;
    color: #b5b0a9 !important;
}

/* ═══════════════════════════════════════════
   MODAL LINKEDIN
   ═══════════════════════════════════════════ */
.li-modal-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    background: rgba(0,0,0,0.45);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.li-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.li-modal-container {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--card-r);
    box-shadow: 0 15px 40px rgba(0,0,0,0.06);
    padding: 45px;
    width: 440px;
    max-width: calc(100vw - 40px);
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    position: relative;
    transform: translateY(-16px) scale(0.98);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.li-modal-overlay.active .li-modal-container {
    transform: translateY(0) scale(1);
}

.li-modal-close {
    position: absolute;
    top: 14px; right: 18px;
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text);
    cursor: pointer;
    line-height: 1;
    opacity: 0.5;
    transition: opacity 0.2s;
    padding: 0;
    width: auto;
    margin: 0;
}

.li-modal-close:hover { opacity: 1; }

.li-modal-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--text);
    font-weight: 700;
    margin-bottom: 40px;
}

.li-modal-logo { width: 34px; }

/* ─── Formulário ─── */
.li-form-group {
    margin-bottom: 22px;
    position: relative;
}

.li-form-group label:not(.li-checkbox-container) {
    display: block;
    font-size: 16px;
    font-weight: bold;
    color: var(--text);
    margin-bottom: 10px;
}

.li-modal-container input[type="text"],
.li-modal-container textarea {
    width: 100%;
    padding: 13px;
    background: rgba(255,255,255,0.4);
    border: 1px solid var(--border);
    border-radius: var(--btn-r);
    color: var(--text);
    font-size: 16px;
    font-family: inherit;
    outline: none;
}

.li-modal-container input[type="text"]:focus,
.li-modal-container textarea:focus {
    animation: desenharBorda 2s cubic-bezier(.65,.05,.36,1) forwards;
}

@keyframes desenharBorda {
    0%   { border-color: transparent; }
    25%  { border-top-color: var(--text); }
    50%  { border-top-color: var(--text); border-right-color: var(--text); }
    75%  { border-top-color: var(--text); border-right-color: var(--text); border-bottom-color: var(--text); }
    100% { border-color: var(--text); }
}

.li-modal-container textarea {
    min-height: 150px;
    resize: vertical;
}

/* ─── Linha checkbox + calendário ─── */
.li-actions-row {
    display: flex;
    align-items: center;
    gap: 14px;
}

.li-checkbox-container {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 50px;
    padding: 0 18px;
    background: rgba(255,255,255,0.4);
    border: 1px solid var(--border);
    border-radius: var(--btn-r);
    cursor: pointer;
    font-size: 16px;
    font-weight: normal;
    color: var(--text);
    flex: 1;
    margin-bottom: 0;
    user-select: none;
}

.li-checkbox-container input { display: none; }

.li-checkbox-custom {
    width: 20px;
    height: 20px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: rgba(255,255,255,0.4);
    position: relative;
    flex-shrink: 0;
}

.li-checkbox-container input:checked + .li-checkbox-custom {
    background: var(--primary);
    border-color: var(--primary);
}

.li-checkbox-container input:checked + .li-checkbox-custom::after {
    content: "";
    position: absolute;
    left: 5px; top: 2px;
    width: 6px; height: 12px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* ─── Botão calendário ─── */
.li-calendar-wrapper {
    display: flex;
    align-items: center;
}

.li-calendar-button {
    width: 50px; height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.4);
    border: 1px solid var(--border);
    border-radius: var(--btn-r);
    cursor: pointer;
    color: var(--text);
    transition: 0.15s;
    flex-shrink: 0;
}

.li-calendar-button:hover {
    color: var(--primary);
    border-color: var(--primary);
}

.li-calendar-button svg { width: 20px; height: 20px; }

/* ─── Calendário popup ─── */
#li-calendar {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    right: 0;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--card-r);
    padding: 20px 16px 16px;
    width: 280px;
    box-shadow: 0 12px 32px rgba(0,0,0,0.15);
    z-index: 600;
}

.li-cal-year {
    text-align: right;
    font-size: 12px;
    font-weight: 600;
    color: #b5b0a9;
    margin-bottom: 4px;
}

.li-cal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-weight: 700;
    color: var(--text);
    font-size: 14px;
}

.li-cal-header button {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--primary);
    font-size: 14px;
    padding: 0 6px;
    width: auto;
    margin: 0;
}

.li-cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    text-align: center;
}

.li-cal-weekday {
    font-size: 11px;
    font-weight: 700;
    color: var(--text);
    padding: 3px 0;
    margin-bottom: 4px;
}

.li-cal-day {
    padding: 6px 0;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    color: var(--text);
    transition: background 0.15s;
}

.li-cal-day:hover { background: rgba(29,157,195,0.1); }
.li-cal-day.selected { background: var(--primary); color: #fff; }
.li-cal-day.past { color: #c5c2bc; cursor: default; pointer-events: none; }

.li-cal-time {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 10px 0;
}

.li-cal-time input {
    width: 50px;
    padding: 6px;
    text-align: center;
    font-size: 16px;
    border: 1px solid var(--border);
    border-radius: var(--btn-r);
    background: rgba(255,255,255,0.4);
    color: var(--text);
    outline: none;
}

.li-cal-time input::-webkit-outer-spin-button,
.li-cal-time input::-webkit-inner-spin-button { -webkit-appearance: none; }
.li-cal-time input[type=number] { -moz-appearance: textfield; appearance: textfield; }
.li-cal-time input.input-erro { border-color: var(--error); }
.li-cal-time span { font-weight: 700; color: var(--text); }

.li-cal-actions { display: flex; gap: 8px; margin-top: 4px; }

.li-cal-actions button {
    flex: 1;
    padding: 10px;
    border-radius: var(--btn-r);
    border: 1px solid var(--border);
    font-size: 16px;
    cursor: pointer;
    transition: 0.15s;
    width: auto;
    margin: 0;
}

.li-btn-cancelar { background: transparent; color: var(--text); }
.li-btn-cancelar:hover { background: rgba(0,0,0,0.05); }
.li-btn-agendar { background: var(--primary); color: #fff; border-color: var(--primary) !important; }
.li-btn-agendar:hover { background: var(--primary-dk); }

/* ─── Submit ─── */
#li-submit-btn {
    width: 100%;
    padding: 15px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--btn-r);
    font-size: 16px;
    cursor: pointer;
    margin-top: 22px;
    transition: background 0.2s;
}

#li-submit-btn:hover { background: var(--primary-dk); }
#li-submit-btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* ─── Mensagem de retorno ─── */
#li-mensagem {
    margin-top: 15px;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    gap: 8px;
}

#li-mensagem.sucesso { color: var(--success); }
#li-mensagem.erro { color: var(--error); }

/* ─── Tooltip de erro ─── */
.li-tooltip-erro {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--text);
    color: #fff;
    padding: 6px 12px;
    border-radius: var(--btn-r);
    font-size: 12px;
    white-space: nowrap;
    pointer-events: none;
    z-index: 10;
}

/* ═══════════════════════════════════════════
   MODAL CFG — Formulário de Configuração
   ═══════════════════════════════════════════ */

#cfg-modal-overlay .li-modal-container {
    width: 520px;
    border-radius: 0;
}

/* ─── Seções do formulário ─── */
.cfg-section {
    margin-bottom: 28px;
}

.cfg-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.4px;
    color: var(--primary);
    margin-bottom: 14px;
}

.cfg-section-title svg {
    flex-shrink: 0;
    stroke: var(--primary);
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.cfg-section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* ─── Campo empresa ─── */
.cfg-company-input {
    width: 100%;
    padding: 12px 14px;
    background: rgba(255,255,255,0.55);
    border: 1px solid var(--border);
    border-radius: var(--btn-r);
    color: var(--text);
    font-size: 15px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s, background 0.2s;
}

.cfg-company-input:focus {
    border-color: var(--primary);
    background: rgba(255,255,255,0.8);
}

/* ─── Serviços ─── */
.cfg-service-row {
    display: grid;
    grid-template-columns: 1fr 110px;
    gap: 10px;
    margin-bottom: 8px;
    align-items: end;
}

.cfg-field-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cfg-field-label {
    font-size: 10px;
    font-weight: 700;
    color: #b5b0a9;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.cfg-service-row.optional {
    opacity: 0.65;
    transition: opacity 0.2s;
}

.cfg-service-row.optional:focus-within {
    opacity: 1;
}

/* ─── Adicionar serviço ─── */
.cfg-add-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 4px;
    margin-bottom: 10px;
}
.cfg-add-btn {
    background: none;
    border: 1px solid #d6d3ce;
    border-radius: 0;
    color: #1d9dc3;
    font-size: 13px;
    padding: 6px 12px;
    cursor: pointer;
    transition: border-color 0.2s;
    white-space: nowrap;
}
.cfg-add-btn:hover { border-color: #1d9dc3; }

/* ─── Select ─── */
.li-modal-container select {
    width: 100%;
    padding: 10px 28px 10px 12px;
    background: rgba(255,255,255,0.55)
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='11' viewBox='0 0 24 24' fill='none' stroke='%23707070' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E")
        no-repeat right 10px center;
    border: 1px solid var(--border);
    border-radius: var(--btn-r);
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s, background-color 0.2s;
    appearance: none;
    -webkit-appearance: none;
}

.li-modal-container select:focus {
    border-color: var(--primary);
    background-color: rgba(255,255,255,0.8);
}

/* ─── Horário de atendimento ─── */
.cfg-shift-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
}

.cfg-time-range {
    display: grid;
    grid-template-columns: 1fr 28px 1fr;
    gap: 8px;
    align-items: end;
    margin-bottom: 16px;
}

.cfg-time-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 38px;
    color: var(--border);
    font-size: 18px;
    font-weight: 300;
    padding-bottom: 1px;
}

.li-modal-container input[type="time"] {
    width: 100%;
    padding: 10px 12px;
    background: rgba(255,255,255,0.55);
    border: 1px solid var(--border);
    border-radius: var(--btn-r);
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s, background 0.2s;
    cursor: pointer;
}

.li-modal-container input[type="time"]:focus {
    border-color: var(--primary);
    background: rgba(255,255,255,0.8);
}

/* ─── Submit e feedback ─── */
#cfg-submit-btn {
    width: 100%;
    padding: 15px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 0;
    font-size: 16px;
    font-weight: normal;
    font-family: inherit;
    cursor: pointer;
    margin-top: 8px;
    transition: background 0.2s, opacity 0.2s;
}

#cfg-submit-btn:hover {
    background: var(--primary-dk);
}

#cfg-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

#cfg-mensagem {
    margin-top: 12px;
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    gap: 8px;
    border-radius: var(--btn-r);
    padding: 0 10px;
}

#cfg-mensagem.sucesso {
    color: var(--success);
    background: rgba(39,174,96,0.08);
    padding: 10px;
}

#cfg-mensagem.erro {
    color: var(--error);
    background: rgba(224,85,85,0.08);
    padding: 10px;
}
