:root {
  color-scheme: light;
  --bg: #f3f5ef;
  --surface: #fbfcf8;
  --surface-raised: #ffffff;
  --surface-soft: #eef3ed;
  --ink: #20241f;
  --ink-strong: #111610;
  --muted: #657066;
  --faint: #8a948a;
  --line: #d9dfd5;
  --line-strong: #aebaaa;
  --accent: #9d3446;
  --accent-strong: #7f2433;
  --accent-soft: #f6e8eb;
  --green: #2f6c4f;
  --blue: #2c6278;
  --sidebar: #17201b;
  --sidebar-soft: #223027;
  --sidebar-line: #334339;
  --code-bg: #20251f;
  --code-ink: #eff4eb;
  --shadow: 0 24px 60px rgba(31, 37, 30, 0.12);
  --fast: 180ms cubic-bezier(0.16, 1, 0.3, 1);
  --card-sticky-top: 0px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100dvh;
  background:
    linear-gradient(90deg, rgba(157, 52, 70, 0.06), transparent 18%),
    linear-gradient(180deg, #f7f8f3 0%, var(--bg) 48%, #edf2ec 100%);
  color: var(--ink);
  font-family:
    Geist, Aptos, "Segoe UI", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(23, 32, 27, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 32, 27, 0.03) 1px, transparent 1px);
  background-size: 32px 32px;
  content: "";
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.55), transparent 74%);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 20;
  transform: translateY(-140%);
  border-radius: 8px;
  background: var(--surface-raised);
  color: var(--ink);
  padding: 9px 12px;
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: transform var(--fast);
}

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

button:active {
  transform: translateY(1px) scale(0.99);
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(157, 52, 70, 0.22);
  outline-offset: 2px;
}

.app-shell {
  display: grid;
  grid-template-columns: 304px minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  overflow: auto;
  border-right: 1px solid var(--sidebar-line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 30%),
    var(--sidebar);
  color: #edf4ec;
  padding: 22px 16px;
}

.brand {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--sidebar-line);
  padding-bottom: 16px;
}

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

h1 {
  max-width: 220px;
  color: #ffffff;
  font-size: 21px;
  font-weight: 760;
  line-height: 1.08;
}

.brand p {
  margin-top: 7px;
  color: #aebbac;
  font-size: 13px;
}

.app-nav {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 16px;
}

.app-nav-button {
  min-height: 36px;
  border: 1px solid var(--sidebar-line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: #aebbac;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 820;
  transition:
    background var(--fast),
    border-color var(--fast),
    color var(--fast),
    transform var(--fast);
}

.app-nav-button:hover,
.app-nav-button.active {
  border-color: rgba(255, 255, 255, 0.18);
  background: var(--sidebar-soft);
  color: #ffffff;
}

.sidebar-upload-button {
  display: grid;
  place-items: center;
  min-height: 36px;
  margin: -6px 0 16px;
  border: 1px solid rgba(178, 195, 178, 0.24);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: #f8fbf5;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 820;
  cursor: pointer;
  transition:
    background var(--fast),
    border-color var(--fast),
    transform var(--fast);
}

.sidebar-upload-button:hover {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
}

.search-row {
  margin-bottom: 14px;
}

.search-row label {
  display: block;
  margin-bottom: 7px;
  color: #aebbac;
  font-size: 11px;
  font-weight: 820;
  text-transform: uppercase;
}

.search-row input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--sidebar-line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
  color: #ffffff;
  padding: 10px 12px;
  outline: none;
  transition:
    border-color var(--fast),
    background var(--fast),
    box-shadow var(--fast);
}

.search-row input::placeholder {
  color: #94a092;
}

.search-row input:focus {
  border-color: rgba(255, 255, 255, 0.36);
  background: rgba(255, 255, 255, 0.11);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.batch-list {
  display: grid;
  gap: 14px;
}

.issue-group {
  display: grid;
  gap: 7px;
}

.issue-group.collapsed {
  gap: 0;
}

.issue-group-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 18px;
  align-items: center;
  width: 100%;
  min-height: 34px;
  gap: 7px;
  border: 1px solid transparent;
  border-bottom-color: rgba(174, 187, 172, 0.18);
  border-radius: 8px;
  background: transparent;
  color: inherit;
  padding: 6px 7px;
  text-align: left;
  transition:
    background var(--fast),
    border-color var(--fast),
    transform var(--fast);
}

.issue-group-header:hover {
  border-color: rgba(174, 187, 172, 0.2);
  background: rgba(255, 255, 255, 0.06);
}

