.pdf-page {
  --workshop-width: 1580px;
  background:
    radial-gradient(circle at 75% 7%, rgba(198, 223, 136, .105), transparent 30rem),
    radial-gradient(circle at 4% 40%, rgba(97, 128, 109, .07), transparent 30rem),
    #080c0a;
}

.workshop-shell { width: min(var(--workshop-width), calc(100% - 32px)); margin-inline: auto; }
.workshop-header { position: sticky; top: 0; }
.pdf-main { padding: 54px 0 100px; }

.pdf-intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 40px;
  margin-bottom: 30px;
}
.pdf-intro > div:first-child { max-width: 850px; }
.pdf-intro h1 {
  margin: 12px 0 14px;
  font-size: clamp(3rem, 7vw, 7.4rem);
  line-height: .86;
  letter-spacing: -.075em;
}
.pdf-intro h1 em { color: var(--accent); font-family: Georgia, serif; font-weight: 400; }
.pdf-intro p { max-width: 720px; margin: 0; color: var(--muted); font-size: clamp(1rem, 1.5vw, 1.18rem); }
.privacy-seal {
  min-width: 205px;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 15px 17px;
  border: 1px solid rgba(198,223,136,.24);
  border-radius: 18px;
  background: rgba(198,223,136,.045);
}
.privacy-seal svg { width: 34px; fill: none; stroke: var(--accent); stroke-width: 1.5; }
.privacy-seal span, .privacy-seal strong { display: block; }
.privacy-seal strong { color: var(--text); font-size: .86rem; }
.privacy-seal span { color: var(--muted); font-size: .75rem; }

