/* TORCH AI DESK - tema oscuro por defecto, claro con data-theme="light" */
:root, [data-theme="dark"] {
    --bg: #0f1115;
    --bg-panel: #171a21;
    --bg-hover: #1f232d;
    --text: #e6e8ee;
    --text-secondary: #9aa0ad;
    --accent: #ff6a2b;
    --accent-2: #ffb347;
    --border: #262b36;
    --star: #ffc93c;
}
[data-theme="light"] {
    --bg: #f4f5f7;
    --bg-panel: #ffffff;
    --bg-hover: #eceef2;
    --text: #1c1e24;
    --text-secondary: #5d6370;
    --accent: #e04e12;
    --accent-2: #b96a00;
    --border: #d8dce3;
    --star: #c98a00;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}
.mono { font-family: Consolas, "Courier New", monospace; }

/* ---------- navbar ---------- */
.navbar-torch {
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border);
}
.brand-torch { color: var(--accent); }
.torch-search { width: min(480px, 40vw); }

/* ---------- sidebar ---------- */
.sidebar {
    background: var(--bg-panel);
    border-right: 1px solid var(--border);
    min-height: calc(100vh - 56px);
    position: sticky;
    top: 56px;
}
.side-link {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .45rem .9rem;
    color: var(--text);
    text-decoration: none;
    border-radius: 6px;
    margin: 1px 6px;
    font-size: .93rem;
}
.side-link:hover { background: var(--bg-hover); color: var(--accent); }
.side-sub { padding-left: 1.6rem; font-size: .88rem; color: var(--text-secondary); }
.side-section {
    margin: .9rem .9rem .2rem;
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    padding-bottom: .25rem;
}
.disabled-link { opacity: .55; cursor: default; }
.tag-soon {
    font-size: .65rem;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0 6px;
}
.count-badge {
    margin-left: auto;
    font-size: .7rem;
    background: var(--bg-hover);
    border-radius: 8px;
    padding: 0 7px;
    color: var(--text-secondary);
}
.bg-torch { background: var(--accent); }

/* ---------- main ---------- */
.main-area { min-height: calc(100vh - 56px); }
.panel-card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
}
.btn-torch {
    background: var(--accent);
    color: #fff;
    border: none;
}
.btn-torch:hover { background: var(--accent-2); color: #1c1e24; }

.stat-card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem 1.1rem;
}
.stat-value { font-size: 1.5rem; font-weight: 700; }
.stat-label { color: var(--text-secondary); font-size: .82rem; }
.stat-error { border-color: #dc3545; }
.stat-error .stat-value { color: #dc3545; }

/* ---------- bandeja ---------- */
.conv-row { cursor: pointer; }
.conv-table tbody tr:hover { background: var(--bg-hover); }
.star { color: var(--star); }
.star-btn {
    background: none; border: none; color: var(--star);
    font-size: 1.05rem; padding: 0 .25rem;
}
.proj-badge { background: #3a4152; color: #cfd6e4; }
.mode-badge { background: transparent; border: 1px solid var(--border); color: var(--text-secondary); }
.status-nueva { background: #0d6efd; }
.status-en_proceso { background: #b96a00; }
.status-respondida { background: #198754; }
.status-archivada { background: #6c757d; }
.status-error { background: #dc3545; }

/* ---------- mensajes ---------- */
.messages-area { max-height: 60vh; overflow-y: auto; }
.msg { margin-bottom: 1rem; padding: .7rem .9rem; border-radius: 8px; border: 1px solid var(--border); }
.msg-user { background: rgba(255, 106, 43, .08); }
.msg-assistant { background: var(--bg-hover); }
.msg-head {
    display: flex; justify-content: space-between;
    font-size: .78rem; color: var(--text-secondary); margin-bottom: .35rem;
}
.msg-who { font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.msg-body { white-space: pre-wrap; font-size: .93rem; }

.table-dark-tech { color: var(--text); }
.table-dark-tech th { color: var(--text-secondary); font-weight: 600; }
.accordion-item { background: var(--bg-panel); color: var(--text); }
.accordion-button {
    background: var(--bg-panel); color: var(--text);
    box-shadow: none;
}
.accordion-button:not(.collapsed) { background: var(--bg-hover); color: var(--accent); }
.accordion-button::after { filter: invert(1); }
[data-theme="light"] .accordion-button::after { filter: none; }

/* ---------- login ---------- */
.login-wrap {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg);
}
.login-card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2rem;
    width: min(400px, 92vw);
}
.empty-state { text-align: center; color: var(--text-secondary); padding: 2rem; }

.form-control, .form-select {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
}
.form-control:focus, .form-select:focus {
    background: var(--bg);
    color: var(--text);
    border-color: var(--accent);
    box-shadow: 0 0 0 .2rem rgba(255, 106, 43, .25);
}
.form-control::placeholder { color: var(--text-secondary); }

.list-group-item { background: transparent; color: var(--text); border-color: var(--border); }

@media (max-width: 767px) {
    .sidebar { min-height: auto; position: static; }
    .torch-search { width: auto; flex-grow: 1; }
}