.issue-heading {
  min-width: 0;
  overflow: hidden;
  color: #ffffff;
  font-size: 12px;
  font-weight: 820;
  letter-spacing: 0;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.issue-summary {
  color: #93a092;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  line-height: 1.2;
  text-align: right;
  white-space: nowrap;
}

.issue-toggle {
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border: 1px solid rgba(174, 187, 172, 0.18);
  border-radius: 6px;
  color: #dfe8dd;
  font-size: 13px;
  font-weight: 820;
  line-height: 1;
}

.issue-group.active .issue-heading {
  color: #f4e4e8;
}

.issue-group.active .issue-toggle {
  border-color: rgba(244, 228, 232, 0.3);
  color: #f4e4e8;
}

.issue-batch-list {
  display: grid;
  gap: 5px;
}

.issue-group.collapsed .issue-batch-list {
  display: none;
}

.batch-button {
  position: relative;
  width: 100%;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #e6eee5;
  padding: 9px 10px 9px 14px;
  text-align: left;
  transition:
    border-color var(--fast),
    background var(--fast),
    transform var(--fast);
}

.batch-button::before {
  position: absolute;
  inset: 9px auto 9px 0;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: transparent;
  content: "";
  transition: background var(--fast);
}

.batch-button:hover,
.batch-button.active {
  border-color: var(--sidebar-line);
  background: var(--sidebar-soft);
}

.batch-button.active::before {
  background: var(--accent);
}

.batch-button strong {
  display: block;
  margin-bottom: 4px;
  font-size: 14px;
  font-weight: 780;
  line-height: 1.2;
}

.batch-button span {
  display: block;
  color: #aebbac;
  font-size: 12px;
  line-height: 1.35;
}

.content {
  min-width: 0;
  padding: 24px 28px 44px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 3;
  display: block;
  margin: -24px -28px 20px;
  border-bottom: 1px solid rgba(217, 223, 213, 0.86);
  background: rgba(243, 245, 239, 0.88);
  padding: 12px 28px;
  backdrop-filter: blur(14px);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.75) inset;
}

.eyebrow,
.panel-kicker,
.section-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 820;
  letter-spacing: 0;
  text-transform: uppercase;
}

.eyebrow {
  margin-bottom: 6px;
}

.topbar-actions,
.card-header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-start;
}

.topbar-actions {
  align-items: center;
  gap: 12px;
}

.team-settings-button {
  color: var(--blue);
}

.prompt-controls {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.batch-jump-button {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface-raised);
  color: var(--green);
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 820;
  letter-spacing: 0;
  transition:
    border-color var(--fast),
    background var(--fast),
    color var(--fast);
}

.batch-jump-button:hover,
.batch-jump-button[aria-expanded="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.batch-jump-button:disabled {
  cursor: default;
  opacity: 0.48;
}

.batch-jump-popover {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  z-index: 6;
  display: grid;
  width: min(560px, calc(100vw - 72px));
  grid-template-columns: minmax(128px, 154px) minmax(260px, 1fr);
  gap: 10px;
  overflow: hidden;
  border: 1px solid rgba(140, 156, 136, 0.58);
  border-radius: 8px;
  background: rgba(252, 253, 249, 0.98);
  box-shadow: 0 24px 60px rgba(23, 29, 23, 0.2);
  padding: 10px;
}

.batch-jump-popover[hidden] {
  display: none;
}

.jump-section {
  display: flex;
  min-height: 0;
  min-width: 0;
  flex-direction: column;
}

.jump-label {
  flex: 0 0 auto;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 860;
  text-transform: uppercase;
}

.jump-page-list {
  display: grid;
  max-height: min(292px, calc(100vh - 178px));
  gap: 5px;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
}

.jump-page-button,
.panel-jump-button {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  text-align: left;
  transition:
    border-color var(--fast),
    background var(--fast),
    color var(--fast);
}

.jump-page-button {
  padding: 7px 8px;
}

.jump-page-button strong,
.jump-page-button span,
.panel-jump-button strong,
.panel-jump-button span {
  display: block;
}

.jump-page-button strong,
.panel-jump-button strong {
  font-size: 12px;
  font-weight: 820;
  line-height: 1.2;
}

