/* ==============================================
   Copeal Gestión — Renta App
   Premium Desktop-First Design
   ============================================== */

:root {
    /* Sophisticated palette — corporate warm with dark neutral */
    --accent: #1D1D1F;
    --accent-hover: #000000;
    --accent-soft: #F5F5F7;
    --accent-glow: rgba(29, 29, 31, 0.08);
    --brand: #C45D3E;
    --brand-hover: #B04F33;
    --brand-soft: #FDF5F2;
    --brand-glow: rgba(196, 93, 62, 0.12);
    --warm: #C45D3E;
    --warm-soft: #FDF5F2;
    --warm-glow: rgba(196, 93, 62, 0.1);
    --bg: #F5F5F7;
    --bg-card: #FFFFFF;
    --bg-elevated: #FAFAFA;
    --text: #1D1D1F;
    --text-secondary: #6E6E73;
    --text-muted: #AEAEB2;
    --border: #E8E8ED;
    --border-hover: #D2D2D7;
    --border-focus: #1D1D1F;
    --success: #30D158;
    --success-soft: #F0FDF4;
    --error: #FF3B30;
    --error-soft: #FEF2F2;
    --warning: #FF9F0A;
    --warning-soft: #FFFBEB;
    --info: #007AFF;
    --info-soft: #EFF6FF;

    /* Refined spacing & radii */
    --radius: 16px;
    --radius-sm: 10px;
    --radius-xs: 8px;
    --radius-full: 9999px;

    /* Apple-like shadows */
    --shadow-xs: 0 0.5px 1px rgba(0,0,0,0.04);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.02);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.06);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.08);
    --shadow-xl: 0 16px 48px rgba(0,0,0,0.1);

    /* Transitions */
    --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
    --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-out: cubic-bezier(0, 0, 0.2, 1);
    --duration: 0.2s;
    --duration-md: 0.35s;
    --duration-lg: 0.5s;
}

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    scroll-behavior: smooth;
    overflow-x: hidden;
    max-width: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Inter', 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    letter-spacing: -0.01em;
    min-height: 100vh;
}

/* ==============================================
   Animations
   ============================================== */

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.04); }
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes priceCount {
    0% { transform: translateY(-8px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

/* ==============================================
   Top Header
   ============================================== */

.top-header {
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 0.5px solid rgba(0, 0, 0, 0.08);
    position: sticky;
    top: 0;
    z-index: 100;
    animation: fadeIn var(--duration-md) var(--ease);
}

.top-header-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 16px 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.top-header-brand {
    flex: 0 0 220px;
}

.brand-mark {
    font-size: 17px;
    font-weight: 700;
    color: var(--brand);
    letter-spacing: -0.03em;
}

.top-header-title {
    text-align: center;
    flex: 1;
}

.top-header-title h1 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.02em;
}

.top-header-title p {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 1px;
}

.top-header-spacer {
    flex: 0 0 220px;
}

/* ==============================================
   App Layout — 3 columns on desktop
   ============================================== */

.app-layout {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 240px 1fr 300px;
    gap: 0;
    min-height: calc(100vh - 60px);
    padding: 0 40px;
}

/* ==============================================
   Steps Sidebar (LEFT)
   ============================================== */

.steps-sidebar {
    padding: 40px 0;
    padding-right: 32px;
}

.steps-sidebar-inner {
    position: sticky;
    top: 100px;
}

.steps-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 20px;
}

.steps-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.progress-step {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-xs);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--duration) var(--ease);
    position: relative;
    user-select: none;
}

.progress-step:hover {
    color: var(--text-secondary);
    background: rgba(0, 0, 0, 0.02);
}

.progress-step .step-number {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    background: var(--bg);
    color: var(--text-muted);
    border: 1.5px solid var(--border);
    transition: all var(--duration-md) var(--ease);
    flex-shrink: 0;
}

.progress-step.active {
    color: var(--brand);
    font-weight: 600;
    background: var(--brand-soft);
}

