/* CoachSolver V2 — estilos comunes (look Factusolver) */
:root {
    --sidebar-width: 240px;
    --topbar-height: 60px;
    --blue: #5197d1;
    --blue-light: #edf4fb;
    --bg: #F7F9FA;
    --text: #0B0F1F;
    --text-muted: #637282;
    --border: #E6E8EB;
    --white: #ffffff;
}

html { -webkit-text-size-adjust: 100%; }
body {
    background: var(--bg);
    font-family: 'Manrope', 'Segoe UI', sans-serif;
    color: var(--text);
    font-size: 14px;
    margin: 0;
}

/* ─── Login ─────────────────────────────────────────── */
body.login-body {
    display: flex; flex-direction: column;
    justify-content: center; align-items: center;
    min-height: 100vh; padding: 24px; box-sizing: border-box;
}
.login-card {
    background: var(--white); padding: 40px; border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    width: 100%; max-width: 380px; text-align: center; box-sizing: border-box;
}
.login-logo { width: min(230px, 72vw); margin-bottom: 22px; }
.login-card .input-group { text-align: left; margin-bottom: 15px; display: block; }
.login-card label {
    display: block; font-weight: 600; margin-bottom: 6px; font-size: 13px;
}
.login-card input[type=email],
.login-card input[type=password] {
    width: 100%; padding: 12px; border: 1px solid var(--border);
    border-radius: 6px; box-sizing: border-box; font-size: 15px; font-family: inherit;
}
.login-card input:focus {
    border-color: var(--blue); outline: none;
    box-shadow: 0 0 0 3px rgba(81,151,209,0.15);
}
.login-card button[type=submit] {
    width: 100%; background: var(--blue); color: #fff; border: none;
    padding: 12px; border-radius: 6px; font-weight: 800; cursor: pointer;
    font-size: 15px; margin-top: 8px; transition: background .2s;
}
.login-card button[type=submit]:hover { background: #3d7db2; }
.login-alert {
    padding: 10px 12px; border-radius: 6px; font-size: 13px; margin-bottom: 14px; text-align: left;
}
.login-alert.error   { background: #FDECEA; color: #B3261E; border: 1px solid #F5C6C0; }
.login-alert.info    { background: #E8F0FE; color: #1A73E8; border: 1px solid #C6DAFC; }
.login-alert.success { background: #E6F4EA; color: #137333; border: 1px solid #C6E5CE; }

@media (max-width: 768px) {
    .login-card { max-width: 100%; padding: 28px 20px; border-radius: 16px; }
    .login-logo { width: min(220px, 70vw); margin-bottom: 22px; }
    .login-card input { padding: 14px; font-size: 16px; }
    .login-card button[type=submit] { padding: 14px; font-size: 16px; }
}

/* ── SIDEBAR ── */
#sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: var(--sidebar-width);
    background: var(--white);
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
    z-index: 1000;
}
#sidebar .sidebar-brand {
    height: var(--topbar-height);
    display: flex; align-items: center; justify-content: center;
    padding: 0 20px;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
}
#sidebar .sidebar-brand img { max-height: 30px; width: auto; }

#sidebar nav { flex: 1; overflow-y: auto; padding: 6px 0; }

#sidebar nav .nav-section {
    font-size: .63rem; font-weight: 700; letter-spacing: .09em;
    color: #b0b8c4; text-transform: uppercase;
    padding: 11px 20px 3px;
}
#sidebar nav .nav-section:first-child { padding-top: 2px; }

#sidebar nav a {
    display: flex; align-items: center; gap: 9px;
    padding: 6px 20px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: .85rem; font-weight: 600; line-height: 1.35;
    border-right: 3px solid transparent;
    transition: background .12s, color .12s;
}
#sidebar nav a:hover { background: var(--bg); color: var(--text); }
#sidebar nav a.active {
    background: var(--blue-light);
    color: var(--blue);
    border-right-color: var(--blue);
    font-weight: 700;
}
#sidebar nav a.disabled { pointer-events: none; cursor: default; }
#sidebar nav a i { font-size: 1rem; width: 18px; text-align: center; }
#sidebar nav a .badge-soon {
    margin-left: auto; font-size: .6rem; font-weight: 700;
    padding: 2px 6px; border-radius: 4px;
    background: #F1F3F5; color: #9AA4B2; text-transform: uppercase; letter-spacing: .04em;
}

