:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #eef2ff;
    --accent: #06b6d4;
    --bg: #f1f5f9;
    --bg-gradient: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    --card: #ffffff;
    --text: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --shadow: 0 4px 24px rgba(15, 23, 42, 0.06);
    --shadow-lg: 0 12px 40px rgba(15, 23, 42, 0.12);
    --radius: 10px;
    --header-height: 56px;
    --gap: 12px;
    --card-pad: 16px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: var(--bg);
    background-image: var(--bg-gradient);
    background-attachment: fixed;
    color: var(--text);
    line-height: 1.65;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

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

.container { max-width: 1140px; margin: 0 auto; padding: 0 14px; }

/* Header */
.header {
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(12px);
    height: var(--header-height);
    box-shadow: 0 1px 0 rgba(255,255,255,0.06);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.header .logo { color: #fff; }
.header .nav a { color: rgba(255,255,255,0.75); }
.header .nav a:hover, .header .nav a.active {
    background: rgba(99, 102, 241, 0.25);
    color: #fff;
}
.header .user-menu span { color: rgba(255,255,255,0.9); }
.header .btn-ghost { color: rgba(255,255,255,0.7); }
.header .btn-ghost:hover { background: rgba(255,255,255,0.1); color: #fff; }
.header .btn-outline { border-color: rgba(255,255,255,0.3); color: #fff; }
.header .btn-outline:hover { background: rgba(255,255,255,0.1); }

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--primary);
}

.logo-icon { font-size: 28px; }

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

.nav a {
    padding: 8px 16px;
    border-radius: 8px;
    color: var(--text);
    font-size: 14px;
    transition: all 0.2s;
}

.nav a:hover, .nav a.active {
    background: var(--primary-light);
    color: var(--primary);
}

.nav-badge {
    position: relative;
}

.nav-badge .badge {
    position: absolute;
    top: 2px;
    right: 6px;
    background: var(--danger);
    color: #fff;
    font-size: 10px;
    padding: 1px 5px;
    border-radius: 10px;
    min-width: 16px;
    text-align: center;
}

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

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    overflow: hidden;
}

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

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; box-shadow: 0 4px 14px rgba(99,102,241,0.35); }
.btn-primary:hover { background: linear-gradient(135deg, var(--primary-dark), #4338ca); color: #fff; transform: translateY(-1px); }
.btn-outline { background: transparent; border: 1px solid var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--primary-light); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Inline form row (avatar, rename, etc.) */
.form-inline {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}
.form-inline .form-group { flex: 1; min-width: 0; margin: 0; }
.form-inline--center { align-items: center; }

.btn-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.page-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.page-toolbar h2 { font-size: 20px; min-width: 0; }

/* Hero */
.hero {
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
    color: #fff;
    padding: 28px 0 32px;
    margin-bottom: 16px;
    position: relative;
    overflow: hidden;
}
.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 20% 50%, rgba(99,102,241,0.3), transparent 50%),
                radial-gradient(circle at 80% 20%, rgba(6,182,212,0.2), transparent 40%);
}
.hero .container { position: relative; z-index: 1; }
.hero h1 { font-size: 26px; font-weight: 800; letter-spacing: -0.5px; margin-bottom: 6px; }
.hero p { font-size: 14px; opacity: 0.85; margin-bottom: 16px; }

.search-bar {
    display: flex;
    max-width: 560px;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.search-bar input {
    flex: 1;
    border: none;
    padding: 14px 20px;
    font-size: 15px;
    outline: none;
}

.search-bar button {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 14px 24px;
    cursor: pointer;
    font-size: 15px;
}

/* Categories */
.category-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.category-tab {
    padding: 10px 20px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 24px;
    font-size: 14px;
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.category-tab:hover, .category-tab.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* Resource Grid */
.resource-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.resource-card {
    background: var(--card);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s;
    text-decoration: none;
    color: inherit;
    display: block;
}

.resource-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(99, 102, 241, 0.3);
}

.resource-cover {
    width: 100%;
    height: 180px;
    background: linear-gradient(135deg, #ffe0cc, #fff3eb);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    overflow: hidden;
    position: relative;
}

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

.resource-price {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0,0,0,0.7);
    color: #fff;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
}

.resource-price.free { background: var(--success); }

.resource-info { padding: 16px; }

.resource-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.resource-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    color: var(--text-muted);
}

