* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #19110d;
    --bg-alt: #201511;
    --bg-card: #2a1d15;
    --bg-card-hover: #35251a;
    --border: #4d3b29;
    --primary: #d8a15e;
    --primary-light: #eac493;
    --primary-dark: #b57f3f;
    --cyan: #e2bb74;
    --text: #f2e7d1;
    --text-muted: #c4ac8c;
    --gold: #e2bb74;
    --danger: #e0716d;
    --success: #8ec67f;
    --btn-fg: #2a190c;
    --shadow: rgba(0, 0, 0, 0.5);
    --logo-peer: #9a6a2c;
    --logo-notes: #f4e0b6;
}

html[data-theme="light"] {
    --bg: #f2ead6;
    --bg-alt: #ece1c8;
    --bg-card: #faf4e3;
    --bg-card-hover: #f3ead2;
    --border: #d8c7a4;
    --primary: #a06a2c;
    --primary-light: #8a5a24;
    --primary-dark: #7c4e1d;
    --cyan: #9a6a2f;
    --text: #422c19;
    --text-muted: #71593c;
    --gold: #9c6a2c;
    --danger: #b3423d;
    --success: #3f8a3a;
    --btn-fg: #fff8ea;
    --shadow: rgba(70, 50, 30, 0.25);
    --logo-peer: #6b4219;
    --logo-notes: #a57347;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

button {
    font-family: inherit;
    cursor: pointer;
}

a {
    color: var(--primary-light);
    text-decoration: none;
}

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

.hidden {
    display: none !important;
}

.icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    vertical-align: -3px;
}

.icon.sm {
    width: 13px;
    height: 13px;
}

.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

.nav {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.8rem 1.5rem;
}

.logo {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--primary-light);
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.logo-peer {
    color: var(--logo-peer);
}

.logo-notes {
    color: var(--logo-notes);
}

.search {
    flex: 1;
    max-width: 500px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 30px;
    padding: 0.45rem 1rem;
    transition: border-color 0.3s;
    position: relative;
}

.search:focus-within {
    border-color: var(--primary);
}

.search-icon {
    color: var(--text-muted);
    flex-shrink: 0;
}

.search input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text);
    font-size: 0.95rem;
    min-width: 0;
}

.search input::placeholder {
    color: var(--text-muted);
}

.suggest {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--bg-card-hover);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 12px 40px var(--shadow);
    z-index: 150;
}

.suggest-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    padding: 0.6rem 0.9rem;
    font-size: 0.9rem;
    transition: background 0.15s;
}

.suggest-item:last-child {
    border-bottom: none;
}

.suggest-item:hover {
    background: var(--bg-card);
}

.suggest-icon {
    flex-shrink: 0;
    width: 20px;
    text-align: center;
    color: var(--primary-light);
}

.suggest-icon .icon {
    vertical-align: middle;
}

.suggest-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.suggest-label span:not(.muted) {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.88rem;
    padding: 0.45rem 0.65rem;
    border-radius: 8px;
    transition: all 0.2s;
}

.nav-btn:hover {
    color: var(--text);
    background: var(--bg-card);
}

.nav-btn svg {
    color: var(--primary-light);
}

.btn {
    padding: 0.55rem 1.4rem;
    border-radius: 8px;
    font-size: 0.95rem;
    border: none;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary);
    color: var(--btn-fg);
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-upload {
    background: var(--logo-peer);
}

.btn-upload:hover {
    background: var(--primary);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary-light);
}

.btn-outline:hover {
    background: var(--primary);
    color: var(--btn-fg);
}

.btn-ghost {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text);
}

.btn-ghost:hover {
    background: var(--bg-card-hover);
}

.btn-sm {
    padding: 0.35rem 0.8rem;
    font-size: 0.85rem;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.card-actions .btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

.burger {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    padding: 4px;
}

.burger span {
    width: 24px;
    height: 2.5px;
    background: var(--text);
    border-radius: 2px;
}

main {
    flex: 1;
    min-width: 0;
    padding: 1.5rem;
    min-height: calc(100vh - 200px);
}

.page-title {
    font-size: 1.7rem;
    font-weight: 700;
    margin-bottom: 0.3rem;
}

.page-sub {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.chips {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 1.5rem;
}

.chip {
    padding: 0.35rem 0.9rem;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-muted);
    font-size: 0.85rem;
    transition: all 0.2s;
}

.chip:hover {
    border-color: var(--primary);
    color: var(--primary-light);
}

.chip.active {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--btn-fg);
}

.tags-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag-btn {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: var(--bg-alt);
    color: var(--primary-light);
    font-size: 0.85rem;
    transition: all 0.2s;
}

.tag-btn:hover {
    background: var(--primary);
    color: var(--btn-fg);
    border-color: var(--primary);
}

