:root {
  --bg: #faf8f5;
  --panel: #ffffff;
  --ink: #1a1a1a;
  --ink-2: #555;
  --ink-3: #8a8a8a;
  --line: #e5e0d8;
  --line-2: #d4cdc0;
  --accent: #c59a2a;
  --primary: #2a5a8a;
  --primary-soft: #e6eef8;
  --rachel: #b04a3b;
  --tarun: #3b6fb0;
  --mono: "SF Mono", "Menlo", "Consolas", monospace;
  --serif: "Iowan Old Style", "Palatino", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Inter", "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* screens */
.screen {
  min-height: 100vh;
  padding: max(env(safe-area-inset-top), 20px) 20px 40px;
  display: flex;
  flex-direction: column;
}
.screen.center {
  justify-content: center;
  align-items: center;
}
.hidden { display: none !important; }

.env-ribbon {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid rgba(84, 132, 188, 0.20);
  background: rgba(255,255,255,0.72);
  box-shadow: 0 10px 32px -20px rgba(42, 90, 138, 0.45);
  color: #2a4a74;
  font-size: 13px;
  line-height: 1.35;
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
}

.env-ribbon-kicker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(42, 90, 138, 0.12);
  color: #2a5a8a;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.env-ribbon-inline {
  display: flex;
  width: 100%;
  margin-bottom: 16px;
  border-radius: 14px;
  background: rgba(230, 238, 248, 0.88);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 520px;
  width: 100%;
  text-align: center;
}

/* brand */
.brand {
  font-family: var(--serif);
  font-size: 22px;
  color: var(--ink-2);
  letter-spacing: -0.005em;
}
.brand.small { font-size: 17px; color: var(--ink-3); }

/* beta badge */
.beta-badge {
  display: inline-block;
  padding: 5px 14px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: #fbf3d9;
  color: #6d5e1d;
  border: 1px solid #e6d9a6;
  border-radius: 12px;
  margin: 0 auto;
}

/* typography */
h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(30px, 5.5vw, 42px);
  line-height: 1.15;
  margin: 8px 0;
  letter-spacing: -0.01em;
}
h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 22px;
  margin: 28px 0 14px;
  letter-spacing: -0.005em;
}
h3 {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  margin: 0 0 10px;
}
p { margin: 0 0 10px; }
p.lede { color: var(--ink-2); font-size: 17px; }
.small { font-size: 13px; }
.muted { color: var(--ink-3); }

/* cards */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px 20px;
  text-align: left;
}

/* buttons */
.btn {
  font-family: inherit;
  font-size: 15px;
  padding: 11px 18px;
  border-radius: 8px;
  border: 1px solid var(--line-2);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-weight: 500;
  transition: background 80ms, transform 80ms;
}
.btn:hover { background: #f4efe7; }
.btn:active { transform: scale(0.98); }
.btn.primary {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}
.btn.primary:hover { background: #333; }
.btn.primary:disabled {
  background: #ccc;
  border-color: #ccc;
  cursor: not-allowed;
}
.btn.link {
  background: transparent;
  border: none;
  color: var(--ink-3);
  text-decoration: underline;
  padding: 8px 12px;
}
.btn.icon {
  background: transparent;
  border: none;
  padding: 6px 12px;
  font-size: 22px;
  color: var(--ink-2);
}
.btn.back { font-size: 20px; }

/* input */
.input {
  font-family: inherit;
  font-size: 15.5px;
  padding: 10px 14px;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: #fff;
  width: 100%;
  color: var(--ink);
}
.input:focus { outline: 2px solid var(--primary-soft); border-color: var(--primary); }
.input.file { padding: 8px; }
textarea.input { resize: vertical; min-height: 80px; }

.field {
  display: block;
  margin-bottom: 14px;
}
.field > span:first-child {
  display: block;
  font-size: 13px;
  color: var(--ink-3);
  margin-bottom: 6px;
  font-weight: 500;
}

/* inline */
.inline {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.inline.centered { justify-content: center; }

/* error */
.error {
  color: var(--rachel);
  font-size: 13px;
  margin-top: 6px;
}

/* actions */
.actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 10px;
}

.video-list {
  display: grid;
  gap: 18px;
  margin-top: 14px;
}

.video-list.grid-view {
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

.video-list.list-view {
  grid-template-columns: 1fr;
}

.video-list.feed-view {
  grid-template-columns: 1fr;
  gap: 0;
  margin-top: 0;
  height: calc(100vh - 170px);
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  padding-bottom: 24px;
}

.video-table-head {
  display: grid;
  grid-template-columns: 180px minmax(220px, 1.2fr) minmax(220px, 0.9fr) 220px;
  gap: 16px;
  padding: 0 16px 8px;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 11px;
  font-weight: 700;
}

.video-card {
  background: transparent;
  border: none;
  border-radius: 18px;
  padding: 0;
  box-shadow: none;
}

.video-card h3 {
  margin-bottom: 2px;
  color: var(--ink);
  font-size: 15px;
  letter-spacing: 0;
  text-transform: none;
  font-weight: 600;
}

.video-meta {
  color: var(--ink-3);
  font-size: 12px;
  margin-bottom: 0;
}

.video-notes {
  margin: 0 0 12px;
  color: var(--ink-2);
}

.video-stage {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  background: #111;
  aspect-ratio: 4 / 3;
}

.video-overlay-btn {
  position: relative;
  left: auto;
  top: auto;
  transform: none !important;
  z-index: 2;
  width: 108px;
  min-width: 108px;
  min-height: 44px;
  border: 1px solid rgba(255,255,255,0.35);
  background: rgba(16, 16, 16, 0.72);
  color: #fff;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 12px 30px -16px rgba(0,0,0,0.8);
  transition: background 80ms, opacity 120ms;
  white-space: nowrap;
  appearance: none;
}

.video-overlay-btn:hover {
  background: rgba(16, 16, 16, 0.84);
}

.video-overlay-btn:active,
.video-actions-primary .btn:active,
.video-view-toggle .btn:active {
  transform: none !important;
}

.video-overlay-btn:focus,
.video-overlay-btn:focus-visible,
.video-overlay-btn[disabled] {
  transform: none !important;
}

.video-overlay-actions {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 2;
  pointer-events: none;
}

.video-overlay-actions > .video-overlay-btn {
  pointer-events: auto;
}

.video-overlay-btn[data-state="loading"] {
  color: transparent;
}

.video-overlay-btn[data-state="loading"]::after {
  content: "";
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.28);
  border-top-color: #fff;
  border-radius: 50%;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  animation: video-spinner-spin 800ms linear infinite;
}

@keyframes video-spinner-spin {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

.video-thumb {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #111;
}

.video-frame {
  display: block;
  width: 100%;
  height: 100%;
  background: #111;
  object-fit: cover;
}

.video-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 10px;
}

.video-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.video-toolbar-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.screen-video {
  padding-left: 22px;
  padding-right: 22px;
  background: #fcfbf8;
}

.screen-gallery {
  background: #101114;
  color: #f4f1ea;
  min-height: 100vh;
}

.screen-gallery .app-header {
  background: rgba(16,17,20,0.96);
  border-bottom-color: rgba(255,255,255,0.08);
}

.screen-gallery .brand,
.screen-gallery .small,
.screen-gallery .muted {
  color: #f4f1ea;
}

.gallery-main {
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 10px 10px 24px;
}

.gallery-toolbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0 10px;
  background: rgba(16,17,20,0.96);
}

.gallery-summary {
  color: #f4f1ea;
  font-size: 14px;
  font-weight: 650;
}

.gallery-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.gallery-search,
.gallery-select {
  min-height: 38px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.08);
  color: #f4f1ea;
  border-radius: 8px;
  padding: 0 10px;
  font: inherit;
}

