/* OrangeLMS — Sistema visual (tokens, componentes, animaciones) */

:root {
    --app-brand: #2b6cb0;
    --app-brand-hover: #2c5282;
    --app-secondary: #c53030;
    --app-bg: #f7fafc;
    --app-texture-dot: #dce6ed;
    --app-surface: #ffffff;
    --app-border: #d1d9e0;
    --app-text: #333333;
    --app-text-muted: #666666;
    --app-header-h: 3.5rem;
    --app-sidebar-w: 15rem;
    --app-bottom-nav-h: 4rem;
    --app-focus-ring: rgba(43, 108, 176, 0.2);
    --app-input-border: #94a3b8;
    --app-input-border-hover: #64748b;
    --app-input-border-focus: var(--app-brand);
    --app-input-bg: #ffffff;
    --app-input-bg-muted: #f8fafc;
    --app-card-border: #e2e8f0;
    --app-card-border-strong: #cbd5e1;
    --app-shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.05);
    --app-shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
    --app-shadow-md: 0 8px 28px rgba(15, 23, 42, 0.08), 0 2px 8px rgba(15, 23, 42, 0.04);
    --app-shadow-input: inset 0 1px 2px rgba(15, 23, 42, 0.06);
    --app-shadow-input-focus: 0 0 0 4px var(--app-focus-ring), 0 2px 8px rgba(43, 108, 176, 0.12);
    --app-radius-input: 0.625rem;
    --app-radius-card: 1rem;
    /* Alias legacy para estilos inline existentes */
    --primary: var(--app-brand);
    --primary-hover: var(--app-brand-hover);
    --secondary: var(--app-secondary);
    --white: #ffffff;
    --light-bg: var(--app-bg);
    --border-color: var(--app-border);
    --text-dark: var(--app-text);
    --text-muted: var(--app-text-muted);
    --shadow-soft: var(--app-shadow-sm);
    --shadow-strong: var(--app-shadow-md);
}

/* Textura institucional (puntos) */
.app-texture {
    background-color: var(--app-bg);
    background-image: radial-gradient(var(--app-texture-dot) 1px, transparent 1px);
    background-size: 20px 20px;
}

/* Safe area (PWA / notch) */
.safe-top { padding-top: env(safe-area-inset-top, 0px); }
.safe-bottom { padding-bottom: env(safe-area-inset-bottom, 0px); }
.pb-nav {
    padding-bottom: calc(var(--app-bottom-nav-h) + env(safe-area-inset-bottom, 0px));
}
@media (min-width: 768px) {
    .pb-nav { padding-bottom: 0; }
}

/* Densidad y bordes suaves */
html.app-density-compact .app-main-inner { @apply py-2; }
html.app-borders-soft .app-card,
html.app-borders-soft .app-bottom-nav { border-radius: 1.05rem; }

/* ── Formularios (inputs profesionales) ── */
.label-form,
.input-group > label,
.input-group label:first-child {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #334155;
    margin-bottom: 0.5rem;
    letter-spacing: 0.01em;
}

.input-form,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="url"],
input[type="search"],
input[type="date"],
input[type="datetime-local"],
input[type="time"],
input[type="month"],
input[type="week"],
select,
textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1.5px solid var(--app-input-border);
    border-radius: var(--app-radius-input);
    font-size: 0.9375rem;
    font-family: inherit;
    line-height: 1.45;
    background: linear-gradient(180deg, #ffffff 0%, var(--app-input-bg-muted) 100%);
    color: #0f172a;
    box-shadow: var(--app-shadow-input);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, transform 0.15s ease;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
}

input::placeholder,
textarea::placeholder {
    color: #94a3b8;
    opacity: 1;
}

.input-form:hover,
input[type="text"]:hover,
input[type="email"]:hover,
input[type="password"]:hover,
input[type="number"]:hover,
input[type="tel"]:hover,
input[type="url"]:hover,
input[type="search"]:hover,
input[type="date"]:hover,
input[type="datetime-local"]:hover,
input[type="time"]:hover,
input[type="month"]:hover,
input[type="week"]:hover,
select:hover,
textarea:hover {
    border-color: var(--app-input-border-hover);
    background: #ffffff;
}

input[type="file"],
.input-file {
    border: 2px dashed var(--app-card-border-strong);
    border-radius: var(--app-radius-input);
    padding: 1rem;
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
    font-size: 0.875rem;
    width: 100%;
    box-sizing: border-box;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
input[type="file"]:hover {
    border-color: var(--app-brand);
    background: #eff6ff;
    box-shadow: var(--app-shadow-xs);
}

select,
select.input-form {
    appearance: none;
    background-image:
        linear-gradient(180deg, #ffffff 0%, var(--app-input-bg-muted) 100%),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%2364748b' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.75' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat, no-repeat;
    background-position: 0 0, right 0.75rem center;
    background-size: auto, 1.25rem;
    padding-right: 2.5rem;
}

.input-form:focus,
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="tel"]:focus,
input[type="url"]:focus,
input[type="search"]:focus,
input[type="date"]:focus,
input[type="datetime-local"]:focus,
input[type="time"]:focus,
input[type="month"]:focus,
input[type="week"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--app-input-border-focus);
    background: #ffffff;
    box-shadow: var(--app-shadow-input-focus);
}

.input-form:disabled,
input:disabled,
select:disabled,
textarea:disabled {
    background: #f1f5f9;
    color: #94a3b8;
    cursor: not-allowed;
    border-color: #cbd5e1;
    box-shadow: none;
    opacity: 0.85;
}

textarea.input-form,
textarea {
    resize: vertical;
    min-height: 6rem;
}

.input-group {
    margin-bottom: 1.125rem;
}
.input-group input,
.input-group select,
.input-group textarea {
    border: 1.5px solid var(--app-input-border);
    box-shadow: var(--app-shadow-input);
}

/* ── Contenedores y tarjetas (superficies elevadas) ── */
.app-card,
.app-panel,
.stat-card,
.stat-card-wide,
.course-card-premium,
.widget-box,
.form-box,
.table-responsive {
    position: relative;
    border-radius: var(--app-radius-card);
    background: var(--app-surface);
    border: 1px solid var(--app-card-border);
    box-shadow: var(--app-shadow-sm);
    overflow: hidden;
}

.app-card::before,
.app-panel::before,
.stat-card-wide::before,
.widget-box::before,
.form-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--app-brand) 0%, #4a90d9 50%, var(--app-brand-hover) 100%);
    opacity: 0.85;
}

.app-card,
.app-panel,
.stat-card,
.stat-card-wide,
.widget-box,
.form-box {
    padding: 1.25rem 1.5rem;
}

.table-responsive {
    padding: 0;
}
.table-responsive::before { display: none; }

.stat-card {
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--app-shadow-md);
    border-color: var(--app-card-border-strong);
}
.stat-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    height: auto;
    background: linear-gradient(180deg, var(--app-brand), var(--app-brand-hover));
    border-radius: var(--app-radius-card) 0 0 var(--app-radius-card);
}

