:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #172019;
  background: #f3f1ea;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at top right, rgba(244, 153, 74, 0.2), transparent 30rem),
    #f3f1ea;
}

button,
code,
input {
  font: inherit;
}

.shell {
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto;
  padding: 56px 0;
}

.masthead,
.toolbar,
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

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

h1 {
  max-width: 720px;
  margin-bottom: 12px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.4rem, 6vw, 4.8rem);
  font-weight: 500;
  line-height: 0.98;
  letter-spacing: -0.04em;
}

h2 {
  margin-bottom: 0;
  font-size: 1.6rem;
}

.eyebrow,
.label {
  margin-bottom: 8px;
  color: #637067;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.intro {
  max-width: 640px;
  margin-bottom: 0;
  color: #586159;
  font-size: 1.05rem;
  line-height: 1.6;
}

.service-status {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 9px;
  padding: 10px 14px;
  border: 1px solid #d7d9d2;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.62);
  color: #505950;
  font-size: 0.85rem;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #b57247;
}

.status-dot.is-ready {
  background: #39855a;
  box-shadow: 0 0 0 4px rgba(57, 133, 90, 0.12);
}

.toolbar {
  margin: 52px 0;
  padding: 22px 24px;
  border: 1px solid #d7d9d2;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 18px 60px rgba(65, 57, 42, 0.06);
}

.folder-name {
  margin-bottom: 0;
  font-size: 1.1rem;
  font-weight: 700;
}

.source-note {
  margin: 5px 0 0;
  color: #7a817a;
  font-size: 0.82rem;
}

.scan-status {
  min-height: 1.3em;
  margin: -36px 2px 36px;
  color: #637067;
  font-size: 0.88rem;
}

.capture-panel {
  margin: 0 0 52px;
  padding: 24px;
  border: 1px solid #d7d9d2;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 18px 60px rgba(65, 57, 42, 0.06);
}

.capture-heading {
  margin-bottom: 10px;
}

.capture-availability {
  color: #637067;
  font-size: 0.82rem;
  font-weight: 700;
}

.capture-availability.is-ready {
  color: #28683f;
}

.capture-help {
  max-width: 760px;
  margin-bottom: 20px;
  color: #586159;
  line-height: 1.5;
}

.capture-form {
  display: flex;
  min-height: 0;
  flex-direction: column;
}

.capture-modal-body {
  min-height: 0;
  flex: 1 1 auto;
  display: grid;
  gap: 20px;
  overflow-y: auto;
  padding: 20px;
}

.capture-modal-footer {
  display: grid;
  flex-shrink: 0;
  gap: 14px;
  border-top: 1px solid #e5e7eb;
  background: #fff;
  padding: 16px 20px;
}

.capture-url-grid {
  display: grid;
  gap: 10px;
}

.capture-location-row {
  display: grid;
  grid-template-columns: minmax(0, 9fr) minmax(72px, 1fr);
  gap: 10px;
  align-items: end;
}

.capture-location-fields {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr);
  gap: 10px;
  align-items: end;
}

.capture-location-row .remove-location {
  min-height: 42px;
  width: 100%;
  white-space: nowrap;
}

.capture-location-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #637067;
  font-size: 0.82rem;
}

.capture-field {
  display: grid;
  gap: 7px;
  color: #536057;
  font-size: 0.78rem;
  font-weight: 750;
}

.capture-field input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid #cfd4cc;
  border-radius: 9px;
  background: #fff;
  color: #172019;
}

.capture-field input:focus-visible {
  outline: 3px solid rgba(154, 84, 39, 0.22);
  outline-offset: 2px;
  border-color: #8b9c8d;
}

.capture-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.capture-status {
  min-height: 1.4em;
  margin-top: 16px;
  color: #637067;
  font-size: 0.88rem;
}

.capture-progress {
  margin-top: 18px;
  padding: 12px 14px;
  border: 1px solid #dfe3dc;
  border-radius: 12px;
  background: rgba(247, 249, 245, 0.9);
}

.capture-progress-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
  color: #435148;
  font-size: 0.8rem;
  font-weight: 750;
}

.capture-progress-count {
  color: #748078;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.capture-progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #dfe5dc;
}

.capture-progress-bar {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: #2d6b45;
  transition: width 260ms ease;
}

