:root {
    --body-bg: #f8fafc;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --text-white: #ffffff;
    --card-bg: #ffffff;
    --card-alt-bg: #f1f5f9;
    --border: #e2e8f0;
    --border-strong: #d1d5db;
    --border-light: #f1f5f9;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #dbeafe;
    --success: #16a34a;
    --success-bg: #f0fdf4;
    --success-border: #bbf7d0;
    --error: #dc2626;
    --error-bg: #fef2f2;
    --error-border: #fecaca;
    --header-bg: #0f172a;
    --hero-bg: #0f172a;
    --input-bg: #ffffff;
    --slider-overlay-from: rgba(15,23,42,0.85);
    --slider-overlay-to: rgba(15,23,42,0.4);
    --hover-bg: #f1f5f9;
    --stat-card-bg: #ffffff;
    --stat-card-border: #e2e8f0;
    --warning: #f59e0b;
    --warning-bg: #fef3c7;
    --warning-text: #92400e;
    --warning-border: #fde68a;
    --accent: #eab308;
    --info-bg: #e0f2fe;
    --info-text: #0369a1;
    --purple-bg: #ede9fe;
    --purple-text: #6d28d9;
    --pink-bg: #fce4ec;
    --pink-text: #c62828;
    --gray-700: #374151;
    --gray-600: #545454;
    --success-dark: #059669;
    --warning-dark: #d97706;
    --slate-700: #334155;
    --blue-400: #60a5fa;
    --blue-300: #93c5fd;
    --red-800: #991b1b;
    --google-link: #1a0dab;
    --google-url: #006621;
}

body.dark-mode {
    --body-bg: #0f172a;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-white: #ffffff;
    --card-bg: #1e293b;
    --card-alt-bg: #334155;
    --border: #334155;
    --border-strong: #475569;
    --border-light: #1e293b;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --primary-light: #1e3a5f;
    --success: #22c55e;
    --success-bg: #14532d;
    --success-border: #166534;
    --error: #ef4444;
    --error-bg: #450a0a;
    --error-border: #7f1d1d;
    --header-bg: #020617;
    --hero-bg: #020617;
    --input-bg: #1e293b;
    --slider-overlay-from: rgba(2,6,23,0.85);
    --slider-overlay-to: rgba(2,6,23,0.4);
    --hover-bg: #334155;
    --stat-card-bg: #1e293b;
    --stat-card-border: #334155;
    --warning: #fbbf24;
    --warning-bg: #451a03;
    --warning-text: #fde68a;
    --warning-border: #78350f;
    --accent: #facc15;
    --info-bg: #0c4a6e;
    --info-text: #7dd3fc;
    --purple-bg: #3b0764;
    --purple-text: #d8b4fe;
    --pink-bg: #4a0e1c;
    --pink-text: #f9a8d4;
    --gray-700: #cbd5e1;
    --gray-600: #94a3b8;
    --success-dark: #22c55e;
    --warning-dark: #fbbf24;
    --slate-700: #94a3b8;
    --blue-400: #60a5fa;
    --blue-300: #93c5fd;
    --red-800: #fca5a5;
    --google-link: #93c5fd;
    --google-url: #4ade80;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--body-bg);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { text-decoration: none; color: var(--primary); transition: color 0.2s ease; }
a:hover { color: var(--primary-hover); }
img { max-width: 100%; height: auto; display: block; }

h1 { font-size: 2.5rem; font-weight: 800; line-height: 1.2; color: var(--text-primary); }
h2 { font-size: 1.75rem; font-weight: 700; line-height: 1.3; color: var(--text-primary); }
h3 { font-size: 1.25rem; font-weight: 600; line-height: 1.4; }

/* Header */
.nav-container {
    background: var(--header-bg);
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 12px rgba(15,23,42,0.15);
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.nav-brand {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-white);
    letter-spacing: -0.5px;
}

.nav-brand span { color: var(--primary); }

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    list-style: none;
}

.nav-links a {
    color: rgba(255,255,255,0.85);
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.5rem 0;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}

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

.nav-links .btn-logout {
    background: rgba(255,255,255,0.1);
    padding: 0.5rem 1.25rem;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.15);
    color: var(--text-white);
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.nav-links .btn-logout:hover {
    background: var(--error);
    border-color: var(--error);
}

/* Container */
.container {
    max-width: 1080px;
    margin: 0 auto;
    padding: 2rem;
    flex: 1;
    width: 100%;
}

/* Hero Slider */
.hero-slider {
    position: relative;
    width: 100%;
    height: 480px;
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 3rem;
    background: var(--header-bg);
}

.hero-slide {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.8s ease-in-out;
    z-index: 1;
}

.hero-slide.active {
    opacity: 1;
    z-index: 2;
}

.hero-slide .slide-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(15,23,42,0.85) 0%, rgba(15,23,42,0.4) 100%);
    z-index: 1;
}

.hero-slide .slide-content {
    position: relative;
    z-index: 2;
    text-align: center;
    color: var(--text-white);
    padding: 2rem;
    max-width: 700px;
}

.hero-slide .slide-content h1 {
    font-size: 3rem;
    font-weight: 800;
    color: var(--text-white);
    margin-bottom: 0.75rem;
}

.hero-slide .slide-content h2 {
    font-size: 1.2rem;
    font-weight: 400;
    color: rgba(255,255,255,0.8);
    margin-bottom: 1.5rem;
}

.btn-primary {
    display: inline-block;
    background: var(--primary);
    color: var(--text-white);
    padding: 0.85rem 2rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.95rem;
    border: none;
    cursor: pointer;
    transition: all 0.25s ease;
    font-family: inherit;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(37,99,235,0.35);
    color: var(--text-white);
}

.slider-dots {
    position: absolute;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 0.5rem;
    z-index: 3;
}

.slider-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255,255,255,0.4);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.slider-dot.active {
    background: var(--card-bg);
    width: 28px;
    border-radius: 5px;
}

/* Section Titles */
.section-title { margin-bottom: 2rem; }
.section-title h1 { font-size: 2rem; margin-bottom: 0.25rem; }
.section-title h2 { font-size: 1rem; font-weight: 400; color: var(--text-secondary); }

/* Product Grid */
.product-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.75rem;
}