.progress-step.active .step-number {
    background: var(--brand);
    color: white;
    border-color: var(--brand);
}

.progress-step.completed {
    color: var(--text-secondary);
}

.progress-step.completed .step-number {
    background: var(--success);
    color: white;
    border-color: var(--success);
}

.progress-step.completed .step-number::after {
    content: '✓';
    font-size: 11px;
}

.progress-step.completed .step-number span {
    display: none;
}

.steps-progress-track {
    margin-top: 24px;
    height: 2px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
}

.steps-progress-fill {
    height: 100%;
    background: var(--brand);
    width: 0%;
    border-radius: 2px;
    transition: width var(--duration-lg) var(--ease);
}

/* ==============================================
   Form Main (CENTER)
   ============================================== */

.form-main {
    padding: 40px 0;
    padding-left: 32px;
    padding-right: 32px;
    border-left: 0.5px solid var(--border);
    border-right: 0.5px solid var(--border);
    background: var(--bg-card);
    min-height: 100%;
}

/* Sections */
.form-section {
    display: none;
    animation: fadeUp var(--duration-md) var(--ease);
}

.form-section.active {
    display: block;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 8px;
}

.section-number {
    font-size: 12px;
    font-weight: 700;
    color: var(--brand);
    letter-spacing: 0.02em;
    font-variant-numeric: tabular-nums;
    opacity: 0.7;
}

.section-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.03em;
    line-height: 1.2;
}

.section-description {
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 32px;
    line-height: 1.6;
    max-width: 520px;
}

/* Fields */
.form-group {
    margin-bottom: 28px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 7px;
    letter-spacing: -0.01em;
}

.required-mark {
    color: var(--warm);
    margin-left: 2px;
}

.helper-text {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 8px;
    line-height: 1.5;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    font-size: 15px;
    font-family: inherit;
    color: var(--text);
    background: var(--bg-card);
    transition: all var(--duration) var(--ease);
    outline: none;
    letter-spacing: -0.01em;
}

.form-input:hover {
    border-color: var(--border-hover);
}

.form-input:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-glow);
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
}

.form-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 12 12'%3E%3Cpath fill='%23AEAEB2' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 44px;
    cursor: pointer;
}

/* Radio */
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--duration) var(--ease);
    user-select: none;
}

.radio-option:hover {
    border-color: var(--brand);
    background: var(--brand-soft);
}

.radio-option input[type="radio"] { display: none; }

.radio-custom {
    width: 20px;
    height: 20px;
    min-width: 20px;
    border: 2px solid var(--border-hover);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--duration) var(--ease);
}

.radio-option input:checked + .radio-custom {
    border-color: var(--brand);
    background: var(--brand);
}

.radio-option input:checked + .radio-custom::after {
    content: '';
    width: 7px;
    height: 7px;
    background: white;
    border-radius: 50%;
}

.radio-option input:checked ~ .radio-label {
    color: var(--brand);
    font-weight: 600;
}

.radio-label {
    font-size: 14px;
    color: var(--text-secondary);
    transition: all var(--duration) var(--ease);
}

/* Checkbox */
.checkbox-option {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--duration) var(--ease);
}

.checkbox-option:hover {
    border-color: var(--border-hover);
}

.checkbox-option input[type="checkbox"] { display: none; }

.checkbox-custom {
    width: 20px;
    height: 20px;
    min-width: 20px;
    border: 2px solid var(--border-hover);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--duration) var(--ease);
    margin-top: 1px;
}

.checkbox-option input:checked + .checkbox-custom {
    border-color: var(--brand);
    background: var(--brand);
}

.checkbox-option input:checked + .checkbox-custom::after {
    content: '✓';
    color: white;
    font-size: 12px;
    font-weight: 700;
}

.checkbox-label {
    font-size: 14px;
    color: var(--text);
    line-height: 1.5;
}

