/* ==========================================================================
   Obsidian — a clean modern theme layer for LuCI
   Loaded AFTER cascade.css (the functional bootstrap base). This file only
   re-skins: design tokens, frosted glass chrome, wallpaper, motion and the
   Control Center. Functional widget behaviour stays with the base.
   Licensed under the Apache License 2.0.
   ========================================================================== */

/* ----------------------------------------------------------------------------
   1. Design tokens
   The bootstrap base derives almost every colour from a small set of HSL
   custom properties. We override those plus add Obsidian's own tokens.
---------------------------------------------------------------------------- */
:root {
	/* Typeface — San Francisco where available, graceful CJK fallbacks */
	--ob-font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
		"Helvetica Neue", "Inter", "PingFang SC", "Hiragino Sans GB",
		"Microsoft YaHei UI", "Microsoft YaHei", system-ui, sans-serif;
	--ob-mono: ui-monospace, "SF Mono", "JetBrains Mono", "Menlo", "Consolas", monospace;

	/* Accent — monochrome by default (black in light / white in dark).
	   The Settings panel can switch to a Material-You seed colour, which
	   overrides --ob-accent* below. */
	--ob-accent: #0a0a0a;
	--ob-accent-rgb: 10, 10, 10;
	--ob-accent-press: #333333;
	--ob-accent-soft: #ececef;
	--ob-on-accent: #ffffff;

	/* Corner radii */
	--ob-radius-sm: 8px;
	--ob-radius: 9px;
	--ob-radius-lg: 12px;
	--ob-radius-xl: 16px;
	--ob-radius-pill: 980px;

	/* Content column width — adjustable from the Settings panel */
	--ob-content-width: 1320px;

	/* Surfaces (light) — clean white cards on a soft grey page */
	--ob-bg: #f2f2f5;
	--ob-card: #ffffff;
	--ob-card-2: #f3f3f6;
	--ob-card-strong: #ffffff;
	--ob-bar: rgba(248, 248, 250, .82);
	--ob-elevated: #ffffff;
	--ob-hairline: #e6e6ea;
	--ob-hairline-strong: #d6d6dc;
	--ob-fill: #f2f2f5;
	--ob-fill-hover: #e9e9ee;

	/* Text (light) */
	--ob-text: #0a0a0a;
	--ob-text-2: #47474d;
	--ob-text-3: #6c6c75;

	--ob-glass-blur: 12px;

	--ob-shadow-1: none;
	--ob-shadow-2: 0 10px 34px rgba(0, 0, 0, .14);
	--ob-ring: 0 0 0 0 transparent;

	/* Wallpaper — fixed background layer. Default matches the page bg. */
	--ob-wallpaper: linear-gradient(var(--ob-bg), var(--ob-bg));
	--ob-wallpaper-blur: 0px;
	--ob-wallpaper-dim: 0;
	--ob-wallpaper-scrim: 0;

	/* Easings */
	--ob-ease: cubic-bezier(.4, 0, .2, 1);
	--ob-spring: cubic-bezier(.16, 1, .3, 1);

	/* Re-tint EVERY base semantic colour to the accent, so LuCI's green
	   "save", blue "apply", red buttons, focus glow, labels and alerts all
	   become monochrome (and follow the Material-You accent when enabled). */
	--primary-color-high: var(--ob-accent);
	--primary-color-medium: var(--ob-accent);
	--primary-color-low: var(--ob-accent-press);
	--on-primary-color: var(--ob-on-accent);
	--success-color-high-rgb: var(--ob-accent-rgb);
	--success-color-high: var(--ob-accent);
	--success-color-medium: var(--ob-accent);
	--success-color-low: var(--ob-accent-press);
	--on-success-color: var(--ob-on-accent);
	--error-color-high-rgb: var(--ob-accent-rgb);
	--error-color-high: var(--ob-accent);
	--error-color-medium: var(--ob-accent);
	--error-color-low: var(--ob-accent-press);
	--on-error-color: var(--ob-on-accent);
	--warn-color-high: var(--ob-accent);
	--warn-color-medium: var(--ob-accent);
	--warn-color-low: var(--ob-accent-press);
	--on-warn-color: var(--ob-on-accent);
	--focus-color-rgb: var(--ob-accent-rgb);

	--background-color-s: 0%;
	--background-color-l: 100%;
	color-scheme: light;
}

/* Dark mode — pure black, white accent */
:root[data-darkmode="true"] {
	--ob-accent: #ffffff;
	--ob-accent-rgb: 255, 255, 255;
	--ob-accent-press: #d6d6d6;
	--ob-accent-soft: #262626;
	--ob-on-accent: #000000;

	--ob-bg: #050505;
	--ob-card: #121212;
	--ob-card-2: #1b1b1b;
	--ob-card-strong: #1e1e1e;
	--ob-bar: rgba(7, 7, 7, .82);
	--ob-elevated: #181818;
	--ob-hairline: #2e2e2e;
	--ob-hairline-strong: #3d3d3d;
	--ob-fill: #1b1b1b;
	--ob-fill-hover: #272727;

	--ob-text: #f5f5f5;
	--ob-text-2: #b4b4b4;
	--ob-text-3: #82828a;

	--ob-shadow-2: 0 10px 34px rgba(0, 0, 0, .7);

	--ob-wallpaper: linear-gradient(var(--ob-bg), var(--ob-bg));

	--background-color-l: 2%;
	color-scheme: dark;
}

/* ----------------------------------------------------------------------------
   2. Base & wallpaper
---------------------------------------------------------------------------- */
html {
	background: transparent;
	scroll-behavior: smooth;
}

