/* ==========================================================================
   TekBB refresh: the same layout, a calmer finish.
   Cards on a soft page, white rows with hairline dividers, a quiet column bar,
   badge icons, readable posts, light outline buttons, a readable footer, focus
   rings. Light and dark share the rules; only the tokens change.
   ========================================================================== */

html[data-bs-theme] {
	--rf-page: var(--tk-gray-20); --rf-card: var(--bs-white); --rf-row: var(--bs-white); --rf-row-2: var(--tk-gray-20); --rf-hover: var(--tk-slate-30);
	--rf-line: var(--tk-slate-70); --rf-line-2: var(--tk-slate-120); --rf-text: var(--tk-slate-870); --rf-muted: var(--tk-slate-530); --rf-faint: var(--tk-slate-400);
	--rf-bar: var(--tk-slate-50); --rf-bar-text: var(--tk-blue-600); --rf-link: var(--tk-indigo-700); --rf-soft: var(--tk-slate-60); --rf-quote: var(--tk-slate-30);
	--rf-shadow: 0 1px 2px color-mix(in srgb, var(--tk-indigo-930) 4%, transparent), 0 2px 8px color-mix(in srgb, var(--tk-indigo-930) 5%, transparent);
	--rf-ring: var(--tk-indigo-500); --rf-radius: 12px;
	--link: var(--tk-indigo-700);   /* TekBB links read this (color.css) */
}
html[data-bs-theme="dark"] {
	--rf-page: var(--tk-gray-950); --rf-card: var(--tk-slate-930); --rf-row: var(--tk-slate-930); --rf-row-2: var(--tk-slate-920); --rf-hover: var(--tk-slate-900);
	--rf-line: var(--tk-slate-830); --rf-line-2: var(--tk-slate-790); --rf-text: var(--tk-slate-70); --rf-muted: var(--tk-slate-350); --rf-faint: var(--tk-slate-470);
	--rf-bar: var(--tk-slate-910); --rf-bar-text: var(--tk-slate-310); --rf-link: var(--tk-indigo-250); --rf-soft: var(--tk-indigo-860); --rf-quote: var(--tk-slate-900);
	--rf-shadow: 0 1px 2px rgba(var(--bs-black-rgb), 0.4), 0 4px 14px rgba(var(--bs-black-rgb), 0.25);
	--rf-ring: var(--tk-indigo-280);
	--link: var(--tk-indigo-250);
}

/* Page and type */
html[data-bs-theme] body { background: var(--rf-page); color: var(--rf-text); -webkit-font-smoothing: antialiased; }
html[data-bs-theme] .smalltext { color: var(--rf-muted); }
html[data-bs-theme] :is(a, button, input, select, textarea, [tabindex]):focus-visible { outline: 2px solid var(--rf-ring); outline-offset: 2px; border-radius: 6px; }

/* Header: links in soft pills */
html[data-bs-theme] .site-navbar .nav-link { border-radius: 8px; font-weight: 500; color: var(--tk-slate-250); transition: background .15s, color .15s; }
html[data-bs-theme] .site-navbar .nav-link:hover, html[data-bs-theme] .site-navbar .nav-link:focus { background: rgba(var(--bs-white-rgb), 0.07); color: var(--bs-white); }

/* Welcome panel: a faint wash of the brand colours */
html[data-bs-theme] #panel .upper {
	background: linear-gradient(120deg, color-mix(in srgb, var(--primary) 9%, var(--rf-card)), color-mix(in srgb, var(--secondary) 7%, var(--rf-card)));
	border-bottom: 1px solid var(--rf-line); color: var(--rf-muted); padding: 22px 0;
}
html[data-bs-theme] #panel .upper h3 { color: var(--rf-text); font-weight: 600; font-size: 1.55rem; margin: 0 0 4px; }
html[data-bs-theme] #panel .upper h4 { color: var(--rf-text); font-weight: 600; }
html[data-bs-theme] #panel .upper h5 { color: var(--rf-muted); font-weight: 400; font-size: 14.5px; margin: 0 0 14px; }
html[data-bs-theme] #panel .upper .btn { border-radius: 8px; font-weight: 500; }
html[data-bs-theme] .avatar img { border-radius: 14px !important; border: 0 !important; box-shadow: 0 0 0 1px var(--rf-line-2); }

