:root {
  color-scheme: dark;
  --ink: #f2f2f2;
  --muted: #9b9b9b;
  --line: rgba(255,255,255,0.09);
  --paper: #111111;
  --surface: #0a0a0a;
  --accent: #e85d04;
  --accent-dark: #f48c06;
  --dark-2: #111111;
  --dark-3: #1a1a1a;
  --dark-4: #222222;
  --focus: #1f6feb;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.38);
  --font-head: "Oswald", sans-serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.5;
}

button,
input,
select,
summary,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  min-height: 46px;
  padding: 0 16px;
  font-weight: 700;
  font-family: var(--font-head);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

button.secondary,
.icon-button {
  background: var(--dark-4);
}

button.danger {
  background: #5f2222;
}

button.text-button {
  min-height: auto;
  padding: 0;
  background: transparent;
  color: var(--accent);
}

button:focus-visible,
input:focus,
select:focus,
textarea:focus {
  outline: 3px solid color-mix(in srgb, var(--focus) 30%, transparent);
  outline-offset: 2px;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: max(16px, env(safe-area-inset-top)) 18px 16px;
  background: rgba(10, 10, 10, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.app-header h1 {
  margin: 0;
  font-size: clamp(1.15rem, 5vw, 1.75rem);
  line-height: 1.1;
  font-family: var(--font-head);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.brand-home {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  align-items: flex-start;
  color: white;
  text-decoration: none;
}

.brand-home:hover h1,
.brand-home:hover .eyebrow {
  color: var(--accent);
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(320px, 520px) minmax(0, 1fr);
  gap: 18px;
  width: min(1400px, 100%);
  margin: 0 auto;
  padding: 18px;
}

.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.form-panel {
  display: grid;
  gap: 15px;
  align-content: start;
  padding: 18px;
}

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

.section-title h2 {
  margin: 0;
  font-size: 1.05rem;
}

.section-title span {
  color: var(--muted);
  font-size: 0.9rem;
}

.grid {
  display: grid;
  gap: 12px;
}

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

label {
  display: grid;
  gap: 6px;
  color: #dedede;
  font-size: 0.88rem;
  font-weight: 750;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 8px;
  background: #0d0d0d;
  color: var(--ink);
  min-height: 44px;
  padding: 10px 12px;
  font-weight: 500;
}

textarea {
  min-height: 92px;
  resize: vertical;
}

.upload-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.upload-target {
  display: grid;
  place-items: center;
  min-height: 92px;
  border: 2px dashed rgba(232,93,4,0.55);
  border-radius: 8px;
  background: #161616;
  color: var(--accent);
  font-family: var(--font-head);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.upload-target input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
}

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

.ai-actions {
  display: grid;
  gap: 8px;
}

.ai-actions p {
  min-height: 22px;
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.ai-actions p[data-state="error"] {
  color: #8b1d1d;
}

.ai-actions p[data-state="ok"] {
  color: #17623a;
}

.image-list {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.image-item {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.image-item img,
.image-item video,
.media-preview {
  width: 96px;
  height: 72px;
  border-radius: 6px;
}

.image-item img,
.image-item video {
  object-fit: cover;
  border: 1px solid var(--line);
  background: #111;
}

.media-preview {
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #eef1f4;
}

.remove-image {
  grid-column: 2;
  justify-self: start;
  min-height: 34px;
  padding: 0 10px;
  background: #5f2222;
  font-size: 0.85rem;
}

.preview-panel {
  display: grid;
  gap: 0;
  align-content: start;
  overflow: hidden;
}

.preview-toolbar {
  position: sticky;
  top: 82px;
  z-index: 5;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding: 14px;
  background: #161616;
  border-bottom: 1px solid var(--line);
}

.preview-toolbar button {
  flex: 1 1 150px;
}

.share-panel {
  display: grid;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  background: #141414;
}

.share-panel a {
  overflow-wrap: anywhere;
}

.share-panel p {
  margin: 0;
  color: var(--muted);
}

.share-panel p[data-state="error"] {
  color: #ff8a8a;
}

.share-panel p[data-state="ok"] {
  color: #62d28f;
}

.share-result-box,
.pdf-result-box {
  display: grid;
  gap: 6px;
  border: 1px solid rgba(232,93,4,0.34);
  border-radius: 8px;
  background: #0d0d0d;
  padding: 12px;
}

.share-result-box span,
.pdf-result-box span {
  color: var(--accent);
  font-family: var(--font-head);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.share-result-box a {
  color: white;
}

.pdf-result-box {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  background: linear-gradient(135deg, rgba(232,93,4,0.16), #0d0d0d 60%);
}

.pdf-result-box strong {
  display: block;
  color: white;
}

.share-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.link-button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  padding: 0 14px;
  text-decoration: none;
  font-weight: 800;
  font-family: var(--font-head);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.secondary-link {
  background: var(--dark-4);
}

.details-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #141414;
}

.details-panel summary {
  min-height: 48px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  cursor: pointer;
  font-weight: 850;
}

.details-grid {
  display: grid;
  gap: 14px;
  padding: 0 12px 12px;
}

.saved-panel {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  background: #141414;
}

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

.saved-list:empty::before {
  content: "Saved statements will appear here.";
  color: var(--muted);
  font-size: 0.92rem;
}

.saved-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0d0d0d;
}

.saved-title,
.saved-meta {
  display: block;
}

.saved-title {
  overflow-wrap: anywhere;
}

.saved-meta {
  color: var(--muted);
  font-size: 0.86rem;
}

.saved-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.saved-actions button {
  min-height: 36px;
  padding: 0 10px;
  font-size: 0.86rem;
}

.statement {
  width: min(100%, 880px);
  margin: 0 auto;
  padding: 34px;
  background: white;
  color: #15171a;
}

.statement-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 18px;
  border-bottom: 3px solid #15171a;
}

.statement h2,
.statement h3,
.statement p {
  margin-top: 0;
}

.statement h2 {
  margin-bottom: 6px;
  font-size: 1.8rem;
  font-family: var(--font-head);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.statement-brand {
  margin-bottom: 6px;
  color: var(--accent-dark);
  font-weight: 850;
}

.statement-meta {
  min-width: 180px;
  text-align: right;
}

.vehicle-block {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 20px 0;
}

.vehicle-block div {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

dt {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

dd {
  min-height: 24px;
  margin: 0;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.statement-body p {
  margin: 0 0 14px;
}

.statement-body ul {
  margin: 0 0 14px;
  padding-left: 20px;
}

.statement-body h3,
.photo-section h3 {
  margin: 22px 0 8px;
  font-size: 1rem;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line);
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.photo-card {
  break-inside: avoid;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.photo-card img,
.photo-card video {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  background: #111;
}

.photo-card a {
  display: block;
  padding: 18px;
}

.photo-card p {
  margin: 0;
  padding: 8px 10px;
  color: #30363d;
  font-size: 0.9rem;
}

.signature-block {
  margin-top: 46px;
}

.signature-line {
  width: min(360px, 100%);
  height: 1px;
  margin-bottom: 8px;
  background: var(--ink);
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
    padding: 10px;
  }

  .panel {
    box-shadow: none;
  }

  .grid.two,
  .vehicle-block {
    grid-template-columns: 1fr;
  }

  .preview-toolbar {
    top: 73px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .saved-item {
    grid-template-columns: 1fr;
  }

  .saved-actions {
    justify-content: stretch;
  }

  .saved-actions button {
    flex: 1 1 90px;
  }

  .statement {
    padding: 22px 16px;
  }

  .statement-header {
    display: grid;
  }

  .statement-meta {
    text-align: left;
  }

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

@media (max-width: 520px) {
  .app-header {
    align-items: start;
    padding-inline: 12px;
  }

  .icon-button {
    min-height: 40px;
    padding-inline: 12px;
  }

  .form-panel {
    padding: 14px;
  }

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

  .image-item {
    grid-template-columns: 76px minmax(0, 1fr);
  }

  .image-item img,
  .image-item video,
  .media-preview {
    width: 76px;
    height: 62px;
  }

  .remove-image {
    grid-column: 1 / -1;
  }

  .statement h2 {
    font-size: 1.45rem;
  }

  .preview-toolbar {
    grid-template-columns: 1fr;
  }
}

@media print {
  @page {
    margin: 0.5in;
  }

  body {
    background: white;
  }

  .app-header,
  .form-panel,
  .preview-toolbar,
  .saved-panel {
    display: none !important;
  }

  .app-shell,
  .preview-panel,
  .statement {
    display: block;
    width: auto;
    margin: 0;
    padding: 0;
    border: 0;
    box-shadow: none;
  }

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