body {
	font-family: var(--ob-font);
	color: var(--ob-text);
	background: transparent !important;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	letter-spacing: .1px;
	min-height: 100vh;
	margin: 0 !important;      /* base sets 5px padding → kills the full-bleed header */
	padding: 0 !important;
}

::selection { background: color-mix(in srgb, var(--ob-accent) 28%, transparent); }
* { accent-color: var(--ob-accent); }

/* The fixed wallpaper layer + readability scrims */
#ob-bg {
	position: fixed;
	inset: -4% -4% -4% -4%;
	z-index: -2;
	background-color: var(--ob-bg);                            /* fills letterbox / centre / tile gaps */
	background-image: var(--ob-wallpaper);
	background-size: var(--ob-wallpaper-size, cover);          /* fill / fit / stretch / tile / centre */
	background-position: center;
	background-repeat: var(--ob-wallpaper-repeat, no-repeat);
	filter: blur(var(--ob-wallpaper-blur)) saturate(1.08);
	transform: scale(1.06);
	transition: filter .45s var(--ob-ease), background-image .45s var(--ob-ease);
	will-change: filter;
}
#ob-bg-dim {
	position: absolute;
	inset: 0;
	background:
		linear-gradient(rgba(0, 0, 0, var(--ob-wallpaper-dim)), rgba(0, 0, 0, var(--ob-wallpaper-dim))),
		linear-gradient(rgba(255, 255, 255, var(--ob-wallpaper-scrim)), rgba(255, 255, 255, var(--ob-wallpaper-scrim)));
	transition: background .35s var(--ob-ease);
}

/* When a real wallpaper is chosen, surfaces turn to frosted glass so the
   image shows through (set via data-has-wallpaper by obsidian.js). Without
   a wallpaper everything stays solid for the clean monochrome look. */
:root[data-has-wallpaper] .cbi-section,
:root[data-has-wallpaper] .panel {
	background: color-mix(in srgb, var(--ob-card) 78%, transparent);
	-webkit-backdrop-filter: blur(22px) saturate(150%);
	backdrop-filter: blur(22px) saturate(150%);
}
:root[data-has-wallpaper] .tabs,
:root[data-has-wallpaper] .cbi-tabmenu {
	background: color-mix(in srgb, var(--ob-card-2) 72%, transparent);
	-webkit-backdrop-filter: blur(22px) saturate(150%);
	backdrop-filter: blur(22px) saturate(150%);
}
:root[data-has-wallpaper] .dropdown-menu {
	background: color-mix(in srgb, var(--ob-elevated) 86%, transparent);
	-webkit-backdrop-filter: blur(22px) saturate(150%);
	backdrop-filter: blur(22px) saturate(150%);
}
:root[data-has-wallpaper] .alert-message {
	background: color-mix(in srgb, var(--ob-card) 82%, transparent) !important;
	-webkit-backdrop-filter: blur(22px) saturate(150%);
	backdrop-filter: blur(22px) saturate(150%);
}

/* Slim, unobtrusive scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--ob-hairline-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb {
	background: var(--ob-hairline-strong);
	border-radius: 980px;
	border: 3px solid transparent;
	background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover { background: var(--ob-text-3); background-clip: padding-box; }
*::-webkit-scrollbar-track { background: transparent; }

/* ----------------------------------------------------------------------------
   3. Header — frosted top bar (macOS menu-bar vibe)
---------------------------------------------------------------------------- */
header {
	position: sticky;
	top: 0;
	z-index: 1000;
	display: flex;
	align-items: center;
	gap: 14px;
	width: 100%;
	box-sizing: border-box;
	min-height: 54px;
	padding: 0 max(20px, env(safe-area-inset-left)) 0 max(20px, env(safe-area-inset-left));
	margin: 0;
	background: var(--ob-bar);
	-webkit-backdrop-filter: saturate(120%) blur(var(--ob-glass-blur));
	backdrop-filter: saturate(120%) blur(var(--ob-glass-blur));
	border: none;
	border-bottom: 1px solid var(--ob-hairline);
	box-shadow: none;
}

header .brand {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	color: var(--ob-text);
	font-weight: 600;
	font-size: 16px;
	letter-spacing: .2px;
	padding: 6px 4px;
	text-decoration: none;
	border-radius: var(--ob-radius-sm);
	transition: opacity .2s var(--ob-ease);
}
header .brand:hover { opacity: .7; background: transparent; }
header .ob-brand-logo {
	width: 26px;
	height: 26px;
	border-radius: 7px;
	box-shadow: var(--ob-shadow-1);
	flex: 0 0 auto;
}

