/*
 * HI ENJOY — sistema de design do 1Click Maker.
 *
 * Carregado DEPOIS de todo o resto, em todas as páginas. Três partes:
 *   1. Tokens (--hi-*): a única fonte de cor, raio, espaço e tipo.
 *   2. Ponte: remapeia as variáveis do template antigo (styles.css) e do Bootstrap
 *      para os tokens, então tudo que ainda usa classes do template já sai na marca.
 *   3. Componentes base (botões, campos, modais, tabelas, bibliotecas de terceiros).
 * O layout novo do painel fica em shell.css.
 *
 * Regra da marca: um fundo quase preto, texto branco/cinza e o vermelho da logo
 * como ÚNICA cor de destaque. Verde, âmbar e vermelho de erro só aparecem com
 * significado (salvo, aviso, perigo), nunca como enfeite.
 */

/* ============================================================ 1. tokens */

:root {
    /* superfícies, do fundo para cima */
    --hi-bg: #0b0b0e;
    --hi-surface: #121216;
    --hi-surface-2: #18181d;
    --hi-surface-3: #202027;
    --hi-surface-4: #292931;

    --hi-border: rgba(255, 255, 255, 0.07);
    --hi-border-strong: rgba(255, 255, 255, 0.13);

    /* texto */
    --hi-text: #f3f3f5;
    --hi-text-2: #b3b3bd;
    --hi-text-3: #7c7c88;

    /* marca: #d0182a é a cor da logo. Em texto pequeno sobre o fundo escuro ela
       fica abaixo de 4.5:1, então texto e ícones usam --hi-accent-text. */
    --hi-accent: #d0182a;
    --hi-accent-rgb: 208, 24, 42;
    --hi-accent-hover: #e2233a;
    --hi-accent-press: #b31424;
    --hi-accent-text: #ff5a69;
    --hi-accent-soft: rgba(208, 24, 42, 0.14);
    --hi-accent-line: rgba(255, 90, 105, 0.45);

    /* significado */
    --hi-ok: #3ccf8e;
    --hi-ok-rgb: 60, 207, 142;
    --hi-warn: #f2b84b;
    --hi-warn-rgb: 242, 184, 75;
    --hi-danger: #ff5a69;
    --hi-danger-rgb: 255, 90, 105;

    /* forma */
    --hi-r-xs: 4px;
    --hi-r-sm: 6px;
    --hi-r: 8px;
    --hi-r-lg: 12px;
    --hi-r-xl: 16px;

    --hi-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
    --hi-shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.55);
    --hi-focus: 0 0 0 3px rgba(208, 24, 42, 0.35);

    /* tipo */
    --hi-font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --hi-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
    --hi-fs-xs: 11px;
    --hi-fs-sm: 12px;
    --hi-fs: 13px;
    --hi-fs-md: 14px;
    --hi-fs-lg: 16px;
    --hi-fs-xl: 20px;

    --hi-ease: cubic-bezier(0.2, 0.7, 0.2, 1);
    --hi-fast: 120ms;
}

/* ============================================================ 2. ponte */

/* Especificidade maior que o [data-theme-mode=dark] do styles.css. */
html[data-theme-mode] {
    color-scheme: dark;

    --primary-rgb: 208, 24, 42;
    --secondary-rgb: 124, 124, 136;
    --info-rgb: 150, 160, 178;
    --teal-rgb: 150, 160, 178;
    --success-rgb: 60, 207, 142;
    --green-rgb: 60, 207, 142;
    --warning-rgb: 242, 184, 75;
    --orange-rgb: 242, 150, 75;
    --danger-rgb: 255, 90, 105;
    --pink-rgb: 255, 90, 105;
    --purple-rgb: 208, 24, 42;
    --light-rgb: 32, 32, 39;
    --dark-rgb: 243, 243, 245;

    --body-bg-rgb: 18, 18, 22;
    --body-bg-rgb2: 11, 11, 14;
    --default-body-bg-color: var(--hi-bg);
    --theme-bg-gradient: var(--hi-bg);
    --bg-pattern: none;
    --card-bg: 18, 18, 22;

    --default-text-color-rgb: 243, 243, 245;
    --default-font-family: var(--hi-font);
    --default-border: var(--hi-border);
    --default-background: var(--hi-surface-2);
    --custom-white: var(--hi-surface);
    --custom-black: var(--hi-text);
    --menu-bg: var(--hi-surface);
    --header-bg: var(--hi-surface);
    --menu-border-color: var(--hi-border);
    --header-border-color: var(--hi-border);
    --bootstrap-card-border: var(--hi-border);
    --list-hover-focus-bg: var(--hi-surface-3);
    --text-muted: var(--hi-text-3);
    --input-border: var(--hi-border-strong);
    --form-control-bg: var(--hi-surface-2);

    --bs-body-bg: var(--hi-bg);
    --bs-body-color: var(--hi-text);
    --bs-body-font-family: var(--hi-font);
    --bs-border-color: var(--hi-border);
    --bs-border-color-translucent: var(--hi-border);
    --bs-primary: var(--hi-accent);
    --bs-primary-rgb: 208, 24, 42;
    --bs-danger-rgb: 255, 90, 105;
    --bs-success-rgb: 60, 207, 142;
    --bs-warning-rgb: 242, 184, 75;
    --bs-link-color: var(--hi-accent-text);
    --bs-link-color-rgb: 255, 90, 105;
    --bs-link-hover-color: var(--hi-text);
    --bs-emphasis-color: var(--hi-text);
    --bs-secondary-color: var(--hi-text-2);
    --bs-tertiary-bg: var(--hi-surface-2);
    --bs-secondary-bg: var(--hi-surface-3);
}

