/* ==========================================
   Hub Views — Headers e Layout de Telas
   Tokens: var(--hub-*) como fonte da verdade
   ========================================== */

/* --- .hub-view / .hub-view (Containers de Tela) --- */
.hub-view {
    display: none;
    min-height: 100%;
    gap: var(--hub-view-section-gap, var(--hub-space-s));
    content-visibility: auto;
    contain-intrinsic-size: 900px;
}
.hub-view.is-active {
    display: grid;
    animation: hub-fade-in 0.3s ease-out both;
}

/* Layout por View (data-view) */
.hub-view[data-view="unidades"],
.hub-view[data-view="reservas"],
.hub-view[data-view="relatorios"] {
    max-height: 100%;
    grid-template-rows: auto minmax(0, 1fr);
}

.hub-view[data-view="calendario"] {
    grid-template-rows: auto minmax(0, 1fr);
}

.hub-view[data-view="calendario"].is-active {
    height: 100%;
    min-height: 0;
    content-visibility: visible;
}

.hub-view[data-view="calendario"] > .hub-view-heading {
    position: sticky;
    top: 0;
    z-index: var(--hub-z-sticky);
    background: var(--hub-surface);
}

.hub-view-stack {
    display: grid;
    gap: var(--hub-view-section-gap, var(--hub-space-s));
}

/* --- Unificação de Headers Operacionais (5 Cabeçalhos Consolidados) --- */
.hub-view-heading,
.hub-strategy-library__head,
.hub-analysis-heading {
    position: relative;
    z-index: var(--hub-z-sticky, 20);
    min-height: 112px;
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: var(--hub-space-s);
    padding: var(--hub-space-s) var(--hub-view-gutter);
    border: 1px solid var(--hub-border);
    border-radius: var(--hub-radius);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.018), transparent 64%),
        var(--hub-surface);
    box-shadow: none;
}

.hub-view-heading h1,
.hub-strategy-library__head h1,
.hub-analysis-heading h1 {
    margin: 0;
    color: var(--hub-surface-text, var(--hub-text));
    font-size: var(--hub-text-heading);
    line-height: var(--hub-leading-heading);
    font-weight: var(--hub-weight-medium);
    letter-spacing: var(--hub-tracking-tight);
}

.hub-view-heading p,
.hub-strategy-library__head p,
.hub-analysis-heading p {
    max-width: 720px;
    margin: 5px 0 0;
    color: var(--hub-surface-text-muted, var(--hub-text-muted));
    font-size: var(--hub-text-body-compact);
    line-height: 1.35;
}

.hub-view-heading .hub-page-cta {
    flex: 0 0 auto;
    min-width: 156px;
}

.hub-view-heading > div:first-child {
    display: grid;
    align-content: center;
    min-height: 56px;
}

/* Breakpoint Desktop - Adaptação de Altura de Headers */
@media (min-width: 861px) {
    .hub-view-heading,
    .hub-strategy-library__head,
    .hub-analysis-heading {
        height: var(--hub-shell-header-height);
        min-height: var(--hub-shell-header-height);
        max-height: var(--hub-shell-header-height);
        align-items: stretch;
        padding-top: var(--hub-space-xs);
        padding-bottom: var(--hub-space-xs);
        border-color: var(--hub-border);
        border-radius: var(--hub-radius);
        background:
            linear-gradient(180deg, rgba(255, 255, 255, 0.012), transparent 68%),
            var(--hub-surface);
        overflow: visible;
    }
    .hub-view-heading h1,
    .hub-strategy-library__head h1,
    .hub-analysis-heading h1 {
        font-size: var(--hub-text-title);
        line-height: 1.08;
        font-weight: var(--hub-weight-semibold);
    }
    .hub-view-heading p,
    .hub-strategy-library__head p,
    .hub-analysis-heading p {
        font-size: var(--hub-text-body);
        line-height: 1.35;
    }
}

@media (max-width: 860px) {
    .hub-view-heading,
    .hub-strategy-library__head,
    .hub-analysis-heading {
        height: auto;
        min-height: auto;
        max-height: none;
        align-items: stretch;
        overflow: visible;
    }
}

@media (max-width: 760px) {
    .hub-view-heading,
    .hub-strategy-library__head,
    .hub-analysis-heading {
        min-height: auto;
        display: grid;
        align-items: stretch;
        gap: var(--hub-space-s);
    }
}

/* --- .hub-home-hero específico --- */
.hub-home-hero__eyebrow {
    display: block;
    margin-bottom: var(--hub-space-2);
    color: var(--hub-primary-hover);
    font-size: var(--hub-text-overline);
    font-weight: var(--hub-weight-bold);
    letter-spacing: var(--hub-tracking-widest);
    text-transform: var(--hub-case-eyebrow);
}

