/* Stillhaven console — calm, creator-first, considered.
   Sage leads; clay only for play/CTA; square corners throughout. */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: var(--text-body);
  font-weight: var(--weight-regular);
  line-height: 1.5;
}

a {
  color: var(--color-link);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

h1 {
  font-size: var(--text-h1);
  font-weight: var(--weight-semibold);
  margin: 0 0 0.25rem;
}

h2 {
  font-size: var(--text-h2);
  font-weight: var(--weight-semibold);
  margin: 0 0 0.75rem;
}

.muted {
  color: var(--color-text-muted);
  font-size: var(--text-caption);
}

/* ---- Top bar ---------------------------------------------------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.875rem 1.5rem;
  border-bottom: 1px solid var(--n-200);
  background: var(--paper);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--ink);
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  display: inline-flex;
  width: 32px;
  height: 32px;
}

.brand-word {
  font-weight: var(--weight-medium);
  font-size: 1.15rem;
  letter-spacing: 0.2px;
}

.brand-word-accent {
  color: var(--sage-500);
}

.topnav {
  display: inline-flex;
  align-items: center;
  gap: 1rem;
}

.topnav-user {
  font-size: var(--text-caption);
  color: var(--color-text-muted);
}

/* ---- Buttons ---------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-box);
  border: 1px solid transparent;
  font: inherit;
  font-weight: var(--weight-medium);
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.btn:hover {
  text-decoration: none;
}

.btn:focus-visible {
  outline: 2px solid var(--sage-700);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--sage-500);
  color: #fff;
}

.btn-primary:hover {
  background: var(--sage-600);
}

/* Clay is reserved for the primary action / play — used sparingly. */
.btn-accent {
  background: var(--clay);
  color: #fff;
}

.btn-accent:hover {
  background: var(--clay-dark);
}

.btn-ghost {
  background: transparent;
  border-color: var(--n-300);
  color: var(--ink);
}

.btn-ghost:hover {
  background: var(--n-100);
}

.btn-block {
  width: 100%;
}

/* ---- Layout ----------------------------------------------------------- */
.container {
  flex: 1;
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

/* ---- Cards ------------------------------------------------------------ */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.card {
  background: #fff;
  border: 1px solid var(--n-200);
  border-radius: var(--radius-box);
  padding: 1.25rem;
}

.card-wide {
  grid-column: 1 / -1;
}

.card-title {
  font-size: var(--text-h2);
}

.metric {
  margin: 0.25rem 0 0.5rem;
}

.metric-num {
  font-size: 2rem;
  font-weight: var(--weight-bold);
  color: var(--sage-600);
}

.metric-unit {
  color: var(--color-text-muted);
  font-size: var(--text-caption);
}

/* ---- Empty state ------------------------------------------------------ */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  text-align: center;
  padding: 2.5rem 1rem;
  border: 1px dashed var(--n-300);
  color: var(--color-text-muted);
}

/* ---- Auth ------------------------------------------------------------- */
.auth {
  display: flex;
  justify-content: center;
  padding-top: 3rem;
}

.auth-box {
  width: 100%;
  max-width: 360px;
  background: #fff;
  border: 1px solid var(--n-200);
  padding: 2rem;
}

.alert {
  background: var(--clay-tint);
  color: var(--clay-dark);
  padding: 0.6rem 0.8rem;
  font-size: var(--text-caption);
}

code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--n-100);
  padding: 0.1em 0.35em;
}

/* ---- Video list ------------------------------------------------------- */
.video-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.video-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--n-200);
}

.video-row:last-child {
  border-bottom: 0;
}