.feed-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
    gap: 1.2rem;
}

.consept-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    transition: transform 0.2s, border-color 0.2s;
}

.consept-card:hover {
    transform: translateY(-3px);
    border-color: var(--primary);
}

.card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1.35;
}

.card-desc {
    color: var(--text-muted);
    font-size: 0.92rem;
    flex: 1;
}

.card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 1rem;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.card-meta span {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.card-meta .icon {
    color: var(--primary-light);
}

.card-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: auto;
}

.card-actions .btn {
    flex: 1;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.6rem;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-blue {
    background: var(--bg-alt);
    color: var(--primary-light);
    border: 1px solid var(--border);
}

.avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    color: #f5ecd8;
    flex-shrink: 0;
    user-select: none;
}

.avatar.sm {
    width: 30px;
    height: 30px;
    font-size: 0.85rem;
}

.author-link {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    color: var(--text);
    font-weight: 500;
    font-size: 0.9rem;
}

.author-link:hover {
    color: var(--primary-light);
}

.author-stats {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.author-stats .icon {
    color: var(--primary-light);
    width: 12px;
    height: 12px;
}

.section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.section-head h2 {
    font-size: 1.25rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-head h2 .icon {
    color: var(--primary);
}

.section-head .accent-light {
    color: var(--primary-light);
}

.section-head a {
    font-size: 0.85rem;
}

.section {
    margin-bottom: 2.2rem;
}

.row-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.hero-banner {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 2.4rem 2rem;
    margin-bottom: 2rem;
    text-align: center;
}

.hero-banner .hero-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 0.78rem;
    color: var(--cyan);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 0.3rem 1rem;
    margin-bottom: 1rem;
    background: var(--bg-alt);
}

.hero-banner .hero-title {
    font-size: clamp(1.9rem, 5vw, 3rem);
    font-weight: 800;
    margin-bottom: 0.7rem;
}

.hero-banner .hero-peer {
    color: var(--logo-peer);
}

.hero-banner .hero-notes {
    color: var(--logo-notes);
}

.hero-banner p {
    color: var(--text-muted);
    max-width: 560px;
    margin: 0 auto;
    font-size: 1.05rem;
}

.about-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.2rem;
    margin-top: 1rem;
}

.about-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1.3rem;
}

.about-card .about-num {
    font-size: 0.8rem;
    color: var(--primary-light);
    font-weight: 700;
}

.about-card h3 {
    font-size: 1.05rem;
    margin: 0.3rem 0 0.4rem;
}

.about-card p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.about-compare {
    margin-top: 0.6rem;
    border: 1px solid var(--border);
    border-left: 3px solid var(--primary);
    background: var(--bg-card);
    border-radius: 0 12px 12px 0;
    padding: 1.1rem 1.3rem;
    margin-bottom: 0.8rem;
}

.about-compare h4 {
    font-size: 1rem;
    margin-bottom: 0.3rem;
}

.about-compare p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.value-box {
    background: var(--bg-card);
    border: 1px solid var(--primary);
    border-radius: 16px;
    padding: 1.6rem;
    margin-top: 1.4rem;
    color: var(--text);
    font-size: 1.05rem;
    text-align: center;
}

.value-box .icon {
    color: var(--primary);
    vertical-align: -4px;
}

.profile-hero {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.6rem;
    margin-bottom: 1.6rem;
    flex-wrap: wrap;
}

.avatar-xl {
    width: 84px;
    height: 84px;
    font-size: 2.2rem;
}

.profile-info {
    flex: 1;
    min-width: 220px;
}

.profile-name {
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.profile-nick {
    color: var(--primary-light);
}

.profile-stats {
    display: flex;
    gap: 1.5rem;
    margin-top: 0.7rem;
    flex-wrap: wrap;
}

.stat {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.stat b {
    color: var(--text);
}

.stat .icon {
    color: var(--primary-light);
    width: 14px;
    height: 14px;
}

.stat span {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.open-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--cyan);
    background: var(--bg-alt);
    border: 1px solid var(--border);
    padding: 0.25rem 0.7rem;
    border-radius: 6px;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.open-btn:hover {
    background: var(--primary);
    color: var(--btn-fg);
    border-color: var(--primary);
}

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
    background: var(--bg-card);
    border: 1px dashed var(--border);
    border-radius: 14px;
}

.empty-state .big-icon {
    font-size: 2.2rem;
    color: var(--primary-light);
    margin-bottom: 0.5rem;
    display: block;
}

.upload-form {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.6rem;
    max-width: 640px;
    display: grid;
    gap: 1rem;
}

.field label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
    color: var(--text);
}

.field input,
.field textarea {
    width: 100%;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    padding: 0.7rem 0.9rem;
    font-size: 0.95rem;
    font-family: inherit;
}