/* --- Zonas do Header (identity / center / right) --- */
.hub-view-heading__identity {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 48px;
}
.hub-view-heading__center {
    flex: 1 1 0;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: var(--hub-space-xs);
    min-width: 0;
}
.hub-view-heading__right {
    flex: 0 0 auto;
    display: flex;
    align-items: flex-end;
    gap: var(--hub-space-xs);
}
.hub-view-heading__center .hub-field,
.hub-view-heading__right .hub-field { min-width: 132px; }
.hub-view-heading__center .hub-field--search { min-width: min(28vw, 280px); }
.hub-view-heading__center .hub-field input,
.hub-view-heading__center .hub-field select,
.hub-view-heading__right .hub-field input,
.hub-view-heading__right .hub-field select { min-height: var(--hub-control-height); }
.hub-view-heading__right [data-audit-count],
.hub-view-heading__center [data-audit-count] {
    color: var(--hub-text-muted);
    font-size: var(--hub-text-label);
    font-weight: var(--hub-weight-semibold);
    white-space: nowrap;
}

/* --- .hub-view-heading__actions / .hub-home-hero__actions --- */
.hub-view-heading__actions,
.hub-home-hero__actions,
.hub-home-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--hub-space-xs);
}

.hub-view-heading__actions,
.hub-home-hero__actions {
    justify-content: flex-end;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--hub-space-s);
}

/* Header filter: min-width em contexto de barra de acoes */
.hub-view-heading__actions .hub-field {
    min-width: 132px;
}
.hub-view-heading__actions .hub-field--search {
    min-width: min(28vw, 280px);
}

.hub-top-view-toggle {
    min-width: 154px;
}

.hub-view-heading__actions [data-audit-count] {
    color: var(--hub-text-muted);
    font-size: var(--hub-text-label);
    font-weight: var(--hub-weight-semibold);
    white-space: nowrap;
}

.hub-home-metrics {
    grid-template-columns: repeat(6, minmax(0, 1fr));
}

/* =====================================================
   CALENDÁRIO — COMPARTILHADO
   ===================================================== */


/* =====================================================
   CALENDÁRIO — TIMELINE (multi-unidade)
   ===================================================== */

/* Painel container — mesma pattern do Por Unidade */
.hub-calendar-timeline-wrap {
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--hub-border);
    border-radius: var(--hub-radius);
    background: var(--hub-bg);
    position: relative;
}

.hub-calendar-timeline-wrap::before,
.hub-calendar-timeline-wrap::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 80px;
    pointer-events: none;
    z-index: 5;
}

.hub-calendar-timeline-wrap::before {
    left: var(--tl-unit-width, 300px);
    background: linear-gradient(to right, var(--hub-bg), transparent);
}

.hub-calendar-timeline-wrap::after {
    right: 0;
    background: linear-gradient(to left, var(--hub-bg), transparent);
}

/* Scroll container — horizontal + vertical dentro do painel */
.hub-timeline-scroll {
    flex: 1;
    min-height: 0;
    overflow: auto;
}

/* Grid principal — 2 linhas de header fixas + linhas de unidade automáticas */
.hub-timeline-grid {
    display: grid;
    position: relative;
    grid-template-columns: var(--tl-unit-width, 200px) repeat(90, var(--tl-day-width, 57px));
    grid-auto-columns: var(--tl-day-width, 57px);
    grid-template-rows: var(--tl-month-row-height, 22px) var(--tl-head-row-height, 40px);
    grid-auto-rows: var(--tl-row-height, 44px);
    min-width: max-content;
}

/* Garante fundo opaco nos elementos sticky da timeline sem !important */
.hub-calendar-timeline-wrap .hub-timeline-corner,
.hub-calendar-timeline-wrap .hub-timeline-month-label,
.hub-calendar-timeline-wrap .hub-timeline-day-head,
.hub-calendar-timeline-wrap .hub-timeline-unit-name {
    background: var(--hub-surface-soft);
}

/* Canto superior esquerdo — sticky em ambos os eixos, span 2 linhas (via JS) */
.hub-timeline-corner {
    position: sticky;
    top: 0;
    left: 0;
    z-index: 5;
    background: var(--hub-surface-soft);
    border-right: 1px solid var(--hub-border);
    border-bottom: 1px solid var(--hub-border);
}

