:root {
    --hf-charcoal: #3d3e47;
    --hf-charcoal-dark: #292a31;
    --hf-charcoal-soft: #5a5b65;
    --hf-orange: #ff7821;
    --hf-gold: #e5b83c;
    --hf-surface: #ffffff;
    --hf-canvas: #f5f5f6;
    --hf-line: #dedfe3;
    --hf-text: #303139;
    --hf-muted: #777983;
    --hf-success: #2ca36b;
    color-scheme: light;
    font-family: Arial, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body, #app { width: 100%; min-height: 100%; margin: 0; }
body { background: var(--hf-canvas); color: var(--hf-text); }
button, input { font: inherit; }
a { color: inherit; }
.app-shell { min-height: 100vh; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.app-loading {
    min-height: 100vh;
    display: grid;
    place-content: center;
    justify-items: center;
    gap: 24px;
    background: var(--hf-charcoal);
}

.loading-ring, .button-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid rgba(255, 120, 33, .25);
    border-top-color: var(--hf-orange);
    border-radius: 50%;
    animation: spin .75s linear infinite;
}

.button-spinner { width: 17px; height: 17px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Identidad gráfica original de HighFinance */
.brand-logo { display: inline-flex; align-items: center; }
.brand-image { display: block; object-fit: contain; }
.brand-image--full { width: min(100%, 640px); height: auto; }
.brand-image--symbol { width: 52px; height: 52px; }
.brand-wordmark {
    margin-left: 8px;
    color: var(--hf-charcoal);
    font-size: 22px;
    font-weight: 800;
    font-style: italic;
    letter-spacing: -1.2px;
}
.brand-wordmark span { color: var(--hf-orange); font-weight: 600; }

/* Login inspirado en la aplicación HighFinance de referencia */
.login-page {
    position: relative;
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(420px, 48%) 1fr;
    background: #fff;
    overflow: hidden;
    transition: background-color .3s, color .3s;
}

.theme-toggle {
    position: absolute;
    z-index: 30;
    top: 24px;
    right: 24px;
    width: 60px;
    height: 30px;
    padding: 0;
    border: 0;
    border-radius: 30px;
    background: linear-gradient(135deg, #fdf5b0, #c3c3c3);
    box-shadow: inset 0 0 8px rgba(0, 0, 0, .73), 0 5px 18px rgba(0, 0, 0, .14);
    cursor: pointer;
    transition: background .3s, box-shadow .3s;
}
.theme-toggle::before {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    transform: translateX(30px);
    background: radial-gradient(circle at 30% 30%, #ffd66b, #ff8c00 68%);
    box-shadow: 0 0 7px rgba(255, 165, 0, .7);
    transition: transform .3s, background .3s, box-shadow .3s;
}
.theme-toggle.on { border: 2px solid rgba(255,255,255,.9); background: #111; }
.theme-toggle.on::before {
    top: 1px;
    left: 1px;
    transform: translateX(0);
    background: radial-gradient(circle at 45% 40%, #eff8ff, #aabbd1 70%);
    box-shadow: 0 0 7px rgba(200, 220, 255, .65);
}
.theme-toggle:focus-visible { outline: 3px solid var(--hf-orange); outline-offset: 4px; }

.login-panel {
    position: relative;
    z-index: 2;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 54px clamp(28px, 5vw, 76px) 76px;
    background: #fff;
}

.login-card { width: min(100%, 470px); }
.mobile-brand, .login-corner-mark { display: none; }

.gradient-ring {
    width: 100%;
    padding: 5px;
    border-radius: 54px;
    background: linear-gradient(120deg, #6e6f77 0%, #d8d8db 52%, #fff 100%);
    box-shadow: 0 25px 70px rgba(45, 46, 54, .14);
}

.login-form-surface {
    width: 100%;
    padding: 42px 35px 34px;
    border-radius: 49px;
    background: #fff;
}

.login-form-surface h1 {
    margin: 0;
    color: #33343b;
    text-align: center;
    font-size: 25px;
    font-weight: 700;
}
.login-form-surface h1:focus { outline: none; }

.login-intro {
    margin: 10px auto 28px;
    color: var(--hf-muted);
    text-align: center;
    font-size: 13px;
    line-height: 1.5;
}

.form-field { margin-bottom: 18px; }
.form-field label {
    display: block;
    margin: 0 0 6px 2px;
    color: #393a42;
    font-size: 14px;
    font-weight: 600;
}

.input-shell {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 48px;
    padding: 0 16px;
    border: 1px solid var(--hf-charcoal);
    border-radius: 50px;
    background: #fafafa;
    transition: border-color .2s, box-shadow .2s, background .2s;
}

.input-shell:focus-within {
    border-color: var(--hf-orange);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(255, 120, 33, .12);
}

.input-shell img {
    flex: none;
    width: 21px;
    height: 21px;
    margin-right: 10px;
    object-fit: contain;
    opacity: .68;
}

.input-shell input {
    width: 100%;
    min-width: 0;
    height: 46px;
    padding: 0;
    border: 0;
    outline: 0;
    color: var(--hf-text);
    background: transparent;
    font-size: 15px;
}
.input-shell input::placeholder { color: #9a9ba2; }

.primary-button {
    width: 100%;
    min-height: 46px;
    margin-top: 4px;
    padding: 0 22px;
    border: 0;
    border-radius: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: #fff;
    background: var(--hf-charcoal);
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 12px 22px rgba(61, 62, 71, .18);
    transition: transform .2s, background .2s, box-shadow .2s;
}
.primary-button:not(:disabled):hover {
    transform: translateY(-2px);
    background: var(--hf-orange);
    box-shadow: 0 15px 28px rgba(255, 120, 33, .24);
}
.primary-button:disabled { opacity: .72; cursor: wait; }

.alert { margin: 0 0 14px; padding: 11px 14px; border-radius: 14px; font-size: 13px; line-height: 1.4; }
.alert-error { border: 1px solid #facbd0; color: #9a2e39; background: #fff0f1; }
.offline-note {
    margin-top: 19px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 9px;
    color: var(--hf-muted);
    font-size: 11px;
    line-height: 1.45;
    text-align: left;
}
.status-dot {
    flex: none;
    width: 8px;
    height: 8px;
    margin-top: 4px;
    border-radius: 50%;
    background: var(--hf-success);
    box-shadow: 0 0 0 4px rgba(44, 163, 107, .13);
}

.login-footer {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
}
.login-footer img { display: block; width: 108px; height: auto; opacity: .8; }

.brand-stage {
    position: relative;
    isolation: isolate;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    overflow: hidden;
    padding: 0;
    background: var(--hf-charcoal);
}
.brand-stage::before {
    content: "";
    position: absolute;
    z-index: -1;
    top: -4%;
    left: -105px;
    width: 245px;
    height: 114%;
    background: #fff;
    transform: rotate(7deg);
    transform-origin: center;
}
.brand-stage::after {
    content: "";
    position: absolute;
    z-index: -1;
    right: -210px;
    bottom: -260px;
    width: 600px;
    height: 600px;
    border: 1px solid rgba(255, 255, 255, .07);
    border-radius: 50%;
    box-shadow: 0 0 0 85px rgba(255,255,255,.022), 0 0 0 170px rgba(255,255,255,.014);
}
.brand-logo--hero { position: absolute; top: 0; left: clamp(18px, 3vw, 52px); width: min(94%, 690px); margin: 0; }
.brand-logo--hero .brand-image--full { width: 100%; filter: drop-shadow(0 24px 30px rgba(0,0,0,.2)); }

/* Tema oscuro del login, basado en la aplicación HighFinance de referencia */
.login-page.theme-dark { color: #fff; background: #000; }
.theme-dark .login-panel { background: #050505; }
.theme-dark .brand-stage { background: #783810; }
.theme-dark .brand-stage::before { background: #050505; }
.theme-dark .gradient-ring {
    background: linear-gradient(120deg, #ff7821 0%, rgba(255,120,33,.35) 45%, #6a6a70 100%);
    box-shadow: 0 25px 75px rgba(0,0,0,.48);
}
.theme-dark .login-form-surface {
    color: #fff;
    background: linear-gradient(270deg, #111 0%, #29292d 100%);
}
.theme-dark .login-form-surface h1,
.theme-dark .form-field label { color: #fff; }
.theme-dark .login-intro,
.theme-dark .offline-note { color: #d0d0d4; }
.theme-dark .input-shell {
    border-color: rgba(255,120,33,.7);
    background: rgba(255,120,33,.58);
}
.theme-dark .input-shell:focus-within {
    border-color: #ff9d5d;
    background: rgba(255,120,33,.72);
    box-shadow: 0 0 0 4px rgba(255,120,33,.2);
}
.theme-dark .input-shell input { color: #111; }
.theme-dark .input-shell input::placeholder { color: #3f3330; }
.theme-dark .input-shell img { opacity: .8; }
.theme-dark .primary-button { color: #16100c; background: #ff7821; box-shadow: 0 12px 25px rgba(255,120,33,.2); }
.theme-dark .primary-button:not(:disabled):hover { color: #fff; background: #a34a12; }
.theme-dark .brand-wordmark { color: #f2f2f4; }
.theme-dark .brand-wordmark span { color: #ff7821; }
.theme-dark .login-footer img { filter: brightness(1.15); opacity: .95; }
.theme-dark .alert-error { color: #ffd9dc; border-color: #7d3139; background: #3d171b; }
.alert-info { margin: 0 0 14px; padding: 9px 12px; color: #4c4d55; border: 1px solid #d7d8dc; border-radius: 12px; background: #f5f5f6; font-size: 11px; line-height: 1.45; }
.alert-info a { color: var(--hf-orange); font-weight: 800; }
.theme-dark .alert-info { color: #d0d0d4; border-color: #4b4b50; background: #202024; }

/* Panel de aplicaciones */
.dashboard-page, .module-page { min-height: 100vh; background: var(--hf-canvas); }
.dashboard-header {
    position: relative;
    z-index: 10;
    height: 84px;
    padding: 0 clamp(22px, 5vw, 72px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #d4d5d8;
    background: #fff;
    box-shadow: 0 5px 18px rgba(38, 39, 45, .035);
}
.brand-logo--header .brand-image--symbol { width: 53px; height: 53px; }
.brand-logo--header .brand-wordmark { font-size: 21px; }

.user-menu { position: relative; }
.user-menu summary { list-style: none; display: flex; align-items: center; gap: 11px; cursor: pointer; user-select: none; }
.user-menu summary::-webkit-details-marker { display: none; }
.avatar {
    width: 41px;
    height: 41px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: #fff;
    background: linear-gradient(145deg, var(--hf-charcoal-soft), var(--hf-charcoal-dark));
    font-weight: 800;
    box-shadow: inset 0 0 0 2px rgba(229,184,60,.55);
}
.user-copy { display: flex; flex-direction: column; line-height: 1.25; }
.user-copy strong { font-size: 13px; }
.user-copy small { color: var(--hf-muted); font-size: 11px; }
.chevron { margin-left: 2px; color: var(--hf-muted); }
.menu-popover {
    position: absolute;
    right: 0;
    top: calc(100% + 14px);
    width: 245px;
    padding: 12px;
    border: 1px solid var(--hf-line);
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 20px 50px rgba(35, 36, 43, .15);
}
.menu-popover > div { padding: 8px 9px 13px; display: flex; flex-direction: column; gap: 4px; border-bottom: 1px solid var(--hf-line); }
.menu-popover small { color: var(--hf-muted); font-size: 11px; }
.menu-popover button { width: 100%; margin-top: 8px; padding: 11px 10px; border: 0; border-radius: 10px; display: flex; align-items: center; gap: 9px; color: #a83742; background: transparent; text-align: left; cursor: pointer; }
.menu-popover button:hover { background: #fff1f2; }
.menu-popover button img { width: 18px; height: 18px; filter: invert(22%) sepia(61%) saturate(1522%) hue-rotate(322deg); }

.dashboard-content, .module-content { width: min(1180px, calc(100% - 44px)); margin: 0 auto; padding: 58px 0 70px; }
.welcome-row { margin-bottom: 35px; display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; }
.eyebrow { margin: 0 0 9px; color: var(--hf-orange); font-size: 11px; font-weight: 800; letter-spacing: 1.7px; text-transform: uppercase; }
.welcome-row h1, .module-title-row h1 { margin: 0; color: var(--hf-text); font-size: clamp(30px, 4vw, 41px); letter-spacing: -1.5px; }
.welcome-row p, .module-title-row p { color: var(--hf-muted); line-height: 1.6; }
.welcome-row p { margin: 9px 0 0; }
.role-pill { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; border: 1px solid #e5d39c; border-radius: 99px; color: #70550b; background: #fffaf0; font-size: 12px; font-weight: 700; }
.role-pill span { width: 7px; height: 7px; border-radius: 50%; background: var(--hf-gold); }

.apps-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.app-card {
    position: relative;
    min-height: 188px;
    padding: 27px;
    display: flex;
    align-items: flex-start;
    gap: 21px;
    overflow: hidden;
    border: 1px solid var(--hf-line);
    border-radius: 24px;
    color: inherit;
    background: #fff;
    text-decoration: none;
    transition: transform .2s, box-shadow .2s, border-color .2s;
}
.app-card::after { content: ""; position: absolute; right: -45px; bottom: -75px; width: 160px; height: 160px; border-radius: 50%; background: rgba(255, 120, 33, .055); }
.app-card:hover { transform: translateY(-4px); border-color: #efb187; box-shadow: 0 20px 45px rgba(41,42,49,.1); }
.app-card-icon { flex: none; width: 62px; height: 62px; display: grid; place-items: center; border-radius: 18px; background: var(--hf-charcoal); box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); }
.app-icon { width: 34px; height: 34px; object-fit: contain; }
.app-icon {
    display: inline-block;
    color: inherit;
    background-color: currentColor;
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-position: center;
    -webkit-mask-size: contain;
    mask-repeat: no-repeat;
    mask-position: center;
    mask-size: contain;
}
.app-icon--credit-card {
    -webkit-mask-image: url("assets/prestamoporautorizar.svg");
    mask-image: url("assets/prestamoporautorizar.svg");
}
.app-icon--report {
    -webkit-mask-image: url("assets/expedientecrediticio.svg");
    mask-image: url("assets/expedientecrediticio.svg");
}
.app-icon--shield {
    -webkit-mask-image: url("assets/pld.svg");
    mask-image: url("assets/pld.svg");
}
.app-icon--settings {
    -webkit-mask-image: url("assets/pldconfiguracion.svg");
    mask-image: url("assets/pldconfiguracion.svg");
}

.app-icon--pui {
    -webkit-mask-image: url("assets/pui.svg");
    mask-image: url("assets/pui.svg");
}

.app-icon--redeco {
    -webkit-mask-image: url("assets/redeco.svg");
    mask-image: url("assets/redeco.svg");
}
.app-icon--reune {
    -webkit-mask-image: url("assets/reune.svg");
    mask-image: url("assets/reune.svg");
}
.app-card-copy { padding-right: 22px; }
.app-card h2 { margin: 3px 0 10px; font-size: 19px; letter-spacing: -.4px; }
.app-card p { margin: 0; color: var(--hf-muted); font-size: 13px; line-height: 1.6; }
.card-arrow { position: absolute; right: 25px; top: 27px; color: #a4a5ab; font-size: 18px; }
.app-card:hover .card-arrow { color: var(--hf-orange); }
.sync-banner { margin-top: 24px; padding: 17px 20px; display: flex; align-items: center; gap: 14px; border: 1px solid #cfebdc; border-radius: 16px; background: #f2fbf6; }
.sync-icon { flex: none; width: 33px; height: 33px; display: grid; place-items: center; border-radius: 50%; color: #177447; background: #d5f4e2; font-weight: 800; }
.sync-banner > div:last-child { display: flex; flex-direction: column; gap: 3px; }
.sync-banner strong { font-size: 13px; }
.sync-banner span { color: #678071; font-size: 12px; }

/* Pantallas dummy de cada aplicación */
.back-link { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; text-decoration: none; }
.back-link:hover { color: var(--hf-orange); }
.back-link span { font-size: 19px; }
.brand-logo--center { position: absolute; left: 50%; transform: translateX(-50%); }
.header-role { color: var(--hf-muted); font-size: 12px; }
.module-title-row { margin-bottom: 35px; display: flex; align-items: center; gap: 24px; }
.module-title-row h1 { font-size: 34px; }
.module-title-row p:last-child { margin: 7px 0 0; }
.module-hero-icon { flex: none; width: 80px; height: 80px; display: grid; place-items: center; border-radius: 24px; background: var(--hf-charcoal); box-shadow: 0 15px 30px rgba(41,42,49,.18); }
.module-hero-icon .app-icon { width: 42px; height: 42px; }
.dummy-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.dummy-card { min-height: 150px; padding: 24px; display: flex; flex-direction: column; justify-content: center; border: 1px solid var(--hf-line); border-radius: 20px; background: #fff; }
.dummy-card--accent { color: #fff; border-color: transparent; background: linear-gradient(135deg, var(--hf-charcoal-dark), var(--hf-charcoal-soft)); }
.dummy-label { margin-bottom: 12px; color: var(--hf-muted); font-size: 12px; }
.dummy-card--accent .dummy-label, .dummy-card--accent small { color: #c9cad0; }
.dummy-card strong { font-size: 24px; letter-spacing: -.7px; }
.dummy-card small { margin-top: 7px; color: #a0a1a8; }
.status-text { display: inline-flex; align-items: center; gap: 8px; color: var(--hf-success); }
.status-text span { width: 9px; height: 9px; border-radius: 50%; background: var(--hf-success); }
.placeholder-panel { margin-top: 20px; overflow: hidden; border: 1px solid var(--hf-line); border-radius: 20px; background: #fff; }
.placeholder-heading { min-height: 73px; padding: 18px 22px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--hf-line); }
.placeholder-heading h2 { margin: 0; font-size: 17px; }
.placeholder-heading button { padding: 10px 14px; border: 0; border-radius: 50px; color: #fff; background: var(--hf-charcoal); font-size: 12px; font-weight: 700; }
.placeholder-heading button:hover { background: var(--hf-orange); }
.placeholder-row { min-height: 65px; padding: 14px 22px; display: grid; grid-template-columns: 10px minmax(140px, .8fr) 1fr auto; gap: 13px; align-items: center; border-bottom: 1px solid #f0f0f2; font-size: 12px; }
.placeholder-row:last-child { border-bottom: 0; }
.placeholder-row > span:not(.row-dot), .placeholder-row time { color: var(--hf-muted); }
.row-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--hf-orange); }

.not-found { min-height: 100vh; padding: 30px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #fff; background: var(--hf-charcoal); text-align: center; }
.not-found > span { margin-top: 55px; color: var(--hf-orange); font-size: 75px; font-weight: 800; }
.not-found h1 { margin: 0; }
.not-found p { color: #c8c9ce; }
.primary-button--link { width: auto; min-width: 210px; margin-top: 18px; text-decoration: none; }

#blazor-error-ui { display: none; position: fixed; z-index: 9999; right: 0; bottom: 0; left: 0; padding: 12px 20px; color: #342b11; background: #fff1c8; box-shadow: 0 -2px 10px rgba(0,0,0,.15); }
#blazor-error-ui .dismiss { float: right; cursor: pointer; }

@media (max-width: 900px) {
    .login-page { display: block; }
    .brand-stage { display: none; }
    .login-panel { min-height: 100vh; padding: 85px 24px 72px; overflow: hidden; }
    .login-panel::after { content: ""; position: absolute; z-index: -1; top: 0; right: 0; width: 34%; height: 100%; background: var(--hf-charcoal); clip-path: polygon(65% 0, 100% 0, 100% 100%, 0 100%); }
    .theme-toggle { top: 24px; right: auto; left: 24px; }
    .theme-dark .login-panel::after { background: #783810; }
    .login-corner-mark { position: absolute; top: 15px; right: 13px; display: block; }
    .login-corner-mark img { width: 118px; height: 118px; object-fit: contain; }
    .mobile-brand { display: block; width: max-content; margin: 0 auto 28px; }
    .apps-grid { grid-template-columns: 1fr; }
    .dummy-grid { grid-template-columns: 1fr 1fr; }
    .dummy-card:last-child { grid-column: 1 / -1; }
}

@media (max-width: 600px) {
    .login-panel { padding-right: 17px; padding-left: 17px; }
    .login-card { width: 100%; }
    .gradient-ring { border-radius: 39px; }
    .login-form-surface { padding: 35px 22px 28px; border-radius: 34px; }
    .mobile-brand .brand-image--symbol { width: 46px; height: 46px; }
    .mobile-brand .brand-wordmark { font-size: 19px; }
    .dashboard-header { height: 76px; padding: 0 18px; }
    .brand-logo--header .brand-wordmark, .user-copy { display: none; }
    .brand-logo--header .brand-image--symbol { width: 48px; height: 48px; }
    .dashboard-content, .module-content { width: calc(100% - 28px); padding: 38px 0 50px; }
    .welcome-row { display: block; }
    .role-pill { margin-top: 20px; }
    .app-card { min-height: 170px; padding: 21px; gap: 16px; }
    .app-card-icon { width: 52px; height: 52px; }
    .app-card-copy { padding-right: 5px; }
    .card-arrow { top: 20px; right: 18px; }
    .brand-logo--center { display: none; }
    .header-role { max-width: 105px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .module-title-row { align-items: flex-start; gap: 15px; }
    .module-hero-icon { width: 61px; height: 61px; border-radius: 18px; }
    .module-hero-icon .app-icon { width: 34px; height: 34px; }
    .module-title-row h1 { font-size: 27px; }
    .module-title-row p:last-child { font-size: 13px; }
    .dummy-grid { grid-template-columns: 1fr; }
    .dummy-card:last-child { grid-column: auto; }
    .placeholder-row { grid-template-columns: 10px 1fr auto; }
    .placeholder-row > span:not(.row-dot), .placeholder-heading button { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* Encuadre fiel al login original de HighFinance */
.login-page {
    display: flex;
    min-height: 100vh;
    background: #fff;
}
.login-panel {
    flex: 1;
    min-width: 380px;
    padding: 0;
    display: flex;
    flex-flow: column wrap;
    align-items: center;
    align-content: flex-end;
    justify-content: center;
    background: #fff;
}
.settings-link {
    position: absolute;
    z-index: 35;
    top: 1.5rem;
    left: 1.5rem;
    width: 24px;
    height: 24px;
}
.settings-link img { display: block; width: 100%; height: 100%; object-fit: contain; }
.theme-toggle--mobile, .login-corner-mark, .mobile-diagonal { display: none; }
.login-card { z-index: 2; width: 90%; max-width: 460px; margin-top: 2rem; }
.gradient-ring {
    width: 100%;
    padding: 5px;
    border-radius: 54px;
    background: linear-gradient(to right, #777, #fff);
    box-shadow: none;
}
.login-form-surface {
    width: 100%;
    padding: 1.6em 1.4em 1.4em;
    overflow: hidden;
    border-radius: 50px;
    background: #fff;
}
.login-form-surface h1 {
    margin: 1.5rem;
    color: #333;
    text-align: center;
    font-size: 1.5rem;
}
.form-field { margin-bottom: .8rem; }
.form-field label { margin: 0 0 5px; font-size: .95rem; font-weight: 400; }
.input-shell {
    min-height: 0;
    height: 42px;
    margin-top: 5px;
    padding: .5rem 1rem;
    border: 1px solid #3d3e47;
    border-radius: 50px;
    background: #f9f9f9;
}
.input-shell img { width: 22px; height: 22px; margin-right: .5rem; opacity: .7; }
.input-shell input, .input-shell select {
    flex: 1;
    width: 100%;
    min-width: 0;
    height: auto;
    padding: 0;
    border: 0;
    outline: 0;
    color: #333;
    background: transparent;
    font-size: 1rem;
}
.input-shell select { appearance: auto; cursor: pointer; }
.primary-button {
    width: 100%;
    min-height: 40px;
    height: 40px;
    margin: .8rem 0;
    padding: .5rem;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 400;
    box-shadow: none;
}
.social-links { display: flex; justify-content: center; gap: 1rem; margin-bottom: 1rem; }
.social-links img { width: 28px; height: 28px; object-fit: contain; transition: transform .2s; }
.social-links img:hover { transform: scale(1.1); }
.register-text { margin: 0; text-align: center; font-size: 1rem; }
.register-text a { color: #3c3c46; text-decoration: none; font-weight: 700; }
.register-text a:hover { text-decoration: underline; }
.login-footer { position: static; transform: none; margin-top: 1rem; }
.login-footer img { width: auto; max-width: 108px; opacity: 1; transition: transform .2s; }
.login-footer img:hover { transform: scale(1.1); }
.brand-stage {
    flex: 1;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #fff;
}
.brand-stage::before {
    z-index: 0;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #3c3c46;
    transform: none;
    clip-path: polygon(280px 0%, 100% 0%, 100% 100%, 120px 1500px);
}
.brand-stage::after { display: none; }
.brand-stage > .theme-toggle { top: 1.5rem; right: 1.5rem; }
.brand-logo--hero {
    z-index: 1;
    position: absolute;
    top: 0;
    left: 0;
    width: 638px;
    max-width: 100%;
    margin: 0;
}
.brand-logo--hero .brand-image--full { width: 100%; filter: none; }
.loading-overlay {
    position: fixed;
    z-index: 9999;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,.6);
}
.theme-dark .login-panel { background: #000; }
.theme-dark .brand-stage { background: #000; }
.theme-dark .brand-stage::before { background: #783810; }
.theme-dark .gradient-ring { background: none; }
.theme-dark .login-form-surface {
    background: linear-gradient(269.76deg, rgba(0,0,0,.31) .19%, rgba(214,215,215,.31) 75.86%);
}
.theme-dark .input-shell { border-color: rgba(255,120,33,.2); background: rgba(255,120,33,.6); }
.theme-dark .input-shell input, .theme-dark .input-shell select { color: #111; }
.theme-dark .input-shell input::placeholder { color: #444747; }
.theme-dark .primary-button { color: #fff; background: #000; }
.theme-dark .primary-button:not(:disabled):hover { background: #ff7821; }
.theme-dark .register-text a { color: #fff; }

/* Configuración segura de empresas y servidores */
.server-settings-page { min-height: 100vh; background: var(--hf-canvas); color: var(--hf-text); }
.settings-header {
    position: sticky;
    z-index: 20;
    top: 0;
    height: 82px;
    padding: 0 clamp(22px,5vw,72px);
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    border-bottom: 1px solid var(--hf-line);
    background: rgba(255,255,255,.96);
    backdrop-filter: blur(12px);
}
.settings-header .brand-logo { justify-self: center; }
.settings-header .theme-toggle { position: relative; top: auto; right: auto; justify-self: end; }
.settings-content { width: min(1040px,calc(100% - 36px)); margin: 0 auto; padding: 52px 0 76px; }
.settings-title { margin-bottom: 30px; text-align: center; }
.settings-title h1 { margin: 0; font-size: clamp(30px,5vw,44px); letter-spacing: -1.5px; }
.settings-title h1:focus { outline: none; }
.settings-title > p:last-child { max-width: 650px; margin: 12px auto 0; color: var(--hf-muted); line-height: 1.65; }
.settings-card { margin-top: 20px; padding: 26px; border: 1px solid var(--hf-line); border-radius: 24px; background: #fff; box-shadow: 0 14px 40px rgba(35,36,43,.05); }
.settings-methods { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: stretch; }
.settings-methods .settings-card { height: 100%; display: flex; flex-direction: column; }
.settings-methods .settings-primary { margin-top: auto; align-self: flex-start; }
.settings-form-grid--manual { grid-template-columns: 1fr; }
.settings-security-note { margin: 12px 0 18px; color: var(--hf-muted); font-size: 11px; line-height: 1.55; }
.settings-security-note strong { color: var(--hf-orange); }
.settings-message--global { margin-top: 18px; }
.settings-card-heading { margin-bottom: 22px; display: flex; align-items: center; gap: 14px; }
.settings-card-heading img { width: 42px; height: 42px; padding: 9px; border-radius: 13px; object-fit: contain; background: #f2f2f4; }
.settings-card-heading h2 { margin: 0 0 4px; font-size: 18px; }
.settings-card-heading p { margin: 0; color: var(--hf-muted); font-size: 12px; }
.settings-card label { display: block; margin: 0 0 7px; font-size: 13px; font-weight: 700; }
.settings-card input, .settings-card textarea {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid #bfc0c6;
    border-radius: 14px;
    color: var(--hf-text);
    background: #fff;
    outline: 0;
    resize: vertical;
}
.settings-card input:focus, .settings-card textarea:focus { border-color: var(--hf-orange); box-shadow: 0 0 0 4px rgba(255,120,33,.12); }
.settings-primary, .settings-secondary, .server-row-actions button {
    margin-top: 14px;
    padding: 10px 18px;
    border: 0;
    border-radius: 99px;
    color: #fff;
    background: var(--hf-charcoal);
    cursor: pointer;
    font-weight: 700;
}
.settings-primary:hover { background: var(--hf-orange); }
.settings-primary:disabled { opacity: .65; cursor: wait; }
.settings-secondary { color: var(--hf-charcoal); border: 1px solid var(--hf-line); background: #fff; }
.settings-message { margin-top: 15px; padding: 11px 14px; border-radius: 12px; font-size: 13px; }
.settings-message--success { color: #176541; border: 1px solid #b9e5ce; background: #ecfaf2; }
.settings-message--error { color: #96313b; border: 1px solid #efc4c9; background: #fff0f1; }
.settings-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.settings-form-wide { grid-column: 1 / -1; }
.generated-token { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--hf-line); }
.configured-servers { display: grid; gap: 12px; }
.server-row { padding: 15px; display: grid; grid-template-columns: 42px minmax(0,1fr) auto; align-items: center; gap: 14px; border: 1px solid var(--hf-line); border-radius: 17px; }
.server-row--selected { border-color: #efb187; background: #fffaf6; }
.server-row-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; color: #fff; background: var(--hf-charcoal); font-size: 24px; }
.server-row-copy { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.server-row-copy span { color: var(--hf-muted); font-size: 12px; }
.server-row-copy code { overflow: hidden; color: #777983; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.server-row-actions { display: flex; align-items: center; gap: 8px; }
.server-row-actions button { margin: 0; padding: 8px 13px; font-size: 12px; }
.server-row-actions .delete-server { width: 32px; height: 32px; padding: 0; color: #a83742; background: #fff0f1; font-size: 20px; }
.selected-badge { padding: 7px 11px; border-radius: 99px; color: #176541; background: #e4f7ed; font-size: 11px; font-weight: 700; }
.empty-state { margin: 0; padding: 24px; color: var(--hf-muted); border: 1px dashed #c9cad0; border-radius: 16px; text-align: center; }
.server-settings-page.theme-dark { color: #fff; background: #070707; }
.theme-dark .settings-header, .theme-dark .settings-card { color: #fff; border-color: #3a3a3d; background: #171719; }
.theme-dark .settings-title > p:last-child, .theme-dark .settings-card-heading p, .theme-dark .server-row-copy span, .theme-dark .server-row-copy code { color: #b7b7bd; }
.theme-dark .settings-security-note { color: #b7b7bd; }
.theme-dark .settings-card input, .theme-dark .settings-card textarea { color: #fff; border-color: #5a5a60; background: #242428; }
.theme-dark .server-row { border-color: #414146; background: #1d1d20; }
.theme-dark .server-row--selected { border-color: #ff7821; background: #352116; }

@media (max-width: 768px) {
    .login-page { display: block; height: auto; }
    .login-panel { min-width: 0; min-height: 100vh; padding: 145px 0 38px; align-content: center; overflow: hidden; }
    .brand-stage { display: none; }
    .settings-link { width: 30px; height: 30px; }
    .theme-toggle--mobile { display: block; top: 1.5rem; right: auto; left: 5rem; }
    .mobile-diagonal { position: absolute; z-index: 0; inset: 0; display: block; background: #3c3c46; clip-path: polygon(100vw 0%,100% 0%,100% 100%,80vw 100%); }
    .theme-dark .mobile-diagonal { background: #783810; }
    .login-corner-mark { position: absolute; z-index: 1; top: 0; right: 0; display: block; }
    .login-corner-mark img { width: 145px; height: 150px; object-fit: contain; }
    .login-card { width: 90%; margin-top: 2rem; }
    .login-form-surface { min-height: 480px; display: flex; flex-direction: column; justify-content: center; }
    .input-shell { height: 38px; padding: 0 .7rem; }
    .input-shell img { width: 20px; height: 19px; margin-left: 2px; }
    .login-footer { z-index: 1; }
    .settings-header { grid-template-columns: 1fr auto; padding: 0 18px; }
    .settings-header .brand-logo { display: none; }
    .settings-form-grid { grid-template-columns: 1fr; }
    .settings-methods { grid-template-columns: 1fr; }
    .settings-form-wide { grid-column: auto; }
    .server-row { grid-template-columns: 38px minmax(0,1fr); }
    .server-row-actions { grid-column: 1 / -1; justify-content: flex-end; }
}

@media (max-width: 390px) {
    .login-corner-mark img { width: 125px; height: 130px; }
    .login-panel { padding-top: 125px; }
}

/* Panel principal inspirado en la cuadrícula de aplicaciones original */
.dashboard-page {
    --dashboard-surface: #fff;
    --dashboard-canvas: #f6f6f7;
    --dashboard-text: #303139;
    --dashboard-muted: #777983;
    --dashboard-border: #dedfe3;
    min-height: 100vh;
    color: var(--dashboard-text);
    background:
        radial-gradient(circle at 82% 4%, rgba(255,120,33,.08), transparent 26rem),
        var(--dashboard-canvas);
    transition: color .25s, background .25s;
}
.dashboard-page.dashboard-dark {
    --dashboard-surface: #171719;
    --dashboard-canvas: #080809;
    --dashboard-text: #f4f4f6;
    --dashboard-muted: #aaaab2;
    --dashboard-border: #37373c;
    background:
        radial-gradient(circle at 82% 4%, rgba(255,120,33,.12), transparent 28rem),
        #080809;
}
.dashboard-page .dashboard-header {
    height: 88px;
    border-color: var(--dashboard-border);
    background: color-mix(in srgb, var(--dashboard-surface) 94%, transparent);
    backdrop-filter: blur(18px);
}
.dashboard-actions, .session-pills { display: flex; align-items: center; gap: 12px; }
.dashboard-theme-toggle {
    width: 47px;
    height: 25px;
    padding: 3px;
    border: 1px solid #c7c8cd;
    border-radius: 99px;
    background: #ebebed;
    cursor: pointer;
    transition: background .2s, border-color .2s;
}
.dashboard-theme-toggle span {
    display: block;
    width: 17px;
    height: 17px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 7px rgba(0,0,0,.24);
    transition: transform .2s;
}
.dashboard-theme-toggle.on { border-color: #b6581b; background: #ff7821; }
.dashboard-theme-toggle.on span { transform: translateX(21px); }
.dashboard-page .user-copy strong { color: var(--dashboard-text); }
.dashboard-page .user-copy small, .dashboard-page .chevron { color: var(--dashboard-muted); }
.dashboard-page .menu-popover {
    color: var(--dashboard-text);
    border-color: var(--dashboard-border);
    background: var(--dashboard-surface);
}
.dashboard-page .menu-popover > div { border-color: var(--dashboard-border); }
.dashboard-page .menu-popover small { color: var(--dashboard-muted); }
.dashboard-page .dashboard-content { width: min(1260px, calc(100% - 64px)); padding-top: 66px; }
.dashboard-page .welcome-row { margin-bottom: 38px; align-items: center; }
.dashboard-page .welcome-row h1 { color: var(--dashboard-text); font-size: clamp(35px, 4vw, 49px); }
.dashboard-page .welcome-row p { color: var(--dashboard-muted); }
.company-pill, .role-pill {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    border-radius: 99px;
    font-size: 12px;
    font-weight: 800;
}
.company-pill {
    padding: 5px 14px 5px 5px;
    color: var(--dashboard-text);
    border: 1px solid var(--dashboard-border);
    background: var(--dashboard-surface);
}
.company-pill span {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    background: linear-gradient(145deg, #ff8b3f, #b64e0c);
}
.dashboard-dark .role-pill { color: #f1d988; border-color: #66552d; background: #282318; }
.applications-panel {
    padding: 28px;
    border: 1px solid var(--dashboard-border);
    border-radius: 32px;
    background: var(--dashboard-surface);
    box-shadow: 0 24px 70px rgba(35,36,43,.075);
}
.dashboard-dark .applications-panel { box-shadow: 0 24px 70px rgba(0,0,0,.32); }
.applications-heading {
    margin-bottom: 25px;
    padding: 0 2px 21px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    border-bottom: 1px solid var(--dashboard-border);
}
.applications-heading > div { display: flex; align-items: center; gap: 12px; }
.applications-heading h2 { margin: 0; font-size: 19px; letter-spacing: -.35px; }
.applications-heading small { color: var(--dashboard-muted); font-size: 11px; }
.section-number { color: var(--hf-orange); font-size: 11px; font-weight: 900; letter-spacing: 1.2px; }
.dashboard-page .apps-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 17px; }
.dashboard-page .app-card {
    min-height: 285px;
    padding: 25px 21px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    overflow: hidden;
    border-color: var(--dashboard-border);
    border-radius: 23px;
    color: var(--dashboard-text);
    background: var(--dashboard-canvas);
    text-align: center;
}
.dashboard-page .app-card::before {
    content: "";
    position: absolute;
    top: -70px;
    left: 50%;
    width: 190px;
    height: 150px;
    border-radius: 50%;
    background: rgba(255,120,33,.09);
    filter: blur(2px);
    transform: translateX(-50%);
}
.dashboard-page .app-card::after { right: -65px; bottom: -80px; background: rgba(255,120,33,.07); }
.dashboard-page .app-card:hover {
    transform: translateY(-7px);
    border-color: #e38a50;
    box-shadow: 0 20px 38px rgba(45,42,39,.13);
}
.dashboard-page .app-card-icon {
    position: relative;
    width: 84px;
    height: 80px;
    margin: 0 0 19px;
    border-radius: 17px;
    background:
        linear-gradient(rgba(90,91,101,.88), rgba(90,91,101,.88)),
        linear-gradient(319deg, #3d3e47 -2%, #6e7085 36%, #b5afbb 87%);
    background-blend-mode: soft-light;
    box-shadow: 0 0 16px rgba(146,84,222,.24), 0 3px 5px rgba(0,0,0,.35);
    transition: background .22s, transform .22s;
}
.dashboard-page .app-card-icon::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 17px;
    padding: 1.5px;
    background: linear-gradient(135deg, #fbf8ff 0%, #00031a 106%);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}
.dashboard-page .app-card:hover .app-card-icon {
    background: linear-gradient(319deg, #ffc123 -2%, #27231a 40%, #78736b 100%);
    transform: scale(1.045);
}
.dashboard-dark .app-card-icon { background: #1a1a1a; }
.dashboard-page .app-icon { width: 43px; height: 43px; }
.dashboard-page .app-card-copy { flex: 1; padding: 0; }
.dashboard-page .app-card h3 {
    min-height: 45px;
    margin: 0 0 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--dashboard-text);
    font-size: 15px;
    line-height: 1.35;
    letter-spacing: -.2px;
}
.dashboard-page .app-card p { margin: 0; color: var(--dashboard-muted); font-size: 11.5px; line-height: 1.55; }
.card-action {
    margin-top: 16px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--dashboard-muted);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .7px;
    text-transform: uppercase;
}
.card-action b { color: var(--hf-orange); font-size: 15px; }
.dashboard-page .sync-banner {
    color: var(--dashboard-text);
    border-color: color-mix(in srgb, #2ca36b 42%, var(--dashboard-border));
    background: color-mix(in srgb, #2ca36b 8%, var(--dashboard-surface));
}
.dashboard-page .sync-banner span { color: var(--dashboard-muted); }

@media (max-width: 1050px) {
    .dashboard-page .apps-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dashboard-page .app-card { min-height: 255px; }
}

@media (max-width: 650px) {
    .dashboard-page .dashboard-header { height: 76px; padding: 0 17px; }
    .dashboard-page .dashboard-content { width: calc(100% - 24px); padding: 34px 0 45px; }
    .dashboard-page .welcome-row { margin-bottom: 25px; display: block; }
    .dashboard-page .welcome-row h1 { font-size: 32px; }
    .session-pills { margin-top: 19px; flex-wrap: wrap; }
    .applications-panel { padding: 18px 13px; border-radius: 24px; }
    .applications-heading { align-items: flex-start; }
    .applications-heading small { max-width: 105px; text-align: right; line-height: 1.4; }
    .dashboard-page .apps-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .dashboard-page .app-card { min-height: 250px; padding: 20px 11px 16px; border-radius: 19px; }
    .dashboard-page .app-card-icon { width: 72px; height: 69px; border-radius: 15px; }
    .dashboard-page .app-card h3 { min-height: 58px; font-size: 13px; }
    .dashboard-page .app-card p { display: none; }
    .dashboard-theme-toggle { width: 43px; }
    .dashboard-theme-toggle.on span { transform: translateX(17px); }
}

/* Área autenticada: composición original del proyecto HighFinance de referencia */
body:has(.reference-shell) {
    overflow: hidden;
    background: #fff;
}

.reference-shell {
    width: calc(100% - 64px);
    height: calc(100vh - 64px);
    min-height: 560px;
    margin: 32px;
    display: flex;
    align-items: stretch;
    justify-content: center;
    color: #303139;
    background: #fff;
}

.reference-sidebar {
    position: relative;
    z-index: 2;
    flex: 0 0 149px;
    height: 100%;
}

.reference-nav {
    width: 149px;
    height: 100%;
    padding: 16px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    border-radius: 50px;
    color: #fff;
    background: #5a5b65;
    box-shadow: 3px 0 10px rgba(0, 0, 0, .15);
    transition: background .25s;
}

.reference-nav-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 40px;
}

.reference-nav-button,
.reference-logo-button,
.reference-theme-toggle {
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
}

.reference-nav-button {
    width: 50px;
    height: 50px;
    display: grid;
    place-items: center;
    color: #fff;
    transition: color .2s, transform .2s;
}

.reference-nav-button:hover,
.reference-nav-button:focus-visible {
    color: #c89f2d;
    transform: translateY(-2px);
}

.reference-nav-button:focus-visible,
.reference-logo-button:focus-visible,
.reference-theme-toggle:focus-visible,
.reference-app-item:focus-visible {
    outline: 3px solid #ffc123;
    outline-offset: 4px;
}

.reference-nav-button svg { width: 42px; height: 43px; }
.reference-nav-button:nth-child(3) svg { width: 45px; height: 45px; }
.reference-logout-button svg { width: 38px; height: 38px; }
.reference-settings-button { margin-top: 14px; }

.reference-nav-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.reference-logo-button { display: block; border-radius: 20px; }
.reference-logo-button img { width: 80px; height: 82px; display: block; object-fit: contain; }

.reference-theme-toggle {
    position: relative;
    width: 55px;
    height: 26px;
    border-radius: 30px;
    background: linear-gradient(135deg, #fdf5b0, #c3c3c3);
    box-shadow: inset 0 0 8px rgba(0, 0, 0, .73);
    transition: background .3s;
}

.reference-theme-toggle span {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 19px;
    height: 20px;
    border-radius: 50%;
    transform: translateX(30px);
    background: radial-gradient(circle at 30% 30%, #ffa500, #ff8c00);
    box-shadow: 0 0 5px rgba(255, 165, 0, .6);
    transition: transform .3s, background .3s, box-shadow .3s;
}

.reference-theme-toggle.on {
    border: 2px solid #fff;
    background: #111;
}

.reference-theme-toggle.on span {
    top: 1px;
    left: 1px;
    transform: translateX(0);
    background: radial-gradient(circle at 50% 50%, #d0eaff, #b0c4de);
    box-shadow: 0 0 5px rgba(200, 200, 255, .5);
}

.reference-main {
    position: relative;
    z-index: 1;
    min-width: 0;
    height: auto;
    flex: 1 1 auto;
    flex: 1 1 auto;
    overflow: hidden;
    border: 5px solid #bec1c5;
    border-left: 0;
    border-radius: 0 50px 50px 0;
    background: #fff;
}

.reference-workspace {
    min-width: 0;
    min-height: 0;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.reference-main-scroll {
    width: 100%;
    height: 100%;
    padding: 28px;
    overflow: auto;
}

.reference-applications {
    width: 100%;
    min-height: 100%;
}

.reference-app-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 16px;
}

.reference-app-item {
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: inherit;
    text-align: center;
    text-decoration: none;
    transition: transform .2s ease;
}

.reference-app-button {
    padding: 0;
    border: 0;
    font: inherit;
    background: transparent;
    cursor: pointer;
}

.reference-app-button:disabled { cursor: wait; opacity: .72; }
.module-launching { margin-top: -12px; color: #8c6711; font-size: 11px; font-weight: 700; }
.module-launch-message {
    margin: 0 0 18px;
    padding: 11px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    border: 1px solid #e3a150;
    border-radius: 12px;
    color: #6f4211;
    background: #fff4df;
    font-size: 13px;
    font-weight: 650;
}
.module-launch-message button { border: 0; color: inherit; background: transparent; cursor: pointer; font-size: 21px; }
.reference-shell--dark .module-launch-message { color: #ffe6ae; border-color: #8d641b; background: #3c2c10; }

.reference-taskbar {
    min-height: 58px;
    padding: 6px 13px;
    display: flex;
    align-items: center;
    gap: 11px;
    border: 1px solid #bec1c5;
    border-radius: 28px;
    background: linear-gradient(180deg, #fff, #eceef1);
    box-shadow: 0 5px 14px rgba(0, 0, 0, .1);
}
.reference-taskbar-home {
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    padding: 8px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
    border: 0;
    border-radius: 13px;
    color: #fff;
    background: #5a5b65;
    cursor: pointer;
}
.reference-taskbar-home span { border-radius: 2px; background: currentColor; }
.reference-taskbar-items { min-width: 0; flex: 1 1 auto; display: flex; align-items: center; gap: 8px; overflow-x: auto; }
.reference-taskbar-item {
    min-width: 0;
    max-width: 230px;
    display: flex;
    align-items: center;
    border: 1px solid #c9cbd0;
    border-radius: 14px;
    background: #fff;
}
.reference-taskbar-focus {
    min-width: 0;
    padding: 5px 8px;
    display: flex;
    align-items: center;
    gap: 7px;
    overflow: hidden;
    border: 0;
    color: #303139;
    background: transparent;
    cursor: pointer;
}
.reference-taskbar-focus .app-icon { width: 26px; height: 26px; flex: 0 0 auto; }
.reference-taskbar-focus span { overflow: hidden; font-size: 12px; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.reference-taskbar-close { padding: 3px 8px; border: 0; color: #666; background: transparent; cursor: pointer; font-size: 19px; }
.reference-taskbar-close:hover { color: #c23a2b; }
.reference-taskbar-company { padding: 0 10px 0 18px; border-left: 1px solid #d2d3d7; color: #5a5b65; font-size: 11px; font-weight: 850; text-transform: uppercase; }
.reference-shell--dark .reference-taskbar { border-color: #62401f; background: linear-gradient(180deg, #292929, #171717); }
.reference-shell--dark .reference-taskbar-item { border-color: #5c5c5c; background: #292929; }
.reference-shell--dark .reference-taskbar-focus { color: #fff; }
.reference-shell--dark .reference-taskbar-close,
.reference-shell--dark .reference-taskbar-company { color: #ddd; }

.reference-app-item:hover { transform: translateY(-3px); }

.reference-app-icon {
    position: relative;
    width: 78px;
    height: 75px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: 10px;
    color: #fff;
    background:
        linear-gradient(rgba(90, 91, 101, 1), rgba(90, 91, 101, 1)),
        linear-gradient(318.96deg, #3d3e47 -1.9%, #6e7085 36.48%, #b5afbb 87.36%);
    background-blend-mode: soft-light;
    box-shadow: 0 0 16px rgba(146, 84, 222, .32), 0 2px 2px #000;
    transition: color .2s, background .2s;
}

.reference-app-icon::before {
    content: "";
    position: absolute;
    z-index: 1;
    inset: 0;
    padding: 1.4px;
    border-radius: 10px;
    background: linear-gradient(135.41deg, #fbf8ff 0%, #00031a 106.82%);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

.reference-app-item:hover .reference-app-icon {
    color: #c89f2d;
    background: linear-gradient(318.96deg, #ffc123 -1.9%, #000 36.48%, #b5afbb 87.36%);
}

.reference-app-icon .app-icon {
    width: 43px;
    height: 43px;
    object-fit: contain;
}

.reference-app-name {
    min-height: 49px;
    margin-top: 5px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    color: #333;
    font-size: 14px;
    font-weight: 700;
    line-height: 22px;
}

.reference-shell--dark { color: #fff; background: #000; }
.reference-shell--dark .reference-nav { background: #783810; }
.reference-shell--dark .reference-main {
    border: 0;
    background: linear-gradient(269.76deg, rgba(0, 0, 0, .31) .19%, rgba(255, 255, 255, .31) 76.27%), #252525;
}
.reference-shell--dark .reference-app-name { color: #fff; }
.reference-shell--dark .reference-app-icon { background: #1a1a1a; }
.reference-shell--dark .reference-app-item:hover .reference-app-icon {
    background: linear-gradient(318.96deg, #ffc123 -1.9%, #000 36.48%, #434343 87.36%);
}
body:has(.reference-shell--dark) { background: #000; }

.reference-modal-overlay {
    position: fixed;
    z-index: 1000;
    inset: 0;
    display: grid;
    place-items: center;
    background: rgba(0, 0, 0, .5);
}

.reference-modal-border {
    width: min(90vw, 428px);
    padding: 4px;
    border-radius: 50px;
    background: linear-gradient(270deg, #ffbf24 0%, #545455 100%);
}

.reference-modal-content {
    position: relative;
    min-height: 190px;
    padding: 32px;
    overflow: hidden;
    border-radius: 46px;
    color: #000;
    background: linear-gradient(90deg, rgba(181, 175, 187, .96), rgba(255, 191, 36, .96));
    box-shadow: 0 4px 20px rgba(0, 0, 0, .3);
    text-align: center;
}

.reference-modal-logo {
    position: absolute;
    z-index: 0;
    top: 50%;
    left: 50%;
    width: 140px;
    height: auto;
    opacity: .45;
    transform: translate(-50%, -50%);
}

.reference-modal-content > *:not(.reference-modal-logo) { position: relative; z-index: 1; }
.reference-modal-content p { margin: 18px 0 29px; font-size: 17px; font-weight: 700; }
.reference-modal-actions { display: flex; justify-content: center; gap: 16px; }
.reference-modal-actions button {
    width: 110px;
    height: 35px;
    border: 0;
    border-radius: 25px;
    color: #fff;
    cursor: pointer;
    font-size: 15px;
    font-weight: 700;
}
.reference-cancel-button { background: #666; }
.reference-confirm-button { background: #f7931a; }
.reference-cancel-button:hover { background: #555; }
.reference-confirm-button:hover { background: #e67e00; }

.reference-module-page { min-height: 100%; color: inherit; background: transparent; }
.reference-module-content { width: 100%; padding: 10px 4px 40px; }
.reference-shell--dark .module-title-row h1,
.reference-shell--dark .module-title-row p,
.reference-shell--dark .back-link { color: #fff; }
.reference-shell--dark .dummy-card,
.reference-shell--dark .placeholder-panel { color: #fff; border-color: #555; background: #252525; }
.reference-shell--dark .placeholder-heading,
.reference-shell--dark .placeholder-row { border-color: #555; }

@media (max-width: 768px) {
    body:has(.reference-shell) { overflow: auto; }
    .reference-shell {
        width: calc(100% - 32px);
        height: auto;
        min-height: calc(100vh - 32px);
        margin: 16px;
        flex-direction: column-reverse;
    }
    .reference-workspace { width: 100%; }
    .reference-sidebar { flex: 0 0 auto; width: 100%; height: 84px; }
    .reference-nav {
        width: 100%;
        height: 84px;
        padding: 0 14px;
        flex-direction: row-reverse;
        border-radius: 0 0 42px 42px;
    }
    .reference-nav-actions { flex-direction: row; gap: clamp(5px, 2.5vw, 16px); }
    .reference-settings-button { margin-top: 0; }
    .reference-nav-button { width: 42px; height: 42px; }
    .reference-nav-button svg { width: 31px; height: 31px; }
    .reference-logout-button { margin-right: 8px; }
    .reference-nav-footer { flex-direction: row; }
    .reference-theme-toggle { display: none; }
    .reference-logo-button img { width: 66px; height: 68px; }
    .reference-main {
        min-height: calc(100vh - 116px);
        height: auto;
        border: 5px solid #bec1c5;
        border-bottom: 0;
        border-radius: 42px 42px 0 0;
    }
    .reference-taskbar { order: -1; min-height: 52px; border-radius: 24px 24px 0 0; }
    .reference-taskbar-company { display: none; }
    .reference-taskbar-focus span { display: none; }
    .reference-main-scroll { min-height: calc(100vh - 116px); height: auto; padding: 24px 16px; }
    .reference-app-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 16px; }
    .reference-shell--dark .reference-main { border: 0; background: linear-gradient(180deg, rgba(0,0,0,.31), rgba(255,255,255,.31)), #252525; }
}

@media (max-width: 390px) {
    .reference-nav { padding: 0 8px; }
    .reference-nav-actions { gap: 2px; }
    .reference-logo-button img { width: 58px; height: 60px; }
    .reference-app-grid { column-gap: 8px; }
}
