/* ═══════════════════════════════════════════════════════════════
   CLOTO LAYOUT — Header, Columns, Panel, Drawer, Modal
   ═══════════════════════════════════════════════════════════════ */

/* ══════════════════════════════════════════════════════════════
   KANBAN HEADER
   ══════════════════════════════════════════════════════════════ */

/* Save dot */
.fbw-save-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: transparent;
  transition: background var(--duration-slow) var(--ease-default), box-shadow var(--duration-slow) var(--ease-default);
}
.fbw-save-dot.is-saving {
  background: var(--cloto-gold);
  box-shadow: var(--shadow-glow-gold);
  animation: cloto-save-pulse 0.8s ease-in-out infinite;
}
@keyframes cloto-save-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ── Save Status (legacy text — kept for settings/template panels) ── */
.fbw-save-status {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--cloto-fs-xs);
  color: var(--cloto-text-60);
  transition: color var(--duration-slow) var(--ease-default);
  min-width: 16px;
}
.fbw-save-status.is-ok { color: var(--cloto-success); }

/* Save dot flash (global status) */
.fbw-save-dot.is-flash {
  background: var(--cloto-success);
  box-shadow: 0 0 6px var(--cloto-success-a50);
  animation: cloto-dot-flash 1.5s var(--ease-default) forwards;
}
@keyframes cloto-dot-flash {
  0% { background: var(--cloto-success);
  box-shadow: 0 0 6px var(--cloto-success-a50); }
  70% { background: var(--cloto-success);
  box-shadow: 0 0 4px rgba(74, 222, 128, 0.3); }
  100% { background: transparent;
  box-shadow: none; }
}

/* ── App Menu Dropdown (hamburger ≡) ── */
.fbw-app-menu-dropdown {
  position: fixed;
  z-index: var(--cloto-z-dropdown);
  min-width: 220px;
  background: var(--cloto-surface);
  border: 1px solid var(--cloto-glass-border-hover);
  border-radius: var(--radius-lg);
  padding: var(--space-3);
  box-shadow: var(--shadow-lg);
}

.fbw-menu-section-label {
  padding: var(--space-4) var(--space-6) var(--space-2);
  font-size: var(--cloto-fs-2xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--cloto-text-60);
}

.fbw-menu-item {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  width: 100%;
  padding: var(--space-4) var(--space-6);
  font-size: var(--cloto-fs-sm);
  color: var(--cloto-text-70);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-spring);
  text-align: left;
}

.fbw-menu-item:hover {
  background: var(--cloto-teal-a6);
  color: var(--cloto-text-100);
}

.fbw-menu-item-icon {
  width: 18px;
  text-align: center;
  flex-shrink: 0;
  font-size: 14px;
}

.fbw-menu-danger {
  color: var(--cloto-danger);
}
.fbw-menu-danger:hover {
  background: var(--cloto-danger-a8);
  color: var(--cloto-danger);
}

.fbw-menu-sep {
  height: 1px;
  background: var(--cloto-glass-border);
  margin: var(--space-2) var(--space-4);
}

/* ── Menu toggle switch ── */
.fbw-menu-toggle {
  justify-content: flex-start;
}

.fbw-menu-toggle-label {
  flex: 1;
  min-width: 0;
}

.fbw-toggle-track {
  position: relative;
  width: 34px;
  height: 18px;
  background: var(--cloto-white-a8);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: var(--radius-full);
  flex-shrink: 0;
  transition: background var(--duration-normal) var(--ease-default), border-color var(--duration-normal) var(--ease-default);
}

.fbw-toggle-track.is-on {
  background: var(--cloto-gold-a25);
  border-color: var(--cloto-gold-a35);
}

.fbw-toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  background: var(--cloto-text-40);
  border-radius: 50%;
  transition: transform var(--duration-normal) var(--ease-default), background var(--duration-normal) var(--ease-default);
}

.fbw-toggle-track.is-on .fbw-toggle-thumb {
  transform: translateX(16px);
  background: var(--cloto-gold);
}

body.fd-light .fbw-toggle-track {
  background: var(--cloto-black-a6);
  border-color: var(--cloto-black-a10);
}

body.fd-light .fbw-toggle-track.is-on {
  background: var(--cloto-gold-a20);
  border-color: var(--cloto-gold-a30);
}

body.fd-light .fbw-toggle-thumb {
  background: #999;
}

body.fd-light .fbw-toggle-track.is-on .fbw-toggle-thumb {
  background: var(--cloto-gold);
}

/* ── Language Toggle ── */
.fbw-lang-toggle,
.fbw-menu-lang {
  display: flex;
  gap: 4px;
}
.fbw-lang-toggle { margin-right: 4px; }
.fbw-menu-lang { padding: 6px 12px 8px; }
.fbw-lang-btn {
  background: var(--cloto-surface-a55);
  border: 1px solid var(--cloto-teal-a8);
  color: var(--cloto-text-40);
  font: 500 var(--font-xs)/1 var(--cloto-font-ui);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-spring);
}
.fbw-lang-btn:hover {
  color: var(--cloto-teal);
  background: var(--cloto-teal-a12);
  border-color: var(--cloto-teal-a20);
}
.fbw-lang-btn.active {
  background: var(--cloto-teal-a15);
  color: var(--cloto-teal);
  border-color: var(--cloto-teal-a30);
}
body.fd-light .fbw-lang-btn {
  background: var(--cloto-white-a55);
  border-color: var(--cloto-teal-a10);
  color: #6a6a76;
}
body.fd-light .fbw-lang-btn:hover {
  color: var(--cloto-teal);
  background: var(--cloto-teal-a8);
  border-color: var(--cloto-teal-a25);
}
body.fd-light .fbw-lang-btn.active {
  background: var(--cloto-teal-a15);
  color: var(--cloto-teal);
  border-color: var(--cloto-teal-a30);
}