/* Breadcrumb: no box, the page title stands out */
html[data-bs-theme] .navigation { background: transparent; border: 0; padding: 0; margin: 26px 0 18px; color: var(--rf-faint); font-size: 13px; }
html[data-bs-theme] .navigation a { color: var(--rf-muted); }
html[data-bs-theme] .navigation .active, html[data-bs-theme] .navigation h4, html[data-bs-theme] .navigation h5 { color: var(--rf-text); font-weight: 600; }

/* Cards */
html[data-bs-theme] .tborder { background: var(--rf-card); border: 1px solid var(--rf-line); border-radius: var(--rf-radius); overflow: hidden; box-shadow: var(--rf-shadow); margin-bottom: 22px; }
html[data-bs-theme] .tborder > .thead, html[data-bs-theme] .thead { border-radius: 0; padding: 13px 18px; font-size: 15px; letter-spacing: .01em; }
html[data-bs-theme] .thead h5, html[data-bs-theme] .thead h3 { margin: 0; font-size: 15px; font-weight: 700; }
html[data-bs-theme] .tcat { background: var(--rf-bar); color: var(--rf-bar-text); border-bottom: 1px solid var(--rf-line); font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; padding: 9px 18px; }
html[data-bs-theme] .tcat a:link, html[data-bs-theme] .tcat a:visited { color: var(--rf-bar-text); }
html[data-bs-theme] .trow1, html[data-bs-theme] .trow2 { background: var(--rf-row); color: var(--rf-text); border: 0; border-bottom: 1px solid var(--rf-line); }
html[data-bs-theme] .trow_sep { background: var(--rf-row-2); color: var(--rf-bar-text); font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; border: 0; border-bottom: 1px solid var(--rf-line); padding: 8px 18px; }
html[data-bs-theme] .tfoot { background: var(--rf-row-2); border-top: 1px solid var(--rf-line); color: var(--rf-text); }
html[data-bs-theme] .tfoot a:link, html[data-bs-theme] .tfoot a:visited, html[data-bs-theme] .tfoot strong { color: var(--rf-link); }
html[data-bs-theme] .rowbit { transition: background .15s; }
html[data-bs-theme] .tbody > .rowbit:hover, html[data-bs-theme] .inline_row:hover { background: var(--rf-hover); }

/* Cards made of several pieces: the board statistics, and a thread (title bar, posts, bottom bar) */
html[data-bs-theme] main .row:has(> .thead) { background: var(--rf-card); border: 1px solid var(--rf-line); border-radius: var(--rf-radius); overflow: hidden; box-shadow: var(--rf-shadow); margin-bottom: 22px; }
html[data-bs-theme] .tborder.tfixed:has(> .thead:only-child) { border-bottom: 0; border-radius: var(--rf-radius) var(--rf-radius) 0 0; margin-bottom: 0; box-shadow: none; }
html[data-bs-theme] #posts_container { background: var(--rf-card); border: 1px solid var(--rf-line); border-top: 0; border-bottom: 0; }
html[data-bs-theme] #posts_container + .tfoot { border: 1px solid var(--rf-line); border-radius: 0 0 var(--rf-radius) var(--rf-radius); margin: 0 0 22px; box-shadow: var(--rf-shadow); }
html[data-bs-theme] #posts .post:last-child { border-bottom: 0; }

/* Forum rows: a badge for the icon, a clear title, quiet details */
html[data-bs-theme] .tbody > .rowbit { padding-top: 14px; padding-bottom: 14px; }
html[data-bs-theme] .rowbit h5 { font-size: 15.5px; font-weight: 600; margin: 0 0 3px; }
html[data-bs-theme] .rowbit > .forum_status { font-size: 17px !important; }
html[data-bs-theme] .rowbit > .forum_status i {
	display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px; border-radius: 12px;
	background: var(--rf-soft); color: var(--rf-link);
}
html[data-bs-theme] .rowbit > .forum_status.forum_off i, html[data-bs-theme] .rowbit > .forum_status.forum_offclose i,
html[data-bs-theme] .rowbit > .forum_status.forum_offlink i { background: var(--rf-bar); color: var(--rf-faint); }
html[data-bs-theme] .forumbit_subforums, html[data-bs-theme] .subforumicon { color: var(--rf-faint); }

