/* OdooManager — base styles.
   Tokens and components follow the design core in design/output/00-design-system/README.md
   (Industry blueprint system + the OdooManager theme layer). Token names match the export.
   Breakpoints: phone < 640px, tablet 640–1023px, desktop ≥ 1024px (JS mirrors 640 / 1024). */

/* ---------- Fonts (vendored, OFL; licences in static/fonts/) ---------- */
@font-face { font-family: "Barlow"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("fonts/barlow-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-style: normal; font-weight: 500; font-display: swap;
  src: url("fonts/barlow-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("fonts/barlow-condensed-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 500; font-display: swap;
  src: url("fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2"); }

/* ---------- Tokens ---------- */
:root {
  --color-bg: #f2f2f3; --color-surface: #e9e9ea; --color-text: #1d1f20;
  --color-accent: #476e94;
  --color-divider: color-mix(in srgb, #1d1f20 16%, transparent);
  --color-neutral-100: #f5f5f8; --color-neutral-200: #e7e7ea; --color-neutral-300: #d4d4d7;
  --color-neutral-400: #b7b7ba; --color-neutral-500: #98989b; --color-neutral-600: #7a7a7d;
  --color-neutral-700: #5d5d60; --color-neutral-800: #424244; --color-neutral-900: #2b2b2d;
  --color-accent-100: #eef6ff; --color-accent-200: #d6ebff; --color-accent-300: #b5d9fd;
  --color-accent-400: #94bce3; --color-accent-500: #749dc4; --color-accent-600: #597ea3;
  --color-accent-700: #416180; --color-accent-800: #2c455d; --color-accent-900: #1d2d3d;
  --st-ok: oklch(0.47 0.11 150); --st-ok-bg: oklch(0.95 0.035 150); --st-ok-line: oklch(0.78 0.08 150);
  --st-warn: oklch(0.50 0.10 70); --st-warn-bg: oklch(0.95 0.045 85); --st-warn-line: oklch(0.80 0.10 80);
  --st-danger: oklch(0.50 0.16 27); --st-danger-bg: oklch(0.95 0.03 27); --st-danger-line: oklch(0.78 0.09 27);
  --scrim: color-mix(in srgb, #2b2b2d 50%, transparent);
  --shadow-sm: 0 1px 2px color-mix(in srgb, #2b2b2d 14%, transparent);
  --shadow-md: 0 3px 10px color-mix(in srgb, #2b2b2d 16%, transparent);
  --shadow-lg: 0 12px 32px color-mix(in srgb, #2b2b2d 22%, transparent);

  /* Served from /static/fonts (CSP font-src 'self'). Latin subset only; other scripts fall back. */
  --font-heading: "Barlow Condensed", "Roboto Condensed", "Arial Narrow", system-ui, sans-serif;
  --font-heading-weight: 600;
  --font-body: "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --space-1: 3.4px; --space-2: 6.8px; --space-3: 10.2px; --space-4: 13.6px; --space-6: 20.4px; --space-8: 27.2px;

  --bp-tablet: 640px; --bp-desktop: 1024px;
  --content-max: 1440px; --tap-min: 44px;
  --sidebar-w: 248px; --sidebar-w-collapsed: 64px; --topbar-h: 56px;
  --mark: color-mix(in srgb, var(--color-text) 55%, transparent);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --color-bg: #131516; --color-surface: #1b1e20; --color-text: #e3e5e7;
    --color-accent: #86a9cd;
    --color-divider: color-mix(in srgb, #e3e5e7 18%, transparent);
    --color-neutral-100: #2b2b2d; --color-neutral-200: #424244; --color-neutral-300: #5d5d60;
    --color-neutral-400: #7a7a7d; --color-neutral-500: #98989b; --color-neutral-600: #b7b7ba;
    --color-neutral-700: #d4d4d7; --color-neutral-800: #e7e7ea; --color-neutral-900: #f5f5f8;
    --color-accent-100: #1d2d3d; --color-accent-200: #2c455d; --color-accent-300: #416180;
    --color-accent-400: #597ea3; --color-accent-500: #749dc4; --color-accent-600: #94bce3;
    --color-accent-700: #b5d9fd; --color-accent-800: #d6ebff; --color-accent-900: #eef6ff;
    --st-ok: oklch(0.80 0.12 150); --st-ok-bg: oklch(0.27 0.045 150); --st-ok-line: oklch(0.45 0.08 150);
    --st-warn: oklch(0.84 0.12 80); --st-warn-bg: oklch(0.28 0.05 75); --st-warn-line: oklch(0.48 0.08 75);
    --st-danger: oklch(0.79 0.12 25); --st-danger-bg: oklch(0.28 0.06 25); --st-danger-line: oklch(0.48 0.10 25);
    --scrim: rgb(0 0 0 / .6);
    --shadow-sm: 0 0 0 1px color-mix(in srgb, #fff 5%, transparent), 0 1px 2px rgb(0 0 0 / .5);
    --shadow-md: 0 0 0 1px color-mix(in srgb, #fff 6%, transparent), 0 4px 14px rgb(0 0 0 / .55);
    --shadow-lg: 0 0 0 1px color-mix(in srgb, #fff 7%, transparent), 0 16px 40px rgb(0 0 0 / .65);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --color-bg: #131516; --color-surface: #1b1e20; --color-text: #e3e5e7;
  --color-accent: #86a9cd;
  --color-divider: color-mix(in srgb, #e3e5e7 18%, transparent);
  --color-neutral-100: #2b2b2d; --color-neutral-200: #424244; --color-neutral-300: #5d5d60;
  --color-neutral-400: #7a7a7d; --color-neutral-500: #98989b; --color-neutral-600: #b7b7ba;
  --color-neutral-700: #d4d4d7; --color-neutral-800: #e7e7ea; --color-neutral-900: #f5f5f8;
  --color-accent-100: #1d2d3d; --color-accent-200: #2c455d; --color-accent-300: #416180;
  --color-accent-400: #597ea3; --color-accent-500: #749dc4; --color-accent-600: #94bce3;
  --color-accent-700: #b5d9fd; --color-accent-800: #d6ebff; --color-accent-900: #eef6ff;
  --st-ok: oklch(0.80 0.12 150); --st-ok-bg: oklch(0.27 0.045 150); --st-ok-line: oklch(0.45 0.08 150);
  --st-warn: oklch(0.84 0.12 80); --st-warn-bg: oklch(0.28 0.05 75); --st-warn-line: oklch(0.48 0.08 75);
  --st-danger: oklch(0.79 0.12 25); --st-danger-bg: oklch(0.28 0.06 25); --st-danger-line: oklch(0.48 0.10 25);
  --scrim: rgb(0 0 0 / .6);
  --shadow-sm: 0 0 0 1px color-mix(in srgb, #fff 5%, transparent), 0 1px 2px rgb(0 0 0 / .5);
  --shadow-md: 0 0 0 1px color-mix(in srgb, #fff 6%, transparent), 0 4px 14px rgb(0 0 0 / .55);
  --shadow-lg: 0 0 0 1px color-mix(in srgb, #fff 7%, transparent), 0 16px 40px rgb(0 0 0 / .65);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 400 15px/1.55 var(--font-body); color: var(--color-text); background: var(--color-bg); }
h1, h2, h3, h4 { font-family: var(--font-heading); font-weight: var(--font-heading-weight);
  line-height: 1.12; letter-spacing: -0.015em; margin: 0 0 var(--space-2); }
h2 { font-size: 32px; } h3 { font-size: 20px; } h4 { font-size: 17px; }
p { margin: 0 0 var(--space-3); }
a { color: var(--color-accent); text-underline-offset: 3px; }
a:hover { color: var(--color-accent-700); }
.mono, code, pre { font-family: var(--font-mono); }
.mono, code { font-size: 13px; }
.muted { color: var(--color-neutral-700); }
.small { font-size: 13px; }
.label { font-size: 11px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--color-neutral-700); }
.empty { color: var(--color-neutral-700); padding: var(--space-4) 0; }
.error-text { color: var(--st-danger); }
[hidden] { display: none !important; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
::selection { background: color-mix(in srgb, var(--color-accent) 30%, transparent); }
.skip { position: absolute; left: -999px; }
.skip:focus { left: var(--space-2); top: var(--space-2); z-index: 100; background: var(--color-bg); padding: var(--space-2); border: 1px solid var(--color-divider); }
.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5;
  stroke-linecap: round; stroke-linejoin: round; vertical-align: -4px; }
.icon-sm { width: 13px; height: 13px; vertical-align: -2px; }
.spin { animation: om-spin .9s linear infinite; }
@keyframes om-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { * { animation-duration: 3s !important; transition: none !important; } }

/* ---------- Blueprint frame: hairline + "+" registration marks at the four corners.
   Drawn with one pseudo-element, so templates need no extra markup. ---------- */
.blueprint, .card, .btn-primary, .toast, .menu, .login-card, dialog.sheet, .job-row {
  position: relative; border: 1px solid var(--color-divider); border-radius: 0;
}
.blueprint::before, .card::before, .btn-primary::before, .toast::before, .menu::before, .login-card::before, .job-row::before {
  content: ""; position: absolute; inset: -6px; pointer-events: none;
  --c: linear-gradient(var(--mark), var(--mark));
  background:
    var(--c) 0 5px / 11px 1px no-repeat, var(--c) 5px 0 / 1px 11px no-repeat,
    var(--c) 100% 5px / 11px 1px no-repeat, var(--c) calc(100% - 5px) 0 / 1px 11px no-repeat,
    var(--c) 0 calc(100% - 5px) / 11px 1px no-repeat, var(--c) 5px 100% / 1px 11px no-repeat,
    var(--c) 100% calc(100% - 5px) / 11px 1px no-repeat, var(--c) calc(100% - 5px) 100% / 1px 11px no-repeat;
}

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 36px; padding: var(--space-2) calc(var(--space-3) * 1.2);
  font-family: var(--font-heading); font-weight: var(--font-heading-weight); font-size: 14px; line-height: 1.2;
  color: var(--color-text); background: transparent; border: 1px solid var(--color-divider); border-radius: 0;
  cursor: pointer; text-decoration: none; }
.btn:hover:not(:disabled):not([aria-disabled="true"]) { background: color-mix(in srgb, var(--color-text) 7%, transparent); }
.btn:active:not(:disabled):not([aria-disabled="true"]) { background: color-mix(in srgb, var(--color-text) 14%, transparent); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--color-accent); border-color: var(--color-accent); color: var(--color-bg); }
.btn-primary:hover:not(:disabled):not([aria-disabled="true"]) { background: var(--color-accent-600); }
.btn-primary:active:not(:disabled):not([aria-disabled="true"]) { background: var(--color-accent-700); }
.btn-ghost { color: var(--color-accent); border-color: transparent; padding-inline: var(--space-1); }
.btn-ghost:hover:not(:disabled):not([aria-disabled="true"]) { background: color-mix(in srgb, var(--color-accent) 10%, transparent); }
.btn-danger { color: var(--st-danger); }
.btn-danger:hover:not(:disabled):not([aria-disabled="true"]) { background: var(--st-danger-bg); }
.btn-danger.is-confirm, .btn-danger-solid { background: var(--st-danger); border-color: var(--st-danger); color: var(--color-bg); }
.btn-danger.is-confirm:hover:not(:disabled), .btn-danger-solid:hover:not(:disabled) {
  background: color-mix(in srgb, var(--st-danger) 82%, var(--color-text)); }
.btn-sm { min-height: 32px; padding: 4px var(--space-3); font-size: 13px; }
.btn-block { width: 100%; }
.btn-icon, .icon-btn { width: var(--tap-min); height: var(--tap-min); padding: 0; flex: none; }
.icon-btn { display: inline-grid; place-items: center; border: 0; background: none; color: inherit; cursor: pointer; position: relative; }
.icon-btn:hover { background: color-mix(in srgb, var(--color-text) 7%, transparent); }

/* ---------- Status pill: icon + label + role colour, readable in grayscale ---------- */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px 1px 6px;
  font: 500 12px/20px var(--font-body); white-space: nowrap;
  border: 1px solid var(--color-neutral-300); background: var(--color-neutral-100); color: var(--color-neutral-800); }
.pill .icon { width: 13px; height: 13px; vertical-align: 0; }
.pill-running, .pill-succeeded, .pill-ok { border-color: var(--st-ok-line); background: var(--st-ok-bg); color: var(--st-ok); }
.pill-stopped, .pill-failed, .pill-danger { border-color: var(--st-danger-line); background: var(--st-danger-bg); color: var(--st-danger); }
.pill-pending, .pill-warn { border-color: var(--st-warn-line); background: var(--st-warn-bg); color: var(--st-warn); }
.pill-starting, .pill-stopping, .pill-busy { border-color: var(--color-accent-300); background: var(--color-accent-100); color: var(--color-accent-800); }

/* ---------- Tags ---------- */
.tag, .badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; letter-spacing: .02em;
  padding: 3px 10px; border-radius: 0; background: var(--color-neutral-100); color: var(--color-neutral-800); }
.tag-accent { background: var(--color-accent-100); color: var(--color-accent-800); }
.tag-outline { background: none; border: 1px solid var(--color-accent); color: var(--color-accent); }

/* ---------- Shell ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-w); flex: none; background: var(--color-bg); border-right: 1px solid var(--color-divider);
  display: flex; flex-direction: column; gap: var(--space-4); padding: var(--space-4) var(--space-3);
  position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar-head { display: flex; align-items: center; gap: var(--space-2); }
.mark { display: inline-grid; place-items: center; width: 32px; height: 32px; flex: none;
  background: var(--color-accent); color: var(--color-bg);
  font: var(--font-heading-weight) 15px/1 var(--font-heading); letter-spacing: .02em; }
.instance { font-family: var(--font-mono); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.sidebar nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.sidebar nav a { display: flex; align-items: center; gap: var(--space-3); min-height: 40px; padding: 0 var(--space-3);
  color: var(--color-text); text-decoration: none; font-size: 14px; border-left: 2px solid transparent; }
.sidebar nav a:hover { background: color-mix(in srgb, var(--color-text) 6%, transparent); color: var(--color-text); }
.sidebar nav a[aria-current="page"] { border-left-color: var(--color-accent); color: var(--color-accent-700);
  background: color-mix(in srgb, var(--color-accent) 10%, transparent); font-weight: 500; }
.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { height: var(--topbar-h); display: flex; align-items: center; gap: var(--space-2); padding: 0 var(--space-6);
  background: var(--color-bg); border-bottom: 1px solid var(--color-divider); box-shadow: var(--shadow-sm);
  position: sticky; top: 0; z-index: 10; }
.page-title { font-size: 20px; flex: 1; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hamburger, .topbar-status { display: none; }
main { padding: var(--space-8) var(--space-8) 56px; width: 100%; max-width: var(--content-max); margin: 0 auto; }
main:focus { outline: none; }
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 40; }

body.sidebar-collapsed .sidebar { width: var(--sidebar-w-collapsed); }
body.sidebar-collapsed .nav-label, body.sidebar-collapsed .instance, body.sidebar-collapsed .pill-label { display: none; }

.jobs-btn .count { position: absolute; top: 5px; right: 5px; min-width: 17px; height: 17px; padding: 0 4px;
  background: var(--color-accent); color: var(--color-bg); font: 500 11px/17px var(--font-mono); text-align: center; }
.jobs-btn.has-failed .count { background: var(--st-danger); }
.jobs-btn.is-busy .icon { animation: om-spin 2s linear infinite; }

.user-menu { position: relative; }
.user-menu summary { list-style: none; display: flex; align-items: center; gap: var(--space-2); min-height: var(--tap-min);
  cursor: pointer; padding: 0 var(--space-2); font-size: 14px; }
.user-menu summary:hover { background: color-mix(in srgb, var(--color-text) 7%, transparent); }
.user-menu summary::-webkit-details-marker { display: none; }
.avatar { width: 30px; height: 30px; border: 1px solid var(--color-divider); display: grid; place-items: center;
  font: var(--font-heading-weight) 15px/1 var(--font-heading); }
.menu { position: absolute; right: 0; top: calc(100% + 6px); background: var(--color-bg); min-width: 220px;
  padding: 4px 0; box-shadow: var(--shadow-md); z-index: 30; }
.menu a, .menu button { display: flex; align-items: center; width: 100%; text-align: left; padding: 0 14px; min-height: 40px;
  border: 0; background: none; color: var(--color-text); font: inherit; font-size: 14px; text-decoration: none; cursor: pointer; }
.menu a:hover, .menu button:hover { background: color-mix(in srgb, var(--color-text) 6%, transparent); color: var(--color-text); }
.menu .danger { color: var(--st-danger); }
.menu-sep { height: 1px; background: var(--color-divider); margin: 4px 0; }
.menu-head { padding: var(--space-2) 14px var(--space-3); border-bottom: 1px solid var(--color-divider); margin-bottom: 4px;
  display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }

/* ---------- Banners and lock strip ---------- */
.banner { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3) var(--space-4); flex-wrap: wrap;
  padding: 10px var(--space-8); border-bottom: 1px solid var(--color-divider); }
.banner ul { margin: var(--space-1) 0 0; padding-left: 18px; font-size: 13px; color: var(--color-neutral-700); }
.banner summary { cursor: pointer; font-weight: 500; }
.banner-warning { background: var(--st-warn-bg); border-color: var(--st-warn-line); }
.banner-warning > :first-child .icon, .banner-warning summary .icon { color: var(--st-warn); }
.banner-danger { background: var(--st-danger-bg); border-color: var(--st-danger-line); }
.banner-danger .icon { color: var(--st-danger); }
.lock-strip { height: 2px; background: linear-gradient(90deg, transparent, var(--color-accent), transparent); background-size: 50% 100%;
  background-repeat: no-repeat; animation: strip 1.5s linear infinite; }
@keyframes strip { from { background-position: -50% 0; } to { background-position: 150% 0; } }

/* ---------- Content ---------- */
.page-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--space-4);
  padding-bottom: var(--space-4); margin-bottom: var(--space-6); border-bottom: 1px solid var(--color-divider); }
.page-header h2 { margin-bottom: 4px; }
.page-header p { margin: 0; color: var(--color-neutral-700); }
.card { display: flex; flex-direction: column; gap: var(--space-3); background: transparent; padding: 20px; margin-bottom: var(--space-6); }
.card > :last-child { margin-bottom: 0; }
.card h3 { margin: 0; }
.card-kicker { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--color-neutral-700); }
.card-title { font: var(--font-heading-weight) 17px/1.2 var(--font-heading); }
.card-danger { border-color: var(--st-danger-line); background: var(--st-danger-bg); }
.card.narrow { max-width: 480px; }
.grid { display: grid; gap: var(--space-6); grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }
.grid > .card { margin-bottom: 0; }
.actions { display: flex; gap: var(--space-2); flex-wrap: wrap; align-items: center; }
.spacer { flex: 1; }
.alert { display: flex; flex-direction: column; gap: var(--space-2); padding: 10px 14px; margin-bottom: var(--space-4);
  border: 1px solid var(--color-divider); font-size: 14px; }
.alert-danger { background: var(--st-danger-bg); border-color: var(--st-danger-line); color: var(--color-text); }
.alert-info { background: var(--color-accent-100); border-color: var(--color-accent-300); }
.alert-success { background: var(--st-ok-bg); border-color: var(--st-ok-line); }
.alert details summary, details.tech summary { cursor: pointer; color: var(--color-accent-700); font-size: 13px; }

/* Read-only/surface boxes: logs, technical details */
.log { background: var(--color-surface); color: var(--color-text); border: 1px solid var(--color-divider);
  padding: 10px 12px; font-size: 12px; line-height: 1.6; overflow: auto; white-space: pre; max-height: 60vh; min-height: 120px; margin: 0; }
.log.wrap { white-space: pre-wrap; word-break: break-all; }
.alert .log { min-height: 0; white-space: pre-wrap; word-break: break-all; font-size: 11px; }

/* Tables */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 11px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase;
  color: color-mix(in srgb, var(--color-text) 60%, transparent); padding: var(--space-2); border-bottom: 1px solid var(--color-divider); }
.table td { padding: var(--space-2); border-bottom: 1px solid color-mix(in srgb, var(--color-text) 8%, transparent); }
.table tbody tr:hover { background: color-mix(in srgb, var(--color-text) 4%, transparent); }

/* Sizes and tooltips */
.size { font-family: var(--font-mono); font-size: 13px; text-decoration: underline dotted var(--color-neutral-500); text-underline-offset: 3px; }
.tooltip { position: absolute; white-space: nowrap; background: var(--color-text); color: var(--color-bg);
  font-size: 12px; padding: 4px 8px; box-shadow: var(--shadow-md); z-index: 70; }

/* ---------- Forms ---------- */
.form { display: flex; flex-direction: column; gap: var(--space-2); }
.form fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.form label, .field > label { display: block; font-size: 12px; color: color-mix(in srgb, var(--color-text) 70%, transparent); }
.input, .form input[type=text], .form input[type=password], .form input[type=email], .form input[type=search] {
  width: 100%; min-height: 40px; padding: 6px 10px; font: inherit; font-size: 14px; color: var(--color-text);
  caret-color: var(--color-accent); background: var(--color-surface); border: 1px solid var(--color-divider); border-radius: 0;
  margin-bottom: var(--space-2); }
.input:hover, .form input:hover { border-color: color-mix(in srgb, var(--color-text) 45%, transparent); }
.input:focus-visible, .form input:focus-visible { border-color: var(--color-accent); outline-offset: 0; }
.form .btn { margin-top: var(--space-2); }

/* ---------- Login (design/01) ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.bare main { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 48px 24px; }
.login { width: min(400px, 100%); }
.login-card { padding: 32px; display: flex; flex-direction: column; gap: 22px; }
.login-brand { display: flex; gap: 10px; align-items: center; }
.login-brand .mark { width: 28px; height: 28px; font-size: 14px; background: none; color: var(--color-accent); border: 1px solid var(--color-accent); }
.login-brand .product { font-size: 19px; letter-spacing: -.01em; }
.product { font: var(--font-heading-weight) 22px/1.1 var(--font-heading); }
.login-head { display: flex; flex-direction: column; gap: 2px; }
.login-head h1 { font-size: 30px; margin: 0; }
.login-head > span { font-size: 14px; }
.login-head .instance { font-size: 13px; color: var(--color-text); }
.login-card .alert { margin: 0; }
.login-form fieldset { gap: 16px; min-width: 0; }
.login-form .field > label { margin-bottom: 4px; }
.login-form input[type=text], .login-form input[type=password] { min-height: var(--tap-min); margin: 0; }
.login-form input[aria-invalid="true"] { border-color: var(--st-danger-line); }
.login-form .field > .small { margin-top: 8px; }
.login-form .btn { min-height: var(--tap-min); font-size: 15px; margin-top: 4px; }
.password-wrap { position: relative; }
.password-wrap input { padding-right: 48px; }
.reveal { position: absolute; right: 0; top: 0; width: var(--tap-min); height: var(--tap-min); display: grid; place-items: center;
  border: 0; background: none; color: var(--color-neutral-700); cursor: pointer; }
.reveal:hover { color: var(--color-text); }
.reveal .icon { width: 17px; height: 17px; }
.reveal[aria-pressed="false"] .icon:last-child, .reveal[aria-pressed="true"] .icon:first-child { display: none; }
.login-form .when-busy { display: none; }
.login-form[aria-busy="true"] .when-busy { display: inline-flex; align-items: center; gap: 8px; }
.login-form[aria-busy="true"] .when-idle { display: none; }
.login-form .when-busy .icon { width: 15px; height: 15px; vertical-align: 0; }
.login-foot { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 20px 0 0; font-size: 12px; }
.login-foot .icon { width: 13px; height: 13px; vertical-align: 0; }

/* Inline alert with a leading status icon */
.alert-row { flex-direction: row; align-items: flex-start; gap: 10px; padding: 10px 12px; }
.alert-row > .icon { width: 17px; height: 17px; margin-top: 2px; vertical-align: 0; }
.alert-row > span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.alert-row strong { font-weight: 500; }
.alert-row.alert-danger > .icon { color: var(--st-danger); }
.alert-row.alert-success > .icon { color: var(--st-ok); }
.alert-warn { background: var(--st-warn-bg); border-color: var(--st-warn-line); }
.alert-row.alert-warn > .icon { color: var(--st-warn); }

/* ---------- Jobs drawer ---------- */
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100%); background: var(--color-bg);
  border-left: 1px solid var(--color-divider); z-index: 50; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); }
.drawer-head { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-1) var(--space-2) var(--space-1) var(--space-4);
  border-bottom: 1px solid var(--color-divider); }
.drawer-head h2 { flex: 1; margin: 0; font-size: 20px; }
.drawer-body { flex: 1; overflow: auto; padding: var(--space-6) var(--space-4); display: flex; flex-direction: column; }
.job-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.job-row { display: grid; grid-template-columns: 1fr auto; align-items: start; gap: 2px var(--space-3); width: 100%; text-align: left;
  padding: 12px 14px; background: none; color: inherit; font: inherit; cursor: pointer; }
.job-row:hover { background: color-mix(in srgb, var(--color-text) 4%, transparent); }
.job-row .muted { grid-column: 1 / -1; font-family: var(--font-mono); font-size: 11px; }
.job-title { font-weight: 500; font-size: 14px; }
.job-detail { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.job-detail .log { flex: 1; max-height: none; }
.job-meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.job-meta .muted { font-family: var(--font-mono); font-size: 11px; }
.log-toolbar { display: flex; gap: var(--space-3); align-items: center; flex-wrap: wrap; margin: var(--space-3) 0 var(--space-2); font-size: 13px; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; right: 20px; bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 90;
  display: flex; flex-direction: column; gap: 10px; width: min(360px, calc(100vw - 40px)); }
.toast { background: var(--color-bg); color: var(--color-text); box-shadow: var(--shadow-md);
  padding: 10px 8px 10px 12px; display: flex; gap: 10px; align-items: center; font-size: 14px; }
.toast > span { flex: 1; }
.toast.toast-error { border-color: var(--st-danger-line); background: var(--st-danger-bg); }
.toast button { background: none; border: 0; color: var(--color-accent-700); font: inherit; cursor: pointer; min-height: 32px; padding: 0 6px; }

/* ---------- Dialogs ---------- */
dialog.sheet { padding: 22px; max-width: 480px; width: calc(100% - 32px); background: var(--color-bg); color: var(--color-text);
  box-shadow: var(--shadow-lg); }
dialog.sheet h2 { font-size: 22px; margin: 0; }
dialog.sheet::backdrop { background: var(--scrim); }
/* The blueprint frame's position: relative would become absolute in the top
   layer, placing a modal against the document instead of the viewport. */
dialog.sheet:modal { position: fixed; }
dialog .actions { justify-content: flex-end; margin-top: var(--space-4); }
dialog .actions .btn { min-height: var(--tap-min); }
dialog.sheet { display: flex; flex-direction: column; gap: 14px; }
dialog.sheet:not([open]) { display: none; }
dialog.sheet .actions { margin-top: 4px; }
dialog.sheet > p { margin: 0; }
.sheet-title { display: flex; gap: 10px; align-items: center; }
.sheet-title .icon { width: 20px; height: 20px; color: var(--st-warn); vertical-align: 0; }
.sheet-title h2 { margin: 0; }

/* ---------- Segmented control: native radios, the checked one filled with the accent ---------- */
.seg { display: inline-flex; border: 1px solid var(--color-divider); margin: 0; padding: 0; min-width: 0; }
.seg-opt { position: relative; display: inline-flex; align-items: center; justify-content: center; min-height: 32px; padding: 0 12px;
  font: 500 13px/1 var(--font-body); color: var(--color-text); cursor: pointer; }
.seg-opt + .seg-opt { border-left: 1px solid var(--color-divider); }
.seg-opt input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg-opt:hover { background: color-mix(in srgb, var(--color-text) 7%, transparent); }
.seg-opt:has(input:checked) { background: var(--color-accent); color: var(--color-bg); }
.seg-opt:has(input:focus-visible) { outline: 2px solid var(--color-accent); outline-offset: 2px; }

/* ---------- Help tooltip: hover, focus or tap ---------- */
.tip { position: relative; display: inline-flex; }
.tip-btn { width: 32px; height: 32px; margin: -8px 0; color: var(--color-neutral-700); cursor: help; }
.tip-btn .icon { width: 15px; height: 15px; }
.tip-pop { display: none; position: absolute; left: 0; bottom: calc(100% + 6px); width: max-content; max-width: min(300px, 80vw);
  background: var(--color-text); color: var(--color-bg); font-size: 12px; line-height: 1.45; padding: 6px 10px; box-shadow: var(--shadow-md); z-index: 5; }
.tip-btn:hover + .tip-pop, .tip-btn:focus-visible + .tip-pop, .tip-btn[aria-expanded="true"] + .tip-pop { display: block; }

/* ---------- Dashboard (design/03). Layout follows the content width (container queries):
   one column under 600px, two columns from 600px, three from 960px. ---------- */
.dash { container-type: inline-size; display: flex; flex-direction: column; gap: 20px; }
.dash .card { margin: 0; min-width: 0; }
.dash h2 { font-size: 20px; margin: 0; }
.dash-updated { display: flex; justify-content: flex-end; align-items: center; gap: 8px; min-height: 20px; margin-top: -6px;
  font-size: 12px; color: var(--color-neutral-700); }
.dash-fresh { display: inline-flex; align-items: center; gap: 8px; }
.dash-fresh .icon { width: 15px; height: 15px; vertical-align: 0; color: var(--color-accent); }
.dash-fresh .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--st-ok); }
.dash-stale-note { display: none; align-items: center; gap: 6px; padding: 2px 8px; color: var(--color-text);
  border: 1px solid var(--st-warn-line); background: var(--st-warn-bg); }
.dash-stale-note .icon { width: 13px; height: 13px; vertical-align: 0; color: var(--st-warn); }
.dash.is-stale .dash-stale-note { display: inline-flex; }
.dash.is-stale .dash-fresh { display: none; }
.dash.is-stale :is(.dash-dim, .dash-storage, .dash-cpu, .dash-mem, .dash-dbs) { opacity: .5; }

.dash-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 16px; min-height: 32px; }
.dash-card { gap: 12px; padding: 18px 20px; }
.dash-body { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.dash-storage .dash-body { gap: 16px; }
.dash-figure { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px; }
.dash-figure-split { justify-content: space-between; gap: 6px 12px; }
.dash-figure .muted { font-size: 15px; }
.dash-hero { font: var(--font-heading-weight) 36px/1 var(--font-heading); }
.dash-big { font: var(--font-heading-weight) 26px/1.1 var(--font-heading); }
.dash-note { margin: 0; }
.dash-link { display: inline-flex; align-items: center; gap: 5px; min-height: 32px; font-size: 13px; color: var(--color-accent-700); }
.dash-link .icon { width: 14px; height: 14px; vertical-align: 0; }
.dash-link-warn { color: var(--color-text); text-decoration-color: var(--st-warn-line); }
.dash-link-warn .icon { color: var(--st-warn); }
.dash-ok { display: inline-flex; align-items: center; gap: 5px; }
.dash-ok .icon { width: 14px; height: 14px; vertical-align: 0; color: var(--st-ok); }
.dash-ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* Status row */
.dash-status { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.dash-tile { gap: 10px; padding: 16px 18px; }
.dash-tile-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 22px; }
.dash-tile-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; min-width: 0; }
.dash-restart { min-height: 32px; }
.dash-restart .icon { width: 15px; height: 15px; vertical-align: 0; }

