/* EC Hub - CI theme (see ../CI/AGENTS.md). Components use tokens only.
   The user's color (app.js applyColor) overrides the tokens on <html>. */

:root {
  --bg: #f4f1ea;
  --panel: #ffffff;
  --panel-2: #f7f4ee;
  --border: #e3ddd1;
  --shadow: 0 1px 2px rgba(40, 28, 15, .06), 0 4px 16px rgba(40, 28, 15, .06);
  --text: #241d16;
  --muted: #7a6f62;
  --accent: #e0662f;
  --accent-ink: #ffffff;
  --tone: #2aa594;
  --tone-ink: #ffffff;
  --focus: #2f6fd6;
  --danger: #a33b5c;
  /* room the pinned page panel takes at each side; set by the dock-* classes on #view-hub */
  --inset-top: 0px;
  --inset-right: 0px;
  --inset-bottom: 0px;
  --inset-left: 0px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #16130f;
    --panel: #201c17;
    --panel-2: #29241e;
    --border: #3a332b;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
    --text: #f1ebe2;
    --muted: #a99d8f;
    --accent: #f07a42;
    --accent-ink: #ffffff;
    --tone: #36bfac;
    --tone-ink: #06231f;
    --focus: #7aa7ff;
    --danger: #f08aa9;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #16130f;
  --panel: #201c17;
  --panel-2: #29241e;
  --border: #3a332b;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
  --text: #f1ebe2;
  --muted: #a99d8f;
  --accent: #f07a42;
  --accent-ink: #ffffff;
  --tone: #36bfac;
  --tone-ink: #06231f;
  --focus: #7aa7ff;
  --danger: #f08aa9;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { overscroll-behavior: none; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

[hidden] { display: none !important; }
h1 { margin: 0; font-size: clamp(28px, 5vw, 38px); letter-spacing: -.03em; }
h2 { margin: 0; font-size: 19px; }
p { margin: 0; }
.muted { color: var(--muted); }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ---------- Components ---------- */
.panel {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.btn {
  display: inline-block;
  font: inherit;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  text-align: center;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn:disabled { opacity: .4; cursor: default; }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field.grow { flex: 1 1 200px; }
.label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
input[type="text"], input[type="search"], input[type="number"], select, textarea {
  font: inherit;
  padding: 8px 10px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  width: 100%;
}
textarea { resize: vertical; min-height: 60px; }
input[type="file"] { font: inherit; color: var(--text); max-width: 100%; }
.check { display: flex; align-items: center; gap: 6px; padding-bottom: 8px; white-space: nowrap; }
.msg { margin: 0; color: var(--muted); font-size: 14px; }
.msg.error { color: var(--danger); font-weight: 600; }
.row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin: 14px 0 8px; }
.actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }

/* ---------- Pages ---------- */
.center { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.card-login { padding: 28px; display: grid; gap: 14px; max-width: 420px; text-align: center; justify-items: center; }
.card-login .note { font-size: 12.5px; max-width: 300px; line-height: 1.45; margin-top: -4px; }
.msg.hint-small { font-size: 12.5px; line-height: 1.45; margin: -4px 0 4px; }

.userbar {
  position: fixed; top: calc(10px + var(--inset-top)); right: calc(16px + var(--inset-right)); z-index: 5;
  display: flex; align-items: center; gap: 10px; font-size: 13px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 999px;
  padding: 4px 6px 4px 14px; box-shadow: var(--shadow);
}

#hub {
  /* min size is set by app.js; the page scrolls if the layout is bigger than the window */
  position: relative; min-height: calc(100vh - var(--inset-top) - var(--inset-bottom)); outline-offset: -2px;
  touch-action: pan-x pan-y;
  user-select: none; -webkit-user-select: none;
}
/* Selection rectangle (drag on the empty background) and marked tiles */
.marquee { position: absolute; z-index: 8; pointer-events: none; border: 1px solid var(--focus); }
.marquee::before { content: ""; position: absolute; inset: 0; background: var(--focus); opacity: .18; }
.hidden-badge {
  position: fixed; left: calc(16px + var(--inset-left)); bottom: calc(16px + var(--inset-bottom)); z-index: 20; margin: 0; padding: 6px 12px;
  background: var(--panel); color: var(--muted); border: 1px solid var(--border); border-radius: 999px;
  font-size: 13px; pointer-events: none; box-shadow: 0 2px 8px rgba(0, 0, 0, .15);
}
.hint {
  position: fixed; inset: var(--inset-top) var(--inset-right) var(--inset-bottom) var(--inset-left);
  display: grid; place-items: center; pointer-events: none;
  color: var(--muted); font-size: 18px;
}
.toast {
  position: fixed; left: 50%; bottom: calc(20px + var(--inset-bottom)); transform: translateX(-50%); z-index: 30;
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  padding: 8px 14px; box-shadow: var(--shadow);
}

/* ---------- Page panel ---------- */
/* Fixed size: --side-w wide (left / right, full height) or --bar-h high (top / bottom, full width); the page
   list scrolls inside. Unpinned (.compact) it is smaller, lies over the canvas and only shows while .open. */
#view-hub { --side-w: 200px; --bar-h: 80px; display: flow-root; width: max-content; min-width: 100%; padding:
  var(--inset-top) var(--inset-right) var(--inset-bottom) var(--inset-left); }