.jump-page-button span,
.panel-jump-button span {
  margin-top: 2px;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.jump-page-button:hover,
.jump-page-button.active,
.panel-jump-button:hover,
.panel-jump-button.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.panel-jump-grid {
  display: grid;
  max-height: min(292px, calc(100vh - 178px));
  align-content: start;
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  gap: 6px;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
}

.panel-jump-button {
  min-height: 48px;
  padding: 7px;
}

.raw-controls,
.page-controls {
  position: relative;
  display: flex;
  min-width: min(100%, 620px);
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.raw-version-tabs,
.page-stage-tabs {
  display: flex;
  min-width: 0;
  max-width: 100%;
  flex: 1 1 380px;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.workflow-stage-tabs {
  display: flex;
  min-width: min(100%, 360px);
  max-width: 100%;
  flex: 1 1 360px;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.raw-version-tab,
.page-stage-tab,
.workflow-stage-tab {
  display: inline-flex;
  min-height: 34px;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface-raised);
  color: var(--ink);
  padding: 7px 9px;
  font-size: 12px;
  font-weight: 760;
  transition:
    border-color var(--fast),
    background var(--fast),
    color var(--fast),
    transform var(--fast);
}

.raw-version-tab strong,
.page-stage-tab strong,
.workflow-stage-tab strong {
  min-width: 22px;
  border-radius: 999px;
  background: rgba(47, 108, 79, 0.11);
  color: var(--green);
  padding: 2px 6px;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  text-align: center;
}

.raw-version-tab:hover,
.raw-version-tab.active,
.page-stage-tab:hover,
.page-stage-tab.active,
.workflow-stage-tab:hover,
.workflow-stage-tab.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.raw-version-tab:hover strong,
.raw-version-tab.active strong,
.page-stage-tab:hover strong,
.page-stage-tab.active strong,
.workflow-stage-tab:hover strong,
.workflow-stage-tab.active strong {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

.segmented-control {
  display: inline-grid;
  grid-template-columns: repeat(3, minmax(68px, 1fr));
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface-raised);
}

.segment {
  min-height: 36px;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 8px 11px;
  font-size: 12px;
  font-weight: 780;
  transition:
    background var(--fast),
    color var(--fast);
}

.segment + .segment {
  border-left: 1px solid var(--line);
}

.segment.active {
  background: var(--code-bg);
  color: #ffffff;
}

.result-count {
  min-width: 92px;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  font-weight: 760;
  text-align: left;
}

.primary-button,
.secondary-button,
.small-button,
.icon-button {
  min-height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface-raised);
  color: var(--ink);
  padding: 8px 11px;
  transition:
    border-color var(--fast),
    background var(--fast),
    color var(--fast),
    transform var(--fast),
    box-shadow var(--fast);
}

.primary-button {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
  box-shadow: 0 10px 20px rgba(157, 52, 70, 0.18);
}

.primary-button:hover {
  background: var(--accent-strong);
}

.secondary-button:hover,
.small-button:hover,
.icon-button:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.small-button {
  min-height: 32px;
  padding: 6px 9px;
  font-size: 12px;
  font-weight: 760;
}

.upload-button {
  display: inline-grid;
  place-items: center;
}

.upload-button.disabled {
  cursor: not-allowed;
  opacity: 0.56;
}

.workflow-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 7px;
}

.workflow-stage-pill,
.workflow-done-pill {
  display: inline-grid;
  min-height: 32px;
  place-items: center;
  border: 1px solid rgba(47, 108, 79, 0.24);
  border-radius: 8px;
  background: rgba(47, 108, 79, 0.1);
  color: var(--green);
  padding: 6px 9px;
  font-size: 12px;
  font-weight: 820;
  line-height: 1;
}

.workflow-done-pill {
  border-color: rgba(157, 52, 70, 0.24);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.done-button {
  border-color: rgba(47, 108, 79, 0.36);
  background: rgba(47, 108, 79, 0.1);
  color: var(--green);
}

.done-button:hover {
  border-color: var(--green);
  background: rgba(47, 108, 79, 0.16);
}

.workflow-field {
  display: grid;
  min-width: 126px;
  gap: 4px;
}

.workflow-field.compact {
  min-width: 96px;
}

.workflow-field span,
.team-settings-field span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 820;
  line-height: 1;
  text-transform: uppercase;
}

.workflow-select {
  min-height: 32px;
  max-width: 170px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface-raised);
  color: var(--ink);
  padding: 5px 28px 5px 8px;
  font-size: 12px;
  font-weight: 720;
  transition:
    border-color var(--fast),
    background var(--fast),
    color var(--fast);
}

.workflow-select:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.workflow-select:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

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

.primary-small {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.primary-small:hover {
  background: var(--accent-strong);
}

.reference-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 10px;
  align-items: start;
  margin-bottom: 22px;
}

.reference-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(174, 186, 170, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 12px 28px rgba(31, 37, 30, 0.08);
}

.reference-card-media {
  display: grid;
  align-items: start;
  background:
    linear-gradient(45deg, rgba(23, 32, 27, 0.045) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(23, 32, 27, 0.045) 25%, transparent 25%),
    #edf2ec;
  background-size: 18px 18px;
}

.reference-card-media.multi {
  grid-template-columns: repeat(auto-fit, minmax(48px, 1fr));
}

.ref-image-button {
  position: relative;
  display: block;
  min-width: 0;
  align-self: start;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: transparent;
  line-height: 0;
  padding: 0;
}

.ref-image-button + .ref-image-button {
  border-left: 1px solid rgba(174, 186, 170, 0.72);
}

.ref-image-button img {
  display: block;
  width: 100%;
  height: auto;
  transition:
    filter var(--fast),
    transform var(--fast);
}

.ref-image-button span {
  position: absolute;
  right: 6px;
  bottom: 6px;
  transform: translateY(6px);
  display: inline-flex;
  max-width: calc(100% - 12px);
  align-items: center;
  gap: 6px;
  opacity: 0;
  border-radius: 6px;
  background: rgba(32, 37, 31, 0.86);
  color: #ffffff;
  padding: 4px 6px;
  font-size: 10px;
  font-weight: 780;
  line-height: 1;
  pointer-events: none;
  white-space: nowrap;
  transition:
    opacity var(--fast),
    transform var(--fast);
}

.ref-image-button span strong {
  min-width: 0;
  overflow: hidden;
  font: inherit;
  font-weight: 820;
  text-overflow: ellipsis;
}

.ref-image-button span em {
  flex: 0 0 auto;
  color: rgba(255, 255, 255, 0.84);
  font-style: normal;
  font-weight: 760;
}

