:root {
  color-scheme: light;
  --bg: #f7f1e7;
  --surface: rgba(255, 255, 255, 0.84);
  --surface-strong: #fffdf8;
  --text: #1f2a1f;
  --muted: #5d645b;
  --accent: #235347;
  --accent-soft: #dce9e2;
  --border: rgba(31, 42, 31, 0.12);
  --danger: #9f2f2f;
  --shadow: 0 20px 50px rgba(34, 52, 35, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: Georgia, "Times New Roman", serif;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.85), transparent 32%),
    linear-gradient(160deg, #f5ede0 0%, #edf4ea 58%, #e4ece8 100%);
}

a {
  color: var(--accent);
}

button,
input {
  font: inherit;
}

input {
  width: 100%;
  padding: 0.9rem 1rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.94);
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.68;
}

.site-shell {
  width: min(1100px, calc(100vw - 2rem));
  margin: 0 auto;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 0 0.5rem;
}

.brand {
  font-size: 1.1rem;
  font-weight: 700;
  text-decoration: none;
  letter-spacing: 0.02em;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-actions a,
.link-button {
  color: var(--text);
  text-decoration: none;
  background: none;
  border: 0;
  padding: 0;
}

.page-header,
.auth-card,
.card {
  margin: 1.5rem 0;
  padding: 1.5rem;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
  border-radius: 28px;
  backdrop-filter: blur(14px);
}

.page-header {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  align-items: end;
}

.eyebrow {
  margin: 0 0 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  color: var(--muted);
}

.lede,
.muted {
  color: var(--muted);
}

.stack {
  display: grid;
  gap: 1rem;
}

.button-primary,
.button-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 1.15rem;
  border-radius: 999px;
  border: 0;
  text-decoration: none;
}

.button-primary {
  color: white;
  background: var(--accent);
}

.button-secondary {
  color: var(--accent);
  background: var(--accent-soft);
}

.validation-summary {
  color: var(--danger);
}

.sync-status-card {
  display: grid;
  gap: 1rem;
  padding: 1.1rem 1.2rem;
  border-radius: 22px;
  border: 1px solid var(--border);
  background: var(--surface-strong);
}

.sync-status-card-hidden {
  display: none;
}

.sync-status-card.is-active {
  background: linear-gradient(180deg, rgba(220, 233, 226, 0.95), rgba(255, 253, 248, 0.95));
  border-color: rgba(35, 83, 71, 0.2);
}

.sync-status-card.is-complete {
  background: linear-gradient(180deg, rgba(220, 233, 226, 0.95), rgba(241, 248, 244, 0.98));
  border-color: rgba(35, 83, 71, 0.28);
}

.sync-status-card.is-failed {
  background: linear-gradient(180deg, rgba(248, 224, 224, 0.96), rgba(255, 253, 248, 0.98));
  border-color: rgba(159, 47, 47, 0.24);
}

.sync-status-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: start;
}

.sync-status-title {
  margin: 0;
}

.sync-status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2rem;
  padding: 0.3rem 0.8rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--accent);
  font-size: 0.92rem;
  font-weight: 700;
}

.sync-status-card.is-failed .sync-status-pill {
  color: var(--danger);
}

.sync-status-message {
  margin: 0;
  color: var(--muted);
}

.sync-progress {
  overflow: hidden;
  height: 0.8rem;
  border-radius: 999px;
  background: rgba(35, 83, 71, 0.12);
}

.sync-progress-bar {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #235347 0%, #5a9b81 100%);
  transition: width 220ms ease;
}

.sync-status-card.is-failed .sync-progress-bar {
  background: linear-gradient(90deg, #9f2f2f 0%, #d46a6a 100%);
}

.sync-progress-bar.is-indeterminate {
  width: 38%;
  animation: sync-progress-indeterminate 1.2s ease-in-out infinite;
}

.sync-status-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  color: var(--muted);
}

.sync-status-details {
  display: grid;
  gap: 0.9rem;
}

.sync-status-details > summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 700;
}

.share-list,
.job-items {
  display: grid;
  gap: 1rem;
}

.share-row,
.job-item {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
  border-radius: 18px;
  background: var(--surface-strong);
  border: 1px solid var(--border);
}