.video-title {
  font-weight: var(--weight-medium);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.video-meta {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.badge {
  font-size: var(--text-caption);
  font-weight: var(--weight-medium);
  padding: 0.1rem 0.5rem;
  border: 1px solid var(--n-300);
  color: var(--n-700);
}

.badge-ready {
  background: var(--sage-100);
  border-color: var(--sage-300);
  color: var(--sage-700);
}

.badge-processing,
.badge-uploading {
  background: var(--n-100);
  border-color: var(--n-300);
  color: var(--n-700);
}

.badge-failed {
  background: #f7e8e6;
  border-color: #b85f53;
  color: #7a3028;
}

/* ---- Public share page ------------------------------------------------ */
/* --bar-bg / --bar-fg are theming hooks (paid plans override them later). */
.share-body {
  --bar-bg: var(--sage-900);        /* top bar */
  --bar-bottom-bg: var(--sage-700); /* bottom bar — lighter, same family */
  --bar-fg: var(--paper);
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: #fff; /* video stage in the middle */
}

.share-bar {
  width: 100%;
  color: var(--bar-fg);
}

.share-bar-top {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.9rem 1.5rem;
  background: var(--bar-bg);
}

.share-bar-bottom {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0.6rem 1.5rem;
  background: var(--bar-bottom-bg);
}

.share-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.share-word {
  font-weight: var(--weight-medium);
  font-size: 1.15rem;
  letter-spacing: 0.2px;
  color: var(--bar-fg);
}

.share-word-accent {
  color: var(--sage-400);
}

.share-powered {
  color: var(--n-300);
  font-size: var(--text-caption);
  text-decoration: none;
}

.share-powered:hover {
  color: var(--bar-fg);
  text-decoration: none;
}

.share-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.share-content {
  width: 100%;
  max-width: 920px;
}

.share-title {
  color: var(--ink);
  font-size: var(--text-h2);
  font-weight: var(--weight-semibold);
  margin: 0 0 0.75rem;
}

.share-sub {
  color: var(--color-text-muted);
  font-size: var(--text-caption);
}

/* ---- Video page ------------------------------------------------------- */
.breadcrumb {
  margin: 0 0 0.5rem;
  font-size: var(--text-caption);
}

.video-layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(240px, 1fr);
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 760px) {
  .video-layout {
    grid-template-columns: 1fr;
  }
}

.player {
  width: 100%;
  background: var(--ink);
  aspect-ratio: 16 / 9;
  display: block;
}

/* Portrait videos: tall player instead of an extreme pillarbox in a 16:9 frame. */
.player--portrait {
  aspect-ratio: 9 / 16;
  max-height: 70vh;
  width: auto;
  max-width: 100%;
  margin: 0 auto;
}

.video-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.video-side {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.detail-list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.35rem 1rem;
  margin: 0;
  font-size: var(--text-caption);
}

.detail-list dt {
  color: var(--color-text-muted);
}

.detail-list dd {
  margin: 0;
  text-align: right;
  font-weight: var(--weight-medium);
}

/* ---- Modal + upload --------------------------------------------------- */
.modal[hidden] {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(26, 26, 26, 0.45); /* --ink at 45% opacity */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 50;
}

.modal-box {
  background: #fff;
  width: 100%;
  max-width: 460px;
  padding: 1.5rem;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.modal-head h2 {
  margin: 0;
}

.modal-close {
  background: none;
  border: 0;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: var(--color-text-muted);
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: -0.5rem -0.5rem -0.5rem 0;
}

.modal-close:focus-visible {
  outline: 2px solid var(--sage-700);
  outline-offset: 2px;
}

.field {
  display: block;
  margin-bottom: 1rem;
}

.field > span {
  display: block;
  font-size: var(--text-caption);
  font-weight: var(--weight-medium);
  margin-bottom: 0.3rem;
}

.field input[type="file"],
.field select {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--n-300);
  border-radius: var(--radius-box);
  font: inherit;
  background: #fff;
}

.field-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.field-check > span {
  margin: 0;
  font-weight: var(--weight-regular);
}

.progress {
  height: 8px;
  background: var(--n-200);
  margin-bottom: 0.5rem;
}

.progress[hidden] {
  display: none;
}

.progress-bar {
  height: 100%;
  width: 0;
  background: var(--sage-500);
  transition: width 0.2s ease;
}

.upload-status {
  min-height: 1.2em;
  margin: 0 0 1rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* ---- Footer ----------------------------------------------------------- */
.site-footer {
  padding: 1.25rem 1.5rem;
  border-top: 1px solid var(--n-200);
  text-align: center;
}

.tagline {
  text-transform: lowercase;
  letter-spacing: var(--tagline-tracking);
  color: var(--color-text-muted);
  font-size: var(--text-caption);
}

/* ======================================================================
   App shell (sidebar layout)
   ====================================================================== */
.app {
  flex: 1;
  display: grid;
  grid-template-columns: 232px 1fr;
  min-height: 0;
}

.sidebar {
  display: flex;
  flex-direction: column;
  background: #fff;
  border-right: 1px solid var(--n-200);
  padding: 1.25rem 0.75rem;
  overflow-y: auto; /* folder list scrolls independently when long */
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.side-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.side-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.75rem;
  color: var(--ink);
  font-weight: var(--weight-medium);
  font-size: 0.95rem;
}

.side-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.side-link.is-disabled .side-icon {
  stroke-width: 1.6;
}

a.side-link:hover {
  background: var(--n-100);
  text-decoration: none;
}

.side-link.is-active {
  background: var(--sage-100);
  color: var(--sage-700);
}

.side-link.is-disabled {
  color: var(--n-400);
  cursor: default;
}

.side-label {
  margin: 1.1rem 0.75rem 0.25rem;
  font-size: var(--text-caption);
  font-weight: var(--weight-medium);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
}

.soon {
  margin-left: auto;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--n-400);
  border: 1px solid var(--n-300);
  padding: 0 4px;
  line-height: 1.6;
}

.side-foot {
  padding: 0.75rem;
}

.app-main {
  min-width: 0;
  padding: 2rem;
  overflow-y: auto; /* content scrolls; sidebar + topbar stay put */
}

/* App shell fills the viewport so the sidebar and main scroll independently. */
body.has-shell {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

/* ======================================================================
   Stat tiles
   ====================================================================== */
.stat-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.tile {
  background: #fff;
  border: 1px solid var(--n-200);
  border-top: 2px solid var(--sage-300);
  padding: 1.1rem 1.25rem;
}

.tile-num {
  display: block;
  font-size: 1.9rem;
  font-weight: var(--weight-bold);
  color: var(--sage-600);
  line-height: 1.1;
  margin-bottom: 0.15rem;
}

.tile-label {
  font-size: var(--text-caption);
  font-weight: var(--weight-medium);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
}

/* ======================================================================
   Video grid (thumbnail cards)
   ====================================================================== */
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.25rem;
}

.vcard {
  position: relative;
  background: #fff;
  border: 1px solid var(--n-200);
  transition: border-color 0.15s ease;
}

.vcard:hover {
  border-color: var(--n-300);
}

.vcard-link {
  display: block;
  color: inherit;
}

.vcard-link:hover {
  text-decoration: none;
}

.vcard-thumb {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  background: var(--sage-900);
  overflow: hidden;
}

.vcard-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Portrait posters: fit the whole frame (pillarboxed on the sage backdrop)
   instead of cropping the top and bottom off a vertical clip. */
.vcard-thumb--portrait img {
  object-fit: contain;
}

.vcard-thumb-empty {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--sage-200), var(--sage-400));
}

