:root {
  color-scheme: light;
  --video-sidebar-width: 240px;
  --bg: #faf8f3;
  --panel: #ffffff;
  --panel-soft: #fbefe7;
  --ink: #25313a;
  --muted: #6d625a;
  --line: #e2d4c7;
  --accent: #c2410c;
  --accent-strong: #9a3412;
  --amber: #b76b24;
  --shadow: 0 18px 50px rgba(28, 45, 37, 0.12);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  overflow-x: auto;
}

body.is-resizing-video {
  cursor: ns-resize;
  user-select: none;
}

body.is-resizing-sidebar {
  cursor: ew-resize;
  user-select: none;
}

body.is-resizing-video iframe,
body.is-resizing-sidebar iframe {
  pointer-events: none;
}

button,
input,
select {
  font: inherit;
}

button,
select,
input[type="search"],
input[type="text"],
input[type="file"] {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
}

button {
  cursor: pointer;
  padding: 0.5rem 0.75rem;
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  font-weight: 700;
}

button.secondary {
  background: #fff;
  color: var(--accent-strong);
  border-color: #d9c1b2;
}

.app {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  grid-template-areas: "sidebar main";
  min-height: 100vh;
}

.app.sidebar-collapsed {
  grid-template-columns: 72px minmax(0, 1fr);
}

.app.video-sidebar {
  grid-template-columns: clamp(160px, 22vw, 260px) minmax(420px, 1fr) var(--video-sidebar-width);
  grid-template-areas: "sidebar main media";
}

.app.video-sidebar.sidebar-collapsed {
  grid-template-columns: 72px minmax(420px, 1fr) var(--video-sidebar-width);
}

.sidebar {
  grid-area: sidebar;
  border-right: 1px solid var(--line);
  background: #fffaf5;
  padding: 1rem;
  display: flex;
  flex-direction: column;
}

.app.video-sidebar .sidebar {
  border-right: 1px solid var(--line);
  padding: 0.8rem;
}