/* Linha 1: label de mês — sticky no topo */
.hub-timeline-month-label {
    position: sticky;
    top: 0;
    z-index: 4;
    background: var(--hub-surface-soft);
    border-bottom: 1px solid var(--hub-border);
    border-left: 1px solid var(--hub-border);
    display: flex;
    align-items: center;
    padding: 0 var(--hub-space-2);
    font-size: var(--hub-text-micro);
    font-weight: var(--hub-weight-bold);
    color: var(--hub-text-muted);
    text-transform: var(--hub-case-eyebrow);
    letter-spacing: var(--hub-tracking-wide);
    white-space: nowrap;
    user-select: none;
}

/* Linha 2: header de dia — sticky abaixo da linha de mês */
.hub-timeline-day-head {
    position: sticky;
    top: var(--tl-month-row-height, 22px);
    z-index: 3;
    background: var(--hub-surface-soft);
    border-bottom: 1px solid var(--hub-border);
    border-right: 1px solid var(--hub-border);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    padding: 5px 0;
    user-select: none;
}

.hub-timeline-day-num {
    font-size: var(--hub-text-label);
    font-weight: var(--hub-weight-semibold);
    color: var(--hub-text);
    line-height: 1;
}

.hub-timeline-day-label {
    font-size: var(--hub-text-micro);
    font-weight: var(--hub-weight-semibold);
    color: var(--hub-text-muted);
    text-transform: var(--hub-case-eyebrow);
    letter-spacing: var(--hub-tracking-snug);
    line-height: 1;
}

.hub-timeline-day-head--today .hub-timeline-day-num,
.hub-timeline-day-head--today .hub-timeline-day-label {
    color: var(--hub-primary);
}

.hub-timeline-day-head--month-start {
    border-left: 1px solid var(--hub-border);
}

/* Nome da unidade — sticky à esquerda */
.hub-timeline-unit-name {
    position: sticky;
    left: 0;
    z-index: 4;
    background: var(--hub-surface-soft);
    border-right: 1px solid var(--hub-border);
    border-bottom: 1px solid var(--hub-border);
    display: flex;
    align-items: center;
    padding: 0 var(--hub-space-xs);
    font-size: var(--hub-text-body-compact);
    font-weight: var(--hub-weight-semibold);
    color: var(--hub-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: default;
}

.hub-timeline-unit-name--link {
    cursor: pointer;
    transition: background var(--hub-transition-fast), color var(--hub-transition-fast);
}

.hub-timeline-unit-name--link:hover {
    background: var(--hub-surface-soft);
    color: var(--hub-primary);
}

/* Célula de dia */
.hub-timeline-cell {
    background: var(--hub-surface-soft);
    border-right: 1px solid var(--hub-border);
    border-bottom: 1px solid var(--hub-border);
    position: relative;
    min-width: 0;
}

.hub-timeline-cell--month-start {
    border-left: 1px solid var(--hub-border);
}

.hub-timeline-cell--today {
    background: rgba(var(--hub-primary-rgb), 0.06);
}

.hub-timeline-cell--blocked {
    background: rgba(var(--hub-text-rgb), 0.06);
    cursor: pointer;
}
.hub-timeline-cell--blocked-internal {
    background: rgba(var(--hub-danger-rgb), 0.14);
}

.hub-timeline-cell--unavailable {
    background: var(--hub-surface-soft);
    opacity: 0.5;
}

.hub-timeline-cell--past {
    opacity: 0.38;
}

/* ─── Pill bars de reserva ─────────────────────────── */

.hub-timeline-pill {
    align-self: start;
    height: 24px;
    display: flex;
    align-items: center;
    padding: 0 var(--hub-space-3);
    border-radius: 999px;
    font-size: var(--hub-text-overline);
    font-weight: var(--hub-weight-semibold);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    z-index: 2; /* Elevado acima do trilho duplo */
    /* Checkin 14:00 → left offset = 14/24 * day-width; Checkout 11:00 → right offset = 13/24 * day-width */
    margin-top: var(--hub-space-1);
    margin-left: calc(var(--tl-day-width, 57px) * 14 / 24);
    margin-right: calc(var(--tl-day-width, 57px) * 13 / 24);
    transition: filter var(--hub-transition-fast);
    min-width: 0;
}

.hub-timeline-pill:hover {
    filter: brightness(1.18);
}

.hub-timeline-pill--reserved {
    background: rgba(var(--hub-primary-rgb), 0.26);
    color: var(--hub-primary);
    border: 1px solid rgba(var(--hub-primary-rgb), 0.34);
}

.hub-timeline-pill--blocked {
    background: rgba(var(--hub-danger-rgb), 0.22);
    color: var(--hub-danger);
    border: 1px solid rgba(var(--hub-danger-rgb), 0.30);
}

/* Estado vazio / loading */
.hub-calendar-timeline-empty {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--hub-text-muted);
    font-size: var(--hub-text-label);
    pointer-events: none;
}