/* Storage bar: SVG segments, threshold marks at 80 % and 90 % */
.dash-storage-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 8px 16px; }
.dash-storage-used { display: flex; align-items: center; gap: 8px; }
.storage-bar { position: relative; padding-bottom: 14px; }
.storage-bar svg { display: block; width: 100%; height: 20px; border: 1px solid var(--color-divider); }
.storage-bar rect { stroke: var(--color-bg); stroke-width: 1px; vector-effect: non-scaling-stroke; }
.seg-0 { fill: var(--color-accent-800); background: var(--color-accent-800); }
.seg-1 { fill: var(--color-accent-600); background: var(--color-accent-600); }
.seg-2 { fill: var(--color-accent-400); background: var(--color-accent-400); }
.seg-3 { fill: var(--color-accent-200); background: var(--color-accent-200); }
.seg-4 { fill: var(--color-neutral-400); background: var(--color-neutral-400); }
.storage-bar .seg-free { fill: transparent; stroke: none; }
.storage-bar .thresh { position: absolute; top: -4px; height: 28px; border-left: 1px dashed var(--st-warn); }
.storage-bar .thresh-90 { left: 90%; border-left-color: var(--st-danger); }
.storage-bar .thresh-80 { left: 80%; }
.storage-bar .thresh-label { position: absolute; top: 26px; transform: translateX(-50%); font: 10px/1 var(--font-mono); color: var(--color-neutral-700); border: 0; }
.storage-legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px 22px; grid-template-columns: repeat(auto-fit, minmax(130px, max-content)); }
.storage-legend li { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13px; }
.swatch { display: inline-block; width: 10px; height: 10px; flex: none; border: 1px solid var(--color-divider); }
.swatch.seg-free { background: transparent; }
.dash-alert { margin: 0; flex-wrap: wrap; align-items: center; }
.dash-alert > span { flex: 1 1 260px; }

