/*
 * AUTOS v2 — Shell (sidebar + topbar + layout)
 *
 * BEM: au-shell__*
 * Fonte visual: docs/prototipos/refs/autos-prototipo.html
 */

/* ── Layout grid ── */
.au-shell {
    display: grid;
    grid-template-columns: 216px 1fr;
    grid-template-rows: var(--au-topbar-h) 1fr;
    grid-template-areas:
        "sidebar topbar"
        "sidebar main";
    height: 100vh;
    overflow: hidden;
}

/* ── Sidebar ── */
.au-shell__sidebar {
    grid-area: sidebar;
    background: var(--au-bg-panel);
    border-right: 1px solid var(--au-line);
    display: flex;
    flex-direction: column;
    padding: 0 10px;
    gap: 2px;
    overflow: hidden;
}

/* Brand — altura idêntica ao topbar para alinhar horizontalmente */
.au-shell__brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 10px;
    height: var(--au-topbar-h);
    min-height: var(--au-topbar-h);
    flex-shrink: 0;
    border-bottom: 1px solid var(--au-line);
    margin: 0 -10px;
    padding-left: 20px;
    box-sizing: border-box;
}

.au-shell__brand-mark {
    width: 22px;
    height: 22px;
    background: var(--au-ink-900);
    color: var(--au-bg);
    border-radius: 3px;
    display: grid;
    place-items: center;
    font-family: var(--au-font-serif);
    font-weight: 600;
    font-size: 13px;
    font-style: italic;
}

.au-shell__brand-name {
    font-family: var(--au-font-serif);
    font-weight: 600;
    font-size: 16px;
    letter-spacing: -0.02em;
    color: var(--au-ink-900);
}

.au-shell__brand-beta {
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.1em;
    color: var(--au-accent);
    background: var(--au-accent-soft);
    padding: 1px 5px;
    border-radius: 3px;
    text-transform: uppercase;
    line-height: 1.4;
}

.au-shell__brand-sub {
    font-size: 10px;
    color: var(--au-ink-400);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-left: auto;
}

/* Nav sections */
.au-shell__nav {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    padding-top: 10px;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--au-ink-300) transparent;
}

.au-shell__nav::-webkit-scrollbar {
    width: 8px;
}

.au-shell__nav::-webkit-scrollbar-track {
    background: transparent;
}

.au-shell__nav::-webkit-scrollbar-thumb {
    background: var(--au-ink-300);
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

.au-shell__nav-section {
    display: flex;
    flex-direction: column;
    gap: 1px;
    margin-bottom: 6px;
}

.au-shell__nav-label-row {
    display: flex;
    align-items: center;
    padding: 10px 10px 4px;
}

.au-shell__nav-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--au-ink-400);
}

.au-shell__nav-collapse-inline {
    margin-left: auto;
    border: none;
    background: transparent;
    color: var(--au-ink-400);
    cursor: pointer;
    padding: 2px;
    border-radius: var(--au-radius);
    display: grid;
    place-items: center;
    transition: background 0.12s, color 0.12s;
}

.au-shell__nav-collapse-inline:hover {
    background: var(--au-bg-hover);
    color: var(--au-ink-700);
}

.au-shell__nav-collapse-inline svg {
    width: 12px;
    height: 12px;
    stroke: currentColor;
    stroke-width: 1.5;
    fill: none;
}

/* Nav item */
.au-shell__nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    border-radius: var(--au-radius);
    color: var(--au-ink-700);
    font-weight: 450;
    font-size: 13px;
    cursor: pointer;
}

.au-shell__nav-item:hover {
    background: var(--au-bg-hover);
    color: var(--au-ink-900);
}

.au-shell__nav-item--active {
    background: var(--au-ink-900);
    color: var(--au-bg);
    box-shadow: var(--au-shadow);
}

.au-shell__nav-item--active:hover {
    background: var(--au-ink-900);
    color: var(--au-bg);
}

.au-shell__nav-item--active .au-shell__nav-icon {
    opacity: 1;
}

