/* ============================================================
   MailPanel Pro - Estilos base (estructura)
   El tema visual se selecciona con data-tema en <html>
   Los temas estan en /assets/css/themes/*.css
   ============================================================ */

/* ---------- Reset y variables base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    background: var(--bg);
    color: var(--text);
    transition: background-color .25s ease, color .25s ease;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0 0 .5rem; font-weight: 600; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 .75rem; }

.muted { color: var(--muted); }
.empty { padding: 2rem; text-align: center; }

/* ---------- Variables base vienen del archivo de tema ----------
   Los temas en /themes/*.css definen:
   --bg, --bg-card, --bg-input, --bg-sidebar, --bg-topbar
   --text, --muted, --border, --accent, --accent-h, --accent-soft
   --ok, --warn, --err
   --shadow, --shadow-lg
   --radius, --radius-sm
   --font-body, --font-num
   --letter-spacing
*/

/* Auto: detecta el sistema para modo dia/noche (cuando data-theme no esta fijo) */
@media (prefers-color-scheme: dark) {
    [data-tema="clasico"]:not([data-theme="light"]):not([data-theme="dark"]),
    :root:not([data-theme="light"]):not([data-theme="dark"]) {
        --bg:        #0f1419;
        --bg-card:   #1a1f2c;
        --bg-input:  #242b3a;
        --bg-sidebar:#131822;
        --bg-topbar: #131822;
        --text:      #e5e7eb;
        --muted:     #9ca3af;
        --border:    #2a3142;
        --accent:    #818cf8;
        --accent-h:  #6366f1;
        --accent-soft: #1e1b4b;
        --ok:        #4ade80;
        --warn:      #fbbf24;
        --err:       #f87171;
        --shadow:    0 1px 2px rgba(0,0,0,.4), 0 4px 12px rgba(0,0,0,.3);
        --shadow-lg: 0 4px 20px rgba(0,0,0,.5);
    }
}

