:root {
  --dh-bg: #050816;
  --dh-surface: #0f172a;
  --dh-surface-2: #111c31;
  --dh-surface-3: #18243b;
  --dh-border: rgba(148, 163, 184, 0.22);
  --dh-text: #e5edf8;
  --dh-muted: #94a3b8;
  --dh-primary: #8d7cff;
  --dh-primary-strong: #aa9dff;
  --dh-primary-soft: rgba(141, 124, 255, 0.14);
  --dh-success: #55d6a1;
  --dh-warning: #f1bd66;
  --dh-danger: #ff7d91;
  /* Series colours are bound to the source, never to its position in the chart, so a
     filtered-out source never repaints the rest. Both modes validated against their own
     surface for colour-vision separation and contrast. */
  --dh-series-ga4: #3987e5;
  --dh-series-matomo: #d95926;
  --dh-series-meta_pixel: #199e70;
  --dh-series-facebook: #9085e9;
  --dh-series-instagram: #d55181;
  --dh-series-tiktok: #008300;
  --dh-blue: #5eb7ff;
  --dh-radius: 14px;
  --dh-shadow: 0 18px 60px rgba(0, 0, 0, 0.42);
}

[data-bs-theme="light"] {
  --dh-bg: #f3f5f9;
  --dh-surface: #ffffff;
  --dh-surface-2: #f8f9fc;
  --dh-surface-3: #eef1f6;
  --dh-border: #dfe3eb;
  --dh-text: #1c2230;
  --dh-muted: #677184;
  --dh-primary: #6456d8;
  --dh-primary-strong: #4f41bd;
  --dh-primary-soft: rgba(100, 86, 216, 0.11);
  --dh-shadow: 0 18px 50px rgba(37, 45, 65, 0.1);
  --dh-series-ga4: #2a78d6;
  --dh-series-matomo: #eb6834;
  --dh-series-meta_pixel: #1baf7a;
  --dh-series-facebook: #4a3aa7;
  --dh-series-instagram: #e87ba4;
  --dh-series-tiktok: #008300;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
html, body { max-width: 100%; overflow-x: hidden; }
body { margin: 0; background: var(--dh-bg); color: var(--dh-text); font-family: "Open Sans", sans-serif; font-size: 14px; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea, label, [role="tab"] { touch-action: manipulation; }
.material-symbols-outlined { font-size: 20px; vertical-align: middle; }
.skip-link { position: fixed; z-index: 2000; top: 8px; left: 8px; padding: 10px 14px; background: var(--dh-primary); color: white; border-radius: 8px; }
.eyebrow { margin: 0 0 6px; color: var(--dh-primary-strong); font-size: 11px; font-weight: 700; letter-spacing: .12em; }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 18% 10%, rgba(141,124,255,.18), transparent 34%), radial-gradient(circle at 82% 88%, rgba(94,183,255,.1), transparent 32%), var(--dh-bg); }
.login-card { width: min(100%, 430px); padding: 44px; border: 1px solid var(--dh-border); border-radius: 24px; background: color-mix(in srgb, var(--dh-surface) 92%, transparent); box-shadow: var(--dh-shadow); }
.login-card h1 { margin: 12px 0 6px; font-size: 34px; letter-spacing: -.04em; }
.login-lead { color: var(--dh-muted); font-size: 15px; line-height: 1.65; }
.brand-mark, .app-icon { display: grid; place-items: center; color: white; background: linear-gradient(145deg, var(--dh-primary), #5c77f2); box-shadow: 0 8px 24px rgba(110, 93, 230, .3); }
.app-icon { padding: 0; border: 0; }
.app-icon:hover, .app-icon:focus-visible { color: white; transform: translateY(-1px); }
.brand-mark { width: 56px; height: 56px; border-radius: 16px; }
.brand-mark .material-symbols-outlined { font-size: 30px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 10px; font-weight: 600; }
.btn-primary { --bs-btn-bg: var(--dh-primary); --bs-btn-border-color: var(--dh-primary); --bs-btn-hover-bg: var(--dh-primary-strong); --bs-btn-hover-border-color: var(--dh-primary-strong); }

.app-shell { min-height: 100vh; }
.topbar { position: sticky; top: 0; z-index: 1030; height: 68px; display: flex; align-items: center; border-bottom: 1px solid var(--dh-border); background: linear-gradient(135deg, #020617, #0f172a); box-shadow: 0 8px 22px rgba(0, 0, 0, .32); }
[data-bs-theme="light"] .topbar { background: rgba(255, 255, 255, .94); backdrop-filter: blur(10px); box-shadow: 0 8px 22px var(--dh-shadow); }
.topbar-shell { width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 12px; }
.topbar-brand, .topbar-actions, .account-button, .system-status { display: flex; align-items: center; }
.topbar-brand { gap: 11px; min-width: 0; }
.app-icon { width: 36px; height: 36px; border-radius: 10px; flex: 0 0 auto; }
.brand-copy { display: flex; align-items: baseline; gap: 7px; white-space: nowrap; }
.brand-copy .organization { color: var(--dh-muted); font-size: 12px; font-weight: 600; }
.brand-copy strong { font-size: 15px; }
.version-badge, .status-pill, .count-badge { display: inline-flex; align-items: center; border: 1px solid var(--dh-border); background: var(--dh-surface-2); color: var(--dh-muted); border-radius: 999px; font-size: 11px; font-weight: 700; }
.version-badge { padding: 4px 8px; }
.version-control { display: flex; align-items: center; gap: 5px; }
.version-update-button { width: 26px; height: 26px; display: grid; place-items: center; padding: 0; border: 1px solid color-mix(in srgb, var(--dh-warning) 55%, transparent); border-radius: 50%; background: color-mix(in srgb, var(--dh-warning) 16%, transparent); color: var(--dh-warning); animation: version-update-pulse 2.4s ease-in-out infinite; }
.version-update-button:hover, .version-update-button:focus-visible { background: var(--dh-warning); color: #17120a; }
.version-update-button .material-symbols-outlined { font-size: 18px; font-weight: 700; }
@keyframes version-update-pulse { 50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--dh-warning) 12%, transparent); } }
@media (prefers-reduced-motion: reduce) { .version-update-button { animation: none; } }
.primary-nav { align-items: center; gap: 4px; margin-left: 14px; padding: 4px; border: 1px solid var(--dh-border); border-radius: 999px; background: color-mix(in srgb, var(--dh-surface-2) 82%, transparent); }
.view-tab { display: inline-flex; align-items: center; gap: 7px; min-height: 38px; padding: 7px 14px; border: 0; border-radius: 999px; background: transparent; color: var(--dh-muted); font-weight: 700; }
.view-tab .material-symbols-outlined { font-size: 18px; }
.view-tab:hover, .view-tab:focus-visible, .view-tab.active { background: var(--dh-surface); color: var(--dh-text); }
.topbar-actions { gap: 9px; margin-left: auto; }
.icon-button { width: 38px; height: 38px; display: grid; place-items: center; border: 0; border-radius: 10px; background: transparent; color: var(--dh-muted); }
.icon-button:hover, .icon-button:focus-visible { background: var(--dh-surface-3); color: var(--dh-text); }
.system-status { gap: 7px; padding: 7px 10px; color: var(--dh-muted); font-size: 12px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #6d7481; box-shadow: 0 0 0 4px rgba(109,116,129,.1); }
.system-status.ok .status-dot { background: var(--dh-success); box-shadow: 0 0 0 4px rgba(85,214,161,.1); }
.system-status.error .status-dot { background: var(--dh-danger); box-shadow: 0 0 0 4px rgba(255,125,145,.1); }
.account-button { gap: 9px; min-height: 40px; padding: 3px 9px 3px 4px; border: 1px solid var(--dh-border); border-radius: 14px; background: var(--dh-surface-2); color: var(--dh-text); }
.account-button:hover, .account-button:focus-visible { background: var(--dh-surface-3); }
.avatar { width: 32px; height: 32px; display: inline-grid; place-items: center; flex: 0 0 auto; border-radius: 50%; background: var(--dh-primary-soft); color: var(--dh-primary-strong); font-size: 11px; font-weight: 700; }
.avatar-stack { display: flex; padding-left: 8px; }
.avatar-stack .avatar { margin-left: -8px; border: 2px solid var(--dh-surface); }
.avatar-button { padding: 0; border: 0; border-radius: 50%; background: transparent; color: inherit; }
.avatar-button:hover, .avatar-button:focus-visible { position: relative; z-index: 2; outline: 2px solid var(--dh-primary); outline-offset: 2px; }

.mobile-tabbar { display: none; }
.sidebar-backdrop { display: none; }
.workspace-grid { min-height: calc(100vh - 68px); display: grid; grid-template-columns: 292px minmax(0, 1fr) 310px; }
.workspace-grid.admin-mode { grid-template-columns: minmax(0, 1fr); }
.workspace-grid.admin-mode .sidebar, .workspace-grid.admin-mode .context-panel { display: none; }
.workspace-grid.admin-mode .workspace { width: min(100%, 1440px); margin-inline: auto; }
.sidebar, .context-panel { position: sticky; top: 68px; height: calc(100vh - 68px); overflow: hidden; background: var(--dh-surface); }
.sidebar { display: flex; flex-direction: column; border-right: 1px solid var(--dh-border); }
.context-panel { overflow-y: auto; border-left: 1px solid var(--dh-border); }
.sidebar-heading { min-height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--dh-border); color: var(--dh-muted); font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.sidebar-heading > span { display: flex; align-items: center; gap: 7px; }
.sidebar-heading .material-symbols-outlined { font-size: 18px; }
.sidebar-search { margin: 12px; height: 40px; display: flex; align-items: center; gap: 8px; padding: 0 10px; border: 1px solid var(--dh-border); border-radius: 10px; background: var(--dh-surface-2); color: var(--dh-muted); }
.sidebar-search input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; color: var(--dh-text); }
.sidebar-search kbd { padding: 2px 6px; border: 1px solid var(--dh-border); background: var(--dh-surface); color: var(--dh-muted); }
.entity-tree { flex: 1; overflow-y: auto; padding: 0 8px 16px; }
.tree-root { width: 100%; display: flex; align-items: center; gap: 8px; margin: 4px 0 8px; padding: 9px 10px; border: 0; border-radius: 9px; background: transparent; color: var(--dh-text); text-align: left; font-weight: 600; }
.tree-root:hover { background: var(--dh-surface-2); }
.tree-root.active { background: var(--dh-primary-soft); color: var(--dh-primary-strong); }
.tree-root .material-symbols-outlined { color: var(--dh-primary-strong); }
.tree-section { margin-top: 8px; }
.tree-branch { min-width: 0; }
.tree-node-row { display: flex; align-items: center; min-width: 0; padding-left: calc(var(--tree-depth) * 18px); border-radius: 9px; }
.tree-node-row:hover { background: var(--dh-surface-2); }
.tree-node-row.active { background: var(--dh-primary-soft); color: var(--dh-primary-strong); }
.tree-toggle, .tree-toggle-spacer { width: 26px; height: 34px; flex: 0 0 26px; }
.tree-toggle { display: grid; place-items: center; padding: 0; border: 0; border-radius: 7px; background: transparent; color: var(--dh-muted); }
.tree-toggle:hover, .tree-toggle:focus-visible { color: var(--dh-text); background: var(--dh-surface-3); }
.tree-toggle .material-symbols-outlined { font-size: 18px; }
.tree-entry { min-width: 0; flex: 1; display: flex; align-items: center; gap: 8px; padding: 7px 8px 7px 2px; border: 0; background: transparent; color: inherit; text-align: left; }
.tree-node-icon { color: var(--dh-muted); font-size: 18px; }
.tree-node-row.active .tree-node-icon { color: var(--dh-primary-strong); }
.tree-label { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-presence-stack { display: flex; flex: 0 0 auto; padding-right: 5px; }
.tree-presence-stack .avatar-button { margin-left: -5px; }
.tree-presence-stack .avatar { width: 22px; height: 22px; border: 2px solid var(--dh-surface-2); font-size: 8px; }
.tree-empty { padding: 4px 12px 8px 44px; }
.tree-archive { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--dh-border); }
.tree-node-row.archived { opacity: .82; }
.archive-badge { margin-left: auto; padding: 2px 6px; border: 1px solid color-mix(in srgb, var(--dh-warning) 40%, var(--dh-border)); border-radius: 999px; color: var(--dh-warning); font-size: 9px; font-weight: 800; text-transform: uppercase; }
.sidebar-footer { padding: 12px; border-top: 1px solid var(--dh-border); }

.workspace { min-width: 0; padding: 0 34px 60px; background: var(--dh-bg); }
.workspace-header { min-height: 132px; display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; padding: 26px 0 20px; border-bottom: 1px solid var(--dh-border); }
.breadcrumbs { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; color: var(--dh-muted); font-size: 12px; }
.breadcrumbs button { padding: 2px 0; border: 0; background: transparent; color: var(--dh-primary-strong); font: inherit; text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 3px; }
.breadcrumbs button:hover, .breadcrumbs button:focus-visible { text-decoration-color: currentColor; }
.breadcrumbs > * + *::before { content: "/"; margin-right: 6px; color: var(--dh-border); text-decoration: none; }
.title-row { display: flex; align-items: center; gap: 11px; }
.title-row h1 { margin: 0; font-size: clamp(24px, 3vw, 34px); letter-spacing: -.035em; }
.status-pill { padding: 5px 9px; color: var(--dh-warning); border-color: color-mix(in srgb, var(--dh-warning) 35%, var(--dh-border)); background: color-mix(in srgb, var(--dh-warning) 10%, transparent); }
.status-pill.archived { color: var(--dh-warning); }
.entity-meta { margin: 7px 0 0; color: var(--dh-muted); }
.header-actions { display: flex; align-items: center; gap: 10px; }
.save-state { display: inline-flex; align-items: center; gap: 6px; color: var(--dh-muted); font-size: 12px; }
.save-state .material-symbols-outlined { color: var(--dh-success); }
.notice-area:not(:empty) { margin-top: 18px; }
.notice { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border: 1px solid var(--dh-border); border-radius: 11px; background: var(--dh-surface); }
.notice.warning { border-color: color-mix(in srgb, var(--dh-warning) 40%, var(--dh-border)); background: color-mix(in srgb, var(--dh-warning) 8%, var(--dh-surface)); }
.field-groups { display: grid; gap: 18px; padding-top: 24px; }
.entity-collections { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); gap: 14px; padding-top: 24px; }
.entity-section-tabs { position: sticky; top: 68px; z-index: 1010; display: flex; gap: 6px; margin: 0 -4px; padding: 12px 4px; overflow-x: auto; scrollbar-width: none; background: color-mix(in srgb, var(--dh-bg) 92%, transparent); backdrop-filter: blur(10px); }
.entity-section-tabs::-webkit-scrollbar { display: none; }
.entity-section-tab { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 13px; border: 1px solid transparent; border-radius: 10px; background: transparent; color: var(--dh-muted); font-size: 12px; font-weight: 700; white-space: nowrap; }
.entity-section-tab:hover, .entity-section-tab:focus-visible, .entity-section-tab.active { border-color: var(--dh-border); background: var(--dh-surface); color: var(--dh-text); }
.entity-section-tab.active { box-shadow: inset 0 -2px var(--dh-primary); }
.entity-section-tab .material-symbols-outlined { font-size: 18px; }
.entity-summary { padding-top: 8px; }
.summary-toolbar { display: flex; align-items: end; justify-content: space-between; gap: 20px; padding: 18px 0; }
.summary-toolbar h2 { margin: 0; font-size: clamp(20px, 2.4vw, 28px); }
.summary-period { min-width: 126px; display: grid; gap: 5px; color: var(--dh-muted); font-size: 11px; font-weight: 700; }
.summary-period .form-select { min-height: 40px; border-color: var(--dh-border); background-color: var(--dh-surface); color: var(--dh-text); }
.summary-content { display: grid; gap: 16px; }
.summary-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.summary-kpis article { min-width: 0; display: flex; align-items: center; gap: 12px; padding: 16px; border: 1px solid var(--dh-border); border-radius: var(--dh-radius); background: var(--dh-surface); }
.summary-kpis .material-symbols-outlined { width: 38px; height: 38px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 10px; background: var(--dh-primary-soft); color: var(--dh-primary-strong); }
.summary-kpis strong, .summary-kpis small { display: block; }
.summary-kpis strong { font-size: 22px; letter-spacing: -.04em; }
.summary-kpis small { color: var(--dh-muted); font-size: 11px; }
.summary-panel { min-width: 0; border: 1px solid var(--dh-border); border-radius: var(--dh-radius); background: var(--dh-surface); overflow: hidden; }
.summary-panel > header { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 18px; border-bottom: 1px solid var(--dh-border); background: var(--dh-surface-2); }
.summary-panel h3, .summary-panel h4, .summary-panel p { margin: 0; }
.summary-panel h3 { font-size: 16px; }
.summary-panel > header > small { color: var(--dh-muted); text-align: right; }
.pagespeed-grid, .analytics-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(310px, 100%), 1fr)); gap: 14px; padding: 16px; }
.pagespeed-card, .analytics-card { min-width: 0; border: 1px solid var(--dh-border); border-radius: 12px; background: var(--dh-surface-2); overflow: hidden; }
.pagespeed-card > header, .analytics-card > header { display: flex; align-items: center; gap: 11px; padding: 13px 14px; border-bottom: 1px solid var(--dh-border); }
.pagespeed-card > header > .material-symbols-outlined, .summary-source-icon { width: 34px; height: 34px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 9px; background: var(--dh-primary-soft); color: var(--dh-primary-strong); }
.pagespeed-card h4, .analytics-card h4 { font-size: 13px; }
.pagespeed-card small, .analytics-card small { color: var(--dh-muted); font-size: 10px; }
.score-list { display: grid; gap: 11px; padding: 15px; }
.score-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 6px 12px; font-size: 11px; }
.score-item strong { font-size: 13px; }
.score-item strong.good { color: var(--dh-success); }
.score-item strong.warning { color: var(--dh-warning); }
.score-item strong.bad { color: var(--dh-danger); }
.score-track { grid-column: 1 / -1; height: 5px; overflow: hidden; border-radius: 999px; background: var(--dh-surface-3); }
.score-track span { width: var(--score); height: 100%; display: block; border-radius: inherit; background: var(--dh-muted); }
.score-track span.good { background: var(--dh-success); }
.score-track span.warning { background: var(--dh-warning); }
.score-track span.bad { background: var(--dh-danger); }
.agentic-score { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 15px; border-top: 1px solid var(--dh-border); color: var(--dh-muted); font-size: 11px; }
.agentic-score strong { color: var(--dh-text); font-size: 14px; }
.summary-sparkline { width: 100%; height: 82px; display: block; padding: 10px 12px 0; overflow: visible; }
.summary-sparkline line { stroke: var(--dh-border); stroke-width: 1; }
.summary-sparkline polyline { fill: none; stroke: var(--dh-primary-strong); stroke-width: 3; vector-effect: non-scaling-stroke; }
.summary-chart { padding: 8px 12px 2px; }
.summary-chart-toolbar { display: flex; justify-content: flex-end; gap: 6px; margin-bottom: 2px; }
.chart-tool { padding: 3px 9px; border: 1px solid var(--dh-border); border-radius: 999px; background: transparent; color: var(--dh-muted); font-size: 10px; font-weight: 600; touch-action: manipulation; }
.chart-tool:hover { border-color: var(--dh-primary-strong); color: var(--dh-primary-strong); }
.chart-tool[aria-pressed="true"] { border-color: var(--dh-primary-strong); background: var(--dh-primary-soft); color: var(--dh-primary-strong); }
.chart-tool[hidden] { display: none; }
.comparison-panel { margin: 16px 16px 0; border: 1px solid var(--dh-border); border-radius: 12px; background: var(--dh-surface-2); }
.comparison-panel > header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 13px 14px; border-bottom: 1px solid var(--dh-border); }
.comparison-panel h4 { font-size: 13px; }
.comparison-panel small { color: var(--dh-muted); font-size: 10px; }
.comparison-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 12px; padding: 12px; }
.comparison-item { min-width: 0; border: 1px solid var(--dh-border); border-radius: 10px; background: var(--dh-surface); overflow: hidden; }
.comparison-item > header { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 10px 12px 0; }
.comparison-item h5 { margin: 0; font-size: 12px; }
.comparison-item small { color: var(--dh-muted); font-size: 10px; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0; padding: 2px 2px 6px; list-style: none; }
.chart-legend li { display: flex; align-items: center; gap: 6px; color: var(--dh-muted); font-size: 10px; font-weight: 600; }
.chart-legend strong { color: var(--dh-text); font-size: 11px; }
.chart-legend-swatch { width: 10px; height: 10px; flex: 0 0 auto; border-radius: 3px; }
.summary-chart-canvas { position: relative; height: 148px; }
.summary-chart-canvas.is-tall { height: 232px; }
.summary-chart canvas { width: 100% !important; height: 100% !important; cursor: crosshair; }
.summary-chart canvas:focus-visible { outline: 2px solid var(--dh-primary-strong); outline-offset: 2px; border-radius: 6px; }
.analytics-card dl { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0; padding: 12px 14px 15px; }
.analytics-card dl > div { min-width: 0; padding-right: 9px; }
.analytics-card dl > div + div { padding-left: 9px; border-left: 1px solid var(--dh-border); }
.analytics-card dt { overflow: hidden; color: var(--dh-muted); font-size: 9px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.analytics-card dd { margin: 3px 0 0; font-size: 16px; font-weight: 700; letter-spacing: -.03em; }
.analytics-awaiting, .summary-empty { display: flex; align-items: center; gap: 12px; color: var(--dh-muted); }
.analytics-awaiting { min-height: 112px; padding: 18px; }
.analytics-awaiting p { font-size: 11px; line-height: 1.55; }
.summary-empty { min-height: 132px; justify-content: center; padding: 24px; text-align: left; }
.summary-empty > .material-symbols-outlined { color: var(--dh-primary-strong); font-size: 32px; }
.summary-empty strong { display: block; color: var(--dh-text); }
.summary-empty p { max-width: 620px; margin-top: 4px; font-size: 11px; line-height: 1.55; }
.collection-card { min-width: 0; display: flex; flex-direction: column; border: 1px solid var(--dh-border); border-radius: var(--dh-radius); background: var(--dh-surface); overflow: hidden; }
.collection-card > header { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; gap: 11px; padding: 15px; border-bottom: 1px solid var(--dh-border); background: var(--dh-surface-2); }
.collection-card h2, .collection-card p { margin: 0; }
.collection-card h2 { font-size: 14px; }
.collection-card p { margin-top: 3px; color: var(--dh-muted); font-size: 11px; line-height: 1.45; }
.collection-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; background: var(--dh-primary-soft); color: var(--dh-primary-strong); }
.collection-items { min-width: 0; display: grid; }
.collection-item, .collection-person { min-width: 0; min-height: 52px; display: flex; align-items: center; gap: 10px; padding: 10px 14px; border: 0; border-bottom: 1px solid var(--dh-border); background: transparent; color: var(--dh-text); text-align: left; }
.collection-item:hover, .collection-item:focus-visible { background: var(--dh-primary-soft); }
.collection-item > .material-symbols-outlined:first-child { color: var(--dh-primary-strong); }
.collection-item > span:nth-child(2), .collection-person > span:last-child { min-width: 0; flex: 1; }
.collection-item strong, .collection-item small, .collection-person strong, .collection-person small { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.collection-item strong, .collection-person strong { font-size: 12px; }
.collection-item small, .collection-person small { color: var(--dh-muted); font-size: 10px; }
.collection-chevron { margin-left: auto; color: var(--dh-muted); }
.collection-empty { padding: 16px; }
.collection-card > footer { min-height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; padding: 9px 12px; }
.collection-card > footer .btn { min-height: 36px; }
.folder-browser { margin-top: 24px; border: 1px solid var(--dh-border); border-radius: var(--dh-radius); background: var(--dh-surface); overflow: hidden; }
.folder-browser > header { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--dh-border); background: var(--dh-surface-2); }
.folder-browser > header > .material-symbols-outlined { color: var(--dh-primary-strong); font-size: 28px; }
.folder-browser h2, .folder-browser p, .folder-empty h2, .folder-empty p { margin: 0; }
.folder-browser h2 { font-size: 14px; }
.folder-browser p, .folder-empty p { color: var(--dh-muted); font-size: 12px; }
.folder-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; padding: 18px; }
.folder-item { min-width: 0; display: grid; justify-items: start; gap: 6px; padding: 16px; border: 1px solid var(--dh-border); border-radius: 12px; background: var(--dh-surface-2); color: var(--dh-text); text-align: left; }
.folder-item:hover, .folder-item:focus-visible { border-color: var(--dh-primary); background: var(--dh-primary-soft); }
.folder-item > .material-symbols-outlined { color: var(--dh-primary-strong); font-size: 28px; }
.folder-item strong, .folder-item small { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-item small { color: var(--dh-muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; }
.folder-empty { min-height: 280px; display: grid; place-items: center; align-content: center; gap: 8px; margin-top: 24px; padding: 36px; border: 1px dashed var(--dh-border); border-radius: var(--dh-radius); color: var(--dh-muted); text-align: center; }
.folder-empty > .material-symbols-outlined { color: var(--dh-primary-strong); font-size: 42px; }
.folder-empty h2 { color: var(--dh-text); font-size: 17px; }
.field-group { border: 1px solid var(--dh-border); border-radius: var(--dh-radius); background: var(--dh-surface); overflow: hidden; }
.field-group-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 15px 18px; border-bottom: 1px solid var(--dh-border); background: var(--dh-surface-2); }
.field-group-header h2 { margin: 0; font-size: 14px; }
.group-chip { padding: 4px 8px; border-radius: 999px; background: var(--dh-primary-soft); color: var(--dh-primary-strong); font-size: 10px; font-weight: 700; text-transform: uppercase; }
.field-list { display: grid; }
.field-row { position: relative; display: grid; grid-template-columns: minmax(150px, 32%) minmax(0, 1fr); gap: 22px; padding: 18px; border-bottom: 1px solid var(--dh-border); }
.field-row:last-child { border-bottom: 0; }
.field-row.is-focused { box-shadow: inset 3px 0 var(--dh-primary); background: var(--dh-primary-soft); }
.field-row.is-locked { background: color-mix(in srgb, var(--dh-surface-2) 50%, transparent); }
.field-label { display: flex; flex-direction: column; gap: 5px; }
.field-label label { font-weight: 600; }
.field-label p { margin: 0; color: var(--dh-muted); font-size: 12px; line-height: 1.5; }
.field-group-tag { width: max-content; color: var(--dh-muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; }
.field-control-wrap { min-width: 0; }
.field-control { min-height: 42px; border-color: var(--dh-border); background: var(--dh-surface-2); color: var(--dh-text); }
.field-control:focus { border-color: var(--dh-primary); box-shadow: 0 0 0 3px var(--dh-primary-soft); background: var(--dh-surface); color: var(--dh-text); }
.field-control:disabled { opacity: .72; }
.field-footer { min-height: 26px; display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 7px; }
.field-meta { color: var(--dh-muted); font-size: 10px; }
.field-actions { display: flex; align-items: center; gap: 7px; }
.field-save { padding: 5px 10px; font-size: 11px; }
.field-save:not(.d-none) { display: inline-flex !important; }
.presence-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px 4px 4px; border: 1px solid color-mix(in srgb, var(--dh-primary) 35%, var(--dh-border)); border-radius: 999px; background: var(--dh-primary-soft); color: var(--dh-primary-strong); font-size: 10px; }
.presence-chip .avatar { width: 20px; height: 20px; font-size: 8px; }
.lock-copy { display: flex; align-items: center; gap: 5px; color: var(--dh-muted); font-size: 11px; }
.lock-copy .material-symbols-outlined { font-size: 16px; }

.section-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 28px 0 20px; }
.section-toolbar h2 { margin: 0; font-size: 24px; }
.relation-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.entity-relations { margin-top: 12px; padding-top: 6px; border-top: 1px solid var(--dh-border); }
.relation-card { padding: 16px; border: 1px solid var(--dh-border); border-radius: var(--dh-radius); background: var(--dh-surface); }
.relation-direction { display: flex; align-items: center; gap: 9px; margin-bottom: 12px; }
.relation-node { min-width: 0; flex: 1; padding: 10px; border-radius: 9px; background: var(--dh-surface-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.relation-type { color: var(--dh-primary-strong); font-size: 11px; font-weight: 700; text-transform: uppercase; }
.relation-card p { margin: 0; color: var(--dh-muted); font-size: 12px; }
.user-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 14px; padding-bottom: 28px; }
.user-card { min-width: 0; padding: 16px; border: 1px solid var(--dh-border); border-radius: var(--dh-radius); background: var(--dh-surface); }
.user-card header { min-width: 0; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; }
.user-card header strong, .user-card header small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-card header small { color: var(--dh-muted); font-size: 10px; }
.user-card dl { display: grid; gap: 10px; margin: 14px 0 0; }
.user-card dl div { min-width: 0; padding-top: 10px; border-top: 1px solid var(--dh-border); }
.user-card dt { color: var(--dh-muted); font-size: 10px; text-transform: uppercase; }
.user-card dd { margin: 3px 0 0; overflow-wrap: anywhere; font-size: 12px; }
.user-card > .btn { margin-top: 14px; min-height: 38px; }
.permission-filters { margin-bottom: 18px; }
.permission-filters .sidebar-search { max-width: 520px; margin: 0; }
.role-chip { display: inline-flex; padding: 4px 8px; border-radius: 999px; background: var(--dh-primary-soft); color: var(--dh-primary-strong); font-size: 10px; font-weight: 700; }
.role-chip.pending { background: color-mix(in srgb, var(--dh-warning) 18%, transparent); color: var(--dh-warning); }
.groups-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; padding-bottom: 28px; }
.permissions-groups { margin-top: 10px; border-top: 1px solid var(--dh-border); }
.group-card { display: grid; gap: 14px; padding: 18px; border: 1px solid var(--dh-border); border-radius: var(--dh-radius); background: var(--dh-surface); }
.group-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.group-card h3, .group-card p { margin: 0; }
.group-card h3 { font-size: 15px; }
.group-card p { color: var(--dh-muted); font-size: 12px; line-height: 1.55; }
.group-id { color: var(--dh-muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; }
.group-members-preview { display: flex; align-items: center; gap: 8px; min-height: 32px; }
.group-members-preview .avatar { margin-right: -4px; }
.group-members-preview small { margin-left: 4px; color: var(--dh-muted); }
.group-members { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px; max-height: 300px; overflow-y: auto; }
.group-member { display: flex; align-items: center; gap: 9px; padding: 10px; border: 1px solid var(--dh-border); border-radius: 10px; background: var(--dh-surface-2); }
.group-member-copy { min-width: 0; flex: 1; }
.group-member-copy strong, .group-member-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.group-member-copy strong { font-size: 11px; }
.group-member-copy small { color: var(--dh-muted); font-size: 9px; }

.schema-filters { display: grid; grid-template-columns: minmax(240px, 1fr) repeat(3, minmax(150px, 220px)); gap: 12px; margin-bottom: 18px; }
.schema-filters .sidebar-search { margin: 0; }
.schema-fields-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(330px, 100%), 1fr)); gap: 14px; padding-bottom: 28px; }
.schema-field-card { min-width: 0; display: flex; flex-direction: column; gap: 13px; padding: 17px; border: 1px solid var(--dh-border); border-radius: var(--dh-radius); background: var(--dh-surface); }
.schema-field-card.is-hidden { opacity: .72; }
.schema-field-card header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.schema-field-card h3, .schema-field-card p { margin: 0; }
.schema-field-card h3 { font-size: 15px; }
.schema-field-card p { min-height: 38px; color: var(--dh-muted); font-size: 12px; line-height: 1.55; }
.schema-field-card dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 0; }
.schema-field-card dl div { min-width: 0; padding: 9px; border-radius: 9px; background: var(--dh-surface-2); }
.schema-field-card dt { color: var(--dh-muted); font-size: 9px; text-transform: uppercase; }
.schema-field-card dd { margin: 3px 0 0; overflow-wrap: anywhere; font-size: 11px; font-weight: 600; }
.schema-field-card dd small { display: block; color: var(--dh-muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 400; }
.schema-field-card footer { min-height: 24px; display: flex; align-items: center; flex-wrap: wrap; gap: 6px; border-top: 1px solid var(--dh-border); padding-top: 11px; }
.schema-chip { display: inline-flex; padding: 4px 7px; border-radius: 999px; background: var(--dh-primary-soft); color: var(--dh-primary-strong); font-size: 9px; font-weight: 700; }
.schema-chip.muted { background: var(--dh-surface-3); color: var(--dh-muted); }
#fieldDefinitionModal .modal-body.row { margin-inline: 0; }
.entity-files, .entity-export { padding-bottom: 30px; }
.export-actions { display: flex; gap: 8px; }
.export-actions .btn, .export-download .btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.button-count { min-width: 20px; padding: 2px 6px; border-radius: 999px; background: rgba(255,255,255,.18); color: currentColor; font-size: 9px; font-weight: 800; }
.export-options { margin-bottom: 18px; padding: 14px 16px; border: 1px solid var(--dh-border); border-radius: var(--dh-radius); background: var(--dh-surface); }
.export-options .form-check { display: flex; align-items: flex-start; gap: 10px; margin: 0; padding: 0; }
.export-options .form-check-input { flex: 0 0 auto; margin: 3px 0 0; }
.export-options strong, .export-options small { display: block; }
.export-options small { margin-top: 2px; color: var(--dh-muted); font-size: 10px; }
.export-result { display: grid; gap: 14px; }
.export-empty { min-height: 220px; margin-top: 0; }
.export-download { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 16px; border: 1px solid color-mix(in srgb, var(--dh-success) 45%, var(--dh-border)); border-radius: var(--dh-radius); background: color-mix(in srgb, var(--dh-success) 8%, var(--dh-surface)); }
.export-download > .material-symbols-outlined { color: var(--dh-success); font-size: 30px; }
.export-download strong, .export-download small { display: block; }
.export-download small { margin-top: 3px; color: var(--dh-muted); font-size: 10px; overflow-wrap: anywhere; }
.export-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.export-summary article { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 2px 9px; padding: 14px; border: 1px solid var(--dh-border); border-radius: var(--dh-radius); background: var(--dh-surface); }
.export-summary .material-symbols-outlined { grid-row: 1 / 3; color: var(--dh-primary-strong); }
.export-summary strong { font-size: 14px; }
.export-summary small { color: var(--dh-muted); font-size: 9px; }
.export-issues { display: grid; gap: 7px; }
.export-issue { display: flex; align-items: flex-start; gap: 8px; padding: 10px 12px; border: 1px solid var(--dh-border); border-radius: 10px; background: var(--dh-surface); font-size: 11px; }
.export-issue.error { border-color: color-mix(in srgb, var(--dh-danger) 45%, var(--dh-border)); }
.export-issue.warning { border-color: color-mix(in srgb, var(--dh-warning) 45%, var(--dh-border)); }
.export-issue.error .material-symbols-outlined { color: var(--dh-danger); }
.export-issue.warning .material-symbols-outlined { color: var(--dh-warning); }
.export-preview { border: 1px solid var(--dh-border); border-radius: var(--dh-radius); background: var(--dh-surface); overflow: hidden; }
.export-preview summary { cursor: pointer; padding: 13px 15px; font-size: 12px; font-weight: 700; }
.export-preview pre, .export-preview ul { max-height: 360px; margin: 0; padding: 15px; overflow: auto; border-top: 1px solid var(--dh-border); background: var(--dh-surface-2); color: var(--dh-text); font-size: 10px; }
.export-preview ul { padding-left: 34px; }
.export-preview li + li { margin-top: 6px; }
.publication-plan { display: grid; gap: 14px; }
.publication-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.publication-summary article { padding: 13px; border: 1px solid var(--dh-border); border-radius: 11px; background: var(--dh-surface-2); }
.publication-summary strong, .publication-summary small { display: block; }
.publication-summary strong { font-size: 16px; }
.publication-summary small { margin-top: 2px; color: var(--dh-muted); font-size: 9px; }
.publication-group { border: 1px solid var(--dh-border); border-radius: var(--dh-radius); background: var(--dh-surface); overflow: hidden; }
.publication-group > header { padding: 12px 14px; border-bottom: 1px solid var(--dh-border); background: var(--dh-surface-2); }
.publication-group h3, .publication-group p { margin: 0; }
.publication-group h3 { font-size: 13px; }
.publication-group p { margin-top: 3px; color: var(--dh-muted); font-size: 10px; }
.publication-files { display: grid; }
.publication-file { min-width: 0; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--dh-border); }
.publication-file:last-child { border-bottom: 0; }
.publication-file > .material-symbols-outlined { color: var(--dh-primary-strong); }
.publication-file strong, .publication-file small, .publication-file code { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.publication-file small { margin-top: 2px; color: var(--dh-muted); font-size: 9px; }
.publication-file code { margin-top: 4px; color: var(--dh-primary-strong); font-size: 9px; }
.publication-file.blocked > .material-symbols-outlined { color: var(--dh-warning); }
.publication-result { padding: 14px; border: 1px solid color-mix(in srgb, var(--dh-success) 45%, var(--dh-border)); border-radius: var(--dh-radius); background: color-mix(in srgb, var(--dh-success) 8%, var(--dh-surface)); }
.publication-result strong, .publication-result small { display: block; }
.publication-result small { margin-top: 4px; color: var(--dh-muted); }
.file-filters { display: grid; grid-template-columns: minmax(220px, 1fr) repeat(2, minmax(150px, 220px)); gap: 12px; margin-bottom: 18px; }
.file-filters .sidebar-search { margin: 0; }
.file-cards { display: grid; gap: 12px; }
.file-card { min-width: 0; padding: 17px; border: 1px solid var(--dh-border); border-radius: var(--dh-radius); background: var(--dh-surface); }
.file-card > header { min-width: 0; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; gap: 12px; }
.file-card h3, .file-card p { margin: 0; }
.file-card h3 { font-size: 14px; }
.file-card p { margin-top: 4px; color: var(--dh-muted); font-size: 11px; line-height: 1.5; }
.file-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; background: var(--dh-primary-soft); color: var(--dh-primary-strong); }
.file-status.review { color: var(--dh-warning); }
.file-status.approved { color: var(--dh-success); }
.file-status.archived { color: var(--dh-muted); }
.file-facts { display: flex; flex-wrap: wrap; gap: 7px; margin: 14px 0; }
.file-facts span { padding: 5px 8px; border-radius: 999px; background: var(--dh-surface-2); color: var(--dh-muted); font-size: 10px; }
.file-publication-readiness { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 8px; font-size: 10px; font-weight: 700; }
.file-publication-readiness .material-symbols-outlined { font-size: 16px; }
.file-publication-readiness.ready { color: var(--dh-success); }
.file-publication-readiness.blocked { color: var(--dh-warning); }
.file-card footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 12px; border-top: 1px solid var(--dh-border); }
.file-modal-dialog.is-markdown { width: 90vw; max-width: 1800px; height: 90dvh; margin: 5dvh auto; }
.file-modal-dialog .modal-body.row { margin: 0; }
.file-modal-dialog.is-markdown .modal-content { height: 90dvh; overflow: hidden; }
.file-modal-dialog.is-markdown .modal-body { min-height: 0; overflow: auto; }
.markdown-editor-section { min-height: 440px; }
.markdown-editor-workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: 440px; height: min(52dvh, 720px); overflow: hidden; border: 1px solid var(--dh-border); border-radius: var(--dh-radius); background: var(--dh-surface); }
.markdown-source-pane, .markdown-preview-pane { display: flex; min-width: 0; min-height: 0; flex-direction: column; }
.markdown-source-pane { border-right: 1px solid var(--dh-border); }
.markdown-pane-heading { display: flex; min-height: 44px; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--dh-border); background: var(--dh-surface-2); font-size: 12px; font-weight: 700; }
.markdown-pane-heading small { color: var(--dh-muted); font-weight: 500; }
#fileMarkdown { min-height: 0; height: 100%; resize: none; border: 0; border-radius: 0; padding: 18px; background: transparent; line-height: 1.65; box-shadow: none; }
.literature-preview { min-height: 0; height: 100%; overflow: auto; padding: clamp(18px, 3vw, 42px); line-height: 1.65; }
.literature-preview > :first-child { margin-top: 0; }
.literature-preview h2, .literature-preview h3, .literature-preview h4, .literature-preview h5, .literature-preview h6 { margin: 1.35em 0 .55em; line-height: 1.25; }
.literature-preview p { margin: 0 0 1em; }
.literature-preview blockquote { margin: 1rem 0; padding: .75rem 1rem; border-left: 4px solid var(--dh-primary); background: var(--dh-surface-2); }
.literature-preview pre { overflow: auto; padding: 14px; border-radius: 10px; background: #111827; color: #e5e7eb; }
.literature-preview code { overflow-wrap: anywhere; }
.literature-preview img { display: block; max-width: 100%; height: auto; }
.literature-preview table { width: 100%; margin: 1rem 0; border-collapse: collapse; }
.literature-preview th, .literature-preview td { padding: 8px 10px; border: 1px solid var(--dh-border); vertical-align: top; }
.literature-preview-empty { display: grid; height: 100%; place-items: center; color: var(--dh-muted); text-align: center; }
.file-autosave-status { display: inline-flex; align-items: center; gap: 7px; color: var(--dh-muted); font-size: 12px; }
.file-autosave-status .material-symbols-outlined { font-size: 18px; }
.file-autosave-status.is-saving { color: var(--dh-warning); }
.file-autosave-status.is-error { color: var(--dh-danger); }
.markdown-mobile-tabs { grid-template-columns: 1fr 1fr; margin-bottom: 10px; padding: 3px; border: 1px solid var(--dh-border); border-radius: 10px; background: var(--dh-surface-2); }
.markdown-mobile-tabs button { min-height: 38px; border: 0; border-radius: 7px; background: transparent; color: var(--dh-muted); font-weight: 700; }
.markdown-mobile-tabs button.active { background: var(--dh-surface); color: var(--dh-text); box-shadow: 0 1px 4px rgba(0, 0, 0, .16); }
.file-source { color: var(--dh-muted); font-size: 10px; }
.file-actions { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.file-actions .btn { display: inline-flex; align-items: center; gap: 5px; }
.file-actions .material-symbols-outlined { font-size: 17px; }
.file-source-switch { display: flex; flex-wrap: wrap; gap: 10px; }
.file-source-switch label { min-height: 42px; display: flex; align-items: center; gap: 8px; padding: 9px 12px; border: 1px solid var(--dh-border); border-radius: 10px; background: var(--dh-surface-2); }
.file-source-switch label:has(input:checked) { border-color: var(--dh-primary); background: var(--dh-primary-soft); color: var(--dh-primary-strong); }
.loader-path-preview, .file-loader-path { min-width: 0; display: flex; align-items: flex-start; gap: 10px; border: 1px solid var(--dh-border); border-radius: 10px; background: var(--dh-surface-2); color: var(--dh-muted); }
.loader-path-preview { padding: 12px; }
.loader-path-preview .material-symbols-outlined, .file-loader-path .material-symbols-outlined { flex: 0 0 auto; font-size: 18px; color: var(--dh-primary-strong); }
.loader-path-preview div { min-width: 0; display: grid; gap: 3px; }
.loader-path-preview small { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; }
.loader-path-preview code, .file-loader-path code { min-width: 0; overflow-wrap: anywhere; color: var(--dh-text); font-size: 11px; }
.file-loader-path { margin: 0 0 14px; padding: 9px 10px; }
.field-scope-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
.field-scope-option { display: flex; align-items: center; gap: 8px; min-height: 42px; padding: 9px 11px; border: 1px solid var(--dh-border); border-radius: 10px; background: var(--dh-surface-2); }

.context-section { padding: 20px; border-bottom: 1px solid var(--dh-border); }
.context-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.context-heading h2 { margin: 0; font-size: 13px; }
.count-badge { min-width: 24px; justify-content: center; padding: 3px 7px; }
.text-button { padding: 0; border: 0; background: none; color: var(--dh-primary-strong); font-size: 11px; font-weight: 600; }
.empty-copy { margin: 0; color: var(--dh-muted); font-size: 12px; line-height: 1.55; }
.presence-list, .relation-summary, .activity-list { display: grid; gap: 12px; }
.presence-person, .activity-item { display: flex; align-items: flex-start; gap: 10px; }
.presence-person { width: 100%; padding: 8px; border: 0; border-radius: 9px; background: var(--dh-surface-2); color: var(--dh-text); text-align: left; }
.presence-person:hover, .presence-person:focus-visible { background: var(--dh-primary-soft); }
.presence-person > div { min-width: 0; }
.presence-person strong, .presence-person small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.field-row.is-presence-target { animation: presence-target 1.8s ease-out; box-shadow: inset 3px 0 var(--dh-success); }
@keyframes presence-target { 0%, 45% { background: color-mix(in srgb, var(--dh-success) 16%, var(--dh-surface)); } 100% { background: transparent; } }
.presence-person strong, .activity-item strong { display: block; font-size: 11px; }
.presence-person small, .activity-item small { color: var(--dh-muted); font-size: 10px; }
.relation-summary-item { display: flex; align-items: center; gap: 9px; padding: 9px; border-radius: 9px; background: var(--dh-surface-2); }
.relation-summary-item .material-symbols-outlined { color: var(--dh-primary-strong); }
.relation-summary-item div { min-width: 0; }
.relation-summary-item strong, .relation-summary-item small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.relation-summary-item strong { font-size: 11px; }
.relation-summary-item small { color: var(--dh-muted); font-size: 9px; }
.activity-item .activity-icon { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; background: var(--dh-surface-3); color: var(--dh-muted); }
.activity-item .activity-icon .material-symbols-outlined { font-size: 17px; }
.context-activity { min-height: 220px; }
.entity-wordpress > .section-toolbar + .section-toolbar, .entity-wordpress .user-cards + .section-toolbar { margin-top: 8px; }
.wordpress-events { display: grid; gap: 8px; margin: 0 0 16px; padding: 0; list-style: none; }
.wordpress-event { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--dh-border); border-radius: 10px; background: var(--dh-surface); }
.wordpress-event strong, .wordpress-event small { display: block; overflow-wrap: anywhere; }
.wordpress-event strong { font-size: 12px; }
.wordpress-event small { color: var(--dh-muted); font-size: 10px; }
.wordpress-event.high { border-color: color-mix(in srgb, var(--dh-danger) 45%, var(--dh-border)); }
.wordpress-event.high .activity-icon { background: color-mix(in srgb, var(--dh-danger) 16%, transparent); color: var(--dh-danger); }
.role-chip.danger { background: color-mix(in srgb, var(--dh-danger) 16%, transparent); color: var(--dh-danger); }
.role-chip.muted { background: var(--dh-surface-3); color: var(--dh-muted); }
.user-card.removed { opacity: .72; }

.modal-content { border: 1px solid var(--dh-border); border-radius: 16px; background: var(--dh-surface); color: var(--dh-text); }
.modal-header, .modal-footer { border-color: var(--dh-border); }
.creation-path { display: flex; align-items: center; gap: 10px; padding: 11px 13px; border: 1px solid var(--dh-border); border-radius: 10px; background: var(--dh-surface-2); }
.creation-path > .material-symbols-outlined { color: var(--dh-primary-strong); }
.creation-path small, .creation-path strong { display: block; }
.creation-path small { color: var(--dh-muted); font-size: 10px; text-transform: uppercase; }
.form-control, .form-select { border-color: var(--dh-border); background-color: var(--dh-surface-2); color: var(--dh-text); }
.form-control:focus, .form-select:focus { border-color: var(--dh-primary); box-shadow: 0 0 0 3px var(--dh-primary-soft); background-color: var(--dh-surface); color: var(--dh-text); }
.field-option-editor { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; margin-top: 8px; }
.modal-body { overflow-x: hidden; }
.account-menu { width: min(380px, 100vw) !important; border-color: var(--dh-border); background: var(--dh-bg); color: var(--dh-text); }
.account-menu .offcanvas-header { min-height: 68px; border-bottom: 1px solid var(--dh-border); background: var(--dh-surface-2); }
.account-menu .offcanvas-header small { color: var(--dh-muted); }
.account-menu-heading { margin: 0 0 9px; color: var(--dh-muted); font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.account-menu-profile { min-width: 0; display: flex; align-items: center; gap: 12px; padding: 15px; border: 1px solid var(--dh-border); border-radius: 14px; background: var(--dh-surface); }
.account-menu-profile .avatar { width: 42px; height: 42px; }
.account-menu-profile > span:last-child { min-width: 0; }
.account-menu-profile strong, .account-menu-profile small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-menu-profile small { color: var(--dh-muted); font-size: 10px; }
.account-menu-nav { display: grid; gap: 8px; }
.account-menu-link { width: 100%; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; padding: 12px 14px; border: 1px solid var(--dh-border); border-radius: 14px; background: var(--dh-surface); color: var(--dh-text); text-align: left; }
.account-menu-link > span { display: flex; align-items: center; gap: 9px; font-weight: 700; }
.account-menu-link small { color: var(--dh-muted); }
.account-menu-link:hover, .account-menu-link:focus-visible { border-color: var(--dh-primary); background: var(--dh-primary-soft); }
.account-menu-link .material-symbols-outlined { font-size: 19px; }
.update-version-list { display: grid; gap: 10px; }
.update-version-list div { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 11px 13px; border: 1px solid var(--dh-border); border-radius: 12px; background: var(--dh-surface-2); }
.update-version-list dt { color: var(--dh-muted); font-size: 12px; font-weight: 600; }
.update-version-list dd { margin: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; font-weight: 700; }

@media (max-width: 1199.98px) {
  .workspace-grid { grid-template-columns: 270px minmax(0, 1fr); }
  .context-panel { display: none; }
}

@media (max-width: 991.98px) {
  .topbar { height: 60px; }
  .brand-copy .organization, .version-badge { display: none; }
  .workspace-grid { display: block; }
  .mobile-tabbar { position: sticky; top: 60px; z-index: 1020; display: flex; gap: 5px; margin: 8px 10px 0; padding: 5px; border: 1px solid var(--dh-border); border-radius: 16px; background: color-mix(in srgb, var(--dh-bg) 90%, transparent); backdrop-filter: blur(10px); box-shadow: 0 8px 22px var(--dh-shadow); }
  .mobile-tabbar-link { min-width: 0; min-height: 42px; flex: 1; display: flex; align-items: center; justify-content: center; gap: 5px; padding: 6px 8px; border: 0; border-radius: 12px; background: transparent; color: var(--dh-muted); font-size: 11px; font-weight: 800; }
  .mobile-tabbar-link .material-symbols-outlined { font-size: 18px; }
  .mobile-tabbar-link:hover, .mobile-tabbar-link:focus-visible, .mobile-tabbar-link.active { border: 1px solid var(--dh-border); background: var(--dh-surface); color: var(--dh-text); }
  .sidebar { position: fixed; z-index: 1040; top: 60px; left: 0; width: min(86vw, 310px); height: calc(100dvh - 60px); transform: translateX(-105%); box-shadow: var(--dh-shadow); transition: transform .2s ease; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop.show { position: fixed; z-index: 1035; inset: 60px 0 0; display: block; border: 0; background: rgba(2, 6, 23, .62); backdrop-filter: blur(2px); }
  .workspace { padding-inline: 20px; }
  .entity-section-tabs { top: 118px; }
}

@media (max-width: 639.98px) {
  .file-modal-dialog.is-markdown { width: 100%; max-width: none; height: 100dvh; margin: 0; }
  .file-modal-dialog.is-markdown .modal-content { height: 100dvh; }
  .file-modal-dialog.is-markdown .modal-header { padding-block: 12px; }
  .file-modal-dialog.is-markdown .modal-body { display: flex; flex-direction: column; padding: 12px; }
  .file-modal-dialog.is-markdown #fileMetadataToggle { display: grid !important; flex: 0 0 auto; }
  .file-modal-dialog.is-markdown:not(.show-mobile-metadata) .file-editor-metadata { display: none; }
  .file-modal-dialog.is-markdown.show-mobile-metadata .markdown-editor-section { display: none; }
  .markdown-editor-section { display: flex; min-height: 50dvh; flex: 1; flex-direction: column; }
  .markdown-mobile-tabs { display: grid; }
  .markdown-editor-workspace { min-height: 50dvh; height: 100%; flex: 1; grid-template-columns: minmax(0, 1fr); }
  .markdown-source-pane { border-right: 0; }
  .markdown-editor-workspace[data-mobile-pane="source"] .markdown-preview-pane, .markdown-editor-workspace[data-mobile-pane="preview"] .markdown-source-pane { display: none; }
  .file-modal-footer { display: flex; flex-wrap: nowrap; }
  .file-autosave-status > span:last-child { max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .modal-fullscreen-sm-down .modal-body.row { align-content: start; }
  .topbar { height: 60px; }
  .topbar-shell { position: relative; display: grid; grid-template-columns: 40px minmax(0, 1fr) 44px; gap: 8px; padding-inline: 10px; }
  .topbar-brand { display: contents; }
  .topbar-brand .app-icon { grid-column: 1; }
  .app-icon { width: 32px; height: 32px; }
  .brand-copy { display: none; }
  .version-control { position: absolute; top: 17px; left: 48px; }
  .topbar-actions { display: contents; }
  .system-status { grid-column: 2; justify-self: center; max-width: 100%; padding: 6px 8px; overflow: hidden; border: 1px solid var(--dh-border); border-radius: 999px; background: var(--dh-surface-2); }
  .system-status span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .account-button { grid-column: 3; justify-self: end; min-width: 40px; min-height: 40px; padding: 3px; }
  .avatar-stack { display: none; }
  .sidebar { width: min(92vw, 340px); }
  .workspace { padding: 0 12px calc(40px + env(safe-area-inset-bottom)); }
  .workspace-header { min-height: 0; align-items: stretch; flex-direction: column; gap: 14px; padding: 18px 0 14px; }
  .breadcrumbs { max-width: 100%; overflow: hidden; flex-wrap: wrap; }
  .title-row { min-width: 0; flex-wrap: wrap; }
  .title-row h1 { max-width: 100%; overflow-wrap: anywhere; font-size: 24px; }
  .entity-meta { overflow-wrap: anywhere; }
  .header-actions { width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .save-state { grid-column: 1 / -1; }
  .header-actions .btn { min-height: 44px; min-width: 0; }
  .field-row { grid-template-columns: 1fr; gap: 10px; padding: 15px; }
  .field-footer { align-items: flex-start; flex-direction: column; }
  .field-actions, .field-save:not(.d-none) { width: 100%; }
  .field-save:not(.d-none) { min-height: 42px; justify-content: center; }
  .folder-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; padding: 12px; }
  .folder-item { padding: 13px; }
  .entity-collections { grid-template-columns: 1fr; gap: 12px; padding-top: 16px; }
  .entity-section-tabs { top: 118px; margin-inline: -12px; padding-inline: 12px; }
  .entity-section-tab { flex: 1 0 auto; min-height: 44px; }
  .summary-toolbar { align-items: stretch; flex-direction: column; gap: 12px; }
  .summary-period { width: 100%; }
  .summary-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .summary-kpis article { padding: 12px; }
  .summary-panel > header { align-items: flex-start; flex-direction: column; gap: 5px; }
  .summary-panel > header > small { text-align: left; }
  .pagespeed-grid, .analytics-grid { grid-template-columns: minmax(0, 1fr); padding: 10px; }
  .summary-chart { padding: 6px 8px 2px; }
  .summary-chart-canvas { height: 128px; }
  .summary-chart-canvas.is-tall { height: 196px; }
  .comparison-panel { margin: 10px 10px 0; }
  .comparison-panel > header { align-items: flex-start; flex-direction: column; }
  .analytics-card dl { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .analytics-card dl > div:nth-child(3) { margin-top: 10px; padding: 10px 0 0; border-top: 1px solid var(--dh-border); border-left: 0; grid-column: 1 / -1; }
  .collection-card > header { padding: 13px; }
  .collection-card > footer { position: sticky; bottom: 0; background: var(--dh-surface); }
  .collection-add { min-height: 42px !important; }
  .section-toolbar { align-items: flex-start; flex-direction: column; }
  .section-toolbar .btn { width: 100%; }
  .export-actions { width: 100%; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .export-actions .btn { min-width: 0; padding-inline: 8px; font-size: 11px; }
  .export-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .publication-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .publication-summary article:nth-child(3) { grid-column: 1 / -1; }
  .publication-file { grid-template-columns: auto minmax(0, 1fr); }
  .publication-file > .status-pill { grid-column: 2; justify-self: start; }
  .export-download { grid-template-columns: auto minmax(0, 1fr); }
  .export-download .btn { grid-column: 1 / -1; min-height: 44px; }
  .schema-filters { grid-template-columns: minmax(0, 1fr); }
  .file-filters { grid-template-columns: minmax(0, 1fr); }
  .file-card > header { grid-template-columns: auto minmax(0, 1fr); }
  .file-card > header .file-status { grid-column: 2; justify-self: start; }
  .file-card footer { align-items: stretch; flex-direction: column; }
  .file-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .file-actions .btn { min-height: 42px; justify-content: center; }
  .file-actions .icon-button { width: 100%; min-height: 42px; }
  .schema-field-card dl { grid-template-columns: minmax(0, 1fr); }
  .field-scope-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .relation-cards, .groups-grid, .group-members { grid-template-columns: minmax(0, 1fr); }
  .relation-direction { align-items: stretch; flex-direction: column; }
  .relation-direction > .material-symbols-outlined { transform: rotate(90deg); align-self: center; }
  .modal-header, .modal-footer { flex: 0 0 auto; }
  .modal-footer { position: sticky; bottom: 0; display: grid; grid-template-columns: 1fr 1fr; background: var(--dh-surface); }
  .modal-footer .btn { min-height: 46px; margin: 0; }
  .form-control, .form-select { min-height: 46px; font-size: 16px; }
  .field-option-editor { grid-template-columns: minmax(0, 1fr); }
  .field-option-add { min-height: 44px; }
  .login-card { padding: 30px 24px; }
}

@media (max-width: 359.98px) {
  .folder-grid { grid-template-columns: 1fr; }
  .brand-copy { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
