/* ============================================================
   GOETIA — IA Esotérica · Hoja de estilos
   Tema: noche mística — índigo profundo, violeta y oro
   ============================================================ */

:root {
    --bg:          #0d0a1a;
    --bg-soft:     #14102a;
    --bg-raise:    #1b1536;
    --bg-hover:    #241c46;
    --line:        #2c2352;
    --text:        #e8e3f5;
    --text-dim:    #9d93bd;
    --text-faint:  #6d6390;
    --gold:        #d9b45b;
    --gold-soft:   #e8d48b;
    --violet:      #8b6fd8;
    --violet-soft: #b28dff;
    --danger:      #e0605a;
    --ok:          #58c88f;
    --radius:      14px;
    --sidebar-w:   292px;
    --font-body:   'Inter', system-ui, -apple-system, sans-serif;
    --font-title:  'Cinzel', serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.55;
    overflow: hidden;
}

body::before { /* nebulosa de fondo */
    content: '';
    position: fixed; inset: 0;
    background:
        radial-gradient(ellipse 55% 40% at 75% 8%,  rgba(139,111,216,.14), transparent),
        radial-gradient(ellipse 45% 35% at 15% 90%, rgba(217,180,91,.07),  transparent),
        radial-gradient(ellipse 60% 50% at 50% 50%, rgba(30,20,70,.35),    transparent);
    pointer-events: none;
    z-index: 0;
}

button { font-family: inherit; cursor: pointer; }
textarea, input, select { font-family: inherit; font-size: inherit; }
[hidden] { display: none !important; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #3b2f6e; }

/* ============================ Estructura ============================ */

.app {
    position: relative;
    display: flex;
    height: 100dvh;
    z-index: 1;
}

/* ---------- barra lateral ---------- */

.sidebar {
    width: var(--sidebar-w);
    min-width: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    background: rgba(15, 11, 32, .92);
    border-right: 1px solid var(--line);
    backdrop-filter: blur(8px);
    z-index: 40;
}

.sidebar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 18px 10px;
}

.logo { height: 46px; filter: drop-shadow(0 0 12px rgba(178,141,255,.35)); }

.sidebar-close { display: none; }

.btn-new {
    margin: 10px 14px 6px;
    padding: 11px 16px;
    border: 1px solid var(--gold);
    border-radius: var(--radius);
    background: linear-gradient(135deg, rgba(217,180,91,.16), rgba(217,180,91,.05));
    color: var(--gold-soft);
    font-weight: 600;
    font-size: 14px;
    letter-spacing: .3px;
    transition: all .18s;
}
.btn-new:hover { background: rgba(217,180,91,.22); box-shadow: 0 0 18px rgba(217,180,91,.18); }

.sidebar-scroll { flex: 1; overflow-y: auto; padding: 6px 8px 10px; }

.side-section { margin-top: 12px; }

.side-title {
    font-family: var(--font-title);
    font-size: 11px;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    color: var(--text-faint);
    padding: 4px 12px 6px;
}

.mancia-list, .conv-list { list-style: none; }

.mancia-item, .conv-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 10px;
    color: var(--text-dim);
    font-size: 14px;
    cursor: pointer;
    transition: background .15s, color .15s;
    user-select: none;
}
.mancia-item:hover, .conv-item:hover { background: var(--bg-hover); color: var(--text); }
.mancia-item.active, .conv-item.active { background: var(--bg-raise); color: var(--text); }
.mancia-item.active { box-shadow: inset 2px 0 0 var(--m-color, var(--violet)); }

.mancia-ico {
    width: 26px; height: 26px;
    display: grid; place-items: center;
    font-size: 15px;
    border-radius: 8px;
    background: rgba(255,255,255,.05);
    flex-shrink: 0;
}

.conv-item { justify-content: space-between; }
.conv-item .conv-label {
    display: flex; align-items: center; gap: 8px;
    overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
    flex: 1; min-width: 0;
}
.conv-item .conv-label span:last-child { overflow: hidden; text-overflow: ellipsis; }
.conv-item .conv-del {
    opacity: 0;
    background: none; border: none;
    color: var(--text-faint);
    font-size: 13px;
    padding: 2px 5px;
    border-radius: 6px;
    transition: opacity .15s, color .15s;
    flex-shrink: 0;
}
.conv-item:hover .conv-del { opacity: 1; }
.conv-item .conv-del:hover { color: var(--danger); }

.conv-empty { padding: 6px 12px; color: var(--text-faint); font-size: 13px; font-style: italic; }

.sidebar-foot {
    border-top: 1px solid var(--line);
    padding: 10px 14px 14px;
}

.profile-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: none;
    border: none;
    border-radius: 10px;
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
    transition: background .15s;
}
.profile-btn:hover { background: var(--bg-hover); }

.avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    display: grid; place-items: center;
    background: linear-gradient(135deg, var(--violet), #5a3fa8);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .5px;
    flex-shrink: 0;
}

.profile-name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

.status-row {
    display: flex; align-items: center; gap: 7px;
    margin-top: 8px;
    padding: 0 10px;
    font-size: 11.5px;
    color: var(--text-faint);
}
.status-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--text-faint);
    flex-shrink: 0;
}
.status-dot.on  { background: var(--ok);     box-shadow: 0 0 8px rgba(88,200,143,.6); }
.status-dot.off { background: var(--danger); box-shadow: 0 0 8px rgba(224,96,90,.6); }

.sidebar-backdrop {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.55);
    z-index: 35;
}

/* ---------- zona principal ---------- */

.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    position: relative;
}

.topbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    border-bottom: 1px solid var(--line);
    background: rgba(13,10,26,.7);
    backdrop-filter: blur(6px);
    min-height: 56px;
}

.icon-btn {
    background: none;
    border: 1px solid transparent;
    color: var(--text-dim);
    font-size: 17px;
    padding: 6px 10px;
    border-radius: 10px;
    transition: all .15s;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }

#btnMenu { display: none; }

.topbar-mancia {
    display: flex; align-items: center; gap: 10px;
    font-family: var(--font-title);
    font-size: 16px;
    letter-spacing: 1.5px;
    color: var(--gold-soft);
}
.topbar-mancia .tm-ico { font-size: 20px; }
.topbar-mancia .tm-desc {
    font-family: var(--font-body);
    font-size: 12.5px;
    letter-spacing: 0;
    color: var(--text-faint);
    margin-left: 4px;
}

/* ---------- chat ---------- */

.chat-area { flex: 1; overflow: hidden; position: relative; }

.chat-scroll {
    height: 100%;
    overflow-y: auto;
    padding: 26px 18px 10px;
    scroll-behavior: smooth;
}

.chat-inner { max-width: 860px; margin: 0 auto; }

.msg { display: flex; gap: 12px; margin-bottom: 22px; animation: fadeUp .25s ease; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.msg-avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    display: grid; place-items: center;
    font-size: 16px;
    flex-shrink: 0;
    margin-top: 2px;
}
.msg.user .msg-avatar { background: linear-gradient(135deg, #3d3168, #292050); font-size: 12px; font-weight: 700; color: var(--violet-soft); }
.msg.assistant .msg-avatar {
    background: radial-gradient(circle at 35% 30%, #43317e, #201743);
    border: 1px solid var(--line);
    box-shadow: 0 0 14px rgba(139,111,216,.25);
}

.msg-body { flex: 1; min-width: 0; }
.msg-name { font-size: 12px; font-weight: 600; color: var(--text-faint); margin-bottom: 4px; letter-spacing: .4px; }
.msg.assistant .msg-name { color: var(--gold); font-family: var(--font-title); letter-spacing: 1.5px; }

.msg-content { word-wrap: break-word; overflow-wrap: break-word; }
.msg.user .msg-content {
    background: var(--bg-raise);
    border: 1px solid var(--line);
    border-radius: 4px 16px 16px 16px;
    padding: 10px 14px;
    display: inline-block;
    max-width: 100%;
    white-space: pre-wrap;
}

/* markdown de la respuesta */
.msg-content h1, .msg-content h2, .msg-content h3 {
    font-family: var(--font-title);
    color: var(--gold-soft);
    margin: 14px 0 6px;
    letter-spacing: 1px;
    line-height: 1.3;
}
.msg-content h1 { font-size: 19px; } .msg-content h2 { font-size: 17px; } .msg-content h3 { font-size: 15.5px; }
.msg-content p { margin: 7px 0; }
.msg-content ul, .msg-content ol { margin: 7px 0 7px 22px; }
.msg-content li { margin: 3px 0; }
.msg-content strong { color: var(--gold-soft); font-weight: 600; }
.msg-content em { color: var(--violet-soft); }
.msg-content blockquote {
    border-left: 3px solid var(--violet);
    padding: 4px 14px;
    margin: 8px 0;
    color: var(--text-dim);
    font-style: italic;
    background: rgba(139,111,216,.06);
    border-radius: 0 8px 8px 0;
}
.msg-content code {
    background: var(--bg-raise);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 1px 6px;
    font-size: 13px;
}
.msg-content pre {
    background: var(--bg-raise);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 12px;
    overflow-x: auto;
    margin: 8px 0;
}
.msg-content pre code { background: none; border: none; padding: 0; }
.msg-content hr { border: none; border-top: 1px solid var(--line); margin: 12px 0; }
.msg-content table { border-collapse: collapse; margin: 10px 0; width: 100%; font-size: 14px; }
.msg-content th, .msg-content td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; }
.msg-content th { background: var(--bg-raise); color: var(--gold-soft); }

/* cursor de escritura */
.typing-cursor {
    display: inline-block;
    width: 8px; height: 15px;
    background: var(--violet-soft);
    border-radius: 2px;
    vertical-align: text-bottom;
    animation: blink .8s infinite;
    margin-left: 2px;
}
@keyframes blink { 50% { opacity: .15; } }

/* indicador "consultando" */
.thinking {
    display: inline-flex; gap: 5px; align-items: center;
    color: var(--text-dim); font-size: 14px; font-style: italic;
}
.thinking .orb {
    width: 9px; height: 9px; border-radius: 50%;
    background: var(--violet-soft);
    animation: orbPulse 1.2s ease-in-out infinite;
}
.thinking .orb:nth-child(2) { animation-delay: .2s; }
.thinking .orb:nth-child(3) { animation-delay: .4s; }
@keyframes orbPulse { 0%,100% { opacity: .25; transform: scale(.8); } 50% { opacity: 1; transform: scale(1.15); } }

/* chip de derivación a mancia */
.route-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding: 9px 16px;
    border-radius: 999px;
    border: 1px solid var(--m-color, var(--gold));
    background: rgba(217,180,91,.08);
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
    transition: all .18s;
}
.route-chip:hover { background: rgba(217,180,91,.18); transform: translateY(-1px); box-shadow: 0 4px 14px rgba(0,0,0,.3); }

/* ---------- pantalla vacía (héroe) ---------- */

.hero { text-align: center; padding: 42px 16px 24px; }
.hero-ico {
    font-size: 46px;
    display: inline-grid; place-items: center;
    width: 92px; height: 92px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, var(--bg-hover), var(--bg-soft));
    border: 1px solid var(--line);
    box-shadow: 0 0 34px rgba(139,111,216,.25);
    margin-bottom: 16px;
}
.hero-title {
    font-family: var(--font-title);
    font-size: 26px;
    letter-spacing: 3px;
    color: var(--gold-soft);
}
.hero-sub { color: var(--text-dim); margin-top: 8px; max-width: 480px; margin-inline: auto; }

