:root {
  color-scheme: light dark;
  --violet: #6d4aff;
  --violet-deep: #4d32c8;
  --orange: #ff8a3d;
  --orange-soft: #fff0e6;
  --cream: #fff9f2;
  --ink: #171427;
  --muted: #6f697c;
  --line: #e7dfeb;
  --panel: #ffffff;
  --panel-soft: #f8f5fb;
  --success: #117b58;
  --success-soft: #e2f6ed;
  --warning: #9a5b00;
  --warning-soft: #fff2cf;
  --danger: #b53a45;
  --danger-soft: #ffe8eb;
  --shadow: 0 20px 60px rgba(43, 30, 70, 0.09);
  --header-height: 68px;
  --sidebar-width: 246px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--cream);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 92% 4%, rgba(109, 74, 255, 0.1), transparent 30rem),
    var(--cream);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

button,
input,
select {
  font: inherit;
}

button,
select,
input[type="radio"] {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
[tabindex="0"]:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(109, 74, 255, 0.35);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 10px;
  left: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  color: #fff;
  background: var(--violet-deep);
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

.screen-reader-status {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--violet);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.login-view {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(300px, 0.9fr) minmax(400px, 1.1fr);
  background: var(--panel);
}

.login-art {
  position: relative;
  min-height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: clamp(36px, 8vw, 92px);
  color: #fff;
  background:
    linear-gradient(155deg, rgba(33, 19, 69, 0.28), rgba(33, 19, 69, 0.92)),
    linear-gradient(135deg, #8a63ff 0%, #6d4aff 38%, #ff8a3d 140%);
}

.login-art::before,
.login-art::after {
  content: "";
  position: absolute;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
}

.login-art::before {
  width: 520px;
  height: 520px;
  top: -170px;
  left: -210px;
}

.login-art::after {
  width: 320px;
  height: 320px;
  right: -110px;
  bottom: 80px;
}

.trail-mark {
  position: absolute;
  width: 160px;
  height: 420px;
  border: 44px solid rgba(255, 255, 255, 0.08);
  border-top-color: transparent;
  border-bottom-color: transparent;
  transform: rotate(32deg);
}

.trail-mark-one {
  top: 4%;
  right: 16%;
}

.trail-mark-two {
  top: 20%;
  right: -12%;
}

.login-wordmark {
  position: relative;
  z-index: 1;
  font-size: clamp(2.2rem, 5vw, 4.6rem);
  font-weight: 950;
  letter-spacing: -0.06em;
}

.login-art p {
  position: relative;
  z-index: 1;
  max-width: 420px;
  margin: 12px 0 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: clamp(1rem, 2vw, 1.3rem);
}

.login-panel {
  width: min(520px, calc(100% - 48px));
  margin: auto;
  padding: 48px 0;
}

.login-panel h1 {
  margin: 0;
  font-size: clamp(2.3rem, 5vw, 4.3rem);
  line-height: 0.98;
  letter-spacing: -0.055em;
}

.lede {
  max-width: 480px;
  margin: 22px 0 28px;
  color: var(--muted);
  font-size: 1.08rem;
}

.validation-callout {
  display: grid;
  gap: 4px;
  margin: 0 0 18px;
  padding: 15px 16px;
  border: 1px solid #d9ccff;
  border-radius: 14px;
  background: #f5f0ff;
}

.validation-callout span,
.login-status,
.provider-list {
  color: var(--muted);
  font-size: 0.9rem;
}

.provider-list {
  display: grid;
  gap: 7px;
  margin-top: 14px;
}

.provider-row {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.provider-row strong {
  color: var(--ink);
  font-size: 0.78rem;
}

.primary-action,
.secondary-action,
.text-button,
.icon-button,
.filter-chip {
  border: 0;
  border-radius: 12px;
  font-weight: 750;
}

.primary-action {
  min-height: 44px;
  padding: 10px 17px;
  color: #fff;
  background: linear-gradient(135deg, var(--violet), var(--violet-deep));
  box-shadow: 0 9px 22px rgba(109, 74, 255, 0.24);
}

.primary-action:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(109, 74, 255, 0.3);
}

.primary-action:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.secondary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 8px 14px;
  color: var(--violet-deep);
  border: 1px solid #d7caff;
  background: var(--panel);
  text-decoration: none;
}

.secondary-action.danger-action {
  color: var(--danger);
  border-color: #ffc6ce;
}

.wide-action {
  width: 100%;
}

.text-button {
  padding: 6px 8px;
  color: var(--violet-deep);
  background: transparent;
}

.text-button:hover {
  background: rgba(109, 74, 255, 0.08);
}

.danger-action {
  color: var(--danger);
}

.workspace-header {
  position: fixed;
  z-index: 50;
  top: 0;
  right: 0;
  left: 0;
  height: var(--header-height);
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  backdrop-filter: blur(18px);
}

.workspace-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: calc(var(--sidebar-width) - 24px);
  color: var(--ink);
  font-weight: 950;
  letter-spacing: -0.04em;
  text-decoration: none;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 11px 11px 16px 11px;
  color: #fff;
  background: linear-gradient(145deg, var(--violet), var(--orange));
}

