:root {
  --blue: #005bff;
  --blue-dark: #0048cf;
  --blue-soft: #eef4ff;
  --red: #f91155;
  --red-dark: #d90d47;
  --red-soft: #fff0f5;
  --ink: #111827;
  --muted: #6b7280;
  --line: #d9e2f2;
  --panel: #ffffff;
  --page: #f4f7fb;
  --shadow: 0 18px 45px rgba(0, 35, 100, 0.1);
  font-family:
    Inter, "Segoe UI", Roboto, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: linear-gradient(180deg, #ffffff 0%, var(--page) 62%);
}

button,
textarea,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.app-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 100vh;
  padding: 18px;
  gap: 18px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  padding: 0 22px;
  border: 1px solid rgba(217, 226, 242, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 10px 28px rgba(0, 35, 100, 0.06);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 34px;
  border-radius: 8px;
  color: #fff;
  background: var(--blue);
  box-shadow: inset -10px 0 0 var(--red);
  font-size: 15px;
  font-weight: 800;
}

.brand-name {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0;
  white-space: nowrap;
}

.topbar-status {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
  gap: 10px;
}

.status-pill,
.result-badge,
.counter,
.health-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 8px;
  color: var(--blue);
  background: var(--blue-soft);
  font-size: 13px;
  font-weight: 700;
}

.health-pill {
  flex: 0 0 auto;
  gap: 8px;
}

.health-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 3px currentColor;
  opacity: 0.3;
}

.status-pill.is-loading,
.result-badge.is-loading,
.health-pill.is-loading {
  color: var(--blue-dark);
}

.status-pill.is-error,
.result-badge.is-error,
.health-pill.is-error {
  color: var(--red);
  background: var(--red-soft);
}

.status-pill.is-success,
.result-badge.is-success,
.health-pill.is-success {
  color: #0f8f52;
  background: #eaf8f1;
}

.health-pill.is-loading .health-dot {
  animation: pulse 1s ease-in-out infinite;
}

.health-pill.is-success .health-dot,
.health-pill.is-error .health-dot {
  opacity: 1;
  box-shadow: none;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(280px, 1.05fr) minmax(280px, 0.95fr) minmax(320px, 1.1fr);
  gap: 18px;
  min-height: 0;
}

.panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  font-size: 25px;
  line-height: 1.1;
  letter-spacing: 0;
}

.icon-button {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  color: var(--red);
  background: var(--red-soft);
  transition:
    transform 0.15s ease,
    background 0.15s ease;
}

.icon-button:hover:not(:disabled) {
  background: #ffe0eb;
  transform: translateY(-1px);
}

.icon-button:disabled {
  color: #b8c1d1;
  background: #f5f7fb;
}

.dropzone {
  position: relative;
  display: grid;
  flex: 1;
  min-height: 420px;
  border: 2px dashed #b9c9e8;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(0, 91, 255, 0.06), rgba(249, 17, 85, 0.04)),
    #fbfdff;
  outline: none;
  overflow: hidden;
  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    transform 0.15s ease;
}

.dropzone.is-dragover,
.dropzone:focus-visible {
  border-color: var(--blue);
  background:
    linear-gradient(135deg, rgba(0, 91, 255, 0.1), rgba(249, 17, 85, 0.06)),
    #ffffff;
}

.dropzone-empty,
.preview-state,
.result-state {
  min-width: 0;
}

.dropzone-empty {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  padding: 24px;
  text-align: center;
}

.upload-icon,
.result-placeholder,
.error-icon {
  display: grid;
  place-items: center;
  width: 66px;
  height: 66px;
  border-radius: 8px;
  color: var(--blue);
  background: var(--blue-soft);
}

.upload-icon svg,
.result-placeholder svg,
.error-icon svg {
  width: 31px;
  height: 31px;
}

.drop-title {
  margin: 0;
  font-size: 19px;
  font-weight: 800;
}

.drop-copy {
  margin: -4px 0 6px;
  color: var(--muted);
  font-size: 14px;
}

.secondary-button,
.ghost-button,
.primary-button,
.download-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  gap: 9px;
  border-radius: 8px;
  font-weight: 800;
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease,
    background 0.15s ease;
}

.secondary-button {
  padding: 0 16px;
  color: var(--blue);
  background: var(--blue-soft);
}

