:root {
    --color-bg: #f8f9fb;
    --color-surface: #ffffff;
    --color-surface-2: #f1f3f7;
    --color-primary: #2c5fb6;
    --color-primary-hover: #1e4a96;
    --color-primary-light: #e7f0fc;
    --color-text: #1a2236;
    --color-text-muted: #6b7589;
    --color-border: #e1e5ec;
    --color-success: #0a8050;
    --color-success-bg: #e6f5ee;
    --color-error: #c63838;
    --color-error-bg: #fdecec;
    --color-warning: #b8770a;
    --color-warning-bg: #fef5e6;

    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 16px;

    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
    --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.08);

    --font-sans: 'Plus Jakarta Sans', -apple-system, system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

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

html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.55;
    color: var(--color-text);
    background: var(--color-bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container { max-width: 1180px; margin: 0 auto; padding: 0 24px; width: 100%; }

main { flex: 1; padding: 40px 0 64px; }

a { color: var(--color-primary); text-decoration: none; }
a:hover { color: var(--color-primary-hover); }

/* ===== NAVBAR ===== */
.navbar {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    position: sticky; top: 0; z-index: 50;
}
.nav-inner { display: flex; justify-content: space-between; align-items: center; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; color: var(--color-text); }
.brand-mark { color: var(--color-primary); font-size: 22px; line-height: 1; }
.nav-links { display: flex; align-items: center; gap: 22px; }
.nav-links a { color: var(--color-text-muted); font-weight: 500; font-size: 14px; }
.nav-links a:hover { color: var(--color-text); }
.logout-form { margin: 0; }
.link-btn { background: none; border: 0; color: var(--color-text-muted); cursor: pointer; font: inherit; font-weight: 500; font-size: 14px; }
.link-btn:hover { color: var(--color-text); }

/* ===== TYPOGRAPHY ===== */
h1 { font-size: 32px; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 8px; }
h2 { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; margin-bottom: 14px; }
h3 { font-size: 17px; font-weight: 600; margin-bottom: 10px; }
.subtitle { color: var(--color-text-muted); margin-bottom: 28px; font-size: 16px; }

/* ===== CARDS ===== */
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: var(--shadow-sm);
}
.card + .card { margin-top: 18px; }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; padding-bottom: 16px; border-bottom: 1px solid var(--color-border); }
.card-header h2, .card-header h3 { margin-bottom: 0; }

/* ===== FORMS ===== */
.form-grid { display: grid; gap: 16px; }
.form-grid.cols-2 { grid-template-columns: 1fr 1fr; }
@media (max-width: 640px) { .form-grid.cols-2 { grid-template-columns: 1fr; } }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 600; font-size: 14px; color: var(--color-text); }
.field label .req { color: var(--color-error); }
.field input, .field select, .field textarea {
    width: 100%; padding: 11px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
    font: inherit; color: var(--color-text);
    transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-light);
}
.field .hint { color: var(--color-text-muted); font-size: 13px; }
.field-checkbox { display: flex; align-items: center; gap: 10px; }
.field-checkbox input { width: auto; }

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 12px 22px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font: inherit; font-weight: 600; font-size: 14px;
    cursor: pointer; text-decoration: none;
    transition: all .15s;
}
.btn-sm { padding: 8px 16px; font-size: 13px; }
.btn-primary { background: var(--color-primary); color: white; }
.btn-primary:hover { background: var(--color-primary-hover); color: white; }
.btn-secondary { background: var(--color-surface); color: var(--color-text); border-color: var(--color-border); }
.btn-secondary:hover { background: var(--color-surface-2); }
.btn-danger { background: var(--color-error); color: white; }
.btn-danger:hover { opacity: 0.9; color: white; }
.btn-block { width: 100%; }

