@import url('/css/variables.css');

/* ---------- Base / Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
html {
    color-scheme: dark;
    font-size: 16px;
    text-rendering: optimizeLegibility;
    -webkit-text-size-adjust: 100%;
}

html[data-theme="light"] { color-scheme: light; }

body {
    margin: 0;
    font-family: var(--font-stack);
    line-height: 1.45;
    background: radial-gradient(1200px 700px at 20% 0%, rgba(41, 151, 255, 0.22), transparent 60%),
                radial-gradient(900px 650px at 80% 10%, rgba(48, 209, 88, 0.12), transparent 55%),
                radial-gradient(1000px 700px at 50% 100%, rgba(255, 69, 58, 0.10), transparent 60%),
                var(--bg-app);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

html[data-theme="light"] body {
    background:
        radial-gradient(1200px 700px at 20% 0%, rgba(41, 151, 255, 0.10), transparent 60%),
        radial-gradient(900px 650px at 80% 10%, rgba(48, 209, 88, 0.06), transparent 55%),
        radial-gradient(1000px 700px at 50% 100%, rgba(255, 69, 58, 0.05), transparent 60%),
        var(--bg-app);
}

main { min-height: calc(100vh - var(--header-height)); }

/* Explicitly inherit font for form controls */
input, button, textarea, select {
    font-family: inherit;
    font-size: inherit;
}

/* ---------- Footer ---------- */
.site-footer {
    padding: 16px 0 18px;
    text-align: center;
    color: var(--text-tertiary);
}

.site-footer p {
    margin: 0;
    font-size: 12px;
    letter-spacing: 0.01em;
    color: var(--text-tertiary);
}

a {
    color: var(--accent-primary);
    text-decoration: none;
    text-underline-offset: 0.18em;
}

a:hover { text-decoration: underline; }

/* Don't underline interactive controls/navigation on hover */
.btn:hover,
.nav-item:hover,
.nav-brand:hover,
.menu-item:hover,
.thread:hover {
    text-decoration: none;
}

h1, h2, h3, h4, h5 {
    margin: 0;
    letter-spacing: -0.02em;
}

p { margin: 0; color: var(--text-secondary); line-height: 1.5; }

img { max-width: 100%; display: block; }

:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
    box-shadow: var(--focus-shadow);
    border-radius: var(--control-radius);
}

::selection { background: rgba(41, 151, 255, 0.25); }

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

    .spinner,
    .skeleton::after {
        animation: none !important;
    }

    .btn:hover,
    .btn:active {
        filter: none;
    }
}

/* ---------- Global progress (HIG-inspired) ---------- */
.app-progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    background: transparent;
    transition: opacity 160ms ease;
}

.app-progress.is-active { opacity: 1; }

.app-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, rgba(41,151,255,1), rgba(145,70,255,0.95));
    box-shadow: 0 0 24px rgba(0, 122, 255, 0.35);
    border-radius: 999px;
}

/* ---------- Segmented controls ---------- */
.segmented {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 4px;
    border-radius: 14px;
    border: 1px solid var(--divider);
    background: rgba(255,255,255,0.05);
}

.segmented .segmented-item {
    appearance: none;
    border: 0;
    background: transparent;
    color: rgba(245,245,247,0.75);
    padding: 8px 10px;
    border-radius: 10px;
    font-weight: 650;
    cursor: pointer;
    transition: background 160ms ease, color 160ms ease;
}

.segmented .segmented-item:hover {
    background: rgba(255,255,255,0.06);
}

.segmented .segmented-item[aria-pressed="true"] {
    background: rgba(41, 151, 255, 0.18);
    color: rgba(245,245,247,0.96);
}

.segmented input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

/* ---------- Layout Primitives ---------- */
.container {
    width: min(1120px, calc(100% - 40px));
    margin: 0 auto;
}

.w-100 { width: 100%; }

.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.page-title {
    font-size: clamp(2.0rem, 3.5vw, 3.0rem);
    line-height: 1.02;
    font-weight: 900;
    letter-spacing: -0.03em;
    margin: 0;
}

.page-subtitle {
    margin-top: 8px;
    color: rgba(245,245,247,0.70);
    max-width: 72ch;
}