/* Errors */
.field-error {
    font-size: 13px;
    color: var(--error);
    margin-top: 6px;
    display: none;
    animation: slideDown var(--duration) var(--ease);
}

.field-error.visible { display: block; }

.form-input.input-error {
    border-color: var(--error);
    box-shadow: 0 0 0 3px rgba(255, 59, 48, 0.08);
}

.form-divider {
    border: none;
    border-top: 0.5px solid var(--border);
    margin: 28px 0;
}

/* Navigation */
.form-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 32px;
    margin-top: 40px;
    border-top: 0.5px solid var(--border);
}

/* ==============================================
   Price Sidebar (RIGHT)
   ============================================== */

.price-sidebar {
    padding: 40px 0;
    padding-left: 32px;
}

.price-card {
    position: sticky;
    top: 100px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--duration-md) var(--ease);
}

.price-card:hover {
    box-shadow: var(--shadow-md);
}

.price-card-header {
    padding: 16px 20px;
    border-bottom: 0.5px solid var(--border);
    background: var(--accent-soft);
}

.price-card-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.price-card-body {
    padding: 24px 20px;
}

.price-amount {
    font-size: 36px;
    font-weight: 700;
    color: var(--brand);
    letter-spacing: -0.04em;
    line-height: 1;
    margin-bottom: 8px;
    transition: all var(--duration) var(--ease);
    font-variant-numeric: tabular-nums;
}

.price-amount.price-changed {
    animation: priceCount 0.35s var(--ease);
}

.price-details {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.6;
}

.price-card-footer {
    padding: 14px 20px;
    border-top: 0.5px solid var(--border);
    background: var(--accent-soft);
}

.price-secure {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

/* Mobile floating price */
.price-calculator-mobile {
    display: none;
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(29, 29, 31, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--radius-full);
    padding: 10px 24px;
    z-index: 100;
    align-items: center;
    gap: 12px;
    color: white;
    box-shadow: var(--shadow-lg);
}

.price-calculator-mobile .price-label {
    font-size: 11px;
    font-weight: 500;
    opacity: 0.7;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.price-amount-mobile {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}

/* ==============================================
   Buttons
   ============================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 11px 24px;
    border: none;
    border-radius: var(--radius-full);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--duration) var(--ease);
    text-decoration: none;
    gap: 6px;
    position: relative;
    letter-spacing: -0.01em;
}

.btn-primary {
    background: var(--brand);
    color: white;
}

.btn-primary:hover {
    background: var(--brand-hover);
    transform: scale(1.02);
    box-shadow: 0 4px 16px rgba(196, 93, 62, 0.25);
}

.btn-primary:active {
    transform: scale(0.98);
    box-shadow: 0 2px 8px rgba(196, 93, 62, 0.2);
}

.btn-secondary {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    border-color: var(--border-hover);
    background: var(--accent-soft);
    color: var(--text);
}

.btn-danger {
    background: var(--error-soft);
    color: var(--error);
    border: 1px solid transparent;
}

.btn-danger:hover {
    background: var(--error);
    color: white;
}

.btn-sm {
    padding: 7px 14px;
    font-size: 13px;
}

.btn-full { width: 100%; }

.btn-submit { display: none; }

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none !important;
}

.btn-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* ==============================================
   Alerts
   ============================================== */

.alert {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin-bottom: 20px;
    animation: slideDown var(--duration-md) var(--ease);
    border: 1px solid transparent;
    font-weight: 500;
}

.alert-success {
    background: var(--success-soft);
    color: #16A34A;
    border-color: #BBF7D0;
}

.alert-error {
    background: var(--error-soft);
    color: #DC2626;
    border-color: #FECACA;
}

/* ==============================================
   Result pages (pago ok / error)
   ============================================== */

.result-container {
    max-width: 480px;
    margin: 100px auto;
    padding: 56px 48px;
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    text-align: center;
    animation: scaleIn var(--duration-lg) var(--ease);
    border: 1px solid var(--border);
}

.result-icon { margin-bottom: 24px; }
.result-success { color: var(--success); }
.result-error { color: var(--error); }

.result-container h1 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 10px;
    letter-spacing: -0.03em;
}

.result-message {
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 32px;
    line-height: 1.6;
}

.result-details {
    background: var(--accent-soft);
    border-radius: var(--radius-sm);
    padding: 18px 22px;
    margin-bottom: 32px;
    text-align: left;
}

.result-detail-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 14px;
    border-bottom: 0.5px solid var(--border);
}

