
/* Header bar: always visible, even collapsed — drag grip + collapse toggle on
   the left, Reset/Done on the right, so finishing an edit never requires
   re-expanding first. While the capsule floats (minimal topbar) the bar is the
   drag surface; the grip signals it and the whole bar shows a grab cursor. */
.layout-dock-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
}

.layout-dock-spacer { flex: 1 1 auto; min-width: 12px; }

.layout-dock-toggle svg { transition: transform 0.2s ease; }
.layout-dock.is-collapsed .layout-dock-toggle svg { transform: rotate(180deg); }

/* Drag grip — the "you can move this" affordance. Only shown/active where the
   capsule actually floats free; in the in-flow full-topbar layout it's hidden. */
.layout-dock-grip {
  display: none;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 30px;
  margin-right: -2px;
  border-radius: 8px;
  color: var(--dim-text);
  flex-shrink: 0;
}
.layout-dock-grip svg { width: 16px; height: 16px; fill: currentColor; }
body.topbar-minimal .layout-dock-grip { display: inline-flex; }
body.topbar-minimal .layout-dock-bar { cursor: grab; touch-action: none; }
body.topbar-minimal .layout-dock.is-dragging,
body.topbar-minimal .layout-dock.is-dragging .layout-dock-bar { cursor: grabbing; }
/* No position transition while dragging — the pointer drives it directly. */
.layout-dock.is-dragging { transition: none; }

.layout-dock-body {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.layout-dock.is-collapsed .layout-dock-body { display: none; }

.layout-dock-section {
  min-width: 0;
  flex: 1 1 220px;
  display: flex;
  align-items: flex-start;
  flex-direction: column;
  gap: 7px;
}

.layout-dock-title {
  color: var(--dim-text);
  font-size: 10.5px;
  font-weight: 900;
  letter-spacing: 0.55px;
  text-transform: uppercase;
}

.layout-chip-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  width: 100%;
}

.layout-chip {
  width: auto;
  gap: 6px;
  padding: 0 10px;
  border: 1px solid transparent;
  font-size: 11.5px;
  font-weight: 850;
  white-space: nowrap;
}

.layout-chip.active {
  color: var(--green);
  border-color: rgba(var(--accent-rgb),0.35);
  background: rgba(var(--accent-rgb),0.13);
}

.layout-chip.primary {
  color: var(--on-accent);
  background: var(--green);
}

.layout-chip.primary:hover { color: var(--on-accent); filter: brightness(1.08); }
.layout-chip.danger:hover { color: var(--red); }
.layout-chip-icon { width: 31px; padding: 0; }

.layout-empty-label {
  padding: 6px 2px;
  color: var(--dim-text);
  font-size: 11.5px;
  font-weight: 750;
}

body[data-panel] .qbtn-layout,
body[data-panel] .layout-dock,
body[data-panel] .layout-controls {
  display: none !important;
}

/* ── Hidden top bar + floating Layout button ─────────────────
   The user can hide the whole top bar (clock, quick actions,
   Layout/Settings/App) for an edge-to-edge widget surface. When hidden it
   STAYS hidden — even while editing — so the surface never flashes the bar
   back; the editor's controls live in the dock below instead. A glass
   "Layout" button stays pinned in the corner so the editor is always
   reachable, and the dock carries "Mostra barra superiore" to bring it back. */
body.topbar-hidden .topbar { display: none; }
/* Not editing → the pager fills the whole shell (no topbar/dock rows). */
body.topbar-hidden:not(.layout-editing) .shell { grid-template-rows: minmax(0, 1fr); }
/* Editing → only the dock row + pager (the empty topbar row is dropped).
   Excluded under the minimal chrome ("none" carries both classes now): there the
   dock is position:fixed and floats over the grid, so reserving a row for it
   would leave a blank strip at the top. TopbarMinimal.css owns that case. */
body.topbar-hidden.layout-editing:not(.topbar-minimal) .shell { grid-template-rows: auto minmax(0, 1fr); }

.layout-fab {
  position: fixed;
  right: 18px;
  bottom: 18px;
  /* Above the scrolling ticker (z-index 60) so the news never covers the button
     or eats its taps; still below modals/toasts. */
  z-index: 62;
  display: none;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 15px;
  border-radius: 999px;
  border: 1px solid rgba(var(--accent-rgb), 0.32);
  background: rgba(8, 12, 12, 0.82);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.3px;
  cursor: pointer;
  box-shadow: 0 8px 28px rgba(0,0,0,0.45), 0 0 20px rgba(var(--accent-rgb), 0.12);
  transition: transform 0.12s ease, background 0.18s ease, box-shadow 0.18s ease;
}
.layout-fab svg { width: 16px; height: 16px; fill: var(--accent); flex-shrink: 0; }
.layout-fab:hover { background: rgba(14, 20, 20, 0.92); box-shadow: 0 10px 32px rgba(0,0,0,0.5), 0 0 26px rgba(var(--accent-rgb), 0.18); }
.layout-fab:active { transform: scale(0.96); }

/* Last-resort escape hatch only. With the bar hidden the edge rails stay up and
   already carry Layout/Settings/App, so in normal use this button never shows —
   :not(.topbar-minimal) is what keeps it off screen. It reappears only if the
   minimal chrome failed to build (captureTopbarEls found no topbar to reparent),
   which would otherwise leave no way back into Settings at all. */
body.topbar-hidden:not(.layout-editing):not(.topbar-minimal) .layout-fab { display: inline-flex; }
/* Lift the button clear of a bottom ticker so it never sits on the moving news. */
body.xe-has-ticker.xe-ticker-bottom .layout-fab { bottom: calc(18px + var(--xe-ticker-h)); }
/* Never overlap an open full-screen panel (settings / app switcher). */
body[data-panel] .layout-fab { display: none !important; }
