/* ============ v6: DarkLogic CRM branding + i18n switches + help + logo upload ============ */

/* Brand logo in sidebar */
.brand.brand-dl {
    padding: 18px 16px 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    background: var(--hero-image);
    border-bottom: 1px solid var(--brd);
    margin-bottom: 6px;
}
.brand-logo-img {
    max-width: 100%;
    max-height: 44px;
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 2px 8px rgba(123,97,255,.3));
}

/* Language switcher (topbar) */
.lang-switch {
    display: inline-flex;
    gap: 0;
    background: rgba(11,14,22,.5);
    border: 1px solid var(--brd);
    border-radius: 6px;
    overflow: hidden;
}
[data-theme="light"] .lang-switch { background: #F3F4F6 }
.lang-switch a {
    padding: 4px 10px;
    text-decoration: none;
    color: var(--mut);
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: 1px;
    transition: all .15s;
}
.lang-switch a:hover { color: var(--tx); background: rgba(123,97,255,.15) }
.lang-switch a.active { background: var(--grad); color: #fff }

/* Theme switcher (dots) */
.theme-switch {
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    background: rgba(11,14,22,.5);
    border: 1px solid var(--brd);
    border-radius: 6px;
}
[data-theme="light"] .theme-switch { background: #F3F4F6 }
.theme-switch a {
    width: 18px; height: 18px;
    border-radius: 50%;
    border: 2px solid transparent;
    transition: all .15s;
}
.theme-switch a:hover { transform: scale(1.15); border-color: var(--vlt) }
.theme-switch a.active { border-color: var(--tx); box-shadow: 0 0 0 2px var(--vlt); transform: scale(1.1) }

/* ============ Help / tutorial page ============ */

.help-hero {
    text-align: center;
    padding: 30px 20px 20px;
    background: var(--hero-image), var(--surf);
    border-radius: 16px;
    border: 1px solid var(--brd);
    margin-bottom: 20px;
}
[data-theme="light"] .help-hero img { filter: none }
.help-hero h1 { font-size: 1.6rem; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

.help-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 14px;
}
.help-card {
    position: relative;
    background: var(--surf);
    border: 1px solid var(--brd);
    border-radius: 12px;
    padding: 22px 20px 18px;
    transition: all .2s;
}
.help-card:hover { border-color: var(--vlt); transform: translateY(-2px); box-shadow: 0 6px 20px rgba(123,97,255,.15) }
.help-num {
    position: absolute;
    top: 10px; right: 14px;
    font-size: 2rem;
    font-weight: 800;
    color: var(--vlt);
    opacity: .18;
    line-height: 1;
}
.help-icon {
    width: 42px; height: 42px;
    border-radius: 10px;
    background: var(--grad);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    margin-bottom: 12px;
}
.help-card p { color: var(--mut); font-size: .92rem }
.help-card p .mono { font-family: 'JetBrains Mono', monospace; background: rgba(123,97,255,.12); padding: 1px 6px; border-radius: 4px; font-size: .85em }
.help-card p b { color: var(--tx) }

/* ============ Logo upload UI (billing_settings) ============ */

.logo-slots { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px }
.logo-slot {
    background: var(--surf2);
    border: 2px dashed var(--brd);
    border-radius: 10px;
    padding: 14px;
    text-align: center;
}
.logo-slot.dark  { background: #FFFFFF }
.logo-slot.white { background: #060713 }
.logo-slot .preview {
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
}
.logo-slot .preview img { max-height: 70px; max-width: 100%; object-fit: contain }
.logo-slot .preview .placeholder { color: rgba(148,163,184,.5); font-size: 2rem }
.logo-slot .preview.dark .placeholder  { color: #94A3B8 }
.logo-slot .preview.white .placeholder { color: #94A3B8 }
.logo-slot .lbl {
    font-size: .7rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    font-weight: 700;
    margin-bottom: 6px;
}
.logo-slot.dark  .lbl { color: #6B7280 }
.logo-slot.white .lbl { color: #94A3B8 }
.logo-slot input[type=file] {
    width: 100%;
    padding: 8px;
    background: transparent;
    color: var(--tx);
    border: 1px solid var(--brd);
    border-radius: 6px;
    font-size: .8rem;
    box-sizing: border-box;
}
.logo-slot.dark  input[type=file] { color: #1F2937; border-color: #D1D5DB; background: #F9FAFB }
.logo-slot.white input[type=file] { color: #EAE6FF; border-color: #1F2545; background: rgba(11,14,22,.6) }

/* Theme picker cards in profile */
.theme-picker { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-top: 10px }
.theme-picker label {
    display: block;
    cursor: pointer;
    background: var(--surf2);
    border: 2px solid var(--brd);
    border-radius: 10px;
    padding: 12px;
    transition: all .2s;
    text-align: center;
}
.theme-picker input[type=radio] { display: none }
.theme-picker input[type=radio]:checked + .th-inner { border-color: var(--vlt) }
.theme-picker label:hover { border-color: var(--vlt) }
.theme-picker .th-swatch {
    height: 60px;
    border-radius: 8px;
    margin-bottom: 8px;
}
.theme-picker .th-name { font-weight: 700; font-size: .9rem }

/* Kbd */
.kbd { background: var(--surf2); border: 1px solid var(--brd); padding: 2px 6px; border-radius: 4px; font-family: 'JetBrains Mono', monospace; font-size: .8em }

/* Mobile */
@media (max-width: 900px) {
    .who .lang-switch, .who .theme-switch { display: none }
    .help-grid { grid-template-columns: 1fr }
    .logo-slots { grid-template-columns: 1fr }
    .brand-logo-img { max-height: 36px }
}


/* v6.5: límites de tablas y gráficos para evitar crecimiento infinito */
.tbl-wrap { max-height:min(520px, 60vh) !important; overflow:auto !important; width:100%; }
.card canvas { display:block !important; width:100% !important; height:250px !important; max-height:250px !important; }
.card canvas.chart-small { height:210px !important; max-height:210px !important; }
@media(max-width:700px){ .card canvas { height:220px !important; max-height:220px !important; } }

.chart-box{position:relative;height:250px;max-height:250px;min-height:0;overflow:hidden;width:100%}.chart-box canvas{width:100%!important;height:100%!important;max-height:100%!important}
@media(max-width:700px){.chart-box{height:220px;max-height:220px}}

/* v6.5: tablas y graficas con dimensiones controladas */
.tbl-wrap{contain:layout paint;max-width:100%;max-height:min(520px,60vh)!important;overflow:auto!important}
.tbl-wrap table.tbl{margin:0!important;width:100%;max-width:100%}
.chart-box{contain:layout paint;position:relative;height:250px!important;max-height:250px!important;overflow:hidden;width:100%;max-width:100%}
.chart-box canvas{display:block!important;width:100%!important;height:100%!important;max-width:100%!important;max-height:250px!important}
@media(max-width:700px){.chart-box{height:220px!important;max-height:220px!important}}