.ref-image-button:hover img,
.ref-image-button:focus-visible img {
  filter: saturate(1.06) contrast(1.04);
  transform: scale(1.025);
}

.ref-image-button:hover span,
.ref-image-button:focus-visible span {
  transform: translateY(0);
  opacity: 1;
}

.ref-image-placeholder {
  display: grid;
  min-height: 82px;
  gap: 3px;
  place-items: center;
  color: var(--faint);
  padding: 10px;
  font-size: 12px;
  font-weight: 760;
  text-align: center;
}

.ref-image-placeholder strong,
.ref-image-placeholder span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ref-image-placeholder strong {
  max-width: 100%;
  color: var(--ink-strong);
  font-size: 12px;
  font-weight: 820;
  line-height: 1.15;
}

.ref-image-placeholder span {
  color: var(--faint);
  font-size: 11px;
  font-weight: 760;
  line-height: 1.15;
}

.ref-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 9px;
  align-items: start;
}

.panel-list {
  display: grid;
  gap: 16px;
}

.refs-mode {
  display: block;
}

.reference-page {
  display: grid;
  gap: 15px;
}

.reference-page-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.reference-page-header h3 {
  color: var(--ink-strong);
  font-size: 22px;
  font-weight: 760;
  line-height: 1.2;
}

.reference-page-header span {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  font-weight: 760;
  white-space: nowrap;
}

.reference-page-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(178px, 1fr));
  gap: 14px;
  align-items: start;
}

.reference-page .ref-image-placeholder {
  min-height: 150px;
}

.raw-list {
  display: grid;
  gap: 22px;
}

.raw-issue-section {
  display: grid;
  gap: 15px;
}

.raw-issue-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.raw-issue-header h2 {
  color: var(--ink-strong);
  font-size: 22px;
  font-weight: 760;
  line-height: 1.2;
}

.raw-issue-header p,
.raw-page-header span {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  font-weight: 760;
}

.raw-page-group {
  display: grid;
  gap: 10px;
  scroll-margin-top: calc(var(--card-sticky-top) + 14px);
}

.raw-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.raw-page-header > div {
  min-width: 0;
}

.raw-page-header h3 {
  color: var(--blue);
  font-size: 13px;
  font-weight: 820;
  text-transform: uppercase;
}

.raw-page-folder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 10px;
}

.raw-page-folder-card {
  display: grid;
  min-width: 0;
  min-height: 112px;
  align-content: start;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(47, 108, 79, 0.08), transparent 52%),
    var(--surface-raised);
  color: var(--ink);
  padding: 12px;
  text-align: left;
  box-shadow: 0 12px 26px rgba(31, 37, 30, 0.07);
  transition:
    border-color var(--fast),
    background var(--fast),
    transform var(--fast),
    box-shadow var(--fast);
}

.raw-page-folder-card:hover {
  border-color: var(--accent);
  background:
    linear-gradient(135deg, rgba(157, 52, 70, 0.09), transparent 52%),
    #ffffff;
  box-shadow: 0 16px 34px rgba(31, 37, 30, 0.1);
}

.raw-page-folder-kicker {
  color: var(--blue);
  font-size: 10px;
  font-weight: 840;
  line-height: 1;
  text-transform: uppercase;
}

.raw-page-folder-card strong {
  color: var(--ink-strong);
  font-size: 18px;
  font-weight: 780;
  line-height: 1.15;
}

.raw-page-folder-card span,
.raw-page-folder-card em {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
  line-height: 1.35;
  text-overflow: ellipsis;
}

.raw-page-folder-card em {
  color: var(--faint);
  white-space: nowrap;
}

.jump-empty {
  margin: 0;
  color: var(--faint);
  font-size: 11px;
  font-weight: 760;
}

.raw-grid {
  display: grid;
  grid-auto-flow: dense;
  grid-auto-rows: 8px;
  grid-template-columns: repeat(auto-fill, minmax(172px, 1fr));
  gap: 12px;
  align-items: start;
}

.raw-card {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-raised);
  scroll-margin-top: calc(var(--card-sticky-top) + 14px);
  box-shadow: 0 14px 30px rgba(31, 37, 30, 0.08);
}

.raw-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(173, 49, 77, 0.18), 0 14px 30px rgba(31, 37, 30, 0.08);
}

.raw-card-media {
  display: block;
  width: 100%;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background:
    linear-gradient(45deg, rgba(23, 32, 27, 0.045) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(23, 32, 27, 0.045) 25%, transparent 25%),
    #edf2ec;
  color: inherit;
  cursor: zoom-in;
  background-size: 18px 18px;
  line-height: 0;
  padding: 0;
  text-align: inherit;
}

.raw-card-media img {
  display: block;
  width: 100%;
  height: auto;
  transition: transform var(--fast);
}

.raw-card-media:hover img,
.raw-card-media:focus-visible img {
  transform: scale(1.018);
}

.raw-card-media:active {
  transform: none;
}

