/* Content factory dashboard — light, clean, grid-first SaaS look.
 * Layout: fixed left sidebar + centered content column.
 * Type: Inter everywhere; tabular numerals for data.
 * Palette: white surfaces on a light-gray canvas, one amber accent,
 * semantic green/red/blue for statuses. Spacing scale: 4/8/12/16/24/32.
 * The conveyor-tape signature survives only as a thin progress strip on
 * in-progress order cards. */

:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --border: #e4e7ec;
  --border-strong: #d0d5dd;
  --text: #101828;
  --muted: #667085;
  --faint: #98a2b3;
  --accent: #d97706;
  --accent-strong: #b45309;
  --accent-soft: #fef3e2;
  --accent-border: #f5d9ae;
  --success: #067647;
  --success-soft: #ecfdf3;
  --success-border: #abefc6;
  --danger: #d92d20;
  --danger-soft: #fef3f2;
  --danger-border: #fecdca;
  --info: #175cd3;
  --info-soft: #eff8ff;
  --info-border: #b2ddff;
  --gray-soft: #f2f4f7;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-md: 0 4px 12px rgba(16, 24, 40, 0.08);
  --shadow-lg: 0 20px 48px rgba(16, 24, 40, 0.16);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-display: "Tektur", var(--font);
  --sidebar-w: 236px;
  --tape: repeating-linear-gradient(
    -55deg,
    rgba(217, 119, 6, 0.85) 0 10px,
    rgba(217, 119, 6, 0.15) 10px 20px
  );
}

/* ============================== Base ============================== */

* { box-sizing: border-box; }

html { color-scheme: light; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3 { margin: 0; line-height: 1.3; font-weight: 600; letter-spacing: -0.01em; }
p { margin: 0; }
a { color: var(--accent-strong); }

.hidden { display: none !important; }
.no-scroll { overflow: hidden; }
.muted { color: var(--muted); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.noscript { padding: 24px; text-align: center; color: var(--muted); }

@keyframes tape-move { to { background-position: 28px 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================== Spinner ============================== */

@keyframes rot { to { transform: rotate(360deg); } }

.spin {
  display: inline-block;
  flex: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(217, 119, 6, 0.25);
  border-top-color: var(--accent);
  animation: rot 0.8s linear infinite;
}
.spin-sm { width: 14px; height: 14px; }
.spin-xs { width: 10px; height: 10px; border-width: 1.5px; }

/* ============================== Buttons ============================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  box-shadow: var(--shadow-sm);
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.05s;
}
.btn:hover { background: var(--surface-2); border-color: var(--faint); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: default; pointer-events: none; }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}
.btn-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn-primary .spin { border-color: rgba(255, 255, 255, 0.4); border-top-color: #fff; }

.btn-danger {
  background: var(--surface);
  border-color: var(--danger-border);
  color: var(--danger);
}
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }

.btn-block { width: 100%; }
.btn-sm { min-height: 32px; padding: 4px 12px; font-size: 0.85rem; box-shadow: none; }

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.btn-icon:hover { background: var(--gray-soft); color: var(--text); }

/* ============================== App shell ============================== */

#app { display: flex; min-height: 100vh; min-height: 100dvh; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  width: var(--sidebar-w);
  padding: 20px 14px 16px;
  background: var(--surface);
  border-right: 1px solid var(--border);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 8px 22px;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text);
  text-decoration: none;
}
.brand svg { color: var(--accent); flex: none; }

.sidenav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidenav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 0.93rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.sidenav a svg { flex: none; opacity: 0.75; }
.sidenav a:hover { background: var(--gray-soft); color: var(--text); }
.sidenav a.active { background: var(--accent-soft); color: var(--accent-strong); }
.sidenav a.active svg { opacity: 1; }

.soon-tag {
  margin-left: auto;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--gray-soft);
  border: 1px solid var(--border);
  color: var(--faint);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.sidebar-foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.hf-balance {
  display: block;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  color: var(--accent-strong);
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.hf-balance:empty { display: none; }

.logout-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}
.logout-btn:hover { background: var(--gray-soft); color: var(--text); }

/* ============================== Content column ============================== */

.view {
  flex: 1;
  min-width: 0;
  margin-left: var(--sidebar-w);
  padding: 32px 40px 64px;
}

.page-title { font-size: 1.35rem; }
.page-sub { margin-top: 4px; font-size: 0.92rem; color: var(--muted); }

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 22px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.panel-title { font-size: 1rem; margin-bottom: 14px; }

.loading-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 56px 16px;
  text-align: center;
}

/* Section badge for not-yet-live pages. */
.stage-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--info-soft);
  border: 1px solid var(--info-border);
  color: var(--info);
  font-size: 0.78rem;
  font-weight: 600;
}