#sidebar .sidebar-footer {
    padding: 10px 20px;
    border-top: 1px solid var(--border);
    color: var(--text-muted); font-size: .8rem;
}
#sidebar .sidebar-footer .fw-semibold { color: var(--text); }

/* ── TOPBAR ── */
#topbar {
    position: fixed; top: 0; left: var(--sidebar-width); right: 0;
    height: var(--topbar-height);
    background: var(--white); border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px; z-index: 999;
}
#topbar .topbar-title { font-weight: 700; color: var(--text); font-size: .95rem; }
#topbar .menu-toggle { display: none; background: none; border: none; font-size: 22px; margin-right: 6px; }

/* ── CONTENIDO ── */
#main-content {
    margin-left: var(--sidebar-width);
    padding-top: var(--topbar-height);
    min-height: 100vh;
}
.page-content { padding: 28px 32px; }

/* ── TARJETAS ── */
.card {
    border: 1px solid var(--border) !important;
    border-radius: 12px !important;
    box-shadow: none !important;
    background: var(--white);
}
.card-header { background: var(--white) !important; }
.kpi-tile { border-left: 4px solid var(--blue); }

/* ── BOTONES ── */
.btn-primary { background: var(--blue); border-color: var(--blue); font-weight: 700; }
.btn-primary:hover { background: #3d7db2; border-color: #3d7db2; }

/* ── TOOLTIPS invertidos (blanco con texto oscuro) ── */
.tooltip {
    --bs-tooltip-bg: #fff;
    --bs-tooltip-color: var(--text);
    --bs-tooltip-opacity: 1;
    --bs-tooltip-font-size: .78rem;
    --bs-tooltip-padding-x: .55rem;
    --bs-tooltip-padding-y: .35rem;
}
.tooltip-inner {
    font-weight: 500;
    border: 1px solid var(--border);
    box-shadow: 0 6px 16px rgba(0,0,0,.12);
    white-space: pre-line;   /* respeta los saltos de línea del title */
    text-align: left;
    max-width: 340px;
    line-height: 1.35;
}

/* ── FORMULARIOS (compactos-medios global) ── */
.form-control,
.form-select {
    padding: .42rem .7rem;
    font-size: .9rem;
    line-height: 1.4;
    min-height: auto;
    border-radius: 6px;
    font-variant-ligatures: none;
    font-feature-settings: "liga" 0;
}
.form-control-sm,
.form-select-sm {
    padding: .28rem .55rem;
    font-size: .82rem;
}
.form-control-plaintext {
    padding: .3rem 0;
    font-size: .9rem;
}
textarea.form-control { min-height: auto; }
input[type="color"].form-control,
input.form-control-color {
    padding: 2px;
    width: 42px;
    min-height: 34px;
    height: 34px;
    border-radius: 6px;
}
input[type="time"].form-control,
input[type="date"].form-control,
input[type="number"].form-control { font-variant-numeric: tabular-nums; }
.form-check-input { margin-top: .2em; }
.form-check-label { font-size: .88rem; }
.form-label {
    font-weight: 700;
    font-size: .8rem;
    margin-bottom: .3rem;
    color: var(--text);
    text-transform: none;
}
.form-text { font-size: .74rem; }

.form-control:focus, .form-select:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(81,151,209,.15);
}

/* Placeholders muy suaves */
.form-control::placeholder,
.form-select::placeholder,
textarea.form-control::placeholder {
    color: #c8cdd6;
    opacity: 1;
    font-weight: 400;
}