.au-shell__nav-item--active .au-shell__nav-kbd {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.6);
    border-color: rgba(255, 255, 255, 0.15);
}

.au-shell__nav-item--active .au-shell__nav-badge {
    background: rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.9);
}

.au-shell__nav-sublist {
    display: grid;
    gap: 1px;
    margin: 7px 0 5px 18px;
    padding-left: 15px;
    border-left: 1px solid var(--au-line);
}

.au-shell__nav-subitem {
    appearance: none;
    border: 0;
    width: 100%;
    min-height: 28px;
    display: flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: var(--au-radius);
    background: transparent;
    color: var(--au-ink-500);
    font: inherit;
    line-height: 1.2;
    text-align: left;
    cursor: pointer;
}

.au-shell__nav-subitem:hover {
    background: var(--au-bg-hover);
    color: var(--au-ink-900);
}

.au-shell__nav-subitem--active {
    background: var(--au-bg-selected, var(--au-bg-hover));
    color: var(--au-ink-900);
    font-weight: 600;
}

.au-shell__nav-subitem em {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: var(--au-font-serif);
    font-size: 13px;
    font-style: italic;
    font-weight: 500;
}

/* Nav icon */
.au-shell__nav-icon {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    stroke-width: 1.5;
    fill: none;
    flex-shrink: 0;
    opacity: 0.75;
}

.au-shell__nav-icon--glyph {
    width: 14px;
    height: 14px;
    stroke: none;
    fill: currentColor;
    opacity: 0.95;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    line-height: 1;
    font-weight: 700;
}

.au-shell__nav-icon--fatal { color: var(--au-danger); }
.au-shell__nav-icon--info { color: var(--au-info); }
.au-shell__nav-icon--warn { color: var(--au-warn); }

/* Nav keyboard shortcut */
.au-shell__nav-kbd {
    margin-left: auto;
    font-family: var(--au-font-mono);
    font-size: 10px;
    color: var(--au-ink-400);
    background: var(--au-bg-subtle);
    border: 1px solid var(--au-line);
    border-radius: 3px;
    padding: 1px 5px;
}

/* Nav badge */
.au-shell__nav-badge {
    margin-left: auto;
    font-size: 10px;
    font-weight: 600;
    color: var(--au-ink-500);
    background: var(--au-bg-subtle);
    border-radius: 999px;
    padding: 1px 6px;
    min-width: 16px;
    text-align: center;
}

/* Divider */
.au-shell__divider {
    height: 1px;
    background: var(--au-line);
    margin: 8px 6px;
}

/* Expand button — visible only when sidebar is collapsed */
.au-shell__expand-btn {
    display: none;
    border: none;
    background: transparent;
    color: var(--au-ink-400);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--au-radius);
    justify-content: center;
    align-items: center;
    transition: background 0.12s, color 0.12s;
    flex-shrink: 0;
}

.au-shell__expand-btn:hover {
    background: var(--au-bg-hover);
    color: var(--au-ink-700);
}

.au-shell__expand-btn svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    stroke-width: 1.5;
    fill: none;
}

body[data-sidebar-collapsed="true"] .au-shell__expand-btn {
    display: flex;
}

/* Footer / User */
.au-shell__foot {
    margin-top: auto;
    padding: 14px 10px 24px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    flex-shrink: 0;
    border-top: 1px solid var(--au-line);
}

.au-shell__avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--au-accent-soft);
    color: var(--au-accent);
    display: grid;
    place-items: center;
    font-weight: 600;
    font-size: 10.5px;
    font-family: var(--au-font-sans);
    border: 0;
    letter-spacing: -0.02em;
    box-shadow: 0 0 0 2px var(--au-bg-panel), 0 0 0 3px var(--au-line);
    flex-shrink: 0;
}

.au-shell__user-name {
    font-size: 12px;
    font-weight: 500;
    color: var(--au-ink-900);
    line-height: 1.2;
}