/* ============================== Login ============================== */

.screen-login {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 24px 16px;
  background: var(--bg);
}

.login-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 360px;
  padding: 36px 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-md);
  text-align: center;
}

.login-logo { color: var(--accent); margin-bottom: 2px; }
.login-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.login-sub { color: var(--muted); font-size: 0.9rem; margin-bottom: 10px; }

.form-error { color: var(--danger); font-size: 0.88rem; }

/* ============================== Form controls ============================== */

.field { display: block; margin-bottom: 14px; }

.field-label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
}
.field-label em {
  font-style: normal;
  font-weight: 500;
  color: var(--faint);
}

textarea, select, input[type="password"], input[type="text"] {
  width: 100%;
  padding: 9px 12px;
  font: inherit;
  font-size: 0.92rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, box-shadow 0.15s;
}
textarea { resize: vertical; min-height: 42px; }
textarea::placeholder, input::placeholder { color: var(--faint); }

textarea:focus, select:focus, input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.15);
}

select {
  appearance: none;
  -webkit-appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  padding-right: 34px;
  min-height: 40px;
  cursor: pointer;
}

.form-sec { padding-top: 16px; margin-top: 16px; border-top: 1px solid var(--border); }
.form-sec:first-child { padding-top: 0; margin-top: 0; border-top: none; }
.form-sec-title {
  margin-bottom: 12px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--faint);
}

.segmented {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--gray-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.seg-btn {
  flex: 1;
  min-height: 34px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}
.seg-btn:hover { color: var(--text); }
.seg-btn.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-strong);
}

.estimate-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  margin-bottom: 4px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-sm);
}
.estimate-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent-strong);
  font-variant-numeric: tabular-nums;
}

.form-hint {
  margin: 12px 0 14px;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.5;
}

/* ============================== Home: stats + orders grid ============================== */

.home { display: flex; flex-direction: column; gap: 20px; }
.home .page-head { margin-bottom: 0; }

.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
}
.stat-chip {
  display: flex;
  flex-direction: column-reverse;
  gap: 4px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.stat-num {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.stat-label { font-size: 0.82rem; color: var(--muted); font-weight: 500; }
.stat-work .stat-num { color: var(--accent-strong); }
.stat-ok .stat-num, .stat-pub .stat-num { color: var(--success); }
.stat-err .stat-num { color: var(--danger); }
.stat-zero .stat-num { color: var(--faint); }

.orders-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}
.orders-grid .loading-block { grid-column: 1 / -1; }

.orders-hint {
  grid-column: span 2;
  align-self: center;
  padding: 12px;
  font-size: 0.9rem;
  line-height: 1.55;
}

.order-add {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 300px;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.order-add:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.lib-add-plus {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-sm);
  font-size: 1.4rem;
  font-weight: 400;
  line-height: 1;
  color: var(--accent);
}

.order-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s, transform 0.12s, box-shadow 0.15s;
}
.order-tile:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.order-tile.working::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: var(--tape);
  background-size: 28px 100%;
  animation: tape-move 2.4s linear infinite;
  pointer-events: none;
}