/* ── History Menu ── */
.fbw-history-menu {
  position: fixed;
  z-index: var(--cloto-z-dropdown);
  background: var(--cloto-surface);
  border: 1px solid var(--cloto-glass-border-hover);
  border-radius: var(--radius-lg);
  padding: var(--space-3);
  box-shadow: var(--shadow-lg);
  min-width: 220px;
  max-height: 300px;
  overflow-y: auto;
}

/* ── Theme Toggle ── */
.fd-theme-toggle {
  position: relative;
  cursor: pointer;
}

/* Dark mode (default): show sun icon, hide moon */
.fd-theme-toggle .fd-theme-icon--light { display: block; }
.fd-theme-toggle .fd-theme-icon--dark  { display: none; }

/* Light mode: show moon icon, hide sun */
body.fd-light .fd-theme-toggle .fd-theme-icon--light { display: none; }
body.fd-light .fd-theme-toggle .fd-theme-icon--dark  { display: block; }

/* ══════════════════════════════════════════════════════════════
   COLUMNS — Outline Board
   ══════════════════════════════════════════════════════════════ */

.fbw-columns {
  position: relative;
  display: flex;
  gap: var(--space-16);
  padding: var(--space-6);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1 1 auto;
  min-height: 0;
  align-items: flex-start;
}

/* ── Golden threads (SVG overlay) ── */
.fbw-threads-svg {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 1;
  overflow: visible;
}
.fbw-thread-path {
  fill: none;
  stroke: var(--cloto-gold);
  stroke-width: 1.5;
  opacity: 0.3;
}
.fbw-thread-ancestor {
  stroke: var(--cloto-text-40);
  stroke-width: 1;
  opacity: 0.6;
  stroke-dasharray: 6 4;
}

/* ── Card staggered entrance ── */
.fbw-card-enter {
  opacity: 0;
  transform: translateY(6px);
  animation: fbw-card-appear var(--duration-slow) var(--ease-spring) forwards;
}
@keyframes fbw-card-appear {
  to { opacity: 1;
  transform: translateY(0); }
}

/* ══════════════════════════════════════════════════════════════
   OUTLINE CONTAINER + DETAIL PANEL
   ══════════════════════════════════════════════════════════════ */

.fbw-outline-container {
  display: flex;
  position: relative;
  min-height: 0;
  overflow: clip;
  flex: 1 1 auto;
}

.fbw-outline-container .fbw-columns {
  flex: 1 1 auto;
  min-width: 0;
}

/* ── Detail Panel — Glassmorphism Drawer ── */
.fbw-detail-panel {
  flex: 0 0 var(--cloto-panel-width);
  width: var(--cloto-panel-width);
  max-width: 45vw;
  background: rgba(22, 24, 36, 0.72);
  border-left: 2px solid var(--cloto-teal-a18);
  box-shadow:
    -4px 0 24px rgba(0, 0, 0, 0.25),
    inset 2px 0 8px var(--cloto-teal-a4);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: opacity var(--duration-fast) var(--ease-default);
}

.fbw-detail-panel:not(.has-card) {
  background: rgba(16, 18, 28, 0.5);
  border-left-color: var(--cloto-teal-a6);
  box-shadow: none;
}

body.fd-light .fbw-detail-panel {
  background: rgba(255, 255, 255, 0.78);
  border-left: 2px solid var(--cloto-teal-a15);
  box-shadow:
    -6px 0 28px var(--cloto-black-a8),
    inset 2px 0 8px var(--cloto-teal-a3);
}

body.fd-light .fbw-detail-panel:not(.has-card) {
  background: rgba(245, 243, 238, 0.5);
  border-left-color: var(--cloto-surface-a6);
  box-shadow: none;
}

/* Info bubble (collapsed panel) */
.fbw-panel-info-bubble {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 5;
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--cloto-glass-border);
  border-radius: 50%;
  background: var(--cloto-surface);
  color: var(--cloto-text-40);
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: all var(--duration-normal) var(--ease-default);
}

.fbw-panel-info-bubble:hover {
  color: var(--cloto-text-70);
  border-color: var(--cloto-glass-border-hover);
  transform: scale(1.05);
}

.fbw-panel-collapsed .fbw-detail-panel { display: none; }
.fbw-panel-collapsed .fbw-panel-info-bubble { display: flex; }

/* ── Panel Close Button ── */
.fbw-dp-close {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--cloto-text-40);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-default), color var(--duration-fast) var(--ease-default);
}

.fbw-dp-close:hover {
  background: var(--cloto-teal-a6);
  color: var(--cloto-text-70);
}

/* ── Panel Inner ── */
.fbw-dp-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.fbw-dp-inner.is-promoted {
  border-left: 3px solid var(--cloto-gold);
  background: var(--cloto-gold-a4);
}

/* ── Panel Empty State ── */
.fbw-dp-empty {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: var(--space-16);
  text-align: center;
  color: var(--cloto-text-40);
}

.fbw-dp-empty .fbw-dp-close {
  position: absolute;
  top: 8px;
  right: 8px;
}

.fbw-dp-empty-icon {
  font-size: 48px;
  margin-bottom: var(--space-8);
  opacity: 0.3;
}

.fbw-dp-empty-text {
  font-size: var(--cloto-fs-md);
  line-height: 1.5;
}

/* ── Panel Header ── */
.fbw-dp-header {
  flex: 0 0 auto;
  padding: var(--space-7) var(--space-8);
  border-bottom: 1px solid var(--cloto-glass-border);
}

.fbw-dp-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-6);
}

.fbw-dp-title {
  margin: 0;
  font-size: var(--cloto-fs-xl);
  font-weight: 600;
  line-height: 1.3;
  color: var(--cloto-text-100);
  word-break: break-word;
}

.fbw-dp-header-actions {
  display: flex;
  gap: var(--space-3);
  flex-shrink: 0;
}