.raw-card-body {
  position: absolute;
  right: 7px;
  bottom: 7px;
  left: 7px;
  z-index: 1;
  transform: translateY(7px);
  display: grid;
  gap: 4px;
  opacity: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 7px;
  background: rgba(29, 35, 28, 0.9);
  padding: 8px;
  box-shadow: 0 12px 26px rgba(17, 22, 16, 0.22);
  pointer-events: none;
  transition:
    opacity var(--fast),
    transform var(--fast);
}

.raw-card:hover .raw-card-body,
.raw-card:focus-within .raw-card-body {
  transform: translateY(0);
  opacity: 1;
}

.raw-card-body strong {
  min-width: 0;
  overflow: hidden;
  color: #ffffff;
  font-size: 12px;
  font-weight: 780;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.raw-card-body span {
  min-width: 0;
  overflow: hidden;
  color: #c7d0c5;
  font-size: 11px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page-list {
  display: grid;
  gap: 22px;
}

.page-view-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.page-view-header p,
.page-notes-header p {
  color: var(--blue);
  font-size: 11px;
  font-weight: 840;
  text-transform: uppercase;
}

.page-view-header h2,
.page-notes-header h3 {
  margin-top: 4px;
  color: var(--ink-strong);
  font-size: 22px;
  font-weight: 780;
  line-height: 1.15;
}

.page-view-header span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
  white-space: nowrap;
}

.page-view-empty {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-raised);
  padding: 18px;
  box-shadow: 0 14px 30px rgba(31, 37, 30, 0.07);
}

.page-view-empty strong {
  color: var(--ink-strong);
  font-size: 18px;
}

.page-view-empty span {
  color: var(--muted);
  font-size: 13px;
}

.page-review-row {
  display: grid;
  grid-template-columns: minmax(280px, 7in) minmax(300px, 1fr);
  gap: 18px;
  align-items: start;
  scroll-margin-top: calc(var(--card-sticky-top) + 14px);
}

.page-sheet-column {
  display: grid;
  gap: 8px;
  justify-items: center;
}

.page-sheet-button {
  display: grid;
  width: min(100%, 7in);
  aspect-ratio: 7 / 10.5;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background:
    linear-gradient(45deg, rgba(23, 32, 27, 0.04) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(23, 32, 27, 0.04) 25%, transparent 25%),
    var(--surface-soft);
  background-size: 24px 24px;
  color: var(--muted);
  cursor: zoom-in;
  padding: 0;
  box-shadow: 0 18px 42px rgba(31, 37, 30, 0.12);
}

.page-sheet-button img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform var(--fast);
}

.page-sheet-button:hover img,
.page-sheet-button:focus-visible img {
  transform: scale(1.012);
}

.page-sheet-column > p {
  max-width: min(100%, 7in);
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page-notes-column {
  display: grid;
  gap: 12px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(251, 252, 248, 0.92);
  padding: 14px;
  box-shadow: 0 14px 30px rgba(31, 37, 30, 0.07);
}

.page-notes-header,
.page-panel-note-header,
.page-team-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.page-panel-stack {
  display: grid;
  gap: 12px;
}

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

.page-panel-note-header label {
  display: grid;
  min-width: 0;
  flex: 1 1 auto;
  gap: 4px;
}

.page-panel-note-header span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 840;
  text-transform: uppercase;
}

.page-panel-note-header input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink-strong);
  padding: 8px 9px;
  font-weight: 760;
}

.page-team-card {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 10px;
}

.page-team-card h5 {
  margin: 0;
  color: var(--blue);
  font-size: 12px;
  font-weight: 840;
  text-transform: uppercase;
}

.page-note-stack {
  display: grid;
  gap: 8px;
}

.page-text-note {
  display: grid;
  gap: 6px;
}

.page-text-note textarea {
  width: 100%;
  min-height: 82px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-raised);
  color: var(--ink);
  padding: 9px 10px;
  line-height: 1.45;
}

.page-note-empty {
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  color: var(--muted);
  padding: 10px;
  font-size: 12px;
  text-align: center;
}

.page-note-empty.large {
  padding: 18px;
}

.mini-action {
  flex: 0 0 auto;
  min-height: 28px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--surface-raised);
  color: var(--green);
  padding: 5px 8px;
  font-size: 11px;
  font-weight: 820;
}

.mini-action:hover {
  border-color: var(--accent);
  color: var(--accent);
}

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

.panel-card {
  position: relative;
  overflow: visible;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  scroll-margin-top: calc(var(--card-sticky-top) + 14px);
  box-shadow: var(--shadow);
  animation: rise-in 320ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.panel-card.active {
  border-color: rgba(157, 52, 70, 0.58);
  box-shadow:
    0 0 0 3px rgba(157, 52, 70, 0.08),
    var(--shadow);
}

.panel-card.hidden {
  display: none;
}

.panel-card-header {
  position: sticky;
  top: var(--card-sticky-top);
  z-index: 2;
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  border-radius: 8px 8px 0 0;
  background:
    linear-gradient(90deg, rgba(47, 108, 79, 0.07), transparent 42%),
    rgba(255, 255, 255, 0.95);
  padding: 12px 16px;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.74) inset,
    0 12px 22px rgba(31, 37, 30, 0.06);
  backdrop-filter: blur(12px);
}