.toolbar {
    padding: 12px;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.toolbar .toolbar-grow {
    flex: 1;
    min-width: 220px;
}

.toolbar .toolbar-select {
    min-width: 180px;
}

.toolbar label {
    margin: 0;
}

.toolbar-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    user-select: none;
    padding: 8px 10px;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.10);
    background: rgba(255,255,255,0.04);
}

.toolbar-check input[type="checkbox"] {
    width: 16px;
    height: 16px;
}

.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

@media (max-width: 1000px) {
    .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

.text-secondary { color: var(--text-secondary); }

/* ---------- Accessibility ---------- */
.skip-link {
    position: absolute;
    left: 12px;
    top: 10px;
    z-index: 10002;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(18, 18, 20, 0.92);
    border: 1px solid rgba(255,255,255,0.14);
    color: rgba(245,245,247,0.92);
    text-decoration: none;
    transform: translateY(-160%);
    transition: transform 180ms ease;
}

.skip-link:focus {
    transform: translateY(0);
    outline: 2px solid rgba(124, 58, 237, 0.75);
    outline-offset: 3px;
}

/* ---------- Header account chip ---------- */
.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    max-width: min(420px, 48vw);
    padding: 7px 10px;
    border-radius: 14px;
}

.user-chip-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 8px 14px rgba(0,0,0,0.35);
}

.user-chip-fallback {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.10);
    border: 1px solid rgba(255,255,255,0.12);
    color: rgba(245,245,247,0.90);
    font-weight: 800;
    font-size: 0.85rem;
}

.user-chip-name {
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 750;
    color: rgba(245,245,247,0.90);
}

.user-chip-caret {
    color: rgba(245,245,247,0.70);
    font-size: 0.85rem;
}

/* ---------- Lists (HIG-inspired) ---------- */
.list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.list-item {
    border-radius: var(--radius-lg);
}

/* ---------- Messages (Threads) ---------- */
.messages-shell {
    display: grid;
    grid-template-columns: 340px minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.messages-list {
    padding: 12px;
    position: sticky;
    top: 92px;
    max-height: calc(100vh - 120px);
    overflow: auto;
}

.messages-list-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    padding: 6px 6px 12px;
}

.thread {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 16px;
    text-decoration: none;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.03);
    color: rgba(245,245,247,0.92);
}

.thread:hover {
    background: rgba(255,255,255,0.06);
    border-color: rgba(255,255,255,0.12);
}

.thread.is-active {
    background: rgba(124, 58, 237, 0.14);
    border-color: rgba(124, 58, 237, 0.35);
}

.thread-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    flex: none;
}

.thread-body {
    min-width: 0;
    flex: 1;
}

.thread-top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
}