.sidebar-toggle {
  width: 2.75rem;
  height: 2.75rem;
  margin-left: auto;
  padding: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 999px;
  align-self: flex-end; /* explicitly prevent flex stretching when expanded */
  flex: 0 0 2.75rem; /* prevent vertical sizing compression or stretching */
  box-shadow: 0 8px 18px rgba(28, 45, 37, 0.08);
  transition: transform 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

.sidebar-toggle:hover {
  box-shadow: 0 12px 24px rgba(28, 45, 37, 0.14);
}

.sidebar-toggle-icon {
  width: 18px;
  height: 18px;
  transition: transform 160ms ease;
}

.sidebar-toggle[aria-expanded="true"] .sidebar-toggle-icon {
  transform: rotate(180deg);
}

.sidebar-panel {
  display: block;
  margin-top: 0.9rem;
}

.app.sidebar-collapsed .sidebar {
  overflow: hidden;
}

.app.sidebar-collapsed .sidebar-toggle {
  align-self: center; /* explicitly center and prevent stretching when collapsed */
  margin-left: auto;
  margin-right: auto;
}

.app.sidebar-collapsed .sidebar-panel {
  margin-top: 0;
  height: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
}

.brand {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1rem;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  letter-spacing: 0;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 1.1rem;
  line-height: 1.2;
}

.brand p,
.source,
.meta,
.time,
.reply-target,
.reactions {
  color: var(--muted);
  font-size: 0.78rem;
}

.field-label {
  display: block;
  margin: 0.85rem 0 0.35rem;
  color: #4c574f;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.app.video-sidebar .field-label {
  font-size: 0.72rem;
}

select,
input[type="search"],
input[type="text"],
input[type="file"] {
  width: 100%;
  padding: 0.42rem 0.52rem;
}

.upload-panel {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 0.55rem 0;
  margin: 0.55rem 0;
}

.upload-status {
  margin-top: 0.45rem;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.upload-status.error {
  color: #9b2f22;
}



.tools,
.video-tools,
.playback-launch,
.playback {
  border-top: 1px solid var(--line);
  padding-top: 0.55rem;
  margin-top: 0.55rem;
}

.field-label-inline {
  margin: 0;
}

.playback-launch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.toggle-row {
  display: grid;
  gap: 0.45rem;
  margin-top: 0.75rem;
  color: #3f4b43;
  font-size: 0.9rem;
}

.toggle-row-compact {
  margin-top: 0.55rem;
}

.workspace {
  grid-area: main;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "media"
    "chat";
  gap: 1.25rem;
  padding: clamp(1rem, 3vw, 2.5rem);
  min-width: 0;
  align-content: start;
}

.app.video-sidebar .workspace {
  display: contents;
}

.playback-head,
.playback-time,
.conversation-header,
.message-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.playback-head h2 {
  font-size: 0.95rem;
}

.playback-head {
  justify-content: flex-start;
}

.playback-time {
  margin: 0.45rem 0 0.25rem;
  font-variant-numeric: tabular-nums;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.scrub-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-top: 0.45rem;
}

.scrub-row input[type="range"] {
  flex: 1;
  margin: 0;
}

.scrub-btn {
  padding: 0.25rem 0.45rem !important;
  font-size: 0.75rem !important;
  min-width: 44px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.playback-grid {
  display: grid;
  grid-template-columns: minmax(0, 120px);
  gap: 0.55rem;
  margin-top: 0.45rem;
}

.playback-grid label {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.media-column,
.conversation {
  min-width: 0;
}

.media-column {
  grid-area: media;
  display: grid;
  gap: 1rem;
  align-content: start;
  min-width: 0;
}

.app.video-sidebar .media-column {
  grid-area: media;
  border-left: 1px solid var(--line);
  background: linear-gradient(180deg, #fff8f1 0%, #fdf0e6 100%);
  box-shadow: inset 1px 0 0 rgba(28, 45, 37, 0.04);
  padding: 0.8rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  position: sticky;
}

.app.video-sidebar .media-column::before {
  content: "";
  position: absolute;
  inset: 0.8rem;
  border-radius: 10px;
  background: repeating-linear-gradient(
    180deg,
    rgba(194, 65, 12, 0.05) 0,
    rgba(194, 65, 12, 0.05) 18px,
    rgba(255, 255, 255, 0.38) 18px,
    rgba(255, 255, 255, 0.38) 36px
  );
  pointer-events: none;
}

.app.video-sidebar .media-column > * {
  position: relative;
  z-index: 1;
}

.video-sidebar-resize-handle {
  display: none;
}

.app.video-sidebar .video-sidebar-resize-handle {
  display: block;
  position: absolute;
  left: -0.55rem;
  top: 0.8rem;
  bottom: 0.8rem;
  width: 1rem;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: transparent;
  cursor: ew-resize;
  touch-action: none;
}

.video-sidebar-resize-handle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.video-sidebar-resize-grip {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 4px;
  height: 84px;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(194, 65, 12, 0.16), rgba(194, 65, 12, 0.38), rgba(194, 65, 12, 0.16));
  box-shadow: 0 0 0 4px rgba(247, 247, 244, 0.92);
}

.conversation {
  grid-area: chat;
  min-width: 0;
}

.app.video-sidebar .conversation {
  grid-area: main;
  min-width: 420px;
  padding: clamp(0.75rem, 2vw, 1.5rem);
}

.conversation-header {
  width: 100%;
  max-width: none;
  margin: 0 0 1rem;
}

.conversation-header h2 {
  font-size: clamp(1.35rem, 2vw, 2.1rem);
  line-height: 1.15;
}

.video-embed {
  --video-height: 360px;
  margin-bottom: 0;
}

.video-embed.hidden {
  display: none;
}

.video-frame-shell {
  width: 100%;
  height: var(--video-height);
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  box-shadow: var(--shadow);
}

.video-frame-shell iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.video-resize-handle {
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.35rem 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: ns-resize;
  touch-action: none;
}

.video-resize-handle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.video-resize-grip {
  display: block;
  width: 100%;
  height: 12px;
  position: relative;
}

.video-resize-grip::before,
.video-resize-grip::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 999px;
}

.video-resize-grip::before {
  top: 5px;
  width: min(100%, 220px);
  height: 2px;
  background: #d9c1b2;
}

.video-resize-grip::after {
  top: 2px;
  width: 54px;
  height: 8px;
  border: 1px solid #d9c1b2;
  background: #fffaf5;
}

.messages {
  width: 100%;
  max-width: none;
  margin: 0;
  display: grid;
  gap: 0.7rem;
}

.message {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 1px 0 rgba(28, 45, 37, 0.03);
  padding: 0.82rem 0.9rem;
}

.message.is-reply {
  margin-left: 1.25rem;
  background: #fbfcfb;
  box-shadow: none;
}

.message.unresolved {
  border-left: 3px solid var(--amber);
}

.sender {
  font-weight: 800;
}

.time {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}



.text {
  margin-top: 0.45rem;
  display: block;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.45;
}

.text a {
  color: var(--accent-strong);
  font-weight: 650;
}

.text-select {
  display: inline;
  cursor: text;
  user-select: text;
  -webkit-user-select: text;
}

.reply-target,
.reactions {
  cursor: text;
  user-select: text;
  -webkit-user-select: text;
}

.reply-toggle {
  margin-top: 0.7rem;
  padding: 0.25rem 0.55rem;
  background: #ffffff;
  color: var(--accent-strong);
  border: 1px solid #d9c1b2;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.78rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
  box-shadow: 0 1px 2px rgba(28, 45, 37, 0.04);
  user-select: none;
  -webkit-user-select: none;
}

.reply-toggle:hover {
  background: var(--panel-soft);
  border-color: #c8b5a6;
  box-shadow: 0 2px 4px rgba(28, 45, 37, 0.08);
}

.reply-toggle svg {
  width: 14px;
  height: 14px;
  transition: transform 160ms ease;
}

.reply-toggle[aria-expanded="true"] svg {
  transform: rotate(90deg);
}

.replies {
  display: none;
  margin-top: 0.65rem;
  border-left: 2px solid #e6c5b1;
  padding-left: 0.65rem;
}

.replies.open {
  display: grid;
  gap: 0.5rem;
}

.reply-target,
.reactions {
  margin-top: 0.45rem;
}

.empty {
  background: var(--panel-soft);
  border: 1px dashed #ddb8a1;
  border-radius: var(--radius);
  padding: 1.25rem;
  color: var(--muted);
}

@media (max-width: 640px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-areas: "sidebar" "main";
  }

  .app.sidebar-collapsed {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .workspace {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-areas:
      "media"
      "chat";
  }

  .app.video-sidebar .media-column {
    border-left: 1px solid var(--line);
    background: #fffaf5;
    padding: 1rem;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow: auto;
  }

  .app.sidebar-collapsed .sidebar {
    overflow: visible;
  }

  .conversation-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .message.is-reply {
    margin-left: 0.25rem;
  }
}

/* Onboarding Demo Invite Card */
.demo-invite {
  background: var(--panel-soft);
  border: 1px solid var(--line);
  padding: 1.5rem;
  border-radius: var(--radius);
  text-align: center;
  margin-bottom: 1.5rem;
}

.demo-invite h3 {
  margin: 0 0 0.5rem 0;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--accent-strong);
}

.demo-invite p {
  margin: 0 0 1.2rem 0;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.45;
}

.demo-invite button {
  padding: 0.6rem 1.25rem;
  font-size: 0.9rem;
  border-radius: var(--radius);
  transition: transform 100ms ease, background-color 100ms ease;
}

.demo-invite button:active {
  transform: scale(0.97);
}

/* Search Highlight */
mark {
  background: rgba(194, 65, 12, 0.15); /* matching --accent color with transparency */
  color: inherit;
  border-radius: 2px;
  padding: 0 2px;
  border-bottom: 1px dashed rgba(194, 65, 12, 0.45);
}

/* Drag and Drop Fullscreen Overlay */
.drag-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(37, 49, 58, 0.88); /* transparent dark */
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 160ms ease;
}

.drag-overlay:not(.hidden) {
  pointer-events: auto;
  opacity: 1;
}

.drag-overlay-card {
  background: var(--bg);
  border: 2px dashed var(--accent);
  padding: 3rem 2rem;
  border-radius: var(--radius);
  text-align: center;
  max-width: 420px;
  width: 90%;
  box-shadow: var(--shadow);
  transform: translateY(20px);
  transition: transform 160ms ease;
}

.drag-overlay:not(.hidden) .drag-overlay-card {
  transform: translateY(0);
}

.drag-icon {
  width: 48px;
  height: 48px;
  color: var(--accent);
  margin-bottom: 1.25rem;
}

.drag-overlay-card h2 {
  margin: 0 0 0.5rem 0;
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--ink);
}

