/* ============================================================
   Media AI Box — Components (Cinema Atelier)
   ============================================================ */

/* ===== Cards ===== */
.card {
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: var(--s-6);
  transition: box-shadow 0.2s var(--ease-out);
  box-shadow: var(--shadow-xs);
  border: 1px solid var(--border);
}

.card:hover {
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--s-4);
  gap: var(--s-3);
}

.card-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.card-subtitle {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 2px;
  font-weight: 400;
}

.card-interactive {
  cursor: pointer;
}

.card-interactive:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}

.card-interactive:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

/* ===== Form Inputs ===== */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: -0.005em;
}

.field-hint {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 2px;
  font-weight: 400;
}

.input,
.textarea,
.select {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 9px var(--s-3);
  color: var(--text);
  font-size: 14px;
  width: 100%;
  outline: none;
  transition: all 0.15s;
  font-family: inherit;
  letter-spacing: -0.005em;
}

.input::placeholder,
.textarea::placeholder {
  color: var(--text-muted);
}

.input:focus,
.textarea:focus,
.select:focus {
  border-color: var(--accent);
  box-shadow: var(--shadow-focus);
}

.textarea {
  resize: vertical;
  min-height: 90px;
  line-height: 1.5;
  padding: 10px var(--s-3);
}

.textarea-lg {
  min-height: 220px;
}

.select {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath fill='%236e6e73' d='M5 8l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 12px center;
  background-size: 14px;
  padding-inline-start: 36px;
  cursor: pointer;
}

/* Color picker */
.color-input {
  width: 40px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: var(--r-xs);
  cursor: pointer;
  background: transparent;
  padding: 2px;
}

/* Toggle switch */
.toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  gap: var(--s-3);
}

.toggle-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-switch {
  width: 42px;
  height: 24px;
  background: var(--surface-pressed);
  border-radius: 14px;
  position: relative;
  transition: background 0.2s;
}

.toggle-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  inset-inline-start: 2px;
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  transition: all 0.2s var(--ease-out);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.toggle-input:checked + .toggle-switch {
  background: var(--green);
}

.toggle-input:checked + .toggle-switch::after {
  transform: translateX(-18px);
}

[dir="rtl"] .toggle-input:checked + .toggle-switch::after {
  transform: translateX(-18px);
}

/* ===== Badges ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: -0.005em;
  background: var(--surface-2);
  color: var(--text-2);
  border: 1px solid var(--border);
}

.badge-primary {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: transparent;
}

.badge-success {
  background: rgba(52, 199, 89, 0.12);
  color: #137a30;
  border-color: transparent;
}

.badge-warning {
  background: rgba(255, 149, 0, 0.12);
  color: #b25c00;
  border-color: transparent;
}

.badge-info {
  background: rgba(90, 200, 250, 0.16);
  color: #006a8e;
  border-color: transparent;
}

.badge-muted {
  background: var(--surface-2);
  color: var(--text-3);
  border-color: var(--border);
}

/* ===== Tabs (segmented control) ===== */
.tabs {
  display: inline-flex;
  gap: 2px;
  background: var(--surface-pressed);
  border-radius: var(--r-sm);
  padding: 2px;
}

.tab {
  padding: 6px var(--s-4);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
}

.tab:hover {
  color: var(--text);
}

.tab.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-xs);
}

/* ===== Progress ===== */
.progress {
  width: 100%;
  height: 4px;
  background: var(--surface-pressed);
  border-radius: var(--r-pill);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: var(--r-pill);
  transition: width 0.3s var(--ease-out);
  position: relative;
}

.progress-bar.animated::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.5),
    transparent
  );
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  to {
    transform: translateX(200%);
  }
}

/* ===== Empty State ===== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--s-16) var(--s-6);
  text-align: center;
  gap: var(--s-3);
}

.empty-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin-bottom: var(--s-2);
  border: 1px solid var(--border);
}

.empty-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

.empty-desc {
  font-size: 13px;
  color: var(--text-3);
  max-width: 380px;
  line-height: 1.5;
}

/* ===== Avatar / Thumb ===== */
.thumb {
  background: var(--surface-2);
  border-radius: var(--r-md);
  position: relative;
  overflow: hidden;
  background-size: cover;
  background-position: center;
  box-shadow: var(--shadow-xs);
}