.capture-progress-items {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.capture-progress-item {
  padding: 9px 10px;
  border: 1px solid #d5dad3;
  border-radius: 8px;
  background: #f8f8f4;
}

.capture-progress-item-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.capture-progress-item-heading span {
  color: #667269;
  font-size: 0.76rem;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.capture-progress-item small,
.capture-progress-item p {
  display: block;
  margin: 4px 0 0;
  overflow-wrap: anywhere;
  color: #68736b;
  font-size: 0.78rem;
}

.capture-progress-item-error {
  color: #a33e28 !important;
  font-weight: 650;
}

.capture-progress-item.is-complete {
  border-color: #a7c9ae;
}

.capture-progress-item.is-failed {
  border-color: #e3b6a9;
  background: #fff3ee;
}

.capture-progress.is-active .capture-progress-bar {
  background: linear-gradient(90deg, #2d6b45, #78a86d, #2d6b45);
  background-size: 200% 100%;
  animation: capture-progress-shimmer 1.6s linear infinite;
}

@keyframes capture-progress-shimmer {
  to { background-position: -200% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .capture-progress-bar {
    transition: none;
  }

  .capture-progress.is-active .capture-progress-bar {
    animation: none;
  }
}

.capture-status.is-error {
  color: #8a4923;
}

.capture-status.is-success {
  color: #28683f;
}

button {
  cursor: pointer;
  transition: background-color 160ms ease, transform 160ms ease;
}

button:active:not(:disabled) {
  transform: translateY(1px);
}

button:focus-visible {
  outline: 3px solid rgba(154, 84, 39, 0.32);
  outline-offset: 3px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.section-heading {
  align-items: end;
  margin-bottom: 20px;
}

.project-count {
  color: #6b746c;
  font-size: 0.9rem;
  white-space: nowrap;
}

.project-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 18px;
  flex-wrap: wrap;
}

.project-filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #59635b;
  font-size: 0.84rem;
  font-weight: 700;
}

.project-filter select {
  min-width: 116px;
  padding: 8px 30px 8px 10px;
  border: 1px solid #cfd3cb;
  border-radius: 9px;
  background: #fffefa;
  color: #172019;
}

.project-table-wrap {
  overflow-x: auto;
  border: 1px solid #d7d9d2;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 18px 50px rgba(65, 57, 42, 0.05);
}

.project-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  text-align: left;
}

.project-location {
  min-width: 180px;
  color: #172019;
  font-weight: 750;
}

.project-years-cell {
  color: #59635b;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  white-space: nowrap;
}

.table-status {
  white-space: nowrap;
}

.status-badge.is-approved {
  background: #dcecdf;
  color: #28683f;
}

.status-badge.is-pending {
  background: #f4dfd1;
  color: #8a4923;
}

.table-issues {
  max-width: 260px;
  margin: 0;
  color: #774728;
  font-size: 0.82rem;
  line-height: 1.4;
}

.table-issues.is-clear {
  color: #707870;
}

.project-action-button {
  min-width: 125px;
  white-space: nowrap;
}

.project-card {
  padding: 22px;
  border: 1px solid #d7d9d2;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 18px 50px rgba(65, 57, 42, 0.05);
}

.project-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.project-heading h3 {
  margin-bottom: 0;
  font-size: 1.17rem;
  line-height: 1.35;
}

.status-badge {
  flex-shrink: 0;
  padding: 6px 9px;
  border-radius: 999px;
  background: #f4dfd1;
  color: #8a4923;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.status-badge.is-ready {
  background: #dcecdf;
  color: #28683f;
}

.project-years {
  margin: 12px 0 20px;
  color: #59635b;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
}

.issue-list {
  margin: -6px 0 20px;
  padding: 13px 16px 13px 34px;
  border-radius: 10px;
  background: #fcf0e8;
  color: #774728;
  font-size: 0.88rem;
  line-height: 1.5;
}

.issue-list li + li {
  margin-top: 5px;
}

.preview-placeholder {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border: 1px dashed #bdc2b9;
  border-radius: 14px;
  background: rgba(243, 241, 234, 0.62);
}

.preview-frame {
  display: grid;
  width: 42px;
  height: 74px;
  flex-shrink: 0;
  place-items: center;
  border: 1px solid #9ca49c;
  border-radius: 6px;
  background: #e5e6df;
  color: #777f78;
  font-size: 0.7rem;
  font-weight: 700;
}

.preview-title {
  margin-bottom: 4px;
  color: #303a32;
  font-size: 0.9rem;
  font-weight: 750;
}

.preview-description {
  margin-bottom: 0;
  color: #707870;
  font-size: 0.82rem;
  line-height: 1.45;
}

.open-editor-button {
  width: 100%;
  margin-top: 14px;
}

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

.editor-dialog {
  width: min(1120px, calc(100% - 28px));
  max-height: calc(100vh - 28px);
  overflow: hidden;
  padding: 0;
  border: 1px solid #cfd3cb;
  border-radius: 22px;
  background: #f8f7f2;
  color: #172019;
  box-shadow: 0 28px 90px rgba(37, 43, 38, 0.28);
}

.editor-dialog::backdrop {
  background: rgba(27, 33, 29, 0.62);
  backdrop-filter: blur(3px);
}

.editor-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: min(900px, calc(100vh - 28px));
  max-height: calc(100vh - 28px);
}

.editor-header,
.editor-section-heading,
.editor-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.editor-header {
  align-items: flex-start;
  padding: 14px 20px 12px;
  border-bottom: 1px solid #dadcd5;
}

.editor-header h2 {
  margin-bottom: 3px;
  font-size: 1.25rem;
}

.editor-years {
  margin-bottom: 0;
  color: #657067;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
}

.editor-header .eyebrow {
  margin-bottom: 3px;
  font-size: 0.68rem;
}

.icon-button {
  width: 40px;
  height: 40px;
  padding: 0;
  flex-shrink: 0;
  border: 1px solid #d1d5cd;
  border-radius: 50%;
  background: transparent;
  color: #465048;
  font-size: 1.7rem;
  font-weight: 400;
  line-height: 1;
}

.icon-button:hover:not(:disabled) {
  background: #e9e9e2;
}

.editor-form {
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
}

.editor-layout {
  min-height: 0;
  overflow-y: auto;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(340px, 0.95fr);
  align-items: start;
  gap: 12px;
  padding: 12px 20px;
  overscroll-behavior: contain;
}

.editor-preview-column,
.editor-settings-column {
  display: grid;
  min-width: 0;
  gap: 12px;
}

.editor-section {
  padding: 14px;
  border: 1px solid #d8dad3;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
}

.accordion-section {
  padding: 0;
}

.accordion-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 20px;
  cursor: pointer;
  list-style: none;
}

