﻿/* AI Assistant Login Form - Complete & Self-Contained */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

h1:focus, h1:focus-visible {
    outline: none;
}

html, body {
    height: 100%;
    overflow: hidden; /* body không scroll – .secured-body scroll thay */
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Inter', sans-serif;
    background: #0a0a0f;
    min-height: 100%;
    line-height: 1.5;
    position: relative;

    /* IMPORTANT: don't globally center all pages */
    display: block;
    padding: 0;
}

/* Apply the "centered login" layout only when body has this class */
body.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;

    /* keep background from scrolling for login only */
    overflow: hidden;
}

/* keep the neural background fixed, but it won't lock scrolling now */
.neural-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.neural-node {
    position: absolute;
    width: 2px;
    height: 2px;
    background: #3b82f6;
    border-radius: 50%;
    opacity: 0.6;
    animation: neuralPulse 4s ease-in-out infinite;
}

    .neural-node:nth-child(1) {
        top: 20%;
        left: 15%;
        animation-delay: 0s;
    }

    .neural-node:nth-child(2) {
        top: 60%;
        left: 80%;
        animation-delay: 1s;
    }

    .neural-node:nth-child(3) {
        top: 80%;
        left: 20%;
        animation-delay: 2s;
    }

    .neural-node:nth-child(4) {
        top: 30%;
        left: 70%;
        animation-delay: 3s;
    }

    .neural-node:nth-child(5) {
        top: 10%;
        left: 60%;
        animation-delay: 4s;
    }

@keyframes neuralPulse {
    0%, 100% {
        opacity: 0.3;
        transform: scale(1);
    }

    50% {
        opacity: 0.8;
        transform: scale(1.5);
    }
}

.login-container {
    width: 100%;
    max-width: 420px;
    position: relative;
    z-index: 1;
}

.login-card {
    background: rgba(15, 15, 20, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 20px;
    padding: 40px 32px;
    position: relative;
    overflow: hidden;
}

.ai-glow {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.1) 0%, transparent 70%);
    animation: aiGlow 6s ease-in-out infinite;
    pointer-events: none;
}

@keyframes aiGlow {
    0%, 100% {
        transform: rotate(0deg) scale(1);
    }

    50% {
        transform: rotate(180deg) scale(1.1);
    }
}

.login-header {
    text-align: center;
    margin-bottom: 36px;
}

.ai-logo {
    position: relative;
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-core {
    position: relative;
    z-index: 3;
    color: #3b82f6;
    animation: coreRotate 8s linear infinite;
}

@keyframes coreRotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.logo-rings {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.ring {
    position: absolute;
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 50%;
    animation: ringPulse 3s ease-in-out infinite;
}

.ring-1 {
    width: 60px;
    height: 60px;
    top: 10px;
    left: 10px;
    animation-delay: 0s;
}

.ring-2 {
    width: 70px;
    height: 70px;
    top: 5px;
    left: 5px;
    animation-delay: 1s;
}

.ring-3 {
    width: 80px;
    height: 80px;
    top: 0;
    left: 0;
    animation-delay: 2s;
}

@keyframes ringPulse {
    0%, 100% {
        opacity: 0.3;
        transform: scale(1);
    }

    50% {
        opacity: 0.6;
        transform: scale(1.05);
    }
}

.login-header h1 {
    color: #f8fafc;
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}

.login-header p {
    color: #94a3b8;
    font-size: 14px;
    font-weight: 400;
}

/* Smart Fields */
.smart-field {
    position: relative;
    margin-bottom: 28px;
}

.field-background {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 12px;
    transition: all 0.3s ease;
}

.smart-field input {
    width: 100%;
    background: transparent;
    border: none;
    padding: 16px 50px 16px 16px;
    color: #f8fafc;
    font-size: 15px;
    font-weight: 400;
    outline: none;
    position: relative;
    z-index: 2;
    font-family: inherit;
}

    .smart-field input::placeholder {
        color: transparent;
    }

.smart-field label {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #64748b;
    font-size: 15px;
    font-weight: 400;
    pointer-events: none;
    transition: all 0.3s ease;
    z-index: 3;
    background: rgba(15, 15, 20, 0.8);
    padding: 0 4px;
}

.smart-field input:focus + label,
.smart-field input:not(:placeholder-shown) + label {
    top: 0;
    font-size: 12px;
    font-weight: 500;
    color: #3b82f6;
    transform: translateY(-50%);
}

.smart-field input:focus ~ .field-background {
    border-color: #3b82f6;
    background: rgba(30, 41, 59, 0.8);
    box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.5);
}

.ai-indicator {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    z-index: 4;
}

.ai-pulse {
    width: 100%;
    height: 100%;
    background: #3b82f6;
    border-radius: 50%;
    opacity: 0;
    animation: aiIndicator 2s ease-in-out infinite;
}

.smart-field input:focus ~ .ai-indicator .ai-pulse {
    opacity: 1;
}

@keyframes aiIndicator {
    0%, 100% {
        transform: scale(1);
        opacity: 0.6;
    }

    50% {
        transform: scale(1.5);
        opacity: 1;
    }
}

.field-completion {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6);
    width: 0%;
    transition: width 0.5s ease;
    border-radius: 0 0 12px 12px;
}

