/* ── EAM Frontend — Shortcodes [eam_client] y [eam_maint_portal] ── */

/* ── Paleta Pymes Modernas ── */
:root {
    --pm-navy:      #1a2e4f;
    --pm-navy-mid:  #2d4a7a;
    --pm-navy-bg:   #eef1f7;
    --pm-navy-bdr:  #c5cedb;
    --pm-green:     #16a34a;
    --pm-yellow:    #d97706;
    --pm-red:       #dc2626;
    --pm-text:      #111827;
    --pm-muted:     #6b7280;
    --pm-white:     #ffffff;
    --pm-radius:    12px;
    --pm-radius-sm: 8px;
    --pm-shadow:    0 1px 6px rgba(26,46,79,.08);
    --pm-shadow-md: 0 4px 18px rgba(26,46,79,.14);
}

/* ── Notices ── */
.eam-front-notice {
    background: var(--pm-navy-bg);
    border: 1px solid var(--pm-navy-bdr);
    border-radius: var(--pm-radius-sm);
    padding: 14px 18px;
    color: var(--pm-navy);
    font-size: 14px;
}
.eam-front-notice-warn {
    background: #fefce8;
    border-color: #fde047;
    color: #713f12;
}

/* ══════════════════════════════════════════════════════════════════
   SHORTCODE: [eam_client id=X]
   ══════════════════════════════════════════════════════════════════ */

.eam-front-wrap { max-width: 860px; font-family: inherit; }