.secondary-button:hover,
.ghost-button:hover,
.download-button:hover,
.primary-button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.secondary-button:hover {
  background: #deebff;
}

.secondary-button.compact {
  min-height: 38px;
  padding: 0 12px;
  font-size: 14px;
}

.secondary-button.danger {
  color: var(--red);
  background: var(--red-soft);
}

.secondary-button.danger:hover {
  background: #ffe0eb;
}

.preview-state {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  height: 100%;
  padding: 12px;
  gap: 12px;
}

.preview-state[hidden] {
  display: none;
}

.preview-state img {
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
  border-radius: 8px;
  background: #ffffff;
}

.preview-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.preview-info > div {
  min-width: 0;
}

.file-name,
.file-meta {
  max-width: 220px;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-name {
  font-weight: 800;
}

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

.prompt-panel {
  gap: 14px;
}

.counter {
  min-width: 42px;
}

textarea {
  width: 100%;
  flex: 1;
  min-height: 345px;
  resize: none;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fbfdff;
  line-height: 1.5;
  outline: none;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(0, 91, 255, 0.1);
}

textarea::placeholder {
  color: #8a96aa;
}

.prompt-actions {
  display: grid;
  grid-template-columns: minmax(104px, auto) 1fr;
  gap: 10px;
}

.ghost-button {
  padding: 0 16px;
  color: var(--blue);
  background: #ffffff;
  border: 1px solid var(--line);
}

.primary-button {
  position: relative;
  padding: 0 18px;
  color: #ffffff;
  background: var(--blue);
  box-shadow: 0 12px 24px rgba(0, 91, 255, 0.22);
}

.primary-button:hover:not(:disabled) {
  background: var(--blue-dark);
  box-shadow: 0 16px 26px rgba(0, 91, 255, 0.26);
}

.primary-button:disabled {
  color: #9aa6bb;
  background: #edf1f7;
  box-shadow: none;
}

.primary-button.is-loading .run-icon {
  display: none;
}

.button-spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #ffffff;
  border-radius: 50%;
}

.primary-button.is-loading .button-spinner {
  display: inline-block;
  animation: spin 0.75s linear infinite;
}

.result-panel {
  gap: 14px;
}

.result-state {
  flex: 1;
  min-height: 420px;
}

.result-empty,
.loading-state,
.error-state {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 14px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  text-align: center;
}

.result-empty[hidden],
.loading-state[hidden],
.error-state[hidden],
.success-state[hidden] {
  display: none;
}

.result-empty p,
.error-state p {
  margin: 0;
}

.result-empty p {
  color: var(--muted);
}