.smart-field input:valid ~ .field-completion {
    width: 100%;
}

/* Password Toggle */
.smart-field:has(.smart-toggle) input {
    padding-right: 90px;
}

.smart-toggle {
    position: absolute;
    right: 50px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: #64748b;
    padding: 6px;
    border-radius: 6px;
    transition: all 0.2s ease;
    z-index: 4;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .smart-toggle:hover {
        color: #3b82f6;
        background: rgba(59, 130, 246, 0.1);
    }

.toggle-hide {
    display: none;
}

.smart-toggle.toggle-active .toggle-show {
    display: none;
}

.smart-toggle.toggle-active .toggle-hide {
    display: block;
}

/* Form Options */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    flex-wrap: wrap;
    gap: 16px;
}

.smart-checkbox {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 14px;
    color: #cbd5e1;
    font-weight: 500;
}

    .smart-checkbox input[type="checkbox"] {
        display: none;
    }

.checkbox-ai {
    width: 20px;
    height: 20px;
    margin-right: 10px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.checkbox-core {
    width: 100%;
    height: 100%;
    border: 1.5px solid rgba(59, 130, 246, 0.4);
    border-radius: 4px;
    background: rgba(30, 41, 59, 0.5);
    transition: all 0.3s ease;
    position: absolute;
}

.checkbox-ai svg {
    color: transparent;
    transition: color 0.3s ease;
    position: relative;
    z-index: 1;
}

.smart-checkbox input[type="checkbox"]:checked + .checkbox-ai .checkbox-core {
    background: #3b82f6;
    border-color: #3b82f6;
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.4);
}

.smart-checkbox input[type="checkbox"]:checked + .checkbox-ai svg {
    color: #ffffff;
}

.neural-link {
    color: #3b82f6;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    position: relative;
}

    .neural-link::after {
        content: '';
        position: absolute;
        bottom: -2px;
        left: 0;
        width: 0;
        height: 1px;
        background: #3b82f6;
        transition: width 0.3s ease;
    }

    .neural-link:hover::after {
        width: 100%;
    }

    .neural-link:hover {
        color: #60a5fa;
    }

/* Neural Button */
.neural-button {
    width: 100%;
    background: transparent;
    color: #ffffff;
    border: none;
    border-radius: 12px;
    padding: 0;
    cursor: pointer;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    position: relative;
    margin-bottom: 28px;
    overflow: hidden;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.button-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    border-radius: 12px;
    transition: all 0.3s ease;
}

.neural-button:hover .button-bg {
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    transform: scale(1.02);
}

.neural-button:active .button-bg {
    transform: scale(0.98);
}

.button-text {
    position: relative;
    z-index: 2;
    transition: opacity 0.2s ease;
}

