:root {
  --bg: #f8fafc;
  --bg-accent: #f1f5f9;
  --surface: rgba(255, 255, 255, 0.9);
  --surface-strong: #ffffff;
  --border: rgba(15, 23, 42, 0.08);
  --text: #0f172a;
  --muted: #64748b;
  --accent: #2563eb;
  --accent-soft: #60a5fa;
  --good: #16a34a;
  --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

* {
  box-sizing: border-box;
}

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

.app-shell {
  width: min(1400px, calc(100% - 40px));
  margin: 0 auto;
  padding: 24px 0;
}

.title-bar {
  padding: 16px 32px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
}

.title-bar h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.sidebar-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px 16px;
  border: 2px dashed var(--accent-soft);
  border-radius: 12px;
  background: var(--surface);
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--muted);
  box-shadow: 0 0 15px rgba(96, 165, 250, 0.2);
  animation: dropzone-glow 3s infinite ease-in-out;
}

@keyframes dropzone-glow {
  0%, 100% { box-shadow: 0 0 10px rgba(96, 165, 250, 0.2); border-color: var(--accent-soft); }
  50% { box-shadow: 0 0 25px rgba(96, 165, 250, 0.6); border-color: var(--accent); }
}

.sidebar-dropzone:hover,
.sidebar-dropzone.active {
  border-color: var(--accent);
  background: var(--surface-strong);
  color: var(--accent);
  animation: none;
  box-shadow: 0 0 30px rgba(37, 99, 235, 0.4);
}

.drop-icon {
  font-size: 1.5rem;
  font-weight: 300;
}

.drop-text {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.workspace {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 24px;
  align-items: start;
}

.status-panel {
  display: grid;
  gap: 12px;
}

.status-card {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.status-label {
  display: block;
  margin-bottom: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.status-card strong {
  font-size: 0.9rem;
  color: var(--text);
}

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

.metrics-header {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}

.metrics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.metric-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.m-label {
  font-size: 0.65rem;
  color: var(--muted);
  font-weight: 500;
}

.metric-item span:last-child {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
}

.class-metrics {
  margin-top: 4px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.class-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
}

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

.class-row strong {
  color: var(--text);
}

.results-section {
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
  min-height: 500px;
}

.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.results-header h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
}

.clear-button {
  border: 0;
  border-radius: 8px;
  padding: 8px 16px;
  background: var(--text);
  color: #fff;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.2s;
}

.clear-button:hover {
  opacity: 0.9;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

.result-card,
.empty-state {
  border-radius: 12px;
  background: var(--bg-accent);
  border: 1px solid var(--border);
  overflow: hidden;
}

.empty-state {
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  height: 200px;
  color: var(--muted);
}

.preview {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: #cbd5e1;
}

.result-body {
  padding: 16px;
}

.result-name {
  margin: 0 0 12px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.result-prediction {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 16px;
}

.result-prediction strong {
  font-size: 1.125rem;
  font-weight: 700;
}

.result-prediction span {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--good);
}

.prob-row + .prob-row {
  margin-top: 12px;
}

.prob-labels {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
  font-size: 0.75rem;
  font-weight: 500;
}

.prob-bar {
  height: 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.05);
  overflow: hidden;
}

.prob-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.error-text {
  color: #ef4444;
  font-weight: 600;
}

@media (max-width: 900px) {
  .workspace {
    grid-template-columns: 1fr;
  }
  .status-panel {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 640px) {
  .title-bar {
    flex-direction: column;
    gap: 12px;
    padding: 20px;
    text-align: center;
  }
  .status-panel {
    grid-template-columns: 1fr;
  }
  .app-shell {
    width: min(100% - 24px, 1400px);
  }
}