.au-shell__user-org {
    font-size: 10px;
    color: var(--au-ink-400);
    line-height: 1.2;
}

/* ── User menu button ── */
.au-shell__user-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 6px 8px;
    border: none;
    background: transparent;
    border-radius: var(--au-radius, 6px);
    cursor: pointer;
    text-align: left;
    color: inherit;
    font: inherit;
    transition: background .12s;
}
.au-shell__user-btn:hover {
    background: var(--au-bg-hover);
}

/* ── User dropdown menu ── */
.au-shell__user-menu {
    position: fixed;
    bottom: 60px;
    left: 10px;
    background: var(--au-bg-panel);
    border: 1px solid var(--au-line);
    border-radius: var(--au-radius-lg, 8px);
    box-shadow: var(--au-shadow-lg);
    overflow: hidden;
    z-index: 9999;
    font-size: 13px;
    min-width: 240px;
    padding: 4px;
}
.au-shell__user-menu-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px 10px 10px;
}
.au-shell__user-menu-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--au-accent-soft);
    color: var(--au-accent);
    display: grid;
    place-items: center;
    font-weight: 600;
    font-size: 13px;
    font-family: var(--au-font-sans);
    border: 0;
    letter-spacing: -0.02em;
    box-shadow: 0 0 0 2px var(--au-bg-panel), 0 0 0 3px var(--au-line);
    flex-shrink: 0;
}
.au-shell__user-menu-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.au-shell__user-menu-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--au-ink-900);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.au-shell__user-menu-email {
    font-size: 11.5px;
    color: var(--au-ink-500);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: var(--au-font-sans);
}
.au-shell__user-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    color: var(--au-ink-700);
    text-decoration: none;
    cursor: pointer;
    transition: background .1s, color .1s;
    border-radius: var(--au-radius-sm);
}
.au-shell__user-menu-item:hover {
    background: var(--au-bg-hover);
    color: var(--au-ink-900);
}
.au-shell__user-menu-item--danger {
    color: var(--au-danger);
}
.au-shell__user-menu-item--danger:hover {
    background: var(--au-danger-soft);
    color: var(--au-danger);
}
.au-shell__user-menu-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: var(--au-ink-400);
}
.au-shell__user-menu-item:hover .au-shell__user-menu-icon {
    color: var(--au-ink-700);
}
.au-shell__user-menu-item--danger .au-shell__user-menu-icon {
    color: var(--au-danger);
}
.au-shell__user-menu-divider {
    border-top: 1px solid var(--au-line);
    margin: 4px 0;
}

/* ── Topbar ── */
.au-shell__topbar {
    grid-area: topbar;
    position: relative;
    z-index: 80;
    background: var(--au-bg-panel);
    border-bottom: 1px solid var(--au-line);
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 20px;
}

/* Explorer actions group — left side of topbar, only visible on Pesquisa/Arquivos */
.au-shell__topbar-explorer-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.au-shell__topbar-explorer-actions[hidden] {
    display: none;
}

.au-shell__topbar-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border: 1px solid var(--au-line);
    background: var(--au-bg);
    border-radius: var(--au-radius);
    color: var(--au-ink-600);
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
}
.au-shell__topbar-btn[hidden] {
    display: none;
}
.au-shell__topbar-btn:hover {
    background: var(--au-bg-hover);
    color: var(--au-ink-900);
}
.au-shell__topbar-btn svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* Topbar context chip — referência visual ao módulo ativo (estilo "g a") */
.au-shell__topbar-context {
    font-family: var(--au-font-mono, ui-monospace, monospace);
    font-size: 11px;
    font-weight: 500;
    color: var(--au-ink-600);
    background: var(--au-bg-panel);
    border: 1px solid var(--au-line);
    border-radius: var(--au-radius-sm);
    padding: 3px 9px;
    margin-right: 8px;
    letter-spacing: 0.01em;
    text-transform: lowercase;
    white-space: nowrap;
    user-select: none;
    line-height: 1.4;
}
.au-shell__topbar-context[hidden] { display: none; }