@media (max-width: 1100px) {
    .product-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
    .product-grid { grid-template-columns: repeat(2, 1fr); }
    .hero-slider { height: 320px; }
    .hero-slide .slide-content h1 { font-size: 2rem; }
    .nav-container { flex-wrap: wrap; height: auto; padding: 1rem 0; }
    .nav-links { flex-wrap: wrap; gap: 0.75rem; }
}

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

/* Product Card */
.product-card {
    background: var(--card-bg);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 40px rgba(15,23,42,0.12);
}

.product-card .card-image {
    width: 100%;
    height: 220px;
    object-fit: cover;
    background: var(--card-alt-bg);
}

.product-card .card-body {
    padding: 1.25rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.product-card .card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.product-card .card-subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.product-card .card-type {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.product-card .card-price {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--primary);
    margin-top: auto;
    margin-bottom: 0.75rem;
}

.product-card .card-action {
    display: inline-block;
    text-align: center;
    padding: 0.6rem 1rem;
    background: var(--card-alt-bg);
    color: var(--text-primary);
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.product-card .card-action:hover {
    background: var(--primary);
    color: var(--text-white);
}

/* Auth Pages */
.auth-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
    position: relative;
}

.auth-page::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(15,23,42,0.5);
}

.auth-container {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 440px;
    padding: 2rem;
}

.auth-card {
    background: rgba(255,255,255,0.08);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 20px;
    padding: 2.5rem;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.auth-card h1 {
    color: var(--text-white);
    font-size: 1.75rem;
    text-align: center;
    margin-bottom: 0.5rem;
}

.auth-card h2 {
    color: rgba(255,255,255,0.6);
    font-size: 0.95rem;
    font-weight: 400;
    text-align: center;
    margin-bottom: 2rem;
}

.form-group { margin-bottom: 1.25rem; }

.auth-page .form-group label {
    display: block;
    color: rgba(255,255,255,0.8);
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 0.4rem;
}

.auth-page .form-group input,
.auth-page .form-group textarea,
.auth-page .form-group select {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 10px;
    color: var(--text-white);
    font-size: 0.95rem;
    font-family: inherit;
    transition: all 0.2s ease;
    outline: none;
}

.auth-page .form-group input::placeholder { color: rgba(255,255,255,0.4); }

.auth-page .form-group input:focus,
.auth-page .form-group textarea:focus {
    border-color: var(--primary);
    background: rgba(255,255,255,0.15);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.2);
}

.form-group textarea { min-height: 100px; resize: vertical; }
.form-group input[type="file"] { padding: 0.5rem; }

.btn-submit {
    width: 100%;
    padding: 0.85rem;
    background: var(--primary);
    color: var(--text-white);
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.25s ease;
    font-family: inherit;
}

.btn-submit:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(37,99,235,0.35);
}

.btn-auth {
    padding: 0.75rem 2rem;
    white-space: nowrap;
    font-size: 0.9rem;
    width: auto;
}

.auth-link {
    text-align: center;
    margin-top: 1.25rem;
    color: rgba(255,255,255,0.6);
    font-size: 0.9rem;
}

.auth-link a { color: var(--blue-400); font-weight: 600; }
.auth-link a:hover { color: var(--blue-300); }

/* Alerts */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 10px;
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
    font-weight: 500;
}

.alert-error {
    background: rgba(239,68,68,0.2);
    border: 1px solid rgba(239,68,68,0.3);
    color: #fca5a5;
}

.alert-success {
    background: rgba(34,197,94,0.2);
    border: 1px solid rgba(34,197,94,0.3);
    color: #86efac;
}

.admin-content .alert-error {
    background: var(--error-bg);
    border-color: var(--error-border);
    color: var(--error);
}

.admin-content .alert-success {
    background: var(--success-bg);
    border-color: var(--success-border);
    color: var(--success);
}

/* Admin Layout */
.admin-layout { display: flex; min-height: calc(100vh - 64px); }

.admin-sidebar {
    width: 260px;
    background: var(--header-bg);
    padding: 2rem 1.5rem;
    flex-shrink: 0;
}

.admin-sidebar h2 {
    color: var(--text-white);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 1.5rem;
    opacity: 0.6;
}

.admin-sidebar a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 1rem;
    color: rgba(255,255,255,0.7);
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
    transition: all 0.2s ease;
}

.admin-sidebar a:hover,
.admin-sidebar a.active {
    background: rgba(37,99,235,0.2);
    color: var(--text-white);
}

.admin-content {
    flex: 1;
    padding: 2rem;
    background: var(--body-bg);
}

.page-wrap {
    max-width: 1080px;
    margin: 2rem auto;
    padding: 0;
}

.admin-content h1 { font-size: 1.75rem; margin-bottom: 0.25rem; }
.admin-content .page-subtitle { color: var(--text-secondary); margin-bottom: 2rem; font-size: 0.95rem; }

/* Metrics */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2.5rem;
}

.metric-card {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 14px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.metric-card .metric-label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.metric-card .metric-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-primary);
}