/* Top navigation (#topmenu .nav) → translucent pill items */
header .nav { margin: 0; display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
.nav > li { list-style: none; }
.nav a, .nav a.menu {
	display: inline-flex;
	align-items: center;
	color: var(--ob-text-2);
	font-size: 13.5px;
	font-weight: 500;
	padding: 7px 12px;
	border-radius: var(--ob-radius-pill);
	text-decoration: none;
	line-height: 1;
	transition: background .18s var(--ob-ease), color .18s var(--ob-ease);
}
.nav a:hover, .nav a.menu:hover { background: var(--ob-fill); color: var(--ob-text); }
.nav .active > a, .nav .active > a.menu {
	background: var(--ob-accent-soft);
	color: var(--ob-text);
}
/* Dropdown caret — base draws a white triangle nudged down by margin-top:8px,
   so it's invisible in light mode and not vertically centred. Fix both. */
.nav a.menu:after {
	margin-top: 0;
	margin-left: 6px;
	vertical-align: middle;
	border-top-color: var(--ob-text-3);
	opacity: 1;
}
.nav a.menu:hover:after, .nav .active > a.menu:after { border-top-color: var(--ob-text); }

/* Dropdown menus → solid floating panels, anchored right under the trigger
   so hovering down keeps them open (no click needed). */
.nav li.dropdown { position: relative; }
.nav .dropdown-menu, .dropdown-menu {
	position: absolute;
	top: 100%;                 /* base puts it at top:40px → big gap → hover dropped */
	z-index: 1200;
	background: var(--ob-elevated);
	border: 1px solid var(--ob-hairline);
	border-radius: var(--ob-radius-lg);
	box-shadow: var(--ob-shadow-2);
	padding: 6px;
	margin-top: 6px;
	min-width: 210px;
	overflow: visible;
}
/* Invisible bridge covering the small gap so the hover never collapses. */
.nav .dropdown-menu::before {
	content: "";
	position: absolute;
	top: -8px;
	left: 0;
	right: 0;
	height: 10px;
}
/* Click / tap also pins it open (touch fallback) — driven by obsidian.js. */
.nav li.dropdown.ob-open > .dropdown-menu,
.dropdown.ob-open > .dropdown-menu {
	display: block;
	left: 0;                   /* base parks closed menus at left:-9999px */
	animation: ob-pop .18s var(--ob-spring) both;
}
.dropdown-menu li { list-style: none; }
.dropdown-menu li a, .nav .dropdown-menu li a {
	display: block;
	color: var(--ob-text);
	padding: 8px 12px;
	border-radius: 6px;
	font-size: 13.5px;
	font-weight: 450;
	transition: background .12s var(--ob-ease);
}
.dropdown-menu li a:hover, .nav .dropdown-menu li a:hover {
	background: var(--ob-fill-hover);
	color: var(--ob-text);
}
.nav .dropdown-menu .active a { background: var(--ob-accent-soft); color: var(--ob-text); }
.dropdown:hover ul.dropdown-menu { animation: ob-pop .18s var(--ob-spring) both; }

#indicators { display: flex; align-items: center; gap: 8px; margin-left: auto; }
#indicators a, header [data-indicator] {
	color: var(--ob-text-2);
	font-size: 12.5px;
	font-weight: 500;
	padding: 5px 11px;
	border-radius: var(--ob-radius-pill);
	background: var(--ob-fill);
	border: none;
	text-decoration: none;
	transition: background .18s var(--ob-ease), transform .12s var(--ob-ease);
}
#indicators a:hover, header [data-indicator][data-clickable]:hover { background: var(--ob-fill-hover); }
#indicators a:active { transform: scale(.96); }
header [data-indicator][data-style="active"] {
	background: color-mix(in srgb, var(--ob-accent) 18%, transparent);
	color: var(--ob-accent);
}

/* ----------------------------------------------------------------------------
   4. Main content layout
---------------------------------------------------------------------------- */
/* The content column. Width follows the Settings value across ALL page shells:
   classic static pages (#maincontent.container / .container) AND client-rendered
   LuCI views, where #maincontent has no .container class and content lives in #view. */
#maincontent.container,
#maincontent,
#maincontent > #view,
.container {
	max-width: var(--ob-content-width);
	width: auto;
	margin: 0 auto;
	background: transparent;
}
#maincontent.container,
#maincontent,
.container {
	padding: 30px max(24px, env(safe-area-inset-left)) 96px;
}
#maincontent > #view { padding: 0; }

/* Inner LuCI wrappers must not re-cap the width, or some app pages (dockerman,
   appfilter, dropbear, status views) stay narrow even at 宽 / 全宽. The login
   card is re-asserted narrow further below. */
#maincontent #view,
#maincontent .cbi-map:not(.login),
#maincontent .cbi-section-node,
#maincontent .cbi-section-node-tabbed {
	max-width: none;
	width: auto;
}
#maincontent #view .container,
#maincontent #view .cbi-map > .container {
	max-width: 100%;
	width: auto;
	padding-left: 0;
	padding-right: 0;
}

/* Spacing between top-level elements (e.g. a lone "保存" button above a card) */
#maincontent > *, #view > *, .cbi-map > * { margin-top: 0; }
#maincontent .cbi-button-save, #maincontent .cbi-button-apply,
.cbi-map > .cbi-button, #view > .cbi-button { margin-bottom: 18px; }

