:root {
    --bg: #f3f4f7;
    --panel: #f8f9fd;
    --card: #ffffff;
    --accent: #7c5df7;
    --accent-strong: #5d62f4;
    --muted: #6b7280;
    --text: #1f2430;
    --shadow: 0 10px 30px rgba(27, 33, 58, 0.08);
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    font-family: "SF Pro Display", "Segoe UI", "PingFang SC", system-ui, -apple-system, sans-serif;
    color: var(--text);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: radial-gradient(110% 60% at 10% 10%, #f2eeff 0%, #f5f6fb 25%, #eef2fb 50%, #f6f7fa 100%), var(--bg);
    color: var(--text);
}

a {
    color: inherit;
    text-decoration: none;
}

.page {
    max-width: 1280px;
    margin: 0 auto 56px;
    padding: 0 28px 28px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    background: var(--card);
    box-shadow: 0 12px 30px rgba(20, 25, 48, 0.06);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    border-bottom: 1px solid #e8eaf3;
    position: sticky;
    top: 0;
    z-index: 20;
}

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

.logo {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: linear-gradient(135deg, #d17bff 0%, var(--accent) 60%, #5ab3ff 100%);
    display: grid;
    place-items: center;
    color: #fff;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.brand-text {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.brand-title {
    font-weight: 700;
    font-size: 17px;
    letter-spacing: 0.2px;
}

.brand-subtitle {
    font-size: 12px;
    color: var(--muted);
}

.nav {
    display: flex;
    align-items: center;
    gap: 18px;
    font-size: 14px;
}

.nav a {
    position: relative;
    padding: 6px 2px;
    color: #3b4254;
    transition: color 0.2s ease;
}

.nav a.active::after,
.nav a:hover::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -8px;
    height: 2px;
    background: linear-gradient(90deg, var(--accent), #5c8dff);
    border-radius: 999px;
}

.nav a.active {
    color: var(--accent);
    font-weight: 600;
}

.user-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid #e6e8f0;
    background: #f7f8fd;
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.icon-btn:hover {
    border-color: #d8dbeb;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
}

.tabs {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 22px 0 10px;
    padding: 12px 4px 0;
    border-bottom: 1px solid #e2e6f2;
}

.tab {
    padding: 10px 16px;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    background: transparent;
    border: 1px solid transparent;
    font-weight: 600;
    color: #3b3f52;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab.is-active {
    background: #ede9ff;
    border-color: #dbd1ff;
    color: #4f45d4;
    box-shadow: inset 0 -3px 0 var(--accent);
}

.search-panel {
    background: var(--card);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 6px;
}

.search-input {
    flex: 1;
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 10px;
    background: #f6f7fb;
    border: 1px solid #e6e8f0;
    border-radius: var(--radius-md);
    padding: 12px 14px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-input:focus-within {
    border-color: rgba(124, 93, 247, 0.6);
    box-shadow: 0 10px 30px rgba(124, 93, 247, 0.12);
    background: #ffffff;
}

.search-input svg {
    width: 18px;
    height: 18px;
    color: #9aa0b5;
}

.search-input input {
    border: none;
    outline: none;
    background: transparent;
    font-size: 14px;
    color: #3b4053;
}

.pill-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.pill {
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid #e5e7f0;
    background: #f7f8fb;
    color: #4b5166;
    font-size: 13px;
}

.btn {
    border: 1px solid #d6d9ea;
    background: linear-gradient(135deg, #ffffff, #f7f8ff);
    color: #3c3f55;
    border-radius: var(--radius-md);
    padding: 11px 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn.primary {
    background: linear-gradient(135deg, var(--accent), #5f8cff);
    color: #fff;
    border: none;
    box-shadow: 0 12px 30px rgba(124, 93, 247, 0.28);
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
}

.meta-row {
    margin: 18px 4px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.meta {
    color: #62667a;
    font-size: 13px;
}

.view-tools {
    display: flex;
    align-items: center;
    gap: 8px;
}

.select {
    border: 1px solid #dfe2ee;
    background: #fff;
    border-radius: var(--radius-md);
    padding: 9px 12px;
    color: #3e4254;
    min-width: 150px;
}

.grid-toggle {
    display: inline-flex;
    gap: 6px;
}

.grid-toggle button {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    border: 1px solid #e2e4ef;
    background: #fff;
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.grid-toggle button.active {
    background: #ede9ff;
    border-color: #cfc5ff;
    color: #4f45d4;
    box-shadow: 0 10px 24px rgba(97, 80, 238, 0.16);
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 16px;
    margin-top: 10px;
}

.card-grid[data-view="list"] {
    grid-template-columns: 1fr;
}

.card {
    background: var(--card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid #e8eaf2;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 18px 38px rgba(17, 22, 46, 0.12);
    border-color: #d8ddf2;
}

.card-grid[data-view="list"] .card {
    flex-direction: row;
    gap: 12px;
    min-height: 180px;
}

.card-cover {
    position: relative;
    aspect-ratio: 16 / 9;
    background-size: cover;
    background-position: center;
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin: 10px;
}

.card-grid[data-view="list"] .card-cover {
    width: 320px;
    margin: 16px;
    aspect-ratio: auto;
    flex-shrink: 0;
}

.card-cover::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0) 45%, rgba(0, 0, 0, 0.28) 100%);
}

.cover-fallback {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: #fff;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

.cover-tag {
    position: absolute;
    left: 12px;
    top: 12px;
    padding: 6px 10px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 12px;
    z-index: 2;
}

.card-body {
    padding: 0 18px 18px;
    display: grid;
    gap: 8px;
}

.title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.card-title {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: #2e3342;
}

.meta-line {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #707485;
    font-size: 12px;
}

.meta-dot::before {
    content: "•";
    margin-right: 6px;
    color: #a0a5b5;
}

.label {
    padding: 6px 9px;
    border-radius: 10px;
    background: #eef2ff;
    color: #4f56c6;
    font-size: 12px;
    font-weight: 600;
}

.empty {
    text-align: center;
    padding: 28px;
    color: #6f7383;
    background: #fff;
    border: 1px dashed #dfe2ee;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

@media (max-width: 1080px) {
    .page {
        padding: 0 18px 18px;
    }

    .topbar {
        flex-wrap: wrap;
        gap: 12px;
    }

    .nav {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .card-grid[data-view="list"] .card-cover {
        width: 240px;
    }
}

@media (max-width: 760px) {
    .topbar {
        position: static;
    }

    .search-panel {
        flex-direction: column;
        align-items: stretch;
    }

    .meta-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .card-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }

    .card-grid[data-view="list"] .card {
        flex-direction: column;
    }

    .card-grid[data-view="list"] .card-cover {
        width: auto;
        margin: 12px;
        aspect-ratio: 16 / 9;
    }
}