.card-hover {
    transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}
.card-hover:hover {
    transform: translateY(-3px);
    box-shadow: var(--app-shadow-md);
    border-color: #bfdbfe;
}
.card-hover:active { transform: translateY(-1px) scale(0.995); }

/* Modales refinados */
.app-modal {
    background: #fff;
    border-radius: 1.25rem;
    border: 1px solid var(--app-card-border);
    box-shadow: 0 24px 64px rgba(15, 23, 42, 0.18), 0 8px 24px rgba(15, 23, 42, 0.08);
    width: 100%;
    max-width: 28rem;
    animation: modalIn 0.25s ease;
    overflow: hidden;
}
.app-modal::before {
    content: '';
    display: block;
    height: 4px;
    background: linear-gradient(90deg, var(--app-brand), #60a5fa);
}

.profile-photo-drop {
    text-align: center;
    border: 2px dashed var(--app-card-border-strong);
    border-radius: var(--app-radius-input);
    padding: 1.5rem;
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
    margin-bottom: 1rem;
    transition: border-color 0.2s, background 0.2s;
}
.profile-photo-drop:hover {
    border-color: var(--app-brand);
    background: #eff6ff;
}

.profile-intro-card,
.profile-feed-card,
.profile-head-card,
.profile-post {
    border: 1px solid var(--app-card-border);
    box-shadow: var(--app-shadow-sm);
}

.profile-alert {
    border-radius: var(--app-radius-input);
    padding: 0.875rem 1.125rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    border: 1px solid;
    box-shadow: var(--app-shadow-xs);
}
.profile-alert.success { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.profile-alert.error { background: #fff1f2; color: #be123c; border-color: #fecdd3; }

/* Select: conservar flecha en hover/focus */
select:focus,
select:hover {
    background-image:
        linear-gradient(180deg, #ffffff 0%, var(--app-input-bg-muted) 100%),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%2364748b' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.75' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat, no-repeat;
    background-position: 0 0, right 0.75rem center;
    background-size: auto, 1.25rem;
}
select:focus {
    background-image:
        linear-gradient(180deg, #ffffff 0%, #ffffff 100%),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%232b6cb0' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.75' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    border-radius: 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: background-color 0.15s, transform 0.1s, box-shadow 0.15s;
    white-space: nowrap;
}
.btn-primary, .btn:not(.btn-secondary):not(.btn-danger):not(.btn-success):not(.btn-outline):not(.btn-ghost) {
    background: linear-gradient(180deg, #3182ce 0%, #2563a8 100%);
    color: #fff;
    box-shadow: 0 2px 6px rgba(43, 108, 176, 0.35), inset 0 1px 0 rgba(255,255,255,0.15);
}
.btn-primary:hover, .btn:not(.btn-secondary):not(.btn-danger):not(.btn-success):not(.btn-outline):not(.btn-ghost):hover {
    background: linear-gradient(180deg, #2b6cb0 0%, var(--app-brand-hover) 100%);
    box-shadow: 0 4px 12px rgba(43, 108, 176, 0.4);
}
.btn-secondary, .btn-ghost {
    background: linear-gradient(180deg, #ffffff 0%, #f1f5f9 100%);
    color: #334155;
    border: 1px solid var(--app-card-border-strong);
    box-shadow: var(--app-shadow-xs);
}
.btn-secondary:hover, .btn-ghost:hover { background: #e2e8f0; }
.btn-danger {
    background: linear-gradient(180deg, #d9534f 0%, #c9302c 100%);
    color: #fff;
}
.btn-success {
    background: linear-gradient(180deg, #5cb85c 0%, #449d44 100%);
    color: #fff;
}
.btn-outline {
    background: transparent;
    border: 1px solid var(--app-brand);
    color: var(--app-brand);
}
.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.75rem; }
.btn:active { transform: scale(0.98); }

/* stat-card-wide etc. ya definidos arriba en contenedores */
/* ── Icon pills (.ji) ── */
.ji {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 13px;
    font-size: 1rem;
    flex-shrink: 0;
    transition: transform 0.2s, box-shadow 0.2s;
}
.ji-sm { width: 2rem; height: 2rem; border-radius: 10px; font-size: 0.85rem; }
.ji-lg { width: 3rem; height: 3rem; border-radius: 16px; }
.ji-xl { width: 3.5rem; height: 3.5rem; border-radius: 18px; }
.ji:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12); }
.ji-teal   { background: linear-gradient(135deg, #dbeafe, #bfdbfe); color: #1e4976; }
.ji-cyan   { background: linear-gradient(135deg, #e0f2fe, #bae6fd); color: #0369a1; }
.ji-blue   { background: linear-gradient(135deg, #dbeafe, #93c5fd); color: #1d4ed8; }
.ji-emerald{ background: linear-gradient(135deg, #ecfdf5, #d1fae5); color: #047857; }
.ji-amber  { background: linear-gradient(135deg, #fef3c7, #fde68a); color: #92400e; }
.ji-rose   { background: linear-gradient(135deg, #ffe4e6, #fecdd3); color: #9f1239; }
.ji-slate  { background: linear-gradient(135deg, #f1f5f9, #e2e8f0); color: #334155; }
.ji-violet { background: linear-gradient(135deg, #ede9fe, #ddd6fe); color: #5b21b6; }
.ji-green  { background: linear-gradient(135deg, #dcfce7, #bbf7d0); color: #15803d; }
.ji-orange { background: linear-gradient(135deg, #ffedd5, #fed7aa); color: #c2410c; }

/* ── Badges ── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    border-radius: 0.375rem;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}
.badge-active  { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.badge-pending { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }
.badge-blocked { background: #fff1f2; color: #be123c; border: 1px solid #fecdd3; }

/* ── Tablas dentro de contenedores ── */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: calc(var(--app-radius-card) - 2px);
}
table { width: 100%; border-collapse: collapse; }
th, td {
    padding: 0.875rem 1.125rem;
    text-align: left;
    font-size: 0.875rem;
    border-bottom: 1px solid #eef2f7;
}
th {
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    color: #334155;
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 2px solid var(--app-card-border);
}
tbody tr {
    transition: background 0.15s ease;
}
tbody tr:hover {
    background: #f8fafc;
}
tbody tr:last-child td {
    border-bottom: none;
}

/* ── Grids legacy compat ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}
.course-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
}
.dashboard-widgets {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.25rem;
}
.stat-card {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.stat-card i {
    font-size: 1.25rem;
    color: var(--app-brand);
}
@media (max-width: 1200px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .dashboard-widgets { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
    .stats-grid, .course-grid { grid-template-columns: 1fr; }
}

/* ── Listas clicables ── */
.app-list-row {
    display: flex;
    gap: 0.75rem;
    padding: 1rem;
    transition: background 0.15s;
}
.app-list-row:hover { background: rgba(248, 250, 252, 0.9); }
.app-list-row.unread { background: rgba(219, 234, 254, 0.4); }

/* ── Toasts ── */
.app-toast-container {
    position: fixed;
    top: calc(var(--app-header-h) + 0.75rem);
    right: 0.75rem;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 22rem;
}
.app-toast {
    padding: 0.875rem 1.125rem;
    border-radius: 0.75rem;
    color: #fff;
    font-size: 0.875rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    animation: fadeInUp 0.3s ease;
}
.app-toast.success { background: #059669; }
.app-toast.error   { background: #e11d48; }
.app-toast.warning { background: #d97706; }
.app-toast.info    { background: #0284c7; }

/* ── Modales ── */
.app-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(6px);
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

/* ── Sidebar navegación ── */
.app-sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    border-radius: 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #64748b;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}
.app-sidebar-link:hover { background: #f1f5f9; color: #334155; }
.app-sidebar-link.active {
    background: #eff6ff;
    color: var(--app-brand);
    font-weight: 600;
}
.app-sidebar-link i { width: 1.25rem; text-align: center; font-size: 0.95rem; }
.app-sidebar-group {
    font-size: 0.6875rem;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 1rem 0 0.5rem;
    padding: 0 0.5rem;
}
.app-sidebar-sub { padding-left: 0.5rem; margin-left: 0.75rem; border-left: 2px solid #f1f5f9; }
.app-sidebar-sub .app-sidebar-link { font-size: 0.8125rem; padding: 0.5rem 0.75rem; }

/* ── Bottom nav móvil ── */
.app-bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.125rem;
    padding: 0.375rem 0.25rem;
    min-height: 44px;
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.625rem;
    font-weight: 500;
    position: relative;
    transition: color 0.15s;
}
.app-bottom-nav-item i { font-size: 1.125rem; transition: transform 0.15s; }
.app-bottom-nav-item:hover { color: #64748b; }
.app-bottom-nav-item.active { color: var(--app-brand); }
.app-bottom-nav-item.active i { transform: scale(1.1); }
.app-bottom-nav-item.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 2rem;
    height: 2px;
    background: var(--app-brand);
    border-radius: 9999px;
}

/* ── Drawer móvil ── */
.app-drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    z-index: 45;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}
.app-drawer-backdrop.open { opacity: 1; pointer-events: auto; }
.app-drawer {
    position: fixed;
    top: var(--app-header-h);
    left: 0;
    bottom: 0;
    width: min(18rem, 85vw);
    background: #fff;
    z-index: 46;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    overflow-y: auto;
    border-right: 1px solid #e2e8f0;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.08);
}
.app-drawer.open { transform: translateX(0); }

/* ── Prosa ── */
.prose { color: #374151; max-width: none; }
.prose h1, .prose h2, .prose h3 { font-weight: 700; margin: 1rem 0 0.5rem; }
.prose a { color: var(--app-brand); text-decoration: underline; }
.prose code { background: #f3f4f6; padding: 0.125rem 0.375rem; border-radius: 0.25rem; font-size: 0.875em; }
.prose pre { background: #1e293b; color: #e2e8f0; padding: 1rem; border-radius: 0.75rem; overflow-x: auto; }

/* ── Video player ── */
.video-js .vjs-big-play-button {
    background-color: rgba(43, 108, 176, 0.9) !important;
    border-radius: 50% !important;
}
.video-js .vjs-play-progress { background-color: var(--app-brand) !important; }

/* ── Animaciones ── */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes modalIn {
    from { opacity: 0; transform: scale(0.93) translateY(8px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes slideUp {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
@keyframes pulse-ring {
    0%   { box-shadow: 0 0 0 0 rgba(43, 108, 176, 0.35); }
    70%  { box-shadow: 0 0 0 10px rgba(43, 108, 176, 0); }
    100% { box-shadow: 0 0 0 0 rgba(43, 108, 176, 0); }
}
@keyframes skeleton-shine {
    0%   { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}
.animate-fade-in-up { animation: fadeInUp 0.3s ease both; }
.animate-fade-in    { animation: fadeIn 0.3s ease both; }
.animate-modal      { animation: modalIn 0.25s ease both; }
.animate-slide-up   { animation: slideUp 0.3s ease both; }
.animate-spin       { animation: spin 0.8s linear infinite; }
.animate-pulse-ring { animation: pulse-ring 1.5s ease infinite; }
.stagger-children > * { animation: fadeInUp 0.3s ease both; }
.stagger-children > *:nth-child(1) { animation-delay: 0.03s; }
.stagger-children > *:nth-child(2) { animation-delay: 0.06s; }
.stagger-children > *:nth-child(3) { animation-delay: 0.09s; }
.stagger-children > *:nth-child(4) { animation-delay: 0.12s; }
.stagger-children > *:nth-child(5) { animation-delay: 0.15s; }
.stagger-children > *:nth-child(6) { animation-delay: 0.18s; }

.skeleton {
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    animation: skeleton-shine 1.4s ease infinite;
    border-radius: 0.5rem;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #b2c9e0; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--app-brand); }

/* ── Auth pages ── */
.auth-split {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr;
}
@media (min-width: 768px) {
    .auth-split { grid-template-columns: 1fr 1fr; }
}
.auth-brand-panel {
    background: linear-gradient(135deg, #1e4976 0%, var(--app-brand) 50%, #2c5282 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.auth-brand-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(255,255,255,0.08) 1px, transparent 1px);
    background-size: 20px 20px;
}
.auth-form-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.5rem;
}

/* ── Logo institucional (solo en encabezado) ── */
.app-logo-sub {
    display: block;
    font-size: 0.7rem;
    color: #94a3b8;
    font-weight: 600;
    letter-spacing: 0.2em;
    margin-bottom: 0.125rem;
    line-height: 1.1;
}
.app-logo-main {
    display: block;
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    text-transform: uppercase;
    line-height: 1.15;
    white-space: nowrap;
}
.app-logo-main .brand-red { color: var(--app-secondary); }
.app-logo-main .brand-blue { color: var(--app-brand); }

.app-header-inner {
    max-width: 80rem;
    margin: 0 auto;
    width: 100%;
}
.app-logo-link--header {
    display: block;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}
.app-logo-link--header .app-logo-sub {
    font-size: 0.5rem;
    letter-spacing: 0.14em;
    margin-bottom: 0.05rem;
}
.app-logo-link--header .app-logo-main {
    font-size: clamp(0.68rem, 3.2vw, 0.82rem);
    letter-spacing: -0.01em;
}
@media (min-width: 400px) {
    .app-logo-link--header .app-logo-sub { font-size: 0.55rem; letter-spacing: 0.16em; }
    .app-logo-link--header .app-logo-main { font-size: clamp(0.72rem, 2.8vw, 0.9rem); }
}
@media (min-width: 640px) {
    .app-logo-link--header .app-logo-sub { font-size: 0.65rem; letter-spacing: 0.18em; }
    .app-logo-link--header .app-logo-main { font-size: 0.95rem; }
}
@media (min-width: 768px) {
    .app-header-start { flex: 0 1 auto; }
    .app-logo-link--header { max-width: 16rem; }
    .app-logo-link--header .app-logo-sub { font-size: 0.7rem; letter-spacing: 0.2em; }
    .app-logo-link--header .app-logo-main { font-size: 1rem; }
}
.app-header-logout { padding-left: 0.65rem; padding-right: 0.65rem; }

/* Sidebar escritorio — sin logo */
.app-sidebar-head {
    padding: 0.875rem 1rem 0.625rem;
    border-bottom: 1px solid #f1f5f9;
}
.app-sidebar-label {
    display: block;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #94a3b8;
}

/* Drawer móvil — cabecera compacta */
.app-drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f1f5f9;
    background: #f8fafc;
    position: sticky;
    top: 0;
    z-index: 1;
}
.app-drawer-title {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 700;
    color: #334155;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.app-drawer-title i { color: var(--app-brand); font-size: 0.85rem; }
.app-drawer-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border: none;
    border-radius: 0.5rem;
    background: #fff;
    color: #64748b;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
    flex-shrink: 0;
}
.app-drawer-close:hover { background: #f1f5f9; color: #334155; }
.app-drawer-user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: #475569;
    border-bottom: 1px solid #f1f5f9;
    background: #fff;
}
.app-drawer-user i { color: var(--app-brand); }
.app-drawer-user span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.app-drawer-nav { padding-top: 0.5rem !important; }

/* ── Utilidades legacy ── */
.container { max-width: 80rem; margin: 0 auto; }
.link-action { color: var(--app-brand); text-decoration: none; font-size: 0.875rem; }
.link-action:hover { text-decoration: underline; }
.input-group { margin-bottom: 1.125rem; }

/* Forzar estilo en inputs con estilos inline legacy (bordes claros) */
.app-main-inner input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="hidden"]):not([type="image"]),
.app-main-inner select,
.app-main-inner textarea {
    border: 1.5px solid var(--app-input-border) !important;
    border-radius: var(--app-radius-input) !important;
    box-shadow: var(--app-shadow-input) !important;
    padding: 0.75rem 1rem !important;
    font-size: 0.9375rem !important;
    background: linear-gradient(180deg, #ffffff 0%, var(--app-input-bg-muted) 100%) !important;
}
.app-main-inner input:focus,
.app-main-inner select:focus,
.app-main-inner textarea:focus {
    border-color: var(--app-input-border-focus) !important;
    box-shadow: var(--app-shadow-input-focus) !important;
    background: #ffffff !important;
    outline: none !important;
}

/* Contenedores legacy con bordes inline débiles */
.app-main-inner .stat-card-wide,
.app-main-inner .widget-box,
.app-main-inner .form-box,
.app-main-inner [style*="border:1px solid #ddd"],
.app-main-inner [style*="border: 1px solid #ddd"],
.app-main-inner [style*="border:1px solid #eee"],
.app-main-inner [style*="border: 1px solid #eee"],
.app-main-inner [style*="border:1px solid #ccc"],
.app-main-inner [style*="border: 1px solid #ccc"] {
    border: 1px solid var(--app-card-border) !important;
    box-shadow: var(--app-shadow-sm) !important;
    border-radius: var(--app-radius-card) !important;
}

/* ── Perfil tipo Facebook Timeline ── */
.profile-timeline-wrap {
    max-width: 980px;
    margin: 0 auto;
    width: 100%;
    min-width: 0;
}
.profile-hero {
    border-radius: 0.75rem;
    overflow: visible;
    box-shadow: var(--shadow-soft);
    border: 1px solid #e5e7eb;
    background: #fff;
    margin-bottom: 2.5rem;
    isolation: isolate;
}
.profile-hero .profile-cover {
    height: 200px;
    border-radius: 0.75rem 0.75rem 0 0;
    overflow: hidden;
    position: relative;
    z-index: 0;
}
.profile-hero .profile-head-card {
    border: none;
    border-top: none;
    border-radius: 0 0 0.75rem 0.75rem;
    box-shadow: none;
    margin-bottom: 0;
    overflow: visible;
    position: relative;
    z-index: 1;
    padding-top: 0.5rem;
}
.profile-cover {
    height: 220px;
    border-radius: 0.75rem 0.75rem 0 0;
    background: linear-gradient(135deg, #1e4976 0%, var(--app-brand) 45%, #2c5282 100%);
    background-image:
        linear-gradient(135deg, rgba(30,73,118,0.92) 0%, rgba(43,108,176,0.88) 50%, rgba(44,82,130,0.92) 100%),
        radial-gradient(rgba(255,255,255,0.12) 1px, transparent 1px);
    background-size: auto, 20px 20px;
    position: relative;
}
.profile-cover-plain {
    height: 110px;
    border-radius: 0.75rem 0.75rem 0 0;
    background: linear-gradient(135deg, #f8fafc 0%, #eef2f7 60%, #e8eef5 100%);
    border: 1px solid #e5e7eb;
    border-bottom: none;
    position: relative;
}
@media (max-width: 900px) {
    .profile-cover-plain { height: 80px; }
}
@media (max-width: 480px) {
    .profile-cover-plain { height: 66px; }
}
.profile-head-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-top: none;
    border-radius: 0 0 1rem 1rem;
    box-shadow: var(--shadow-soft);
    padding: 0 1rem 1.25rem;
    margin-bottom: 1rem;
    overflow: visible;
    position: relative;
    z-index: 1;
}
@media (min-width: 640px) {
    .profile-head-card { padding: 0 1.25rem 1.25rem; }
}
.profile-head-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem 1.25rem;
    margin-top: 0;
    padding-bottom: 1rem;
    border-bottom: none;
    width: 100%;
    min-width: 0;
}
.profile-hero .profile-head-inner {
    padding-top: 0.25rem;
}
.profile-head-main {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.75rem 1rem;
    flex: 1 1 12rem;
    min-width: 0;
    max-width: 100%;
}
.profile-avatar-wrap {
    position: relative;
    flex-shrink: 0;
    z-index: 2;
    margin-top: -4.5rem;
}
.profile-hero .profile-avatar-wrap {
    margin-top: -5rem;
}
.profile-avatar {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    border: 5px solid #fff;
    object-fit: cover;
    background: #f1f5f9;
    box-shadow: 0 4px 14px rgba(0,0,0,0.12);
    display: block;
}
.profile-avatar-badge {
    position: absolute;
    bottom: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #22c55e;
    border: 3px solid #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.65rem;
}
.profile-name-block {
    flex: 1 1 0;
    min-width: 0;
    max-width: 100%;
    padding-top: 0.75rem;
}
.profile-hero .profile-name-block {
    padding-top: 1rem;
}
.profile-name-block h1 {
    margin: 0;
    font-size: clamp(1.15rem, 4.5vw, 1.75rem);
    font-weight: 800;
    color: #111827;
    line-height: 1.25;
    overflow-wrap: anywhere;
    word-break: break-word;
    hyphens: auto;
}
.profile-name-block p {
    margin: 0.25rem 0 0;
    color: #64748b;
    font-size: 0.875rem;
    overflow-wrap: anywhere;
    word-break: break-word;
}
.profile-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
    padding-top: 0.75rem;
    flex-shrink: 0;
    max-width: 100%;
}
.profile-hero .profile-actions {
    padding-top: 1rem;
}
.profile-actions .btn { white-space: nowrap; }
.profile-grid {
    display: grid;
    grid-template-columns: minmax(0, 360px) minmax(0, 1fr);
    gap: 1.25rem;
    align-items: start;
    width: 100%;
    min-width: 0;
    margin-top: 0.25rem;
}
.profile-hero + .profile-grid {
    margin-top: 0.5rem;
    padding-top: 0.25rem;
}
.profile-intro-card,
.profile-feed-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 1rem;
    box-shadow: var(--shadow-soft);
    overflow: hidden;
    min-width: 0;
}
.profile-card-head {
    padding: 0.875rem 1rem;
    font-size: 1.05rem;
    font-weight: 700;
    color: #111827;
    border-bottom: 1px solid #f1f5f9;
}
.profile-intro-list { padding: 0.75rem 1rem 1rem; }
.profile-intro-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.625rem 0;
    font-size: 0.9rem;
    color: #334155;
    border-bottom: 1px solid #f8fafc;
    min-width: 0;
}
.profile-intro-item:last-child { border-bottom: none; }
.profile-intro-item i {
    width: 1.25rem;
    text-align: center;
    color: var(--app-brand);
    margin-top: 0.15rem;
    flex-shrink: 0;
}
.profile-intro-item div {
    flex: 1;
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}
.profile-intro-item strong { display: block; color: #64748b; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 0.15rem; }
.profile-feed {
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 0;
}
.profile-feed-head {
    margin-bottom: 0.25rem;
}
.profile-feed-head .profile-card-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.profile-bio-text {
    white-space: pre-line;
    overflow-wrap: anywhere;
    word-break: break-word;
}
.profile-post {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 1rem;
    box-shadow: var(--shadow-soft);
    overflow: hidden;
    min-width: 0;
}
.profile-post-head {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    min-width: 0;
}
.profile-post-head img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid #e5e7eb;
    flex-shrink: 0;
}
.profile-post-meta {
    flex: 1;
    min-width: 0;
}
.profile-post-meta h4 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: #111827;
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.35;
}
.profile-post-meta span {
    font-size: 0.75rem;
    color: #94a3b8;
    overflow-wrap: anywhere;
    word-break: break-word;
}
.profile-post-body {
    padding: 0 1rem 1rem;
    color: #374151;
    font-size: 0.925rem;
    line-height: 1.65;
    overflow-wrap: anywhere;
    word-break: break-word;
}
.profile-post-body pre-like { white-space: pre-line; }
.profile-post-footer {
    padding: 0.625rem 1rem;
    border-top: 1px solid #f1f5f9;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    font-size: 0.8rem;
    color: #64748b;
}
.profile-post-footer span { display: inline-flex; align-items: center; gap: 0.35rem; max-width: 100%; }
.profile-post-footer .btn { max-width: 100%; }
.profile-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
    text-align: left;
}
.profile-edit-modal.app-modal-backdrop {
    z-index: 100;
    padding: max(0.75rem, env(safe-area-inset-top, 0px)) max(0.75rem, env(safe-area-inset-right, 0px)) max(0.75rem, env(safe-area-inset-bottom, 0px)) max(0.75rem, env(safe-area-inset-left, 0px));
    align-items: flex-start;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}
@media (min-width: 480px) {
    .profile-edit-modal.app-modal-backdrop {
        align-items: center;
        padding: 1rem;
    }
}
.profile-edit-modal .app-modal,
.profile-edit-modal .profile-edit-modal-panel {
    max-width: 36rem;
    width: 100%;
    max-height: calc(100dvh - 1.5rem);
    margin: auto;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
    flex-shrink: 0;
}
.profile-edit-modal .app-modal::before { display: none; }
.profile-edit-modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 1rem 1.125rem 0.875rem;
    border-bottom: 1px solid #f1f5f9;
    flex-shrink: 0;
    background: #fff;
    border-radius: 1.25rem 1.25rem 0 0;
}
.profile-edit-modal-head h2 {
    margin: 0;
    font-size: 1.05rem;
    line-height: 1.35;
    text-align: left;
    flex: 1;
    min-width: 0;
}
.profile-edit-modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border: none;
    border-radius: 0.5rem;
    background: #f1f5f9;
    color: #64748b;
    cursor: pointer;
    flex-shrink: 0;
    font-size: 1.1rem;
}
.profile-edit-modal-close:hover { background: #e2e8f0; color: #334155; }
.profile-edit-modal-body {
    overflow-y: auto;
    flex: 1 1 auto;
    min-height: 0;
    padding: 1rem 1.125rem 1.25rem;
    -webkit-overflow-scrolling: touch;
}
@media (min-width: 640px) {
    .profile-edit-modal-head { padding: 1.25rem 1.5rem 1rem; }
    .profile-edit-modal-body { padding: 1rem 1.5rem 1.5rem; }
    .profile-edit-modal-head h2 { font-size: 1.125rem; }
}
@media (max-width: 900px) {
    .profile-hero { border-radius: 0.625rem; margin-bottom: 2rem; }
    .profile-cover,
    .profile-hero .profile-cover { height: 140px; }
    .profile-hero .profile-cover { border-radius: 0.625rem 0.625rem 0 0; }
    .profile-cover { border-radius: 0.5rem 0.5rem 0 0; }
    .profile-avatar { width: 96px; height: 96px; border-width: 4px; }
    .profile-avatar-wrap { margin-top: -3rem; }
    .profile-hero .profile-avatar-wrap { margin-top: -3.25rem; }
    .profile-head-inner {
        margin-top: 0;
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }
    .profile-head-main {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    .profile-name-block,
    .profile-actions {
        padding-top: 0;
        width: 100%;
    }
    .profile-name-block h1 { font-size: clamp(1.1rem, 5vw, 1.45rem); }
    .profile-status-pill { justify-content: center; text-align: center; }
    .profile-actions { justify-content: center; padding-top: 0.5rem; }
    .profile-actions .btn { width: 100%; justify-content: center; }
    .profile-grid { grid-template-columns: 1fr; gap: 1rem; }
    .profile-hero + .profile-grid { margin-top: 1rem; }
    .profile-hero .profile-head-inner { padding-bottom: 1.25rem; }
    .profile-post-head { align-items: center; }
    .profile-post-meta { text-align: left; }
}
@media (max-width: 480px) {
    .profile-hero { margin-bottom: 1.75rem; }
    .profile-cover,
    .profile-hero .profile-cover { height: 120px; }
    .profile-avatar { width: 88px; height: 88px; }
    .profile-avatar-wrap { margin-top: -2.75rem; }
    .profile-hero .profile-avatar-wrap { margin-top: -2.875rem; }
    .profile-head-inner { margin-top: 0; gap: 0.5rem; }
    .profile-edit-modal .app-modal,
    .profile-edit-modal .profile-edit-modal-panel {
        max-height: calc(100dvh - 1rem);
        border-radius: 1rem;
    }
    .profile-card-head { font-size: 0.95rem; padding: 0.75rem 0.875rem; }
    .profile-intro-list { padding: 0.5rem 0.875rem 0.875rem; }
    .profile-post-body { font-size: 0.875rem; }
}

/* ── Perfil admin (diseño tarjetas, sin timeline) ── */
.admin-profile {
    max-width: 920px;
    margin: 0 auto;
    width: 100%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}
.admin-profile-header-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1.25rem;
}
.admin-profile-avatar {
    position: relative;
    flex-shrink: 0;
}
.admin-profile-avatar img {
    width: 112px;
    height: 112px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid #fff;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.12);
    background: #f1f5f9;
    display: block;
}
.admin-profile-avatar-badge {
    position: absolute;
    bottom: 6px;
    right: 6px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #22c55e;
    border: 3px solid #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.6rem;
}
.admin-profile-identity {
    flex: 1 1 12rem;
    min-width: 0;
}
.admin-profile-name {
    margin: 0;
    font-size: clamp(1.25rem, 4vw, 1.65rem);
    font-weight: 800;
    color: #111827;
    line-height: 1.25;
    overflow-wrap: anywhere;
}
.admin-profile-role {
    margin: 0.35rem 0 0;
    color: #64748b;
    font-size: 0.9rem;
}
.admin-profile-status {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.625rem;
    padding: 0.3rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    background: #ecfdf5;
    color: #047857;
}
.admin-profile-header-actions {
    flex-shrink: 0;
    margin-left: auto;
}
.admin-profile-body {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
    align-items: start;
}
.admin-profile-section {
    min-width: 0;
}
.admin-profile-section.admin-profile-note {
    grid-column: 1 / -1;
}
.admin-profile-section-title {
    margin: 0 0 1rem;
    font-size: 1rem;
    font-weight: 700;
    color: #111827;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.admin-profile-section-title--inline {
    margin-bottom: 0.15rem;
}
.admin-profile-details {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.admin-profile-details li {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #f1f5f9;
}
.admin-profile-details li:last-child {
    padding-bottom: 0;
    border-bottom: none;
}
.admin-profile-detail-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
.admin-profile-detail-label i {
    color: var(--app-brand);
    width: 1rem;
    text-align: center;
}
.admin-profile-detail-value {
    font-size: 0.925rem;
    color: #334155;
    overflow-wrap: anywhere;
    word-break: break-word;
}
.admin-profile-bio {
    margin: 0;
    font-size: 0.925rem;
    line-height: 1.65;
    color: #374151;
    white-space: pre-line;
    overflow-wrap: anywhere;
}
.admin-profile-meta {
    margin: 1rem 0 0;
    font-size: 0.8rem;
    color: #64748b;
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.75rem;
}
.admin-profile-note-head {
    display: flex;
    align-items: flex-start;
    gap: 0.875rem;
    margin-bottom: 0.75rem;
}
.admin-profile-note-icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.75rem;
    background: #eff6ff;
    color: var(--app-brand);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.1rem;
}
.admin-profile-note-sub {
    margin: 0;
    font-size: 0.8rem;
    color: #94a3b8;
}
.admin-profile-note-text {
    margin: 0;
    font-size: 0.925rem;
    line-height: 1.65;
    color: #475569;
}
@media (max-width: 768px) {
    .admin-profile-header-inner {
        flex-direction: column;
        text-align: center;
    }
    .admin-profile-header-actions {
        margin-left: 0;
        width: 100%;
    }
    .admin-profile-header-actions .btn {
        width: 100%;
        justify-content: center;
    }
    .admin-profile-body {
        grid-template-columns: 1fr;
    }
    .admin-profile-section.admin-profile-note {
        grid-column: auto;
    }
}

/* ── Formularios admin responsive (certificados, facturas) ── */
.orange-form-grid {
    display: grid;
    gap: 1rem;
    margin-bottom: 1.5rem;
    width: 100%;
    min-width: 0;
}
.orange-form-grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.orange-form-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.orange-form-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.orange-form-grid--2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }

.orange-page-alert {
    padding: 0.875rem 1rem;
    margin-bottom: 1.25rem;
    border-radius: var(--app-radius-card);
    font-weight: 600;
    font-size: 0.9rem;
    line-height: 1.5;
    border: 1px solid transparent;
}
.orange-page-alert--info {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: var(--app-brand);
}
.orange-page-alert--success {
    background: #ecfdf5;
    border-color: #a7f3d0;
    color: #047857;
}
.orange-page-alert--error {
    background: #fff1f2;
    border-color: #fecdd3;
    color: #be123c;
}
.orange-page-alert--warn {
    background: #fffbeb;
    border-color: #fde68a;
    color: #92400e;
}

.orange-section-title {
    margin: 2rem 0 1rem;
    font-size: 1.1rem;
    font-weight: 700;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.orange-form-panel {
    background: #fff;
    border: 1px solid var(--app-card-border);
    border-radius: var(--app-radius-card);
    box-shadow: var(--app-shadow-sm);
    padding: 1.25rem;
    position: relative;
    overflow: hidden;
    min-width: 0;
}
.orange-form-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--app-brand) 0%, #4a90d9 50%, var(--app-brand-hover) 100%);
}
.orange-form-panel__title {
    margin: 0 0 1.25rem;
    font-size: 1rem;
    font-weight: 700;
    color: #475569;
}

.orange-form-actions {
    margin-top: 2rem;
    padding-top: 1.25rem;
    border-top: 1px solid #eef2f7;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.5rem;
}

.orange-table-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
}

/* Certificados — filas de materias */
.cert-subjects-wrap { min-width: 0; }
.cert-subject-header {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(0, 1fr) minmax(0, 1fr) 2.5rem;
    gap: 0.625rem;
    margin-bottom: 0.35rem;
    font-weight: 700;
    font-size: 0.72rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.cert-subject-row {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(0, 1fr) minmax(0, 1fr) 2.5rem;
    gap: 0.625rem;
    margin-bottom: 0.625rem;
    align-items: end;
}
.cert-field-label {
    display: none;
    font-size: 0.72rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 0.25rem;
}
.cert-subject-row .cert-field { min-width: 0; }
.cert-subject-row .cert-remove { align-self: end; }

/* Factura — encabezado y filas de ítems */
.invoice-page-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}
.invoice-items-toolbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}
.invoice-items-toolbar h4 { margin: 0; font-size: 1rem; }
.invoice-item-row {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) 2.5rem;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    align-items: end;
}
.invoice-item-row .invoice-field { min-width: 0; }
.invoice-item-row .invoice-field-label {
    display: block;
    font-size: 0.72rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    margin-bottom: 0.25rem;
}
.invoice-item-row .invoice-remove { align-self: end; height: 42px; margin-bottom: 0.15rem; }
.invoice-items-panel {
    background: #f8fafc;
    padding: 1rem;
    border-radius: var(--app-radius-card);
    margin-bottom: 1.25rem;
    border: 1px solid #e2e8f0;
}
.invoice-tax-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px dashed #cbd5e1;
}
.invoice-tax-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: flex-end;
}
.invoice-preview-bar {
    margin-bottom: 1.25rem;
    background: #fffbeb;
    padding: 1rem;
    border: 1px solid #fde68a;
    border-radius: var(--app-radius-card);
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
}
.invoice-preview-bar strong { color: #92400e; font-size: 0.9rem; }
.invoice-preview-bar form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    width: 100%;
    justify-content: flex-end;
}

/* Select2 dentro de formularios admin */
.orange-form-panel .select2-container--default .select2-selection--single,
.orange-form-panel .select2-container {
    width: 100% !important;
}
.orange-form-panel .select2-container--default .select2-selection--single {
    min-height: 42px;
    border: 1px solid var(--app-input-border);
    border-radius: var(--app-radius-input);
    display: flex;
    align-items: center;
}
.orange-form-panel .select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 40px;
}
.orange-form-panel input[readonly] {
    background-color: #f1f5f9;
    cursor: not-allowed;
    border-color: #cbd5e1;
}

/* Tabla responsive tipo tarjeta en móvil */
.orange-data-table { width: 100%; min-width: 0; }
@media (max-width: 768px) {
    .orange-form-grid--4,
    .orange-form-grid--3,
    .orange-form-grid--2,
    .orange-form-grid--2-1 {
        grid-template-columns: 1fr;
    }

    .cert-subject-header { display: none; }
    .cert-subject-row {
        grid-template-columns: 1fr;
        gap: 0.75rem;
        padding: 0.875rem;
        border: 1px solid #e2e8f0;
        border-radius: 0.75rem;
        background: #f8fafc;
        align-items: stretch;
    }
    .cert-field-label { display: block; }
    .cert-subject-row .cert-remove {
        justify-self: stretch;
        width: 100%;
    }
    .cert-subject-row .cert-remove .btn { width: 100%; }

    .invoice-item-row {
        grid-template-columns: 1fr;
        padding: 0.875rem;
        border: 1px solid #e2e8f0;
        border-radius: 0.75rem;
        background: #fff;
    }
    .invoice-item-row .invoice-remove {
        width: 100%;
        height: auto;
        margin-bottom: 0;
    }
    .invoice-item-row .invoice-remove .btn { width: 100%; }

    .orange-form-actions,
    .orange-form-actions .btn,
    .invoice-preview-bar form,
    .invoice-preview-bar form .btn {
        width: 100%;
        justify-content: center;
    }
    .orange-form-actions { flex-direction: column; }
    .invoice-preview-bar form { flex-direction: column; }
    .invoice-page-header { justify-content: stretch; }
    .invoice-page-header .btn { width: 100%; justify-content: center; }

    .orange-data-table thead { display: none; }
    .orange-data-table,
    .orange-data-table tbody,
    .orange-data-table tr,
    .orange-data-table td { display: block; width: 100%; }
    .orange-data-table tr {
        margin-bottom: 0.875rem;
        border: 1px solid #e2e8f0;
        border-radius: 0.75rem;
        background: #fff;
        overflow: hidden;
        box-shadow: var(--app-shadow-sm);
    }
    .orange-data-table td {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 0.75rem;
        padding: 0.625rem 0.875rem;
        border-bottom: 1px solid #f1f5f9;
        text-align: right;
        font-size: 0.875rem;
    }
    .orange-data-table td:last-child { border-bottom: none; }
    .orange-data-table td::before {
        content: attr(data-label);
        font-weight: 700;
        color: #64748b;
        font-size: 0.68rem;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        text-align: left;
        flex-shrink: 0;
        max-width: 45%;
    }
    .orange-data-table td.orange-table-actions-cell {
        flex-direction: column;
        align-items: stretch;
    }
    .orange-data-table td.orange-table-actions-cell::before { margin-bottom: 0.25rem; }
    .orange-table-actions { justify-content: flex-end; }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .orange-form-grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .orange-form-grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Vista previa factura — scroll horizontal seguro en móvil */
.official-preview-wrap {
    width: 100%;
    min-width: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--app-radius-card);
}
.official-preview {
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    background: #fff;
    padding: 20px;
    border: 1px solid #ccc;
    font-family: Arial, sans-serif;
    font-size: 9pt;
    color: #000;
    min-width: 320px;
}
.official-preview .header-grid {
    display: grid;
    grid-template-columns: 150px 1fr 100px 220px;
    gap: 10px;
    align-items: center;
    border-bottom: 2px solid #005691;
    padding-bottom: 5px;
}
.official-preview .company-info { font-size: 8pt; line-height: 1.1; }
.official-preview .invoice-id-box {
    border: 2px solid #000;
    border-radius: 10px;
    text-align: center;
    padding: 5px;
}
.official-preview .invoice-id-box .number { font-size: 14pt; color: #000; font-weight: bold; }
.official-preview .client-section {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 10px;
    margin-top: 10px;
}
.official-preview .data-table { width: 100%; border-collapse: collapse; }
.official-preview .data-label {
    background: #E1F5FE;
    font-weight: bold;
    color: #005691;
    width: 80px;
    padding: 3px 5px;
    font-size: 8pt;
}
.official-preview .data-value { border-bottom: 1px solid #E1F5FE; padding: 3px 5px; }
.official-preview .dates-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border: 1px solid #005691;
    border-radius: 5px;
    text-align: center;
}
.official-preview .date-header { background: #005691; color: #fff; font-size: 7pt; padding: 2px; }
.official-preview .date-numbers {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    font-size: 10pt;
    font-weight: bold;
    padding: 3px;
}
.official-preview .items-table { width: 100%; border-collapse: collapse; margin-top: 10px; }
.official-preview .items-table th {
    background: #005691;
    color: #fff;
    padding: 5px;
    font-size: 8pt;
    text-transform: uppercase;
    border: 1px solid #fff;
}
.official-preview .items-table td {
    padding: 4px 8px;
    border-bottom: 1px solid #eee;
    font-size: 8.5pt;
}
.official-preview .letters-bar {
    background: #E1F5FE;
    border: 1px solid #005691;
    padding: 5px;
    font-size: 8.5pt;
    font-weight: bold;
    margin-top: 5px;
    word-break: break-word;
}
.official-preview .footer-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 220px;
    gap: 0;
    border: 1px solid #005691;
    margin-top: 5px;
}
.official-preview .sign-box {
    border-right: 1px solid #005691;
    padding: 5px;
    position: relative;
    min-height: 60px;
}
.official-preview .totals-box { background: #005691; color: #fff; padding: 0; }
.official-preview .total-row {
    display: flex;
    justify-content: space-between;
    padding: 3px 8px;
    font-size: 8.5pt;
    border-bottom: 1px solid rgba(255,255,255,0.2);
}
.official-preview .total-row.grand { font-size: 11pt; font-weight: bold; background: #003c66; }
.official-preview .legal-text {
    font-size: 6.5pt;
    color: #555;
    text-align: justify;
    padding: 5px 0;
    line-height: 1.2;
}
.official-preview .bottom-metadata {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.35rem;
    font-size: 7pt;
    color: #888;
    border-top: 1px solid #eee;
    padding-top: 3px;
}
.preview-watermark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-30deg);
    font-size: clamp(2rem, 12vw, 5rem);
    color: rgba(0,0,0,0.05);
    font-weight: bold;
    z-index: 10;
    pointer-events: none;
    white-space: nowrap;
}
.currency-input {
    font-family: 'Courier New', Courier, monospace;
    font-weight: bold;
    color: #1e7e34;
    text-align: right;
}

@media (max-width: 768px) {
    .official-preview {
        padding: 12px;
        font-size: 8pt;
        min-width: 560px;
    }
    .official-preview .header-grid {
        grid-template-columns: 80px 1fr;
        grid-template-areas:
            "logo company"
            "qr invoice";
    }
    .official-preview .logo-box { grid-area: logo; }
    .official-preview .company-info { grid-area: company; }
    .official-preview .qr-box { grid-area: qr; }
    .official-preview .invoice-id-box { grid-area: invoice; }
    .official-preview .client-section { grid-template-columns: 1fr; }
    .official-preview .footer-grid { grid-template-columns: 1fr; }
    .official-preview .sign-box { border-right: none; border-bottom: 1px solid #005691; }
}

@media print {
    .no-print { display: none !important; }
    .official-preview-wrap { overflow: visible; }
}

/* ── Avisos (announcements) ── */
.announcement-preview-bar {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
    padding: 0.875rem 1rem;
    border-radius: var(--app-radius-card);
    margin-bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 3.75rem;
    font-weight: 600;
    text-align: center;
    position: relative;
    overflow: hidden;
    word-break: break-word;
}
.notice-item { display: none; width: 100%; animation: slideIn 0.5s ease; }
.notice-item.active { display: block; }
@keyframes slideIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.grade-badge {
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    border-radius: 9999px;
    font-weight: 800;
    text-transform: uppercase;
    white-space: nowrap;
}
.announcement-preview-panel {
    border-top: 3px solid #f39c12 !important;
    margin-bottom: 1.5rem;
    background: #fffdf5 !important;
}
.announcement-form-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 280px);
    gap: 1rem;
    margin-bottom: 1rem;
}

/* ── Hub financiero (billing y páginas relacionadas) ── */
.fin-hub-nav {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.35rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    padding-bottom: 0.25rem;
    margin-bottom: 0;
    border-bottom: 2px solid var(--app-card-border);
}
.fin-hub-nav::-webkit-scrollbar { height: 4px; }
.fin-hub-link {
    padding: 0.65rem 1rem;
    text-decoration: none;
    color: #64748b;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 0.5rem 0.5rem 0 0;
    background: #f1f5f9;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background 0.2s, color 0.2s, transform 0.2s;
    border: 1px solid transparent;
    border-bottom: none;
}
.fin-hub-link:hover {
    background: #e2e8f0;
    color: var(--app-brand);
}
.fin-hub-link.active {
    background: #fff;
    color: var(--app-brand);
    font-weight: 700;
    border-color: var(--app-card-border);
    border-bottom: 2px solid var(--app-brand);
    margin-bottom: -2px;
}
.fin-hub-panel {
    background: #fff;
    border: 1px solid var(--app-card-border);
    border-radius: 0 0 var(--app-radius-card) var(--app-radius-card);
    padding: 1.25rem;
    margin-top: -1px;
    min-width: 0;
}
.fin-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.fin-stat-card {
    background: #fff;
    padding: 1.25rem;
    border-radius: 1rem;
    border: 1px solid var(--app-card-border);
    box-shadow: var(--app-shadow-sm);
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 0;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}
.fin-stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--app-shadow-md);
    border-color: #bfdbfe;
}
.fin-stat-card i {
    font-size: 1.5rem;
    color: var(--app-brand);
    background: #eff6ff;
    width: 3rem;
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.75rem;
    flex-shrink: 0;
}
.fin-stat-card h3 {
    font-size: clamp(1.1rem, 4vw, 1.5rem);
    font-weight: 800;
    margin: 0;
    color: #1e293b;
    word-break: break-word;
}
.fin-stat-card p {
    font-size: 0.72rem;
    color: #64748b;
    margin: 0;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.fin-hub-empty {
    margin-top: 1.5rem;
    text-align: center;
    color: #64748b;
    padding: 1rem;
}

/* ── Auditoría ── */
.audit-toolbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eef2f7;
}
.audit-toolbar-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1rem;
    min-width: 0;
}
.audit-stat-badge {
    background: var(--app-brand);
    color: #fff;
    padding: 0.15rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
}
.audit-filter-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: flex-end;
    flex: 1 1 20rem;
    min-width: 0;
    justify-content: flex-end;
}
.audit-filter-form .input-form,
.audit-filter-form select {
    min-height: 42px;
    width: 100%;
}
.audit-filter-field { min-width: 0; flex: 1 1 10rem; }
.audit-filter-field--search { flex: 1 1 12rem; position: relative; }
.audit-filter-field--search i {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 0.8rem;
    pointer-events: none;
}
.audit-filter-field--search .input-form { padding-left: 2rem; }
.audit-filter-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    flex: 0 0 auto;
}
.log-badge {
    padding: 0.2rem 0.5rem;
    border-radius: 0.375rem;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    border: 1px solid #ddd;
    white-space: normal;
    word-break: break-word;
}
.log-activacion { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.log-error { background: #fff1f2; color: #be123c; border-color: #fecdd3; }
.ip-text {
    font-family: ui-monospace, monospace;
    font-size: 0.75rem;
    color: var(--app-brand);
    font-weight: 700;
    word-break: break-all;
}

@media (max-width: 768px) {
    .announcement-form-grid { grid-template-columns: 1fr; }
    .announcement-preview-bar { min-height: auto; padding: 0.75rem; font-size: 0.9rem; }
    .fin-hub-nav { margin-left: -0.25rem; margin-right: -0.25rem; padding-left: 0.25rem; padding-right: 0.25rem; }
    .fin-hub-link { padding: 0.55rem 0.75rem; font-size: 0.75rem; }
    .fin-hub-panel { padding: 1rem; border-radius: 0 0 0.75rem 0.75rem; }
    .fin-stat-card { padding: 1rem; }
    .audit-toolbar { flex-direction: column; align-items: stretch; }
    .audit-filter-form { flex-direction: column; align-items: stretch; justify-content: flex-start; }
    .audit-filter-field,
    .audit-filter-field--search { flex: 1 1 auto; width: 100%; }
    .audit-filter-actions { width: 100%; }
    .audit-filter-actions .btn { flex: 1 1 auto; justify-content: center; }
}