.button-loader {
    position: absolute;
    z-index: 2;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.neural-spinner {
    display: flex;
    gap: 4px;
}

.spinner-segment {
    width: 4px;
    height: 16px;
    background: #ffffff;
    border-radius: 2px;
    animation: neuralSpinner 1.2s ease-in-out infinite;
}

    .spinner-segment:nth-child(2) {
        animation-delay: 0.1s;
    }

    .spinner-segment:nth-child(3) {
        animation-delay: 0.2s;
    }

@keyframes neuralSpinner {
    0%, 80%, 100% {
        transform: scaleY(0.5);
        opacity: 0.5;
    }

    40% {
        transform: scaleY(1);
        opacity: 1;
    }
}

.neural-button.loading .button-text {
    opacity: 0;
}

.neural-button.loading .button-loader {
    opacity: 1;
}

.button-glow {
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    border-radius: 14px;
    opacity: 0;
    filter: blur(8px);
    transition: opacity 0.3s ease;
    z-index: -1;
}

.neural-button:hover .button-glow {
    opacity: 0.6;
}

/* Auth Separator */
.auth-separator {
    display: flex;
    align-items: center;
    margin: 28px 0;
    gap: 16px;
}

.separator-line {
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.3), transparent);
}

.separator-text {
    color: #64748b;
    font-size: 13px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Neural Social */
.neural-social {
    display: flex;
    gap: 12px;
    margin-bottom: 28px;
}

.social-neural {
    flex: 1;
    background: transparent;
    color: #cbd5e1;
    border: none;
    text-decoration: none;
    border-radius: 10px;
    padding: 12px 16px;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
    min-height: 46px;
    position: relative;
    overflow: hidden;
}

.social-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 10px;
    transition: all 0.2s ease;
    pointer-events: none;
}

.social-neural:hover .social-bg {
    background: rgba(30, 41, 59, 0.8);
    border-color: rgba(59, 130, 246, 0.4);
}

.social-neural span {
    position: relative;
    z-index: 2;
}

.social-neural svg {
    position: relative;
    z-index: 2;
}

.social-glow {
    position: absolute;
    top: -1px;
    left: -1px;
    right: -1px;
    bottom: -1px;
    background: rgba(59, 130, 246, 0.2);
    border-radius: 11px;
    opacity: 0;
    filter: blur(4px);
    transition: opacity 0.2s ease;
    z-index: 0;
}

.social-neural:hover .social-glow {
    opacity: 1;
}

/* Signup Section */
.signup-section {
    text-align: center;
    font-size: 14px;
    color: #64748b;
}

.neural-signup {
    color: #3b82f6;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s ease;
    position: relative;
}

    .neural-signup::after {
        content: '';
        position: absolute;
        bottom: -2px;
        left: 0;
        width: 0;
        height: 1px;
        background: #3b82f6;
        transition: width 0.3s ease;
    }

    .neural-signup:hover::after {
        width: 100%;
    }

    .neural-signup:hover {
        color: #60a5fa;
    }

/* Error States */
.error-message {
    color: #ef4444;
    font-size: 12px;
    font-weight: 500;
    margin-top: 6px;
    opacity: 0;
    transform: translateY(-4px);
    transition: all 0.2s ease;
    position: relative;
    z-index: 5;
}

    .error-message.show {
        opacity: 1;
        transform: translateY(0);
    }