.vcard-play {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 1px 6px rgba(0, 0, 0, 0.35));
}

.vcard-play svg {
  width: 100%;
  height: 100%;
  display: block;
}

.vcard:hover .vcard-play {
  background: var(--clay-dark);
}

.vcard-badge {
  position: absolute;
  bottom: 8px;
  left: 8px;
  background: rgba(255, 255, 255, 0.92);
}

/* Favorite star (top-left): always shown when favorited, on hover otherwise. */
.vcard-fav {
  position: absolute;
  top: 6px;
  left: 6px;
  z-index: 2;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--n-200);
  color: var(--n-700);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.vcard-fav svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linejoin: round;
}

.vcard:hover .vcard-fav,
.vcard-fav:focus-visible {
  opacity: 1;
}

.vcard-fav.is-fav {
  opacity: 1;
  color: var(--clay);
}

.vcard-fav.is-fav svg {
  fill: var(--clay);
}

@media (hover: none) {
  .vcard-fav {
    opacity: 1;
  }
}

.fav-sort {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: var(--text-caption);
}

.fav-sort select {
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--n-300);
  border-radius: var(--radius-box);
  font: inherit;
  background: #fff;
}

/* Player color controls (video override + folder) */
.player-color {
  margin-top: 0.9rem;
}

.player-color .opt-label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: var(--text-caption);
  font-weight: var(--weight-medium);
}

.player-color-row,
.folder-color-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: var(--text-caption);
}

.folder-color-bar {
  margin-bottom: 1.5rem;
  padding: 0.55rem 0.8rem;
  background: #fff;
  border: 1px solid var(--n-200);
}

