/* =========================================================
   MATEO V6 — APPLICATION SHELL
========================================================= */
:root {
    --v6-sidebar-width: 252px;
    --v6-sidebar-collapsed: 76px;
    --v6-topbar-height: 68px;
    --v6-navy: #102f4b;
    --v6-navy-deep: #0b2237;
    --v6-navy-active: #19486d;
    --v6-ivory: #f5f3ee;
    --v6-panel: #ffffff;
    --v6-ink: #243040;
    --v6-muted: #697582;
    --v6-line: #e3e5e5;
    --v6-gold: #b38b4d;
    --v6-blue-soft: #eaf1f7;
}

body.app-shell-v6 { background: var(--v6-ivory); }
body.app-shell-v6 #main-content {
    min-height: 100vh;
    padding-top: var(--v6-topbar-height);
    padding-left: var(--v6-sidebar-width);
    transition: padding-left .2s ease;
}
body.app-shell-v6.v6-sidebar-collapsed #main-content { padding-left: var(--v6-sidebar-collapsed); }
body.app-shell-v6 > #main-content > header { display: none !important; }
body.app-shell-v6 main { min-height: calc(100vh - var(--v6-topbar-height)); }
body.app-shell-v6 .content { margin-top: 28px; }

.v6-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 3100;
    width: var(--v6-sidebar-width);
    display: flex;
    flex-direction: column;
    color: #fff;
    background: linear-gradient(180deg, var(--v6-navy-deep), var(--v6-navy));
    border-right: 1px solid rgba(255,255,255,.08);
    transition: width .2s ease, transform .2s ease;
}

.v6-sidebar__brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: var(--v6-topbar-height);
    padding: 0 18px;
    border-bottom: 1px solid rgba(255,255,255,.09);
    color: #fff;
    text-decoration: none;
}
.v6-sidebar__mark {
    display: grid;
    place-items: center;
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    border: 1px solid rgba(255,255,255,.22);
    border-radius: 12px;
    background: rgba(255,255,255,.08);
    font-weight: 800;
    letter-spacing: .04em;
}
.v6-sidebar__brand-copy { min-width: 0; }
.v6-sidebar__brand-copy strong,
.v6-sidebar__brand-copy small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.v6-sidebar__brand-copy strong { font-family: Georgia, 'Times New Roman', serif; font-size: 1.04rem; }
.v6-sidebar__brand-copy small {
    margin-top: 2px;
    color: rgba(255,255,255,.62);
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.v6-sidebar__nav { flex: 1; overflow: auto; padding: 14px 10px; }
.v6-sidebar__label {
    margin: 20px 12px 7px;
    color: rgba(255,255,255,.42);
    font-size: .62rem;
    font-weight: 800;
    letter-spacing: .13em;
    text-transform: uppercase;
}
.v6-nav-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 11px;
    min-height: 42px;
    padding: 0 12px;
    margin: 2px 0;
    border-radius: 9px;
    color: rgba(255,255,255,.72);
    font-size: .85rem;
    font-weight: 650;
    text-decoration: none;
    transition: background .16s ease, color .16s ease, transform .16s ease;
}
.v6-nav-link:hover {
    color: #fff;
    background: rgba(255,255,255,.07);
    transform: translateX(1px);
}
.v6-nav-link.active {
    color: #fff;
    background: linear-gradient(90deg, rgba(35,88,127,.94), rgba(29,72,108,.76));
    box-shadow: inset 3px 0 0 var(--v6-gold), 0 5px 14px rgba(3,17,28,.18);
}
.v6-nav-link.active::after {
    content: '';
    position: absolute;
    right: 10px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: rgba(255,255,255,.82);
}
.v6-nav-link__icon {
    display: grid;
    place-items: center;
    flex: 0 0 27px;
    width: 27px;
    height: 27px;
    font-size: .92rem;
}

