/* =====================================================
   Rmetrics — Portal Público de Facturación
   Design System v1.0  |  Docs/UI.md
   ===================================================== */

/* --- Tokens ---------------------------------------- */
:root {
    --rm-primary:     #2563EB;
    --rm-primary-hov: #1D4ED8;
    --rm-success:     #10B981;
    --rm-danger:      #EF4444;
    --rm-warning:     #F59E0B;
    --rm-info:        #2563EB;
    --rm-purple:      #7C3AED;

    --rm-gray-50:  #F9FAFB;
    --rm-gray-100: #F3F4F6;
    --rm-gray-200: #E5E7EB;
    --rm-gray-300: #D1D5DB;
    --rm-gray-400: #9CA3AF;
    --rm-gray-500: #6B7280;
    --rm-gray-600: #4B5563;
    --rm-gray-700: #374151;
    --rm-gray-800: #1F2937;
    --rm-gray-900: #111827;

    --rm-radius-sm: 8px;
    --rm-radius-md: 12px;
    --rm-radius-lg: 16px;
    --rm-radius-xl: 20px;

    --rm-shadow-sm: 0 1px 2px rgba(0,0,0,.06);
    --rm-shadow-md: 0 4px 12px rgba(0,0,0,.08);
    --rm-shadow-lg: 0 10px 25px rgba(0,0,0,.10);
}

/* --- Layout ---------------------------------------- */
.rm-portal-wrapper {
    min-height: 100vh;
    background: var(--rm-gray-100);
    font-family: 'Inter', system-ui, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 16px 64px;
}

.rm-portal-header {
    text-align: center;
    margin-bottom: 32px;
}

.rm-portal-header img.rm-logo {
    height: 48px;
    margin-bottom: 12px;
}

.rm-portal-header h1 {
    font-size: 24px;
    font-weight: 600;
    color: var(--rm-gray-800);
    margin: 0 0 4px;
}

.rm-portal-header p.rm-subtitle {
    font-size: 14px;
    color: var(--rm-gray-500);
    margin: 0;
}

.rm-card {
    background: #fff;
    border-radius: var(--rm-radius-lg);
    padding: 32px;
    box-shadow: var(--rm-shadow-md);
    width: 100%;
    max-width: 560px;
}

/* Stepper */
.rm-stepper {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 32px;
}

.rm-step {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--rm-gray-400);
    font-weight: 500;
}

.rm-step-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--rm-gray-200);
    color: var(--rm-gray-500);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}

.rm-step.active .rm-step-dot {
    background: var(--rm-primary);
    color: #fff;
}

.rm-step.active {
    color: var(--rm-primary);
}

.rm-step.done .rm-step-dot {
    background: var(--rm-success);
    color: #fff;
}

.rm-step.done {
    color: var(--rm-success);
}

.rm-step-sep {
    width: 24px;
    height: 2px;
    background: var(--rm-gray-200);
    flex-shrink: 0;
    margin-top: 1px;
}

/* Form */
.rm-field {
    margin-bottom: 20px;
}

.rm-field label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--rm-gray-700);
    margin-bottom: 6px;
}

.rm-input {
    width: 100%;
    height: 44px;
    border: 1.5px solid var(--rm-gray-300);
    border-radius: var(--rm-radius-sm);
    padding: 0 14px;
    font-size: 14px;
    color: var(--rm-gray-800);
    background: #fff;
    box-sizing: border-box;
    transition: border-color .15s;
    outline: none;
}

.rm-input:focus {
    border-color: var(--rm-primary);
}

.rm-input.invalid {
    border-color: var(--rm-danger);
}

.rm-input-hint {
    font-size: 12px;
    color: var(--rm-gray-400);
    margin-top: 4px;
}

.rm-input-error {
    font-size: 12px;
    color: var(--rm-danger);
    margin-top: 4px;
}

.rm-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

/* Buttons */
.rm-btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 44px;
    padding: 0 24px;
    background: var(--rm-primary);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: var(--rm-radius-md);
    cursor: pointer;
    transition: background .15s;
    width: 100%;
}

.rm-btn-primary:hover:not(:disabled) {
    background: var(--rm-primary-hov);
}

.rm-btn-primary:disabled {
    opacity: .55;
    cursor: not-allowed;
}

.rm-btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 40px;
    padding: 0 16px;
    background: transparent;
    color: var(--rm-primary);
    font-size: 14px;
    font-weight: 500;
    border: none;
    cursor: pointer;
}

.rm-btn-ghost:hover {
    text-decoration: underline;
}

/* Ticket summary */
.rm-ticket-summary {
    background: var(--rm-gray-50);
    border: 1px solid var(--rm-gray-200);
    border-radius: var(--rm-radius-md);
    padding: 20px;
    margin-bottom: 24px;
}

.rm-ticket-row {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    color: var(--rm-gray-700);
    margin-bottom: 8px;
}

.rm-ticket-row:last-child { margin-bottom: 0; }

.rm-ticket-row .label {
    color: var(--rm-gray-500);
    font-size: 13px;
}

.rm-ticket-row.total {
    font-weight: 700;
    font-size: 16px;
    color: var(--rm-gray-900);
    border-top: 1px solid var(--rm-gray-200);
    padding-top: 10px;
    margin-top: 4px;
}

.rm-ticket-artículos {
    margin-top: 12px;
}

.rm-ticket-art-row {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--rm-gray-600);
    padding: 4px 0;
    border-bottom: 1px dashed var(--rm-gray-200);
}

.rm-ticket-art-row:last-child { border-bottom: none; }

/* Badge */
.rm-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.rm-badge-success { background: #D1FAE5; color: #065F46; }
.rm-badge-danger  { background: #FEE2E2; color: #991B1B; }
.rm-badge-warning { background: #FEF3C7; color: #92400E; }
.rm-badge-info    { background: #DBEAFE; color: #1E40AF; }

/* Alert */
.rm-alert {
    padding: 14px 16px;
    border-radius: var(--rm-radius-sm);
    font-size: 14px;
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.rm-alert-danger  { background: #FEF2F2; color: #B91C1C; border-left: 3px solid var(--rm-danger); }
.rm-alert-success { background: #ECFDF5; color: #065F46; border-left: 3px solid var(--rm-success); }
.rm-alert-info    { background: #EFF6FF; color: #1E40AF; border-left: 3px solid var(--rm-primary); }

/* Result */
.rm-result-icon {
    text-align: center;
    margin-bottom: 20px;
}

.rm-result-icon svg {
    width: 56px;
    height: 56px;
}

.rm-result-title {
    text-align: center;
    font-size: 20px;
    font-weight: 700;
    color: var(--rm-gray-900);
    margin-bottom: 6px;
}

.rm-result-sub {
    text-align: center;
    font-size: 14px;
    color: var(--rm-gray-500);
    margin-bottom: 28px;
}

/* Spinner */
.rm-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: rm-spin .6s linear infinite;
    flex-shrink: 0;
}

@keyframes rm-spin { to { transform: rotate(360deg); } }

/* Divider */
.rm-divider {
    border: none;
    border-top: 1px solid var(--rm-gray-200);
    margin: 24px 0;
}

/* Footer */
.rm-portal-footer {
    margin-top: 40px;
    text-align: center;
    font-size: 12px;
    color: var(--rm-gray-400);
}