/* Charts: SVG paths in a 300×100 box, stretched to the card */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: 120px; border-bottom: 1px solid var(--color-divider); }
.chart-area { fill: var(--color-accent-100); stroke: none; }
.chart-line { fill: none; stroke: var(--color-accent); stroke-width: 1.5; stroke-linejoin: round; }
.chart-warn .chart-area { fill: var(--st-warn-bg); }
.chart-warn .chart-line { stroke: var(--st-warn); }
.chart-threshold { stroke: var(--st-warn); stroke-width: 1; stroke-dasharray: 4 4; }
.chart-threshold-label { position: absolute; right: 0; top: calc(15% - 16px); font: 10px/1 var(--font-mono); color: var(--color-neutral-700); }
.chart-axis { display: flex; justify-content: space-between; margin-top: 4px; font: 11px/1.4 var(--font-mono); color: var(--color-neutral-700); }
.chart-empty { height: 120px; margin: 0; display: grid; place-items: center; text-align: center; border-bottom: 1px solid var(--color-divider); }
.dash-load { display: flex; align-items: center; gap: 4px; font-size: 13px; color: var(--color-neutral-700); }
.dash-load .mono { font-size: 12px; color: var(--color-text); }
.dash-load .small { font-size: 12px; }

/* Database size list */
.dash-key { display: flex; gap: 12px; }
.dash-key > span { display: flex; align-items: center; gap: 5px; }
.dash-key .swatch { border: 0; }
.db-bar-db { fill: var(--color-accent-700); background: var(--color-accent-700); }
.db-bar-files { fill: var(--color-accent-400); background: var(--color-accent-400); }
.db-list, .act-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.db-list li, .act-row { border-bottom: 1px solid var(--color-divider); }
.db-row { display: flex; flex-direction: column; gap: 6px; padding: 10px 0; color: var(--color-text); text-decoration: none; }
.db-row:hover { background: color-mix(in srgb, var(--color-text) 4%, transparent); color: var(--color-text); }
.db-row-top { display: flex; justify-content: space-between; gap: 10px; }
.db-name { font: 500 13px var(--font-mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--color-accent-700);
  text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--color-accent-300); }
.db-bar { display: block; width: 100%; height: 8px; }
.db-meta { font-size: 11px; color: var(--color-neutral-700); }
.db-total { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; font-weight: 500; }

/* Recent activity */
.dash-activity { gap: 8px; }
.act-row { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; }
.act-icon { width: 18px; flex: none; display: grid; place-items: center; padding-top: 2px; color: var(--color-neutral-700); }
.act-icon .icon { width: 16px; height: 16px; vertical-align: 0; }
.act-icon .spin { color: var(--color-accent); }
.act-row:has(.pill-danger) .act-icon, .act-row:has(.error-text) .act-icon { color: var(--st-danger); }
.act-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 14px; overflow-wrap: anywhere; }
.act-meta { font-size: 11px; color: var(--color-neutral-700); }
.act-link { padding: 0; border: 0; background: none; font: inherit; color: var(--color-text); text-align: left; cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--color-divider); }

/* Loading skeletons */
.skel { display: block; height: 16px; background: var(--color-neutral-200); }
.skel-tile { height: 26px; width: 110px; }
.skel-hero { height: 36px; width: min(280px, 70%); }
.skel-bar { height: 20px; width: 100%; }
.skel-line { height: 14px; width: min(520px, 90%); }
.skel-chart { height: 120px; width: 100%; }
.skel-row { height: 34px; }
.skel-60 { width: 60%; } .skel-35 { width: 35%; }

.dash-grid { display: grid; gap: 20px; align-items: start; grid-template-columns: minmax(0, 1fr); }
.dash-cpu { order: 1; } .dash-dbs { order: 2; } .dash-mem { order: 3; }
@container (min-width: 600px) {
  .dash-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-mem { order: 2; } .dash-dbs { order: 3; }
}
@container (min-width: 960px) {
  .dash-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
/* Phone: stacked compact tiles, full-width Restart, 44px targets, two-column legend */
@container (max-width: 599px) {
  .dash { gap: 14px; }
  .dash-status, .dash-grid { gap: 14px; grid-template-columns: minmax(0, 1fr); }
  .dash-tile { padding: 12px 14px; }
  .dash-card { padding: 14px; }
  .dash-big { font-size: 22px; }
  .dash-hero { font-size: 30px; }
  .dash-restart { width: 100%; min-height: var(--tap-min); }
  .seg-opt, .dash-link, .btn-ghost { min-height: var(--tap-min); }
  .tip-btn { width: var(--tap-min); height: var(--tap-min); }
  .storage-bar { padding-bottom: 0; }
  .storage-bar .thresh-label { display: none; }
  .storage-legend { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .storage-legend .name { flex: 1; }
}

/* ---------- Unavailable actions: focusable, reason in a tooltip on hover, focus or tap ---------- */
.dis-tip { position: relative; display: inline-flex; }
.dis-tip > .btn { width: 100%; }
.dis-tip > .tip-pop { left: auto; right: 0; bottom: auto; top: calc(100% + 6px); white-space: nowrap; max-width: none; z-index: 6; }
.dis-tip:hover > .tip-pop, .dis-tip:focus-within > .tip-pop, .dis-tip.show-tip > .tip-pop { display: block; }

/* ---------- Switch: a square track with a sliding knob ---------- */
.switch { display: inline-flex; align-items: center; gap: 8px; min-height: 32px; padding: 0 4px; border: 0; background: none;
  color: var(--color-text); font: inherit; font-size: 13px; cursor: pointer; }
.switch-track { position: relative; flex: none; width: 28px; height: 16px; border: 1px solid var(--color-neutral-500); }
.switch-track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 10px; height: 10px; background: var(--color-neutral-500);
  transition: left .15s; }
.switch[aria-checked="true"] .switch-track { border-color: var(--color-accent); background: var(--color-accent-100); }
.switch[aria-checked="true"] .switch-track::after { left: 14px; background: var(--color-accent); }
.switch-row { justify-content: space-between; min-height: var(--tap-min); padding: 0; font-size: 15px; }
.switch-row .switch-track { width: 36px; height: 20px; }
.switch-row .switch-track::after { top: 3px; left: 3px; width: 12px; height: 12px; }
.switch-row[aria-checked="true"] .switch-track::after { left: 19px; }

/* ---------- Banners with a title and a line under it ---------- */
.banner > .icon { flex: none; }
.banner-text { flex: 1 1 240px; min-width: 0; display: flex; flex-direction: column; }
.banner-text strong { font-weight: 500; }
.banner-text span { font-size: 13px; color: var(--color-neutral-700); }
.banner .btn { min-height: 36px; }

/* ---------- Confirmation dialog ---------- */
.sheet-head { display: flex; align-items: flex-start; gap: 10px; }
.sheet-head h2 { flex: 1; }
.sheet-head .icon-btn { margin: -10px -10px 0 0; }
.confirm-icon .icon { width: 22px; height: 22px; margin-top: 2px; color: var(--st-danger); }
dialog.sheet.is-danger { border-color: var(--st-danger-line); }
.confirm-body { display: flex; flex-direction: column; gap: 8px; font-size: 15px; }
.confirm-body strong { font-weight: 500; }
.confirm-body ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 3px; font-size: 14px; }

/* ---------- Service (design/04). Layout follows the content width: phone layout under 600px. ---------- */
.svc { container-type: inline-size; display: flex; flex-direction: column; }
.svc .card { margin: 0; min-width: 0; }
.svc-live { display: flex; flex-direction: column; gap: 20px; margin-bottom: 20px; }
.svc-status { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 18px 32px; padding: 20px 22px; }
.svc-state { flex: 1 1 300px; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.svc-pill-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.svc-heading { font: var(--font-heading-weight) 24px/1.15 var(--font-heading); }
.svc-steps { list-style: none; margin: 4px 0 0; padding: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.svc-steps li { display: flex; align-items: center; gap: 6px; }
.svc-steps .icon { width: 14px; height: 14px; vertical-align: 0; }
.svc-steps .is-done .icon { color: var(--st-ok); }
.svc-steps .is-active { font-weight: 500; }
.svc-steps .is-active .icon { color: var(--color-accent); }
.svc-step-todo { display: inline-block; width: 12px; height: 12px; border: 1px solid var(--color-neutral-500); }
.svc-step-line { display: inline-block; width: 24px; height: 1px; margin-left: 2px; background: var(--color-divider); }
.svc-figures { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, max-content)); gap: 4px 32px; }
.svc-figures dd { margin: 0; font: var(--font-heading-weight) 28px/1.2 var(--font-heading); }
.svc-actions { display: flex; gap: 10px; align-items: stretch; }
.svc-actions .icon { width: 15px; height: 15px; vertical-align: 0; }
.svc-sep { width: 1px; align-self: stretch; margin: 0 6px; background: var(--color-divider); }
.btn-stop { color: var(--st-danger); border-color: var(--st-danger-line); }
.btn-stop:hover:not(:disabled):not([aria-disabled="true"]) { background: var(--st-danger-bg); }

.svc-fail { border-color: var(--st-danger-line); padding: 20px 22px; gap: 12px; }
.svc-fail-head { display: flex; gap: 10px; align-items: flex-start; }
.svc-fail-head > .icon { width: 20px; height: 20px; margin-top: 3px; color: var(--st-danger); }
.svc-fail-head > div { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.svc-fail-head h2 { font-size: 22px; margin: 0; }
.svc-fail-head p { margin: 0; max-width: 70ch; text-wrap: pretty; }
.svc-fail-actions { gap: 10px; }
.svc-fail-log { min-width: 0; }
.svc-fail-log summary { cursor: pointer; font-size: 13px; color: var(--color-accent-700); min-height: 32px; display: flex; align-items: center; }

.svc-logs { gap: 12px; padding: 20px 22px; }
.svc-logs-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 6px 12px; }
.svc-logs-head h2 { font-size: 20px; margin: 0; }
.svc-logs-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.svc-search { position: relative; flex: 0 1 280px; min-width: 0; }
.svc-search > .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--color-neutral-700); }
.svc-search .input { margin: 0; padding-left: 32px; min-height: 36px; }
.svc-download { margin-left: auto; }
.svc-download .icon { width: 15px; height: 15px; vertical-align: 0; }
.svc-narrow { display: none !important; }
.svc-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { gap: 4px; padding: 0 0 0 12px; min-height: var(--tap-min); font-size: 13px; }
.chip button { display: grid; place-items: center; width: 40px; height: var(--tap-min); padding: 0; border: 0; background: none; color: inherit; cursor: pointer; }
.chip .icon { width: 14px; height: 14px; vertical-align: 0; }
.svc-paused { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13px; color: var(--color-neutral-700); }

/* The log viewer: lines scroll sideways unless wrapped; errors get a tinted row. */
.logview { height: max(420px, calc(100vh - 420px)); overflow: auto; background: var(--color-surface); border: 1px solid var(--color-divider);
  padding: 8px 0; font: 12px/1.65 var(--font-mono); }
.logview-short { height: auto; max-height: 320px; margin-top: 8px; padding: 10px 0; line-height: 1.6; }
.logview:not(.wrap) .ln { width: max-content; min-width: 100%; }
.ln { white-space: pre; padding: 0 12px; }
.logview.wrap .ln { white-space: pre-wrap; overflow-wrap: anywhere; }
.ln-ts { color: var(--color-neutral-700); }
.r2 .ln-lv { color: var(--st-warn); font-weight: 500; }
.r3 .ln-lv { color: var(--st-danger); font-weight: 500; }
.ln.r3:not(.ln-cont) { background: var(--st-danger-bg); }
.ln-cont.r3 { color: var(--st-danger); }
.log-note { display: flex; align-items: center; gap: 8px; margin: 0; padding: 16px 12px; font: 14px/1.5 var(--font-body); color: var(--color-neutral-700); }
.log-note .icon { width: 15px; height: 15px; vertical-align: 0; }
.log-error { margin: 8px 12px; font-family: var(--font-body); }

/* Log options sheet (phones) */
#log-options { gap: 16px; }
#log-options h2 { font-size: 20px; }
.sheet-field { display: flex; flex-direction: column; gap: 6px; }
.seg-full { display: flex; }
.seg-full .seg-opt { flex: 1; min-height: var(--tap-min); }
#log-options .btn { min-height: var(--tap-min); }