/* ============================================================ 3. base */

html,
body {
    background: var(--hi-bg) !important;
}

body {
    font-family: var(--hi-font);
    font-size: var(--hi-fs);
    color: var(--hi-text);
    letter-spacing: -0.005em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
    font-family: var(--hi-font);
    color: var(--hi-text);
    letter-spacing: -0.01em;
}

a {
    color: var(--hi-accent-text);
}

a:hover {
    color: var(--hi-text);
}

::selection {
    background: rgba(var(--hi-accent-rgb), 0.45);
    color: #fff;
}

.text-muted {
    color: var(--hi-text-3) !important;
}

/* O template invertia .text-white no tema escuro (virava quase preto): títulos
   com essa classe sumiam no fundo. */
.text-default,
.text-dark,
.text-white,
.text-fixed-white {
    color: var(--hi-text) !important;
}

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

/* barras de rolagem finas em tudo */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--hi-surface-4) transparent;
}

*::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

*::-webkit-scrollbar-thumb {
    background: var(--hi-surface-4);
    border-radius: 8px;
    border: 2px solid transparent;
    background-clip: content-box;
}

*::-webkit-scrollbar-track {
    background: transparent;
}

:focus-visible {
    outline: none;
    box-shadow: var(--hi-focus);
}

/* Campos de texto já mostram o foco na borda (ou no contêiner, como a barra
   "Add action" e o chat do Clicky): o anel extra virava uma borda dupla. */
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    box-shadow: none;
}

/* O template enfeitava os cards com cantoneiras e fundo com padrão. Fora. */
.top-left,
.top-right,
.bottom-left,
.bottom-right {
    display: none !important;
}

.card.custom-card,
.card {
    letter-spacing: normal;
    background: var(--hi-surface-2);
    border: 1px solid var(--hi-border);
    border-radius: var(--hi-r-lg);
    box-shadow: none;
    color: var(--hi-text);
}

.card.custom-card .card-header {
    background: transparent;
    border-bottom: 1px solid var(--hi-border);
}

.card.custom-card .card-title {
    font-size: var(--hi-fs-sm);
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--hi-text-2);
}

.card.custom-card .card-title::before {
    display: none;
}

/* ---------- botões */

.btn {
    font-family: var(--hi-font);
    font-size: var(--hi-fs);
    font-weight: 500;
    border-radius: var(--hi-r);
    letter-spacing: 0;
    transition: background-color var(--hi-fast) var(--hi-ease), border-color var(--hi-fast) var(--hi-ease), color var(--hi-fast) var(--hi-ease), box-shadow var(--hi-fast) var(--hi-ease);
}

.btn-sm {
    font-size: var(--hi-fs-sm);
    border-radius: var(--hi-r-sm);
}

.btn-lg {
    font-size: var(--hi-fs-md);
}

.btn-primary,
.btn-success,
.btn-danger {
    background: var(--hi-accent) !important;
    border-color: var(--hi-accent) !important;
    color: #fff !important;
}

.btn-primary:hover,
.btn-success:hover,
.btn-danger:hover {
    background: var(--hi-accent-hover) !important;
    border-color: var(--hi-accent-hover) !important;
}

.btn-primary:active,
.btn-success:active,
.btn-danger:active {
    background: var(--hi-accent-press) !important;
}

/* Botões secundários: neutros, sem cor de enfeite. */
.btn-secondary,
.btn-light,
.btn-dark,
.btn-info,
.btn-warning,
.btn-orange,
.btn-purple,
.btn-teal {
    background: var(--hi-surface-3) !important;
    border: 1px solid var(--hi-border-strong) !important;
    color: var(--hi-text) !important;
}