.spinner {
  width: 42px;
  height: 42px;
  border: 4px solid #dce8ff;
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.skeleton-stack {
  display: grid;
  width: min(320px, 100%);
  gap: 10px;
}

.skeleton-stack span {
  height: 14px;
  border-radius: 8px;
  background: linear-gradient(90deg, #edf2fb 0%, #dce8ff 45%, #edf2fb 100%);
  background-size: 220% 100%;
  animation: shimmer 1.2s ease-in-out infinite;
}

.skeleton-stack span:nth-child(2) {
  width: 82%;
}

.skeleton-stack span:nth-child(3) {
  width: 58%;
}

.error-icon {
  color: var(--red);
  background: var(--red-soft);
}

.error-title {
  font-size: 18px;
  font-weight: 800;
}

.error-text {
  color: var(--muted);
  line-height: 1.45;
}

.success-state {
  display: grid;
  grid-template-rows: minmax(190px, 1fr) auto auto;
  gap: 12px;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  min-height: 0;
  gap: 12px;
}

.cards-grid[hidden],
.result-data[hidden],
.download-button[hidden] {
  display: none;
}

.card-preview {
  display: grid;
  grid-template-rows: minmax(170px, 1fr) auto;
  min-height: 0;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  overflow: hidden;
}

.card-preview img {
  width: 100%;
  height: 100%;
  max-height: 290px;
  object-fit: contain;
  background: #ffffff;
}

.card-preview figcaption {
  padding: 10px 12px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  background: #ffffff;
  font-size: 13px;
}

.result-data {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0f172a;
  overflow: hidden;
}

.data-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  color: #dbeafe;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 13px;
  font-weight: 800;
}

pre {
  max-height: 150px;
  margin: 0;
  padding: 12px;
  color: #f8fafc;
  font-size: 13px;
  line-height: 1.45;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.download-button {
  width: 100%;
  color: #ffffff;
  background: var(--red);
  box-shadow: 0 12px 24px rgba(249, 17, 85, 0.2);
}

.download-button:hover {
  background: var(--red-dark);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.landing-page {
  background: #ffffff;
  overflow-x: hidden;
}

.landing-page a {
  color: inherit;
  text-decoration: none;
}

.landing-nav {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  min-height: 76px;
  padding: 0 36px;
  border-bottom: 1px solid rgba(217, 226, 242, 0.9);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(16px);
}

.landing-links {
  display: inline-flex;
  align-items: center;
  gap: 22px;
  color: #4b5563;
  font-size: 14px;
  font-weight: 700;
}

.landing-links a:hover {
  color: var(--blue);
}

.landing-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
  gap: 10px;
}

.landing-login {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 8px;
  color: #ffffff;
  background: var(--ink);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.landing-login:hover {
  color: #ffffff;
  background: #263244;
}

.landing-page .landing-login {
  color: #ffffff;
}

.landing-hero {
  position: relative;
  display: grid;
  align-items: center;
  min-height: calc(100svh - 220px);
  max-height: 740px;
  padding: 72px 36px;
  overflow: hidden;
}

.landing-hero-image,
.landing-hero-overlay {
  position: absolute;
  inset: 0;
}

.landing-hero-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.landing-hero-overlay {
  background:
    linear-gradient(90deg, rgba(7, 12, 22, 0.92) 0%, rgba(7, 12, 22, 0.7) 32%, rgba(7, 12, 22, 0.12) 68%, rgba(7, 12, 22, 0.04) 100%),
    rgba(7, 12, 22, 0.08);
}

.landing-hero-content {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 620px;
  min-width: 0;
  color: #ffffff;
}

.landing-kicker {
  margin: 0 0 14px;
  color: #bfdbfe;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.landing-hero h1 {
  margin: 0;
  font-size: 76px;
  line-height: 0.95;
  letter-spacing: 0;
}

.landing-lead {
  width: 100%;
  max-width: 560px;
  margin: 24px 0 0;
  color: #e5edf9;
  font-size: 20px;
  line-height: 1.5;
}

.landing-cta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 34px;
}

.landing-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  gap: 9px;
  padding: 0 18px;
  border-radius: 8px;
  font-weight: 900;
}

.landing-button.primary {
  color: #ffffff;
  background: var(--blue);
  box-shadow: 0 18px 30px rgba(0, 91, 255, 0.28);
}

.landing-button.primary:hover {
  background: var(--blue-dark);
}

.landing-button.secondary {
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.34);
  background: rgba(255, 255, 255, 0.12);
}

.landing-button.secondary:hover {
  background: rgba(255, 255, 255, 0.2);
}

.landing-button.inline {
  width: fit-content;
  margin-top: 26px;
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  width: 100%;
  max-width: 560px;
  margin: 40px 0 0;
}

.hero-metrics div {
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.24);
}

.hero-metrics dt,
.hero-metrics dd {
  margin: 0;
}

.hero-metrics dt {
  color: #ffffff;
  font-size: 18px;
  font-weight: 900;
}

.hero-metrics dd {
  margin-top: 4px;
  color: #cbd5e1;
  font-size: 13px;
  line-height: 1.35;
}

.landing-section,
.landing-band {
  padding: 76px 36px;
}

.landing-section {
  background: #ffffff;
}

#features {
  padding-top: 40px;
}

.landing-band {
  background: #f6f8fc;
}

.section-heading {
  width: 100%;
  max-width: 760px;
  margin: 0 auto 34px;
  text-align: center;
}

.section-heading.align-left {
  margin: 0;
  text-align: left;
}

.section-heading.compact {
  margin-bottom: 28px;
}

.section-heading h2 {
  margin: 0;
  font-size: 42px;
  line-height: 1.1;
}

.section-heading p:not(.eyebrow) {
  margin: 16px 0 0;
  color: #526071;
  font-size: 17px;
  line-height: 1.6;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  width: 100%;
  max-width: 1220px;
  margin: 0 auto;
}

.feature-card {
  min-width: 0;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 14px 35px rgba(17, 24, 39, 0.06);
}

.feature-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  color: var(--blue);
  background: var(--blue-soft);
}