/* Topbar tabs — segmented control (módulos com sub-navegação) */
.au-shell__topbar-tabs {
    display: flex;
    gap: 2px;
    background: var(--au-bg-subtle);
    border-radius: var(--au-radius-sm);
    padding: 2px;
    margin-right: 8px;
}
.au-shell__topbar-tabs[hidden] { display: none; }

.au-shell__topbar-tab {
    border: none;
    background: transparent;
    padding: 4px 12px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 450;
    color: var(--au-ink-500);
    border-radius: var(--au-radius-sm);
    cursor: pointer;
    transition: all 0.12s;
    white-space: nowrap;
}
.au-shell__topbar-tab:hover { color: var(--au-ink-800); }
.au-shell__topbar-tab--active {
    background: var(--au-bg-panel);
    color: var(--au-ink-900);
    font-weight: 500;
    box-shadow: var(--au-shadow-sm, 0 1px 2px rgba(0,0,0,.04));
}

/* Topbar search (input contextual) */
.au-shell__topbar-search {
    position: relative;
    z-index: 90;
    max-width: 560px;
    flex: 1;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--au-bg-subtle);
    border: 1px solid transparent;
    border-radius: var(--au-radius);
    padding: 6px 10px 6px 12px;
    font-size: 13px;
    color: var(--au-ink-400);
    transition: all 0.15s ease;
}

.au-shell__topbar-search:focus-within {
    background: var(--au-bg);
    border-color: var(--au-line);
    box-shadow: 0 0 0 2px rgba(0,0,0,0.04);
}

.au-shell__topbar-search:hover {
    background: var(--au-bg-hover);
}

.au-shell__cmdk-icon {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    stroke-width: 1.5;
    fill: none;
    opacity: 0.6;
    flex-shrink: 0;
}

.au-shell__cmdk-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    font-family: inherit;
    font-size: 13px;
    color: var(--au-ink-700);
    min-width: 0;
}

.au-shell__cmdk-input::placeholder {
    color: var(--au-ink-400);
}

.au-shell__cmdk-input::selection {
    background: rgba(122, 62, 47, 0.28);
    color: var(--au-ink-900);
}

.au-shell__cmdk-kbd {
    font-family: var(--au-font-mono);
    font-size: 10px;
    color: var(--au-ink-400);
    background: var(--au-bg-panel);
    border: 1px solid var(--au-line);
    border-radius: 3px;
    padding: 1px 5px;
}

.au-shell__cmdk-clear {
    border: none;
    background: transparent;
    color: var(--au-ink-400);
    display: inline-grid;
    place-items: center;
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
}
.au-shell__cmdk-clear:hover {
    color: var(--au-ink-900);
}

/* --- Topbar search dropdown --- */
.au-shell__topbar-dropdown {
    position: fixed;
    background: var(--au-bg);
    border: 1px solid var(--au-line);
    border-radius: var(--au-radius);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    max-height: 400px;
    overflow-y: auto;
    z-index: 9999;
}
.au-shell__topbar-dropdown[hidden] { display: none; }
.au-shell__topbar-dropdown:empty { display: none; }

.au-shell__topbar-dropdown .tbd-group {
    padding: 6px 0;
}
.au-shell__topbar-dropdown .tbd-group + .tbd-group {
    border-top: 1px solid var(--au-line);
}
.au-shell__topbar-dropdown .tbd-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--au-ink-400);
    padding: 4px 12px;
}
.au-shell__topbar-dropdown .tbd-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 13px;
    color: var(--au-ink-700);
    transition: background 0.1s;
}
.au-shell__topbar-dropdown .tbd-item:hover,
.au-shell__topbar-dropdown .tbd-item--selected {
    background: var(--au-bg-hover);
}
.au-shell__topbar-dropdown .tbd-item-icon {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    stroke-width: 1.5;
    fill: none;
    opacity: 0.5;
    flex-shrink: 0;
}
.au-shell__topbar-dropdown .tbd-title {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 300px;
}
.au-shell__topbar-dropdown .tbd-meta {
    font-size: 11px;
    color: var(--au-ink-400);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.au-shell__topbar-dropdown .tbd-item-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

/* Search dropdown */
.au-shell__search-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%);
    width: 680px;
    background: var(--au-bg-panel);
    border: 1px solid var(--au-line);
    border-radius: var(--au-radius);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    max-height: 420px;
    overflow-y: auto;
    z-index: 100;
}

