/*
 * v6-shell.css — JYB unified SPA shell visual layer (wave-2-rev2).
 *
 * Loaded by app-shell.html AFTER tokens.css / components.css / tri-web-
 * layout.css / tri-web-surface.css. Adds shell-specific tokens and
 * .jyb-shell__* selectors. Does NOT redeclare existing tokens or
 * override per-page polish layers.
 *
 * Tri-web breakpoints (matches tri-web-layout.css):
 *   <=768  mobile  : sidebar off-canvas; bottom-nav fixed; main is single-col
 *   769-1024 tablet: collapsible sidebar (off-canvas), no bottom-nav
 *   >=1025 desktop : fixed sidebar 248px, no bottom-nav
 *
 * Touch target floor (mobile/tablet): 44px (WCAG 2.5.5 / iOS HIG).
 *
 * Wave-2-rev2 expansion (lines 427+):
 *   - token aliases: color / type / shadow / density (reuses --jyb-* base)
 *   - 9 standardized components: btn / card / alert / empty / loading /
 *     toast / table / form-field / modal
 *   - per-route layout hooks: cw / dy / ref / nb / up / settings
 *   - prefers-reduced-motion overrides
 */

/* ── v6 shell tokens ──────────────────────────────────────────────── */
:root {
  --shell-sidebar-w:           248px;
  --shell-sidebar-w-collapsed: 64px;
  --shell-header-h:            56px;
  --shell-bottom-nav-h:        60px;
  --shell-content-max-w:       1280px;
  --shell-z-sidebar:           40;
  --shell-z-sidebar-scrim:     38;
  --shell-z-header:            50;
  --shell-z-bottom-nav:        45;
  --shell-z-route-frame:       1;
  --shell-divider:             #e5e7eb;
  --shell-nav-active-bg:       rgba(201, 162, 94, 0.14);
  --shell-nav-active-fg:       #7a5a28;
  --shell-nav-fg:              #475569;
  --shell-nav-fg-hover:        #1e293b;
  --shell-touch-target:        44px;
}

