:root {
  --p-bg: #f8fafc;
  --p-surface: #ffffff;
  --p-sidebar: #eef2f6;
  --p-border: #e2e8f0;
  --p-text: #0f172a;
  --p-muted: #64748b;
  --p-primary: #2563eb;
  --p-primary-hover: #1d4ed8;
  --p-emerald: #059669;
  --p-amber: #d97706;
  --p-radius: 10px;
  --p-shadow: 0 4px 20px rgba(15, 23, 42, 0.06);
}
* { box-sizing: border-box; }
body.pres-body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
  background: var(--p-bg);
  color: var(--p-text);
  height: 100vh;
  overflow: hidden;
}
#presentation-root, .pres-shell { display: flex; flex-direction: column; height: 100vh; }

/* Header */
.pres-header {
  height: 60px; background: #0f172a; color: #fff;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px; gap: 16px; border-bottom: 1px solid #1e293b; flex-shrink: 0;
}
.pres-brand { display: flex; align-items: center; gap: 10px; }
.pres-logo {
  width: 30px; height: 30px; border-radius: 7px;
  background: linear-gradient(135deg, #3b82f6, #10b981);
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 16px;
}
.pres-brand-title { font-weight: 700; font-size: 16px; letter-spacing: -0.01em; }
.pres-brand-sub { font-size: 12px; color: #94a3b8; margin-left: 6px; }
.pres-header-center { display: flex; align-items: center; gap: 10px; }
.pres-company-input {
  background: #1e293b; border: 1px solid #334155; color: #fff;
  padding: 7px 12px; border-radius: 7px; font-size: 13px; min-width: 220px;
}
.pres-company-input:focus { outline: none; border-color: #60a5fa; }
.pres-quota-pill {
  background: #1e293b; border: 1px solid #334155; padding: 6px 12px;
  border-radius: 999px; font-size: 12px; font-weight: 600; color: #cbd5e1;
}
.pres-header-right { display: flex; align-items: center; gap: 10px; }
.pres-lang-group { display: inline-flex; background: #1e293b; border-radius: 7px; padding: 2px; border: 1px solid #334155; }
.pres-lang-btn {
  border: none; background: transparent; color: #94a3b8; font-weight: 600;
  font-size: 12px; padding: 5px 10px; border-radius: 5px; cursor: pointer;
}
.pres-lang-btn.active { background: #3b82f6; color: #fff; }
.pres-hdr-btn {
  background: #1e293b; color: #e2e8f0; border: 1px solid #334155;
  padding: 7px 12px; border-radius: 7px; font-size: 12.5px; font-weight: 500; cursor: pointer;
}
.pres-hdr-btn:hover { background: #334155; }

/* Gate */
.pres-gate-wrap { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px; }
.pres-gate-card {
  width: 100%; max-width: 440px; background: var(--p-surface); border: 1px solid var(--p-border);
  border-radius: 16px; padding: 36px; box-shadow: 0 20px 50px rgba(15, 23, 42, 0.08);
}
.pres-field { margin-bottom: 16px; }
.pres-field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: #334155; }
.pres-input {
  width: 100%; padding: 10px 12px; border: 1px solid #cbd5e1; border-radius: 8px;
  font-size: 14px; transition: border-color 0.15s;
}
.pres-input:focus { outline: none; border-color: var(--p-primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.12); }
.pres-primary-btn {
  width: 100%; padding: 11px 16px; background: var(--p-primary); color: #fff;
  border: none; border-radius: 8px; font-weight: 600; font-size: 14px; cursor: pointer;
}
.pres-primary-btn:hover { background: var(--p-primary-hover); }
.pres-error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; padding: 10px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 14px; }

/* Workspace Layout: Pipeline Table + Functions Drawer
   (the old separate preview sidebar is gone -- thumbnails render inline per
   row in the table via thumb-card, so they scroll with the row they describe) */
.pres-main-layout { flex: 1; display: flex; min-height: 0; overflow: hidden; }
.pres-apple-sidebar {
  width: 196px; background: var(--p-sidebar); border-right: 1px solid #cbd5e1;
  display: flex; flex-direction: column; flex-shrink: 0; user-select: none;
}
.pres-sidebar-hdr {
  padding: 10px 14px; font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: #475569; border-bottom: 1px solid #dbe2ea;
  display: flex; justify-content: space-between;
}
.pres-thumb-list { flex: 1; overflow-y: auto; padding: 12px 14px; display: flex; flex-direction: column; gap: 14px; }
.pres-thumb-item { display: flex; flex-direction: column; align-items: center; cursor: pointer; position: relative; }
.pres-thumb-frame {
  width: 132px; background: #fff; border-radius: 4px; padding: 3px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.12); border: 2px solid transparent; transition: all 0.15s;
}
.pres-thumb-item.selected .pres-thumb-frame, .pres-thumb-frame.selected { border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,0.22); }
.pres-thumb-frame img { width: 100%; display: block; border-radius: 2px; }
.pres-thumb-num { margin-top: 5px; font-size: 11px; font-weight: 600; color: #475569; display: flex; align-items: center; gap: 5px; }
.pres-doc-pill { font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 99px; background: #dbeafe; color: #1e40af; }

/* Stacked-pages effect: a multi-page document's thumbnail shows 2 faint page
   edges peeking out behind the top (first-page) thumbnail, like a physical
   stack of paper -- purely visual, no functional meaning. */
.pres-thumb-stack { position: relative; display: inline-block; flex-shrink: 0; }
.pres-thumb-stack.multi::before,
.pres-thumb-stack.multi::after {
  content: ""; position: absolute; inset: 0; background: #fff; border-radius: 4px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.10); border: 1px solid #e2e8f0;
}
.pres-thumb-stack.multi::before { transform: translate(4px, 4px); z-index: -1; }
.pres-thumb-stack.multi::after  { transform: translate(8px, 8px); z-index: -2; }

/* Center Stage */
.pres-stage-center { flex: 1; overflow-y: auto; padding: 24px 28px; display: flex; flex-direction: column; gap: 20px; }
.pres-dropzone {
  border: 2px dashed #94a3b8; border-radius: 16px; background: #fff;
  padding: 64px 32px; text-align: center; cursor: pointer; transition: all 0.15s;
  margin: auto; max-width: 640px; width: 100%; box-shadow: var(--p-shadow);
}
.pres-dropzone:hover, .pres-dropzone.dragging { border-color: var(--p-primary); background: #eff6ff; }
.pres-toolbar {
  display: flex; align-items: center; gap: 12px; background: #fff; padding: 14px 18px;
  border-radius: 12px; border: 1px solid var(--p-border); box-shadow: var(--p-shadow); flex-wrap: wrap;
}
.pres-stage-btn {
  padding: 9px 16px; border-radius: 8px; font-weight: 600; font-size: 13.5px;
  border: 1px solid #cbd5e1; background: #fff; color: #1e293b; cursor: pointer; transition: all 0.15s;
}
.pres-stage-btn.unlocked { background: #eff6ff; border-color: #93c5fd; color: #1d4ed8; }
.pres-stage-btn.primary { background: var(--p-primary); border-color: var(--p-primary); color: #fff; }
.pres-stage-btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* Table */
.pres-card { background: #fff; border: 1px solid var(--p-border); border-radius: 12px; box-shadow: var(--p-shadow); overflow-x: auto; }
.pres-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.pres-table th {
  text-align: left; padding: 12px 16px; background: #f8fafc; color: #475569;
  font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.04em; border-bottom: 1px solid var(--p-border);
}
.pres-table td { padding: 13px 16px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.pres-badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; }
.pres-badge.amber { background: #fef3c7; color: #92400e; }
.pres-badge.green { background: #d1fae5; color: #065f46; }
.pres-badge.blue  { background: #dbeafe; color: #1e40af; }
.pres-duration { display: inline-block; margin-top: 2px; font-size: 10.5px; color: #94a3b8; font-variant-numeric: tabular-nums; }

/* Two-line Done / Preview Button */
.pres-done-preview-btn {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 5px 14px; border-radius: 8px; border: 1px solid #10b981; background: #ecfdf5;
  color: #065f46; cursor: pointer; line-height: 1.2; transition: all 0.15s;
}
.pres-done-preview-btn:hover { background: #d1fae5; transform: translateY(-1px); }
.pres-done-preview-btn .l1 { font-weight: 700; font-size: 12px; }
.pres-done-preview-btn .l2 { font-size: 11px; text-decoration: underline; color: #047857; }

/* Buffering Spinner */
.pres-buffering { display: inline-flex; align-items: center; gap: 8px; color: #64748b; font-size: 12.5px; font-weight: 500; }
.pres-spinner {
  width: 15px; height: 15px; border: 2px solid #cbd5e1; border-top-color: #2563eb;
  border-radius: 50%; animation: pres-spin 0.75s linear infinite;
}
@keyframes pres-spin { to { transform: rotate(360deg); } }

/* Right Drawer */
.pres-drawer {
  width: 310px; background: #fff; border-left: 1px solid var(--p-border);
  padding: 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 18px; flex-shrink: 0;
}
.pres-archive-item {
  padding: 10px 12px; border: 1px solid var(--p-border); border-radius: 8px;
  cursor: pointer; transition: background 0.15s; margin-bottom: 8px;
}
.pres-archive-item:hover { background: #f8fafc; border-color: #93c5fd; }

/* Focus Side-by-Side Modal */
.pres-modal-backdrop {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.65); z-index: 1000;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.pres-focus-modal {
  width: 96vw; height: 92vh; background: #fff; border-radius: 14px;
  display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 25px 60px rgba(0,0,0,0.3);
}
.pres-focus-hdr {
  padding: 12px 20px; background: #0f172a; color: #fff;
  display: flex; align-items: center; justify-content: space-between;
}
.pres-focus-split { flex: 1; display: flex; min-height: 0; }
.pres-focus-left { width: 50%; border-right: 1px solid var(--p-border); background: #334155; }
.pres-focus-right { width: 50%; overflow-y: auto; padding: 20px 24px; display: flex; flex-direction: column; gap: 16px; }
.pres-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pres-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