/* Table */
.table-container {
    background: var(--card-bg);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

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

.table-container th {
    text-align: left;
    padding: 1rem 1.25rem;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    background: var(--body-bg);
    border-bottom: 2px solid var(--border);
}

.table-container td {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
    vertical-align: middle;
}

.table-container tr:last-child td { border-bottom: none; }
.table-container tr:hover td { background: var(--body-bg); }

.table-container .table-img {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    object-fit: cover;
    background: var(--card-alt-bg);
}

/* Action buttons */
.action-group { display: flex; gap: 0.5rem; }

.btn-edit {
    padding: 0.4rem 1rem;
    background: var(--card-alt-bg);
    color: var(--text-primary);
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.btn-edit:hover { background: var(--primary); color: var(--text-white); }

.btn-delete {
    padding: 0.4rem 1rem;
    background: var(--error-bg);
    color: var(--error);
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.btn-delete:hover { background: #dc2626; color: var(--text-white); }

.btn-add {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 1.5rem;
    background: var(--primary);
    color: var(--text-white);
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    margin-bottom: 1.5rem;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.btn-add:hover {
    background: var(--primary-hover);
    color: var(--text-white);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(37,99,235,0.3);
}

/* User Dashboard */
.user-greeting {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    padding: 2rem;
    border-radius: 16px;
    color: var(--text-white);
    margin-bottom: 2rem;
}

.user-greeting h1 { color: var(--text-white); font-size: 1.75rem; margin-bottom: 0.25rem; }
.user-greeting p { color: rgba(255,255,255,0.7); font-size: 0.95rem; }

/* Footer */
.site-footer {
    background: var(--header-bg);
    color: rgba(255,255,255,0.6);
    text-align: center;
    padding: 1.5rem 2rem;
    font-size: 0.85rem;
    margin-top: auto;
}

.site-footer strong { color: var(--text-white); }

/* Empty state */
.empty-state { text-align: center; padding: 4rem 2rem; color: var(--text-secondary); }
.empty-state p { font-size: 1.1rem; margin-bottom: 1rem; }

/* Product form */
.form-card { max-width: 1080px; }
.form-card .form-group select option { background: var(--header-bg); color: var(--text-white); }

.admin-content .form-group label { color: var(--text-secondary); }
.admin-content .form-group input,
.admin-content .form-group textarea,
.admin-content .form-group select {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--card-bg);
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: inherit;
    outline: none;
    transition: all 0.2s ease;
}
.admin-content .form-group input:focus,
.admin-content .form-group textarea:focus {
    border-color: var(--primary);
    background: var(--card-bg);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}
.admin-content .form-group input::placeholder { color: var(--text-muted); }

/* Chat / Messages */
.chat-layout { display: flex; gap: 1.5rem; min-height: 500px; }

.chat-sidebar {
    width: 300px;
    flex-shrink: 0;
    background: var(--card-bg);
    border-radius: 14px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    overflow-y: auto;
    max-height: 600px;
}

.chat-sidebar h3 {
    padding: 1.25rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.chat-conversation {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--card-bg);
    border-radius: 14px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    overflow: hidden;
}

.chat-conversation .chat-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    font-weight: 700;
    font-size: 1rem;
}

.chat-messages {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    max-height: 400px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.chat-bubble {
    max-width: 75%;
    padding: 0.85rem 1.25rem;
    border-radius: 14px;
    font-size: 0.9rem;
    line-height: 1.5;
    position: relative;
}

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

.chat-bubble.received {
    align-self: flex-start;
    background: var(--card-alt-bg);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
}

.chat-bubble .bubble-meta {
    font-size: 0.7rem;
    opacity: 0.7;
    margin-top: 0.4rem;
}

.chat-bubble.sent .bubble-meta { text-align: right; }

.chat-input-area {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 0.75rem;
}

.chat-input-area input {
    flex: 1;
    padding: 0.7rem 1rem;
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s ease;
}

.chat-input-area input:focus { border-color: var(--primary); }

.chat-input-area button {
    padding: 0.7rem 1.5rem;
    background: var(--primary);
    color: var(--text-white);
    border: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s ease;
    font-family: inherit;
}

.chat-input-area button:hover { background: var(--primary-hover); }

.chat-thread-item {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.2s ease;
}

.chat-thread-item:hover { background: var(--body-bg); }

.chat-thread-item.active {
    background: var(--primary-light);
    border-left: 3px solid var(--primary);
}

.chat-thread-item .thread-sender {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-primary);
    margin-bottom: 0.15rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-thread-item .thread-preview {
    font-size: 0.82rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-thread-item .thread-time {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.chat-thread-item .unread-badge {
    display: inline-block;
    background: var(--primary);
    color: var(--text-white);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.15rem 0.45rem;
    border-radius: 10px;
    margin-left: 0.5rem;
}

.chat-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    min-height: 200px;
    font-size: 0.95rem;
}

.new-message-form { margin-bottom: 1.5rem; }
.new-message-form textarea { min-height: 120px; }

@media (max-width: 768px) {
    .chat-layout { flex-direction: column; }
    .chat-sidebar { width: 100%; max-height: none; }
    .chat-bubble { max-width: 90%; }
}

.upload-zone {
    border: 2px dashed var(--border-strong);
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all .3s;
    background: var(--card-alt-bg);
}
.upload-zone:hover, .upload-zone.drag-over { border-color: var(--primary); background: var(--primary-light); }
.upload-placeholder p { color: var(--text-secondary); margin-bottom: 4px; }
.upload-placeholder .hint { font-size: .82rem; color: var(--text-muted); }

.image-preview { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 16px; }
.preview-item { position: relative; width: 150px; height: 150px; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--card-alt-bg); }
.preview-item img { width: 100%; height: 100%; object-fit: cover; }
.preview-item .crop-btn { position: absolute; bottom: 4px; left: 4px; right: 4px; padding: 4px; font-size: .75rem; background: rgba(0,0,0,.6); color: var(--text-white); border: none; border-radius: 4px; cursor: pointer; }
.preview-item .remove-btn { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; background: rgba(239,68,68,.9); color: var(--text-white); border: none; border-radius: 50%; cursor: pointer; font-size: .8rem; display: flex; align-items: center; justify-content: center; }

.crop-overlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(15,23,42,.7); display: flex; align-items: center; justify-content: center; z-index: 2000; }
.crop-modal { background: var(--card-bg); border-radius: 16px; padding: 24px; max-width: 90vw; max-height: 90vh; overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.crop-modal h3 { margin-bottom: 16px; font-size: 1.1rem; color: var(--text-primary); }
.crop-container { position: relative; display: inline-block; }
.crop-container img { max-width: 600px; max-height: 400px; display: block; }
.crop-box { position: absolute; border: 2px dashed var(--text-white); background: rgba(37,99,235,.15); cursor: move; box-shadow: 0 0 0 9999px rgba(0,0,0,.5); }
.crop-handle { position: absolute; width: 12px; height: 12px; background: var(--card-bg); border: 2px solid var(--primary); border-radius: 50%; }
.crop-handle.nw { top: -6px; left: -6px; cursor: nw-resize; }
.crop-handle.ne { top: -6px; right: -6px; cursor: ne-resize; }
.crop-handle.sw { bottom: -6px; left: -6px; cursor: sw-resize; }
.crop-handle.se { bottom: -6px; right: -6px; cursor: se-resize; }
.crop-actions { display: flex; gap: 8px; margin-top: 16px; justify-content: flex-end; }

.level-badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; }
.level-1 { background: #fee2e2; color: var(--error); }
.level-2 { background: var(--warning-bg); color: var(--warning-dark); }
.level-3 { background: var(--primary-light); color: var(--primary); }
.level-4 { background: #d1fae5; color: var(--success-dark); }
.level-5 { background: var(--card-alt-bg); color: var(--text-secondary); }
.level-6 { background: #f3f4f6; color: #9ca3af; }
.level-7 { background: var(--purple-bg); color: var(--purple-text); }

/* ── Category Tree (shared across index, listing, control, messages) ── */
.tree-ul, .ctree-ul, .m2-tree-ul { list-style:none; padding:0; margin:0; }
.tree-li, .ctree-li, .m2-tree-li { margin:0; }

/* Shared link/item base */
.tree-a, .m2-tree-a {
    display:flex; align-items:center; gap:0.35rem;
    text-decoration:none; color:var(--text-primary);
    font-size:0.85rem; transition:background 0.15s; cursor:pointer;
}
.tree-a { padding:0.35rem 0.5rem; border-radius:6px; }
.m2-tree-a { padding:0.4rem 0.75rem; border-radius:0; min-height:0; }

.tree-a:hover, .m2-tree-a:hover { background:var(--hover-bg); }
.tree-a.active, .m2-tree-a.active { background:var(--primary-light); color:var(--primary); font-weight:600; }
.tree-a.selected { background:var(--primary); color:var(--text-white); font-weight:600; }

/* Shared toggle base */
.tree-toggle, .ctree-toggle {
    width:16px; height:16px; display:inline-flex;
    align-items:center; justify-content:center;
    color:var(--text-muted); flex-shrink:0; transition:transform 0.15s;
}
.tree-toggle { font-size:0.65rem; }
.ctree-toggle { font-size:0.6rem; cursor:pointer; user-select:none; }
.tree-toggle.expanded, .ctree-toggle.expanded { transform:rotate(90deg); }

.tree-children { padding-left:1.25rem; }
.tree-count { font-size:0.7rem; color:var(--text-muted); margin-left:auto; }

/* ctree (control panel category tree with actions) */
.ctree-toggle-hidden { visibility:hidden; }
.ctree-node { display:flex; align-items:center; gap:0.4rem; padding:0.4rem 0.5rem; border-radius:6px; transition:background 0.15s; }
.ctree-node:hover { background:var(--hover-bg); }
.ctree-node.active { background:var(--primary-light); }
.ctree-children { padding-left:1.5rem; }
.ctree-name { font-size:0.85rem; }
.ctree-count { font-size:0.7rem; color:var(--text-muted); background:var(--card-alt-bg); padding:0.1rem 0.45rem; border-radius:999px; }
.ctree-actions { margin-left:auto; display:flex; align-items:center; gap:0.3rem; }

/* m2-tree (messages sidebar user list) */
.m2-unread-badge { background:var(--primary); color:var(--text-white); font-size:0.65rem; font-weight:700; padding:0.1rem 0.4rem; border-radius:99px; margin-left:auto; flex-shrink:0; }

/* Products page layout */
.products-layout { display:flex; gap:1.5rem; align-items:flex-start; }
.products-sidebar { flex:0 0 240px; position:sticky; top:1rem; max-height:calc(100vh - 8rem); overflow-y:auto; }
.products-main { flex:1; min-width:0; }
@media (max-width:768px) { .products-layout { flex-direction:column; } .products-sidebar { position:static; max-height:none; } }

/* ── Consolidated Utility Classes ── */

/* Product/Listing Card Row */
.card-row {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
    overflow: hidden;
}
.card-row-p-sm { padding: 0.75rem 1rem; }

.card-col-img { flex: 0 0 25%; min-width: 0; }
.card-col-img-sm { flex: 0 0 50px; min-width: 0; }
.card-col-content { flex: 1; min-width: 0; overflow-wrap: break-word; word-break: break-word; }

.product-card-img { width:100%; height:auto; border-radius:12px; display:block; }
.product-card-img-sm { width:50px; height:50px; border-radius:8px; object-fit:cover; background:var(--card-alt-bg); flex-shrink:0; }
.product-card-actions-inline { display:flex; align-items:center; gap:0.5rem; }

.card-no-img {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 12px;
    background: var(--card-alt-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.card-title { font-weight: 600; font-size: 1.05rem; }
.card-title-lg { font-weight: 600; font-size: 1.25rem; }
.card-title-sm { font-weight: 600; font-size: 0.9rem; }

.card-subtitle { font-size: 0.85rem; color: var(--text-secondary); margin-top: 0.15rem; }
.card-desc { font-size: 0.8rem; color: var(--text-secondary); margin-top: 0.15rem; }
.card-type-path { font-size: 0.7rem; color: var(--text-muted); margin-bottom: 2px; }

/* Buttons */
.btn-view {
    white-space: nowrap;
    padding: 0.5rem 1.25rem;
    background: var(--primary);
    color: var(--text-white);
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    text-decoration: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    display: inline-block;
}
.btn-view:hover { background: var(--primary-hover); color: var(--text-white); }

.btn-search {
    padding: 0.5rem 1rem;
    background: var(--primary);
    color: var(--text-white);
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    font-family: inherit;
}
.btn-search:hover { background: var(--primary-hover); }

.btn-search-lge {
    padding: 0.7rem 1.5rem;
    background: var(--primary);
    color: var(--text-white);
    border: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    font-family: inherit;
}
.btn-search-lge:hover { background: var(--primary-hover); color: var(--text-white); }

.btn-clear, .btn-clear-lg {
    background: var(--card-alt-bg);
    color: var(--text-secondary);
    text-decoration: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
}
.btn-clear:hover, .btn-clear-lg:hover { background: var(--border); color: var(--text-primary); }

.btn-clear {
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 500;
    display: inline-block;
}
.btn-clear-lg {
    padding: 0.7rem 1.25rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
}

/* Inputs */
.input-search {
    flex: 1;
    min-width: 180px;
    padding: 0.7rem 1rem;
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
}
.input-search:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.15); }

.input-admin {
    flex: 1;
    padding: 0.6rem 1rem;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    font-size: 0.85rem;
    font-family: inherit;
    outline: none;
    max-width: 560px;
}
.input-admin:focus { border-color: var(--primary); }

.input-full {
    width: 100%;
    padding: 0.65rem 1rem;
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
}
.input-full:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.15); }

.select-sm {
    padding: 0.35rem 0.5rem;
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    font-size: 0.8rem;
    font-family: inherit;
    outline: none;
}

.select-sort {
    padding: 0.6rem 1rem;
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    font-size: 0.85rem;
    font-family: inherit;
    outline: none;
    background: var(--card-bg);
    color: var(--text-primary);
}

.tag-label {
    padding: 0.4rem 0.75rem;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    background: var(--card-alt-bg);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.3rem;
}
.tag-label:hover { background: var(--border); }

/* Pagination */
.pag-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}
.pag-bar-top { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); }

.pag-info { display: flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; color: var(--text-secondary); }
.pag-links { display: flex; align-items: center; gap: 0.35rem; flex-wrap: wrap; }

.pag-link {
    padding: 0.4rem 0.75rem;
    background: var(--card-alt-bg);
    color: var(--text-primary);
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
}
.pag-link:hover { background: var(--border); color: var(--text-primary); }
.pag-link.active { background: var(--primary); color: var(--text-white); }
.pag-link.active:hover { background: var(--primary-hover); }

/* Alerts */
.alert-box {
    padding: 0.75rem 1rem;
    border-radius: 10px;
    margin-bottom: 1rem;
    font-size: 0.85rem;
}
.alert-box-error {
    background: var(--error-bg);
    border: 1px solid var(--error-border);
    color: var(--error);
}
.alert-box-success {
    background: var(--success-bg);
    border: 1px solid var(--success-border);
    color: var(--success);
}

/* Badges */
.badge-status {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 6px;
}

/* Form */
.form-row { display: flex; gap: 1rem; }
.form-group-flex { flex: 1; }
.textarea-desc { min-height: 60px; }

/* Meta / Timestamp */
.meta-text { font-size: 0.75rem; color: var(--text-muted); }

/* Empty state sm */
.empty-state-sm { text-align: center; padding: 2rem; color: var(--text-muted); font-size: 0.9rem; }
.empty-state-sm-lg { padding: 3rem; }

/* Card white container */
.card-white {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
}
.card-white-p-lg { padding: 1.5rem; }
.card-white-p-sm { padding: 0.75rem; }

/* Tag pill */
.tag-pill {
    padding: 0.1rem 0.5rem;
    background: var(--warning-bg);
    color: var(--warning-text);
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    text-decoration: none;
}

/* Search form wrapper */
.search-form {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    align-items: center;
}
.search-form-mb-lg { margin-bottom: 2rem; }

/* Info banner */
.info-banner {
    margin-bottom: 1.5rem;
    padding: 0.75rem 1rem;
    background: var(--purple-bg);
    border-radius: 10px;
    font-size: 0.9rem;
    color: var(--purple-text);
}
.info-banner-mb-sm { margin-bottom: 1rem; }

/* Wishlist / action buttons on cards */
.card-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

/* ── Dark Mode ── */
body.dark-mode .nav-container { background: var(--header-bg); }
body.dark-mode .hero-slider { background: var(--hero-bg); }
body.dark-mode .hero-slide .slide-overlay { background: linear-gradient(135deg, var(--slider-overlay-from) 0%, var(--slider-overlay-to) 100%); }
body.dark-mode .nav-links a { color: rgba(255,255,255,0.7); }
body.dark-mode .nav-links a:hover,
body.dark-mode .nav-links a.active { color: var(--text-white); }
body.dark-mode .nav-links .btn-logout { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.1); }
body.dark-mode .stat-card { background: var(--stat-card-bg); border-color: var(--stat-card-border); }
body.dark-mode .stat-card .num { color: var(--text-white); }
body.dark-mode .cp-card { background: var(--card-bg); border-color: var(--border); }
body.dark-mode .cp-card h3 { color: var(--text-primary); }
body.dark-mode .tbl-wrap table th { background: var(--card-alt-bg); color: var(--text-secondary); }
body.dark-mode .tbl-wrap table td { border-bottom-color: var(--border); }
body.dark-mode .tbl-wrap table tr:hover td { background: var(--hover-bg); }
body.dark-mode input, body.dark-mode textarea, body.dark-mode select {
    background: var(--input-bg);
    color: var(--text-primary);
    border-color: var(--border-strong);
}
body.dark-mode input:focus, body.dark-mode textarea:focus, body.dark-mode select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.2);
}
body.dark-mode .alert-success { background: var(--success-bg); border-color: var(--success-border); color: var(--success); }
body.dark-mode .alert-error { background: var(--error-bg); border-color: var(--error-border); color: var(--error); }
body.dark-mode .form-card { background: var(--card-bg); border-color: var(--border); }
body.dark-mode .page-subtitle { color: var(--text-secondary); }
body.dark-mode .chat-sidebar { background: var(--card-bg); border-color: var(--border); }
body.dark-mode .chat-thread-item { border-bottom-color: var(--border); }
body.dark-mode .chat-thread-item:hover { background: var(--hover-bg); }
body.dark-mode .chat-thread-item.active { background: var(--hover-bg); }
body.dark-mode .chat-header { border-bottom-color: var(--border); }
body.dark-mode .chat-messages { background: var(--body-bg); }
body.dark-mode .chat-bubble.sent { background: var(--primary); color: var(--text-white); }
body.dark-mode .chat-bubble.received { background: var(--card-alt-bg); color: var(--text-primary); }
body.dark-mode .chat-input-area { border-top-color: var(--border); }
body.dark-mode .chat-input-area input { background: var(--input-bg); color: var(--text-primary); border-color: var(--border-strong); }
body.dark-mode .announcement-card { background: var(--card-alt-bg); border-color: var(--border); }
body.dark-mode .badge-on { background: var(--success-bg); color: var(--success); }
body.dark-mode .badge-off { background: var(--error-bg); color: var(--error); }
body.dark-mode .product-card { background: var(--card-bg); border-color: var(--border); }
body.dark-mode .product-card:hover { border-color: var(--primary); box-shadow: 0 4px 16px rgba(59,130,246,0.15); }
body.dark-mode .upload-zone { background: var(--card-alt-bg); border-color: var(--border-strong); }
body.dark-mode .upload-zone:hover, body.dark-mode .upload-zone.drag-over { border-color: var(--primary); background: var(--primary-light); }
body.dark-mode .upload-placeholder p { color: var(--text-secondary); }
body.dark-mode .upload-placeholder .hint { color: var(--text-muted); }
body.dark-mode .crop-overlay { background: rgba(0,0,0,.8); }
body.dark-mode .crop-modal { background: var(--card-bg); }
body.dark-mode .crop-modal h3 { color: var(--text-primary); }
body.dark-mode .crop-box { border-color: var(--primary); background: rgba(59,130,246,.15); }
body.dark-mode .crop-handle { background: var(--primary); }
body.dark-mode .preview-item { background: var(--card-alt-bg); border-color: var(--border); }
body.dark-mode .level-badge.level-1 { background: var(--error-bg); color: var(--red-800); }
body.dark-mode .level-badge.level-2 { background: var(--warning-bg); color: var(--warning); }
body.dark-mode .level-badge.level-3 { background: var(--primary-light); color: var(--blue-300); }
body.dark-mode .level-badge.level-4 { background: var(--success-bg); color: var(--success); }
body.dark-mode .level-badge.level-6 { background: #1e293b; color: var(--text-muted); }
body.dark-mode .level-badge.level-7 { background: var(--purple-bg); color: var(--purple-text); }
body.dark-mode .btn-sm-g { background: var(--card-alt-bg); color: var(--text-primary); border-color: var(--border); }
body.dark-mode .btn-sm-d { background: var(--error-bg); color: var(--red-800); }
body.dark-mode .btn-sm-p { background: var(--primary); color: var(--text-white); }
body.dark-mode .tbl-wrap table tr:hover { background: transparent; }
body.dark-mode .chat-empty { color: var(--text-muted); }
body.dark-mode .search-user-link { color: var(--text-primary); border-bottom-color: var(--border) !important; }
body.dark-mode .search-user-link:hover { background: var(--hover-bg); }
body.dark-mode .search-user-link span:last-child { color: var(--primary); }
body.dark-mode .admin-content { color: var(--text-primary); }
body.dark-mode .subtitle { color: var(--text-secondary); }
body.dark-mode .cp-sidebar { background: var(--card-bg); border-color: var(--border); }
body.dark-mode .cp-sidebar a { color: var(--text-secondary); }
body.dark-mode .cp-sidebar a:hover,
body.dark-mode .cp-sidebar a.active { background: var(--hover-bg); color: var(--text-primary); }
body.dark-mode .cp-sidebar a i { color: var(--primary); }
body.dark-mode .dark-mode-btn { opacity: 0.9; }
body.dark-mode .admin-content .form-group label { color: var(--text-secondary); }
body.dark-mode .admin-content .form-group input,
body.dark-mode .admin-content .form-group textarea,
body.dark-mode .admin-content .form-group select { color: var(--text-primary); border-color: var(--border-strong); }
body.dark-mode .admin-content .form-group input:focus,
body.dark-mode .admin-content .form-group textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59,130,246,0.2); }
body.dark-mode .admin-content .form-group input::placeholder { color: var(--text-muted); }
body.dark-mode .admin-content .inline-form input,
body.dark-mode .admin-content .inline-form select { color: var(--text-primary); border-color: var(--border-strong); }
body.dark-mode .listing-sidebar .card-white { background: var(--card-bg); border-color: var(--border); }