select,
input:not([type="radio"]):not([type="file"]) {
  min-height: 42px;
  padding: 8px 12px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--panel);
}

.connection-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-left: auto;
  padding: 6px 10px;
  color: var(--success);
  border-radius: 999px;
  background: var(--success-soft);
  font-size: 0.78rem;
  font-weight: 800;
}

.connection-pill span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.connection-pill.is-offline {
  color: var(--danger);
  background: var(--danger-soft);
}

.workspace-layout {
  min-height: 100vh;
  padding-top: var(--header-height);
}

.workspace-sidebar {
  position: fixed;
  z-index: 40;
  top: var(--header-height);
  bottom: 0;
  left: 0;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 88%, var(--cream));
}

.workspace-sidebar nav {
  display: grid;
  gap: 4px;
}

.nav-item {
  min-height: 44px;
  display: grid;
  grid-template-columns: 26px 1fr auto;
  align-items: center;
  gap: 9px;
  padding: 8px 12px;
  color: var(--muted);
  border: 0;
  border-radius: 11px;
  background: transparent;
  text-align: left;
  font-weight: 700;
}

.nav-item:hover,
.nav-item.is-active {
  color: var(--violet-deep);
  background: rgba(109, 74, 255, 0.1);
}

.nav-item span {
  font-size: 1.1rem;
  text-align: center;
}

.nav-item b {
  min-width: 22px;
  padding: 2px 7px;
  color: #fff;
  border-radius: 999px;
  background: var(--orange);
  font-size: 0.72rem;
  text-align: center;
}

.nav-divider {
  height: 1px;
  margin: 9px 10px;
  background: var(--line);
}

.sidebar-foot {
  display: grid;
  gap: 3px;
  margin-top: auto;
  padding: 13px;
  color: var(--muted);
  border-radius: 12px;
  background: var(--panel-soft);
  font-size: 0.73rem;
}

.sidebar-foot strong {
  color: var(--ink);
}

.workspace-main {
  min-height: calc(100vh - var(--header-height));
  margin-left: var(--sidebar-width);
  padding: 38px clamp(20px, 4vw, 58px) 64px;
}

.main-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  max-width: 1260px;
  margin: 0 auto 27px;
}

.heading-copy {
  min-width: 0;
}

.title-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
}

.title-line .secondary-action {
  min-height: 36px;
  padding: 7px 12px;
  font-size: 0.82rem;
}

.main-heading h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.45rem);
  line-height: 1;
  letter-spacing: -0.055em;
}

.main-heading p:last-child {
  max-width: 660px;
  margin: 10px 0 0;
  color: var(--muted);
}