.sugg-row {
    display: flex; flex-wrap: wrap; gap: 10px;
    justify-content: center;
    margin-top: 22px;
}
.sugg-chip {
    padding: 9px 16px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--bg-soft);
    color: var(--text-dim);
    font-size: 13.5px;
    transition: all .18s;
}
.sugg-chip:hover { border-color: var(--violet); color: var(--text); background: var(--bg-raise); }

/* rejilla de mancias en el inicio */
.mancia-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    margin-top: 30px;
    text-align: left;
}
.mancia-card {
    border: 1px solid var(--line);
    background: linear-gradient(160deg, var(--bg-raise), var(--bg-soft));
    border-radius: var(--radius);
    padding: 15px 15px 13px;
    cursor: pointer;
    transition: all .18s;
    position: relative;
    overflow: hidden;
}
.mancia-card::after {
    content: '';
    position: absolute; inset: 0 0 auto 0; height: 2px;
    background: var(--m-color, var(--violet));
    opacity: .65;
}
.mancia-card:hover {
    transform: translateY(-3px);
    border-color: var(--m-color, var(--violet));
    box-shadow: 0 8px 22px rgba(0,0,0,.35);
}
.mancia-card .mc-ico { font-size: 24px; }
.mancia-card .mc-name { font-family: var(--font-title); font-size: 14.5px; letter-spacing: 1px; margin-top: 8px; color: var(--text); }
.mancia-card .mc-desc { font-size: 12.5px; color: var(--text-faint); margin-top: 4px; line-height: 1.4; }

/* ---------- formulario intake en el chat ---------- */

.intake-bubble {
    background: var(--bg-raise);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 14px 16px;
    max-width: 460px;
}
.intake-bubble .ib-title { font-weight: 600; margin-bottom: 4px; color: var(--gold-soft); }
.intake-bubble .ib-sub { font-size: 13px; color: var(--text-dim); margin-bottom: 12px; }
.intake-field { margin-bottom: 10px; }
.intake-field label { display: block; font-size: 12.5px; color: var(--text-dim); margin-bottom: 4px; }
.intake-actions { display: flex; gap: 10px; margin-top: 12px; }

/* ---------- redactor ---------- */

.composer-wrap { padding: 8px 18px 14px; }

.composer {
    max-width: 860px;
    margin: 0 auto;
    display: flex;
    align-items: flex-end;
    gap: 10px;
    background: var(--bg-raise);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 10px 10px 10px 18px;
    transition: border-color .2s, box-shadow .2s;
}
.composer:focus-within {
    border-color: var(--violet);
    box-shadow: 0 0 0 3px rgba(139,111,216,.14), 0 0 24px rgba(139,111,216,.10);
}