@container (max-width: 599px) {
  .svc-status, .svc-fail, .svc-logs { padding: 14px; }
  .svc-heading { font-size: 20px; }
  .svc-figures { flex: 1 1 100%; }
  .svc-figures dd { font-size: 24px; }
  .svc-actions { flex: 1 1 100%; flex-direction: column; }
  .svc-actions .btn, .svc-fail-actions .btn, .svc-fail-actions .dis-tip { min-height: var(--tap-min); flex: 1 1 auto; }
  .svc-sep { width: auto; height: 1px; margin: 6px 0; }
  .svc-wide { display: none !important; }
  .svc-narrow { display: inline-flex !important; }
  .svc-chips.svc-narrow { display: flex !important; }
  .svc-chips[hidden] { display: none !important; }
  .svc-search { flex: 1 1 160px; }
  .svc-search .input { min-height: var(--tap-min); font-size: 16px; }
  .svc-options { min-height: var(--tap-min); flex: none; }
  .logview { height: max(360px, calc(100dvh - 170px)); }
  .svc-fail-log summary { min-height: var(--tap-min); }
}

/* ---------- Dropdown menus: <details class="dd"> with a .menu ---------- */
.dd { position: relative; flex: none; }
.dd > summary { list-style: none; cursor: pointer; }
.dd > summary::-webkit-details-marker { display: none; }
.dd > .menu { right: 0; top: calc(100% + 4px); min-width: 200px; }
.menu [aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
.menu [aria-disabled="true"]:hover { background: none; }

/* ---------- Addons dialog (design/05): head, scrolling body, pinned foot ---------- */
dialog.om-dialog { padding: 0; gap: 0; max-height: calc(100vh - 48px); }
dialog.om-dialog:has(.dlg-wide) { max-width: 640px; }
dialog.om-dialog.is-danger { border-color: var(--st-danger-line); }
.om-dialog .sheet-head { padding: 20px 22px 6px; }
.om-dialog .sheet-head h2 { overflow-wrap: anywhere; }
.om-dialog p { margin: 0; }
.om-dialog .alert { margin: 0; }
.om-dialog .input { margin-bottom: 0; min-height: var(--tap-min); }
.om-dialog .field > label { margin-bottom: 4px; }
.dlg-form { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.dlg-body { flex: 1; min-height: 0; overflow: auto; padding: 6px 22px 18px; display: flex; flex-direction: column; gap: 14px; }
.dlg-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 10px; padding: 14px 22px;
  border-top: 1px solid var(--color-divider); }
.dlg-foot .btn { min-height: var(--tap-min); }
.dlg-foot-note { margin-right: auto; font-size: 13px; color: var(--color-neutral-700); }
.dlg-note { padding: 8px 12px; border: 1px solid var(--color-divider); font-size: 13px; color: var(--color-neutral-800); }
.dlg-info { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--color-divider); font-size: 14px; }
.dlg-info .icon { width: 16px; height: 16px; margin-top: 2px; vertical-align: 0; color: var(--color-accent-700); }
.dlg-progress { display: flex; align-items: center; gap: 10px; padding: 24px 0; }
.dlg-progress .icon { width: 16px; height: 16px; vertical-align: 0; color: var(--color-accent); }
.field-hint { display: flex; gap: 6px; align-items: flex-start; margin-top: 6px; font-size: 13px; color: var(--color-neutral-700); }
.field-hint.is-error { color: var(--st-danger); }
.field-hint .icon { width: 14px; height: 14px; margin-top: 2px; vertical-align: 0; }
.input[aria-invalid="true"] { border-color: var(--st-danger); }
.alert-row > span { gap: 2px; }

/* Upload: drop zone, then "Checking…", then the review list */
.drop { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 36px 20px; text-align: center;
  border: 1px dashed var(--color-neutral-500); }
.drop.is-over { background: var(--color-accent-100); border-color: var(--color-accent); }
.drop > .icon { width: 24px; height: 24px; color: var(--color-neutral-700); }
.drop-phone { display: none !important; }
.up-checking { display: none; }
.is-checking .up-choose, .is-checking .alert, .is-checking .dlg-note { display: none !important; }
.is-checking .up-checking { display: flex; }
.review-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 12px; font-size: 13px; color: var(--color-neutral-700); }
.review-meta .mono { font-size: 12px; color: var(--color-text); }
.review-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.review-row { border-bottom: 1px solid var(--color-divider); }
.review-label { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; cursor: pointer; }
.review-label.is-off { cursor: default; }
.review-label input { width: 20px; height: 20px; margin: 2px 0 0; flex: none; accent-color: var(--color-accent); }
.review-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.review-name { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.review-name > .mono:first-child { font-size: 14px; font-weight: 500; overflow-wrap: anywhere; }
.review-state { display: flex; gap: 6px; align-items: flex-start; font-size: 13px; }
.review-state > .icon { width: 14px; height: 14px; margin-top: 2px; vertical-align: 0; color: var(--st-danger); }
.review-state .tag-outline { color: var(--color-accent-700); border-color: var(--color-accent-700); }
.done-row { display: flex; gap: 10px; align-items: flex-start; }
.done-row > .icon { width: 20px; height: 20px; margin-top: 2px; vertical-align: 0; color: var(--st-ok); }
.done-row > span { display: flex; flex-direction: column; gap: 4px; }
.done-row strong { font-weight: 500; }
.done-row .muted { font-size: 14px; }
.done-list { margin: 0; padding-left: 18px; font-size: 13px; display: flex; flex-direction: column; gap: 2px; }

/* ---------- Addons overview (design/05). Layout follows the content width: cards under 600px. ---------- */
.addons { container-type: inline-size; display: flex; flex-direction: column; gap: 20px; }
.addons .page-header { margin-bottom: 0; }
.addons .card { margin: 0; min-width: 0; }
.addons-actions { display: flex; gap: 8px; align-items: center; }
.addons-actions .icon { width: 15px; height: 15px; vertical-align: 0; }
.addons-narrow, .addons-chips { display: none !important; }
.addons-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.addons-search { flex: 0 1 320px; }
.addons-dirfilter { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--color-neutral-700); }
.addons-dirfilter .input { width: auto; min-height: 36px; margin: 0; font-size: 13px; }
.addons-summary { margin-left: auto; font-size: 12px; }
.addons-nomatch { align-items: flex-start; gap: 8px; padding: 28px 20px; }
.addons-nomatch > span { font-weight: 500; }
.addons-empty { align-items: center; text-align: center; padding: 40px 24px; gap: 10px; }
.addons-empty > .icon { width: 28px; height: 28px; color: var(--color-neutral-700); }
.addons-empty h2 { font-size: 22px; margin: 0; }
.addons-empty p { margin: 0; max-width: 46ch; color: var(--color-neutral-700); text-wrap: pretty; }
.addons-empty .btn { margin-top: 6px; }
#addons-dirs { display: flex; flex-direction: column; gap: 20px; }

.addons-dir { padding: 0; gap: 0; }
.addons-dir-head { display: flex; align-items: center; gap: 6px; padding: 4px 6px 4px 4px; border-bottom: 1px solid var(--color-divider); }
.addons-dir.is-collapsed .addons-dir-head { border-bottom: 0; }
.addons-dir.is-collapsed .addons-dir-body { display: none; }
.addons-dir-toggle { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 6px 10px;
  border: 0; background: none; color: var(--color-text); font: inherit; text-align: left; cursor: pointer; }