h1, h2, h3, h4, h5, legend, .cbi-map-descr + h1 {
	color: var(--ob-text);
	font-weight: 650;
	letter-spacing: -.2px;
}
.cbi-map > h2, #maincontent > .cbi-map > h2, #view > * > h2, .cbi-map-tabbed + h2 {
	font-size: 26px;
	margin: 6px 0 4px;
}
.cbi-map-descr, .cbi-section-descr, p.cbi-section-descr {
	color: var(--ob-text-3);
	font-size: 13.5px;
}
a { color: var(--ob-accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }

/* ----------------------------------------------------------------------------
   5. Tab menu → segmented control
---------------------------------------------------------------------------- */
#tabmenu { margin: 14px 0 18px; }
.tabs, .cbi-tabmenu {
	display: inline-flex;
	flex-wrap: wrap;
	gap: 2px;
	padding: 3px;
	margin: 0 0 4px;
	border: none !important;
	border-radius: var(--ob-radius);
	background: var(--ob-card-2);
	box-shadow: inset 0 0 0 1px var(--ob-hairline);
	list-style: none;
	max-width: 100%;
}
/* Full reset of the base tab <li> (base caps it at max-width:48%, height:25px,
   border + 4px top radius — all of which cause the truncated "WebD…" text) */
.tabs > li, .cbi-tabmenu > li {
	list-style: none;
	display: flex;
	flex: 0 1 auto;
	max-width: none;
	height: auto;
	margin: 0;
	border: none !important;
	border-radius: 0;
	background: none !important;
	color: inherit;
}
.tabs > li > a, .cbi-tabmenu > li > a {
	display: inline-flex;
	align-items: center;
	color: var(--ob-text-2);
	font-size: 13px;
	font-weight: 550;
	padding: 6px 13px;
	border-radius: calc(var(--ob-radius) - 3px);
	text-decoration: none;
	white-space: nowrap;
	overflow: visible;
	text-overflow: clip;       /* base used ellipsis → cut the labels */
	line-height: 1.25;
	height: auto;
	transition: color .18s var(--ob-ease), background .18s var(--ob-ease), box-shadow .18s var(--ob-ease);
}
.tabs > li:not(.active):hover > a,
.cbi-tabmenu > li.cbi-tab-disabled:hover > a { color: var(--ob-text); background: var(--ob-fill); }
.tabs > li.active > a,
.cbi-tabmenu > li.cbi-tab > a {
	background: var(--ob-card-strong);
	color: var(--ob-text);
	box-shadow: inset 0 0 0 1px var(--ob-hairline-strong);
}
.cbi-tabmenu > li.cbi-tab-disabled > a { color: var(--ob-text-2); background: none; }

/* ----------------------------------------------------------------------------
   6. Sections / cards
---------------------------------------------------------------------------- */
.cbi-section,
.cbi-map > .cbi-section,
.cbi-section-node-tabbed,
#view fieldset.cbi-section,
.panel {
	position: relative;
	background: var(--ob-card);
	border: 1px solid var(--ob-hairline);
	border-radius: var(--ob-radius-lg);
	box-shadow: none;
	padding: 22px 26px;
	margin: 0 0 22px;
}
/* Avoid nested cards stacking up */
.cbi-section .cbi-section,
.cbi-section .cbi-section-node .cbi-section,
.cbi-section fieldset {
	background: transparent;
	-webkit-backdrop-filter: none;
	backdrop-filter: none;
	border: none;
	box-shadow: none;
	border-radius: 0;
	padding: 0;
	margin: 0 0 8px;
}
legend, .cbi-section > h3, .cbi-section-node + h3, .cbi-section > legend {
	font-size: 16px;
	font-weight: 650;
	padding: 0;
	margin: 0 0 14px;
	color: var(--ob-text);
}

/* Form rows → label on its own line above the field, left aligned
   (the base aligns the label right at 180px which collapses badly on
   narrow pages — these selectors are specific enough to win). */
.cbi-section .cbi-value,
.cbi-value {
	display: block;
	margin: 0;
	padding: 16px 0;
	border: none;
	border-bottom: 1px solid var(--ob-hairline);
	text-align: left;
}
.cbi-value:last-child, .cbi-value-last,
.cbi-section .cbi-value:last-of-type { border-bottom: none; }

.cbi-section .cbi-value label.cbi-value-title,
.cbi-value label.cbi-value-title,
.cbi-value-title {
	display: block;
	float: none;
	flex: none;
	width: auto;
	max-width: none;
	text-align: left;
	padding: 0;
	margin: 0 0 9px;
	color: var(--ob-text);
	font-weight: 550;
	font-size: 13px;
	line-height: 1.3;
}
.cbi-section .cbi-value .cbi-value-field,
.cbi-value .cbi-value-field,
.cbi-value-field {
	display: block;
	flex: none;
	width: 100%;
	min-width: 0;
	margin: 0;
}
/* Text-like inputs fill the column (capped) like a real settings form */
.cbi-value-field > input[type="text"],
.cbi-value-field > input[type="password"],
.cbi-value-field > input[type="search"],
.cbi-value-field > input[type="number"],
.cbi-value-field > select,
.cbi-value-field > textarea,
.cbi-value-field > .cbi-input-text,
.cbi-value-field > .cbi-dropdown {
	width: 100%;
	max-width: 560px;
}
.cbi-value-description {
	display: block;
	color: var(--ob-text-3);
	font-size: 12px;
	line-height: 1.4;
	margin: 7px 0 0;
}

/* ----------------------------------------------------------------------------
   7. Form controls — inputs, selects, textareas
---------------------------------------------------------------------------- */
input[type="text"], input[type="password"], input[type="search"], input[type="email"],
input[type="url"], input[type="number"], input[type="tel"], input[type="date"],
input[type="datetime-local"], input[type="time"], select, textarea,
.cbi-input-text, .cbi-input-password, .cbi-input-user, .cbi-input-ip,
.cbi-dynlist > .item, .cbi-dropdown {
	font-family: var(--ob-font);
	font-size: 13.5px;
	color: var(--ob-text);
	background: var(--ob-fill);
	border: 1px solid var(--ob-hairline);
	border-radius: var(--ob-radius-sm);
	padding: 8px 11px;
	min-height: 34px;
	box-shadow: none;
	outline: none;
	transition: border-color .18s var(--ob-ease), box-shadow .18s var(--ob-ease), background .18s var(--ob-ease);
	box-sizing: border-box;
}
textarea { line-height: 1.5; padding: 10px 12px; }
input::placeholder, textarea::placeholder { color: var(--ob-text-3); }

input[type="text"]:focus, input[type="password"]:focus, input[type="search"]:focus,
input[type="email"]:focus, input[type="url"]:focus, input[type="number"]:focus,
select:focus, textarea:focus, .cbi-input-text:focus, .cbi-dropdown:focus-within {
	background: var(--ob-card-strong);
	border-color: var(--ob-accent);
	box-shadow: 0 0 0 3.5px color-mix(in srgb, var(--ob-accent) 28%, transparent);
}

select {
	-webkit-appearance: none;
	appearance: none;
	padding-right: 30px;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2386868b' d='M1 1.5 6 6.5 11 1.5'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 11px center;
}

input[type="checkbox"], input[type="radio"] { width: 17px; height: 17px; cursor: pointer; }
input[type="range"] { accent-color: var(--ob-accent); }

/* Mono fields (code / textareas of configs) */
textarea.cbi-input-text, .cbi-input-textarea, pre, code, .cbi-section-table code {
	font-family: var(--ob-mono);
}

/* ----------------------------------------------------------------------------
   8. Buttons
---------------------------------------------------------------------------- */
.btn, .cbi-button, button, input[type="submit"], input[type="button"], input[type="reset"] {
	font-family: var(--ob-font);
	font-size: 13px;
	font-weight: 550;
	line-height: 1;
	color: var(--ob-text);
	background: var(--ob-fill);
	border: 1px solid var(--ob-hairline);
	border-radius: var(--ob-radius-sm);
	padding: 9px 16px;
	min-height: 34px;
	cursor: pointer;
	text-decoration: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	transition: transform .12s var(--ob-ease), background .18s var(--ob-ease),
		box-shadow .18s var(--ob-ease), filter .18s var(--ob-ease);
}
.btn:hover, .cbi-button:hover, button:hover,
input[type="submit"]:hover, input[type="button"]:hover { background: var(--ob-fill-hover); }
.btn:active, .cbi-button:active, button:active { transform: scale(.97); }

/* Focus → clean accent ring (base used a blue 82,168,236 glow). */
.btn:focus, .btn:focus-visible, .cbi-button:focus, .cbi-button:focus-visible,
button:focus, button:focus-visible,
.cbi-dropdown:focus, .cbi-dropdown[open],
input:focus, textarea:focus, select:focus, .cbi-dynlist > .item:focus,
.cbi-input-text:focus {
	--focus-color-rgb: var(--ob-accent-rgb);
	outline: none;
	border-color: var(--ob-accent) !important;
	box-shadow: 0 0 0 3px rgba(var(--ob-accent-rgb), .16) !important;
}
/* Hover must not glow (base applied the same blue ring on hover). */
.btn:hover, .cbi-button:hover, button:hover,
input:hover, textarea:hover, select:hover, .cbi-dropdown:hover {
	box-shadow: none !important;
	border-color: var(--ob-hairline) !important;
}

/* Primary / affirmative actions → filled accent. !important so the accent bg
   AND on-accent text always win together (base re-paints some of these with a
   higher-specificity rule, which previously left text the same colour as bg). */
.btn.primary, .cbi-button-action, .cbi-button-apply,
.cbi-button-positive, .cbi-button-add, .important,
.cbi-page-actions .cbi-button-apply {
	color: var(--ob-on-accent) !important;
	background: var(--ob-accent) !important;
	border-color: transparent !important;
	box-shadow: none;
}
.btn.primary:hover, .cbi-button-action:hover, .cbi-button-apply:hover,
.cbi-button-positive:hover, .cbi-button-add:hover {
	background: var(--ob-accent) !important;
	filter: brightness(1.06);
}

/* "保存" is a SECONDARY action. Base styles the save-after-apply with a neutral
   default background but accent/on-accent text → it ended up black-on-black.
   Force a readable neutral button on whatever background it lands. */
.cbi-button-save, input.cbi-button-save,
.cbi-page-actions .cbi-button-save,
.cbi-page-actions .cbi-button-apply + .cbi-button-save,
.cbi-page-actions .cbi-button-negative + .cbi-button-save {
	color: var(--ob-text) !important;
	background: var(--ob-fill) !important;
	border: 1px solid var(--ob-hairline) !important;
}
.cbi-button-save:hover, .cbi-page-actions .cbi-button-save:hover {
	background: var(--ob-fill-hover) !important;
}

/* Destructive actions → monochrome, emphasis comes from the outline on hover */
.cbi-button-remove, .cbi-button-reset, .cbi-button-negative, .btn.danger {
	color: var(--ob-text);
	background: var(--ob-fill);
	border: 1px solid var(--ob-hairline);
}
.cbi-button-remove:hover, .cbi-button-negative:hover,
.cbi-button-reset:hover, .btn.danger:hover {
	background: var(--ob-fill-hover);
	border-color: var(--ob-text);
}

.cbi-page-actions {
	display: flex;
	gap: 10px;
	flex-wrap: wrap;
	align-items: center;
	padding: 16px 0 0;
	margin-top: 6px;
	border-top: 1px solid var(--ob-hairline);
	background: transparent;
}
/* Base adds a clearfix ::after (display:table) + floats some children, which as
   flex items skew the row alignment (the tilted "复位"). Neutralize both. */
.cbi-page-actions::after { display: none !important; content: none !important; }
.cbi-page-actions > * { float: none !important; margin: 0 !important; vertical-align: middle; }

/* ----------------------------------------------------------------------------
   9. Tables
---------------------------------------------------------------------------- */
.table, table.cbi-section-table, table {
	width: 100%;
	border-collapse: separate;
	border-spacing: 0;
	background: transparent;
}
.th, .td, th, td {
	padding: 10px 12px;
	border: none;
	border-bottom: .5px solid var(--ob-hairline);
	font-size: 13px;
	color: var(--ob-text);
	text-align: left;
	vertical-align: middle;
}
.thead .th, thead th, .cbi-section-table-titles .th {
	color: var(--ob-text-3);
	font-weight: 600;
	font-size: 11.5px;
	text-transform: uppercase;
	letter-spacing: .4px;
	border-bottom: .5px solid var(--ob-hairline-strong);
}
.tr:last-child .td, tr:last-child td { border-bottom: none; }
.tr:hover, tbody tr:hover { background: var(--ob-fill); }
.tr.cbi-rowstyle-2, .cbi-rowstyle-2 { background: transparent; }
.tr.table-titles, .tr.cbi-section-table-titles { background: transparent; }
caption { color: var(--ob-text); font-weight: 650; text-align: left; padding: 0 0 10px; }

/* ----------------------------------------------------------------------------
   10. Alerts, notifications, badges
---------------------------------------------------------------------------- */
.alert-message, .notification {
	border: 1px solid var(--ob-hairline);
	border-left: 3px solid var(--ob-text);
	border-radius: var(--ob-radius);
	background: var(--ob-card) !important;
	box-shadow: none;
	color: var(--ob-text) !important;
	padding: 14px 18px;
}
.alert-message h4 { color: var(--ob-text); margin-top: 0; }
.alert-message.warning, .alert-message.notice,
.alert-message.error, .alert-message.danger,
.alert-message.success {
	border-left-color: var(--ob-text);
	background: var(--ob-card) !important;
}

.label, .badge, .ifacebadge {
	border-radius: var(--ob-radius-pill);
	padding: 3px 9px;
	font-size: 11.5px;
	font-weight: 600;
	background: var(--ob-fill);
	color: var(--ob-text-2);
	border: 1px solid var(--ob-hairline);
}
.label.success, .badge.success,
.label.warning, .label.notice {
	background: var(--ob-fill);
	color: var(--ob-text);
	border-color: var(--ob-hairline-strong);
}

/* Spinner tint */
.spinning::before { border-top-color: var(--ob-accent) !important; }

/* ----------------------------------------------------------------------------
   11. Footer
---------------------------------------------------------------------------- */
footer {
	margin: 0;
	padding: 22px 20px calc(28px + env(safe-area-inset-bottom));
	text-align: center;
	color: var(--ob-text-3);
	font-size: 12px;
	background: transparent;
	border: none;
}
footer a { color: var(--ob-text-2); }
footer .ob-footer-mark { font-weight: 600; color: var(--ob-text-3); }

/* ----------------------------------------------------------------------------
   12. Animations
---------------------------------------------------------------------------- */
@keyframes ob-rise {
	from { opacity: 0; transform: translateY(14px); }
	to   { opacity: 1; transform: translateY(0); }
}
@keyframes ob-pop {
	from { opacity: 0; transform: translateY(-6px) scale(.98); }
	to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes ob-fab-in {
	from { opacity: 0; transform: translateY(16px) scale(.85); }
	to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes ob-panel-in {
	from { opacity: 0; transform: translateX(28px) scale(.985); }
	to   { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes ob-scrim-in { from { opacity: 0; } to { opacity: 1; } }

#maincontent .cbi-section,
#maincontent > .cbi-map > .cbi-section,
#maincontent .panel,
#maincontent .alert-message {
	animation: ob-rise .55s var(--ob-spring) both;
}
#maincontent .cbi-section:nth-of-type(1) { animation-delay: .02s; }
#maincontent .cbi-section:nth-of-type(2) { animation-delay: .07s; }
#maincontent .cbi-section:nth-of-type(3) { animation-delay: .12s; }
#maincontent .cbi-section:nth-of-type(4) { animation-delay: .17s; }
#maincontent .cbi-section:nth-of-type(n+5) { animation-delay: .2s; }

/* ----------------------------------------------------------------------------
   13. Control Center — floating button + settings panel
---------------------------------------------------------------------------- */
#ob-fab {
	position: fixed;
	right: max(22px, env(safe-area-inset-right));
	bottom: max(22px, env(safe-area-inset-bottom));
	z-index: 4000;
	width: 52px;
	height: 52px;
	display: grid;
	place-items: center;
	border-radius: 50%;
	border: 1px solid var(--ob-hairline);
	background: var(--ob-elevated);
	color: var(--ob-accent);
	box-shadow: var(--ob-shadow-2);
	cursor: pointer;
	animation: ob-fab-in .5s var(--ob-spring) both .3s;
	transition: transform .2s var(--ob-spring), box-shadow .2s var(--ob-ease);
}
#ob-fab:hover { transform: translateY(-2px) scale(1.04); }
#ob-fab:active { transform: scale(.94); }
#ob-fab svg { width: 24px; height: 24px; }

#ob-scrim {
	position: fixed;
	inset: 0;
	z-index: 4001;
	background: rgba(0, 0, 0, .28);
	-webkit-backdrop-filter: blur(2px);
	backdrop-filter: blur(2px);
	opacity: 0;
	pointer-events: none;
	transition: opacity .3s var(--ob-ease);
}
#ob-scrim.ob-open { opacity: 1; pointer-events: auto; animation: ob-scrim-in .3s var(--ob-ease); }

#ob-panel {
	position: fixed;
	z-index: 4002;
	top: 0;
	right: 0;
	height: 100%;
	width: min(380px, 92vw);
	display: flex;
	flex-direction: column;
	background: var(--ob-card);
	border-left: 1px solid var(--ob-hairline);
	box-shadow: var(--ob-shadow-2);
	transform: translateX(102%);
	transition: transform .42s var(--ob-spring);
	padding: calc(18px + env(safe-area-inset-top)) 0 0;
}
#ob-panel.ob-open { transform: translateX(0); }

.ob-panel-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0 20px 14px;
	border-bottom: .5px solid var(--ob-hairline);
}
.ob-panel-title { font-size: 19px; font-weight: 700; color: var(--ob-text); letter-spacing: -.2px; }
.ob-panel-close {
	width: 30px; height: 30px;
	display: grid; place-items: center;
	border-radius: 50%;
	border: none;
	background: var(--ob-fill);
	color: var(--ob-text-2);
	cursor: pointer;
	font-size: 16px;
	transition: background .18s var(--ob-ease), transform .12s var(--ob-ease);
}
.ob-panel-close:hover { background: var(--ob-fill-hover); }
.ob-panel-close:active { transform: scale(.9); }