input[type="color"] {
  width: 38px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--n-300);
  border-radius: var(--radius-box);
  background: #fff;
  cursor: pointer;
}

.link-btn {
  padding: 0;
  background: none;
  border: 0;
  color: var(--color-link);
  font: inherit;
  font-size: var(--text-caption);
  cursor: pointer;
  text-decoration: underline;
}

.video-fav {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.6rem;
  background: none;
  border: 1px solid var(--n-300);
  color: var(--n-700);
  font: inherit;
  font-size: var(--text-caption);
  font-weight: var(--weight-medium);
  cursor: pointer;
}

.video-fav svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linejoin: round;
}

.video-fav:hover {
  border-color: var(--clay);
}

.video-fav.is-fav {
  color: var(--clay);
  border-color: var(--clay);
}

.video-fav.is-fav svg {
  fill: var(--clay);
}

.vcard-meta {
  display: block;
  padding: 0.7rem 0.8rem;
}

.vcard-title {
  display: block;
  font-weight: var(--weight-medium);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vcard-sub {
  display: block;
  font-size: var(--text-caption);
}

.vcard-copy {
  position: absolute;
  /* Offset slightly so the 44px target stays within the card. */
  top: 4px;
  right: 4px;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--n-200);
  color: var(--n-700);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.vcard:hover .vcard-copy,
.vcard-copy:focus-visible {
  opacity: 1;
}

/* Touch devices have no hover — keep the quick-copy button visible. */
@media (hover: none) {
  .vcard-copy {
    opacity: 1;
  }
}

.vcard-copy.is-copied {
  color: var(--sage-600);
  border-color: var(--sage-400);
}

/* ======================================================================
   Dropzone
   ====================================================================== */
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  text-align: center;
  padding: 1.75rem 1rem;
  border: 1px dashed var(--n-300);
  color: var(--color-text-muted);
  cursor: pointer;
  margin-bottom: 1rem;
}

.dropzone.is-active {
  border-color: var(--sage-500);
  background: var(--sage-50);
  color: var(--sage-700);
}

.dz-link {
  color: var(--color-link);
  text-decoration: underline;
}

.dz-filename {
  font-weight: var(--weight-medium);
  color: var(--ink);
}

.dz-filename:empty {
  display: none;
}

.empty-lg {
  padding: 3.5rem 1rem;
  margin-bottom: 1.5rem;
}

/* ======================================================================
   Video page — head + play funnel
   ====================================================================== */
.video-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.video-head h1 {
  margin: 0;
}

.funnel {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.funnel-row {
  display: grid;
  grid-template-columns: max-content 1fr 2.5rem;
  align-items: center;
  gap: 0.6rem;
  font-size: var(--text-caption);
}

.funnel-label {
  color: var(--color-text-muted);
}

.funnel-track {
  height: 6px;
  background: var(--n-100);
  overflow: hidden;
}

.funnel-fill {
  display: block;
  height: 100%;
  min-width: 1px;
  background: var(--sage-600);
}

.funnel-val {
  text-align: right;
  font-weight: var(--weight-medium);
  font-variant-numeric: tabular-nums;
}

/* ======================================================================
   Responsive — sidebar collapses to a top strip
   ====================================================================== */
@media (max-width: 760px) {
  .app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--n-200);
    padding: 0.4rem 0.75rem;
  }

  .side-nav {
    flex-direction: row;
  }

  .sidebar .side-label,
  .sidebar .side-foot,
  .sidebar .side-link.is-disabled {
    display: none;
  }

  .app-main {
    padding: 1.25rem;
  }
}

/* ======================================================================
   Accessibility — reduced motion
   ====================================================================== */
/* ======================================================================
   Custom video player
   ====================================================================== */
.vplayer {
  --player-accent: #849b54;
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  overflow: hidden;
}

.vplayer--portrait {
  aspect-ratio: 9 / 16;
  max-height: 70vh;
  width: auto;
  max-width: 100%;
  margin: 0 auto;
}

.vplayer-video {
  width: 100%;
  height: 100%;
  display: block;
  background: #000;
}