.ot-cover {
  position: relative;
  aspect-ratio: 9 / 12;
  background: var(--gray-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.ot-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.order-tile:hover .ot-cover img { transform: scale(1.03); transition: transform 0.25s; }
.ot-badge { position: absolute; top: 8px; left: 8px; }
.ot-badge .badge {
  box-shadow: var(--shadow-sm);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.ot-body { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px 14px; }
.ot-body .order-topic { font-size: 0.9rem; }

.order-topic {
  font-weight: 600;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.order-error {
  font-size: 0.8rem;
  color: var(--danger);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.order-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.8rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.thumb-ph { color: var(--faint); display: inline-flex; }

/* ============================== Status badges ============================== */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 0.76rem;
  font-weight: 600;
  white-space: nowrap;
  width: fit-content;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.badge .spin-xs { border-color: currentColor; border-top-color: transparent; opacity: 0.9; }

.badge-wait { color: var(--info); background: var(--info-soft); border-color: var(--info-border); }
.badge-work { color: var(--accent-strong); background: var(--accent-soft); border-color: var(--accent-border); }
.badge-ok   { color: var(--success); background: var(--success-soft); border-color: var(--success-border); }
.badge-pub  { color: var(--success); background: var(--success-soft); border-color: var(--success); }
.badge-err  { color: var(--danger); background: var(--danger-soft); border-color: var(--danger-border); }
.badge-off  { color: var(--muted); background: var(--gray-soft); border-color: var(--border); }

/* ============================== Empty states ============================== */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 44px 20px;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  text-align: center;
  background: var(--surface);
}
.empty-icon { color: var(--faint); margin-bottom: 4px; }
.empty .muted { font-size: 0.9rem; max-width: 380px; }
.empty-sm { padding: 24px 16px; border: none; background: transparent; }

/* ============================== Order detail ============================== */

.detail {
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: fit-content;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  padding: 4px 0;
}
.back-link:hover { color: var(--accent-strong); }

.detail-head { display: flex; flex-direction: column; gap: 8px; }
.detail-title-row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.detail-title { font-size: 1.3rem; }
.detail-topic { font-size: 0.92rem; }
.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}

.error-banner {
  padding: 12px 14px;
  background: var(--danger-soft);
  border: 1px solid var(--danger-border);
  border-radius: var(--radius-sm);
  color: #912018;
  font-size: 0.9rem;
  line-height: 1.5;
}
.error-banner strong { color: var(--danger); }

/* Stage timeline */
.tl-panel { padding: 18px 10px 14px; }
.tl { display: flex; overflow-x: auto; scrollbar-width: none; }
.tl::-webkit-scrollbar { display: none; }

.tl-step {
  position: relative;
  flex: 1;
  min-width: 76px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.tl-step::before {
  content: "";
  position: absolute;
  top: 14px;
  left: calc(-50% + 15px);
  width: calc(100% - 30px);
  height: 2px;
  background: var(--border-strong);
}
.tl-step:first-child::before { display: none; }
.tl-step.done::before,
.tl-step.current::before,
.tl-step.fail::before { background: var(--accent); }

.tl-dot {
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--border-strong);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}
.tl-step.done .tl-dot { background: var(--accent); border-color: var(--accent); color: #fff; }
.tl-step.current .tl-dot { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.tl-step.fail .tl-dot { background: var(--danger); border-color: var(--danger); color: #fff; }
.tl-step.off .tl-dot { opacity: 0.5; }

.tl-label { font-size: 0.72rem; font-weight: 600; color: var(--muted); white-space: nowrap; }
.tl-step.done .tl-label, .tl-step.current .tl-label { color: var(--text); }
.tl-step.fail .tl-label { color: var(--danger); }

/* Final video player */
.player { display: flex; justify-content: center; }
.player video {
  width: 100%;
  max-width: 340px;
  aspect-ratio: 9 / 16;
  max-height: 72vh;
  background: #000;
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-md);
  display: block;
}

.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.actions .btn { flex: 0 1 auto; }

.caption-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.caption-head .panel-title { margin-bottom: 0; }
.caption-text {
  white-space: pre-wrap;
  overflow-wrap: break-word;
  font-size: 0.93rem;
  line-height: 1.6;
  color: var(--text);
  user-select: text;
}

/* Scene grid */
.scenes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

.scene-card {
  display: flex;
  flex-direction: column;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  overflow: hidden;
  cursor: pointer;
  font: inherit;
  color: inherit;
  text-align: left;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, transform 0.1s, box-shadow 0.15s;
}
.scene-card:hover:not(:disabled) {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.scene-card:disabled { cursor: default; }

.scene-media {
  position: relative;
  aspect-ratio: 9 / 16;
  background: var(--gray-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.scene-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.scene-ph { color: var(--faint); display: inline-flex; }

.play-badge {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  color: var(--accent-strong);
  padding-left: 2px;
  transition: transform 0.15s;
  pointer-events: none;
}
.scene-card:hover .play-badge { transform: scale(1.08); }

.scene-fail {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--danger);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 800;
}

.scene-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 7px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}
.scene-foot .muted { font-weight: 500; white-space: nowrap; }

/* ============================== Library ============================== */

.library, .settings {
  max-width: 1080px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.lib-intro { margin: -14px 0 4px; max-width: 760px; }
.lib-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.lib-count { font-size: 0.8rem; color: var(--faint); font-variant-numeric: tabular-nums; }

.lib-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(136px, 1fr));
  gap: 14px;
}

.lib-card { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.lib-thumb {
  position: relative;
  aspect-ratio: 9 / 12;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--gray-soft);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--faint);
}
.lib-thumb img { width: 100%; height: 100%; object-fit: cover; }
.lib-thumb-voice { aspect-ratio: 9 / 5; font-size: 1.6rem; }

.lib-add {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  aspect-ratio: 9 / 12;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.83rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.lib-add:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
  background: var(--accent-soft);
}
.lib-add-voice { aspect-ratio: 9 / 5; }

.lib-del {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 50%;
  background: rgba(16, 24, 40, 0.55);
  color: #fff;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
}
.lib-card:hover .lib-del { opacity: 1; }

.lib-name {
  font-size: 0.86rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lib-error {
  font-size: 0.76rem;
  color: var(--danger);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.lib-empty { padding: 6px 0 2px; font-size: 0.9rem; }

/* ============================== Asset & order modal ============================== */

.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(16, 24, 40, 0.45);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(12px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-card {
  width: 100%;
  max-width: 460px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  animation: modal-in 0.16s ease-out;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}
.modal-title { font-size: 1.05rem; }
.modal-sub { margin: 6px 0 16px; font-size: 0.87rem; color: var(--muted); line-height: 1.5; }
.modal-close {
  flex: none;
  width: 32px;
  height: 32px;
  margin: -4px -6px 0 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}
.modal-close:hover { background: var(--gray-soft); color: var(--text); }

.dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 140px;
  margin-bottom: 14px;
  padding: 18px;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--muted);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.dropzone:hover, .dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.dropzone input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.dz-placeholder { display: flex; flex-direction: column; align-items: center; gap: 7px; }
.dz-icon { font-size: 1.6rem; line-height: 1; }
.dz-text { font-size: 0.9rem; font-weight: 600; color: var(--text); }
.dz-hint { font-size: 0.78rem; }

.dz-preview { display: none; width: 100%; flex-direction: column; align-items: center; gap: 8px; }
.dropzone.has-file .dz-preview { display: flex; }
.dropzone.has-file .dz-placeholder { display: none; }
.dz-preview img, .dz-preview video {
  max-width: 100%;
  max-height: 200px;
  border-radius: var(--radius-sm);
  background: #000;
}
.dz-file {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.82rem;
  color: var(--muted);
}

.upload-progress {
  height: 6px;
  margin: 2px 0 12px;
  border-radius: 999px;
  background: var(--gray-soft);
  border: 1px solid var(--border);
  overflow: hidden;
}
.upload-progress > i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--accent);
  transition: width 0.2s ease;
}

/* ============================== Settings & placeholders ============================== */

.ig-status { margin-bottom: 16px; min-height: 28px; display: flex; flex-direction: column; gap: 6px; }
.ig-status > .spin { align-self: flex-start; }
.ig-status:has(> .spin) { flex-direction: row; align-items: center; gap: 10px; }
.ig-row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.ig-username { font-size: 1rem; }
.ig-quota { font-size: 0.85rem; }

.pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
  border: 1px solid transparent;
}
.pill-ok { color: var(--success); background: var(--success-soft); border-color: var(--success-border); }
.pill-warn { color: var(--accent-strong); background: var(--accent-soft); border-color: var(--accent-border); }
.pill-danger { color: var(--danger); background: var(--danger-soft); border-color: var(--danger-border); }

.steps {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.steps li {
  position: relative;
  padding-left: 38px;
  counter-increment: step;
  font-size: 0.9rem;
  line-height: 1.5;
  min-height: 26px;
}
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 25px;
  height: 25px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 700;
}
.steps-note { margin-top: 14px; font-size: 0.85rem; }

/* Platform / integration rows (settings, future features). */
.platform-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
}
.platform-row:first-of-type { border-top: none; padding-top: 0; }
.platform-name { font-weight: 600; font-size: 0.93rem; }
.platform-desc { font-size: 0.82rem; color: var(--muted); }
.platform-row .badge, .platform-row .pill { margin-left: auto; flex: none; }

/* Feature preview blocks (radar / analytics placeholders). */
.preview-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--info-soft);
  border: 1px solid var(--info-border);
  color: var(--info);
  font-size: 0.88rem;
  line-height: 1.5;
}

