:root {
    --bg-root: #06070b;
    --bg-surface: #0c0e14;
    --bg-card: #11131c;
    --bg-elevated: #161a27;
    --bg-input: #0e1019;
    --border: #1a1e30;
    --border-hover: #262c45;
    --text-primary: #e8eaf2;
    --text-secondary: #7d83a0;
    --text-muted: #4a4f6a;
    --accent: #4b8aff;
    --accent-soft: rgba(75, 138, 255, 0.12);
    --accent-glow: rgba(75, 138, 255, 0.2);
    --accent-hover: #6ba1ff;
    --accent-dim: #3a6cd4;
    --green: #34d399;
    --green-dim: rgba(52, 211, 153, 0.12);
    --red: #f87171;
    --red-dim: rgba(248, 113, 113, 0.12);
    --orange: #fbbf24;
    --orange-dim: rgba(251, 191, 36, 0.12);
    --sidebar-w: 232px;
    --topbar-h: 56px;
    --radius: 14px;
    --radius-sm: 10px;
    --radius-xs: 6px;
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --font: 'Outfit', sans-serif;
    --mono: 'JetBrains Mono', monospace;
    --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.3), 0 0 0 1px var(--border);
}

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

html {
    font-size: 14.5px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font);
    background: var(--bg-root);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--accent-hover);
}

button {
    cursor: pointer;
    font-family: var(--font);
}

input,
select,
textarea {
    font-family: var(--font);
}

::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-hover);
}

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-root);
    position: relative;
    overflow: hidden;
}

.login-bg-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(75, 138, 255, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(75, 138, 255, 0.04) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: radial-gradient(ellipse 50% 50% at 50% 50%, black, transparent);
}

.login-card {
    position: relative;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 44px 36px;
    text-align: center;
    width: 100%;
    max-width: 380px;
    animation: fadeUp 0.5s ease;
}

.login-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 6px;
}

.logo-icon {
    width: 40px;
    height: 40px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: 0 0 20px var(--accent-glow);
}

.logo-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.login-logo h1 {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.04em;
}

.login-subtitle {
    color: var(--text-secondary);
    margin-bottom: 28px;
    font-size: 0.88rem;
}

.login-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 13px;
    background: #5865F2;
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    transition: var(--transition);
    text-decoration: none;
}

.login-btn:hover {
    background: #4752c4;
    transform: translateY(-1px);
    color: #fff;
}

.login-footer {
    margin-top: 20px;
    font-size: 0.78rem;
    color: var(--text-muted);
}

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

.login-footer .dot {
    margin: 0 6px;
}

.flash-messages {
    margin-bottom: 14px;
}

.flash {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    background: var(--red-dim);
    color: var(--red);
    border: 1px solid rgba(248, 113, 113, 0.15);
}

.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-w);
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 18px 14px;
    border-bottom: 1px solid var(--border);
}

.logo-mark {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.logo-mark img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.logo-text {
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.sidebar-nav {
    flex: 1;
    padding: 10px 8px;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.88rem;
    font-weight: 500;
    transition: var(--transition);
    text-decoration: none;
}

.nav-item:hover {
    color: var(--text-primary);
    background: var(--bg-elevated);
}

.nav-item.active {
    color: var(--accent);
    background: var(--accent-soft);
}

.nav-item.active i {
    color: var(--accent);
}

.nav-item i {
    width: 18px;
    text-align: center;
    font-size: 0.88rem;
}

.nav-admin {
    color: #a78bfa;
}

.nav-admin:hover {
    background: rgba(167, 139, 250, 0.1);
}

.nav-logout {
    color: var(--red);
}

.nav-logout:hover {
    background: var(--red-dim);
}

.sidebar-footer {
    padding: 10px 8px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.user-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    margin-bottom: 3px;
}

.user-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    object-fit: cover;
}

.user-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mobile-topbar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--topbar-h);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    padding: 0 14px;
    align-items: center;
    justify-content: space-between;
    z-index: 99;
}

.menu-toggle {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.1rem;
    padding: 6px;
}

.main-content {
    margin-left: var(--sidebar-w);
    flex: 1;
    padding: 28px 32px;
    min-height: 100vh;
}

.tab-panel {
    display: none;
    animation: fadeIn 0.25s ease;
}

.tab-panel.active {
    display: block;
}

.panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
    margin-bottom: 24px;
}

.panel-title {
    font-size: 1.65rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 1.2;
}