/* ── LISTADOS (texto más suave) ── */
:root {
    --list-text:   #566274;
    --list-strong: #364052;
}
.table {
    --bs-table-color: var(--list-text);
    color: var(--list-text);
    font-size: .88rem;
}
.table thead th {
    font-size: .72rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .05em;
    color: var(--text-muted);
    background: #F9FAFB;
}
.table td { vertical-align: middle; color: var(--list-text); }
.table td.fw-semibold,
.table td .fw-semibold,
.table td.fw-bold,
.table td .fw-bold {
    color: var(--list-strong);
    font-weight: 600 !important;
}
.table a { color: var(--list-strong); text-decoration: none; }
.table a:hover { color: var(--blue); }
.table .text-muted { color: #8792a4 !important; }

/* Tablas dentro de una tarjeta: la primera y la última columna llevan el mismo margen lateral que
   la tarjeta. Sin esto el texto queda pegado al borde y la lista parece cortada. */
.card .table > :not(caption) > * > *:first-child { padding-left: var(--bs-card-spacer-x, 1rem); }
.card .table > :not(caption) > * > *:last-child { padding-right: var(--bs-card-spacer-x, 1rem); }
/* Si la tabla ya va dentro de un cuerpo con su propio margen, se queda como estaba */
.card .card-body:not(.p-0) .table > :not(caption) > * > * { padding-left: .5rem; padding-right: .5rem; }
.card .card-body:not(.p-0) .table-sm > :not(caption) > * > * { padding-left: .25rem; padding-right: .25rem; }

/* ── MÓVIL ── */
@media (max-width: 900px) {
    #sidebar { transform: translateX(-100%); transition: transform .2s; }
    #sidebar.open { transform: translateX(0); }
    #topbar { left: 0; }
    #main-content { margin-left: 0; }
    #topbar .menu-toggle { display: inline-flex; }
}

/* ─── Pestañas modernas (píldoras con icono) ─────────────── */
.cs-tabs {
    display: inline-flex; flex-wrap: wrap;
    gap: 6px;
    padding: 6px;
    background: var(--bg, #f4f6f8);
    border-radius: 999px;
    border: 1px solid var(--border, #e6e8eb);
}
.cs-tab {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 9px 18px;
    border-radius: 999px;
    color: var(--text-muted, #637282);
    font-weight: 600;
    font-size: .92rem;
    text-decoration: none;
    background: transparent;
    border: 1.5px solid transparent;
    transition: background .15s, color .15s, box-shadow .15s, transform .1s;
    cursor: pointer;
    white-space: nowrap;
    line-height: 1.1;
}
.cs-tab:hover { color: var(--text, #1f2937); background: #fff; }
.cs-tab.active {
    background: var(--blue, #478ac9);
    color: #fff;
    box-shadow: 0 6px 14px -6px rgba(71, 138, 201, 0.6);
}
.cs-tab.active:hover { color: #fff; }
.cs-tab i.bi { font-size: 1rem; opacity: .95; }
.cs-tab-badge {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 22px; height: 22px; padding: 0 7px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.25);
    color: inherit;
    font-size: .75rem; font-weight: 700;
    margin-left: 2px;
}
.cs-tab:not(.active) .cs-tab-badge {
    background: var(--blue-light, #e8f2fb);
    color: var(--blue, #478ac9);
}
.cs-tab-hint {
    font-size: .7rem; font-weight: 600;
    opacity: .75;
    letter-spacing: 0.02em;
    padding: 2px 6px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.2);
    margin-left: 4px;
}
.cs-tab:not(.active) .cs-tab-hint {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-muted, #637282);
}
/* Variante compacta (para modals) */
.cs-tabs-sm { gap: 4px; padding: 4px; }
.cs-tabs-sm .cs-tab { padding: 7px 14px; font-size: .86rem; }
.cs-tabs-sm .cs-tab i.bi { font-size: .95rem; }

@media (max-width: 640px) {
    .cs-tabs { width: 100%; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
    .cs-tabs::-webkit-scrollbar { display: none; }
    .cs-tab { flex-shrink: 0; }
}

/* Nav item destacado (Planes y créditos IA) */
#sidebar nav a.nav-highlight {
    background: linear-gradient(90deg, rgba(71,138,201,0.16), rgba(71,138,201,0.05));
    border-left: 3px solid var(--blue, #478ac9);
    color: var(--blue, #478ac9);
    font-weight: 700;
}
#sidebar nav a.nav-highlight:hover { background: rgba(71,138,201,0.22); color: var(--blue, #478ac9); }
#sidebar nav a.nav-highlight .bi { color: var(--blue, #478ac9); }

/* ShopSolver: marca en texto mientras no hay logotipo */
.sidebar-brand-text { font-weight: 800; font-size: 18px; color: var(--text); text-decoration: none; display: flex; align-items: center; gap: 8px; }
.sidebar-brand-text .bi { color: var(--blue); }
.login-brand { font-weight: 800; font-size: 24px; margin-bottom: 4px; }
.login-brand .bi { color: var(--blue); }

/* Selector de imágenes compartido */
.ssm-drop{border:2px dashed var(--border);border-radius:8px;padding:18px;text-align:center;color:var(--text-muted);cursor:pointer;transition:all .15s}
.ssm-drop.over{border-color:var(--blue);background:var(--blue-light);color:var(--blue)}
.ssm-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(110px,1fr));gap:10px;max-height:50vh;overflow:auto}
.ssm-item{position:relative;border-radius:8px;overflow:hidden;border:3px solid transparent;cursor:pointer;background:#f3f4f6}
.ssm-item img,.ssm-item video{width:100%;aspect-ratio:1;object-fit:cover;display:block;background:#111}
.pi-item video{width:100%;aspect-ratio:1;object-fit:cover;display:block;background:#111}
.pi-play{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;pointer-events:none;color:#fff;font-size:22px;text-shadow:0 1px 4px rgba(0,0,0,.6)}
.ssm-play{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;pointer-events:none}
.ssm-play i{font-size:26px;color:#fff;background:rgba(0,0,0,.55);border-radius:50%;width:40px;height:40px;
  display:flex;align-items:center;justify-content:center}
.ssm-item.sel{border-color:var(--blue)}
.ssm-check{position:absolute;top:6px;right:6px;background:var(--blue);color:#fff;border-radius:50%;width:22px;height:22px;display:flex;align-items:center;justify-content:center;font-size:13px}
.ss-imgfield{display:flex;gap:10px;align-items:center}
.ss-imgfield img{width:64px;height:64px;object-fit:cover;border-radius:6px;border:1px solid var(--border);background:#f3f4f6}
.ss-imgfield .ph{width:64px;height:64px;border-radius:6px;border:1px dashed var(--border);background:#fafbfc}

/* Selector de color con su casilla para escribirlo en hexadecimal */
.ss-hexbox{display:flex;align-items:center;gap:6px;width:100%}
.ss-hexbox input[type=color]{flex:0 0 38px;width:38px;min-width:38px;max-width:38px;cursor:pointer}
.ss-hexbox .ss-hex{flex:1 1 0;width:auto;min-width:0;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;
  font-size:12px;text-transform:lowercase;height:34px}
/* Siempre en la misma línea, también en paneles estrechos */
.ss-hexbox{flex-wrap:nowrap}
/* En Diseño los colores iban de tres en tres; con la casilla al lado caben mejor de dos en dos */
.dz-colors{grid-template-columns:repeat(2,1fr)}
/* Rejilla del selector de iconos (componente compartido) */
.ssi-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(84px,1fr));gap:6px}
.ssi-grid button{display:flex;flex-direction:column;align-items:center;gap:4px;padding:10px 4px;
  border:1px solid var(--border,#e5e7eb);background:#fff;border-radius:8px;cursor:pointer;
  font-size:10px;color:var(--text-muted,#6b7280);overflow:hidden}
.ssi-grid button:hover{border-color:var(--blue,#0d6efd);color:var(--blue,#0d6efd)}
.ssi-grid svg{width:22px;height:22px;flex:0 0 auto}
.ssi-grid span{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
/* Campo de icono en la pantalla de Diseño */
.dz-ico{display:flex;align-items:center;gap:8px}
.dz-ico .dz-ico-v svg{width:20px;height:20px;color:var(--blue,#0d6efd)}
.dz-ico .dz-ico-n{font-size:11px;color:var(--text-muted,#6b7280);flex:1 1 auto;min-width:0;
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