.thumb-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: var(--text-muted);
  height: 100%;
}

.thumb-aspect-video {
  aspect-ratio: 16/9;
}

.thumb-aspect-square {
  aspect-ratio: 1;
}

/* ===== Chip ===== */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.15s;
}

.chip:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.chip.active {
  background: var(--text);
  color: var(--surface);
  border-color: var(--text);
}

.chip-remove {
  color: var(--text-3);
  font-size: 13px;
  line-height: 1;
}

/* ===== Loading Skeleton ===== */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--surface-2) 0%,
    var(--surface-hover) 50%,
    var(--surface-2) 100%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.4s infinite;
  border-radius: var(--r-xs);
}

@keyframes skeleton-loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* ===== Divider ===== */
.divider {
  height: 1px;
  background: var(--divider);
  margin: var(--s-4) 0;
}

.divider-text {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  color: var(--text-3);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: var(--s-4) 0;
}

.divider-text::before,
.divider-text::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--divider);
}

/* ===== Tooltip ===== */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--surface);
  padding: 4px 10px;
  border-radius: var(--r-xs);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 50;
}

[data-tooltip]:hover::after {
  opacity: 1;
}

/* ===== Dropdown ===== */
.dropdown {
  position: relative;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  inset-inline-end: 0;
  background: var(--surface);
  border-radius: var(--r-md);
  padding: 4px;
  min-width: 200px;
  box-shadow: var(--shadow-lg);
  z-index: 40;
  display: none;
  border: 1px solid var(--border);
  animation: dropdownIn 0.15s var(--ease-out);
}

.dropdown.open .dropdown-menu {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

@keyframes dropdownIn {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.dropdown-item {
  padding: 8px 12px;
  border-radius: var(--r-xs);
  color: var(--text);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: var(--s-2);
  cursor: pointer;
  transition: background 0.1s;
}

.dropdown-item:hover {
  background: var(--surface-hover);
}

.dropdown-item.danger {
  color: var(--red);
}

.dropdown-item.danger:hover {
  background: rgba(255, 59, 48, 0.08);
}

/* ===== Stepper ===== */
.stepper {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  margin-bottom: var(--s-7);
}

.step {
  display: flex;
  align-items: center;
  gap: var(--s-2);
}

.step-circle {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--surface);
  border: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  flex-shrink: 0;
  transition: all 0.25s var(--ease-out);
}

.step.active .step-circle {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.step.completed .step-circle {
  background: var(--green);
  border-color: var(--green);
  color: white;
}

.step-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-3);
  letter-spacing: -0.005em;
}

.step.active .step-label {
  color: var(--text);
  font-weight: 600;
}

.step.completed .step-label {
  color: var(--text-2);
}

.step-line {
  flex: 1;
  height: 1.5px;
  background: var(--border);
  margin: 0 var(--s-2);
  border-radius: 1px;
  min-width: 24px;
}

.step-line.completed {
  background: var(--green);
}

/* Lazy route transition spinner */
.route-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 40vh;
  color: var(--text-3);
}

.route-loading-spinner {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2.5px solid rgba(0, 0, 0, 0.1);
  border-top-color: var(--accent);
  animation: routeSpin 0.75s linear infinite;
}

.route-loading-text {
  font-size: 14px;
  font-weight: 500;
}

@keyframes routeSpin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .route-loading-spinner {
    animation: none;
  }
}

/* Project workspace loading - page skeleton (header + shots layout) */
.workspace-root {
  position: relative;
}

/* While the project loads the skeleton IS the page, so it stays in normal
   flow and its height is its content's height - which, because every block
   inside wears the real class, is the height the real page will have. It used
   to be an absolutely-positioned box of `100vh - topbar - 48px`: 55px shorter
   than the page it stood for (header + margin + a `--shots-col-h` column), so
   the layout jumped on reveal AND the skeleton's own footer was clipped by the
   overflow:hidden below. */