/* =====================================================
   CALENDÁRIO ESTRATÉGICO — POR UNIDADE
   ===================================================== */

/* Painel de calendário — scroll interno, header de mês sticky dentro do painel */
.hub-calendar-scroll {
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    border: 1px solid var(--hub-border);
    border-radius: var(--hub-radius);
    background: var(--hub-bg);
    padding: 0 var(--hub-space-xs) var(--hub-space-s);
    -webkit-mask-image: linear-gradient(to bottom, black 0%, black calc(100% - 60px), transparent 100%);
    mask-image: linear-gradient(to bottom, black 0%, black calc(100% - 60px), transparent 100%);
}

.hub-calendar-loading {
    padding: var(--hub-space-xl);
    text-align: center;
    color: var(--hub-text-muted);
}

.hub-calendar-sentinel {
    height: 1px;
}

/* --- Mês --- */
.hub-calendar-month {
    margin-bottom: var(--hub-space-m);
}

.hub-calendar-month-header {
    position: sticky;
    top: 0;
    z-index: var(--hub-z-raised);
    background: var(--hub-bg);
    display: flex;
    align-items: center;
    gap: var(--hub-space-s);
    padding: var(--hub-space-2) 2px;
}

.hub-calendar-month-title {
    font-size: var(--hub-text-heading);
    font-weight: var(--hub-weight-semibold);
    color: var(--hub-text);
    margin: 0;
    line-height: 1.1;
    min-width: 160px;
}

.hub-calendar-month-kpis {
    display: flex;
    gap: var(--hub-space-xs);
    flex-wrap: wrap;
}

.hub-calendar-kpi-chip {
    font-size: var(--hub-text-overline);
    font-weight: var(--hub-weight-semibold);
    color: var(--hub-text-muted);
    background: var(--hub-white-alpha-3);
    border: 1px solid var(--hub-border);
    border-radius: var(--hub-radius-sm);
    padding: 2px var(--hub-space-2);
    white-space: nowrap;
}

.hub-calendar-kpi-chip--reserved { color: var(--hub-primary); }
.hub-calendar-kpi-chip--blocked  { color: var(--hub-danger);  }
.hub-calendar-kpi-chip--free     { color: var(--hub-success); }

.hub-calendar-month-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 3px;
    margin-top: var(--hub-space-xs);
}

/* --- KPI Strip --- */
.hub-calendar-kpis {
    display: flex;
    align-items: stretch;
    background: var(--hub-surface-soft);
    border: 1px solid var(--hub-border);
    border-radius: var(--hub-radius);
    overflow: hidden;
}

/* --- Grade Mensal --- */
.hub-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    grid-auto-rows: minmax(0, 1fr);
    gap: 3px;
    align-content: stretch;
}

.hub-calendar-day-header {
    padding: var(--hub-space-2) var(--hub-space-1);
    font-size: var(--hub-text-overline);
    font-weight: var(--hub-weight-semibold);
    text-transform: var(--hub-case-eyebrow);
    letter-spacing: var(--hub-tracking-snug);
    color: var(--hub-text-muted);
    text-align: center;
}

.hub-calendar-day {
    position: relative;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 5px var(--hub-space-2);
    border-radius: var(--hub-radius);
    background: var(--hub-surface-soft);
    transition: background var(--hub-transition-fast);
    min-height: 88px;
    overflow: visible;
}

.hub-calendar-day--empty {
    background: transparent;
    pointer-events: none;
}

.hub-calendar-day--available {
    background: var(--hub-surface-soft);
}

.hub-calendar-day--reserved {
    background: rgba(var(--hub-primary-rgb), 0.22);
}

.hub-calendar-day--blocked {
    background: rgba(var(--hub-text-rgb), 0.08);
}
.hub-calendar-day--blocked-internal {
    background: rgba(var(--hub-danger-rgb), 0.18);
}

.hub-calendar-day--unavailable {
    background: var(--hub-surface-soft);
    opacity: 0.45;
}

.hub-calendar-day--today {
    box-shadow: inset 0 0 0 2px var(--hub-primary);
}

.hub-calendar-day-num {
    position: relative;
    z-index: 2;
    font-size: var(--hub-text-label);
    font-weight: var(--hub-weight-semibold);
    line-height: 1;
    color: var(--hub-text-muted);
}

.hub-calendar-day--reserved .hub-calendar-day-num {
    color: var(--hub-primary);
}

.hub-calendar-day--blocked .hub-calendar-day-num {
    color: var(--hub-text-muted);
}
.hub-calendar-day--blocked-internal .hub-calendar-day-num {
    color: var(--hub-danger);
}

.hub-calendar-day--today .hub-calendar-day-num {
    color: var(--hub-text);
}