.btn-secondary:hover,
.btn-light:hover,
.btn-dark:hover,
.btn-info:hover,
.btn-warning:hover,
.btn-orange:hover,
.btn-purple:hover,
.btn-teal:hover {
    background: var(--hi-surface-4) !important;
}

/* Variantes "-light"/"-transparent" do template: fantasmas neutros. A de perigo
   mantém o vermelho só no texto, para não competir com a ação principal. */
.btn-primary-light,
.btn-primary-transparent,
.btn-info-light,
.btn-info-transparent,
.btn-success-light,
.btn-success-transparent,
.btn-warning-light,
.btn-warning-transparent,
.btn-orange-light,
.btn-secondary-light,
.btn-light-transparent {
    background: var(--hi-surface-3) !important;
    border: 1px solid var(--hi-border) !important;
    color: var(--hi-text-2) !important;
}

.btn-primary-light:hover,
.btn-primary-transparent:hover,
.btn-info-light:hover,
.btn-info-transparent:hover,
.btn-success-light:hover,
.btn-success-transparent:hover,
.btn-warning-light:hover,
.btn-warning-transparent:hover,
.btn-orange-light:hover,
.btn-secondary-light:hover,
.btn-light-transparent:hover {
    background: var(--hi-surface-4) !important;
    color: var(--hi-text) !important;
}

.btn-danger-light,
.btn-danger-transparent {
    background: transparent !important;
    border: 1px solid var(--hi-border) !important;
    color: var(--hi-danger) !important;
}

.btn-danger-light:hover,
.btn-danger-transparent:hover {
    background: rgba(var(--hi-danger-rgb), 0.12) !important;
    border-color: rgba(var(--hi-danger-rgb), 0.35) !important;
}

.btn:disabled,
.btn.disabled {
    opacity: 0.45;
}

.btn-close {
    filter: invert(1) grayscale(1);
    opacity: 0.5;
}

.btn-close:hover {
    opacity: 0.9;
}

/* ---------- campos */

.form-control,
.form-select,
.input-group-text {
    font-family: var(--hi-font);
    font-size: var(--hi-fs);
    color: var(--hi-text) !important;
    background-color: var(--hi-surface-2) !important;
    border: 1px solid var(--hi-border-strong) !important;
    border-radius: var(--hi-r);
}

.form-control::placeholder {
    color: var(--hi-text-3) !important;
    opacity: 1;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--hi-accent-line) !important;
    box-shadow: var(--hi-focus) !important;
    background-color: var(--hi-surface-2) !important;
}

.form-label {
    font-size: var(--hi-fs-sm);
    font-weight: 500;
    color: var(--hi-text-2) !important;
    margin-bottom: 6px;
}

.form-check-input {
    background-color: var(--hi-surface-3);
    border-color: var(--hi-border-strong);
}

.form-check-input:checked {
    background-color: var(--hi-accent);
    border-color: var(--hi-accent);
}

.form-check-input:focus {
    box-shadow: var(--hi-focus);
    border-color: var(--hi-accent-line);
}

.form-range::-webkit-slider-thumb {
    background: var(--hi-accent);
}

.form-range::-moz-range-thumb {
    background: var(--hi-accent);
}

.form-range::-webkit-slider-runnable-track {
    background: var(--hi-surface-4);
}

/* ---------- modais, offcanvas, dropdowns */

.modal-backdrop.show {
    opacity: 0.7;
    background: #000;
}

.modal-content,
.offcanvas {
    background: var(--hi-surface) !important;
    border: 1px solid var(--hi-border-strong) !important;
    border-radius: var(--hi-r-xl);
    box-shadow: var(--hi-shadow-lg);
    color: var(--hi-text);
}

.offcanvas {
    border-radius: 0;
}

.modal-fullscreen .modal-content {
    border-radius: 0;
    border: 0 !important;
}

.modal-header,
.offcanvas-header {
    border-bottom: 1px solid var(--hi-border) !important;
    background: transparent !important;
    padding: 16px 20px;
}

.modal-title,
.offcanvas-title {
    font-size: var(--hi-fs-lg);
    font-weight: 600;
    color: var(--hi-text) !important;
}

.modal-footer {
    border-top: 1px solid var(--hi-border) !important;
    padding: 12px 20px;
}

.offcanvas-body {
    background: var(--hi-surface) !important;
}

.dropdown-menu {
    background: var(--hi-surface-2);
    border: 1px solid var(--hi-border-strong);
    border-radius: var(--hi-r-lg);
    box-shadow: var(--hi-shadow);
    padding: 6px;
}