.gallery-search {
  width: min(32vw, 360px);
  min-width: 220px;
}

.gallery-select option {
  color: #111;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 3px;
  grid-auto-flow: dense;
}

.gallery-tile {
  position: relative;
  display: block;
  aspect-ratio: 1 / 1;
  border: 0;
  padding: 0;
  margin: 0;
  overflow: hidden;
  background: #23252b;
  color: #fff;
  cursor: zoom-in;
}

.gallery-tile:nth-child(11n),
.gallery-tile:nth-child(17n) {
  grid-row: span 2;
  grid-column: span 2;
}

.gallery-media {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #23252b;
}

.gallery-file-icon {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #2f333d, #191b21);
  color: rgba(255,255,255,0.9);
  font-size: clamp(22px, 3vw, 42px);
  font-weight: 800;
  letter-spacing: -0.04em;
}

.gallery-placeholder {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  padding: 8px;
  color: rgba(255,255,255,0.82);
  font-size: 12px;
  line-height: 1.2;
  overflow-wrap: anywhere;
  text-align: center;
  background: #23252b;
}

.gallery-tile.preview-loaded .gallery-media {
  z-index: 3;
}

.gallery-placeholder.hidden {
  display: none;
}

.gallery-badge {
  position: absolute;
  z-index: 4;
  top: 6px;
  right: 6px;
  padding: 3px 6px;
  border-radius: 999px;
  background: rgba(0,0,0,0.62);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.gallery-tile.image .gallery-badge {
  display: none;
}

.gallery-tile-meta {
  position: absolute;
  z-index: 4;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 22px 7px 6px;
  background: linear-gradient(transparent, rgba(0,0,0,0.72));
  color: rgba(255,255,255,0.92);
  font-size: 10px;
  opacity: 0;
  transition: opacity 120ms ease;
}

.gallery-debug {
  position: absolute;
  z-index: 5;
  left: 4px;
  right: 4px;
  bottom: 4px;
  display: grid;
  gap: 2px;
  padding: 5px;
  border-radius: 5px;
  background: rgba(0,0,0,0.76);
  color: #fff;
  font-family: var(--mono);
  font-size: 9px;
  line-height: 1.15;
  text-align: left;
  overflow: hidden;
  pointer-events: none;
}

.gallery-debug span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gallery-tile:hover .gallery-tile-meta,
.gallery-tile:focus-visible .gallery-tile-meta {
  opacity: 1;
}

.gallery-tile.unavailable::after {
  content: "Unavailable";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0,0,0,0.72);
  color: #fff;
  font-size: 12px;
}

.gallery-empty {
  grid-column: 1 / -1;
  color: #d8d2c6;
}

.gallery-loading-card {
  grid-column: 1 / -1;
  width: min(520px, 100%);
  min-height: 128px;
  display: grid;
  place-items: center;
  gap: 8px;
  padding: 24px;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 16px;
  background: rgba(255,255,255,0.05);
  color: rgba(244,241,234,0.88);
  text-align: center;
}

.gallery-loading-card span {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(255,255,255,0.18);
  border-top-color: #f4f1ea;
  border-radius: 999px;
  animation: spin 900ms linear infinite;
}

.gallery-loading-card small {
  color: rgba(244,241,234,0.56);
}

.gallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: 1fr auto;
  background: #050506;
  color: #fff;
  isolation: isolate;
}

.gallery-lightbox.hidden {
  display: none;
}

.gallery-lightbox-stage {
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 64px 76px 22px;
  transition: margin-right 180ms ease;
}

.gallery-lightbox-media {
  max-width: 100%;
  max-height: calc(100vh - 136px);
  object-fit: contain;
  background: #000;
  border-radius: 3px;
  box-shadow: 0 18px 80px rgba(0,0,0,0.46);
}

.gallery-lightbox-pdf {
  width: min(92vw, 1100px);
  height: calc(100vh - 136px);
  border: 0;
  background: #fff;
}

.gallery-lightbox-file {
  display: grid;
  place-items: center;
  gap: 18px;
  min-width: min(560px, 90vw);
  min-height: 320px;
  padding: 28px;
  border-radius: 22px;
  background: rgba(255,255,255,0.08);
  color: #fff;
}

.gallery-lightbox-file-icon {
  display: grid;
  place-items: center;
  width: 118px;
  height: 118px;
  border-radius: 28px;
  background: rgba(255,255,255,0.14);
  font-size: 40px;
  font-weight: 800;
}

.gallery-lightbox-loading {
  display: grid;
  place-items: center;
  min-width: 220px;
  min-height: 140px;
  padding: 24px;
  border-radius: 12px;
  background: rgba(255,255,255,0.06);
  color: #fff;
  font-size: 14px;
}

