/* Sanctum global styles */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --bg-deep: #07070c; --bg-surface: #0e0e16; --bg-elevated: #16161f; --bg-hover: #1c1c28;
  --accent: #c9a84c; --accent-dim: #8a7234; --accent-glow: rgba(201, 168, 76, 0.1);
  --text-primary: #e2dbd0; --text-secondary: #8a857d; --text-muted: #5a564f;
  --border: #1e1e2a; --border-light: #2a2a38;
  --danger: #d94444; --success: #4a9e6a;
  --tier-0: #8a857d; --tier-1: #4a9eff; --tier-2: #c9a84c;
}
html { scroll-behavior: smooth; }
body {
  font-family: 'DM Sans', sans-serif; background: var(--bg-deep); color: var(--text-primary);
  line-height: 1.7; min-height: 100vh;
}
body::before {
  content: ''; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none; z-index: 1000;
}
a { color: var(--accent); text-decoration: none; transition: opacity 0.2s; }
a:hover { opacity: 0.8; }

.app-nav { padding: 1rem 0; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: rgba(7, 7, 12, 0.92); backdrop-filter: blur(12px); z-index: 100; }
.app-nav .container { display: flex; align-items: center; justify-content: space-between; }
.nav-logo { font-family: 'Syne', sans-serif; font-weight: 800; font-size: 1.2rem; letter-spacing: 0.15em; text-transform: uppercase; color: var(--accent); }
.nav-logo span { display: inline-block; width: 5px; height: 5px; background: var(--accent); border-radius: 50%; margin-left: 2px; vertical-align: super; }
.nav-links { display: flex; align-items: center; gap: 1.5rem; }
.nav-link { color: var(--text-secondary); font-size: 0.9rem; font-weight: 500; transition: color 0.2s; }
.nav-link:hover { color: var(--text-primary); opacity: 1; }
.nav-link-muted { color: var(--text-muted); }

.container { max-width: 960px; margin: 0 auto; padding: 0 1.5rem; }
.container-sm { max-width: 560px; margin: 0 auto; padding: 0 1.5rem; }
.card { background: var(--bg-surface); border: 1px solid var(--border); border-radius: 8px; padding: 2rem; margin-bottom: 1rem; }

.page-header { padding: 2.5rem 0 1.5rem; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1rem; }
.page-header h1 { font-family: 'Syne', sans-serif; font-size: 1.6rem; font-weight: 700; }
.page-header .sub { font-size: 0.9rem; color: var(--text-secondary); font-weight: 300; }

.btn { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.65rem 1.4rem; background: var(--accent); color: var(--bg-deep); font-family: 'DM Sans', sans-serif; font-size: 0.9rem; font-weight: 600; border: none; border-radius: 6px; cursor: pointer; transition: all 0.2s; text-decoration: none; }
.btn:hover { opacity: 0.9; transform: translateY(-1px); color: var(--bg-deep); }
.btn-sm { padding: 0.4rem 1rem; font-size: 0.8rem; background: var(--accent); color: var(--bg-deep); border-radius: 5px; font-weight: 600; }
.btn-ghost { background: transparent; color: var(--text-secondary); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--border-light); color: var(--text-primary); }
.btn-danger { background: var(--danger); }
.btn-small { padding: 0.35rem 0.8rem; font-size: 0.8rem; }

.form-group { margin-bottom: 1.25rem; }
.form-group label { display: block; font-size: 0.85rem; font-weight: 500; color: var(--text-secondary); margin-bottom: 0.4rem; letter-spacing: 0.02em; }
.form-input { width: 100%; padding: 0.7rem 1rem; background: var(--bg-deep); border: 1px solid var(--border); border-radius: 6px; color: var(--text-primary); font-family: 'DM Sans', sans-serif; font-size: 0.95rem; transition: border-color 0.2s; }
.form-input:focus { outline: none; border-color: var(--accent-dim); box-shadow: 0 0 0 3px var(--accent-glow); }
textarea.form-input { min-height: 120px; resize: vertical; line-height: 1.6; }
.form-hint { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.3rem; }

