/* ================================================================
   DESIGN SYSTEM — GESTOR ACADÉMICO (Didac-Click)
   Identidad canónica: Poppins, paleta verde DIDAC (BRANDING.md)
   ================================================================ */

/* — DESIGN TOKENS — */
:root {
    --brand-primary: #0E6B4F;
    --brand-primary-hover: #063B2E;
    --brand-primary-light: #E8F5EF;
    --brand-primary-subtle: #F5F7F6;
    --brand-accent: #1A8F67;
    --brand-accent-light: #DCE5E1;
    --text-primary: #1E2A27;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --text-faint: #94a3b8;
    --surface: #ffffff;
    --surface-alt: #F5F7F6;
    --surface-raised: #DCE5E1;
    --border: #DCE5E1;
    --border-light: #E8F5EF;
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --shadow-xs: 0 1px 2px rgba(15,43,91,0.04);
    --shadow-sm: 0 1px 3px rgba(15,43,91,0.07), 0 1px 2px rgba(15,43,91,0.04);
    --shadow-md: 0 4px 8px rgba(15,43,91,0.06), 0 2px 4px rgba(15,43,91,0.04);
    --transition: 0.18s ease;
    --font-body: 'Poppins', system-ui, -apple-system, sans-serif;
    --font-heading: 'Poppins', system-ui, sans-serif;
}

/* — RESET & BASE — */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
* { -ms-overflow-style: none; scrollbar-width: none; }
*::-webkit-scrollbar { display: none; }

