:root {
  color-scheme: light;
  --paper: #f1ecdf;
  --paper-deep: #e8e0d0;
  --paper-raised: #fbf8f0;
  --ink: #1e2922;
  --ink-soft: #445047;
  --muted: #72766d;
  --line: #d2c8b7;
  --line-strong: #b8ad9a;
  --accent: #386044;
  --accent-deep: #234532;
  --accent-wash: #dfe8dc;
  --danger: #93473c;
  --danger-wash: #f1dfda;
  --shadow: 0 20px 60px rgba(43, 48, 39, 0.08);
  --sans: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  --serif: "Noto Serif SC", "Songti SC", "STSong", "SimSun", Georgia, serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--paper);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 4%, rgba(255, 255, 255, 0.72), transparent 31rem),
    radial-gradient(circle at 93% 14%, rgba(206, 216, 197, 0.4), transparent 32rem),
    var(--paper);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

button {
  color: inherit;
}

::selection {
  color: #fffdf8;
  background: var(--accent);
}

.paper-texture {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.44;
  background-image:
    radial-gradient(rgba(49, 56, 48, 0.12) 0.55px, transparent 0.65px),
    linear-gradient(90deg, transparent 0 49.8%, rgba(73, 70, 60, 0.035) 50%, transparent 50.2%);
  background-size: 7px 7px, 100% 100%;
  mix-blend-mode: multiply;
}

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

.site-header {
  width: min(100%, 1380px);
  margin: 0 auto;
  min-height: 82px;
  padding: 21px 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid rgba(153, 141, 120, 0.4);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  text-decoration: none;
  width: fit-content;
}

.brand-mark {
  display: grid;
  width: 39px;
  height: 39px;
  place-items: center;
  border: 1px solid var(--accent-deep);
  color: var(--paper-raised);
  background: var(--accent-deep);
  font-family: var(--serif);
  font-size: 21px;
  line-height: 1;
}

.brand-copy {
  display: grid;
  gap: 1px;
}

.brand-copy strong {
  font-family: var(--serif);
  font-size: 18px;
  letter-spacing: 0.13em;
  font-weight: 700;
}

.brand-copy small {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.12em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 21px;
}

.privacy-note {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #527b57;
  box-shadow: 0 0 0 3px rgba(82, 123, 87, 0.12);
}

.text-button,
.refresh-button,
.password-toggle {
  border: 0;
  padding: 5px 0;
  background: transparent;
  cursor: pointer;
  text-decoration: none;
}

.text-button {
  color: var(--ink-soft);
  border-bottom: 1px solid transparent;
  font-size: 13px;
  transition: color 160ms ease, border-color 160ms ease;
}

.text-button:hover {
  color: var(--accent-deep);
  border-bottom-color: currentColor;
}

.page-shell {
  width: min(100%, 1280px);
  margin: 0 auto;
  padding: 78px 48px 90px;
}

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 270px;
  gap: clamp(48px, 8vw, 120px);
  align-items: end;
}

.eyebrow,
.section-index,
.dialog-index {
  margin: 0 0 24px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.intro h1 {
  max-width: 850px;
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(46px, 6vw, 78px);
  font-weight: 600;
  letter-spacing: -0.045em;
  line-height: 1.16;
}

.intro h1 em {
  color: var(--accent);
  font-style: normal;
}

.intro-text {
  max-width: 670px;
  margin: 31px 0 0;
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.9;
}

.archive-note {
  position: relative;
  padding: 3px 0 4px 28px;
  border-left: 1px solid var(--line-strong);
}

.note-label {
  display: block;
  margin-bottom: 25px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.18em;
}

.stat-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.stat-row span {
  color: var(--muted);
  font-family: var(--serif);
  font-size: 14px;
}

.stat-row strong {
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.03em;
}

.note-foot {
  margin: 23px 0 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.11em;
}

.note-foot span {
  display: block;
  margin-top: 6px;
  color: var(--ink-soft);
  font-size: 10px;
  letter-spacing: 0.02em;
}

.library {
  margin-top: 83px;
  padding-top: 31px;
  border-top: 1px solid var(--line-strong);
}

.library-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 32px;
}

.section-index {
  margin-bottom: 9px;
  color: var(--muted);
}

.library h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.search-wrap {
  position: relative;
  width: min(100%, 285px);
}