/* Limpeza badge — Nível 1 */
.hub-cal-limpeza-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--hub-text-muted);
    z-index: 3;
}
.hub-cal-limpeza-badge[data-limpeza-status="confirmada"] {
    background: var(--hub-success, #22c55e);
}
.hub-cal-limpeza-badge[data-limpeza-status="pendente"] {
    background: var(--hub-warning, #f59e0b);
}

/* --- Barra de reserva estilo Airbnb --- */
.hub-calendar-bar {
    position: absolute;
    bottom: 6px;
    height: 24px;
    background: color-mix(in srgb, var(--hub-bg) 82%, transparent);
    z-index: 1;
    pointer-events: none;
    display: flex;
    align-items: center;
    overflow: hidden;
}

.hub-calendar-day-guest {
    display: block;
    font-size: var(--hub-text-overline);
    font-weight: var(--hub-weight-semibold);
    line-height: 1;
    padding: 0 5px;
    color: var(--hub-text-on-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 1;
    min-width: 0;
}

/* Dias passados */
.hub-calendar-day--past {
    opacity: 0.38;
}
.hub-calendar-day--past.hub-calendar-day--today {
    opacity: 1;
}

/* --- Hover nas células --- */
.hub-calendar-day:not(.hub-calendar-day--empty):hover {
    background: var(--hub-white-alpha-8);
    cursor: pointer;
}

.hub-calendar-day--reserved:hover {
    background: rgba(var(--hub-primary-rgb), 0.32);
}

.hub-calendar-day--blocked:hover {
    background: rgba(var(--hub-text-rgb), 0.14);
}
.hub-calendar-day--blocked-internal:hover {
    background: rgba(var(--hub-danger-rgb), 0.28);
}

.hub-calendar-day--unavailable:hover {
    background: var(--hub-surface-soft);
    opacity: 0.6;
}

/* =====================================================
   MODAIS DO CALENDÁRIO (iCal anomalia + bloqueio)
   ===================================================== */

/* Eyebrow genérico para modais de inspeção */
.hub-modal__eyebrow {
    display: block;
    font-size: var(--hub-text-overline);
    font-weight: var(--hub-weight-semibold);
    color: var(--hub-primary);
    letter-spacing: var(--hub-tracking-widest);
    text-transform: var(--hub-case-eyebrow);
    margin-bottom: var(--hub-space-1);
}

.hub-modal__title {
    margin: 0;
    font-size: var(--hub-text-heading);
    font-weight: var(--hub-weight-semibold);
    color: var(--hub-text);
    line-height: 1.2;
}

/* Body de inspeção (definition list) */
.hub-modal__body--info {
    padding: var(--hub-space-m);
}

.hub-info-dl {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: var(--hub-space-2) var(--hub-space-4);
    margin: 0;
    align-items: baseline;
}

.hub-info-dl dt {
    font-size: var(--hub-text-label);
    font-weight: var(--hub-weight-semibold);
    color: var(--hub-text-muted);
    white-space: nowrap;
}

.hub-info-dl dd {
    margin: 0;
    font-size: var(--hub-text-body);
    color: var(--hub-text);
    word-break: break-all;
}

/* Badge inline de status */
.hub-badge {
    display: inline-block;
    padding: 2px var(--hub-space-2);
    border-radius: var(--hub-radius-sm);
    font-size: var(--hub-text-overline);
    font-weight: var(--hub-weight-semibold);
}

.hub-badge--warning {
    background: rgba(var(--hub-warning-rgb), 0.15);
    color: var(--hub-warning);
    border: 1px solid rgba(var(--hub-warning-rgb), 0.3);
}

/* Monospace para UIDs */
.hub-mono {
    font-family: var(--hub-font-mono);
    font-size: var(--hub-text-label);
    color: var(--hub-text-muted);
    word-break: break-all;
}

/* =====================================================
   AJUSTES DE CONTRASTE E CORES PARA TEMA CLARO (CALENDÁRIO)
   ===================================================== */

/* 1. Timeline: Aumento de contraste nas pílulas de reservas e bloqueios */
html[data-hub-theme="light"] .hub-app .hub-timeline-pill--reserved,
.hub-app[data-theme="light"] .hub-timeline-pill--reserved {
    background: rgba(var(--hub-primary-rgb), 0.15);
    color: var(--hub-cal-text-reserved);
    border: 1px solid rgba(var(--hub-primary-rgb), 0.38);
}

html[data-hub-theme="light"] .hub-app .hub-timeline-pill--blocked,
.hub-app[data-theme="light"] .hub-timeline-pill--blocked {
    background: rgba(var(--hub-danger-rgb), 0.12);
    color: var(--hub-cal-text-blocked);
    border: 1px solid rgba(var(--hub-danger-rgb), 0.32);
}

/* 2. Grade Mensal: Cores mais nítidas para os dias ocupados e bloqueados */
html[data-hub-theme="light"] .hub-app .hub-calendar-day--reserved,
.hub-app[data-theme="light"] .hub-calendar-day--reserved {
    background: rgba(var(--hub-primary-rgb), 0.14);
}
html[data-hub-theme="light"] .hub-app .hub-calendar-day--reserved .hub-calendar-day-num,
.hub-app[data-theme="light"] .hub-calendar-day--reserved .hub-calendar-day-num {
    color: var(--hub-cal-text-reserved);
}

html[data-hub-theme="light"] .hub-app .hub-calendar-day--blocked,
.hub-app[data-theme="light"] .hub-calendar-day--blocked {
    background: rgba(0, 0, 0, 0.05);
}
html[data-hub-theme="light"] .hub-app .hub-calendar-day--blocked .hub-calendar-day-num,
.hub-app[data-theme="light"] .hub-calendar-day--blocked .hub-calendar-day-num {
    color: var(--hub-text-muted);
}
html[data-hub-theme="light"] .hub-app .hub-calendar-day--blocked-internal,
.hub-app[data-theme="light"] .hub-calendar-day--blocked-internal {
    background: rgba(var(--hub-danger-rgb), 0.11);
}
html[data-hub-theme="light"] .hub-app .hub-calendar-day--blocked-internal .hub-calendar-day-num,
.hub-app[data-theme="light"] .hub-calendar-day--blocked-internal .hub-calendar-day-num {
    color: var(--hub-cal-text-blocked);
}

/* 3. Legibilidade dos Dias Passados na Grade Mensal */
html[data-hub-theme="light"] .hub-app .hub-calendar-day--past,
.hub-app[data-theme="light"] .hub-calendar-day--past {
    background: var(--hub-surface-soft);
    opacity: 0.55;
}

/* 4. Cores de chips de status e métricas de síntese */
html[data-hub-theme="light"] .hub-app .hub-calendar-kpi-chip--reserved,
.hub-app[data-theme="light"] .hub-calendar-kpi-chip--reserved {
    color: var(--hub-cal-text-reserved);
}
html[data-hub-theme="light"] .hub-app .hub-calendar-kpi-chip--blocked,
.hub-app[data-theme="light"] .hub-calendar-kpi-chip--blocked {
    color: var(--hub-cal-text-blocked);
}

/* =============================================================
   VIEW INTEGRAÇÕES — hub-integracoes-*
   ============================================================= */

.hub-view[data-view="integracoes"] {
    grid-template-rows: auto auto minmax(0, 1fr);
}

/* Tab nav */
.hub-integracoes-tabs {
    display: flex;
    align-items: center;
    border-bottom: none;
    padding: var(--hub-space-3) var(--hub-view-gutter, var(--hub-space-5)) 0;
    background: transparent;
    overflow-x: auto;
}

.hub-seg__tab--locked {
    opacity: 0.45;
    pointer-events: none;
    cursor: default;
}

/* Body layout */
.hub-integracoes-body {
    display: grid;
    gap: var(--hub-view-section-gap, var(--hub-space-4));
    align-content: start;
    padding: var(--hub-view-section-gap, var(--hub-space-4)) var(--hub-view-gutter, var(--hub-space-5));
    overflow-y: auto;
}

.hub-integracoes-subnav {
    display: flex;
    align-items: center;
    margin-bottom: var(--hub-space-2);
}

.hub-integracoes-section-layout:not([hidden]) {
    display: grid;
    gap: var(--hub-view-section-gap, var(--hub-space-4));
}

/* KPI cards — usa .hub-metric de hub-cards.css */
.hub-integracoes-kpis {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--hub-space-3);
}

/* Section inside hub-table-panel */
.hub-integracoes-section__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--hub-section-head-padding);
    border-bottom: 1px solid var(--hub-border);
}