/* Big center play button — the brand box (square, perforated) with a play triangle. */
.vplayer-bigplay {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 88px;
  height: 88px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  filter: drop-shadow(0 2px 12px rgba(0, 0, 0, 0.45));
  transition: transform 0.15s ease;
}

.vplayer-bigplay svg {
  width: 100%;
  height: 100%;
  display: block;
}

.vplayer-bigplay:hover {
  transform: scale(1.06);
}

.vplayer-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.3rem 1rem;
  background: color-mix(in srgb, var(--player-accent) 75%, transparent); /* accent @ 75% */
  color: #fff;
  transition: opacity 0.2s ease; /* quick to show */
}

.vplayer.vp-idle .vplayer-bar {
  opacity: 0;
  transition: opacity 0.8s ease; /* slow, gentle fade out */
}

.vplayer.vp-idle {
  cursor: none;
}

.vp-btn {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: none;
  border: 0;
  color: #fff;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.vp-btn svg {
  width: 32px;
  height: 32px;
  fill: currentColor;
}

.vp-btn:hover {
  opacity: 0.75;
}

.vp-cc {
  width: auto;
  padding: 0 10px;
  font-weight: var(--weight-semibold);
  font-size: 1rem;
  opacity: 0.7;
}

.vp-cc.is-on {
  opacity: 1;
}

/* Volume: one mute button (icon swaps by class) + a slider. */
.vp-volume {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  flex-shrink: 0;
}

.vp-icon-mute {
  display: none;
}

.vp-mute.is-muted .vp-icon-vol {
  display: none;
}

.vp-mute.is-muted .vp-icon-mute {
  display: inline-block;
}

.vp-vol {
  width: 78px;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255, 255, 255, 0.4);
  cursor: pointer;
}

.vp-vol::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
}

.vp-vol::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
}

.vp-scrub {
  position: relative;
  flex: 1;
  height: 8px;
  background: rgba(255, 255, 255, 0.3);
  cursor: pointer;
}

.vp-buffered,
.vp-progress {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0;
}

.vp-buffered {
  background: rgba(255, 255, 255, 0.4);
}

.vp-progress {
  background: #fff;
}

.vp-handle {
  position: absolute;
  top: 50%;
  left: 0;
  width: 15px;
  height: 15px;
  margin-left: -7px;
  border-radius: 50%;
  background: #fff;
  transform: translateY(-50%);
}

.vp-time {
  flex-shrink: 0;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  .btn,
  .vcard,
  .vcard-copy,
  .vcard-menu-btn,
  .vcard-fav,
  .side-caret,
  .progress-bar,
  .dropzone,
  .account-overlay,
  .account-panel,
  .vplayer-bigplay,
  .vplayer-bar {
    transition: none;
  }
}

/* ======================================================================
   Account button + right slide-out drawer
   ====================================================================== */
.btn-account svg {
  flex-shrink: 0;
}

.account-drawer {
  position: fixed;
  inset: 0;
  z-index: 60;
  visibility: hidden;
}

.account-drawer.is-open {
  visibility: visible;
}

.account-overlay {
  position: absolute;
  inset: 0;
  background: rgba(26, 26, 26, 0.4);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.account-drawer.is-open .account-overlay {
  opacity: 1;
}

.account-panel {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: 300px;
  max-width: 85vw;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-left: 1px solid var(--n-200);
  padding: 1.25rem;
  transform: translateX(100%);
  transition: transform 0.2s ease;
}

.account-drawer.is-open .account-panel {
  transform: translateX(0);
}

.account-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.account-title {
  font-size: var(--text-h2);
  font-weight: var(--weight-semibold);
}

.account-email {
  margin: 0.25rem 0 1.25rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.account-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.6rem;
  color: var(--ink);
  font-weight: var(--weight-medium);
  font-size: 0.95rem;
}

a.account-link:hover {
  background: var(--n-100);
  text-decoration: none;
}

.account-link.is-disabled {
  color: var(--n-400);
  cursor: default;
}

.account-link svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.account-link .soon {
  margin-left: auto;
}

.account-foot {
  margin-top: auto;
  padding-top: 1rem;
}

/* ======================================================================
   Folders — sidebar tree, folder view, card menus, dialogs
   ====================================================================== */
.side-sub {
  padding-left: 2.35rem;
  font-size: 0.9rem;
}

.side-sub .side-text {
  color: var(--n-700);
}

.side-sub.is-active .side-text {
  color: var(--sage-700);
}

.side-add {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0.35rem 0.25rem 0;
  padding: 0.4rem 0.5rem;
  background: none;
  border: 0;
  color: var(--color-link);
  font: inherit;
  font-size: 0.9rem;
  font-weight: var(--weight-medium);
  cursor: pointer;
}

.side-add:hover {
  text-decoration: underline;
}

.side-add svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.side-empty {
  margin: 0.15rem 0.75rem;
  font-size: var(--text-caption);
  color: var(--color-text-muted);
}

.side-caret {
  margin-left: auto;
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  color: var(--n-400);
  transition: transform 0.15s ease;
}

.side-caret.is-open {
  transform: rotate(90deg);
}

/* Folder view */
.head-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.subfolder-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.subfolder-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.7rem;
  background: #fff;
  border: 1px solid var(--n-200);
  color: var(--ink);
  font-size: var(--text-caption);
  font-weight: var(--weight-medium);
}