.drag-overlay-card p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.45;
}



.inline-kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: 4px;
  padding: 0.1rem 0.35rem;
  margin-left: 0.5rem;
  vertical-align: middle;
  pointer-events: none;
  line-height: 1;
}

/* Badge inside primary button (e.g. Play) */
button:not(.secondary) .inline-kbd {
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-bottom: 2px solid rgba(255, 255, 255, 0.45);
  color: #ffffff;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.1);
}

button:not(.secondary):hover .inline-kbd {
  background: rgba(255, 255, 255, 0.28);
  border-color: rgba(255, 255, 255, 0.45);
}

/* Badge inside secondary buttons (e.g. -10s, +10s) */
button.secondary .inline-kbd {
  background: #fbefe7;
  border: 1px solid var(--line);
  border-bottom: 2px solid #c8b5a6;
  color: var(--accent-strong);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.05);
}

button.secondary:hover .inline-kbd {
  background: #f5e4da;
  color: var(--accent-strong);
}

.search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.search-wrapper input[type="search"] {
  width: 100%;
  padding-right: 2.2rem;
}

.input-shortcut {
  position: absolute;
  right: 0.5rem;
  pointer-events: none;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-bottom: 2px solid #c8b5a6;
  border-radius: 4px;
  padding: 0.1rem 0.35rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.05);
  transition: opacity 0.15s ease;
}

.search-wrapper input:focus + .input-shortcut {
  opacity: 0;
}




