:root {
  --bg: #eef1f3;
  --panel: #ffffff;
  --ink: #17212b;
  --muted: #5a6571;
  --line: #d5dde4;
  --slate: #1f2d3a;
  --slate-hover: #15212d;
  --soft: #f7f8f9;
  --good: #1f7a4d;
  --warn: #a33b3b;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
}

.app-shell {
  width: min(1080px, calc(100% - 28px));
  margin: 0 auto;
  padding: 22px 0 42px;
}

.section-head,
.actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.page-head {
  position: sticky;
  top: 0;
  z-index: 12;
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(0, auto) minmax(120px, 1fr);
  align-items: center;
  gap: 12px;
  max-width: 860px;
  margin: 0 auto 14px;
  padding: 8px 0;
  background: var(--bg);
}

.header-title {
  display: grid;
  justify-items: center;
  gap: 4px;
  min-width: 0;
  text-align: center;
}

.header-logo {
  display: block;
  width: min(158px, 100%);
  height: 64px;
  object-fit: contain;
}

.header-logo-left {
  justify-self: start;
}

.header-logo-right {
  justify-self: end;
}

.eyebrow,
h1,
h2,
p {
  margin: 0;
}

.eyebrow {
  color: #6f7a86;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  font-size: 1.45rem;
  line-height: 1.15;
}

h2 {
  font-size: 1rem;
}

.muted,
.section-head p {
  color: var(--muted);
  line-height: 1.45;
}

.credit-note {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.section-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 860px);
  justify-content: center;
  gap: 14px;
  align-items: start;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.07);
}

.upload-panel {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.install-choice {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.05);
  padding: 10px 12px;
}

.install-choice strong,
.install-choice span {
  display: block;
}

.install-choice strong {
  color: var(--ink);
  font-size: 0.9rem;
}

.install-choice span,
.install-hint {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.35;
}

.install-hint {
  margin-top: 4px;
}

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

.install-choice-actions button {
  min-height: 34px;
  padding: 7px 10px;
}

.field-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(180px, 1fr);
  align-items: end;
  gap: 12px;
}

.job-address-field,
.copy-email-address-field,
#password-field {
  grid-column: 1 / -1;
}

.bot-field {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.result-banner {
  border: 1px solid var(--line);
  border-left: 5px solid #6f7a86;
  border-radius: 6px;
  background: #f7f8f9;
  color: var(--ink);
  font-weight: 800;
  line-height: 1.42;
  padding: 10px 12px;
}

.result-banner.progress {
  border-left-color: #4b6f8f;
  background: #f1f6fa;
}

.result-banner.success {
  border-color: rgba(31, 122, 77, 0.34);
  border-left-color: var(--good);
  background: #eff8f3;
  color: var(--good);
}

.result-banner.error {
  border-color: rgba(163, 59, 59, 0.34);
  border-left-color: var(--warn);
  background: #fff3f3;
  color: var(--warn);
}

label {
  display: grid;
  gap: 6px;
  color: #33404d;
  font-size: 0.86rem;
  font-weight: 700;
}

input {
  width: 100%;
  min-height: 40px;
  border: 1px solid #c7d0d8;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  padding: 9px 10px;
}

input::placeholder {
  color: #6f7a86;
  font-style: italic;
}

input:focus,
button:focus-visible,
.file-drop:focus-within {
  outline: 3px solid rgba(31, 45, 58, 0.16);
  border-color: var(--slate);
}

.file-drop {
  border: 1px dashed #2f8f5b;
  border-radius: 8px;
  background: #edf8f1;
  cursor: pointer;
  gap: 4px;
  min-height: 88px;
  padding: 14px;
}

.file-drop:hover {
  background: #e3f3ea;
  border-color: #237347;
}

.file-drop span {
  color: #16613e;
  font-weight: 800;
}

.file-drop strong {
  color: var(--muted);
  font-size: 0.94rem;
  font-weight: 700;
}

.file-drop input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.file-list {
  display: grid;
  gap: 6px;
}

.camera-panel {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafb;
  padding: 12px;
}

.camera-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.camera-head strong,
.camera-head span {
  display: block;
}

.camera-head strong {
  color: var(--ink);
  font-size: 0.94rem;
}

.camera-head span,
.camera-status {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
}

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

.camera-video {
  width: 100%;
  max-height: min(56dvh, 430px);
  border: 1px solid #c7d0d8;
  border-radius: 6px;
  background: #17212b;
  object-fit: contain;
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
  gap: 8px;
}

.preview-thumb {
  display: grid;
  align-items: center;
  justify-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafb;
  aspect-ratio: 1 / 1;
  position: relative;
}

.preview-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.preview-thumb span {
  position: absolute;
  right: 6px;
  bottom: 6px;
  min-width: 22px;
  border-radius: 999px;
  background: rgba(23, 33, 43, 0.82);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
  padding: 5px 7px;
  text-align: center;
}

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

.file-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-row small {
  color: var(--muted);
}

.file-row em {
  color: var(--good);
  font-style: normal;
  font-weight: 800;
}

.permission-row {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  border-top: 1px solid var(--line);
  color: #34404d;
  font-weight: 600;
  line-height: 1.42;
  padding-top: 12px;
}

.permission-row input {
  min-height: 18px;
  margin-top: 2px;
}

.email-copy-panel {
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  min-height: 40px;
  margin: 0;
  padding: 9px 10px;
}

.email-copy-toggle {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  cursor: pointer;
  font-weight: 800;
  gap: 8px;
  white-space: nowrap;
}

.email-copy-toggle input {
  min-height: 16px;
  width: 16px;
}

.store-type-panel {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: max-content repeat(2, minmax(0, 1fr));
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 8px 10px;
}

.store-type-title {
  color: #33404d;
  font-size: 0.86rem;
  font-weight: 800;
  white-space: nowrap;
}

.store-type-option {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid #c7d0d8;
  border-radius: 6px;
  background: var(--soft);
  cursor: pointer;
  font-weight: 800;
  gap: 8px;
  padding: 8px 10px;
}

.store-type-option:has(input:checked) {
  border-color: #1f7a4d;
  background: #edf8f1;
  color: #16613e;
}

.store-type-option input {
  width: 16px;
  min-height: 16px;
  margin: 0;
}

.legal-footer {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.35;
  max-width: 860px;
  margin: 0 auto;
  padding: 12px 4px 0;
  text-align: center;
}

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border-radius: 6px;
  font: inherit;
  font-weight: 800;
  padding: 9px 14px;
  cursor: pointer;
}

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

