/* CaixaLeve - modo claro. Tokens preparados para modo escuro futuro (ver [data-theme="dark"]). */
:root {
  --cl-bg: #F7F8FA;
  --cl-surface: #FFFFFF;
  --cl-primary: #4F46E5;
  --cl-primary-hover: #4338CA;
  --cl-primary-soft: #EEF0FF;
  --cl-text: #111827;
  --cl-muted: #6B7280;
  --cl-border: #E5E7EB;
  --cl-success: #16A34A;
  --cl-danger: #DC2626;
  --cl-warning: #D97706;
  --cl-radius: 14px;
  --cl-shadow: 0 1px 2px rgba(17, 24, 39, .04), 0 2px 8px rgba(17, 24, 39, .04);
  --cl-sidebar-w: 236px;
  --cl-sidebar-w-collapsed: 68px;
  --bs-body-font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --bs-body-bg: var(--cl-bg);
  --bs-body-color: var(--cl-text);
  --bs-primary: var(--cl-primary);
  --bs-primary-rgb: 79, 70, 229;
  --bs-link-color: var(--cl-primary);
  --bs-link-hover-color: var(--cl-primary-hover);
  --bs-border-color: var(--cl-border);
  --bs-secondary-color: var(--cl-muted);
}

html { -webkit-text-size-adjust: 100%; }
body { background: var(--cl-bg); color: var(--cl-text); font-family: var(--bs-body-font-family); font-size: .95rem; }
.text-muted { color: var(--cl-muted) !important; }
a { text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--cl-primary); outline-offset: 2px; }