.panel-subtitle {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: 3px;
}

.header-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.84rem;
    font-weight: 600;
    border: none;
    transition: var(--transition);
    white-space: nowrap;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 0 16px var(--accent-glow);
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    border-color: var(--border-hover);
    background: var(--bg-card);
}

.btn-danger {
    background: var(--red-dim);
    color: var(--red);
    border: 1px solid rgba(248, 113, 113, 0.1);
}

.btn-danger:hover {
    background: rgba(248, 113, 113, 0.18);
}

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

.btn-ghost:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-soft);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.btn-xs {
    padding: 4px 8px;
    font-size: 0.76rem;
    border-radius: var(--radius-xs);
}

.btn-icon {
    padding: 7px 9px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition);
}

.stat-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
}

.stat-icon {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    background: var(--accent-soft);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    flex-shrink: 0;
}

.stat-value {
    font-size: 1.65rem;
    font-weight: 800;
    font-family: var(--mono);
    letter-spacing: -0.03em;
    display: block;
    line-height: 1.15;
}

.stat-label {
    font-size: 0.76rem;
    color: var(--text-secondary);
    display: block;
    margin-top: 1px;
}

.charts-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 24px;
}

.chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
}

.chart-title {
    font-size: 0.88rem;
    font-weight: 600;
    margin-bottom: 14px;
    color: var(--text-secondary);
}

.section-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 14px;
}

.recent-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.recent-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: var(--transition);
}

.recent-item:hover {
    border-color: var(--border-hover);
}

.recent-icon {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--bg-elevated);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.recent-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.recent-info {
    flex: 1;
    min-width: 0;
}

.recent-title {
    font-size: 0.85rem;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.recent-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.recent-badge {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 20px;
    font-weight: 600;
    flex-shrink: 0;
}

.badge-sent {
    background: var(--green-dim);
    color: var(--green);
}

.badge-failed {
    background: var(--red-dim);
    color: var(--red);
}

.badge-skipped {
    background: var(--orange-dim);
    color: var(--orange);
}

.recent-time {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-family: var(--mono);
    flex-shrink: 0;
}

.items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 12px;
}

.items-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.categories-grid-centered {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    align-items: flex-start;
}

.category-chip {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: var(--transition);
    min-width: 200px;
}

.category-chip:hover {
    border-color: var(--border-hover);
    transform: translateY(-1px);
}

.category-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.category-name {
    font-size: 0.92rem;
    font-weight: 600;
    flex: 1;
}

.category-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: var(--transition);
}

.category-chip:hover .category-actions {
    opacity: 1;
}

.item-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    transition: var(--transition);
}

.item-card:hover {
    border-color: var(--border-hover);
}

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

.item-card-title {
    font-size: 1rem;
    font-weight: 700;
}

.item-card-actions {
    display: flex;
    gap: 4px;
}

.item-card-body {
    color: var(--text-secondary);
    font-size: 0.82rem;
    line-height: 1.5;
}

.item-card-body pre {
    font-family: var(--mono);
    font-size: 0.78rem;
    background: var(--bg-input);
    padding: 10px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    margin-top: 8px;
    white-space: pre-wrap;
    word-break: break-all;
    border: 1px solid var(--border);
}

.item-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 9px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    background: var(--bg-elevated);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.tags-row {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.row-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 22px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.row-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: transparent;
    transition: var(--transition);
}

.row-item:hover {
    border-color: var(--border-hover);
    transform: translateX(4px);
    background: var(--bg-elevated);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.row-item:hover::before {
    background: var(--accent);
}

.row-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-elevated);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    color: var(--accent);
    font-size: 0.95rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
}

.row-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.row-info {
    flex: 1;
    min-width: 0;
}

.row-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 2px;
}

.row-meta {
    font-size: 0.78rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.row-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.row-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
}

.row-item .tag {
    background: var(--accent-soft);
    color: var(--accent);
    border: 1px solid rgba(75, 138, 255, 0.1);
    padding: 2px 10px;
    font-size: 0.68rem;
}

.slowmode-badge {
    background: var(--orange-dim) !important;
    color: var(--orange) !important;
    border: 1px solid rgba(251, 191, 36, 0.1);
    font-family: var(--mono);
}

.toggle {
    position: relative;
    width: 36px;
    height: 19px;
    cursor: pointer;
}

.toggle input {
    display: none;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 20px;
    transition: var(--transition);
}