.subfolder-chip:hover {
  border-color: var(--sage-400);
  text-decoration: none;
}

.subfolder-chip svg {
  color: var(--sage-600);
}

/* Card quick-action menu (kebab) */
.vcard-actions {
  position: absolute;
  top: 6px;
  right: 6px;
}

.vcard-menu-btn {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--n-200);
  color: var(--n-700);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.vcard-menu-btn svg {
  fill: currentColor;
}

.vcard:hover .vcard-menu-btn,
.vcard-menu-btn:focus-visible,
.vcard-menu-btn[aria-expanded="true"] {
  opacity: 1;
}

@media (hover: none) {
  .vcard-menu-btn {
    opacity: 1;
  }
}

.vcard-menu {
  position: absolute;
  top: 34px;
  right: 0;
  min-width: 170px;
  display: flex;
  flex-direction: column;
  padding: 4px;
  background: #fff;
  border: 1px solid var(--n-200);
  box-shadow: 0 6px 20px rgba(26, 26, 26, 0.12);
  z-index: 10;
}

.vcard-menu[hidden] {
  display: none;
}

.vcard-menu > button,
.vcard-menu > a {
  text-align: left;
  background: none;
  border: 0;
  padding: 0.5rem 0.6rem;
  font: inherit;
  font-size: var(--text-caption);
  color: var(--ink);
  cursor: pointer;
}

.vcard-menu > button:hover,
.vcard-menu > a:hover {
  background: var(--n-100);
  text-decoration: none;
}

/* Small dialogs (move / folder name) + inline form errors */
.modal-sm {
  max-width: 380px;
}

.field input[type="text"] {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--n-300);
  border-radius: var(--radius-box);
  font: inherit;
  background: #fff;
}

.form-error {
  margin: 0 0 1rem;
  color: var(--clay-dark);
  font-size: var(--text-caption);
}

.form-error[hidden] {
  display: none;
}

/* ======================================================================
   Video CRUD — small/danger buttons, Trash cards, playback options
   ====================================================================== */
.btn-sm {
  padding: 0.35rem 0.7rem;
  font-size: var(--text-caption);
}

.btn-danger {
  color: var(--clay-dark);
  border-color: var(--n-300);
}

.btn-danger:hover {
  background: var(--clay-tint);
  border-color: var(--clay);
}

.vcard-menu > .menu-danger {
  color: var(--clay-dark);
}

.vcard-menu > .menu-danger:hover {
  background: var(--clay-tint);
}

/* Trash cards */
.vcard-thumb.is-trashed img,
.vcard-thumb.is-trashed .vcard-thumb-empty {
  filter: grayscale(0.6);
  opacity: 0.7;
}

.vcard-trash-actions {
  display: flex;
  gap: 0.5rem;
  padding: 0 0.8rem 0.8rem;
}

.vcard-trash-actions .btn {
  flex: 1;
}

/* Playback options card */
.options-form {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.opt-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: var(--text-caption);
}

.opt-row input {
  flex-shrink: 0;
}

.opt-saved {
  margin: 0;
  color: var(--sage-600);
}

.opt-saved[hidden] {
  display: none;
}

.opt-hint {
  margin: -0.2rem 0 0 1.6rem;
}

.opt-hint[hidden] {
  display: none;
}