/* Thread list */
html[data-bs-theme] .threadbit_title { font-weight: 600; }
html[data-bs-theme] .author, html[data-bs-theme] .thread_start_datetime { color: var(--rf-muted); }
html[data-bs-theme] .threadbit_stats { color: var(--rf-muted); font-variant-numeric: tabular-nums; }

/* Posts */
html[data-bs-theme] .post { background: var(--rf-card); border-bottom: 1px solid var(--rf-line-2); }
html[data-bs-theme] .post .post_author { background: var(--rf-row-2); border: 0; border-bottom: 1px solid var(--rf-line); padding: 14px 18px; }
html[data-bs-theme] .post .post_author div.author_avatar img { border-radius: 12px; border: 0; padding: 0; box-shadow: 0 0 0 1px var(--rf-line-2); background: var(--rf-card); }
html[data-bs-theme] .post .post_author .largetext a { font-size: 16px; font-weight: 700; }
html[data-bs-theme] .post .post_author div.author_statistics { color: var(--rf-muted); font-size: 12px; line-height: 1.6; }
html[data-bs-theme] .post .post_head { border: 0; padding: 12px 18px 0; color: var(--rf-faint); }
html[data-bs-theme] .post .post_head span.post_date { color: var(--rf-faint); font-size: 12.5px; }
html[data-bs-theme] .post_body { background: transparent; color: var(--rf-text); font-size: 15px; line-height: 1.7; padding: 10px 18px 18px; }
html[data-bs-theme] .post_controls { background: transparent; border: 0; border-top: 1px solid var(--rf-line); padding: 10px 14px; }
html[data-bs-theme] .postbit_buttons > a:link, html[data-bs-theme] .postbit_buttons > a:visited {
	background: var(--rf-card); color: var(--rf-text); border: 1px solid var(--rf-line-2); border-radius: 8px; padding: 4px 11px; font-size: 13px; font-weight: 500;
	transition: border-color .15s, color .15s, background .15s;
}
html[data-bs-theme] .postbit_buttons > a:hover { border-color: var(--rf-link); color: var(--rf-link); background: var(--rf-soft); }
html[data-bs-theme] .postbit_buttons > a span::before, html[data-bs-theme] .postbit_buttons > a i { color: inherit; }

/* Quotes and code */
html[data-bs-theme] blockquote, html[data-bs-theme] .mycode_quote {
	background: var(--rf-quote); border: 0; border-left: 3px solid var(--primary); border-radius: 8px; padding: 10px 14px; margin: 8px 0 14px; color: var(--rf-text);
}
html[data-bs-theme] blockquote cite, html[data-bs-theme] .mycode_quote cite {
	display: block; border: 0; padding: 0 0 6px; margin: 0 0 6px; font-size: 12.5px; font-style: normal; font-weight: 600; color: var(--rf-muted); background: transparent;
}
html[data-bs-theme] blockquote blockquote { background: var(--rf-card); }
html[data-bs-theme] .codeblock { background: var(--rf-row-2); border: 1px solid var(--rf-line); border-radius: 8px; }

