/* Site theme - the look built in Koder, for every site on the app template (dev.admin/inc/shared/app).
   Applies inside .site-theme (the body of a site that uses it, or the Theme editor's preview) and is driven by the
   --th-* variables (every rule is :is(body, .th-preview).site-theme ... so it outranks a site's own CSS,
   and Koder's inside the editor): the defaults below are Koder's, a site's own changes (Koder: Apps > Theme) come after them as
   :root{--th-...} (app_theme_style()). The :root block is generated from APP_THEME (inc/shared/app/theme.inc):
   php -r 'require "theme.inc"; echo app_theme_defaults_css();' - app_theme_selfcheck() checks it matches. */

:root {
	--th-bg: #020919;
	--th-bg-2: #04132c;
	--th-glow-1: #153b8655;
	--th-glow-2: #073c6b45;
	--th-grid: #46baff12;
	--th-text: #e6f3ff;
	--th-muted: #8aa4c4;
	--th-accent: #4edaff;
	--th-primary: #3788ef;
	--th-link: #4edaff;
	--th-line: #46baff24;
	--th-line-2: #46baff47;
	--th-glow: #4edaff40;
	--th-font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Lato", sans-serif;
	--th-font-size: 14px;
	--th-title-size: 26px;
	--th-title-weight: 650;
	--th-title-color: #e6f3ff;
	--th-title-line-1: #4edaff;
	--th-title-line-2: #3788ef;
	--th-title-line-3: #3788ef4d;
	--th-title-line-h: 2px;
	--th-title-glow: #4edaff40;
	--th-panel: #0a1c3c8c;
	--th-card-2: #14346466;
	--th-card-border: #46baff24;
	--th-card-radius: 10px;
	--th-panel-2: #102852a6;
	--th-card-title: #8aa4c4;
	--th-card-title-line: #46baff24;
	--th-card-icon-bg: #3788ef33;
	--th-card-icon: #e6f3ff;
	--th-card-accent: #3788ef;
	--th-panel-line: #46baff24;
	--th-card-row-line: #46baff14;
	--th-card-row-2: #ffffff05;
	--th-card-row-hover: #46baff14;
	--th-panel-text-2: #b9cbe0;
	--th-panel-on: #3788ef;
	--th-tag-bg: #46baff1f;
	--th-tag-text: #b9cbe0;
	--th-side-btn: #0a1c3cb3;
	--th-side-btn-text: #e6f3ff;
	--th-bar-w: 64px;
	--th-bar-1: #061634eb;
	--th-bar-2: #030c1ef0;
	--th-bar-line: #46baff24;
	--th-logo-size: 42px;
	--th-logo-glow: #007bff59;
	--th-icon: #8aa4c4;
	--th-icon-hover: #e6f3ff;
	--th-tile-hover: #3788ef24;
	--th-tile-on-1: #3788ef52;
	--th-tile-on-2: #3788ef24;
	--th-icon-on: #f5fbff;
	--th-icon-on-glow: #4edaffb3;
	--th-pill: #4edaff;
	--th-menu-bg: #061634f5;
	--th-tbl-bg: #0410268c;
	--th-tbl-row: #14346438;
	--th-tbl-row-2: #285aa029;
	--th-tbl-head: #071731;
	--th-tbl-head-text: #50cfff;
	--th-tbl-hover: #4edaff24;
	--th-tbl-on-1: #2f7fe8;
	--th-tbl-on-2: #1d55c4;
	--th-tbl-del: #d84d4f;
	--th-input-bg: #041026cc;
	--th-input-text: #e6f3ffeb;
	--th-input-border: #0f2a4d;
	--th-input-focus: #4f7ee6;
	--th-label: #8aa4c4;
	--th-placeholder: #8aa4c4aa;
	--th-chk-bg: #06112a;
	--th-chk-on: #3788ef;
	--th-chk-border: #2a4a73;
	--th-ks-bg: #041026cc;
	--th-ks-pop: #071731;
	--th-ks-hover: #4edaff24;
	--th-ks-on: #3788ef99;
	--th-range-on: #3788ef;
	--th-range-off: #46baff2e;
	--th-range-thumb: #3788ef;
	--th-btn-1: #3d95ff;
	--th-btn-2: #1f5fd6;
	--th-btn-hover: #52a6ff;
	--th-btn-text: #ffffff;
	--th-btn-ring: #4edaff29;
	--th-btn-gray: #102852a6;
	--th-btn-gray-hover: #16345f;
	--th-btn-gray-text: #e6f3ff;
	--th-btn-radius: 6px;
	--th-login-bg: #020919;
	--th-login-sky-1: #07549a;
	--th-login-sky-2: #041a38;
	--th-login-card: #06142eb8;
	--th-login-line: #46baff47;
	--th-login-glow: #4edaff40;
	--th-login-logo-glow: #007bff30;
	--th-login-title: #f5fbff;
	--th-login-text: #e6f3ff;
	--th-login-muted: #8aa4c4;
	--th-login-input: #041026cc;
	--th-login-btn-1: #3d95ff;
	--th-login-btn-2: #1f5fd6;
	--th-login-btn-hover: #52a6ff;
	--th-login-btn-ring: #4edaff2e;
	--th-login-accent: #4edaff;
	--th-modal-1: #08193a;
	--th-modal-2: #050f24;
	--th-modal-border: #46baff47;
	--th-modal-head: #e6f3ff;
	--th-modal-head-bg: #0b1d3d;
	--th-modal-body: #071631;
	--th-modal-actions: #050f26;
	--th-modal-close: #8aa4c4;
	--th-modal-close-hover: #4edaff;
	--th-tab-bg: #46baff0f;
	--th-tab-hover: #46baff1f;
	--th-tab-text: #8aa4c4;
	--th-tab-on-bg: #3788ef29;
	--th-tab-on-text: #e6f3ff;
	--th-tab-on-top: #4edaff;
	--th-tab-line: #46baff24;
	--th-modal-line: #46baff24;
	--th-menu: #071731;
}