.opt-row input:disabled + span {
  color: var(--n-400);
}

/* Change-thumbnail picker */
.thumb-frames {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
  gap: 0.5rem;
  max-height: 320px;
  overflow-y: auto;
  margin: 0.75rem 0;
  padding: 2px;
}

.thumb-frame {
  position: relative;
  display: block;
  padding: 0;
  border: 2px solid transparent;
  background: var(--sage-900);
  aspect-ratio: 16 / 9;
  overflow: hidden;
  cursor: pointer;
}

.thumb-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.thumb-frame span {
  position: absolute;
  right: 0;
  bottom: 0;
  padding: 1px 4px;
  background: rgba(26, 26, 26, 0.7);
  color: #fff;
  font-size: 11px;
}

.thumb-frame:hover {
  border-color: var(--sage-400);
}

.thumb-frame.is-current {
  border-color: var(--clay);
}

.thumb-upload {
  display: block;
  text-align: center;
  cursor: pointer;
}

/* ======================================================================
   Login screen (standalone, branded)
   ====================================================================== */
.login-body {
  margin: 0;
  min-height: 100vh;
  background: var(--sage-50);
  color: var(--color-text);
  font-family: var(--font-sans);
}

.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.25rem;
}

.login-card {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  background: #fff;
  border: 1px solid var(--n-200);
  padding: 2.5rem 2rem;
}

.login-mark {
  display: inline-flex;
  margin-bottom: 1rem;
}

.login-word {
  font-weight: var(--weight-medium);
  font-size: 1.5rem;
  letter-spacing: 0.2px;
  color: var(--ink);
}

.login-tagline {
  margin-top: 0.35rem;
}

.login-title {
  margin: 1.75rem 0 0.4rem;
  font-size: var(--text-h2);
}

.login-sub {
  margin: 0 0 1.5rem;
  max-width: 32ch;
}

.login-cta {
  width: 100%;
}

.login-fine {
  margin: 0.9rem 0 0;
  font-size: 12px;
}

.login-alert {
  width: 100%;
  margin: 1.5rem 0 0;
  text-align: left;
}

.auth-form {
  width: 100%;
  margin-top: 1.25rem;
  text-align: left;
}

.auth-form .field {
  margin-bottom: 0.9rem;
}

.auth-form input[type="email"],
.auth-form input[type="password"] {
  width: 100%;
  padding: 0.55rem 0.6rem;
  border: 1px solid var(--n-300);
  border-radius: var(--radius-box);
  font: inherit;
  background: #fff;
}

.auth-form input:focus {
  outline: none;
  border-color: var(--sage-500);
}

.login-form-error {
  margin: 0 0 0.85rem;
}

.login-or {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  margin: 1rem 0;
  color: var(--color-text-muted);
  font-size: var(--text-caption);
}

.login-or::before,
.login-or::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--n-200);
}

.login-google {
  gap: 0.6rem;
}

/* ======================================================================
   Team
   ====================================================================== */
.field input[type="email"] {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--n-300);
  border-radius: var(--radius-box);
  font: inherit;
  background: #fff;
}

.team-table {
  border: 1px solid var(--n-200);
  background: #fff;
}

.team-row {
  display: grid;
  grid-template-columns: 1fr 8rem 7rem auto;
  align-items: center;
  gap: 1rem;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--n-200);
}

.team-row:last-child {
  border-bottom: 0;
}

.team-head {
  font-size: var(--text-caption);
  font-weight: var(--weight-medium);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  background: var(--n-100);
}

.team-email {
  font-weight: var(--weight-medium);
  overflow: hidden;
  text-overflow: ellipsis;
}

.team-you {
  margin-left: 0.4rem;
  padding: 0 5px;
  font-size: 11px;
  color: var(--sage-700);
  background: var(--sage-100);
}

.team-role {
  width: 100%;
  padding: 0.35rem 0.4rem;
  border: 1px solid var(--n-300);
  border-radius: var(--radius-box);
  font: inherit;
  background: #fff;
}

.team-role-static {
  color: var(--color-text-muted);
}

.team-actions {
  text-align: right;
}

@media (max-width: 640px) {
  .team-row {
    grid-template-columns: 1fr auto;
    row-gap: 0.4rem;
  }

  .team-head {
    display: none;
  }
}