.primary {
  border: 1px solid var(--slate);
  background: var(--slate);
  color: #fff;
}

.primary:hover {
  background: var(--slate-hover);
}

.secondary {
  border: 1px solid #b8c2cc;
  background: #fff;
  color: var(--slate);
}

.status-pill {
  justify-self: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: #33404d;
  font-size: 0.78rem;
  font-weight: 800;
  padding: 6px 10px;
}

.hidden {
  display: none !important;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  align-items: center;
  justify-items: center;
  background: rgba(15, 23, 42, 0.46);
  padding: 16px;
}

.upload-modal {
  display: grid;
  gap: 12px;
  width: min(620px, 100%);
  max-height: min(86vh, 720px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.28);
  padding: 16px;
}

.modal-message {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.4;
}

.modal-preview-grid {
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.camera-modal {
  width: min(720px, 100%);
  gap: 8px;
  max-height: min(94dvh, 720px);
  padding: 10px;
}

.camera-modal-actions {
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-top: 0;
  border-bottom: 1px solid var(--line);
  padding: 0 0 8px;
}

.camera-modal-actions button {
  min-height: 32px;
  border-radius: 5px;
  flex: 0 1 auto;
  font-size: 0.78rem;
  line-height: 1;
  padding: 6px 9px;
  white-space: nowrap;
}

.camera-modal-actions .primary {
  min-width: 72px;
  font-size: 0.9rem;
}

@media (max-width: 820px) {
  .app-shell {
    width: min(100% - 20px, 1080px);
    padding-top: 14px;
  }

  .section-head,
  .actions {
    align-items: stretch;
    flex-direction: column;
  }

  .page-head {
    grid-template-columns: minmax(72px, 1fr) minmax(116px, 1.15fr) minmax(72px, 1fr);
    gap: 6px;
  }

  .header-logo {
    height: 52px;
  }

  h1 {
    font-size: 1.14rem;
  }

  .eyebrow {
    font-size: 0.64rem;
  }

  .status-pill {
    font-size: 0.68rem;
    padding: 4px 7px;
  }

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

  .install-choice {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .install-choice-actions {
    justify-content: stretch;
  }

  .install-choice-actions button {
    flex: 1 1 140px;
  }

  .field-grid {
    grid-template-columns: minmax(0, 2fr) minmax(160px, 1fr);
    gap: 8px;
  }

  .preview-grid,
  .modal-preview-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .camera-head {
    grid-template-columns: 1fr;
  }

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

  .camera-actions button {
    flex: 1 1 130px;
  }

  .camera-modal {
    width: min(100%, 640px);
    max-height: calc(100dvh - 18px);
  }

  .camera-modal-actions {
    flex-wrap: nowrap;
    justify-content: center;
  }

  .camera-video {
    max-height: min(54dvh, 390px);
  }
}

@media (max-width: 420px) {
  .page-head {
    grid-template-columns: minmax(58px, 1fr) minmax(104px, 1.08fr) minmax(58px, 1fr);
    gap: 4px;
  }

  .header-logo {
    height: 44px;
  }

  h1 {
    font-size: 1.02rem;
  }

  .status-pill {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .field-grid {
    grid-template-columns: minmax(0, 2fr) minmax(104px, 1fr);
    gap: 8px;
  }

  .email-copy-panel {
    min-height: 40px;
    padding: 8px 6px;
  }

  .email-copy-toggle {
    gap: 5px;
    font-size: 0.76rem;
  }

  .email-copy-toggle input {
    min-height: 14px;
    width: 14px;
  }

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

  .modal-actions {
    flex-direction: column;
  }

  .camera-modal {
    gap: 6px;
    padding: 8px;
  }

  .camera-modal .modal-message {
    font-size: 0.78rem;
    line-height: 1.25;
  }

  .camera-modal-actions {
    display: flex;
    flex-direction: row;
    gap: 4px;
  }

  .camera-modal-actions button {
    min-height: 30px;
    flex: 1 1 0;
    font-size: 0.7rem;
    padding: 5px 4px;
  }

  .camera-modal-actions .primary {
    min-width: 0;
    font-size: 0.82rem;
  }

  .camera-video {
    max-height: min(50dvh, 340px);
  }
}