.toggle-slider::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: var(--transition);
}

.toggle input:checked+.toggle-slider {
    background: var(--accent);
    border-color: var(--accent);
}

.toggle input:checked+.toggle-slider::after {
    transform: translateX(17px);
    background: #fff;
}

.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 9px 13px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.88rem;
    transition: var(--transition);
    outline: none;
}

.form-input:focus,
.form-textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

textarea.form-textarea {
    display: block !important;
    resize: vertical;
    min-height: 130px;
    height: 130px;
    border: 1px solid var(--border-hover) !important;
    background: var(--bg-elevated) !important;
    font-family: inherit;
    line-height: 1.5;
    visibility: visible !important;
    opacity: 1 !important;
}

.form-select {
    display: none;
}

.cdd {
    position: relative;
    width: 100%;
    user-select: none;
}

.cdd-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 9px 13px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.88rem;
    cursor: pointer;
    transition: var(--transition);
    outline: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.cdd-trigger:hover {
    border-color: var(--border-hover);
    background: var(--bg-elevated);
}

.cdd.open .cdd-trigger {
    border-color: var(--accent);
    background: var(--bg-elevated);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.cdd-trigger svg {
    width: 10px;
    height: 6px;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.cdd.open .cdd-trigger svg {
    transform: rotate(180deg);
}

.cdd-trigger .cdd-chevron {
    stroke: var(--text-muted);
}

.cdd.open .cdd-trigger .cdd-chevron {
    stroke: var(--accent);
}

.cdd-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 4px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45), 0 0 0 1px var(--border);
    z-index: 150;
    display: none;
    max-height: 220px;
    overflow-y: auto;
    animation: cddIn 0.15s ease;
}

.cdd.open .cdd-menu {
    display: block;
}

@keyframes cddIn {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cdd-option {
    padding: 8px 12px;
    border-radius: var(--radius-xs);
    font-size: 0.85rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.12s ease, color 0.12s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.cdd-option:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

.cdd-option.selected {
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 600;
}

.cdd-option.selected::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    flex-shrink: 0;
}

.cdd.disabled .cdd-trigger {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--bg-root);
}

.form-hint {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 3px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    cursor: pointer;
}

.form-check input[type="checkbox"] {
    width: 15px;
    height: 15px;
    accent-color: var(--accent);
    cursor: pointer;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.open {
    display: flex;
}

.modal {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    width: 100%;
    max-width: 500px;
    max-height: 85vh;
    overflow-y: auto;
    animation: scaleIn 0.2s ease;
}

.modal-wide {
    max-width: 880px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--bg-surface);
    z-index: 1;
}

.modal-title {
    font-size: 1.05rem;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.4rem;
    line-height: 1;
    padding: 4px;
    transition: var(--transition);
}

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

.modal-body {
    padding: 22px;
}

.modal-footer {
    padding: 14px 22px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.server-browser-body {
    display: flex;
    height: 540px;
}

.sb-sidebar {
    width: 220px;
    border-right: 1px solid var(--border);
    overflow-y: auto;
    flex-shrink: 0;
    padding: 4px 0;
}

.sb-guild {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    cursor: pointer;
    transition: var(--transition);
    border-left: 3px solid transparent;
}

.sb-guild:hover {
    background: var(--bg-elevated);
}

.sb-guild.active {
    background: var(--bg-elevated);
    border-left-color: var(--accent);
}

.sb-guild-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-card);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--text-secondary);
}

.sb-guild-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sb-guild-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.sb-guild-name {
    font-size: 0.82rem;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-primary);
}

.sb-guild-meta {
    font-size: 0.68rem;
    color: var(--text-muted);
}

.sb-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--bg-root);
}

.sb-toolbar {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap;
}

.sb-toolbar .form-input {
    flex: 1;
    min-width: 80px;
}

.sb-toolbar .form-select {
    flex: 0 1 auto;
    min-width: 100px;
    max-width: 180px;
}

.sb-toolbar .cdd {
    flex: 0 1 auto;
    min-width: 100px;
    max-width: 180px;
}

.sb-channels {
    flex: 1;
    overflow-y: auto;
    padding: 6px;
}

.sb-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.sb-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    color: var(--text-muted);
    gap: 8px;
    font-size: 0.85rem;
    width: 100%;
    text-align: center;
}

.sb-channel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.sb-channel:hover {
    background: var(--bg-elevated);
}

.sb-channel-name {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.84rem;
}