.v6-sidebar__footer { padding: 12px; border-top: 1px solid rgba(255,255,255,.09); }
.v6-sidebar__collapse {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    width: 100%;
    min-height: 40px;
    border: 0;
    border-radius: 9px;
    background: rgba(255,255,255,.065);
    color: rgba(255,255,255,.78);
    font-weight: 700;
    cursor: pointer;
}
.v6-sidebar__collapse:hover { background: rgba(255,255,255,.11); color: #fff; }

.v6-topbar {
    position: fixed;
    top: 0;
    right: 0;
    left: var(--v6-sidebar-width);
    z-index: 3000;
    height: var(--v6-topbar-height);
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 0 24px;
    background: rgba(255,255,255,.94);
    border-bottom: 1px solid var(--v6-line);
    backdrop-filter: blur(16px);
    transition: left .2s ease;
}
.v6-topbar__menu {
    display: none;
    width: 40px;
    height: 40px;
    border: 1px solid var(--v6-line);
    border-radius: 10px;
    background: #fff;
    color: var(--v6-ink);
}
.v6-topbar__context { min-width: 0; }
.v6-topbar__eyebrow {
    display: block;
    color: var(--v6-muted);
    font-size: .64rem;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
}
.v6-topbar__title {
    margin: 1px 0 0;
    color: var(--v6-ink);
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 1.18rem;
    line-height: 1.15;
}
.v6-search-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    width: min(430px, 42vw);
    min-height: 40px;
    margin-left: auto;
    padding: 0 11px 0 14px;
    border: 1px solid var(--v6-line);
    border-radius: 10px;
    background: #f8f8f7;
    color: var(--v6-muted);
    text-align: left;
    cursor: pointer;
}
.v6-search-trigger span { flex: 1; }
.v6-search-trigger kbd {
    padding: 3px 7px;
    border: 1px solid #d9dcde;
    border-bottom-width: 2px;
    border-radius: 6px;
    background: #fff;
    color: #59636d;
    font: 700 .68rem var(--font-system, sans-serif);
}
.v6-topbar .user-area { display: flex; grid-column: auto; justify-self: auto; }
.v6-topbar #user-profile { color: var(--v6-ink); background: #fff; border-color: var(--v6-line); }
.v6-topbar #user-profile p { color: var(--v6-ink); }
.v6-topbar .dropdown-content { background: #fff; border-color: var(--v6-line); }
.v6-topbar .signout-button { color: var(--v6-ink); }
.v6-topbar .signout-button:hover { background: #f3f4f4; }

body.v6-sidebar-collapsed .v6-sidebar { width: var(--v6-sidebar-collapsed); }
body.v6-sidebar-collapsed .v6-topbar { left: var(--v6-sidebar-collapsed); }
body.v6-sidebar-collapsed .v6-sidebar__brand-copy,
body.v6-sidebar-collapsed .v6-sidebar__label,
body.v6-sidebar-collapsed .v6-nav-link__text,
body.v6-sidebar-collapsed .v6-sidebar__collapse span { display: none; }
body.v6-sidebar-collapsed .v6-sidebar__brand { justify-content: center; padding: 0; }
body.v6-sidebar-collapsed .v6-nav-link { justify-content: center; padding: 0; }
body.v6-sidebar-collapsed .v6-nav-link.active::after { display: none; }

.v6-command {
    position: fixed;
    inset: 0;
    z-index: 7000;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding: 12vh 20px 20px;
    background: rgba(10,24,37,.58);
    backdrop-filter: blur(6px);
}
.v6-command.is-open { display: flex; }
.v6-command__dialog {
    width: min(100%, 680px);
    overflow: hidden;
    border: 1px solid rgba(255,255,255,.5);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 28px 90px rgba(8,22,34,.34);
}
.v6-command__search { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--v6-line); }
.v6-command__search input { flex: 1; min-height: 42px; border: 0; outline: 0; color: var(--v6-ink); font-size: 1rem; }
.v6-command__close { border: 0; background: transparent; color: var(--v6-muted); font-weight: 800; }
.v6-command__results { max-height: 390px; overflow: auto; padding: 10px; }
.v6-command__item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 48px;
    padding: 0 12px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--v6-ink);
    text-align: left;
}
.v6-command__item:hover,
.v6-command__item:focus { background: var(--v6-blue-soft); outline: 0; }
.v6-command__item small { margin-left: auto; color: var(--v6-muted); }
.v6-command__empty { padding: 28px; color: var(--v6-muted); text-align: center; }

body.app-shell-v6 footer { margin-top: 56px; background: var(--v6-navy-deep); }

@media (max-width: 900px) {
    body.app-shell-v6 #main-content,
    body.app-shell-v6.v6-sidebar-collapsed #main-content { padding-left: 0; }
    .v6-sidebar {
        width: min(84vw, 290px);
        transform: translateX(-100%);
        box-shadow: 20px 0 60px rgba(6,18,29,.25);
    }
    body.v6-sidebar-open .v6-sidebar { transform: translateX(0); }
    .v6-topbar,
    .v6-sidebar-collapsed .v6-topbar { left: 0; padding: 0 14px; }
    .v6-topbar__menu { display: inline-grid; place-items: center; }
    .v6-search-trigger { width: auto; min-width: 42px; margin-left: auto; }
    .v6-search-trigger span,
    .v6-search-trigger kbd { display: none; }
    .v6-topbar #user-profile p { display: none; }
    .v6-sidebar__collapse { display: none; }
}

@media (max-width: 520px) {
    .v6-topbar__eyebrow { display: none; }
    .v6-topbar__title { font-size: 1rem; }
    .v6-topbar { gap: 10px; }
}

@media (prefers-reduced-motion: reduce) {
    .v6-sidebar,
    .v6-topbar,
    body.app-shell-v6 #main-content,
    .v6-nav-link { transition: none; }
}
