﻿:root {
  color-scheme: light;
  --bg: #0d1117;
  --panel: rgba(255, 255, 255, 0.08);
  --panel-strong: rgba(255, 255, 255, 0.12);
  --text: #f8fafc;
  --muted: rgba(248, 250, 252, 0.62);
  --accent: #ffb454;
  --accent-strong: #ff9b24;
  --teal: #4dd6c8;
  --danger: #ff6b6b;
  --border: rgba(255, 255, 255, 0.12);
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --font-title: "Space Grotesk", sans-serif;
  --font-body: "IBM Plex Sans", sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body);
  background: radial-gradient(circle at 20% 20%, rgba(255, 180, 84, 0.18), transparent 50%),
    radial-gradient(circle at 80% 10%, rgba(77, 214, 200, 0.2), transparent 45%),
    linear-gradient(140deg, #0b0f14, #141b25 45%, #0e131b 100%);
  color: var(--text);
  min-height: 100vh;
}

#app {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px 24px;
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  backdrop-filter: blur(20px);
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: linear-gradient(140deg, var(--accent), var(--teal));
  color: #0b0f14;
  font-family: var(--font-title);
  font-weight: 700;
  display: grid;
  place-items: center;
  letter-spacing: 0.5px;
  font-size: 18px;
}

.title {
  font-family: var(--font-title);
  font-size: 20px;
  font-weight: 600;
}

.subtitle {
  font-size: 13px;
  color: var(--muted);
}

.nav {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
}

.nav-btn {
  border-radius: 999px;
  padding: 8px 16px;
  font-weight: 500;
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
}

.nav-btn.active {
  background: rgba(255, 180, 84, 0.2);
  color: var(--text);
  border-color: rgba(255, 180, 84, 0.45);
}

.actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pages {
  margin-top: 20px;
}

.page {
  display: none;
  padding: 22px;
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  backdrop-filter: blur(16px);
  min-height: calc(100vh - 170px);
}

.page.active {
  display: flex;
  flex-direction: column;
  gap: 18px;
  animation: pageFade 0.3s ease;
}

@keyframes pageFade {
  from {
    opacity: 0.4;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.labeling-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  width: 100%;
}

.labeling-actions .align-right {
  margin-left: auto;
}

.image-counter {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.image-counter input {
  width: 70px;
  text-align: center;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.18);
  padding: 4px 6px;
  border-radius: 999px;
  color: var(--text);
  font-weight: 600;
}

.image-counter input:disabled {
  opacity: 0.5;
}

.page-head h2,
.panel-head h3 {
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 18px;
}

.page-sub {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

.panel {
  background: var(--panel-strong);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.row.wrap {
  flex-wrap: wrap;
}

.row.stretch {
  width: min(460px, 100%);
}

.row.stretch input {
  flex: 1;
}

button,
select,
input {
  font-family: inherit;
  font-size: 13px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  padding: 8px 12px;
  transition: 0.2s ease;
}

select {
  background-color: rgba(255, 255, 255, 0.12);
}

select option {
  color: #0b0f14;
  background: #f8fafc;
}

button {
  cursor: pointer;
}

button:hover,
select:hover,
input:focus {
  border-color: rgba(255, 255, 255, 0.3);
}

button.primary {
  background: linear-gradient(140deg, var(--accent), var(--accent-strong));
  color: #151515;
  font-weight: 600;
}

button.ghost {
  background: rgba(255, 255, 255, 0.1);
}

button.danger {
  background: rgba(255, 107, 107, 0.18);
  color: var(--danger);
}

button.success {
  background: rgba(102, 255, 179, 0.2);
  color: #0b1b14;
  border-color: rgba(102, 255, 179, 0.4);
  font-weight: 600;
}

.status-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.pill-btn {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  font-weight: 600;
}

.status-pill.approved .pill-btn {
  background: rgba(102, 255, 179, 0.22);
  color: #0b1b14;
  border-color: rgba(102, 255, 179, 0.4);
}

.status-pill.unapproved .pill-btn {
  background: rgba(255, 107, 107, 0.2);
  color: #2b0b0b;
  border-color: rgba(255, 107, 107, 0.35);
}

.pill-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 160px;
  padding: 6px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(10, 14, 20, 0.92);
  box-shadow: var(--shadow);
  display: none;
  z-index: 20;
}

.pill-menu button {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--text);
}

.pill-menu button:hover {
  background: rgba(255, 255, 255, 0.08);
}

.pill-menu.show {
  display: block;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

input[type="search"] {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.inline-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
}

.inline-label input[type="color"] {
  width: 36px;
  height: 28px;
  border: none;
  padding: 0;
  background: transparent;
}

.list,
.image-list,
.label-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

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

.dataset-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 14px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid transparent;
  text-align: left;
}

.dataset-item.active {
  border-color: rgba(255, 180, 84, 0.6);
  background: rgba(255, 180, 84, 0.1);
}

.dataset-item span {
  font-weight: 500;
}

.dataset-count {
  font-size: 12px;
  color: var(--muted);
}

.class-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.image-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.image-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.image-section h3 {
  font-family: var(--font-title);
  font-size: 15px;
  font-weight: 600;
}

.image-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.image-card {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.04);
  text-align: left;
  cursor: pointer;
  position: relative;
  content-visibility: auto;
  contain-intrinsic-size: 80px 280px;
}