.dropdown-item {
    color: var(--hi-text-2);
    border-radius: var(--hi-r-sm);
    font-size: var(--hi-fs);
    padding: 7px 10px;
}

.dropdown-item:hover,
.dropdown-item:focus {
    background: var(--hi-surface-3);
    color: var(--hi-text);
}

.tooltip-inner {
    background: var(--hi-surface-4) !important;
    color: var(--hi-text) !important;
    font-family: var(--hi-font);
    font-size: var(--hi-fs-sm);
    border-radius: var(--hi-r-sm);
    padding: 5px 9px;
    box-shadow: var(--hi-shadow);
}

.tooltip .tooltip-arrow::before {
    display: none;
}

/* ---------- abas, tabelas, selos, alertas */

.nav-pills .nav-link,
.nav-tabs .nav-link {
    color: var(--hi-text-2);
    border-radius: var(--hi-r);
    font-size: var(--hi-fs);
    font-weight: 500;
}

.nav-pills .nav-link.active,
.nav-tabs .nav-link.active,
.nav-pills .show > .nav-link {
    background: var(--hi-surface-3) !important;
    color: var(--hi-text) !important;
    border-color: var(--hi-border-strong) !important;
    box-shadow: inset 0 -2px 0 var(--hi-accent);
}

.nav-tabs {
    border-bottom: 1px solid var(--hi-border);
}

.table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--hi-text);
    --bs-table-hover-bg: var(--hi-surface-3);
    --bs-table-hover-color: var(--hi-text);
    border-color: var(--hi-border);
}