.thread-name {
    font-weight: 850;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.thread-time {
    color: var(--text-tertiary);
    font-size: 0.75rem;
    flex: none;
}

.thread-preview {
    color: var(--text-secondary);
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.thread-unread {
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 900;
    background: rgba(124, 58, 237, 0.85);
    color: white;
    box-shadow: 0 10px 16px rgba(0,0,0,0.35);
}

.messages-thread {
    padding: 0;
    overflow: hidden;
}

.messages-thread-head {
    padding: 14px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.messages-bubbles {
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: calc(100vh - 330px);
    overflow: auto;
    position: relative;
}

.jump-latest {
    position: sticky;
    align-self: center;
    top: 10px;
    z-index: 5;
    box-shadow: 0 12px 18px rgba(0,0,0,0.35);
}

.bubble-row {
    display: flex;
    align-items: flex-end;
    gap: 10px;
}

.bubble-row.is-me {
    justify-content: flex-end;
}

.bubble {
    max-width: min(640px, 78%);
    padding: 12px 12px;
    border-radius: 18px;
    border: 1px solid rgba(255,255,255,0.10);
    background: rgba(255,255,255,0.05);
}

.bubble-row.is-me .bubble {
    background: rgba(124, 58, 237, 0.16);
    border-color: rgba(124, 58, 237, 0.30);
}

.bubble-text {
    white-space: pre-wrap;
    color: rgba(245,245,247,0.92);
}

.bubble-meta {
    margin-top: 6px;
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

.messages-compose {
    padding: 12px;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.compose-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.compose-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

@media (max-width: 980px) {
    .messages-shell {
        grid-template-columns: 1fr;
    }
    .messages-list {
        position: relative;
        top: auto;
        max-height: none;
    }
    .messages-bubbles {
        max-height: none;
    }
}

/* ---------- Text guidance ---------- */
.help-text {
    font-size: 0.85rem;
    color: var(--text-tertiary);
}

/* ---------- Switch (HIG-inspired) ---------- */
.switch {
    position: relative;
    width: 46px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.switch input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.switch-ui {
    width: 46px;
    height: 28px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.14);
    background: rgba(255,255,255,0.08);
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.18);
    position: relative;
    transition: background 180ms ease, border-color 180ms ease;
}

.switch-ui::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(245,245,247,0.92);
    box-shadow: 0 10px 18px rgba(0,0,0,0.35);
    transition: transform 180ms ease;
}

.switch input:checked + .switch-ui {
    background: rgba(124, 58, 237, 0.70);
    border-color: rgba(124, 58, 237, 0.95);
}

.switch input:checked + .switch-ui::after {
    transform: translateX(18px);
}

.switch input:focus-visible + .switch-ui {
    outline: 2px solid rgba(124, 58, 237, 0.75);
    outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
    .switch-ui,
    .switch-ui::after {
        transition: none;
    }
}

/* ---------- Toasts (Undo / Feedback) ---------- */
.toast-stack {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: min(520px, calc(100vw - 36px));
}

.toast {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 12px;
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.10);
    background: rgba(18, 18, 20, 0.72);
    backdrop-filter: blur(calc(var(--blur-backdrop) * 0.7)) saturate(var(--saturation-glass));
    -webkit-backdrop-filter: blur(calc(var(--blur-backdrop) * 0.7)) saturate(var(--saturation-glass));
    box-shadow: var(--shadow-lg);
}

.toast-message {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.toast-title {
    font-weight: 750;
    color: rgba(245,245,247,0.92);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.toast-subtitle {
    color: rgba(245,245,247,0.62);
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.toast-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.toast .btn {
    box-shadow: none;
}

/* ---------- Context menus (HIG-inspired) ---------- */
.context-wrap {
    position: relative;
}

.context-trigger {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.10);
    background: rgba(255,255,255,0.06);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: rgba(245,245,247,0.86);
}

.context-trigger:hover {
    background: rgba(255,255,255,0.10);
    border-color: rgba(255,255,255,0.16);
}

.context-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 10px);
    min-width: 220px;
    padding: 8px;
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(18, 18, 20, 0.82);
    backdrop-filter: blur(calc(var(--blur-backdrop) * 0.7)) saturate(var(--saturation-glass));
    -webkit-backdrop-filter: blur(calc(var(--blur-backdrop) * 0.7)) saturate(var(--saturation-glass));
    box-shadow: var(--shadow-lg);
    display: none;
    z-index: 10001;
}

.context-menu.is-open { display: block; }

.menu-item {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 10px;
    border-radius: 12px;
    text-decoration: none;
    border: 0;
    background: transparent;
    color: rgba(245,245,247,0.90);
    cursor: pointer;
    font-weight: 650;
    text-align: left;
}

.menu-item:hover,
.menu-item:focus-visible {
    background: rgba(255,255,255,0.08);
    outline: none;
}

.menu-item-danger {
    color: rgba(255, 69, 58, 0.95);
}

.menu-sep {
    height: 1px;
    margin: 8px 6px;
    background: rgba(255,255,255,0.10);
}

/* ---------- Skeletons (Loading placeholders) ---------- */
.skeleton {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    background: rgba(255,255,255,0.06);
}

.skeleton::after {
    content: '';
    position: absolute;
    inset: 0;
    transform: translateX(-60%);
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.10) 50%, transparent 100%);
    animation: evoria-shimmer 1200ms ease-in-out infinite;
}

@keyframes evoria-shimmer {
    0% { transform: translateX(-60%); }
    100% { transform: translateX(60%); }
}

/* ---------- Media Cards (Clips / VODs) ---------- */
.ratio { position: relative; width: 100%; }
.ratio-16x9 { aspect-ratio: 16 / 9; }