.project-load-overlay {
  position: relative;
  z-index: 40;
  display: flex;
  flex-direction: column;
  /* On סגנון the root itself is a fixed-height flex column, and the real tab
     fills it as a flex child - so the skeleton has to be able to fill it too. */
  flex: 1 1 auto;
  min-height: 0;
  background: var(--bg);
  border-radius: var(--r-lg);
  animation: plOverlayIn 0.22s var(--ease-out);
  overflow: hidden;
  pointer-events: all;
}

/* Second act: the real page is mounted underneath and the skeleton is laid
   over it to fade out - only then does it leave the flow. */
.project-load-overlay--float {
  position: absolute;
  inset: 0;
}

.project-load-overlay--done {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

/* Thin top progress - page-native, not a centered spinner/bar pair */
.ws-sk-progress {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  z-index: 2;
  background: transparent;
  overflow: hidden;
  border-radius: var(--r-lg) var(--r-lg) 0 0;
}

.ws-sk-progress-fill {
  height: 100%;
  width: 12%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.45s var(--ease-out);
}

.ws-sk-progress.is-indeterminate .ws-sk-progress-fill,
.ws-sk-progress-fill.is-indeterminate {
  width: 28%;
  animation: wsSkIndeterminate 1.15s var(--ease-out) infinite;
}

/* One shimmer, three carriers:
   .ws-sk-bone  - a free-standing block, sized by its own rule below;
   .ws-sk-fill  - paint INSIDE a real element, which keeps its own size;
   .ws-sk-text  - a run of text inside real typography (width in em).
   The fill/text pair is why this skeleton cannot drift from the page: the
   geometry is the page's own, and only the paint is ours. Both are scoped to
   .project-load-overlay so they outrank the real element's own background and
   never leak past the overlay. */
.ws-sk-bone,
.project-load-overlay .ws-sk-fill,
.project-load-overlay .ws-sk-text::after {
  background-image: linear-gradient(
    90deg,
    color-mix(in srgb, var(--text) 5%, transparent) 0%,
    color-mix(in srgb, var(--text) 10%, transparent) 45%,
    color-mix(in srgb, var(--text) 5%, transparent) 100%
  );
  /* Tiled, not no-repeat: skeleton-loading sweeps the position out past the
     box, and a single non-repeating pass leaves the bone half unpainted. */
  background-size: 200% 100%;
  background-repeat: repeat;
  animation: skeleton-loading 1.4s ease-in-out infinite;
}

/* Radius belongs to the element being stood in for, so ws-sk-fill must never
   set one: it flattened the active shot's round number into a square. Only the
   free-standing bones, which have no real counterpart, get a radius here. */
.ws-sk-bone {
  border-radius: var(--r-xs);
}

/* A run of text: the span keeps the REAL line box (it holds an invisible
   glyph, so it measures like text in a flex row as well as an inline one) and
   the bar is painted over it. */
.project-load-overlay .ws-sk-text {
  display: inline-block;
  position: relative;
  color: transparent;
  overflow: hidden;
  white-space: nowrap;
  user-select: none;
  /* Baseline-aligned, an inline-block hangs its own descent below the parent's
     and grows every row by ~4px; middle keeps the line box at text height. */
  vertical-align: middle;
}

.project-load-overlay .ws-sk-text::after {
  content: "";
  position: absolute;
  inset-inline: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 0.72em;
  border-radius: 3px;
}

.ws-sk-header {
  position: relative;
  flex-shrink: 0;
  pointer-events: none;
  user-select: none;
}

.ws-sk-project-name {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.2;
}

.ws-sk-name-bone {
  width: min(220px, 55%);
  height: 22px;
}

/* The ⋮ trigger's width, without its (hover-only) ink. */
.ws-sk-menu-slot {
  display: inline-block;
  width: 26px;
  height: 26px;
  flex-shrink: 0;
}

/* Undo / redo, 28px each - they set the name row's height. */
.ws-sk-icon-btn {
  width: 28px;
  height: 28px;
  border-radius: var(--r-sm);
  opacity: 0.7;
}

.ws-sk-header .project-header-tabs .wtab,
.ws-sk-open-editor {
  pointer-events: none;
  cursor: default;
}

.ws-sk-open-editor {
  opacity: 0.9;
}

/* Every tab's body is at least as tall as a real workspace column, so the
   skeleton's total height matches the page on tabs whose real content is
   auto-height too (תכנון, סגנון) - not only on קטעים. Two classes on purpose:
   .planning-tab and .style-tab set min-height:0 from a later stylesheet, and a
   single-class rule here loses to them and collapses the body to ~400px. */
.project-load-overlay .ws-sk-layout {
  flex: 1;
  min-height: var(--shots-col-h, calc(100vh - var(--topbar-h) - 80px));
  pointer-events: none;
  user-select: none;
}

/* סגנון is the one tab that FITS the window instead of scrolling: the real
   page turns the root into a fixed-height flex column (.workspace-root:has(
   .style-tab)), and that rule catches the skeleton too - so here the body
   fills what is left instead of claiming a full column's height, which would
   overflow the fitted root and clip the panels. */
.project-load-overlay .ws-sk-layout.style-tab {
  min-height: 0;
}

/* Nothing in a skeleton scrolls: the lists are clipped, not scrollable. */
.project-load-overlay .rail-list,
.project-load-overlay .panel-list,
.project-load-overlay .workshop-shot-items,
.project-load-overlay .video-card-body {
  overflow: hidden;
}

/* ── קטעים: rail ─────────────────────────────────────────────────────────── */
.ws-sk-header-btn {
  width: 28px;
  height: 28px;
  border-radius: var(--r-sm);
  opacity: 0.75;
}

/* Archive + delete are invisible until hover, but their 20px stack is what
   makes a rail row 58px tall - reserved, not painted. */
.ws-sk-row-btn-slot {
  display: block;
  width: 20px;
  height: 20px;
}

/* ── קטעים: stage card ───────────────────────────────────────────────────── */
.ws-sk-status-picker {
  width: 104px;
  height: 28px;
  border-radius: var(--r-sm);
  flex-shrink: 0;
}

.ws-sk-textarea {
  width: 100%;
  /* Two rows of 13px text, as the real prompt box opens. */
  height: 44px;
  border-radius: var(--r-sm);
}

.ws-sk-chip-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.ws-sk-chip {
  width: 68px;
  height: 24px;
  border-radius: var(--r-pill);
  opacity: 0.8;
}

.ws-sk-control {
  height: 30px;
  flex: 0 1 92px;
  border-radius: var(--r-sm);
}

.ws-sk-generate-btn {
  width: 128px;
  height: 34px;
  border-radius: var(--r-sm);
  flex-shrink: 0;
}

/* ── קטעים: videos panel ─────────────────────────────────────────────────── */
/* Header actions keep the real .btn box; only the label is a bone. */
.ws-sk-btn {
  flex-shrink: 0;
  pointer-events: none;
}

.ws-sk-checkbox {
  width: 13px;
  height: 13px;
  border-radius: 3px;
  flex-shrink: 0;
  margin-top: 1px;
}

/* ── עריכה / סגנון / תכנון / קבצים ───────────────────────────────────────── */
.ws-sk-stage-top {
  height: 34px;
  border-radius: var(--r-sm);
  margin-bottom: var(--s-2);
}

.ws-sk-stage-strip {
  height: 56px;
  border-radius: var(--r-md);
  margin-top: var(--s-2);
}

/* The workshop's tool column is one full-height card in the real page. */
.project-load-overlay .ws-area-options {
  display: flex;
  flex-direction: column;
}

.project-load-overlay .ws-area-options .ws-sk-card {
  flex: 1;
}

.ws-sk-card {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  padding: var(--s-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
  min-height: 0;
  overflow: hidden;
}

.ws-sk-card-head {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  padding-bottom: var(--s-2);
  border-bottom: 1px solid var(--divider);
}

.ws-sk-block {
  height: 38px;
  border-radius: var(--r-sm);
}

.ws-sk-block--tall {
  height: 108px;
  border-radius: var(--r-md);
}

.ws-sk-block--short {
  width: 62%;
  height: 30px;
  opacity: 0.8;
}

.ws-sk-jump-nav {
  width: min(280px, 60%);
  height: 24px;
  border-radius: var(--r-pill);
}

.ws-sk-planning-footer {
  height: 52px;
  border-radius: var(--r-md);
  flex-shrink: 0;
}

/* תכנון opens as three panels (director, chapters, details). Clip the
   lists so the skeleton cannot grow a scrollbar the real page then drops. */
.project-load-overlay .pc-chapters,
.project-load-overlay .director-log {
  overflow: hidden;
}

.project-load-overlay .planning-story {
  display: flex;
  flex-direction: column;
  gap: 10px;
  justify-content: flex-start;
}

.project-load-overlay .planning-step {
  gap: 6px;
  font-size: 12px;
  padding-inline-end: 14px;
}

/* Stagger shimmer so the page feels alive */
.project-load-overlay .rail-item:nth-child(2n) .ws-sk-fill,
.project-load-overlay .rail-item:nth-child(2n) .ws-sk-text {
  animation-delay: 0.08s;
}
.project-load-overlay .rail-item:nth-child(3n) .ws-sk-fill,
.project-load-overlay .rail-item:nth-child(3n) .ws-sk-text {
  animation-delay: 0.16s;
}
.project-load-overlay .panel-video-item:nth-child(2) .ws-sk-fill {
  animation-delay: 0.12s;
}
.project-load-overlay .panel-video-item:nth-child(3) .ws-sk-fill {
  animation-delay: 0.24s;
}
.project-load-overlay .file-item:nth-child(2n) .ws-sk-fill {
  animation-delay: 0.1s;
}
.project-load-overlay .file-item:nth-child(3n) .ws-sk-fill {
  animation-delay: 0.2s;
}

@keyframes plOverlayIn {
  from {
    opacity: 0;
  }
}

@keyframes wsSkIndeterminate {
  0% {
    transform: translateX(-120%);
  }
  100% {
    transform: translateX(420%);
  }
}

@media (max-width: 1024px) {
  .ws-sk-panel {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .project-load-overlay {
    animation: none;
  }
  .ws-sk-bone,
  .project-load-overlay .ws-sk-fill,
  .project-load-overlay .ws-sk-text::after,
  .ws-sk-progress-fill.is-indeterminate,
  .ws-sk-progress.is-indeterminate .ws-sk-progress-fill {
    animation: none;
  }
  .ws-sk-progress-fill {
    transition: none;
  }
}

/* ===================== Cloud-save banner (js/sync-banner.js) =====================
   A failed state PUT used to be visible only inside Settings, so work could sit
   unsaved for a day while every other device showed a stale snapshot. This bar
   is deliberately hard to miss and stays until the save actually lands. */
.sync-banner {
  position: fixed;
  top: 0;
  inset-inline: 0;
  /* Above toasts (1300), below the login gate (10000). */
  z-index: 1350;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px calc(10px + env(safe-area-inset-top, 0px));
  font-size: 13.5px;
  line-height: 1.45;
  color: #fff;
  box-shadow: var(--shadow-md);
  animation: sync-banner-in 0.22s ease-out;
}

@keyframes sync-banner-in {
  from {
    transform: translateY(-100%);
  }
  to {
    transform: translateY(0);
  }
}

.sync-banner-error {
  background: var(--red, #d64545);
}

.sync-banner-pending {
  background: var(--orange, #e86d2f);
}

.sync-banner-icon {
  flex: none;
  display: inline-flex;
}

.sync-banner-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  flex: 1;
}

.sync-banner-text strong {
  font-weight: 700;
}

.sync-banner-text span {
  opacity: 0.92;
  font-size: 12.5px;
}

.sync-banner-btn {
  flex: none;
  padding: 6px 14px;
  border-radius: var(--r-sm, 8px);
  border: 1px solid rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.sync-banner-btn:hover {
  background: rgba(255, 255, 255, 0.26);
}

@media (prefers-reduced-motion: reduce) {
  .sync-banner {
    animation: none;
  }
}