.panel-header-summary {
  min-width: max-content;
}

.panel-kicker {
  margin-bottom: 0;
  color: var(--blue);
  white-space: nowrap;
}

.panel-card-header .card-header-actions {
  align-items: end;
  justify-content: flex-end;
}

.panel-card h3 {
  color: var(--ink-strong);
  font-size: 18px;
  font-weight: 760;
  line-height: 1.28;
}

.panel-summary {
  margin-top: 7px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.panel-body {
  display: grid;
  grid-template-columns: minmax(214px, 0.82fr) minmax(0, 1.68fr);
  gap: 0;
  overflow: hidden;
  border-radius: 0 0 8px 8px;
}

.deck-mode {
  grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
  align-items: start;
}

.deck-mode .panel-card-header {
  display: block;
}

.deck-mode .card-header-actions {
  justify-content: flex-start;
  margin-top: 14px;
}

.deck-mode .panel-body {
  display: block;
}

.deck-mode .prompt-preview {
  display: none;
}

.deck-mode .panel-info {
  border-right: 0;
}

.panel-info {
  border-right: 1px solid var(--line);
  background: rgba(238, 243, 237, 0.62);
  padding: 15px;
}

.detail-grid {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 9px 10px;
  align-items: baseline;
  margin-bottom: 14px;
  font-size: 13px;
}

.detail-grid dt {
  color: var(--muted);
  font-weight: 760;
}

.detail-grid dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--ink);
}

.inline-copy {
  max-width: 100%;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--blue);
  padding: 0;
  font-size: inherit;
  font-weight: 690;
  line-height: 1.3;
  text-align: left;
  overflow-wrap: anywhere;
  text-decoration: underline;
  text-decoration-color: rgba(44, 98, 120, 0.28);
  text-underline-offset: 3px;
  transition:
    background var(--fast),
    color var(--fast),
    text-decoration-color var(--fast);
}

.inline-copy:hover {
  background: rgba(44, 98, 120, 0.08);
  color: var(--accent-strong);
  text-decoration-color: rgba(127, 36, 51, 0.42);
}

.section-label {
  margin: 14px 0 8px;
}

.ref-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.prompt-preview {
  min-width: 0;
  padding: 15px;
}

.script-copy-panel {
  margin-bottom: 13px;
}

.script-copy-panel .section-label {
  margin-top: 0;
}

.script-copy-text {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.58);
  color: #2d332d;
  padding: 10px 11px;
  font-size: 14px;
  line-height: 1.55;
  text-align: left;
  transition:
    border-color var(--fast),
    background var(--fast),
    transform var(--fast);
}

.script-copy-text:hover {
  border-color: var(--line-strong);
  background: var(--surface-raised);
}

.subject {
  margin-bottom: 13px;
  color: #2d332d;
  font-size: 14px;
  line-height: 1.56;
}

.json-shell {
  max-height: 440px;
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: var(--code-bg);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

pre {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

code {
  font-family: "Cascadia Code", "JetBrains Mono", Consolas, monospace;
  font-size: 12px;
  line-height: 1.55;
}

.json-shell code {
  display: block;
  color: var(--code-ink);
  padding: 14px;
}

.json-error {
  margin-top: 9px;
  border-left: 3px solid var(--accent);
  color: var(--accent-strong);
  padding-left: 9px;
  font-size: 13px;
}

.reference-panel {
  position: fixed;
  inset: 0 0 0 auto;
  z-index: 8;
  width: min(444px, calc(100vw - 32px));
  height: 100dvh;
  overflow: auto;
  border-left: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(47, 108, 79, 0.07), transparent 38%),
    #f8faf5;
  box-shadow: var(--shadow);
  transform: translateX(104%);
  transition:
    transform var(--fast),
    visibility var(--fast);
  visibility: hidden;
}

.reference-panel.open {
  transform: translateX(0);
  visibility: visible;
}

.popup-backdrop {
  position: fixed;
  inset: 0;
  z-index: 7;
  background: rgba(17, 22, 16, 0.28);
  opacity: 0;
  transition: opacity var(--fast);
}

.popup-backdrop.open {
  opacity: 1;
}

.image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9;
  display: grid;
  place-items: center;
  padding: 24px 24px 86px;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition:
    opacity var(--fast),
    visibility var(--fast);
}

.image-lightbox.open {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
}

.image-lightbox-frame {
  display: flex;
  max-width: min(94vw, 1500px);
  max-height: calc(100vh - 118px);
  max-height: calc(100dvh - 118px);
  overflow: hidden;
  border: 1px solid rgba(248, 250, 245, 0.22);
  border-radius: 8px;
  background: #111610;
  box-shadow:
    0 32px 82px rgba(17, 22, 16, 0.44),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  cursor: zoom-in;
  outline: none;
}

.image-lightbox-frame:focus-visible {
  outline: 3px solid rgba(248, 250, 245, 0.36);
  outline-offset: 4px;
}