/* Buttons, fields, pages */
html[data-bs-theme] input.button, html[data-bs-theme] button.button, html[data-bs-theme] .button {
	background: var(--rf-card); color: var(--rf-text); border: 1px solid var(--rf-line-2); border-radius: 8px; padding: 6px 13px; font-weight: 500;
}
html[data-bs-theme] input.button:hover, html[data-bs-theme] .button:hover { border-color: var(--rf-link); color: var(--rf-link); }
html[data-bs-theme] input.textbox, html[data-bs-theme] select, html[data-bs-theme] textarea {
	background: var(--rf-card); color: var(--rf-text); border: 1px solid var(--rf-line-2); border-radius: 8px; padding: 6px 10px;
}
html[data-bs-theme] :is(input.textbox, select, textarea):focus { border-color: var(--rf-ring); box-shadow: 0 0 0 3px color-mix(in srgb, var(--rf-ring) 22%, transparent); outline: 0; }
html[data-bs-theme] .pagination a, html[data-bs-theme] .pagination .pagination_current {
	border-radius: 8px; border: 1px solid var(--rf-line-2); background: var(--rf-card); padding: 4px 10px; margin: 0 2px;
}
html[data-bs-theme] .pagination .pagination_current { background: linear-gradient(90deg, var(--primary), var(--secondary)); border-color: transparent; color: var(--bs-white); }
html[data-bs-theme] .pagination .pages { color: var(--rf-muted); }

/* Board statistics: the gradient band, rounded with its card */
html[data-bs-theme] .stat-card h3 { font-weight: 700; font-variant-numeric: tabular-nums; }
html[data-bs-theme] .stat-card h5 { opacity: .9; font-weight: 500; }

/* Footer: readable */
html[data-bs-theme] #footer { background: var(--tk-slate-930); border-top: 1px solid var(--tk-slate-860); }
html[data-bs-theme] #footer .foot h3 { color: var(--tk-gray-30); font-size: 18px; font-weight: 600; margin-bottom: 0; }
html[data-bs-theme] #footer .foot p { color: var(--tk-slate-270); }
html[data-bs-theme] #footer .btn { border-radius: 8px; }
html[data-bs-theme] #copyright { background: var(--tk-gray-950); color: var(--tk-slate-340); }

/* The thread list's title bar sits just outside its card */
html[data-bs-theme] .thead:has(.threadlist_thread_option) { border-radius: var(--rf-radius) var(--rf-radius) 0 0; }

/* MyBB's dialogs (jQuery Modal) are the one frame; the card inside them, and a card inside another card, draws none */
html[data-bs-theme] .blocker .modal, html[data-bs-theme] .modal[style*="inline-block"] {
	padding: 0; border: 1px solid var(--rf-line); border-radius: var(--rf-radius); overflow: hidden; background: var(--rf-card);
	box-shadow: 0 20px 50px color-mix(in srgb, var(--tk-indigo-930) 30%, transparent);
}
html[data-bs-theme] .modal .tborder, html[data-bs-theme] .tborder .tborder { border: 0; border-radius: 0; box-shadow: none; margin: 0; }
html[data-bs-theme] .modal .thead { padding-right: 52px; }
html[data-bs-theme] .modal a.close-modal { top: 12px; right: 12px; width: 26px; height: 26px; background-size: contain; z-index: 2; }

/* Headings with a collapse arrow: the title and the arrow on one centred line */
html[data-bs-theme] .thead:has(> .expcolimage) { display: flex; align-items: center; gap: 10px; }
html[data-bs-theme] .thead:has(> .expcolimage) > :not(.expcolimage) { margin: 0; }
html[data-bs-theme] .thead > .expcolimage { order: 2; margin-left: auto; float: none; display: flex; align-items: center; }
html[data-bs-theme] .thead > .expcolimage img { position: static !important; top: auto !important; display: block; }

/* Selected for moderation: a tinted row with a coloured edge, no padding added */
html[data-bs-theme] { --rf-selected: var(--tk-yellow-20); --rf-selected-edge: var(--tk-yellow-220); }
html[data-bs-theme="dark"] { --rf-selected: var(--tk-stone-840); --rf-selected-edge: var(--tk-yellow-400); }
html[data-bs-theme] .post.trow_selected { background: var(--rf-selected); padding: 0; box-shadow: inset 4px 0 0 var(--rf-selected-edge); }
html[data-bs-theme] .post.trow_selected .post_author, html[data-bs-theme] .post.trow_selected .post_body, html[data-bs-theme] .post.trow_selected .post_controls { background: transparent; }
html[data-bs-theme] .inline_row.trow_selected, html[data-bs-theme] .inline_row.trow_selected > * { background: var(--rf-selected); }
html[data-bs-theme] .inline_row.trow_selected { box-shadow: inset 4px 0 0 var(--rf-selected-edge); }