.gallery-lightbox-close,
.gallery-lightbox-info-toggle,
.gallery-lightbox-nav {
  position: fixed;
  z-index: 102;
  border: 0;
  color: #fff;
  background: rgba(32,33,36,0.74);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  cursor: pointer;
  transition: background 120ms ease, opacity 120ms ease, right 180ms ease;
}

.gallery-lightbox-close:hover,
.gallery-lightbox-info-toggle:hover,
.gallery-lightbox-nav:hover:not(:disabled) {
  background: rgba(255,255,255,0.20);
}

.gallery-lightbox-close {
  top: 14px;
  right: 16px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-size: 30px;
  line-height: 1;
}

.gallery-lightbox.info-open .gallery-lightbox-close {
  right: 378px;
}

.gallery-lightbox-info-toggle {
  top: 14px;
  right: 62px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-size: 18px;
  font-weight: 800;
  font-family: Georgia, serif;
  line-height: 1;
}

.gallery-lightbox.info-open .gallery-lightbox-info-toggle {
  right: 424px;
  background: rgba(255,255,255,0.92);
  color: #111;
}

.gallery-lightbox-nav {
  top: 50%;
  width: 44px;
  height: 64px;
  transform: translateY(-50%);
  border-radius: 8px;
  font-size: 46px;
  line-height: 1;
}

.gallery-lightbox-nav.prev {
  left: 16px;
}

.gallery-lightbox-nav.next {
  right: 16px;
}

.gallery-lightbox-nav:disabled {
  opacity: 0.25;
  cursor: default;
}

.gallery-lightbox-info {
  grid-column: 1;
  grid-row: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 68px;
  padding: 12px 18px;
  border-top: 1px solid rgba(255,255,255,0.12);
  background: rgba(18,18,20,0.98);
  transition: margin-right 180ms ease;
}

.gallery-info-panel {
  position: fixed;
  z-index: 101;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(360px, 92vw);
  display: none;
  grid-template-rows: auto 1fr;
  border-left: 1px solid rgba(0,0,0,0.12);
  background: #fff;
  color: #202124;
  box-shadow: -18px 0 48px rgba(0,0,0,0.34);
  font-family: var(--sans);
}

.gallery-lightbox.info-open .gallery-info-panel {
  display: grid;
}

.gallery-lightbox.info-open .gallery-lightbox-stage,
.gallery-lightbox.info-open .gallery-lightbox-info {
  margin-right: min(360px, 92vw);
}

.gallery-info-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 14px 10px 20px;
}

.gallery-info-heading {
  font-size: 20px;
  font-weight: 600;
}

.gallery-info-close {
  width: 36px;
  height: 36px;
  border: 1px solid rgba(0,0,0,0.14);
  border-radius: 50%;
  background: #fff;
  color: #202124;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.gallery-info-panel-body {
  overflow: auto;
  padding: 0 20px 28px;
  overscroll-behavior: contain;
}

.gallery-info-section {
  padding: 18px 0;
  border-top: 1px solid #e5e7eb;
}

.gallery-info-section:first-child {
  border-top: 0;
}

.gallery-info-section label,
.gallery-info-section-title {
  display: block;
  margin-bottom: 10px;
  color: #3c4043;
  font-size: 13px;
  font-weight: 700;
}

.gallery-info-description {
  width: 100%;
  border: 0;
  border-bottom: 1px solid #d6d9de;
  padding: 8px 0;
  background: transparent;
  color: #5f6368;
  font: inherit;
}

.gallery-face-empty {
  display: grid;
  gap: 6px;
  padding: 12px;
  border-radius: 8px;
  background: #f6f8fb;
  color: #202124;
}

.gallery-face-empty small {
  color: #5f6368;
  line-height: 1.35;
}

.gallery-location-empty {
  display: grid;
  gap: 6px;
  padding: 12px;
  border-radius: 10px;
  background: #f6f8fb;
  color: #202124;
}

.gallery-location-empty small {
  color: #5f6368;
  line-height: 1.35;
}

.gallery-location-card {
  display: block;
  overflow: hidden;
  border: 1px solid #e1e5eb;
  border-radius: 12px;
  background: #fff;
  color: inherit;
  text-decoration: none;
}

.gallery-location-map {
  display: block;
  width: 100%;
  height: 152px;
  border: 0;
  background: #e8eaed;
  pointer-events: none;
}

.gallery-location-caption {
  display: grid;
  gap: 2px;
  padding: 10px 12px;
}

.gallery-location-caption strong {
  color: #202124;
  font-size: 13px;
}

.gallery-location-caption small {
  color: #5f6368;
}

.gallery-face-labeler {
  margin-top: 12px;
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid #e1e5eb;
  border-radius: 10px;
  background: #fff;
}

.gallery-face-labeler-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.gallery-unknown-face-avatar,
.gallery-contact-avatar {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #e8f0fe;
  color: #174ea6;
  font-weight: 800;
}

.gallery-face-labeler-title {
  color: #202124;
  font-weight: 700;
}

.gallery-face-labeler small,
.gallery-contact-suggestion small,
.gallery-person-share-card small {
  display: block;
  color: #5f6368;
  line-height: 1.25;
}

.gallery-face-name-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  border: 1px solid #d6d9de;
  border-radius: 10px;
  overflow: hidden;
}

.gallery-face-name-input {
  min-width: 0;
  border: 0;
  padding: 10px 11px;
  font: inherit;
}

.gallery-face-done {
  border: 0;
  border-left: 1px solid #d6d9de;
  padding: 0 14px;
  background: #fff;
  color: #0b57d0;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.gallery-contact-suggestions {
  display: grid;
  gap: 6px;
}

.gallery-contact-suggestion {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 0;
  border-radius: 9px;
  padding: 8px;
  background: transparent;
  color: #202124;
  text-align: left;
  cursor: pointer;
}

.gallery-contact-suggestion:hover,
.gallery-contact-suggestion:focus-visible {
  background: #f1f3f4;
}

.gallery-face-label-status {
  color: #5f6368;
  font-size: 12px;
  line-height: 1.35;
}

.gallery-person-share-card {
  margin-top: 10px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid #e1e5eb;
  border-radius: 10px;
  background: #f8fafc;
}

.gallery-person-action {
  border: 1px solid #d6d9de;
  border-radius: 999px;
  padding: 6px 12px;
  background: #fff;
  color: #5f6368;
  font: inherit;
}