.smart-field.error .field-background {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.smart-field.error label {
    color: #ef4444;
}

.smart-field.error .field-completion {
    background: #ef4444;
}

/* Success Neural */
.success-neural {
    display: none;
    text-align: center;
    padding: 40px 20px;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.4s ease;
}

    .success-neural.show {
        display: block;
        opacity: 1;
        transform: translateY(0);
    }

.success-core {
    position: relative;
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.success-rings {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.success-ring {
    position: absolute;
    border: 2px solid #10b981;
    border-radius: 50%;
    animation: successRing 1s ease-out forwards;
}

    .success-ring:nth-child(1) {
        width: 60px;
        height: 60px;
        top: 10px;
        left: 10px;
        animation-delay: 0s;
    }

    .success-ring:nth-child(2) {
        width: 70px;
        height: 70px;
        top: 5px;
        left: 5px;
        animation-delay: 0.2s;
    }

    .success-ring:nth-child(3) {
        width: 80px;
        height: 80px;
        top: 0;
        left: 0;
        animation-delay: 0.4s;
    }

@keyframes successRing {
    0% {
        opacity: 0;
        transform: scale(0);
    }

    50% {
        opacity: 1;
        transform: scale(1.1);
    }

    100% {
        opacity: 0.7;
        transform: scale(1);
    }
}

.success-core svg {
    color: #10b981;
    position: relative;
    z-index: 2;
    animation: successCheck 0.6s ease-out 0.6s forwards;
    opacity: 0;
}

@keyframes successCheck {
    0% {
        opacity: 0;
        transform: scale(0);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.success-neural h3 {
    color: #f8fafc;
    font-size: 1.375rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.success-neural p {
    color: #94a3b8;
    font-size: 14px;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    body {
        padding: 16px;
    }

    .login-card {
        padding: 32px 24px;
        border-radius: 16px;
    }

    .login-header h1 {
        font-size: 1.5rem;
    }

    .ai-logo {
        width: 60px;
        height: 60px;
    }

    .ring-1 {
        width: 45px;
        height: 45px;
        top: 7.5px;
        left: 7.5px;
    }

    .ring-2 {
        width: 52px;
        height: 52px;
        top: 4px;
        left: 4px;
    }

    .ring-3 {
        width: 60px;
        height: 60px;
        top: 0;
        left: 0;
    }

    .form-options {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .neural-social {
        flex-direction: column;
    }
}

/* LOGIN PAGE CENTERING - thêm vào cuối file */
.login-container {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    padding: 20px;
}

/* ===== GLOBAL APPBAR FIX - Chrome iOS =====
   translate3d() forces a compositor layer (the actual iOS fix).
   z-index 1100 matches AppBar.razor.css scoped rule and still beats
   every page-level component. */
.top-appbar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    z-index: 1100 !important;
    -webkit-transform: translate3d(0, 0, 0);
    transform: translate3d(0, 0, 0);
    pointer-events: auto !important;
}

.top-appbar * {
    pointer-events: auto !important;
}

/* ─────────────────────────────────────────────────────────────────────
   Magic-lock corner trigger + lock mask + static fallback overlay.
   In app.css (always loaded) — NOT in MagicGuard's component <style> —
   because magic-idle.js arms the bottom-right corner on page load, BEFORE
   the Blazor circuit renders MagicGuard.
   ───────────────────────────────────────────────────────────────────── */
.magic-trigger {
    position: fixed;
    bottom: 0; right: 0;
    width: 60px; height: 60px;
    z-index: 99600;
    background: transparent;
    cursor: default;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}
.magic-mask {
    position: fixed; inset: 0;
    background-color: #f4f1ec;
    background-image:
        repeating-linear-gradient( 45deg, rgba(71, 85, 105, .05) 0 1px, transparent 1px 8px),
        repeating-linear-gradient(-45deg, rgba(71, 85, 105, .05) 0 1px, transparent 1px 8px),
        radial-gradient(ellipse at 30% 20%, #fbfaf7 0%, #f4f1ec 60%, #e8e3da 100%);
    background-repeat: repeat, repeat, no-repeat;
    z-index: 99000;
}
.mlf-overlay {
    position: fixed; inset: 0;
    z-index: 100000;
    display: flex; align-items: center; justify-content: center;
    padding: 16px;
    background: rgba(244, 241, 236, .55);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
.mlf-card {
    width: 100%; max-width: 440px;
    background: linear-gradient(180deg, #ffffff 0%, #fdfaf3 100%);
    border: 1px solid var(--cream-line, #e8d5a8);
    border-radius: 16px;
    box-shadow: 0 30px 80px rgba(15, 23, 42, .25), 0 8px 20px rgba(184, 134, 46, .12);
    overflow: hidden;
}
.mlf-header {
    display: flex; flex-direction: column; align-items: center; gap: 12px;
    padding: 28px 24px 12px; text-align: center;
    background: radial-gradient(ellipse at top, rgba(184, 134, 46, .10) 0%, transparent 70%);
}
.mlf-icon {
    width: 64px; height: 64px; border-radius: 18px;
    display: flex; align-items: center; justify-content: center;
    font-size: 28px; color: #fff;
    background: linear-gradient(135deg, var(--cream-gold, #c79a3f) 0%, var(--cream-gold-deep, #8e6a1f) 100%);
    box-shadow: 0 8px 24px rgba(184, 134, 46, .35), inset 0 1px 0 rgba(255, 255, 255, .25);
}
.mlf-title { margin: 0; font-size: 19px; font-weight: 700; color: var(--cream-text-strong, #1f2937); }
.mlf-sub   { font-size: 13px; color: var(--cream-text-muted, #6b7280); max-width: 320px; }
.mlf-body  { padding: 16px 24px 4px; display: flex; flex-direction: column; gap: 12px; }
.mlf-input {
    -webkit-text-security: disc; text-security: disc; -webkit-text-fill-color: #1f2937;
    font-size: 22px; letter-spacing: 8px; text-align: center;
    padding: 14px 16px; border-radius: 10px;
    border: 1px solid var(--cream-line, #e8d5a8); background: #fff; color: #1f2937;
    outline: none;
}
.mlf-input:focus { border-color: var(--cream-gold, #c79a3f); box-shadow: 0 0 0 3px rgba(199, 154, 63, .2); }
.mlf-hidden { display: none; }
.mlf-msg { min-height: 18px; font-size: 13px; color: #991b1b; }
.mlf-msg:empty { display: none; }
.mlf-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 8px 24px 20px; }
.mlf-btn {
    padding: 10px 18px; border-radius: 10px; font-size: 15px; font-weight: 600;
    border: 1px solid transparent; cursor: pointer;
}
.mlf-btn-ghost   { background: transparent; border-color: var(--cream-line, #e8d5a8); color: var(--cream-text-strong, #1f2937); }
.mlf-btn-primary { background: linear-gradient(135deg, var(--cream-gold, #c79a3f) 0%, var(--cream-gold-deep, #8e6a1f) 100%); color: #fff; }
.mlf-btn:disabled { opacity: .6; cursor: default; }

@media (max-width: 540px) {
    .mlf-overlay { padding: 0; align-items: stretch; }
    .mlf-card { max-width: 100%; min-height: 100vh; min-height: 100dvh; border-radius: 0; border: none; }
    .mlf-footer .mlf-btn { flex: 1; min-height: 46px; justify-content: center; }
}

/* ═══════════════════════════════════════════════════════════════════
   PLAIN-HTML REPLACEMENTS FOR SYNCFUSION CONTROLS
   Added when Syncfusion was removed. Uses the cream/gold design tokens
   (--cream-*) defined in cream-theme.css (loaded after this file — CSS
   custom properties resolve at use-time regardless of file order).
   ═══════════════════════════════════════════════════════════════════ */

/* ── Text input (replaces SfTextBox) ── */
.ip-input {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--cream-line, rgba(30, 41, 59, .14));
    background: rgba(255, 255, 255, .85);
    color: var(--cream-text, #1e293b);
    font-size: .95rem;
    font-family: inherit;
    outline: none;
    transition: border-color 120ms ease, box-shadow 120ms ease;
}
.ip-input:focus {
    border-color: var(--cream-gold, #475569);
    box-shadow: 0 0 0 3px rgba(71, 85, 105, .15);
    background: #fff;
}
.ip-input:disabled {
    background: rgba(30, 41, 59, .05);
    color: var(--cream-text-muted, #475569);
    cursor: not-allowed;
}
.ip-input::placeholder { color: var(--cream-text-soft, #64748b); }

/* ── Tabs (replaces SfTab) ── */
.app-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    border-bottom: 1px solid var(--cream-line, rgba(30, 41, 59, .14));
    margin-bottom: 16px;
}
.app-tab {
    padding: 10px 18px;
    border: none;
    background: transparent;
    color: var(--cream-text-muted, #475569);
    font-size: .95rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border-radius: 10px 10px 0 0;
    border-bottom: 2px solid transparent;
    transition: color 120ms ease, background 120ms ease, border-color 120ms ease;
}
.app-tab:hover { background: rgba(71, 85, 105, .08); color: var(--cream-text-strong, #0f172a); }
.app-tab.is-active {
    color: var(--cream-gold-deep, #334155);
    border-bottom-color: var(--cream-gold, #475569);
    background: rgba(71, 85, 105, .06);
}

/* ── Tables (replaces SfGrid) ── */
.app-table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.app-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--cream-card-bg-strong, rgba(255, 255, 255, .92));
    border: 1px solid var(--cream-card-border, rgba(30, 41, 59, .10));
    border-radius: 12px;
    overflow: hidden;
}
.app-table thead th {
    padding: 11px 12px;
    text-align: left;
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    font-weight: 700;
    color: var(--cream-eyebrow, #475569);
    background: rgba(255, 255, 255, .4);
    border-bottom: 1px solid var(--cream-line, rgba(30, 41, 59, .14));
    white-space: nowrap;
}
.app-table tbody td {
    padding: 9px 12px;
    border-bottom: 1px solid var(--cream-line, rgba(30, 41, 59, .14));
    color: var(--cream-text, #1e293b);
    vertical-align: middle;
}
.app-table tbody tr:last-child td { border-bottom: none; }
.app-table tbody tr:hover { background: rgba(71, 85, 105, .05); }
.app-table tfoot td {
    padding: 10px 12px;
    border-top: 2px solid var(--cream-line, rgba(30, 41, 59, .14));
    color: var(--cream-text-strong, #0f172a);
    background: rgba(255, 255, 255, .4);
}
.app-th-center, .app-td-center { text-align: center; }
.app-th-right,  .app-td-right  { text-align: right; font-variant-numeric: tabular-nums; }
.app-td-empty {
    text-align: center;
    color: var(--cream-text-muted, #475569);
    font-style: italic;
    padding: 24px 12px !important;
}
.app-th-sort { cursor: pointer; user-select: none; }
.app-th-sort:hover { color: var(--cream-gold-deep, #334155); }
.app-row-click { cursor: pointer; }
.app-row-click:hover { background: rgba(71, 85, 105, .1) !important; }

/* ── Pager (replaces GridPageSettings) ── */
.app-pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 10px 4px;
}
.app-pager-btn {
    min-width: 36px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--cream-line, rgba(30, 41, 59, .14));
    background: rgba(255, 255, 255, .8);
    color: var(--cream-text-strong, #0f172a);
    font-size: 1rem;
    cursor: pointer;
    transition: background 120ms ease, border-color 120ms ease;
}
.app-pager-btn:hover:not(:disabled) { background: #fff; border-color: var(--cream-gold, #475569); }
.app-pager-btn:disabled { opacity: .4; cursor: not-allowed; }
.app-pager-info { font-size: .85rem; color: var(--cream-text-muted, #475569); font-weight: 600; }

/* ── Modal (replaces SfDialog) ── */
.app-modal {
    position: fixed;
    inset: 0;
    z-index: 1400;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(30, 41, 59, .45);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}
.app-modal-panel {
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    background: var(--cream-card-bg-strong, #fff);
    border: 1px solid var(--cream-line, rgba(30, 41, 59, .14));
    border-radius: 16px;
    box-shadow: 0 30px 80px rgba(15, 23, 42, .25);
    overflow: hidden;
}
.app-modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--cream-line, rgba(30, 41, 59, .14));
}
.app-modal-body { padding: 18px 20px; overflow-y: auto; }
.app-modal-foot {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    padding: 14px 20px;
    border-top: 1px solid var(--cream-line, rgba(30, 41, 59, .14));
}
.app-modal-close {
    background: none;
    border: none;
    font-size: 1.1rem;
    color: var(--cream-text-muted, #475569);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
    line-height: 1;
}
.app-modal-close:hover { background: rgba(71, 85, 105, .12); color: var(--cream-text-strong, #0f172a); }

/* ── Drawer (replaces SfSidebar) — visual styling reuses .e-sidebar in
      cream-theme.css; here only width + the dim backdrop. ── */
.app-drawer { width: 280px; max-width: 85vw; }
.app-drawer-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1290;
    background: rgba(30, 41, 59, .45);
}

/* ── Spinner (replaces SfSpinner) ── */
.app-spinner {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 4px solid rgba(71, 85, 105, .2);
    border-top-color: var(--cream-gold, #475569);
    animation: app-spin .8s linear infinite;
}
.tcs-wrap { position: relative; }
.app-spinner-overlay {
    position: absolute;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(244, 241, 236, .5);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}
@keyframes app-spin { to { transform: rotate(360deg); } }