.feature-card h3,
.audience-list h3 {
  margin: 18px 0 0;
  font-size: 19px;
  line-height: 1.25;
}

.feature-card p,
.audience-list p,
.workflow-list p {
  margin: 10px 0 0;
  color: #5f6b7a;
  line-height: 1.55;
}

.workflow-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  width: 100%;
  max-width: 1060px;
  margin: 0 auto;
  padding: 0;
  list-style: none;
}

.workflow-list li {
  min-width: 0;
  padding: 24px;
  border: 1px solid #d8e1ef;
  border-radius: 8px;
  background: #ffffff;
}

.workflow-list span {
  display: inline-flex;
  margin-bottom: 26px;
  color: var(--red);
  font-size: 13px;
  font-weight: 900;
}

.workflow-list strong {
  display: block;
  font-size: 20px;
}

.landing-section.split {
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(320px, 1.2fr);
  gap: 42px;
  align-items: start;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
}

.audience-list {
  display: grid;
  gap: 12px;
}

.audience-list article {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.audience-list h3 {
  margin-top: 0;
}

.landing-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 26px 36px;
  color: #5f6b7a;
  border-top: 1px solid var(--line);
  background: #ffffff;
  font-size: 14px;
}

.landing-footer span {
  color: var(--ink);
  font-weight: 900;
}

.landing-footer a {
  color: var(--blue);
  font-weight: 800;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes shimmer {
  to {
    background-position: -220% 0;
  }
}

@keyframes pulse {
  50% {
    opacity: 0.9;
    transform: scale(1.15);
  }
}

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: 1fr 1fr;
  }

  .result-panel {
    grid-column: 1 / -1;
  }

  .feature-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .landing-nav {
    padding: 0 18px;
  }

  .landing-links {
    display: none;
  }

  .landing-hero {
    min-height: calc(100svh - 180px);
    padding: 60px 22px;
  }

  .landing-hero h1 {
    font-size: 58px;
  }

  .landing-section,
  .landing-band {
    padding: 58px 22px;
  }

  .workflow-list,
  .landing-section.split {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 780px) {
  .app-shell {
    min-height: auto;
    padding: 10px;
  }

  .topbar {
    min-height: 58px;
    padding: 0 14px;
  }

  .brand-name {
    font-size: 17px;
  }

  .status-pill {
    display: none;
  }

  .health-pill {
    padding: 0 10px;
  }

  .landing-actions {
    display: none;
  }

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

  .panel {
    padding: 16px;
  }

  h1,
  h2 {
    font-size: 22px;
  }

  .dropzone,
  .result-state {
    min-height: 320px;
  }

  textarea {
    min-height: 230px;
  }

  .prompt-actions {
    grid-template-columns: 1fr;
  }

  .landing-nav {
    min-height: 66px;
  }

  .landing-login {
    min-height: 36px;
    padding: 0 11px;
    font-size: 12px;
  }

  .landing-hero {
    min-height: calc(100svh - 220px);
    padding: 44px 18px;
  }

  .landing-hero-content,
  .landing-cta-row,
  .hero-metrics {
    width: 100%;
    max-width: 340px;
  }

  .landing-lead {
    max-width: 100%;
    overflow-wrap: break-word;
  }

  .landing-hero-overlay {
    background: rgba(7, 12, 22, 0.86);
  }

  .landing-hero h1 {
    font-size: 44px;
  }

  .landing-lead {
    font-size: 17px;
  }

  .landing-cta-row,
  .hero-metrics,
  .feature-grid,
  .workflow-list {
    grid-template-columns: 1fr;
  }

  .hero-metrics {
    display: none;
  }

  .landing-cta-row {
    display: grid;
  }

  .landing-button {
    width: 100%;
  }

  .section-heading,
  .section-heading.align-left {
    text-align: left;
  }

  .section-heading h2 {
    width: 100%;
    max-width: 330px;
    font-size: 30px;
    overflow-wrap: break-word;
  }

  .section-heading p:not(.eyebrow) {
    max-width: 330px;
  }

  .landing-section,
  .landing-band {
    padding: 44px 18px;
  }

  #features {
    padding-top: 28px;
  }

  .feature-card,
  .workflow-list li,
  .audience-list article {
    padding: 18px;
  }

  .landing-footer {
    align-items: flex-start;
    flex-direction: column;
    padding: 24px 18px;
  }
}