.addons-chev { display: grid; place-items: center; width: 16px; flex: none; }
.addons-chev .icon { width: 14px; height: 14px; vertical-align: 0; transform: rotate(90deg); transition: transform .15s; }
.addons-dir.is-collapsed .addons-chev .icon { transform: none; }
.addons-dir-toggle > .icon { width: 17px; height: 17px; vertical-align: 0; color: var(--color-neutral-700); }
.addons-dir-name { display: flex; flex-direction: column; min-width: 0; }
.addons-dir-name .mono { font-size: 15px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.addons-dir-meta { font-size: 12px; color: var(--color-neutral-700); }
.addons-notpath { flex: none; background: var(--st-warn-bg); color: var(--color-text); }
.addons-dir-head > .dd > summary { width: 32px; height: 32px; }
.addons-dir-body { padding: 4px 12px 8px; }
.addons-dir-empty { margin: 0; padding: 14px 4px; font-size: 14px; color: var(--color-neutral-700); }

.mods-table { table-layout: fixed; }
.mods-table .col-name { width: 28%; }
.mods-table .col-version { width: 120px; }
.mods-table .col-author, .mods-table .col-mod { width: 130px; }
.mods-table .col-act { width: 52px; text-align: right; }
.mods-table td { vertical-align: middle; overflow: hidden; text-overflow: ellipsis; }
.mods-table td.col-act { overflow: visible; }
.row-menu > summary { width: 32px; height: 32px; }
.row-menu > .menu { text-align: left; min-width: 180px; }
.mod-link { display: block; font-size: 13px; font-weight: 500; color: var(--color-accent-700); text-decoration-color: var(--color-accent-300);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mod-warn { display: flex; gap: 5px; align-items: flex-start; margin-top: 3px; font-size: 12px; white-space: normal; }
.mod-warn .icon { width: 13px; height: 13px; margin-top: 2px; vertical-align: 0; color: var(--st-warn); }
.mods-cards { display: none; list-style: none; margin: 0; padding: 0; flex-direction: column; gap: 14px; }
.mod-card { padding: 12px 4px 4px 14px; gap: 8px; }
.mod-card-top { display: flex; gap: 8px; align-items: flex-start; }
.mod-card-title { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; padding-top: 2px; }
.mod-card .mod-link { display: flex; align-items: center; min-height: 32px; font-size: 14px; }
.mod-card .row-menu > summary { width: var(--tap-min); height: var(--tap-min); }
.mod-dl { margin: 0; padding-right: 10px; display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 8px 14px; }
.mod-dl dd { margin: 0; font-size: 14px; overflow-wrap: anywhere; }
.mod-more summary { display: inline-flex; align-items: center; gap: 6px; min-height: var(--tap-min); padding: 0 10px 0 0; list-style: none;
  font-size: 13px; color: var(--color-accent-700); cursor: pointer; }
.mod-more summary::-webkit-details-marker { display: none; }
.mod-more summary .icon { width: 14px; height: 14px; vertical-align: 0; transition: transform .15s; }
.mod-more[open] summary .icon { transform: rotate(180deg); }
.mod-more .when-open, .mod-more[open] .when-closed { display: none; }
.mod-more[open] .when-open { display: inline; }
.mod-more .mod-dl { margin: -6px 0 10px; }

#addons-filters { gap: 6px; }
#addons-filters h2 { font-size: 20px; }
.addons-radios { display: flex; flex-direction: column; }
.addons-radios label { display: flex; align-items: center; gap: 12px; min-height: 48px; border-bottom: 1px solid var(--color-divider); font-size: 15px; cursor: pointer; }
.addons-radios input { width: 18px; height: 18px; margin: 0; accent-color: var(--color-accent); }
#addons-filters .btn { min-height: var(--tap-min); margin-top: 10px; }

@container (max-width: 599px) {
  .addons { gap: 14px; }
  .addons-wide { display: none !important; }
  .addons-narrow { display: inline-flex !important; }
  .addons-chips:not([hidden]) { display: flex !important; }
  .addons-actions { width: 100%; }
  .addons-primary { flex: 1; display: flex; }
  .addons-primary .dis-tip { flex: 1; }
  .addons-primary.btn, .addons-primary .btn { flex: 1; min-height: var(--tap-min); }
  .addons-actions .dd > summary { width: var(--tap-min); height: var(--tap-min); }
  .addons-search { flex: 1 1 160px; }
  .addons-search .input { min-height: var(--tap-min); font-size: 16px; }
  .addons-filters-btn { min-height: var(--tap-min); flex: none; }
  .mods-table { display: none; }
  .mods-cards { display: flex; }
  .addons-dir-toggle { min-height: 52px; }
  .addons-dir-head > .dd > summary { width: var(--tap-min); height: var(--tap-min); }
  .addons-notpath { display: none; }
  .addons-dir-body { padding: 12px; }
  .addons .menu a, .addons .menu button { min-height: var(--tap-min); font-size: 15px; }
}

/* ---------- Module detail (design/05). Media queries, not container queries: on
   phones the open file is position: fixed, which a container would trap. ---------- */
.addon { display: flex; flex-direction: column; gap: 20px; }
.addon .card { margin: 0; min-width: 0; }
.addon-head { display: flex; flex-direction: column; gap: 14px; padding-bottom: 16px; border-bottom: 1px solid var(--color-divider); }
.back-link { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; min-height: 32px; font-size: 14px;
  color: var(--color-accent-700); text-decoration: none; }
.back-link .icon { width: 15px; height: 15px; vertical-align: 0; }
.addon-head-row { display: flex; flex-wrap: wrap; gap: 14px 24px; align-items: flex-end; justify-content: space-between; }
.addon-title { min-width: 0; flex: 1 1 320px; display: flex; flex-direction: column; gap: 6px; }
.addon-title h2 { font-family: var(--font-mono); font-weight: 500; font-size: 28px; letter-spacing: 0; margin: 0; overflow-wrap: anywhere; }
.addon-sub { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; font-size: 14px; color: var(--color-neutral-700); }
.addon-sub > span:first-child { color: var(--color-text); }
.addon-sub .mono { font-size: 13px; }
.addon-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.addon-actions .icon { width: 15px; height: 15px; vertical-align: 0; }
.addon > .alert { margin: 0; }
.addon-manifest { padding: 18px 20px; gap: 12px; }
.addon-manifest h2, .addon-files h2 { font-size: 20px; margin: 0; }
.man-grid { margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 14px 24px; }
.man-grid dd { margin: 2px 0 0; font-size: 14px; }
.man-grid dd.mono { font-size: 13px; }
.man-wide { grid-column: 1 / -1; }
.man-grid .man-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.man-grid .man-list { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
.man-list .mono { overflow-wrap: anywhere; }
.addon-files { padding: 0; gap: 0; }
.addon-files-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 18px 20px 10px; }
.addon-files-body { display: flex; min-width: 0; border-top: 1px solid var(--color-divider); }

.tree { width: 250px; flex: none; border-right: 1px solid var(--color-divider); padding: 6px 0; max-height: 640px; overflow: auto; }
.tree ul { list-style: none; margin: 0; padding: 0; }
.tree ul ul { padding-left: 16px; }
.tree summary, .tree a { display: flex; align-items: center; gap: 6px; min-height: 28px; padding: 4px 12px; font: 13px/1.4 var(--font-mono);
  color: var(--color-text); text-decoration: none; cursor: pointer; white-space: nowrap; list-style: none; }
.tree summary::-webkit-details-marker { display: none; }
.tree summary span, .tree a span { overflow: hidden; text-overflow: ellipsis; }
.tree .icon { width: 14px; height: 14px; vertical-align: 0; color: var(--color-neutral-700); }
.tree a:hover, .tree summary:hover { background: color-mix(in srgb, var(--color-text) 5%, transparent); color: var(--color-text); }
.tree a[aria-current] { background: var(--color-accent-100); box-shadow: inset 2px 0 0 var(--color-accent); }

.drill { display: none; flex: 1; min-width: 0; flex-direction: column; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 6px 10px; border-bottom: 1px solid var(--color-divider); font: 13px var(--font-mono); }
.crumbs a { display: inline-flex; align-items: center; min-height: var(--tap-min); padding: 0 6px; color: var(--color-accent-700); text-decoration: none; }
.crumbs a[aria-current] { color: var(--color-text); }
.crumbs > span { color: var(--color-neutral-500); }
.drill-list { list-style: none; margin: 0; padding: 0; }
.drill-list li { border-bottom: 1px solid var(--color-divider); }
.drill-list a { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 14px; font: 14px var(--font-mono); color: var(--color-text); text-decoration: none; }
.drill-list .icon { width: 16px; height: 16px; vertical-align: 0; color: var(--color-neutral-700); }
.drill-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drill-meta { font-size: 11px; color: var(--color-neutral-700); }

.viewer { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--color-bg); }
.viewer-empty { padding: 24px 16px; }
.viewer-head { display: flex; align-items: center; gap: 8px; min-height: 52px; padding: 8px 10px 8px 14px; border-bottom: 1px solid var(--color-divider); }
.viewer-back { display: none; }
.viewer-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.viewer-path { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-meta { font-size: 11px; color: var(--color-neutral-700); }
.viewer-head .btn .icon { width: 14px; height: 14px; vertical-align: 0; }
.viewer-flash { display: flex; align-items: center; gap: 8px; padding: 8px 12px; font-size: 13px; background: var(--st-ok-bg); border-bottom: 1px solid var(--st-ok-line); }
.viewer-flash .icon { width: 15px; height: 15px; vertical-align: 0; color: var(--st-ok); }
.viewer-alert { margin: 10px 12px 0; }
.viewer-msg { flex: 1; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 24px 16px; }
.viewer-msg strong { font-weight: 500; }

.code, .diff { flex: 1; min-height: 360px; max-height: 560px; overflow: auto; background: var(--color-surface); font: 12.5px/1.7 var(--font-mono); padding: 8px 0; }
.code-inner { min-width: max-content; }
.cl { display: flex; }
.cl-n { position: sticky; left: 0; flex: none; width: 44px; padding-right: 12px; text-align: right; background: var(--color-surface);
  color: var(--color-neutral-600); user-select: none; border-right: 1px solid var(--color-divider); }
.cl-t { white-space: pre; padding: 0 16px 0 12px; }
.tk-c { color: var(--color-neutral-700); font-style: italic; }
.tk-s, .tk-n { color: var(--color-accent-800); }
.tk-k, .tk-t { color: var(--color-accent-700); font-weight: 600; }
.tk-d { color: var(--color-accent-700); font-weight: 500; }
.tk-a { color: var(--color-neutral-800); font-weight: 500; }

.editor { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.editor-note { display: flex; align-items: center; gap: 8px; padding: 8px 12px; font-size: 13px; background: var(--color-accent-100); border-bottom: 1px solid var(--color-divider); }
.editor-note .icon { width: 14px; height: 14px; vertical-align: 0; color: var(--color-accent-700); }
.editor-text { flex: 1; width: 100%; min-height: 360px; max-height: 560px; margin: 0; padding: 10px 14px; resize: vertical; border: 0; border-radius: 0;
  outline-offset: -2px; background: var(--color-surface); color: var(--color-text); caret-color: var(--color-accent);
  font: 12.5px/1.7 var(--font-mono); white-space: pre; overflow: auto; tab-size: 4; }
.editor-foot { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; align-items: center; padding: 10px 12px; border-top: 1px solid var(--color-divider); }
.editor-state { margin-right: auto; font-size: 12px; color: var(--color-neutral-700); }
.review-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; font-size: 13px; border-bottom: 1px solid var(--color-divider); }
.review-head > span:first-child { font-weight: 500; }
.diff { padding: 6px 0; }
.diff-add { color: var(--st-ok); }
.diff-del { color: var(--st-danger); }
.diff-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-width: 720px; }
.diff-uni { display: none; min-width: max-content; }
.ds-head { padding: 2px 12px; font: 500 11px/1.7 var(--font-body); letter-spacing: .08em; text-transform: uppercase; color: var(--color-neutral-700);
  border-bottom: 1px solid var(--color-divider); }
.ds-right { border-left: 1px solid var(--color-divider); }
.ds, .du { display: flex; min-height: 1.7em; }
.ds { min-width: 0; overflow: hidden; }
.dn { flex: none; color: var(--color-neutral-600); text-align: right; user-select: none; }
.ds .dn { width: 36px; padding-right: 8px; }
.du .dn { position: sticky; left: 0; width: 36px; padding-right: 6px; background: var(--color-surface); }
.du .dn-b { left: 36px; border-right: 1px solid var(--color-divider); }
.dm { flex: none; width: 14px; user-select: none; }
.du .dm { width: 18px; text-align: center; }
.dt { white-space: pre; }
.du .dt { padding-right: 16px; }
.ds-del, .du-del { background: color-mix(in srgb, var(--st-danger) 14%, transparent); }
.ds-add, .du-add { background: color-mix(in srgb, var(--st-ok) 14%, transparent); }
.ds-none { background: color-mix(in srgb, var(--color-text) 4%, transparent); }
.ds-del .dm, .du-del .dm { color: var(--st-danger); }
.ds-add .dm, .du-add .dm { color: var(--st-ok); }
.ds-gap, .du-gap { grid-column: 1 / -1; padding: 2px 12px; font: 12px/1.7 var(--font-body); color: var(--color-neutral-700);
  background: color-mix(in srgb, var(--color-text) 4%, transparent); border-block: 1px dashed var(--color-divider); }

/* The side-by-side diff needs room; under ~900px of content it's one column (design/05). */
@media (max-width: 1199px) {
  .diff-split { display: none; }
  .diff-uni { display: block; }
}
body.sidebar-collapsed .diff-split { display: grid; }
body.sidebar-collapsed .diff-uni { display: none; }
@media (max-width: 1023px) {
  body.sidebar-collapsed .diff-split { display: none; }
  body.sidebar-collapsed .diff-uni { display: block; }
}

/* ---------- Tablet: icon sidebar, expands as overlay ---------- */
@media (max-width: 1023px) {
  .sidebar { width: var(--sidebar-w-collapsed); }
  .sidebar .nav-label, .sidebar .instance, .sidebar .pill-label, .sidebar-collapse { display: none; }
  body.sidebar-open .sidebar { position: fixed; z-index: 45; width: var(--sidebar-w); box-shadow: var(--shadow-lg); }
  body.sidebar-open .sidebar .nav-label, body.sidebar-open .sidebar .instance, body.sidebar-open .sidebar .pill-label { display: initial; }
  .btn { min-height: var(--tap-min); }
  .topbar { padding: 0 var(--space-4); }
  main { padding: var(--space-6) var(--space-6) 48px; }
  .banner { padding: 10px var(--space-6); }
}

/* ---------- Phone: drawer navigation, compact header, sheets ---------- */
@media (max-width: 639px) {
  .sidebar { position: fixed; left: 0; top: 0; z-index: 45; width: min(300px, 85vw); transform: translateX(-100%); transition: transform .2s; }
  body.sidebar-open .sidebar { transform: none; width: min(300px, 85vw); }
  .hamburger, .topbar-status { display: inline-flex; }
  .topbar { padding: 0 var(--space-2); padding-top: env(safe-area-inset-top); }
  .user-name { display: none; }
  main { padding: var(--space-4) var(--space-4) 40px; }
  .banner { padding: 10px var(--space-4); }
  .page-header { flex-direction: column; align-items: stretch; }
  .page-header h2 { font-size: 28px; }
  .page-header .btn-primary { width: 100%; }
  .card { padding: var(--space-4); }
  .input, .form input[type=text], .form input[type=password], .form input[type=email], .form input[type=search] { min-height: var(--tap-min); font-size: 16px; }
  .log { white-space: pre-wrap; word-break: break-all; }
  .drawer { width: 100%; border-left: 0; }
  .toasts { left: var(--space-4); right: var(--space-4); width: auto; }
  dialog.sheet { width: 100%; max-width: none; height: 100%; max-height: none; margin: 0; border: 0;
    padding: calc(14px + env(safe-area-inset-top)) 16px 16px; display: flex; flex-direction: column; }
  dialog.sheet:not([open]) { display: none; }
  dialog.sheet .actions { margin-top: auto; flex-direction: column-reverse; align-items: stretch; padding-bottom: env(safe-area-inset-bottom); }
  dialog.sheet .actions .btn, dialog.sheet .actions form { flex: none; width: 100%; }
  dialog.sheet .actions form .btn { width: 100%; }
  /* Session warning: a bottom sheet, not a full-screen page. */
  dialog.sheet-bottom { height: fit-content; margin: auto 0 0; border-top: 1px solid var(--color-divider);
    padding: 20px 16px calc(16px + env(safe-area-inset-bottom)); }
  dialog.sheet-bottom .actions { padding-bottom: 0; }
  /* Login: full width with the side gutter, top-aligned, no floating card. */
  .bare main { justify-content: flex-start; padding: calc(28px + env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
    calc(24px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
  .login { width: 100%; }
  .login-card { padding: 0; border: 0; }
  .login-card::before { display: none; }
  /* On-screen keyboard open (app.js sets .kbd-open): drop the brand, tighten spacing. */
  .kbd-open.bare main { padding-top: calc(16px + env(safe-area-inset-top)); }
  .kbd-open .login-brand, .kbd-open .login-foot { display: none; }
  .kbd-open .login-card { gap: 14px; }
  .kbd-open .login-form fieldset { gap: 12px; }
  .kbd-open .login-head h1 { font-size: 24px; }
  /* Addons dialog: full-screen sheet, actions pinned at the bottom, stacked. */
  dialog.om-dialog { padding: 0; max-height: none; }
  .om-dialog .sheet-head { padding: calc(14px + env(safe-area-inset-top)) 16px 6px; }
  .dlg-body { padding: 6px 16px 16px; }
  .dlg-foot { flex-direction: column-reverse; align-items: stretch; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
  .dlg-foot .btn, .dlg-foot .dis-tip { width: 100%; }
  .dlg-foot-note { display: none; }
  .drop { display: none; }
  button.drop-phone { display: inline-flex !important; flex-direction: column; gap: 4px; min-height: 72px; font-size: 16px; }
  span.drop-phone { display: block !important; text-align: center; }
  .review-list { gap: 14px; }
  .review-row { border: 1px solid var(--color-divider); }
  .review-label { padding: 14px; }
  /* Module detail: drill-down files; an open file takes the whole screen. */
  .addon { gap: 14px; }
  .addon-title h2 { font-size: 22px; }
  .addon-actions { width: 100%; }
  .addon-actions > .btn, .addon-actions > .dis-tip { flex: 1 1 140px; min-height: var(--tap-min); }
  .addon-manifest { padding: 14px; }
  .addon-files-head { padding: 14px 14px 10px; }
  .back-link { min-height: var(--tap-min); }
  .tree { display: none; }
  .drill { display: flex; }
  .viewer:not(.is-open) { display: none; }
  .viewer.is-open { position: fixed; inset: 0; z-index: 60; padding-top: env(safe-area-inset-top); }
  .viewer.is-open .viewer-back { display: inline-grid; }
  .viewer.is-open .viewer-head { padding-left: 4px; }
  .viewer.is-open :is(.code, .diff, .editor-text) { min-height: 0; max-height: none; }
  .viewer.is-open .editor-foot { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
  .viewer-head .btn, .editor-foot .btn, .viewer-msg .btn { min-height: var(--tap-min); }
  .editor-text { font-size: 14px; }
  body.viewer-open { overflow: hidden; }
}

/* ---------- Odoo core (design/06) ---------- */
.core { display: flex; flex-direction: column; }
.core .card h2 { font-size: 20px; margin: 0; }
.core-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 6px 14px; }
.core-ro { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; }
.core-ro .icon { width: 12px; height: 12px; vertical-align: 0; }
.core-blocked { flex-direction: row; align-items: flex-start; gap: 12px; border-color: var(--st-warn-line); background: var(--st-warn-bg); }
.core-blocked > .icon { width: 20px; height: 20px; flex: none; margin-top: 2px; color: var(--st-warn); vertical-align: 0; }
.core-blocked > div { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.core-blocked strong { font-weight: 500; font-size: 15px; }
.core-blocked span { font-size: 13px; color: var(--color-neutral-700); text-wrap: pretty; }
.core-dl { margin: 0; display: grid; grid-template-columns: repeat(4, minmax(0, max-content)); gap: 14px 40px; align-items: baseline; }
.core-dl > div { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.core-dl dd { margin: 0; font-size: 14px; display: flex; align-items: center; gap: 6px; min-width: 0; }
.core-dl .core-msg { grid-column: 1 / -1; }
.core-dl .core-msg dd { font-size: 13px; overflow-wrap: anywhere; display: block; }
.core-dl .core-series { font: var(--font-heading-weight) 28px/1.1 var(--font-heading); }
.core-dl .tag { font-family: var(--font-body); }
.core-commit { gap: 2px !important; }
.core-hash { display: flex; min-width: 0; font-size: 14px; }
.core-hash-full { display: none; min-width: 0; }
.core-hash-head { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.core-hash-full > span:last-child { flex: none; }
.core-copy { flex: none; min-height: 36px; min-width: 36px; padding: 0 6px; gap: 4px; font-size: 12px; font-weight: 400; color: var(--color-text); }
.core-copied:empty { display: none; }
.core-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding-top: 14px; border-top: 1px solid var(--color-divider); }
.core-checked { margin-left: auto; font-size: 12px; text-align: right; }
.core-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.core-steps li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--color-divider); }
.core-step-icon { width: 20px; height: 20px; flex: none; display: grid; place-items: center; margin-top: 1px; }
.core-step-icon .icon { width: 18px; height: 18px; vertical-align: 0; }
.core-steps .is-done .icon { color: var(--st-ok); }
.core-steps .is-running .icon { color: var(--color-accent); }
.core-steps .is-failed .icon { color: var(--st-danger); }
.core-step-mark { width: 14px; height: 14px; border: 1px solid var(--color-neutral-500); }
.core-steps .is-skipped .core-step-mark { height: 1px; border: 0; background: var(--color-neutral-500); }
.core-step-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; overflow-wrap: anywhere; }
.core-step-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 10px; }
.core-step-row .small { font-size: 12px; }
.core-step-label { font-size: 15px; }
.core-steps :is(.is-pending, .is-skipped) .core-step-label { color: var(--color-neutral-700); }
.core-steps :is(.is-running, .is-failed) .core-step-label { font-weight: 500; }
.core-steps .is-failed .core-step-label { color: var(--st-danger); }
.core-result { margin: 0; gap: 10px; padding: 12px 14px; }
.core-result strong { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.core-result strong .icon { color: var(--st-ok); width: 18px; height: 18px; vertical-align: 0; }
.core-result > span { font-size: 14px; text-wrap: pretty; }
.core-result-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.core-backups { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.core-backups a { font-size: 13px; color: var(--color-accent-700); text-underline-offset: 3px; min-height: 28px; display: flex; align-items: center;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.core-log { max-height: 280px; overflow: auto; margin: 8px 0 0; font-size: 12px; line-height: 1.6; white-space: pre; }
.core-inc p { margin: 0; font-size: 14px; }
.core-checking { display: flex; align-items: center; gap: 10px; padding: 10px 0; }
.core-checking .icon { color: var(--color-accent); }
.core-list { max-height: 360px; overflow: auto; border: 1px solid var(--color-divider); }
.core-table { table-layout: fixed; min-width: 640px; }
.core-table th { position: sticky; top: 0; background: var(--color-bg); }
.core-table td { font-size: 13px; white-space: nowrap; }
.core-c-hash { width: 92px; }
.core-c-date, .core-c-author { width: 120px; }
.core-ellipsis { overflow: hidden; text-overflow: ellipsis; }
.core-rows { display: none; list-style: none; margin: 0; padding: 0; }
.core-rows li { display: flex; flex-direction: column; gap: 3px; padding: 10px 12px; border-bottom: 1px solid var(--color-divider); }
.core-row-top { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; }
.core-row-top .mono { font-size: 12px; font-weight: 500; }
.core-row-msg { font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.core-backup { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border: 1px solid var(--color-divider); cursor: pointer; }
.core-backup input { width: 20px; height: 20px; margin: 1px 0 0; flex: none; accent-color: var(--color-accent); }
.core-backup > span { display: flex; flex-direction: column; gap: 2px; font-size: 15px; }
.core-nobackup { display: flex; gap: 6px; align-items: flex-start; }
.core-nobackup[hidden] { display: none; }
.core-nobackup .icon { width: 14px; height: 14px; flex: none; margin-top: 2px; color: var(--st-warn); vertical-align: 0; }
.core-plan { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 2px; }

/* Phone: label/value rows, the hash truncated in the middle, compact commit rows, full-width buttons. */
@media (max-width: 639px) {
  .core-dl { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .core-dl > div { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 10px; align-items: center;
    padding: 8px 0; border-bottom: 1px solid var(--color-divider); }
  .core-dl .core-series { font-size: 20px; }
  .core-hash-short { display: none; }
  .core-hash-full { display: flex; }
  .core-copy { min-height: var(--tap-min); min-width: var(--tap-min); }
  .core-actions > .btn, .core-actions > .dis-tip, .core-result-actions > .btn { flex: 1 1 100%; min-height: var(--tap-min); }
  .core-checked { margin-left: 0; flex: 1 1 100%; text-align: center; }
  .core-list { max-height: 420px; }
  .core-table { display: none; }
  .core-rows { display: block; }
  .core-backups a { min-height: var(--tap-min); }
}

/* ---- Python packages (design/07) ---- */
.pkgs { container-type: inline-size; display: flex; flex-direction: column; gap: 20px; }
.pkgs .card { margin: 0; min-width: 0; }
.pkgs-narrow, .pkgs-chips { display: none !important; }
.pkgs-head { display: flex; flex-direction: column; gap: 20px; }
.pkgs-head:empty { display: none; }
.pkgs-info { display: flex; flex-wrap: wrap; gap: 8px 28px; align-items: baseline; padding: 12px 16px; border: 1px solid var(--color-divider); }
.pkgs-env { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 500; }
.pkgs-env .icon { width: 16px; height: 16px; vertical-align: 0; color: var(--color-neutral-700); }
.pkgs-fail { background: transparent; padding: 18px 20px; }
.pkgs-fail h2 { font-size: 20px; margin: 0; overflow-wrap: anywhere; }
.pkgs-fail h2 .mono { font-weight: 500; font-size: 18px; }
.pkgs-fail-head { display: flex; gap: 10px; align-items: flex-start; }
.pkgs-fail-head > .icon { width: 20px; height: 20px; flex: none; margin-top: 3px; vertical-align: 0; color: var(--st-danger); }
.pkgs-fail-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.pkgs-fail-text p { margin: 0; font-size: 14px; color: var(--color-neutral-700); }
.pkgs-hint { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; padding: 12px 14px; border: 1px solid var(--color-divider); }
.pkgs-hint > .icon { width: 16px; height: 16px; flex: none; vertical-align: 0; color: var(--color-accent-700); }
.pkgs-hint > span { flex: 1 1 240px; font-size: 15px; }
.pkgs-hint .mono { font-size: 14px; }
.pkgs-hint-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.pkgs-hint:not(:has(> .icon)) .pkgs-hint-actions { margin-left: auto; }
.pkgs-nomatch .muted { font-size: 14px; }
.pkgs-nomatch-q { overflow-wrap: anywhere; }
.pkgs-nomatch-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.pkgs-tablecard { padding: 4px 12px 8px; }
.pkgs-table { table-layout: fixed; }
.pkgs-table .col-ver { width: 120px; }
.pkgs-table .col-upd, .pkgs-table .col-src { width: 170px; }
.pkgs-table .col-act { width: 52px; text-align: right; }
.pkgs-table td { vertical-align: middle; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.pkgs-table td.mono { font-size: 13px; }
.pkgs-table td.col-act { overflow: visible; }
.pkgs-cards { display: none; list-style: none; margin: 0; padding: 0; flex-direction: column; gap: 12px; }
.pkg-card { flex-direction: row; align-items: flex-start; gap: 8px; padding: 12px 4px 12px 14px; }
.pkg-card-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.pkg-card-name { font-size: 15px; font-weight: 500; overflow-wrap: anywhere; }
.pkg-card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 14px; }
.pkg-card .row-menu > summary { width: var(--tap-min); height: var(--tap-min); }
#pkgs-filters { gap: 6px; }
#pkgs-filters h2 { font-size: 20px; }
#pkgs-filters .btn { min-height: var(--tap-min); margin-top: 10px; }
.pkgs-install .icon { width: 15px; height: 15px; vertical-align: 0; }
.pkgs-install > .menu { right: 0; left: auto; min-width: 220px; }

/* Install dialog: form, requirements.txt lines, dry-run table */
dialog.om-dialog:has(.dlg-xwide) { max-width: 820px; }
.pkg-form { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 14px; }
.pkg-lines { display: flex; flex-direction: column; gap: 6px; }
.pkg-lines ul { list-style: none; margin: 0; padding: 0; border: 1px solid var(--color-divider); max-height: 220px; overflow: auto; }
.pkg-lines li { display: flex; gap: 10px; align-items: flex-start; padding: 7px 10px; border-bottom: 1px solid var(--color-divider); font-size: 13px; }
.pkg-lines li:last-child { border-bottom: 0; }
.pkg-lines li > .icon { width: 14px; height: 14px; flex: none; margin-top: 2px; vertical-align: 0; }
.pkg-lines .is-ok > .icon { color: var(--st-ok); }
.pkg-lines .is-bad > .icon { color: var(--st-danger); }
.pkg-lines li > span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pkg-lines .mono { font-size: 12px; overflow-wrap: anywhere; }
.pkg-line-note { color: var(--st-danger); }
.pkg-plan-sum { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--color-neutral-700); }
.pkg-plan { table-layout: fixed; }
.pkg-plan .col-kind { width: 110px; }
.pkg-plan .col-ver { width: 130px; }
.pkg-plan .col-note { width: 200px; }
.pkg-plan td { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pkg-plan tr.is-risk, .pkg-plan tr.is-risk:hover { background: var(--st-warn-bg); }
.pkg-alert > span { display: block; font-size: 14px; }
.pkg-requested { font-family: var(--font-body); font-size: 11px; color: var(--color-neutral-700); }
.pkg-risk { display: inline-flex; gap: 5px; align-items: center; font-size: 12px; font-weight: 500; }
.pkg-risk .icon, .pkg-plan-mark .icon { width: 14px; height: 14px; flex: none; vertical-align: 0; color: var(--st-warn); }
.pkg-plan-rows { display: none; list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--color-divider); }
.pkg-plan-rows li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 8px; border-bottom: 1px solid var(--color-divider); }
.pkg-plan-rows li.is-risk { background: var(--st-warn-bg); }
.pkg-plan-mark { width: 16px; flex: none; display: grid; place-items: center; margin-top: 3px; font-family: var(--font-mono); font-size: 13px; color: var(--color-neutral-700); }
.pkg-plan-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pkg-plan-text .mono { font-size: 14px; overflow-wrap: anywhere; }
.pkg-risk-label { font-size: 12px; font-weight: 500; }
.pkgs-pick { min-height: 72px; font-size: 16px; }

/* Phone: one Install button with a choice, cards, the Filters sheet. */
@container (max-width: 599px) {
  .pkgs { gap: 14px; }
  .pkgs-wide { display: none !important; }
  .pkgs-narrow { display: inline-flex !important; }
  .pkgs-chips:not([hidden]) { display: flex !important; }
  .pkgs-install { flex: 1; }
  .pkgs-install > summary, .pkgs-install .dis-tip, .pkgs-install .btn { flex: 1; width: 100%; min-height: var(--tap-min); justify-content: center; }
  .pkgs-install > .menu { left: 0; right: 0; }
  .pkgs-install .menu [role=menuitem] { min-height: var(--tap-min); }
  .pkgs-filters-btn { min-height: var(--tap-min); flex: none; }
  .pkgs-info { padding: 10px 12px; }
  .pkgs-fail { padding: 14px; }
  .pkgs-hint-actions { width: 100%; }
  .pkgs-hint-actions > .btn, .pkgs-hint-actions > .dis-tip, .pkgs-nomatch-actions > .btn { flex: 1 1 140px; min-height: var(--tap-min); }
  .pkgs-fail-head .icon-btn { width: var(--tap-min); height: var(--tap-min); }
  .pkgs-tablecard { display: none; }
  .pkgs-cards { display: flex; }
}
/* The install sheet is full-screen on phones; the dry run becomes change rows. */
@media (max-width: 639px) {
  .pkg-form { grid-template-columns: minmax(0, 1fr); }
  .pkg-form .input { font-size: 16px; }
  .pkg-plan { display: none; }
  .pkg-plan-rows { display: block; }
}

/* ---------- System libraries (design/08) ---------- */
.libs { container-type: inline-size; display: flex; flex-direction: column; gap: 20px; --libs-bleed: var(--space-8); }
.libs .card { margin: 0; min-width: 0; }
.libs-intro { margin: 0; max-width: 72ch; font-size: 15px; text-wrap: pretty; }
.libs-search { flex: 0 1 380px; }
.libs-nomatch-q { overflow-wrap: anywhere; }
.libs-nomatch .muted { font-size: 14px; }
.libs-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
#libs-live { display: flex; flex-direction: column; gap: 20px; }
.libs-groups { display: flex; flex-direction: column; gap: 28px; }
.libs-group { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.libs-group-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  padding: 8px 0; margin-top: -8px; border-bottom: 1px solid var(--color-divider); background: var(--color-bg); z-index: 5; }
.libs-group-head h2 { font-size: 20px; margin: 0; }
.libs-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.lib-card { padding: 14px; gap: 10px; }
.lib-card:has(input:checked) { background: var(--color-accent-100); border-color: var(--color-accent); }
.lib-top { display: flex; gap: 10px; align-items: flex-start; }
.lib-top input[type=checkbox] { width: 20px; height: 20px; margin: 2px 0 0; flex: none; accent-color: var(--color-accent); cursor: pointer; }
.lib-top input[type=checkbox]:disabled { cursor: not-allowed; }
.lib-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.lib-name { font-size: 15px; font-weight: 500; overflow-wrap: anywhere; }
.lib-desc { font-size: 13px; color: var(--color-neutral-800); text-wrap: pretty; }
.lib-needed { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; color: var(--color-neutral-700); }
.lib-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; padding-top: 10px;
  border-top: 1px solid var(--color-divider); min-height: 46px; }
.lib-foot .pill { min-width: 0; max-width: 100%; }
.lib-ver { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-missing { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--color-neutral-700); }
.lib-box { width: 10px; height: 10px; border: 1px solid var(--color-neutral-500); }
.libs-job { padding: 18px 20px; }
.dbs-job h2 .icon { flex: none; }
.libs-job-head { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; justify-content: space-between; }
.libs-job-head h2 { font-size: 20px; margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; overflow-wrap: anywhere; }
.libs-job-head h2 .icon { width: 18px; height: 18px; vertical-align: 0; color: var(--color-accent); }
.libs-job-head h2 .mono { font-size: 17px; font-weight: 500; }
.libs-job:not(.card-danger) h2 .icon:not(.spin) { color: var(--st-ok); }
.libs-job.card-danger h2 .icon { color: var(--st-danger); }
.libs-job.card-danger { background: transparent; }
.libs-job-note { margin: 0; font-size: 14px; }
.libs-log { max-height: 220px; overflow: auto; margin: 0; font-size: 12px; line-height: 1.6; white-space: pre; }
.libs-job-next { align-self: flex-start; }
.libs-request { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; padding: 16px 0 4px; border-top: 1px solid var(--color-divider); font-size: 14px; }
.libs-request a { display: inline-flex; align-items: center; min-height: 36px; }
.libs-bar { position: sticky; bottom: 0; z-index: 20; margin: 0 calc(-1 * var(--libs-bleed)) -56px;
  padding: 12px var(--libs-bleed) calc(12px + env(safe-area-inset-bottom)); background: var(--color-bg);
  border-top: 1px solid var(--color-divider); box-shadow: var(--shadow-md); display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.libs-bar[hidden] { display: none; }
.libs-bar-text { flex: 1 1 auto; font-size: 14px; min-width: 0; overflow-wrap: anywhere; }
.libs-bar-text strong { font-weight: 500; }
.libs-bar-actions { display: flex; gap: 8px; }
.libs-bar .btn { min-height: var(--tap-min); }
.libs-dlg-sec { display: flex; flex-direction: column; gap: 6px; }
.libs-sel { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--color-divider); }
.libs-sel li { display: flex; flex-direction: column; gap: 2px; padding: 8px 0; border-bottom: 1px solid var(--color-divider); }
.libs-sel .mono { font-size: 14px; }
.libs-deps { display: flex; flex-wrap: wrap; gap: 6px; }
@media (max-width: 1023px) { .libs { --libs-bleed: var(--space-6); } .libs-bar { margin-bottom: -48px; } }
@media (max-width: 639px) { .libs { --libs-bleed: var(--space-4); } .libs-bar { margin-bottom: -40px; } }
@container (max-width: 899px) { .libs-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* Phone: one column, group headings stick under the top bar, larger tap targets. */
@container (max-width: 599px) {
  .libs { gap: 14px; }
  .libs-search { flex: 1 1 100%; }
  .libs-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .libs-group-head { position: sticky; top: calc(var(--topbar-h) + env(safe-area-inset-top)); }
  .lib-foot .btn, .libs-request a { min-height: var(--tap-min); }
  .libs-job { padding: 14px; }
  .libs-log { max-height: 260px; }
  .libs-job-next { width: 100%; }
  .libs-actions > .btn { flex: 1 1 140px; min-height: var(--tap-min); }
  .libs-bar-actions { flex: 1 1 100%; }
  .libs-bar-actions .btn-primary { flex: 1; }
}

/* ---------- Databases (design/09) ---------- */
.dbs { container-type: inline-size; }
#db-live { display: flex; flex-direction: column; gap: 20px; }
.dbs .card { margin: 0; min-width: 0; }
.dbs .page-header { margin-bottom: 0; }
.dbs-meta { display: flex; flex-wrap: wrap; gap: 8px 24px; align-items: baseline; font-size: 13px; color: var(--color-neutral-700); }
.dbs-meta .mono { font-size: 12px; color: var(--color-text); }
.dbs-empty { padding: 24px 20px; gap: 8px; align-items: flex-start; }
.dbs-empty-title { font-weight: 500; }
.dbs-empty .muted { font-size: 14px; }
.dbs-tablecard { padding: 4px 12px 8px; }
.dbs-table { table-layout: fixed; }
.dbs-table td { vertical-align: middle; font-size: 14px; }
.dbs-table .col-size { width: 96px; }
.dbs-table .col-date { width: 130px; }
.dbs-table .col-bk { width: 140px; }
.dbs-table .col-ver { width: 70px; }
.dbs-table .col-act { width: 140px; }
.dbs-table .col-type { width: 130px; }
.dbs-table .col-by { width: 120px; }
.dbs-table .col-bkact { width: 170px; }
.dbs-table .num { text-align: right; }
.dbs-bk-table td.mono { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dbs-name { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; min-width: 0; }
.dbs-name > a { font-size: 13px; font-weight: 500; overflow-wrap: anywhere; }
.dbs-badges { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.dbs-age { display: inline-flex; align-items: center; gap: 5px; }
.dbs-age .icon { width: 13px; height: 13px; vertical-align: 0; color: var(--st-warn); }
.dbs-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.dbs-actions .btn { min-height: 32px; padding-inline: 10px; }
.dbs-actions .btn .icon { width: 15px; height: 15px; vertical-align: 0; }
.dbs-cards { display: none; list-style: none; margin: 0; padding: 0; flex-direction: column; gap: 12px; }
.db-card { padding: 14px; gap: 8px; }
.db-card-text { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.db-card-name { font-size: 15px; font-weight: 500; overflow-wrap: anywhere; }
.db-card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; font-size: 14px; }
.db-card-foot { padding-top: 8px; border-top: 1px solid var(--color-divider); }
.db-card-foot .dbs-actions { justify-content: stretch; }
.db-card-foot .dbs-actions > .btn, .db-card-foot .dbs-actions > .dis-tip { flex: 1; }
.db-card-foot .dbs-actions .btn { width: 100%; min-height: var(--tap-min); }
.db-card .row-menu > summary { width: var(--tap-min); height: var(--tap-min); }
.dbs-file { overflow-wrap: anywhere; }

/* Detail page */
.dbs-dhead { display: flex; flex-direction: column; gap: 14px; padding-bottom: 16px; border-bottom: 1px solid var(--color-divider); }
.dbs-back { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; min-height: 32px; font-size: 14px; }
.dbs-back .icon { width: 15px; height: 15px; vertical-align: 0; }
.dbs-dhead-row { display: flex; flex-wrap: wrap; gap: 14px 24px; align-items: flex-end; justify-content: space-between; }
.dbs-dhead-text { flex: 1 1 300px; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.dbs-dhead-text h2 { font-family: var(--font-mono); font-weight: 500; font-size: 28px; letter-spacing: 0; margin: 0; overflow-wrap: anywhere; }
.dbs-dhead-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 14px; }
.dbs-dactions { display: flex; flex-wrap: wrap; gap: 8px; }
.dbs-dgrid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 20px; }
.dbs-size, .dbs-facts { padding: 18px 20px; }
.dbs-sec-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.dbs-sec-head h2 { font-size: 22px; margin: 0; }
.dbs-sec-head h3 { font-size: 20px; }
.dbs-total { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; font-size: 14px; }
.dbs-total-n { font: var(--font-heading-weight) 34px/1 var(--font-heading); }
.dbs-spark { width: 100%; height: 110px; display: block; border-bottom: 1px solid var(--color-divider); }
.dbs-spark-area { fill: var(--color-accent-100); }
.dbs-spark-line { fill: none; stroke: var(--color-accent); stroke-width: 1.5; }
.dbs-spark-axis { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: 11px; color: var(--color-neutral-700); }
.dbs-spark-none { margin: 0; padding: 30px 0; border-bottom: 1px solid var(--color-divider); }
.dbs-facts dl { margin: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px 20px; }
.dbs-facts dd { margin: 2px 0 0; font-size: 14px; }
.dbs-facts .dbs-fact-n { font: var(--font-heading-weight) 24px/1.2 var(--font-heading); }
.dbs-backups { display: flex; flex-direction: column; gap: 12px; min-width: 0; }

/* Dialogs */
.dbs-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.dbs-wide { grid-column: 1 / -1; }
.dbs-form select.input, .om-dialog select.input { min-height: var(--tap-min); }
.pw-meter { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; margin-top: 8px; }
.pw-meter span { height: 4px; background: var(--color-neutral-200); }
.pw-meter[data-score="1"] span:nth-child(-n+1) { background: var(--st-danger); }
.pw-meter[data-score="2"] span:nth-child(-n+2) { background: var(--st-warn); }
.pw-meter[data-score="3"] span:nth-child(-n+3), .pw-meter[data-score="4"] span { background: var(--st-ok); }
.field-hint strong { font-weight: 500; color: var(--color-text); }
.field-hint.is-error strong { color: inherit; }
.dbs-switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: var(--tap-min); cursor: pointer; }
.dbs-switch-text { display: flex; flex-direction: column; font-size: 15px; }
.dbs-switch input { appearance: none; flex: none; position: relative; width: 36px; height: 20px; margin: 0; border: 1px solid var(--color-neutral-500); cursor: pointer; }
.dbs-switch input::before { content: ""; position: absolute; top: 3px; left: 3px; width: 12px; height: 12px; background: var(--color-neutral-500); transition: left .15s; }
.dbs-switch input:checked { border-color: var(--color-accent); background: var(--color-accent-100); }
.dbs-switch input:checked::before { left: 19px; background: var(--color-accent); }
.dbs-switch input:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.dbs-fmts { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.dbs-fmts legend { margin-bottom: 6px; }
.dbs-fmt { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border: 1px solid var(--color-divider); cursor: pointer; }
.dbs-fmt:has(input:checked) { border-color: var(--color-accent); background: var(--color-accent-100); }
.dbs-fmt.is-disabled { opacity: .55; cursor: not-allowed; }
.dbs-fmt input, .dbs-check input { width: 18px; height: 18px; margin: 2px 0 0; flex: none; accent-color: var(--color-accent); }
.dbs-fmt-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.dbs-fmt-top { display: flex; justify-content: space-between; gap: 10px; font-size: 15px; }
.dbs-space { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; font-size: 14px; }
.dbs-space[hidden] { display: none; }
.dbs-check { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border: 1px solid var(--color-divider); cursor: pointer; }
.dbs-check > span { display: flex; flex-direction: column; gap: 3px; font-size: 15px; }
.dbs-check strong { font-weight: 500; }
.dbs-check-plain { padding: 0; border: 0; align-items: center; min-height: var(--tap-min); }
.dbs-warn { display: flex; gap: 6px; align-items: flex-start; font-size: 13px; }
.dbs-warn[hidden] { display: none; }
.dbs-warn .icon { width: 14px; height: 14px; flex: none; margin-top: 2px; vertical-align: 0; color: var(--st-warn); }
.dbs-room { display: flex; flex-direction: column; gap: 6px; }
.dbs-room-bar { width: 100%; height: 12px; display: block; border: 1px solid var(--color-divider); }
.dbs-room-used { fill: var(--color-neutral-400); }
.dbs-room-add { fill: var(--color-accent); }
.dbs-room-add.is-warn { fill: var(--st-warn); }
.dbs-room-add.is-full { fill: var(--st-danger); }
.dbs-room-text { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; font-size: 13px; }
.dbs-room-text .mono { font-size: 12px; color: var(--color-text); }
.dbs-mods { display: flex; flex-direction: column; gap: 8px; }
.dbs-mods[hidden] { display: none; }
.dbs-mods-bar { display: flex; gap: 8px; align-items: center; }
.dbs-mods-bar .input { flex: 1; min-width: 0; margin: 0; }
.dbs-mods-bar .muted { white-space: nowrap; }
.dbs-mods-list { list-style: none; margin: 0; padding: 0; max-height: 260px; overflow: auto; border: 1px solid var(--color-divider); }
.dbs-mods-list li { border-bottom: 1px solid var(--color-divider); }
.dbs-mods-list li:last-child { border-bottom: 0; }
.dbs-mods-list label { display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 0 10px; cursor: pointer; }
.dbs-mods-list label:has(input:checked) { background: var(--color-accent-100); }
.dbs-mods-list input { width: 18px; height: 18px; margin: 0; flex: none; accent-color: var(--color-accent); }
.dbs-mods-list .mono { font-size: 13px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dbs-mods-none { padding: 12px; }
.dbs-done { display: flex; gap: 10px; align-items: flex-start; }
.dbs-done > .icon { width: 20px; height: 20px; margin-top: 2px; vertical-align: 0; color: var(--st-ok); }
.dbs-done > span { display: flex; flex-direction: column; gap: 4px; }
.dbs-done strong { font-weight: 500; }
.dbs-done .muted { font-size: 14px; }
.dbs-run { padding: 16px 0; }
.dbs-tech .log { margin-top: 8px; max-height: 260px; }

@container (max-width: 819px) { .dbs-dgrid { grid-template-columns: minmax(0, 1fr); } }
/* Phone: cards with Back up (or Download) visible and the rest in the menu. */
@container (max-width: 599px) {
  #db-live { gap: 14px; }
  .dbs-tablecard { display: none; }
  .dbs-cards { display: flex; }
  .dbs-dhead-text h2 { font-size: 22px; }
  .dbs-dhead-tags a { display: inline-flex; align-items: center; min-height: var(--tap-min); }
  .dbs-dactions { width: 100%; }
  .dbs-dactions > .btn, .dbs-dactions > .dis-tip { flex: 1 1 120px; }
  .dbs-dactions .btn { width: 100%; min-height: var(--tap-min); }
  .dbs-back { min-height: var(--tap-min); }
  .dbs-size, .dbs-facts { padding: 14px; }
  .dbs-empty .btn { min-height: var(--tap-min); }
}
/* The dialogs are full-screen sheets on phones, with single-column forms. */
@media (max-width: 639px) {
  .dbs-form { grid-template-columns: minmax(0, 1fr); }
  .dbs-form .input, .om-dialog select.input, .dbs-mods-bar .input { font-size: 16px; }
  .dbs-mods-list { max-height: none; }
  .dbs-mods-list label { min-height: 48px; }
  .dbs-mods-bar .input { min-height: var(--tap-min); }
}

/* ---------- Filestore (design/10) ---------- */
/* .fs also carries .dbs: the backups list reuses the Databases table and cards. */
.fs { display: flex; flex-direction: column; gap: 22px; }
.fs-live { display: flex; flex-direction: column; gap: 22px; }
.fs-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.fs-card { padding: 16px 18px; flex-direction: column; justify-content: space-between; gap: 8px 16px; color: var(--color-text); text-decoration: none; }
.fs-card:hover { color: var(--color-text); background: color-mix(in srgb, var(--color-text) 4%, transparent); }
.fs-card[aria-current="true"] { background: var(--color-accent-100); border-color: var(--color-accent); }
.fs-card-name { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.fs-card-name .mono { font-size: 14px; font-weight: 500; overflow-wrap: anywhere; }
.fs-card-val { display: flex; flex-direction: column; gap: 2px; }
.fs-card-size { font: var(--font-heading-weight) 30px/1 var(--font-heading); }
.fs-card-growth { display: flex; align-items: center; gap: 4px; }
.fs-card-growth .icon { width: 12px; height: 12px; vertical-align: 0; }

.fs-browser { padding: 0; gap: 0; }
.fs-br-head { padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; border-bottom: 1px solid var(--color-divider); }
.fs-br-top, .fs-br-bar { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; }
.fs-br-top h2 { font-size: 20px; margin: 0; display: flex; align-items: center; gap: 10px; }
.fs-br-top .tag .icon { width: 11px; height: 11px; vertical-align: 0; }
.fs-db-pick { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--color-neutral-700); }
.fs-db-pick .input, .fs-sort .input { width: auto; margin: 0; min-height: 36px; font-size: 14px; }
.fs-note { margin: 0; display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: var(--color-neutral-800); }
.fs-note .icon { width: 15px; height: 15px; flex: none; margin-top: 1px; vertical-align: 0; color: var(--color-accent-700); }
.fs-crumbs { display: flex; align-items: center; min-width: 0; font: 13px var(--font-mono); }
.fs-crumbs-full { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; min-width: 0; }
.fs-crumbs a, .fs-crumbs [aria-current] { padding: 0 6px; min-height: 32px; display: inline-flex; align-items: center; }
.fs-crumbs a { color: var(--color-accent-700); text-decoration: underline; text-underline-offset: 3px; }
.fs-crumbs [aria-current] { font-weight: 500; }
.fs-sep { color: var(--color-neutral-500); }
.fs-crumbs-short { display: none; align-items: center; gap: 2px; min-width: 0; }
.fs-crumb-menu > summary { min-width: var(--tap-min); min-height: var(--tap-min); display: grid; place-items: center; color: var(--color-accent-700); }
.fs-crumb-menu > .menu { left: 0; right: auto; }
.fs-crumb-menu .menu a { min-height: var(--tap-min); font-size: 14px; }
.fs-br-meta { display: flex; align-items: center; gap: 8px 14px; font-size: 13px; color: var(--color-neutral-700); }
.fs-sort { display: none; align-items: center; gap: 8px; margin-left: auto; }
.fs-empty { padding: 24px 18px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.fs-empty .muted { font-size: 14px; }
.fs-trunc { margin: 0; padding: 10px 18px 0; }
.fs-tablewrap { overflow: auto; max-height: 560px; }
.fs-table { table-layout: fixed; min-width: 640px; }
.fs-table th { position: sticky; top: 0; z-index: 1; background: var(--color-bg); }
.fs-table th a { display: inline-flex; align-items: center; gap: 4px; color: inherit; text-decoration: none; }
.fs-table th[aria-sort="ascending"] a, .fs-table th[aria-sort="descending"] a { color: var(--color-text); }
.fs-table td { vertical-align: middle; font-size: 13px; }
.fs-table .col-thumb { width: 64px; padding: 6px 8px; }
.fs-table .col-type { width: 190px; }
.fs-table .col-size { width: 100px; }
.fs-table .col-date { width: 120px; }
.fs-table .col-fsact { width: 96px; text-align: right; }
.fs-table .num { text-align: right; }
.fs-table .mono { font-size: 13px; }
.fs-mtime { white-space: nowrap; }
.fs-thumb { display: block; flex: none; width: 40px; height: 40px; border: 1px solid var(--color-divider); object-fit: cover; }
.fs-badge { display: grid; place-items: center; font: 500 10px var(--font-mono); color: var(--color-neutral-800); }
.fs-dir { font-weight: 500; color: var(--color-accent-700); text-decoration: underline; text-underline-offset: 3px; }
.fs-name { display: flex; min-width: 0; }
.fs-name > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.fs-acts { display: inline-flex; gap: 2px; }
.fs-acts .icon-btn { width: 32px; height: 32px; }
.fs-acts .icon-btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
.fs-list { display: none; list-style: none; margin: 0; padding: 0; }
.fs-list li { border-bottom: 1px solid var(--color-divider); }
.fs-list li:last-child { border-bottom: 0; }
.fs-item { width: 100%; display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 8px 12px; border: 0; background: none;
  color: var(--color-text); font: inherit; text-align: left; text-decoration: none; cursor: pointer; }
.fs-item:hover { color: var(--color-text); background: color-mix(in srgb, var(--color-text) 4%, transparent); }
span.fs-item[aria-disabled="true"] { cursor: default; }
.fs-item > .icon { width: 14px; height: 14px; flex: none; vertical-align: 0; color: var(--color-neutral-700); }
.fs-item-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.fs-item-top { display: flex; justify-content: space-between; gap: 10px; }
.fs-item-top .mono { font-size: 13px; font-weight: 500; }
.fs-item-top > .mono:last-child { flex: none; font-weight: 400; }
.fs-bk-note { margin: 0; font-size: 13px; color: var(--color-neutral-700); }

/* Preview: a wide dialog on desktop, full-screen on phones (the sheet rule). */
dialog.om-dialog:has(.fs-pv-body) { max-width: 900px; height: min(86vh, 900px); }
.om-dialog .fs-pv-head { align-items: center; padding: 12px 12px 12px 22px; border-bottom: 1px solid var(--color-divider); }
.fs-pv-head .icon-btn { margin: 0; width: 44px; height: 44px; }
.fs-pv-head .btn { min-height: 44px; flex: none; }
.fs-pv-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.fs-pv-title .mono { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fs-pv-dl-short { display: none; }
.fs-pv-body { flex: 1; min-height: 0; display: grid; place-items: center; background: var(--color-surface); overflow: auto; }
.fs-pv-img { max-width: 100%; max-height: 100%; object-fit: contain; }
.fs-pv-pdf { width: 100%; height: 100%; border: 0; background: #fff; }

@container (max-width: 899px) { .fs-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* Phone: stacked cards, rows instead of the table, a collapsed breadcrumb and the sort control. */
@container (max-width: 599px) {
  .fs, .fs-live { gap: 14px; }
  .fs-cards { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .fs-card { padding: 14px; flex-direction: row; align-items: center; }
  .fs-card-val { align-items: flex-end; }
  .fs-card-size { font-size: 22px; }
  .fs-br-head { padding: 14px; }
  .fs-db-pick, .fs-br-meta { flex: 1 1 100%; }
  .fs-db-pick .input { flex: 1; }
  .fs-db-pick .input, .fs-sort .input { min-height: var(--tap-min); font-size: 16px; }
  .fs-crumbs-full:has(+ .fs-crumbs-short) { display: none; }
  .fs-crumbs-short { display: flex; }
  .fs-sort { display: flex; }
  .fs-tablewrap { display: none; }
  .fs-list { display: block; }
  .fs-bk-note a { display: inline-flex; align-items: center; min-height: var(--tap-min); }
}
@media (max-width: 639px) {
  dialog.om-dialog:has(.fs-pv-body) { height: auto; }
  .om-dialog .fs-pv-head { padding: calc(6px + env(safe-area-inset-top)) 8px 6px 16px; }
  .fs-pv-dl { display: none; }
  .fs-pv-dl-short { display: inline; }
}

/* ---------- Activity (design/11). Phone layout under 640px: cards, filters in a sheet. ---------- */
.act { display: flex; flex-direction: column; gap: 16px; }
.act .page-header { margin-bottom: 0; }
.act .card { margin: 0; }
.act-narrow { display: none !important; }
.act-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin: 0; }
.act-search { flex: 1 1 220px; }
/* Desktop: the sheet's fields sit in the bar (the dialog is never opened). */
.act-sheet { display: contents; }
.act-sheet .field { margin: 0; }
.act-sheet .field > label { display: block; font-size: 12px; margin-bottom: 4px; color: var(--color-neutral-800); }
.act-sheet .input { margin: 0; min-height: 36px; }
.act-f-user, .act-f-cat { flex: 0 1 170px; }
.act-f-result { flex: 0 1 130px; }
.act-dates { display: contents; }
.act-f-date { flex: 0 1 150px; }
.act-f-date .input { height: 36px; padding-block: 0; }
.act-filters-btn .icon { width: 15px; height: 15px; vertical-align: 0; }
.act-chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; min-height: 26px; }
.act-chip { min-height: 26px; font-size: 12px; padding-left: 10px; }
.act-chip button { width: 24px; height: 26px; }
.act-chip .icon { width: 12px; height: 12px; }
.act-clearall { min-height: 26px; }
.act-count { margin-left: auto; }
.act-empty { padding: 28px 20px; gap: 8px; align-items: flex-start; }
.act-tablecard { padding: 4px 12px 8px; min-width: 0; overflow-x: auto; }
.act-table { table-layout: fixed; min-width: 820px; }
.act-table td { vertical-align: middle; }
.act-table .col-time { width: 130px; }
.act-table .col-user { width: 150px; }
.act-table .col-target { width: 22%; }
.act-table .col-result { width: 100px; }
.act-table .col-ip { width: 130px; }
.act-table td.mono { font-size: 12px; }
.act-table tbody tr { cursor: pointer; }
.act-time { white-space: nowrap; }
.act-ellip { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.act-table td.act-ellip { display: table-cell; font-size: 13px; }
.act-open { display: flex; align-items: center; gap: 6px; max-width: 100%; padding: 0; border: 0; background: none; font: inherit; font-size: 14px;
  color: var(--color-text); text-align: left; cursor: pointer; }
.act-open:hover .act-ellip { text-decoration: underline; }
.act-log { flex: none; font-size: 10px; padding: 0 5px; }
.act-res { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; }
.act-res .icon { width: 14px; height: 14px; vertical-align: 0; }
.act-res.is-failed { color: var(--st-danger); }
.act-cards { display: none; list-style: none; margin: 0; padding: 0; flex-direction: column; gap: 10px; }
.act-card { padding: 0; }
.act-card > button { width: 100%; display: flex; flex-direction: column; gap: 5px; padding: 12px 14px; border: 0; background: none;
  color: var(--color-text); font: inherit; text-align: left; cursor: pointer; }
.act-card-title { font-size: 15px; font-weight: 500; overflow-wrap: anywhere; }
.act-card-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 10px; font-size: 13px; color: var(--color-neutral-700); }
.act-foot { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 10px; }
/* Entry detail: a side panel on desktop, full-screen on phones (dialog.sheet). */
@media (min-width: 640px) {
  dialog.om-dialog.is-drawer { margin: 0 0 0 auto; width: min(520px, 100vw); max-width: none; height: 100dvh; max-height: 100dvh;
    border-width: 0 0 0 1px; }
}
.act-detail { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.om-dialog .act-dhead { padding: calc(14px + env(safe-area-inset-top)) 12px 12px 20px; border-bottom: 1px solid var(--color-divider); }
.om-dialog .act-dhead .icon-btn { margin: 0; width: var(--tap-min); height: var(--tap-min); }
.act-dtitle { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.act-dtitle h2 { font-size: 22px; margin: 0; overflow-wrap: anywhere; }
.act-dbody { padding: 16px 20px calc(20px + env(safe-area-inset-bottom)); gap: 16px; }
.act-facts { margin: 0; display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 10px 14px; font-size: 14px; }
.act-facts dt { color: var(--color-neutral-700); }
.act-facts dd { margin: 0; }
.act-facts dd.mono { font-size: 13px; }
.act-wrap { overflow-wrap: anywhere; }
.act-note { padding: 10px 12px; border: 1px solid var(--color-divider); font-size: 14px; }
.act-note.is-failed { border-color: var(--st-danger-line); background: var(--st-danger-bg); }
.act-logwrap { display: flex; flex-direction: column; gap: 6px; }
.act-log-pre { margin: 0; max-height: 360px; overflow: auto; }
@media (max-width: 639px) {
  .act-wide { display: none !important; }
  .act-narrow { display: inline-flex !important; }
  .act .page-header { flex-direction: row; flex-wrap: nowrap; align-items: flex-start; }
  .act .page-header > div:first-child { flex: 1; min-width: 0; }
  .act .page-header .addons-actions { flex: none; }
  .act-more > summary { width: var(--tap-min); height: var(--tap-min); }
  .act-search { flex: 1 1 160px; }
  .act-search .input { min-height: var(--tap-min); font-size: 16px; }
  .act-filters-btn { min-height: var(--tap-min); flex: none; }
  .act-chips { min-height: 0; }
  .act-chip, .act-chip button, .act-clearall { min-height: var(--tap-min); }
  .act-chip button { width: 40px; height: var(--tap-min); }
  .act-count { flex: 1 1 100%; margin-left: 0; }
  .act-tablecard { display: none; }
  .act-cards { display: flex; }
  .act-foot .btn { min-height: var(--tap-min); }
  /* The filter sheet. */
  .act-sheet:not([open]) { display: none; }
  .act-sheet[open] { display: flex; flex-direction: column; gap: 14px; width: 100%; max-width: none; max-height: 92vh; margin: auto 0 0;
    box-sizing: border-box; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); border: 1px solid var(--color-divider);
    background: var(--color-bg); color: var(--color-text); overflow: auto; }
  .act-sheet::backdrop { background: var(--scrim); }
  .act-sheet-head { display: flex !important; align-items: center; justify-content: space-between; }
  .act-sheet-head h2 { font-size: 20px; margin: 0; }
  .act-sheet-head .icon-btn { width: var(--tap-min); height: var(--tap-min); }
  .act-sheet .field { flex: none; }
  .act-sheet .input { min-height: var(--tap-min); font-size: 16px; }
  .act-dates { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .act-sheet-foot { display: flex !important; gap: 10px; }
  .act-sheet-foot .btn { min-height: var(--tap-min); flex: 1; }
  .act-sheet-foot .btn-primary { flex: 2; }
}

/* ---------- Users & roles (design/11). Phone layout under 600px of content: cards, a role selector. ---------- */
.users { container-type: inline-size; display: flex; flex-direction: column; gap: 28px; }
.users .page-header { margin-bottom: 0; }
.users .card { margin: 0; }
.users-sec { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.users-table .col-un { width: 130px; }
.users-table .col-role { width: 110px; }
.users-table .col-status { width: 120px; }
.users-table .col-uact { width: 56px; text-align: right; }
.users-name { display: block; font-weight: 500; }
.users-note { display: flex; gap: 5px; align-items: flex-start; margin-top: 3px; font-size: 12px; color: var(--color-neutral-700); }
.users-note .icon { width: 13px; height: 13px; flex: none; margin-top: 2px; vertical-align: 0; color: var(--color-accent-700); }
.user-card-head { display: flex; gap: 8px; align-items: flex-start; justify-content: space-between; }
.users-role-name { font-size: 15px; font-weight: 500; }
.matrix-card { overflow-x: auto; }
.matrix-table { min-width: 560px; }
.matrix-table th[scope="row"] { font-size: 14px; font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--color-text);
  position: sticky; left: 0; background: var(--color-bg); }
.matrix-table thead th:first-child { position: sticky; left: 0; background: var(--color-bg); }
.matrix-table .col-mx { width: 120px; text-align: center; }
.mx-yes { display: inline-flex; color: var(--st-ok); }
.mx-yes .icon { width: 16px; height: 16px; vertical-align: 0; }
.mx-no { color: var(--color-neutral-600); }
.matrix-phone { display: none; flex-direction: column; gap: 12px; }
.mx-role { display: none; }
.matrix-phone:has(input[value="owner"]:checked) .mx-role[data-role="owner"],
.matrix-phone:has(input[value="operator"]:checked) .mx-role[data-role="operator"],
.matrix-phone:has(input[value="viewer"]:checked) .mx-role[data-role="viewer"] { display: block; }
.mx-role p { margin: 0 0 8px; }
.mx-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--color-divider); }
.mx-list li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 2px; border-bottom: 1px solid var(--color-divider); font-size: 14px; }
.mx-list li.is-no { color: var(--color-neutral-700); }
.mx-list .mx-yes, .mx-list .mx-no { width: 16px; flex: none; justify-content: center; margin-top: 2px; }
/* The one-time password: never truncated, a large copy button. */
.users-pw-wrap { display: flex; flex-direction: column; gap: 6px; }
.users-pw { flex-direction: row; align-items: center; gap: 12px; padding: 16px; }
.users-pw-text { flex: 1; min-width: 0; font: 500 20px/1.4 var(--font-mono); letter-spacing: .04em; word-break: break-all; }
.users-pw-copy { min-height: 52px; min-width: 140px; font-size: 16px; }
.users-pw-copy .icon { width: 17px; height: 17px; vertical-align: 0; }
.users-warn { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--st-warn-line); background: var(--st-warn-bg); font-size: 14px; }
.users-warn .icon { width: 16px; height: 16px; flex: none; margin-top: 2px; vertical-align: 0; color: var(--st-warn); }
@container (max-width: 599px) {
  .users-tablecard, .matrix-card { display: none; }
  .users-cards { display: flex; }
  .matrix-phone { display: flex; }
}
@media (max-width: 639px) {
  .users-pw { flex-direction: column; align-items: stretch; }
}

/* ---------- My account (design/11) ---------- */
.acct { container-type: inline-size; display: flex; flex-direction: column; gap: 24px; }
.acct .page-header { margin-bottom: 0; }
.acct .card { margin: 0; }
.acct-who { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; padding: 18px 20px; border: 1px solid var(--color-divider); }
.acct-avatar { width: 44px; height: 44px; display: grid; place-items: center; border: 1px solid var(--color-divider);
  font: 600 18px var(--font-heading); }
.acct-id { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.acct-name { font-size: 16px; font-weight: 500; }
.acct-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; align-items: start; }
.acct-pw { padding: 18px 20px; gap: 14px; }
.acct-pw h2, .acct-ss-head h2 { font-size: 20px; margin: 0; }
.acct-pw .alert { margin: 0; }
.acct-form { display: flex; flex-direction: column; gap: 14px; margin: 0; }
.acct-form .input { margin: 0; min-height: var(--tap-min); }
.acct-form .field > label { display: block; margin-bottom: 4px; }
.acct-submit { align-self: flex-start; min-height: var(--tap-min); }
.acct-sessions-sec { min-width: 0; }
#acct-sessions { display: flex; flex-direction: column; gap: 12px; }
.acct-ss-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 12px; }
.acct-ss { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--color-divider); }
.acct-s { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; padding: 12px 4px; border-bottom: 1px solid var(--color-divider); }
.acct-s-icon { display: inline-flex; color: var(--color-neutral-700); }
.acct-s-icon .icon { width: 20px; height: 20px; vertical-align: 0; }
.acct-s-text { flex: 1 1 200px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.acct-s-dev { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 14px; font-weight: 500; }
.acct-s-dev .tag { font-size: 11px; }
.acct-s-text .mono { font-size: 12px; }
.acct-s-end { color: var(--st-danger); }
@container (min-width: 860px) { .acct-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); } }
@container (max-width: 599px) {
  .acct-who, .acct-pw { padding: 14px; }
  .acct-submit, .acct-ss-head .btn { align-self: stretch; width: 100%; }
  .acct-ss-head .btn, .acct-s-end { min-height: var(--tap-min); }
  .acct-ss { border-top: 0; display: flex; flex-direction: column; gap: 12px; }
  .acct-s { border: 1px solid var(--color-divider); padding: 12px 12px 12px 14px; }
}
