/* ============================================================
   Autorización de Retiro por Tercero — Frontend
   ============================================================ */

#ar-wrap {
    max-width: 680px;
    margin: 0 auto;
    padding: 0 16px 60px;
    font-family: inherit;
}

/* ── Header ── */
.ar-header { margin-bottom: 32px; }

.ar-eyebrow {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    color: #6b7280;
    margin-bottom: 10px;
}

.ar-title {
    margin: 0 0 10px !important;
    font-size: 26px !important;
    font-weight: 700 !important;
    color: #111827 !important;
    letter-spacing: -0.4px !important;
    line-height: 1.2 !important;
}

.ar-subtitle {
    margin: 0 !important;
    font-size: 15px !important;
    color: #4b5563 !important;
    line-height: 1.6 !important;
}

/* ── Fieldset ── */
.ar-fieldset {
    border: none;
    padding: 0;
    margin: 0 0 24px !important;
}

.ar-legend {
    display: block;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #6b7280;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e5e7eb;
    width: 100%;
}

/* ── Rows ── */
.ar-row { display: grid; gap: 16px; margin-bottom: 16px; }
.ar-row--1 { grid-template-columns: 1fr; }
.ar-row--2 { grid-template-columns: 1fr 1fr; }

@media (max-width: 520px) {
    .ar-row--2 { grid-template-columns: 1fr; }
}

/* ── Fields ── */
.ar-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ar-field label {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
}

.ar-field label span[aria-hidden="true"] {
    color: #ef4444;
    margin-left: 2px;
}

.ar-field input,
.ar-field textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    color: #111827;
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
    box-sizing: border-box;
    font-family: inherit;
    -webkit-appearance: none;
}

.ar-field input:focus,
.ar-field textarea:focus {
    outline: none;
    border-color: #111827;
    box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.08);
}

.ar-field input.ar-invalid,
.ar-field textarea.ar-invalid {
    border-color: #ef4444;
}

.ar-field textarea {
    resize: vertical;
    min-height: 80px;
}

/* ── Aviso pedido activo ── */
.ar-pedido-aviso {
    margin-top: 2px;
    border-radius: 7px;
    padding: 11px 15px;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.5;
    /* color por defecto (activo) */
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
}

.ar-pedido-aviso[data-estado="usado"] {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1e40af;
}

.ar-pedido-aviso[data-estado="caducado"] {
    background: #fffbeb;
    border-color: #fde68a;
    color: #92400e;
}

/* ── Errors ── */
.ar-error {
    font-size: 12px;
    color: #ef4444;
    font-weight: 500;
    min-height: 16px;
}

.ar-global-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 14px;
    color: #dc2626;
    margin-bottom: 16px;
    display: none;
}

.ar-global-error.ar-visible { display: block; }

/* ── Checkbox ── */
.ar-checkbox-wrap { margin-bottom: 24px; }

.ar-checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    font-size: 14px;
    color: #374151;
    line-height: 1.5;
}

.ar-checkbox-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.ar-checkmark {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border: 2px solid #d1d5db;
    border-radius: 5px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    margin-top: 1px;
}

.ar-checkbox-label input:checked + .ar-checkmark {
    background: #111827;
    border-color: #111827;
}

.ar-checkbox-label input:checked + .ar-checkmark::after {
    content: '';
    width: 5px;
    height: 9px;
    border: 2px solid #fff;
    border-top: none;
    border-left: none;
    transform: rotate(45deg) translate(-1px, -1px);
    display: block;
}

.ar-checkbox-label input:focus + .ar-checkmark {
    box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.12);
}

/* ── Submit ── */
.ar-btn {
    width: 100%;
    padding: 14px 24px;
    background: #111827;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: background 0.15s, transform 0.1s;
}

.ar-btn:hover:not(:disabled) { background: #1f2937; }
.ar-btn:active:not(:disabled) { transform: scale(0.99); }
.ar-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.ar-btn-spinner {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: ar-spin 0.7s linear infinite;
}

.ar-btn.ar-loading .ar-btn-spinner { display: block; }
.ar-btn.ar-loading .ar-btn-text    { opacity: 0.7; }

@keyframes ar-spin { to { transform: rotate(360deg); } }

/* ── Success ── */
.ar-success {
    text-align: center;
    padding: 40px 20px;
    animation: ar-fade-in 0.4s ease;
}

@keyframes ar-fade-in {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.ar-success-icon {
    width: 64px;
    height: 64px;
    background: #111827;
    color: #fff;
    border-radius: 50%;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.ar-success-title {
    font-size: 24px !important;
    font-weight: 700 !important;
    color: #111827 !important;
    margin: 0 0 10px !important;
}

.ar-success-msg {
    font-size: 15px !important;
    color: #4b5563 !important;
    margin: 0 0 28px !important;
    line-height: 1.6 !important;
    max-width: 460px;
    margin-left: auto !important;
    margin-right: auto !important;
}

.ar-code-display {
    display: inline-block;
    background: #111827;
    border-radius: 12px;
    padding: 20px 40px 18px;
    margin-bottom: 20px;
}

.ar-code-label {
    margin: 0 0 6px !important;
    font-size: 10px !important;
    letter-spacing: 2.5px !important;
    text-transform: uppercase !important;
    color: #9ca3af !important;
}

.ar-code-value {
    margin: 0 0 12px !important;
    font-size: 36px !important;
    font-weight: 800 !important;
    color: #fff !important;
    letter-spacing: 8px !important;
}

.ar-vence-info {
    margin: 0 !important;
    font-size: 11px !important;
    color: #9ca3af !important;
    letter-spacing: 0.5px !important;
}

.ar-success-note {
    font-size: 13px !important;
    color: #6b7280 !important;
    max-width: 400px;
    margin: 0 auto !important;
    line-height: 1.5 !important;
}
