:root {
  --bg: #05111f;
  --panel: #0b1f35;
  --panel-soft: #102a47;
  --stroke: #1f466d;
  --text: #edf3fb;
  --muted: #a9bdd6;
  --accent: #6ad0d3;
  --accent-strong: #5fc2c6;
  --success: #7be495;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
  --radius: 22px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(26, 74, 121, 0.28), transparent 28%),
    radial-gradient(circle at top right, rgba(14, 76, 109, 0.22), transparent 20%),
    linear-gradient(180deg, #03111d 0%, #061728 100%);
  color: var(--text);
}

body {
  padding: 18px 14px 32px;
}

.shell {
  max-width: 1080px;
  margin: 0 auto;
  display: grid;
  gap: 18px;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  padding: 12px 6px 4px;
}

.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.74rem;
  color: var(--accent);
  font-weight: 700;
}

h1, h2, h3 {
  margin: 0;
}

h1 {
  font-size: clamp(2rem, 6vw, 3.35rem);
  line-height: 0.96;
  max-width: 10ch;
}

.subhead {
  color: var(--muted);
  max-width: 44rem;
  margin: 14px 0 0;
  font-size: 1.05rem;
  line-height: 1.55;
}

.pill {
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(106, 208, 211, 0.12);
  border: 1px solid rgba(106, 208, 211, 0.28);
  color: var(--text);
  font-size: 0.9rem;
  white-space: nowrap;
}

.panel {
  background: linear-gradient(180deg, rgba(10, 29, 49, 0.98), rgba(8, 23, 40, 0.98));
  border: 1px solid rgba(106, 208, 211, 0.14);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

.panel-form {
  padding: 18px;
}

.grid {
  display: grid;
  gap: 18px;
  grid-template-columns: 1.05fr 0.95fr;
}

.field,
.field-stack {
  display: grid;
  gap: 10px;
}

.field span {
  font-size: 0.94rem;
  font-weight: 600;
  color: var(--muted);
}

input[type="text"],
input[type="file"] {
  width: 100%;
}

input[type="text"] {
  appearance: none;
  border: 1px solid var(--stroke);
  background: rgba(16, 42, 71, 0.56);
  border-radius: 16px;
  color: var(--text);
  padding: 14px 16px;
  font-size: 1rem;
  outline: none;
}

input[type="text"]::placeholder {
  color: #89a2c0;
}

input[type="text"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(106, 208, 211, 0.12);
}

input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.upload-field {
  position: relative;
}

.upload-box {
  min-height: 260px;
  border-radius: 20px;
  border: 1px dashed rgba(106, 208, 211, 0.36);
  background: linear-gradient(180deg, rgba(12, 34, 58, 0.92), rgba(8, 23, 40, 0.96));
  display: grid;
  place-items: center;
  overflow: hidden;
  text-align: center;
  color: var(--muted);
  padding: 16px;
}

#preview-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

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

button {
  appearance: none;
  border: none;
  border-radius: 16px;
  padding: 14px 18px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 120ms ease, opacity 120ms ease, box-shadow 120ms ease;
}

button:hover {
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.55;
  cursor: wait;
}

#scan-button {
  background: linear-gradient(180deg, var(--accent), var(--accent-strong));
  color: #052237;
  box-shadow: 0 12px 24px rgba(95, 194, 198, 0.2);
}

.ghost {
  color: var(--text);
  background: rgba(106, 208, 211, 0.08);
  border: 1px solid rgba(106, 208, 211, 0.2);
}

.callout {
  background: rgba(106, 208, 211, 0.08);
  color: var(--muted);
  border-radius: 16px;
  border: 1px solid rgba(106, 208, 211, 0.12);
  padding: 14px 16px;
  line-height: 1.5;
  font-size: 0.95rem;
}

.result-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 18px;
}

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

.confidence-chip {
  min-width: 92px;
  text-align: center;
  border-radius: 999px;
  padding: 10px 14px;
  background: rgba(123, 228, 149, 0.14);
  color: #baf0c8;
  border: 1px solid rgba(123, 228, 149, 0.22);
  font-weight: 700;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.summary-card,
.provider-card,
.history-card {
  border-radius: 18px;
  border: 1px solid rgba(73, 118, 161, 0.36);
  background: linear-gradient(180deg, rgba(15, 38, 63, 0.96), rgba(9, 24, 40, 0.96));
  padding: 16px;
}

.summary-card .label,
.provider-card .label {
  color: var(--muted);
  font-size: 0.84rem;
  margin-bottom: 8px;
}

.summary-card .value,
.provider-card .value {
  font-size: 1.55rem;
  font-weight: 800;
  line-height: 1.05;
}

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

.provider-card h4 {
  margin: 0 0 10px;
  font-size: 1.25rem;
}

.provider-meta {
  display: grid;
  gap: 10px;
  margin: 12px 0;
}

.provider-list {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.5;
}

.tag {
  display: inline-flex;
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(95, 194, 198, 0.12);
  border: 1px solid rgba(95, 194, 198, 0.2);
  font-size: 0.78rem;
  font-weight: 700;
  margin-top: 8px;
}

.insight-strip {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

.insight {
  border-left: 3px solid var(--accent);
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(106, 208, 211, 0.06);
  color: var(--muted);
}

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

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

.history-card {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.history-title {
  font-weight: 700;
  margin-bottom: 4px;
}

.badge {
  display: inline-flex;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(123, 228, 149, 0.12);
  border: 1px solid rgba(123, 228, 149, 0.18);
  color: #baf0c8;
  font-size: 0.78rem;
  font-weight: 700;
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 0 6px 10px;
  font-size: 0.92rem;
}

@media (max-width: 900px) {
  .grid,
  .summary-grid,
  .provider-grid {
    grid-template-columns: 1fr;
  }

  .hero,
  .history-head,
  .footer,
  .result-head {
    flex-direction: column;
    align-items: flex-start;
  }

  h1 {
    max-width: 12ch;
  }
}