.resource-author {
    display: flex;
    align-items: center;
    gap: 6px;
}

.resource-author .avatar { width: 24px; height: 24px; font-size: 12px; }

/* Cards & Forms */
.card {
    background: var(--card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    padding: var(--card-pad);
    margin-bottom: var(--gap);
}

.card-title {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: var(--primary);
}

.form-group textarea { resize: vertical; min-height: 100px; }

.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 6px; }

.file-upload {
    border: 2px dashed var(--border);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.file-upload:hover { border-color: var(--primary); background: var(--primary-light); }
.file-upload input { display: none; }
.file-upload-icon { font-size: 36px; margin-bottom: 8px; }

/* Alerts */
.alert {
    padding: 10px 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
}

.alert-success { background: #f6ffed; color: #389e0d; border: 1px solid #b7eb8f; }
.alert-error { background: #fff2f0; color: #cf1322; border: 1px solid #ffccc7; }
.alert-warning { background: #fffbe6; color: #d48806; border: 1px solid #ffe58f; }
.alert-info { background: #e6f7ff; color: #096dd9; border: 1px solid #91d5ff; }

/* Detail Page */
.detail-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 24px;
    margin-top: 24px;
}

.detail-cover {
    width: 100%;
    max-height: 400px;
    border-radius: var(--radius);
    background: linear-gradient(135deg, #ffe0cc, #fff3eb);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 80px;
    overflow: hidden;
}

.detail-cover img { width: 100%; height: 100%; object-fit: contain; }

.detail-info h1 { font-size: 24px; margin-bottom: 12px; }
.detail-desc { color: var(--text-secondary); margin: 16px 0; line-height: 1.8; }

.detail-stats {
    display: flex;
    gap: 24px;
    padding: 16px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    margin: 16px 0;
    font-size: 14px;
    color: var(--text-muted);
}

.author-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--bg);
    border-radius: 8px;
    margin: 16px 0;
}

.author-card .avatar { width: 48px; height: 48px; }

.price-tag {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
    margin: 16px 0;
}

/* Messages */
.message-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 0;
    height: calc(100vh - var(--header-height) - 48px);
    background: var(--card);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.conversation-list {
    border-right: 1px solid var(--border);
    overflow-y: auto;
}

.conversation-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background 0.2s;
}

.conversation-item:hover, .conversation-item.active { background: var(--primary-light); }

.conversation-item .avatar { width: 40px; height: 40px; flex-shrink: 0; }

.conversation-info { flex: 1; min-width: 0; }
.conversation-name { font-weight: 500; font-size: 14px; }
.conversation-preview {
    font-size: 13px;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.conversation-time { font-size: 12px; color: var(--text-muted); }

.unread-dot {
    width: 8px;
    height: 8px;
    background: var(--danger);
    border-radius: 50%;
    flex-shrink: 0;
}

.chat-area { display: flex; flex-direction: column; }

.chat-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.message-bubble {
    max-width: 70%;
    padding: 10px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
}

.message-bubble.sent {
    align-self: flex-end;
    background: var(--primary);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.message-bubble.received {
    align-self: flex-start;
    background: var(--bg);
    border-bottom-left-radius: 4px;
}

.message-time { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

.chat-input {
    display: flex;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid var(--border);
}

.chat-input input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    outline: none;
    font-size: 14px;
}

/* Profile / My */
.profile-header {
    background: linear-gradient(135deg, #0f172a, #312e81);
    color: #fff;
    padding: 24px 0;
    margin-bottom: 16px;
}

.profile-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

.profile-info .avatar { width: 80px; height: 80px; font-size: 32px; border: 3px solid rgba(255,255,255,0.5); }

.profile-stats {
    display: flex;
    gap: 32px;
    margin-top: 16px;
}

.profile-stat { text-align: center; }
.profile-stat .num { font-size: 20px; font-weight: 700; }
.profile-stat .label { font-size: 13px; opacity: 0.8; }

.tab-nav {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border);
    margin-bottom: 24px;
}

.tab-nav a {
    padding: 12px 24px;
    color: var(--text-secondary);
    font-size: 14px;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}

.tab-nav a:hover, .tab-nav a.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* Table */
.table-wrap { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

table th, table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

table th {
    background: var(--bg);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 13px;
}

table tr:hover { background: #fafafa; }

.status-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.status-published { background: #f6ffed; color: #389e0d; }
.status-pending { background: #fffbe6; color: #d48806; }
.status-rejected { background: #fff2f0; color: #cf1322; }
.status-offline { background: #f5f5f5; color: #999; }
.status-draft { background: #e6f7ff; color: #096dd9; }

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

.membership-card {
    background: var(--card);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    text-align: center;
    transition: all 0.2s;
}

.membership-card:hover, .membership-card.featured {
    border-color: var(--primary);
    box-shadow: 0 4px 20px rgba(255,103,0,0.15);
}

.membership-card.featured { position: relative; }

.membership-card .price {
    font-size: 36px;
    font-weight: 700;
    color: var(--primary);
    margin: 16px 0;
}

.membership-card .price span { font-size: 14px; font-weight: 400; }

.membership-benefits {
    text-align: left;
    margin: 20px 0;
    font-size: 14px;
    color: var(--text-secondary);
}

.membership-benefits li {
    padding: 6px 0;
    list-style: none;
}

.membership-benefits li::before {
    content: '✓ ';
    color: var(--success);
    font-weight: 700;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 32px 0;
}

.page-btn {
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 14px;
    text-decoration: none;
}

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

/* Footer */
.footer {
    background: #1e293b;
    color: #94a3b8;
    padding: 16px 0;
    margin-top: auto;
    text-align: center;
    font-size: 13px;
    flex-shrink: 0;
}

.footer a { color: #a5b4fc; text-decoration: none; }
.footer a:hover { text-decoration: underline; }

.footer-line {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: center;
    gap: 0;
    white-space: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.footer-line::-webkit-scrollbar { display: none; }

.footer-sep {
    margin: 0 10px;
    opacity: 0.45;
    user-select: none;
}

.footer-muted { color: #64748b; }

/* Mobile bottom navigation */
.mobile-bottom-nav {
    display: none;
}

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

.profile-overview-grid .card {
    text-align: center;
    text-decoration: none;
    color: inherit;
    min-width: 0;
}

.profile-overview-grid .card-icon {
    font-size: 28px;
}

.profile-overview-grid .card-label {
    font-weight: 600;
    margin-top: 6px;
    font-size: 14px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state .icon { font-size: 48px; margin-bottom: 16px; }

/* Admin */
.admin-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    min-height: 100vh;
}

.admin-sidebar {
    background: #1a1a2e;
    color: #fff;
    padding: 20px 0;
}

.admin-sidebar .logo {
    padding: 0 20px 20px;
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 12px;
}

.admin-nav a {
    display: block;
    padding: 12px 20px;
    color: rgba(255,255,255,0.7);
    font-size: 14px;
    transition: all 0.2s;
}

.admin-nav a:hover, .admin-nav a.active {
    background: rgba(255,103,0,0.2);
    color: #fff;
}

.admin-content { padding: 24px; background: var(--bg); }

.admin-stats {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--card);
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.stat-card .num { font-size: 28px; font-weight: 700; color: var(--primary); }
.stat-card .label { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* Auth Pages */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(160deg, #0f172a, #1e293b);
    padding: 16px;
}

.auth-card {
    background: var(--card);
    padding: 24px 22px;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
    border: 1px solid var(--border);
}

.auth-card h2 {
    text-align: center;
    margin-bottom: 4px;
    font-weight: 800;
    font-size: 22px;
}
.auth-card .subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 16px;
    font-size: 13px;
}

.auth-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
    color: var(--text-muted);
}

/* Contact Float */
.contact-float {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff;
    padding: 14px 22px;
    border-radius: 30px;
    box-shadow: 0 8px 24px rgba(99,102,241,0.4);
    font-size: 14px;
    font-weight: 600;
    z-index: 99;
    transition: transform 0.2s;
    text-decoration: none;
}

.contact-float:hover {
    transform: scale(1.05);
    color: #fff;
}

/* Responsive */
@media (max-width: 768px) {
    html, body { overflow-x: hidden; }
    body {
        padding-bottom: calc(58px + env(safe-area-inset-bottom, 0px));
    }

    .detail-layout { grid-template-columns: 1fr; }
    .message-layout { grid-template-columns: 1fr; height: auto; }
    .conversation-list { max-height: 200px; }
    .admin-layout { grid-template-columns: 1fr; }
    .admin-sidebar { display: none; }
    .hero { padding: 18px 0 22px; }
    .hero h1 { font-size: 20px; }
    .hero p { font-size: 12px; margin-bottom: 10px; }
    .resource-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
    .nav { display: none; }

    .card { padding: 14px; overflow: hidden; }
    .card-title { font-size: 16px; }

    .btn {
        padding: 5px 10px;
        font-size: 12px;
        border-radius: 6px;
        min-width: 0;
        max-width: 100%;
        line-height: 1.35;
        white-space: nowrap;
    }
    .card form .btn,
    .card .btn-block {
        white-space: normal;
        text-align: center;
    }
    .btn-sm {
        padding: 3px 8px;
        font-size: 11px;
    }
    .header .btn-sm {
        padding: 3px 7px;
        font-size: 11px;
    }
    .user-menu span { display: none; }

    .form-inline {
        flex-direction: column;
        align-items: stretch !important;
        gap: 10px;
    }
    .form-inline .btn {
        align-self: flex-start;
        width: auto;
    }
    .form-inline .avatar { align-self: flex-start; }

    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="file"],
    select,
    textarea {
        max-width: 100%;
        box-sizing: border-box;
        font-size: 14px;
    }
    input[type="file"] { font-size: 12px; }

    .search-bar input {
        padding: 8px 10px;
        font-size: 13px;
    }
    .search-bar button {
        padding: 8px 12px;
        font-size: 12px;
        flex-shrink: 0;
    }

    .category-tab {
        padding: 5px 10px;
        font-size: 11px;
    }
    .category-tabs { gap: 5px; margin-bottom: 8px; }

    .tab-nav {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        margin-bottom: 12px;
        scrollbar-width: none;
    }
    .tab-nav::-webkit-scrollbar { display: none; }
    .tab-nav a {
        padding: 6px 10px;
        font-size: 11px;
        white-space: nowrap;
        flex-shrink: 0;
    }

    .page-btn {
        padding: 4px 8px;
        font-size: 11px;
    }

    table .btn-sm {
        padding: 2px 6px;
        font-size: 10px;
    }
    table td { font-size: 12px; padding: 8px 6px; white-space: normal; }
    table td .btn { margin: 2px 2px 2px 0; vertical-align: middle; }

    .membership-card .btn,
    .membership-form .btn {
        padding: 6px 10px;
        font-size: 12px;
    }

    .resource-info { padding: 10px; }
    .resource-title { font-size: 13px; }

    .footer { padding: 12px 0; font-size: 11px; }
    .footer-sep { margin: 0 6px; }

    .author-card { flex-wrap: wrap; gap: 8px; }
    .author-card .btn { flex-shrink: 0; }

    .profile-header { padding: 16px 0; }
    .profile-info { flex-direction: column; align-items: flex-start; gap: 12px; }
    .profile-info > div { min-width: 0; max-width: 100%; }
    .profile-info h2 { font-size: 18px; word-break: break-word; }
    .profile-info p { font-size: 12px; word-break: break-word; }
    .profile-info .avatar { width: 56px; height: 56px; font-size: 22px; }
    .profile-stats { flex-wrap: wrap; gap: 12px; }

    .profile-page { max-width: 100%; overflow-x: hidden; }
    .profile-tab-nav {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 6px;
        overflow: visible;
        border-bottom: none;
        margin-bottom: 12px;
    }
    .profile-tab-nav a {
        text-align: center;
        padding: 7px 4px;
        font-size: 11px;
        line-height: 1.25;
        white-space: normal;
        border: 1px solid var(--border);
        border-radius: 6px;
        margin-bottom: 0;
        border-bottom-color: var(--border);
    }
    .profile-tab-nav a.active {
        background: var(--primary-light);
        border-color: var(--primary);
        border-bottom-color: var(--primary);
    }

    .profile-overview-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }
    .profile-overview-grid .card { padding: 12px 6px; }
    .profile-overview-grid .card-icon { font-size: 22px; }
    .profile-overview-grid .card-label { font-size: 12px; margin-top: 4px; }

    .mobile-bottom-nav {
        display: flex;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 120;
        background: rgba(15, 23, 42, 0.96);
        backdrop-filter: blur(12px);
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    }
    .mbn-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        padding: 6px 4px;
        color: rgba(255, 255, 255, 0.65);
        text-decoration: none;
        border-radius: 8px;
        position: relative;
        min-width: 0;
    }
    .mbn-item.active {
        color: #fff;
        background: rgba(99, 102, 241, 0.35);
    }
    .mbn-icon { font-size: 18px; line-height: 1; }
    .mbn-label { font-size: 11px; font-weight: 500; line-height: 1.2; }
    .mbn-badge {
        position: absolute;
        top: 2px;
        right: calc(50% - 22px);
        background: var(--danger);
        color: #fff;
        font-size: 10px;
        min-width: 16px;
        height: 16px;
        line-height: 16px;
        text-align: center;
        border-radius: 8px;
        padding: 0 4px;
    }

    .header .user-menu .btn { display: none; }
    .header .user-menu span { display: none; }
    .contact-float { display: none; }

    .page-toolbar {
        flex-direction: column;
        align-items: stretch;
        margin-bottom: 14px;
    }
    .page-toolbar h2 { font-size: 18px; }
    .page-toolbar .btn { align-self: flex-start; }
}

@media (max-width: 480px) {
    .container { padding: 0 10px; }
    .btn { padding: 4px 8px; font-size: 11px; }
    .btn-sm { padding: 2px 6px; font-size: 10px; }
    .search-bar button { padding: 7px 10px; font-size: 11px; }
    .footer-line { font-size: 10px; }
    .footer-sep { margin: 0 4px; }
}

/* Captcha hint */
.captcha-hint-text {
    font-size: 12px;
    color: var(--text-muted);
    margin: 8px 0 4px;
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.15);
}

.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 200; align-items: center; justify-content: center; padding: 20px; display: none; }
.modal-content { max-width: 420px; width: 100%; max-height: 90vh; overflow-y: auto; }

.name-admin { color: #f59e0b !important; font-weight: 700; }
.name-moderator { color: #38bdf8 !important; font-weight: 600; }
a.name-admin, a.name-moderator { text-decoration: none; }

.privacy-box h3 { font-size: 16px; margin: 12px 0 8px; }
.privacy-box h4 { font-size: 14px; margin: 14px 0 6px; color: var(--text-secondary); }
.privacy-box ul { margin: 0 0 10px 18px; }
.privacy-box li { margin-bottom: 4px; }
.comment-item { padding: 12px 0; border-bottom: 1px solid var(--border); }
.comment-item:last-child { border-bottom: none; }

/* Announcement overlay */
.announcement-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.announcement-box {
    width: 100%;
    max-width: 520px;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: annIn 0.25s ease;
}
@keyframes annIn {
    from { opacity: 0; transform: translateY(12px) scale(0.98); }
    to { opacity: 1; transform: none; }
}
.announcement-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}
.announcement-head h3 { margin: 0; font-size: 18px; }
.announcement-close {
    border: none;
    background: transparent;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0 4px;
}
.announcement-body {
    padding: 16px 0;
    overflow-y: auto;
    line-height: 1.7;
    font-size: 14px;
    color: var(--text-secondary);
}
.announcement-foot {
    padding-top: 12px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-muted);
    text-align: right;
}
