:root {
    color-scheme: light;
    --ink: #292a2e;
    --muted: #505258;
    --paper: #f8f8f8;
    --paper-strong: #ffffff;
    --surface-subtle: #f0f1f2;
    --surface-muted: #dcdfe4;
    --surface-warm: #e9f2fe;
    --forest: #1558bc;
    --forest-light: #1868db;
    --brand-surface: #1868db;
    --brand-surface-hover: #1558bc;
    --on-brand: #ffffff;
    --selected-surface: #e9f2fe;
    --selected-surface-hover: #cfe1fd;
    --selected-text: #1558bc;
    --line: #dcdfe4;
    --line-strong: #8c8f97;
    --accent: #1868db;
    --accent-light: #669df1;
    --danger: #c9372c;
    --header-bg: rgb(12 102 228 / 98%);
    --header-fg: #ffffff;
    --header-muted: #e9f2fe;
    --header-control-bg: rgb(9 30 66 / 22%);
    --header-control-hover: rgb(9 30 66 / 32%);
    --header-control-border: rgb(255 255 255 / 32%);
    --code-bg: #1c2b42;
    --code-fg: #e9f2fe;
    --focus-ring: rgb(102 157 241 / 32%);
    --shadow: 0 18px 48px rgb(9 30 66 / 15%);
    --status-private-bg: #ffad3d;
    --status-private-fg: #693200;
    --status-archived-bg: #f87168;
    --status-archived-fg: #5d1f1a;
    --status-firmware-bg: #669df1;
    --status-firmware-fg: #123263;
    --navigation-width: clamp(216px, 15.5vw, 280px);
    --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", "Noto Sans SC", Arial, sans-serif;
    --font-mono: ui-monospace, "SFMono-Regular", "SF Mono", Menlo, Consolas, "Liberation Mono", "Noto Sans Mono CJK SC", monospace;
    --text-xs: .75rem;
    --text-sm: .875rem;
    --text-md: 1rem;
    --text-lg: 1.25rem;
    --text-xl: 1.5rem;
    --text-2xl: 1.75rem;
    --text-3xl: 2rem;
    --leading-xs: 1rem;
    --leading-sm: 1.25rem;
    --leading-md: 1.5rem;
    --leading-lg: 1.75rem;
    --leading-xl: 2rem;
    --leading-2xl: 2.25rem;
    --leading-3xl: 2.5rem;
    --weight-regular: 400;
    --weight-medium: 500;
    --weight-semibold: 600;
    --weight-bold: 700;
    --content-measure: 47.5rem;
    font-family: var(--font-sans);
    font-synthesis: none;
}

html[data-theme="dark"] {
    color-scheme: dark;
    --ink: #cecfd2;
    --muted: #a9abaf;
    --paper: #18191a;
    --paper-strong: #1f1f21;
    --surface-subtle: #242528;
    --surface-muted: #2b2c2f;
    --surface-warm: #1c2b42;
    --forest: #8fb8f6;
    --forest-light: #669df1;
    --brand-surface: #669df1;
    --brand-surface-hover: #8fb8f6;
    --on-brand: #1f1f21;
    --selected-surface: #1c2b42;
    --selected-surface-hover: #123263;
    --selected-text: #cfe1fd;
    --line: rgb(227 228 242 / 12%);
    --line-strong: #6b6e76;
    --accent: #669df1;
    --accent-light: #8fb8f6;
    --danger: #fd9891;
    --header-bg: rgb(29 33 37 / 98%);
    --header-fg: #f0f1f2;
    --header-muted: #a9abaf;
    --header-control-bg: rgb(255 255 255 / 10%);
    --header-control-hover: rgb(255 255 255 / 16%);
    --header-control-border: rgb(255 255 255 / 20%);
    --code-bg: #101214;
    --code-fg: #cfe1fd;
    --focus-ring: rgb(102 157 241 / 38%);
    --shadow: 0 20px 56px rgb(0 0 0 / 38%);
    --status-private-bg: #ffad3d;
    --status-private-fg: #693200;
    --status-archived-bg: #ae2e24;
    --status-archived-fg: #ffd5d2;
    --status-firmware-bg: #1558bc;
    --status-firmware-fg: #cfe1fd;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--paper); font-size: var(--text-md); line-height: var(--leading-md); }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, summary:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
.skip-link { position: fixed; top: -5rem; left: 1rem; z-index: 100; padding: .75rem 1rem; color: var(--on-brand); background: var(--brand-surface); border-radius: .4rem; }
.skip-link:focus { top: 1rem; }
.eyebrow { display: inline-block; color: var(--accent); font-size: var(--text-xs); font-weight: var(--weight-semibold); line-height: var(--leading-xs); letter-spacing: .12em; text-transform: uppercase; }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }

.site-header { position: sticky; top: 0; z-index: 20; min-height: 68px; display: grid; grid-template-columns: var(--navigation-width) minmax(0, 1fr) auto; align-items: center; gap: 1.5rem; padding: .65rem 1.25rem; color: var(--header-fg); background: var(--header-bg); border-bottom: 1px solid rgb(255 255 255 / 9%); backdrop-filter: blur(14px); }
.brand { display: flex; align-items: center; gap: .7rem; color: inherit; text-decoration: none; }
.brand img { width: 44px; height: 44px; flex: 0 0 44px; filter: drop-shadow(0 5px 12px rgb(0 0 0 / 18%)); }
.brand span { display: grid; gap: .15rem; }
.brand strong { font-size: var(--text-lg); font-weight: var(--weight-bold); line-height: var(--leading-md); letter-spacing: normal; }
.brand small { color: var(--header-muted); font-size: .6875rem; line-height: .875rem; letter-spacing: .02em; white-space: nowrap; }
.header-center { min-width: 0; display: flex; align-items: center; gap: .65rem; }
.header-search { width: min(520px, 100%); flex: 0 1 520px; display: flex; align-items: center; color: var(--header-fg); background: var(--header-control-bg); border: 1px solid var(--header-control-border); border-radius: .5rem; }
.header-search input { min-width: 0; padding: .5rem .15rem .5rem .7rem; color: inherit; background: transparent; border: 0; box-shadow: none; }
.header-search input::placeholder { color: var(--header-muted); opacity: 1; }
.header-search button { width: 36px; align-self: stretch; color: var(--header-fg); background: transparent; border: 0; cursor: pointer; font-size: 1.25rem; }
.chip-nav { min-width: 0; display: flex; gap: .35rem; overflow-x: auto; scrollbar-width: none; }
.chip-nav a { flex: 0 0 auto; padding: .48rem .7rem; color: #e9f2fe; border-radius: 999px; font-size: var(--text-sm); line-height: var(--leading-sm); text-decoration: none; }
.chip-nav a:hover { color: white; background: rgb(255 255 255 / 8%); }
.header-actions, .inline-actions, .form-actions { display: flex; align-items: center; gap: .65rem; }
.theme-toggle { min-height: 38px; display: inline-flex; align-items: center; gap: .42rem; padding: .45rem .62rem; color: var(--header-fg); background: var(--header-control-bg); border: 1px solid var(--header-control-border); border-radius: .5rem; cursor: pointer; }
.theme-toggle:hover { background: var(--header-control-hover); }
.theme-toggle span { width: 1rem; font-size: 1rem; line-height: 1; }
.theme-toggle small { color: var(--header-muted); font-size: var(--text-xs); font-weight: var(--weight-semibold); line-height: var(--leading-xs); }
.button, .icon-button, .text-button, .tab, .management-card { border: 0; cursor: pointer; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 38px; padding: .62rem 1rem; border-radius: .5rem; font-size: var(--text-sm); font-weight: var(--weight-semibold); line-height: var(--leading-sm); text-decoration: none; transition: background .16s ease, box-shadow .16s ease, opacity .16s ease; }
.button:hover { box-shadow: 0 2px 6px rgb(9 30 66 / 18%); }
.button.primary { color: var(--on-brand); background: var(--brand-surface); box-shadow: none; }
.button.primary:hover { background: var(--brand-surface-hover); }
.button.subtle { color: var(--ink); background: var(--surface-muted); }
.site-header .button.subtle { color: var(--header-fg); background: rgb(255 255 255 / 10%); }
.button.danger { color: white; background: var(--danger); }
.button.danger-text { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, var(--paper-strong)); }
.button.large { min-height: 50px; padding-inline: 1.4rem; }
.button:disabled { cursor: wait; opacity: .5; }
.icon-button { min-width: 38px; min-height: 38px; display: grid; place-items: center; padding: .35rem; color: inherit; background: transparent; border-radius: .4rem; font-size: 1.15rem; }
.icon-button:hover { background: rgb(128 128 128 / 12%); }
.mobile-only { display: none; }