.image-lightbox img {
  display: block;
  max-width: min(94vw, 1500px);
  max-height: calc(100vh - 118px);
  max-height: calc(100dvh - 118px);
  object-fit: contain;
  cursor: zoom-in;
  transform: scale(1);
  transform-origin: center center;
  transition: transform var(--fast);
  user-select: none;
}

.image-lightbox.zoomed img {
  cursor: zoom-out;
  transform: scale(2.35);
  will-change: transform;
}

.image-lightbox.zoomed .image-lightbox-frame {
  cursor: zoom-out;
}

.lightbox-script-panel {
  position: absolute;
  bottom: 76px;
  left: 50%;
  z-index: 2;
  transform: translateX(-50%);
  width: min(760px, calc(100vw - 48px));
  max-height: min(24vh, 190px);
  overflow: auto;
  border: 1px solid rgba(248, 250, 245, 0.16);
  border-radius: 8px;
  background: rgba(20, 26, 19, 0.88);
  color: #eef4ea;
  padding: 10px 12px 11px;
  box-shadow:
    0 18px 46px rgba(17, 22, 16, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(16px);
  transition:
    opacity var(--fast),
    transform var(--fast);
}

.image-lightbox.zoomed .lightbox-script-panel {
  transform: translateX(-50%) translateY(8px);
  opacity: 0;
  pointer-events: none;
}

.lightbox-script-label {
  margin-bottom: 5px;
  color: rgba(238, 244, 234, 0.62);
  font-size: 10px;
  font-weight: 820;
  letter-spacing: 0;
  text-transform: uppercase;
}

.lightbox-script-text {
  color: #f7fbf4;
  font-size: 13px;
  font-weight: 620;
  line-height: 1.42;
}

.lightbox-actions {
  position: absolute;
  bottom: 24px;
  left: 50%;
  z-index: 2;
  transform: translateX(-50%);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  max-width: calc(100vw - 48px);
  transition:
    opacity var(--fast),
    transform var(--fast);
}

.image-lightbox.zoomed .lightbox-actions {
  transform: translateX(-50%) translateY(8px);
  opacity: 0;
  pointer-events: none;
}

.lightbox-action-button {
  display: inline-grid;
  min-height: 40px;
  place-items: center;
  border: 1px solid rgba(248, 250, 245, 0.2);
  border-radius: 999px;
  background: rgba(248, 250, 245, 0.94);
  color: var(--ink-strong);
  padding: 9px 16px;
  box-shadow:
    0 18px 44px rgba(17, 22, 16, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  font-size: 13px;
  font-weight: 820;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  backdrop-filter: blur(12px);
  transition:
    border-color var(--fast),
    background var(--fast),
    color var(--fast),
    transform var(--fast),
    box-shadow var(--fast);
}

.lightbox-action-button:hover {
  background: #ffffff;
  box-shadow:
    0 22px 52px rgba(17, 22, 16, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.86);
}

.lightbox-action-button:active {
  transform: translateY(1px) scale(0.99);
}

.lightbox-action-button.danger {
  border-color: rgba(164, 47, 64, 0.36);
  background: rgba(100, 24, 35, 0.92);
  color: #ffffff;
}

.lightbox-action-button.danger:hover {
  border-color: rgba(214, 83, 101, 0.62);
  background: rgba(126, 36, 51, 0.96);
}

.lightbox-action-button:disabled {
  cursor: wait;
  opacity: 0.62;
  pointer-events: none;
}

.reference-panel-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(248, 250, 245, 0.92);
  padding: 18px;
  backdrop-filter: blur(14px);
}

.reference-panel-header h2 {
  color: var(--ink-strong);
  font-size: 21px;
  font-weight: 760;
  line-height: 1.25;
}

.icon-button {
  width: 36px;
  padding: 0;
  font-size: 15px;
  font-weight: 820;
  line-height: 1;
}

.reference-content {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.team-settings-form {
  display: grid;
  gap: 12px;
}

.team-settings-field {
  display: grid;
  gap: 7px;
}

.team-settings-add-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 9px;
  align-items: end;
}

.team-settings-field input,
.team-member-card input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  padding: 8px 10px;
  font-size: 13px;
  line-height: 1.45;
  transition:
    border-color var(--fast),
    background var(--fast);
}

.team-settings-field input:focus,
.team-member-card input:focus {
  border-color: var(--accent);
  background: var(--surface-raised);
  outline: 0;
}

.team-member-list {
  display: grid;
  gap: 8px;
}

.team-member-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
  border: 1px solid rgba(174, 186, 170, 0.72);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.64);
  padding: 9px;
  box-shadow: 0 10px 26px rgba(31, 37, 30, 0.06);
}

.team-member-card label {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.team-member-card span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 820;
  line-height: 1;
  text-transform: uppercase;
}

.team-remove-button {
  color: var(--accent-strong);
}

.team-empty-state {
  margin: 0;
}

.reference-note,
.empty-state {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.empty-state {
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.48);
  padding: 14px;
}

.sidebar-empty {
  border-color: rgba(174, 187, 172, 0.28);
  background: rgba(255, 255, 255, 0.06);
  color: #aebbac;
  font-size: 12px;
}