.heading-actions {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.workspace-view {
  max-width: 1260px;
  margin: 0 auto;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.metric-card,
.panel,
.story-card,
.vault-card {
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.metric-card {
  min-height: 126px;
  display: grid;
  align-content: space-between;
  padding: 19px;
}

.metric-card span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 750;
}

.metric-card strong {
  font-size: 2rem;
  line-height: 1;
  letter-spacing: -0.05em;
}

.metric-card em {
  color: var(--success);
  font-size: 0.75rem;
  font-style: normal;
}

.content-grid,
.two-column-grid {
  display: grid;
  gap: 18px;
}

.content-grid:not(.two-column-grid) {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.two-column-grid {
  grid-template-columns: minmax(0, 1.5fr) minmax(300px, 0.8fr);
}

.panel {
  padding: 21px;
}

.panel-heading,
.selected-files-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.panel-heading {
  margin-bottom: 17px;
}

.panel h2,
.panel h3 {
  margin: 0;
  letter-spacing: -0.025em;
}

.panel h2 {
  font-size: 1.25rem;
}

.panel h3 {
  font-size: 0.95rem;
}

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
}

.timeline li {
  position: relative;
  display: grid;
  grid-template-columns: 12px 1fr auto;
  gap: 11px;
  align-items: start;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.timeline li:last-child {
  border-bottom: 0;
}

.timeline-dot {
  width: 9px;
  height: 9px;
  margin-top: 6px;
  border: 2px solid var(--panel);
  border-radius: 50%;
  background: var(--violet);
  box-shadow: 0 0 0 2px rgba(109, 74, 255, 0.2);
}

.timeline strong,
.timeline span {
  display: block;
}

.timeline span,
.timeline time {
  color: var(--muted);
  font-size: 0.77rem;
}

.empty-state {
  padding: 28px 16px;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 14px;
  text-align: center;
}

.attention-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  width: 100%;
  color: var(--ink);
  text-align: left;
}

.attention-row:last-child {
  border: 0;
}

.attention-count {
  width: 35px;
  height: 35px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 11px;
  color: var(--warning);
  background: var(--warning-soft);
  font-weight: 900;
}

.attention-row span {
  color: var(--muted);
  font-size: 0.8rem;
}

.filter-row {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
  overflow-x: auto;
}

.share-explanation {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 0.88rem;
}

.filter-chip {
  flex: 0 0 auto;
  padding: 8px 13px;
  color: var(--muted);
  border: 1px solid var(--line);
  background: var(--panel);
}

.filter-chip.is-active {
  color: #fff;
  border-color: var(--violet);
  background: var(--violet);
}

.story-grid,
.vault-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.story-card,
.vault-card {
  overflow: hidden;
}

.story-cover,
.vault-preview {
  min-height: 155px;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.86);
  background: linear-gradient(140deg, var(--violet), var(--orange));
  font-size: 2rem;
}

.story-cover {
  height: 210px;
  overflow: hidden;
  background: var(--panel-soft);
}

.story-cover img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.story-card-body,
.vault-card-body {
  padding: 13px 16px 15px;
}

.story-card h3,
.vault-card h3 {
  margin: 0 0 5px;
}

.story-card p,
.vault-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.story-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 10px;
  margin-bottom: 5px;
}

.story-title-row h3 {
  margin: 0;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin-top: 11px;
}

.card-actions .text-button,
.card-actions a {
  padding: 0;
}

.story-card .card-actions {
  justify-content: flex-end;
}

.section-intro {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}

.section-intro p:last-child {
  max-width: 520px;
  margin: 0;
  color: var(--muted);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  color: var(--violet-deep);
  border-radius: 999px;
  background: #eee8ff;
  font-size: 0.7rem;
  font-weight: 850;
  text-transform: capitalize;
}

.status-badge.is-success {
  color: var(--success);
  background: var(--success-soft);
}

.status-badge.is-warning {
  color: var(--warning);
  background: var(--warning-soft);
}

.status-badge.is-danger {
  color: var(--danger);
  background: var(--danger-soft);
}

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

.vault-preview img {
  width: 100%;
  height: 180px;
  object-fit: cover;
}

.import-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(280px, 0.7fr);
  gap: 18px;
  align-items: start;
}

.import-primary-column {
  display: grid;
  gap: 18px;
}

.recent-imports-panel {
  position: sticky;
  top: calc(var(--header-height) + 24px);
}

.target-options {
  display: grid;
  gap: 9px;
  margin: 0 0 19px;
  padding: 0;
  border: 0;
}

.target-options legend,
.form-row label {
  margin-bottom: 8px;
  font-size: 0.82rem;
  font-weight: 850;
}

.target-options label {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 11px;
  align-items: start;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 13px;
  cursor: pointer;
}

.target-options label:has(input:checked) {
  border-color: var(--violet);
  background: rgba(109, 74, 255, 0.06);
}