.hub-integracoes-section__head h3 {
    margin: 0;
    font-size: var(--hub-text-overline);
    font-weight: var(--hub-weight-semibold);
    color: var(--hub-text);
}

.hub-integracoes-note {
    font-size: var(--hub-text-overline);
}

/* Filters inside events section */
.hub-integracoes-events-filters {
    padding: var(--hub-section-head-padding);
    border-bottom: 1px solid var(--hub-border);
    background: var(--hub-surface-soft);
}

.hub-integracoes-events-filters .hub-integracoes-filters-grid {
    grid-template-columns: minmax(200px, 1fr) minmax(200px, 1fr);
    max-width: 480px;
}

/* Table helpers */
.hub-integracoes-cell-sub {
    font-size: var(--hub-text-overline);
    color: var(--hub-text-muted);
    display: block;
}

/* Table actions unificadas via .hub-table-action */

/* Empty state */
.hub-integracoes-empty {
    padding: var(--hub-empty-state-padding);
}

.hub-integracoes-empty__title {
    margin: 0 0 2px;
    font-size: var(--hub-text-body-compact);
    font-weight: var(--hub-weight-medium);
    color: var(--hub-text);
}

.hub-integracoes-empty__sub {
    margin: 0;
    font-size: var(--hub-text-overline);
    color: var(--hub-text-muted);
}