.sb-channel-name i {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.sb-channel-add {
    opacity: 0;
    transition: var(--transition);
}

.sb-channel:hover .sb-channel-add {
    opacity: 1;
}

.settings-content {
    display: grid;
    gap: 16px;
}

.settings-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
}

.settings-card-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 14px;
}

.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.settings-row:last-child {
    border-bottom: none;
}

.settings-row-label {
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.settings-row-value {
    font-size: 0.85rem;
    font-weight: 600;
    font-family: var(--mono);
}

.sub-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 11px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.sub-active {
    background: var(--green-dim);
    color: var(--green);
}

.sub-inactive {
    background: var(--red-dim);
    color: var(--red);
}

.pricing-section {
    margin-top: 16px;
}

.pricing-section-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 12px;
}

.pricing-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.pricing-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    transition: var(--transition);
    position: relative;
}

.pricing-card:hover {
    border-color: var(--accent);
}

.pricing-card.featured {
    border-color: var(--accent);
    box-shadow: 0 0 28px var(--accent-glow);
}

.pricing-badge {
    position: absolute;
    top: -9px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent);
    color: #fff;
    padding: 2px 12px;
    border-radius: 20px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.pricing-plan {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
    margin-bottom: 6px;
}

.pricing-price {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    margin-bottom: 4px;
}

.pricing-price span {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 400;
}

.pricing-card .btn {
    width: 100%;
    margin-top: 14px;
    justify-content: center;
}

.payment-methods {
    display: flex;
    gap: 10px;
    margin-top: 8px;
    justify-content: center;
}

.payment-method-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.payment-method-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.payment-method-btn.active {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-soft);
}

.toast-container {
    position: fixed;
    bottom: 16px;
    right: 16px;
    z-index: 300;
    display: flex;
    flex-direction: column-reverse;
    gap: 6px;
}

.toast {
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 500;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
    animation: slideInRight 0.25s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 240px;
}

.toast-success {
    border-color: var(--green);
}

.toast-success i {
    color: var(--green);
}

.toast-error {
    border-color: var(--red);
}

.toast-error i {
    color: var(--red);
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 2.2rem;
    margin-bottom: 10px;
    display: block;
}

.empty-state p {
    font-size: 0.85rem;
}

.admin-shell {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    width: var(--sidebar-w);
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.admin-sidebar-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 18px 14px;
    border-bottom: 1px solid var(--border);
}

.admin-sidebar-nav {
    flex: 1;
    padding: 10px 8px;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.admin-main {
    margin-left: var(--sidebar-w);
    flex: 1;
    padding: 28px 32px;
}

.admin-panel {
    display: none;
    animation: fadeIn 0.25s ease;
}

.admin-panel.active {
    display: block;
}

.admin-stats {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.admin-table-wrap {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 20px;
}

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

.admin-table th {
    padding: 10px 14px;
    text-align: left;
    font-size: 0.74rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
}

.admin-table td {
    padding: 10px 14px;
    font-size: 0.84rem;
    border-bottom: 1px solid var(--border);
}

.admin-table tr:last-child td {
    border-bottom: none;
}

.admin-table tr:hover td {
    background: rgba(255, 255, 255, 0.01);
}

.admin-search {
    margin-bottom: 14px;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 14px;
}

.page-btn {
    padding: 5px 10px;
    border-radius: var(--radius-xs);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: var(--transition);
}

.page-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.page-btn.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.autofind-results {
    max-height: 360px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.af-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.af-row:hover {
    background: var(--bg-elevated);
}

.af-check {
    accent-color: var(--accent);
    width: 15px;
    height: 15px;
    cursor: pointer;
}

.af-info {
    flex: 1;
    min-width: 0;
}

.af-name {
    font-size: 0.84rem;
    font-weight: 600;
}

.af-guild {
    font-size: 0.72rem;
    color: var(--text-secondary);
}

.legal-page {
    max-width: 780px;
    margin: 0 auto;
    padding: 44px 24px;
}

.legal-page h1 {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    margin-bottom: 6px;
}

.legal-page .legal-updated {
    color: var(--text-muted);
    font-size: 0.82rem;
    margin-bottom: 28px;
}

.legal-page h2 {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 24px 0 10px;
    color: var(--text-primary);
}

.legal-page p,
.legal-page li {
    color: var(--text-secondary);
    font-size: 0.88rem;
    line-height: 1.7;
    margin-bottom: 10px;
}

.legal-page ul {
    padding-left: 20px;
}

.legal-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 28px;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.legal-back:hover {
    color: var(--accent);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.96);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        max-height: 80px;
        transform: translateY(0);
    }
}

.recent-item-new {
    animation: slideDown 0.35s ease forwards;
    border-color: var(--accent) !important;
}

.recent-item-new {
    transition: border-color 2s ease 0.5s;
}


@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(5, 1fr);
    }

    .admin-stats {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 1024px) {
    .charts-row {
        grid-template-columns: 1fr;
    }

    .pricing-cards {
        grid-template-columns: 1fr;
    }

    .stats-grid,
    .admin-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

.confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(12px);
    z-index: 250;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.confirm-overlay.open {
    display: flex;
}

.confirm-dialog {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 36px 32px 28px;
    text-align: center;
    width: 100%;
    max-width: 400px;
    animation: confirmIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5), 0 0 0 1px var(--border);
}