.media-card {
    padding: 0;
    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.media-cover {
    position: relative;
    display: block;
    text-decoration: none;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.media-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.media-cover::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.58), rgba(0,0,0,0));
    pointer-events: none;
}

.media-badges {
    position: absolute;
    left: 12px;
    bottom: 12px;
    display: flex;
    gap: 10px;
    align-items: center;
    z-index: 2;
}

.media-body {
    padding: 14px 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
}

.media-title {
    font-weight: 850;
    line-height: 1.2;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.media-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary);
}

.media-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 7px 10px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.06);
    color: rgba(245,245,247,0.92);
    font-weight: 700;
    font-size: 0.85rem;
    max-width: 100%;
}

.badge-purple {
    border-color: rgba(169, 112, 255, 0.30);
    background: rgba(169, 112, 255, 0.14);
}

.logo-text {
    font-weight: 800;
    letter-spacing: -0.03em;
    background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(255,255,255,0.78));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* ---------- Glass System ---------- */
.glass-nav {
    position: sticky;
    top: 0;
    z-index: 50;
    height: var(--header-height);
    border-bottom: 1px solid var(--divider);
    background: rgba(10, 10, 12, 0.55);
    backdrop-filter: blur(var(--blur-backdrop)) saturate(var(--saturation-glass));
    -webkit-backdrop-filter: blur(var(--blur-backdrop)) saturate(var(--saturation-glass));
}

.glass-nav .nav-inner {
    height: var(--header-height);
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 0 18px;
    gap: 12px;
}