/* Feedback */
.hub-integracoes-feedback:not(:empty) {
    padding: 0 var(--hub-cell-padding-x);
}

.hub-integracoes-feedback--drawer:not(:empty) {
    margin-top: var(--hub-space-2);
}

/* Actions row inside blocks table */
.hub-integracoes-actions {
    display: flex;
    gap: var(--hub-space-3);
}

/* Custom layouts for integration panels (Gemini, Google Calendar, E-mail Inbound) */
.hub-integracoes-card-form {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--hub-space-m);
}

.hub-integracoes-card-form .hub-integracoes-section__head {
    border-bottom: 0;
    padding: 0;
}

.hub-integracoes-card-form .hub-integracoes-section__head h3 {
    font-size: var(--hub-text-heading);
    font-weight: var(--hub-weight-medium);
    margin: 0;
    text-transform: none;
    letter-spacing: normal;
}

.hub-integracoes-card-form p.hub-text-muted {
    margin: 0;
    max-width: 64ch;
    font-size: var(--hub-text-body-compact);
    line-height: var(--hub-leading-normal);
}

.hub-integracoes-fields-group {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--hub-space-s);
    max-width: 560px;
}

.hub-integracoes-card-form .hub-field-row {
    display: flex;
    gap: var(--hub-space-xs);
}

.hub-integracoes-card-form .hub-field-row .hub-input,
.hub-integracoes-card-form .hub-field-row input {
    flex: 1;
    min-width: 0;
}

.hub-integracoes-card-form .hub-field-row .hub-button {
    flex-shrink: 0;
}

/* Callout de instrução — nota inline, não card flutuante */
.hub-integracoes-instruction {
    border-left: 3px solid var(--hub-border);
    padding: var(--hub-space-2) var(--hub-space-s);
    max-width: 560px;
}

.hub-integracoes-instruction p {
    margin: 0;
    font-size: var(--hub-text-micro);
    line-height: var(--hub-leading-relaxed, 1.6);
}

.hub-integracoes-instruction code {
    display: block;
    margin-top: var(--hub-space-1);
    background: var(--hub-input-bg);
    padding: var(--hub-space-2) var(--hub-space-s);
    border-radius: var(--hub-radius-sm);
    border: 1px solid var(--hub-border);
    color: var(--hub-text-muted);
    white-space: pre-wrap;
    word-break: break-all;
    overflow-wrap: break-word;
    font-size: var(--hub-text-micro);
    font-family: var(--hub-font-mono, monospace);
}

.hub-integracoes-credentials-actions {
    margin: 0;
    display: flex;
    gap: var(--hub-space-s);
    align-items: center;
}

.hub-integracoes-credentials-status {
    border-top: 1px solid var(--hub-border);
    padding-top: var(--hub-space-m);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--hub-space-m);
}

.hub-credentials-status__connected {
    color: var(--hub-success);
    font-size: var(--hub-text-body-compact);
    font-weight: var(--hub-weight-medium);
}

.hub-integracoes-credentials-status .hub-text-muted,
.hub-email-queue-list .hub-text-muted {
    font-size: var(--hub-text-body-compact);
    margin: 0;
}

.hub-email-queue-list {
    padding: var(--hub-panel-padding);
}