/* Botoes */
.btn { border-radius: 10px; font-weight: 500; min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; }
.btn-sm { min-height: 34px; }
.btn-primary { --bs-btn-bg: var(--cl-primary); --bs-btn-border-color: var(--cl-primary); --bs-btn-hover-bg: var(--cl-primary-hover); --bs-btn-hover-border-color: var(--cl-primary-hover); --bs-btn-active-bg: var(--cl-primary-hover); --bs-btn-disabled-bg: var(--cl-primary); }
.btn-outline-secondary { --bs-btn-color: #374151; --bs-btn-border-color: var(--cl-border); --bs-btn-hover-bg: #F3F4F6; --bs-btn-hover-color: var(--cl-text); --bs-btn-hover-border-color: var(--cl-border); --bs-btn-active-bg: #E5E7EB; --bs-btn-active-color: var(--cl-text); }
.btn-light { --bs-btn-bg: #F3F4F6; --bs-btn-border-color: #F3F4F6; --bs-btn-hover-bg: #E5E7EB; --bs-btn-hover-border-color: #E5E7EB; }
.btn-icon { width: 40px; padding: 0; background: transparent; border: 0; color: #4B5563; }
.btn-icon.btn-sm { width: 34px; }
.btn-icon:hover { background: #F3F4F6; color: var(--cl-text); }
.btn.is-loading { pointer-events: none; opacity: .8; }
.btn.is-loading::before { content: ""; width: 1em; height: 1em; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: cl-spin .7s linear infinite; }
@keyframes cl-spin { to { transform: rotate(360deg); } }

/* Formularios */
.form-control, .form-select, .input-group-text { border-radius: 10px; border-color: var(--cl-border); min-height: 40px; }
.form-control-sm, .form-select-sm { min-height: 34px; }
.form-control:focus, .form-select:focus { border-color: var(--cl-primary); box-shadow: 0 0 0 .2rem rgba(79, 70, 229, .15); }
.form-label { font-weight: 500; margin-bottom: .3rem; }
.input-group > .form-control, .input-group > .form-select { border-radius: 0 10px 10px 0; }
.input-group > :first-child { border-radius: 10px 0 0 10px !important; }
.input-group > .btn:last-child { border-radius: 0 10px 10px 0; }

/* Cards */
.cl-card { background: var(--cl-surface); border: 1px solid var(--cl-border); border-radius: var(--cl-radius); box-shadow: var(--cl-shadow); padding: 1.1rem 1.2rem; }
.cl-card.p-0 { padding: 0; overflow: hidden; }
.cl-card-title { font-size: .95rem; font-weight: 600; margin-bottom: .8rem; }
.cl-card-link { display: block; color: inherit; height: 100%; }
.cl-card-link:hover { text-decoration: none; }
.cl-card-link:hover .cl-card { border-color: #C7C9F5; }

/* Shell */
.cl-shell { display: flex; min-height: 100vh; }
.cl-sidebar { width: var(--cl-sidebar-w); background: var(--cl-surface); border-right: 1px solid var(--cl-border); flex-direction: column; padding: 1rem .75rem; position: sticky; top: 0; height: 100vh; transition: width .18s ease; }
.cl-sidebar.collapsed { width: var(--cl-sidebar-w-collapsed); }
.cl-sidebar.collapsed .cl-label { display: none; }
.cl-brand { display: flex; align-items: center; gap: .55rem; font-weight: 700; font-size: 1.1rem; color: var(--cl-text); padding: .25rem .5rem; }
.cl-brand:hover { text-decoration: none; }
.cl-brand i { color: var(--cl-primary); font-size: 1.3rem; }
.cl-nav { display: flex; flex-direction: column; gap: 2px; margin-top: 1.25rem; flex: 1; }
.cl-nav-link { display: flex; align-items: center; gap: .75rem; padding: .6rem .7rem; border-radius: 10px; color: #4B5563; font-weight: 500; position: relative; }
.cl-nav-link i { font-size: 1.1rem; width: 1.3rem; text-align: center; }
.cl-nav-link:hover { background: #F3F4F6; color: var(--cl-text); text-decoration: none; }
.cl-nav-link.active { background: var(--cl-primary-soft); color: var(--cl-primary); }
.cl-collapse { display: flex; align-items: center; gap: .75rem; border: 0; background: transparent; color: var(--cl-muted); padding: .6rem .7rem; border-radius: 10px; }
.cl-collapse:hover { background: #F3F4F6; }
.cl-dot { width: 8px; height: 8px; background: var(--cl-danger); border-radius: 50%; margin-left: auto; }
.cl-dot-abs { position: absolute; top: 8px; right: 9px; margin: 0; }

.cl-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cl-header { display: flex; align-items: center; gap: .75rem; padding: .6rem 1rem; background: var(--cl-surface); border-bottom: 1px solid var(--cl-border); position: sticky; top: 0; z-index: 20; min-height: 56px; }
.cl-search { position: relative; flex: 1; max-width: 460px; }
.cl-search i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--cl-muted); }
.cl-search .form-control { padding-left: 2.2rem; background: #F3F4F6; border-color: transparent; min-height: 38px; }
.cl-header-actions { margin-left: auto; display: flex; align-items: center; gap: .35rem; }
.cl-avatar { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--cl-primary-soft); color: var(--cl-primary); font-weight: 600; }
.cl-notif { min-width: 260px; }
.cl-content { padding: 1.25rem 1rem 6rem; width: 100%; max-width: 1180px; margin: 0 auto; }
@media (min-width: 992px) { .cl-content { padding: 1.75rem 2rem 3rem; } .cl-header { padding: .6rem 2rem; } }

.cl-page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.cl-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
@media (max-width: 575px) { .cl-actions .btn { flex: 1 1 calc(50% - .5rem); font-size: .85rem; } }

/* Stat cards */
.cl-stat-top { display: flex; justify-content: space-between; align-items: center; }
.cl-stat-label { color: var(--cl-muted); font-size: .82rem; font-weight: 500; }
.cl-stat-icon { width: 30px; height: 30px; border-radius: 9px; background: var(--cl-primary-soft); color: var(--cl-primary); display: inline-grid; place-items: center; }
.cl-stat-value { font-size: 1.4rem; font-weight: 700; margin: .35rem 0 .1rem; letter-spacing: -.01em; }
.cl-stat-hint { color: var(--cl-muted); font-size: .78rem; }
@media (max-width: 575px) { .cl-stat-value { font-size: 1.15rem; } }
.cl-balance { display: flex; justify-content: space-between; align-items: center; background: linear-gradient(180deg, #fff, #FAFAFF); }
.cl-balance-value { font-size: 2rem; font-weight: 700; letter-spacing: -.02em; }
.cl-triple { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; }
.cl-triple span { display: block; color: var(--cl-muted); font-size: .78rem; }
.cl-triple strong { font-size: 1.02rem; }
@media (max-width: 575px) { .cl-triple strong { font-size: .9rem; } }
.cl-in { color: var(--cl-success); }
.cl-out { color: #B91C1C; }
.cl-chart { position: relative; height: 280px; }
.cl-alert { display: flex; gap: .6rem; align-items: center; background: #FFFBEB; border: 1px solid #FDE68A; color: #92400E; border-radius: 12px; padding: .7rem .9rem; }
.cl-alert a { color: inherit; font-weight: 600; text-decoration: underline; }

/* Listas */
.cl-list { list-style: none; margin: 0; padding: 0; }
.cl-list li { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: .7rem 0; border-bottom: 1px solid var(--cl-border); }
.cl-list li:last-child { border-bottom: 0; }
.cl-card.p-0 .cl-list li { padding: .7rem 1.1rem; }
.cl-list-main { display: flex; flex-direction: column; min-width: 0; }
.cl-list-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-list-side { display: flex; align-items: center; gap: .6rem; white-space: nowrap; }
.cl-list li.is-open { opacity: .65; }

/* Tabelas */
.cl-table { --bs-table-bg: transparent; }
.cl-table thead th { font-size: .76rem; text-transform: uppercase; letter-spacing: .03em; color: var(--cl-muted); font-weight: 600; border-bottom: 1px solid var(--cl-border); padding: .75rem .9rem; background: #FAFAFB; }
.cl-table td { padding: .7rem .9rem; border-color: var(--cl-border); }
.cl-table tfoot th { padding: .75rem .9rem; border-top: 1px solid var(--cl-border); }
.is-cancelled { opacity: .55; }
.is-cancelled td:nth-child(2), .is-cancelled strong { text-decoration: line-through; }
.cl-mrow { padding: .8rem .9rem; }
.min-w-0 { min-width: 0; }
.cl-sum { display: flex; flex-wrap: wrap; gap: .4rem 1.25rem; font-size: .88rem; }

/* Badges de status (discretos) */
.cl-badge { display: inline-block; font-size: .72rem; font-weight: 600; padding: .18rem .55rem; border-radius: 999px; }
.cl-badge-paid { background: #ECFDF3; color: #15803D; }
.cl-badge-pending { background: #F3F4F6; color: #4B5563; }
.cl-badge-overdue { background: #FEF2F2; color: #B91C1C; }
.cl-badge-cancelled { background: #F3F4F6; color: #9CA3AF; }

/* Abas e pills */
.cl-tabs { border-bottom: 1px solid var(--cl-border); gap: .25rem; }
.cl-tabs .nav-link { color: var(--cl-muted); border-bottom: 2px solid transparent; border-radius: 0; padding: .5rem .9rem; }
.cl-tabs .nav-link.active { color: var(--cl-primary); border-bottom-color: var(--cl-primary); font-weight: 600; }
.cl-pills { gap: .35rem; }
.cl-pills .nav-link { color: #4B5563; background: #F3F4F6; border-radius: 999px; padding: .3rem .85rem; font-size: .85rem; }
.cl-pills .nav-link.active { background: var(--cl-primary); color: #fff; }
.cl-scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.cl-day-title { font-size: .82rem; font-weight: 600; color: var(--cl-muted); margin: 1rem 0 .4rem; }

.cl-empty { text-align: center; padding: 2rem 1rem; }
.cl-empty > i { font-size: 2rem; color: #9CA3AF; }
.cl-empty h2 { margin-top: .5rem; }

/* Menu inferior mobile */
.cl-bottom { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr); align-items: center; background: var(--cl-surface); border-top: 1px solid var(--cl-border); padding: .3rem .25rem calc(.3rem + env(safe-area-inset-bottom)); }
.cl-bottom a, .cl-bottom button:not(.cl-fab) { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .68rem; color: var(--cl-muted); background: transparent; border: 0; padding: .35rem 0; min-height: 48px; justify-content: center; }
.cl-bottom a i, .cl-bottom button i { font-size: 1.25rem; }
.cl-bottom a.active { color: var(--cl-primary); }
.cl-bottom a:hover { text-decoration: none; }
.cl-fab { width: 52px; height: 52px; border-radius: 50%; border: 0; background: var(--cl-primary); color: #fff; font-size: 1.4rem; margin: -22px auto 0; box-shadow: 0 6px 16px rgba(79, 70, 229, .35); display: grid; place-items: center; }
.cl-sheet { border-radius: 18px 18px 0 0; height: auto !important; max-height: 80vh; }
.cl-quick { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.cl-quick-item { display: flex; flex-direction: column; align-items: center; gap: .3rem; padding: 1rem .5rem; border: 1px solid var(--cl-border); border-radius: 12px; color: var(--cl-text); font-weight: 500; }
.cl-quick-item i { font-size: 1.4rem; color: var(--cl-primary); }
.cl-quick-item:hover { text-decoration: none; background: #F9FAFB; }
.cl-more { display: flex; flex-direction: column; }
.cl-more a, .cl-more button { display: flex; align-items: center; gap: .75rem; padding: .85rem .25rem; color: var(--cl-text); background: transparent; border: 0; border-bottom: 1px solid var(--cl-border); text-align: left; width: 100%; }
.cl-more form:last-child button { border-bottom: 0; }
@media (max-width: 991px) { .cl-search { max-width: none; } .cl-header .cl-brand span { display: none; } }

/* Valores ocultos */
.values-hidden .js-money { filter: blur(7px); user-select: none; }

/* Convidado / auth */
.cl-guest { background: var(--cl-bg); }
.cl-guest-wrap { max-width: 460px; margin: 0 auto; padding: 2.5rem 1rem; }
.cl-brand-guest { justify-content: center; margin-bottom: 1.25rem; font-size: 1.3rem; }
.cl-auth h1, .cl-auth .h4 { font-weight: 700; }
.cl-legal { max-width: 720px; }
.cl-guest-wrap:has(.cl-legal) { max-width: 760px; }
.cl-steps { display: flex; gap: .35rem; margin-bottom: 1.25rem; }
.cl-steps span { flex: 1; height: 4px; border-radius: 4px; background: var(--cl-border); }
.cl-steps span.on { background: var(--cl-primary); }
.cl-choices { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.cl-choice { position: relative; }
.cl-choice input { position: absolute; opacity: 0; }
.cl-choice span { display: block; padding: .8rem; border: 1px solid var(--cl-border); border-radius: 12px; text-align: center; cursor: pointer; font-weight: 500; }
.cl-choice input:checked + span { border-color: var(--cl-primary); background: var(--cl-primary-soft); color: var(--cl-primary); }
.cl-choice input:focus-visible + span { outline: 2px solid var(--cl-primary); outline-offset: 2px; }

/* Landing */
.cl-land-nav { display: flex; justify-content: space-between; align-items: center; padding-top: 1rem; padding-bottom: 1rem; }
.cl-hero { text-align: center; padding: 3.5rem 0 2.5rem; max-width: 760px; }
.cl-hero h1 { font-size: clamp(2rem, 6vw, 3.2rem); font-weight: 700; letter-spacing: -.03em; }
.cl-hero .lead { color: var(--cl-muted); margin: 1rem 0 1.5rem; }
.cl-land-sec { padding-top: 2rem; padding-bottom: 2rem; }
.cl-land-icon { font-size: 1.5rem; color: var(--cl-primary); }
.cl-step { width: 40px; height: 40px; border-radius: 50%; background: var(--cl-primary-soft); color: var(--cl-primary); font-weight: 700; display: grid; place-items: center; margin: 0 auto .6rem; }
.cl-feature { background: var(--cl-surface); border: 1px solid var(--cl-border); border-radius: 12px; padding: .85rem 1rem; }
.cl-feature i { color: var(--cl-success); }
.cl-price { font-size: 1.4rem; font-weight: 700; margin: .4rem 0; }
.cl-checks { padding-left: 1.1rem; color: var(--cl-muted); font-size: .9rem; min-height: 4.5rem; }
.cl-faq .accordion-button:not(.collapsed) { background: var(--cl-primary-soft); color: var(--cl-primary); }
.cl-cta { padding: 2rem 1rem; }

/* Preparado para modo escuro (nao ativado no MVP) */
[data-theme="dark"] {
  --cl-bg: #0F1115; --cl-surface: #171A21; --cl-text: #F3F4F6; --cl-muted: #9CA3AF; --cl-border: #262A33; --cl-primary-soft: #23244A;
}

/* Assistente (chat) */
.cl-chat { display: flex; flex-direction: column; padding: 0; overflow: hidden; height: min(70vh, 640px); }
.cl-chat-log { flex: 1; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: .5rem; background: #FBFBFC; }
.cl-msg { display: flex; }
.cl-msg-user { justify-content: flex-end; }
.cl-bubble { max-width: 82%; padding: .55rem .8rem; border-radius: 14px; white-space: pre-wrap; word-break: break-word; line-height: 1.4; }
.cl-msg-user .cl-bubble { background: var(--cl-primary); color: #fff; border-bottom-right-radius: 4px; }
.cl-msg-bot .cl-bubble { background: var(--cl-surface); border: 1px solid var(--cl-border); border-bottom-left-radius: 4px; }
.cl-chat-actions { display: flex; flex-wrap: wrap; gap: .4rem; padding: .5rem 1rem 0; min-height: 0; }
.cl-chat-form { display: flex; gap: .5rem; padding: .75rem 1rem; border-top: 1px solid var(--cl-border); background: var(--cl-surface); }
.cl-chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.cl-chip { border: 1px solid var(--cl-border); background: var(--cl-surface); border-radius: 999px; padding: .35rem .8rem; font-size: .85rem; }
.cl-chip:hover { background: var(--cl-primary-soft); border-color: #C7C9F5; }
@media (max-width: 991px) { .cl-chat { height: calc(100vh - 260px); min-height: 380px; } }

/* Assistente flutuante (canto inferior direito) */
.cl-assistant-fab { position: fixed; right: 20px; bottom: 20px; z-index: 40; width: 56px; height: 56px; border-radius: 50%; border: 0; background: var(--cl-primary); color: #fff; font-size: 1.4rem; display: grid; place-items: center; box-shadow: 0 8px 22px rgba(79, 70, 229, .35); transition: transform .12s ease, background .12s ease; }
.cl-assistant-fab:hover { background: var(--cl-primary-hover); transform: translateY(-1px); }
.cl-assistant-fab.is-open { background: #374151; }
.cl-assistant-panel { position: fixed; right: 20px; bottom: 88px; z-index: 41; width: 380px; height: min(560px, calc(100vh - 120px)); display: flex; flex-direction: column; background: var(--cl-surface); border: 1px solid var(--cl-border); border-radius: 16px; box-shadow: 0 18px 48px rgba(17, 24, 39, .18); overflow: hidden; }
.cl-assistant-panel[hidden] { display: none; }
.cl-assistant-head { display: flex; justify-content: space-between; align-items: center; padding: .75rem 1rem; border-bottom: 1px solid var(--cl-border); }
.cl-assistant-panel .cl-chat { flex: 1; min-height: 0; height: auto; border: 0; box-shadow: none; border-radius: 0; }
@media (max-width: 991px) {
  .cl-assistant-fab { right: 14px; bottom: calc(84px + env(safe-area-inset-bottom)); width: 52px; height: 52px; }
  .cl-assistant-panel { right: 8px; left: 8px; width: auto; bottom: calc(146px + env(safe-area-inset-bottom)); height: min(520px, calc(100vh - 220px)); }
}

/* Botao de voz */
.cl-mic { width: 44px; padding: 0; flex: none; }
.cl-mic.is-listening { background: #FEF2F2; border-color: #FCA5A5; color: #B91C1C; animation: cl-pulse 1.2s ease-in-out infinite; }
@keyframes cl-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, .35); } 50% { box-shadow: 0 0 0 7px rgba(220, 38, 38, 0); } }