.chart-ph {
  height: 220px;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border-strong);
  background:
    repeating-linear-gradient(to top, transparent 0 39px, var(--border) 39px 40px),
    var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--faint);
  font-size: 0.88rem;
}

.table-ph { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.table-ph th {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-strong);
  color: var(--muted);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.table-ph td { padding: 10px; border-bottom: 1px solid var(--border); color: var(--faint); }

/* ============================== Virality ============================== */

.vp-note { font-size: 0.88rem; line-height: 1.5; }
.vp-row { margin-bottom: 10px; }
.vp-row .stat-chip { padding: 12px 14px; }
.vp-row .stat-num { font-size: 1.35rem; }
.vp-foot { font-size: 0.85rem; color: var(--muted); line-height: 1.5; }
.vp-foot:empty { display: none; }
.vp-warn { color: var(--danger); font-weight: 600; }

.vp-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 0 7px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.78rem;
}
.vp-ok { color: var(--success); background: var(--success-soft); }
.vp-work { color: var(--accent-strong); background: var(--accent-soft); }
.vp-err { color: var(--danger); background: var(--danger-soft); }

/* ============================== Toasts ============================== */

@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

#toasts {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(92vw, 420px);
  pointer-events: none;
}

.toast {
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  font-size: 0.9rem;
  line-height: 1.45;
  animation: toast-in 0.2s ease-out;
  transition: opacity 0.25s, transform 0.25s;
}
.toast-error { border-left-color: var(--danger); }
.toast-success { border-left-color: var(--success); }
.toast-out { opacity: 0; transform: translateY(6px); }