.target-options input {
  margin-top: 4px;
  accent-color: var(--violet);
}

.target-options strong,
.target-options small {
  display: block;
}

.target-options small {
  margin-top: 2px;
  color: var(--muted);
}

.form-row {
  display: grid;
  margin-bottom: 17px;
}

.drop-zone {
  display: grid;
  place-items: center;
  min-height: 215px;
  padding: 26px;
  border: 2px dashed #cabaff;
  border-radius: 17px;
  background: linear-gradient(145deg, rgba(109, 74, 255, 0.055), rgba(255, 138, 61, 0.05));
  text-align: center;
}

.drop-zone.is-dragging {
  border-style: solid;
  border-color: var(--violet);
  background: rgba(109, 74, 255, 0.12);
}

.drop-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  margin-bottom: 8px;
  border-radius: 15px;
  color: #fff;
  background: var(--violet);
  font-size: 1.45rem;
}

.drop-zone > span:not(.drop-icon) {
  color: var(--muted);
}

.drop-actions {
  display: flex;
  gap: 9px;
  margin-top: 14px;
}

.selected-files {
  margin: 16px 0;
  padding: 14px;
  border-radius: 14px;
  background: var(--panel-soft);
}

.file-list,
.batch-file-list,
.recent-import-list {
  display: grid;
  gap: 7px;
  margin-top: 10px;
}

.file-row,
.batch-file-row,
.recent-import-row {
  display: grid;
  align-items: center;
  gap: 10px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--panel);
}

.file-row {
  grid-template-columns: minmax(0, 1fr) auto;
}

.batch-file-row {
  grid-template-columns: minmax(0, 1fr) auto auto;
}

.file-row strong,
.batch-file-row strong,
.recent-import-row strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-row small,
.batch-file-row small,
.recent-import-row small {
  color: var(--muted);
}

progress {
  width: 110px;
  height: 8px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  accent-color: var(--violet);
}

.status-counts {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin-bottom: 15px;
}

.status-count {
  padding: 10px;
  border-radius: 12px;
  background: var(--panel-soft);
  text-align: center;
}

.status-count strong,
.status-count span {
  display: block;
}

.status-count strong {
  font-size: 1.3rem;
}

.status-count span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 750;
  text-transform: uppercase;
}

.batch-progress {
  margin-bottom: 15px;
}

.batch-progress progress {
  width: 100%;
  height: 10px;
}

.review-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
  margin: 16px 0;
}

.review-item {
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.review-item strong,
.review-item span {
  display: block;
}

.review-item span {
  color: var(--muted);
  font-size: 0.72rem;
}

.batch-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin: 18px 0;
}

.batch-events {
  padding-top: 17px;
  border-top: 1px solid var(--line);
}

.compact-timeline {
  margin-top: 8px;
}

.recent-import-row {
  grid-template-columns: 1fr auto;
  width: 100%;
  color: var(--ink);
  text-align: left;
}

button.recent-import-row:hover {
  border-color: #cbbcff;
  background: rgba(109, 74, 255, 0.045);
}

.toast-region {
  position: fixed;
  z-index: 200;
  right: 20px;
  bottom: 20px;
  display: grid;
  gap: 8px;
  width: min(390px, calc(100% - 40px));
}

.toast {
  padding: 13px 15px;
  color: #fff;
  border-radius: 13px;
  background: #252038;
  box-shadow: 0 16px 50px rgba(15, 10, 29, 0.25);
}

.toast.is-error {
  background: var(--danger);
}

.workspace-dialog {
  width: min(620px, calc(100% - 32px));
  max-height: calc(100vh - 40px);
  padding: 0;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: 0 28px 90px rgba(15, 10, 29, 0.3);
}

.edit-adventure-dialog {
  width: min(820px, calc(100% - 32px));
}

.workspace-dialog textarea {
  width: 100%;
  resize: vertical;
  padding: 10px 12px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--panel);
  font: inherit;
}

.adventure-photo-section {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.adventure-photo-section .panel-heading {
  margin-bottom: 12px;
}

.adventure-photo-section h3 {
  margin: 0;
  font-size: 1rem;
}

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

.adventure-photo-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-soft);
}

