:root {
  --bg: #f6f6f4;
  --card: #ffffff;
  --ink: #1a1a1a;
  --muted: #6b6b6b;
  --line: #e4e4e0;
  --accent: #5b68c7;
  --brand-grad: linear-gradient(100deg, #39c1ff 0%, #4976ff 35%, #912cee 70%, #eb30b3 100%);
  --btn-grad: linear-gradient(100deg, #4976ff 0%, #912cee 100%);
  --accent-ink: #ffffff;
  --danger: #c62828;
  --mark: #ff3b30;
  --radius: 10px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; font-size: 15px; line-height: 1.45; }
h1 { font-size: 1.4rem; margin: 0; }
h2 { font-size: 1.05rem; margin: 0 0 .5rem; }
p { margin: .35rem 0; }
a { color: inherit; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.loading { padding: 3rem; text-align: center; color: var(--muted); }

input, select, textarea, button { font: inherit; }
input, select, textarea {
  border: 1px solid var(--line); border-radius: 8px; padding: .55rem .7rem;
  background: #fff; color: var(--ink); min-width: 0;
}
textarea { width: 100%; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

button, .button { cursor: pointer; border-radius: 8px; padding: .5rem .85rem; border: 1px solid transparent; background: none; }
button:disabled { opacity: .5; cursor: default; }
.primary { background: var(--btn-grad); color: var(--accent-ink); font-weight: 600; }
.primary:hover:not(:disabled) { filter: brightness(1.08); }
.ghost { border-color: var(--line); background: #fff; display: inline-flex; align-items: center; }
.ghost.on { background: var(--mark); color: #fff; border-color: var(--mark); }
.link { padding: .2rem .3rem; color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }
.link:hover { color: var(--ink); }
.danger { color: var(--danger); }

.row { display: flex; align-items: center; }
.between { justify-content: space-between; }
.gap { gap: .5rem; }
.wrap-row { flex-wrap: wrap; gap: .5rem; }

.top {
  display: flex; justify-content: space-between; align-items: center;
  padding: .75rem 1.25rem; background: #fff; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.top { border-image: var(--brand-grad) 1; border-width: 0 0 2px; border-style: solid; }
.brand { display: inline-flex; align-items: center; gap: .6rem; text-decoration: none; }
.brand img { height: 28px; width: auto; display: block; }
.brand span { font-size: .8rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding-left: .6rem; border-left: 1px solid var(--line); }
.signin-icon { width: 40px; height: 40px; }

/* ---------- branded sign-in ---------- */
.auth {
  min-height: 100vh; display: grid; place-items: center; padding: 2rem 1rem;
  background:
    radial-gradient(60rem 40rem at 10% -10%, rgba(73,118,255,.28), transparent 60%),
    radial-gradient(50rem 40rem at 110% 110%, rgba(235,48,179,.22), transparent 60%),
    #0e0f1a;
  color: #fff;
}
.auth-inner { width: min(420px, 100%); display: grid; gap: 1.5rem; justify-items: center; }
.auth-logo { width: 220px; height: auto; }
.auth-card {
  width: 100%; position: relative; border-radius: 14px; padding: 1.75rem 1.5rem 1.5rem;
  background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.10);
  box-shadow: 0 20px 60px rgba(0,0,0,.45); overflow: hidden;
}
.auth-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--brand-grad); }
.auth-card h2 { font-size: 1.25rem; color: #fff; }
.auth-card .muted { color: rgba(255,255,255,.65); }
.auth-card input { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.14); color: #fff; padding: .7rem .8rem; }
.auth-card input::placeholder { color: rgba(255,255,255,.4); }
.auth-card .primary { padding: .7rem; }
.auth-foot { margin: 0; font-size: .78rem; color: rgba(255,255,255,.45); letter-spacing: .04em; }
.who { display: flex; gap: .5rem; align-items: center; }

.wrap { max-width: 1000px; margin: 0 auto; padding: 1.5rem 1.25rem 4rem; display: grid; gap: 1rem; }
.narrow { max-width: 440px; padding-top: 3rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; }
.card.error { border-color: var(--danger); }
.signin { display: grid; gap: .6rem; position: relative; }
.signin .close { position: absolute; top: .4rem; right: .4rem; text-decoration: none; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .75rem; }
.tile { text-decoration: none; display: grid; gap: .25rem; }
.tile:hover { border-color: var(--accent); }
.tile-title { font-weight: 600; text-decoration: none; }

.new-video .fields { display: grid; grid-template-columns: 2fr 1fr 2fr auto; gap: .5rem; }
.video-card { display: grid; gap: .6rem; }
.share-form input[type=email] { flex: 1 1 260px; }
.check { display: inline-flex; gap: .35rem; align-items: center; }

.badge { display: inline-block; font-size: .72rem; padding: .05rem .45rem; border-radius: 99px; background: #eceae4; color: #444; text-transform: lowercase; }
.src-owner  { background: #e3ebff; color: #1f3f99; }
.src-client { background: #e6f4ea; color: #1e6b34; }
.src-team   { background: #fff1d6; color: #8a5a00; }
.src-family { background: #f6e6f4; color: #7a2a6e; }
.chip { display: inline-flex; gap: .35rem; align-items: center; font-size: .8rem; padding: .2rem .55rem; border-radius: 99px; background: #f0efea; border: 1px solid var(--line); }
.chip em { color: var(--muted); font-style: normal; }
.chip .link { padding: 0; text-decoration: none; }

.progress { position: relative; height: 22px; background: #f0efea; border-radius: 6px; overflow: hidden; margin-top: .5rem; }
.progress .bar { position: absolute; inset: 0 auto 0 0; background: #cfdcff; width: 0; transition: width .2s; }
.progress span { position: relative; padding-left: .5rem; line-height: 22px; }

/* ---------- review page ---------- */
.review {
  max-width: 1400px; margin: 0 auto; padding: 1rem 1.25rem 4rem;
  display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 1.25rem; align-items: start;
}
.player-col { display: grid; gap: .6rem; min-width: 0; }
.titlebar h1 { font-size: 1.2rem; }
.stage { position: relative; background: #000; border-radius: var(--radius); overflow: hidden; }
.stage video { display: block; width: 100%; max-height: 72vh; background: #000; }
.overlay { position: absolute; top: 0; left: 0; pointer-events: none; }
.stage.drawing .overlay { pointer-events: auto; cursor: crosshair; touch-action: none; }
.stage.drawing { outline: 3px solid var(--mark); outline-offset: -3px; }

.markers { padding: 0 2px; }
.track { position: relative; height: 14px; background: #ebe9e3; border-radius: 99px; }
.marker {
  position: absolute; top: 1px; width: 12px; height: 12px; margin-left: -6px; padding: 0;
  border-radius: 50%; background: var(--accent); border: 2px solid #fff;
}
.marker.resolved { background: #b9b9b9; }
.marker.active { background: var(--mark); transform: scale(1.25); }

.composer { display: grid; gap: .5rem; }
.composer .at { cursor: pointer; font-variant-numeric: tabular-nums; }

.comments-col { position: sticky; top: 4.2rem; max-height: calc(100vh - 5rem); overflow: auto; display: grid; gap: .5rem; }
.comments-col .list { display: grid; gap: .5rem; }
.comment { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: .65rem .75rem; cursor: pointer; }
.comment:hover { border-color: #c9c7c0; }
.comment.active { border-color: var(--mark); box-shadow: 0 0 0 1px var(--mark); }
.comment.resolved { opacity: .55; }
.comment .meta { flex-wrap: wrap; }
.comment .time { font-variant-numeric: tabular-nums; }
.comment .actions:empty { display: none; }

#toast {
  position: fixed; left: 50%; bottom: 1.25rem; transform: translate(-50%, 1rem);
  background: #1a1a1a; color: #fff; padding: .6rem 1rem; border-radius: 8px;
  opacity: 0; pointer-events: none; transition: all .2s; z-index: 50;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

.modal { border: 0; padding: 0; background: transparent; width: min(420px, 92vw); }
.modal::backdrop { background: rgba(0, 0, 0, .35); }

@media (max-width: 900px) {
  .review { grid-template-columns: 1fr; }
  .comments-col { position: static; max-height: none; }
  .new-video .fields { grid-template-columns: 1fr; }
}