.glass-nav .nav-left,
.glass-nav .nav-center,
.glass-nav .nav-right {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.glass-nav .nav-left { justify-content: flex-start; }
.glass-nav .nav-center { justify-content: center; }
.glass-nav .nav-right {
    justify-content: flex-end;
}

.nav-brand {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

.nav-brand .logo-text {
    font-size: 1.35rem;
    margin: 0;
}

/* ---------- Content width (Dashboard / Community / Admin) ---------- */
.dashboard-main {
    flex: 1;
    padding: 26px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.dashboard-main > * {
    width: 100%;
    max-width: 1160px;
}

@media (max-width: 980px) {
    .dashboard-main { padding: 18px; }
}

.glass-panel {
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(var(--blur-backdrop)) saturate(var(--saturation-glass));
    -webkit-backdrop-filter: blur(var(--blur-backdrop)) saturate(var(--saturation-glass));
    position: relative;
}

.glass-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    background: linear-gradient(135deg, rgba(255,255,255,0.12), transparent 35%, rgba(255,255,255,0.06));
    mask-image: radial-gradient(120% 90% at 20% 10%, black 30%, transparent 65%);
    opacity: 0.8;
}

.glass-panel:hover {
    border-color: var(--border-glass-highlight);
    background: var(--bg-glass-hover);
}

.card {
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.card-title {
    font-weight: 700;
    color: var(--text-primary);
}

/* ---------- Dashboard Layout ---------- */
.dashboard-layout {
    display: flex;
    min-height: calc(100vh - var(--header-height));
}

.sidebar {
    width: var(--sidebar-width);
    padding: 18px 14px;
    border-right: 1px solid var(--divider);
    background: rgba(10, 10, 12, 0.45);
    backdrop-filter: blur(var(--blur-backdrop)) saturate(var(--saturation-glass));
    -webkit-backdrop-filter: blur(var(--blur-backdrop)) saturate(var(--saturation-glass));
    position: sticky;
    top: var(--header-height);
    height: calc(100vh - var(--header-height));
    overflow: auto;
    display: flex;
    flex-direction: column;
}

.sidebar::-webkit-scrollbar { width: 10px; }
.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.10);
    border-radius: 10px;
    border: 2px solid rgba(0,0,0,0.2);
}

.sidebar-nav { display: flex; flex-direction: column; gap: 6px; }

/* Sidebar brand / profile (replaces inline styles in views) */
.sidebar-brand {
    margin-bottom: 28px;
    padding: 0 12px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-brand-mark {
    width: 32px;
    height: 32px;
    background: var(--accent-primary);
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 12px 28px rgba(0, 122, 255, 0.20);
}

.sidebar-brand-title {
    font-weight: 750;
    font-size: 1.15rem;
    letter-spacing: -0.02em;
    color: rgba(245,245,247,0.92);
}

html[data-theme="light"] .sidebar-brand-title { color: var(--text-primary); }

.sidebar-profile {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid var(--divider);
}

.sidebar-profile-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.sidebar-avatar {
    width: 36px;
    height: 36px;
    border-radius: 999px;
    background: var(--bg-tertiary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.10);
}

html[data-theme="light"] .sidebar-avatar { border-color: rgba(0,0,0,0.10); }

.sidebar-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sidebar-profile-meta {
    flex: 1;
    min-width: 0;
}

.sidebar-profile-name {
    font-size: 0.92rem;
    font-weight: 650;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: rgba(245,245,247,0.92);
}

html[data-theme="light"] .sidebar-profile-name { color: var(--text-primary); }

.sidebar-profile-status {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.sidebar-signout { width: 100%; justify-content: center; }

/* Small layout helpers */
.divider-fade {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--divider), transparent);
}

.hero-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Dashboard: welcome header card */
.dashboard-welcome {
    margin-bottom: 24px;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
}

.dashboard-account {
    display: flex;
    align-items: center;
    gap: 12px;
}

.dashboard-account-meta { text-align: right; }

.dashboard-welcome-title {
    margin: 0 0 8px;
    font-size: 1.75rem;
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.dashboard-account-name {
    display: block;
    font-weight: 650;
    color: rgba(245,245,247,0.92);
}

html[data-theme="light"] .dashboard-account-name { color: var(--text-primary); }

.dashboard-account-status {
    display: block;
    font-size: 0.85rem;
    color: var(--success);
}

.stats-grid {
    margin-top: 20px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.stat-tile {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    padding: 14px;
    border-radius: 14px;
}

html[data-theme="light"] .stat-tile {
    background: rgba(0,0,0,0.03);
    border-color: rgba(0,0,0,0.08);
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: rgba(245,245,247,0.94);
}

html[data-theme="light"] .stat-value { color: var(--text-primary); }

.stat-status {
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.stat-status.is-live { color: var(--success); }
.stat-status.is-offline { color: rgba(148, 163, 184, 0.95); }

.stat-callout {
    margin-top: 14px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(169, 112, 255, 0.35);
    background: rgba(169, 112, 255, 0.14);
    color: rgba(245,245,247,0.88);
}

.stat-callout small { color: rgba(245,245,247,0.88); }

html[data-theme="light"] .stat-callout {
    color: var(--text-primary);
    background: rgba(169, 112, 255, 0.12);
}

.dashboard-avatar {
    width: 48px;
    height: 48px;
    border-radius: 999px;
    border: 2px solid var(--accent-primary);
    object-fit: cover;
}

.nav-section-title {
    margin: 18px 12px 8px;
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-tertiary);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--control-radius);
    text-decoration: none;
    color: rgba(245,245,247,0.78);
    border: 1px solid transparent;
    transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}

.nav-item svg { opacity: 0.9; }

.nav-item:hover {
    background: rgba(255,255,255,0.06);
    border-color: rgba(255,255,255,0.08);
}

.nav-item.active {
    background: rgba(41, 151, 255, 0.14);
    border-color: rgba(41, 151, 255, 0.22);
    color: var(--text-primary);
}

@media (max-width: 980px) {
    .sidebar { display: none; }
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border: 0;
    cursor: pointer;
    user-select: none;
    text-decoration: none;
    min-height: var(--control-height);
    padding: var(--control-padding-y) var(--control-padding-x);
    border-radius: var(--control-radius);
    font-weight: 600;
    color: var(--text-primary);
    background: rgba(255,255,255,0.08);
    transition: background 160ms ease, box-shadow 160ms ease, border-color 160ms ease, filter 160ms ease;
    box-shadow: var(--shadow-sm);
}

.btn:hover { filter: brightness(1.04); }
.btn:active { filter: brightness(0.98); }

.btn:disabled,
.btn[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-primary {
    background: var(--accent-gradient);
    box-shadow: 0 16px 44px rgba(0, 122, 255, 0.22);
}

.btn-primary:hover {
    box-shadow: 0 18px 52px rgba(0, 122, 255, 0.30);
}

.btn-secondary {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.10);
}

.btn-glass {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.10);
    backdrop-filter: blur(calc(var(--blur-backdrop) * 0.6)) saturate(var(--saturation-glass));
    -webkit-backdrop-filter: blur(calc(var(--blur-backdrop) * 0.6)) saturate(var(--saturation-glass));
}

.btn-sm {
    min-height: 36px;
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 0.92rem;
}

.btn-lg {
    min-height: 52px;
    padding: 14px 22px;
    border-radius: 16px;
    font-size: 1.05rem;
}

.btn-outline {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.16);
    box-shadow: none;
}

