:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --danger: #dc2626;
  --success: #16a34a;
  --warning: #f59e0b;
  --border: #e5e7eb;
  --soft: #eef2ff;
  --radius-lg: 22px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, Segoe UI, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(28px, 3vw, 42px); line-height: 1.05; letter-spacing: 0; }
h2 { font-size: 18px; margin-bottom: 10px; }
p { color: var(--muted); line-height: 1.55; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }

.app-shell { min-height: 100vh; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 76px;
  padding: 12px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: rgba(255,255,255,.86);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 12px; font-weight: 800; font-size: 20px; }
.brand-mark {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  border-radius: 12px;
  background: var(--primary);
  color: #fff;
  box-shadow: 0 10px 24px rgba(37, 99, 235, .28);
}
.brand-mark.large { width: 52px; height: 52px; border-radius: 16px; font-size: 24px; }
.top-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: 1;
}
.top-nav a {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  color: var(--muted);
  font-weight: 800;
}
.top-nav a:hover, .top-nav a.active {
  background: var(--soft);
  color: var(--primary);
}
.topbar-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}
.topbar strong { display: block; font-size: 18px; }
.main-content { padding: 32px; max-width: 1520px; margin: 0 auto; }
.user-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
}
.user-pill small { color: var(--muted); }
.eyebrow {
  display: inline-block;
  margin-bottom: 6px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
  background:
    radial-gradient(circle at 12% 10%, rgba(37,99,235,.12), transparent 28%),
    linear-gradient(135deg, #f8fbff, #eef3ff);
}
.login-page {
  width: min(1040px, 100%);
  display: grid;
  grid-template-columns: 1.15fr 420px;
  gap: 24px;
  align-items: stretch;
}
.login-visual, .login-card {
  border: 1px solid rgba(255,255,255,.72);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  background: rgba(255,255,255,.82);
}
.login-visual { padding: 42px; display: flex; flex-direction: column; justify-content: space-between; }
.login-visual h1 { max-width: 620px; font-size: clamp(38px, 5vw, 64px); }
.feature-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.feature-list div {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #fff;
}
.feature-list strong, .feature-list span { display: block; }
.feature-list span { color: var(--muted); margin-top: 6px; }
.login-card { padding: 32px; }
.hint { margin: 0; font-size: 13px; text-align: center; }

.card, .stat-card, .empty-state {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.card { padding: 22px; }
.stack { display: grid; gap: 16px; }
.narrow { max-width: 720px; }
.page-head, .editor-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 24px;
}
.actions, .row-actions, .thumb-actions, .show-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  width: auto;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  padding: 9px 14px;
  font-weight: 700;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { color: #fff; background: var(--primary); box-shadow: 0 12px 24px rgba(37,99,235,.2); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { color: var(--text); background: #fff; border-color: var(--border); }
.btn-danger { color: #fff; background: var(--danger); }
.btn-ghost { color: var(--muted); background: transparent; border-color: var(--border); }
.btn-block { width: 100%; }
.icon-btn {
  min-width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}
.danger-icon { color: var(--danger); }

.form-group { display: grid; gap: 7px; color: var(--muted); font-size: 14px; font-weight: 700; }
.form-control {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 11px 13px;
  background: #fff;
  color: var(--text);
}
.form-control:focus { outline: 3px solid rgba(37,99,235,.14); border-color: var(--primary); }
textarea.form-control { resize: vertical; }
.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; align-items: end; }
.form-card { padding: 28px; }
.form-section { display: grid; gap: 12px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.two-cols { grid-template-columns: 1fr 1fr; align-items: end; }
.toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #fff;
  color: var(--text);
  font-weight: 700;
}
.toggle input { width: auto; }
.file-drop {
  min-height: 74px;
  padding: 14px;
  border: 1px dashed #bfcbda;
  border-radius: var(--radius-md);
  background: #f8fafc;
}
.file-drop.is-dragover { border-color: var(--primary); background: #eff6ff; }
.file-drop input { width: 100%; }
.alert, .warning {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: #991b1b;
}
.warning { border-color: #fde68a; background: #fffbeb; color: #92400e; }
.flash {
  margin: 0 0 18px;
  padding: 13px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  font-weight: 800;
}
.flash-success { border-color: #bbf7d0; background: #f0fdf4; color: #166534; }
.flash-error { border-color: #fecaca; background: #fef2f2; color: #991b1b; }
.hidden { display: none !important; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}
.stat-card { padding: 20px; }
.stat-card span { display: block; color: var(--muted); margin-bottom: 8px; }
.stat-card strong { font-size: 34px; }
.presentation-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px;
}
.presentation-card { overflow: hidden; padding: 0; }
.presentation-cover {
  height: 150px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #1e293b, #2563eb);
  color: #fff;
}
.presentation-cover span { font-size: 44px; font-weight: 900; }
.presentation-cover small { margin-top: -34px; opacity: .78; }
.presentation-body { padding: 20px; }
.card-top { display: flex; justify-content: space-between; gap: 12px; }
.meta-row { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 14px; margin: 14px 0; }
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 9px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}
.badge-image { background: #ecfeff; color: #0e7490; }
.badge-video { background: #fef3c7; color: #b45309; }
.badge-vks { background: #eef2ff; color: #4338ca; }
.badge-success { background: #dcfce7; color: #15803d; }
.badge-danger { background: #fee2e2; color: #b91c1c; }
.empty-state {
  grid-column: 1 / -1;
  padding: 36px;
  text-align: center;
}
.empty-state.compact { padding: 18px; box-shadow: none; }

.editor-head {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: var(--shadow);
}
.deck-title-form {
  display: flex;
  gap: 14px;
  align-items: center;
  flex: 1;
}
.title-input, .description-input {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
}
.title-input { font-size: 26px; font-weight: 900; }
.description-input { color: var(--muted); resize: none; }
.title-input:focus, .description-input:focus { outline: 0; }
.editor-layout {
  display: grid;
  grid-template-columns: 230px minmax(420px, 1fr) 360px;
  gap: 18px;
  align-items: start;
}
.slide-strip, .properties-panel {
  position: sticky;
  top: 92px;
  max-height: calc(100vh - 112px);
  overflow: auto;
}
.slide-strip, .slide-canvas-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: var(--shadow);
  padding: 16px;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel-head h2 { margin: 0; }
.slide-thumbs { display: grid; gap: 10px; }
.pdf-import-card {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #f8fafc;
}
.pdf-import-card h3 { margin-bottom: 6px; font-size: 16px; }
.pdf-import-card p { margin-bottom: 0; font-size: 13px; }
.slide-thumb {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #fff;
  overflow: hidden;
}
.slide-thumb.active { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.thumb-main {
  width: 100%;
  border: 0;
  background: #f8fafc;
  padding: 12px;
  text-align: left;
  display: grid;
  gap: 8px;
}
.thumb-number { font-weight: 900; color: var(--primary); }
.thumb-actions { padding: 8px; justify-content: space-between; }
.slide-canvas-panel { min-height: 540px; display: grid; align-content: center; gap: 14px; }
.slide-canvas {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid #cbd5e1;
  background: #0f172a;
  color: #fff;
}
.slide-canvas img { width: 100%; height: 100%; object-fit: contain; }
.canvas-placeholder {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 24px;
  text-align: center;
}
.canvas-placeholder strong { font-size: 24px; }
.canvas-placeholder p { color: #cbd5e1; margin: 0; word-break: break-word; }
.editor-hint { text-align: center; color: var(--muted); font-size: 13px; }
.properties-panel { display: grid; gap: 16px; }
.type-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.type-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #f8fafc;
  padding: 12px;
  text-align: left;
}
.type-card.active { border-color: var(--primary); background: #eff6ff; }
.type-card strong, .type-card span { display: block; }
.type-card span { margin-top: 4px; color: var(--muted); font-size: 12px; }

.table-card { padding: 0; overflow: hidden; }
.table-toolbar { display: flex; justify-content: space-between; gap: 12px; padding: 18px; border-bottom: 1px solid var(--border); }
.table-toolbar .form-control { max-width: 360px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { padding: 14px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; }

.show-body { background: #070b13; color: #f8fafc; overflow: hidden; }
.show-body:focus { outline: none; }
.show-layout {
  height: 100vh;
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  transition: grid-template-columns .18s ease;
}
.show-body.previews-collapsed .show-layout {
  grid-template-columns: 34px minmax(0, 1fr);
}
.preview-rail {
  position: relative;
  padding: 16px;
  overflow-y: auto;
  background: #0f172a;
  border-right: 1px solid #1e293b;
}
.show-body.previews-collapsed .preview-rail {
  padding: 10px 6px;
  overflow: hidden;
}
.preview-item {
  width: 100%;
  aspect-ratio: 16 / 9;
  margin-bottom: 12px;
  border: 1px solid #334155;
  border-radius: 14px;
  display: grid;
  align-content: end;
  justify-items: start;
  gap: 4px;
  padding: 10px;
  background-color: #111827;
  background-size: cover;
  background-position: center;
  color: #cbd5e1;
  text-align: left;
  overflow: hidden;
  position: relative;
}
.show-body.previews-collapsed .preview-item {
  display: none;
}
.preview-item.active { border-color: #60a5fa; box-shadow: 0 0 0 3px rgba(96,165,250,.2); }
.preview-item strong {
  min-width: 24px;
  min-height: 24px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(15, 23, 42, .78);
  color: #fff;
  font-size: 12px;
}
.preview-item span {
  max-width: 100%;
  padding: 4px 7px;
  border-radius: 8px;
  background: rgba(15, 23, 42, .72);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.preview-item i {
  position: absolute;
  top: 8px;
  right: 8px;
  min-width: 30px;
  min-height: 24px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(37, 99, 235, .86);
  color: #fff;
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
}
.preview-video {
  background:
    radial-gradient(circle at 50% 38%, rgba(96,165,250,.28), transparent 26%),
    linear-gradient(135deg, #0f172a, #1e293b);
}
.preview-vks {
  background:
    radial-gradient(circle at 22% 22%, rgba(34,197,94,.18), transparent 26%),
    linear-gradient(135deg, #111827, #172554);
}
.preview-toggle {
  position: sticky;
  top: 0;
  z-index: 5;
  width: 100%;
  min-height: 28px;
  margin-bottom: 10px;
  border: 1px solid #334155;
  border-radius: 9px;
  background: #111827;
  color: #cbd5e1;
  font-size: 18px;
  font-weight: 900;
}
.show-body.previews-collapsed .preview-toggle {
  min-height: 44px;
  padding: 0;
}
.stage-wrap {
  min-width: 0;
  padding: 18px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto auto;
  gap: 12px;
}
.show-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border: 1px solid #1e293b;
  border-radius: 18px;
  background: rgba(15,23,42,.78);
}
.show-stage {
  width: min(100%, calc((100vh - 184px) * 16 / 9));
  aspect-ratio: 16 / 9;
  margin: auto;
  border: 1px solid #334155;
  border-radius: 20px;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: #020617;
  box-shadow: 0 28px 90px rgba(0,0,0,.35);
  opacity: 1;
  transition: opacity .18s ease;
}
.show-stage.is-switching { opacity: .35; }
.show-stage img, .show-stage video, .show-stage iframe {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border: 0;
}
.show-stage iframe { object-fit: fill; }
.stage-placeholder {
  display: grid;
  gap: 14px;
  place-items: center;
  padding: 28px;
  color: #cbd5e1;
  text-align: center;
}
.show-controls { justify-content: center; }
.speaker-notes {
  max-width: 980px;
  width: 100%;
  margin: 0 auto;
  padding: 14px 16px;
  border: 1px solid #334155;
  border-radius: 16px;
  background: #0f172a;
  color: #e2e8f0;
}
.shortcut-bar { text-align: center; color: #94a3b8; font-size: 12px; }

#blank-screen-overlay {
  position: fixed;
  inset: 0;
  z-index: 999999;
}

#blank-screen-overlay.blank-screen-black {
  background: #000;
}

#blank-screen-overlay.blank-screen-white {
  background: #fff;
}

#clicker-key-debug {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 1000000;
  max-width: calc(100vw - 36px);
  padding: 10px 12px;
  border: 1px solid #334155;
  border-radius: 10px;
  background: rgba(15, 23, 42, .92);
  color: #e2e8f0;
  font-size: 13px;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity .15s ease, transform .15s ease;
}

#clicker-key-debug.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1180px) {
  .editor-layout { grid-template-columns: 210px 1fr; }
  .properties-panel { grid-column: 1 / -1; position: static; max-height: none; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
}
@media (max-width: 900px) {
  .topbar {
    position: static;
    padding-left: 18px;
    padding-right: 18px;
    flex-wrap: wrap;
  }
  .top-nav {
    order: 3;
    flex: 1 0 100%;
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 2px;
  }
  .top-nav a { white-space: nowrap; }
  .topbar-right { margin-left: auto; }
  .main-content { padding-left: 18px; padding-right: 18px; }
  .login-page, .editor-layout, .show-layout { grid-template-columns: 1fr; }
  .feature-list, .stats-grid, .form-grid, .type-cards, .two-cols { grid-template-columns: 1fr; }
  .slide-strip, .properties-panel { position: static; max-height: none; }
  .show-body { overflow: auto; }
  .show-layout { height: auto; min-height: 100vh; }
  .show-body.previews-collapsed .show-layout { grid-template-columns: 1fr; }
  .preview-rail { display: flex; gap: 10px; overflow-x: auto; border-right: 0; border-bottom: 1px solid #1e293b; }
  .preview-item { min-width: 150px; margin-bottom: 0; }
  .preview-toggle { position: sticky; left: 0; min-width: 40px; width: 40px; margin: 0; }
  .show-body.previews-collapsed .preview-rail { min-height: 56px; padding: 8px; }
  .show-top, .page-head, .editor-head, .deck-title-form { flex-direction: column; align-items: stretch; }
}

/* SlideFlow reference theme */
:root {
  --sf-bg: #f7f9fd;
  --sf-panel: #ffffff;
  --sf-line: #dfe6f2;
  --sf-text: #101828;
  --sf-muted: #667085;
  --sf-blue: #175cff;
  --sf-blue-dark: #064de8;
  --sf-blue-soft: #eef4ff;
  --sf-green-soft: #dcf8df;
  --sf-green: #178a31;
  --sf-orange-soft: #fff0df;
  --sf-orange: #e26315;
  --sf-radius: 18px;
  --sf-shadow: 0 14px 38px rgba(16, 24, 40, .08);
}

body {
  background: var(--sf-bg);
  color: var(--sf-text);
}

.slideflow-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.app-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 22px 18px;
  background: #fff;
  border-right: 1px solid var(--sf-line);
}

.app-area {
  min-width: 0;
  display: grid;
  grid-template-rows: 72px minmax(0, 1fr);
}

.sf-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #0f172a;
  font-size: 26px;
  font-weight: 900;
}

.sf-logo {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 4px solid var(--sf-blue);
  border-radius: 10px;
  color: var(--sf-blue);
  font-size: 16px;
  line-height: 1;
}

.sf-nav {
  display: grid;
  gap: 14px;
}

.sf-nav a {
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 18px;
  border-radius: 12px;
  color: #26334d;
  font-size: 16px;
  font-weight: 800;
}

.sf-nav a span {
  width: 24px;
  color: #66758f;
  font-size: 22px;
}

.sf-nav a.active,
.sf-nav a:hover {
  background: var(--sf-blue-soft);
  color: var(--sf-blue);
}

.sf-nav a.active span,
.sf-nav a:hover span {
  color: var(--sf-blue);
}

.storage-card {
  margin-top: auto;
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--sf-line);
  border-radius: 14px;
  background: #fff;
}

.storage-card strong,
.storage-card span {
  display: block;
}

.storage-card span {
  color: #344054;
  font-size: 14px;
}

.storage-bar {
  height: 7px;
  border-radius: 999px;
  background: #e7ecf5;
  overflow: hidden;
}

.storage-bar i {
  display: block;
  width: 28%;
  height: 100%;
  border-radius: inherit;
  background: var(--sf-blue);
}

.sf-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 28px;
  background: #fff;
  border-bottom: 1px solid var(--sf-line);
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 18px;
  color: #667085;
}

.breadcrumb a {
  color: #667085;
  font-size: 20px;
}

.breadcrumb strong {
  color: #26334d;
  font-size: 15px;
}

.avatar {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #dbeafe, #bfdbfe);
  color: #1d4ed8;
  font-weight: 900;
}

.logout-icon {
  font-size: 32px;
  color: #0f172a;
}

.user-pill {
  border: 0;
  padding: 0;
  background: transparent;
  display: grid;
  gap: 2px;
}

.user-pill span {
  font-weight: 900;
}

.main-content {
  max-width: none;
  width: 100%;
  padding: 20px 26px 26px;
}

.btn {
  border-radius: 10px;
  min-height: 46px;
  font-weight: 800;
}

.btn-primary {
  background: var(--sf-blue);
  box-shadow: 0 10px 20px rgba(23, 92, 255, .2);
}

.btn-primary:hover {
  background: var(--sf-blue-dark);
}

.btn-secondary {
  border-color: #cfd8e8;
}

.btn-danger-outline {
  color: #ef1f1f;
  background: #fff;
  border: 1px solid #ffb8b8;
}

.sf-editor {
  display: grid;
  grid-template-columns: 340px minmax(520px, 1fr) 360px;
  gap: 14px;
  height: calc(100vh - 118px);
  min-height: 720px;
}

.sf-slides-panel,
.sf-stage-panel,
.sf-properties-panel {
  min-height: 0;
  background: #fff;
  border: 1px solid var(--sf-line);
  border-radius: var(--sf-radius);
  box-shadow: var(--sf-shadow);
}

.sf-slides-panel {
  display: flex;
  flex-direction: column;
  padding: 20px;
  overflow: hidden;
}

.sf-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.sf-panel-head h2 {
  margin: 0;
  font-size: 20px;
}

.search-icon {
  width: 34px;
  height: 34px;
  border: 0;
  background: transparent;
  color: #344054;
  font-size: 28px;
}

.slide-create-box {
  margin-bottom: 12px;
}

.slide-create-box summary {
  list-style: none;
}

.slide-create-box summary::-webkit-details-marker {
  display: none;
}

.slide-create-box[open] {
  display: grid;
  gap: 12px;
  padding-bottom: 12px;
}

.slide-create-box[open] summary {
  margin-bottom: 12px;
}

.pdf-import-inline {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.pdf-import-inline label {
  min-height: 46px;
  display: grid;
  place-items: center;
  border: 1px solid #b7c9ff;
  border-radius: 10px;
  background: #fff;
  color: #1f2a44;
  font-weight: 900;
  cursor: pointer;
}

.pdf-import-inline input {
  display: none;
}

.pdf-import-inline p {
  margin: 0;
  color: var(--sf-muted);
  font-size: 12px;
  line-height: 1.35;
}

.sf-slide-list {
  display: grid;
  gap: 10px;
  padding-right: 2px;
  overflow: auto;
}

.sf-slide-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 2px solid transparent;
  border-radius: 12px;
}

.sf-slide-item.active {
  border-color: var(--sf-blue);
  background: #f7faff;
}

.sf-slide-select {
  min-width: 0;
  display: grid;
  grid-template-columns: 24px 158px auto;
  align-items: center;
  gap: 12px;
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
}

.slide-index {
  color: #0f5cff;
  font-size: 16px;
  font-weight: 900;
}

.slide-preview {
  width: 158px;
  aspect-ratio: 16 / 9;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid #d8e0ed;
  border-radius: 8px;
  background: #0f1d33;
  color: #fff;
}

.slide-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.slide-preview i {
  font-style: normal;
  font-size: 28px;
}

.sf-slide-item .thumb-actions {
  display: none;
  grid-template-columns: repeat(3, 30px);
  gap: 4px;
}

.sf-slide-item:hover .thumb-actions,
.sf-slide-item.active .thumb-actions {
  display: grid;
}

.sf-stage-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  gap: 14px;
  padding: 20px;
}

.sf-stage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.sf-stage-head .deck-title-form {
  min-width: 0;
  display: flex;
  flex: 1;
  gap: 14px;
}

.sf-stage-head .title-input {
  font-size: 22px;
  font-weight: 900;
}

.sf-slide-canvas {
  width: 100%;
  aspect-ratio: 16 / 9;
  align-self: center;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 10px;
  background:
    radial-gradient(circle at 85% 2%, rgba(120, 165, 255, .18), transparent 26%),
    linear-gradient(135deg, #12294a, #07152b);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
}

.sf-slide-canvas img,
.sf-slide-canvas video,
.sf-slide-canvas iframe {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.canvas-vks-card {
  width: min(560px, 78%);
  min-height: 320px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 14px;
  padding: 34px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 16px;
  background: rgba(7, 21, 43, .5);
  text-align: center;
}

.canvas-vks-card strong {
  font-size: 36px;
  font-weight: 500;
}

.canvas-vks-card p {
  margin: 0;
  color: rgba(255,255,255,.84);
}

.sf-stage-controls {
  min-height: 66px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 10px;
  border: 1px solid var(--sf-line);
  border-radius: 14px;
  background: #fff;
}

.sf-stage-controls .spacer {
  flex: 1;
}

#editorSlideCounter {
  min-width: 70px;
  text-align: center;
  color: #1f2a44;
  font-weight: 900;
}

.speaker-card {
  min-height: 112px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 20px;
  border: 1px solid var(--sf-line);
  border-radius: 14px;
  background: #fff;
}

.speaker-card h3 {
  margin-bottom: 8px;
  font-size: 17px;
}

.speaker-card p {
  margin: 0;
  color: #1f2a44;
}

.sf-properties-panel {
  padding: 20px;
  overflow: auto;
}

.sf-properties-card {
  display: grid;
  gap: 18px;
}

.sf-properties-card h2 {
  margin: 0;
  font-size: 20px;
}

.sf-properties-panel .form-group {
  color: #26334d;
  font-size: 14px;
  font-weight: 800;
}

.sf-properties-panel .form-control {
  min-height: 48px;
  border-color: #d6deea;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(16, 24, 40, .03);
}

.sf-properties-panel textarea.form-control {
  min-height: 116px;
}

.sf-properties-panel .toggle {
  justify-content: space-between;
  border: 0;
  padding: 0;
  background: transparent;
}

.sf-properties-panel .toggle input {
  appearance: none;
  width: 46px;
  height: 26px;
  border-radius: 999px;
  background: #d7dfec;
  position: relative;
}

.sf-properties-panel .toggle input::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: left .18s ease;
}

.sf-properties-panel .toggle input:checked {
  background: var(--sf-blue);
}

.sf-properties-panel .toggle input:checked::after {
  left: 23px;
}

.badge-image {
  background: var(--sf-green-soft);
  color: var(--sf-green);
  text-transform: none;
}

.badge-video {
  background: var(--sf-orange-soft);
  color: var(--sf-orange);
  text-transform: none;
}

.badge-vks {
  background: #e8f0ff;
  color: var(--sf-blue);
  text-transform: none;
}

@media (max-width: 1280px) {
  .slideflow-shell {
    grid-template-columns: 230px minmax(0, 1fr);
  }
  .sf-editor {
    grid-template-columns: 300px minmax(420px, 1fr);
    height: auto;
  }
  .sf-properties-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 900px) {
  .slideflow-shell {
    grid-template-columns: 1fr;
  }
  .app-sidebar {
    position: static;
    height: auto;
  }
  .app-area {
    grid-template-rows: auto minmax(0, 1fr);
  }
  .sf-topbar {
    min-height: 68px;
    flex-wrap: wrap;
    padding: 14px 18px;
  }
  .sf-editor {
    grid-template-columns: 1fr;
    min-height: 0;
  }
  .sf-slide-select {
    grid-template-columns: 24px 132px auto;
  }
  .slide-preview {
    width: 132px;
  }
}

/* Compact desktop pass: keep the SlideFlow layout inside 1366x768. */
body {
  overflow-x: hidden;
}

.slideflow-shell {
  grid-template-columns: 210px minmax(0, 1fr);
}

.app-area {
  min-width: 0;
}

.app-sidebar {
  padding: 18px 14px;
  gap: 18px;
}

.sf-brand {
  font-size: 22px;
}

.sf-logo {
  width: 30px;
  height: 30px;
  border-width: 3px;
}

.sf-nav {
  gap: 8px;
}

.sf-nav a {
  min-height: 46px;
  gap: 10px;
  padding: 0 12px;
  font-size: 15px;
}

.sf-nav a span {
  width: 20px;
  font-size: 18px;
}

.storage-card {
  padding: 14px;
  gap: 9px;
}

.sf-topbar {
  min-height: 60px;
  padding: 0 22px;
}

.app-area {
  grid-template-rows: 60px minmax(0, 1fr);
}

.main-content {
  padding: 14px;
  min-width: 0;
}

.btn {
  min-height: 38px;
  padding: 7px 12px;
  border-radius: 9px;
  font-size: 14px;
}

.btn-block {
  width: 100%;
}

.icon-btn {
  min-width: 26px;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  font-size: 13px;
}

.sf-editor {
  grid-template-columns: 280px minmax(0, 1fr) 300px;
  gap: 10px;
  height: calc(100vh - 88px);
  min-height: 0;
}

.sf-slides-panel,
.sf-stage-panel,
.sf-properties-panel {
  border-radius: 14px;
}

.sf-slides-panel,
.sf-stage-panel,
.sf-properties-panel {
  padding: 14px;
}

.sf-panel-head {
  margin-bottom: 10px;
}

.sf-panel-head h2 {
  font-size: 18px;
}

.slide-create-box {
  margin-bottom: 8px;
}

.pdf-import-inline {
  gap: 6px;
  margin-bottom: 10px;
}

.pdf-import-inline label {
  min-height: 38px;
  font-size: 14px;
}

.pdf-import-inline p {
  display: none;
}

.sf-slide-list {
  gap: 7px;
}

.sf-slide-item {
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
  padding: 6px;
  border-width: 1px;
}

.sf-slide-select {
  grid-template-columns: 20px 118px minmax(68px, 1fr);
  gap: 8px;
}

.slide-index {
  font-size: 14px;
}

.slide-preview {
  width: 118px;
  border-radius: 7px;
}

.sf-slide-item .thumb-actions {
  grid-template-columns: repeat(3, 26px);
  justify-content: end;
}

.sf-stage-panel {
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  gap: 10px;
}

.sf-stage-head {
  gap: 10px;
}

.sf-stage-head .deck-title-form {
  gap: 10px;
}

.sf-stage-head .title-input {
  font-size: 18px;
}

.description-input {
  display: none;
}

.sf-slide-canvas {
  align-self: center;
  max-height: calc(100vh - 290px);
  min-height: 260px;
}

.canvas-vks-card {
  width: min(420px, 82%);
  min-height: 220px;
  gap: 10px;
  padding: 22px;
}

.canvas-vks-card strong {
  font-size: 28px;
}

.sf-stage-controls {
  min-height: 50px;
  gap: 10px;
  padding: 7px;
  border-radius: 12px;
}

.speaker-card {
  min-height: 86px;
  padding: 14px;
  border-radius: 12px;
}

.speaker-card h3 {
  font-size: 15px;
  margin-bottom: 5px;
}

.speaker-card p {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 14px;
}

.sf-properties-panel {
  overflow: auto;
}

.sf-properties-card {
  gap: 12px;
}

.sf-properties-card h2 {
  font-size: 18px;
}

.sf-properties-panel .form-group {
  gap: 6px;
  font-size: 13px;
}

.sf-properties-panel .form-control {
  min-height: 40px;
  padding: 8px 10px;
  border-radius: 9px;
  font-size: 14px;
}

.sf-properties-panel textarea.form-control {
  min-height: 84px;
}

.sf-properties-panel .toggle input {
  width: 40px;
  height: 22px;
}

.sf-properties-panel .toggle input::after {
  width: 16px;
  height: 16px;
}

.sf-properties-panel .toggle input:checked::after {
  left: 21px;
}

@media (max-width: 1360px) {
  .slideflow-shell {
    grid-template-columns: 190px minmax(0, 1fr);
  }
  .sf-editor {
    grid-template-columns: 250px minmax(0, 1fr) 280px;
  }
  .sf-nav a {
    font-size: 14px;
  }
  .storage-card {
    display: none;
  }
  .sf-slide-select {
    grid-template-columns: 18px 104px minmax(58px, 1fr);
    gap: 7px;
  }
  .slide-preview {
    width: 104px;
  }
}

@media (max-width: 900px) {
  .slideflow-shell {
    grid-template-columns: 1fr;
  }
  .app-sidebar {
    position: static;
    height: auto;
  }
  .app-area {
    grid-template-rows: auto minmax(0, 1fr);
  }
  .sf-editor {
    grid-template-columns: 1fr;
    height: auto;
  }
  .sf-properties-panel {
    grid-column: auto;
  }
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, .42);
  backdrop-filter: blur(8px);
}

body.modal-open {
  overflow: hidden;
}

.modal-card {
  width: min(720px, 100%);
  max-height: min(760px, calc(100vh - 48px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--sf-line);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 28px 80px rgba(15, 23, 42, .22);
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px 16px;
  border-bottom: 1px solid var(--sf-line);
}

.modal-head h2 {
  margin: 0;
  font-size: 24px;
}

.modal-close {
  width: 38px;
  height: 38px;
  border: 1px solid var(--sf-line);
  border-radius: 10px;
  background: #fff;
  color: #1f2a44;
  font-size: 24px;
  line-height: 1;
}

.modal-form {
  overflow-y: auto;
  padding: 22px 24px 24px;
  overscroll-behavior: contain;
}

.modal-form.stack {
  gap: 16px;
}

.modal-form .type-cards {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.modal-form .type-card {
  min-height: 78px;
  padding: 14px;
  border-radius: 12px;
}

.modal-form .form-group,
.modal-form .file-drop,
.modal-form .toggle {
  padding: 12px;
  border: 1px solid #d6deea;
  border-radius: 12px;
  background: #fff;
}

.modal-form .form-control {
  min-height: 42px;
}

.modal-form textarea.form-control {
  min-height: 96px;
}

.modal-actions {
  position: sticky;
  bottom: -24px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin: 8px -24px -24px;
  padding: 16px 24px;
  border-top: 1px solid var(--sf-line);
  background: #fff;
}

@media (max-width: 640px) {
  .modal-backdrop {
    padding: 12px;
    align-items: stretch;
  }
  .modal-card {
    max-height: calc(100vh - 24px);
  }
  .modal-form .type-cards {
    grid-template-columns: 1fr;
  }
  .modal-actions {
    flex-direction: column-reverse;
  }
  .modal-actions .btn {
    width: 100%;
  }
}

.guest-editor-block {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--sf-line);
  border-radius: 12px;
  background: #f8fbff;
}

.guest-editor-head,
.guest-card-main,
.guest-card-actions,
.show-guest-panel header,
.show-guest-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.guest-editor-head {
  justify-content: space-between;
}

.guest-editor-head h3 {
  margin: 0 0 4px;
  font-size: 16px;
}

.guest-editor-head p,
.guest-empty {
  margin: 0;
  font-size: 12px;
  line-height: 1.35;
}

.guest-add-form,
.guest-card-list {
  display: grid;
  gap: 10px;
}

.guest-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid #dce4f0;
  border-radius: 10px;
  background: #fff;
}

.guest-card-main {
  justify-content: space-between;
  align-items: flex-start;
}

.guest-card-main strong,
.guest-card-main span {
  display: block;
}

.guest-card-main span {
  color: var(--sf-muted);
  font-size: 12px;
}

.guest-link-input {
  min-height: 36px !important;
  font-size: 12px !important;
}

.guest-card-actions {
  flex-wrap: wrap;
}

.guest-card-actions .btn {
  min-height: 34px;
  padding: 6px 10px;
  font-size: 12px;
}

.guest-body {
  min-height: 100vh;
  background: linear-gradient(135deg, #0b1730, #143b72);
  color: #f8fafc;
}

.guest-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.guest-panel {
  width: min(760px, 100%);
  display: grid;
  gap: 16px;
  padding: 24px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 18px;
  background: rgba(7, 21, 43, .72);
  box-shadow: 0 24px 80px rgba(0,0,0,.28);
}

.guest-head h1 {
  margin-bottom: 8px;
  font-size: 30px;
}

.guest-head p {
  margin: 0;
  color: #cbd5e1;
}

.guest-status-card,
.guest-target,
.guest-audio {
  padding: 14px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 12px;
  background: rgba(15, 23, 42, .66);
}

.guest-status-card strong,
.guest-status-card span,
.guest-target span,
.guest-target strong {
  display: block;
}

.guest-status-card span,
.guest-target span {
  margin-top: 4px;
  color: #cbd5e1;
  font-size: 13px;
}

.guest-preview {
  aspect-ratio: 16 / 9;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 12px;
  background: #020617;
}

.guest-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.guest-preview-placeholder {
  display: grid;
  gap: 6px;
  place-items: center;
  padding: 24px;
  color: #cbd5e1;
  text-align: center;
}

.guest-preview-placeholder strong,
.guest-preview-placeholder span {
  display: block;
}

.guest-audio audio {
  width: 100%;
}

.guest-connect:disabled {
  opacity: .55;
  cursor: wait;
  transform: none;
}

.show-guest-panel {
  max-width: 980px;
  width: 100%;
  margin: 0 auto;
  padding: 12px;
  border: 1px solid #334155;
  border-radius: 16px;
  background: #0f172a;
  color: #e2e8f0;
}

.show-guest-panel header {
  justify-content: space-between;
  margin-bottom: 10px;
}

.show-guest-panel header span {
  min-width: 28px;
  min-height: 24px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: #1d4ed8;
  color: #fff;
  font-weight: 900;
}

#showGuestList {
  display: grid;
  gap: 8px;
}

.show-guest-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid #1e293b;
  border-radius: 12px;
  background: #111827;
}

.show-guest-card strong,
.show-guest-card span {
  display: block;
}

.show-guest-card span {
  margin-top: 3px;
  color: #94a3b8;
  font-size: 13px;
}

.show-guest-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.show-guest-actions .btn {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 12px;
}

@media (max-width: 720px) {
  .show-guest-card {
    grid-template-columns: 1fr;
  }
  .show-guest-actions {
    justify-content: flex-start;
  }
}

/* Button hygiene pass: keep actions compact and inside their containers. */
.btn,
.icon-btn,
.type-card,
.preview-item,
.sf-slide-select,
.pdf-import-inline label,
.modal-close,
.search-icon {
  flex-shrink: 0;
}

.btn {
  max-width: 100%;
  min-width: 0;
  line-height: 1.2;
  white-space: normal;
  text-align: center;
  overflow-wrap: anywhere;
}

.btn-block {
  flex-shrink: 1;
}

.actions,
.row-actions,
.thumb-actions,
.show-controls,
.sf-stage-controls,
.modal-actions,
.guest-card-actions,
.show-guest-actions {
  min-width: 0;
}

.actions form,
.row-actions form,
.thumb-actions form,
.guest-card-actions form,
.show-guest-actions form {
  min-width: 0;
  margin: 0;
}

.actions .btn,
.row-actions .btn,
.modal-actions .btn {
  min-height: 36px;
}

.presentation-card .actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.presentation-card .actions form,
.presentation-card .actions .btn {
  width: 100%;
}

.presentation-card .actions form:last-child {
  grid-column: 1 / -1;
}

.table-toolbar {
  align-items: center;
}

.table-toolbar .badge {
  flex-shrink: 0;
}

.row-actions {
  justify-content: flex-end;
  max-width: 360px;
}

.row-actions .btn {
  min-height: 32px;
  padding: 6px 9px;
  font-size: 12px;
}

.sf-stage-head > .btn {
  min-width: 150px;
}

.sf-stage-controls {
  flex-wrap: wrap;
  justify-content: center;
}

.sf-stage-controls .btn {
  min-width: 126px;
  min-height: 36px;
}

.sf-stage-controls .spacer {
  min-width: 0;
}

.show-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.show-controls .btn {
  min-height: 36px;
  padding: 7px 11px;
}

.show-meta .btn {
  min-height: 34px;
  padding: 6px 10px;
}

.storage-card .btn,
.pdf-import-inline .btn,
.guest-add-form .btn,
.guest-connect {
  width: 100%;
}

.guest-card-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.guest-card-actions form,
.guest-card-actions .btn {
  width: 100%;
}

.show-guest-actions .btn {
  min-width: 82px;
}

.modal-actions .btn {
  min-width: 112px;
}

.modal-close,
.search-icon,
.icon-btn {
  display: inline-grid;
  place-items: center;
  padding: 0;
  line-height: 1;
}

@media (max-width: 1360px) {
  .sf-stage-head > .btn {
    min-width: 128px;
  }
  .sf-stage-controls .btn {
    min-width: 112px;
  }
  .row-actions {
    max-width: 300px;
  }
}

@media (max-width: 900px) {
  .page-head > .btn {
    width: 100%;
  }
  .presentation-card .actions,
  .guest-card-actions {
    grid-template-columns: 1fr;
  }
  .row-actions {
    justify-content: flex-start;
    max-width: none;
  }
  .row-actions .btn,
  .row-actions form {
    width: 100%;
  }
  .sf-stage-head > .btn,
  .sf-stage-controls .btn,
  .show-controls .btn {
    min-width: 0;
    flex: 1 1 150px;
  }
}

@media (max-width: 520px) {
  .actions .btn,
  .actions form,
  .modal-actions .btn,
  .show-guest-actions .btn {
    width: 100%;
  }
  .sf-stage-controls,
  .show-controls,
  .show-meta {
    align-items: stretch;
  }
}

/* Presentation editor button fixes. */
.sf-editor .btn {
  min-height: 36px;
  padding: 7px 10px;
  font-size: 13px;
}

.sf-stage-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.sf-stage-head .deck-title-form {
  min-width: 0;
}

.sf-stage-head .deck-title-form > div {
  min-width: 0;
}

.deck-save-btn {
  width: 92px;
  min-width: 92px;
}

.deck-show-btn {
  width: 142px;
  min-width: 142px;
}

.editor-add-slide,
.pdf-import-inline .btn {
  min-height: 36px;
}

.sf-slide-item {
  position: relative;
  min-width: 0;
}

.sf-slide-select {
  width: 100%;
  min-width: 0;
}

.sf-slide-item .thumb-actions {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 2;
  width: auto;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 24px);
  gap: 4px;
  opacity: 0;
  pointer-events: none;
}

.sf-slide-item:hover .thumb-actions,
.sf-slide-item.active .thumb-actions {
  opacity: 1;
  pointer-events: auto;
}

.sf-slide-item .icon-btn {
  width: 24px;
  min-width: 24px;
  height: 24px;
  border-radius: 7px;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 4px 12px rgba(16, 24, 40, .12);
}

.sf-stage-controls {
  flex-wrap: nowrap;
  overflow: hidden;
}

.sf-stage-controls .editor-nav-btn {
  flex: 0 1 132px;
  min-width: 104px;
}

.sf-stage-controls .editor-tool-btn {
  width: 36px;
  min-width: 36px;
  height: 36px;
  padding: 0;
  font-size: 16px;
}

.sf-stage-controls .spacer {
  flex: 1 1 16px;
}

.speaker-card {
  align-items: center;
}

.speaker-card > div {
  min-width: 0;
}

.speaker-edit-btn {
  width: 92px;
  min-width: 92px;
}

.sf-properties-panel .guest-card-actions {
  grid-template-columns: 1fr;
}

.sf-properties-panel .guest-card-actions .btn,
.sf-properties-panel .guest-card-actions form {
  width: 100%;
}

.sf-properties-panel .btn-block {
  min-height: 38px;
}

@media (max-width: 1360px) {
  .deck-save-btn {
    width: 84px;
    min-width: 84px;
  }
  .deck-show-btn {
    width: 128px;
    min-width: 128px;
  }
  .sf-stage-controls .editor-nav-btn {
    flex-basis: 116px;
    min-width: 96px;
  }
}

@media (max-width: 900px) {
  .sf-stage-head {
    grid-template-columns: 1fr;
  }
  .deck-save-btn,
  .deck-show-btn,
  .speaker-edit-btn {
    width: 100%;
    min-width: 0;
  }
  .sf-stage-controls {
    flex-wrap: wrap;
  }
  .sf-stage-controls .editor-nav-btn {
    flex: 1 1 140px;
  }
}

@media (max-width: 1180px) {
  .show-body.has-guest-panel .stage-wrap {
    padding-right: 18px;
    grid-template-rows: auto minmax(260px, 1fr) auto auto minmax(140px, 26vh) auto;
  }
  .show-body.has-guest-panel .show-stage {
    width: min(100%, calc((100vh - 360px) * 16 / 9));
    height: auto;
  }
  .show-body.has-guest-panel .show-guest-panel {
    position: static;
    width: 100%;
    max-width: 980px;
    max-height: min(280px, 28vh);
    margin: 0 auto;
    box-shadow: none;
  }
}

/* LiveKit VKS module. */
.show-layout {
  min-height: 0;
}

.stage-wrap {
  height: 100vh;
  min-height: 0;
  overflow: hidden;
}

.show-body.has-guest-panel .stage-wrap {
  padding-right: 374px;
  grid-template-rows: auto minmax(0, 1fr) auto auto auto;
}

.show-body.has-guest-panel .show-stage {
  width: min(100%, calc((100vh - 184px) * 16 / 9));
  height: auto;
  min-height: 0;
  max-height: 100%;
  justify-self: center;
  align-self: center;
}

.show-guest-panel {
  min-height: 0;
  max-height: none;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.show-body.has-guest-panel .show-guest-panel {
  position: fixed;
  top: 18px;
  right: 18px;
  bottom: 18px;
  z-index: 35;
  width: 340px;
  max-width: calc(100vw - 36px);
  margin: 0;
  box-shadow: 0 24px 80px rgba(0,0,0,.35);
}

.show-guest-panel.hidden {
  display: none !important;
}

#showGuestList {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 4px;
}

.show-guest-panel > header {
  flex: 0 0 auto;
}

#showGuestList::-webkit-scrollbar {
  width: 8px;
}

#showGuestList::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: #334155;
}

.show-guest-card {
  flex-shrink: 0;
}

.livekit-stage {
  width: 100%;
  height: 100%;
  min-height: 360px;
  background: #0f172a;
  border-radius: 14px;
  overflow: hidden;
  color: #fff;
  position: relative;
}

.vks-livekit-placeholder {
  width: 100%;
  height: 100%;
  position: relative;
  display: block;
  padding: 0;
}

.vks-livekit-placeholder .livekit-stage {
  min-height: 100%;
  height: 100%;
  margin: 0;
  border-radius: 0;
}

.livekit-join-bar {
  position: absolute;
  left: 14px;
  right: 14px;
  top: 14px;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 12px;
  background: rgba(15, 23, 42, .82);
  backdrop-filter: blur(10px);
}

.livekit-join-bar strong,
.livekit-join-bar span {
  display: block;
}

.livekit-join-bar strong {
  color: #fff;
  font-size: 15px;
}

.livekit-join-bar span {
  margin-top: 2px;
  color: #bfdbfe;
  font-size: 12px;
}

.livekit-join-bar .btn {
  min-height: 34px;
  padding: 6px 10px;
  font-size: 13px;
}

.lk-status {
  padding: 12px 16px;
  color: #dbeafe;
  font-size: 14px;
}

.lk-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(150px, 220px);
  grid-auto-rows: minmax(140px, 1fr);
  gap: 12px;
  height: calc(100% - 76px);
  min-height: 240px;
  padding: 12px;
}

.lk-participant {
  min-height: 160px;
  overflow: hidden;
  position: relative;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 12px;
  background: #111827;
}

.lk-participant.lk-guest {
  grid-column: 1;
  grid-row: 1 / span 2;
  min-height: 320px;
}

.lk-participant.lk-speaker {
  grid-column: 2;
  min-height: 140px;
}

.lk-participant.lk-local.lk-speaker {
  opacity: .96;
}

.lk-participant-media {
  width: 100%;
  height: 100%;
  min-height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #020617;
}

.lk-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.lk-speaker .lk-video {
  object-fit: cover;
}

.lk-audio {
  display: none;
}

.lk-participant-name {
  position: absolute;
  left: 10px;
  bottom: 10px;
  max-width: calc(100% - 20px);
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(0,0,0,.55);
  color: #fff;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lk-controls {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.lk-controls .btn {
  min-height: 34px;
  padding: 6px 10px;
  font-size: 12px;
}

.guest-livekit-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 12px;
  background: rgba(15, 23, 42, .66);
}

.guest-livekit-panel h2 {
  margin: 0;
  color: #fff;
  font-size: 18px;
}

.guest-livekit-panel p {
  margin: 0;
  color: #cbd5e1;
}

.guest-livekit-panel .livekit-stage {
  min-height: 320px;
}

.livekit-room-line {
  margin: 0;
  color: #1f2a44;
  font-size: 13px;
  overflow-wrap: anywhere;
}

/* Final show-mode guest layout: side panel on desktop, bottom drawer on narrow screens. */
.show-body.has-guest-panel .stage-wrap {
  padding-right: 374px;
  grid-template-rows: auto minmax(0, 1fr) auto auto auto;
}

.show-body.has-guest-panel .show-stage {
  width: min(100%, calc((100vh - 184px) * 16 / 9));
  height: auto;
  max-height: 100%;
}

.show-body.has-guest-panel .show-guest-panel {
  position: fixed;
  top: 18px;
  right: 18px;
  bottom: 18px;
  z-index: 35;
  width: 340px;
  max-width: calc(100vw - 36px);
  max-height: none;
  margin: 0;
  box-shadow: 0 24px 80px rgba(0,0,0,.35);
}

@media (max-width: 1180px) {
  .show-body.has-guest-panel .stage-wrap {
    padding-right: 18px;
    grid-template-rows: auto minmax(260px, 1fr) auto auto minmax(140px, 26vh) auto;
  }
  .show-body.has-guest-panel .show-stage {
    width: min(100%, calc((100vh - 360px) * 16 / 9));
    height: auto;
  }
  .show-body.has-guest-panel .show-guest-panel {
    position: static;
    width: 100%;
    max-width: 980px;
    max-height: min(280px, 28vh);
    margin: 0 auto;
    box-shadow: none;
  }
}

@media (max-width: 720px) {
  .lk-grid {
    grid-template-columns: 1fr;
    grid-auto-rows: auto;
  }
  .lk-participant.lk-guest,
  .lk-participant.lk-speaker {
    grid-column: auto;
    grid-row: auto;
  }
  .lk-participant.lk-guest {
    min-height: 280px;
  }
  .lk-participant.lk-speaker {
    min-height: 130px;
  }
}