/* Responsive */
@media (max-width: 1100px) {
    .hub-integracoes-kpis {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 860px) {
    .hub-integracoes-events-filters .hub-integracoes-filters-grid {
        grid-template-columns: minmax(0, 1fr);
        max-width: 100%;
    }
}

/* =============================================================
   TEMA CLARO — Calendário (continuação)
   ============================================================= */
html[data-hub-theme="light"] .hub-app .hub-calendar-kpi-chip--free,
.hub-app[data-theme="light"] .hub-calendar-kpi-chip--free {
    color: var(--hub-cal-text-free);
}

html[data-hub-theme="light"] .hub-app .hub-calendar-kpi-value--reserved,
.hub-app[data-theme="light"] .hub-calendar-kpi-value--reserved {
    color: var(--hub-cal-text-reserved);
}
html[data-hub-theme="light"] .hub-app .hub-calendar-kpi-value--blocked,
.hub-app[data-theme="light"] .hub-calendar-kpi-value--blocked {
    color: var(--hub-cal-text-blocked);
}
html[data-hub-theme="light"] .hub-app .hub-calendar-kpi-value--free,
.hub-app[data-theme="light"] .hub-calendar-kpi-value--free {
    color: var(--hub-cal-text-free);
}

/* ==========================================
   Sinalizadores Visuais e Trilho Duplo das Estratégias
   ========================================== */

/* Bolinha de cor para legenda / listagem */
.hub-strategy-color-dot {
    display: inline-block;
    margin-right: var(--hub-space-2);
    font-size: var(--hub-text-body);
    line-height: 1;
    vertical-align: middle;
}

/* Chip eloqüente compacto de 2 iniciais */
.hub-strategy-compact-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 20px;
    padding: 0 var(--hub-space-2);
    border-radius: var(--hub-radius-sm);
    font-size: var(--hub-text-overline);
    font-weight: var(--hub-weight-bold);
    line-height: 1;
    text-transform: var(--hub-case-eyebrow);
    cursor: default;
    border: 1px solid transparent;
}
.hub-strategy-compact-chip.is-amber {
    background: rgba(var(--hub-strategy-color-amber-rgb), 0.15);
    color: var(--hub-strategy-color-amber);
    border-color: rgba(var(--hub-strategy-color-amber-rgb), 0.3);
}
.hub-strategy-compact-chip.is-emerald {
    background: rgba(var(--hub-strategy-color-emerald-rgb), 0.15);
    color: var(--hub-strategy-color-emerald);
    border-color: rgba(var(--hub-strategy-color-emerald-rgb), 0.3);
}
.hub-strategy-compact-chip.is-sapphire {
    background: rgba(var(--hub-strategy-color-sapphire-rgb), 0.15);
    color: var(--hub-strategy-color-sapphire);
    border-color: rgba(var(--hub-strategy-color-sapphire-rgb), 0.3);
}
.hub-strategy-compact-chip.is-amethyst {
    background: rgba(var(--hub-strategy-color-amethyst-rgb), 0.15);
    color: var(--hub-strategy-color-amethyst);
    border-color: rgba(var(--hub-strategy-color-amethyst-rgb), 0.3);
}
.hub-strategy-compact-chip.is-ruby {
    background: rgba(var(--hub-strategy-color-ruby-rgb), 0.15);
    color: var(--hub-strategy-color-ruby);
    border-color: rgba(var(--hub-strategy-color-ruby-rgb), 0.3);
}
.hub-strategy-compact-chip.is-turquoise {
    background: rgba(var(--hub-strategy-color-turquoise-rgb), 0.15);
    color: var(--hub-strategy-color-turquoise);
    border-color: rgba(var(--hub-strategy-color-turquoise-rgb), 0.3);
}

/* Trilho duplo de estratégia no Calendário Timeline */
.hub-timeline-strategy-track {
    align-self: end;
    height: 3px;
    z-index: 1;
    border-radius: 2px;
    margin: 0 var(--hub-space-1) var(--hub-space-1) var(--hub-space-1);
    opacity: 0.20;
    cursor: default;
}
.hub-timeline-strategy-track.hub-strategy-bg-amber { background-color: var(--hub-strategy-color-amber); }
.hub-timeline-strategy-track.hub-strategy-bg-emerald { background-color: var(--hub-strategy-color-emerald); }
.hub-timeline-strategy-track.hub-strategy-bg-sapphire { background-color: var(--hub-strategy-color-sapphire); }
.hub-timeline-strategy-track.hub-strategy-bg-amethyst { background-color: var(--hub-strategy-color-amethyst); }
.hub-timeline-strategy-track.hub-strategy-bg-ruby { background-color: var(--hub-strategy-color-ruby); }
.hub-timeline-strategy-track.hub-strategy-bg-turquoise { background-color: var(--hub-strategy-color-turquoise); }

/* Bloco da Estratégia no Card de Unidade */
.hub-unit-card__active-strategy {
    display: flex;
    align-items: center;
    font-size: var(--hub-text-overline);
    color: var(--hub-text-muted);
    margin-bottom: var(--hub-space-xs);
    gap: var(--hub-space-1);
}
.hub-unit-card__active-strategy .hub-strategy-name {
    font-weight: var(--hub-weight-medium);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Bloco da Estratégia na Tabela de Unidades */
.hub-unit-table__active-strategy {
    display: inline-flex;
    align-items: center;
    gap: var(--hub-space-2);
    font-weight: var(--hub-weight-medium);
}