.ob-panel-body {
	flex: 1 1 auto;
	overflow-y: auto;
	padding: 18px 20px calc(26px + env(safe-area-inset-bottom));
	display: flex;
	flex-direction: column;
	gap: 22px;
}
.ob-group { display: flex; flex-direction: column; gap: 10px; }
.ob-group-label {
	font-size: 11.5px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .5px;
	color: var(--ob-text-3);
}

/* Segmented control */
.ob-seg {
	display: grid;
	grid-auto-flow: column;
	grid-auto-columns: 1fr;
	gap: 2px;
	padding: 3px;
	background: var(--ob-fill);
	border-radius: 11px;
}
.ob-seg button {
	border: none;
	background: transparent;
	color: var(--ob-text-2);
	font-size: 13px;
	font-weight: 550;
	padding: 7px 6px;
	border-radius: 8px;
	cursor: pointer;
	min-height: 32px;
	transition: color .18s var(--ob-ease), background .25s var(--ob-spring), box-shadow .2s var(--ob-ease);
}
.ob-seg button[aria-pressed="true"] {
	background: var(--ob-card-strong);
	color: var(--ob-text);
	box-shadow: inset 0 0 0 1px var(--ob-hairline-strong);
}

/* Accent swatches */
.ob-swatches { display: flex; flex-wrap: wrap; gap: 12px; }
.ob-swatch {
	width: 30px; height: 30px;
	border-radius: 50%;
	border: none;
	cursor: pointer;
	position: relative;
	box-shadow: var(--ob-ring), 0 1px 3px rgba(0, 0, 0, .2);
	transition: transform .18s var(--ob-spring);
}
.ob-swatch:hover { transform: scale(1.12); }
.ob-swatch[aria-pressed="true"] {
	box-shadow: 0 0 0 2.5px var(--ob-card), 0 0 0 4.5px currentColor;
}
.ob-swatch[aria-pressed="true"]::after {
	content: "";
	position: absolute;
	left: 50%; top: 46%;
	width: 11px; height: 6px;
	border-left: 2px solid #fff; border-bottom: 2px solid #fff;
	transform: translate(-50%, -50%) rotate(-45deg);
}
.ob-swatch-custom {
	display: grid; place-items: center;
	background: conic-gradient(red, magenta, blue, cyan, lime, yellow, red);
	color: #fff;
	overflow: hidden;
}
.ob-swatch-custom input[type="color"] {
	position: absolute; inset: 0; opacity: 0; cursor: pointer; border: none; padding: 0;
}