.alert { padding: 0.8rem 1.2rem; border-radius: 6px; margin-bottom: 1.25rem; font-size: 0.9rem; }
.alert-error { background: rgba(217, 68, 68, 0.1); border: 1px solid rgba(217, 68, 68, 0.25); color: #f08080; }
.alert-success { background: rgba(74, 158, 106, 0.1); border: 1px solid rgba(74, 158, 106, 0.25); color: #6fc98f; }

.avatar { width: 38px; height: 38px; border-radius: 50%; background: hsl(var(--hue, 30), 40%, 25%); display: flex; align-items: center; justify-content: center; font-family: 'Syne', sans-serif; font-weight: 700; font-size: 0.85rem; color: hsl(var(--hue, 30), 50%, 70%); flex-shrink: 0; }
.avatar-sm { width: 30px; height: 30px; font-size: 0.7rem; }
.avatar-lg { width: 64px; height: 64px; font-size: 1.4rem; }

.tier-badge { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.7rem; font-weight: 600; padding: 0.15rem 0.5rem; border-radius: 3px; letter-spacing: 0.04em; text-transform: uppercase; }
.tier-0 { color: var(--tier-0); background: rgba(138, 133, 125, 0.1); }
.tier-1 { color: var(--tier-1); background: rgba(74, 158, 255, 0.1); }
.tier-2 { color: var(--tier-2); background: rgba(201, 168, 76, 0.12); }

.category-list { list-style: none; }
.category-item { display: flex; align-items: center; gap: 1.2rem; padding: 1.2rem 1.5rem; background: var(--bg-surface); border: 1px solid var(--border); border-radius: 8px; margin-bottom: 0.5rem; transition: all 0.2s; text-decoration: none; color: var(--text-primary); }
.category-item:hover { border-color: var(--border-light); background: var(--bg-elevated); transform: translateX(2px); opacity: 1; }
.category-item.locked { opacity: 0.5; }
.category-item.locked:hover { transform: none; cursor: not-allowed; }
.category-icon { font-size: 1.5rem; flex-shrink: 0; width: 40px; text-align: center; }
.category-info { flex: 1; min-width: 0; }
.category-name { font-family: 'Syne', sans-serif; font-weight: 700; font-size: 1rem; display: flex; align-items: center; gap: 0.6rem; }
.category-desc { font-size: 0.85rem; color: var(--text-secondary); font-weight: 300; margin-top: 0.15rem; }
.category-stats { text-align: right; font-size: 0.8rem; color: var(--text-muted); white-space: nowrap; }

.thread-list { list-style: none; }
.thread-item { display: flex; gap: 1rem; padding: 1rem 1.5rem; background: var(--bg-surface); border: 1px solid var(--border); border-radius: 8px; margin-bottom: 0.4rem; transition: all 0.2s; text-decoration: none; color: var(--text-primary); }
.thread-item:hover { border-color: var(--border-light); opacity: 1; }
.thread-item.pinned { border-left: 2px solid var(--accent); }
.thread-meta { flex: 1; min-width: 0; }
.thread-title { font-weight: 600; font-size: 0.95rem; display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.2rem; }
.thread-title .pin-badge { font-size: 0.7rem; color: var(--accent); }
.thread-title .lock-badge { font-size: 0.7rem; color: var(--text-muted); }
.thread-excerpt { font-size: 0.85rem; color: var(--text-secondary); font-weight: 300; }
.thread-foot { display: flex; align-items: center; gap: 0.8rem; margin-top: 0.4rem; font-size: 0.75rem; color: var(--text-muted); }
.thread-stats { text-align: right; font-size: 0.8rem; color: var(--text-muted); white-space: nowrap; flex-shrink: 0; }
.thread-stats div { margin-bottom: 0.2rem; }

.post { display: flex; gap: 1rem; padding: 1.5rem; border-bottom: 1px solid var(--border); }
.post:last-child { border-bottom: none; }
.post-body { flex: 1; min-width: 0; }
.post-header { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; flex-wrap: wrap; }
.post-author { font-weight: 600; font-size: 0.9rem; }
.post-time { font-size: 0.75rem; color: var(--text-muted); }
.post-content { font-size: 0.95rem; line-height: 1.7; color: var(--text-primary); }
.post-content p { margin-bottom: 0.75rem; }
.post-content p:last-child { margin-bottom: 0; }
.post-content code { background: var(--bg-elevated); padding: 0.15rem 0.4rem; border-radius: 3px; font-size: 0.85em; }
.post-actions { margin-top: 0.75rem; display: flex; gap: 1rem; }
.post-action { font-size: 0.8rem; color: var(--text-muted); cursor: pointer; transition: color 0.2s; background: none; border: none; font-family: inherit; }
.post-action:hover { color: var(--accent); }
.post.op { background: var(--bg-elevated); border-radius: 8px; margin-bottom: 1rem; border-bottom: none; }

.reply-section { background: var(--bg-surface); border: 1px solid var(--border); border-radius: 8px; padding: 1.5rem; margin-top: 1rem; }
.reply-section h3 { font-family: 'Syne', sans-serif; font-size: 0.95rem; font-weight: 700; margin-bottom: 1rem; color: var(--text-secondary); }

.profile-header { display: flex; align-items: center; gap: 1.5rem; padding: 2rem; }
.profile-info h2 { font-family: 'Syne', sans-serif; font-weight: 700; font-size: 1.4rem; display: flex; align-items: center; gap: 0.6rem; }
.profile-info .profile-stats { display: flex; gap: 1.5rem; margin-top: 0.5rem; font-size: 0.85rem; color: var(--text-secondary); }
.profile-section { padding: 1.5rem 2rem; border-top: 1px solid var(--border); }
.profile-section h3 { font-family: 'Syne', sans-serif; font-size: 0.8rem; font-weight: 600; letter-spacing: 0.15em; text-transform: uppercase; color: var(--accent-dim); margin-bottom: 0.75rem; }
.profile-section p { color: var(--text-secondary); font-weight: 300; font-size: 0.95rem; }

.empty-state { text-align: center; padding: 4rem 2rem; color: var(--text-muted); }
.empty-icon { font-size: 2.5rem; margin-bottom: 1rem; }
.empty-state h3 { font-family: 'Syne', sans-serif; font-size: 1.1rem; margin-bottom: 0.5rem; color: var(--text-secondary); }
.empty-state p { font-size: 0.9rem; margin-bottom: 1.5rem; }

.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th { text-align: left; padding: 0.6rem 1rem; font-size: 0.75rem; font-weight: 600; color: var(--text-muted); letter-spacing: 0.08em; text-transform: uppercase; border-bottom: 1px solid var(--border); }
.admin-table td { padding: 0.7rem 1rem; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.admin-table tr:hover td { background: var(--bg-elevated); }

.auth-page { min-height: 80vh; display: flex; align-items: center; justify-content: center; padding: 2rem; }
.auth-card { width: 100%; max-width: 420px; background: var(--bg-surface); border: 1px solid var(--border); border-radius: 10px; padding: 2.5rem; }
.auth-card h1 { font-family: 'Syne', sans-serif; font-size: 1.5rem; font-weight: 800; margin-bottom: 0.5rem; }
.auth-card .auth-sub { color: var(--text-secondary); font-size: 0.9rem; font-weight: 300; margin-bottom: 2rem; }
.auth-footer { text-align: center; margin-top: 1.5rem; font-size: 0.85rem; color: var(--text-muted); }
.auth-footer a { color: var(--accent); }

.breadcrumb { font-size: 0.85rem; color: var(--text-muted); padding: 1.5rem 0 0; display: flex; align-items: center; gap: 0.5rem; }
.breadcrumb a { color: var(--text-secondary); }
.breadcrumb .sep { color: var(--text-muted); }

.invite-code { font-family: 'Space Mono', 'Courier New', monospace; background: var(--bg-deep); border: 1px dashed var(--border-light); padding: 0.5rem 1rem; border-radius: 4px; font-size: 0.85rem; color: var(--accent); letter-spacing: 0.05em; display: inline-block; margin: 0.3rem 0; }

/* Payment wall */
.pay-wall { max-width: 600px; margin: 0 auto; padding: 3rem 1.5rem; text-align: center; }
.pay-wall-icon { font-size: 3rem; margin-bottom: 1rem; }
.pay-wall h1 { font-family: 'Syne', sans-serif; font-size: 1.8rem; font-weight: 800; margin-bottom: 0.75rem; }
.pay-wall-sub { color: var(--text-secondary); font-size: 1.05rem; font-weight: 300; margin-bottom: 2.5rem; }

.pay-cost-box { background: var(--bg-surface); border: 1px solid var(--border); border-radius: 10px; padding: 2rem; margin-bottom: 2rem; }
.pay-cost-label { font-size: 0.8rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent-dim); margin-bottom: 0.5rem; font-weight: 600; }
.pay-cost-number { font-family: 'Syne', sans-serif; font-size: 2.5rem; font-weight: 800; color: var(--accent); }
.pay-cost-desc { color: var(--text-secondary); font-size: 0.9rem; margin-top: 0.3rem; }
.pay-cost-note { font-size: 0.8rem; color: var(--text-muted); margin-top: 1rem; font-style: italic; border-top: 1px solid var(--border); padding-top: 1rem; }

.pay-options { display: grid; grid-template-columns: 1fr auto 1fr; gap: 0; align-items: stretch; margin-bottom: 2rem; }
.pay-option { background: var(--bg-surface); border: 1px solid var(--border); border-radius: 10px; padding: 2rem; text-align: left; }
.pay-divider { display: flex; align-items: center; justify-content: center; color: var(--text-muted); font-size: 0.9rem; font-weight: 500; padding: 0 1.5rem; }
.pay-option-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.75rem; }
.pay-option-header h2 { font-family: 'Syne', sans-serif; font-size: 1rem; font-weight: 700; }
.pay-option-badge { font-size: 0.65rem; font-weight: 600; padding: 0.2rem 0.5rem; border-radius: 3px; letter-spacing: 0.05em; background: rgba(74, 158, 255, 0.1); color: var(--tier-1); text-transform: uppercase; }
.pay-option-desc { color: var(--text-secondary); font-size: 0.85rem; font-weight: 300; margin-bottom: 1.25rem; line-height: 1.5; }
.pay-amount-row { display: flex; align-items: center; gap: 0; }
.pay-dollar-sign { font-size: 1rem; color: var(--text-secondary); padding: 0.7rem 0.5rem 0.7rem 1rem; background: var(--bg-deep); border: 1px solid var(--border); border-right: none; border-radius: 6px 0 0 6px; }
.pay-per-month { font-size: 0.85rem; color: var(--text-muted); padding: 0.7rem 0.75rem; background: var(--bg-deep); border: 1px solid var(--border); border-left: none; border-radius: 0 6px 6px 0; white-space: nowrap; }
.pay-amount-input { border-radius: 0; text-align: center; font-size: 1.1rem; font-weight: 600; }
.pay-amount-input:focus { z-index: 1; }
.pay-option-hint { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.5rem; }
.pay-amount-form { display: flex; flex-direction: column; }

.pay-cta { background: var(--bg-surface); border: 1px solid var(--border); border-radius: 8px; padding: 1.25rem 1.5rem; font-size: 0.9rem; color: var(--text-secondary); font-weight: 300; line-height: 1.6; }
.pay-cta p { margin: 0; }

@media (max-width: 640px) {
  .category-item { padding: 1rem; gap: 0.8rem; }
  .category-stats, .thread-stats { display: none; }
  .page-header { padding: 1.5rem 0 1rem; }
  .page-header h1 { font-size: 1.3rem; }
  .post { padding: 1rem; }
  .profile-header { flex-direction: column; text-align: center; }
}