.pdf-command-bar {
  position: sticky;
  top: 76px;
  z-index: 8;
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(12, 18, 14, .9);
  box-shadow: 0 16px 46px rgba(0,0,0,.28);
  backdrop-filter: blur(20px);
}
.command-group { display: flex; align-items: center; gap: 8px; }
.command-button, .icon-command {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: rgba(255,255,255,.025);
  color: var(--text);
  cursor: pointer;
  font-weight: 740;
  transition: border-color .18s ease, background .18s ease, transform .18s ease;
}
.command-button { padding: 0 16px; }
.command-button svg, .icon-command svg { width: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.command-button:hover:not(:disabled), .icon-command:hover:not(:disabled) { border-color: rgba(198,223,136,.4); background: rgba(198,223,136,.07); transform: translateY(-1px); }
.command-primary { border-color: transparent; background: var(--accent); color: #11170f; }
.command-primary:hover { background: #d4e99b; }
.icon-command { width: 46px; padding: 0; }
.subtle-danger { color: #ffc1b9; }
.subtle-danger:hover:not(:disabled) { border-color: rgba(255,155,143,.35); background: rgba(255,155,143,.07); }

.pdf-empty {
  min-height: 590px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 28px;
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: linear-gradient(145deg, rgba(255,255,255,.035), rgba(255,255,255,.012));
  box-shadow: var(--shadow);
}
.pdf-drop-zone {
  width: min(760px, 100%);
  min-height: 360px;
  display: grid;
  place-items: center;
  align-content: center;
  padding: 44px;
  border: 1.5px dashed rgba(198,223,136,.36);
  border-radius: 26px;
  background: radial-gradient(circle, rgba(198,223,136,.075), transparent 66%);
  text-align: center;
  cursor: pointer;
  transition: border-color .2s ease, background .2s ease, transform .2s ease;
}
.pdf-drop-zone:hover, .pdf-drop-zone:focus-visible, .pdf-drop-zone.is-dragging { border-color: var(--accent); background-color: rgba(198,223,136,.045); transform: translateY(-3px); }
.pdf-drop-icon { width: 86px; height: 86px; display: grid; place-items: center; margin-bottom: 22px; border: 1px solid rgba(198,223,136,.22); border-radius: 25px; color: var(--accent); background: rgba(198,223,136,.07); }
.pdf-drop-icon svg { width: 50px; fill: none; stroke: currentColor; stroke-width: 1.45; stroke-linejoin: round; }
.pdf-drop-zone strong { font-size: clamp(1.4rem, 3vw, 2.1rem); letter-spacing: -.025em; }
.pdf-drop-zone > span:not(.pdf-drop-icon) { max-width: 520px; margin-top: 9px; color: var(--muted); }
.pdf-drop-zone small { margin-top: 20px; color: var(--accent); font-size: .78rem; font-weight: 760; letter-spacing: .08em; text-transform: uppercase; }
.empty-features { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.empty-features span { padding: .5rem .78rem; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: .78rem; }

.pdf-workspace {
  display: grid;
  grid-template-columns: minmax(270px, 330px) minmax(440px, 1fr) minmax(270px, 310px);
  gap: 14px;
  align-items: start;
}
.pdf-workspace[hidden] { display: none; }
.panel { border: 1px solid var(--line); border-radius: 22px; background: rgba(13, 19, 15, .9); box-shadow: var(--shadow); overflow: hidden; }
.organizer-panel, .inspector-panel { max-height: calc(100vh - 170px); position: sticky; top: 158px; }
.organizer-panel { display: flex; flex-direction: column; }
.panel-heading { min-height: 84px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px; border-bottom: 1px solid var(--line); }
.panel-heading h2, .inspector-section h2 { margin: 3px 0 0; font-size: 1.4rem; letter-spacing: -.025em; }
.panel-kicker { color: var(--accent); font-size: .66rem; font-weight: 820; letter-spacing: .14em; text-transform: uppercase; }
.count-badge { min-width: 34px; height: 34px; display: grid; place-items: center; padding-inline: 8px; border-radius: 999px; background: rgba(198,223,136,.08); color: var(--accent); font-size: .77rem; font-weight: 800; }

.search-box { position: relative; margin: 15px 15px 0; }
.search-box svg { position: absolute; left: 12px; top: 50%; width: 18px; fill: none; stroke: var(--soft); stroke-width: 1.7; transform: translateY(-50%); }
.search-box input { width: 100%; min-height: 43px; padding: 0 38px; border: 1px solid var(--line); border-radius: 12px; outline: 0; background: #090e0b; color: var(--text); }
.search-box input:focus { border-color: var(--accent-deep); box-shadow: 0 0 0 3px rgba(198,223,136,.07); }
.search-box button { position: absolute; right: 6px; top: 50%; width: 30px; height: 30px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; transform: translateY(-50%); }
.search-status { min-height: 18px; margin: 6px 18px 0; color: var(--soft); font-size: .72rem; }
.selection-bar { display: flex; align-items: center; gap: 10px; padding: 11px 15px; border-bottom: 1px solid var(--line); }
.selection-bar button { border: 0; padding: 0; background: transparent; color: var(--accent); cursor: pointer; font-size: .73rem; font-weight: 730; }
.selection-bar span { margin-left: auto; color: var(--soft); font-size: .7rem; }

.page-list { min-height: 180px; padding: 12px; overflow-y: auto; overscroll-behavior: contain; scrollbar-color: rgba(198,223,136,.28) transparent; }
.page-card {
  position: relative;
  display: grid;
  grid-template-columns: 22px 84px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  margin-bottom: 9px;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: rgba(255,255,255,.022);
  cursor: pointer;
  user-select: none;
  transition: border-color .16s ease, background .16s ease, transform .16s ease;
}
.page-card:hover { background: rgba(255,255,255,.045); }
.page-card.is-active { border-color: rgba(198,223,136,.45); background: rgba(198,223,136,.075); }
.page-card.is-selected { box-shadow: inset 3px 0 var(--accent); }
.page-card.is-match::after { content: "Match"; position: absolute; top: 8px; right: 8px; padding: 2px 6px; border-radius: 999px; background: #365021; color: #dff6aa; font-size: .55rem; font-weight: 800; text-transform: uppercase; }
.page-checkbox { width: 17px; height: 17px; accent-color: var(--accent-deep); cursor: pointer; }
.thumbnail-wrap { width: 84px; height: 108px; display: grid; place-items: center; overflow: hidden; border-radius: 7px; background: #e8e8e5; box-shadow: 0 6px 17px rgba(0,0,0,.25); }
.thumbnail-wrap canvas { max-width: 100%; max-height: 100%; display: block; }
.thumbnail-placeholder { width: 22px; height: 22px; border: 2px solid rgba(10,20,14,.18); border-top-color: #61754d; border-radius: 50%; animation: pdf-spin .8s linear infinite; }
.page-card-meta { min-width: 0; }
.page-card-meta strong, .page-card-meta span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page-card-meta strong { font-size: .8rem; }
.page-card-meta span { margin-top: 4px; color: var(--soft); font-size: .68rem; }
.drag-grip { margin-top: 9px; display: inline-flex; color: #718078; font-size: .7rem; letter-spacing: 2px; cursor: grab; }
.sortable-ghost { opacity: .25; }
.sortable-chosen { transform: scale(.985); }

.reader-panel { min-height: calc(100vh - 170px); display: grid; grid-template-rows: auto 1fr auto; }
.reader-toolbar { min-height: 61px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 8px 14px; border-bottom: 1px solid var(--line); }
.reader-navigation, .zoom-controls { display: flex; align-items: center; gap: 7px; }
.reader-navigation > span { min-width: 72px; color: var(--muted); text-align: center; font-size: .8rem; }
.reader-navigation strong { color: var(--text); }
.reader-button, .zoom-label { height: 39px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.025); color: var(--text); cursor: pointer; }
.reader-button { width: 39px; display: grid; place-items: center; font-size: 1.1rem; }
.reader-button svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.reader-button:hover:not(:disabled), .zoom-label:hover { border-color: rgba(198,223,136,.35); background: rgba(198,223,136,.06); }
.zoom-label { min-width: 58px; padding: 0 10px; color: var(--muted); font-size: .74rem; }
.reader-stage { position: relative; min-height: 650px; display: flex; align-items: flex-start; justify-content: center; overflow: auto; padding: 34px; background: #191d1a; scrollbar-color: rgba(198,223,136,.25) #101411; }
.reader-stage canvas { display: block; max-width: none; background: white; box-shadow: 0 22px 60px rgba(0,0,0,.5); }
.reader-loading, .reader-error { position: absolute; inset: 0; z-index: 2; display: flex; align-items: center; justify-content: center; gap: 10px; background: rgba(25,29,26,.78); color: var(--muted); font-size: .85rem; backdrop-filter: blur(3px); }
.reader-loading[hidden], .reader-error[hidden] { display: none; }
.reader-loading span { width: 18px; height: 18px; border: 2px solid rgba(198,223,136,.2); border-top-color: var(--accent); border-radius: 50%; animation: pdf-spin .8s linear infinite; }
.reader-footer { min-height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 0 16px; border-top: 1px solid var(--line); color: var(--soft); font-size: .69rem; }
.reader-footer span:first-child { max-width: 62%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.inspector-panel { overflow-y: auto; scrollbar-color: rgba(198,223,136,.28) transparent; }
.inspector-section { padding: 20px; border-bottom: 1px solid var(--line); }
.inspector-section:last-child { border-bottom: 0; }
.inspector-section h3 { margin: 5px 0 15px; font-size: 1rem; }
.page-facts { margin: 18px 0 0; }
.page-facts div { display: flex; justify-content: space-between; gap: 14px; padding: 8px 0; border-top: 1px solid rgba(255,255,255,.055); }
.page-facts dt { color: var(--soft); font-size: .72rem; }
.page-facts dd { max-width: 58%; margin: 0; overflow: hidden; color: #dfe5e0; font-size: .72rem; text-overflow: ellipsis; white-space: nowrap; }
.action-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.action-grid button { min-height: 72px; display: grid; place-items: center; align-content: center; gap: 5px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.02); color: var(--muted); cursor: pointer; font-size: .7rem; font-weight: 700; }
.action-grid button:hover:not(:disabled) { border-color: rgba(198,223,136,.32); background: rgba(198,223,136,.055); color: var(--text); }
.action-grid svg { width: 22px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.action-grid .danger-action:hover:not(:disabled) { border-color: rgba(255,155,143,.35); background: rgba(255,155,143,.065); color: #ffc0b7; }
.selection-hint { margin: 12px 0 0; color: var(--soft); font-size: .68rem; }
.section-line { display: flex; align-items: center; justify-content: space-between; }
.section-line h3 { margin: 0; }
.section-line span { color: var(--accent); font-size: .72rem; font-weight: 800; }
.source-list { display: grid; gap: 8px; margin-top: 13px; }
.source-item { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 11px; }
.source-icon { width: 31px; height: 36px; display: grid; place-items: center; border-radius: 7px; background: rgba(198,223,136,.08); color: var(--accent); font-size: .58rem; font-weight: 850; }
.source-item strong, .source-item span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.source-item strong { font-size: .73rem; }
.source-item span { margin-top: 2px; color: var(--soft); font-size: .63rem; }
.export-section label { display: block; margin-bottom: 7px; color: var(--muted); font-size: .7rem; font-weight: 700; }
.filename-field { display: flex; align-items: center; margin-bottom: 12px; border: 1px solid var(--line); border-radius: 11px; background: #090e0b; }
.filename-field input { min-width: 0; width: 100%; height: 44px; padding: 0 5px 0 12px; border: 0; outline: 0; background: transparent; color: var(--text); }
.filename-field span { padding-right: 11px; color: var(--soft); font-size: .76rem; }
.export-button { width: 100%; min-height: 62px; display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 9px; padding: 0 15px; border: 0; border-radius: 12px; background: var(--accent); color: #11170f; cursor: pointer; text-align: left; }
.export-button:hover:not(:disabled) { background: #d3e99a; transform: translateY(-1px); }
.export-button span, .export-button strong, .export-button small { display: block; }
.export-button strong { font-size: .81rem; }
.export-button small { margin-top: 2px; color: rgba(17,23,15,.68); font-size: .64rem; }
.export-button svg { width: 22px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.secondary-export { border: 1px solid var(--line-strong); background: rgba(255,255,255,.025); color: var(--text); }
.secondary-export:hover:not(:disabled) { background: rgba(198,223,136,.07); }
.secondary-export small { color: var(--soft); }
.export-progress { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: rgba(198,223,136,.06); color: var(--muted); font-size: .7rem; }
.export-progress[hidden], .export-message[hidden] { display: none; }
.export-spinner { width: 15px; height: 15px; border: 2px solid rgba(198,223,136,.2); border-top-color: var(--accent); border-radius: 50%; animation: pdf-spin .8s linear infinite; }
.export-message { margin: 10px 0 0; padding: 9px 10px; border-radius: 9px; font-size: .68rem; }
.export-message.error { background: rgba(255,155,143,.08); color: #ffc1b9; }
.export-message.success { background: rgba(169,220,145,.08); color: #c5edb2; }

.pdf-details { padding: 20px 0 110px; }
.pdf-feature-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.pdf-feature-grid article { min-height: 230px; padding: 25px; border: 1px solid var(--line); border-radius: 18px; background: rgba(255,255,255,.018); }
.pdf-feature-grid article > span { color: var(--accent); font-size: .7rem; font-weight: 800; }
.pdf-feature-grid h3 { margin: 52px 0 10px; font-size: 1.08rem; }
.pdf-feature-grid p { margin: 0; color: var(--muted); font-size: .84rem; }

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

@media (max-width: 1180px) {
  .pdf-workspace { grid-template-columns: 290px minmax(420px, 1fr); }
  .inspector-panel { grid-column: 1 / -1; position: static; max-height: none; display: grid; grid-template-columns: repeat(4, 1fr); overflow: visible; }
  .inspector-section { border-right: 1px solid var(--line); border-bottom: 0; }
  .inspector-section:last-child { border-right: 0; }
  .pdf-feature-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 800px) {
  .workshop-shell { width: min(100% - 20px, var(--workshop-width)); }
  .pdf-intro { align-items: flex-start; flex-direction: column; }
  .privacy-seal { min-width: 0; }
  .pdf-command-bar { top: 70px; align-items: stretch; flex-direction: column; }
  .command-group { width: 100%; }
  .command-group:first-child .command-button { flex: 1; }
  .history-group { justify-content: flex-end; }
  .pdf-workspace { grid-template-columns: 1fr; }
  .organizer-panel, .inspector-panel { position: static; max-height: none; }
  .page-list { max-height: 470px; }
  .reader-panel { min-height: 650px; }
  .reader-stage { min-height: 550px; }
  .inspector-panel { display: grid; grid-template-columns: repeat(2, 1fr); }
  .inspector-section:nth-child(2n) { border-right: 0; }
  .inspector-section:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .pdf-feature-grid { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .pdf-main { padding-top: 36px; }
  .pdf-intro h1 { font-size: 3.7rem; }
  .command-button { padding-inline: 11px; font-size: .78rem; }
  .pdf-empty { min-height: 500px; padding: 14px; }
  .pdf-drop-zone { min-height: 330px; padding: 25px 18px; }
  .reader-toolbar { align-items: stretch; flex-direction: column; }
  .reader-navigation, .zoom-controls { justify-content: center; }
  .reader-stage { min-height: 480px; padding: 20px; }
  .reader-footer { align-items: flex-start; flex-direction: column; justify-content: center; gap: 3px; }
  .reader-footer span:first-child { max-width: 100%; }
  .inspector-panel { grid-template-columns: 1fr; }
  .inspector-section { border-right: 0; border-bottom: 1px solid var(--line) !important; }
  .page-card { grid-template-columns: 22px 76px minmax(0,1fr); }
  .thumbnail-wrap { width: 76px; height: 98px; }
}

@media (prefers-reduced-motion: reduce) {
  .thumbnail-placeholder, .reader-loading span, .export-spinner { animation: none; }
}
