/* ---- App Shell ---- */
.app-shell {
    display: flex;
    min-height: 100vh;
}

.app-shell--auth .sidebar,
.app-shell--auth .header {
    display: none;
}

.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    margin-left: var(--sidebar-width);
    transition: margin-left var(--transition-base);
}

/* ---- Sidebar ---- */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: width var(--transition-base);
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar__brand {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-lg) var(--space-md);
    border-bottom: 1px solid var(--border-subtle);
    min-height: 64px;
}

.sidebar__brand-icon {
    width: 32px;
    height: 32px;
    background: var(--brand-gradient);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar__brand-icon svg {
    width: 18px;
    height: 18px;
    color: white;
}

.sidebar__brand-text {
    font-size: var(--text-lg);
    font-weight: 700;
    white-space: nowrap;
}

.sidebar__brand-text .logo-text__ai {
    background: var(--brand-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar__nav {
    flex: 1;
    padding: var(--space-sm);
}

.sidebar__section {
    margin-bottom: var(--space-md);
}

.sidebar__section-title {
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
    padding: var(--space-sm) var(--space-sm);
    margin-bottom: var(--space-xs);
}

.sidebar__item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: var(--text-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    position: relative;
}

.sidebar__item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.sidebar__item--active {
    background: var(--bg-tertiary);
    color: var(--brand-purple);
}

.sidebar__item--active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--brand-purple);
    border-radius: 0 2px 2px 0;
}

.sidebar__item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.sidebar__item-badge {
    margin-left: auto;
    background: var(--brand-purple);
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 1px 7px;
    border-radius: var(--radius-full);
    min-width: 20px;
    text-align: center;
}

.sidebar__footer {
    padding: var(--space-md);
    border-top: 1px solid var(--border-subtle);
}

.sidebar__user {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.sidebar__user:hover {
    background: var(--bg-tertiary);
}

.sidebar__avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background: var(--brand-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-xs);
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.sidebar__user-info {
    overflow: hidden;
}

.sidebar__user-name {
    font-size: var(--text-sm);
    font-weight: 600;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.sidebar__user-role {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
}

/* ---- Header ---- */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-lg);
    height: 56px;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-secondary);
    position: sticky;
    top: 0;
    z-index: 50;
}

.header__left {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.header__title {
    font-size: var(--text-lg);
    font-weight: 700;
}

.header__subtitle {
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.header__right {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.header__search {
    display: flex;
    align-items: center;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    padding: 6px 14px;
    gap: var(--space-sm);
    width: 280px;
    transition: border-color var(--transition-fast);
}

.header__search:focus-within {
    border-color: var(--brand-purple);
}

.header__search svg {
    width: 16px;
    height: 16px;
    color: var(--text-tertiary);
    flex-shrink: 0;
}

.header__search input {
    flex: 1;
    font-size: var(--text-sm);
    color: var(--text-primary);
}

.header__search input::placeholder {
    color: var(--text-tertiary);
}

/* ---- Main Content ---- */
.main-content {
    flex: 1;
    padding: var(--space-lg);
    overflow-y: auto;
}

/* ---- Page Header ---- */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-lg);
    flex-wrap: wrap;
    gap: var(--space-md);
}

.page-header__title {
    font-size: var(--text-2xl);
    font-weight: 700;
}

.page-header__actions {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}