.gallery-person-action:disabled {
  opacity: 0.58;
}

.gallery-info-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 12px;
  padding: 8px 0;
  align-items: start;
}

.gallery-info-row-label {
  color: #5f6368;
  font-size: 12px;
}

.gallery-info-row-value {
  min-width: 0;
  color: #202124;
  font-size: 13px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.gallery-lightbox-title {
  font-weight: 700;
  max-width: 70vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gallery-lightbox-meta {
  margin-top: 3px;
  color: rgba(255,255,255,0.68);
  font-size: 12px;
  max-width: 76vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.main-video {
  max-width: none;
  width: 100%;
  margin: 0;
  padding-top: 12px;
}

.video-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.video-top .banner-soft,
.video-top .card {
  margin: 0;
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(255,255,255,0.74);
  border: 1px solid rgba(212,205,192,0.8);
  box-shadow: none;
}

.video-top .card h3 {
  display: none;
}

.video-top .card {
  max-width: 380px;
}

.video-top .banner-soft {
  flex: 1;
}

.video-list.list-view .video-card {
  display: grid;
  grid-template-columns: 140px minmax(220px, 1.5fr) minmax(180px, 1fr) 160px;
  gap: 14px;
  align-items: center;
  padding: 10px 0 14px;
  border-radius: 0;
  border-bottom: 1px solid var(--line);
}

.video-list.list-view .video-card h3,
.video-list.list-view .video-notes,
.video-list.list-view .video-meta,
.video-list.list-view .video-actions,
.video-list.list-view .video-metadata {
  margin: 0;
}

.video-list.list-view .video-stage {
  grid-row: auto;
}

.video-list.list-view .video-thumb,
.video-list.list-view .video-frame {
  height: 100%;
  border-radius: 14px;
}

.video-list.list-view .video-card-main {
  display: grid;
  gap: 2px;
}

.video-list.list-view .video-card-stats {
  display: grid;
  gap: 4px;
  font-size: 12px;
}

.video-list.list-view .video-card-stats-row {
  display: grid;
  grid-template-columns: 68px 1fr;
  gap: 8px;
}

.video-list.list-view .video-card-stats-label {
  color: var(--ink-3);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.08em;
}

.video-list.list-view .video-card-files {
  display: grid;
  gap: 4px;
  align-content: center;
  word-break: break-word;
  font-size: 12px;
}

.video-list.list-view .video-metadata {
  grid-column: 2 / -1;
  margin-top: 8px;
  padding-top: 12px;
}

.video-list.grid-view .video-card-body {
  display: grid;
  gap: 8px;
  padding: 10px 2px 0;
}

.video-list.grid-view .video-card-stats,
.video-list.grid-view .video-card-files {
  display: none;
}

.video-list.grid-view .video-metadata {
  margin-top: 2px;
}

.video-list.feed-view .video-card {
  min-height: calc(100vh - 190px);
  display: grid;
  grid-template-rows: 1fr auto;
  scroll-snap-align: start;
  border-radius: 0;
  border-left: none;
  border-right: none;
  border-top: none;
  box-shadow: none;
  padding: 0;
  background: #0f0f10;
  color: #fff;
}

.video-list.feed-view .video-card h3,
.video-list.feed-view .video-meta,
.video-list.feed-view .video-notes,
.video-list.feed-view .video-actions,
.video-list.feed-view .video-metadata summary,
.video-list.feed-view .video-metadata-label,
.video-list.feed-view .video-metadata-value {
  color: #f3f3f3;
}

.video-list.feed-view .video-stage {
  border-radius: 0;
  min-height: 0;
  aspect-ratio: auto;
}

.video-list.feed-view .video-thumb,
.video-list.feed-view .video-frame {
  width: 100%;
  height: 100%;
  min-height: 58vh;
  max-height: none;
  aspect-ratio: auto;
  object-fit: contain;
  background: #000;
}

.video-list.feed-view .video-card-body {
  display: grid;
  gap: 12px;
  padding: 18px 20px 24px;
  background: linear-gradient(180deg, rgba(15,15,16,0.3) 0%, rgba(15,15,16,0.95) 24%, #0f0f10 100%);
}

.video-list.feed-view .video-overlay-btn {
  border-color: rgba(255,255,255,0.24);
}

.video-list.feed-view .video-metadata {
  border-top-color: rgba(255,255,255,0.12);
}

.video-list.feed-view .video-metadata-raw {
  background: rgba(255,255,255,0.08);
}

.video-view-toggle {
  display: inline-flex;
  gap: 8px;
  background: rgba(255,255,255,0.8);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px;
}

.video-view-toggle .btn {
  border: none;
  background: transparent;
  border-radius: 999px;
  padding: 8px 14px;
}

.video-sort-toggle {
  display: inline-flex;
  gap: 8px;
  background: rgba(255,255,255,0.8);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px;
}

.video-sort-toggle .btn {
  border: none;
  background: transparent;
  border-radius: 999px;
  padding: 8px 14px;
}

.video-view-toggle .btn.active {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.video-sort-toggle .btn.active {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.video-metadata {
  margin-top: 12px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.video-metadata summary {
  cursor: pointer;
  color: var(--ink-2);
  font-weight: 500;
  font-size: 13px;
}

.video-metadata-grid {
  display: grid;
  grid-template-columns: minmax(120px, 180px) 1fr;
  gap: 6px 12px;
  margin-top: 10px;
  font-size: 13px;
}

.video-metadata-label {
  color: var(--ink-3);
}

.video-metadata-value {
  color: var(--ink);
  word-break: break-word;
}

.video-metadata-raw {
  margin: 10px 0 0;
  max-height: 320px;
  overflow: auto;
  padding: 12px;
  border-radius: 10px;
  background: #171717;
  color: #f3f3f3;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

/* fine print */
.fine-print {
  margin-top: 20px;
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 13.5px;
}
.fine-print summary {
  cursor: pointer;
  color: var(--ink-2);
  padding: 4px 0;
}
.fine-print p { color: var(--ink-2); margin: 8px 0; }

/* invite code */
.invite-code {
  font-family: var(--mono);
  font-size: 30px;
  padding: 20px;
  background: var(--bg);
  border-radius: 8px;
  letter-spacing: 0.15em;
  font-weight: 600;
  user-select: all;
  text-align: center;
  margin-bottom: 14px;
}

/* loader */
.loader {
  width: 32px;
  height: 32px;
  border: 3px solid var(--line);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* dashboard */
.app-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
}
.app-header .brand.small { flex: 1; }
.main {
  padding: 20px 0;
  max-width: 760px;
  margin: 0 auto;
  width: 100%;
}
.greeting { margin-bottom: 20px; }
.greeting h1 { font-size: 26px; }

/* people pills */
.people { display: flex; gap: 6px; align-items: center; }
.person-pill {
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  background: var(--primary-soft);
  color: var(--primary);
  border-radius: 10px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.person-pill.other { background: #f8e8e5; color: var(--rachel); }

/* menu drawer */
.drawer {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px;
  margin: 6px 4px 0 auto;
  max-width: 260px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}
.drawer-item {
  display: block;
  width: 100%;
  padding: 10px 14px;
  text-align: left;
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  border-radius: 4px;
}
.drawer-item:hover { background: var(--bg); }

/* action cards */
.actions-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}
.actions-row-single {
  grid-template-columns: 1fr;
}
.action-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px 18px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: border-color 80ms, transform 80ms;
}
.action-card:hover { border-color: var(--line-2); }
.action-card:active { transform: scale(0.98); }
.action-icon { font-size: 26px; margin-bottom: 8px; }
.action-title { font-family: var(--serif); font-size: 17px; margin-bottom: 3px; font-weight: 500; }
.action-sub { font-size: 12.5px; color: var(--ink-3); }

/* section */
.section { margin-top: 24px; }
.empty {
  padding: 20px;
  background: var(--panel);
  border: 1px dashed var(--line-2);
  border-radius: 8px;
  color: var(--ink-3);
  text-align: center;
  font-size: 14px;
}

.video-list.list-view .empty,
.video-list.feed-view .empty {
  border-radius: 12px;
}

.sync-main {
  display: grid;
  gap: 16px;
}

.sync-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 16px;
}

.sync-status-card {
  display: grid;
  gap: 12px;
  align-content: start;
}

.sync-state-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-width: 108px;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--line);
  font-weight: 700;
  letter-spacing: 0.01em;
}

.sync-state-chip.ok {
  background: #e7f5ea;
  border-color: #b7ddc1;
  color: #2e6f44;
}

.sync-state-chip.running,
.sync-state-chip.syncing {
  background: #eef3ff;
  border-color: #cbd9ff;
  color: #3357a6;
}

.sync-state-chip.ready {
  background: #e7f5ea;
  border-color: #b7ddc1;
  color: #2e6f44;
}

.sync-state-chip.error {
  background: #fff0ee;
  border-color: #f0cbc4;
  color: #9d3b2a;
}

.sync-state-chip.failed {
  background: #fff0ee;
  border-color: #f0cbc4;
  color: #9d3b2a;
}

.sync-summary {
  font-family: var(--serif);
  font-size: 28px;
  line-height: 1.2;
  color: var(--ink);
}

.sync-facts {
  margin: 12px 0 0;
  display: grid;
  gap: 12px;
}

.sync-facts div {
  display: grid;
  grid-template-columns: 124px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.sync-facts dt {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-3);
}

.sync-facts dd {
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--ink);
}

.sync-source-statuses {
  margin-top: 12px;
  display: grid;
  gap: 10px;
}

.sync-source-row {
  display: grid;
  grid-template-columns: 132px 92px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.sync-source-row:first-child {
  border-top: 0;
}

.sync-source-row strong {
  color: var(--ink);
}

.sync-source-row span {
  color: var(--ink-2);
}

.sync-source-row small {
  overflow-wrap: anywhere;
  color: var(--ink-3);
}

.sync-log-tail {
  margin: 12px 0 0;
  padding: 16px;
  border-radius: 12px;
  background: #f5f3ef;
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 980px) {
  .gallery-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .gallery-controls {
    justify-content: stretch;
  }

  .gallery-search,
  .gallery-select {
    width: 100%;
    min-width: 0;
    flex: 1 1 160px;
  }

  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(82px, 1fr));
  }

  .gallery-lightbox-stage {
    padding: 52px 12px 12px;
  }

  .gallery-lightbox-nav {
    top: auto;
    bottom: 78px;
    width: 40px;
    height: 48px;
    font-size: 36px;
  }

  .gallery-lightbox-info {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
  }

  .gallery-lightbox-title,
  .gallery-lightbox-meta {
    max-width: calc(100vw - 36px);
  }

  .screen-video {
    padding-left: 18px;
    padding-right: 18px;
  }

  .video-top {
    display: grid;
    grid-template-columns: 1fr;
  }

  .video-list.list-view .video-card {
    grid-template-columns: 1fr;
  }

  .video-table-head {
    display: none;
  }

  .video-list.list-view .video-stage,
  .video-list.list-view .video-metadata {
    grid-row: auto;
    grid-column: auto;
  }

  .video-overlay-actions {
    width: calc(100% - 24px);
    justify-content: center;
  }

  .sync-grid {
    grid-template-columns: 1fr;
  }

  .sync-facts div {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .sync-summary {
    font-size: 22px;
  }
}

/* conversation list */
.conv-list { display: flex; flex-direction: column; gap: 8px; }
.conv-item {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.conv-item:hover { border-color: var(--line-2); }
.conv-item .info { flex: 1; }
.conv-item .t { font-family: var(--serif); font-size: 15.5px; margin-bottom: 2px; }
.conv-item .meta { font-size: 12px; color: var(--ink-3); }
.conv-item .status {
  font-size: 11px; padding: 2px 8px;
  border-radius: 10px;
  background: var(--bg);
  color: var(--ink-3);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.conv-item .status.ready { background: #e5f1ea; color: #3f8a5c; }
.conv-item .status.processing { background: var(--primary-soft); color: var(--primary); }

/* progress */
.progress-block { margin-top: 12px; }
.progress-bar {
  height: 6px;
  background: var(--line);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 6px;
}
.progress-fill {
  height: 100%;
  background: var(--ink);
  width: 0%;
  transition: width 200ms;
}

/* audio preview */
.audio-preview { margin-top: 10px; }
audio { width: 100%; margin-top: 8px; }

/* checkbox */
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 14px;
}
.checkbox-row input { width: 18px; height: 18px; cursor: pointer; }

/* question list */
.q-list { display: flex; flex-direction: column; gap: 8px; }
.q-item {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
}
.q-item .q { font-family: var(--serif); font-size: 14.5px; margin-bottom: 4px; }
.q-item .a { font-size: 13.5px; color: var(--ink-2); }
.q-item .meta { font-size: 11px; color: var(--ink-3); margin-top: 4px; }

/* tabs */
.tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  border-bottom: 2px solid var(--line);
  overflow-x: auto;
}
.tab-btn {
  padding: 10px 16px;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  font-family: inherit;
  font-size: 14px;
  color: var(--ink-3);
  cursor: pointer;
  white-space: nowrap;
  margin-bottom: -2px;
}
.tab-btn.active {
  color: var(--ink);
  border-bottom-color: var(--ink);
  font-weight: 500;
}
.tab-pane { display: block; }
.tab-pane.hidden { display: none; }

/* bullet lists */
.bullet-list {
  margin: 0;
  padding-left: 20px;
  line-height: 1.65;
}
.bullet-list li { margin-bottom: 8px; font-size: 14.5px; }
.bullet-list.negative li { color: #6d2a2a; }
.bullet-list.muted li { color: var(--ink-3); }

/* orientation picker */
.orientation-picker {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}
.orient-choice {
  display: flex;
  align-items: start;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg);
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid var(--line);
  font-size: 14px;
}
.orient-choice input { margin-top: 3px; }
.orient-choice:has(input:checked) {
  background: var(--primary-soft);
  border-color: var(--primary);
}

/* goal list */
.goal-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.goal-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 14px;
}
.goal-item .goal-text { flex: 1; }
.goal-item .goal-meta { font-size: 11px; color: var(--ink-3); font-family: var(--mono); }
.goal-item button { background: transparent; border: none; cursor: pointer; font-size: 14px; }

/* soft banner */
.banner-soft {
  background: var(--primary-soft);
  border-left: 3px solid var(--primary);
  padding: 12px 14px;
  border-radius: 6px;
  font-size: 13.5px;
  color: #1f3f66;
  margin-bottom: 16px;
  line-height: 1.5;
}

/* chat */
.chat-main { display: flex; flex-direction: column; height: calc(100vh - 100px); }
.chat-messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 0;
}
.chat-msg { display: flex; }
.chat-msg.user { justify-content: flex-end; }
.chat-msg.ai { justify-content: flex-start; }
.chat-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  max-width: 75%;
  font-size: 14.5px;
  line-height: 1.5;
}
.chat-msg.user .chat-bubble {
  background: var(--ink);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.chat-msg.ai .chat-bubble {
  background: var(--panel);
  border: 1px solid var(--line);
  border-bottom-left-radius: 4px;
}
.chat-msg.typing .chat-bubble { opacity: 0.6; }
.dots { letter-spacing: 3px; }

.chat-input-row {
  display: flex;
  gap: 8px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  background: var(--bg);
}
.chat-input-row textarea { flex: 1; }

/* shared messages */
.messages-main {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 96px);
}

.messages-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 10px 0 8px;
}

.messages-thread {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 6px 0 28px;
}

.message-day {
  align-self: center;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin: 8px 0 2px;
}

.message-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: min(76%, 520px);
}