.field input:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.field textarea {
    resize: vertical;
    min-height: 80px;
}

.field-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.file-drop {
    border: 2px dashed var(--border);
    border-radius: 10px;
    padding: 1.4rem;
    text-align: center;
    color: var(--text-muted);
    transition: all 0.2s;
    cursor: pointer;
}

.file-drop.dragover {
    border-color: var(--primary);
    background: var(--bg-alt);
}

.file-drop input {
    display: none;
}

.file-name {
    color: var(--primary-light);
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

.tags-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag-opt {
    padding: 0.35rem 0.85rem;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: var(--bg-alt);
    color: var(--text-muted);
    font-size: 0.85rem;
    transition: all 0.2s;
}

.tag-opt:hover {
    border-color: var(--primary);
    color: var(--primary-light);
}

.tag-opt.selected {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--btn-fg);
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(12, 8, 5, 0.78);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    z-index: 200;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    max-width: 900px;
    width: 100%;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.4rem;
    border-bottom: 1px solid var(--border);
}

.modal-head h3 {
    font-size: 1.05rem;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.6rem;
    line-height: 1;
}

.modal-close:hover {
    color: var(--text);
}

.modal-body {
    padding: 1.4rem;
    overflow-y: auto;
}

.pdf-view {
    width: 100%;
    height: 62vh;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-alt);
}

.pdf-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    height: 280px;
    color: var(--text-muted);
}

.pdf-placeholder .pdf-icon {
    color: var(--primary-light);
}

.login-box {
    max-width: 460px;
    margin: 6vh auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2rem;
    text-align: center;
}

.login-box h2 {
    margin-bottom: 0.3rem;
}

.login-box p {
    color: var(--text-muted);
    margin-bottom: 1.3rem;
    font-size: 0.92rem;
}

.login-box input {
    width: 100%;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    padding: 0.75rem 0.95rem;
    font-size: 0.95rem;
    margin-bottom: 0.9rem;
}

.login-box input:focus {
    outline: none;
    border-color: var(--primary);
}