/* Bootstrap's close button keeps its own look: the theme's button styles (gradient, dark fill) are not for it */
html[data-bs-theme] .btn-close { background: transparent var(--bs-btn-close-bg) center / 1em auto no-repeat; border: 0; border-radius: .375rem; box-shadow: none; color: var(--bs-btn-close-color); width: 1em; height: 1em; padding: .25em; }
html[data-bs-theme] .btn-close:hover { background-color: transparent; opacity: var(--bs-btn-close-hover-opacity); }

/* Light mode: a light header and footer (dark mode keeps the dark bars above) */
html[data-bs-theme="light"] .site-navbar { background: var(--bs-white); border-bottom: 1px solid var(--tk-gray-100); box-shadow: 0 1px 3px rgba(var(--bs-black-rgb), 0.04); }
html[data-bs-theme="light"] .site-navbar .nav-link, html[data-bs-theme="light"] .theme-mode-toggle { color: var(--tk-slate-530); }
html[data-bs-theme="light"] .site-navbar .nav-link:hover, html[data-bs-theme="light"] .site-navbar .nav-link:focus, html[data-bs-theme="light"] .site-navbar .nav-link.show { background: var(--tk-slate-50); color: var(--primary); }
html[data-bs-theme="light"] .theme-mode-toggle:hover, html[data-bs-theme="light"] .theme-mode-toggle:focus-visible { color: var(--primary); }
html[data-bs-theme="light"] .site-navbar .navbar-toggler { border-color: var(--tk-gray-120); }
html[data-bs-theme="light"] .site-navbar .navbar-toggler:focus { box-shadow: 0 0 0 2px rgba(var(--bs-black-rgb), 0.1); }
html[data-bs-theme="light"] #footer { background: var(--tk-gray-20); border-top: 1px solid var(--tk-gray-100); color: var(--tk-slate-530); }
html[data-bs-theme="light"] #footer .foot h3 { color: var(--tk-gray-790); }
html[data-bs-theme="light"] #footer .foot p { color: var(--tk-slate-530); }
html[data-bs-theme="light"] #copyright { background: var(--tk-slate-70); color: var(--tk-slate-530); }
#copyright .copyright-mybb { color: var(--bs-white); }
html[data-bs-theme="light"] #copyright .copyright-mybb { color: var(--tk-gray-790); font-weight: 600; }

/* Dark mode: the header takes the theme's own dark surface, as the footer and panels do */
html[data-bs-theme="dark"] .site-navbar { background: var(--rf-card); border-bottom: 1px solid var(--rf-line); }
html[data-bs-theme="dark"] .site-navbar .navbar-toggler { border-color: var(--rf-line-2); }
/* The header's menus: the theme's surface and lines in both modes, not Bootstrap's grey */
html[data-bs-theme] .site-navbar .dropdown-menu { --bs-dropdown-bg: var(--rf-card); --bs-dropdown-border-color: var(--rf-line); --bs-dropdown-link-color: var(--rf-text); --bs-dropdown-link-hover-bg: var(--rf-hover); --bs-dropdown-link-hover-color: var(--rf-text); border-radius: 10px; box-shadow: var(--rf-shadow); padding: 6px; }
html[data-bs-theme] .site-navbar .dropdown-item { border-radius: 6px; }