.composer textarea {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    resize: none;
    color: var(--text);
    font-size: 15px;
    line-height: 1.5;
    max-height: 180px;
    padding: 4px 0;
}
.composer textarea::placeholder { color: var(--text-faint); }

.send-btn {
    width: 40px; height: 40px;
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, var(--violet), #6748c0);
    color: #fff;
    display: grid; place-items: center;
    transition: all .18s;
    flex-shrink: 0;
}
.send-btn:hover:not(:disabled) { filter: brightness(1.15); box-shadow: 0 0 16px rgba(139,111,216,.4); }
.send-btn:disabled { opacity: .35; cursor: default; }
.send-btn.stop { background: linear-gradient(135deg, #a44743, #7e332f); }

.composer-note {
    text-align: center;
    font-size: 11px;
    color: var(--text-faint);
    margin-top: 8px;
}

/* ============================ Onboarding ============================ */

.onboarding {
    position: fixed; inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(ellipse 60% 45% at 70% 10%, rgba(139,111,216,.18), transparent),
        radial-gradient(ellipse 50% 40% at 20% 85%, rgba(217,180,91,.08), transparent),
        var(--bg);
    z-index: 100;
    padding: 18px;
}

.stars { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.stars i {
    position: absolute;
    width: 2px; height: 2px;
    background: #fff;
    border-radius: 50%;
    opacity: .5;
    animation: twinkle 3s infinite;
}
@keyframes twinkle { 50% { opacity: .08; } }

.onboard-card {
    width: 100%;
    max-width: 520px;
    max-height: 92dvh;
    display: flex;
    flex-direction: column;
    background: rgba(20,16,42,.88);
    border: 1px solid var(--line);
    border-radius: 22px;
    padding: 28px 26px 22px;
    box-shadow: 0 18px 60px rgba(0,0,0,.5), 0 0 40px rgba(139,111,216,.12);
    backdrop-filter: blur(10px);
    position: relative;
    z-index: 2;
}

.onboard-logo {
    height: 60px;
    align-self: center;
    margin-bottom: 18px;
    filter: drop-shadow(0 0 16px rgba(178,141,255,.4));
}

.onboard-chat {
    flex: 1;
    overflow-y: auto;
    min-height: 200px;
    max-height: 46dvh;
    padding-right: 6px;
}

.ob-msg {
    background: var(--bg-raise);
    border: 1px solid var(--line);
    border-radius: 4px 16px 16px 16px;
    padding: 11px 15px;
    margin-bottom: 12px;
    max-width: 92%;
    animation: fadeUp .3s ease;
    font-size: 14.5px;
}
.ob-msg.user {
    margin-left: auto;
    border-radius: 16px 4px 16px 16px;
    background: linear-gradient(135deg, rgba(139,111,216,.25), rgba(139,111,216,.12));
    border-color: #45387c;
}

.onboard-input { margin-top: 14px; }

.ob-row { display: flex; gap: 10px; }
.ob-row input {
    flex: 1;
    background: var(--bg-raise);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 11px 14px;
    color: var(--text);
    outline: none;
    transition: border-color .2s;
    min-width: 0;
}
.ob-row input:focus { border-color: var(--violet); }
input[type="date"], input[type="time"] { color-scheme: dark; }

.ob-options { display: flex; flex-wrap: wrap; gap: 10px; }
.ob-opt {
    padding: 10px 18px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--bg-raise);
    color: var(--text);
    font-size: 14px;
    transition: all .15s;
}
.ob-opt:hover { border-color: var(--gold); color: var(--gold-soft); }

.btn-primary {
    padding: 11px 22px;
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, var(--violet), #6748c0);
    color: #fff;
    font-weight: 600;
    font-size: 14px;
    transition: all .18s;
}
.btn-primary:hover { filter: brightness(1.12); box-shadow: 0 0 18px rgba(139,111,216,.35); }
.btn-primary:disabled { opacity: .4; cursor: default; }

.btn-ghost {
    padding: 11px 18px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: none;
    color: var(--text-dim);
    font-size: 14px;
    transition: all .15s;
}
.btn-ghost:hover { color: var(--text); border-color: var(--text-faint); }

.ob-error { color: var(--danger); font-size: 12.5px; margin-top: 8px; }

/* ============================ Modal perfil ============================ */

.modal {
    position: fixed; inset: 0;
    background: rgba(5,3,14,.72);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 90;
    padding: 18px;
    backdrop-filter: blur(4px);
}

.modal-box {
    width: 100%;
    max-width: 560px;
    max-height: 90dvh;
    display: flex;
    flex-direction: column;
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: 20px;
    box-shadow: 0 20px 70px rgba(0,0,0,.6);
    animation: fadeUp .22s ease;
}

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px 12px;
    border-bottom: 1px solid var(--line);
}
.modal-head h2 {
    font-family: var(--font-title);
    font-size: 17px;
    letter-spacing: 2px;
    color: var(--gold-soft);
}

.modal-body { padding: 18px 22px 22px; overflow-y: auto; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-field { display: flex; flex-direction: column; gap: 5px; }
.form-field.full { grid-column: 1 / -1; }
.form-field label { font-size: 12.5px; color: var(--text-dim); }
.form-field input, .form-field select {
    background: var(--bg-raise);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px 12px;
    color: var(--text);
    outline: none;
    transition: border-color .2s;
    width: 100%;
}
.form-field input:focus, .form-field select:focus { border-color: var(--violet); }

.profile-meta {
    display: flex; gap: 14px; flex-wrap: wrap;
    margin: 4px 0 14px;
    font-size: 13px; color: var(--text-dim);
}
.profile-meta b { color: var(--gold-soft); font-weight: 600; }

.attrs-title {
    font-family: var(--font-title);
    font-size: 12px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--text-faint);
    margin: 22px 0 4px;
}
.attrs-sub { font-size: 12.5px; color: var(--text-faint); margin-bottom: 12px; }

.attr-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    margin-bottom: 8px;
    background: var(--bg-raise);
}
.attr-row .ar-label { font-size: 12.5px; color: var(--text-dim); min-width: 120px; }
.attr-row .ar-value { flex: 1; font-size: 14px; overflow: hidden; text-overflow: ellipsis; }
.attr-row .ar-del {
    background: none; border: none;
    color: var(--text-faint);
    padding: 4px 7px;
    border-radius: 6px;
    transition: color .15s;
}
.attr-row .ar-del:hover { color: var(--danger); }