.workspace { position: relative; min-height: calc(100vh - 68px); display: grid; grid-template-columns: var(--navigation-width) minmax(0, 1fr); }
.tree-panel { position: sticky; top: 68px; height: calc(100vh - 68px); display: flex; flex-direction: column; padding: .9rem .65rem .65rem; background: var(--paper-strong); overflow: hidden; }
.panel-heading { min-height: 30px; display: flex; justify-content: space-between; align-items: center; padding: 0 .45rem .55rem; }
.tree-toolbar { min-height: 33px; display: flex; align-items: center; gap: 8px; margin: 0 .3rem .35rem; padding-bottom: .3rem; border-bottom: 1px solid var(--line); }
.tree-tool-button { width: 28px; height: 28px; display: grid; place-items: center; padding: 0; color: var(--muted); background: transparent; border: 0; border-radius: .35rem; cursor: pointer; }
.tree-tool-button:hover { color: var(--accent); background: var(--surface-subtle); }
.tree-tool-button:disabled { color: var(--line-strong); cursor: default; opacity: .5; background: transparent; }
.tree-tool-button svg { width: 16px; height: 16px; fill: currentcolor; }
.tree-resizer { position: fixed; z-index: 15; top: 68px; bottom: 0; left: calc(var(--navigation-width) - 6px); width: 12px; padding: 0; touch-action: none; cursor: col-resize; outline: none; }
.tree-resizer::before { content: ""; position: absolute; inset: 0 auto 0 5px; width: 1px; background: var(--line); transition: width .12s ease, background .12s ease; }
.tree-resizer:hover::before, .tree-resizer:focus-visible::before, body.navigation-resizing .tree-resizer::before { width: 2px; background: var(--accent); }
.tree-resizer:focus-visible { box-shadow: inset 0 0 0 2px var(--focus-ring); }
body.navigation-resizing { cursor: col-resize; user-select: none; }
.wiki-tree { min-height: 0; flex: 1 1 auto; overflow: auto; }
.wiki-tree ul { margin: 0; padding: 0; list-style: none; }
.wiki-tree ul ul { margin-left: .35rem; padding-left: .65rem; }
.tree-node-row { min-width: 0; min-height: 32px; display: flex; align-items: center; gap: .1rem; margin: .04rem 0; color: var(--muted); background: transparent; border-radius: .38rem; transition: color 50ms cubic-bezier(.4, 1, .6, 1), background 50ms cubic-bezier(.4, 1, .6, 1); }
.tree-node-row:hover, .tree-node-row:focus-within { background: var(--surface-subtle); }
.tree-node-row.active { color: var(--accent); background: var(--selected-surface); }
.tree-node-row.active:hover, .tree-node-row.active:focus-within { background: var(--selected-surface-hover); }
.tree-branch-toggle { position: relative; width: 24px; min-width: 24px; height: 28px; flex: 0 0 24px; display: grid; place-items: center; padding: 0; color: inherit; background: transparent; border: 0; border-radius: .38rem; cursor: pointer; }
.tree-branch-toggle:hover { color: inherit; background: transparent; }
.tree-branch-toggle:focus-visible { outline-offset: -2px; }
.tree-node-row.active .tree-branch-toggle, .tree-node-row.active .tree-branch-toggle:hover { color: inherit; background: transparent; }
.tree-branch-toggle .node-icon, .tree-chevron { position: absolute; inset: 50% auto auto 50%; translate: -50% -50%; transition: opacity .14s ease, transform .16s ease; transform-origin: center; }
.tree-chevron { width: 20px; height: 20px; display: block; fill: currentcolor; opacity: 0; }
.tree-node-row:hover .tree-branch-toggle .node-icon, .tree-node-row:focus-within .tree-branch-toggle .node-icon { opacity: 0; }
.tree-node-row:hover .tree-chevron, .tree-node-row:focus-within .tree-chevron { opacity: 1; }
.tree-branch-toggle[aria-expanded="true"] .tree-chevron { transform: rotate(90deg); }
.root-icon-fill, .branch-icon-expanded-fill, .branch-icon-collapsed-outline, .branch-icon-collapsed-fill { display: none; }
.tree-node-row.active .root-icon-outline { display: none; }
.tree-node-row.active .root-icon-fill { display: block; }
.tree-branch-toggle[aria-expanded="false"] .branch-icon-expanded-outline { display: none; }
.tree-branch-toggle[aria-expanded="false"] .branch-icon-collapsed-outline { display: block; }
.tree-node-row.active .tree-branch-toggle[aria-expanded="true"] .branch-icon-expanded-outline { display: none; }
.tree-node-row.active .tree-branch-toggle[aria-expanded="true"] .branch-icon-expanded-fill { display: block; }
.tree-node-row.active .tree-branch-toggle[aria-expanded="false"] .branch-icon-collapsed-outline { display: none; }
.tree-node-row.active .tree-branch-toggle[aria-expanded="false"] .branch-icon-collapsed-fill { display: block; }
.wiki-tree a { min-width: 0; min-height: 32px; display: flex; flex: 1 1 auto; align-items: center; gap: .4rem; padding: .3rem .45rem; border-radius: .38rem; color: inherit; font-size: var(--text-sm); line-height: var(--leading-sm); text-decoration: none; }
.wiki-tree a:hover, .wiki-tree a.active, .wiki-tree a.active:hover { color: inherit; background: transparent; }
.node-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-labels { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 2px; margin-left: auto; padding-left: .1rem; }
.tree-label { width: 4px; height: 18px; display: block; border-radius: 999px; }
.tree-label-private { background: var(--status-private-bg); }
.tree-label-archived { background: var(--status-archived-bg); }
.tree-label-firmware { background: var(--status-firmware-bg); }
.wiki-tree a[draggable="true"] { cursor: grab; }
.wiki-tree a.drag-source { opacity: .38; cursor: grabbing; }
.tree-node-row.drop-before { box-shadow: inset 0 3px var(--accent); background: var(--selected-surface); }
.tree-node-row.drop-after { box-shadow: inset 0 -3px var(--accent); background: var(--selected-surface); }
.tree-node-row.drop-child { box-shadow: inset 0 0 0 2px var(--accent); background: var(--surface-warm); }
.tree-node-row.active.drop-child { background: var(--selected-surface-hover); }
.node-icon { width: 16px; height: 16px; flex: 0 0 16px; color: inherit; fill: currentcolor; opacity: .88; }
.wiki-tree a:hover .node-icon { color: inherit; opacity: .94; }
.wiki-tree a.active .node-icon { color: inherit; opacity: 1; }
.type-chip { color: #1868db; }
.type-board { color: #803fa5; }
.type-project { color: #a97c3b; }
.tree-footer { display: flex; justify-content: space-between; margin-top: auto; padding: .75rem .45rem .15rem; color: var(--muted); font-size: var(--text-xs); line-height: var(--leading-xs); border-top: 1px solid var(--line); }
.tree-footer a { color: var(--danger); }

.content { min-width: 0; outline: none; container: main-content / inline-size; }
.welcome-view { min-height: calc(100vh - 68px); display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(280px, .7fr); align-items: center; gap: clamp(2rem, 4cqi, 5rem); padding: clamp(2.5rem, 6cqi, 7rem); background: radial-gradient(circle at 80% 20%, rgb(102 157 241 / 18%), transparent 32%), linear-gradient(135deg, var(--paper), var(--surface-subtle)); overflow: hidden; }
.welcome-copy { max-width: 900px; }
.welcome-copy h1 { display: grid; gap: .12em; margin: .7rem 0 1.3rem; font-family: ui-rounded, "SF Pro Rounded", "Arial Rounded MT Bold", var(--font-sans); font-size: clamp(2.35rem, 5cqi, 5.5rem); font-weight: var(--weight-bold); line-height: 1.02; letter-spacing: -.045em; }
.welcome-copy h1 span, .welcome-copy h1 em { display: block; text-wrap: balance; }
.welcome-copy h1 em { padding-left: .35em; color: var(--accent); font-style: normal; font-weight: inherit; }
.welcome-copy p { max-width: 580px; margin: 0 0 2rem; color: var(--muted); font-size: clamp(1rem, 1.5vw, 1.25rem); line-height: 1.8; }
.memory-card { position: relative; min-height: 430px; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: .8rem; color: var(--header-muted); background: linear-gradient(145deg, #1868db, #1c2b42); border-radius: 1rem 4rem 1rem 4rem; box-shadow: var(--shadow); transform: rotate(2deg); overflow: hidden; }
.memory-card::before { content: ""; position: absolute; inset: 1rem; border: 1px solid rgb(255 255 255 / 12%); border-radius: .6rem 3.3rem .6rem 3.3rem; }
.memory-card img { position: relative; width: 112px; height: 112px; margin-bottom: 1rem; transform: rotate(-2deg) scale(1.1); }
.memory-card span { position: relative; font: var(--weight-bold) var(--text-xs)/var(--leading-xs) var(--font-mono); letter-spacing: .12em; }
.memory-light { position: absolute; inset: -30%; background: radial-gradient(circle, rgb(143 184 246 / 30%), transparent 44%); }

.page-view, .management-view, .error-view { width: 100%; margin: 0; padding: clamp(2rem, 4cqi, 5rem) clamp(1.25rem, 3.5cqi, 4.5rem) 6rem; }
.page-view { padding-top: clamp(1.25rem, 2cqi, 2.5rem); }
.page-hero { display: grid; gap: 1rem; padding-bottom: 1.2rem; border-bottom: 1px solid var(--line); }
.page-title { min-width: 0; }
.page-title h1 { margin: 0 0 .35rem; font-family: var(--font-sans); font-size: var(--text-3xl); font-weight: var(--weight-semibold); line-height: var(--leading-3xl); letter-spacing: normal; overflow-wrap: anywhere; text-wrap: pretty; }
.page-hero img { width: min(260px, 30vw); max-height: 160px; object-fit: contain; border-radius: .7rem; }
.type-badge { display: inline-flex; align-items: center; gap: .4rem; padding: .28rem .55rem; color: var(--forest); background: var(--surface-muted); border-radius: 999px; font-size: var(--text-xs); font-weight: var(--weight-semibold); line-height: var(--leading-xs); }
.metadata { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem .85rem; color: var(--muted); font-size: var(--text-sm); line-height: var(--leading-sm); font-variant-numeric: tabular-nums; }
.metadata > span:not(.status-label) { min-height: 23px; display: inline-flex; align-items: center; }
.page-engagement { gap: .5rem; }
.page-heart { height: 23px; display: inline-flex; align-items: center; gap: .25rem; padding: 0 .48rem; color: var(--muted); background: transparent; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; }
.page-heart:hover { color: #d7335b; border-color: #e68aa2; background: color-mix(in srgb, #d7335b 8%, var(--paper-strong)); }
.page-heart.liked { color: #d7335b; border-color: #e68aa2; background: color-mix(in srgb, #d7335b 10%, var(--paper-strong)); }
.page-heart:disabled { cursor: not-allowed; opacity: .62; }
.page-heart > span:first-child { line-height: 1; }
.page-heart > span:last-child { min-width: 1ch; font-size: var(--text-xs); font-weight: var(--weight-semibold); font-variant-numeric: tabular-nums; }
.status-label { height: 23px; display: inline-flex; align-items: center; padding: 0 .55rem; border: 1px solid transparent; border-radius: .35rem; font-size: var(--text-xs); font-weight: var(--weight-semibold); line-height: var(--leading-xs); letter-spacing: normal; }
.status-private { color: var(--status-private-fg); background: var(--status-private-bg); }
.status-archived { color: var(--status-archived-fg); background: var(--status-archived-bg); }
.status-firmware { color: var(--status-firmware-fg); background: var(--status-firmware-bg); }
.page-info-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.page-quick-actions { display: flex; flex-wrap: wrap; justify-content: end; gap: .35rem; }
.page-quick-actions .button { min-height: 31px; padding: .35rem .58rem; font-size: var(--text-xs); line-height: var(--leading-xs); }
.page-columns { display: grid; grid-template-columns: minmax(0, 1fr) clamp(280px, 21cqi, 380px); gap: clamp(1.5rem, 3cqi, 4rem); padding-top: 2.2rem; }
.page-tools { display: flex; flex-direction: column; gap: 1rem; }
.release-card { display: grid; gap: .8rem; padding: 1rem; background: var(--surface-subtle); border: 1px solid var(--line); border-radius: .65rem; }
.release-heading, .mcp-application-heading { display: flex; align-items: center; justify-content: space-between; gap: .7rem; }
.info-card h3 { margin: .45rem 0; font-size: var(--text-lg); font-weight: var(--weight-semibold); line-height: var(--leading-lg); }
.compact-button { min-height: 32px; padding: .35rem .65rem; }
.release-summary { display: grid; gap: .55rem; margin: 0; padding: .85rem; background: var(--paper-strong); border: 1px solid var(--line); border-radius: .55rem; box-shadow: 0 5px 16px rgb(9 30 66 / 8%); }
.release-summary header { display: flex; align-items: center; justify-content: space-between; }
.release-version { display: flex; align-items: center; gap: .45rem; }
.release-version strong { font-size: var(--text-md); font-weight: var(--weight-semibold); line-height: var(--leading-md); font-variant-numeric: tabular-nums; }
.release-target { display: flex; align-items: center; gap: .45rem; min-width: 0; }
.release-device { min-width: 0; margin: 0; color: var(--ink); font-size: var(--text-sm); font-weight: var(--weight-semibold); line-height: var(--leading-sm); overflow-wrap: anywhere; }
.release-revision { flex: 0 0 auto; padding: .18rem .4rem; color: var(--forest); background: var(--surface-subtle); border: 1px solid var(--line); border-radius: 999px; font-size: var(--text-xs); font-weight: var(--weight-semibold); line-height: var(--leading-xs); white-space: nowrap; font-variant-numeric: tabular-nums; }
.release-specs { display: grid; margin: 0; border-top: 1px solid var(--line); }
.release-specs > div { display: grid; grid-template-columns: 3.2rem minmax(0, 1fr); align-items: baseline; gap: .65rem; padding: .35rem 0; border-bottom: 1px solid var(--line); }
.release-specs dt { color: var(--muted); font-size: var(--text-xs); line-height: var(--leading-xs); }
.release-specs dd { min-width: 0; margin: 0; color: var(--ink); font-size: var(--text-xs); font-weight: var(--weight-medium); line-height: var(--leading-xs); text-align: right; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.release-summary footer { display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding-top: .55rem; border-top: 1px solid var(--line); }
.release-summary footer code { min-width: 0; color: var(--muted); font: var(--text-xs)/var(--leading-xs) var(--font-mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.release-download { flex: 0 0 auto; }
.release-switch { margin: .8rem 0; }
.info-card, .flash-disabled { padding: 1.1rem; background: var(--surface-subtle); border: 1px solid var(--line); border-radius: .65rem; }
.info-card dl { margin: .8rem 0 0; }
.info-card dl div { display: flex; justify-content: space-between; gap: 1rem; padding: .48rem 0; border-top: 1px solid var(--line); }
.info-card dt { color: var(--muted); }
.info-card dd { margin: 0; font-weight: var(--weight-semibold); font-variant-numeric: tabular-nums; }
.tool-actions { display: grid; gap: .5rem; }
.flash-button { display: grid; gap: .25rem; width: 100%; padding: 1.15rem; border: 0; color: var(--on-brand); background: var(--brand-surface); border-radius: .65rem; text-align: left; cursor: pointer; box-shadow: 0 4px 12px rgb(9 30 66 / 18%); }
.flash-button:hover { background: var(--brand-surface-hover); }
.flash-button span { font-size: var(--text-md); font-weight: var(--weight-semibold); line-height: var(--leading-md); }
.flash-button small { color: inherit; opacity: .78; line-height: 1.45; }
.flash-disabled small { color: var(--muted); line-height: 1.45; }
.flash-disabled { display: grid; gap: .3rem; color: var(--muted); }
.flash-disabled small { color: var(--muted); }
.flash-target { display: grid; gap: .3rem; padding: 1rem; border: 1px solid var(--line); border-radius: .65rem; background: var(--paper-strong); }
.flash-target strong { font-size: var(--text-md); font-weight: var(--weight-semibold); line-height: var(--leading-md); }
.flash-target span, .flash-warning, .flash-consent, #flash-dialog small { color: var(--muted); line-height: 1.5; }
.flash-warning { padding: .8rem; border-left: 3px solid var(--accent-light); background: var(--surface-warm); }
.flash-consent { display: flex; gap: .6rem; align-items: flex-start; }
#flash-support:not(.error) { color: var(--forest); }
.flash-actions { flex-wrap: wrap; }
.site-flash-transfer { display: grid; gap: .7rem; padding: .9rem; background: var(--paper-strong); border: 1px solid var(--line); border-radius: .6rem; }
.site-flash-transfer .transfer-steps { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.flash-overall-meter { display: grid; gap: .5rem; padding: .85rem .9rem; color: var(--on-brand); background: var(--brand-surface); border-radius: .6rem; box-shadow: 0 .3rem .8rem rgb(9 30 66 / 18%); }
.flash-overall-meter .transfer-meter-heading, .flash-overall-meter .transfer-stats { color: inherit; }
.flash-stage-meter { border: 1px solid var(--line); }
.glow-progress { position: relative; height: 1rem; overflow: hidden; background: rgba(255,255,255,.2); border: 1px solid rgba(255,255,255,.28); border-radius: 999px; }
.glow-progress.compact { height: .8rem; background: var(--surface-muted); border-color: var(--line-strong); }
.glow-progress-fill { position: absolute; inset: 0 auto 0 0; width: 0; overflow: hidden; background: linear-gradient(90deg, #85b8ff, #ffffff); border-radius: inherit; transition: width .25s ease; }
.glow-progress.active .glow-progress-fill::after { content: ''; position: absolute; inset: 0; width: 42%; background: linear-gradient(90deg, transparent, rgba(255,255,255,.82), transparent); transform: translateX(-120%); animation: flash-progress-glow 1.35s linear infinite; }
.glow-progress.indeterminate .glow-progress-fill { width: 38% !important; animation: flash-progress-indeterminate 1.55s ease-in-out infinite; }
.glow-progress.error .glow-progress-fill { background: var(--danger); }
@keyframes flash-progress-glow { to { transform: translateX(340%); } }
@keyframes flash-progress-indeterminate { 0% { left: -38%; } 50% { left: 62%; } 100% { left: -38%; } }

.markdown-body { min-width: 0; color: var(--ink); font-size: var(--text-md); line-height: var(--leading-lg); line-break: strict; word-break: normal; }
.markdown-body :where(p, ul, ol, blockquote, h1, h2, h3, h4, h5, h6) { max-width: var(--content-measure); }
.markdown-body :where(h1, h2, h3, h4, h5, h6) { margin: 2em 0 .65em; color: var(--ink); font-family: var(--font-sans); font-weight: var(--weight-semibold); letter-spacing: normal; text-wrap: pretty; }
.markdown-body [data-markdown-level="1"] { font-size: var(--text-2xl); line-height: var(--leading-2xl); }
.markdown-body [data-markdown-level="2"] { padding-bottom: .4rem; font-size: var(--text-xl); line-height: var(--leading-xl); border-bottom: 1px solid var(--line); }
.markdown-body [data-markdown-level="3"] { font-size: var(--text-lg); line-height: var(--leading-lg); }
.markdown-body [data-markdown-level="4"], .markdown-body [data-markdown-level="5"], .markdown-body [data-markdown-level="6"] { font-size: var(--text-md); line-height: var(--leading-md); }
.markdown-body p { margin: 1em 0; }
.markdown-body a { color: var(--accent); text-underline-offset: .2em; }
.markdown-body code { padding: .15em .35em; color: var(--accent); background: var(--surface-subtle); border-radius: .25rem; font: .875em/1.5 var(--font-mono); overflow-wrap: anywhere; }
.markdown-body pre { padding: 1.15rem; color: var(--code-fg); background: var(--code-bg); border-radius: .65rem; overflow-x: auto; box-shadow: inset 0 1px rgb(255 255 255 / 8%); }
.markdown-body pre code { padding: 0; color: inherit; background: transparent; }
.markdown-body blockquote { margin: 1.5rem 0; padding: .2rem 1.2rem; color: var(--muted); background: var(--surface-subtle); border-left: 4px solid var(--accent); }
.markdown-body hr { margin: 2.5rem 0; border: 0; border-top: 1px solid var(--line); }
.markdown-body li { margin: .35rem 0; }

.comments-panel { max-width: 980px; display: grid; gap: 1.25rem; margin-top: clamp(2.5rem, 5cqi, 5rem); padding-top: 2rem; border-top: 1px solid var(--line); }
.comments-heading { display: grid; gap: .25rem; }
.comments-heading h2 { margin: .25rem 0; font-size: var(--text-xl); font-weight: var(--weight-semibold); line-height: var(--leading-xl); letter-spacing: normal; }
.heart-button { min-height: 34px; display: inline-flex; align-items: center; gap: .35rem; padding: .4rem .6rem; color: var(--muted); background: transparent; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; }
.heart-button:hover { color: #d7335b; border-color: #e68aa2; background: color-mix(in srgb, #d7335b 8%, var(--paper-strong)); }
.heart-button.liked { color: #d7335b; border-color: #e68aa2; background: color-mix(in srgb, #d7335b 10%, var(--paper-strong)); }
.heart-button:disabled { cursor: not-allowed; opacity: .62; }
.heart-button > span:first-child { font-size: 1rem; line-height: 1; }
.heart-button > span:nth-child(2) { min-width: 1ch; font-size: var(--text-xs); font-weight: var(--weight-semibold); font-variant-numeric: tabular-nums; }
.comment-form { position: relative; display: grid; gap: .75rem; padding: 1rem; background: var(--surface-subtle); border: 1px solid var(--line); border-radius: .7rem; }
.comment-form-heading, .comment-form-footer { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.comment-form-heading > div { min-width: 0; display: grid; gap: .18rem; }
.comment-form-heading small, .comment-form-footer small { color: var(--muted); font-size: var(--text-xs); line-height: var(--leading-xs); }
.comment-form textarea { min-height: 110px; padding: .8rem; background: var(--paper-strong); font-family: inherit; font-size: var(--text-md); line-height: var(--leading-md); resize: vertical; }
.comment-honeypot { position: absolute !important; left: -10000px !important; width: 1px !important; height: 1px !important; overflow: hidden !important; }
.comment-list { display: grid; gap: .8rem; }
.comment-card { min-width: 0; padding: .95rem 1rem; background: var(--paper-strong); border: 1px solid var(--line); border-radius: .65rem; box-shadow: 0 5px 18px rgb(9 30 66 / 5%); }
.comment-card > header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.comment-author, .comment-time, .comment-card > footer { display: flex; align-items: center; flex-wrap: wrap; gap: .45rem; }
.comment-author strong { font-size: var(--text-sm); font-weight: var(--weight-semibold); line-height: var(--leading-sm); }
.comment-role { padding: .15rem .38rem; color: var(--muted); background: var(--surface-subtle); border-radius: .3rem; font-size: var(--text-xs); font-weight: var(--weight-semibold); line-height: var(--leading-xs); }
.comment-role.role-admin { color: var(--on-brand); background: var(--brand-surface); }
.comment-role.role-author { color: var(--forest); background: var(--surface-warm); }
.comment-time { justify-content: end; color: var(--muted); font-size: var(--text-xs); line-height: var(--leading-xs); font-variant-numeric: tabular-nums; }
.comment-body.markdown-body { margin: .65rem 0; font-size: .9375rem; line-height: 1.5rem; }
.comment-body.markdown-body > :first-child { margin-top: 0; }
.comment-body.markdown-body > :last-child { margin-bottom: 0; }
.comment-body.markdown-body [data-markdown-level="1"] { font-size: var(--text-lg); line-height: var(--leading-lg); }
.comment-body.markdown-body [data-markdown-level="2"] { font-size: var(--text-md); line-height: var(--leading-md); }
.comment-body.markdown-body [data-markdown-level="3"], .comment-body.markdown-body [data-markdown-level="4"], .comment-body.markdown-body [data-markdown-level="5"], .comment-body.markdown-body [data-markdown-level="6"] { font-size: var(--text-sm); line-height: var(--leading-sm); }
.comment-card > footer .text-button { font-size: var(--text-xs); line-height: var(--leading-xs); }
.comment-thread-toggle { min-height: 32px; display: inline-flex; align-items: center; gap: .5rem; margin-top: .4rem; padding: .3rem .6rem; color: var(--accent); background: transparent; border: 0; border-radius: 999px; font: var(--weight-semibold) var(--text-xs)/var(--leading-xs) var(--font-sans); cursor: pointer; }
.comment-thread-toggle:hover { background: var(--selected-surface); }
.comment-thread-toggle:focus-visible { outline-offset: 1px; }
.comment-thread-chevron { width: 7px; height: 7px; flex: 0 0 7px; border-right: 2px solid currentcolor; border-bottom: 2px solid currentcolor; transform: rotate(-45deg); transition: transform .16s ease; }
.comment-thread-toggle[aria-expanded="true"] .comment-thread-chevron { transform: rotate(45deg) translate(-1px, -1px); }
.comment-children { display: grid; gap: .65rem; margin: .8rem 0 0 .8rem; padding-left: .8rem; border-left: 2px solid var(--line); }
.comment-children[hidden] { display: none; }
.comment-children .comment-card { box-shadow: none; }
.comments-more { justify-self: center; }

.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 1.5rem; margin-bottom: 1.5rem; }
.section-heading h1, .section-heading h2, .section-heading h3 { margin: .35rem 0 0; font-family: var(--font-sans); font-weight: var(--weight-semibold); letter-spacing: normal; text-wrap: pretty; }
.section-heading h1, .section-heading h2 { font-size: var(--text-xl); line-height: var(--leading-xl); }
.section-heading h3 { font-size: var(--text-lg); line-height: var(--leading-lg); }
.section-heading p { margin: .4rem 0 0; color: var(--muted); }
.section-heading.compact { margin-top: 3rem; }
.management-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 1.5rem; margin-bottom: 1.75rem; }
.management-heading h1 { margin: 0; font-family: var(--font-sans); font-size: var(--text-xl); font-weight: var(--weight-semibold); line-height: var(--leading-xl); letter-spacing: normal; text-wrap: pretty; }
.management-heading p { max-width: var(--content-measure); margin: .5rem 0 0; color: var(--muted); font-size: var(--text-sm); line-height: var(--leading-sm); }
.management-heading > .button { flex: 0 0 auto; margin-top: 0; }
.account-heading { margin-bottom: 1.5rem; }
.account-identity { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .75rem; margin-top: .65rem; }
.account-identity strong { font-size: var(--text-md); font-weight: var(--weight-semibold); line-height: var(--leading-md); }
.account-identity > span:not(.type-badge) { color: var(--muted); font-size: var(--text-sm); line-height: var(--leading-sm); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; clip: rect(0, 0, 0, 0); white-space: nowrap; overflow: hidden; border: 0; }
.management-filter { display: flex; align-items: end; gap: .75rem; margin-bottom: 1rem; }
.management-filter.management-panel { width: fit-content; max-width: 100%; padding: .9rem 1rem; box-shadow: none; }
.management-filter label { display: grid; gap: .35rem; color: var(--muted); font-size: var(--text-xs); font-weight: var(--weight-semibold); line-height: var(--leading-xs); }
.management-filter input { min-width: min(320px, 42vw); }
.management-filter select { min-width: 130px; }
.list-heading { align-items: end; }
.list-heading .management-filter { margin: 0; }
.pagination { display: flex; justify-content: flex-end; align-items: center; gap: .75rem; margin-top: 1rem; color: var(--muted); font-size: var(--text-sm); line-height: var(--leading-sm); font-variant-numeric: tabular-nums; }
.pagination .button { min-height: 34px; padding: .45rem .75rem; }
.create-application-panel { margin-bottom: 1.5rem; }
.create-application-panel > summary { display: flex; align-items: baseline; gap: .75rem; cursor: pointer; list-style-position: outside; }
.create-application-panel > summary strong { font-size: var(--text-md); font-weight: var(--weight-semibold); line-height: var(--leading-md); }
.create-application-panel > summary span { color: var(--muted); font-size: var(--text-sm); line-height: var(--leading-sm); }
.create-application-panel[open] > summary { padding-bottom: 1rem; border-bottom: 1px solid var(--line); }
.create-application-panel .mcp-application-form { margin: 1rem 0 0; }
.mcp-application-form { margin-bottom: 1.5rem; background: var(--surface-subtle); border: 1px solid var(--line); border-radius: .7rem; }
.mcp-application-form h4 { margin: .3rem 0 0; }
.mcp-help { margin: -.55rem 0 0; color: var(--muted); font-size: var(--text-sm); line-height: var(--leading-sm); }
.mcp-transfer { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: stretch; gap: .75rem; }
.mcp-transfer section { display: grid; grid-template-rows: auto auto 1fr; gap: .35rem; min-width: 0; padding: .8rem; background: var(--paper-strong); border: 1px solid var(--line); border-radius: .55rem; }
.mcp-transfer h5 { margin: 0; }
.mcp-transfer small { min-height: 2.4em; color: var(--muted); }
.mcp-transfer select { min-height: 150px; font-size: var(--text-sm); line-height: var(--leading-sm); }
.mcp-transfer-actions { display: flex; flex-direction: column; justify-content: center; gap: .4rem; }
.mcp-transfer-actions .button { min-width: 42px; padding-inline: .6rem; }
.mcp-applications { display: grid; gap: .8rem; }
.mcp-application-card { padding: 1rem 1.15rem; background: var(--paper-strong); border: 1px solid var(--line); border-radius: .65rem; }
.mcp-application-heading > div:first-child { display: grid; gap: .25rem; }
.mcp-application-heading span, .mcp-application-heading small { color: var(--muted); font-size: var(--text-sm); line-height: var(--leading-sm); }
.mcp-application-card details { margin-top: .8rem; border-top: 1px solid var(--line); }
.mcp-application-card summary { padding-top: .8rem; color: var(--forest-light); cursor: pointer; font-weight: var(--weight-semibold); }
.mcp-config-form { padding-inline: 0; }
.token-secret { display: block; margin-top: .5rem; padding: .75rem; overflow-wrap: anywhere; user-select: all; }
.switch { display: flex; align-items: center; gap: .45rem; color: var(--muted); font-size: var(--text-sm); line-height: var(--leading-sm); cursor: pointer; }
.switch input { accent-color: var(--forest-light); }
.table-wrap { width: 100%; overflow-x: auto; background: var(--paper-strong); border: 1px solid var(--line); border-radius: .7rem; box-shadow: 0 10px 30px rgb(9 30 66 / 7%); }
table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); line-height: var(--leading-sm); font-variant-numeric: tabular-nums; }
th, td { padding: .85rem 1rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
th { color: var(--muted); background: var(--surface-subtle); font-size: var(--text-xs); font-weight: var(--weight-semibold); line-height: var(--leading-xs); letter-spacing: .04em; }
tbody tr:last-child td { border-bottom: 0; }
td small { display: block; margin-top: .2rem; color: var(--muted); }
td code { font: var(--text-xs)/var(--leading-xs) var(--font-mono); }
.current-tag { padding: .12rem .3rem; color: #09326c; background: #cfe1fd; border-radius: .25rem; font-size: var(--text-xs); line-height: var(--leading-xs); }
.text-button { padding: .25rem; color: var(--forest-light); background: none; font-size: var(--text-sm); font-weight: var(--weight-semibold); line-height: var(--leading-sm); }
.text-button.danger { color: var(--danger); }

.management-view { min-height: calc(100vh - 68px); }
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.management-card { min-height: 155px; display: flex; flex-direction: column; align-items: start; justify-content: end; gap: .5rem; padding: 1.25rem; color: var(--ink); background: var(--paper-strong); border: 1px solid var(--line); border-radius: .7rem; text-align: left; box-shadow: 0 10px 25px rgb(9 30 66 / 7%); }
.management-card:hover { border-color: var(--accent-light); transform: translateY(-2px); }
.management-card strong { font-size: var(--text-md); font-weight: var(--weight-semibold); line-height: var(--leading-md); }
.management-card span { color: var(--muted); font-size: var(--text-sm); line-height: var(--leading-sm); }
.account-card-grid { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.management-panel { padding: 1.35rem 1.5rem; background: var(--paper-strong); border: 1px solid var(--line); border-radius: .7rem; box-shadow: 0 10px 25px rgb(9 30 66 / 6%); }
.management-panel.narrow { max-width: 760px; }
.settings-stack { display: grid; gap: 1rem; }
.settings-fieldset { min-width: 0; margin: 0; padding: 1rem; border: 1px solid var(--line); border-radius: .6rem; }
.settings-fieldset legend { padding: 0 .4rem; color: var(--forest); font-size: var(--text-sm); font-weight: var(--weight-semibold); line-height: var(--leading-sm); }
.settings-grid { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.setting-number { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: .55rem; }
.setting-number small { min-width: 2.5rem; }
.password-panel { max-width: 620px; }
.management-panel > .form-stack { padding: 0; }
.management-panel .section-heading h2 { font-size: var(--text-lg); font-weight: var(--weight-semibold); line-height: var(--leading-lg); }
.section-heading.compact.first { margin-top: 0; }
.danger-card strong { color: var(--danger); }
.item-list { display: grid; gap: .7rem; }
.item-list article { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1rem 1.15rem; background: var(--paper-strong); border: 1px solid var(--line); border-radius: .65rem; }
.item-list article > div:first-child { display: grid; gap: .25rem; }
.item-list article span { color: var(--muted); font-size: var(--text-sm); line-height: var(--leading-sm); }
.recycle-tree ul { display: grid; gap: .7rem; margin: 0; padding: 0; list-style: none; }
.recycle-tree ul ul { margin: .7rem 0 0 1.25rem; padding-left: 1.25rem; border-left: 1px solid var(--line); }
.recycle-tree article { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1rem 1.15rem; background: var(--paper-strong); border: 1px solid var(--line); border-radius: .65rem; }
.recycle-tree article > div:first-child { display: grid; gap: .25rem; }
.recycle-tree article span { color: var(--muted); font-size: var(--text-sm); line-height: var(--leading-sm); }
.recycle-tree .recycle-path-hint { color: var(--forest); }
.recycle-tree .recycle-path-hint.blocked { color: var(--danger); }
.empty { padding: 2rem; color: var(--muted); background: var(--surface-subtle); border: 1px dashed var(--line-strong); border-radius: .6rem; text-align: center; }
.empty.compact { padding: 1rem; font-size: var(--text-sm); line-height: var(--leading-sm); }
.error-view { min-height: 70vh; display: flex; flex-direction: column; justify-content: center; align-items: start; }
.error-view h1 { margin: .7rem 0 .5rem; font-size: var(--text-xl); font-weight: var(--weight-semibold); line-height: var(--leading-xl); letter-spacing: normal; }
.error-view p { max-width: 600px; color: var(--muted); font-size: var(--text-md); line-height: var(--leading-md); }
.error-view .button { margin-top: 1rem; }

.search-filters { display: grid; grid-template-columns: minmax(240px, 1fr) auto; align-items: end; gap: .75rem; margin-bottom: 1.5rem; padding: 1rem; background: var(--surface-subtle); border: 1px solid var(--line); border-radius: .7rem; }
.search-filters label { display: grid; gap: .35rem; color: var(--muted); font-size: var(--text-sm); font-weight: var(--weight-semibold); line-height: var(--leading-sm); }
.search-status { min-height: 2rem; color: var(--muted); font-size: var(--text-sm); line-height: var(--leading-sm); }
.search-results { display: grid; gap: .8rem; }
.search-result { display: flex; justify-content: space-between; align-items: start; gap: 2rem; padding: 1.25rem 1.35rem; background: var(--paper-strong); border: 1px solid var(--line); border-radius: .7rem; box-shadow: 0 8px 24px rgb(9 30 66 / 6%); }
.search-result:hover { border-color: var(--accent-light); }
.search-result-main { min-width: 0; }
.search-result h2 { margin: .45rem 0; font-size: var(--text-lg); font-weight: var(--weight-semibold); line-height: var(--leading-lg); letter-spacing: normal; text-wrap: pretty; }
.search-result h2 a { text-decoration: none; }
.search-result h2 a:hover { color: var(--accent); }
.search-result p { margin: .35rem 0 0; font-size: var(--text-sm); line-height: var(--leading-sm); }
.result-summary { color: var(--ink); }
.result-snippet { color: var(--muted); font-size: var(--text-sm); line-height: var(--leading-sm); }
.result-tags { display: flex; flex-wrap: wrap; gap: .3rem; }
.result-tags span { padding: .15rem .35rem; color: var(--forest); background: var(--surface-warm); border-radius: .25rem; font-size: var(--text-xs); line-height: var(--leading-xs); }
.search-result time { flex: 0 0 auto; color: var(--muted); font-size: var(--text-xs); line-height: var(--leading-xs); font-variant-numeric: tabular-nums; }

.modal { width: min(480px, calc(100% - 2rem)); max-height: calc(100vh - 2rem); padding: 0; color: var(--ink); background: var(--paper-strong); border: 1px solid var(--line); border-radius: .8rem; box-shadow: 0 24px 90px rgb(9 30 66 / 30%); }
.modal.wide { width: min(1120px, calc(100% - 2rem)); }
.modal::backdrop { background: rgb(9 30 66 / 58%); backdrop-filter: blur(4px); }
.modal-heading { display: flex; justify-content: space-between; align-items: start; padding: 1.35rem 1.5rem 1rem; border-bottom: 1px solid var(--line); }
.modal-heading h2 { margin: .2rem 0 0; font-size: var(--text-lg); font-weight: var(--weight-semibold); line-height: var(--leading-lg); letter-spacing: normal; text-wrap: pretty; }
#page-dialog { width: min(1360px, calc(100vw - 3rem)); max-width: none; max-height: calc(100vh - 5rem); max-height: calc(100dvh - 5rem); overflow: hidden; }
#page-dialog[open] { display: grid; grid-template-rows: auto minmax(0, 1fr); }
#page-dialog > #page-form { min-height: 0; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto auto auto auto; overflow: auto; }
#page-dialog .form-grid { grid-template-columns: minmax(0, 1fr); }
#page-dialog .form-grid .span-two { grid-column: auto; }
.tabs { display: flex; gap: .3rem; padding: .8rem 1.5rem 0; }
.tab { padding: .5rem .8rem; color: var(--muted); background: transparent; border-bottom: 2px solid transparent; font-size: var(--text-sm); line-height: var(--leading-sm); }
.tab.active { color: var(--forest); border-color: var(--accent); font-weight: var(--weight-semibold); }
.form-stack { display: grid; gap: 1rem; padding: 1.35rem 1.5rem 1.5rem; }
.form-stack label { display: grid; gap: .4rem; color: var(--ink); font-size: var(--text-sm); font-weight: var(--weight-semibold); line-height: var(--leading-sm); }
.form-stack label small { color: var(--muted); font-weight: var(--weight-medium); line-height: var(--leading-sm); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.account-password-form { max-width: 620px; }
.span-two { grid-column: span 2; }
.check-label { display: flex !important; grid-template-columns: auto 1fr; align-items: center; align-self: end; }
.check-label input { width: auto; }
input, textarea, select { width: 100%; padding: .68rem .75rem; color: var(--ink); background: var(--paper-strong); border: 1px solid var(--line-strong); border-radius: .42rem; outline: 0; font-size: var(--text-md); line-height: var(--leading-md); }
input:focus, textarea:focus, select:focus { border-color: var(--forest-light); box-shadow: 0 0 0 3px var(--focus-ring); }
textarea { resize: vertical; font-family: var(--font-mono); }
.markdown-editor { height: clamp(380px, 45dvh, 640px); min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr); border: 1px solid var(--line-strong); border-radius: .55rem; overflow: hidden; background: var(--paper-strong); }
.markdown-toolbar { display: flex; align-items: center; gap: .25rem; padding: .45rem; background: var(--surface-subtle); border-bottom: 1px solid var(--line-strong); }
.markdown-toolbar button { min-width: 34px; padding: .35rem .5rem; color: var(--forest); background: var(--paper-strong); border: 1px solid var(--line); border-radius: .3rem; cursor: pointer; }
.markdown-toolbar button:hover, .markdown-toolbar button.active { color: var(--on-brand); background: var(--brand-surface); }
.editor-tabs { display: none; margin-left: auto; gap: .25rem; }
.editor-split { min-height: 0; height: 100%; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.editor-source { min-height: 0; display: grid !important; grid-template-rows: minmax(0, 1fr); min-width: 0; padding: .7rem; overflow: hidden; border-right: 1px solid var(--line-strong); }
.editor-source textarea { height: 100%; min-height: 0; padding: .8rem; border: 0; box-shadow: none; resize: none; overflow: auto; font-size: var(--text-md); line-height: var(--leading-lg); }
.editor-preview { min-width: 0; height: 100%; max-height: none; padding: .7rem 1rem; overflow: auto; background: var(--paper-strong); }
.editor-preview .markdown-body :where(h1, h2, h3):first-child { margin-top: .5rem; }
.editor-module-card { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.1rem; background: var(--surface-subtle); border: 1px solid var(--line); border-radius: .6rem; }
.editor-module-card > div { min-width: 0; display: grid; gap: .25rem; }
.editor-module-card strong { font-size: var(--text-md); font-weight: var(--weight-semibold); line-height: var(--leading-md); }
.editor-module-card small { color: var(--muted); line-height: 1.5; }
.firmware-workbench { max-height: calc(100vh - 92px); overflow: auto; }
.firmware-auto-card { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: 1.25rem 1.5rem; padding: 1rem; background: var(--surface-subtle); border: 1px solid var(--line); border-radius: .6rem; }
.firmware-auto-card > div { display: grid; gap: .25rem; }
.firmware-auto-card h3, .firmware-publish-panel h3 { margin: 0; font-size: var(--text-lg); font-weight: var(--weight-semibold); line-height: var(--leading-lg); }
.firmware-auto-card p { margin: 0; color: var(--muted); font-size: var(--text-sm); line-height: var(--leading-sm); }
.firmware-auto-card > strong { flex: none; color: var(--forest); font-size: var(--text-sm); font-weight: var(--weight-semibold); line-height: var(--leading-sm); }
.firmware-publish-panel { padding: 0 1.5rem 1.5rem; }
.firmware-publish-actions { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, .8fr); align-items: start; gap: 1rem; }
.firmware-publish-actions > * { min-width: 0; padding: 1rem; background: var(--paper-strong); border: 1px solid var(--line); border-radius: .6rem; }
.firmware-publish-actions .form-stack { padding: 1rem; }
.esp-read-card { display: flex; flex-direction: column; align-items: stretch; gap: .8rem; }
.esp-read-card p { margin: 0; color: var(--muted); line-height: 1.6; }
.esp-read-card code { font-family: var(--font-mono); }
.form-stack .flash-consent { display: flex; align-items: flex-start; gap: .6rem; }
.flash-consent input { width: auto; flex: 0 0 auto; margin-top: .2rem; }
.esp-read-actions { display: flex; flex-wrap: wrap; gap: .55rem; }
.transfer-steps { display: grid; gap: .45rem; margin: .2rem 0; padding: 0; list-style: none; }
.transfer-steps li { display: grid; grid-template-columns: 30px minmax(0, 1fr); align-items: center; gap: .65rem; padding: .55rem .65rem; color: var(--muted); border: 1px solid transparent; border-radius: .5rem; }
.transfer-steps li > span { display: grid; width: 26px; height: 26px; place-items: center; font-family: var(--font-mono); font-size: var(--text-xs); line-height: var(--leading-xs); background: var(--surface-muted); border-radius: 50%; }
.transfer-steps li > div { display: grid; gap: .08rem; }
.transfer-steps strong { font-size: var(--text-sm); font-weight: var(--weight-semibold); line-height: var(--leading-sm); }
.transfer-steps small { font-size: var(--text-xs); line-height: var(--leading-xs); }
.transfer-steps li.running { color: var(--forest); background: var(--surface-warm); border-color: var(--accent-light); }
.transfer-steps li.running > span { color: var(--on-brand); background: var(--brand-surface); animation: transfer-pulse 1.1s ease-in-out infinite alternate; }
.transfer-steps li.done { color: var(--forest); }
.transfer-steps li.done > span { color: var(--on-brand); background: var(--brand-surface); }
.transfer-steps li.done > span { font-size: 0; }
.transfer-steps li.done > span::after { content: '✓'; font-size: var(--text-sm); }
.transfer-steps li.error { color: var(--danger); background: #fff0ed; border-color: #e8bcb3; }
.transfer-steps li.error > span { color: white; background: var(--danger); }
@keyframes transfer-pulse { to { transform: scale(.86); opacity: .72; } }
.transfer-meter { display: grid; gap: .42rem; padding: .7rem .8rem; background: var(--surface-subtle); border-radius: .5rem; }
.transfer-meter-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; color: var(--forest); font-size: var(--text-sm); line-height: var(--leading-sm); }
.transfer-meter-heading span { font-family: var(--font-mono); font-weight: var(--weight-semibold); font-variant-numeric: tabular-nums; }
.transfer-meter progress { height: .8rem; }
.transfer-stats { color: var(--muted); font-family: var(--font-mono); font-size: var(--text-xs); line-height: var(--leading-xs); font-variant-numeric: tabular-nums; }
.transfer-status { min-height: 1.5em; padding: .65rem .75rem; color: var(--forest) !important; background: var(--surface-subtle); border-left: 3px solid var(--forest-light); border-radius: .3rem; font-size: var(--text-sm); line-height: var(--leading-sm); }
.transfer-status.error { color: var(--danger) !important; background: color-mix(in srgb, var(--danger) 10%, var(--paper-strong)); border-color: var(--danger); }
.connect-help { display: grid; gap: .55rem; padding: .8rem; color: #6a4a00; background: #fff5d8; border: 1px solid #e7c875; border-radius: .5rem; }
.connect-help p { color: #6a4a00; font-size: var(--text-sm); line-height: var(--leading-sm); }
.connect-help .form-actions { justify-content: start; }
.transfer-log { color: var(--muted); font-size: var(--text-xs); line-height: var(--leading-xs); }
.transfer-log summary { cursor: pointer; font-weight: var(--weight-semibold); }
.transfer-log pre { max-height: 180px; margin: .5rem 0 0; padding: .65rem; color: var(--code-fg); background: var(--code-bg); border-radius: .4rem; font: var(--text-xs)/var(--leading-xs) var(--font-mono); white-space: pre-wrap; overflow: auto; }
@media (prefers-reduced-motion: reduce) {
    .glow-progress.active .glow-progress-fill::after, .glow-progress.indeterminate .glow-progress-fill { animation-duration: 2.8s; }
}
.revision-workbench { min-height: min(640px, calc(100vh - 130px)); display: grid; grid-template-columns: 270px minmax(0, 1fr); }
.revision-workbench > aside { padding: 1.1rem; background: var(--surface-subtle); border-right: 1px solid var(--line); overflow: auto; }
.revision-workbench > aside h3 { margin: 0; font-size: var(--text-md); font-weight: var(--weight-semibold); line-height: var(--leading-md); }
.revision-workbench > aside > p { margin: .4rem 0 1rem; color: var(--muted); font-size: var(--text-sm); line-height: var(--leading-sm); }
.revision-list { display: grid; gap: .45rem; }
.revision-list-item { min-width: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: .55rem; padding: .7rem; background: var(--paper-strong); border: 1px solid var(--line); border-radius: .45rem; cursor: pointer; }
.revision-list-item:has(input:checked) { border-color: var(--forest-light); box-shadow: 0 0 0 2px rgb(24 104 219 / 14%); }
.revision-list-item input { width: auto; margin-top: .2rem; accent-color: var(--forest-light); }
.revision-list-item span { min-width: 0; display: grid; gap: .25rem; }
.revision-list-item small { color: var(--muted); font-size: var(--text-xs); line-height: var(--leading-xs); overflow-wrap: anywhere; }
.revision-detail { min-width: 0; padding: 1.25rem; overflow: auto; }
.revision-heading { display: flex; align-items: start; justify-content: space-between; gap: 1rem; padding-bottom: 1rem; border-bottom: 1px solid var(--line); }
.revision-heading h3 { margin: .35rem 0; font-size: var(--text-lg); font-weight: var(--weight-semibold); line-height: var(--leading-lg); letter-spacing: normal; text-wrap: pretty; }
.revision-heading p { margin: 0; color: var(--muted); font-size: var(--text-sm); line-height: var(--leading-sm); }
.revision-stats { display: flex; flex-wrap: wrap; gap: .8rem; margin: 1rem 0; }
.revision-stats div { min-width: 150px; padding: .65rem .8rem; background: var(--surface-subtle); border-radius: .45rem; }
.revision-stats dt { color: var(--muted); font-size: var(--text-xs); line-height: var(--leading-xs); }
.revision-stats dd { margin: .25rem 0 0; overflow-wrap: anywhere; }
.revision-source { max-height: 480px; padding: 1rem; color: var(--code-fg); background: var(--code-bg); border-radius: .55rem; white-space: pre-wrap; overflow: auto; }
.diff-field-change { margin: .8rem 0; padding: .65rem .8rem; background: #fff5df; border-left: 3px solid var(--accent-light); overflow-wrap: anywhere; }
.diff-summary { display: flex; gap: .8rem; margin: 1rem 0; font-weight: var(--weight-semibold); font-variant-numeric: tabular-nums; }
.diff-summary ins, .revision-stats ins { color: #27764f; text-decoration: none; }
.diff-summary del, .revision-stats del { color: var(--danger); text-decoration: none; }
.revision-diff { max-width: 100%; overflow: auto; border: 1px solid var(--line); border-radius: .55rem; }
.revision-diff .d2h-wrapper { color: #2a403a; font-family: var(--font-mono); font-size: var(--text-xs); line-height: var(--leading-xs); }
.revision-diff .d2h-file-header { padding: .6rem; background: #eee8dc; }
.revision-diff .d2h-file-list-wrapper, .revision-diff .d2h-file-collapse, .revision-diff .d2h-tag { display: none; }
.revision-diff .d2h-diff-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.revision-diff td { padding: 0; border: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.revision-diff .d2h-code-linenumber, .revision-diff .d2h-code-side-linenumber { width: 42px; padding: .16rem .35rem; color: #7b8782; background: #f0ece4; text-align: right; user-select: none; }
.revision-diff .d2h-code-line, .revision-diff .d2h-code-side-line { padding: .16rem .4rem; }
.revision-diff .d2h-del { background: #fbe4e1; }
.revision-diff .d2h-ins { background: #e2f2e7; }
.revision-diff .d2h-info { background: #e8edf0; }
.form-actions { justify-content: end; }
.form-status { min-height: 1.25em; margin: 0; color: var(--danger); font-size: var(--text-sm); line-height: var(--leading-sm); }
.form-status.success { color: var(--forest); }
progress { width: 100%; height: .6rem; accent-color: var(--accent); }
.toast { position: fixed; right: 1.2rem; bottom: 1.2rem; z-index: 80; max-width: min(420px, calc(100% - 2.4rem)); padding: .85rem 1rem; color: var(--on-brand); background: var(--brand-surface); border-radius: .5rem; box-shadow: var(--shadow); }
.toast.error { background: var(--danger); }
.skeleton { height: 1rem; margin: 1rem 0; background: var(--surface-muted); border-radius: .3rem; }
.skeleton.short { width: 55%; }
.skeleton.title { width: 45%; height: 3.5rem; }

.standalone-error { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(circle at 50% 20%, #e9f2fe, var(--paper)); }
.error-card { width: min(560px, calc(100% - 2rem)); padding: 3rem; background: var(--paper-strong); border: 1px solid var(--line); border-radius: 1rem; box-shadow: var(--shadow); text-align: center; }
.error-card h1 { margin: .5rem 0; font-size: var(--text-xl); font-weight: var(--weight-semibold); line-height: var(--leading-xl); letter-spacing: normal; }
.error-card p { margin-bottom: 1.5rem; color: var(--muted); }

html[data-theme="dark"] .flash-disabled, html[data-theme="dark"] .flash-disabled small { color: var(--muted); }
html[data-theme="dark"] .glow-progress.compact { background: var(--surface-muted); border-color: var(--line-strong); }
html[data-theme="dark"] .transfer-steps li { color: var(--muted); }
html[data-theme="dark"] .transfer-steps li > span { background: var(--surface-muted); }
html[data-theme="dark"] .transfer-steps li.running { color: var(--accent-light); background: var(--surface-warm); border-color: #144794; }
html[data-theme="dark"] .transfer-steps li.error { background: #3b2424; border-color: #714343; }
html[data-theme="dark"] .connect-help, html[data-theme="dark"] .connect-help p { color: #f0d58b; background: #362e1b; border-color: #6e5a26; }
html[data-theme="dark"] .diff-field-change { background: #332c1e; }
html[data-theme="dark"] .revision-diff .d2h-wrapper { color: var(--ink); }
html[data-theme="dark"] .revision-diff .d2h-file-header, html[data-theme="dark"] .revision-diff .d2h-code-linenumber, html[data-theme="dark"] .revision-diff .d2h-code-side-linenumber { background: var(--surface-subtle); color: var(--muted); }
html[data-theme="dark"] .revision-diff .d2h-del { background: #3b2424; }
html[data-theme="dark"] .revision-diff .d2h-ins { background: #1e3c2a; }
html[data-theme="dark"] .revision-diff .d2h-info { background: #202f38; }
html[data-theme="dark"] .result-tags span { color: var(--muted); background: var(--surface-subtle); }
html[data-theme="dark"] .standalone-error { background: radial-gradient(circle at 50% 20%, #1c2b42, var(--paper)); }
html[data-theme="dark"] .skeleton { background: linear-gradient(90deg, #242528 25%, #303134 50%, #242528 75%); background-size: 200% 100%; }

@container main-content (max-width: 860px) {
    .page-columns { grid-template-columns: 1fr; }
    .page-tools { grid-row: 1; display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
}

@media (max-width: 900px) {
    .site-flash-transfer .transfer-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .site-header { grid-template-columns: auto 1fr auto; }
    .brand img { width: 38px; height: 38px; flex-basis: 38px; }
    .brand small, .chip-nav { display: none; }
    .header-search { width: 100%; max-width: none; flex-basis: auto; }
    .mobile-only { display: grid; }
    .workspace { display: block; }
    .tree-panel { position: fixed; z-index: 40; top: 0; left: 0; width: min(340px, 88vw); height: 100vh; transform: translateX(-105%); transition: transform .22s ease; border-right: 1px solid var(--line); box-shadow: 15px 0 50px rgb(9 30 66 / 25%); }
    .tree-panel.open { transform: translateX(0); }
    .tree-resizer { display: none; }
    .welcome-view { grid-template-columns: 1fr; padding: 3rem 1.5rem; }
    .memory-card { min-height: 260px; }
    .page-columns { grid-template-columns: 1fr; }
    .page-tools { grid-row: 1; display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
    .firmware-publish-actions { grid-template-columns: 1fr; }
    .transfer-steps li { padding-inline: .35rem; }
    .revision-workbench { grid-template-columns: 220px minmax(0, 1fr); }
    .search-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .search-query-field { grid-column: span 2; }
}

@media (hover: none) {
    .tree-branch-toggle .node-icon { opacity: 0; }
    .tree-branch-toggle .tree-chevron { opacity: 1; }
}

@media (max-width: 600px) {
    .site-flash-transfer .transfer-steps { grid-template-columns: 1fr; }
    .site-header { min-height: 62px; padding-inline: .75rem; }
    .brand strong { font-size: var(--text-md); line-height: var(--leading-md); }
    .theme-toggle small { display: none; }
    .header-actions { gap: .35rem; }
    .header-center { gap: 0; }
    .header-search { max-width: 155px; }
    .site-header .button { min-height: 36px; padding: .5rem .7rem; }
    .welcome-copy h1 { gap: .1em; font-size: clamp(2.25rem, 10vw, 2.7rem); }
    .welcome-copy h1 em { padding-left: .12em; }
    .memory-card { display: none; }
    .page-view, .management-view, .error-view { width: 100%; padding: 2rem 1rem 6rem; }
    .page-hero { align-items: start; }
    .page-info-row { align-items: start; flex-direction: column; }
    .page-quick-actions { justify-content: start; }
    .page-hero img { width: 100px; max-height: 100px; }
    .page-title h1 { font-size: var(--text-2xl); line-height: var(--leading-2xl); }
    .page-columns { gap: 1.5rem; padding-top: 1.5rem; }
    .comments-panel { margin-top: 2.5rem; }
    .comment-form-heading, .comment-form-footer, .comment-card > header { align-items: stretch; flex-direction: column; }
    .comment-form-footer .button { width: 100%; }
    .comment-time { justify-content: start; }
    .comment-children { margin-left: .25rem; padding-left: .5rem; }
    .section-heading, .management-heading { align-items: start; flex-direction: column; }
    .section-heading .inline-actions { width: 100%; justify-content: space-between; }
    .management-heading > .button { width: 100%; }
    .account-identity { align-items: flex-start; flex-direction: column; }
    .list-heading .management-filter, .management-filter { width: 100%; align-items: stretch; flex-direction: column; }
    .management-filter.management-panel { width: 100%; }
    .management-filter input, .management-filter select { width: 100%; min-width: 0; }
    .pagination { justify-content: space-between; flex-wrap: wrap; }
    .pagination span { order: -1; width: 100%; text-align: center; }
    .create-application-panel > summary { align-items: flex-start; flex-direction: column; gap: .35rem; }
    .form-grid { grid-template-columns: 1fr; }
    .span-two { grid-column: auto; }
    .item-list article { align-items: start; flex-direction: column; }
    .recycle-tree article { align-items: start; flex-direction: column; }
    .recycle-tree ul ul { margin-left: .5rem; padding-left: .65rem; }
    .search-filters { grid-template-columns: 1fr; }
    .search-query-field { grid-column: auto; }
    .search-result { flex-direction: column; gap: .7rem; }
    .modal { max-height: calc(100vh - 1rem); }
    #page-dialog { width: calc(100vw - 1rem); max-height: calc(100vh - 1rem); max-height: calc(100dvh - 1rem); }
    .editor-tabs { display: flex; }
    .markdown-editor { height: clamp(320px, 55dvh, 480px); }
    .editor-split { height: 100%; display: block; }
    .editor-source { height: 100%; border-right: 0; }
    .editor-preview { height: 100%; max-height: none; }
    .editor-source.tab-hidden, .editor-preview.tab-hidden { display: none !important; }
    .editor-module-card { align-items: stretch; flex-direction: column; }
    .editor-module-card .button { width: 100%; }
    .firmware-publish-panel { padding-inline: .75rem; }
    .revision-workbench { display: block; }
    .revision-workbench > aside { max-height: 220px; border-right: 0; border-bottom: 1px solid var(--line); }
    .revision-heading { flex-direction: column; }
    .revision-detail { padding: .85rem; }
    .mcp-application-heading { align-items: start; flex-direction: column; }
    .mcp-transfer { grid-template-columns: 1fr; }
    .mcp-transfer-actions { flex-direction: row; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