.au-search__group {
    padding: 4px 0;
}

.au-search__group + .au-search__group {
    border-top: 1px solid var(--au-line);
}

.au-search__group-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--au-ink-400);
    padding: 8px 12px 4px;
}

.au-search__item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 12px;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    transition: background 0.1s;
}

.au-search__item:hover {
    background: var(--au-bg-hover);
}

.au-search__item-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--au-ink-900);
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.au-search__item-sub {
    font-size: 11px;
    color: var(--au-ink-400);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.au-search__empty {
    padding: 16px 12px;
    font-size: 13px;
    color: var(--au-ink-400);
    text-align: center;
}

.au-search__more {
    padding: 6px 12px;
    font-size: 11px;
    color: var(--au-ink-400);
    border-top: 1px solid var(--au-line);
}

/* Topbar action buttons */
.au-shell__topbar-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.au-shell__icon-btn {
    position: relative;
    width: 32px;
    height: 32px;
    border-radius: var(--au-radius);
    display: grid;
    place-items: center;
    color: var(--au-ink-500);
    transition: background 0.12s;
}

.au-shell__icon-btn:hover {
    background: var(--au-bg-hover);
    color: var(--au-ink-900);
}

.au-shell__icon-btn svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    stroke-width: 1.5;
    fill: none;
}

/* Botao do assistente na topbar global - avatar humanizado + rotulo.
   O ponto verde com halo (assistente disponivel) vira o status do avatar. */
.au-shell__assistant-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 32px;
    padding: 0 6px 0 12px;
    border: 1px solid var(--au-line);
    background: var(--au-bg-panel);
    border-radius: 999px;
    color: var(--au-ink-700);
    cursor: pointer;
    transition: background .12s, border-color .12s, color .12s, box-shadow .12s;
}
.au-shell__assistant-btn:hover {
    background: var(--au-bg-hover);
    color: var(--au-ink-900);
    border-color: var(--au-line-strong);
}
.au-shell__assistant-btn.active {
    border-color: color-mix(in srgb, var(--au-accent) 55%, transparent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--au-accent) 14%, transparent);
}
.au-shell__assistant-label {
    font-size: 13px;
    font-weight: 550;
    letter-spacing: .01em;
    white-space: nowrap;
}
.au-shell__assistant-avatar {
    position: relative;
    width: 26px;
    height: 26px;
    flex: none;
}
.au-shell__assistant-avatar svg {
    width: 26px;
    height: 26px;
    display: block;
    border-radius: 50%;
}
.au-shell__assistant-status {
    position: absolute;
    right: -1px;
    bottom: -1px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--au-ok);
    border: 2px solid var(--au-bg-panel);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--au-ok) 24%, transparent);
    transition: box-shadow .15s;
}
.au-shell__assistant-btn:hover .au-shell__assistant-status,
.au-shell__assistant-btn.active .au-shell__assistant-status {
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--au-ok) 30%, transparent);
}
/* Em telas estreitas, recolhe para so o avatar (mantem o alvo de toque). */
@media (max-width: 640px) {
    .au-shell__assistant-btn {
        padding: 0;
        width: 32px;
        justify-content: center;
        border-radius: 50%;
    }
    .au-shell__assistant-label {
        display: none;
    }
}

/* Inbox badge */
.au-shell__inbox-wrap {
    position: relative;
}

.au-shell__count-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--au-accent);
    color: var(--au-bg-panel);
    font-size: 9px;
    font-weight: 600;
    display: grid;
    place-items: center;
    line-height: 1;
}