.btn-outline:hover {
    background: rgba(255,255,255,0.06);
    border-color: rgba(255,255,255,0.22);
}

/* ---------- Status Pills ---------- */
.status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 750;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-size: 0.78rem;
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.06);
}

.status-online {
    color: var(--success);
    border-color: rgba(48, 209, 88, 0.25);
    background: rgba(48, 209, 88, 0.10);
}

.status-offline {
    color: var(--text-secondary);
    border-color: rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.05);
}

/* Backwards-compatible aliases used in newer views */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 750;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-size: 0.78rem;
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.06);
}

.status-live {
    color: var(--danger);
    border-color: rgba(255, 69, 58, 0.30);
    background: rgba(255, 69, 58, 0.14);
}

.status-muted {
    color: rgba(245,245,247,0.70);
    border-color: rgba(255,255,255,0.14);
    background: rgba(255,255,255,0.06);
}

/* ---------- Pagination ---------- */
.pagination-bar {
    padding: 12px;
    margin-top: 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.pagination-actions { display: flex; gap: 10px; }

/* ---------- Alerts ---------- */
.alert {
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.10);
    background: rgba(255,255,255,0.06);
    color: rgba(245,245,247,0.9);
    box-shadow: var(--shadow-sm);
}

.alert-success {
    border-color: rgba(48, 209, 88, 0.28);
    background: rgba(48, 209, 88, 0.12);
    color: var(--success);
}

.alert-error,
.alert-danger {
    border-color: rgba(255, 69, 58, 0.28);
    background: rgba(255, 69, 58, 0.10);
    color: var(--danger);
}

/* ---------- Forms ---------- */
.form-group { margin-bottom: 16px; position: relative; }
label, .form-label { display: block; font-size: 0.9rem; color: var(--text-secondary); margin-bottom: 8px; }

input[type="text"],
input[type="search"],
input[type="email"],
input[type="password"],
textarea,
select {
    width: 100%;
    min-height: var(--control-height);
    padding: var(--control-padding-y) var(--control-padding-x);
    border-radius: var(--control-radius);
    border: 1px solid var(--divider);
    background: rgba(255,255,255,0.06);
    color: var(--text-primary);
    outline: none;
    transition: border-color 160ms ease, background 160ms ease;
}

textarea { min-height: 44px; }

input::placeholder, textarea::placeholder { color: rgba(134,134,139,0.8); }

input:focus, textarea:focus, select:focus {
    border-color: rgba(41, 151, 255, 0.55);
    background: rgba(255,255,255,0.08);
}

/* Search fields (HIG-inspired) */
input[type="search"] {
    -webkit-appearance: none;
    appearance: none;
    padding-left: 40px;
    background-image:
        radial-gradient(circle at 18px 50%, rgba(245,245,247,0.35) 0 1px, transparent 2px),
        linear-gradient(135deg, rgba(245,245,247,0.45), rgba(245,245,247,0.10));
    background-size: 0 0, 0 0;
    background-repeat: no-repeat;
}

/* Provide a subtle magnifier hint without relying on external assets */
.toolbar input[type="search"].toolbar-grow {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M10.5 18a7.5 7.5 0 1 1 0-15 7.5 7.5 0 0 1 0 15Z' stroke='%23B7B7BD' stroke-width='2'/%3E%3Cpath d='M16.5 16.5 21 21' stroke='%23B7B7BD' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 14px 50%;
    background-size: 18px 18px;
}