.empty-state strong,
.empty-state span {
  display: block;
}

.empty-state strong {
  margin-bottom: 4px;
  color: var(--ink-strong);
}

.batch-skeleton,
.skeleton-card,
.skeleton-line,
.skeleton-grid div {
  position: relative;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
}

.batch-skeleton::after,
.skeleton-card::after,
.skeleton-line::after,
.skeleton-grid div::after {
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.22), transparent);
  animation: shimmer 1.25s infinite;
  content: "";
}

.batch-skeleton {
  height: 58px;
  border-radius: 8px;
}

.batch-skeleton.short {
  width: 82%;
}

.skeleton-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 18px;
  box-shadow: var(--shadow);
}

.skeleton-card::after {
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.62), transparent);
}

.skeleton-line {
  height: 15px;
  border-radius: 999px;
  background: #dbe2d8;
}

.skeleton-line.wide {
  width: 76%;
  margin-bottom: 12px;
}

.skeleton-line:not(.wide) {
  width: 52%;
  margin-bottom: 18px;
}

.skeleton-grid {
  display: grid;
  grid-template-columns: 0.75fr 1.5fr;
  gap: 16px;
}

.skeleton-grid div {
  height: 156px;
  border-radius: 8px;
  background: #dfe6dd;
}

.image-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-raised);
  box-shadow: 0 20px 42px rgba(31, 37, 30, 0.11);
}

.reference-group {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.reference-group:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.reference-group-header h3 {
  color: var(--ink-strong);
  font-size: 15px;
  font-weight: 780;
  line-height: 1.25;
}

.reference-group-header p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.image-card img {
  display: block;
  width: 100%;
  max-height: 72vh;
  object-fit: contain;
  background:
    linear-gradient(45deg, rgba(23, 32, 27, 0.05) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(23, 32, 27, 0.05) 25%, transparent 25%),
    #eef3ed;
  background-size: 20px 20px;
}

.image-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding: 9px;
  font-size: 12px;
}

.image-card-footer span {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--muted);
}

.upload-status {
  position: fixed;
  right: 18px;
  bottom: 64px;
  z-index: 11;
  display: grid;
  width: min(360px, calc(100vw - 36px));
  gap: 8px;
  pointer-events: none;
}

.upload-status-item {
  overflow: hidden;
  border: 1px solid rgba(174, 186, 170, 0.64);
  border-radius: 8px;
  background: rgba(251, 252, 248, 0.96);
  color: var(--ink);
  padding: 10px 12px;
  box-shadow: 0 18px 44px rgba(17, 22, 16, 0.18);
  backdrop-filter: blur(16px);
}

.upload-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.upload-status-label {
  overflow: hidden;
  color: var(--ink-strong);
  font-size: 12px;
  font-weight: 820;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-status-state {
  flex: 0 0 auto;
  color: var(--blue);
  font-size: 11px;
  font-weight: 840;
  text-transform: uppercase;
}

.upload-status-item.done .upload-status-state {
  color: var(--green);
}

.upload-status-item.failed .upload-status-state {
  color: var(--accent);
}

.upload-status-track {
  overflow: hidden;
  height: 5px;
  margin-top: 8px;
  border-radius: 999px;
  background: var(--surface-soft);
}

.upload-status-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
  transition: width var(--fast);
}

.upload-status-item.processing .upload-status-track span {
  background: var(--green);
}

.upload-status-item.done .upload-status-track span {
  background: var(--green);
}

.upload-status-item.failed .upload-status-track span {
  background: var(--accent);
}

.upload-status-item p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 10;
  transform: translateY(16px);
  opacity: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: #20251f;
  color: #ffffff;
  padding: 10px 12px;
  font-size: 13px;
  box-shadow: 0 18px 44px rgba(17, 22, 16, 0.26);
  transition:
    opacity var(--fast),
    transform var(--fast);
  pointer-events: none;
}

.toast.visible {
  transform: translateY(0);
  opacity: 1;
}

@keyframes rise-in {
  from {
    transform: translateY(8px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes shimmer {
  100% {
    transform: translateX(100%);
  }
}

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

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 270px minmax(0, 1fr);
  }
}

@media (max-width: 820px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--sidebar-line);
  }

  .content {
    padding: 18px 14px 32px;
  }

  .topbar {
    position: static;
    margin: -18px -14px 14px;
    padding: 12px 14px;
  }

  .topbar-actions,
  .card-header-actions {
    justify-content: flex-start;
  }

  .result-count {
    width: 100%;
    text-align: left;
  }

  .batch-jump-popover {
    position: fixed;
    top: 74px;
    right: 14px;
    left: 14px;
    width: auto;
    max-height: calc(100dvh - 96px);
    grid-template-columns: 1fr;
  }

  .jump-page-list,
  .panel-jump-grid {
    max-height: min(220px, calc(50dvh - 62px));
  }

  .panel-jump-grid {
    grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  }

  .page-review-row {
    grid-template-columns: 1fr;
  }

  .page-sheet-button {
    width: min(100%, 420px);
  }

  .panel-card-header,
  .panel-body {
    display: block;
  }

  .panel-info {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}