.result-detail-row:last-child { border-bottom: none; }

.result-note {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 32px;
    line-height: 1.6;
}

/* ==============================================
   Login
   ============================================== */

.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    background: var(--bg);
}

.login-card {
    background: var(--bg-card);
    padding: 48px;
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    width: 100%;
    max-width: 380px;
    animation: scaleIn var(--duration-lg) var(--ease);
}

.login-title {
    font-size: 26px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
    letter-spacing: -0.03em;
}

.login-subtitle {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 36px;
}

/* ==============================================
   Admin Panel — Layout
   ============================================== */

.admin-body {
    display: flex;
    min-height: 100vh;
    background: var(--bg);
}

.admin-sidebar {
    width: 240px;
    min-width: 240px;
    background: var(--bg-card);
    border-right: 0.5px solid var(--border);
    padding: 24px 0;
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 0 20px 20px;
    border-bottom: 0.5px solid var(--border);
    margin-bottom: 12px;
}

.sidebar-header h2 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
}

.sidebar-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg);
    padding: 2px 8px;
    border-radius: var(--radius-full);
    margin-top: 6px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sidebar-nav { list-style: none; }

.sidebar-nav li a {
    display: flex;
    align-items: center;
    padding: 10px 20px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all var(--duration) var(--ease);
    border-left: 3px solid transparent;
}

.sidebar-nav li a:hover {
    background: var(--accent-soft);
    color: var(--text);
}

.sidebar-nav li a.active {
    background: var(--brand-soft);
    color: var(--brand);
    font-weight: 600;
    border-left-color: var(--brand);
}

.sidebar-divider {
    height: 0.5px;
    background: var(--border);
    margin: 8px 20px;
}

.sidebar-logout { color: var(--text-muted) !important; }

/* Main */
.admin-main {
    flex: 1;
    padding: 32px;
    overflow-x: auto;
    animation: fadeIn var(--duration-md) var(--ease);
}

.admin-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.admin-header h1 {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.03em;
}

.admin-header-count {
    font-size: 13px;
    color: var(--text-muted);
    background: var(--bg);
    padding: 4px 12px;
    border-radius: var(--radius-full);
}

/* Stats */
.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: all var(--duration) var(--ease);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.03em;
}

.stat-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-card-success .stat-value { color: var(--success); }
.stat-card-warning .stat-value { color: var(--warning); }
.stat-card-accent .stat-value { color: var(--warm); }

/* Filters */
.filter-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    background: var(--bg-card);
    padding: 4px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.filter-tab {
    padding: 7px 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-xs);
    transition: all var(--duration) var(--ease);
}

.filter-tab:hover { background: var(--bg); }

.filter-tab.active {
    background: var(--text);
    color: white;
    box-shadow: var(--shadow-sm);
}

.filter-count {
    font-size: 11px;
    opacity: 0.7;
    margin-left: 4px;
}

/* Filter groups */
.filter-group {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.filter-group-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    min-width: 80px;
}

/* Table */
.table-responsive { overflow-x: auto; }

.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
}

.admin-table th {
    text-align: left;
    padding: 12px 16px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--accent-soft);
    border-bottom: 0.5px solid var(--border);
}

.admin-table td {
    padding: 14px 16px;
    font-size: 14px;
    border-bottom: 0.5px solid var(--border);
    transition: background var(--duration) var(--ease);
}