.fbw-dp-meta {
  margin-top: var(--space-3);
  font-size: var(--cloto-fs-xs);
  color: var(--cloto-text-40);
}

.fbw-dp-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-4);
}
.fbw-dp-badges:empty { display: none; }

/* ── Panel Content ── */
.fbw-dp-content {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: var(--space-8);
  min-height: 0;
}

.fbw-dp-summary {
  font-size: 14.5px;
  line-height: 1.8;
  color: var(--cloto-text-100);
  white-space: pre-wrap;
  word-break: break-word;
  letter-spacing: 0.01em;
}

body.fd-light .fbw-dp-summary {
  color: #2a2c38;
}

.fbw-dp-summary-para + .fbw-dp-summary-para { margin-top: var(--space-6); }

.fbw-dp-summary-empty {
  color: var(--cloto-text-25);
  font-style: italic;
}

/* ── Panel Chips ── */
.fbw-dp-chips {
  flex: 0 0 auto;
  padding: var(--space-5) var(--space-8);
  border-top: 1px solid var(--cloto-teal-a10);
  background: rgba(13, 15, 23, 0.35);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}
.fbw-dp-chips:empty { display: none; }

/* ── Panel Actions ── */
.fbw-dp-actions {
  flex: 0 0 auto;
  padding: var(--space-6) var(--space-8);
  border-top: 1px solid var(--cloto-teal-a10);
  background: var(--cloto-void-a40);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
}
.fbw-dp-actions:empty { display: none; }

.fbw-dp-actions .button {
  flex: 1 1 auto;
  min-width: 80px;
  justify-content: center;
}

/* Light — panel footer */
body.fd-light .fbw-dp-chips {
  background: rgba(236, 232, 223, 0.5);
  border-top-color: var(--cloto-surface-a8);
}

body.fd-light .fbw-dp-actions {
  background: rgba(236, 232, 223, 0.55);
  border-top-color: var(--cloto-surface-a8);
}

body.fd-light .fbw-dp-actions .button {
  color: #3a3c48;
  background: rgba(255, 255, 255, 0.6);
  border-color: var(--cloto-surface-a10);
}

body.fd-light .fbw-dp-actions .button:hover {
  color: var(--cloto-text-100);
  background: var(--cloto-white-a85);
  border-color: var(--cloto-teal-a25);
}

body.fd-light .fbw-dp-actions .fbw-btn-primary,
body.fd-light .fbw-dp-actions .button-primary {
  color: var(--cloto-teal);
  background: var(--cloto-teal-a8);
  border-color: var(--cloto-teal-a30);
}

body.fd-light .fbw-dp-actions .fbw-btn-primary:hover,
body.fd-light .fbw-dp-actions .button-primary:hover {
  color: #14706e;
  background: rgba(94, 198, 198, 0.14);
  border-color: var(--cloto-teal-a40);
}

/* ── Panel Edit Mode ── */
.fbw-dp-edit {
  display: flex;
  flex-direction: column;
  gap: var(--space-7);
}

.fbw-dp-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.fbw-dp-field-row {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.fbw-dp-field-half {
  flex: 1 1 auto;
  min-width: 0;
}

.fbw-dp-place-override {
  width: 100%;
  padding: var(--space-3) var(--space-5);
  margin-top: var(--space-3);
  font-size: var(--cloto-fs-base);
  border: 1px solid var(--cloto-teal-a12);
  border-radius: var(--radius-sm);
  background: var(--cloto-void-a60);
  color: var(--cloto-text-100);
  transition: border-color var(--duration-fast) var(--ease-default), box-shadow var(--duration-fast) var(--ease-default);
}

.fbw-dp-place-override:focus {
  border-color: var(--cloto-teal-a35);
  box-shadow: var(--shadow-focus-teal);
}

.fbw-dp-edit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--cloto-glass-border);
}

/* Scene meta in detail panel */
.fbw-dp-scene-meta {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  margin-top: var(--space-6);
}

.fbw-dp-luogo-select,
.fbw-dp-characters-list {
  margin-top: var(--space-2);
}

.fbw-dp-char-checkbox {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--cloto-fs-sm);
  color: var(--cloto-text-70);
}

/* ══════════════════════════════════════════════════════════════
   DRAWER
   ══════════════════════════════════════════════════════════════ */

.fbw-drawer {
  position: fixed;
  top: 0;
  bottom: 0;
  right: -480px;
  width: 460px;
  max-width: 90vw;
  z-index: var(--cloto-z-drawer);
  display: flex;
  flex-direction: column;
  background: var(--cloto-surface);
  border-left: 1px solid var(--cloto-glass-border);
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.4);
  transition: right var(--duration-slow) var(--ease-spring);
}

.fbw-drawer.is-open {
  right: 0;
}

.fbw-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-7) var(--space-10);
  border-bottom: 1px solid var(--cloto-glass-border);
  flex-shrink: 0;
}

.fbw-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-7) var(--space-10);
  border-bottom: 1px solid var(--cloto-glass-border);
  flex-shrink: 0;
}

.fbw-drawer-title {
  font-size: var(--cloto-fs-lg);
  font-weight: 600;
  color: var(--cloto-text-100);
}

.fbw-drawer-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--cloto-text-40);
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-spring);
}

.fbw-drawer-close:hover {
  color: var(--cloto-text-70);
  background: var(--cloto-teal-a6);
}

.fbw-drawer-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: var(--space-10);
}

.fbw-drawer-actions {
  display: flex;
  gap: var(--space-4);
  padding: var(--space-7) var(--space-10);
  border-top: 1px solid var(--cloto-glass-border);
  flex-shrink: 0;
}

.fbw-drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: calc(var(--cloto-z-drawer) - 1);
  background: var(--cloto-void-a60);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-slow) var(--ease-spring);
}