.demo-inbox {
    background: var(--bg-alt);
    border: 1px solid var(--primary);
    border-radius: 12px;
    padding: 1rem 1.1rem;
    text-align: left;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.demo-inbox .inbox-head {
    font-weight: 700;
    color: var(--primary-light);
    margin-bottom: 0.3rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.demo-inbox .inbox-line {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.demo-inbox .inbox-code {
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: 4px;
    color: var(--cyan);
    margin: 0.4rem 0;
}

.demo-inbox .inbox-note {
    font-size: 0.78rem;
    color: var(--text-muted);
    border-top: 1px dashed var(--border);
    padding-top: 0.5rem;
    margin-top: 0.5rem;
}

.login-row {
    display: flex;
    gap: 0.6rem;
}

.login-row>* {
    flex: 1;
}

.email-config {
    margin-top: 0.9rem;
    text-align: left;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.6rem 0.8rem;
    background: var(--bg-alt);
}

.email-config summary {
    font-size: 0.85rem;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.email-config-body {
    margin-top: 0.7rem;
    display: grid;
    gap: 0.5rem;
}

.email-config-body input {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    padding: 0.55rem 0.75rem;
    font-size: 0.85rem;
    font-family: inherit;
}

.email-config-body input:focus {
    outline: none;
    border-color: var(--primary);
}

.toast {
    position: fixed;
    bottom: 1.4rem;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--bg-card-hover);
    border: 1px solid var(--primary);
    color: var(--text);
    padding: 0.7rem 1.4rem;
    border-radius: 10px;
    font-size: 0.9rem;
    box-shadow: 0 8px 30px var(--shadow);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s;
    z-index: 300;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.theme-opt {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    width: 100%;
    text-align: left;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem 1.2rem;
    color: var(--text);
    transition: all 0.2s;
}

.theme-opt:hover {
    border-color: var(--primary);
}

.theme-opt.selected {
    border-color: var(--primary);
    background: var(--bg-card-hover);
}

.theme-opt .swatch {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid var(--border);
    flex-shrink: 0;
}

.swatch.dark {
    background: #2a1d15;
}

.swatch.light {
    background: #f2ead6;
}

.settings-box {
    max-width: 560px;
    display: grid;
    gap: 0.9rem;
}

.settings-box h3 {
    font-size: 1.05rem;
    margin-bottom: 0.6rem;
    color: var(--text);
}

.settings-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem;
}

.footer {
    border-top: 1px solid var(--border);
    background: var(--bg-alt);
    padding: 2rem 1.5rem 1rem;
    margin-top: 2rem;
}

.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 0.8rem;
}

.footer strong {
    font-size: 1.2rem;
    display: block;
    color: var(--primary-light);
}

.footer-links {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.footer-link {
    background: transparent;
}

@media (max-width: 820px) {
    .burger {
        display: flex;
    }

    .search {
        order: 3;
        max-width: none;
        flex-basis: 100%;
    }

    .nav {
        flex-wrap: wrap;
    }

    .nav-actions {
        margin-left: auto;
    }

    .nav-actions.mobile-open {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        background: var(--bg);
        border-bottom: 1px solid var(--border);
        padding: 1rem 1.5rem;
        gap: 0.5rem;
    }

    .nav-btn-label {
        display: none;
    }

    .nav-actions.mobile-open .nav-btn {
        justify-content: flex-start;
        padding: 0.7rem;
    }

    .nav-actions.mobile-open .nav-btn-label {
        display: inline;
    }

    .profile-hero {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .profile-stats {
        justify-content: center;
    }
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

.topbar-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.7rem 1.5rem;
}

.topbar-nav {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.2rem;
}

.nav-btn.active {
    color: var(--text);
    background: var(--bg-card);
}

.nav-btn.active svg {
    color: var(--primary);
}

.theme-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.45rem 0.5rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
}

.theme-btn:hover {
    color: var(--text);
    background: var(--bg-card);
}

.layout {
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.sidebar {
    position: sticky;
    top: 70px;
    width: 250px;
    flex-shrink: 0;
    margin-top: 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 0.9rem;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
}

.side-title {
    margin: 0.4rem 0 0.5rem;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
}

.side-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.6rem;
    border-radius: 8px;
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.15s;
}

.side-link:hover {
    background: var(--bg-alt);
    color: var(--primary-light);
}

.side-link.active,
.side-sub.active {
    background: var(--bg-alt);
    color: var(--primary-light);
}

.side-count {
    margin-left: auto;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 500;
}

.tgroup {
    border-bottom: 1px solid var(--border);
}

.tgroup:last-child {
    border-bottom: none;
}

.tgroup[open] {
    padding-bottom: 0.3rem;
}

.tg-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.6rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text);
    list-style: none;
    border-radius: 8px;
    transition: background 0.15s;
}

.tg-head::-webkit-details-marker {
    display: none;
}

.tg-head:hover {
    background: var(--bg-alt);
}

.tg-head .icon {
    margin-left: 0.2rem;
    color: var(--text-muted);
    transition: transform 0.2s;
}

.tgroup[open] > .tg-head .icon {
    transform: rotate(180deg);
}

.tg-body {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.2rem 0 0.5rem;
}

.side-sub {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.35rem 0.6rem 0.35rem 1.3rem;
    border-radius: 6px;
    font-size: 0.85rem;
    color: var(--text-muted);
    transition: all 0.15s;
}

.side-sub:hover {
    color: var(--primary-light);
    background: var(--bg-alt);
}

.side-sub .side-count {
    font-size: 0.72rem;
    margin-left: 0;
}

.search-wrap {
    position: relative;
    margin-bottom: 1.2rem;
}

.search-page-bar {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 0.6rem 1rem;
    transition: border-color 0.3s;
}

.search-page-bar:focus-within {
    border-color: var(--primary);
}

.search-page-input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text);
    font-size: 1rem;
    min-width: 0;
}

.search-page-input::placeholder {
    color: var(--text-muted);
}

.tag-picker {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.pick-group-head {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--primary-light);
    margin-bottom: 0.5rem;
}

.pick-group-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag-opt {
    padding: 0.45rem 1rem;
    font-size: 0.88rem;
    cursor: pointer;
}

.tag-opt.is-static {
    cursor: default;
}

.lang-opt {
    display: flex;
    align-items: center;
    gap: 0.7rem;
}

.lang-dot {
    flex-shrink: 0;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    padding: 0.15rem 0.45rem;
    border-radius: 8px;
    border: 2px solid var(--text-muted);
    color: var(--text-muted);
}

.lang-dot.active {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--btn-fg);
}

.switch-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    cursor: pointer;
}

.switch-row input {
    width: 17px;
    height: 17px;
    accent-color: var(--primary);
    cursor: pointer;
}

@media (max-width: 820px) {
    .theme-btn {
        display: none;
    }

    .layout {
        flex-direction: column;
        padding: 0 1rem;
    }

    .sidebar {
        position: static;
        width: 100%;
        max-height: 300px;
        margin-top: 1rem;
    }

    .topbar-nav {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        background: var(--bg);
        border-bottom: 1px solid var(--border);
        padding: 0.8rem 1.5rem;
        gap: 0.4rem;
        display: none;
    }

    .topbar-nav.mobile-open {
        display: flex;
    }

    .nav-btn-label {
        display: inline;
    }

    .topbar-inner {
        padding: 0.7rem 1rem;
    }
}