/* ============================== Lightbox ============================== */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(16, 24, 40, 0.78);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.lightbox-body { display: flex; align-items: center; justify-content: center; max-width: 100%; max-height: 100%; }
.lightbox-body video, .lightbox-body img {
  max-width: min(94vw, 480px);
  max-height: 88vh;
  border-radius: 14px;
  background: #000;
  display: block;
}
.lightbox-close {
  position: absolute;
  top: calc(10px + env(safe-area-inset-top));
  right: max(14px, env(safe-area-inset-right));
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s;
}
.lightbox-close:hover { background: rgba(255, 255, 255, 0.3); }

/* ============================== Responsive ============================== */

@media (max-width: 899px) {
  .sidebar {
    position: sticky;
    top: 0;
    inset: auto;
    width: 100%;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-right: none;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    scrollbar-width: none;
  }
  .sidebar::-webkit-scrollbar { display: none; }
  #app { flex-direction: column; }
  .brand { margin: 0 8px 0 0; }
  .brand span { display: none; }
  .sidenav { flex-direction: row; gap: 2px; }
  .sidenav a { padding: 7px 10px; white-space: nowrap; }
  .sidenav a svg { display: none; }
  .soon-tag { display: none; }
  .sidebar-foot {
    margin: 0 0 0 auto;
    padding: 0;
    border: none;
    flex-direction: row;
    align-items: center;
  }
  .hf-balance { padding: 5px 9px; font-size: 0.78rem; }
  .logout-btn span { display: none; }
  .view { margin-left: 0; padding: 18px 14px 56px; }
  .orders-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .order-add { min-height: 240px; }
}

@media (min-width: 1500px) {
  .view { padding: 40px 64px 72px; }
  .orders-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
}

/* --- Библиотека шрифтов (Настройки → Субтитры) --- */
.font-lib {
  display: grid;
  gap: 10px;
}
.font-card {
  display: grid;
  grid-template-columns: minmax(0, 240px) 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}
.font-card-off { opacity: .55; }
.font-prev {
  font-size: 22px;
  line-height: 1.2;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.font-name { font-weight: 600; margin-bottom: 2px; }
.font-note { font-size: 13px; color: var(--muted); }
.font-lic { white-space: nowrap; }

/* Выбор стиля подписей в форме заказа */
.sub-style-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 720px) {
  .font-card { grid-template-columns: 1fr; gap: 8px; }
  .sub-style-row { grid-template-columns: 1fr; }
}

/* --- Радар: агенты Virlo --- */
.lib-form-block {
  margin-top: 14px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  display: grid;
  gap: 12px;
}
#virlo-box .ig-row {
  justify-content: space-between;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 8px;
}
#virlo-box .ig-row > div:first-child { flex: 1 1 260px; min-width: 0; }
#virlo-videos { margin-top: 16px; }

/* --- Монтаж: врезки b-roll и пересборка --- */
.montage-meta { margin-bottom: 12px; flex-wrap: wrap; }
.broll-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.broll-card {
  display: block;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
  text-decoration: none;
  color: inherit;
}
.broll-card img { display: block; width: 100%; aspect-ratio: 9 / 16; object-fit: cover; }
.broll-card .scene-ph { display: flex; aspect-ratio: 9 / 16; align-items: center; justify-content: center; }
.broll-foot { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; font-size: 0.85rem; }
.remix summary { display: inline-flex; cursor: pointer; list-style: none; }
.remix summary::-webkit-details-marker { display: none; }
.remix-body { margin-top: 12px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); display: grid; gap: 10px; }

