:root {
  color-scheme: light;
  --bg: #f4f5f1;
  --surface: #ffffff;
  --surface-soft: #eef3f5;
  --text: #172022;
  --muted: #657073;
  --line: #d9dfdf;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --danger: #b42318;
  --danger-bg: #fff0ed;
  --success: #147a38;
  --success-bg: #edf8f0;
  --warning: #9a6700;
}

* {
  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 {
  font: inherit;
}

.shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0;
}

.workspace {
  min-height: calc(100vh - 56px);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
  line-height: 1.2;
  letter-spacing: 0;
}

.topbar p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
}

.upload-button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  border-radius: 7px;
  background: var(--accent);
  color: white;
  font-weight: 700;
  cursor: pointer;
}

.upload-button:hover {
  background: var(--accent-dark);
}

.upload-button input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.content {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
}

.preview-panel,
.result-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.preview-panel {
  min-height: 580px;
  padding: 16px;
}

.dropzone {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 548px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(23, 32, 34, 0.04) 1px, transparent 1px),
    linear-gradient(180deg, rgba(23, 32, 34, 0.04) 1px, transparent 1px),
    var(--surface-soft);
  background-size: 28px 28px;
  border: 1px dashed #aab4b5;
  border-radius: 8px;
}

.dropzone.dragover {
  border-color: var(--accent);
  background-color: #e7f4f2;
}

.empty-state {
  display: grid;
  gap: 8px;
  text-align: center;
  color: var(--muted);
}

.empty-state strong {
  color: var(--text);
  font-size: 20px;
}

.image-stage {
  position: relative;
  max-width: 100%;
  max-height: 100%;
}

.image-stage img {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 160px);
  width: auto;
  height: auto;
  border-radius: 6px;
}

.hidden {
  display: none;
}

.result-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px;
}

.status-card {
  display: grid;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.status-card strong {
  font-size: 20px;
  line-height: 1.25;
}

.status-card p {
  color: var(--muted);
  line-height: 1.45;
}

.status-card.allowed {
  background: var(--success-bg);
  border-color: #b8dec3;
}

.status-card.blocked {
  background: var(--danger-bg);
  border-color: #f4b5ad;
}

.status-card.loading {
  background: #fff8e6;
  border-color: #f1d486;
}

.status-card.error {
  background: #fff8e6;
  border-color: #f1d486;
}

.status-label {
  width: fit-content;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(23, 32, 34, 0.08);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.status-card.allowed .status-label {
  color: var(--success);
  background: rgba(20, 122, 56, 0.12);
}

.status-card.blocked .status-label {
  color: var(--danger);
  background: rgba(180, 35, 24, 0.12);
}

.status-card.loading .status-label {
  color: var(--warning);
  background: rgba(154, 103, 0, 0.12);
}

.status-card.error .status-label {
  color: var(--warning);
  background: rgba(154, 103, 0, 0.12);
}

.meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.meta-grid div {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.meta-grid span,
.muted {
  color: var(--muted);
  font-size: 13px;
}

.meta-grid strong {
  font-size: 14px;
}

.objects-section {
  display: grid;
  gap: 12px;
  min-height: 0;
}

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

h2 {
  font-size: 16px;
  letter-spacing: 0;
}

#objectsCount {
  display: inline-grid;
  min-width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 999px;
  background: var(--surface-soft);
  font-weight: 800;
}

.objects-list {
  display: grid;
  gap: 8px;
  overflow: auto;
}

.object-item {
  display: grid;
  gap: 7px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

.object-row strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.pill {
  flex: 0 0 auto;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  color: var(--success);
  background: rgba(20, 122, 56, 0.12);
}

.pill.danger {
  color: var(--danger);
  background: rgba(180, 35, 24, 0.12);
}

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

@media (max-width: 900px) {
  .shell {
    width: min(100vw - 20px, 760px);
    padding: 10px 0;
  }

  .workspace {
    min-height: calc(100vh - 20px);
  }

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

  .upload-button {
    width: 100%;
  }

  .content {
    grid-template-columns: 1fr;
  }

  .preview-panel {
    min-height: 420px;
  }

  .dropzone {
    min-height: 388px;
  }
}