/* ── outermost container ──────────────────────────────────────────── */
html, body { margin: 0; padding: 0; height: 100%; }
body.jyb-shell-body {
  background: #f6f7fb;
  color: #1e293b;
  font-family: 'Inter', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.jyb-shell {
  display: grid;
  grid-template-columns: var(--shell-sidebar-w) 1fr;
  min-height: 100vh;
  min-height: 100dvh;
}

/* ── header (top utility bar) ─────────────────────────────────────── */
.jyb-shell__header {
  position: sticky;
  top: 0;
  z-index: var(--shell-z-header);
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--shell-header-h);
  padding: 0 16px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--shell-divider);
}
.jyb-shell__header__brand {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.jyb-shell__header__brand img,
.jyb-shell__header__brand .jyb-mark {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #c9a25e, #7a5a28);
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 11px; letter-spacing: 0.05em;
}
.jyb-shell__header__brand strong {
  font-size: 14px;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.jyb-shell__header__route-title {
  flex: 1;
  min-width: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--shell-nav-active-fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.jyb-shell__header__utility {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* hamburger toggle for tablet */
.jyb-shell__header__menu {
  display: none;
  width: 40px; height: 40px;
  border: 0; background: transparent;
  cursor: pointer;
  border-radius: 8px;
  color: #475569;
  font-size: 18px;
  line-height: 1;
  align-items: center; justify-content: center;
}
.jyb-shell__header__menu:hover { background: rgba(15,23,42,0.06); }

/* ── sidebar ──────────────────────────────────────────────────────── */
.jyb-shell__sidebar {
  position: sticky;
  top: 0;
  z-index: var(--shell-z-sidebar);
  height: 100vh;
  height: 100dvh;
  background: #ffffff;
  border-right: 1px solid var(--shell-divider);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.jyb-shell__sidebar__head {
  display: flex;
  align-items: center;
  gap: 10px;
  height: var(--shell-header-h);
  padding: 0 16px;
  border-bottom: 1px solid var(--shell-divider);
}
.jyb-shell__sidebar__head .jyb-mark {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #c9a25e, #7a5a28);
  color: #fff; font-weight: 700; font-size: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.jyb-shell__sidebar__head__brand {
  font-size: 13px; font-weight: 700; color: #1e293b;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.jyb-shell__sidebar__nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 8px;
}
.jyb-shell__sidebar__foot {
  border-top: 1px solid var(--shell-divider);
  padding: 12px;
  font-size: 0.78rem;
  color: #94a3b8;
}

/* ── nav items ────────────────────────────────────────────────────── */
.jyb-shell__nav-group {
  margin-bottom: 8px;
}
.jyb-shell__nav-group__label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #94a3b8;
  padding: 8px 10px 6px;
}
.jyb-shell__nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 0.9rem;
  color: var(--shell-nav-fg);
  text-decoration: none;
  cursor: pointer;
  transition: background-color 120ms ease, color 120ms ease;
}
.jyb-shell__nav-item:hover {
  background: rgba(15, 23, 42, 0.04);
  color: var(--shell-nav-fg-hover);
}
.jyb-shell__nav-item[aria-current="page"],
.jyb-shell__nav-item.is-active {
  background: var(--shell-nav-active-bg);
  color: var(--shell-nav-active-fg);
  font-weight: 600;
}
.jyb-shell__nav-item__icon {
  width: 20px; flex-shrink: 0; text-align: center;
}
.jyb-shell__nav-item__label {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── main content frame ───────────────────────────────────────────── */
.jyb-shell__main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
  min-height: 100dvh;
}
.jyb-shell__route-frame {
  flex: 1;
  min-width: 0;
  padding: 24px clamp(16px, 3vw, 32px);
  z-index: var(--shell-z-route-frame);
}
.jyb-shell__route-frame > .jyb-route-inner {
  max-width: var(--shell-content-max-w);
  margin: 0 auto;
}

/* ── provider / worker status pill ────────────────────────────────── */
.jyb-shell__status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border-radius: 9999px;
  font-size: 0.74rem;
  font-weight: 600;
  background: #f6f7fb;
  border: 1px solid var(--shell-divider);
  color: #475569;
  white-space: nowrap;
}
.jyb-shell__status-pill .jyb-shell__dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #94a3b8;
  flex-shrink: 0;
}
.jyb-shell__status-pill.is-ok .jyb-shell__dot { background: #16a34a; }
.jyb-shell__status-pill.is-warn .jyb-shell__dot { background: #d97706; }
.jyb-shell__status-pill.is-err .jyb-shell__dot { background: #dc2626; }
.jyb-shell__status-pill.is-ok { color: #14532d; background: #f0fdf4; border-color: #bbf7d0; }
.jyb-shell__status-pill.is-warn { color: #78350f; background: #fffbeb; border-color: #fde68a; }
.jyb-shell__status-pill.is-err { color: #7f1d1d; background: #fef2f2; border-color: #fecaca; }

/* ── tile (welcome dashboard) ─────────────────────────────────────── */
.jyb-tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.jyb-tile {
  background: #fff;
  border: 1px solid var(--shell-divider);
  border-radius: 10px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.jyb-tile__label {
  font-size: 0.78rem;
  color: #64748b;
  letter-spacing: 0.02em;
}
.jyb-tile__value {
  font-size: 1.4rem;
  font-weight: 700;
  color: #1e293b;
}
.jyb-tile__hint {
  font-size: 0.75rem;
  color: #94a3b8;
}
.jyb-tile.is-ok    .jyb-tile__value { color: #16a34a; }
.jyb-tile.is-warn  .jyb-tile__value { color: #d97706; }
.jyb-tile.is-err   .jyb-tile__value { color: #dc2626; }

/* ── badge variants ───────────────────────────────────────────────── */
.jyb-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.74rem;
  font-weight: 600;
  border: 1px solid var(--shell-divider);
  background: #f6f7fb;
  color: #475569;
}
.jyb-badge.is-ok   { background: #f0fdf4; color: #14532d; border-color: #bbf7d0; }
.jyb-badge.is-warn { background: #fffbeb; color: #78350f; border-color: #fde68a; }
.jyb-badge.is-err  { background: #fef2f2; color: #7f1d1d; border-color: #fecaca; }
.jyb-badge.is-info { background: #eff6ff; color: #1e3a8a; border-color: #bfdbfe; }

/* ── bottom nav (mobile only) ─────────────────────────────────────── */
.jyb-shell__bottom-nav {
  display: none; /* mobile media query enables */
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: var(--shell-z-bottom-nav);
  height: calc(var(--shell-bottom-nav-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: saturate(140%) blur(8px);
  border-top: 1px solid var(--shell-divider);
  grid-template-columns: repeat(4, 1fr);
}
.jyb-shell__bottom-nav__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  height: var(--shell-bottom-nav-h);
  font-size: 0.7rem;
  color: var(--shell-nav-fg);
  text-decoration: none;
  background: transparent;
  border: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.jyb-shell__bottom-nav__item__icon { font-size: 18px; line-height: 1; }
.jyb-shell__bottom-nav__item.is-active,
.jyb-shell__bottom-nav__item[aria-current="page"] {
  color: var(--shell-nav-active-fg);
}

/* ── tablet: collapsible sidebar (off-canvas) ─────────────────────── */
@media (min-width: 769px) and (max-width: 1024px) {
  .jyb-shell {
    grid-template-columns: 1fr;
  }
  .jyb-shell__sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--shell-sidebar-w);
    transform: translateX(-100%);
    transition: transform 200ms ease-out;
    box-shadow: 22px 0 42px -32px rgba(15,23,42,0.65);
  }
  body.jyb-shell-sidebar-open .jyb-shell__sidebar {
    transform: translateX(0);
  }
  body.jyb-shell-sidebar-open::before {
    content: '';
    position: fixed; inset: 0;
    z-index: var(--shell-z-sidebar-scrim);
    background: rgba(15,23,42,0.32);
  }
  .jyb-shell__header__menu {
    display: inline-flex;
  }
}

/* ── mobile: hide sidebar, show bottom nav ────────────────────────── */
@media (max-width: 768px) {
  .jyb-shell {
    grid-template-columns: 1fr;
  }
  .jyb-shell__sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: min(86vw, 320px);
    transform: translateX(-100%);
    transition: transform 200ms ease-out;
    box-shadow: 22px 0 42px -32px rgba(15,23,42,0.65);
  }
  body.jyb-shell-sidebar-open .jyb-shell__sidebar {
    transform: translateX(0);
  }
  body.jyb-shell-sidebar-open::before {
    content: '';
    position: fixed; inset: 0;
    z-index: var(--shell-z-sidebar-scrim);
    background: rgba(15,23,42,0.32);
  }
  .jyb-shell__header__menu {
    display: inline-flex;
  }
  .jyb-shell__bottom-nav {
    display: grid;
  }
  .jyb-shell__main {
    padding-bottom: calc(var(--shell-bottom-nav-h) + env(safe-area-inset-bottom, 0px));
  }
  .jyb-shell__route-frame {
    padding: 16px 14px;
  }
  /* Touch-target floor on phones */
  .jyb-shell__nav-item,
  .jyb-shell__bottom-nav__item,
  .jyb-shell__header__menu {
    min-height: var(--shell-touch-target);
  }
  .jyb-shell__header__menu {
    min-width: var(--shell-touch-target);
  }
}

/* ╔═══════════════════════════════════════════════════════════════════╗
   ║  WAVE-2-REV2 · v6 design-system extension                          ║
   ║  (token aliases · 9 standardized components · per-route layouts)   ║
   ╚═══════════════════════════════════════════════════════════════════╝ */

:root {
  /* color: alias --jyb-* semantics for shell-scope reads */
  --shell-info: var(--jyb-info, #2563eb);
  --shell-info-bg: var(--jyb-info-bg, #dbeafe);
  --shell-success: var(--jyb-success, #16a34a);
  --shell-success-bg: var(--jyb-success-bg, #dcfce7);
  --shell-warn: var(--jyb-warning, #d97706);
  --shell-warn-bg: var(--jyb-warning-bg, #fef3c7);
  --shell-danger: var(--jyb-danger, #dc2626);
  --shell-danger-bg: var(--jyb-danger-bg, #fee2e2);
  --shell-border-subtle: var(--jyb-divider, #eef0f4);
  --shell-border-default: var(--jyb-border, #e5e7eb);
  --shell-border-strong: var(--jyb-border-strong, #cbd5e1);

  /* type scale */
  --shell-type-display: 40px;
  --shell-type-h1: var(--jyb-font-size-2xl, 32px);
  --shell-type-h2: var(--jyb-font-size-xl, 24px);
  --shell-type-h3: var(--jyb-font-size-lg, 20px);
  --shell-type-body: var(--jyb-font-size-base, 14px);
  --shell-type-caption: var(--jyb-font-size-xs, 12px);

  /* elevation */
  --shell-elev-0: none;
  --shell-elev-1: var(--jyb-shadow-sm, 0 1px 2px rgba(15,23,42,0.05));
  --shell-elev-2: var(--jyb-shadow-md, 0 4px 12px rgba(15,23,42,0.08));
  --shell-elev-3: var(--jyb-shadow-lg, 0 10px 24px rgba(15,23,42,0.10));
  --shell-elev-4: var(--jyb-shadow-xl, 0 20px 40px rgba(15,23,42,0.14));

  /* density */
  --shell-row-h-compact: 36px;
  --shell-row-h-comfy: 48px;
  --shell-card-pad-sm: var(--jyb-space-3, 12px);
  --shell-card-pad-md: var(--jyb-space-4, 16px);
  --shell-card-pad-lg: var(--jyb-space-5, 24px);
}

/* ── COMPONENT: .jyb-btn ──────────────────────────────────────────── */
.jyb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: var(--jyb-radius-md, 6px);
  background: #fff;
  color: var(--jyb-text, #1e293b);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--jyb-motion-fast, 120ms) var(--jyb-ease-standard, ease),
              color var(--jyb-motion-fast, 120ms) var(--jyb-ease-standard, ease),
              border-color var(--jyb-motion-fast, 120ms) var(--jyb-ease-standard, ease);
}
.jyb-btn:focus-visible {
  outline: none;
  box-shadow: var(--jyb-focus-ring, 0 0 0 2px rgba(201,162,94,0.35));
}
.jyb-btn:disabled,
.jyb-btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
}
.jyb-btn--primary,
.jyb-btn.is-primary {
  background: var(--jyb-gold, #c9a25e);
  color: #fff;
  border-color: var(--jyb-gold, #c9a25e);
}
.jyb-btn--primary:hover:not(:disabled),
.jyb-btn.is-primary:hover:not(:disabled) {
  background: var(--jyb-gold-strong, #b08a47);
  border-color: var(--jyb-gold-strong, #b08a47);
}
.jyb-btn--secondary,
.jyb-btn.is-secondary {
  background: #fff;
  color: var(--jyb-text, #1e293b);
  border-color: var(--shell-border-default);
}
.jyb-btn--secondary:hover:not(:disabled),
.jyb-btn.is-secondary:hover:not(:disabled) {
  background: var(--jyb-bg-muted, #f6f7f9);
}
.jyb-btn--ghost,
.jyb-btn.is-ghost {
  background: transparent;
  color: var(--jyb-text-muted, #64748b);
  border-color: transparent;
}
.jyb-btn--ghost:hover:not(:disabled),
.jyb-btn.is-ghost:hover:not(:disabled) {
  background: var(--jyb-bg-muted, #f6f7f9);
  color: var(--jyb-text, #1e293b);
}
.jyb-btn--danger,
.jyb-btn.is-danger {
  background: var(--shell-danger);
  color: #fff;
  border-color: var(--shell-danger);
}
.jyb-btn--danger:hover:not(:disabled),
.jyb-btn.is-danger:hover:not(:disabled) {
  background: #b91c1c;
  border-color: #b91c1c;
}
.jyb-btn--sm { min-height: 32px; padding: 0 12px; font-size: 0.82rem; }
.jyb-btn--lg { min-height: 48px; padding: 0 24px; font-size: 1rem; }
.jyb-btn.is-loading {
  position: relative;
  pointer-events: none;
}
.jyb-btn.is-loading::after {
  content: '';
  display: inline-block;
  width: 14px; height: 14px;
  margin-left: 6px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: jyb-spin 700ms linear infinite;
}

@media (max-width: 768px) {
  .jyb-btn { min-height: var(--shell-touch-target, 44px); }
  .jyb-btn--sm { min-height: 36px; }
}

/* ── COMPONENT: .jyb-card ─────────────────────────────────────────── */
.jyb-card {
  background: var(--jyb-surface, #fff);
  border: 1px solid var(--shell-border-subtle);
  border-radius: var(--jyb-radius-lg, 10px);
  padding: var(--shell-card-pad-md);
}
.jyb-card--padded { padding: var(--shell-card-pad-lg); }
.jyb-card--bordered { border-color: var(--shell-border-default); }
.jyb-card--elevated {
  box-shadow: var(--shell-elev-1);
  border-color: transparent;
  transition: box-shadow var(--jyb-motion-base, 180ms) var(--jyb-ease-standard, ease);
}
.jyb-card--elevated:hover { box-shadow: var(--shell-elev-2); }
.jyb-card__title {
  margin: 0 0 8px;
  font-size: var(--shell-type-h3);
  font-weight: 600;
  color: var(--jyb-text, #1e293b);
}
.jyb-card__hint {
  margin: 0 0 12px;
  font-size: var(--shell-type-caption);
  color: var(--jyb-text-muted, #64748b);
}
.jyb-card__footer {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--shell-border-subtle);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── COMPONENT: .jyb-alert ────────────────────────────────────────── */
.jyb-alert {
  display: flex;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--jyb-radius-md, 6px);
  border-left: 3px solid;
  background: var(--jyb-bg-muted, #f6f7f9);
  align-items: flex-start;
  margin-bottom: 12px;
}
.jyb-alert__icon { font-size: 1rem; line-height: 1.4; flex-shrink: 0; }
.jyb-alert__body { flex: 1; min-width: 0; font-size: 0.88rem; line-height: 1.55; }
.jyb-alert__body strong { display: block; margin-bottom: 2px; font-size: 0.9rem; }
.jyb-alert--info,    .jyb-alert.is-info    { background: var(--shell-info-bg);    border-color: var(--shell-info);    color: #1e3a8a; }
.jyb-alert--success, .jyb-alert.is-success { background: var(--shell-success-bg); border-color: var(--shell-success); color: #14532d; }
.jyb-alert--warn,    .jyb-alert.is-warn    { background: var(--shell-warn-bg);    border-color: var(--shell-warn);    color: #78350f; }
.jyb-alert--error,   .jyb-alert.is-error   { background: var(--shell-danger-bg);  border-color: var(--shell-danger);  color: #7f1d1d; }

/* ── COMPONENT: .jyb-empty ────────────────────────────────────────── */
.jyb-empty-host {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 0;
}
.jyb-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 48px 24px;
  text-align: center;
  max-width: 480px;
  background: #fff;
  border: 1px solid var(--shell-border-subtle);
  border-radius: var(--jyb-radius-lg, 10px);
}
.jyb-empty__icon { font-size: 36px; opacity: 0.7; }
.jyb-empty__title { margin: 0; font-size: 1.05rem; font-weight: 700; color: var(--jyb-text, #1e293b); }
.jyb-empty__body { margin: 0; font-size: 0.85rem; line-height: 1.55; color: var(--jyb-text-muted, #64748b); }
.jyb-empty__actions {
  display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 4px;
}
.jyb-empty.is-error .jyb-empty__title { color: var(--shell-danger); }
.jyb-empty.is-loading .jyb-empty__icon { animation: jyb-pulse 1.4s ease infinite; }
.jyb-empty.is-disabled { opacity: 0.95; }

/* ── COMPONENT: .jyb-spinner / .jyb-skeleton ──────────────────────── */
.jyb-spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2px solid var(--shell-border-default);
  border-top-color: var(--jyb-gold, #c9a25e);
  border-radius: 50%;
  animation: jyb-spin 700ms linear infinite;
  vertical-align: -3px;
}
.jyb-skeleton {
  display: block;
  height: 12px;
  border-radius: 4px;
  background: linear-gradient(90deg,
              var(--jyb-bg-muted, #f6f7f9) 25%,
              var(--jyb-bg-subtle, #eef0f4) 37%,
              var(--jyb-bg-muted, #f6f7f9) 63%);
  background-size: 400% 100%;
  animation: jyb-shimmer 1.4s ease infinite;
}
.jyb-skeleton--lg { height: 20px; }
.jyb-skeleton--block { height: 64px; }

@keyframes jyb-spin { to { transform: rotate(360deg); } }
@keyframes jyb-pulse { 50% { opacity: 0.4; } }
@keyframes jyb-shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

/* ── COMPONENT: .jyb-toast ────────────────────────────────────────── */
.jyb-toast-host {
  position: fixed;
  top: 76px; right: 16px;
  z-index: var(--jyb-z-toast, 1500);
  display: flex; flex-direction: column; gap: 10px;
  pointer-events: none;
  max-width: 360px;
}
.jyb-toast {
  pointer-events: auto;
  min-width: 220px;
  max-width: 360px;
  padding: 12px 16px;
  background: #fff;
  border: 1px solid var(--shell-border-default);
  border-left: 3px solid var(--shell-info);
  border-radius: var(--jyb-radius-md, 6px);
  box-shadow: var(--shell-elev-3);
  font-size: 0.86rem;
  color: var(--jyb-text, #1e293b);
  animation: jyb-toast-in 240ms var(--jyb-ease-standard, ease) both;
}
.jyb-toast.is-success { border-left-color: var(--shell-success); }
.jyb-toast.is-warn    { border-left-color: var(--shell-warn); }
.jyb-toast.is-error   { border-left-color: var(--shell-danger); }
.jyb-toast.is-leaving { animation: jyb-toast-out 200ms var(--jyb-ease-standard, ease) both; }
@keyframes jyb-toast-in  { from { transform: translateX(40px); opacity: 0; } }
@keyframes jyb-toast-out { to   { transform: translateX(40px); opacity: 0; } }

@media (max-width: 768px) {
  .jyb-toast-host {
    top: auto;
    bottom: calc(var(--shell-bottom-nav-h) + env(safe-area-inset-bottom, 0px) + 12px);
    left: 12px; right: 12px;
    max-width: none;
  }
  .jyb-toast { max-width: none; }
}

/* ── COMPONENT: .jyb-table (responsive: card-stack on mobile) ─────── */
.jyb-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--shell-border-subtle);
  border-radius: var(--jyb-radius-md, 6px);
  background: #fff;
}
.jyb-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.jyb-table thead th {
  position: sticky; top: 0;
  background: var(--jyb-bg-muted, #f6f7f9);
  font-weight: 600;
  text-align: left;
  padding: 0 12px;
  height: var(--shell-row-h-compact, 36px);
  color: var(--jyb-text, #1e293b);
  border-bottom: 1px solid var(--shell-border-default);
  white-space: nowrap;
}
.jyb-table tbody td {
  padding: 0 12px;
  height: var(--shell-row-h-comfy, 48px);
  border-bottom: 1px solid var(--shell-border-subtle);
  vertical-align: middle;
}
.jyb-table tbody tr:hover { background: var(--jyb-bg-muted, #f6f7f9); }
.jyb-table tbody tr:last-child td { border-bottom: 0; }

@media (max-width: 768px) {
  .jyb-table-wrap { border: 0; background: transparent; overflow: visible; }
  .jyb-table thead { display: none; }
  .jyb-table, .jyb-table tbody, .jyb-table tr { display: block; }
  .jyb-table tbody { display: flex; flex-direction: column; gap: 8px; }
  .jyb-table tbody tr {
    background: #fff;
    border: 1px solid var(--shell-border-subtle);
    border-radius: var(--jyb-radius-md, 6px);
    padding: 10px 12px;
  }
  .jyb-table tbody tr:hover { background: #fff; }
  .jyb-table tbody td {
    display: flex; justify-content: space-between; align-items: center;
    border-bottom: 1px dashed var(--shell-border-subtle);
    padding: 6px 0;
    height: auto;
    min-height: 32px;
    gap: 12px;
  }
  .jyb-table tbody td:last-child { border-bottom: 0; }
  .jyb-table tbody td::before {
    content: attr(data-label);
    font-size: 0.78rem;
    color: var(--jyb-text-muted, #64748b);
    flex-shrink: 0;
  }
}

/* ── COMPONENT: .jyb-form-field ───────────────────────────────────── */
.jyb-form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}
.jyb-form-field__label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--jyb-text, #1e293b);
}
.jyb-form-field__input,
.jyb-form-field__textarea,
.jyb-form-field__select {
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--shell-border-default);
  border-radius: var(--jyb-radius-md, 6px);
  background: #fff;
  font: inherit;
  font-size: 0.92rem;
  color: var(--jyb-text, #1e293b);
  box-sizing: border-box;
  transition: border-color var(--jyb-motion-fast, 120ms) var(--jyb-ease-standard, ease),
              box-shadow var(--jyb-motion-fast, 120ms) var(--jyb-ease-standard, ease);
}
.jyb-form-field__textarea {
  min-height: 96px;
  line-height: 1.55;
  resize: vertical;
}
.jyb-form-field__input:focus,
.jyb-form-field__textarea:focus,
.jyb-form-field__select:focus {
  outline: none;
  border-color: var(--jyb-gold, #c9a25e);
  box-shadow: var(--jyb-focus-ring, 0 0 0 2px rgba(201,162,94,0.35));
}
.jyb-form-field__help {
  font-size: 0.78rem;
  color: var(--jyb-text-muted, #64748b);
}
.jyb-form-field.is-error .jyb-form-field__input,
.jyb-form-field.is-error .jyb-form-field__textarea,
.jyb-form-field.is-error .jyb-form-field__select { border-color: var(--shell-danger); }
.jyb-form-field.is-error .jyb-form-field__help { color: var(--shell-danger); }

@media (max-width: 768px) {
  .jyb-form-field__input,
  .jyb-form-field__textarea,
  .jyb-form-field__select { min-height: var(--shell-touch-target, 44px); }
}

/* ── COMPONENT: .jyb-modal (centered desktop · bottom-sheet mobile) ── */
.jyb-modal-host[hidden] { display: none; }
.jyb-modal-backdrop {
  position: fixed; inset: 0;
  z-index: var(--jyb-z-modal, 1000);
  background: rgba(15, 23, 42, 0.5);
  animation: jyb-fade-in 180ms var(--jyb-ease-standard, ease) both;
}
.jyb-modal-dialog {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  z-index: calc(var(--jyb-z-modal, 1000) + 1);
  width: min(560px, calc(100% - 48px));
  max-height: 85vh;
  overflow: auto;
  background: #fff;
  border-radius: var(--jyb-radius-xl, 16px);
  box-shadow: var(--shell-elev-3);
  animation: jyb-modal-pop 220ms var(--jyb-ease-emphasized, ease) both;
}
.jyb-modal-dialog__head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--shell-border-subtle);
  display: flex; justify-content: space-between; align-items: center;
}
.jyb-modal-dialog__title {
  margin: 0;
  font-size: var(--shell-type-h3);
  font-weight: 700;
  color: var(--jyb-text, #1e293b);
}
.jyb-modal-dialog__close {
  width: 32px; height: 32px;
  border: 0;
  background: transparent;
  border-radius: 6px;
  font-size: 18px;
  cursor: pointer;
  color: var(--jyb-text-muted, #64748b);
}
.jyb-modal-dialog__close:hover { background: var(--jyb-bg-muted, #f6f7f9); }
.jyb-modal-dialog__body {
  padding: 20px;
}
.jyb-modal-dialog__foot {
  padding: 12px 20px;
  border-top: 1px solid var(--shell-border-subtle);
  display: flex; justify-content: flex-end; gap: 8px;
}

@keyframes jyb-fade-in { from { opacity: 0; } }
@keyframes jyb-modal-pop {
  from { transform: translate(-50%, -50%) scale(0.96); opacity: 0; }
}
@keyframes jyb-sheet-up {
  from { transform: translateY(100%); }
}

@media (max-width: 768px) {
  .jyb-modal-dialog {
    top: auto; bottom: 0; left: 0; right: 0;
    transform: none;
    width: 100%;
    max-width: none;
    max-height: 88vh;
    border-radius: var(--jyb-radius-xl, 16px) var(--jyb-radius-xl, 16px) 0 0;
    animation: jyb-sheet-up 240ms var(--jyb-ease-emphasized, ease) both;
  }
  .jyb-modal-dialog__close { min-width: var(--shell-touch-target, 44px); min-height: var(--shell-touch-target, 44px); }
}

/* ── PER-ROUTE LAYOUT HOOKS ───────────────────────────────────────── */

/* welcome already uses .jyb-tile-grid + .jyb-shortcut-grid (declared below) */
.jyb-shortcut-grid {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin-bottom: 16px;
}
.jyb-shortcut {
  display: flex; flex-direction: column; gap: 4px;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid var(--shell-divider, #e5e7eb);
  border-radius: 10px;
  text-decoration: none;
  color: #1e293b;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.jyb-shortcut:hover { border-color: #c9a25e; box-shadow: 0 1px 8px rgba(122,90,40,0.10); }
.jyb-shortcut__icon { font-size: 22px; }
.jyb-shortcut__title { font-weight: 700; font-size: 0.95rem; }
.jyb-shortcut__hint { font-size: 0.78rem; color: #64748b; }
.jyb-shortcut.is-disabled { opacity: 0.5; pointer-events: none; }

/* generator: form + result two-column on desktop, stacked on mobile */
.gen-layout { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 1025px) {
  .gen-layout--split { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
}
.gen-meta { display: flex; gap: 10px; align-items: center; font-size: 0.78rem; color: #64748b; flex-wrap: wrap; }
.gen-result {
  background: #f6f7fb; border: 1px solid var(--shell-divider);
  border-radius: 8px; padding: 12px 14px;
  white-space: pre-wrap; word-wrap: break-word;
  font-size: 0.9rem; color: #1e293b;
  max-height: 50vh; overflow: auto;
  min-height: 80px;
}
.gen-version-stack { display: flex; flex-direction: column; gap: 8px; max-height: 50vh; overflow: auto; }
.gen-version {
  background: #fff; border: 1px solid var(--shell-border-subtle);
  border-radius: 6px; padding: 8px 10px;
  font-size: 0.82rem; color: var(--jyb-text-muted);
}
.gen-version__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; font-size: 0.74rem; }

/* copywriting: list panel + editor panel */
.cw-layout {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
  min-height: calc(100vh - var(--shell-header-h) - 80px);
}
@media (min-width: 769px) {
  .cw-layout { grid-template-columns: 280px minmax(0, 1fr); }
}
.cw-layout__list {
  background: #fff;
  border: 1px solid var(--shell-border-subtle);
  border-radius: var(--jyb-radius-md, 6px);
  display: flex; flex-direction: column;
  max-height: calc(100vh - 160px);
}
.cw-layout__list-head { padding: 10px 12px; border-bottom: 1px solid var(--shell-border-subtle); display: flex; gap: 8px; align-items: center; }
.cw-layout__list-body { flex: 1; overflow-y: auto; padding: 4px 0; min-height: 200px; }
.cw-layout__editor {
  background: #fff;
  border: 1px solid var(--shell-border-subtle);
  border-radius: var(--jyb-radius-md, 6px);
  padding: 16px;
  min-height: 320px;
  display: flex; flex-direction: column; gap: 10px;
}
.cw-doc-row {
  padding: 8px 12px;
  border-bottom: 1px dashed var(--shell-border-subtle);
  cursor: pointer;
  font-size: 0.85rem;
}
.cw-doc-row__title { font-weight: 600; color: var(--jyb-text); margin-bottom: 2px; }
.cw-doc-row__meta { color: var(--jyb-text-muted); font-size: 0.74rem; }
.cw-doc-row.is-active { background: var(--shell-nav-active-bg); color: var(--shell-nav-active-fg); }
.cw-doc-row:hover:not(.is-active) { background: var(--jyb-bg-muted, #f6f7f9); }

/* douyin: cookie banner + profile lookup + result cards */
.dy-banner { margin-bottom: 12px; }
.dy-lookup { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.dy-lookup .jyb-form-field { flex: 1; min-width: 220px; margin-bottom: 0; }
.dy-result-grid { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 769px) { .dy-result-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); } }

/* video-workshop */
.vw-queue-empty { padding: 32px 16px; text-align: center; color: var(--jyb-text-muted); }

/* references */
.ref-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; flex-wrap: wrap; gap: 8px; }
.ref-toolbar__left { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ref-grid { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 769px) { .ref-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); } }
.ref-card { padding: 12px; background: #fff; border: 1px solid var(--shell-border-subtle); border-radius: 8px; }
.ref-card__title { margin: 0 0 4px; font-size: 0.92rem; font-weight: 600; color: var(--jyb-text, #1e293b); }
.ref-card__meta { font-size: 0.78rem; color: var(--jyb-text-muted, #64748b); }

/* users */
.users-toolbar { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; align-items: center; }
.users-toolbar .jyb-form-field { flex: 1; min-width: 220px; margin-bottom: 0; }
.users-table-wrap { overflow-x: auto; }

/* settings */
.settings-grid { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 769px) { .settings-grid { grid-template-columns: 1fr 1fr; } }
.settings-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px dashed var(--shell-border-subtle); font-size: 0.85rem; gap: 12px; }
.settings-row:last-child { border-bottom: 0; }
.settings-row__key { color: var(--jyb-text-muted, #64748b); flex-shrink: 0; }
.settings-row__val { color: var(--jyb-text, #1e293b); font-weight: 600; text-align: right; word-break: break-word; }
.settings-row__val.is-ok { color: var(--shell-success); }
.settings-row__val.is-err { color: var(--shell-danger); }
.settings-row__val.is-warn { color: var(--shell-warn); }

/* newbie */
.nb-layout { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 769px) { .nb-layout { grid-template-columns: 240px minmax(0, 1fr); align-items: flex-start; } }
.nb-tabs { display: flex; flex-direction: column; gap: 2px; background: #fff; border: 1px solid var(--shell-border-subtle); border-radius: 8px; padding: 6px; }
@media (max-width: 768px) {
  .nb-tabs { flex-direction: row; overflow-x: auto; padding: 6px; }
  .nb-tab { white-space: nowrap; flex-shrink: 0; }
}
.nb-tab {
  display: block;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.88rem;
  color: var(--jyb-text-muted, #64748b);
  border: 0;
  background: transparent;
  text-align: left;
  width: 100%;
  font-family: inherit;
  min-height: 40px;
}
.nb-tab.is-active { background: var(--shell-nav-active-bg); color: var(--shell-nav-active-fg); font-weight: 600; }
.nb-tab:hover:not(.is-active) { background: var(--jyb-bg-muted, #f6f7f9); }
.nb-content { background: #fff; border: 1px solid var(--shell-border-subtle); border-radius: 8px; padding: 18px; min-height: 240px; }
.nb-content h3 { margin-top: 0; }
.nb-content p { line-height: 1.7; color: var(--jyb-text); }

/* upload tabs */
.up-tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--shell-border-subtle); flex-wrap: wrap; }
.up-tab {
  padding: 10px 14px;
  border: 0;
  background: transparent;
  font: inherit; font-size: 0.92rem;
  color: var(--jyb-text-muted, #64748b);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  min-height: 40px;
}
.up-tab.is-active { color: var(--jyb-gold-ink, #7a5a28); border-bottom-color: var(--jyb-gold, #c9a25e); font-weight: 600; }
.up-pane { display: none; }
.up-pane.is-active { display: block; }
.up-batch-preview {
  max-height: 240px; overflow: auto;
  background: var(--jyb-bg-muted, #f6f7f9);
  border-radius: 6px; padding: 8px 10px;
  font-size: 0.82rem; color: var(--jyb-text-muted);
  margin-top: 8px;
}

/* ── prefers-reduced-motion ───────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .jyb-skeleton, .jyb-spinner,
  .jyb-empty.is-loading .jyb-empty__icon { animation: none; opacity: 0.7; }
}