input[type="search"]::-webkit-search-cancel-button {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 999px;
    background:
        radial-gradient(circle at 50% 50%, rgba(255,255,255,0.18), rgba(255,255,255,0.06));
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M18.3 5.71a1 1 0 0 0-1.41 0L12 10.59 7.11 5.7A1 1 0 0 0 5.7 7.11L10.59 12 5.7 16.89a1 1 0 1 0 1.41 1.41L12 13.41l4.89 4.89a1 1 0 0 0 1.41-1.41L13.41 12l4.89-4.89a1 1 0 0 0 0-1.4Z'/%3E%3C/svg%3E");
    mask-repeat: no-repeat;
    mask-position: center;
    mask-size: 12px 12px;
    opacity: 0.9;
}

/* Loading (HIG-inspired: clear progress feedback) */
.spinner {
    width: 16px;
    height: 16px;
    border-radius: 999px;
    border: 2px solid rgba(245,245,247,0.20);
    border-top-color: rgba(245,245,247,0.78);
    animation: evoria-spin 900ms linear infinite;
    flex: 0 0 auto;
}

.btn.is-loading {
    pointer-events: none;
    opacity: 0.9;
}

.btn.is-loading .spinner { margin-right: 6px; }

@keyframes evoria-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.input-icon {
    position: absolute;
    right: 12px;
    bottom: 12px;
    color: rgba(245,245,247,0.55);
    pointer-events: none;
}

/* ---------- Tables ---------- */
.table-wrapper {
    width: 100%;
    overflow: auto;
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(0,0,0,0.18);
}

table { width: 100%; border-collapse: collapse; }

thead th {
    text-align: left;
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-tertiary);
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    color: rgba(245,245,247,0.88);
}

tbody tr:hover td { background: rgba(255,255,255,0.04); }

/* ---------- Landing / Marketing ---------- */
.hero-section {
    padding: 84px 0 42px;
    text-align: center;
}

.hero-title {
    font-size: clamp(2.6rem, 6vw, 4.2rem);
    line-height: 0.95;
    font-weight: 900;
    margin-bottom: 16px;
}

.glow-text {
    background: linear-gradient(120deg, rgba(41,151,255,1), rgba(255,255,255,0.85));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: 0 0 40px rgba(0, 122, 255, 0.22);
}

.hero-subtitle {
    max-width: 760px;
    margin: 0 auto 28px;
    font-size: 1.1rem;
    color: var(--text-secondary);
}

.landing-divider { margin: 20px 0; }

.feature-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
    margin-top: 38px;
}

.feature-card { padding: 22px; }

.feature-icon {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
    border: 1px solid rgba(255,255,255,0.10);
}

.feature-icon.is-purple {
    background: rgba(169, 112, 255, 0.14);
    color: rgba(169, 112, 255, 0.95);
}

.feature-icon.is-green {
    background: rgba(48, 209, 88, 0.10);
    color: var(--success);
}

.feature-icon.is-amber {
    background: rgba(255, 159, 10, 0.10);
    color: var(--warning);
}

.feature-card h3 { margin: 4px 0 10px; }
.feature-card p { color: var(--text-secondary); }

.landing-final {
    text-align: center;
    margin: 80px 0 120px;
}

.landing-final-title {
    font-size: clamp(1.9rem, 3.5vw, 2.5rem);
    margin: 0 0 24px;
    font-weight: 850;
    letter-spacing: -0.02em;
}

@media (max-width: 920px) {
    .feature-grid { grid-template-columns: 1fr; }
}

@media (max-width: 920px) {
    /* Collab filter bar (inline styles use grid columns; this makes inputs stack better) */
    form[method="GET"][action="/dashboard/collaborations"] {
        grid-template-columns: 1fr !important;
    }
}

/* ---------- Auth ---------- */
.auth-wrapper {
    min-height: calc(100vh - var(--header-height));
    display: grid;
    place-items: center;
    padding: 28px 0 60px;
}

.auth-card {
    width: min(520px, calc(100% - 40px));
    padding: 26px;
}

.auth-header { margin-bottom: 18px; }
.auth-subtitle { color: rgba(245,245,247,0.65); }

.auth-footer {
    margin-top: 18px;
    color: rgba(245,245,247,0.60);
    text-align: center;
}

.auth-footer a {
    color: rgba(41,151,255,0.95);
    text-decoration: none;
}

.auth-footer a:hover { text-decoration: underline; }

/* ---------- Misc ---------- */
hr { border: 0; height: 1px; background: rgba(255,255,255,0.08); }