.fbw-drawer-backdrop.is-open,
.fbw-drawer-backdrop.is-visible {
  opacity: 1;
  pointer-events: auto;
}


/* ══════════════════════════════════════════════════════════════
   MODAL
   ══════════════════════════════════════════════════════════════ */

.fbw-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--cloto-z-modal);
  background: var(--cloto-void-a60);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-12);
  opacity: 0;
  transition: opacity 200ms ease;
}

.fbw-modal-backdrop.is-visible {
  opacity: 1;
}

.fbw-modal-dialog {
  background: var(--cloto-surface);
  border: 1px solid var(--cloto-glass-border-hover);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 480px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  transform: scale(0.95);
  transition: transform 200ms ease;
}

.fbw-modal-backdrop.is-visible .fbw-modal-dialog {
  transform: scale(1);
}

.fbw-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-8) var(--space-10);
  border-bottom: 1px solid var(--cloto-glass-border);
  flex-shrink: 0;
}

.fbw-modal-title {
  font-size: var(--cloto-fs-lg);
  font-weight: 600;
  color: var(--cloto-text-100);
}

.fbw-modal-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: var(--space-10);
  color: var(--cloto-text-70);
}

.fbw-modal-body p {
  margin: 0 0 var(--space-4);
  line-height: 1.5;
}

.fbw-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-4);
  padding: var(--space-7) var(--space-10);
  border-top: 1px solid var(--cloto-glass-border);
  flex-shrink: 0;
}

.fbw-modal-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-8);
  font-size: var(--cloto-fs-sm);
  font-weight: 500;
  border: 1px solid var(--cloto-glass-border);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--cloto-text-70);
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-spring);
}

.fbw-modal-btn:hover {
  border-color: var(--cloto-glass-border-hover);
  background: var(--cloto-teal-a4);
}

.fbw-modal-btn-secondary {
  color: var(--cloto-text-40);
}

.fbw-modal-btn-primary {
  color: var(--cloto-teal);
  background: var(--cloto-teal-a8);
  border-color: var(--cloto-teal-a25);
}
.fbw-modal-btn-primary:hover {
  background: var(--cloto-teal-a15);
  border-color: var(--cloto-teal-a40);
}

.fbw-modal-btn-danger {
  color: var(--cloto-danger);
  border-color: var(--cloto-danger-a25);
}
.fbw-modal-btn-danger:hover {
  background: var(--cloto-danger-a8);
}

.fbw-modal-input {
  width: 100%;
  padding: var(--space-4) var(--space-6);
  background: var(--cloto-input-bg);
  border: 1px solid var(--cloto-teal-a25);
  border-radius: var(--radius-md);
  color: var(--cloto-text-100);
  font-size: var(--cloto-fs-md);
}

.fbw-modal-input:focus {
  border-color: var(--cloto-teal-a35);
  box-shadow: var(--shadow-focus-teal);
  outline: none;
}

/* ══════════════════════════════════════════════════════════════
   LOADING OVERLAY
   ══════════════════════════════════════════════════════════════ */

.fbw-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--cloto-z-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(13, 15, 23, 0.8);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-slow) var(--ease-default);
}

.fbw-loading-overlay.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.fbw-loading-overlay__content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-8);
  text-align: center;
}

.fbw-loading-overlay__spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--cloto-teal-a15);
  border-top-color: var(--cloto-teal);
  border-radius: 50%;
  animation: cloto-spin 0.8s linear infinite;
}

.fbw-loading-overlay__message {
  font-size: var(--cloto-fs-md);
  color: var(--cloto-text-70);
}

/* ── Spinner ── */
.fbw-spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid var(--cloto-teal-a15);
  border-top-color: var(--cloto-teal);
  border-radius: 50%;
  animation: cloto-spin 0.8s linear infinite;
}

@keyframes cloto-spin {
  to { transform: rotate(360deg); }
}

/* ── Panel (generic) ── */
.fbw-panel {
  background: var(--cloto-surface);
  border: 1px solid var(--cloto-glass-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.fbw-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-6) var(--space-8);
  border-bottom: 1px solid var(--cloto-glass-border);
}

.fbw-panel-body {
  padding: var(--space-8);
}

/* ══════════════════════════════════════════════════════════════
   LIGHT THEME — Layout Overrides
   ══════════════════════════════════════════════════════════════ */

/* (header removed — floating anchors styled inline) */

body.fd-light .fbw-mode-tab {
  color: #6a6a76;
}
body.fd-light .fbw-mode-tab:hover {
  color: #3a3c48;
  background: var(--cloto-teal-a6);
}
body.fd-light .fbw-mode-tab.is-active {
  color: var(--cloto-teal);
  background: var(--cloto-teal-a8);
  border-color: var(--cloto-teal-a18);
}
body.fd-light .fbw-mode-tab[data-mode="cloto"] {
  color: var(--cloto-gold);
  border-color: var(--cloto-gold-a18);
}
body.fd-light .fbw-mode-tab[data-mode="cloto"]:hover {
  color: var(--cloto-gold);
  background: var(--cloto-gold-a8);
  border-color: rgba(201, 168, 76, 0.28);
}
body.fd-light .fbw-mode-tab[data-mode="cloto"].is-active {
  color: var(--cloto-gold);
  background: var(--cloto-gold-a10);
  border-color: var(--cloto-gold-a30);
}

body.fd-light .fbw-app-menu-dropdown {
  background: #ffffff;
  border-color: var(--cloto-surface-a8);
}
body.fd-light .fbw-menu-item {
  color: #2a2c38;
}
body.fd-light .fbw-menu-item:hover {
  background: var(--cloto-teal-a6);
}
body.fd-light .fbw-menu-section-label {
  color: #8a8a96;
}

body.fd-light .fbw-dp-header {
  border-bottom-color: var(--cloto-surface-a8);
}