.search-icon {
  position: absolute;
  left: 1px;
  top: 50%;
  width: 16px;
  height: 16px;
  transform: translateY(-50%);
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.5;
  stroke-linecap: round;
  pointer-events: none;
}

.search-wrap input {
  width: 100%;
  height: 38px;
  padding: 2px 8px 2px 27px;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  outline: none;
  font-size: 13px;
  transition: border-color 160ms ease;
}

.search-wrap input::placeholder {
  color: #8a8b82;
}

.search-wrap input:focus {
  border-bottom-color: var(--accent);
}

.upload-area {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 21px;
  min-height: 116px;
  padding: 22px 25px;
  border: 1px dashed var(--line-strong);
  background: rgba(251, 248, 240, 0.47);
  transition: border-color 180ms ease, background-color 180ms ease, transform 180ms ease;
}

.upload-area::before {
  content: "";
  position: absolute;
  top: -1px;
  left: -1px;
  width: 29px;
  height: 29px;
  border-top: 2px solid var(--accent);
  border-left: 2px solid var(--accent);
  pointer-events: none;
}

.upload-area.is-dragging {
  border-color: var(--accent);
  background: var(--accent-wash);
}

.upload-icon {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  color: var(--accent);
  border: 1px solid var(--line);
  background: var(--paper-raised);
}

.upload-icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.upload-copy {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.upload-copy strong {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 600;
}

.upload-copy span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.primary-button,
.secondary-button,
.danger-button {
  min-height: 41px;
  padding: 0 21px;
  border: 1px solid transparent;
  border-radius: 0;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.03em;
  transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.primary-button {
  color: #fffdf8;
  background: var(--accent-deep);
  border-color: var(--accent-deep);
}

.primary-button:hover {
  background: #173726;
  border-color: #173726;
}

.primary-button:active,
.secondary-button:active,
.danger-button:active {
  transform: translateY(1px);
}

.primary-button:disabled {
  opacity: 0.58;
  cursor: wait;
}

.secondary-button {
  color: var(--ink-soft);
  background: transparent;
  border-color: var(--line-strong);
}

.secondary-button:hover {
  border-color: var(--ink-soft);
}

.danger-button {
  color: #fffdf8;
  background: var(--danger);
  border-color: var(--danger);
}

.danger-button:hover {
  background: #78352c;
  border-color: #78352c;
}

.upload-progress {
  margin-top: 16px;
  padding: 14px 17px;
  border: 1px solid var(--line);
  background: rgba(251, 248, 240, 0.68);
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 11px;
}

.progress-meta strong {
  color: var(--accent);
  font-family: var(--mono);
  font-weight: 600;
}

.progress-track {
  height: 3px;
  overflow: hidden;
  background: var(--paper-deep);
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent);
  transition: width 150ms linear;
}

.list-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 61px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.04em;
}

.list-toolbar p {
  margin: 0;
}

.refresh-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 11px;
}

.refresh-button:hover {
  color: var(--accent-deep);
}

.refresh-button svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.file-list {
  border-top: 1px solid var(--line-strong);
}

.file-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 19px;
  min-height: 82px;
  padding: 15px 13px;
  border-bottom: 1px solid var(--line);
  background: transparent;
  animation: row-in 320ms both ease-out;
  transition: background-color 160ms ease, padding-left 160ms ease;
}

.file-row:hover {
  background: rgba(251, 248, 240, 0.6);
  padding-left: 18px;
}