@keyframes confirmIn {
    from {
        opacity: 0;
        transform: scale(0.88) translateY(10px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.confirm-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 18px;
    font-size: 1.4rem;
}

.confirm-icon.icon-danger {
    background: var(--red-dim);
    color: var(--red);
}

.confirm-icon.icon-warning {
    background: var(--orange-dim);
    color: var(--orange);
}

.confirm-icon.icon-info {
    background: var(--accent-soft);
    color: var(--accent);
}

.confirm-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}

.confirm-desc {
    font-size: 0.84rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 24px;
}

.confirm-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.confirm-actions .btn {
    min-width: 110px;
    justify-content: center;
    padding: 10px 20px;
}

.ac-cred-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.ac-cred-row:last-child {
    border-bottom: none;
}

.ac-cred-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    min-width: 80px;
}

.ac-cred-value {
    display: flex;
    align-items: center;
    gap: 6px;
}

.ac-cred-value code {
    font-family: var(--mono);
    font-size: 0.85rem;
    color: var(--text-primary);
    background: var(--bg-input);
    padding: 4px 10px;
    border-radius: var(--radius-xs);
    border: 1px solid var(--border);
    user-select: all;
}

.marketplace-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.mp-card {
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
    transition: var(--transition);
    text-decoration: none;
    color: var(--text-primary);
}

.mp-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    color: var(--text-primary);
}

.mp-card-visual {
    position: relative;
    height: 125px;
    background: var(--bg-elevated);
}

.mp-card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.6) 0%, transparent 60%);
    pointer-events: none;
}

.mp-card-banner {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.mp-card-banner-empty {
    background: var(--bg-elevated);
}

.mp-card-icon {
    position: absolute;
    bottom: -20px;
    left: 16px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 3px solid var(--accent);
    object-fit: cover;
    background: var(--bg-elevated);
}

.mp-card-icon-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: var(--text-muted);
}

.mp-card-tag {
    display: none;
}

.mp-card-body {
    padding: 32px 16px 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
}

.mp-card-name {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

.mp-card-desc {
    font-size: 0.76rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.5;
}

.mp-card-stats {
    display: flex;
    gap: 14px;
    font-size: 0.75rem;
    color: var(--text-muted);
    justify-content: flex-start;
    flex-wrap: wrap;
}

.mp-card-stats span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.mp-card-stats i {
    font-size: 0.7rem;
}

.mp-card-join {
    margin-top: auto;
    padding-top: 12px;
    width: 100%;
    justify-content: center;
    transition: var(--transition);
}

.mp-card-join:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--accent-glow);
}

@media (max-width: 768px) {

    .sidebar,
    .admin-sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open,
    .admin-sidebar.open {
        transform: translateX(0);
    }

    .mobile-topbar {
        display: flex;
    }

    .main-content,
    .admin-main {
        margin-left: 0;
        padding: 14px;
        padding-top: calc(var(--topbar-h) + 14px);
    }

    .stats-grid,
    .admin-stats {
        grid-template-columns: 1fr 1fr;
    }

    .items-grid {
        grid-template-columns: 1fr;
    }

    .marketplace-grid {
        grid-template-columns: 1fr;
    }

    .server-browser-body {
        flex-direction: column;
        height: auto;
    }

    .sb-sidebar {
        width: 100%;
        max-height: 180px;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .sb-channels {
        max-height: 280px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .header-actions {
        width: 100%;
    }

    .panel-title {
        font-size: 1.3rem;
    }
}