.meta,
.actions,
.toolbar {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.job-item.is-pending {
  border-color: rgba(31, 42, 31, 0.12);
}

.job-item.is-active {
  border-color: rgba(35, 83, 71, 0.24);
  background: rgba(220, 233, 226, 0.55);
}

.job-item.is-complete {
  border-color: rgba(35, 83, 71, 0.22);
}

.job-item.is-failed {
  border-color: rgba(159, 47, 47, 0.24);
  background: rgba(248, 224, 224, 0.56);
}

.job-item-copy {
  display: grid;
  gap: 0.35rem;
}

.job-item-name {
  font-weight: 700;
}

.job-item-detail {
  color: var(--muted);
  font-size: 0.95rem;
}

.job-item-status {
  white-space: nowrap;
}

.selection-summary {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.95rem;
}

.success-panel,
.badge {
  padding: 1rem;
  border-radius: 18px;
  background: var(--accent-soft);
}

.asset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
}

.asset-card {
  display: grid;
  gap: 0.75rem;
  align-content: start;
  padding: 0.85rem;
  border-radius: 22px;
  background: var(--surface-strong);
  border: 1px solid var(--border);
  transition: transform 120ms ease, border-color 120ms ease, background-color 120ms ease, box-shadow 120ms ease;
  cursor: pointer;
}

.asset-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.asset-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 16px;
  background: #e2e8df;
}

.asset-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 28px rgba(34, 52, 35, 0.08);
}

.asset-card:focus-visible {
  outline: 3px solid rgba(35, 83, 71, 0.25);
  outline-offset: 4px;
}

.asset-card.is-selected {
  background: #dce9e2;
  border-color: rgba(35, 83, 71, 0.45);
  box-shadow: inset 0 0 0 1px rgba(35, 83, 71, 0.2);
}

.asset-media {
  position: relative;
}

.asset-preview-trigger:focus-visible,
.preview-close:focus-visible {
  outline: 3px solid rgba(35, 83, 71, 0.25);
  outline-offset: 3px;
}

.asset-preview-trigger {
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.9);
  color: var(--accent);
  box-shadow: 0 8px 20px rgba(20, 28, 24, 0.16);
}

.asset-preview-icon {
  width: 1.2rem;
  height: 1.2rem;
}

.asset-name {
  display: block;
  padding: 0.2rem 0.1rem 0;
  color: var(--text);
}

.preview-open {
  overflow: hidden;
}

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

.preview-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}

.preview-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 28, 24, 0.74);
  backdrop-filter: blur(6px);
}

.preview-dialog {
  position: relative;
  z-index: 1;
  width: min(1100px, 100%);
  max-height: calc(100vh - 3rem);
  display: grid;
  gap: 1rem;
  padding: 1rem;
  border-radius: 28px;
  background: rgba(248, 245, 239, 0.96);
  border: 1px solid rgba(31, 42, 31, 0.12);
  box-shadow: 0 24px 60px rgba(20, 28, 24, 0.34);
}

.preview-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}

.preview-header h2 {
  margin: 0;
  font-size: 1.2rem;
}

.preview-close {
  min-height: 42px;
  padding: 0 1rem;
  border-radius: 999px;
  border: 0;
  background: var(--accent-soft);
  color: var(--accent);
}

.preview-body {
  display: grid;
  place-items: center;
  min-height: min(70vh, 720px);
}

.preview-body img,
.preview-body video {
  max-width: 100%;
  max-height: min(72vh, 760px);
  border-radius: 20px;
  background: rgba(226, 232, 223, 0.8);
}

@media (max-width: 720px) {
  .page-header,
  .sync-status-header,
  .share-row,
  .job-item,
  .site-header {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar {
    flex-wrap: wrap;
  }

  .selection-summary {
    width: 100%;
    margin-left: 0;
  }

  .sync-status-metrics {
    flex-direction: column;
    gap: 0.5rem;
  }

  .preview-modal {
    padding: 0.75rem;
  }

  .preview-dialog {
    max-height: calc(100vh - 1.5rem);
  }

  .preview-header {
    align-items: stretch;
    flex-direction: column;
  }
}

@keyframes sync-progress-indeterminate {
  0% {
    transform: translateX(-100%);
  }

  60% {
    transform: translateX(120%);
  }

  100% {
    transform: translateX(120%);
  }
}