.file-mark {
  display: grid;
  width: 44px;
  height: 48px;
  place-items: center;
  color: var(--accent);
  background: rgba(251, 248, 240, 0.82);
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.file-mark[data-kind="sheet"] {
  color: #44624d;
  background: #e4ece1;
}

.file-mark[data-kind="slide"] {
  color: #7a5a35;
  background: #f0e6d6;
}

.file-mark[data-kind="image"] {
  color: #5c596f;
  background: #e9e5ed;
}

.file-mark[data-kind="code"] {
  color: #3f6271;
  background: #e2ecef;
}

.file-primary {
  min-width: 0;
}

.file-name {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.45;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-name:hover {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.file-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 15px;
  margin: 5px 0 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.03em;
}

.file-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.file-action {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 11px;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid transparent;
  font-size: 11px;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 160ms ease, color 160ms ease, background-color 160ms ease;
}

.file-action:hover {
  color: var(--accent-deep);
  border-color: var(--line);
  background: var(--paper-raised);
}

.file-action.delete:hover {
  color: var(--danger);
  border-color: #d8bdb6;
  background: var(--danger-wash);
}

.file-action:disabled {
  opacity: 0.46;
  cursor: wait;
}

.empty-state {
  padding: 58px 24px 67px;
  text-align: center;
  border-bottom: 1px solid var(--line);
}

.empty-rule {
  display: block;
  width: 1px;
  height: 45px;
  margin: 0 auto 20px;
  background: var(--line-strong);
}

.empty-kicker {
  margin: 0 0 10px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.15em;
}

.empty-state h3 {
  margin: 0;
  font-family: var(--serif);
  font-size: 23px;
  font-weight: 600;
}

.empty-state > p:last-child {
  max-width: 420px;
  margin: 12px auto 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.8;
}

.site-footer {
  width: min(100%, 1380px);
  margin: 0 auto;
  padding: 24px 48px 31px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  color: var(--muted);
  border-top: 1px solid rgba(153, 141, 120, 0.4);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.1em;
}

.site-footer p {
  margin: 0;
}

.confirm-dialog {
  width: min(calc(100% - 32px), 470px);
  padding: 0;
  color: var(--ink);
  background: var(--paper-raised);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
}

.confirm-dialog::backdrop {
  background: rgba(24, 33, 27, 0.52);
  backdrop-filter: blur(2px);
}

.confirm-dialog form {
  padding: 35px 34px 29px;
}

.dialog-index {
  margin-bottom: 12px;
  color: var(--danger);
}

.confirm-dialog h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 27px;
  font-weight: 600;
}

.dialog-file {
  overflow: hidden;
  margin: 17px 0 10px;
  padding: 10px 12px;
  background: var(--paper);
  border-left: 2px solid var(--danger);
  font-family: var(--mono);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dialog-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.75;
}

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

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 20;
  max-width: min(360px, calc(100vw - 48px));
  padding: 13px 17px;
  color: #fffdf8;
  background: var(--accent-deep);
  box-shadow: 0 14px 42px rgba(25, 36, 28, 0.24);
  font-size: 12px;
  line-height: 1.6;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

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

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

/* Login */
.login-page {
  min-height: 100svh;
  background: var(--paper);
}

.login-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  min-height: 100svh;
}

.login-editorial {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100svh;
  padding: 40px clamp(36px, 6vw, 83px) 34px;
  overflow: hidden;
  color: #f5efe2;
  background:
    radial-gradient(circle at 14% 12%, rgba(126, 153, 119, 0.28), transparent 30rem),
    linear-gradient(148deg, #244532 0%, #1c3527 66%, #182e23 100%);
}

.login-editorial::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.18;
  pointer-events: none;
  background-image:
    repeating-linear-gradient(0deg, transparent 0 35px, rgba(252, 248, 239, 0.09) 36px),
    radial-gradient(rgba(255, 255, 255, 0.16) 0.5px, transparent 0.7px);
  background-size: 100% 36px, 8px 8px;
}

.brand-light {
  position: relative;
  z-index: 1;
}

.brand-light .brand-mark {
  color: var(--accent-deep);
  background: #f5efe2;
  border-color: rgba(245, 239, 226, 0.75);
}

.brand-light .brand-copy strong {
  color: #f5efe2;
}

.brand-light .brand-copy small {
  color: rgba(245, 239, 226, 0.55);
}

.editorial-body {
  position: relative;
  z-index: 1;
  width: min(100%, 640px);
  margin: auto 0;
  padding: 80px 0;
}

.eyebrow-light {
  color: rgba(225, 236, 219, 0.64);
}

.login-editorial blockquote {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(31px, 3.7vw, 53px);
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1.55;
}

.editorial-caption {
  margin: 35px 0 0;
  color: rgba(245, 239, 226, 0.6);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.16em;
}

.editorial-foot {
  position: relative;
  z-index: 1;
  margin: 0;
  color: rgba(245, 239, 226, 0.4);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.12em;
}

.login-panel {
  display: grid;
  place-items: center;
  min-height: 100svh;
  padding: 50px clamp(28px, 8vw, 120px);
  background:
    radial-gradient(circle at 90% 4%, rgba(200, 212, 190, 0.35), transparent 25rem),
    var(--paper);
}

.login-form-wrap {
  width: min(100%, 420px);
}