body {
    font-family: var(--font-body);
    background: linear-gradient(160deg, #F5F7F6 0%, #DCE5E1 40%, #DCE5E1 100%);
    height: 100vh; overflow: hidden;
    display: flex; flex-direction: column;
    color: var(--text-secondary);
    font-size: 0.8rem;
    letter-spacing: -0.01em;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-family: var(--font-heading); color: var(--text-primary); }

/* — HEADER — */
.header-compact {
    height: 52px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 20px;
    box-shadow: var(--shadow-xs);
    z-index: 50;
}

/* — BRANDING — */
.brand-area { display: flex; align-items: center; gap: 14px; min-width: 180px; }
.logo-container { display: flex; align-items: center; gap: 0.3rem; cursor: default; user-select: none; transform: scale(0.85); transform-origin: left center; }
.text-section { display: flex; flex-direction: column; align-items: center; width: max-content; }
.text-colegio { color: var(--brand-primary); font-family: var(--font-heading); font-weight: 700; letter-spacing: 1px; line-height: 1; font-size: 0.5rem; margin-bottom: -1px; }
.text-pinceladas { font-family: var(--font-heading); font-weight: 700; color: var(--brand-accent); line-height: 1; font-size: 1.2rem; margin-bottom: -2px; }
.text-didac-sub { background-color: var(--brand-primary); color: #fff; padding: 1px 0; border-radius: 50px; font-family: var(--font-heading); font-weight: 700; display: block; text-align: center; font-size: 0.45rem; width: 100%; letter-spacing: 0.25em; margin-right: -0.25em; }

.app-title { padding-left: 14px; border-left: 2px solid var(--border); display: flex; flex-direction: column; justify-content: center; align-items: flex-start; }
.app-title h1 { font-size: 0.8rem; font-weight: 800; color: var(--brand-primary); line-height: 1; text-transform: uppercase; letter-spacing: 0.04em; }
.app-title span { font-size: 0.5rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; margin-top: 2px; }

/* — LEVEL TABS — */
.level-tabs-wrapper { flex: 1; display: flex; justify-content: center; overflow: hidden; padding: 0 20px; }
.level-tabs-container { display: flex; gap: 4px; overflow-x: auto; max-width: 100%; padding: 2px; }
.level-tab {
    padding: 5px 14px; font-size: 0.7rem; font-weight: 600;
    color: var(--text-muted); border-radius: var(--radius-md);
    cursor: pointer; transition: all var(--transition);
    white-space: nowrap; border: 1px solid transparent;
}
.level-tab:hover { background: var(--surface-alt); color: var(--text-secondary); }
.level-tab.active {
    background: var(--brand-primary-light);
    color: var(--brand-primary);
    border-color: rgba(26, 143, 103, 0.4);
    font-weight: 700;
}

/* — HEADER ACTIONS — */
.actions-area { display: flex; gap: 6px; align-items: center; min-width: max-content; }
.header-btn {
    height: 30px; padding: 0 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.65rem; font-weight: 700;
    border-radius: var(--radius-md);
    transition: all var(--transition);
    text-transform: uppercase; letter-spacing: 0.02em;
    cursor: pointer; border: none;
}
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid transparent; }
.btn-ghost:hover { background: var(--surface-raised); color: var(--text-secondary); }
.btn-outline { background: var(--surface); border: 1px solid var(--border); color: var(--text-secondary); }
.btn-outline:hover { border-color: #cbd5e1; color: var(--text-primary); box-shadow: var(--shadow-xs); }
.btn-primary { background: var(--brand-primary); border: 1px solid var(--brand-primary); color: #fff; box-shadow: var(--shadow-xs); }
.btn-primary:hover { background: var(--brand-primary-hover); box-shadow: var(--shadow-sm); }
.btn-danger { background: #fef2f2; border: 1px solid #fecaca; color: #dc2626; }
.btn-danger:hover { background: #fee2e2; }
.btn-undo { background: var(--brand-primary-light); border: 1px solid rgba(26, 143, 103, 0.4); color: var(--brand-primary); }
.btn-undo:hover { background: rgba(26, 143, 103, 0.15); }

/* — SIDEBAR — */
.sidebar-slim {
    width: 68px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
    padding: 10px 0;
    z-index: 40; align-items: center;
}
.nav-item {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    width: 52px; height: 48px;
    margin-bottom: 4px;
    border-radius: var(--radius-md);
    transition: all var(--transition); cursor: pointer;
    color: var(--text-muted);
}
.nav-item:hover { background: var(--surface-alt); color: var(--text-primary); }
.nav-item.active { background: var(--brand-primary-light); color: var(--brand-primary); }
.nav-icon { width: 18px; height: 18px; margin-bottom: 3px; }
.nav-label { font-size: 0.5rem; text-transform: uppercase; letter-spacing: 0.03em; font-weight: 700; text-align: center; line-height: 1; }
.nav-separator { width: 28px; height: 1px; background: var(--border); margin: 6px 0; }

/* — GRACE BANNER (período de gracia) — */
.grace-banner {
    background: linear-gradient(90deg, #b45309, #d97706);
    color: #fff;
    padding: 8px 20px;
    z-index: 45;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}
.grace-banner-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.grace-banner-icon { width: 20px; height: 20px; flex-shrink: 0; }
.grace-banner-text { flex: 1; min-width: 200px; font-size: 0.8rem; line-height: 1.4; }
.grace-banner-text b { color: #fff; }
.grace-banner-cta {
    background: #fff;
    color: #b45309;
    border: none;
    border-radius: var(--radius-md);
    padding: 7px 16px;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    cursor: pointer;
    text-transform: uppercase;
    transition: transform var(--transition), box-shadow var(--transition);
}
.grace-banner-cta:hover { transform: translateY(-1px); box-shadow: 0 3px 8px rgba(0, 0, 0, 0.18); }

/* — CONTENT AREA — */
.content-fluid { flex: 1; padding: 20px 24px; overflow-y: auto; background: linear-gradient(180deg, var(--surface-alt) 0%, var(--surface-raised) 100%); }

/* — INICIO SECTION (full area) — */
.inicio-wrapper {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}
.inicio-hero {
    background: var(--brand-primary);
    padding: 28px 40px;
    color: #fff;
}
.inicio-hero h2 {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 800;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 4px;
}
.inicio-hero p {
    font-size: 0.68rem;
    color: rgba(255,255,255,0.6);
    font-weight: 500;
}
.inicio-body {
    flex: 1;
    padding: 40px;
    overflow-y: auto;
    background: linear-gradient(180deg, var(--surface) 0%, var(--surface-alt) 100%);
    display: flex;
    justify-content: center;
}
.inicio-container {
    width: 100%;
    max-width: 1100px;
    display: flex;
    flex-direction: column;
    gap: 48px;
    padding-bottom: 24px;
}

.inicio-section-transparent {
    text-align: center;
    max-width: 900px;
    margin: 0 auto;
}

.inicio-title-center {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--brand-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 16px;
}

.inicio-text {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.75;
    margin-bottom: 16px;
}

.req-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 24px;
    margin-top: 32px;
}
.req-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
    display: flex;
    flex-direction: column;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
    text-align: left;
}
.req-card:hover {
    border-color: var(--brand-primary-light);
    box-shadow: 0 8px 24px rgba(0,0,0,0.06);
    transform: translateY(-4px);
}
.req-card-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}
.req-icon {
    display: flex; align-items: center; justify-content: center;
    width: 44px; height: 44px;
    background: var(--brand-primary-light);
    color: var(--brand-primary);
    border-radius: 12px;
}
.req-card-title {
    font-family: var(--font-heading);
    font-size: 0.88rem;
    font-weight: 800;
    color: var(--text-primary);
}
.req-card-text {
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.7;
}
.inicio-conclusion {
    background: var(--brand-primary);
    color: white;
    border-radius: var(--radius-lg);
    padding: 32px;
    text-align: center;
    margin-top: 24px;
    box-shadow: var(--shadow-md);
}
.inicio-conclusion h3 {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 800;
    text-transform: uppercase;
    margin-bottom: 12px;
    color: white;
    letter-spacing: 0.05em;
}
.inicio-conclusion p {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.85);
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.7;
}
.inicio-conclusion strong { color: white; }
.inicio-footer {
    padding: 12px 40px;
    background: var(--surface-alt);
    border-top: 1px solid var(--border-light);
    font-size: 0.6rem;
    color: var(--text-faint);
    font-weight: 600;
}

/* — SECTION HEADER (unified pattern for all sections) — */
.section-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 16px; padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}
.section-header h2 {
    font-size: 0.85rem; font-weight: 800;
    color: var(--brand-primary);
    text-transform: uppercase; letter-spacing: 0.06em;
}
.section-header p {
    font-size: 0.65rem; color: var(--text-muted);
    font-weight: 500; margin-top: 2px;
}
.section-header .section-actions { display: flex; gap: 6px; align-items: center; }

/* — PANELS — */
.panel {
    background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs); min-width: 0;
}
.panel-header {
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-light);
    display: flex; justify-content: space-between; align-items: center;
    background: var(--surface);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.panel-header h2, .panel-header h3, .panel-header span.panel-title {
    font-size: 0.7rem; font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase; letter-spacing: 0.04em;
}
.panel-body { padding: 16px 20px; }

/* — FORM ELEMENTS — */
.input-std {
    width: 100%; font-size: 0.78rem; font-family: var(--font-body);
    padding: 0.4rem 0.65rem;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    transition: all var(--transition); outline: none;
    background: var(--surface); height: 34px; color: var(--text-primary);
}
.input-std:focus {     border-color: var(--brand-primary); box-shadow: 0 0 0 3px rgba(14,107,79,0.12); }
.lbl-std {
    font-size: 0.6rem; font-weight: 700; color: var(--text-muted);
    margin-bottom: 0.3rem; display: block;
    text-transform: uppercase; letter-spacing: 0.04em;
}

/* — STANDARD BUTTONS (used inside panels/sections) — */
.btn-std {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 0 14px; height: 34px;
    font-size: 0.65rem; font-weight: 700; font-family: var(--font-body);
    text-transform: uppercase; letter-spacing: 0.02em;
    border-radius: var(--radius-sm); cursor: pointer;
    transition: all var(--transition); border: 1px solid transparent;
}
.btn-std-primary { background: var(--brand-primary); color: #fff; border-color: var(--brand-primary); }
.btn-std-primary:hover { background: var(--brand-primary-hover); box-shadow: var(--shadow-sm); }
.btn-std-secondary { background: var(--surface-raised); color: var(--text-secondary); border-color: var(--border); }
.btn-std-secondary:hover { background: #e8ecf1; color: var(--text-primary); }
.btn-std-ghost { background: transparent; color: var(--text-muted); }
.btn-std-ghost:hover { background: var(--surface-raised); color: var(--text-secondary); }
.btn-std-danger { background: #fef2f2; color: #dc2626; border-color: #fecaca; }
.btn-std-danger:hover { background: #fee2e2; }
.btn-std-icon { width: 34px; padding: 0; }

/* — INLINE ACTION BUTTONS (table row actions) — */
.action-link {
    font-size: 0.6rem; font-weight: 700; text-transform: uppercase;
    cursor: pointer; transition: color var(--transition);
    background: none; border: none; padding: 2px 6px;
    border-radius: var(--radius-sm); font-family: var(--font-body);
}
.action-link-edit { color: var(--brand-primary); }
.action-link-edit:hover { color: var(--brand-primary-hover); background: var(--brand-primary-light); }
.action-link-delete { color: var(--text-faint); }
.action-link-delete:hover { color: #dc2626; background: #fef2f2; }

/* — STANDARD TABLES — */
.data-table { width: 100%; text-align: left; font-size: 0.75rem; border-collapse: collapse; }
.data-table thead { background: var(--surface-alt); }
.data-table th {
    padding: 10px 16px; font-size: 0.6rem; font-weight: 700;
    color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em;
    border-bottom: 1px solid var(--border);
}
.data-table td { padding: 10px 16px; border-bottom: 1px solid var(--border-light); color: var(--text-secondary); }
.data-table tr:hover td { background: var(--surface-alt); }
.data-table .col-actions { text-align: right; white-space: nowrap; }

/* — FORM ROW (unified input rows) — */
.form-row {
    display: flex; gap: 12px; align-items: flex-end;
    padding: 12px 16px;
    background: var(--surface-alt); border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
}

/* — SCHEDULE TABLE — */
.schedule-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 0.7rem; }
.schedule-table th {
    background: var(--surface-alt); color: var(--text-secondary);
    padding: 8px; text-transform: uppercase; font-weight: 700;
    border: 1px solid var(--border); font-size: 0.6rem; letter-spacing: 0.03em;
}
.schedule-table td { background: var(--surface); border: 1px solid var(--border-light); vertical-align: top; padding: 2px; height: 45px; }
.time-col { background: var(--surface-alt); text-align: center; vertical-align: middle !important; font-weight: 700; color: var(--text-muted); width: 60px; }
.class-card {
    height: 100%; width: 100%; padding: 3px 5px;
    display: flex; flex-direction: column; justify-content: center;
    border-radius: var(--radius-sm); font-size: 0.68rem;
    border-left: 3px solid transparent; overflow: hidden;
    box-shadow: var(--shadow-xs); transition: all var(--transition);
}
.class-card:hover { transform: scale(1.02); box-shadow: var(--shadow-md); z-index: 10; }

.class-card.force-conflict {
    background-color: #fee2e2 !important;
    border-left-color: #ef4444 !important;
    color: #991b1b !important;
}

/* — SUBJECT COLOR PALETTE (Hash-based) — */
.sub-color-0  { background: #eff6ff; color: #1e3a8a; border-left-color: #2563eb; }
.sub-color-1  { background: #f0fdf4; color: #14532d; border-left-color: #16a34a; }
.sub-color-2  { background: #faf5ff; color: #581c87; border-left-color: #9333ea; }
.sub-color-3  { background: #fff7ed; color: #7c2d12; border-left-color: #ea580c; }
.sub-color-4  { background: #fdf2f8; color: #831843; border-left-color: #db2777; }
.sub-color-5  { background: #f0f9ff; color: #0c4a6e; border-left-color: #0284c7; }
.sub-color-6  { background: #ccfbf1; color: #134e4a; border-left-color: #0d9488; }
.sub-color-7  { background: #fefce8; color: #713f12; border-left-color: #ca8a04; }
.sub-color-8  { background: #fef2f2; color: #7f1d1d; border-left-color: #dc2626; }
.sub-color-9  { background: #e0e7ff; color: #312e81; border-left-color: #4f46e5; }
.sub-color-10 { background: #ecfeff; color: #164e63; border-left-color: #0891b2; }
.sub-color-11 { background: #f7fee7; color: #365314; border-left-color: #65a30d; }
.sub-color-12 { background: #fffbeb; color: #78350f; border-left-color: #d97706; }
.sub-color-13 { background: #fdf4ff; color: #701a75; border-left-color: #c026d3; }
.sub-color-14 { background: #fff1f2; color: #881337; border-left-color: #e11d48; }
.sub-color-15 { background: #f5f3ff; color: #4c1d95; border-left-color: #7c3aed; }
.sub-color-16 { background: #ecfdf5; color: #064e3b; border-left-color: #059669; }
.sub-color-17 { background: #f8fafc; color: #334155; border-left-color: #475569; }
.sub-color-18 { background: #fafaf9; color: #44403c; border-left-color: #57534e; }
.sub-color-19 { background: #fff0f5; color: #4a044e; border-left-color: #9d174d; }

.c-break { background: var(--surface-alt); color: var(--text-faint); border: 1px dashed var(--border); }

/* — ITEM CARDS (levels, classrooms) — */
.item-card {
    background: var(--surface); padding: 12px 14px;
    border: 1px solid var(--border); border-radius: var(--radius-md);
    display: flex; justify-content: space-between; align-items: center;
    transition: all var(--transition);
    box-shadow: var(--shadow-xs);
}
.item-card:hover { border-color: #cbd5e1; box-shadow: var(--shadow-sm); }
.item-card .item-name { font-size: 0.75rem; font-weight: 700; color: var(--text-primary); }
.item-card .item-sub { font-size: 0.6rem; color: var(--text-muted); margin-top: 1px; }

/* — UTILITIES — */
.hidden { display: none !important; }
.fade-in { animation: fadeIn 0.2s ease-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
.max-section { max-width: 1100px; margin: 0 auto; width: 100%; }
.divider-v { width: 1px; height: 24px; background: var(--border); }
.badge { display: inline-block; font-size: 0.55rem; font-weight: 700; padding: 2px 8px; border-radius: 50px; text-transform: uppercase; letter-spacing: 0.04em; }
.badge-info { background: var(--brand-primary-light); color: var(--brand-primary); }
.badge-warn { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fef2f2; color: #dc2626; }
.badge-success { background: #ecfdf5; color: #065f46; }

/* — GENERATION OVERLAY — */
#gen-overlay { position:fixed; inset:0; background:rgba(14,107,79,0.94); z-index:200; display:none; justify-content:center; align-items:center; flex-direction:column; gap:20px; backdrop-filter:blur(10px); opacity:0; transition:opacity 0.3s ease; }
#gen-overlay.show { display:flex; opacity:1; }
#gen-overlay.fade-out { opacity:0; }
.gen-spinner { width:70px; height:70px; position:relative; }
.gen-ring { position:absolute; inset:0; border-radius:50%; border:2px solid transparent; }
.gen-ring:nth-child(1) { border-top-color:#e2e8f0; animation:spin-m 2s cubic-bezier(.4,0,.2,1) infinite; }
.gen-ring:nth-child(2) { inset:8px; border-right-color: rgba(255,255,255,0.5); animation:spin-m 1.6s linear infinite reverse; }
.gen-ring:nth-child(3) { inset:16px; border-bottom-color:#fff; animation:spin-m 1.2s ease-in-out infinite; }
.gen-title { color:#fff; font-family:var(--font-heading); font-weight:800; font-size:0.9rem; text-transform:uppercase; letter-spacing:0.12em; text-align:center; line-height:1.4; }
.gen-phase { color:rgba(255,255,255,0.7); font-size:0.65rem; font-weight:600; text-transform:uppercase; letter-spacing:0.08em; min-height:16px; transition:opacity 0.3s; text-align:center; }
.gen-bar-track { width:260px; height:4px; background:rgba(255,255,255,0.1); border-radius:2px; overflow:hidden; }
.gen-bar-fill { height:100%; background:linear-gradient(90deg,rgba(255,255,255,0.4),#fff); border-radius:2px; width:0%; transition:width 0.5s ease; }
.gen-stats { display:flex; gap:24px; color:rgba(255,255,255,0.5); font-size:0.55rem; font-weight:600; text-transform:uppercase; }
.gen-stats b { color:#fff; font-size:0.7rem; display:block; margin-top:2px; transition:all 0.3s; }
.gen-cancel-btn { margin-top:10px; background:rgba(255,255,255,0.06); border:1px solid rgba(255,255,255,0.12); color:rgba(255,255,255,0.5); padding:6px 20px; border-radius:var(--radius-md); font-size:0.55rem; font-weight:700; text-transform:uppercase; cursor:pointer; transition:all 0.2s; }
.gen-cancel-btn:hover { background:rgba(255,255,255,0.12); color:#fff; }
@keyframes spin-m { to { transform: rotate(360deg); } }

/* — LOADER — */
#loading-overlay { position:fixed; inset:0; background:rgba(255,255,255,0.95); z-index:100; display:flex; justify-content:center; align-items:center; flex-direction:column; transition:opacity 0.2s; pointer-events:none; opacity:0; }
#loading-overlay.show { opacity:1; pointer-events:auto; }
.didac-loader { display:flex; align-items:center; justify-content:center; position:relative; width:50px; height:50px; }
.didac-circle { position:absolute; width:100%; height:100%; border-radius:50%; border:2px solid transparent; border-top-color:var(--brand-primary); animation:spin-m 1.5s cubic-bezier(.4,0,.2,1) infinite; }
.didac-circle:nth-child(2) { width:70%; height:70%; border-top-color:var(--text-faint); animation-direction:reverse; animation-duration:1.2s; }
.didac-circle:nth-child(3) { width:40%; height:40%; border-top-color:var(--border); animation-duration:1s; }

/* — MODALS — */
#generic-confirm-modal, #generic-input-modal, #generic-alert-modal, #copy-structure-modal {
    position:fixed; inset:0; background:rgba(15,23,42,0.5);
    z-index:90; justify-content:center; align-items:center;
    opacity:0; pointer-events:none; transition:opacity 0.2s; display:none;
    backdrop-filter: blur(2px);
}
#generic-confirm-modal.modal-open, #generic-input-modal.modal-open, #generic-alert-modal.modal-open, #copy-structure-modal.modal-open { display:flex; opacity:1; pointer-events:auto; }

/* — CUSTOM TOOLTIPS (reemplaza el title nativo del browser) — */
[data-tip] { position: relative; }
[data-tip]::before,
[data-tip]::after { display: none !important; }

#tooltip-popup {
    position: fixed;
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.12s ease, transform 0.12s ease;
    transform: translateY(4px);
    max-width: 240px;
    border-radius: 8px;
    background: #0f172a;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    line-height: 1.3;
    padding: 9px 12px;
    box-shadow: 0 10px 25px rgba(15,23,42,0.22);
    font-family: var(--font-body);
    white-space: pre-wrap;
    word-break: break-word;
}

#tooltip-popup.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

#tooltip-popup .tooltip-arrow {
    position: absolute;
    width: 0;
    height: 0;
    border: 6px solid transparent;
}

#tooltip-popup.placement-top .tooltip-arrow {
    border-bottom-color: #0f172a;
    bottom: -12px;
    left: 50%;
    transform: translateX(-50%);
}

#tooltip-popup.placement-bottom .tooltip-arrow {
    border-top-color: #0f172a;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
}

#tooltip-popup.placement-left .tooltip-arrow {
    border-right-color: #0f172a;
    right: -12px;
    top: 50%;
    transform: translateY(-50%);
}

#tooltip-popup.placement-right .tooltip-arrow {
    border-left-color: #0f172a;
    left: -12px;
    top: 50%;
    transform: translateY(-50%);
}

/* — CONFLICTS — */
.conflict-card { border-left: 3px solid #ef4444; background: #fff1f2; padding: 10px; margin-bottom: 8px; border-radius: var(--radius-sm); }
.plan-step { padding: 8px; border-bottom: 1px solid var(--border-light); font-size: 0.75rem; color: var(--text-secondary); display: flex; gap: 8px; align-items: flex-start; }
.step-icon { color: var(--brand-primary); font-weight: bold; min-width: 16px; }

/* — CUSTOM SELECT — */
.csel-wrapper { position: relative; width: 100%; }
.csel-trigger {
    width: 100%; padding: 0 28px 0 10px; border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--surface); cursor: pointer; height: 34px; display: flex; align-items: center;
    overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 0.78rem;
    color: var(--text-primary); transition: border-color 0.2s, box-shadow 0.2s; position: relative;
    outline: none; user-select: none; font-family: var(--font-body);
}
.csel-trigger::after {
    content: ''; position: absolute; right: 10px; top: 50%; transform: translateY(-2px);
    border: 4px solid transparent; border-top: 5px solid var(--text-faint); transition: transform 0.2s;
}
.csel-wrapper.open .csel-trigger::after { transform: translateY(-5px) rotate(180deg); }
.csel-trigger:hover { border-color: #94a3b8; }
.csel-wrapper.open .csel-trigger {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(14,107,79,0.12);
}
#csel-global-dropdown {
    position: fixed; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
    box-shadow: 0 12px 32px rgba(0,0,0,0.12), 0 4px 12px rgba(0,0,0,0.06);
    max-height: 220px; overflow-y: auto; z-index: 9999; display: none; padding: 4px;
}
#csel-global-dropdown.open { display: block; animation: cselSlide 0.15s ease; }
@keyframes cselSlide { from { opacity:0; transform:translateY(-4px); } to { opacity:1; transform:translateY(0); } }
.csel-option {
    padding: 7px 12px; font-size: 0.75rem; cursor: pointer; transition: background 0.1s, color 0.1s;
    color: var(--text-secondary); border-radius: var(--radius-sm); margin: 1px 0; font-family: var(--font-body);
}
.csel-option:hover { background: var(--brand-primary-light); color: var(--brand-primary); }
.csel-option.active { background: var(--brand-primary); color: white; font-weight: 600; }

/* — TOAST — */
#toast {
    position: fixed; bottom: 16px; right: 16px;
    background: var(--text-primary); color: #fff;
    padding: 10px 18px; border-radius: var(--radius-md);
    box-shadow: var(--shadow-md); font-size: 0.72rem; font-weight: 600;
    transition: opacity 0.3s; opacity: 0; pointer-events: none; z-index: 50;
    font-family: var(--font-body);
}

/* ============================================================
   SAAS / AUTH — Sistema de Licencias
   ============================================================ */

/* — Nav perfil avatar integrado — */
.nav-spacer { flex: 1; }

.nav-perfil-icon-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 3px;
}
.nav-perfil-icon-wrap .nav-icon { margin-bottom: 0; }
.nav-perfil-dot {
  position: absolute;
  top: -2px;
  right: -3px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
  border: 1.5px solid var(--surface);
}
.nav-perfil-dot.expired { background: #dc2626; }
.nav-perfil-dot.expiring { background: #f59e0b; }

/* ============================================================
   SECCIÓN PERFIL — Mi Cuenta
   ============================================================ */
.perfil-wrap {
  display: flex;
  flex-direction: column;
  gap: 0;
  height: 100%;
  padding: 12px 16px;
  width: 100%;
  box-sizing: border-box;
  overflow-y: auto;
}

/* Left: User Identity Card */
.perfil-user-card {
  width: 230px;
  flex-shrink: 0;
  background: linear-gradient(145deg, #0E6B4F 0%, #0A5640 55%, #063B2E 100%);
  border-radius: 16px;
  padding: 28px 18px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  color: #fff;
  box-shadow: 0 10px 36px rgba(15,43,91,0.28), 0 2px 8px rgba(0,0,0,0.1);
  position: sticky;
  top: 0;
}
.perfil-avatar-container { position: relative; margin-bottom: 8px; }
.perfil-avatar-lg {
  width: 76px;
  height: 76px;
  border-radius: 22px;
  background: rgba(255,255,255,0.12);
  border: 2px solid rgba(255,255,255,0.22);
  color: #fff;
  font-size: 1.6rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.15), 0 4px 16px rgba(0,0,0,0.2);
}
.perfil-avatar-status {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #22c55e;
  border: 2.5px solid #0E6B4F;
  box-shadow: 0 0 0 1px rgba(34,197,94,0.3);
}
.perfil-avatar-status.expired { background: #dc2626; box-shadow: 0 0 0 1px rgba(220,38,38,0.3); }
.perfil-avatar-status.expiring { background: #f59e0b; box-shadow: 0 0 0 1px rgba(245,158,11,0.3); }

.perfil-card-name {
  font-size: 0.88rem;
  font-weight: 800;
  color: #fff;
  text-align: center;
  line-height: 1.3;
  font-family: var(--font-heading);
  margin-top: 2px;
  word-break: break-word;
}
.perfil-card-email {
  font-size: 0.58rem;
  color: rgba(255,255,255,0.5);
  text-align: center;
  word-break: break-all;
  line-height: 1.4;
}
.perfil-card-plan-badge {
  font-size: 0.52rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: rgba(255,255,255,0.12);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 20px;
  padding: 3px 12px;
  margin-top: 4px;
}
.perfil-card-plan-badge.expired {
  background: rgba(220,38,38,0.25);
  border-color: rgba(220,38,38,0.4);
  color: #fca5a5;
}

.perfil-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
  margin-top: 14px;
}
.perfil-stat {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  padding: 9px 6px 8px;
  text-align: center;
}
.perfil-stat-value {
  font-size: 1.15rem;
  font-weight: 800;
  color: #fff;
  font-family: var(--font-heading);
  line-height: 1;
}
.perfil-stat-label {
  font-size: 0.44rem;
  color: rgba(255,255,255,0.45);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  line-height: 1.2;
}

.perfil-days-track {
  width: 100%;
  height: 4px;
  background: rgba(255,255,255,0.12);
  border-radius: 2px;
  margin-top: 6px;
  overflow: hidden;
}
.perfil-days-fill {
  height: 100%;
  background: linear-gradient(90deg, #22c55e, #4ade80);
  border-radius: 2px;
  transition: width 0.7s ease;
}

.perfil-logout-btn {
  margin-top: 18px;
  width: 100%;
  padding: 9px;
  border-radius: 9px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.13);
  color: rgba(255,255,255,0.65);
  font-size: 0.62rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all var(--transition);
  font-family: var(--font-body);
}
.perfil-logout-btn:hover {
  background: rgba(220,38,38,0.18);
  border-color: rgba(220,38,38,0.35);
  color: #fca5a5;
}

/* Right: Panel with Tabs */
.perfil-panel {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

.perfil-tabs-nav {
  display: flex;
  align-items: flex-end;
  padding: 0 22px;
  border-bottom: 1px solid var(--border);
  gap: 2px;
  background: var(--surface-alt);
}
.perfil-tab-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 18px;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font-body);
  margin-bottom: -1px;
  white-space: nowrap;
}
.perfil-tab-btn:hover { color: var(--brand-primary); }
.perfil-tab-btn.active {
  color: var(--brand-primary);
  border-bottom-color: var(--brand-primary);
  background: var(--surface);
  border-radius: 6px 6px 0 0;
}

.perfil-tab-body {
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

/* Section blocks inside tabs */
.perfil-section-block { display: flex; flex-direction: column; gap: 14px; }
.perfil-section-header { display: flex; flex-direction: column; gap: 3px; }
.perfil-section-title {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--text-primary);
  font-family: var(--font-heading);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.perfil-section-sub { font-size: 0.6rem; color: var(--text-muted); }

/* Device list */
.perfil-device-list { display: flex; flex-direction: column; gap: 8px; }
.perfil-device-skeleton {
  height: 60px; border-radius: var(--radius-md);
  background: linear-gradient(90deg, var(--surface-alt) 25%, var(--surface-raised) 50%, var(--surface-alt) 75%);
  background-size: 200% 100%;
  animation: perfil-shimmer 1.4s infinite;
}
@keyframes perfil-shimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }
.perfil-device-card {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  background: var(--surface-alt);
  transition: border-color 0.15s;
}
.perfil-device-card:hover { border-color: var(--border); }
.perfil-device-icon {
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--border-light);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  color: var(--brand-primary);
}
.perfil-device-info { flex: 1; min-width: 0; }
.perfil-device-name { font-size: 0.75rem; font-weight: 700; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.perfil-device-date { font-size: 0.55rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.07em; margin-top: 2px; }
.perfil-device-badge {
  font-size: 0.55rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em;
  padding: 3px 8px; border-radius: var(--radius-sm);
  background: var(--brand-primary-light); color: var(--brand-primary); flex-shrink: 0;
}
.perfil-device-remove {
  background: none; border: none; cursor: pointer; padding: 4px;
  color: var(--text-faint); border-radius: var(--radius-sm);
  transition: color 0.15s, background 0.15s; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.perfil-device-remove:hover { color: #dc2626; background: #fef2f2; }

/* Info grid */
.perfil-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.perfil-info-field {
  background: var(--surface-alt);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 11px 14px;
}
.perfil-info-label {
  font-size: 0.48rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  display: block;
  margin-bottom: 4px;
}
.perfil-info-value {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-primary);
  word-break: break-all;
}

/* Password form */
.perfil-pw-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 340px;
}
.perfil-input {
  padding: 9px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.72rem;
  color: var(--text-primary);
  background: var(--surface);
  font-family: var(--font-body);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  width: 100%;
}
.perfil-input:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px var(--brand-primary-light);
}
.perfil-btn-primary {
  padding: 9px 18px;
  background: var(--brand-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.7rem;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font-body);
  transition: background var(--transition);
  margin-top: 2px;
}
.perfil-btn-primary:hover { background: var(--brand-primary-hover); }
.perfil-btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.perfil-pw-msg {
  font-size: 0.63rem;
  padding: 8px 12px;
  border-radius: var(--radius-md);
}
.perfil-pw-msg.ok { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.perfil-pw-msg.error { background: #fef2f2; color: #991b1b; border: 1px solid #fca5a5; }

/* Subscription summary */
.perfil-sub-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.perfil-sub-item {
  background: var(--surface-alt);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 11px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.perfil-sub-label {
  font-size: 0.48rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
}
.perfil-sub-value {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* Plan cards */
.perfil-plan-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.perfil-plan-card {
  border: 1.5px solid var(--border);
  border-radius: 13px;
  padding: 18px 14px 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  background: var(--surface);
}
.perfil-plan-card:hover {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px var(--brand-primary-light), var(--shadow-md);
  transform: translateY(-2px);
}
.perfil-plan-card.current-plan {
  border-color: var(--brand-primary);
  border-width: 2px;
  background: linear-gradient(160deg, var(--brand-primary-subtle) 0%, #fff 100%);
  box-shadow: 0 0 0 3px var(--brand-primary-light);
}
.perfil-plan-card.current-plan .perfil-plan-cta {
  background: var(--brand-primary); color: #fff; cursor: default;
}
.perfil-plan-card.plan-disabled {
  opacity: 0.4; pointer-events: none; filter: grayscale(0.3);
}
.perfil-plan-card.plan-upgrade .perfil-plan-cta {
  background: transparent; color: var(--brand-primary); border: 1.5px solid var(--brand-primary);
}
.perfil-plan-popular-tag {
  position: absolute;
  top: -9px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--brand-primary);
  color: #fff;
  font-size: 0.42rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 2px 10px;
  border-radius: 10px;
  white-space: nowrap;
  font-family: var(--font-heading);
}
.perfil-plan-name {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--brand-primary);
  font-family: var(--font-heading);
}
.perfil-plan-price {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-primary);
  font-family: var(--font-heading);
  line-height: 1.1;
}
.perfil-plan-price span {
  font-size: 0.55rem;
  font-weight: 600;
  color: var(--text-muted);
}
.perfil-plan-features {
  list-style: none;
  padding: 0;
  margin: 6px 0 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.perfil-plan-features li {
  font-size: 0.6rem;
  color: var(--text-secondary);
  padding-left: 14px;
  position: relative;
  line-height: 1.4;
}
.perfil-plan-features li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: #22c55e;
  font-weight: 800;
  font-size: 0.62rem;
}
.perfil-plan-cta {
  margin-top: auto;
  text-align: center;
  font-size: 0.64rem;
  font-weight: 700;
  color: var(--brand-primary);
  background: var(--brand-primary-light);
  border-radius: 8px;
  padding: 7px;
  transition: all 0.2s ease;
  font-family: var(--font-heading);
}
.perfil-plan-card:hover .perfil-plan-cta {
  background: var(--brand-primary);
  color: #fff;
}
.perfil-plan-card.current-plan .perfil-plan-cta {
  background: var(--brand-primary);
  color: #fff;
}

/* — SaaS loader — */
#saas-loader {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: linear-gradient(160deg, #F5F7F6 0%, #DCE5E1 40%, #DCE5E1 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
}
#saas-loader .loader-brand {
  font-family: var(--font-heading);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 6px;
  text-transform: uppercase;
  color: var(--brand-primary);
}
#saas-loader .loader-bar {
  width: 120px;
  height: 2px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}
#saas-loader .loader-bar::after {
  content: '';
  position: absolute;
  left: -40%;
  top: 0;
  height: 100%;
  width: 40%;
  background: var(--brand-primary);
  border-radius: 2px;
  animation: saasBarSlide 1.2s ease-in-out infinite;
}
@keyframes saasBarSlide {
  0% { left: -40%; }
  100% { left: 100%; }
}

/* — SaaS overlay system — */
#saas-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  font-family: var(--font-body);
}
.saas-hide {
  display: none !important;
}

/* Left Hero Panel */
.saas-hero {
  flex: 0 0 41.66%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #0E6B4F;
  position: relative;
  overflow: hidden;
  padding: 2.5rem;
}
.saas-hero::before {
  content: '';
  position: absolute;
  width: 300px;
  height: 300px;
  top: -10%;
  left: -10%;
  background: rgba(26, 143, 103, 0.2);
  border-radius: 50%;
  filter: blur(64px);
}
.saas-hero::after {
  content: '';
  position: absolute;
  width: 300px;
  height: 300px;
  bottom: -15%;
  right: -15%;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 50%;
  filter: blur(50px);
}
.saas-hero-content {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 360px;
  text-align: center;
  animation: saasFadeScale 0.8s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
@keyframes saasFadeScale {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.saas-hero-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 24px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}
.saas-hero h1 {
  font-family: var(--font-heading);
  font-size: 1.875rem;
  font-weight: 900;
  color: white;
  margin-bottom: 0;
  letter-spacing: -0.02em;
}
.saas-hero-divider {
  width: 48px;
  height: 2px;
  background: #1A8F67;
  border-radius: 9999px;
  margin: 12px auto;
}
.saas-hero .saas-hero-sub {
  font-size: 0.68rem;
  color: rgba(255, 255, 255, 0.6);
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}
.saas-hero-features {
  margin-top: 24px;
  text-align: left;
  width: 100%;
}
.saas-hero-feat {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.8);
  font-weight: 500;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  transition: color 0.2s;
}
.saas-hero-feat:hover { color: rgba(255, 255, 255, 1); }
.saas-hero-feat:last-child { border-bottom: none; }
.saas-feat-icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  flex-shrink: 0;
  background: rgba(26, 143, 103, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #1A8F67;
}

/* Right Panel */
.saas-form-panel {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  padding: 2rem;
  overflow-y: auto;
}

/* Payment mode */
#saas-overlay.saas-payment-mode .saas-hero { display: none !important; }
#saas-overlay.saas-payment-mode .saas-form-panel {
  width: 100%;
  flex-direction: column;
  justify-content: flex-start;
  background: #f8fafc;
  align-items: stretch;
  padding: 0;
  overflow-y: auto;
}
#saas-overlay.saas-payment-mode #saas-view-subscribe {
  max-width: 100%;
  width: 100%;
}

/* Cards / Views */
.saas-view {
  width: 100%;
  max-width: 360px;
  animation: saasEnter 0.35s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
@keyframes saasEnter {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.saas-view-title {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}
.saas-view-desc {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.5;
}
.saas-view-header { margin-bottom: 28px; }

/* Inputs */
.saas-field {
  width: 100%;
  padding: 12px 16px;
  font-size: 0.78rem;
  font-family: var(--font-body);
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #ffffff;
  color: var(--text-primary);
  outline: none;
  transition: border 0.2s, box-shadow 0.2s;
  margin-bottom: 12px;
  box-sizing: border-box;
}
.saas-field:focus {
  border-color: #1A8F67;
  box-shadow: 0 0 0 3px rgba(26, 143, 103, 0.1);
}
.saas-field::placeholder { color: rgba(148, 163, 184, 0.5); }

/* Password toggle (ojito) */
.saas-pass-wrap { position: relative; }
.saas-pass-wrap .saas-field { padding-right: 44px; }
/* Oculta el ojo nativo del navegador (Chromium/Edge/WebKit) para dejar solo el nuestro */
.saas-pass-wrap .saas-field::-ms-reveal,
.saas-pass-wrap .saas-field::-ms-clear,
.saas-pass-wrap .saas-field::-webkit-credentials-auto-fill-button {
  display: none !important;
  visibility: hidden;
}
.saas-pass-toggle {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(calc(-50% - 6px));
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: #94a3b8;
  cursor: pointer;
  transition: color 0.15s;
  padding: 0;
}
.saas-pass-toggle:hover { color: #1A8F67; }
.saas-pass-toggle svg {
  width: 16px;
  height: 16px;
  stroke-width: 2;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Buttons */
.saas-submit {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 12px;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  cursor: pointer;
  background: #0E6B4F;
  color: white;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 2px 8px rgba(14, 107, 79, 0.2);
  margin-top: 8px;
}
.saas-submit:hover {
  background: #063B2E;
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(14, 107, 79, 0.35);
}
.saas-submit:active { transform: translateY(0); }
.saas-submit:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}
.saas-text-btn {
  background: none;
  border: none;
  font-family: var(--font-body);
  font-size: 0.68rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--brand-primary);
  transition: color 0.15s;
}

/* Consentimiento legal en el registro */
.saas-consent {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  cursor: pointer;
  font-size: 0.68rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 12px;
}
.saas-consent input {
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: var(--brand-primary);
}
.saas-consent-link {
  display: inline;
  padding: 0;
  font-size: inherit;
  text-decoration: underline;
}
.saas-text-btn:hover {
  color: var(--brand-primary-hover);
  text-decoration: underline;
}

/* Status message */
.saas-status {
  font-size: 0.68rem;
  font-weight: 600;
  min-height: 18px;
  margin-bottom: 12px;
  transition: color 0.2s;
}

/* OTP digit inputs */
.saas-otp-digit {
  width: 42px;
  height: 52px;
  text-align: center;
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  background: #ffffff;
  outline: none;
  transition: border 0.15s, box-shadow 0.15s, background 0.15s;
  padding: 0;
  -moz-appearance: textfield;
}
.saas-otp-digit::-webkit-outer-spin-button,
.saas-otp-digit::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.saas-otp-digit:focus {
  border-color: #0E6B4F;
  box-shadow: 0 0 0 3px rgba(14, 107, 79, 0.12);
  background: #f8fdfb;
}
.saas-otp-digit.filled {
  border-color: #0E6B4F;
  background: #E8F5EF;
  color: #063B2E;
}
.saas-otp-digit.error {
  border-color: #dc2626;
  background: #fef2f2;
  animation: saas-otp-shake 0.35s ease-in-out;
}
@keyframes saas-otp-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

/* Form links below button */
.saas-form-links {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.saas-form-alt {
  font-size: 0.72rem;
  color: #94a3b8;
}
.saas-link-bold { font-weight: 700; color: #0E6B4F; }
.saas-link-bold:hover { color: #063B2E; }
.saas-text-faint { color: #94a3b8; }
.saas-mobile-title {
  display: none;
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 800;
  color: #0E6B4F;
  margin-bottom: 24px;
}

/* Pending / Approved Result */
.saas-result-box { text-align: center; padding: 2rem 0; }
.saas-result-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.saas-divider {
  height: 1px;
  background: var(--border-light);
  margin: 16px 0;
}

/* — PAYMENT SCREEN — */
.pay-topnav {
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  position: sticky;
  top: 0;
  z-index: 50;
  flex-shrink: 0;
  width: 100%;
}
.pay-topnav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.pay-topnav-brand-name {
  font-family: var(--font-heading);
  font-size: 0.75rem;
  font-weight: 800;
  color: #0E6B4F;
  letter-spacing: 3px;
  text-transform: uppercase;
}
.pay-topnav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.pay-topnav-btn {
  background: none;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 0.7rem;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  font-family: var(--font-body);
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 6px;
}
.pay-topnav-btn:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0E6B4F;
}
.pay-topnav-btn.pay-topnav-logout { color: #94a3b8; border-color: transparent; }
.pay-topnav-btn.pay-topnav-logout:hover {
  color: #ef4444;
  background: #fef2f2;
  border-color: #fecaca;
}
#pay-shared-topnav { display: none; }
#saas-overlay.saas-payment-mode #pay-shared-topnav { display: flex; }

/* Payment body layout */
.pay-body {
  padding: 32px;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
}
.pay-body-title {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 900;
  color: #0E6B4F;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}
.pay-body-subtitle {
  font-size: 0.78rem;
  color: #64748b;
  margin-bottom: 32px;
  line-height: 1.5;
}

/* 2-column layout */
.pay-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  align-items: start;
}
.pay-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.pay-col-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}
.pay-col-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #0E6B4F;
  color: white;
  font-size: 0.65rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.pay-col-title {
  font-size: 0.7rem;
  font-weight: 800;
  color: #0E6B4F;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* Plans grid */
.pay-plans-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 20px;
}
.pay-plans-cta {
  display: flex;
  justify-content: center;
  margin-top: 32px;
}
.pay-plans-cta .saas-submit { max-width: 340px; }

/* Plan cards v2 */
.pay-plan-card-v2 {
  border: 1.5px solid #e2e8f0;
  border-radius: 14px;
  padding: 18px 16px;
  cursor: pointer;
  position: relative;
  transition: all 0.2s;
  background: white;
}
.pay-plan-card-v2:hover {
  border-color: #0E6B4F;
  box-shadow: 0 4px 16px rgba(14, 107, 79, 0.1);
}
.pay-plan-card-v2.chosen {
  border-color: #0E6B4F;
  background: rgba(14, 107, 79, 0.03);
  box-shadow: 0 0 0 3px rgba(14, 107, 79, 0.1);
}
.pay-plan-badge-v2 {
  position: absolute;
  top: -9px;
  right: 16px;
  background: #1A8F67;
  color: white;
  font-size: 0.5rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 20px;
  white-space: nowrap;
}
.pay-plan-card-v2-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
}
.pay-plan-name-v2 {
  font-size: 0.7rem;
  font-weight: 800;
  color: #334155;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.pay-plan-card-v2.chosen .pay-plan-name-v2 { color: #0E6B4F; }
.pay-plan-price-v2 {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 900;
  color: #0E6B4F;
  margin: 4px 0 2px;
}
.pay-plan-period-v2 {
  font-size: 0.6rem;
  color: #94a3b8;
  font-weight: 500;
}
.pay-plan-equivalent {
  font-size: 0.6rem;
  color: #1A8F67;
  font-weight: 700;
  margin-top: 2px;
}
.pay-plan-check-v2 {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}
.pay-plan-check-v2.active { background: #0E6B4F; }
.pay-plan-divider {
  height: 1px;
  background: #f1f5f9;
  margin: 12px 0;
}
.pay-plan-features {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.pay-plan-feat-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.68rem;
  color: #475569;
  line-height: 1.4;
}
.pay-plan-feat-icon {
  color: #1A8F67;
  flex-shrink: 0;
  margin-top: 1px;
}

/* Bank card */
.pay-bank-card {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
}
.pay-bank-header-bar {
  background: linear-gradient(135deg, #0E6B4F, #063B2E);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.pay-bank-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.15);
  color: white;
  font-weight: 800;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.pay-bank-name { font-size: 0.78rem; font-weight: 700; color: white; }
.pay-bank-type { font-size: 0.6rem; color: rgba(255, 255, 255, 0.55); margin-top: 1px; }
.pay-bank-rows { padding: 4px 0; }
.pay-bank-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid #f1f5f9;
}
.pay-bank-row:last-child { border-bottom: none; }
.pay-bank-lbl { font-size: 0.67rem; color: #64748b; font-weight: 500; }
.pay-bank-val { font-size: 0.73rem; font-weight: 600; color: var(--text-primary); }
.pay-mono { font-family: 'Courier New', monospace; letter-spacing: 1px; }
.pay-amount-val {
  font-family: var(--font-heading);
  font-size: 1rem !important;
  font-weight: 800 !important;
  color: #0E6B4F !important;
}
.pay-bank-copy-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.pay-copy-mini {
  background: none;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 3px 10px;
  font-size: 0.6rem;
  font-weight: 700;
  color: #0E6B4F;
  cursor: pointer;
  font-family: var(--font-body);
  transition: all 0.15s;
}
.pay-copy-mini:hover {
  background: rgba(14, 107, 79, 0.05);
  border-color: #0E6B4F;
}

/* Concept / reference box */
.pay-concept-box {
  margin-top: 12px;
  border: 1.5px solid #fbbf24;
  border-radius: 12px;
  padding: 14px 16px;
  background: #fffbeb;
}
.pay-concept-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.pay-concept-icon { color: #d97706; display: flex; flex-shrink: 0; }
.pay-concept-title {
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #d97706;
}
.pay-concept-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: white;
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 10px;
}
.pay-concept-code {
  font-family: 'Courier New', monospace;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 1px;
}
.pay-concept-note { font-size: 0.63rem; color: #92400e; line-height: 1.5; }

/* Checkout header */
.pay-checkout-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px 20px;
  margin-bottom: 24px;
}
.pay-back-btn {
  font-size: 0.75rem;
  font-weight: 700;
  color: #0E6B4F;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  transition: opacity 0.15s;
}
.pay-back-btn:hover { opacity: 0.65; }
.pay-checkout-summary {
  display: flex;
  align-items: center;
  gap: 16px;
}
.pay-selected-plan-name { font-size: 0.72rem; font-weight: 700; color: #0E6B4F; }
.pay-selected-amount {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 900;
  color: #0E6B4F;
}

/* Upload zone */
.saas-upload-zone {
  border: 1.5px dashed #cbd5e1;
  border-radius: 12px;
  padding: 24px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.saas-upload-zone:hover {
  border-color: #0E6B4F;
  background: rgba(14, 107, 79, 0.03);
}
.saas-upload-zone.has-file {
  border-color: #0E6B4F;
  border-style: solid;
  background: rgba(14, 107, 79, 0.04);
}
.pay-upload-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.pay-upload-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(14, 107, 79, 0.06);
  color: #0E6B4F;
  display: flex;
  align-items: center;
  justify-content: center;
}
.saas-upload-label { font-size: 0.75rem; color: #64748b; }
.saas-upload-label strong { color: #0E6B4F; }
.saas-upload-label span { font-size: 0.62rem; color: #94a3b8; }

/* Submit area */
.pay-submit-area { margin-top: 8px; }

/* Responsive */
@media (max-width: 768px) {
  .saas-hero { display: none; }
  .saas-form-panel { padding: 1.5rem; }
  .saas-mobile-title { display: block; }
}
@media (max-width: 900px) {
  .pay-columns { grid-template-columns: 1fr; }
  .pay-plans-grid { grid-template-columns: 1fr; }
  .pay-body { padding: 20px 16px; }
  .pay-topnav { padding: 0 16px; }
}


/* ================================================================
   LEGAL DOCS (T�rminos / Privacidad) + MODAL
   ================================================================ */
.legal-doc-page { max-width: 760px; margin: 0 auto; padding: 8px 8px 48px; }
.legal-doc-header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding-bottom: 16px; border-bottom: 1px solid var(--border); margin-bottom: 22px;
}
.legal-doc-header h2 {
  font-size: 1.1rem; font-weight: 800; color: var(--brand-primary);
  text-transform: uppercase; letter-spacing: 0.04em;
}
.legal-doc-version {
  font-size: 0.66rem; font-weight: 600; color: var(--text-faint);
  background: var(--surface-raised); border: 1px solid var(--border-light);
  padding: 4px 10px; border-radius: 999px; white-space: nowrap;
}
.legal-doc-body { line-height: 1.7; color: var(--text-secondary); font-size: 0.8rem; }
.legal-doc-body h3 { font-size: 1rem; font-weight: 800; color: var(--text-primary); margin: 26px 0 10px; }
.legal-doc-body h4 { font-size: 0.88rem; font-weight: 700; color: var(--text-primary); margin: 18px 0 8px; }
.legal-doc-body p { margin: 0 0 12px; }
.legal-doc-body ul, .legal-doc-body ol { margin: 0 0 14px; padding-left: 22px; }
.legal-doc-body li { margin: 4px 0; }
.legal-doc-body table { width: 100%; border-collapse: collapse; margin: 14px 0 18px; font-size: 0.76rem; }
.legal-doc-body th, .legal-doc-body td { border: 1px solid var(--border); padding: 8px 10px; text-align: left; vertical-align: top; }
.legal-doc-body th { background: var(--brand-primary-subtle); font-weight: 700; color: var(--text-primary); }
.legal-doc-body strong { color: var(--text-primary); }
.legal-doc-body hr { border: none; border-top: 1px solid var(--border); margin: 20px 0; }
.legal-doc-body blockquote {
  border-left: 3px solid var(--brand-primary); background: var(--brand-primary-subtle);
  padding: 10px 14px; margin: 0 0 14px; border-radius: 0 var(--radius-md) var(--radius-md) 0;
}
.legal-doc-body blockquote p { margin: 0; }
.legal-doc-loading, .legal-doc-error { padding: 32px 0; text-align: center; color: var(--text-muted); }
.legal-doc-error { color: #b91c1c; }

.legal-modal {
  position: fixed; inset: 0; z-index: 10000; display: none;
  align-items: center; justify-content: center; padding: 20px;
}
.legal-modal-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, 0.55); backdrop-filter: blur(2px); }
.legal-modal-card {
  position: relative; background: var(--surface); width: 100%; max-width: 760px;
  max-height: 90vh; border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(15, 43, 91, 0.35);
  display: flex; flex-direction: column; overflow: hidden;
}
.legal-modal-header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 20px; border-bottom: 1px solid var(--border); background: var(--surface-alt);
}
.legal-modal-header h3 {
  font-size: 0.92rem; font-weight: 800; color: var(--brand-primary);
  text-transform: uppercase; letter-spacing: 0.04em;
}
.legal-modal-body { overflow-y: auto; padding: 20px 24px 28px; }
.legal-close-btn {
  border: none; background: transparent; color: var(--text-muted); cursor: pointer;
  font-size: 1.1rem; line-height: 1; padding: 6px 8px; border-radius: 6px;
}
.legal-close-btn:hover { background: var(--border-light); color: var(--text-primary); }