#view-hub.pinned.dock-top { --inset-top: calc(var(--bar-h) + env(safe-area-inset-top, 0px)); }
#view-hub.pinned.dock-bottom { --inset-bottom: calc(var(--bar-h) + env(safe-area-inset-bottom, 0px)); }
#view-hub.pinned.dock-left { --inset-left: calc(var(--side-w) + env(safe-area-inset-left, 0px)); }
#view-hub.pinned.dock-right { --inset-right: calc(var(--side-w) + env(safe-area-inset-right, 0px)); }

.pagebar {
  position: fixed; z-index: 15; display: flex; gap: 8px; padding: 8px;
  background: var(--panel); border: 0 solid var(--border); box-shadow: var(--shadow);
}
.dock-left .pagebar, .dock-right .pagebar { top: 0; bottom: 0; flex-direction: column; width: var(--side-w); }
.dock-left .pagebar { left: 0; border-right-width: 1px; width: calc(var(--side-w) + env(safe-area-inset-left, 0px));
  padding-left: calc(8px + env(safe-area-inset-left, 0px)); }
.dock-right .pagebar { right: 0; border-left-width: 1px; width: calc(var(--side-w) + env(safe-area-inset-right, 0px));
  padding-right: calc(8px + env(safe-area-inset-right, 0px)); }
.dock-top .pagebar, .dock-bottom .pagebar { left: 0; right: 0; flex-direction: row; align-items: center; }
.dock-top .pagebar { top: 0; border-bottom-width: 1px; height: calc(var(--bar-h) + env(safe-area-inset-top, 0px));
  padding-top: calc(6px + env(safe-area-inset-top, 0px)); padding-bottom: 6px; }
.dock-bottom .pagebar { bottom: 0; border-top-width: 1px; height: calc(var(--bar-h) + env(safe-area-inset-bottom, 0px));
  padding-top: 6px; padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px)); }

.page-list { list-style: none; margin: 0; padding: 3px; display: flex; gap: 6px; flex: 1; min-width: 0; min-height: 0; }
.dock-left .page-list, .dock-right .page-list { flex-direction: column; overflow-y: auto; }
.dock-top .page-list, .dock-bottom .page-list { flex-direction: row; overflow-x: auto; align-self: stretch;
  align-items: center; scrollbar-width: thin; }