.message-row.mine {
  align-self: flex-end;
  align-items: flex-end;
}

.message-row.theirs {
  align-self: flex-start;
  align-items: flex-start;
}

.message-sender {
  padding: 0 4px;
  color: var(--ink-3);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.message-bubble {
  padding: 10px 14px;
  border-radius: 20px;
  line-height: 1.45;
  font-size: 14px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.message-row.mine .message-bubble {
  background: var(--ink);
  color: #fff;
  border-bottom-right-radius: 6px;
}

.message-row.theirs .message-bubble {
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line);
  border-bottom-left-radius: 6px;
}

.message-attachments {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.message-media-card {
  position: relative;
  overflow: hidden;
  width: min(360px, 72vw);
  border-radius: 20px;
  background: #111;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.message-media-card.image {
  background: #fff;
  border-color: var(--line);
}

.message-media-thumb,
.message-media-image,
.message-media-video {
  display: block;
  width: 100%;
  max-height: min(60vh, 420px);
  object-fit: cover;
}

.message-media-thumb,
.message-media-video {
  aspect-ratio: 3 / 4;
  background: #111;
}

.message-media-image {
  background: #fff;
}

.message-media-card.landscape .message-media-thumb,
.message-media-card.landscape .message-media-video,
.message-media-card.landscape .message-media-image {
  aspect-ratio: 16 / 9;
}

.message-media-play {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  min-width: 88px;
  background: rgba(12, 12, 12, 0.84);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.message-attachment-meta {
  padding: 8px 10px 10px;
  color: rgba(255, 255, 255, 0.74);
  font-size: 11px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.55));
}

.message-media-card.image .message-attachment-meta {
  color: var(--ink-3);
  background: #fff;
}

.message-media-card.audio,
.message-media-card.file {
  background: var(--panel);
  border-color: var(--line);
}

.message-file-shell {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 12px;
  align-items: start;
  padding: 14px;
}

.message-file-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--bg);
  font-size: 20px;
}