/* ---------- Layout principal ---------- */
body:not(.login-page) {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar .brand {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: 1.25rem 1rem;
    border-bottom: 1px solid var(--border);
}
.brand-mark {
    width: 38px; height: 38px;
    background: var(--accent);
    color: #fff;
    border-radius: 8px;
    display: grid; place-items: center;
    font-weight: 700;
    font-size: 14px;
}
.brand-name { font-weight: 600; font-size: 14px; }
.brand-sub  { font-size: 11px; color: var(--muted); }

.nav { padding: .75rem .5rem; flex: 1; overflow-y: auto; }
.nav-group { margin-bottom: .35rem; }
.nav-group-title {
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--muted);
    font-weight: 700;
    padding: .65rem .85rem .35rem;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .55rem .85rem;
    color: var(--text);
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    margin-bottom: 2px;
}
.nav-item:hover { background: var(--accent-soft); text-decoration: none; }
.nav-item.active { background: var(--accent); color: #fff; }
.nav-item.active:hover { background: var(--accent-h); }
.nav-item .ico { width: 18px; text-align: center; opacity: .85; }
.nav-logout { color: var(--err); margin-top: 1rem; }

.sidebar-foot {
    border-top: 1px solid var(--border);
    padding: .5rem;
}

/* ---------- Main + topbar ---------- */
.main {
    padding: 0 1.5rem 2rem;
    overflow-x: hidden;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.25rem;
    position: sticky;
    top: 0;
    background: var(--bg);
    z-index: 10;
}
.topbar-left h2 { display: inline-block; margin-right: .5rem; }
.topbar-right { display: flex; align-items: center; gap: .5rem; }

/* Busqueda global */
.global-search {
    position: relative;
}
.global-search input {
    width: 200px;
    padding: .35rem .75rem .35rem 2rem;
    border-radius: 999px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2'><circle cx='11' cy='11' r='8'/><line x1='21' y1='21' x2='16.65' y2='16.65'/></svg>");
    background-repeat: no-repeat;
    background-position: .65rem center;
    color: var(--text);
    font-size: 13px;
    transition: width .15s, border-color .15s;
}
.global-search input:focus {
    outline: none;
    border-color: var(--accent);
    width: 280px;
}
.global-search-results {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    width: 360px;
    max-height: 420px;
    overflow-y: auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 100;
    padding: .35rem;
}
.global-search-results[hidden] { display: none; }
.search-section {
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: .8px;
    color: var(--muted);
    font-weight: 700;
    padding: .5rem .65rem .25rem;
}
.search-item {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .55rem .65rem;
    border-radius: var(--radius-sm);
    color: var(--text);
    text-decoration: none;
    cursor: pointer;
}
.search-item:hover { background: var(--accent-soft); }
.search-icon { font-size: 16px; width: 22px; text-align: center; }
.search-text { flex: 1; min-width: 0; }
.search-titulo { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-subtitulo { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-empty { padding: 1.5rem; text-align: center; color: var(--muted); font-size: 13px; }
.user-chip {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .35rem .75rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 13px;
}
.user-dot {
    width: 8px; height: 8px;
    background: var(--ok);
    border-radius: 50%;
    display: inline-block;
}

.btn-icon {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text);
    width: 36px; height: 36px;
    border-radius: 8px;
    cursor: pointer;
    display: grid; place-items: center;
    font-size: 16px;
}
.btn-icon:hover { background: var(--accent-soft); border-color: var(--accent); }

/* ---------- Selector de tema (4 disenos) ---------- */
.tema-selector { position: relative; }
.tema-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    min-width: 240px;
    z-index: 100;
    overflow: hidden;
    padding: .35rem;
}
.tema-menu[hidden] { display: none; }
.tema-menu-head {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .8px;
    color: var(--muted);
    padding: .5rem .65rem .35rem;
}
.tema-opcion {
    display: flex;
    align-items: center;
    gap: .65rem;
    width: 100%;
    padding: .55rem .65rem;
    background: transparent;
    border: 0;
    border-radius: var(--radius-sm);
    color: var(--text);
    cursor: pointer;
    text-align: left;
    font-family: inherit;
}
.tema-opcion:hover { background: var(--accent-soft); }
.tema-swatch {
    width: 28px; height: 28px;
    border-radius: 6px;
    flex-shrink: 0;
    border: 1px solid var(--border);
}
.tema-swatch-clasico   { background: linear-gradient(135deg, #4f46e5, #818cf8); }
.tema-swatch-ejecutivo { background: linear-gradient(135deg, #d4a857, #1a2030); }
.tema-swatch-minimal   { background: linear-gradient(135deg, #0a0a0a, #ffffff); }
.tema-swatch-vibrante  { background: linear-gradient(135deg, #a855f7, #ec4899, #f59e0b); }
.tema-info { display: flex; flex-direction: column; line-height: 1.2; }
.tema-nombre { font-weight: 600; font-size: 13px; }
.tema-desc   { font-size: 11.5px; color: var(--muted); }

/* ---------- Live bar (mejorada v1.1) ---------- */
.live-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    padding: 1.25rem;
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-card) 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
    overflow: hidden;
    position: relative;
}
.live-bar::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent 0%, var(--accent-soft) 100%);
    opacity: .35;
    pointer-events: none;
}
.live-item {
    display: flex;
    align-items: center;
    gap: .85rem;
    padding: .25rem 1.25rem;
    border-right: 1px solid var(--border);
    flex: 1 1 auto;
    position: relative;
    z-index: 1;
}
.live-item:last-child { border-right: 0; padding-right: 0; }
.live-item-action { flex: 0 0 auto; align-self: center; margin-left: auto; padding-right: 0; }
.live-content { display: flex; flex-direction: column; }
.live-label { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); font-weight: 600; }
.live-num   { font-size: 1.85rem; font-weight: 700; color: var(--text); line-height: 1.1; margin-top: 2px; }
.live-cap   { font-size: 12px; }

.live-icon-circle {
    width: 42px; height: 42px;
    border-radius: 12px;
    background: var(--accent-soft);
    color: var(--accent);
    display: grid; place-items: center;
    font-size: 18px;
    flex-shrink: 0;
}
.live-icon-ok     { background: #dcfce7; color: #166534; }
.live-icon-warn   { background: #fef3c7; color: #92400e; }
.live-icon-accent { background: #dbeafe; color: #1e40af; }
[data-theme="dark"] .live-icon-ok     { background: #14532d; color: #86efac; }
[data-theme="dark"] .live-icon-warn   { background: #78350f; color: #fcd34d; }
[data-theme="dark"] .live-icon-accent { background: #1e3a8a; color: #93c5fd; }

/* ---------- Cards ---------- */
.grid-cards {
    display: grid;
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.grid-cards-4 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
    color: var(--text);
    transition: transform .15s, box-shadow .15s, border-color .15s;
    display: flex;
    align-items: center;
    gap: 1rem;
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 4px;
    background: var(--accent);
    transition: width .2s;
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    text-decoration: none;
    border-color: var(--accent);
}
.stat-card:hover::before { width: 6px; }

.stat-card-blue::before   { background: #3b82f6; }
.stat-card-green::before  { background: #10b981; }
.stat-card-purple::before { background: #8b5cf6; }
.stat-card-orange::before { background: #f97316; }

.stat-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    background: var(--accent-soft);
    color: var(--accent);
    display: grid; place-items: center;
    font-size: 22px;
    flex-shrink: 0;
}
.stat-card-blue   .stat-icon { background: #dbeafe; color: #1e40af; }
.stat-card-green  .stat-icon { background: #dcfce7; color: #166534; }
.stat-card-purple .stat-icon { background: #ede9fe; color: #5b21b6; }
.stat-card-orange .stat-icon { background: #ffedd5; color: #9a3412; }
[data-theme="dark"] .stat-card-blue   .stat-icon { background: #1e3a8a; color: #93c5fd; }
[data-theme="dark"] .stat-card-green  .stat-icon { background: #14532d; color: #86efac; }
[data-theme="dark"] .stat-card-purple .stat-icon { background: #4c1d95; color: #c4b5fd; }
[data-theme="dark"] .stat-card-orange .stat-icon { background: #7c2d12; color: #fdba74; }

.stat-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; font-weight: 600; }
.stat-value { font-size: 1.85rem; font-weight: 700; margin-top: 2px; line-height: 1.1; }
.stat-foot  { font-size: 11.5px; margin-top: 4px; }

/* ---------- Dashboard grid ---------- */
.dashboard-grid { display: flex; flex-direction: column; gap: 1.25rem; }
.row-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}
@media (max-width: 1000px) {
    .row-2col { grid-template-columns: 1fr; }
}

/* ---------- Sparkline ---------- */
.sparkline {
    display: flex;
    align-items: flex-end;
    gap: .65rem;
    height: 140px;
    padding: .5rem 0;
}
.spark-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    height: 100%;
    justify-content: flex-end;
    cursor: help;
}
.spark-bar {
    width: 100%;
    max-width: 38px;
    background: linear-gradient(180deg, var(--accent) 0%, color-mix(in srgb, var(--accent) 70%, transparent) 100%);
    border-radius: 6px 6px 2px 2px;
    transition: opacity .15s;
    min-height: 4px;
}
.spark-col:hover .spark-bar { opacity: .75; }
.spark-val { font-size: 11px; font-weight: 600; color: var(--text); }
.spark-day { font-size: 11px; }

/* ---------- Salud IP ring ---------- */
.salud-ring {
    position: relative;
    width: 56px; height: 56px;
    display: grid; place-items: center;
}
.salud-ring svg { transform: rotate(-90deg); }
.salud-ring .ring-bg {
    fill: none;
    stroke: var(--border);
    stroke-width: 3;
}
.salud-ring .ring-fg {
    fill: none;
    stroke-width: 3;
    stroke-linecap: round;
    transition: stroke-dasharray .5s ease;
}
.salud-ring-ok   .ring-fg { stroke: var(--ok); }
.salud-ring-warn .ring-fg { stroke: var(--warn); }
.salud-ring-err  .ring-fg { stroke: var(--err); }
.salud-num {
    position: absolute;
    font-size: 14px;
    font-weight: 700;
}
.salud-ok {
    background: #dcfce7;
    color: #166534;
    padding: .75rem;
    border-radius: var(--radius-sm);
    text-align: center;
    font-size: 13px;
}
.salud-ok-mark {
    display: inline-block;
    width: 22px; height: 22px;
    background: #16a34a;
    color: #fff;
    border-radius: 50%;
    margin-right: .35rem;
    font-weight: 700;
}
[data-theme="dark"] .salud-ok { background: #14532d; color: #86efac; }

.salud-list { list-style: none; padding: 0; margin: 0; }
.salud-item {
    display: flex;
    align-items: center;
    gap: .55rem;
    padding: .45rem 0;
    font-size: 13px;
    border-bottom: 1px solid var(--border);
}
.salud-item:last-child { border-bottom: 0; }
.salud-item .dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.salud-err  .dot { background: var(--err); }
.salud-warn .dot { background: var(--warn); }

/* ---------- Top campanias ---------- */
.top-list { list-style: none; padding: 0; margin: 0; }
.top-list li { padding: .65rem 0; border-bottom: 1px solid var(--border); }
.top-list li:last-child { border-bottom: 0; }
.top-row { display: flex; justify-content: space-between; align-items: baseline; }
.top-name { font-weight: 600; font-size: 13.5px; }
.top-meta { font-size: 12px; }
.top-bar {
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
    margin: .35rem 0;
}
.top-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 60%, transparent));
    transition: width .4s;
}
.top-tasa { font-size: 11px; }

/* ---------- Misc ---------- */
.small { font-size: 11.5px; }
.greeting { font-size: 1.05rem; }
.greeting-sub { font-size: 12px; }
.ico-mini { font-size: 11px; opacity: .7; }
.check-ok { color: var(--ok); font-weight: 700; }

/* ---------- Quick start ---------- */
.quickstart { background: linear-gradient(135deg, var(--bg-card), var(--accent-soft)); }
.quick-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: .75rem;
}
.quick-step {
    display: flex;
    align-items: center;
    gap: .85rem;
    padding: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    transition: border-color .15s, transform .15s;
}
.quick-step:hover {
    border-color: var(--accent);
    text-decoration: none;
    transform: translateX(2px);
}
.quick-num {
    width: 32px; height: 32px;
    background: var(--accent);
    color: #fff;
    border-radius: 50%;
    display: grid; place-items: center;
    font-weight: 700;
    flex-shrink: 0;
}
.quick-title { font-weight: 600; font-size: 13.5px; }
.quick-desc  { font-size: 12px; }
.quick-arrow { margin-left: auto; color: var(--muted); font-size: 18px; }

/* ---------- Mod head (encabezado de cada modulo) ---------- */
.mod-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.25rem;
}
.mod-head h2 { font-size: 1.5rem; margin-bottom: .25rem; }

/* ---------- Form layouts ---------- */
.form-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}
.form-row-3 { grid-template-columns: 2fr 1fr 1fr; }
@media (max-width: 700px) {
    .form-row, .form-row-3 { grid-template-columns: 1fr; }
}
.form-row hr { grid-column: 1 / -1; border: 0; border-top: 1px solid var(--border); margin: .5rem 0; }
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: .5rem;
    padding-top: .5rem;
    border-top: 1px solid var(--border);
    margin-top: .5rem;
}
.checkbox {
    display: inline-flex !important;
    align-items: center;
    gap: .5rem;
    text-transform: none !important;
    letter-spacing: normal !important;
    font-weight: 500 !important;
    color: var(--text) !important;
    cursor: pointer;
}
.checkbox input { width: auto !important; }

.input-with-action {
    display: flex;
    gap: .5rem;
}
.input-with-action input { flex: 1; }

.presets {
    display: flex;
    gap: .5rem;
    align-items: center;
    flex-wrap: wrap;
    padding: .85rem 1rem;
    background: var(--accent-soft);
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    border: 1px dashed var(--accent);
}

/* ---------- Empty state ---------- */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
}
.empty-icon {
    font-size: 3rem;
    width: 80px; height: 80px;
    background: var(--accent-soft);
    color: var(--accent);
    border-radius: 50%;
    display: grid; place-items: center;
    margin: 0 auto 1rem;
}

/* ---------- Remitentes cards ---------- */
.grid-remitentes {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1rem;
}
.remitente-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
    transition: transform .15s, box-shadow .15s, border-color .15s;
    position: relative;
}
.remitente-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent);
}
.remitente-card.is-default {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.remitente-card.is-inactive { opacity: .55; }

.remitente-head {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-bottom: .85rem;
}
.remitente-avatar {
    width: 44px; height: 44px;
    background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 60%, transparent));
    color: #fff;
    border-radius: 12px;
    display: grid; place-items: center;
    font-weight: 700;
    font-size: 15px;
    flex-shrink: 0;
}
.remitente-info { flex: 1; min-width: 0; }
.remitente-nombre { font-weight: 600; font-size: 14px; }
.remitente-email  { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.remitente-smtp {
    font-size: 12.5px;
    color: var(--muted);
    padding: .5rem .75rem;
    background: var(--bg);
    border-radius: var(--radius-sm);
    margin-bottom: .85rem;
}
.remitente-actions {
    display: flex;
    gap: .35rem;
    flex-wrap: wrap;
}

.badge-default { background: var(--accent); color: #fff; }
.badge-off     { background: var(--warn); color: #fff; }

/* Tags / chips */
.tag-chip {
    display: inline-block;
    background: var(--accent-soft);
    color: var(--accent);
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    margin: 1px 2px 1px 0;
    border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
}
.tag-chip:hover { opacity: .85; }

/* ---------- Modal ---------- */
.modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: grid;
    place-items: center;
    padding: 1rem;
}
.modal[hidden] { display: none; }
.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.5);
    backdrop-filter: blur(2px);
}
.modal-card {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 440px;
    animation: modalIn .2s ease;
}
@keyframes modalIn { from { opacity: 0; transform: scale(.95); } to { opacity: 1; transform: scale(1); } }
.modal-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}
.modal-body {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: .65rem;
}

/* ---------- Panel genérico ---------- */
.panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
    overflow: hidden;
}
.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg-card);
}
.panel-body { padding: 1.25rem; }

/* ---------- Tabla ---------- */
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}
.table th, .table td {
    text-align: left;
    padding: .65rem .75rem;
    border-bottom: 1px solid var(--border);
}
.table th { font-weight: 600; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
.table tr:hover td { background: var(--accent-soft); }

/* ---------- Badge ---------- */
.badge {
    display: inline-block;
    padding: .15rem .55rem;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    background: var(--accent-soft);
    color: var(--accent);
}
.badge-enviado  { background: #dcfce7; color: #166534; }
.badge-borrador { background: #f3f4f6; color: #6b7280; }
.badge-bajo     { background: #fee2e2; color: #991b1b; }
.badge-rebotado { background: #fef3c7; color: #92400e; }
[data-theme="dark"] .badge-enviado  { background: #14532d; color: #86efac; }
[data-theme="dark"] .badge-borrador { background: #1f2937; color: #9ca3af; }
[data-theme="dark"] .badge-bajo     { background: #7f1d1d; color: #fca5a5; }
[data-theme="dark"] .badge-rebotado { background: #78350f; color: #fcd34d; }

/* ---------- Botones ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .55rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    background: var(--accent);
    color: #fff;
    font-weight: 500;
    cursor: pointer;
    font-size: 13.5px;
    transition: background-color .15s, transform .05s;
}
.btn:hover { background: var(--accent-h); }
.btn:active { transform: translateY(1px); }
.btn-sm { padding: .35rem .7rem; font-size: 12.5px; }
.btn-block { width: 100%; justify-content: center; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.btn-danger { background: var(--err); }
.btn-danger:hover { background: #b91c1c; }

/* ---------- Inputs ---------- */
input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="url"], select, textarea {
    width: 100%;
    padding: .55rem .75rem;
    background: var(--bg-input);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 14px;
    transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
label {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: .35rem;
    text-transform: uppercase;
    letter-spacing: .4px;
}
label .help {
    display: inline-block;
    width: 16px; height: 16px;
    background: var(--accent-soft);
    color: var(--accent);
    border-radius: 50%;
    text-align: center;
    line-height: 16px;
    font-size: 11px;
    cursor: help;
    margin-left: 4px;
}

/* ---------- Alertas ---------- */
.alert {
    padding: .75rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    border: 1px solid;
    font-size: 13.5px;
}
.alert-ok    { background: #dcfce7; color: #166534; border-color: #86efac; }
.alert-error { background: #fee2e2; color: #991b1b; border-color: #fca5a5; }
.alert-warn  { background: #fef3c7; color: #92400e; border-color: #fcd34d; }
[data-theme="dark"] .alert-ok    { background: #14532d; color: #86efac; border-color: #166534; }
[data-theme="dark"] .alert-error { background: #7f1d1d; color: #fca5a5; border-color: #991b1b; }
[data-theme="dark"] .alert-warn  { background: #78350f; color: #fcd34d; border-color: #92400e; }

/* ---------- Login ---------- */
.login-page {
    background: linear-gradient(135deg, var(--accent) 0%, #6366f1 50%, #8b5cf6 100%);
    display: grid;
    place-items: center;
    padding: 1rem;
    min-height: 100vh;
}
.login-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 380px;
    box-shadow: var(--shadow-lg);
}
.login-brand { text-align: center; margin-bottom: 1.5rem; }
.login-brand .brand-mark { margin: 0 auto .75rem; width: 52px; height: 52px; font-size: 18px; }
.login-brand h1 { font-size: 1.4rem; margin: 0; }
.login-foot { text-align: center; margin-top: 1rem; font-size: 12px; }

/* ---------- Tooltip (?) inline ---------- */
[title] { position: relative; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    body:not(.login-page) { grid-template-columns: 1fr; }
    .sidebar {
        position: fixed;
        left: -240px;
        z-index: 100;
        transition: left .25s ease;
    }
    .sidebar.open { left: 0; }
    .main { padding: 0 1rem 2rem; }
}