.attr-add { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.attr-add input {
    background: var(--bg-raise);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 9px 12px;
    color: var(--text);
    outline: none;
}
.attr-add input:focus { border-color: var(--violet); }
.attr-add .ai-label { width: 170px; }
.attr-add .ai-value { flex: 1; min-width: 140px; }

.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

.save-note { color: var(--ok); font-size: 13px; margin-top: 10px; text-align: right; }

/* ==================== Acceso (elegir / login) ==================== */

.auth-title {
    font-family: var(--font-title);
    text-align: center;
    font-size: 19px;
    letter-spacing: 2px;
    color: var(--gold-soft);
    margin-bottom: 6px;
}
.auth-sub { text-align: center; color: var(--text-dim); font-size: 13.5px; margin-bottom: 20px; }

.auth-choice { display: flex; flex-direction: column; gap: 12px; }

.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-form input {
    background: var(--bg-raise);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px 14px;
    color: var(--text);
    outline: none;
    transition: border-color .2s;
}
.auth-form input:focus { border-color: var(--violet); }

.auth-alt { text-align: center; margin-top: 16px; font-size: 13px; color: var(--text-dim); }
.auth-alt a { color: var(--violet-soft); cursor: pointer; text-decoration: underline; }

.g-divider {
    display: flex; align-items: center; gap: 12px;
    margin: 18px 0 14px;
    color: var(--text-faint); font-size: 12px;
}
.g-divider::before, .g-divider::after {
    content: ''; flex: 1; height: 1px; background: var(--line);
}
.g-btn-wrap { display: flex; justify-content: center; min-height: 44px; }

/* ==================== Aviso de verificación ==================== */

.verify-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    padding: 9px 18px;
    background: linear-gradient(90deg, rgba(217,180,91,.14), rgba(217,180,91,.05));
    border-bottom: 1px solid rgba(217,180,91,.35);
    color: var(--gold-soft);
    font-size: 13px;
}
.vb-actions { display: flex; gap: 8px; align-items: center; }
.vb-btn {
    background: none;
    border: 1px solid var(--gold);
    color: var(--gold-soft);
    border-radius: 999px;
    padding: 4px 14px;
    font-size: 12.5px;
    text-decoration: none;
    transition: all .15s;
}
.vb-btn:hover { background: rgba(217,180,91,.15); }
.vb-dev { border-style: dashed; opacity: .85; }
.vb-note { color: var(--ok); }

/* ==================== Medidor de lecturas ==================== */

