:root {
  --bg: #f4f5f7;
  --card-bg: #ffffff;
  --ink: #1c2733;
  --muted: #6b7480;
  --accent: #2f6fed;
  --accent-ink: #ffffff;
  --border: #dde1e6;
  --stub-bg: #fff8e6;
  --stub-border: #e8cf8a;
  --ok: #1a7f4e;
  --danger: #c0392b;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  padding-bottom: 2rem;
}

.app-header {
  background: var(--ink);
  color: #fff;
  padding: 1.25rem 1rem;
}

.app-header h1 {
  margin: 0;
  font-size: 1.4rem;
}

.subtitle {
  margin: 0.25rem 0 0;
  font-size: 0.85rem;
  color: #c7ccd3;
}

main {
  max-width: 640px;
  margin: 1rem auto;
  padding: 0 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.1rem 1.25rem;
}

.card h2 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-type-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.form-type-btn {
  padding: 0.65rem 1rem;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: #fff;
  color: var(--ink);
  font-size: 0.95rem;
  cursor: pointer;
}

.form-type-btn.selected {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.upload-controls {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.upload-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 0.9rem 1.2rem;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
}

.upload-button input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
}

.hint {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0;
}

.preview-area {
  margin-top: 1rem;
  border-top: 1px dashed var(--border);
  padding-top: 1rem;
}

.preview-area.hidden {
  display: none;
}

.preview-area img {
  width: 100%;
  max-height: 480px;
  object-fit: contain;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #000;
}

.primary-button {
  margin-top: 0.75rem;
  padding: 0.75rem 1.25rem;
  border: none;
  border-radius: 8px;
  background: var(--ok);
  color: #fff;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
}

.primary-button:disabled {
  background: #9fb8ac;
  cursor: not-allowed;
}

.status-msg {
  margin-top: 0.5rem;
  font-size: 0.9rem;
}

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

.status-msg.success {
  color: var(--ok);
}

.results-placeholder {
  background: var(--stub-bg);
  border: 1.5px dashed var(--stub-border);
  border-radius: 10px;
  padding: 1rem;
}

.results-placeholder p {
  margin: 0 0 0.5rem;
}

.results-placeholder p:last-child {
  margin-bottom: 0;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.history-item {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem;
}

.history-item img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.history-item .meta {
  font-size: 0.85rem;
}

.history-item .meta .form-label {
  font-weight: 600;
  display: block;
}

.muted {
  color: var(--muted);
  font-size: 0.85rem;
}

.app-footer {
  text-align: center;
  margin-top: 1.5rem;
}