/* ---------------------------------------------------------------- page */
html:has(body.site-theme) { background: var(--th-bg); color-scheme: dark; font-size: var(--th-font-size); }
:is(body.site-theme, .th-preview) {
	/* the names the shared kui / admin styles read */
	--prime: var(--th-primary); --prime-less: color-mix(in srgb, var(--th-primary) 33%, transparent); --prime-light: color-mix(in srgb, var(--th-primary) 15%, transparent);
	--blue: var(--th-primary); --ux-blue: var(--th-primary); --highlight: var(--th-accent); --a-link: var(--th-link);
	--chk-background: var(--th-chk-bg); --chk-background-checked: var(--th-chk-on); --chk-border: var(--th-chk-border); --chk-border-hover: var(--th-accent); --chk-tick: #fff; --chk-label: var(--th-text);
	--rad-background: var(--th-chk-bg); --rad-checked-background: var(--th-chk-on); --rad-border: var(--th-chk-border); --rad-border-hover: var(--th-accent); --rad-label: var(--th-text);
	background:
		radial-gradient(ellipse at 78% 0%, var(--th-glow-1), transparent 55%),
		radial-gradient(ellipse at 10% 85%, var(--th-glow-2), transparent 60%),
		linear-gradient(155deg, var(--th-bg), var(--th-bg-2) 58%, var(--th-bg));
	background-color: var(--th-bg);
	color: var(--th-text);
	font-family: var(--th-font);
	font-size: var(--th-font-size);
}
body.site-theme { background-attachment: fixed; min-height: 100dvh; margin: 0; }
/* the splash grid, faint and fixed behind the page */
body.site-theme::before {
	content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
	background-image: linear-gradient(var(--th-grid) 1px, transparent 1px), linear-gradient(90deg, var(--th-grid) 1px, transparent 1px);
	background-size: 80px 80px;
	mask-image: radial-gradient(ellipse at 60% 30%, black, transparent 75%);
}
body.site-theme.admin_page main { position: relative; z-index: 1; background: transparent; }
body.site-theme.admin_page:has(#appbar.app-bar) main { margin-left: var(--th-bar-w); width: auto; }
body.site-theme.admin_page.mobile:has(#appbar.app-bar) main { margin-left: 0; padding-bottom: 90px; }
/* the page's width from the first frame: admin.css gives it 96% only once system.breakpoint has added .desktop (over
   1280px), so the page loaded full width and then jumped in. Same breakpoint here, without waiting for the script. */
@media (min-width: 1281px) { body.site-theme.admin_page:not(.mobile, .tablet) #page_wrap { width: 96%; margin-inline: auto; } }
/* no weight: a link that sets its own color keeps it (the shared CSS reads --a-link too) */
:where(body.site-theme, .th-preview.site-theme) :where(a:not(.btn, .app, .func, .app-logo)) { color: var(--th-link); }
/* kui sets the checkbox colors on dark forms / modals, nearer the box than the body: set them there too */
:is(body, .th-preview).site-theme :is(.ui.form.dark, .ui.modal.dark, form.kui.dark, .kui.modal.dark) {
	--chk-background: var(--th-chk-bg); --chk-background-checked: var(--th-chk-on); --chk-border: var(--th-chk-border); --chk-border-hover: var(--th-accent); --chk-label: var(--th-text);
	--rad-background: var(--th-chk-bg); --rad-checked-background: var(--th-chk-on); --rad-border: var(--th-chk-border); --rad-border-hover: var(--th-accent); --rad-label: var(--th-text);
}
:is(body, .th-preview).site-theme .divider { border-top-color: var(--th-line); }
:is(body, .th-preview).site-theme .ux-tabs { margin-bottom: 30px; border-bottom-color: var(--th-tab-line); }
:is(body, .th-preview).site-theme .ux-tabs a { background-color: var(--th-tab-bg); color: var(--th-tab-text); border-top-color: var(--th-tab-line); text-shadow: none; }
:is(body, .th-preview).site-theme .ux-tabs a.active { background-color: var(--th-tab-on-bg); color: var(--th-tab-on-text); border-top-color: var(--th-tab-on-top); }
@media (hover: hover) { :is(body, .th-preview).site-theme .ux-tabs a:not(.active):hover { background-color: var(--th-tab-hover); color: var(--th-tab-on-text); } }
/* small gray bits of the shared admin UI: the muted text color */
:is(body, .th-preview).site-theme :is(.tblc.kft.del, .kselect .kft.x, .kselect i.arrow, .subToggle.kft, a.input.kft.x):before { color: var(--th-muted); }
/* a row's delete X stays red on hover, whatever the theme (Tables > Delete Hover) */
:is(body, .th-preview).site-theme .tblc.kft.del:is(:hover, .th-hover):before { color: var(--th-tbl-del); }
:is(body, .th-preview).site-theme .min { color: var(--th-muted); }
:is(body, .th-preview).site-theme .actionBtns { border-color: var(--th-line); }

/* Page title: a thin gradient rule under it */
:is(body, .th-preview).site-theme .page_title {
	font-family: var(--th-font); font-size: var(--th-title-size); font-weight: var(--th-title-weight);
	letter-spacing: -.02em; color: var(--th-title-color); padding-bottom: 10px; position: relative;
}
:is(body, .th-preview).site-theme .page_title::after {
	content: ""; position: absolute; left: 0; bottom: 0;
	width: calc(100% + 30px);	/* the whole title (it is max-content wide) and 30px past it */
	height: var(--th-title-line-h); border-radius: 2px;
	background: linear-gradient(90deg, var(--th-title-line-1), var(--th-title-line-2) 50%, var(--th-title-line-3));
	box-shadow: 0 0 22px var(--th-title-glow);
}

/* ---------------------------------------------------------------- buttons */
/* centred with flex and never narrower than their label; :where() keeps .none / .dskhide able to hide them */
:where(.site-theme) .btn { display: flex; align-items: center; justify-content: center; line-height: 1; white-space: nowrap; min-width: max-content; max-width: 100%; }
:where(.site-theme) .btn:where(:not(.kft.text, .pi10, .pi20, .pi30)) { padding-inline: 16px; }
:where(.site-theme) .btn > i.kft { flex: 0 0 36px; height: 100%; margin-left: -12px; }
:is(body, .th-preview).site-theme .btn:not(.round, .clr) { border-radius: var(--th-btn-radius); }
:is(body, .th-preview).site-theme .btn-primary {
	background: linear-gradient(180deg, var(--th-btn-1), var(--th-btn-2)); color: var(--th-btn-text); text-shadow: none;
	box-shadow: inset 0 1px 0 rgba(255,255,255,.18), 0 0 0 1px var(--th-btn-ring);
}
:is(body, .th-preview).site-theme .btn-primary:is(:focus, :active) { background: linear-gradient(180deg, var(--th-btn-hover), var(--th-btn-2)); box-shadow: 0 0 0 4px var(--th-btn-ring); }
:is(body, .th-preview).site-theme .btn-gray { background-color: var(--th-btn-gray); border: 1px solid var(--th-line); text-shadow: none; color: var(--th-btn-gray-text); }
:is(body, .th-preview).site-theme .submenuBtn .subToggle { background-color: var(--th-menu); border: 0; }
:is(body, .th-preview).site-theme .submenuBtn button.btn-gray { border-right: 0; }
@media (hover: hover) {
	:is(body, .th-preview).site-theme .btn-primary:hover { background: linear-gradient(180deg, var(--th-btn-hover), var(--th-btn-2)); box-shadow: 0 0 0 4px var(--th-btn-ring), 0 0 22px var(--th-glow); }
	:is(body, .th-preview).site-theme .btn-gray:hover { background-color: var(--th-btn-gray-hover); border-color: var(--th-line-2); box-shadow: none; }
	:is(body, .th-preview).site-theme .submenuBtn .subToggle:hover { background-color: var(--th-btn-gray-hover); }
}

/* ---------------------------------------------------------------- tables: glass panels with a hairline */
/* .lined lists (a card's rows, ul.lined.table_wrap) aren't tables: no box, no row colors - the card shows through;
   a row only tints on hover (Cards > Card Row Hover, in the site's own card CSS) */
:is(body, .th-preview).site-theme .table_wrap:not(.lined) { box-shadow: 0 0 0 1px var(--th-line), 0 18px 40px -24px rgba(0,0,0,.8); background: var(--th-tbl-bg); backdrop-filter: blur(6px); }
:is(body, .th-preview).site-theme .table_wrap.sml-shadow:not(.lined) { box-shadow: 0 0 0 1px var(--th-line); }
:is(body, .th-preview).site-theme .tbl:not(.lined *) { background-color: var(--th-tbl-row); }
:is(body, .th-preview).site-theme .table_wrap .tbl:not(.ftr, .lined *):nth-child(2n) { background-color: var(--th-tbl-row-2); }
:is(body, .th-preview).site-theme .tbl:is(.hdr, .ftr), :is(body, .th-preview).site-theme .tbl.hdr.sticky { background-color: var(--th-tbl-head); }
:is(body, .th-preview).site-theme .tbl.hdr .tblc { color: var(--th-tbl-head-text); font-weight: 600; letter-spacing: .02em; }
/* in layer core: the shared hover (admin-table.css) is !important inside layer tbl, and for !important an earlier layer wins */
@layer core {
	:is(body, .th-preview).site-theme .tbl:not(.none, .hdr, .ftr, .lined *):hover,
	:is(body, .th-preview).site-theme .table_wrap .tbl:not(.none, .hdr, .ftr, .lined *):nth-child(2n):hover,
	:is(body, .th-preview).site-theme .tbl.hvr_active { background-color: var(--th-tbl-hover) !important; }
	/* a card's rows: the shared hover stays off them too (the row's own div tints, Card Row Hover) */
	:is(body, .th-preview).site-theme .lined .tbl:not(.none, .hdr, .ftr):hover,
	:is(body, .th-preview).site-theme .lined.table_wrap .tbl:not(.none, .hdr, .ftr):nth-child(2n):hover { background-color: transparent !important; }
}
:is(body, .th-preview).site-theme .tbl.active { background: linear-gradient(180deg, var(--th-tbl-on-1), var(--th-tbl-on-2)); }

/* ---------------------------------------------------------------- forms, kselect */
:is(body, .th-preview).site-theme form.kui {
	--input-background-color: var(--th-input-bg); --input-border: var(--th-input-border); --border-focus: var(--th-input-focus);
	--input-color: var(--th-input-text); --label-color: var(--th-label); --input-placeholder: var(--th-placeholder);
}
/* and on the fields themselves, for a site (or Koder, around the editor) that colors them directly */
:is(body, .th-preview).site-theme form.kui :is(input:not([type=checkbox], [type=radio], [type=hidden], [type=color], [type=range]), textarea) { background-color: var(--th-input-bg); color: var(--th-input-text); }
:is(body, .th-preview).site-theme .kselect { --background: var(--th-ks-bg); --input-border: var(--th-input-border); }
/* sliders: the filled side (On) up to the value, the rest (Off), the notch; --th-fill is set by app_theme_style()'s script.
   A plain box first - kui's field padding / border / height stopped the notch short of both ends */
:is(body, .th-preview).site-theme input[type=range] {
	-webkit-appearance: none; appearance: none; height: 22px; margin: 0; padding: 0; border: 0; border-radius: 0;
	background: transparent; box-shadow: none; cursor: pointer; --th-fill: 50%;
}
:is(body, .th-preview).site-theme input[type=range]::-webkit-slider-runnable-track {
	height: 4px; border-radius: 2px; background: linear-gradient(to right, var(--th-range-on) var(--th-fill), var(--th-range-off) var(--th-fill));
}
:is(body, .th-preview).site-theme input[type=range]::-webkit-slider-thumb {
	-webkit-appearance: none; appearance: none; width: 16px; height: 16px; margin-top: -6px; border: 0; border-radius: 50%;
	background: var(--th-range-thumb); box-shadow: 0 1px 3px rgba(0,0,0,.4); transition: box-shadow .15s ease;
}
:is(body, .th-preview).site-theme input[type=range]:is(:hover, :focus-visible)::-webkit-slider-thumb { box-shadow: 0 0 0 4px color-mix(in srgb, var(--th-range-thumb) 30%, transparent); }
:is(body, .th-preview).site-theme input[type=range]::-moz-range-track { height: 4px; border-radius: 2px; background: var(--th-range-off); }
:is(body, .th-preview).site-theme input[type=range]::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--th-range-on); }
:is(body, .th-preview).site-theme input[type=range]::-moz-range-thumb { width: 16px; height: 16px; border: 0; border-radius: 50%; background: var(--th-range-thumb); }
:is(body, .th-preview).site-theme :is(.ks.popover, .th-ks-pop) {
	--pop-background: var(--th-ks-pop); --kpop-border-color: var(--th-input-focus); --item-color: var(--th-text);
	--item-hover-background: var(--th-ks-hover); --item-selected-background: var(--th-ks-on);
	--item-selected-hover-background: color-mix(in srgb, var(--th-ks-on) 80%, white);
}

/* ---------------------------------------------------------------- modals, submenus */
:is(body, .th-preview).site-theme .kui.modal.dark { background: linear-gradient(180deg, var(--th-modal-1), var(--th-modal-2)); box-shadow: 0 0 0 1px var(--th-modal-border), 0 30px 80px -20px rgba(0,0,0,.9); }
:is(body, .th-preview).site-theme .kui.modal.dark .header { color: var(--th-modal-head); background-color: var(--th-modal-head-bg); border-bottom-color: var(--th-modal-line); }
/* div.cnt: the confirm box's message (system.confirm, #confirm); .actions: the Cancel / Update row */
:is(body, .th-preview).site-theme .kui.modal.dark :is(div.content, div.cnt) { background-color: var(--th-modal-body); }
:is(body, .th-preview).site-theme .kui.modal.dark .actions { background-color: var(--th-modal-actions); border-top-color: var(--th-modal-line); }
:is(body, .th-preview).site-theme .kui.modal.dark .kft.close:before { color: var(--th-modal-close); }
:is(body, .th-preview).site-theme .kui.modal.dark .kft.close:hover:before { color: var(--th-modal-close-hover); }
:is(body, .th-preview).site-theme .submenu { background-color: var(--th-menu); box-shadow: 0 0 0 1px var(--th-line-2), 0 20px 40px -10px rgba(0,0,0,.8); }

/* ---------------------------------------------------------------- app bar: a glass rail with the logo on top
   inc/shared/app/appbar.inc: the same #appbar hooks as the admin's (system.appbar_init), class .app-bar.
   #appbar in the selector: the admin's appbar.css styles it as ".admin #appbar"; .th-preview is the Theme editor's copy */
:is(.site-theme #appbar.app-bar, .th-preview .app-bar) {
	display: flex; flex-direction: column; align-items: center; width: var(--th-bar-w);
	background: linear-gradient(180deg, var(--th-bar-1), var(--th-bar-2));
	border-right: 1px solid var(--th-bar-line); box-shadow: 8px 0 30px -18px rgba(0,0,0,.9); backdrop-filter: blur(10px);
}
:is(body, .th-preview).site-theme #appbar.app-bar { position: fixed; top: 0; left: 0; height: 100%; z-index: 1001; }
:is(.site-theme #appbar.app-bar, .th-preview .app-bar) .app-logo { display: grid; place-items: center; width: var(--th-bar-w); height: 70px; flex: 0 0 auto; border-bottom: 1px solid var(--th-bar-line); }
:is(.site-theme #appbar.app-bar, .th-preview .app-bar) .app-logo img {
	width: var(--th-logo-size); height: var(--th-logo-size); object-fit: contain;
	filter: drop-shadow(0 0 10px var(--th-logo-glow)); transition: transform .25s ease, filter .25s ease;
}
@media (hover: hover) { :is(.site-theme #appbar.app-bar, .th-preview .app-bar) .app-logo:hover img { transform: scale(1.07); filter: drop-shadow(0 0 16px var(--th-glow)); } }
:is(.site-theme #appbar.app-bar, .th-preview .app-bar) .apps { display: flex; flex-direction: column; align-items: center; gap: 4px; padding-top: 12px; width: 100%; }
:is(.site-theme #appbar.app-bar, .th-preview .app-bar) a.app {
	position: relative; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 13px;
	border: 0; outline: none; cursor: pointer; background-color: transparent; transition: background-color .2s ease, box-shadow .2s ease;
}
:is(.site-theme #appbar.app-bar, .th-preview .app-bar) a.app i { display: grid; place-items: center; width: 46px; height: 46px; }
:is(.site-theme #appbar.app-bar, .th-preview .app-bar) .kft:not(.loading):before { font-size: 22px; color: var(--th-icon); transition: color .2s ease, text-shadow .2s ease; }
:is(.site-theme #appbar.app-bar, .th-preview .app-bar) .kft.s20:before { font-size: 19px; }
:is(.site-theme #appbar.app-bar, .th-preview .app-bar) .kft.s22:before { font-size: 20px; }
:is(.site-theme #appbar.app-bar, .th-preview .app-bar) .kft.s24:before { font-size: 21px; }
:is(.site-theme #appbar.app-bar, .th-preview .app-bar) .kft.loading::after { width: 18px; height: 18px; border-width: 3px; top: 50%; left: 50%; margin: -9px; }
@media (hover: hover) {
	:is(.site-theme #appbar.app-bar, .th-preview .app-bar) a.app:hover { background-color: var(--th-tile-hover); border: 0; }
	:is(.site-theme #appbar.app-bar, .th-preview .app-bar) a.app:hover .kft:before { color: var(--th-icon-hover); }
}
:is(.site-theme #appbar.app-bar, .th-preview .app-bar) a.app:focus-visible { box-shadow: 0 0 0 2px var(--th-accent); }
/* the current page: a lit tile plus a pill on the rail's edge */
:is(.site-theme #appbar.app-bar, .th-preview .app-bar) a.app.selected { background: linear-gradient(180deg, var(--th-tile-on-1), var(--th-tile-on-2)); box-shadow: inset 0 0 0 1px var(--th-line-2); border: 0; }
:is(.site-theme #appbar.app-bar, .th-preview .app-bar) a.app.selected .kft:before { color: var(--th-icon-on); text-shadow: 0 0 12px var(--th-icon-on-glow); }
:is(.site-theme #appbar.app-bar, .th-preview .app-bar) .apps > a.app.selected::before {
	content: ""; position: absolute; left: calc((var(--th-bar-w) - 46px) / -2 + 2px); top: 11px; bottom: 11px; width: 3px;
	border-radius: 0 3px 3px 0; background: var(--th-pill); box-shadow: 0 0 10px var(--th-pill);
}
:is(.site-theme #appbar.app-bar, .th-preview .app-bar) .appbar-div { width: 30px; margin: 6px 0; border-bottom: 1px solid var(--th-bar-line); }
:is(.site-theme #appbar.app-bar, .th-preview .app-bar) span.label {
	position: absolute; top: 3px; right: 3px; min-width: 16px; height: 16px; line-height: 16px; padding: 0 4px; border-radius: 8px;
	background: var(--th-accent); color: var(--th-bg); font-size: 10px; font-weight: 700;
}
:is(body, .th-preview).site-theme #appbar.app-bar #appbar-bottom { position: fixed; bottom: 10px; left: 0; width: var(--th-bar-w); display: flex; flex-direction: column; align-items: center; gap: 4px; }
/* toggle menus (Links, Settings ...): a floating glass strip beside the rail */
:is(.site-theme #appbar.app-bar, .th-preview .app-bar) .apps .horiz_menu {
	display: none; position: fixed; left: calc(var(--th-bar-w) + 8px); bottom: auto;	/* system.appbar_init sets top */
	height: auto; white-space: nowrap; width: max-content; padding: 4px; border-radius: 15px;
	background: var(--th-menu-bg); box-shadow: 0 0 0 1px var(--th-line-2), 0 20px 50px -14px rgba(0,0,0,.9); backdrop-filter: blur(10px);
}
:is(.site-theme #appbar.app-bar, .th-preview .app-bar) .horiz_menu a.app { display: inline-grid; vertical-align: top; }
/* phones: the rail becomes a bottom bar */
body.site-theme.mobile #appbar.app-bar {
	top: auto; bottom: 0; width: 100%; height: calc(60px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
	flex-direction: row; border-right: 0; border-top: 1px solid var(--th-bar-line);
}
body.site-theme.mobile #appbar .app-logo { width: 46px; height: 60px; border: 0; flex: 0 0 46px; }
body.site-theme.mobile #appbar .app-logo img { width: 32px; height: 32px; }
body.site-theme.mobile #appbar .apps { flex: 1; min-width: 0; flex-direction: row; gap: 0; padding: 0 4px 0 0; justify-content: space-between; }
body.site-theme.mobile #appbar a.app, body.site-theme.mobile #appbar a.app i { width: 40px; height: 44px; }
body.site-theme.mobile #appbar .appbar-div { display: none; }
body.site-theme.mobile #appbar .apps > a.app.selected::before { display: none; }
body.site-theme.mobile #appbar #appbar-bottom { position: static; width: auto; flex-direction: row; }
body.site-theme.mobile .app-bar .apps .horiz_menu { left: 8px; bottom: calc(68px + env(safe-area-inset-bottom)); top: auto !important; }


/* ---------------------------------------------------------------- the Theme editor's previews (Koder: Apps > Theme)
   Each is a .site-theme.th-preview box with the editor's values on it as --th-*; stand-ins for what only shows on hover
   or in the open state (.th-hover, the open select list, a modal in place) */
.th-preview { position: relative; border-radius: 12px; padding: 18px; min-height: 260px; overflow: hidden; box-shadow: 0 0 0 1px var(--th-line); }
.th-preview p { margin: 10px 0; }
.th-preview .th-muted { color: var(--th-muted); }
.th-preview .page_title { display: inline-block; }
.th-preview .th-cards-wrap { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 12px; }
.th-preview .th-side { display: flex; flex-direction: column; gap: 8px; }
.th-preview .th-side a { display: block; padding: 3px 10px; border-radius: 5px; background: var(--th-side-btn); color: var(--th-side-btn-text); white-space: nowrap; }
.th-preview .th-side a.th-hover { background: var(--th-card-accent); }
.th-preview .th-cards { display: grid; gap: 12px; }
.th-preview .th-card {
	background: linear-gradient(210deg, var(--th-panel) 20%, var(--th-card-2) 60%); border-radius: var(--th-card-radius);
	box-shadow: 0 0 0 1px var(--th-card-border); border: 1px solid transparent; color: var(--th-text); overflow: hidden;
}
.th-preview .th-card.on { border-color: color-mix(in srgb, var(--th-panel-on) 45%, transparent); }
.th-preview .th-card-title { display: flex; align-items: center; gap: 10px; padding: 0 12px; line-height: 40px; font-weight: bold; color: var(--th-card-title); border-bottom: 1px solid var(--th-card-title-line); }
.th-preview .th-card-icon { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--th-card-icon-bg); }
.th-preview .th-card-icon:before { color: var(--th-card-icon); font-size: 14px; }
.th-preview .th-card-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; border-bottom: 1px solid var(--th-card-row-line); padding: 8px 12px; color: var(--th-text); border-radius: 5px; }
.th-preview .th-card-row:nth-child(2n+1) { background: var(--th-card-row-2); }
.th-preview .th-card-row.th-hover { background: var(--th-card-row-hover); }
.th-preview .th-tag { display: inline-block; font-size: 11px; text-transform: uppercase; padding: 0 8px; line-height: 21px; border-radius: 6px; background: var(--th-tag-bg); color: var(--th-tag-text); }
.th-preview .th-tag.on { background: var(--th-card-accent); color: #fff; font-weight: bold; }
.th-preview .th-card-raised { background: var(--th-panel-2); border-radius: 8px; padding: 10px; margin: 10px 12px 12px; color: var(--th-panel-text-2); }
.th-preview.th-appbar { display: flex; gap: 14px; align-items: flex-start; padding: 0; }
.th-preview .app-bar.th-bar { position: relative; height: 330px; flex: 0 0 auto; }
/* the same :is() as the rail's own rules, which carry #appbar's weight - a plainer selector lost to their transparent tile */
:is(.site-theme #appbar.app-bar, .th-preview .app-bar) a.app.th-hover { background-color: var(--th-tile-hover); }
:is(.site-theme #appbar.app-bar, .th-preview .app-bar) a.app.th-hover .kft:not(.loading):before { color: var(--th-icon-hover); }
.th-preview .th-bar-menu.horiz_menu { display: flex; position: static; margin-top: 140px; padding: 4px; border-radius: 15px; background: var(--th-menu-bg); box-shadow: 0 0 0 1px var(--th-line-2); }
.th-preview .th-bar-menu a.app { display: grid; place-items: center; width: 46px; height: 46px; }
.th-preview .th-bar-menu .kft:before { font-size: 22px; color: var(--th-icon); }
.th-preview .th-ks .selected-item { padding: 0 12px; height: 36px; display: flex; align-items: center; justify-content: space-between; color: var(--th-input-text); }
.th-preview .th-ks-pop { display: block; margin-top: 4px; border-radius: 5px; background: var(--pop-background); box-shadow: 0 0 0 2px var(--kpop-border-color); }
.th-preview .th-ks-pop .item.th-hover { background-color: var(--item-hover-background); }
.th-preview .th-ks-pop .item.active { color: var(--item-selected-color, var(--th-text)); background-color: var(--item-selected-background); }
.th-preview .th-buttons { display: flex; flex-wrap: wrap; gap: 12px; }
.th-preview .th-modal.kui.modal { position: relative; top: auto; left: auto; transform: none; opacity: 1; pointer-events: auto; width: auto; max-width: none; display: flex; flex-direction: column; }
.th-preview .th-modal .content { padding: 14px 18px; }
.th-preview .th-submenu.submenu { display: block; position: static; margin-top: 16px; width: max-content; border-radius: 6px; padding: 4px 0; }
.th-preview .th-submenu a { display: block; padding: 8px 16px; color: var(--th-text); }
.th-preview .th-modal .ux-tabs { margin-bottom: 14px; }
.th-preview .th-modal .ux-tabs a { min-width: 0; padding: 0 14px; }
.th-preview .th-modal .ux-tabs a.th-tab-hover { background-color: var(--th-tab-hover); color: var(--th-tab-on-text); }
/* the Login tab: the login page (app.css) in small, from the same --th-login-* values */
.th-preview.th-login { padding: 0; }
.th-preview .th-login { display: grid; place-items: center; padding: 28px 16px; min-height: 360px; background: radial-gradient(ellipse at 65% 25%, var(--th-login-sky-1), var(--th-login-sky-2) 50%, var(--th-login-bg)); }
.th-preview .th-login-card { width: 240px; padding: 22px 20px 18px; border-radius: 14px; text-align: center; background: var(--th-login-card); box-shadow: 0 0 0 1px var(--th-login-line), 0 30px 60px -24px rgba(0,0,0,.95), 0 0 22px var(--th-login-glow); backdrop-filter: blur(10px); color: var(--th-login-text); }
.th-preview .th-login-logo { display: block; margin: 0 auto; width: 64px; height: 64px; object-fit: contain; filter: drop-shadow(0 0 16px var(--th-login-logo-glow)); }
.th-preview .th-login-title { margin-top: 4px; font-size: 22px; font-weight: 650; letter-spacing: -.05em; color: var(--th-login-title); }
.th-preview .th-login-version { font-size: 10px; letter-spacing: .08em; color: var(--th-login-muted); }
.th-preview .th-login-field { margin-top: 14px; text-align: left; padding: 9px 10px; border-radius: 5px; background: var(--th-login-input); color: color-mix(in srgb, var(--th-login-text) 60%, transparent); font-size: 13px; }
.th-preview .th-login-btn { margin-top: 12px; padding: 9px; border-radius: 999px; font-size: 13px; color: #fff; background: linear-gradient(180deg, var(--th-login-btn-1), var(--th-login-btn-2)); box-shadow: inset 0 1px 0 rgba(255,255,255,.18), 0 0 0 1px var(--th-login-btn-ring); }
.th-preview .th-login-forgot { display: inline-block; margin-top: 12px; padding: 4px 12px; border-radius: 999px; font-size: 11px; color: #fff; border: 1px solid var(--th-login-accent); background: color-mix(in srgb, var(--th-login-accent) 12%, transparent); box-shadow: 0 0 22px var(--th-login-glow); }