.table thead,
.table thead.bg-light,
.table thead th {
    background: var(--hi-surface-2) !important;
    color: var(--hi-text-3) !important;
    font-size: var(--hi-fs-xs);
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.badge {
    font-family: var(--hi-font);
    font-weight: 600;
    border-radius: var(--hi-r-sm);
}

.bg-primary {
    background-color: var(--hi-accent) !important;
}

.bg-light {
    background-color: var(--hi-surface-3) !important;
}

.bg-primary-transparent,
.bg-info-transparent,
.bg-light-transparent,
.bg-dark-transparent {
    background-color: var(--hi-surface-3) !important;
    color: var(--hi-text-2) !important;
}

.bg-success-transparent {
    background-color: rgba(var(--hi-ok-rgb), 0.12) !important;
    color: var(--hi-ok) !important;
}

.bg-warning-transparent {
    background-color: rgba(var(--hi-warn-rgb), 0.12) !important;
    color: var(--hi-warn) !important;
}

.bg-danger-transparent {
    background-color: rgba(var(--hi-danger-rgb), 0.12) !important;
    color: var(--hi-danger) !important;
}

.alert {
    border-radius: var(--hi-r-lg);
    font-size: var(--hi-fs);
}

.alert-primary,
.alert-info,
.alert-dark,
.alert-info-transparent {
    background: var(--hi-surface-2) !important;
    border: 1px solid var(--hi-border-strong) !important;
    color: var(--hi-text-2) !important;
}

.alert-danger {
    background: rgba(var(--hi-danger-rgb), 0.1) !important;
    border: 1px solid rgba(var(--hi-danger-rgb), 0.3) !important;
    color: var(--hi-text) !important;
}

.alert-warning {
    background: rgba(var(--hi-warn-rgb), 0.1) !important;
    border: 1px solid rgba(var(--hi-warn-rgb), 0.3) !important;
    color: var(--hi-text) !important;
}

.progress {
    background: var(--hi-surface-3);
    border-radius: 99px;
}

.progress-bar {
    background: var(--hi-accent) !important;
    border-radius: 99px;
}

.accordion-item {
    background: var(--hi-surface-2) !important;
    border: 1px solid var(--hi-border) !important;
    border-radius: var(--hi-r-lg) !important;
}

.accordion-button {
    background: transparent !important;
    color: var(--hi-text) !important;
    font-weight: 600;
    box-shadow: none !important;
}

.accordion-button::after {
    filter: invert(1) grayscale(1);
}

.accordion-body {
    color: var(--hi-text-2);
}

/* ---------- bibliotecas de terceiros */

/* Choices.js (selects de target, links, variáveis) */
.choices__inner {
    background: var(--hi-surface-2) !important;
    border: 1px solid var(--hi-border-strong) !important;
    border-radius: var(--hi-r) !important;
    color: var(--hi-text);
    font-size: var(--hi-fs);
    min-height: 38px;
}

.is-focused .choices__inner,
.is-open .choices__inner {
    border-color: var(--hi-accent-line) !important;
}

.choices__list--dropdown,
.choices__list[aria-expanded] {
    background: var(--hi-surface-2) !important;
    border: 1px solid var(--hi-border-strong) !important;
    border-radius: var(--hi-r) !important;
    box-shadow: var(--hi-shadow);
    color: var(--hi-text);
    z-index: 30;
}

.choices__list--dropdown .choices__item--selectable.is-highlighted,
.choices__list[aria-expanded] .choices__item--selectable.is-highlighted {
    background: var(--hi-surface-3) !important;
}

.choices__list--multiple .choices__item {
    background: var(--hi-surface-4) !important;
    border: 1px solid var(--hi-border-strong) !important;
    color: var(--hi-text) !important;
    border-radius: var(--hi-r-sm) !important;
    font-weight: 500;
}

.choices__input {
    background: transparent !important;
    color: var(--hi-text) !important;
}

.choices__heading {
    color: var(--hi-text-3) !important;
    font-size: var(--hi-fs-xs);
    letter-spacing: 0.06em;
    border-bottom-color: var(--hi-border) !important;
}

/* SweetAlert2 */
.swal2-popup {
    background: var(--hi-surface) !important;
    border: 1px solid var(--hi-border-strong);
    border-radius: var(--hi-r-xl) !important;
    color: var(--hi-text) !important;
    font-family: var(--hi-font) !important;
    box-shadow: var(--hi-shadow-lg);
}

.swal2-title {
    color: var(--hi-text) !important;
    font-size: 18px !important;
    font-weight: 600 !important;
}

.swal2-html-container {
    color: var(--hi-text-2) !important;
    font-size: var(--hi-fs-md) !important;
}

.swal2-styled.swal2-confirm {
    background: var(--hi-accent) !important;
    border-radius: var(--hi-r) !important;
    box-shadow: none !important;
}

.swal2-styled.swal2-cancel,
.swal2-styled.swal2-deny {
    background: var(--hi-surface-3) !important;
    border: 1px solid var(--hi-border-strong) !important;
    color: var(--hi-text) !important;
    border-radius: var(--hi-r) !important;
}

.swal2-input,
.swal2-textarea,
.swal2-select {
    background: var(--hi-surface-2) !important;
    border: 1px solid var(--hi-border-strong) !important;
    color: var(--hi-text) !important;
    border-radius: var(--hi-r) !important;
    box-shadow: none !important;
}

.swal2-container.swal2-backdrop-show {
    background: rgba(0, 0, 0, 0.7) !important;
}

/* Pickr (seletor de cor) */
.pcr-app {
    background: var(--hi-surface-2) !important;
    border: 1px solid var(--hi-border-strong);
    border-radius: var(--hi-r-lg) !important;
    box-shadow: var(--hi-shadow) !important;
}

.pcr-app .pcr-interaction input {
    background: var(--hi-surface-3) !important;
    color: var(--hi-text) !important;
}

.pcr-app .pcr-interaction .pcr-save {
    background: var(--hi-accent) !important;
}

/* Toasts (toasts.js) */
.toast {
    background: var(--hi-surface-2) !important;
    border: 1px solid var(--hi-border-strong) !important;
    border-radius: var(--hi-r-lg) !important;
    color: var(--hi-text) !important;
    box-shadow: var(--hi-shadow);
}

/* Loader da página: fundo da marca em vez do do template. */
#loader {
    background: var(--hi-bg) !important;
}

/* Ondas do node-waves: tiram a sensação de "rápido" e poluem. */
.waves-ripple {
    display: none !important;
}

/* Ícone de destaque em cabeçalhos de modal e cartões (substitui o verde decorativo). */
.hi-accent-avatar {
    background: var(--hi-accent-soft) !important;
    color: var(--hi-accent-text) !important;
    border: 1px solid var(--hi-accent-line);
}

/* ============================================================ páginas avulsas */

/* Login do admin e telas de erro: um cartão central com a marca. */
.hi-auth .authentication {
    min-height: 100vh;
}

.hi-auth .card.custom-card {
    max-width: 440px;
    margin: 0 auto;
    background: var(--hi-surface);
    border: 1px solid var(--hi-border-strong);
    border-radius: var(--hi-r-xl);
    box-shadow: var(--hi-shadow-lg);
}

.hi-auth__brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-bottom: 22px;
}

.hi-auth__brand img {
    border-radius: var(--hi-r-lg);
}

.hi-auth__brand span {
    font-size: var(--hi-fs-lg);
    font-weight: 700;
    color: var(--hi-text);
}

/* Admin: a marca no topo do menu. */
.admin-brand img {
    border-radius: var(--hi-r-sm);
}
