:root {
  color-scheme: light;
  --bg: #ffffff;
  --panel: #ffffff;
  --line: #c8c8c8;
  --line-strong: #222222;
  --text: #111111;
  --muted: #555555;
  --muted-2: #777777;
  --accent: #111111;
  --accent-soft: #eeeeee;
  --green: #111111;
  --yellow: #111111;
  --red: #111111;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
}

body {
  overflow: hidden;
}

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

button {
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 0;
  background: #ffffff;
  color: var(--text);
  cursor: pointer;
}

button:hover:not(:disabled),
button.active {
  background: #eeeeee;
}

button:disabled {
  color: var(--muted-2);
  border-color: var(--line);
  cursor: not-allowed;
}

button.primary {
  background: #111111;
  color: #ffffff;
}

.ghost-btn {
  background: #ffffff;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 0;
  background: #ffffff;
  color: var(--text);
  outline: none;
}

input {
  height: 34px;
  padding: 0 8px;
}

select {
  height: 34px;
  padding: 0 8px;
}

textarea {
  padding: 8px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus,
button:focus {
  outline: 2px solid #111111;
  outline-offset: 1px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 18px;
  line-height: 1.2;
}

h2 {
  font-size: 20px;
  line-height: 1.25;
}

h3 {
  font-size: 15px;
  line-height: 1.3;
}

p {
  color: var(--muted);
  line-height: 1.4;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-panel {
  width: min(420px, 100%);
  border: 1px solid var(--line-strong);
  padding: 18px;
  display: grid;
  gap: 14px;
}

.auth-mode {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.field-row,
.notes-field {
  display: grid;
  gap: 6px;
}

.field-row span,
.notes-field span {
  font-weight: 700;
}

.auth-message {
  min-height: 20px;
  color: var(--text);
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-header {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line-strong);
  background: #ffffff;
}

.brand-block,
.account-strip,
.transport-row,
.timeline-topline,
.completion-row,
.panel-header-line {
  display: flex;
  align-items: center;
}

.brand-block p {
  margin-top: 3px;
}

.account-strip {
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

#currentAccountLabel {
  color: var(--muted);
}

.workspace {
  min-height: 0;
  flex: 1;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
}

.side-nav {
  border-right: 1px solid var(--line-strong);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-item {
  width: 100%;
  min-height: 54px;
  display: block;
  text-align: left;
  padding: 10px;
}

.nav-item strong,
.nav-item small {
  display: block;
}

.nav-item small {
  margin-top: 2px;
  color: var(--muted);
}

.nav-item.active {
  background: #eeeeee;
}

.user-stats {
  margin-top: auto;
  display: grid;
  gap: 8px;
}

.user-stats div {
  border: 1px solid var(--line-strong);
  padding: 10px;
}

.user-stats span {
  display: block;
  font-size: 22px;
  font-weight: 700;
}

.user-stats small {
  color: var(--muted);
}

.content-area {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.view {
  height: calc(100vh - 64px);
  display: none;
  overflow: auto;
  padding: 18px;
}

.view.active {
  display: block;
}

.view-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.header-actions,
.button-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.view-head p,
.labeler-toolbar p {
  margin-top: 3px;
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.video-card,
.upload-panel,
.panel-card,
.metric-card,
.table-card,
.timeline-card {
  border: 1px solid var(--line-strong);
  background: #ffffff;
}

.video-card {
  min-width: 0;
  padding: 12px;
  display: grid;
  gap: 10px;
}

.video-card h3 {
  overflow-wrap: anywhere;
}

.error-text {
  color: #111111;
  font-size: 12px;
  font-weight: 700;
}

.video-meta-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.tag {
  border: 1px solid var(--line);
  padding: 3px 6px;
  color: var(--muted);
  font-size: 12px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  border: 1px solid currentColor;
  background: currentColor;
  flex: 0 0 auto;
}

.status-available {
  color: #0f6b2f;
}

.status-in-use,
.status-processing {
  color: #8a5a00;
}

.status-finished {
  color: #444444;
}

.status-error {
  color: var(--red);
}

.status-waiting {
  color: var(--muted);
}

.video-card-footer {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.mono {
  font-family: "Courier New", Courier, monospace;
}

.video-card-footer .mono {
  min-width: 0;
  overflow-wrap: anywhere;
}

.progress-mini {
  width: 100%;
  height: 8px;
  border: 1px solid var(--line-strong);
  overflow: hidden;
  position: relative;
}

.progress-mini span {
  display: block;
  height: 100%;
  width: 0;
  background: #111111;
}

.progress-mini.processing span {
  position: absolute;
  animation: processing-bar 1.2s linear infinite;
}

@keyframes processing-bar {
  from {
    left: -35%;
  }

  to {
    left: 100%;
  }
}

.admin-video-status {
  display: grid;
  gap: 6px;
}

.status-bar-topline {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.status-bar-topline span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.status-bar-topline strong {
  color: var(--text);
  white-space: nowrap;
}

.status-bar-track {
  width: 100%;
  height: 12px;
  border: 1px solid var(--line-strong);
  overflow: hidden;
  position: relative;
  background: #ffffff;
}

.status-bar-track span {
  display: block;
  height: 100%;
  width: 0;
  background: #111111;
}

.status-bar-track.processing span {
  position: absolute;
  animation: processing-bar 1.2s linear infinite;
}

.upload-panel {
  max-width: 760px;
  padding: 14px;
}

.upload-panel + .upload-panel {
  margin-top: 12px;
}

#videoUploadInput {
  display: none;
}

.upload-drop {
  min-height: 150px;
  border: 1px dashed var(--line-strong);
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  cursor: pointer;
  text-align: center;
}

.upload-icon {
  font-size: 24px;
}

.upload-drop small {
  color: var(--muted);
}

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

.youtube-import-form {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.form-grid,
.checkbox-grid {
  display: grid;
  gap: 10px;
}

.form-grid {
  grid-template-columns: 130px repeat(4, minmax(0, 1fr));
}

.checkbox-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.checkbox-row {
  min-height: 34px;
  border: 1px solid var(--line);
  padding: 6px 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.checkbox-row input {
  width: auto;
  height: auto;
}

.youtube-import-actions {
  justify-content: flex-start;
}

.import-job-list {
  display: grid;
  gap: 8px;
}

.import-job {
  border: 1px solid var(--line);
  padding: 10px;
  display: grid;
  gap: 6px;
}

.import-job p {
  overflow-wrap: anywhere;
}

.labeler-layout {
  min-height: calc(100vh - 100px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 12px;
}

.video-column,
.point-panel {
  min-width: 0;
}

.labeler-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.autosave-state {
  border: 1px solid var(--line);
  padding: 4px 8px;
  color: var(--muted);
  white-space: nowrap;
}

.video-stage {
  position: relative;
  min-height: 420px;
  border: 1px solid var(--line-strong);
  background: #000000;
  display: grid;
  place-items: center;
}

.video-stage video {
  width: 100%;
  max-height: min(62vh, 640px);
  display: none;
  background: #000000;
}

.video-stage.has-video video {
  display: block;
}

.video-stage.has-video .empty-video {
  display: none;
}

.empty-video {
  color: #ffffff;
}

.transport-row {
  gap: 8px;
  flex-wrap: wrap;
  margin: 10px 0;
}

.finish-row {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.finish-row span {
  color: var(--muted);
}

.timeline-card {
  padding: 10px;
}

.timeline-topline {
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
}

.timeline-bar {
  position: relative;
  height: 48px;
  border: 1px solid var(--line-strong);
  cursor: pointer;
  overflow: hidden;
  background: #ffffff;
}

.timeline-progress {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 0;
  background: #eeeeee;
  pointer-events: none;
}

.marker {
  position: absolute;
  top: 6px;
  width: 8px;
  height: 34px;
  transform: translateX(-50%);
  border: 1px solid #111111;
  background: #ffffff;
  cursor: pointer;
  padding: 0;
}

.marker.completed {
  background: #111111;
}

.marker.review {
  border-style: dashed;
}

.marker.active {
  width: 12px;
  border-width: 2px;
}

.point-panel {
  display: grid;
  align-content: start;
  gap: 10px;
}

.panel-card {
  padding: 10px;
}

.panel-kicker {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 6px;
}

.id-list {
  margin: 10px 0 0;
  display: grid;
  gap: 8px;
}

.id-list dt {
  color: var(--muted);
  font-size: 12px;
}

.id-list dd {
  margin: 2px 0 0;
  font-family: "Courier New", Courier, monospace;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.segmented-control button {
  min-height: 40px;
}

.segmented-control button.active {
  background: #eeeeee;
  font-weight: 700;
}

.action-editor-card {
  display: grid;
  gap: 10px;
}

.panel-header-line {
  justify-content: space-between;
  gap: 8px;
}

.taxonomy-state {
  border: 1px solid var(--line);
  padding: 3px 6px;
  color: var(--muted);
  font-size: 12px;
}

.fencer-action-editor {
  border: 1px solid var(--line);
  padding: 10px;
  display: grid;
  gap: 10px;
}

.action-editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.clear-action-btn {
  min-height: 28px;
  padding: 0 8px;
}

.action-summary {
  border: 1px solid var(--line);
  padding: 8px;
  min-height: 34px;
  overflow-wrap: anywhere;
}

.action-summary.has-action {
  font-weight: 700;
}

.action-step {
  display: grid;
  gap: 6px;
}

.action-step > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip-grid button {
  min-height: 30px;
  max-width: 100%;
  white-space: normal;
  text-align: left;
}

.chip-grid button.active {
  background: #eeeeee;
  font-weight: 700;
}

.detail-grid {
  max-height: 190px;
  overflow: auto;
  padding-right: 2px;
}

.empty-chip {
  color: var(--muted-2);
}

.completion-row {
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.point-list-card {
  max-height: 330px;
  overflow: hidden;
}

.point-list {
  margin-top: 10px;
  display: grid;
  gap: 6px;
  max-height: 260px;
  overflow: auto;
}

.point-row {
  width: 100%;
  min-height: 42px;
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  text-align: left;
}

.point-row strong {
  overflow-wrap: anywhere;
  font-family: "Courier New", Courier, monospace;
  font-size: 12px;
}

.point-row.active {
  background: #eeeeee;
}

.point-status {
  border: 1px solid var(--line);
  padding: 3px 6px;
  font-size: 12px;
}

.admin-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.metric-card {
  padding: 12px;
}

.metric-card span {
  display: block;
  font-size: 24px;
  font-weight: 700;
}

.metric-card small {
  color: var(--muted);
}

.admin-tables {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 12px;
}

.table-card {
  min-width: 0;
  padding: 12px;
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
}

th,
td {
  border: 1px solid var(--line);
  padding: 8px;
  text-align: left;
  vertical-align: top;
}

th {
  background: #eeeeee;
}

td {
  overflow-wrap: anywhere;
}

code {
  font-family: "Courier New", Courier, monospace;
}

@media (max-width: 1200px) {
  .video-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .labeler-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  body {
    overflow: auto;
  }

  .app-header {
    height: auto;
    align-items: flex-start;
    flex-direction: column;
    padding: 12px;
  }

  .workspace {
    display: block;
  }

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

  .user-stats {
    margin-top: 8px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .view {
    height: auto;
    min-height: 0;
    padding: 12px;
  }

  .view-head {
    display: grid;
  }

  .video-grid,
  .admin-metrics,
  .admin-tables,
  .form-grid,
  .checkbox-grid {
    grid-template-columns: 1fr;
  }

  .video-stage {
    min-height: 220px;
  }

  .segmented-control {
    grid-template-columns: 1fr;
  }

  .point-row {
    grid-template-columns: 70px minmax(0, 1fr);
  }

  .point-row .point-status {
    grid-column: 1 / -1;
  }
}
