/* === Stock Price Alerts Widget === */
.spa-widget { margin: 24px 0; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; }

.spa-inner {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: 26px;
    max-width: 100%;
    box-shadow: 0 4px 20px rgba(0,0,0,.07);
}

/* Cabecera */
.spa-header { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 22px; }
.spa-header-icon { font-size: 28px; line-height: 1; flex-shrink: 0; margin-top: 2px; }
.spa-title  { margin: 0 0 5px; font-size: 18px; font-weight: 700; color: #111827; line-height: 1.3; }
.spa-subtitle { margin: 0; font-size: 13px; color: #6b7280; line-height: 1.5; }

/* Buscador */
.spa-search-wrap { position: relative; margin-bottom: 14px; }
.spa-search-box {
    display: flex; align-items: center; gap: 10px;
    background: #f9fafb; border: 2px solid #e5e7eb; border-radius: 10px; padding: 0 14px;
    transition: border-color .15s, box-shadow .15s, background .15s;
}
.spa-search-box:focus-within { border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.1); background: #fff; }
.spa-search-svg { width: 18px; height: 18px; flex-shrink: 0; }
.spa-search-input {
    flex: 1; border: none; background: transparent;
    padding: 13px 0; font-size: 15px; color: #111827; outline: none;
}
.spa-search-input::placeholder { color: #9ca3af; }
.spa-search-clear { background: none; border: none; cursor: pointer; color: #9ca3af; font-size: 15px; padding: 4px; line-height: 1; flex-shrink: 0; }
.spa-search-clear:hover { color: #374151; }

/* Dropdown */
.spa-dropdown {
    position: absolute; top: calc(100% + 6px); left: 0; right: 0;
    background: #fff; border: 1px solid #e5e7eb; border-radius: 12px;
    box-shadow: 0 8px 28px rgba(0,0,0,.13); z-index: 99999; overflow: hidden;
}
.spa-result {
    display: flex; align-items: center; justify-content: space-between;
    padding: 11px 16px; cursor: pointer; border-bottom: 1px solid #f3f4f6;
    transition: background .1s;
}
.spa-result:last-child { border-bottom: none; }
.spa-result:hover { background: #f0f9ff; }
.spa-result-left  { display: flex; align-items: center; gap: 10px; min-width: 0; }
.spa-result-ticker {
    font-size: 12px; font-weight: 700; color: #111827; font-family: monospace;
    background: #f3f4f6; border-radius: 5px; padding: 3px 7px; flex-shrink: 0;
}
.spa-result-name { font-size: 13px; color: #374151; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spa-badge {
    font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 20px;
    flex-shrink: 0; white-space: nowrap;
}
.spa-badge-stock  { background: #dbeafe; color: #1d4ed8; }
.spa-badge-etf    { background: #d1fae5; color: #065f46; }
.spa-badge-crypto { background: #fef3c7; color: #92400e; }
.spa-dropdown-info { padding: 14px 16px; text-align: center; color: #9ca3af; font-size: 13px; }

/* Asset card */
.spa-asset-card {
    display: flex; align-items: center; justify-content: space-between;
    background: linear-gradient(135deg,#1e3a5f,#1d4ed8);
    border-radius: 12px; padding: 16px 20px; margin-bottom: 18px; color: #fff;
}
.spa-asset-left  { display: flex; align-items: center; gap: 10px; min-width: 0; }
.spa-asset-ticker { font-size: 20px; font-weight: 800; letter-spacing: .5px; flex-shrink: 0; }
.spa-asset-name  { font-size: 13px; color: rgba(255,255,255,.8); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spa-asset-right { text-align: right; flex-shrink: 0; }
.spa-asset-badge {
    display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px;
    border-radius: 20px; background: rgba(255,255,255,.2); color: #fff; margin-bottom: 6px;
}
.spa-asset-price { display: block; font-size: 22px; font-weight: 700; }

/* Formulario */
.spa-form { display: flex; flex-direction: column; gap: 14px; }
.spa-row-two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.spa-field  { display: flex; flex-direction: column; gap: 5px; }
.spa-label  { font-size: 12px; font-weight: 600; color: #374151; text-transform: uppercase; letter-spacing: .4px; }
.spa-input  {
    padding: 10px 13px; border: 1.5px solid #d1d5db; border-radius: 8px;
    font-size: 14px; color: #111827; width: 100%; box-sizing: border-box;
    background: #fff; transition: border-color .15s, box-shadow .15s;
}
.spa-input:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.1); }

/* Toggle dirección */
.spa-toggle { display: flex; gap: 8px; }
.spa-tog {
    flex: 1; padding: 10px 8px; border: 1.5px solid #d1d5db; border-radius: 8px;
    background: #fff; font-size: 13px; color: #374151; cursor: pointer;
    transition: all .15s; text-align: center;
}
.spa-tog:hover  { border-color: #2563eb; color: #2563eb; }
.spa-tog.active { border-color: #2563eb; background: #eff6ff; color: #1d4ed8; font-weight: 600; }

/* Política de privacidad */
.spa-privacy-wrap {
    background: #f9fafb; border: 1px solid #e5e7eb;
    border-radius: 8px; padding: 12px 14px;
}
.spa-privacy-label {
    display: flex; align-items: flex-start; gap: 10px; cursor: pointer;
}
.spa-privacy-check {
    width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px;
    accent-color: #2563eb; cursor: pointer;
}
.spa-privacy-text { font-size: 13px; color: #374151; line-height: 1.5; }
.spa-privacy-text a { color: #2563eb; text-decoration: underline; }
.spa-privacy-text a:hover { color: #1d4ed8; }

/* Botón */
.spa-btn {
    width: 100%; padding: 14px; background: #2563eb; color: #fff;
    font-size: 15px; font-weight: 600; border: none; border-radius: 10px;
    cursor: pointer; transition: background .15s, transform .1s;
}
.spa-btn:hover   { background: #1d4ed8; }
.spa-btn:active  { transform: scale(.98); }
.spa-btn:disabled { background: #93c5fd; cursor: default; }

/* Mensajes */
.spa-msg { margin-top: 10px; padding: 12px 16px; border-radius: 8px; font-size: 14px; font-weight: 500; }
.spa-msg.ok  { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.spa-msg.err { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }

/* Legal */
.spa-legal { margin: 14px 0 0; font-size: 11px; color: #9ca3af; line-height: 1.6; }

@media (max-width: 480px) {
    .spa-row-two { grid-template-columns: 1fr; }
    .spa-toggle  { flex-direction: column; }
}

/* ═══════════════════════════════════
   MIS ALERTAS — lista compacta
   ═══════════════════════════════════ */
.spm-widget{margin:24px 0;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif}
.spm-widget *{box-sizing:border-box}

.spm-step{background:#fff;border:1px solid #e5e7eb;border-radius:14px;padding:22px;max-width:100%;box-shadow:0 2px 12px rgba(0,0,0,.06)}

/* Paso 1 */
.spm-head{display:flex;gap:14px;align-items:flex-start;margin-bottom:18px}
.spm-head-icon{font-size:26px;line-height:1;margin-top:2px;flex-shrink:0}
.spm-title{margin:0 0 4px;font-size:18px;font-weight:700;color:#111827}
.spm-sub{margin:0;font-size:13px;color:#6b7280;line-height:1.5}
.spm-email-row{display:flex;gap:10px}
.spm-input{padding:10px 13px;border:1.5px solid #d1d5db;border-radius:8px;font-size:14px;color:#111827;background:#fff;transition:border-color .15s,box-shadow .15s;width:100%}
.spm-input:focus{outline:none;border-color:#2563eb;box-shadow:0 0 0 3px rgba(37,99,235,.1)}
.spm-email-row .spm-input{flex:1}
.spm-btn{padding:10px 20px;background:#2563eb;color:#fff;font-size:14px;font-weight:600;border:none;border-radius:8px;cursor:pointer;white-space:nowrap;transition:background .15s}
.spm-btn:hover{background:#1d4ed8}
.spm-btn:disabled{background:#93c5fd;cursor:default}
.spm-msg{margin-top:12px;padding:10px 14px;border-radius:8px;font-size:13px;font-weight:500}
.spm-msg.ok{background:#f0fdf4;color:#15803d;border:1px solid #bbf7d0}
.spm-msg.err{background:#fef2f2;color:#dc2626;border:1px solid #fecaca}

/* Cabecera lista */
.spm-list-top{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:10px;margin-bottom:14px;padding-bottom:14px;border-bottom:1px solid #f3f4f6}
.spm-list-email-wrap{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.spm-list-email{font-size:13px;font-weight:600;color:#374151}
.spm-ghost-btn{background:none;border:1px solid #e5e7eb;border-radius:6px;padding:4px 10px;font-size:12px;color:#6b7280;cursor:pointer;transition:border-color .15s,color .15s}
.spm-ghost-btn:hover{border-color:#2563eb;color:#2563eb}
.spm-progress-wrap{display:flex;align-items:center;gap:8px;flex-shrink:0}
.spm-progress-bar{width:72px;height:5px;background:#e5e7eb;border-radius:3px;overflow:hidden}
.spm-progress-fill{height:100%;background:#2563eb;border-radius:3px;transition:width .4s ease}
.spm-progress-txt{font-size:12px;color:#6b7280;white-space:nowrap}

/* Cabecera columnas */
.spm-cols-head{display:flex;align-items:center;gap:8px;padding:0 0 8px;border-bottom:1px solid #e5e7eb;margin-bottom:4px}
.spm-cols-head span{font-size:11px;font-weight:600;color:#9ca3af;text-transform:uppercase;letter-spacing:.4px}
.spm-col-ticker{min-width:90px}
.spm-col-dir{width:72px;flex-shrink:0}
.spm-col-target{min-width:80px;text-align:right}
.spm-col-current{flex:1;text-align:right}
.spm-col-actions{width:72px;flex-shrink:0}

/* Filas */
.spm-row{border-bottom:1px solid #f9fafb;padding:10px 0}
.spm-row:last-child{border-bottom:none}
.spm-row-main{display:flex;align-items:center;gap:8px}
.spm-dot{width:7px;height:7px;border-radius:50%;flex-shrink:0}
.spm-dot-up{background:#16a34a}
.spm-dot-down{background:#dc2626}
.spm-ticker{font-size:13px;font-weight:700;font-family:monospace;color:#111827;min-width:52px}
.spm-name{font-size:12px;color:#9ca3af;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;flex:1;min-width:0}
.spm-badge{font-size:10px;font-weight:600;padding:1px 6px;border-radius:20px;flex-shrink:0}
.spm-badge-stock{background:#dbeafe;color:#1d4ed8}
.spm-badge-etf{background:#d1fae5;color:#065f46}
.spm-badge-crypto{background:#fef3c7;color:#92400e}
.spm-badge-forex{background:#ede9fe;color:#5b21b6}
.spm-dir{font-size:11px;padding:2px 6px;border-radius:5px;flex-shrink:0;width:64px;text-align:center}
.spm-dir-up{background:#dcfce7;color:#166534}
.spm-dir-down{background:#fee2e2;color:#991b1b}
.spm-target{font-size:13px;font-weight:700;color:#111827;flex-shrink:0;min-width:76px;text-align:right}
.spm-current{font-size:13px;color:#374151;flex:1;text-align:right;font-variant-numeric:tabular-nums;transition:color .3s}
.spm-current.spm-near{color:#d97706;font-weight:600}
.spm-row-btns{display:flex;gap:4px;flex-shrink:0;width:68px;justify-content:flex-end}
.spm-icon-btn{border:1px solid #e5e7eb;border-radius:6px;padding:4px 7px;background:#fff;font-size:12px;cursor:pointer;line-height:1;transition:background .1s,border-color .1s}
.spm-icon-btn:hover{background:#f3f4f6;border-color:#d1d5db}

/* Panel edición */
.spm-edit-panel{display:none;background:#f9fafb;border-radius:10px;margin-top:8px;padding:14px;border:1px solid #e5e7eb}
.spm-edit-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin-bottom:12px}
.spm-label{font-size:11px;font-weight:600;color:#374151;text-transform:uppercase;letter-spacing:.4px;display:block;margin-bottom:5px}
.spm-toggle{display:flex;gap:6px}
.spm-tog{flex:1;padding:8px 6px;border:1.5px solid #d1d5db;border-radius:7px;background:#fff;font-size:12px;color:#374151;cursor:pointer;text-align:center;transition:all .15s}
.spm-tog:hover{border-color:#2563eb;color:#2563eb}
.spm-tog.active{border-color:#2563eb;background:#eff6ff;color:#1d4ed8;font-weight:600}
.spm-edit-footer{display:flex;align-items:center;gap:8px}
.spm-save-btn{padding:8px 18px;background:#2563eb;color:#fff;border:none;border-radius:7px;font-size:13px;font-weight:600;cursor:pointer;transition:background .15s}
.spm-save-btn:hover{background:#1d4ed8}
.spm-save-btn:disabled{background:#93c5fd;cursor:default}
.spm-cancel-btn{background:none;border:none;font-size:13px;color:#6b7280;cursor:pointer;padding:4px}
.spm-cancel-btn:hover{color:#374151}
.spm-edit-msg{margin-top:8px;padding:8px 12px;border-radius:6px;font-size:12px;font-weight:500}
.spm-edit-msg.ok{background:#f0fdf4;color:#15803d}
.spm-edit-msg.err{background:#fef2f2;color:#dc2626}

/* Vacío */
.spm-empty{text-align:center;padding:28px;color:#9ca3af;font-size:14px;border:1.5px dashed #e5e7eb;border-radius:10px;margin-top:8px}

/* Footer refresh */
.spm-footer-bar{display:flex;align-items:center;justify-content:space-between;margin-top:14px;padding-top:12px;border-top:1px solid #f3f4f6}
.spm-refresh-time{font-size:11px;color:#9ca3af}
.spm-refresh-dot{font-size:11px;color:#16a34a;letter-spacing:.2px}

@media(max-width:520px){
  .spm-email-row{flex-direction:column}
  .spm-edit-grid{grid-template-columns:1fr}
  .spm-cols-head{display:none}
  .spm-name{max-width:80px}
}
/* Auto-detección de dirección */
.spa-dir-hint {
    display: inline-block;
    margin-top: 6px;
    font-size: 12px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
}
.spa-dir-hint-up   { background: #dcfce7; color: #166534; }
.spa-dir-hint-down { background: #fee2e2; color: #991b1b; }

/* Toggle dirección: más discreto, es solo override manual */
.spa-toggle {
    opacity: 0.5;
    transition: opacity .2s;
}
.spa-toggle:hover { opacity: 1; }
.spa-field:focus-within .spa-toggle { opacity: 1; }

/* Auto-dirección en panel de edición de mis_alertas */
.spm-dir-hint   { display:inline-block; font-size:12px; font-weight:600; padding:3px 10px; border-radius:20px; margin-top:6px; }
.spm-hint-up   { background:#dcfce7; color:#166534; }
.spm-hint-down { background:#fee2e2; color:#991b1b; }