.section-index {
  margin-bottom: 13px;
}

.login-form-wrap h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(37px, 4vw, 49px);
  font-weight: 600;
  letter-spacing: -0.045em;
}

.login-intro {
  max-width: 380px;
  margin: 19px 0 38px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.85;
}

.field-label {
  display: block;
  margin: 22px 0 8px;
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.text-input {
  width: 100%;
  height: 49px;
  padding: 0 12px;
  color: var(--ink);
  background: rgba(251, 248, 240, 0.62);
  border: 1px solid var(--line);
  border-radius: 0;
  outline: none;
  font-size: 15px;
  transition: border-color 160ms ease, background-color 160ms ease;
}

.text-input:focus {
  background: var(--paper-raised);
  border-color: var(--accent);
}

.password-wrap {
  position: relative;
}

.password-wrap .text-input {
  padding-right: 60px;
}

.password-toggle {
  position: absolute;
  right: 9px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 10px;
}

.password-toggle:hover {
  color: var(--accent);
}

.form-error {
  margin: 15px 0 0;
  padding: 10px 12px;
  color: var(--danger);
  background: var(--danger-wash);
  border-left: 2px solid var(--danger);
  font-size: 12px;
  line-height: 1.6;
}

.login-button {
  width: 100%;
  min-height: 50px;
  margin-top: 28px;
  font-size: 14px;
}

.login-security {
  margin: 24px 0 0;
  padding-top: 20px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: 10px;
  line-height: 1.7;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

@keyframes row-in {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --paper: #171d18;
    --paper-deep: #202821;
    --paper-raised: #202820;
    --ink: #eee9dc;
    --ink-soft: #c1c5b9;
    --muted: #92998d;
    --line: #384038;
    --line-strong: #515a50;
    --accent: #93b799;
    --accent-deep: #b4cfb5;
    --accent-wash: #29372c;
    --danger: #d88478;
    --danger-wash: #3b2824;
    --shadow: 0 24px 70px rgba(0, 0, 0, 0.3);
  }

  body {
    background:
      radial-gradient(circle at 8% 4%, rgba(101, 127, 101, 0.12), transparent 31rem),
      radial-gradient(circle at 93% 14%, rgba(79, 94, 73, 0.16), transparent 32rem),
      var(--paper);
  }

  .brand-mark {
    color: #172219;
    background: var(--accent-deep);
    border-color: var(--accent-deep);
  }

  .primary-button {
    color: #142018;
    background: var(--accent-deep);
    border-color: var(--accent-deep);
  }

  .primary-button:hover {
    background: #c7ddc7;
    border-color: #c7ddc7;
  }

  .file-mark {
    background: rgba(32, 40, 32, 0.82);
  }

  .file-mark[data-kind="sheet"] {
    background: #29382b;
  }

  .file-mark[data-kind="slide"] {
    background: #3a3227;
  }

  .file-mark[data-kind="image"] {
    background: #302d38;
  }

  .file-mark[data-kind="code"] {
    background: #27353a;
  }

  .login-page,
  .login-panel {
    background:
      radial-gradient(circle at 90% 4%, rgba(67, 87, 68, 0.22), transparent 25rem),
      var(--paper);
  }

  .dialog-file {
    background: var(--paper-deep);
  }
}

@media (max-width: 900px) {
  .site-header {
    padding-inline: 28px;
  }

  .page-shell {
    padding: 58px 28px 70px;
  }

  .intro {
    grid-template-columns: minmax(0, 1fr) 220px;
    gap: 45px;
  }

  .intro h1 {
    font-size: clamp(42px, 7vw, 62px);
  }

  .library {
    margin-top: 65px;
  }

  .login-layout {
    grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.18fr);
  }

  .login-editorial {
    padding-inline: 38px;
  }

  .login-editorial blockquote {
    font-size: clamp(29px, 4.2vw, 44px);
  }
}