/* ── Wishlist Heart ── */
.wishlist-btn {
    background: none;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    transition: transform 0.2s, color 0.2s;
    color: var(--text-primary);
    line-height: 1;
}
.wishlist-btn:hover {
    transform: scale(1.2);
    color: var(--error);
}
.wishlist-btn.wishlist-active {
    color: var(--error);
}
.wishlist-btn.wishlist-active:hover {
    color: var(--error);
}

.dark-mode-btn {
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    opacity: 0.7;
}
.dark-mode-btn:hover { opacity: 1; background: rgba(255,255,255,0.1); }

/* ── index.php ── */
.index-layout { display:flex; gap:1.5rem; align-items:flex-start; }
.index-sidebar { flex:0 0 260px; position:sticky; top:1rem; max-height:calc(100vh - 2rem); overflow-y:auto; }
.index-main { flex:1; min-width:0; }

/* ── bbs.php ── */
.bbs-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:1.5rem; flex-wrap:wrap; gap:0.75rem; }
.bbs-header h1 { font-size:1.5rem; margin:0; }
.bbs-header .bbs-header-desc { color:var(--text-secondary); font-size:0.9rem; }
.bbs-cat { background:var(--card-bg); border:1px solid var(--border); border-radius:12px; margin-bottom:1.5rem; overflow:hidden; }
.bbs-cat-header { padding:0.75rem 1rem; background:var(--body-bg); border-bottom:1px solid var(--border); font-weight:700; font-size:0.95rem; color:var(--text-primary); display:flex; align-items:center; justify-content:space-between; }
.bbs-cat-desc { font-size:0.8rem; font-weight:400; color:var(--text-secondary); }
.bbs-topic-row { display:flex; align-items:center; gap:0.75rem; padding:0.7rem 1rem; border-bottom:1px solid var(--border-light); text-decoration:none; color:var(--text-primary); transition:background 0.15s; }
.bbs-topic-row:hover { background:var(--body-bg); }
.bbs-topic-row:last-child { border-bottom:none; }
.bbs-topic-icon { font-size:1.1rem; flex-shrink:0; width:1.5rem; text-align:center; }
.bbs-topic-body { flex:1; min-width:0; }
.bbs-topic-title { font-size:0.9rem; font-weight:600; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.bbs-topic-meta { font-size:0.75rem; color:var(--text-muted); margin-top:0.15rem; }
.bbs-topic-stats { flex-shrink:0; text-align:right; font-size:0.8rem; color:var(--text-secondary); white-space:nowrap; }
.bbs-topic-stats span { display:inline-block; margin-left:0.75rem; }
.bbs-topic-last { flex-shrink:0; text-align:right; font-size:0.75rem; color:var(--text-muted); max-width:160px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.bbs-empty { padding:2rem; text-align:center; color:var(--text-muted); font-size:0.9rem; }
.bbs-pin { color:var(--warning); }
.bbs-lock { color:var(--error); }

/* ── bbs_topic.php ── */
.bbs-breadcrumb { font-size:0.85rem; color:var(--text-secondary); margin-bottom:1rem; }
.bbs-breadcrumb a { color:var(--primary); text-decoration:none; }
.bbs-breadcrumb a:hover { text-decoration:underline; }
.bbs-topic-head { background:var(--card-bg); border:1px solid var(--border); border-radius:12px; padding:1.25rem; margin-bottom:1.5rem; }
.bbs-topic-head h1 { font-size:1.3rem; margin:0 0 0.35rem; }
.bbs-topic-head .bbs-meta { font-size:0.8rem; color:var(--text-muted); }
.bbs-topic-head .bbs-content { margin-top:1rem; font-size:0.9rem; line-height:1.6; color:var(--text-primary); overflow-wrap:break-word;word-break:break-word; }
.bbs-reply { display:flex; gap:1rem; padding:1rem 1.25rem; background:var(--card-bg); border:1px solid var(--border); border-top:none; }
.bbs-reply:first-of-type { border-radius:12px 12px 0 0; border-top:1px solid var(--border); }
.bbs-reply:last-of-type { border-radius:0 0 12px 12px; }
.bbs-reply-avatar { flex-shrink:0; width:40px; height:40px; border-radius:50%; background:var(--border); display:flex; align-items:center; justify-content:center; font-size:1rem; font-weight:700; color:var(--text-secondary); }
.bbs-reply-body { flex:1; min-width:0; }
.bbs-reply-author { font-size:0.85rem; font-weight:700; color:var(--text-primary); }
.bbs-reply-time { font-size:0.75rem; color:var(--text-muted); margin-left:0.5rem; font-weight:400; }
.bbs-reply-content { font-size:0.9rem; line-height:1.6; color:var(--text-primary); margin-top:0.35rem; overflow-wrap:break-word;word-break:break-word; }
.bbs-reply-actions { margin-top:0.5rem; font-size:0.8rem; }
.bbs-reply-actions a { color:var(--text-muted); text-decoration:none; margin-right:0.75rem; }
.bbs-reply-actions a:hover { color:var(--primary); }
.bbs-reply-form { background:var(--card-bg); border:1px solid var(--border); border-radius:12px; padding:1.25rem; margin-top:1.5rem; }
.bbs-reply-form h3 { font-size:1rem; margin-bottom:0.75rem; }
.bbs-reply-form textarea { width:100%; min-height:120px; padding:0.75rem 1rem; border:1px solid var(--border); border-radius:10px; font-size:0.9rem; font-family:inherit; outline:none; resize:vertical; }
.bbs-reply-form textarea:focus { border-color:var(--primary); box-shadow:0 0 0 3px rgba(37,99,235,0.15); }
.bbs-reply-form button { margin-top:0.75rem; padding:0.6rem 1.5rem; background:var(--primary); color:var(--text-white); border:none; border-radius:10px; font-weight:600; font-size:0.9rem; cursor:pointer; font-family:inherit; }
.bbs-reply-form button:hover { background:var(--primary-hover); }
.bbs-locked-banner { background:var(--error-bg); border:1px solid var(--error-border); color:var(--error); padding:0.75rem 1rem; border-radius:10px; font-size:0.85rem; font-weight:600; margin-bottom:1rem; display:flex; align-items:center; gap:0.5rem; }
body.dark-mode .bbs-topic-head,
body.dark-mode .bbs-reply,
body.dark-mode .bbs-reply-form { background:var(--card-bg); border-color:var(--border); }
body.dark-mode .bbs-topic-head .bbs-content,
body.dark-mode .bbs-reply-content { color:var(--text-primary); }
body.dark-mode .bbs-reply-author { color:var(--text-primary); }
body.dark-mode .bbs-reply-form textarea { background:var(--input-bg); color:var(--text-primary); border-color:var(--border-strong); }
body.dark-mode .bbs-reply-form textarea:focus { border-color:var(--primary); box-shadow:0 0 0 3px rgba(59,130,246,0.2); }

/* ── bbs_new.php ── */
.bbs-new-wrap { max-width:700px; margin:0 auto; }
.bbs-new-wrap h1 { font-size:1.5rem; margin-bottom:0.25rem; }
.bbs-new-wrap .subtitle { color:var(--text-secondary); font-size:0.9rem; margin-bottom:1.5rem; }
.bbs-new-card { background:var(--card-bg); border:1px solid var(--border); border-radius:12px; padding:1.5rem; }
.bbs-new-card .form-group { margin-bottom:1.25rem; }
.bbs-new-card label { display:block; font-size:0.85rem; font-weight:600; color:var(--text-secondary); margin-bottom:0.4rem; }
.bbs-new-card select,
.bbs-new-card input[type="text"] { width:100%; padding:0.65rem 1rem; border:1px solid var(--border); border-radius:10px; font-size:0.9rem; font-family:inherit; outline:none; }
.bbs-new-card select:focus,
.bbs-new-card input[type="text"]:focus { border-color:var(--primary); box-shadow:0 0 0 3px rgba(37,99,235,0.15); }
.bbs-new-card textarea { width:100%; min-height:200px; padding:0.75rem 1rem; border:1px solid var(--border); border-radius:10px; font-size:0.9rem; font-family:inherit; outline:none; resize:vertical; }
.bbs-new-card textarea:focus { border-color:var(--primary); box-shadow:0 0 0 3px rgba(37,99,235,0.15); }
.bbs-new-card button { padding:0.7rem 1.5rem; background:var(--primary); color:var(--text-white); border:none; border-radius:10px; font-weight:600; font-size:0.9rem; cursor:pointer; font-family:inherit; }
.bbs-new-card button:hover { background:var(--primary-hover); }
body.dark-mode .bbs-new-card { background:var(--card-bg); border-color:var(--border); }
body.dark-mode .bbs-new-card select,
body.dark-mode .bbs-new-card input[type="text"],
body.dark-mode .bbs-new-card textarea { background:var(--input-bg); color:var(--text-primary); border-color:var(--border-strong); }
body.dark-mode .bbs-new-card select:focus,
body.dark-mode .bbs-new-card input[type="text"]:focus,
body.dark-mode .bbs-new-card textarea:focus { border-color:var(--primary); box-shadow:0 0 0 3px rgba(59,130,246,0.2); }

/* ── control.php ── */
.cp-wrap { display:flex; min-height:calc(100vh - 64px); }
.cp-sidebar { width:220px; background:var(--header-bg); padding:1.5rem 1rem; flex-shrink:0; }
.cp-sidebar h2 { color:var(--text-white); font-size:0.7rem; text-transform:uppercase; letter-spacing:1px; margin-bottom:1rem; opacity:0.5; }
.cp-sidebar a { display:flex; align-items:center; gap:0.6rem; padding:0.65rem 0.9rem; color:rgba(255,255,255,0.65); border-radius:8px; font-size:0.85rem; font-weight:500; margin-bottom:0.2rem; transition:all 0.2s; }
.cp-sidebar a:hover, .cp-sidebar a.active { background:rgba(37,99,235,0.2); color:var(--text-white); }
.cp-content { flex:1; padding:1.5rem 2rem; background:var(--body-bg); }
.cp-content h1 { font-size:1.75rem; margin-bottom:0.25rem; }
.cp-content .subtitle { color:var(--text-secondary); margin-bottom:1.5rem; font-size:0.9rem; }
.section { display:none; }
.section.active { display:block; }
.stat-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(160px,1fr)); gap:1rem; margin-bottom:2rem; }
.stat-card { background:var(--card-bg); padding:1.25rem; border-radius:12px; box-shadow:0 1px 3px rgba(0,0,0,0.06); }
.stat-card .num { font-size:1.8rem; font-weight:800; color:var(--text-primary); }
.stat-card .lbl { font-size:0.75rem; font-weight:600; text-transform:uppercase; letter-spacing:0.3px; color:var(--text-secondary); margin-top:0.25rem; }
.tbl-wrap { background:var(--card-bg); border-radius:12px; overflow-x:auto; box-shadow:0 1px 3px rgba(0,0,0,0.06); }
.tbl-wrap table { width:100%; border-collapse:collapse; }
.tbl-wrap th { text-align:left; padding:0.75rem 1rem; font-size:0.75rem; font-weight:700; text-transform:uppercase; letter-spacing:0.3px; color:var(--text-secondary); background:var(--card-alt-bg); border-bottom:2px solid var(--border); }
.tbl-wrap td { padding:0.75rem 1rem; border-bottom:1px solid var(--border); font-size:0.85rem; vertical-align:middle; }
.tbl-wrap tr:last-child td { border:none; }
.tbl-wrap tr:hover td { background:var(--card-alt-bg); }
.cp-card { background:var(--card-bg); border-radius:12px; box-shadow:0 1px 3px rgba(0,0,0,0.06); padding:1.5rem; margin-bottom:1.5rem; }
.cp-card h3 { font-size:1rem; margin-bottom:1rem; color:var(--text-primary); }
form.inline-form { display:flex; gap:0.5rem; flex-wrap:wrap; align-items:center; }
form.inline-form select, form.inline-form input[type="text"], form.inline-form input[type="email"], form.inline-form textarea { padding:0.5rem 0.75rem; border:1px solid var(--border-strong); border-radius:8px; font-size:0.85rem; font-family:inherit; outline:none; background:var(--input-bg); color:var(--text-primary); }
form.inline-form textarea { width:100%; min-height:80px; resize:vertical; }
.btn-sm { padding:0.4rem 0.85rem; border-radius:7px; font-size:0.8rem; font-weight:600; cursor:pointer; border:none; font-family:inherit; transition:all 0.2s; }
.btn-sm-p { background:var(--primary); color:var(--text-white); } .btn-sm-p:hover { background:var(--primary-hover); }
.btn-sm-s { background:var(--card-alt-bg); color:var(--text-primary); border:1px solid var(--border-strong); } .btn-sm-s:hover { background:var(--border); }
.btn-sm-d { background:var(--error-bg); color:var(--error); } .btn-sm-d:hover { background:var(--error); color:var(--text-white); }
.btn-sm-g { background:var(--card-alt-bg); color:var(--text-primary); } .btn-sm-g:hover { background:var(--border); }
.badge { display:inline-block; padding:0.15rem 0.5rem; border-radius:6px; font-size:0.7rem; font-weight:700; }
.badge-on { background:#d1fae5; color:var(--success-dark); }
.badge-off { background:#fee2e2; color:var(--error); }
.ml-auto { margin-left:auto; }
.cp-card.tree-card { padding:0.75rem 0; }

/* ── messages.php ── */
.m2-layout { display:flex; gap:1.5rem; align-items:flex-start; height:calc(100vh - 100px); }
.m2-sidebar { flex:0 0 260px; display:flex; flex-direction:column; height:100%; }
.m2-main { flex:1; min-width:0; display:flex; flex-direction:column; height:100%; }
.m2-sidebar-inner { background:var(--card-bg); border:1px solid var(--border); border-radius:12px; display:flex; flex-direction:column; height:100%; overflow:hidden; }
.m2-user-list { flex:1; overflow-y:auto; padding:0.25rem 0; }

/* ── Auth pages with header/footer (login, forgot-password, confirm, reset-password) ── */
.auth-page > .nav-container { align-self: stretch; width: 100%; flex-shrink: 0; }
.auth-page > .site-footer { align-self: stretch; width: 100%; flex-shrink: 0; position: relative; z-index: 1; }
.auth-page > .container { align-self: stretch; display: flex; align-items: center; justify-content: center; max-width: none; }

/* ── Static legal pages (privacy, terms) ── */
.legal-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    line-height: 1.8;
    font-size: 0.95rem;
    color: var(--text-primary);
}
.legal-card h2 {
    font-size: 1.25rem;
    margin: 1.5rem 0 0.5rem;
    color: var(--text-primary);
}
.legal-card p { margin: 0 0 0.75rem; }
.legal-card a { color: var(--primary); }
.legal-date { color: var(--text-muted); font-size: 0.85rem; margin-top: 2rem; }

/* ── Color utility classes ── */
.text-error { color: var(--error); }
.text-success { color: var(--success); }
.text-muted { color: var(--text-muted); }
.bg-error { background: var(--error-bg); }
.bg-success { background: var(--success-bg); }
.border-error { border-color: var(--error-border); }
.border-success { border-color: var(--success-border); }
.text-xs { font-size: 0.7rem; }
.text-sm { font-size: 0.75rem; }
.text-base { font-size: 0.8rem; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.uppercase { text-transform: uppercase; }
.pre-wrap { white-space: pre-wrap; word-break: break-word; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Search loading popup ── */
.search-loading {
    position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
    z-index: 9999;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 1rem;
    width: 200px; height: 200px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
}
.search-loading .spinner {
    width: 40px; height: 40px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: sl-spin 0.7s linear infinite;
}
@keyframes sl-spin { to { transform: rotate(360deg); } }
.search-loading span {
    font-size: 0.9rem; color: var(--text-secondary);
}