.accordion-summary::-webkit-details-marker {
  display: none;
}

.accordion-summary::after {
  flex-shrink: 0;
  color: #637067;
  content: "+";
  font-size: 1.35rem;
  font-weight: 500;
  line-height: 1;
}

.accordion-section[open] > .accordion-summary::after {
  content: "−";
}

.accordion-summary:focus-visible {
  outline: 3px solid rgba(154, 84, 39, 0.24);
  outline-offset: -4px;
}

.accordion-section > :not(summary) {
  margin-right: 20px;
  margin-left: 20px;
}

.accordion-section > :last-child {
  margin-bottom: 20px;
}

.preview-stage {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  min-width: 0;
}

.preview-stage-empty {
  align-self: center;
  justify-self: center;
  color: #697269;
  text-align: center;
}

.preview-source-card {
  position: relative;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  border: 1px solid #d8dad3;
  border-radius: 9px;
  background: #fff;
}

.preview-source-image {
  display: block;
  width: 100%;
  aspect-ratio: 9 / 14;
  object-fit: cover;
}

.preview-source-card figcaption {
  overflow: hidden;
  padding: 5px 7px;
  color: #59635b;
  font-size: 0.68rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.editor-source-preview {
  min-width: 0;
  margin-top: 14px;
}

.source-preview-heading {
  display: grid;
  gap: 3px;
  margin-bottom: 8px;
  color: #263029;
  font-size: 0.82rem;
}

.source-preview-heading small {
  color: #707970;
  font-size: 0.74rem;
  font-weight: 500;
}

.editor-actions .preview-stage {
  min-height: 42px;
  padding: 0;
}

.preview-video {
  display: block;
  width: min(100%, 380px);
  max-height: 620px;
  margin: 16px auto 0;
  border-radius: 12px;
  background: #202620;
}

.caption-field {
  display: grid;
  gap: 7px;
  margin-top: 16px;
  color: #59635b;
  font-size: 0.82rem;
  font-weight: 750;
}

.caption-field textarea {
  width: 100%;
  resize: vertical;
  padding: 11px 12px;
  border: 1px solid #c9cec6;
  border-radius: 8px;
  background: white;
  color: #263029;
  font: inherit;
  line-height: 1.5;
}

.download-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.editor-section h3 {
  margin-bottom: 5px;
}

.editor-section p {
  margin-bottom: 0;
  color: #697269;
  font-size: 0.88rem;
  line-height: 1.5;
}

.frame-settings {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.select-field {
  display: grid;
  gap: 7px;
  margin-top: 16px;
  color: #59635b;
  font-size: 0.76rem;
  font-weight: 700;
}

.select-field select,
.select-field input {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid #c9cec6;
  border-radius: 8px;
  background: white;
  color: #263029;
}

.select-field small {
  color: #707970;
  font-weight: 500;
  line-height: 1.4;
}

.frame-row,
.position-fields,
.label-settings {
  min-width: 0;
  margin: 0;
  padding: 14px;
  border: 1px solid #dddeda;
  border-radius: 12px;
}

.frame-row legend,
.position-fields legend,
.label-settings legend {
  padding: 0 5px;
  font-weight: 750;
}

.frame-file {
  overflow: hidden;
  margin-bottom: 12px !important;
  color: #7a817a !important;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.crop-fields,
.position-fields {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.crop-fields label,
.position-fields label {
  display: grid;
  gap: 6px;
  color: #59635b;
  font-size: 0.76rem;
  font-weight: 700;
}

input[type="number"] {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid #c9cec6;
  border-radius: 8px;
  background: white;
  color: #263029;
  font-variant-numeric: tabular-nums;
}

input:focus-visible {
  outline: 3px solid rgba(154, 84, 39, 0.24);
  outline-offset: 1px;
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1.25fr;
  gap: 18px;
}

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

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

.label-settings + .label-settings {
  margin-top: 12px;
}

.label-settings .toggle-row {
  margin-top: 12px;
}

.toggle-row {
  display: flex;
  grid-column: 1 / -1;
  align-items: flex-start;
  gap: 10px;
  padding-top: 4px;
  cursor: pointer;
}

.toggle-row input {
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  accent-color: #1d3a2a;
}

.toggle-row span {
  display: grid;
  gap: 3px;
}

.toggle-row small {
  color: #707970;
  line-height: 1.4;
}

.motion-setting button {
  min-width: 105px;
}

.editor-action-status {
  min-height: 1.45em;
  margin: 0 0 9px;
  color: #8a4923;
  font-weight: 650;
}

.editor-actions {
  position: sticky;
  bottom: 0;
  z-index: 4;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 20px 12px;
  border-top: 1px solid #dadcd5;
  background: rgba(248, 247, 242, 0.98);
  box-shadow: 0 -10px 24px rgba(37, 43, 38, 0.06);
}

.editor-action-panel {
  display: grid;
  min-width: min(360px, 100%);
  gap: 0;
}

.editor-action-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
  flex-wrap: wrap;
}

.button-spinner {
  display: none;
  width: 1em;
  height: 1em;
  margin-left: 7px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  vertical-align: -0.15em;
  animation: button-spin 0.7s linear infinite;
}

button.is-loading .button-spinner {
  display: inline-block;
}

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

.error-state {
  padding: 32px;
  border: 1px solid #e1b9a1;
  border-radius: 16px;
  background: #fcf0e8;
  color: #774728;
  text-align: center;
}

.error-state h3 {
  margin-bottom: 6px;
}

.error-state p {
  margin-bottom: 0;
}

.empty-state {
  padding: 64px 24px;
  border: 1px dashed #bdc2b9;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.42);
  text-align: center;
}

.empty-state p {
  max-width: 600px;
  margin: 0 auto 22px;
  color: #626a63;
  line-height: 1.6;
}

.empty-icon {
  display: grid;
  width: 44px;
  height: 44px;
  margin: 0 auto 18px;
  place-items: center;
  border-radius: 50%;
  background: #f1d8be;
  color: #9a5427;
}

code {
  display: inline-block;
  padding: 9px 12px;
  border-radius: 8px;
  background: #e9e7de;
  color: #485047;
  font-size: 0.85rem;
}

@media (max-width: 700px) {
  .shell {
    padding-top: 32px;
  }

  .masthead,
  .toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .toolbar button {
    width: 100%;
  }

  .capture-form {
    grid-template-columns: 1fr;
  }

  .capture-url-grid {
    grid-template-columns: 1fr;
  }

  .capture-location-row {
    grid-template-columns: 1fr;
  }

  .capture-location-fields {
    grid-template-columns: 1fr;
  }

  .capture-location-row .remove-location {
    width: 100%;
  }

  .capture-location-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .capture-actions,
  .capture-actions button {
    width: 100%;
  }

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

  .scan-status {
    margin-top: -34px;
  }

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

  .project-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .editor-shell {
    max-height: calc(100vh - 28px);
  }

  .editor-header {
    padding: 20px 20px 18px;
  }

  .editor-layout {
    grid-template-columns: 1fr;
    padding: 16px 20px;
  }

  .editor-actions {
    padding: 12px 20px 20px;
  }

  .crop-fields,
  .settings-grid,
  .timing-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .settings-grid > div,
  .position-fields,
  .toggle-row {
    grid-column: 1 / -1;
  }
}

@media (max-width: 440px) {
  .preview-stage {
    grid-template-columns: 1fr;
  }

  .crop-fields,
  .settings-grid,
  .position-fields,
  .timing-fields {
    grid-template-columns: 1fr;
  }

  .editor-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .editor-actions button {
    width: 100%;
  }

  .editor-action-panel {
    width: 100%;
  }

  .editor-action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}