body.fd-light .fbw-dp-title {
  color: var(--cloto-text-100);
}

body.fd-light .fbw-dp-meta {
  color: #6a6a76;
}

body.fd-light .fbw-drawer {
  background: var(--cloto-white-a80);
  border-color: var(--cloto-teal-a10);
  box-shadow: -8px 0 32px var(--cloto-black-a8);
}

body.fd-light .fbw-modal-dialog {
  background: var(--cloto-white-a85);
  border-color: var(--cloto-teal-a10);
}

body.fd-light .fbw-modal-body {
  color: #3a3c48;
}

body.fd-light .fbw-modal-input {
  background: var(--cloto-white-a80);
  border-color: rgba(26, 28, 40, 0.12);
  color: #1a1c28;
}

/* ══════════════════════════════════════════════════════════════
   SPLASH SCREEN — Project Selector (mirrors login design)
   ══════════════════════════════════════════════════════════════ */

.cloto-splash {
  position: relative;
  z-index: 1;
  flex: 1 0 auto;
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  padding: calc(80px + env(safe-area-inset-top, 0px)) var(--space-12) 0;
}

/* Splash topbar — logo + theme toggle (mirrors fc-topbar) */
.cloto-splash-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 12px 24px;
  background: none;
  border: none;
  pointer-events: none;
}
.cloto-splash-topbar > * {
  pointer-events: auto;
}
.cloto-splash-topbar .fd-theme-toggle {
  background: none;
  border: none;
  color: var(--cloto-text-40);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  transition: color 0.3s ease;
}
.cloto-splash-topbar .fd-theme-toggle:hover {
  color: var(--cloto-text-70);
}
body.fd-light .cloto-splash-topbar .fd-theme-toggle {
  color: rgba(17,17,17,0.4);
}
body.fd-light .cloto-splash-topbar .fd-theme-toggle:hover {
  color: rgba(17,17,17,0.7);
}
.cloto-splash-topbar .fd-theme-toggle svg { width: 16px; height: 16px; }
body.fd-light .cloto-splash-topbar .fd-theme-icon--light { display: none; }
body:not(.fd-light) .cloto-splash-topbar .fd-theme-icon--dark { display: none; }

/* Theme toggle — fixed top right */
.cloto-splash-top {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 2;
  display: flex;
  gap: var(--space-4);
  align-items: center;
}

/* Toolbar icon buttons — on-brand glassmorphism for splash context */
.cloto-splash-top .fbw-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--cloto-teal-a8);
  border-radius: var(--radius-sm);
  background: var(--cloto-surface-a55);
  color: var(--cloto-text-40);
  font-size: 14px;
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-spring);
}

.cloto-splash-top .fbw-icon-btn:hover {
  color: var(--cloto-teal);
  background: var(--cloto-teal-a12);
  border-color: var(--cloto-teal-a20);
}

.cloto-splash-top .fbw-icon-btn svg:not(.fd-theme-icon--light):not(.fd-theme-icon--dark) {
  display: block;
}

body.fd-light .cloto-splash-top .fbw-icon-btn {
  background: var(--cloto-white-a55);
  border-color: var(--cloto-teal-a10);
  color: #6a6a76;
}

body.fd-light .cloto-splash-top .fbw-icon-btn:hover {
  color: var(--cloto-teal);
  background: var(--cloto-teal-a8);
  border-color: var(--cloto-teal-a25);
}

/* Splash header logout button */
.cloto-splash-logout-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--cloto-text-25);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: color var(--duration-normal) var(--ease-spring);
}
.cloto-splash-logout-btn:hover {
  color: var(--cloto-teal);
}
.cloto-splash-logout-btn svg {
  width: 16px;
  height: 16px;
}
body.fd-light .cloto-splash-logout-btn {
  color: rgba(0,0,0,0.3);
}
body.fd-light .cloto-splash-logout-btn:hover {
  color: var(--cloto-teal);
}