.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: var(--accent-soft); }
.admin-table-clickable tbody tr { cursor: pointer; }

/* Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
}

.status-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}

.status-paid { background: var(--success-soft); color: #16A34A; }
.status-paid::before { background: var(--success); }
.status-pending { background: var(--warning-soft); color: #D97706; }
.status-pending::before { background: var(--warning); }
.status-failed { background: var(--error-soft); color: #DC2626; }
.status-failed::before { background: var(--error); }
.status-refunded { background: var(--info-soft); color: #2563EB; }
.status-refunded::before { background: var(--info); }

/* Payment method badges */
.status-method-stripe { background: #F0F0FF; color: #635BFF; }
.status-method-stripe::before { background: #635BFF; }
.status-method-manual { background: var(--accent-soft); color: var(--text-secondary); }
.status-method-manual::before { background: var(--text-secondary); }

/* Work status badges */
.status-work-todo { background: #FFF7ED; color: #C2410C; }
.status-work-todo::before { background: #EA580C; }
.status-work-done { background: #F0FDF4; color: #15803D; }
.status-work-done::before { background: #16A34A; }

/* Detail */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.detail-card {
    background: var(--bg-card);
    padding: 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

.detail-card h3 {
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.detail-card-full { grid-column: 1 / -1; }

.detail-card-danger {
    border-color: rgba(255, 59, 48, 0.2);
    background: #FFFBFB;
}

.detail-card-danger h3 {
    color: var(--error);
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 8px 0;
    font-size: 14px;
    gap: 16px;
    border-bottom: 0.5px solid var(--border);
}

.detail-row:last-child { border-bottom: none; }
.detail-row span:first-child { color: var(--text-muted); min-width: 110px; }
.price-accent { color: var(--warm) !important; font-weight: 700; }

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
    font-size: 14px;
}

/* ==============================================
   Form Builder
   ============================================== */

.builder-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 20px;
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.builder-toolbar-info {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
}

.builder-toolbar-actions {
    display: flex;
    gap: 8px;
}

.builder-fields-list {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.field-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    background: var(--bg-card);
    border-radius: var(--radius-xs);
    border: 1px solid var(--border);
    cursor: grab;
    transition: all var(--duration) var(--ease);
}

.field-item:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.field-item:active { cursor: grabbing; }

.field-item.dragging {
    opacity: 0.3;
    border-style: dashed;
}

.drag-placeholder {
    border: 2px dashed var(--text);
    background: var(--accent-soft);
    justify-content: center;
    min-height: 42px;
    border-radius: var(--radius-xs);
}

.field-item-heading {
    background: var(--accent-soft);
    border-color: var(--border-hover);
    border-width: 1.5px;
    margin-top: 12px;
}

.field-item-heading:first-child { margin-top: 0; }
.field-item-child { margin-left: 20px; }

.builder-step-badge {
    padding: 3px 10px;
    background: var(--brand);
    color: white;
    font-size: 10px;
    font-weight: 700;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.section-collapse-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 4px;
    font-size: 14px;
    color: var(--text-secondary);
    transition: transform var(--duration) var(--ease);
    line-height: 1;
}

.collapse-icon {
    display: inline-block;
    transition: transform var(--duration) var(--ease);
}

.section-collapse-btn.collapsed .collapse-icon {
    transform: rotate(-90deg);
}

.field-item-child.section-hidden { display: none; }

.field-drag-handle {
    font-size: 16px;
    color: var(--text-muted);
    cursor: grab;
    user-select: none;
    opacity: 0.3;
    transition: opacity var(--duration) var(--ease);
}

.field-item:hover .field-drag-handle { opacity: 1; }

.field-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    min-width: 0;
}

.field-type-badge {
    padding: 2px 8px;
    background: var(--bg);
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 600;
    border-radius: var(--radius-xs);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.field-label {
    font-size: 13px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.field-required-dot {
    color: var(--warm);
    font-weight: 700;
    font-size: 16px;
}

.field-cost-badge {
    padding: 2px 8px;
    background: var(--warm-soft);
    color: var(--warm);
    font-size: 10px;
    font-weight: 600;
    border-radius: var(--radius-xs);
    white-space: nowrap;
}

.field-inactive-badge {
    padding: 2px 8px;
    background: var(--warning-soft);
    color: #D97706;
    font-size: 10px;
    font-weight: 600;
    border-radius: var(--radius-xs);
}

.field-actions {
    display: flex;
    gap: 6px;
    opacity: 0;
    transition: opacity var(--duration) var(--ease);
}

.field-item:hover .field-actions { opacity: 1; }

.field-inactive { opacity: 0.45; }

.builder-preview-link {
    margin-top: 20px;
    text-align: center;
}

/* Bloque "Sin ubicar" */
.builder-block-header-unplaced {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    margin-top: 4px;
    margin-bottom: 4px;
    background: var(--warning-soft);
    border: 1px dashed var(--warning);
    border-radius: var(--radius-xs);
}
.builder-block-header-main {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.builder-block-title {
    font-size: 12px;
    font-weight: 700;
    color: #D97706;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.builder-block-subtitle {
    font-size: 11px;
    color: var(--text-muted);
}
.field-item-unplaced {
    background: var(--warning-soft);
    border-color: var(--warning);
    border-style: dashed;
    margin-left: 0;
}

/* Barra de guardado inferior */
.builder-save-bar {
    margin-top: 24px;
    padding: 16px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

/* Estado "cambios sin guardar" del botón */
.btn.btn-dirty {
    box-shadow: 0 0 0 3px var(--brand-glow);
    animation: pulseDirty 1.6s ease-in-out infinite;
}
@keyframes pulseDirty {
    0%, 100% { box-shadow: 0 0 0 3px var(--brand-glow); }
    50% { box-shadow: 0 0 0 6px var(--brand-glow); }
}

/* ==============================================
   Editor Modal
   ============================================== */

.editor-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    z-index: 1000;
    padding: 40px 20px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    animation: fadeIn 0.15s var(--ease);
}

.editor-modal {
    background: var(--bg-card);
    border-radius: 20px;
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 560px;
    margin: auto;
    flex-shrink: 0;
    animation: scaleIn var(--duration-md) var(--ease);
    border: 1px solid var(--border);
}

.editor-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 0.5px solid var(--border);
}

.editor-modal-header h3 {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.editor-close {
    background: var(--accent-soft);
    border: none;
    font-size: 18px;
    color: var(--text-muted);
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--duration) var(--ease);
}

.editor-close:hover {
    background: var(--error-soft);
    color: var(--error);
}

.editor-modal-body { padding: 24px; }

.editor-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    border-top: 0.5px solid var(--border);
    background: var(--accent-soft);
    border-radius: 0 0 20px 20px;
}

/* Field type grid */
.field-type-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    margin-top: 6px;
}

.field-type-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 4px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    cursor: pointer;
    transition: all var(--duration) var(--ease);
    font-family: inherit;
}

.field-type-btn:hover {
    border-color: var(--border-hover);
    transform: translateY(-1px);
}

.field-type-btn.selected {
    border-color: var(--text);
    background: var(--accent-soft);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.field-type-icon {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-secondary);
}

.field-type-btn.selected .field-type-icon { color: var(--text); }

.field-type-name {
    font-size: 10px;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.2;
}

.label-optional {
    font-weight: 400;
    color: var(--text-muted);
    font-size: 12px;
}

/* Cost type options */
.cost-type-options {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.radio-option.compact {
    padding: 10px 14px;
    gap: 10px;
}

.radio-option.compact div {
    display: flex;
    flex-direction: column;
}

/* Options builder */
.options-builder {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.option-row {
    animation: slideDown 0.15s var(--ease);
}

.option-row-fields {
    display: flex;
    gap: 6px;
    align-items: center;
}

.option-label-input { flex: 2; }
.option-value-input { flex: 1; }

.option-cost-wrap {
    position: relative;
    flex: 0 0 80px;
}

.option-cost-input { padding-right: 22px !important; }

.option-cost-symbol {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    color: var(--text-muted);
    pointer-events: none;
}

.option-remove-btn {
    background: none;
    border: none;
    font-size: 18px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-xs);
    transition: all var(--duration) var(--ease);
    opacity: 0.4;
}

.option-remove-btn:hover {
    color: var(--error);
    background: var(--error-soft);
    opacity: 1;
}

/* Toggle switches */
.field-settings-row {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
}

.toggle-option {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text);
    user-select: none;
}

.toggle-option input { display: none; }

.toggle-switch {
    width: 38px;
    height: 22px;
    background: var(--border);
    border-radius: 11px;
    position: relative;
    transition: background var(--duration) var(--ease);
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    transition: transform var(--duration) var(--ease-bounce);
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

.toggle-option input:checked + .toggle-switch {
    background: var(--brand);
}

.toggle-option input:checked + .toggle-switch::after {
    transform: translateX(16px);
}

/* ==============================================
   Settings
   ============================================== */

.settings-section {
    background: var(--bg-card);
    padding: 24px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin-bottom: 16px;
}

.settings-section-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 0.5px solid var(--border);
}

.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-group-full { grid-column: 1 / -1; }

/* ==============================================
   Responsive — Tablet
   ============================================== */

@media (max-width: 1080px) {
    .app-layout {
        grid-template-columns: 1fr;
        padding: 0;
        overflow-x: hidden;
        max-width: 100vw;
    }

    .top-header-inner {
        padding: 14px 20px;
    }

    .top-header-brand {
        flex: none;
    }

    .top-header-title {
        text-align: left;
        flex: 1;
        margin-left: 16px;
    }

    .top-header-spacer {
        display: none;
    }

    /* Steps become horizontal bar */
    .steps-sidebar {
        padding: 0;
        order: 1;
        overflow: hidden;
        max-width: 100vw;
    }

    .steps-sidebar-inner {
        position: relative;
        top: 0;
        padding: 12px 0;
        border-bottom: 0.5px solid var(--border);
        background: var(--bg-card);
        overflow: hidden;
    }

    .steps-label {
        display: none;
    }

    .steps-nav {
        flex-direction: row;
        overflow-x: auto;
        gap: 4px;
        -webkit-overflow-scrolling: touch;
        padding: 0 16px;
        scrollbar-width: none;
    }

    .steps-nav::-webkit-scrollbar {
        display: none;
    }

    .progress-step {
        white-space: nowrap;
        padding: 6px 10px;
        font-size: 12px;
        flex-shrink: 0;
    }

    .progress-step .step-number {
        width: 20px;
        height: 20px;
        font-size: 10px;
    }

    .steps-progress-track {
        margin: 10px 16px 0;
    }

    .form-main {
        order: 2;
        padding: 28px 20px;
        padding-bottom: 80px;
        border-left: none;
        border-right: none;
    }

    .price-sidebar {
        display: none;
    }

    .price-calculator-mobile {
        display: flex;
    }
}

/* ==============================================
   Responsive — Mobile
   ============================================== */

@media (max-width: 768px) {
    .top-header-inner {
        padding: 12px 16px;
    }

    .top-header-brand {
        flex: none;
    }

    .top-header-spacer {
        display: none;
    }

    .top-header-title {
        text-align: left;
        margin-left: 12px;
    }

    .top-header-title p {
        display: none;
    }

    .top-header-title h1 {
        font-size: 14px;
    }

    .form-main {
        padding: 20px 16px;
        padding-bottom: 64px;
    }

    .section-title {
        font-size: 20px;
    }

    .section-header {
        gap: 10px;
    }

    .form-navigation {
        padding-top: 24px;
        margin-top: 28px;
    }

    .price-calculator-mobile {
        display: flex;
        bottom: 10px;
        left: 16px;
        right: 16px;
        transform: none;
        max-width: none;
        width: auto;
        padding: 8px 18px;
    }

    /* Admin responsive */
    .admin-body { flex-direction: column; }

    .admin-sidebar {
        width: 100%;
        min-width: 100%;
        height: auto;
        position: relative;
        border-right: none;
        border-bottom: 0.5px solid var(--border);
        padding: 12px 0;
    }

    .sidebar-header { padding: 0 16px 12px; }

    .sidebar-nav {
        display: flex;
        overflow-x: auto;
        padding: 0 16px;
        gap: 2px;
    }

    .sidebar-nav li a {
        white-space: nowrap;
        padding: 8px 14px;
        border-radius: var(--radius-xs);
        border-left: none;
        font-size: 12px;
    }

    .sidebar-divider { display: none; }

    .admin-main {
        padding: 16px;
        overflow-x: hidden;
    }

    .admin-header h1 {
        font-size: 20px;
    }

    .stats-row {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .stat-card {
        padding: 14px 16px;
    }

    .stat-value {
        font-size: 22px;
    }

    /* Filter groups stack */
    .filter-group {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .filter-group-label {
        min-width: auto;
    }

    .filter-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        width: 100%;
    }

    .filter-tab {
        white-space: nowrap;
        padding: 6px 12px;
        font-size: 12px;
    }

    /* Hide columns not needed on mobile */
    .hide-mobile {
        display: none !important;
    }

    /* Table → card layout on mobile */
    .table-responsive {
        overflow-x: visible;
    }

    .admin-table {
        border: none;
        box-shadow: none;
    }

    .admin-table thead {
        display: none;
    }

    .admin-table,
    .admin-table tbody {
        display: block;
        width: 100%;
    }

    .admin-table tr {
        display: block;
        background: var(--bg-card);
        border: 1px solid var(--border);
        border-radius: var(--radius-sm);
        padding: 14px 16px;
        margin-bottom: 8px;
    }

    .admin-table td {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 4px 0;
        border-bottom: none;
        font-size: 13px;
    }

    .admin-table td::before {
        content: attr(data-label);
        font-size: 11px;
        font-weight: 600;
        color: var(--text-muted);
        text-transform: uppercase;
        letter-spacing: 0.03em;
        min-width: 80px;
    }

    .admin-table td:first-child {
        font-weight: 600;
        color: var(--text-muted);
        padding-bottom: 6px;
        margin-bottom: 4px;
        border-bottom: 0.5px solid var(--border);
    }

    .admin-table td:first-child::before {
        display: none;
    }

    .admin-table td:last-child {
        margin-top: 8px;
        padding-top: 8px;
        border-top: 0.5px solid var(--border);
    }

    .admin-table td:last-child::before {
        display: none;
    }

    .admin-table td:last-child .btn {
        width: 100%;
    }

    .admin-table tr:hover td {
        background: transparent;
    }

    .detail-grid { grid-template-columns: 1fr; }
    .settings-grid { grid-template-columns: 1fr; }
    .field-type-grid { grid-template-columns: repeat(3, 1fr); }
    .editor-modal { max-height: none; }
    .option-row-fields { flex-wrap: wrap; }
    .option-label-input { flex: 1 1 100%; }
    .builder-toolbar { flex-direction: column; align-items: flex-start; }
    .field-settings-row { flex-direction: column; gap: 12px; }
    .field-actions { opacity: 1; }
    .field-item-child { margin-left: 12px; }
}

/* Coupon feedback */
.coupon-feedback {
    font-size: 13px;
    margin-top: 6px;
    padding: 6px 10px;
    border-radius: 6px;
    font-weight: 500;
}
.coupon-valid {
    color: #15803d;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
}
.coupon-invalid {
    color: #b91c1c;
    background: #fef2f2;
    border: 1px solid #fecaca;
}