.usage-meter {
    width: 100%;
    background: var(--bg-raise);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 9px 12px 10px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: border-color .15s;
    text-align: left;
}
.usage-meter:hover { border-color: var(--violet); }
.um-row { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-dim); margin-bottom: 6px; }
.um-count { color: var(--text); font-weight: 600; }
.um-bar { height: 6px; border-radius: 6px; background: var(--bg); overflow: hidden; }
.um-fill {
    height: 100%;
    width: 0;
    border-radius: 6px;
    background: linear-gradient(90deg, var(--violet), var(--violet-soft));
    transition: width .4s ease;
}
.um-fill.warn { background: linear-gradient(90deg, #c98b3d, var(--gold)); }
.um-fill.full { background: linear-gradient(90deg, #a8433e, var(--danger)); }

.plan-chip {
    margin-left: auto;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .8px;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 999px;
    border: 1px solid var(--line);
    color: var(--text-faint);
    flex-shrink: 0;
}
.plan-chip.basic { border-color: var(--gold); color: var(--gold-soft); background: rgba(217,180,91,.1); }

/* ==================== Panel con pestañas ==================== */

.panel-tabs {
    display: flex;
    gap: 4px;
    padding: 10px 22px 0;
    border-bottom: 1px solid var(--line);
}
.ptab {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 13.5px;
    font-weight: 500;
    padding: 9px 14px;
    border-radius: 10px 10px 0 0;
    border-bottom: 2px solid transparent;
    transition: color .15s;
}
.ptab:hover { color: var(--text); }
.ptab.active { color: var(--gold-soft); border-bottom-color: var(--gold); }

/* --- tarjeta de plan --- */
.plan-card {
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 16px 18px;
    background: linear-gradient(160deg, var(--bg-raise), var(--bg-soft));
    margin-bottom: 14px;
}
.plan-card.premium { border-color: var(--gold); box-shadow: 0 0 22px rgba(217,180,91,.1); }
.pc-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.pc-name { font-family: var(--font-title); letter-spacing: 1.5px; color: var(--gold-soft); font-size: 15px; }
.pc-price { color: var(--text-dim); font-size: 13px; }
.pc-status { font-size: 12.5px; margin-top: 2px; }
.pc-status.ok { color: var(--ok); }
.pc-status.bad { color: var(--danger); }
.pc-usage { margin: 12px 0 4px; }
.pc-usage .um-bar { height: 8px; }
.pc-meta { font-size: 12.5px; color: var(--text-faint); margin-top: 8px; }

.plan-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 6px; }
.plan-option {
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 16px;
    text-align: center;
}
.plan-option.highlight { border-color: var(--gold); background: rgba(217,180,91,.06); }
.plan-option .po-name { font-family: var(--font-title); font-size: 14px; letter-spacing: 1px; color: var(--text); }
.plan-option .po-price { font-size: 20px; color: var(--gold-soft); margin: 8px 0 2px; font-weight: 700; }
.plan-option ul { list-style: none; margin: 10px 0; font-size: 12.5px; color: var(--text-dim); }
.plan-option li { margin: 5px 0; }

.billing-note {
    font-size: 12px;
    color: var(--text-faint);
    background: var(--bg-raise);
    border: 1px dashed var(--line);
    border-radius: 10px;
    padding: 10px 12px;
    margin-top: 12px;
    line-height: 1.5;
}

/* --- paywall --- */
.paywall-box { max-width: 520px; }
.paywall-msg { text-align: center; color: var(--text-dim); margin-bottom: 16px; }
.paywall-msg .pw-ico { font-size: 40px; display: block; margin-bottom: 8px; }

/* --- cuenta --- */
.account-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    margin-bottom: 10px;
    background: var(--bg-raise);
    flex-wrap: wrap;
}
.account-row .ac-label { font-size: 12.5px; color: var(--text-faint); }
.account-row .ac-value { font-size: 14px; }
.badge { font-size: 11px; padding: 3px 10px; border-radius: 999px; font-weight: 600; }
.badge.ok  { background: rgba(88,200,143,.12); color: var(--ok); border: 1px solid rgba(88,200,143,.4); }
.badge.warn{ background: rgba(217,180,91,.1);  color: var(--gold-soft); border: 1px solid rgba(217,180,91,.4); }

.btn-danger {
    padding: 10px 18px;
    border-radius: 12px;
    border: 1px solid rgba(224,96,90,.5);
    background: rgba(224,96,90,.08);
    color: var(--danger);
    font-size: 14px;
    transition: all .15s;
}
.btn-danger:hover { background: rgba(224,96,90,.16); }

.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-raise);
    border: 1px solid var(--gold);
    color: var(--gold-soft);
    padding: 12px 22px;
    border-radius: 999px;
    font-size: 14px;
    z-index: 200;
    box-shadow: 0 10px 34px rgba(0,0,0,.5);
    animation: fadeUp .25s ease;
}

/* ==================== Enlaces de pie e idioma ==================== */

.foot-links {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px 7px;
    padding: 8px 10px 0;
    font-size: 11px;
    color: var(--text-faint);
}
.foot-links a { color: var(--text-faint); text-decoration: none; transition: color .15s; }
.foot-links a:hover { color: var(--gold-soft); }
.foot-links i { font-style: normal; opacity: .5; }
.foot-links .fl-lang { margin-left: auto; display: flex; align-items: center; gap: 4px; }

