/* box-sizing reset for the app shell only — the embedded receipt must
   keep content-box (browser default) because Uber's inline CSS sets
   `width: 32px; padding-right: 18px` etc. on icons and expects the
   total rendered width to be 50px (content-box behaviour). */
body, .app, .form-panel, .form-panel * { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: #f4f4f4;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  color: #000;
}

.app {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 24px;
  padding: 24px;
  min-height: 100vh;
}

.form-panel {
  background: #fff;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  align-self: start;
  position: sticky;
  top: 24px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
}

.form-panel h2 { margin: 0 0 4px; font-size: 18px; }
.form-panel .subtitle { font-size: 12px; color: #6b6b6b; margin-bottom: 16px; }
.form-panel fieldset { border: none; padding: 0; margin: 0 0 16px; }
.form-panel legend {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.5px; color: #6b6b6b; padding: 0; margin-bottom: 8px;
}
.form-panel label { display: block; font-size: 12px; margin-bottom: 10px; }
.form-panel label > span { display: block; color: #4b4b4b; margin-bottom: 4px; }
.form-panel input, .form-panel textarea, .form-panel select {
  width: 100%; border: 1px solid #d6d6d6; border-radius: 4px;
  padding: 7px 9px; font-size: 13px; font-family: inherit; background: #fff;
}
.form-panel input:focus, .form-panel textarea:focus, .form-panel select:focus {
  outline: none; border-color: #000;
}
.form-panel textarea { resize: vertical; min-height: 56px; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.actions {
  position: sticky; bottom: 0; background: #fff; padding-top: 12px;
  border-top: 1px solid #eee; display: flex; gap: 8px;
}
.btn {
  flex: 1; background: #000; color: #fff; border: none; border-radius: 4px;
  padding: 10px; font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit;
}
.btn:hover { background: #222; }
.btn.secondary { background: #fff; color: #000; border: 1px solid #d6d6d6; }
.btn.secondary:hover { background: #f4f4f4; }

.preview-panel { display: flex; justify-content: center; align-items: flex-start; }

/* The receipt mount — let the original HTML's inline styles do all the work. */
#receipt-mount { width: 700px; max-width: 100%; }

/* === Styles copied verbatim from the original Gmail HTML's <head>.
   The original document had two <style> blocks setting body/td defaults
   for font-family, font-size, link colors and the `img { border: 0 }`
   reset. Scope them to #receipt-mount so they don't bleed into our app. */
#receipt-mount, #receipt-mount td, #receipt-mount div, #receipt-mount p,
#receipt-mount a, #receipt-mount input { font-family: arial, sans-serif; }
#receipt-mount, #receipt-mount td { font-size: 13px; }
#receipt-mount a:link, #receipt-mount a:active { color: #1155CC; text-decoration: none; }
#receipt-mount a:hover { text-decoration: underline; cursor: pointer; }
#receipt-mount a:visited { color: #6611CC; }
#receipt-mount img { border: 0px; }
#receipt-mount pre {
  white-space: pre; white-space: -moz-pre-wrap; white-space: -o-pre-wrap;
  white-space: pre-wrap; word-wrap: break-word; max-width: 800px; overflow: auto;
}
#receipt-mount .logo { left: -7px; position: relative; }

@media print {
  /* Use a wider page so the 700px receipt fits without stretching.
     A4 portrait is ~595pt = ~794px @ 96dpi, so 700px fits with small margins.
     Margin 0 to maximize usable area. */
  @page { size: A4; margin: 8mm; }
  html, body { background: #fff !important; margin: 0; padding: 0; }
  .app { display: block; padding: 0; gap: 0; }
  .form-panel { display: none !important; }
  .preview-panel { display: block; padding: 0; margin: 0; }
  /* Keep the receipt at its natural 700px width — DO NOT stretch.
     Stretching breaks the table-layout widths used by the pickup/dropoff
     pin column (8px pin, 2px white slice, 2px black connector). When the
     container is wider than 700px, browsers can redistribute column widths
     and the dotted connector collapses into a solid black bar. */
  #receipt-mount {
    width: 700px !important;
    max-width: 700px !important;
    margin: 0 auto !important;
  }
}