/* The guest welcome: the brand mark, a short welcome, Register as the main action and Login beside it */
html[data-bs-theme] .guest-welcome { display: flex; align-items: center; gap: 16px 24px; text-align: left; }
html[data-bs-theme] .guest-welcome-icon { flex: 0 0 auto; width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; background: linear-gradient(135deg, var(--primary), var(--secondary)); color: var(--bs-white); font-size: 26px; box-shadow: 0 6px 18px color-mix(in srgb, var(--secondary) 28%, transparent); }
html[data-bs-theme] .guest-welcome-text { flex: 1 1 auto; min-width: 0; }
html[data-bs-theme] #panel .upper .guest-welcome-hello { margin: 0 0 2px; line-height: 1.4; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--secondary); }
html[data-bs-theme] #panel .upper .guest-welcome h3 { margin: 0 0 4px; font-size: 1.45rem; }
html[data-bs-theme] #panel .upper .guest-welcome-lead { margin: 0; color: var(--rf-muted); font-size: 14.5px; line-height: 1.55; max-width: 62ch; }
html[data-bs-theme] .guest-welcome-actions { flex: 0 0 auto; display: flex; flex-wrap: wrap; gap: 10px; }
html[data-bs-theme] #panel .upper .guest-welcome-join { background: linear-gradient(90deg, var(--primary), var(--secondary)); color: var(--bs-white); border: 0; padding: 9px 18px; box-shadow: 0 4px 14px color-mix(in srgb, var(--secondary) 25%, transparent); }
html[data-bs-theme] #panel .upper .guest-welcome-join:hover, html[data-bs-theme] #panel .upper .guest-welcome-join:focus-visible { filter: brightness(1.08); color: var(--bs-white); }
html[data-bs-theme] #panel .upper .guest-welcome-login { background: var(--rf-card); color: var(--rf-text); border: 1px solid var(--rf-line-2); padding: 8px 18px; }
html[data-bs-theme] #panel .upper .guest-welcome-login:hover, html[data-bs-theme] #panel .upper .guest-welcome-login:focus-visible { border-color: var(--rf-link); color: var(--rf-link); }
@media (max-width: 767.98px) {
	html[data-bs-theme] .guest-welcome { flex-direction: column; text-align: center; }
	html[data-bs-theme] #panel .upper .guest-welcome-lead { margin: 0 auto; }
	html[data-bs-theme] .guest-welcome-actions { justify-content: center; }
}

/* The cookie notice: a card fixed to the bottom of the window until it is accepted */
html[data-bs-theme] .cookie-notice { position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 1080; display: flex; justify-content: center; opacity: 0; transform: translateY(16px); transition: opacity .25s, transform .25s; pointer-events: none; }
html[data-bs-theme] .cookie-notice[hidden] { display: none; }
html[data-bs-theme] .cookie-notice.is-shown { opacity: 1; transform: none; pointer-events: auto; }
html[data-bs-theme] .cookie-notice-inner { width: 100%; max-width: 880px; display: flex; align-items: center; gap: 12px 18px; padding: 14px 18px; background: var(--rf-card); color: var(--rf-text); border: 1px solid var(--rf-line); border-radius: 14px; box-shadow: 0 10px 30px rgba(var(--bs-black-rgb), 0.18); }
html[data-bs-theme] .cookie-notice-inner > .bi { flex: 0 0 auto; font-size: 26px; line-height: 1; color: var(--secondary); }
html[data-bs-theme] .cookie-notice-inner p { flex: 1 1 auto; margin: 0; text-align: left; font-size: 14px; line-height: 1.5; color: var(--rf-muted); }
html[data-bs-theme] .cookie-notice-inner a { color: var(--rf-link); font-weight: 600; }
html[data-bs-theme] .cookie-notice .cookie-notice-accept { flex: 0 0 auto; background: linear-gradient(90deg, var(--primary), var(--secondary)); color: var(--bs-white); border: 0; border-radius: 8px; padding: 8px 22px; font-weight: 600; }
html[data-bs-theme] .cookie-notice .cookie-notice-accept:hover, html[data-bs-theme] .cookie-notice .cookie-notice-accept:focus-visible { filter: brightness(1.08); color: var(--bs-white); }
@media (max-width: 575.98px) {
	html[data-bs-theme] .cookie-notice { left: 10px; right: 10px; bottom: 10px; }
	html[data-bs-theme] .cookie-notice-inner { flex-wrap: wrap; }
	html[data-bs-theme] .cookie-notice .cookie-notice-accept { width: 100%; }
}

/* Collapse arrows on the light section bars (User CP / Mod CP menus): MyBB's white arrow turns grey in light mode */
html[data-bs-theme="light"] .tcat .expcolimage img { filter: brightness(0) opacity(.45); }