.auth-foot { justify-content: center; margin-top: 18px; padding: 0; }

.lang-switch { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--text-faint); }
.lang-btn {
    background: none;
    border: none;
    color: var(--text-faint);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .8px;
    padding: 3px 6px;
    border-radius: 6px;
    transition: all .15s;
}
.lang-btn:hover { color: var(--text); background: var(--bg-hover); }
.lang-btn.on { color: var(--gold-soft); background: rgba(217,180,91,.1); }

.onboard-top { display: flex; align-items: center; justify-content: center; position: relative; margin-bottom: 18px; }
.onboard-top .onboard-logo { margin-bottom: 0; }
.onboard-top .lang-switch { position: absolute; right: 0; top: 0; }

/* ==================== Aviso de cookies ==================== */

.cookie-banner {
    position: fixed;
    left: 50%;
    bottom: 16px;
    transform: translateX(-50%);
    z-index: 150;
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    max-width: min(720px, calc(100vw - 24px));
    background: rgba(20,16,42,.97);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 14px 18px;
    box-shadow: 0 16px 50px rgba(0,0,0,.55), 0 0 30px rgba(139,111,216,.08);
    backdrop-filter: blur(10px);
    animation: fadeUp .3s ease;
}
.ck-text { flex: 1; min-width: 220px; font-size: 13px; color: var(--text-dim); line-height: 1.5; }
.ck-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ck-actions a { color: var(--text-faint); font-size: 12px; text-decoration: underline; }
.ck-actions a:hover { color: var(--text); }
.ck-btn { padding: 8px 18px !important; font-size: 13px !important; }

/* ==================== SEO (oculto visualmente, legible por bots) ==================== */