/* ── Splash Header (mirrors .fc-header) ── */
.cloto-splash-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 3;
  height: 48px;
  display: flex;
  align-items: center;
  padding: 0 12px 0 8px;
  background: var(--cloto-surface);
  border-bottom: 1px solid var(--cloto-glass-border);
  gap: 6px;
}
.cloto-splash-header-title {
  flex: 1;
  font-family: var(--cloto-font-ui);
  font-size: 13px;
  color: var(--cloto-text-40);
  letter-spacing: 0.01em;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cloto-splash-btn-create {
  display: inline-flex;
  align-items: center;
  padding: 8px 20px;
  font-family: var(--cloto-font-ui);
  font-size: var(--cloto-fs-sm);
  font-weight: 600;
  color: #fff;
  background: var(--cloto-teal, #2A9D8F);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-spring);
}
.cloto-splash-btn-create:hover {
  background: #34b3a4;
  box-shadow: 0 2px 8px rgba(42, 157, 143, 0.3);
}

/* ── Splash hero (landing-style) inside splash root ── */
.cloto-splash-hero-landing {
  padding-top: 60px;
  padding-bottom: 32px;
}
.cloto-splash-header--below {
  position: static;
  height: auto;
  padding: 16px 12px 8px;
  background: transparent;
  border-bottom: 1px solid var(--cloto-glass-border);
}

/* Footer bar — sticky at bottom of scroll container */
.cloto-splash-footer-pill {
  position: sticky;
  bottom: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--cloto-surface);
  border-top: 1px solid var(--cloto-glass-border);
}
.cloto-splash-pill-sep {
  width: 1px;
  height: 14px;
  background: var(--cloto-text-15, rgba(255,255,255,0.15));
}
body.fd-light .cloto-splash-footer-pill {
  background: rgba(255,255,255,0.75);
  border-top-color: rgba(0,0,0,0.08);
}
body.fd-light .cloto-splash-pill-sep {
  background: rgba(0,0,0,0.1);
}

/* ── Compact project card list ── */
.cloto-splash-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-bottom: 20px;
  opacity: 0;
  animation: cloto-fadeIn 0.8s ease-out 0.15s forwards;
}
.cloto-splash-separator {
  height: 1px;
  background: var(--cloto-glass-border, rgba(255,255,255,0.06));
  margin: 0 20px;
}
/* ── Hero project card ── */
.cloto-splash-hero {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 1.25rem 1.5rem;
  border-radius: 12px;
  cursor: pointer;
  background: var(--cloto-surface-raised, rgba(255,255,255,0.07));
  border: 0.5px solid var(--cloto-text-15, rgba(255,255,255,0.12));
  margin-bottom: 1.5rem;
  transition: border-color var(--duration-normal) var(--ease-spring);
}
.cloto-splash-hero:hover { border-color: #5ec6c6; }
.cloto-hero-row1 {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.cloto-splash-hero .cloto-splash-card-title {
  font-family: var(--cloto-font-body);
  font-size: 18px;
  font-weight: 500;
  color: var(--cloto-text-100);
  line-height: 1.3;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cloto-hero-row1-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.cloto-hero-export {
  font-family: var(--cloto-font-body);
  font-size: 11px;
  font-weight: 500;
  color: #5ec6c6;
  background: transparent;
  border: 0.5px solid rgba(94,198,198,0.4);
  border-radius: 6px;
  padding: 4px 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--duration-fast) var(--ease-spring);
}
.cloto-hero-export:hover { background: #085041; }
body.fd-light .cloto-hero-export { color: #0F6E56; border-color: #0F6E56; }
body.fd-light .cloto-hero-export:hover { background: rgba(15,110,86,0.08); }
.cloto-hero-logline {
  font-family: var(--cloto-font-body);
  font-size: 13px;
  color: var(--cloto-text-40);
  line-height: 1.5;
  margin: 8px 0 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.cloto-hero-row3 {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.cloto-hero-status {
  font-family: var(--cloto-font-body);
  font-size: 13px;
  font-weight: 500;
  color: var(--cloto-text-70);
}
.cloto-hero-status--green { color: #1D9E75; }
.cloto-hero-status--amber { color: #BA7517; }
body.fd-dark .cloto-hero-status--green { color: #5ec6c6; }
body.fd-dark .cloto-hero-status--amber { color: #d4b65a; }
.cloto-hero-secondary {
  font-family: var(--cloto-font-body);
  font-size: 12px;
  color: var(--cloto-text-50);
}
body.fd-light .cloto-splash-hero {
  background: rgba(255,255,255,0.5);
  border-color: rgba(0,0,0,0.08);
}
body.fd-light .cloto-splash-hero:hover { border-color: #1D9E75; }

/* ── 2-column grid for compact cards ── */
.cloto-splash-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
@media (max-width: 700px) {
  .cloto-splash-grid { grid-template-columns: 1fr; }
}

/* ── Compact project cards ── */
.cloto-splash-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  background: var(--cloto-surface-raised, rgba(255,255,255,0.07));
  border: 0.5px solid var(--cloto-glass-border, rgba(255,255,255,0.08));
  transition: border-color var(--duration-normal) var(--ease-spring);
}
.cloto-splash-card:hover {
  border-color: var(--cloto-text-15, rgba(255,255,255,0.15));
}
/* Accent left border via inset box-shadow */
.cloto-splash-card--accent-green { box-shadow: inset 3px 0 0 #5ec6c6; }
.cloto-splash-card--accent-amber { box-shadow: inset 3px 0 0 #d4af5c; }
body.fd-light .cloto-splash-card--accent-green { box-shadow: inset 3px 0 0 #1D9E75; }
body.fd-light .cloto-splash-card--accent-amber { box-shadow: inset 3px 0 0 #BA7517; }

/* Row 1: title + menu button */
.cloto-splash-card-row1 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.cloto-splash-card-title {
  font-family: var(--cloto-font-body);
  font-size: 14px;
  font-weight: 500;
  color: var(--cloto-text-100);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
/* Row 2: logline */
.cloto-splash-card-logline {
  font-family: var(--cloto-font-body);
  font-size: 12px;
  color: var(--cloto-text-70);
  line-height: 1.3;
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Row 3: status + date */
.cloto-splash-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-top: 3px;
}
.cloto-splash-card-status {
  font-family: var(--cloto-font-body);
  font-size: 11px;
  font-weight: 500;
  color: var(--cloto-text-60);
  white-space: nowrap;
}
.cloto-splash-status--teal { color: #0F6E56; }
.cloto-splash-status--amber { color: #C5A44E; }
body.fd-dark .cloto-splash-status--teal { color: #5ec6c6; }
body.fd-dark .cloto-splash-status--amber { color: #d4b65a; }
.cloto-splash-card-date {
  font-family: var(--cloto-font-body);
  font-size: 11px;
  color: var(--cloto-text-50);
  white-space: nowrap;
}
.cloto-splash-card-cta {
  display: inline-block;
  font-family: var(--cloto-font-body);
  font-size: 11px;
  font-weight: 500;
  color: #0b0e15;
  background: #5ec6c6;
  padding: 2px 12px;
  border-radius: 100px;
  white-space: nowrap;
}

/* Draft cards — no scenes, no logline */
.cloto-splash-card--draft {
  border: 1px dashed var(--cloto-glass-border, rgba(255,255,255,0.08));
  background: transparent;
  box-shadow: none;
}
.cloto-splash-card--draft:hover {
  border-color: var(--cloto-text-15, rgba(255,255,255,0.15));
}
.cloto-splash-card-title--placeholder {
  font-weight: 400;
  color: var(--cloto-text-50);
}
body.fd-light .cloto-splash-card--draft {
  border-color: rgba(0,0,0,0.10);
}
body.fd-light .cloto-splash-card--draft:hover {
  border-color: rgba(0,0,0,0.18);
}

/* Show more / hidden cards */
.cloto-splash-card--hidden {
  display: none;
}
.cloto-splash-showmore {
  display: block;
  margin: 12px auto 0;
  padding: 8px 24px;
  font-family: var(--cloto-font-body);
  font-size: 13px;
  color: var(--cloto-text-40);
  background: transparent;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.cloto-splash-showmore:hover {
  color: var(--cloto-text-100);
  border-color: var(--cloto-text-25);
}

/* ── Menu button (⋯) ── */
.cloto-splash-menu-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--cloto-text-40);
  font-size: 18px;
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--duration-normal) var(--ease-spring), background var(--duration-normal) var(--ease-spring);
}
.cloto-splash-card:hover .cloto-splash-menu-btn,
.cloto-splash-card.is-open .cloto-splash-menu-btn,
.cloto-splash-hero:hover .cloto-splash-menu-btn,
.cloto-splash-hero.is-open .cloto-splash-menu-btn {
  opacity: 1;
}
.cloto-splash-menu-btn:hover {
  background: var(--cloto-teal-a12);
  color: var(--cloto-text-70);
}

/* ── Dropdown ── */
.cloto-splash-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  right: 12px;
  z-index: 10;
  min-width: 160px;
  background: var(--cloto-surface, #1c1e2e);
  border: 1px solid var(--cloto-glass-border-hover, rgba(255,255,255,0.12));
  border-radius: var(--radius-lg);
  padding: var(--space-2);
  box-shadow: var(--shadow-lg);
}
.cloto-splash-card.is-open .cloto-splash-dropdown,
.cloto-splash-hero.is-open .cloto-splash-dropdown,
.cloto-splash-menu-wrap.is-open .cloto-splash-dropdown {
  display: block;
}
.cloto-splash-menu-wrap {
  position: relative;
  display: inline-flex;
}
.cloto-splash-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font-family: var(--cloto-font-ui);
  font-size: var(--cloto-fs-xs);
  color: var(--cloto-text-70);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--duration-normal) var(--ease-spring);
}
.cloto-splash-dropdown-item:hover {
  background: var(--cloto-teal-a8);
  color: var(--cloto-text-100);
}
.cloto-splash-dropdown-item--gold {
  color: var(--cloto-gold);
}
.cloto-splash-dropdown-item--gold:hover {
  background: var(--cloto-gold-a10, rgba(212,175,92,0.1));
  color: var(--cloto-gold);
}
.cloto-splash-dropdown-item--danger {
  color: var(--cloto-danger);
}
.cloto-splash-dropdown-item--danger:hover {
  background: var(--cloto-danger-a8);
  color: var(--cloto-danger);
}
.cloto-splash-dropdown-divider {
  height: 1px;
  background: var(--cloto-glass-border, rgba(255,255,255,0.06));
  margin: 4px 8px;
}

/* Empty state */
.cloto-splash-empty {
  font-family: var(--cloto-font-body);
  font-size: var(--cloto-fs-md);
  font-weight: 400;
  text-align: center;
  color: var(--cloto-text-40);
  letter-spacing: 1px;
  line-height: 1.8;
  opacity: 0;
  animation: cloto-fadeIn 1s ease-out 0.7s forwards;
  /* Center in viewport */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 120px);
  gap: 24px;
}
.cloto-splash-empty p {
  margin: 0;
}
.cloto-splash-empty-cta {
  margin-top: 8px;
  font-size: 15px !important;
  padding: 14px 36px !important;
}

/* Splash animations */
@keyframes cloto-fadeIn {
  from { opacity: 0;
  transform: translateY(12px); }
  to   { opacity: 1;
  transform: translateY(0); }
}

/* ── Splash fading (behind create-project prompt) ── */
.cloto-splash--fading {
  transition: opacity 1.5s var(--ease-default) !important;
  opacity: 0 !important;
}

/* ── Splash instant (skip animations after first visit) ── */
.cloto-splash-instant .cloto-splash-list,
.cloto-splash-instant .cloto-splash-empty {
  animation: none;
  opacity: 1;
}

/* Light theme — splash */
body.fd-light .cloto-splash-card {
  background: rgba(255,255,255,0.5);
  border-color: rgba(0,0,0,0.06);
}
body.fd-light .cloto-splash-card:hover {
  border-color: rgba(0,0,0,0.12);
}
body.fd-light .cloto-splash-card-title {
  color: var(--cloto-text-100);
}
body.fd-light .cloto-splash-card-logline {
  color: var(--cloto-text-40);
}
/* Legacy project cards */
.cloto-splash-card--legacy { /* no opacity reduction */ }
.cloto-splash-card--legacy:hover {
  background: rgba(255,255,255,0.03);
  border-color: rgba(255,255,255,0.06);
}
.cloto-splash-legacy-badge {
  font-family: var(--cloto-font-mono);
  font-size: 9px;
  color: var(--cloto-text-25);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 8px;
  border: 1px solid var(--cloto-text-15);
  border-radius: 4px;
  margin-left: 8px;
  vertical-align: middle;
}
body.fd-light .cloto-splash-card--legacy:hover { background: rgba(255,255,255,0.45); border-color: rgba(0,0,0,0.06); }
body.fd-light .cloto-splash-legacy-badge { color: var(--cloto-text-25); border-color: rgba(0,0,0,0.1); }
body.fd-light .cloto-splash-stat {
  color: var(--cloto-text-25);
}
body.fd-light .cloto-splash-bar {
  background: rgba(0,0,0,0.06);
}
body.fd-light .cloto-splash-showmore {
  border-color: rgba(0,0,0,0.1);
}
body.fd-light .cloto-splash-showmore:hover {
  border-color: rgba(0,0,0,0.2);
}
body.fd-light .cloto-splash-menu-btn {
  color: var(--cloto-text-40);
}
body.fd-light .cloto-splash-menu-btn:hover {
  background: rgba(0,0,0,0.06);
  color: var(--cloto-text-70);
}
body.fd-light .cloto-splash-dropdown {
  background: #fff;
  border-color: rgba(0,0,0,0.1);
  box-shadow: 0 4px 24px rgba(0,0,0,0.12);
}
body.fd-light .cloto-splash-dropdown-item {
  color: var(--cloto-text-70);
}
body.fd-light .cloto-splash-dropdown-item:hover {
  background: rgba(0,0,0,0.04);
}
body.fd-light .cloto-splash-separator {
  background: rgba(0,0,0,0.06);
}
body.fd-light .cloto-splash-btn-create {
  color: #fff;
  background: var(--cloto-teal, #2A9D8F);
  border-color: transparent;
}

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════════ */

/* ── Tablet (iPad portrait & landscape) ── */
@media (max-width: 1024px) {
  .fbw-columns {
    padding: var(--space-6) var(--space-5) var(--space-5);
  }

  /* Detail panel overlays as drawer instead of eating flex space */
  .fbw-outline-container .fbw-detail-panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    flex: none;
    width: var(--cloto-panel-width);
    max-width: 80vw;
    background: rgba(22, 24, 36, 0.94);
    box-shadow:
      -8px 0 32px rgba(0, 0, 0, 0.4),
      inset 2px 0 8px var(--cloto-teal-a4);
  }

  body.fd-light .fbw-outline-container .fbw-detail-panel {
    background: rgba(255, 255, 255, 0.96);
    box-shadow:
      -8px 0 32px var(--cloto-black-a10),
      inset 2px 0 8px var(--cloto-teal-a3);
  }

  .fbw-outline-container .fbw-detail-panel:not(.has-card) {
    background: rgba(16, 18, 28, 0.88);
  }

  body.fd-light .fbw-outline-container .fbw-detail-panel:not(.has-card) {
    background: rgba(245, 243, 238, 0.92);
  }

  /* Splash — gentle adaptation for tablet width */
  .cloto-splash {
    padding: var(--space-16) var(--space-12) 0;
  }
  .cloto-splash-empty {
    padding: var(--space-12) 0;
  }
}

/* ── iPad 13" landscape & similar (height ≤ 1050px) — gentle compaction ── */
@media (max-height: 1050px) {
  .cloto-splash {
    padding: calc(72px + env(safe-area-inset-top, 0px)) var(--space-12) 0;
  }
  .cloto-splash-card {
    padding: 12px 16px;
  }
  .cloto-splash-empty {
    padding: var(--space-8) 0;
  }
}

/* ── Short landscape (≤ 768px height) — aggressive compaction ── */
@media (max-height: 768px) {
  .cloto-splash {
    padding: calc(64px + env(safe-area-inset-top, 0px)) var(--space-10) 0;
  }
  .cloto-splash-card {
    padding: 10px 14px;
  }
  .cloto-splash-empty {
    padding: var(--space-5) 0;
  }
}

/* ── Small tablet / iPad Mini portrait ── */
@media (max-width: 768px) {
  .fbw-outline-container .fbw-detail-panel {
    width: 320px;
  }
}

/* ── Phone ── */
@media (max-width: 480px) {
  .cloto-splash {
    padding: calc(64px + env(safe-area-inset-top, 0px)) var(--space-4) 0;
  }
  .cloto-splash-header {
    padding: 0 12px;
    gap: 8px;
  }
  .cloto-splash-header-title {
    display: none;
  }
  .cloto-splash-card-logline {
    display: none;
  }
  .cloto-splash-card {
    padding: 10px 12px;
  }
  .cloto-splash-menu-btn {
    opacity: 1;
  }
}

/* ── Touch devices — always show card actions, larger tap targets ── */
@media (hover: none) and (pointer: coarse) {
  .fbw-columns {
    touch-action: pan-x pan-y;
  }

  .cloto-splash-menu-btn {
    opacity: 1;
  }

  /* Revert absolute panel to flex on touch — absolute blocks scroll propagation */
  .fbw-outline-container .fbw-detail-panel {
    position: static;
    z-index: auto;
    flex: 0 0 320px;
    width: 320px;
    max-width: 45vw;
  }

  .fbw-card-editbtn,
  .fbw-card-firstbtn,
  .fbw-card-dupebtn,
  .fbw-card-exportbtn,
  .fbw-card-aigenbtn,
  .fbw-card-aifbbtn {
    width: 32px;
    height: 32px;
    font-size: var(--cloto-fs-reading);
  }

  .fbw-card-footer-btn,
  .fbw-card-conclude-btn {
    min-height: 36px;
    padding: var(--space-3) var(--space-5);
  }

  .fbw-mode-tab {
    padding: var(--space-4) var(--space-7);
  }

  .fbw-icon-btn {
    width: 36px;
    height: 36px;
  }

  .fbw-dp-close {
    width: 36px;
    height: 36px;
    font-size: 20px;
  }

  .fbw-panel-info-bubble {
    width: 44px;
    height: 44px;
  }
}


/* ══════════════════════════════════════════════════════════════
   ACCESSIBILITY — Focus styles & screen-reader-only
   ══════════════════════════════════════════════════════════════ */

/* Screen-reader-only: visually hidden but accessible */
.fbw-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Focus ring on kanban cards */
.fbw-card:focus {
  outline: 2px solid var(--cloto-teal);
  outline-offset: -2px;
  box-shadow: var(--shadow-focus-teal);
}
.fbw-card:focus:not(:focus-visible) {
  outline: none;
  box-shadow: none;
}
.fbw-card:focus-visible {
  outline: 2px solid var(--cloto-teal);
  outline-offset: -2px;
  box-shadow: var(--shadow-focus-teal);
}