/* Wallpaper grid */
.ob-wp-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.ob-wp {
	aspect-ratio: 1 / 1.5;
	border-radius: 12px;
	border: none;
	cursor: pointer;
	position: relative;
	overflow: hidden;
	box-shadow: var(--ob-ring), 0 2px 8px rgba(0, 0, 0, .18);
	background-size: cover;
	background-position: center;
	transition: transform .18s var(--ob-spring);
}
.ob-wp:hover { transform: scale(1.05); }
.ob-wp[aria-pressed="true"] { box-shadow: 0 0 0 2.5px var(--ob-card), 0 0 0 4.5px var(--ob-accent); }
.ob-wp[aria-pressed="true"]::after {
	content: "✓";
	position: absolute; top: 4px; right: 5px;
	width: 18px; height: 18px;
	display: grid; place-items: center;
	font-size: 11px; font-weight: 800; color: #fff;
	background: var(--ob-accent);
	border-radius: 50%;
	box-shadow: 0 1px 3px rgba(0, 0, 0, .4);
}

.ob-wp-actions { display: flex; gap: 8px; }
.ob-field {
	flex: 1 1 auto;
	font-size: 13px;
	padding: 8px 11px;
	min-height: 34px;
	border-radius: var(--ob-radius-sm);
	border: 1px solid var(--ob-hairline);
	background: var(--ob-fill);
	color: var(--ob-text);
}
.ob-btn {
	font-size: 12.5px;
	font-weight: 550;
	padding: 8px 13px;
	min-height: 34px;
	border-radius: var(--ob-radius-sm);
	border: 1px solid var(--ob-hairline);
	background: var(--ob-fill);
	color: var(--ob-text);
	cursor: pointer;
	white-space: nowrap;
	transition: background .18s var(--ob-ease), transform .12s var(--ob-ease);
}
.ob-btn:hover { background: var(--ob-fill-hover); }
.ob-btn:active { transform: scale(.96); }
.ob-btn-accent { background: var(--ob-accent); color: var(--ob-on-accent); border-color: transparent; }

