:root {
  color-scheme: dark;
  --bg: #0c0f10;
  --panel: #171b1f;
  --panel-2: #22282f;
  --panel-3: #111518;
  --line: #313a43;
  --text: #f4efe6;
  --muted: #a7b0b6;
  --accent: #55c7a4;
  --accent-strong: #27a780;
  --amber: #e6b45a;
  --red: #e06161;
  --blue: #82a8ff;
  --violet: #b8a4ff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, #15191d 0%, #101315 100%);
  padding: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}

.brand-mark {
  width: 54px;
  height: 54px;
  flex: 0 0 auto;
  overflow: hidden;
  border: 1px solid #58706a;
  border-radius: 8px;
  background: #20342f;
}

.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 26%;
  transform: scale(2.15);
  transform-origin: center 28%;
}

.brand strong {
  display: block;
  font-size: 17px;
  line-height: 1.1;
}

.brand span,
.label,
.panel-header span,
.eyebrow {
  color: var(--muted);
  font-size: 12px;
}

.identity-box,
.access-box,
.search-box {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 12px;
}

.access-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: rgb(85 199 164 / 0.05);
}

.access-box label {
  display: grid;
  gap: 7px;
}

.access-box button {
  width: 100%;
}

.sync-status {
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  background: var(--panel);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.sync-status.online {
  border-color: #315a4d;
  color: var(--accent);
}

.sync-status.offline {
  border-color: #694545;
  color: #ffaaa6;
}

.primary-action,
.ghost-button,
.status-button,
.project-link,
.icon-button {
  border: 1px solid transparent;
  border-radius: 8px;
}

.primary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 42px;
  background: var(--accent);
  color: #071512;
  font-weight: 800;
}

.primary-action:hover {
  background: #69d9b7;
}

.primary-action.compact {
  width: auto;
  padding: 0 16px;
}

.ghost-button,
.status-button {
  min-height: 38px;
  padding: 0 14px;
  background: var(--panel-2);
  color: var(--text);
  border-color: var(--line);
}

.project-list {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.project-link {
  display: grid;
  gap: 7px;
  width: 100%;
  padding: 13px;
  text-align: left;
  background: transparent;
  color: var(--text);
}

.project-link span {
  color: var(--muted);
  font-size: 12px;
}

.project-link.active,
.project-link:hover {
  background: var(--panel-2);
  border-color: var(--line);
}

.project-status {
  width: fit-content;
  border-radius: 999px;
  padding: 4px 8px;
  background: #2b2b22;
  color: var(--amber);
  font-size: 11px;
  font-weight: 800;
}

.empty-list {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 14px;
  color: var(--muted);
  font-size: 13px;
}

.workspace {
  min-width: 0;
  padding: 24px;
  background:
    radial-gradient(circle at 18% -8%, rgb(85 199 164 / 0.12), transparent 28%),
    radial-gradient(circle at 84% 0%, rgb(130 168 255 / 0.10), transparent 24%),
    var(--bg);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.topbar h1 {
  font-size: clamp(32px, 5vw, 58px);
  line-height: 0.96;
}

.topbar h1,
.panel-header h2,
.dialog-header h2 {
  margin: 0;
}

.eyebrow {
  margin: 0 0 4px;
  text-transform: uppercase;
  letter-spacing: 0;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.review-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 410px;
  gap: 20px;
}

.player-area,
.comments-panel {
  min-width: 0;
}

.player-frame {
  position: relative;
  overflow: hidden;
  border: 1px solid #40505c;
  border-radius: 8px;
  background: #050607;
  aspect-ratio: 16 / 9;
  box-shadow: 0 24px 70px rgb(0 0 0 / 0.35);
}

video {
  display: block;
  width: 100%;
  height: 100%;
  background: #050607;
}

.empty-player {
  position: absolute;
  inset: 0;
  display: none;
  place-content: center;
  gap: 8px;
  padding: 24px;
  text-align: center;
  color: var(--muted);
}

.empty-player strong {
  color: var(--text);
}

.video-meta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  overflow: hidden;
  margin: 12px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}

.video-meta div {
  display: grid;
  gap: 4px;
  padding: 14px;
  background: var(--panel);
}

.review-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
}

.tool-button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: var(--panel);
  color: var(--muted);
}

.tool-button.active {
  border-color: #417566;
  background: #20342f;
  color: var(--accent);
}

#saveStateLabel {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
}

.compose,
.comments-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.compose {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
}

.timestamp-pill {
  display: grid;
  height: 40px;
  place-items: center;
  border-radius: 8px;
  background: #26342f;
  color: var(--accent);
  font-weight: 800;
}

textarea,
input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101214;
  color: var(--text);
}

textarea {
  resize: vertical;
  padding: 11px 12px;
}

input,
select {
  min-height: 40px;
  padding: 0 11px;
}

.compose-actions {
  grid-column: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.checkbox-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.checkbox-line input {
  width: auto;
}

.comments-panel {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 128px);
  position: sticky;
  top: 20px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.panel-header select {
  width: 132px;
}

.reviewers {
  display: flex;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.avatar {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 999px;
  background: #27323c;
  color: #dce9ff;
  font-size: 12px;
  font-weight: 800;
}

.comments-list {
  display: grid;
  gap: 10px;
  overflow: auto;
  margin: 0;
  padding: 14px;
  list-style: none;
}

.comment {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-3);
  padding: 12px;
}

.comment-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.comment-author {
  font-weight: 800;
}

.comment-time {
  border: 1px solid #315a4d;
  border-radius: 6px;
  background: #26342f;
  color: var(--accent);
  font-weight: 800;
  padding: 4px 8px;
}

.comment p {
  margin: 0 0 10px;
  color: #d8dde2;
  line-height: 1.45;
}

.comment-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tag {
  border-radius: 999px;
  padding: 4px 8px;
  background: #262a30;
  color: var(--muted);
  font-size: 12px;
}

.tag.internal {
  color: var(--amber);
}

.tag.resolved {
  color: var(--accent);
}

.resolve-button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #181e24;
  color: var(--blue);
  padding: 5px 8px;
}

dialog {
  width: min(520px, calc(100vw - 28px));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
}

dialog::backdrop {
  background: rgb(0 0 0 / 0.72);
}

.project-form {
  display: grid;
  gap: 14px;
}

.project-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.dialog-header,
menu {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
  padding: 0;
}

.icon-button {
  width: 34px;
  height: 34px;
  background: var(--panel-2);
  color: var(--text);
  border-color: var(--line);
}

@media (max-width: 980px) {
  .app-shell,
  .review-layout {
    grid-template-columns: 1fr;
  }

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

  .project-list {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }

  .comments-panel {
    max-height: none;
  }
}

@media (max-width: 640px) {
  .workspace,
  .sidebar {
    padding: 14px;
  }

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

  .topbar-actions,
  .topbar-actions button {
    width: 100%;
  }

  .video-meta,
  .compose {
    grid-template-columns: 1fr;
  }

  .compose-actions {
    grid-column: auto;
    align-items: stretch;
    flex-direction: column;
  }
}