/* ── Sidebar collapse toggle ── */
.au-shell__collapse-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 6px 10px;
    border: none;
    background: transparent;
    border-radius: var(--au-radius);
    color: var(--au-ink-400);
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
}

.au-shell__collapse-btn:hover {
    background: var(--au-bg-hover);
    color: var(--au-ink-700);
}

.au-shell__collapse-btn svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    stroke-width: 1.5;
    fill: none;
    transition: transform 0.2s ease;
}

.au-shell__collapse-hint {
    display: none;
    font-family: var(--au-font-mono);
    font-size: 10px;
    line-height: 1;
    letter-spacing: -0.02em;
}

.au-shell__foot-user {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-width: 0;
}

/* ── Sidebar collapsed state ── */
body[data-sidebar-collapsed="true"] .au-shell {
    grid-template-columns: 56px 1fr;
}

body[data-sidebar-collapsed="true"] .au-shell__sidebar {
    width: 56px;
    padding: 0 6px;
    align-items: center;
}

body[data-sidebar-collapsed="true"] .au-shell__brand-name,
body[data-sidebar-collapsed="true"] .au-shell__brand-sub,
body[data-sidebar-collapsed="true"] .au-shell__brand-beta {
    display: none;
}

/* BETA badge na topbar — só aparece quando sidebar colapsada */
.au-shell__topbar-beta {
    display: none;
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.1em;
    color: var(--au-accent);
    background: var(--au-accent-soft);
    padding: 1px 5px;
    border-radius: 3px;
    text-transform: uppercase;
    line-height: 1.4;
    margin-right: 8px;
    flex-shrink: 0;
}

body[data-sidebar-collapsed="true"] .au-shell__topbar-beta {
    display: inline-block;
}

body[data-sidebar-collapsed="true"] .au-shell__brand {
    justify-content: center;
    padding: 0;
    margin: 0 -6px;
    padding-left: 0;
}

body[data-sidebar-collapsed="true"] .au-shell__nav-text,
body[data-sidebar-collapsed="true"] .au-shell__nav-kbd,
body[data-sidebar-collapsed="true"] .au-shell__nav-label,
body[data-sidebar-collapsed="true"] .au-shell__nav-label-row,
body[data-sidebar-collapsed="true"] .au-shell__nav-sublist {
    display: none;
}

body[data-sidebar-collapsed="true"] .au-shell__nav-item {
    justify-content: center;
    padding: 8px;
    position: relative;
}

body[data-sidebar-collapsed="true"] .au-shell__nav-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    margin-left: 0;
    font-size: 9px;
    min-width: 14px;
    height: 14px;
    padding: 0 3px;
}

/* Tooltip on hover when collapsed */
body[data-sidebar-collapsed="true"] .au-shell__nav-item:hover::after {
    content: attr(data-label);
    position: absolute;
    left: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%);
    background: var(--au-ink-900);
    color: var(--au-bg);
    font-size: 12px;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: var(--au-radius);
    white-space: nowrap;
    z-index: 1000;
    pointer-events: none;
    box-shadow: var(--au-shadow);
}

body[data-sidebar-collapsed="true"] .au-shell__user-info {
    display: none;
}

body[data-sidebar-collapsed="true"] .au-shell__foot {
    align-items: center;
    padding-bottom: 28px;
    gap: 14px;
}

body[data-sidebar-collapsed="true"] .au-shell__foot-user {
    width: auto;
    justify-content: center;
}

body[data-sidebar-collapsed="true"] .au-shell__collapse-btn {
    justify-content: center;
}

body[data-sidebar-collapsed="true"] .au-shell__collapse-btn svg {
    display: none;
    transform: none;
}

body[data-sidebar-collapsed="true"] .au-shell__collapse-hint {
    display: inline-block;
}

body[data-sidebar-collapsed="true"] .au-shell__divider {
    margin: 8px 2px;
}