/* Sliders */
.ob-slider-row { display: flex; align-items: center; gap: 12px; }
.ob-slider-row label { flex: 0 0 64px; font-size: 13px; color: var(--ob-text-2); font-weight: 500; }
.ob-range {
	flex: 1 1 auto;
	-webkit-appearance: none;
	appearance: none;
	height: 6px;
	border-radius: 980px;
	background: var(--ob-fill);
	outline: none;
}
.ob-range::-webkit-slider-thumb {
	-webkit-appearance: none;
	width: 20px; height: 20px;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 1px 4px rgba(0, 0, 0, .3), 0 0 0 .5px rgba(0, 0, 0, .08);
	cursor: pointer;
	transition: transform .12s var(--ob-ease);
}
.ob-range::-webkit-slider-thumb:active { transform: scale(1.15); }
.ob-range::-moz-range-thumb {
	width: 20px; height: 20px; border: none; border-radius: 50%;
	background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .3); cursor: pointer;
}
.ob-range-val { flex: 0 0 40px; text-align: right; font-size: 12px; color: var(--ob-text-3); font-variant-numeric: tabular-nums; }

/* iOS-style switch */
.ob-switch-row {
	display: flex; align-items: center; justify-content: space-between;
	gap: 12px; padding: 4px 0;
}
.ob-switch-row span { font-size: 13.5px; color: var(--ob-text); font-weight: 450; }
.ob-switch { position: relative; width: 50px; height: 30px; flex: 0 0 auto; }
.ob-switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.ob-switch .ob-switch-track {
	position: absolute; inset: 0;
	background: var(--ob-fill-hover);
	border: 1px solid var(--ob-hairline);
	border-radius: 980px;
	transition: background .25s var(--ob-ease), border-color .25s var(--ob-ease);
}
.ob-switch .ob-switch-track::before {
	content: "";
	position: absolute; top: 2px; left: 2px;
	width: 24px; height: 24px;
	border-radius: 50%;
	background: var(--ob-text-3);          /* unchecked knob = muted */
	transition: transform .26s var(--ob-spring), background .25s var(--ob-ease);
}
.ob-switch input:checked + .ob-switch-track { background: var(--ob-accent); border-color: var(--ob-accent); }
.ob-switch input:checked + .ob-switch-track::before { transform: translateX(20px); background: var(--ob-on-accent); }