/* --- Радар: оценка находок по нише --- */
.pill-err { background: var(--danger-soft); color: var(--danger); border: 1px solid var(--danger-border); }
.row-dim td { opacity: .55; }
.fit-reason { font-size: 0.8rem; margin-top: 2px; }

/* --- Продукт: несколько ракурсов ---------------------------------------- */
/* Плитка миниатюр под карточкой: у продукта бывает 2–8 фотографий, и
   каждую можно убрать, не трогая сам продукт. */
.shot-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.shot {
  position: relative;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--gray-soft);
  flex: none;
}
.shot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.shot-del {
  position: absolute;
  inset: 0;
  border: none;
  background: rgba(16, 24, 40, 0.55);
  color: #fff;
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
}
.shot:hover .shot-del { opacity: 1; }
.shot-add {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  border-style: dashed;
  background: transparent;
}
.shot-add:hover { background: var(--gray-soft); }
.lib-card-product .prod-sync { align-self: flex-start; }

/* Превью выбранных файлов в окне загрузки — несколько штук в ряд. */
.dz-shots {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}
.dz-shots img, .dz-shots video {
  width: 62px;
  height: 62px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

/* --- Удаление ролика ------------------------------------------------------ */
/* Удаление — второстепенное действие: живёт в нижней строке карточки,
   не закрывает превью и не спорит с ним за внимание. Появляется при
   наведении на карточку; на узких экранах видно всегда (нет hover). */
.ot-del {
  order: 99;               /* всегда правым краем строки */
  margin-left: auto;
  width: 26px;
  height: 26px;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--faint);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s, background 0.15s;
}
.order-tile:hover .ot-del,
.ot-del:focus-visible { opacity: 1; }
.ot-del:hover { color: var(--danger); background: var(--danger-soft); }
@media (hover: none) {
  .ot-del { opacity: 1; }
}
.btn-ghost-danger {
  color: var(--danger);
  background: transparent;
  border-color: var(--danger-border);
  box-shadow: none;
}
.btn-ghost-danger:hover { background: var(--danger-soft); }
.lib-loading { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; padding: 12px 0; font-size: 0.9rem; }

/* --- Аналитика ------------------------------------------------------------ */
.analytics .stats-row { margin-bottom: 16px; }
.an-chart { width: 100%; height: 120px; display: block; margin: 8px 0 14px; }
.an-modes { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 14px; }
.an-bar-row { display: grid; grid-template-columns: 150px 1fr auto; gap: 12px; align-items: center; font-size: 0.88rem; }
.an-bar-label { font-weight: 600; }
.an-bar { height: 8px; background: var(--gray-soft); border-radius: 4px; overflow: hidden; }
.an-bar i { display: block; height: 100%; background: var(--accent); border-radius: 4px; min-width: 2px; }
.an-bar-val { color: var(--muted); white-space: nowrap; }
.an-foot { display: flex; flex-wrap: wrap; gap: 8px; font-size: 0.88rem; align-items: center; }
.an-best { font-weight: 600; color: var(--text); text-decoration: none; }
.an-best:hover { color: var(--accent-strong); }
.an-connect {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  font-size: 0.9rem;
  margin-bottom: 12px;
}
.an-connect a { color: var(--accent-strong); }
.table-wrap { overflow-x: auto; }
.an-table th, .an-table td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.an-table th { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.an-intent { font-size: 0.85rem; margin: 4px 0 12px; }
.an-top-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.an-top { display: grid; grid-template-columns: 84px 1fr; gap: 12px; align-items: baseline; font-size: 0.9rem; }
.an-top-views { font-weight: 700; color: var(--accent-strong); font-variant-numeric: tabular-nums; }
.an-top-title a { color: var(--text); text-decoration: none; }
.an-top-title a:hover { color: var(--accent-strong); text-decoration: underline; }
.stat-chip .stat-label em { font-style: normal; color: var(--faint); font-weight: 400; }

/* --- Форма нового ролика ---------------------------------------------- */
.modal-card.modal-wide { max-width: 900px; padding: 24px 26px; }
.modal-sub-inline { margin: 4px 0 0; font-size: 0.88rem; color: var(--muted); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.order-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 26px; margin-top: 14px; }
.order-side { border-left: 1px solid var(--border); padding-left: 22px; }
.side-sec + .side-sec { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.field-label-lg { font-size: 0.98rem; font-weight: 700; margin-bottom: 8px; }
.field.check { display: flex; align-items: center; gap: 8px; font-size: 0.92rem; }
.mode-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.mode-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 13px;
  text-align: left;
  background: var(--surface);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius);
  cursor: pointer;
  font: inherit;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.mode-card:hover:not([disabled]) { border-color: var(--accent); }
.mode-card.active { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.12); }
.mode-card[disabled] { opacity: 0.45; cursor: not-allowed; }
.mode-name { font-weight: 700; font-size: 0.95rem; }
.mode-price { font-size: 0.8rem; font-weight: 600; color: var(--accent-strong); }
.mode-desc { font-size: 0.8rem; color: var(--muted); line-height: 1.35; }
.adv { margin: 4px 0 14px; }
.adv summary { cursor: pointer; font-size: 0.88rem; font-weight: 600; color: var(--muted); list-style: none; display: flex; align-items: center; gap: 6px; }
.adv summary::before { content: '›'; display: inline-block; transition: transform 0.15s; font-size: 1.1rem; line-height: 1; }
.adv[open] summary::before { transform: rotate(90deg); }
.adv summary::-webkit-details-marker { display: none; }
.adv-body { padding-top: 10px; }
.order-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.order-foot .estimate-row { margin: 0; flex: 1; }
.btn-lg { min-height: 46px; padding: 0 22px; font-size: 1rem; }
@media (max-width: 860px) {
  .order-grid { grid-template-columns: 1fr; }
  .order-side { border-left: none; padding-left: 0; border-top: 1px solid var(--border); padding-top: 16px; }
  .mode-cards { grid-template-columns: 1fr; }
  .order-foot { flex-direction: column; align-items: stretch; }
}
.stat-chip-text .stat-num { font-size: 0.95rem; line-height: 1.35; font-weight: 600; }