.page-list li { flex: 0 0 auto; }
/* pinned: the icon with the name below it */
.page-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; width: 100%; height: 74px;
  padding: 0 6px; font: inherit; font-size: 13px; font-weight: 600; line-height: 16px;
  border: 1px solid transparent; border-radius: 9px; background: var(--panel-2); color: var(--text); cursor: pointer;
}
.dock-top .page-btn, .dock-bottom .page-btn { width: 108px; height: 56px; gap: 2px; }
.page-btn:hover { border-color: var(--accent); }
/* the current page also gets a text-colored border: some accent colors are as light as the buttons */
.page-btn[aria-current="page"] { background: var(--accent); border: 2px solid var(--text); color: var(--accent-ink); }
.page-icon { flex: 0 0 auto; width: 40px; height: 40px; display: grid; place-items: center; pointer-events: none; }
.dock-top .page-icon, .dock-bottom .page-icon { width: 34px; height: 34px; }
.page-img { width: 100%; height: 100%; object-fit: contain; border-radius: 22%; -webkit-user-drag: none; }
.page-letters {
  width: 100%; height: 100%; display: grid; place-items: center; border-radius: 22%;
  background: var(--accent); color: var(--accent-ink); font-size: 12px; font-weight: 700; line-height: 1;
}
.dock-top .page-letters, .dock-bottom .page-letters { font-size: 10px; }
.page-btn[aria-current="page"] .page-letters { background: var(--panel); color: var(--text); }
.page-label { width: 100%; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.page-tools, .page-settings { display: flex; gap: 6px; flex: 0 0 auto; justify-content: center; }
.dock-left .page-settings, .dock-right .page-settings { order: -1; justify-content: flex-end;
  padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.dock-left .page-tools, .dock-right .page-tools { padding-top: 8px; border-top: 1px solid var(--border); }
.dock-top .page-settings, .dock-bottom .page-settings { padding-left: 8px; border-left: 1px solid var(--border); }
.tool {
  width: 34px; height: 34px; padding: 0; display: grid; place-items: center; cursor: pointer;
  border: 1px solid var(--border); border-radius: 9px; background: var(--panel-2); color: var(--text);
}
.tool:hover { border-color: var(--accent); }
.tool:disabled { opacity: .4; cursor: default; border-color: var(--border); }
#panel-pin svg { transform: rotate(45deg); transition: transform .15s; }
#panel-pin[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
#panel-pin[aria-pressed="true"] svg { transform: none; }

/* unpinned: smaller version (icons only), slides in from its side */
.pagebar.compact { gap: 4px; padding: 4px; visibility: hidden; opacity: 0;
  transition: transform .15s, opacity .15s, visibility 0s .15s; }
.pagebar.compact.open { visibility: visible; opacity: 1; transform: none; transition: transform .15s, opacity .15s; }
.compact .page-label { display: none; }
.pagebar.compact .page-btn { gap: 0; width: 38px; height: 38px; padding: 0; }
.pagebar.compact .page-icon { width: 34px; height: 34px; }
.pagebar.compact .page-letters { font-size: 10px; }
.compact .tool { width: 28px; height: 28px; }
.compact .tool svg { width: 16px; height: 16px; }
.compact .page-tools, .compact .page-settings { gap: 4px; }
.dock-left .pagebar.compact { width: calc(50px + env(safe-area-inset-left, 0px)); padding-left: calc(4px + env(safe-area-inset-left, 0px)); }
.dock-right .pagebar.compact { width: calc(50px + env(safe-area-inset-right, 0px)); padding-right: calc(4px + env(safe-area-inset-right, 0px)); }
.dock-top .pagebar.compact { height: calc(52px + env(safe-area-inset-top, 0px)); padding-top: calc(4px + env(safe-area-inset-top, 0px)); }
.dock-bottom .pagebar.compact { height: calc(52px + env(safe-area-inset-bottom, 0px)); padding-bottom: calc(4px + env(safe-area-inset-bottom, 0px)); }
.dock-left .compact .page-list, .dock-right .compact .page-list { align-items: center; padding: 3px 0; scrollbar-width: none; }
.dock-left .compact .page-tools, .dock-right .compact .page-tools,
.dock-left .compact .page-settings, .dock-right .compact .page-settings { flex-direction: column; align-items: center; padding-top: 4px; padding-bottom: 4px; }
.dock-top .compact .page-list, .dock-bottom .compact .page-list { padding: 2px 3px; scrollbar-width: none; }
.dock-left .pagebar.compact:not(.open) { transform: translateX(-100%); }
.dock-right .pagebar.compact:not(.open) { transform: translateX(100%); }
.dock-top .pagebar.compact:not(.open) { transform: translateY(-100%); }
.dock-bottom .pagebar.compact:not(.open) { transform: translateY(100%); }

/* The unpinned panel is retracted: a notch (tab with an arrow) in the middle of its side shows where it is.
   The notch and a thin invisible strip along the whole side bring the panel up. */
.panel-handle { position: fixed; z-index: 14; padding: 0; border: 0; background: transparent; cursor: pointer; }
.panel-handle::before, .panel-handle::after { content: ""; position: absolute; }
.panel-handle::after { box-sizing: border-box; background: var(--panel); border: 1px solid var(--muted); box-shadow: 0 0 10px rgba(0, 0, 0, .25); }
.panel-handle::before { z-index: 1; width: 7px; height: 7px; border: solid var(--text); border-width: 2px 2px 0 0; }
.panel-handle:hover::after, .panel-handle:focus-visible::after { background: var(--accent); border-color: var(--text); }
.panel-handle:hover::before, .panel-handle:focus-visible::before { border-color: var(--accent-ink); }
.dock-left .panel-handle, .dock-right .panel-handle { top: 0; bottom: 0; width: 8px; }
.dock-top .panel-handle, .dock-bottom .panel-handle { left: 0; right: 0; height: 8px; }
.dock-left .panel-handle { left: 0; }
.dock-right .panel-handle { right: 0; }
.dock-top .panel-handle { top: 0; }
.dock-bottom .panel-handle { bottom: 0; }
.dock-left .panel-handle::after, .dock-right .panel-handle::after { top: calc(50% - 40px); width: 18px; height: 80px; }
.dock-top .panel-handle::after, .dock-bottom .panel-handle::after { left: calc(50% - 40px); width: 80px; height: 18px; }
.dock-left .panel-handle::after { left: 0; border-left: 0; border-radius: 0 12px 12px 0; }
.dock-right .panel-handle::after { right: 0; border-right: 0; border-radius: 12px 0 0 12px; }
.dock-top .panel-handle::after { top: 0; border-top: 0; border-radius: 0 0 12px 12px; }
.dock-bottom .panel-handle::after { bottom: 0; border-bottom: 0; border-radius: 12px 12px 0 0; }
/* the arrow points away from the side, to where the panel comes out */
.dock-left .panel-handle::before, .dock-right .panel-handle::before { top: calc(50% - 3.5px); }
.dock-top .panel-handle::before, .dock-bottom .panel-handle::before { left: calc(50% - 3.5px); }
.dock-left .panel-handle::before { left: 3px; transform: rotate(45deg); }
.dock-right .panel-handle::before { right: 3px; transform: rotate(-135deg); }
.dock-top .panel-handle::before { top: 3px; transform: rotate(135deg); }
.dock-bottom .panel-handle::before { bottom: 3px; transform: rotate(-45deg); }

/* ---------- Tiles ---------- */
/* --z = tile size / 100 (set on #hub by app.js); sizes scale with it */
#hub { --z: 1; }
.tile {
  position: absolute; width: calc(112px * var(--z)); display: flex; flex-direction: column; align-items: center;
  gap: calc(6px * var(--z)); cursor: pointer; user-select: none; -webkit-user-select: none; touch-action: none;
  border-radius: 14px; outline-offset: 2px;
}
.tile-card {
  width: calc(96px * var(--z)); height: calc(96px * var(--z)); padding: calc(14px * var(--z));
  background: var(--panel); border: 1px solid var(--border); border-radius: calc(18px * var(--z));
  box-shadow: var(--shadow); display: grid; place-items: center;
}
.tile:hover .tile-card, .tile:focus-visible .tile-card { border-color: var(--accent); }
/* Icons always have round corners: 14/64 of the side, like the favicons of the hub apps (rx="14" of 64).
   app.js fits the img box to the image's aspect ratio, so the corners sit on the picture. */
.tile-card img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; -webkit-user-drag: none;
  border-radius: calc(68px * 14 / 64 * var(--z)); }
.tile-letters {
  width: 100%; height: 100%; display: grid; place-items: center; border-radius: calc(68px * 14 / 64 * var(--z));
  background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: calc(19px * var(--z));
  line-height: 1; text-shadow: 0 1px 2px rgba(0, 0, 0, .25); pointer-events: none;
}
.tile-name {
  max-width: calc(112px * var(--z)); text-align: center; font-size: max(11px, calc(13px * var(--z)));
  font-weight: 600; line-height: 1.25;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow-wrap: anywhere;
}
.tile.dragging { z-index: 10; cursor: grabbing; }
.tile.dragging .tile-card { box-shadow: 0 8px 28px rgba(0, 0, 0, .28); border-color: var(--accent); }
/* Marked tiles: --focus is not changed by the user's color and differs between light and dark mode,
   so the ring is visible with every color; the inner gap separates it from the background. */
.tile.selected .tile-card {
  border-color: var(--focus); background: color-mix(in srgb, var(--focus) 22%, var(--panel));
  box-shadow: 0 0 0 2px var(--panel), 0 0 0 5px var(--focus), var(--shadow);
}
.tile.selected .tile-name { background: var(--focus); color: var(--panel); border-radius: 6px; padding: 0 6px; }
.tile.cut { opacity: .45; }
.tile.cut .tile-card { border-style: dashed; }

/* ---------- Group boxes (behind the tiles) ---------- */
.group {
  position: absolute; z-index: 0; border: 1px solid; border-radius: calc(16px * var(--z)); cursor: grab;
  touch-action: none; user-select: none; -webkit-user-select: none; outline-offset: 2px;
}
.group.dragging { cursor: grabbing; z-index: 1; }
.tile { z-index: 2; }
.tile.dragging { z-index: 10; }
.group-caption {
  position: absolute; left: 0; bottom: calc(100% + 4px * var(--z)); max-width: 100%;   /* label sits on top of the box */
  padding: 1px 10px; border-radius: 8px; background: var(--panel); border: 1px solid var(--border); color: var(--text);
  font-size: max(11px, calc(13px * var(--z))); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.group.cap-in .group-caption { bottom: auto; top: calc(8px * var(--z)); left: calc(10px * var(--z)); max-width: calc(100% - 20px * var(--z)); }   /* box at the very top: no room above */
.group-handle {
  position: absolute; right: 0; bottom: 0; width: 22px; height: 22px; cursor: nwse-resize; touch-action: none;
  background: linear-gradient(135deg, transparent 50%, var(--muted) 50%, var(--muted) 58%, transparent 58%,
    transparent 70%, var(--muted) 70%, var(--muted) 78%, transparent 78%);
  border-radius: 0 0 14px 0;
}

/* ---------- Context menu ---------- */
.menu { position: fixed; z-index: 20; list-style: none; margin: 0; padding: 6px; min-width: 170px; }
.menu li { padding: 8px 12px; border-radius: 8px; cursor: pointer; font-weight: 600; }
.menu li:hover, .menu li:focus { background: var(--panel-2); outline: none; box-shadow: inset 0 0 0 1px var(--accent); }

/* ---------- Dialogs ---------- */
dialog.panel { padding: 22px; width: min(440px, calc(100vw - 32px)); margin: auto; }
dialog.panel.wide { width: min(720px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(0, 0, 0, .4); }
#tile-form { display: grid; gap: 14px; }
.icon-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.url-row { display: flex; gap: 8px; }
.icon-row input[type="color"] { width: 64px; }
/* three letters in a square: the preview in the dialogs, and shared tiles without an image */
.letters-preview, .shared-letters {
  flex: 0 0 auto; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 22%;
  background: var(--accent); color: var(--accent-ink); font-size: 14px; font-weight: 700; line-height: 1;
}
.shared-letters { width: 40px; height: 40px; font-size: 12px; }
.preview { width: 56px; height: 56px; object-fit: contain; border: 1px solid var(--border); border-radius: 10px; padding: 6px; background: var(--panel-2); }

.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px; margin-top: 12px; }
.swatch {
  height: 40px; border-radius: 9px; border: 2px solid transparent; font: inherit; font-size: 12px;
  font-weight: 700; cursor: pointer;
}
.swatch[aria-pressed="true"] { border-color: var(--text); box-shadow: 0 0 0 2px var(--panel) inset; }

.table-wrap { overflow-x: auto; margin-top: 10px; }
table.users { width: 100%; border-collapse: collapse; font-size: 14px; }
.users th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 6px 8px; }
.users td { padding: 6px 8px; border-top: 1px solid var(--border); vertical-align: middle; }

/* ---------- Background (gradient / image) ---------- */
.bg-fields { display: grid; gap: 14px; margin-top: 14px; }
.bg-colors { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
input[type="color"] { width: 100%; height: 40px; padding: 2px; border-radius: 9px; border: 1px solid var(--border); background: var(--panel-2); cursor: pointer; }
input[type="range"] { width: 100%; accent-color: var(--accent); }
/* with a gradient or image behind the tiles, captions get a small plate so they stay readable */
body.has-bg .tile-name { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 1px 8px; box-shadow: var(--shadow); }
body.has-bg .hint { color: var(--text); text-shadow: 0 0 6px var(--panel); }

/* ---------- Sharing ---------- */
.share-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.share-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 4px 4px 4px 10px;
  border: 1px solid var(--border); border-radius: 9px; background: var(--panel-2); }
.share-list .addr { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share-add { display: flex; gap: 8px; }
.search { margin: 14px 0 4px; }
.shared-list { display: grid; gap: 16px; margin-top: 12px; max-height: min(55vh, 460px); overflow-y: auto; }
.shared-group h3 { margin: 0 0 6px; font-size: 14px; }
.shared-group h3 .muted { font-weight: 400; margin-left: 6px; }
.shared-group ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.shared-item { display: flex; align-items: center; gap: 12px; padding: 6px 8px; border: 1px solid var(--border);
  border-radius: 10px; background: var(--panel-2); }
.shared-item img { width: 40px; height: 40px; object-fit: contain; flex: 0 0 auto; border-radius: 8px; background: var(--panel); padding: 4px; }
.shared-item .info { flex: 1; min-width: 0; }
.shared-item .tname { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shared-item .turl { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Overlay (internal app inside the hub, through the proxy) ---------- */
.overlay { position: fixed; inset: 0; z-index: 40; display: flex; flex-direction: column; background: var(--bg); }
.overlay-bar {
  flex: 0 0 auto; display: flex; align-items: center; gap: 12px; padding: 6px 12px;
  background: var(--panel); border-bottom: 1px solid var(--border); box-shadow: var(--shadow);
}
.overlay-title { flex: 1; min-width: 0; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.overlay iframe { flex: 1; width: 100%; border: 0; background: #fff; }
body.has-overlay { overflow: hidden; }
.small-fab { width: 40px; height: 40px; flex: 0 0 auto; text-decoration: none; }

/* ---------- Admin button ---------- */
/* Round buttons, bottom right: [shared with you] [user management (admins)] [smaller] [bigger] */
.fabs { position: fixed; right: calc(20px + var(--inset-right)); bottom: calc(20px + var(--inset-bottom)); z-index: 6; display: flex; gap: 10px; }
.fab {
  width: 48px; height: 48px; border-radius: 50%; padding: 0;
  border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; cursor: pointer; box-shadow: var(--shadow);
}
.fab:hover { filter: brightness(1.08); }
.fab:disabled { opacity: .4; cursor: default; filter: none; }

/* phones: the round "Pages" button, bottom left; the open panel may lie over it */
.fab-pages { position: fixed; z-index: 6; left: max(16px, env(safe-area-inset-left, 0px));
  bottom: max(16px, env(safe-area-inset-bottom, 0px)); }
.has-pages-fab .hidden-badge { bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }

@media (max-width: 600px) {
  dialog.panel { padding: 16px; max-height: calc(100dvh - 32px); overflow-y: auto; }
  .userbar { right: calc(8px + var(--inset-right)); top: calc(8px + var(--inset-top));
    max-width: calc(100vw - 16px - var(--inset-left) - var(--inset-right)); }
  #user-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40vw; }
  .fabs { right: calc(16px + var(--inset-right)); bottom: calc(16px + var(--inset-bottom)); gap: 8px; }
  #view-hub { --side-w: 132px; }
  .dock-top .pagebar:not(.compact) .page-btn, .dock-bottom .pagebar:not(.compact) .page-btn { width: 80px; }
  .overlay-bar { gap: 8px; padding: 6px 8px; }
  .actions .btn { flex: 1; }
  .row { align-items: stretch; }
  .menu { min-width: 150px; }
  .menu li { padding: 12px; }
}
@supports (padding: max(0px)) {
  .fabs { right: max(calc(16px + var(--inset-right)), env(safe-area-inset-right));
    bottom: max(calc(16px + var(--inset-bottom)), env(safe-area-inset-bottom)); }
  .overlay-bar { padding-top: max(6px, env(safe-area-inset-top)); }
}