/* ── Main content area ── */
.au-shell__main {
    grid-area: main;
    overflow-y: auto;
    padding: 0;
    background: var(--au-bg);
    /* Scrollbar discreta: invisivel por padrao, aparece on hover */
    scrollbar-width: thin;
    scrollbar-color: transparent transparent;
    transition: scrollbar-color .18s ease;
}
.au-shell__main:hover { scrollbar-color: var(--au-line-strong) transparent; }
.au-shell__main::-webkit-scrollbar { width: 8px; }
.au-shell__main::-webkit-scrollbar-track { background: transparent; }
.au-shell__main::-webkit-scrollbar-thumb {
    background: transparent;
    border-radius: 4px;
    border: 2px solid transparent;
    background-clip: padding-box;
}
.au-shell__main:hover::-webkit-scrollbar-thumb {
    background: var(--au-line-strong);
    background-clip: padding-box;
}

/* --- Botão Novo (+ da topbar) com dropdown menu --- */
.au-shell__novo-wrap {
    position: relative;
}

.au-shell__novo-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 200px;
    background: var(--au-bg, var(--au-bg-panel));
    border: 1px solid var(--au-border, var(--au-line));
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    padding: 4px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.au-shell__novo-menu[hidden] {
    display: none;
}

.au-shell__novo-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border: 0;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    text-align: left;
    color: var(--au-fg, var(--au-ink-900));
    font-size: 13px;
    font-family: inherit;
    transition: background-color 80ms ease;
}

.au-shell__novo-item:hover {
    background: var(--au-bg-alt, var(--au-bg-subtle));
}

.au-shell__novo-item:focus-visible {
    outline: 2px solid var(--au-accent, var(--au-info));
    outline-offset: -2px;
}

.au-shell__novo-item svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    stroke: currentColor;
    stroke-width: 1.8;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    color: var(--au-fg-muted, var(--au-ink-500));
}

.au-shell__novo-label {
    flex: 1;
}

.au-shell__novo-kbd {
    font-size: 11px;
    color: var(--au-fg-muted, var(--au-ink-400));
    font-family: ui-monospace, monospace;
    background: var(--au-bg-alt, var(--au-bg-subtle));
    padding: 2px 6px;
    border-radius: 3px;
}

/* Tenant switch banner (super-admin) */
/* Item "Trocar de escritório" (acordeon, super-admin) */
.au-shell__user-menu-item--switch {
    color: #664d03;
}
.au-shell__user-menu-item--switch:hover {
    background: #fef3cd;
}
.au-shell__user-menu-item--switch .au-shell__user-menu-icon {
    color: #b08217;
}
.au-shell__user-menu-chevron {
    width: 14px;
    height: 14px;
    margin-left: auto;
    transition: transform 0.15s ease;
    flex-shrink: 0;
    color: #b08217;
}
.au-shell__user-menu-item--switch[aria-expanded="true"] .au-shell__user-menu-chevron {
    transform: rotate(180deg);
}

/* Sublist acordeon */
.au-shell__user-menu-sublist {
    background: rgba(0, 0, 0, 0.025);
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    max-height: 260px;
    overflow-y: auto;
}
.au-shell__user-menu-sublist[hidden] { display: none; }
.au-shell__user-menu-sublist-loading {
    padding: 10px 18px 10px 42px;
    font-size: 12px;
    color: #6b6b6b;
    font-style: italic;
}
.au-shell__user-menu-sublist-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px 8px 42px;
    font-size: 13px;
    color: inherit;
    text-decoration: none;
    cursor: pointer;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
    font-family: inherit;
}
.au-shell__user-menu-sublist-item:hover:not(.is-current):not(.is-loading) {
    background: rgba(102, 77, 3, 0.08);
}
.au-shell__user-menu-sublist-item.is-current {
    color: #b08217;
    font-weight: 600;
    cursor: default;
}
.au-shell__user-menu-sublist-item.is-current::after {
    content: "✓";
    margin-left: auto;
    font-weight: 700;
}
.au-shell__user-menu-sublist-item.is-loading {
    opacity: 0.55;
    pointer-events: none;
}