/* ===== ALERTS ===== */
.alert { padding: 14px 18px; border-radius: var(--radius); margin-bottom: 18px; font-size: 14px; }
.alert-success { background: var(--color-success-bg); color: var(--color-success); border: 1px solid #cce8d8; }
.alert-error { background: var(--color-error-bg); color: var(--color-error); border: 1px solid #f5c6c6; }
.alert ul { margin-top: 6px; padding-left: 22px; }

/* ===== AUTH PAGES ===== */
.auth-wrap { max-width: 460px; margin: 40px auto; }
.auth-wrap .card { padding: 36px; }
.auth-wrap h1 { font-size: 26px; margin-bottom: 6px; }
.auth-foot { text-align: center; margin-top: 18px; color: var(--color-text-muted); font-size: 14px; }

/* ===== PLANS GRID ===== */
.plans-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 22px; margin-top: 32px; }
.plan-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 30px;
    display: flex; flex-direction: column;
    transition: transform .15s, box-shadow .15s, border-color .15s;
}
.plan-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--color-primary); }
.plan-card.featured { border-color: var(--color-primary); position: relative; }
.plan-card.featured::before {
    content: 'Recomendado';
    position: absolute; top: -12px; left: 30px;
    background: var(--color-primary); color: white;
    font-size: 12px; font-weight: 600; padding: 4px 12px; border-radius: 999px;
}
.plan-name { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.plan-interval { color: var(--color-text-muted); font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 18px; }
.plan-price { font-size: 36px; font-weight: 800; letter-spacing: -0.02em; }
.plan-price small { font-size: 14px; color: var(--color-text-muted); font-weight: 500; }
.plan-features { list-style: none; margin: 22px 0; flex: 1; }
.plan-features li { padding: 7px 0; font-size: 14px; color: var(--color-text); display: flex; gap: 8px; }
.plan-features li::before { content: '✓'; color: var(--color-success); font-weight: 700; }

/* ===== TABLES ===== */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--color-border); }
.table th { background: var(--color-surface-2); font-weight: 600; color: var(--color-text-muted); text-transform: uppercase; font-size: 12px; letter-spacing: 0.04em; }
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: var(--color-surface-2); }

/* ===== BADGES ===== */
.badge { display: inline-block; padding: 3px 10px; font-size: 12px; font-weight: 600; border-radius: 999px; }
.badge-success { background: var(--color-success-bg); color: var(--color-success); }
.badge-error { background: var(--color-error-bg); color: var(--color-error); }
.badge-warning { background: var(--color-warning-bg); color: var(--color-warning); }
.badge-muted { background: var(--color-surface-2); color: var(--color-text-muted); }

/* ===== STATS ===== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; margin-bottom: 32px; }
.stat-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: 22px; }
.stat-label { color: var(--color-text-muted); font-size: 13px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em; }
.stat-value { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; margin-top: 6px; }

/* ===== CHECKOUT ===== */
.checkout-grid { display: grid; grid-template-columns: 1fr 380px; gap: 32px; }
@media (max-width: 900px) { .checkout-grid { grid-template-columns: 1fr; } }
.checkout-summary { background: var(--color-surface-2); border-radius: var(--radius-lg); padding: 24px; height: fit-content; }
.summary-row { display: flex; justify-content: space-between; padding: 8px 0; }
.summary-total { display: flex; justify-content: space-between; padding-top: 14px; margin-top: 14px; border-top: 1px solid var(--color-border); font-size: 18px; font-weight: 700; }
.card-icons { color: var(--color-text-muted); font-size: 12px; margin-top: 8px; }
.lock-note { display: flex; align-items: center; gap: 8px; color: var(--color-text-muted); font-size: 13px; margin-top: 16px; }

/* ===== INVOICE ===== */
.invoice-doc { max-width: 800px; margin: 0 auto; }
.invoice-head { display: flex; justify-content: space-between; align-items: flex-start; padding-bottom: 24px; margin-bottom: 24px; border-bottom: 2px solid var(--color-text); }
.invoice-number { font-family: var(--font-mono); font-size: 20px; font-weight: 700; }
.invoice-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 28px; }
.meta-block h4 { font-size: 12px; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 6px; }

/* ===== FOOTER ===== */
.footer { background: var(--color-surface); border-top: 1px solid var(--color-border); padding: 22px 0; color: var(--color-text-muted); font-size: 13px; text-align: center; }

/* ===== UTILITIES ===== */
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.mt-2 { margin-top: 8px; } .mt-4 { margin-top: 16px; } .mt-6 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; } .mb-4 { margin-bottom: 16px; } .mb-6 { margin-bottom: 24px; }
.text-muted { color: var(--color-text-muted); }
.text-mono { font-family: var(--font-mono); }
.text-right { text-align: right; }
.text-center { text-align: center; }