.adventure-photo-card img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: var(--panel);
}

.adventure-photo-card > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  padding: 4px 6px 5px;
}

.adventure-photo-card small {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.65rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.adventure-photo-card .text-button {
  flex: 0 0 auto;
  padding: 3px 4px;
  font-size: 0.7rem;
}

.workspace-dialog::backdrop {
  background: rgba(20, 15, 32, 0.62);
  backdrop-filter: blur(3px);
}

.workspace-dialog form {
  padding: 25px;
}

.workspace-dialog h2 {
  margin: 0;
  font-size: 1.55rem;
  letter-spacing: -0.035em;
}

.workspace-dialog form > p:not(.eyebrow) {
  margin: 10px 0 20px;
  color: var(--muted);
}

.ai-details-dialog {
  width: min(760px, calc(100% - 32px));
}

.photo-details-dialog {
  width: min(1180px, calc(100% - 32px));
}

.photo-details-layout {
  display: grid;
  grid-template-columns: minmax(420px, 1.2fr) minmax(300px, 0.8fr);
  gap: 24px;
}

.photo-details-breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.photo-details-breadcrumb strong {
  color: var(--ink);
}

.photo-details-close {
  flex: 0 0 auto;
}

.photo-editor-preview {
  display: grid;
  place-items: center;
  height: min(64vh, 620px);
  min-height: 380px;
  overflow: hidden;
  border-radius: 14px;
  background: var(--panel-soft);
  cursor: default;
  touch-action: none;
}

.photo-editor-preview.is-zoomed {
  cursor: grab;
}

.photo-editor-preview.is-panning {
  cursor: grabbing;
}

.photo-editor-preview img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: contain;
  transform-origin: center;
  transition: transform 180ms ease;
  user-select: none;
  -webkit-user-drag: none;
}

.photo-editor-preview.is-panning img {
  transition: none;
}

.photo-zoom-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin-top: 10px;
}

.photo-zoom-controls .secondary-action {
  min-width: 40px;
  padding: 7px 10px;
  font-size: 1.1rem;
  line-height: 1;
}

.photo-zoom-controls span {
  min-width: 52px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  text-align: center;
}

.photo-pan-hint {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 0.76rem;
  text-align: center;
}

.photo-editor-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 12px;
}

.photo-editor-controls label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
}

.photo-editor-controls select {
  min-width: 130px;
  padding: 9px 10px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  font: inherit;
}

.photo-details-content {
  min-width: 0;
}

.photo-info-section {
  padding: 0 0 15px;
  margin-bottom: 15px;
  border-bottom: 1px solid var(--line);
}

.photo-info-section h3 {
  margin: 0 0 10px;
  font-size: 0.95rem;
}

.photo-info-section p {
  margin: 0;
  color: var(--muted);
}

.photo-location-empty {
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--panel-soft);
  font-size: 0.82rem;
}

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

.photo-info-grid > div {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 9px;
  border-radius: 10px;
  background: var(--panel-soft);
}

.photo-info-grid span {
  color: var(--muted);
  font-size: 0.7rem;
}

.photo-info-grid strong {
  overflow-wrap: anywhere;
  font-size: 0.78rem;
}

.photo-info-section textarea {
  min-height: 92px;
}

.dialog-heading {
  align-items: flex-start;
  margin: 0 0 18px;
}

.dialog-heading h2 {
  margin-bottom: 5px;
}

.dialog-heading p {
  margin: 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.ai-detail-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.ai-detail-meta > div {
  display: grid;
  gap: 4px;
  padding: 11px;
  border-radius: 11px;
  background: var(--panel-soft);
}

.ai-detail-meta span,
.ai-detail-meta strong {
  overflow-wrap: anywhere;
}

.ai-detail-meta span {
  color: var(--muted);
  font-size: 0.72rem;
}

.ai-detail-meta strong {
  font-size: 0.82rem;
}

.ai-detail-section {
  margin-top: 16px;
}

.ai-detail-section h3 {
  margin: 0 0 7px;
  font-size: 0.9rem;
}

.ai-section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.ai-section-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.ai-raw-response-section {
  padding-top: 4px;
}

.ai-raw-response-section .ai-json {
  margin-top: 10px;
}

.ai-detail-section p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.ai-tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.ai-tag {
  display: inline-grid;
  gap: 2px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel-soft);
}