.ob-panel-foot { display: flex; gap: 10px; padding-top: 4px; }
.ob-panel-foot .ob-btn { flex: 1 1 auto; }

.ob-hint { font-size: 11.5px; color: var(--ob-text-3); line-height: 1.4; }

.ob-about-ver { font-size: 12.5px; color: var(--ob-text-2); font-variant-numeric: tabular-nums; }
.ob-about-link {
	display: inline-flex;
	align-items: center;
	font-size: 12.5px;
	font-weight: 550;
	color: var(--ob-accent);
	text-decoration: none;
	width: fit-content;
	padding: 2px 0;
}
.ob-about-link:hover { text-decoration: underline; text-underline-offset: 2px; }
:root[data-darkmode="true"] .ob-about-link { color: var(--ob-text); }

/* ----------------------------------------------------------------------------
   14. Login page polish
---------------------------------------------------------------------------- */
.cbi-map.login, form > .cbi-map:only-child, .node-main-login .cbi-section {
	max-width: 400px;
	margin: 8vh auto 0;
}

/* ----------------------------------------------------------------------------
   15. Accessibility — reduce transparency / reduce motion
---------------------------------------------------------------------------- */
:root[data-reduce-transparency] {
	--ob-card: var(--background-color-high, #fff);
	--ob-card-2: var(--background-color-high, #fff);
	--ob-card-strong: var(--background-color-high, #fff);
	--ob-bar: var(--background-color-high, #fff);
	--ob-elevated: var(--background-color-high, #fff);
}
:root[data-reduce-transparency][data-darkmode="true"] {
	--ob-card: #1c1c1e;
	--ob-card-2: #1c1c1e;
	--ob-card-strong: #2c2c2e;
	--ob-bar: #1c1c1e;
	--ob-elevated: #2c2c2e;
}
:root[data-reduce-transparency] header,
:root[data-reduce-transparency] .cbi-section,
:root[data-reduce-transparency] .dropdown-menu,
:root[data-reduce-transparency] .tabs,
:root[data-reduce-transparency] #ob-panel,
:root[data-reduce-transparency] #ob-fab,
:root[data-reduce-transparency] .alert-message {
	-webkit-backdrop-filter: none !important;
	backdrop-filter: none !important;
}
/* With BOTH a wallpaper and reduce-transparency, the wallpaper-glass rules use
   color-mix(..., transparent) which stays translucent regardless of the token —
   so force the surfaces fully solid again. */
:root[data-reduce-transparency][data-has-wallpaper] .cbi-section,
:root[data-reduce-transparency][data-has-wallpaper] .panel,
:root[data-reduce-transparency][data-has-wallpaper] .alert-message {
	background: var(--ob-card) !important;
}
:root[data-reduce-transparency][data-has-wallpaper] .tabs,
:root[data-reduce-transparency][data-has-wallpaper] .cbi-tabmenu {
	background: var(--ob-card-2) !important;
}
:root[data-reduce-transparency][data-has-wallpaper] .dropdown-menu {
	background: var(--ob-elevated) !important;
}

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after {
		animation-duration: .001ms !important;
		animation-delay: 0ms !important;
		transition-duration: .001ms !important;
		scroll-behavior: auto !important;
	}
}
:root[data-reduce-motion] *,
:root[data-reduce-motion] *::before,
:root[data-reduce-motion] *::after {
	animation-duration: .001ms !important;
	animation-delay: 0ms !important;
	transition-duration: .001ms !important;
}

/* ----------------------------------------------------------------------------
   16. Responsive
---------------------------------------------------------------------------- */
@media (max-width: 920px) {
	.cbi-value-title { flex-basis: 100%; max-width: none; }
	.cbi-value-field { flex-basis: 100%; }
}
@media (max-width: 680px) {
	header { gap: 8px; padding: 0 12px; min-height: 52px; }
	header .brand span { display: none; }
	#maincontent.container, .container { padding: 18px 14px 96px; }
	.cbi-section, .cbi-map > .cbi-section { padding: 16px; border-radius: var(--ob-radius); }
	.nav a, .nav a.menu { padding: 6px 9px; font-size: 13px; }
	.ob-wp-grid { grid-template-columns: repeat(3, 1fr); }
}
