/* GlouOS Forums stylesheet. --brand is injected per-site from settings. */
:root {
  --brand: #16a34a;
  --bg: #f7f8fa;
  --surface: #ffffff;
  --line: #e6e9ee;
  --text: #1a212b;
  --muted: #6b7480;
  --muted-2: #99a1ac;
  --danger: #dc2626;
  --radius: 8px;
  --radius-sm: 5px;
  --maxw: 1080px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); line-height: 1.6; -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.7rem; margin: 0 0 6px; letter-spacing: -0.02em; }
h2 { font-size: 1.25rem; margin: 0; }
h3 { font-size: 1.05rem; margin: 0 0 12px; }
.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.uppercase { text-transform: uppercase; letter-spacing: 0.06em; }
.ta-c { text-align: center; }
.ta-r { text-align: right; }

/* Header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 50; }
.site-header .bar { display: flex; align-items: center; gap: 18px; height: 60px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 1.15rem; color: var(--text); letter-spacing: -0.02em; }
.brand:hover { text-decoration: none; }
.brand-dot { width: 14px; height: 14px; border-radius: 4px; background: var(--brand); }
.brand-mark { width: 26px; height: 26px; display: block; }
.nav { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.nav > a { color: var(--muted); font-weight: 500; font-size: 0.95rem; }
.nav > a:hover, .nav > a.active { color: var(--text); text-decoration: none; }
/* Buttons in the nav must keep their own colours (beat .nav > a). */
.nav a.btn, .nav a.btn:hover { color: var(--text); font-weight: 600; }
.nav a.btn-primary, .nav a.btn-primary:hover { color: #fff; }

/* Search trigger button */
.search-trigger { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; background: var(--bg); border: 1px solid var(--line); border-radius: 20px; padding: 7px 12px; color: var(--muted); cursor: pointer; font: inherit; font-size: 0.9rem; line-height: 1; }
.search-trigger:hover { color: var(--text); border-color: var(--muted-2); }
.search-trigger kbd { font-size: 0.72rem; border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px; color: var(--muted-2); background: var(--surface); }
.nav { margin-left: 0; }
@media (max-width: 560px) {
  .site-header .bar { gap: 10px; }
  .search-trigger .st-label, .search-trigger kbd { display: none; }
  .search-trigger { border-radius: 50%; padding: 8px; }
}

/* Search palette modal */
.search-modal { position: fixed; inset: 0; z-index: 200; display: flex; align-items: flex-start; justify-content: center; padding: 12vh 16px 16px; }
.search-modal[hidden] { display: none; }
.search-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 34, 0.4); backdrop-filter: blur(7px); -webkit-backdrop-filter: blur(7px); animation: sm-fade 0.15s ease; }
.search-panel { position: relative; width: 100%; max-width: 600px; background: var(--surface); border-radius: 14px; box-shadow: 0 30px 90px -20px rgba(15, 23, 34, 0.55); overflow: hidden; animation: sm-pop 0.15s ease; }
@keyframes sm-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes sm-pop { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
.search-input-wrap { display: flex; align-items: center; gap: 12px; padding: 15px 18px; border-bottom: 1px solid var(--line); color: var(--muted-2); }
.search-input-wrap input { flex: 1; border: none; background: none; font: inherit; font-size: 1.1rem; color: var(--text); padding: 2px 0; outline: none; }
.search-input-wrap kbd { font-size: 0.7rem; color: var(--muted-2); border: 1px solid var(--line); border-radius: 5px; padding: 3px 7px; cursor: pointer; }
.search-output { max-height: 62vh; overflow-y: auto; padding: 6px; }
.search-hint, .search-empty { padding: 22px 16px; color: var(--muted); font-size: 0.9rem; text-align: center; }
.palette-item { display: block; padding: 11px 14px; border-radius: 9px; color: var(--text); }
.palette-item:hover, .palette-item.active { background: var(--bg); text-decoration: none; }
.palette-item .p-title { font-weight: 600; }
.palette-item .p-meta { font-size: 0.78rem; color: var(--muted-2); margin-top: 1px; }
.palette-item .p-snippet { font-size: 0.85rem; color: var(--muted); margin-top: 3px; }
.search-foot { border-top: 1px solid var(--line); padding: 9px 16px; font-size: 0.78rem; color: var(--muted-2); display: flex; justify-content: space-between; align-items: center; }
.search-foot kbd { border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; }
body.modal-open { overflow: hidden; }
.bell { position: relative; display: inline-flex; color: var(--muted); }
.bell .count { position: absolute; top: -6px; right: -8px; background: var(--danger); color: #fff; font-size: 0.68rem; font-weight: 700; min-width: 16px; height: 16px; border-radius: 8px; display: flex; align-items: center; justify-content: center; padding: 0 4px; }

/* User menu */
.usermenu { position: relative; }
.usermenu summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 0.92rem; }
.usermenu summary::-webkit-details-marker { display: none; }
.usermenu .uname { color: var(--text); }
.menu-panel { position: absolute; right: 0; top: calc(100% + 8px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 12px 30px -12px rgba(15,23,34,0.3); min-width: 180px; padding: 6px; display: flex; flex-direction: column; }
.menu-panel a, .menu-panel button { text-align: left; padding: 9px 12px; border-radius: var(--radius-sm); color: var(--text); background: none; border: none; font: inherit; cursor: pointer; }
.menu-panel a:hover, .menu-panel button:hover { background: var(--bg); text-decoration: none; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: var(--radius-sm); font-weight: 600; font-size: 0.92rem; border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; }
.btn:hover { background: var(--bg); text-decoration: none; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { filter: brightness(0.94); color: #fff; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(0.94); }
.btn-small { padding: 6px 11px; font-size: 0.85rem; }
.btn-block { width: 100%; justify-content: center; }
.link { background: none; border: none; padding: 0; color: var(--brand); font: inherit; cursor: pointer; }
.link:hover { text-decoration: underline; }
.link.danger, .danger { color: var(--danger); }
.inline { display: inline; }

/* Flash */
.flash { padding: 11px 15px; border-radius: var(--radius-sm); margin: 16px 0; font-size: 0.92rem; }
.flash ul { margin: 0; padding-left: 18px; }
.flash-success { background: rgba(22,163,74,0.10); color: #15803d; }
.flash-error { background: rgba(220,38,38,0.09); color: #b91c1c; }

/* Layout */
main.container { padding-top: 22px; padding-bottom: 60px; min-height: 60vh; }
.page-head { margin: 6px 0 20px; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.row-gap { display: flex; gap: 10px; align-items: center; margin-top: 8px; }
.layout { display: grid; grid-template-columns: 1fr 300px; gap: 22px; align-items: start; }
@media (max-width: 820px) { .layout { grid-template-columns: 1fr; } }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.empty { padding: 28px; text-align: center; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.breadcrumb { color: var(--muted); font-size: 0.88rem; margin-bottom: 12px; }
.breadcrumb span { color: var(--muted-2); margin: 0 4px; }

/* Categories / channels */
.cat { margin-bottom: 22px; }
.cat-head { display: flex; align-items: baseline; gap: 12px; padding-left: 12px; border-left: 4px solid var(--cat, var(--brand)); margin-bottom: 10px; }
.channel-list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.channel-row { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 14px 16px; color: var(--text); border-top: 1px solid var(--line); }
.channel-row:first-child { border-top: none; }
.channel-row:hover { background: var(--bg); text-decoration: none; }
.channel-name { font-weight: 600; }
.chan-lock { font-size: 0.72rem; font-weight: 600; color: var(--muted-2); margin-left: 6px; }

/* Latest / notifications rows */
.latest-row { display: block; padding: 9px 0; border-top: 1px solid var(--line); color: var(--text); }
.latest-row:first-of-type { border-top: none; }
.latest-row:hover { text-decoration: none; }
.latest-title { font-weight: 500; font-size: 0.92rem; }

/* Topic list */
.topic-list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.topic-head, .topic-row { display: grid; grid-template-columns: 1fr 90px 130px; gap: 12px; align-items: center; padding: 12px 16px; }
.topic-head { color: var(--muted-2); font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; border-bottom: 1px solid var(--line); }
.topic-row { border-top: 1px solid var(--line); color: var(--text); }
.topic-row:first-of-type { border-top: none; }
.topic-row:hover { background: var(--bg); text-decoration: none; }
.topic-title { font-weight: 600; }
.tag { display: inline-block; font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--brand); background: rgba(22,163,74,0.12); padding: 2px 7px; border-radius: 4px; margin-right: 6px; vertical-align: middle; }
@media (max-width: 620px) { .topic-head, .topic-row { grid-template-columns: 1fr auto; } .topic-head > div:nth-child(3), .topic-row > div:nth-child(3) { display: none; } }

/* Avatars */
.avatar { border-radius: 50%; object-fit: cover; display: inline-block; vertical-align: middle; }
.avatar-fallback { display: inline-flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; }

/* Chips / badges / roles */
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 0.76rem; font-weight: 600; padding: 2px 9px; border-radius: 20px; color: var(--chip, var(--brand)); background: color-mix(in srgb, var(--chip, var(--brand)) 14%, transparent); }
.chip-icon { font-size: 0.85em; }
.chip-x { background: none; border: none; color: inherit; cursor: pointer; font-size: 1rem; line-height: 1; padding: 0 0 0 3px; }
.role-tag { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; padding: 2px 7px; border-radius: 4px; }
.role-admin { color: #fff; background: var(--brand); }
.role-moderator { color: #1d4ed8; background: rgba(37,99,235,0.12); }
.role-banned { color: #fff; background: var(--danger); }

/* Posts */
.topic-header { margin-bottom: 16px; }
.topic-tools { display: flex; gap: 14px; margin-top: 6px; }
.post { display: grid; grid-template-columns: 60px 1fr; gap: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
.post-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.post-author { font-weight: 700; color: var(--text); }
.content { word-wrap: break-word; overflow-wrap: anywhere; }
.content p { margin: 0 0 10px; }
.content h3, .content h4, .content h5 { margin: 14px 0 6px; }
.content pre { background: #0f1722; color: #e6edf3; padding: 12px 14px; border-radius: var(--radius-sm); overflow-x: auto; }
.content code { font-family: var(--mono); font-size: 0.86em; background: var(--bg); padding: 1px 5px; border-radius: 4px; }
.content pre code { background: none; padding: 0; color: inherit; }
.content blockquote { margin: 0 0 10px; padding: 4px 14px; border-left: 3px solid var(--line); color: var(--muted); }
.content ul, .content ol { margin: 0 0 10px; padding-left: 22px; }
.content img { max-width: 100%; }
.post-actions { display: flex; align-items: center; gap: 16px; margin-top: 12px; flex-wrap: wrap; }
.like.liked { color: var(--danger); font-weight: 700; }
.downvote.downvoted { color: #4f46e5; font-weight: 700; }
.rep { font-size: 0.78rem; font-weight: 800; letter-spacing: -0.01em; }
.rep-pos { color: #16a34a; }
.rep-neg { color: #dc2626; }
.rep-zero { color: var(--muted); }
.editor { margin-top: 12px; }
.report { position: relative; }
.report summary { list-style: none; }
.report summary::-webkit-details-marker { display: none; }
.report-form { display: flex; gap: 8px; margin-top: 8px; }
.report-form input[type=text] { flex: 1; }
.reply-box textarea { margin-bottom: 10px; }

/* Forms */
.form label { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 14px; }
.form input[type=text], .form input[type=email], .form input[type=password], .form textarea, .form select, input[type=text], input[type=email], input[type=password], textarea, select {
  width: 100%; margin-top: 5px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); font: inherit; background: var(--surface); color: var(--text);
}
textarea { resize: vertical; font-family: var(--font); }
.form .hint, .hint { display: block; font-weight: 400; font-size: 0.8rem; color: var(--muted-2); margin-top: 4px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.check input { width: auto; margin: 0; }
.color-field { display: flex; align-items: center; gap: 10px; margin-top: 5px; }
.color-field input[type=color] { width: 46px; height: 34px; padding: 2px; }
.form-row { display: flex; gap: 14px; flex-wrap: wrap; }
.form-row label { flex: 1; min-width: 120px; }
.auth-card { max-width: 380px; margin: 30px auto; }
.error-card { max-width: 520px; margin: 30px auto; text-align: center; }

/* Profile */
.profile-head { display: flex; gap: 18px; align-items: center; }
.profile-info h1 { display: flex; align-items: center; gap: 10px; }
.badge-row { margin: 8px 0; display: flex; gap: 6px; flex-wrap: wrap; }
.avatar-edit { display: flex; gap: 16px; align-items: center; margin-bottom: 14px; }

/* Notifications */
.notif-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); color: var(--text); }
.notif-row:first-child { border-top: none; }
.notif-row:hover { background: var(--bg); text-decoration: none; }
.notif-row.unread { background: rgba(22,163,74,0.05); }
.notif-msg { flex: 1; }
.notif-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted-2); }
.notif-reply { background: #2563eb; }
.notif-like { background: var(--danger); }
.notif-badge { background: var(--brand); }

/* Admin */
.admin-layout { display: grid; grid-template-columns: 200px 1fr; gap: 22px; align-items: start; }
@media (max-width: 820px) { .admin-layout { grid-template-columns: 1fr; } }
.admin-nav { display: flex; flex-direction: column; gap: 2px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; position: sticky; top: 76px; }
.admin-nav a { padding: 9px 12px; border-radius: var(--radius-sm); color: var(--muted); font-weight: 500; font-size: 0.92rem; }
.admin-nav a:hover { background: var(--bg); color: var(--text); text-decoration: none; }
.admin-nav a.active { background: var(--brand); color: #fff; }
.admin-nav .count { background: var(--danger); color: #fff; border-radius: 10px; padding: 0 6px; font-size: 0.72rem; }
@media (max-width: 820px) { .admin-nav { flex-direction: row; flex-wrap: wrap; position: static; } }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; text-align: center; }
.stat-num { font-size: 1.8rem; font-weight: 800; letter-spacing: -0.02em; }
.stat-label { color: var(--muted); font-size: 0.85rem; }
.stat-alert { border-color: var(--danger); }
.stat-alert .stat-num { color: var(--danger); }
.admin-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.admin-row:first-child { border-top: none; }
.admin-row-main { flex: 1; }
.swatch { width: 20px; height: 20px; border-radius: 5px; }
.channel-group { margin-bottom: 14px; }
.report-row { display: flex; flex-direction: column; padding: 8px 0; border-top: 1px solid var(--line); }
.report-row:first-child { border-top: none; }
.user-card { }
.user-card.banned { opacity: 0.7; }
.user-top { margin-bottom: 12px; }
.user-id { display: flex; align-items: center; gap: 12px; color: var(--text); }
.user-id:hover { text-decoration: none; }
.user-actions { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; }
.user-actions select, .user-actions input { width: auto; }
.user-badges { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.user-badges select { width: auto; }
.report-card.resolved { opacity: 0.7; }
.report-reason { font-weight: 500; }
.report-quote { background: var(--bg); border-radius: var(--radius-sm); padding: 10px 14px; margin-top: 8px; }

/* Search */
.search-form { display: flex; gap: 10px; align-items: center; }
.search-form input { flex: 1; margin-top: 0; }
.search-row { display: block; padding: 12px 16px; border-top: 1px solid var(--line); color: var(--text); }
.search-row:first-child { border-top: none; }
.search-row:hover { background: var(--bg); text-decoration: none; }
.search-title { font-weight: 600; }
.search-snippet { font-size: 0.88rem; margin-top: 3px; }
mark { background: rgba(22, 163, 74, 0.22); color: inherit; padding: 0 2px; border-radius: 3px; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); background: var(--surface); padding: 24px 0; color: var(--muted); font-size: 0.88rem; }
.site-footer .container { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.foot-links { display: flex; gap: 16px; }