/* Cabecera con gradiente navy */
.eam-front-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    background: linear-gradient(135deg, var(--pm-navy) 0%, var(--pm-navy-mid) 100%);
    border-radius: var(--pm-radius);
    padding: 24px 28px;
    margin-bottom: 24px;
    color: #fff;
    box-shadow: var(--pm-shadow-md);
}
.eam-front-company h2  { margin: 0 0 4px; font-size: 20px; font-weight: 700; color: #fff; }
.eam-front-subtitle    { margin: 0; font-size: 13px; opacity: .8; }
.eam-front-badge-readonly {
    display: inline-block; margin-top: 8px;
    background: rgba(255,255,255,.2); border-radius: 20px;
    padding: 2px 12px; font-size: 11px; font-weight: 600;
    letter-spacing: .04em; text-transform: uppercase;
}
.eam-front-progress-ring-wrap { text-align: center; flex-shrink: 0; }
.eam-ring-fill  { transition: stroke-dasharray .6s ease; }
.eam-ring-text  { font-family: inherit; }
.eam-ring-caption { margin: 6px 0 0; font-size: 12px; opacity: .85; }

/* Lista de preguntas */
.eam-front-qa { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
.eam-front-q-block {
    background: var(--pm-white);
    border: 1px solid #e2e8f0;
    border-radius: var(--pm-radius-sm);
    padding: 14px 16px;
    transition: box-shadow .2s;
}
.eam-front-q-block:hover    { box-shadow: var(--pm-shadow); }
.eam-front-q-block.answered { border-left: 3px solid var(--pm-green); }
.eam-front-q-block.pending  { border-left: 3px solid var(--pm-navy-bdr); }
.eam-front-q-label {
    display: flex; align-items: center; gap: 8px;
    font-size: 14px; font-weight: 600; color: var(--pm-text); margin-bottom: 10px;
}
.eam-front-q-dot       { width: 10px; height: 10px; border-radius: 50%; background: #d1d5db; flex-shrink: 0; }
.eam-front-q-dot.done  { background: var(--pm-green); }
.eam-custom-tag {
    background: var(--pm-navy-bg); color: var(--pm-navy);
    font-size: 10px; font-weight: 700; padding: 2px 8px;
    border-radius: 20px; text-transform: uppercase; letter-spacing: .04em;
}
.eam-front-answer-field {
    width: 100%; box-sizing: border-box;
    border: 1px solid var(--pm-navy-bdr); border-radius: 6px;
    padding: 8px 12px; font-size: 13px; resize: vertical;
    color: var(--pm-text); background: #f9fafb; transition: border-color .2s;
}
.eam-front-answer-field:focus   { outline: none; border-color: var(--pm-navy); background: #fff; }
.eam-front-answer-readonly      { font-size: 13px; color: var(--pm-text); line-height: 1.6; padding: 4px 0; }

.eam-front-actions { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.eam-front-btn {
    display: inline-block; padding: 9px 22px;
    border-radius: var(--pm-radius-sm);
    font-size: 14px; font-weight: 600; cursor: pointer; border: none;
    transition: opacity .2s, transform .1s, box-shadow .2s; text-decoration: none;
}
.eam-front-btn:hover  { opacity: .9; transform: translateY(-1px); box-shadow: var(--pm-shadow); }
.eam-front-btn:active { transform: translateY(0); }
.eam-front-btn-primary   { background: var(--pm-navy); color: #fff; }
.eam-front-btn-secondary { background: var(--pm-navy-bg); color: var(--pm-navy); border: 1px solid var(--pm-navy-bdr); }
.eam-front-btn-buy       { background: var(--pm-green); color: #fff; }

.eam-front-msg { font-size: 13px; font-weight: 600; padding: 7px 14px; border-radius: 6px; }
.eam-front-msg.success { background: #d1fae5; color: #065f46; }
.eam-front-msg.error   { background: #fee2e2; color: #7f1d1d; }

.eam-front-add-q {
    background: var(--pm-navy-bg); border: 1px dashed var(--pm-navy-bdr);
    border-radius: var(--pm-radius-sm); padding: 16px 18px; margin-top: 8px;
}
.eam-front-add-q h3       { margin: 0 0 12px; font-size: 14px; color: var(--pm-navy); }
.eam-front-add-q-row      { display: flex; gap: 8px; }
.eam-front-input, .eam-front-select, .eam-front-textarea {
    flex: 1; padding: 8px 12px; border: 1px solid var(--pm-navy-bdr);
    border-radius: 6px; font-size: 13px; color: var(--pm-text);
    background: #f9fafb; box-sizing: border-box; width: 100%;
}
.eam-front-input:focus, .eam-front-select:focus, .eam-front-textarea:focus {
    outline: none; border-color: var(--pm-navy); background: #fff;
}
.eam-front-textarea { resize: vertical; }

/* ══════════════════════════════════════════════════════════════════
   SHORTCODE / TAB: [eam_maint_portal]
   ══════════════════════════════════════════════════════════════════ */

.eam-portal { max-width: 860px; font-family: inherit; }

/* ── Cabecera ── */
.eam-portal-header {
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px; margin-bottom: 20px;
    background: linear-gradient(135deg, var(--pm-navy) 0%, var(--pm-navy-mid) 100%);
    border-radius: var(--pm-radius);
    padding: 22px 28px;
    box-shadow: var(--pm-shadow-md);
}
.eam-portal-greeting h2    { margin: 0 0 4px; font-size: 20px; font-weight: 700; color: #fff; }
.eam-portal-company        { margin: 0; font-size: 14px; color: rgba(255,255,255,.75); }

/* Niveles */
.eam-portal-level {
    padding: 6px 16px; border-radius: 20px;
    font-size: 13px; font-weight: 700; white-space: nowrap;
}
.eam-level-nuevo   { background: rgba(255,255,255,.18); color: #fff; }
.eam-level-regular { background: #fef3c7; color: #92400e; }
.eam-level-vip     { background: #ede9fe; color: #5b21b6; }
.eam-level-premium { background: #d1fae5; color: #065f46; }

/* ── Secciones ── */
.eam-portal-section {
    background: var(--pm-white);
    border: 1px solid var(--pm-navy-bdr);
    border-radius: var(--pm-radius);
    padding: 20px 24px;
    margin-bottom: 16px;
    box-shadow: var(--pm-shadow);
}
.eam-portal-section-title {
    margin: 0 0 14px;
    font-size: 15px; font-weight: 700; color: var(--pm-navy);
}

/* ── Sección de minutos (anillo + stats) ── */
.eam-portal-minutes { display: flex; align-items: center; gap: 32px; flex-wrap: wrap; }

.eam-minutes-ring-wrap { text-align: center; flex-shrink: 0; }
.eam-minutes-ring      { display: block; }
.eam-ring-progress     { transition: stroke-dasharray .7s cubic-bezier(.4,0,.2,1); }
.eam-minutes-legend    { margin: 8px 0 0; font-size: 13px; font-weight: 600; }

.eam-minutes-stats     { display: flex; flex-wrap: wrap; gap: 16px 28px; flex: 1; }
.eam-min-stat          { display: flex; flex-direction: column; }
.eam-min-val           { font-size: 28px; font-weight: 700; color: var(--pm-navy); line-height: 1.1; }
.eam-min-lbl           { font-size: 12px; color: var(--pm-muted); margin-top: 2px; }
.eam-min-extra .eam-min-val { color: var(--pm-navy-mid); }

/* ── Stats de tickets ── */
.eam-ts-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 12px;
}
.eam-ts-card {
    text-align: center; padding: 14px 10px;
    border-radius: var(--pm-radius-sm);
    border: 1px solid var(--pm-navy-bdr);
    background: var(--pm-navy-bg);
}
.eam-ts-val { display: block; font-size: 30px; font-weight: 700; color: var(--pm-navy); }
.eam-ts-lbl { display: block; font-size: 11px; color: var(--pm-muted); margin-top: 4px; text-transform: uppercase; letter-spacing: .04em; }
.eam-ts-resolved .eam-ts-val { color: var(--pm-green); }
.eam-ts-progress .eam-ts-val { color: var(--pm-yellow); }
.eam-ts-pending  .eam-ts-val { color: var(--pm-muted); }

/* ── Comprar créditos ── */
.eam-buy-content { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.eam-buy-text h3 { margin: 0 0 4px; font-size: 15px; font-weight: 700; color: var(--pm-navy); }
.eam-buy-text p  { margin: 0; font-size: 13px; color: var(--pm-muted); }
.eam-buy-form    { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.eam-buy-qty-wrap {
    display: flex; align-items: center;
    border: 1px solid var(--pm-navy-bdr); border-radius: var(--pm-radius-sm); overflow: hidden;
}
.eam-qty-btn {
    width: 34px; height: 36px; background: var(--pm-navy-bg); border: none;
    font-size: 18px; font-weight: 700; cursor: pointer; color: var(--pm-navy);
    transition: background .15s;
}
.eam-qty-btn:hover { background: var(--pm-navy-bdr); }
.eam-qty-input {
    width: 48px; height: 36px; border: none;
    border-left: 1px solid var(--pm-navy-bdr); border-right: 1px solid var(--pm-navy-bdr);
    text-align: center; font-size: 15px; font-weight: 600; color: var(--pm-navy);
}
.eam-qty-input:focus { outline: none; }
.eam-buy-price-preview { font-size: 22px; font-weight: 800; color: var(--pm-green); min-width: 70px; }

/* ── Formulario nueva solicitud ── */
.eam-portal-form-grid {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 12px 18px; margin-bottom: 14px;
}
.eam-pfg-full { grid-column: 1 / -1; }
.eam-portal-form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; color: var(--pm-navy); }
.eam-portal-form-actions { display: flex; align-items: center; gap: 12px; }
.eam-req { color: var(--pm-red); }

/* ── Historial — cabecera con filtro ── */
.eam-history-header {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; margin-bottom: 14px; flex-wrap: wrap;
}
.eam-history-header .eam-portal-section-title { margin-bottom: 0; }
.eam-history-filter         { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.eam-month-picker           { flex: none; width: auto; padding: 6px 10px; font-size: 13px; cursor: pointer; }
.eam-history-load-btn       { padding: 6px 16px; font-size: 13px; }
.eam-history-spinner   { font-size: 16px; color: var(--pm-muted); display: inline-block; }
@keyframes eam-spin    { to { transform: rotate(360deg); } }
.eam-history-spinner   { animation: eam-spin .8s linear infinite; }

.eam-history-summary {
    display: flex; gap: 18px; flex-wrap: wrap;
    margin-top: 12px; padding-top: 10px;
    border-top: 1px solid var(--pm-navy-bdr);
    font-size: 12px; color: var(--pm-muted); font-weight: 600;
}
.eam-history-summary span::before { content: '• '; }

/* ── Lista de tickets ── */
.eam-portal-empty { color: var(--pm-muted); text-align: center; padding: 24px 0; font-size: 13px; margin: 0; }
.eam-portal-ticket-list { display: flex; flex-direction: column; gap: 8px; }

.eam-portal-ticket-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 14px;
    background: var(--pm-navy-bg);
    border-radius: var(--pm-radius-sm);
    border: 1px solid var(--pm-navy-bdr);
    transition: background .15s;
}
.eam-portal-ticket-item:hover { background: #dde4ee; }
.eam-pti-main  { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.eam-pti-title { font-size: 13px; color: var(--pm-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.eam-pti-meta  { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.eam-pti-time  { font-size: 12px; color: var(--pm-muted); }
.eam-pti-date  { font-size: 12px; color: var(--pm-muted); }

.eam-pti-status {
    display: inline-block; padding: 3px 10px; border-radius: 20px;
    font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
    white-space: nowrap; flex-shrink: 0;
}
.eam-pti-resolved   { background: #d1fae5; color: #065f46; }
.eam-pti-inprogress { background: #fef3c7; color: #92400e; }
.eam-pti-pending    { background: #f1f5f9; color: #475569; }

/* ── Responsive ── */
@media (max-width: 640px) {
    .eam-front-header  { flex-direction: column; }
    .eam-portal-header { flex-direction: column; align-items: flex-start; }
    .eam-portal-minutes { flex-direction: column; }
    .eam-portal-form-grid { grid-template-columns: 1fr; }
    .eam-pfg-full { grid-column: auto; }
    .eam-buy-content { flex-direction: column; align-items: flex-start; }
    .eam-portal-ticket-item { flex-direction: column; align-items: flex-start; gap: 6px; }
    .eam-front-add-q-row { flex-direction: column; }
}

/* ================================================================
   Portal de Referidos — [eam_referidos]
   ================================================================ */

.eam-ref-portal {
    max-width: 840px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ── Cabecera ── */
.eam-ref-header {
    display: flex;
    align-items: flex-start;
    margin-bottom: 24px;
}
.eam-ref-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--pm-navy);
    margin: 0 0 4px;
}
.eam-ref-subtitle {
    font-size: 13px;
    color: var(--pm-muted);
    margin: 0;
}

/* ── Card genérica ── */
.eam-ref-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 22px 24px;
    margin-bottom: 20px;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

/* ── Card de link ── */
.eam-ref-link-card { margin-bottom: 20px; }
.eam-ref-link-row  { display: flex; gap: 28px; align-items: flex-start; flex-wrap: wrap; }
.eam-ref-label     { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--pm-muted); margin: 0 0 6px; }
.eam-ref-code      { font-size: 20px; font-weight: 700; color: var(--pm-navy); background: var(--pm-navy-bg); padding: 4px 12px; border-radius: 6px; }
.eam-ref-url-row   { display: flex; gap: 8px; align-items: center; }
.eam-ref-url-input {
    flex: 1;
    border: 1px solid #dde4ee;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 13px;
    color: var(--pm-navy);
    background: var(--pm-navy-bg);
    min-width: 0;
}
.eam-ref-hint { font-size: 12px; color: var(--pm-muted); margin: 6px 0 0; }

/* ── Stats ── */
.eam-ref-stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 20px;
}
.eam-ref-stat-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.eam-ref-stat-val {
    font-size: 22px;
    font-weight: 800;
    color: var(--pm-navy);
    line-height: 1;
}
.eam-ref-stat-available { color: var(--pm-green); }
.eam-ref-stat-lbl {
    font-size: 12px;
    color: var(--pm-muted);
}

/* ── Section title ── */
.eam-ref-section-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--pm-navy);
    margin: 0 0 16px;
}

/* ── Clientes de lanzamiento — cards con timeline ── */
.eam-ref-launch-list { display: flex; flex-direction: column; gap: 16px; }

.eam-ref-launch-card {
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 18px 20px;
    background: #fff;
}

/* Cabecera de la card */
.eam-ref-launch-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 16px;
}
.eam-ref-launch-name  { display: block; font-size: 15px; font-weight: 700; color: var(--pm-navy); }
.eam-ref-launch-phase { display: block; font-size: 12px; color: var(--pm-muted); margin-top: 2px; }

/* Badge de estado */
.eam-ref-launch-badge {
    flex-shrink: 0;
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.eam-ref-launch-badge-active    { background: #dcfce7; color: #14532d; }
.eam-ref-launch-badge-completed { background: #dbeafe; color: #1e3a5f; }
.eam-ref-launch-badge-paused    { background: #fef3c7; color: #92400e; }
.eam-ref-launch-badge-pending   { background: #f3f4f6; color: #6b7280; }

/* ── Timeline vertical ── */
.eam-ref-tl { display: flex; flex-direction: column; margin-bottom: 14px; }

.eam-ref-tl-step {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

/* Columna izquierda: dot + línea */
.eam-ref-tl-left {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
    width: 22px;
}
.eam-ref-tl-dot {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
    z-index: 1;
}
.eam-ref-tl-line {
    width: 2px;
    flex: 1;
    min-height: 14px;
    margin: 2px 0;
}

/* Colores por estado */
.eam-ref-tl-done    .eam-ref-tl-dot  { background: #16a34a; color: #fff; }
.eam-ref-tl-done    .eam-ref-tl-line { background: #bbf7d0; }
.eam-ref-tl-current .eam-ref-tl-dot  { background: #4f46e5; color: #fff; box-shadow: 0 0 0 3px #e0e7ff; }
.eam-ref-tl-current .eam-ref-tl-line { background: #e5e7eb; }
.eam-ref-tl-pending .eam-ref-tl-dot  { background: #f3f4f6; color: #d1d5db; border: 2px solid #e5e7eb; }
.eam-ref-tl-pending .eam-ref-tl-line { background: #f3f4f6; }

/* Contenido del paso */
.eam-ref-tl-body {
    padding-bottom: 14px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.eam-ref-tl-label {
    font-size: 13px;
    font-weight: 600;
    line-height: 22px; /* alinea con el dot */
}
.eam-ref-tl-done    .eam-ref-tl-label { color: var(--pm-navy); }
.eam-ref-tl-current .eam-ref-tl-label { color: #4f46e5; }
.eam-ref-tl-pending .eam-ref-tl-label { color: #9ca3af; }

.eam-ref-tl-date {
    font-size: 11px;
    color: var(--pm-green);
    font-weight: 600;
}
.eam-ref-tl-pct {
    font-size: 11px;
    color: #4f46e5;
    font-weight: 600;
}

/* Barra de progreso general al pie */
.eam-ref-launch-progress {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-top: 4px;
    border-top: 1px solid #f0f0f0;
}
.eam-ref-launch-bar {
    flex: 1;
    height: 5px;
    background: #e5e7eb;
    border-radius: 99px;
    overflow: hidden;
}
.eam-ref-launch-fill {
    height: 100%;
    background: linear-gradient(90deg, #4f46e5, #16a34a);
    border-radius: 99px;
    transition: width .5s;
}
.eam-ref-launch-pct-lbl { font-size: 11px; color: var(--pm-muted); white-space: nowrap; }

/* ── Clientes de mantenimiento ── */
.eam-ref-maint-list { display: flex; flex-direction: column; gap: 8px; }
.eam-ref-maint-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    color: var(--pm-navy);
}
.eam-ref-maint-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--pm-green);
    flex-shrink: 0;
}
.eam-ref-maint-status {
    margin-left: auto;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--pm-muted);
}

/* ── Tabla reutilizable ── */
.eam-ref-table-wrap { overflow-x: auto; }
.eam-ref-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.eam-ref-table th,
.eam-ref-table td {
    padding: 9px 12px;
    text-align: left;
    border-bottom: 1px solid #f0f0f0;
}
.eam-ref-table th {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--pm-muted);
    background: #f9fafb;
}
.eam-ref-table tbody tr:last-child td { border-bottom: none; }

/* ── Datos de pago ── */
.eam-ref-payment-info {
    background: var(--pm-navy-bg);
    border: 1px solid var(--pm-navy-bdr);
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 13px;
    color: var(--pm-navy);
}
.eam-ref-payment-info p { margin: 4px 0; }

/* ── Responsive ── */
@media (max-width: 680px) {
    .eam-ref-stats-row { grid-template-columns: repeat(2, 1fr); }
    .eam-ref-link-row  { flex-direction: column; gap: 16px; }
}