@media (max-width: 680px) {
  .site-header {
    min-height: 72px;
    padding: 16px 19px;
  }

  .brand-mark {
    width: 35px;
    height: 35px;
    font-size: 19px;
  }

  .brand-copy strong {
    font-size: 16px;
  }

  .brand-copy small,
  .privacy-note {
    display: none;
  }

  .header-actions {
    gap: 10px;
  }

  .page-shell {
    padding: 43px 19px 57px;
  }

  .intro {
    display: block;
  }

  .eyebrow {
    margin-bottom: 17px;
    font-size: 9px;
  }

  .intro h1 {
    font-size: clamp(38px, 11vw, 52px);
    line-height: 1.22;
  }

  .intro-text {
    margin-top: 22px;
    font-size: 13px;
    line-height: 1.85;
  }

  .archive-note {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 20px;
    margin-top: 35px;
    padding: 17px 0 0;
    border-top: 1px solid var(--line-strong);
    border-left: 0;
  }

  .note-label {
    grid-column: 1 / -1;
    margin-bottom: 8px;
  }

  .stat-row {
    padding: 8px 0;
  }

  .stat-row strong {
    font-size: 16px;
  }

  .note-foot {
    grid-column: 1 / -1;
    margin-top: 15px;
  }

  .library {
    margin-top: 51px;
    padding-top: 22px;
  }

  .library-heading {
    display: block;
    margin-bottom: 24px;
  }

  .library h2 {
    font-size: 26px;
  }

  .search-wrap {
    width: 100%;
    margin-top: 19px;
  }

  .upload-area {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 16px;
    padding: 19px 17px;
  }

  .upload-area .primary-button {
    grid-column: 1 / -1;
    width: 100%;
  }

  .upload-icon {
    width: 41px;
    height: 41px;
  }

  .upload-copy strong {
    font-size: 15px;
  }

  .upload-copy span {
    font-size: 10px;
  }

  .file-row {
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 13px;
    min-height: 77px;
    padding: 14px 7px;
  }

  .file-row:hover {
    padding-left: 7px;
  }

  .file-mark {
    width: 38px;
    height: 42px;
    font-size: 8px;
  }

  .file-name {
    font-size: 14px;
  }

  .file-actions {
    grid-column: 2;
    justify-content: flex-start;
    margin-top: -2px;
  }

  .file-action {
    min-height: 30px;
    padding: 0 9px 0 0;
  }

  .file-action.delete {
    padding-left: 9px;
    border-left: 1px solid var(--line);
  }

  .site-footer {
    display: block;
    padding: 22px 19px 28px;
    line-height: 1.8;
  }

  .site-footer p + p {
    margin-top: 4px;
  }

  .login-layout {
    display: block;
  }

  .login-editorial {
    min-height: 37svh;
    padding: 24px 22px 27px;
  }

  .login-editorial .brand-copy small,
  .login-editorial .eyebrow,
  .editorial-foot {
    display: none;
  }

  .editorial-body {
    padding: 43px 0 8px;
  }

  .login-editorial blockquote {
    max-width: 520px;
    font-size: clamp(25px, 7.5vw, 34px);
    line-height: 1.45;
  }

  .editorial-caption {
    margin-top: 18px;
    font-size: 8px;
  }

  .login-panel {
    min-height: auto;
    padding: 45px 22px 58px;
  }

  .login-form-wrap h1 {
    font-size: 39px;
  }

  .login-intro {
    margin-bottom: 30px;
  }

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

  .toast {
    right: 16px;
    bottom: 16px;
    max-width: calc(100vw - 32px);
  }
}

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

/* Classification and reading layer */
.library-tools {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 18px;
  width: min(100%, 480px);
}

.new-folder-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 14px;
  color: var(--accent-deep);
  background: transparent;
  border: 1px solid var(--line-strong);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  transition: color 160ms ease, border-color 160ms ease, background-color 160ms ease;
}

.new-folder-button:hover {
  color: var(--paper-raised);
  background: var(--accent-deep);
  border-color: var(--accent-deep);
}

.new-folder-button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.new-folder-button svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.breadcrumb-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 43px;
  margin-bottom: 14px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.04em;
}

.breadcrumb-item {
  padding: 4px 0;
  color: var(--muted);
  background: transparent;
  border: 0;
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
}

.breadcrumb-item:hover {
  color: var(--accent-deep);
}

.breadcrumb-item[aria-current="page"] {
  color: var(--ink);
  cursor: default;
}

.breadcrumb-separator {
  color: var(--line-strong);
}

.upload-copy b {
  color: var(--accent);
  font-weight: 600;
}

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

.folder-card {
  position: relative;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 84px;
  padding: 15px 17px;
  color: var(--ink);
  text-align: left;
  background: rgba(251, 248, 240, 0.53);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: border-color 160ms ease, background-color 160ms ease, transform 160ms ease;
}