.message-file-main {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.message-file-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  word-break: break-word;
}

.message-file-sub {
  font-size: 12px;
  color: var(--ink-3);
  word-break: break-word;
}

.message-file-link {
  width: fit-content;
  padding: 8px 12px;
  text-decoration: none;
}

.message-audio-player {
  width: 100%;
  margin-top: 2px;
}

.message-load-hint {
  padding: 12px;
  color: var(--ink-3);
  font-size: 12px;
  background: var(--panel);
}

.message-meta {
  padding: 0 4px;
  color: var(--ink-3);
  font-size: 11px;
}

.archive-main {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.archive-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.archive-breadcrumbs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.archive-crumb.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.archive-summary {
  margin-top: 4px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
}

.archive-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 32px;
}

.archive-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
  text-align: left;
}

.archive-folder-row {
  cursor: pointer;
}

.archive-row-main {
  min-width: 0;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.archive-row-icon {
  font-size: 22px;
  line-height: 1;
}

.archive-row-title {
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.archive-row-meta {
  margin-top: 2px;
  color: var(--ink-3);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.archive-row-action {
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.guide-main {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.guide-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.guide-suggestion {
  border-radius: 999px;
}

.guide-thread {
  min-height: 320px;
  max-height: calc(100vh - 340px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 6px 0 18px;
}

.guide-row {
  display: flex;
}

.guide-row.mine {
  justify-content: flex-end;
}

.guide-row.assistant {
  justify-content: flex-start;
}

.guide-bubble {
  max-width: min(760px, 100%);
  padding: 14px 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid var(--line);
}

.guide-row.mine .guide-bubble {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.guide-role {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 8px;
}

.guide-row.mine .guide-role {
  color: rgba(255, 255, 255, 0.72);
}

.guide-text {
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.guide-citations {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.guide-citation {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
  color: var(--ink-3);
  font-size: 11px;
}

.guide-row.mine .guide-citation {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.84);
}

.guide-composer {
  display: grid;
  gap: 8px;
  position: sticky;
  bottom: 0;
  padding: 12px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--line);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* calendar scope explainer */
.scope-explainer { display: flex; flex-direction: column; gap: 10px; background: #fff8ec; border-color: #f2e3bf; }
.scope-row { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--ink-2); line-height: 1.45; }
.scope-pill { flex: 0 0 auto; font-family: var(--mono); font-size: 11px; padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.scope-pill.read { background: #e5efe4; color: #366c41; }
.scope-pill.write { background: #e7e4f2; color: #50449b; }

/* kind picker */
.kind-picker { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 14px; }
.kind-tile { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 14px 8px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; background: #fff; transition: border-color 120ms, background 120ms; gap: 4px; text-align: center; }
.kind-tile input { position: absolute; opacity: 0; pointer-events: none; }
.kind-tile:has(input:checked) { border-color: #9a8dc8; background: #f3eff9; }
.kind-ico { font-size: 22px; line-height: 1; }
.kind-label { font-size: 13px; color: var(--ink-2); }
@media (min-width: 640px) {
  .kind-picker { grid-template-columns: repeat(4, 1fr); }
}

/* datetime presets */
.preset-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.preset-btn { font-size: 12px; padding: 6px 10px; background: #fff; color: var(--ink-2); border: 1px solid var(--line); border-radius: 999px; cursor: pointer; transition: background 120ms, border-color 120ms; }
.preset-btn:hover { background: #f4efe7; border-color: var(--ink-3); }
.preset-btn.active { background: var(--ink); color: #fff; border-color: var(--ink); }

/* schedule confirmation */
.sched-invitee { margin: 8px 0 10px; padding: 8px 12px; background: #f7f4ee; border-radius: 8px; }
.sched-result { margin-top: 12px; padding: 12px 14px; background: #eaf5ec; border: 1px solid #c6e2ca; border-radius: 10px; font-size: 14px; color: #1f4a2a; }
.sched-result a { color: #1f4a2a; font-weight: 600; }

/* calendar event cards */
.cal-list { display: flex; flex-direction: column; gap: 12px; }
.cal-day-header { font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); margin: 12px 0 2px; }
.cal-day-header:first-child { margin-top: 0; }
.cal-event {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 14px;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
}
.cal-event.our-event { border-color: #c9bde8; background: linear-gradient(to right, #f5f1fb 0%, #fff 50%); }
.cal-date-badge { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 48px; background: #f3eff9; border-radius: 10px; color: var(--ink); line-height: 1; padding: 6px 0; }
.cal-date-badge .day { font-size: 20px; font-weight: 700; font-family: var(--serif); }
.cal-date-badge .mon { font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); margin-top: 2px; }
.cal-event-main { min-width: 0; }
.cal-event-main .cal-title { font-family: var(--serif); font-size: 15px; margin: 0 0 2px; line-height: 1.3; overflow-wrap: anywhere; }
.cal-event-main .cal-time { font-size: 12px; color: var(--ink-3); font-family: var(--mono); }
.cal-event-main .cal-loc { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.cal-type-icon { font-size: 22px; line-height: 1; }

@media (min-width: 640px) {
  .screen { padding: 40px; }
  .stack { gap: 24px; }
  .env-ribbon-inline {
    width: fit-content;
    min-width: 0;
  }
}

/* -------- Friendly landing page -------- */
.landing-hero {
  background:
    radial-gradient(ellipse at 20% 0%, #fde2d8 0%, transparent 55%),
    radial-gradient(ellipse at 85% 15%, #e8dff5 0%, transparent 55%),
    linear-gradient(180deg, #fdf8ef 0%, #faf5ed 60%, #f7f2ea 100%);
  align-items: center;
  justify-content: flex-start;
  padding-top: max(env(safe-area-inset-top), 40px);
  padding-bottom: 60px;
}
.landing-wrap {
  width: 100%;
  max-width: 760px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}
.landing-wrap .env-ribbon {
  margin-bottom: 4px;
}
.logo-halo {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle, rgba(255,255,255,0.6) 0%, rgba(255,255,255,0) 70%);
  margin-top: 12px;
  margin-bottom: 6px;
  animation: halo-float 6s ease-in-out infinite;
}
.logo-halo img {
  width: 120px;
  height: 120px;
  border-radius: 28px;
  box-shadow: 0 10px 40px -12px rgba(90, 60, 130, 0.25), 0 2px 6px rgba(0,0,0,0.06);
}
@keyframes halo-float {
  0%,100% { transform: translateY(0); }
  50%     { transform: translateY(-4px); }
}
.hero-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(44px, 8vw, 68px);
  line-height: 1;
  letter-spacing: -0.02em;
  margin: 0;
  color: #2a2433;
}
.hero-tag {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(18px, 2.4vw, 22px);
  color: #7a6d85;
  margin: 0;
}
.hero-lede {
  font-size: 17px;
  color: #4a4251;
  max-width: 460px;
  line-height: 1.55;
  margin: 4px 0 0;
}
.hero-cta { margin: 14px 0 8px; }
.btn-big {
  font-size: 16px;
  padding: 14px 28px;
  border-radius: 999px;
  box-shadow: 0 8px 24px -10px rgba(50, 30, 80, 0.3);
  transition: transform 120ms ease, box-shadow 120ms ease;
}
.btn-big:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px -10px rgba(50, 30, 80, 0.4);
}
.hero-cta-sub {
  font-size: 13px;
  color: #8a7f98;
  margin-top: 12px;
  font-style: italic;
}
.feature-grid {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-top: 28px;
}
.feature-card {
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 18px;
  padding: 22px 20px;
  text-align: left;
  box-shadow: 0 2px 12px -8px rgba(90, 60, 130, 0.15);
}
.feature-card .feature-ico {
  font-size: 30px;
  margin-bottom: 10px;
  line-height: 1;
}
.feature-card h3 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 18px;
  text-transform: none;
  letter-spacing: -0.005em;
  color: #2a2433;
  margin: 0 0 6px;
}
.feature-card p {
  font-size: 14px;
  color: #5a5063;
  line-height: 1.5;
  margin: 0;
}
.hero-trust {
  margin-top: 26px;
  font-size: 14px;
  color: #7a6d85;
  max-width: 500px;
  font-style: italic;
}
.site-footer {
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid rgba(122, 109, 133, 0.15);
  width: 100%;
}
.site-footer .muted { color: #998b9d; }
.site-footer a { color: #7a6d85; text-decoration: none; }
.site-footer a:hover { color: #2a2433; text-decoration: underline; }

@media (min-width: 720px) {
  .feature-grid { grid-template-columns: repeat(3, 1fr); }
}

/* =========================================================
   Pipeline review (on the conversation detail screen).
   Each stage renders as a compact card showing status, a
   one-line summary, and a few short audio clips the couple
   can listen to. Engineering fields (metrics, stageVersion)
   are intentionally not rendered.
   ========================================================= */
.stage-row {
  border-top: 1px solid var(--line);
  padding: 14px 0;
}
.stage-row:first-child { border-top: none; padding-top: 0; }
.stage-head {
  display: flex; align-items: baseline; gap: 10px;
  margin-bottom: 6px;
}
.stage-title {
  font-weight: 600; font-size: 15px; color: var(--ink);
}
.stage-chip {
  display: inline-block;
  font-size: 11px; font-family: var(--mono);
  padding: 2px 8px; border-radius: 10px;
  letter-spacing: 0.03em; text-transform: uppercase;
  border: 1px solid transparent;
}
.stage-chip.pending  { background: #f4efe7; color: var(--ink-3); }
.stage-chip.running  { background: #fff4d6; color: #7a6310; }
.stage-chip.done     { background: #e7f2e4; color: #426b33; }
.stage-chip.failed   { background: #f7e1dd; color: #7a2a1e; }
.stage-chip.skipped  { background: #eee; color: var(--ink-3); }

.stage-summary {
  font-size: 14px; color: var(--ink-2); margin-bottom: 8px;
}
.stage-clips {
  display: flex; flex-direction: column; gap: 8px;
}
.stage-clip {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center; gap: 10px;
  padding: 8px 10px;
  background: #fafaf6;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
}
.stage-clip .clip-label {
  color: var(--ink-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.stage-clip audio {
  height: 32px; min-width: 180px; max-width: 260px;
}
.stage-prompt {
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--primary-soft);
  border-radius: 8px;
  font-size: 13.5px;
}
.stage-prompt-q { margin-bottom: 8px; color: var(--ink-2); }
.stage-prompt-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.stage-prompt-actions button {
  padding: 5px 12px; font-size: 13px;
  border: 1px solid var(--line); background: #fff;
  border-radius: 6px; cursor: pointer;
  font-family: inherit;
}
.stage-prompt-actions button.answered {
  background: var(--ink); color: #fff; border-color: var(--ink);
}
.stage-prompt-actions button:hover { background: #f4efe7; }
.stage-prompt-actions button.answered:hover { background: #333; }

/* =========================================================
   Transcript (on the conversation detail screen).
   Fast-pass (v1) arrives in ~30 s after upload; refined pass
   (v2) overwrites it ~20 min later with emotion moods.
   ========================================================= */
.transcript-header {
  display: flex; align-items: baseline; gap: 10px;
  margin-bottom: 6px;
}
.transcript-header h3 { margin: 0; }
.transcript-badge {
  font-size: 11px; font-family: var(--mono);
  padding: 2px 8px; border-radius: 10px;
  letter-spacing: 0.03em; text-transform: uppercase;
  background: #f4efe7; color: var(--ink-2);
  border: 1px solid var(--line);
}
.transcript-badge.quick   { background: #fff4d6; color: #7a6310; border-color: #e6d9a6; }
.transcript-badge.refined { background: #e7f2e4; color: #426b33; border-color: #b5d2ab; }

#conv-transcript-body {
  margin-top: 12px;
  max-height: 70vh;
  overflow-y: auto;
  padding-right: 4px;
}

.utt {
  display: grid;
  grid-template-columns: 62px 1fr;
  gap: 10px;
  margin: 6px 0;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.1s ease;
  border: 1px solid transparent;
}
.utt:hover { background: #fafaf6; border-color: var(--line); }
.utt.playing { background: #fff4d6; border-color: #e6d9a6; }
.utt.rachel { border-left: 3px solid var(--rachel); }
.utt.tarun  { border-left: 3px solid var(--tarun); }

.utt-meta {
  display: flex; flex-direction: column; gap: 3px;
  align-items: flex-start;
}
.utt-time {
  font-size: 10px; font-family: var(--mono);
  color: var(--ink-3);
  white-space: nowrap;
}
.utt-speaker {
  font-size: 11px; font-weight: 600;
  padding: 2px 7px; border-radius: 10px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.utt.rachel .utt-speaker { background: #f1dcd4; color: #7a2a1e; }
.utt.tarun  .utt-speaker { background: #d8e2f0; color: #223c6b; }

.utt-body {
  min-width: 0;  /* allow text wrapping within grid */
}
.utt-text {
  font-size: 15px; line-height: 1.55;
  color: var(--ink);
}
.utt-mood {
  display: inline-block;
  font-size: 10px; font-family: var(--mono);
  padding: 1px 6px; border-radius: 8px;
  margin-left: 6px;
  background: #eee; color: var(--ink-2);
  vertical-align: middle;
}
.utt-mood.warm    { background: #fbe4d4; color: #7a4a1e; }
.utt-mood.tense   { background: #f7d8d2; color: #7a2a1e; }
.utt-mood.sad     { background: #dce4ef; color: #2b3d5e; }
.utt-mood.excited { background: #e4ddd0; color: #6a5420; }