.ai-tag small {
  color: var(--muted);
  font-size: 0.7rem;
}

.ai-json {
  max-height: 280px;
  overflow: auto;
  margin: 0;
  padding: 13px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-soft);
  font: 0.76rem/1.55 ui-monospace, SFMono-Regular, Consolas, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.ai-error p {
  color: var(--danger);
}

.dialog-options {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  border: 0;
}

.dialog-options legend {
  margin-bottom: 9px;
  font-size: 0.82rem;
  font-weight: 850;
}

.dialog-options label {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 11px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 13px;
  cursor: pointer;
}

.dialog-options label:has(input:checked) {
  border-color: var(--violet);
  background: rgba(109, 74, 255, 0.07);
}

.dialog-options input {
  margin-top: 4px;
  accent-color: var(--violet);
}

.dialog-options strong,
.dialog-options small {
  display: block;
}

.dialog-options small {
  margin-top: 3px;
  color: var(--muted);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}

.workspace-dialog .form-row + .form-row {
  margin-top: 14px;
}

.workspace-dialog .form-row label span {
  color: var(--muted);
  font-weight: 650;
}

.destructive-action {
  background: var(--danger);
  box-shadow: 0 9px 22px rgba(181, 58, 69, 0.22);
}

.mobile-menu-button {
  display: none;
  width: 40px;
  height: 40px;
  color: var(--ink);
  background: var(--panel-soft);
}

@media (prefers-color-scheme: dark) {
  :root {
    --cream: #121018;
    --ink: #f7f2ff;
    --muted: #aaa2b7;
    --line: #342d3d;
    --panel: #1b1823;
    --panel-soft: #24202d;
    --orange-soft: #412718;
    --success-soft: #153a2e;
    --warning-soft: #3f3118;
    --danger-soft: #442128;
    --shadow: 0 20px 65px rgba(0, 0, 0, 0.22);
  }

  .validation-callout {
    border-color: #4d3b7d;
    background: #251e38;
  }

  .status-badge {
    background: #302650;
  }
}

@media (max-width: 1080px) {
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .import-layout,
  .two-column-grid {
    grid-template-columns: 1fr;
  }

  .recent-imports-panel {
    position: static;
  }
}

@media (max-width: 780px) {
  :root {
    --header-height: 62px;
  }

  .section-intro {
    display: grid;
    align-items: start;
  }

  .login-view {
    grid-template-columns: 1fr;
  }

  .login-art {
    min-height: 34vh;
    padding: 34px 28px;
  }

  .login-panel {
    width: min(520px, calc(100% - 36px));
    padding: 40px 0;
  }

  .workspace-header {
    gap: 10px;
    padding: 0 13px;
  }

  .workspace-brand {
    min-width: 0;
  }

  .workspace-brand > span:last-child,
  .connection-pill,
  .workspace-header > .text-button {
    display: none;
  }

  .mobile-menu-button {
    display: grid;
    place-items: center;
  }

  .workspace-sidebar {
    width: min(290px, 86vw);
    transform: translateX(-105%);
    transition: transform 160ms ease;
    box-shadow: 22px 0 55px rgba(20, 14, 38, 0.18);
  }

  .workspace-sidebar.is-open {
    transform: translateX(0);
  }

  .workspace-main {
    margin-left: 0;
    padding: 28px 15px 50px;
  }

  .main-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .heading-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .title-line {
    align-items: flex-start;
  }

  .metric-grid,
  .compact-metrics,
  .story-grid,
  .vault-grid,
  .review-grid {
    grid-template-columns: 1fr 1fr;
  }

  .status-counts {
    grid-template-columns: repeat(3, 1fr);
  }

  .batch-file-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .batch-file-row > :last-child {
    grid-column: 1 / -1;
  }

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

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

@media (max-width: 480px) {
  .metric-grid,
  .compact-metrics,
  .story-grid,
  .vault-grid,
  .review-grid {
    grid-template-columns: 1fr;
  }

  .drop-actions,
  .batch-actions {
    align-items: stretch;
    flex-direction: column;
    width: 100%;
  }

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

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

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