.folder-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: var(--accent);
  opacity: 0;
  transition: opacity 160ms ease;
}

.folder-card:hover {
  background: var(--paper-raised);
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.folder-card:hover::before {
  opacity: 1;
}

.folder-card-icon {
  display: grid;
  width: 38px;
  height: 33px;
  place-items: center;
  color: var(--accent);
  border: 1px solid var(--line-strong);
  background: var(--accent-wash);
}

.folder-card-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.3;
  stroke-linejoin: round;
}

.folder-card-copy {
  min-width: 0;
}

.folder-card-copy strong {
  display: block;
  overflow: hidden;
  font-family: var(--serif);
  font-size: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.folder-card-copy span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.03em;
}

.folder-card-arrow {
  color: var(--muted);
  font-size: 16px;
  transition: color 160ms ease, transform 160ms ease;
}

.folder-card:hover .folder-card-arrow {
  color: var(--accent);
  transform: translateX(3px);
}

.form-dialog {
  width: min(calc(100% - 32px), 450px);
  padding: 0;
  color: var(--ink);
  background: var(--paper-raised);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
}

.form-dialog form {
  padding: 34px 33px 29px;
}

.form-dialog h2,
.preview-header h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 27px;
  font-weight: 600;
}

.form-dialog .field-label {
  margin-top: 24px;
}

.form-dialog .dialog-actions {
  margin-top: 24px;
}

.form-dialog::backdrop,
.preview-dialog::backdrop {
  background: rgba(24, 33, 27, 0.58);
  backdrop-filter: blur(3px);
}

.preview-dialog {
  width: min(calc(100% - 44px), 1120px);
  height: min(88vh, 920px);
  max-height: 88vh;
  padding: 0;
  color: var(--ink);
  background: var(--paper-raised);
  border: 1px solid var(--line-strong);
  box-shadow: 0 28px 90px rgba(22, 30, 24, 0.3);
}

.preview-shell {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.preview-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 23px 27px 19px;
  border-bottom: 1px solid var(--line);
}

.preview-header .dialog-index {
  margin-bottom: 7px;
  color: var(--muted);
}

.preview-header h2 {
  max-width: 720px;
  overflow: hidden;
  font-size: 22px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

.preview-actions .secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding-inline: 13px;
  text-decoration: none;
}

.preview-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 0;
  background: var(--paper-deep);
}

.preview-body iframe {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 66vh;
  border: 0;
  background: #fff;
}

.preview-image-wrap {
  display: grid;
  min-height: 100%;
  padding: 28px;
  place-items: center;
  background: var(--paper-deep);
}

.preview-image-wrap img {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
  box-shadow: 0 18px 50px rgba(31, 37, 30, 0.16);
}

.preview-text {
  min-height: 100%;
  margin: 0;
  padding: 30px 34px 60px;
  color: var(--ink);
  background: var(--paper-raised);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.85;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.preview-message {
  display: grid;
  min-height: 56vh;
  padding: 40px;
  place-content: center;
  text-align: center;
}

.preview-message strong {
  font-family: var(--serif);
  font-size: 21px;
}

.preview-message p {
  max-width: 440px;
  margin: 10px auto 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.8;
}

.preview-loading {
  display: grid;
  min-height: 50vh;
  place-items: center;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
}

@media (max-width: 900px) {
  .library-tools {
    width: min(100%, 390px);
  }

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

@media (max-width: 680px) {
  .library-tools {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
    gap: 13px;
    margin-top: 19px;
  }

  .new-folder-button {
    width: 100%;
  }

  .search-wrap {
    margin-top: 0;
  }

  .breadcrumb-bar {
    margin-top: 2px;
  }

  .folder-grid {
    margin-bottom: 14px;
  }

  .folder-card {
    min-height: 76px;
    padding: 13px 14px;
  }

  .preview-dialog {
    width: calc(100% - 20px);
    height: 92vh;
    max-height: 92vh;
  }

  .preview-header {
    display: grid;
    gap: 14px;
    padding: 18px 18px 15px;
  }

  .preview-header h2 {
    max-width: calc(100vw - 58px);
    font-size: 19px;
  }

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

  .preview-body iframe {
    min-height: 68vh;
  }

  .preview-text {
    padding: 21px 18px 45px;
    font-size: 11px;
  }
}