.image-card.selected {
  border-color: rgba(255, 180, 84, 0.55);
  background: rgba(255, 180, 84, 0.08);
}

.image-card.active {
  border-color: rgba(77, 214, 200, 0.6);
  background: rgba(77, 214, 200, 0.12);
}

.image-card .thumb {
  width: 64px;
  height: 54px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.1);
  background-size: cover;
  background-position: center;
  border: 1px solid rgba(255, 255, 255, 0.12);
  flex: 0 0 64px;
  min-width: 64px;
}

.image-card .meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.image-card .meta span {
  font-size: 13px;
}

.image-card .meta small {
  color: var(--muted);
  font-size: 11px;
}

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

.card-delete {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(255, 107, 107, 0.18);
  border: 1px solid rgba(255, 107, 107, 0.35);
  color: var(--danger);
  padding: 0;
}

.card-delete svg {
  width: 14px;
  height: 14px;
}

.image-select {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

.icon-btn {
  padding: 6px 10px;
  font-size: 11px;
  border-radius: 999px;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  margin-top: 4px;
  width: fit-content;
}

.badge + .badge {
  margin-left: 6px;
}

.floating-actions {
  position: fixed;
  right: 24px;
  bottom: 24px;
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(10, 14, 20, 0.92);
  box-shadow: var(--shadow);
  z-index: 30;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.floating-actions.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(6, 10, 16, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
}

.modal.show {
  display: flex;
}

.modal-card {
  width: min(420px, 92vw);
  background: rgba(15, 20, 28, 0.96);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dataset-picker-list {
  display: grid;
  gap: 10px;
}

.dataset-picker-btn {
  text-align: left;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text);
  font-weight: 600;
}

.dataset-picker-btn:hover {
  border-color: rgba(255, 180, 84, 0.5);
  background: rgba(255, 180, 84, 0.12);
}

.badge.manual {
  background: rgba(77, 214, 200, 0.18);
  color: #bff7ef;
}

.badge.auto {
  background: rgba(255, 180, 84, 0.2);
  color: #ffe2b3;
}

.badge.approved {
  background: rgba(102, 255, 179, 0.18);
  color: #b8ffd9;
}

.badge.unapproved {
  background: rgba(255, 107, 107, 0.18);
  color: #ffbdbd;
}

.labeling-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  align-items: start;
}

.canvas-shell {
  position: relative;
  width: 100%;
  min-height: 420px;
  height: min(70vh, 680px);
  border-radius: var(--radius-md);
  border: 1px dashed rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.2);
  overflow: hidden;
}

#labelCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

.empty-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 16px;
  gap: 8px;
  color: var(--muted);
  pointer-events: none;
}

.empty-title {
  font-family: var(--font-title);
  font-size: 18px;
  color: var(--text);
}

.side-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.class-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid transparent;
}

.class-row input[type="text"] {
  flex: 1;
  background: rgba(0, 0, 0, 0.25);
}

.class-row input[type="color"] {
  width: 36px;
  height: 30px;
  border: none;
  padding: 0;
  background: transparent;
}

.class-index {
  font-size: 11px;
  color: var(--muted);
  min-width: 28px;
  text-align: center;
}

.label-list {
  max-height: 320px;
  overflow-y: auto;
}

.batch-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.page[data-page="batches"] .batch-list {
  max-width: 900px;
}

.batch-item {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.batch-delete {
  justify-self: end;
}

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

.batch-item strong {
  font-size: 13px;
  color: var(--text);
}

.auto-inbox {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
}

.auto-inbox-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  align-items: center;
}

.folder-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: rgba(255, 180, 84, 0.18);
  color: var(--accent);
}

.folder-icon svg {
  width: 28px;
  height: 28px;
}

.auto-copy h3 {
  font-family: var(--font-title);
  font-size: 16px;
  margin-bottom: 4px;
}

.auto-inbox-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.auto-inbox-body.collapsed {
  display: none;
}

.auto-inbox-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.inbox-card {
  position: relative;
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.04);
}

.inbox-card.selected {
  border-color: rgba(255, 180, 84, 0.55);
  background: rgba(255, 180, 84, 0.08);
}

.inbox-card .thumb {
  width: 64px;
  height: 54px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.1);
  background-size: cover;
  background-position: center;
  border: 1px solid rgba(255, 255, 255, 0.12);
  flex: 0 0 64px;
  min-width: 64px;
}

.inbox-card .meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.inbox-card .meta span {
  font-size: 13px;
}

.inbox-card .meta small {
  color: var(--muted);
  font-size: 11px;
}

@media (max-width: 720px) {
  .auto-inbox-head {
    grid-template-columns: 1fr;
  }
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.filter-bar select {
  min-width: 180px;
}

.meta-note {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.label-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid transparent;
}

.label-item.active {
  border-color: rgba(255, 180, 84, 0.6);
}

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

.label-item select {
  background: rgba(0, 0, 0, 0.3);
}

.label-item button {
  padding: 6px 10px;
}

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

  .row.stretch {
    width: 100%;
  }
}

@media (max-width: 960px) {
  .image-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .actions {
    width: 100%;
    justify-content: space-between;
  }

  .nav {
    width: 100%;
    justify-content: space-between;
  }
}