.seo-services {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ============================ Responsivo ============================ */

@media (max-width: 900px) {
    .sidebar {
        position: fixed;
        left: 0; top: 0; bottom: 0;
        transform: translateX(-105%);
        transition: transform .25s ease;
        box-shadow: 8px 0 40px rgba(0,0,0,.5);
    }
    .sidebar.open { transform: none; }
    .sidebar.open ~ .sidebar-backdrop, .sidebar-backdrop.show { display: block; }
    .sidebar-close { display: block; }
    #btnMenu { display: block; }
    .topbar-mancia .tm-desc { display: none; }
    .mancia-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
    .form-grid { grid-template-columns: 1fr; }
    .chat-scroll { padding: 18px 12px 8px; }
    .composer-wrap { padding: 6px 10px 10px; }
}

/* ============================================================
   Adjuntar foto de la palma
   ============================================================ */
.attach-btn {
    flex-shrink: 0;
    width: 40px; height: 40px;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: var(--bg-raise);
    color: var(--text-dim);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: color .2s, border-color .2s, box-shadow .2s;
}
.attach-btn:hover { color: var(--gold); border-color: var(--gold); box-shadow: 0 0 12px rgba(217,180,91,.25); }

.attach-preview {
    display: flex; align-items: center; gap: 10px;
    max-width: 760px; margin: 0 auto 8px;
    background: var(--bg-raise);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 8px 10px;
    font-size: 13px; color: var(--text-dim);
}
.attach-preview img {
    width: 44px; height: 44px; object-fit: cover;
    border-radius: 8px; border: 1px solid var(--line);
}
.attach-preview .icon-btn { margin-left: auto; }

.msg-image {
    display: block;
    max-width: min(280px, 70%);
    border-radius: 12px;
    border: 1px solid var(--line);
    margin: 4px 0 8px;
}

/* ============================================================
   Cartas visuales (tarot y baraja española)
   ============================================================ */
.card-spread {
    display: flex; flex-wrap: wrap; gap: 14px;
    margin: 14px 0;
    perspective: 900px;
}
.tcard {
    width: 108px; height: 168px;
    display: inline-block;
    animation: card-deal .7s cubic-bezier(.2,.7,.3,1.05) backwards;
}
.card-spread .tcard:nth-child(2) { animation-delay: .15s; }
.card-spread .tcard:nth-child(3) { animation-delay: .3s; }
.card-spread .tcard:nth-child(4) { animation-delay: .45s; }
.card-spread .tcard:nth-child(5) { animation-delay: .6s; }
@keyframes card-deal {
    0%   { transform: translateY(-14px) rotateY(180deg); opacity: 0; }
    55%  { opacity: 1; }
    100% { transform: translateY(0) rotateY(0); opacity: 1; }
}
.tcard-inner {
    width: 100%; height: 100%;
    display: flex; flex-direction: column; align-items: center; justify-content: space-between;
    padding: 8px 6px;
    border-radius: 10px;
    background:
        radial-gradient(ellipse at 50% 0%, rgba(217,180,91,.16), transparent 55%),
        linear-gradient(160deg, #1e1740, #14102a 60%, #191234);
    border: 1px solid rgba(217,180,91,.55);
    box-shadow: 0 4px 18px rgba(0,0,0,.45), inset 0 0 0 3px rgba(217,180,91,.12);
    text-align: center;
}
.tcard-top {
    font-family: var(--font-title);
    font-size: 13px; font-weight: 700;
    color: var(--gold);
    letter-spacing: .12em;
}
.tcard-glyph {
    font-size: 40px;
    line-height: 1;
    filter: drop-shadow(0 0 10px rgba(217,180,91,.35));
}
.tcard-name {
    font-family: var(--font-title);
    font-size: 10.5px; font-weight: 600;
    color: var(--gold-soft);
    line-height: 1.25;
    letter-spacing: .04em;
}
.tcard.rev .tcard-glyph { transform: rotate(180deg); }
.tcard.rev .tcard-inner { border-color: rgba(178,141,255,.6); }
.tcard-rev {
    font-size: 9px; font-weight: 600;
    letter-spacing: .14em; text-transform: uppercase;
    color: var(--violet-soft);
    border: 1px solid rgba(178,141,255,.4);
    border-radius: 20px;
    padding: 1px 8px;
}

/* ============================================================
   Portal diario (dashboard personalizado)
   ============================================================ */
.dash-hero .dash-greet { font-size: clamp(22px, 4vw, 30px); }
.dash-name { color: var(--gold); }

.daily-panel {
    max-width: 640px;
    margin: 18px auto 6px;
    text-align: left;
    background:
        radial-gradient(ellipse at 80% 0%, rgba(139,111,216,.12), transparent 60%),
        var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px 20px;
    box-shadow: 0 6px 24px rgba(0,0,0,.35);
}
.dp-loading { color: var(--text-dim); font-size: 14px; text-align: center; padding: 8px 0; }
.dp-head {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    font-family: var(--font-title);
    font-size: 13px; font-weight: 700;
    letter-spacing: .12em; text-transform: uppercase;
    color: var(--gold);
    margin-bottom: 10px;
}
.dp-sign { color: var(--violet-soft); letter-spacing: .06em; }
.dp-msg { font-size: 15px; line-height: 1.6; margin-bottom: 12px; }
.dp-rows { display: flex; flex-direction: column; gap: 7px; margin-bottom: 14px; }
.dp-row {
    display: flex; gap: 8px; align-items: baseline;
    font-size: 13.5px; color: var(--text-dim);
}
.dp-row b { color: var(--text); font-weight: 600; flex-shrink: 0; }
.dp-ico { flex-shrink: 0; }
.dp-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.dp-chip {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 12.5px;
    color: var(--text-dim);
    background: var(--bg-raise);
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 5px 12px;
}
.dp-swatch {
    width: 12px; height: 12px;
    border-radius: 50%;
    display: inline-block;
    border: 1px solid rgba(255,255,255,.25);
}
.dash-explore {
    margin-top: 26px;
    font-family: var(--font-title);
    font-size: 14px; font-weight: 600;
    letter-spacing: .08em;
    color: var(--text-dim);
}

/* ============================== invitaciones ============================== */
.inv-pill {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11.5px;
    background: rgba(139, 111, 216, .16);
    border: 1px solid var(--line);
    color: var(--violet-soft);
    white-space: nowrap;
}
.inv-pill.ok  { background: rgba(88, 200, 143, .14); color: var(--ok);     border-color: rgba(88, 200, 143, .35); }
.inv-pill.bad { background: rgba(224, 96, 90, .12);  color: var(--danger); border-color: rgba(224, 96, 90, .3); }

/* ===================== popups de interacción (nudges) ===================== */
.nudge-pop {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 300;
    max-width: min(370px, calc(100vw - 36px));
    animation: nudgeIn .45s cubic-bezier(.2, .9, .3, 1.2);
}
@keyframes nudgeIn {
    from { opacity: 0; transform: translateY(24px) scale(.96); }
    to   { opacity: 1; transform: none; }
}
.nudge-card {
    position: relative;
    background: linear-gradient(160deg, #1a1435, var(--bg-soft));
    border: 1px solid var(--gold);
    border-radius: 16px;
    padding: 20px 20px 16px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, .55);
}
.nudge-x {
    position: absolute;
    top: 8px;
    right: 8px;
}
.nudge-title {
    font-family: var(--font-title, Georgia, serif);
    color: var(--gold-soft);
    font-size: 15.5px;
    letter-spacing: .4px;
    margin-bottom: 8px;
    padding-right: 26px;
}
.nudge-body {
    font-size: 13.5px;
    line-height: 1.55;
    color: var(--text, #e8e3f5);
    margin-bottom: 14px;
}
.nudge-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.nudge-actions .btn-primary,
.nudge-actions .btn-ghost { font-size: 13px; padding: 9px 16px; }