/* --- Доступы -------------------------------------------------------------- */
/* Кто вошёл — над кнопкой «Выйти»: в white-label важно видеть, чьё
   пространство открыто, но это служебная строка, не заголовок. */
.whoami {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  font-size: 0.8rem;
  color: var(--muted);
  min-width: 0;
}
.who-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-tag {
  flex: none;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  color: var(--accent-strong);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.acc-table th, .acc-table td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--border); }
.acc-table th { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.acc-mine td { background: var(--accent-soft); }
.acc-actions { display: flex; gap: 6px; justify-content: flex-end; white-space: nowrap; }
.acc-note { margin-top: 10px; font-size: 0.85rem; }
.acc-note code { padding: 1px 5px; border-radius: 4px; background: var(--gray-soft); font-size: 0.85em; }
.acc-table td { color: var(--text); }
.acc-table td:nth-child(2), .acc-table td:nth-child(3) { color: var(--muted); font-variant-numeric: tabular-nums; }

/* --- Контент-стратегия ----------------------------------------------------- */
.strat-empty { text-align: center; padding: 32px 24px; }
.strat-empty .panel-title { font-size: 1.15rem; }
.strat-empty .muted { max-width: 560px; margin: 8px auto 20px; }
.strat-grid {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 10px 18px;
  margin: 4px 0 0;
  font-size: 0.92rem;
}
.strat-grid dt { font-weight: 600; color: var(--muted); }
.strat-grid dd { margin: 0; }
.chip {
  display: inline-block;
  margin: 0 5px 5px 0;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.84rem;
  line-height: 1.3;
}
.chip-soft { background: var(--gray-soft); border: 1px solid var(--border); }
.chip-accent { background: var(--accent-soft); border: 1px solid var(--accent-border); color: var(--accent-strong); }
.chip-danger { background: var(--danger-soft); border: 1px solid var(--danger-border); color: var(--danger); }
.topic-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.topic-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 14px;
  text-align: left;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.topic-btn:hover { border-color: var(--accent); background: var(--accent-soft); }
.topic-go { flex: none; font-size: 0.8rem; font-weight: 600; color: var(--accent-strong); opacity: 0; transition: opacity 0.15s; }
.topic-btn:hover .topic-go { opacity: 1; }
.strat-history { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 0.9rem; }
.strat-history li { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.strat-hist-actions { display: flex; gap: 6px; flex: none; }

/* --- Анкета ---------------------------------------------------------------- */
.modal-card.modal-quiz { max-width: 560px; padding: 22px 24px 20px; }
.quiz-head { display: flex; align-items: center; justify-content: space-between; }
.quiz-step { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); }
.quiz-bar { height: 4px; margin: 10px 0 18px; border-radius: 2px; background: var(--gray-soft); overflow: hidden; }
.quiz-bar i { display: block; height: 100%; background: var(--accent); border-radius: 2px; transition: width 0.25s ease; }
.quiz-title { margin: 0; font-size: 1.2rem; line-height: 1.3; }
.quiz-title em { font-style: normal; font-size: 0.85rem; font-weight: 500; color: var(--faint); }
.quiz-hint { margin: 6px 0 0; font-size: 0.88rem; color: var(--muted); }
.quiz-field { margin: 16px 0 20px; }
.quiz-field input, .quiz-field textarea { width: 100%; }
.quiz-options { display: grid; gap: 8px; }
.quiz-option {
  padding: 12px 14px;
  text-align: left;
  font: inherit;
  font-weight: 600;
  color: var(--text);
  background: var(--surface);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.quiz-option:hover { border-color: var(--accent); }
.quiz-option.active { border-color: var(--accent); background: var(--accent-soft); }
.quiz-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.quiz-wait { padding: 36px 20px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.quiz-wait .muted { max-width: 380px; }

/* --- Анкета на весь экран -------------------------------------------------- */
/* Первый вход — как настройка нового телефона: один экран, один вопрос,
   ничего лишнего вокруг. */
.quiz-screen {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  overflow-y: auto;
}
.quiz-top {
  position: sticky;
  top: 0;
  display: grid;
  grid-template-columns: 1fr minmax(200px, 420px) 1fr;
  align-items: center;
  gap: 20px;
  padding: 16px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.quiz-brand {
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
}
.quiz-exit {
  justify-self: end;
  border: none;
  background: none;
  font: inherit;
  font-size: 0.86rem;
  color: var(--muted);
  cursor: pointer;
}
.quiz-exit:hover { color: var(--text); }
.quiz-body {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 48px 24px 64px;
}
.quiz-card { width: 100%; max-width: 620px; }
.quiz-card .quiz-step {
  display: block;
  margin-bottom: 10px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-strong);
}
.quiz-card .quiz-title { margin: 0; font-size: 1.9rem; line-height: 1.2; letter-spacing: -0.01em; }
.quiz-card .quiz-hint { margin: 10px 0 0; font-size: 0.98rem; line-height: 1.5; color: var(--muted); }
.quiz-card .quiz-field { margin: 26px 0 28px; }
.quiz-card .quiz-field input, .quiz-card .quiz-field textarea { width: 100%; font-size: 1rem; padding: 13px 14px; }
.quiz-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.quiz-foot-left { display: flex; gap: 8px; }
.btn-plain { background: none; border-color: transparent; box-shadow: none; color: var(--muted); }
.btn-plain:hover { color: var(--text); background: var(--gray-soft); }
.quiz-wait { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 14px; padding-top: 40px; }

/* Ниша: плитки-заготовки + своё поле */
/* Строго три колонки: список ниш подобран так, чтобы делиться на три и
   не оставлять одинокую плитку в хвосте. auto-fill этого не гарантирует —
   число колонок там пляшет от ширины окна. */
.niche-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 700px) { .niche-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.niche-btn {
  padding: 11px 13px;
  text-align: left;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.niche-btn:hover { border-color: var(--accent); }
.niche-btn.active { border-color: var(--accent); background: var(--accent-soft); }
.niche-own { display: block; margin-top: 16px; }

/* Шаг с материалом: сначала да/нет, потом загрузка */
.asset-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.asset-upload .dropzone { margin-bottom: 14px; }
.asset-done {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: var(--success-soft);
  border: 1px solid var(--success-border);
  border-radius: var(--radius);
}
.asset-done strong { display: block; }
.asset-done p { margin: 2px 0 0; font-size: 0.88rem; }
.asset-done .btn { margin-left: auto; flex: none; }
.asset-check {
  flex: none;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--success);
  color: #fff;
  font-weight: 700;
}
@media (max-width: 620px) {
  .quiz-top { grid-template-columns: 1fr; gap: 10px; }
  .quiz-brand, .quiz-exit { justify-self: start; }
  .quiz-card .quiz-title { font-size: 1.5rem; }
  .asset-choice, .niche-grid { grid-template-columns: 1fr; }
}

/* --- Приёмка монтажа ------------------------------------------------------ */
.qc-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 0.9rem; }
.qc-list li { display: flex; gap: 8px; align-items: baseline; }
.qc-frame { flex: none; font-size: 0.78rem; font-weight: 700; color: var(--accent-strong); text-transform: uppercase; letter-spacing: 0.03em; }
.qc-hint { margin-top: 10px; font-size: 0.85rem; }
