:root {
  --ink: #1d1d1f;
  --ink-soft: #424245;
  --steel: #86868b;
  --line: rgba(29, 29, 31, 0.1);
  --line-strong: rgba(29, 29, 31, 0.17);
  --porcelain: #f5f5f7;
  --paper: #ffffff;
  --lavender: #eee8f4;
  --purple: #704097;
  --purple-bright: #8e57b5;
  --purple-deep: #422258;
  --green: #248a54;
  --red: #c73d4c;
  --amber: #9a6400;
  --shadow-sm: 0 8px 30px rgba(27, 19, 34, 0.07);
  --shadow-md: 0 24px 70px rgba(39, 23, 50, 0.13);
  --radius-sm: 14px;
  --radius-md: 22px;
  --radius-lg: 34px;
  --max: 1240px;
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--porcelain); -webkit-font-smoothing: antialiased; }
body, button, input, select, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }
button { color: inherit; }
img { display: block; max-width: 100%; }
button, a, input, select, textarea, summary { -webkit-tap-highlight-color: transparent; }
button, summary { cursor: pointer; }
:focus-visible { outline: 3px solid rgba(112, 64, 151, 0.38); outline-offset: 3px; }
::selection { background: rgba(112, 64, 151, 0.18); }
.is-hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }

.site-header {
  position: sticky;
  z-index: 50;
  top: 0;
  height: 58px;
  border-bottom: 1px solid rgba(29, 29, 31, 0.07);
  background: rgba(250, 250, 252, 0.82);
  backdrop-filter: saturate(180%) blur(22px);
}
.nav-shell { width: min(calc(100% - 40px), var(--max)); height: 100%; margin: auto; display: flex; align-items: center; justify-content: space-between; }
.brand { display: inline-flex; align-items: center; gap: 13px; min-width: max-content; }
.brand img { width: 116px; height: auto; object-fit: contain; }
.brand span { padding-left: 13px; border-left: 1px solid var(--line-strong); color: var(--ink-soft); font-size: 13px; letter-spacing: 0.06em; }
.site-nav { display: flex; align-items: center; gap: 8px; height: 100%; font-size: 13px; }
.nav-link { height: 34px; padding: 0 14px; display: inline-flex; align-items: center; border-radius: 999px; color: var(--ink-soft); transition: 160ms ease; }
.nav-link:hover, .nav-link.is-active { color: var(--ink); background: rgba(29, 29, 31, 0.055); }
.nav-user { display: inline-flex; align-items: center; gap: 8px; margin-left: 12px; padding-left: 20px; border-left: 1px solid var(--line); color: var(--steel); }
.avatar { display: grid; place-items: center; width: 29px; height: 29px; border-radius: 50%; color: #fff; background: var(--purple); font-weight: 650; }
.site-nav form { margin: 0; }
.nav-logout { border: 0; background: transparent; color: var(--steel); padding: 9px 10px; border-radius: 99px; }
.nav-logout:hover { color: var(--ink); background: rgba(29, 29, 31, 0.05); }
.nav-toggle { display: none; width: 38px; height: 38px; border: 0; background: transparent; position: relative; }
.nav-toggle span { position: absolute; left: 9px; width: 20px; height: 1px; background: var(--ink); transition: transform 180ms ease; }
.nav-toggle span:first-child { top: 15px; }
.nav-toggle span:last-child { top: 22px; }
.nav-toggle[aria-expanded="true"] span:first-child { top: 19px; transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:last-child { top: 19px; transform: rotate(-45deg); }

.eyebrow { margin: 0 0 13px; color: var(--purple); font-size: 11px; line-height: 1; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase; }
.eyebrow.light { color: rgba(255, 255, 255, 0.7); }
.muted { color: var(--steel); }
.button { min-height: 42px; padding: 0 20px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; border: 1px solid transparent; border-radius: 999px; font-size: 14px; font-weight: 580; transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease; }
.button:hover { transform: translateY(-1px); }
.button:active { transform: translateY(0); }
.button:disabled { cursor: wait; opacity: 0.65; }
.button-primary { color: #fff; background: var(--purple); box-shadow: 0 7px 20px rgba(112, 64, 151, 0.2); }
.button-primary:hover { background: var(--purple-bright); box-shadow: 0 9px 24px rgba(112, 64, 151, 0.26); }
.button-secondary { border-color: var(--line-strong); background: rgba(255, 255, 255, 0.7); }
.button-secondary:hover { background: #fff; }
.button-large { min-height: 52px; padding: 0 24px; font-size: 15px; }
.text-link { display: inline-flex; width: fit-content; align-items: center; gap: 9px; border: 0; padding: 0; color: var(--purple); background: transparent; font-size: 14px; font-weight: 600; }
.text-link span { transition: transform 160ms ease; }
.text-link:hover span { transform: translateX(3px); }

.site-footer { min-height: 100px; padding: 30px max(24px, calc((100vw - var(--max)) / 2)); border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; color: var(--steel); font-size: 12px; }

/* Login */
.login-page { min-height: 100vh; background: #fff; }
.login-page .site-footer { display: none; }
.login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(440px, 1.15fr) minmax(420px, 0.85fr); }
.login-story { position: relative; isolation: isolate; min-height: 720px; padding: 48px clamp(44px, 6vw, 100px); overflow: hidden; color: #fff; background: #24182c; }
.login-story::before { content: ""; position: absolute; z-index: -2; inset: 0; background: radial-gradient(circle at 75% 15%, rgba(162, 104, 195, 0.48), transparent 34%), radial-gradient(circle at 8% 88%, rgba(111, 52, 147, 0.58), transparent 38%); }
.login-story::after { content: ""; position: absolute; z-index: -1; width: 580px; height: 580px; right: -250px; bottom: -180px; border: 1px solid rgba(255, 255, 255, 0.18); border-radius: 50%; box-shadow: 0 0 0 70px rgba(255, 255, 255, 0.025), 0 0 0 140px rgba(255, 255, 255, 0.018); }
.login-brand .brand img { filter: brightness(0) invert(1); width: 136px; }
.login-brand .brand span { color: rgba(255, 255, 255, 0.72); border-color: rgba(255, 255, 255, 0.25); }
.story-copy { position: absolute; left: clamp(44px, 6vw, 100px); bottom: clamp(70px, 12vh, 150px); max-width: 650px; }
.story-copy h1 { margin: 0; font-size: clamp(48px, 5.4vw, 82px); line-height: 1.06; letter-spacing: -0.055em; font-weight: 660; }
.story-copy > p:last-child { max-width: 520px; margin: 30px 0 0; color: rgba(255, 255, 255, 0.67); font-size: 17px; line-height: 1.75; }
.story-orbit { position: absolute; top: 20%; right: 10%; width: 180px; height: 180px; border: 1px solid rgba(255, 255, 255, 0.14); border-radius: 50%; animation: float 7s ease-in-out infinite; }
.story-orbit span { position: absolute; border-radius: 50%; background: rgba(255, 255, 255, 0.75); box-shadow: 0 0 30px rgba(255, 255, 255, 0.55); }
.story-orbit span:nth-child(1) { width: 8px; height: 8px; left: 18px; top: 72px; }
.story-orbit span:nth-child(2) { width: 5px; height: 5px; right: 32px; top: 25px; }
.story-orbit span:nth-child(3) { width: 3px; height: 3px; right: 2px; bottom: 52px; }
.login-panel { min-height: 720px; padding: 48px clamp(36px, 7vw, 110px); display: grid; place-items: center; background: #fff; }
.login-form-wrap { width: min(100%, 400px); }
.login-form-wrap h2 { margin: 0; font-size: clamp(32px, 3vw, 44px); line-height: 1.1; letter-spacing: -0.04em; }
.login-form-wrap > .muted { margin: 15px 0 35px; line-height: 1.6; font-size: 14px; }
.login-form { display: grid; gap: 20px; }
.login-form label, .stack-form label, .form-grid label { display: grid; gap: 9px; color: var(--ink-soft); font-size: 13px; font-weight: 560; }
input, select, textarea { width: 100%; border: 1px solid var(--line-strong); border-radius: 12px; outline: none; color: var(--ink); background: rgba(255, 255, 255, 0.92); transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease; }
input, select { height: 46px; padding: 0 14px; }
textarea { min-height: 90px; padding: 13px 14px; line-height: 1.55; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: rgba(112, 64, 151, 0.62); box-shadow: 0 0 0 4px rgba(112, 64, 151, 0.09); background: #fff; }
input::placeholder, textarea::placeholder { color: #aaaab0; }
.password-field { position: relative; display: block; }
.password-field input { padding-right: 60px; }
.password-toggle { position: absolute; top: 5px; right: 5px; height: 36px; padding: 0 10px; border: 0; border-radius: 9px; color: var(--purple); background: transparent; font-size: 12px; font-weight: 600; }
.password-toggle:hover { background: var(--lavender); }
.login-note { margin: 28px 0 0; color: var(--steel); font-size: 12px; text-align: center; }
.form-error { margin: 0 0 22px; padding: 13px 15px; border: 1px solid rgba(199, 61, 76, 0.2); border-radius: 12px; color: #a72838; background: #fff4f5; font-size: 13px; line-height: 1.55; }

/* Library */
.library-hero { position: relative; isolation: isolate; min-height: min(780px, calc(100vh - 58px)); padding: clamp(80px, 10vw, 150px) max(24px, calc((100vw - var(--max)) / 2)); display: grid; grid-template-columns: 0.92fr 1.08fr; align-items: center; overflow: hidden; background: #fbfbfd; }
.ambient { position: absolute; z-index: -1; border-radius: 50%; filter: blur(1px); }
.ambient-one { width: min(42vw, 650px); height: min(42vw, 650px); top: -22%; right: -7%; background: rgba(216, 202, 228, 0.34); }
.ambient-two { width: min(27vw, 410px); height: min(27vw, 410px); bottom: -18%; left: 35%; background: rgba(242, 231, 236, 0.7); }
.hero-copy { position: relative; z-index: 2; padding-right: 50px; }
.hero-copy h1 { margin: 0; font-size: clamp(48px, 5.3vw, 76px); line-height: 1.04; letter-spacing: -0.057em; font-weight: 680; }
.hero-copy > p:not(.eyebrow) { max-width: 520px; margin: 27px 0 30px; color: var(--steel); font-size: 17px; line-height: 1.75; }
.document-stage { position: relative; min-height: 500px; display: grid; place-items: center; perspective: 1600px; }
.stage-halo { position: absolute; width: 76%; aspect-ratio: 1; border-radius: 50%; background: rgba(203, 184, 218, 0.46); filter: blur(42px); }
.stage-sheet { position: relative; z-index: 1; width: min(68%, 370px); aspect-ratio: 0.707; overflow: hidden; border-radius: 3px; background: #fff; box-shadow: 0 42px 80px rgba(47, 31, 57, 0.23), 0 8px 26px rgba(47, 31, 57, 0.14); transform: rotateY(-7deg) rotateX(2deg) rotateZ(1.5deg); transition: transform 500ms cubic-bezier(.2,.75,.25,1), box-shadow 500ms ease; }
.document-stage:hover .stage-sheet { transform: rotateY(-2deg) rotateX(0) rotateZ(0) translateY(-9px); box-shadow: 0 52px 90px rgba(47, 31, 57, 0.28), 0 12px 30px rgba(47, 31, 57, 0.16); }
.stage-sheet > img, .stage-sheet > .generated-cover { width: 100%; height: 100%; object-fit: cover; }
.stage-caption { position: absolute; z-index: 3; right: 1%; bottom: 11%; min-width: 190px; padding: 17px 20px; display: grid; gap: 4px; border: 1px solid rgba(255, 255, 255, 0.7); border-radius: 16px; background: rgba(255, 255, 255, 0.76); box-shadow: var(--shadow-sm); backdrop-filter: blur(18px); }
.stage-caption span { color: var(--purple); font-size: 10px; font-weight: 700; letter-spacing: .16em; }
.stage-caption strong { font-size: 17px; }
.stage-caption i { margin-top: 5px; color: var(--steel); font-size: 12px; font-style: normal; }
.library-section { width: min(calc(100% - 48px), var(--max)); margin: auto; padding: 115px 0 140px; }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 35px; margin-bottom: 42px; }
.section-heading h2 { margin: 0; font-size: clamp(36px, 4vw, 54px); letter-spacing: -0.045em; }
.section-heading p:last-child { margin: 14px 0 0; color: var(--steel); }
.search-box { width: min(100%, 300px); position: relative; }
.search-box span { position: absolute; left: 16px; top: 13px; color: var(--steel); font-size: 20px; }
.search-box input { height: 48px; padding-left: 44px; border: 0; border-radius: 999px; background: #e9e9ed; }
.search-box input:focus { background: #fff; }
.filter-row { margin-bottom: 34px; display: flex; gap: 8px; flex-wrap: wrap; }
.filter-chip { height: 38px; padding: 0 17px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink-soft); background: transparent; font-size: 13px; transition: 160ms ease; }
.filter-chip:hover { border-color: var(--line-strong); background: #fff; }
.filter-chip.is-active { border-color: var(--ink); color: #fff; background: var(--ink); }
.case-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 50px 28px; }
.case-card { min-width: 0; }
.case-cover { position: relative; aspect-ratio: 0.78; display: block; overflow: hidden; border-radius: 20px; background: var(--lavender); box-shadow: 0 12px 35px rgba(25, 20, 29, 0.08); }
.case-cover > img, .case-cover > .generated-cover { width: 100%; height: 100%; object-fit: cover; transition: transform 520ms cubic-bezier(.2,.75,.25,1), filter 300ms ease; }
.case-cover:hover > img, .case-cover:hover > .generated-cover { transform: scale(1.025); filter: brightness(.94); }
.case-open { position: absolute; left: 18px; right: 18px; bottom: 18px; min-height: 48px; padding: 0 17px; display: flex; align-items: center; justify-content: space-between; border: 1px solid rgba(255, 255, 255, 0.65); border-radius: 14px; color: var(--ink); background: rgba(255, 255, 255, 0.82); backdrop-filter: blur(20px); font-size: 13px; font-weight: 600; opacity: 0; transform: translateY(8px); transition: 220ms ease; }
.case-cover:hover .case-open, .case-cover:focus-visible .case-open { opacity: 1; transform: none; }
.case-card-copy { padding: 20px 3px 0; }
.case-meta { display: flex; justify-content: space-between; color: var(--purple); font-size: 11px; font-weight: 650; letter-spacing: .04em; }
.case-meta span:last-child { color: var(--steel); font-weight: 500; }
.case-card h2 { margin: 10px 0 8px; font-size: 23px; line-height: 1.2; letter-spacing: -.025em; }
.case-card h2 a:hover { color: var(--purple); }
.case-card-copy p { margin: 0; color: var(--steel); font-size: 14px; line-height: 1.6; }
.generated-cover { position: relative; padding: 12% 10%; display: flex; flex-direction: column; justify-content: flex-end; overflow: hidden; color: #fff; background: #392343; }
.generated-cover::before { content: ""; position: absolute; width: 85%; aspect-ratio: 1; top: -25%; right: -34%; border: 1px solid rgba(255, 255, 255, .18); border-radius: 50%; box-shadow: 0 0 0 40px rgba(255,255,255,.025), 0 0 0 80px rgba(255,255,255,.018); }
.generated-cover img { position: absolute; top: 10%; left: 10%; width: 19%; filter: brightness(0) invert(1); opacity: .8; }
.generated-cover span { position: relative; margin-bottom: auto; font-size: 9px; font-weight: 700; letter-spacing: .2em; opacity: .68; }
.generated-cover strong { position: relative; font-size: clamp(25px, 3vw, 44px); line-height: 1.12; letter-spacing: -.04em; }
.generated-cover i { position: relative; margin-top: 18px; font-size: 9px; font-style: normal; letter-spacing: .18em; opacity: .6; }
.empty-result { padding: 90px 20px; display: grid; place-items: center; text-align: center; color: var(--steel); }
.empty-result span { font-size: 40px; }
.empty-result h3 { margin: 16px 0 4px; color: var(--ink); font-size: 20px; }
.empty-result p { margin: 0; }

/* Reader */
.reader-main { background: #eeeeF1; }
.preview-banner { padding: 10px 20px; color: #664000; background: #fff1c9; text-align: center; font-size: 12px; font-weight: 600; }
.reader-intro { padding: 62px max(24px, calc((100vw - var(--max)) / 2)) 46px; background: #fff; }
.breadcrumb { margin-bottom: 37px; display: flex; gap: 9px; color: var(--steel); font-size: 12px; }
.breadcrumb a:hover { color: var(--purple); }
.reader-title-row { display: flex; align-items: end; justify-content: space-between; gap: 40px; }
.reader-title-row h1 { margin: 0; font-size: clamp(38px, 5vw, 66px); line-height: 1.05; letter-spacing: -.052em; }
.reader-title-row p:not(.eyebrow) { margin: 17px 0 0; color: var(--steel); font-size: 17px; }
.reader-actions { display: flex; gap: 10px; flex-shrink: 0; }
.reader-stats { margin-top: 40px; padding-top: 19px; border-top: 1px solid var(--line); display: flex; gap: 30px; color: var(--steel); font-size: 12px; }
.pdf-reader { width: min(calc(100% - 32px), 1320px); margin: 0 auto; padding: 24px 0 80px; }
.pdf-reader:fullscreen { width: 100%; height: 100%; padding: 0; overflow: auto; background: #ddddE2; }
.pdf-toolbar { position: sticky; z-index: 30; top: 72px; min-height: 50px; margin: 0 auto 22px; padding: 7px 10px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; border: 1px solid rgba(255,255,255,.7); border-radius: 16px; color: var(--ink-soft); background: rgba(255, 255, 255, .86); box-shadow: var(--shadow-sm); backdrop-filter: blur(20px); font-size: 12px; }
.pdf-reader:fullscreen .pdf-toolbar { top: 12px; width: calc(100% - 24px); }
.pdf-toolbar > div { display: flex; align-items: center; gap: 6px; }
.pdf-toolbar > div:last-child { justify-self: end; }
.pdf-toolbar button { width: 34px; height: 34px; border: 0; border-radius: 9px; background: transparent; }
.pdf-toolbar button:hover { background: rgba(29,29,31,.07); }
.pdf-status { color: var(--steel); }
.pdf-pages { display: grid; gap: 24px; justify-items: center; }
.pdf-page-shell { width: fit-content; max-width: 100%; min-width: min(100%, 300px); min-height: 420px; display: grid; place-items: center; overflow: hidden; background: #fff; box-shadow: 0 12px 32px rgba(20, 20, 24, .13); }
.pdf-page-shell canvas { display: block; max-width: 100%; height: auto !important; }
.page-placeholder { width: min(80vw, 840px); min-height: 520px; display: grid; place-items: center; color: #b1b1b6; background: #fff; }
.page-placeholder span { width: 28px; height: 28px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; font-size: 11px; }
.pdf-loading { min-height: 520px; display: grid; place-items: center; align-content: center; color: var(--steel); }
.pdf-loading span { width: 30px; height: 30px; border: 2px solid #d5cadc; border-top-color: var(--purple); border-radius: 50%; animation: spin .8s linear infinite; }
.pdf-loading p { font-size: 13px; }
.page-error { padding: 80px 30px; color: var(--red); }
.pdf-fallback { max-width: 720px; margin: 60px auto; padding: 60px 30px; border-radius: 24px; background: #fff; text-align: center; }
.pdf-fallback h2 { font-size: 24px; }
.pdf-fallback p { color: var(--steel); }

/* Notices */
.notice { width: min(100%, var(--max)); min-height: 66px; margin: 0 auto 24px; padding: 14px 16px; display: flex; align-items: center; gap: 13px; border: 1px solid var(--line); border-radius: 16px; background: #fff; box-shadow: var(--shadow-sm); }
.notice-dot { width: 9px; height: 9px; flex: 0 0 auto; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 5px rgba(36,138,84,.1); }
.notice-error .notice-dot { background: var(--red); box-shadow: 0 0 0 5px rgba(199,61,76,.1); }
.notice strong { display: block; margin-bottom: 3px; font-size: 13px; }
.notice p { margin: 0; color: var(--steel); font-size: 12px; }
.notice-close { width: 34px; height: 34px; margin-left: auto; border: 0; border-radius: 50%; color: var(--steel); background: transparent; font-size: 20px; }
.notice-close:hover { background: var(--porcelain); }

/* Admin */
.admin-main { width: min(calc(100% - 48px), var(--max)); min-height: calc(100vh - 158px); margin: 0 auto; padding: 78px 0 130px; }
.admin-header { display: flex; align-items: end; justify-content: space-between; gap: 30px; }
.admin-header h1 { margin: 0; font-size: clamp(40px, 5vw, 64px); line-height: 1.05; letter-spacing: -.052em; }
.admin-header p:not(.eyebrow) { margin: 17px 0 0; color: var(--steel); font-size: 16px; }
.admin-tabs { margin: 48px 0 32px; padding: 4px; width: fit-content; display: flex; border-radius: 12px; background: #e8e8eb; }
.admin-tabs a { min-height: 36px; padding: 0 18px; display: inline-flex; align-items: center; justify-content: center; border-radius: 9px; color: var(--ink-soft); font-size: 13px; font-weight: 560; }
.admin-tabs a:hover { color: var(--ink); }
.admin-tabs a.is-active { color: var(--ink); background: #fff; box-shadow: 0 1px 5px rgba(0,0,0,.09); }
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.metric-grid article { min-height: 174px; padding: 27px; display: flex; flex-direction: column; border: 1px solid rgba(29,29,31,.06); border-radius: 22px; background: #fff; }
.metric-grid span { color: var(--steel); font-size: 12px; }
.metric-grid strong { margin: 16px 0 4px; font-size: 45px; line-height: 1; letter-spacing: -.05em; }
.metric-grid p { margin: auto 0 0; color: var(--steel); font-size: 11px; }
.admin-split { margin-top: 16px; display: grid; grid-template-columns: 1.45fr .85fr; gap: 16px; align-items: start; }
.surface, .upload-surface { border: 1px solid rgba(29,29,31,.06); border-radius: 24px; background: #fff; }
.surface { padding: 27px; }
.surface-heading { min-height: 48px; margin-bottom: 20px; display: flex; align-items: start; justify-content: space-between; gap: 20px; }
.surface-heading .eyebrow { margin-bottom: 8px; }
.surface-heading h2 { margin: 0; font-size: 22px; letter-spacing: -.025em; }
.surface-heading h2 span { color: var(--steel); font-size: 14px; font-weight: 500; }
.surface-heading > a { color: var(--purple); font-size: 12px; }
.compact-list { display: grid; }
.compact-list > a { min-height: 74px; display: grid; grid-template-columns: 42px 1fr auto; align-items: center; gap: 13px; border-top: 1px solid var(--line); }
.compact-list > a:first-child { border-top: 0; }
.compact-list > a:hover strong { color: var(--purple); }
.compact-icon { width: 40px; height: 48px; display: grid; place-items: end center; padding-bottom: 8px; border-radius: 5px; color: rgba(255,255,255,.75); background: var(--purple-deep); font-size: 7px; font-weight: 700; letter-spacing: .1em; }
.compact-list strong, .compact-list small { display: block; }
.compact-list strong { margin-bottom: 5px; font-size: 14px; }
.compact-list small { color: var(--steel); font-size: 11px; }
.status { width: fit-content; padding: 5px 8px; display: inline-flex; align-items: center; border-radius: 999px; font-size: 10px; font-weight: 650; white-space: nowrap; }
.status.published { color: #186f43; background: #e7f6ed; }
.status.draft { color: #6f5c21; background: #f8f1d9; }
.status.featured { margin-left: 5px; color: var(--purple); background: var(--lavender); }
.status.disabled { color: #78787e; background: #ededf0; }
.quick-start { display: grid; }
.quick-start > a { min-height: 84px; padding: 15px 0; display: flex; align-items: center; gap: 15px; border-top: 1px solid var(--line); }
.quick-start > a:first-of-type { border-top: 0; }
.quick-start > a > span { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; color: var(--purple); background: var(--lavender); font-size: 19px; }
.quick-start strong { font-size: 13px; }
.quick-start p { margin: 5px 0 0; color: var(--steel); font-size: 11px; }

.upload-surface { margin-bottom: 16px; padding: 34px; display: grid; grid-template-columns: .65fr 1.35fr; gap: clamp(35px, 6vw, 90px); }
.upload-copy h2 { margin: 0; font-size: 31px; letter-spacing: -.035em; }
.upload-copy > p:last-child { margin: 18px 0 0; color: var(--steel); font-size: 13px; line-height: 1.7; }
.upload-form { min-width: 0; }
.drop-zone { min-height: 154px; padding: 25px; display: grid; place-items: center; align-content: center; border: 1px dashed rgba(112,64,151,.38); border-radius: 18px; color: var(--ink-soft); background: rgba(238,232,244,.46); transition: 160ms ease; text-align: center; cursor: pointer; }
.drop-zone:hover, .drop-zone.is-dragging { border-color: var(--purple); background: var(--lavender); transform: translateY(-1px); }
.drop-zone.has-file { border-style: solid; border-color: rgba(36,138,84,.35); background: #edf8f1; }
.drop-zone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop-icon { width: 38px; height: 38px; margin-bottom: 9px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: var(--purple); font-size: 20px; }
.drop-zone strong { font-size: 14px; }
.drop-zone small { margin-top: 7px; color: var(--steel); font-size: 10px; }
.form-grid { margin-top: 22px; display: grid; grid-template-columns: 1fr 1fr; gap: 17px; }
.form-grid .wide { grid-column: 1 / -1; }
.form-actions { margin-top: 20px; display: flex; align-items: center; justify-content: flex-end; gap: 18px; }
.check-control { display: flex !important; grid-template-columns: auto 1fr; align-items: center; gap: 8px !important; color: var(--ink-soft); font-size: 12px !important; cursor: pointer; }
.check-control input { appearance: none; width: 18px; height: 18px; margin: 0; padding: 0; border-radius: 5px; }
.check-control input:checked { border-color: var(--purple); background: var(--purple); box-shadow: inset 0 0 0 4px var(--purple); }
.check-control input:checked::after { content: "✓"; display: block; color: #fff; font-size: 12px; line-height: 16px; text-align: center; }
.upload-progress { margin-top: 20px; }
.upload-progress > span { height: 5px; display: block; overflow: hidden; border-radius: 99px; background: #e7e7ea; }
.upload-progress i { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--purple); transition: width 150ms ease; }
.upload-progress p { margin: 8px 0 0; color: var(--steel); font-size: 11px; }
.upload-progress.has-error i { background: var(--red); }
.table-surface { margin-top: 16px; padding: 28px; }
.small-search { width: 210px; height: 38px; padding-left: 12px; display: flex; align-items: center; gap: 5px; border-radius: 10px; color: var(--steel); background: var(--porcelain); font-size: 15px; }
.small-search input { height: 38px; padding: 0 10px 0 4px; border: 0; background: transparent; font-size: 12px; box-shadow: none; }
.small-search input:focus { box-shadow: none; }
.admin-table-wrap { overflow: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.admin-table th { padding: 12px 14px; color: var(--steel); font-size: 10px; font-weight: 650; letter-spacing: .04em; text-align: left; white-space: nowrap; }
.admin-table td { min-height: 68px; padding: 15px 14px; border-top: 1px solid var(--line); color: var(--ink-soft); vertical-align: middle; }
.admin-table small { display: block; margin-top: 5px; color: var(--steel); font-size: 10px; }
.case-cell, .user-cell { min-width: 220px; display: flex; align-items: center; gap: 12px; }
.case-cell > span { width: 34px; height: 43px; flex: 0 0 auto; display: grid; place-items: end center; padding-bottom: 7px; border-radius: 4px; color: rgba(255,255,255,.7); background: var(--purple-deep); font-size: 6px; font-weight: 700; }
.case-cell strong, .user-cell strong { display: block; max-width: 240px; overflow: hidden; color: var(--ink); text-overflow: ellipsis; white-space: nowrap; }
.table-stat { color: var(--ink); }
.row-menu { position: relative; }
.row-menu summary { width: 34px; height: 32px; display: grid; place-items: center; border-radius: 9px; list-style: none; color: var(--steel); font-weight: 700; letter-spacing: .08em; }
.row-menu summary::-webkit-details-marker { display: none; }
.row-menu summary:hover, .row-menu[open] summary { color: var(--ink); background: var(--porcelain); }
.row-popover { position: absolute; z-index: 20; top: 37px; right: 0; width: 160px; padding: 6px; border: 1px solid var(--line); border-radius: 13px; background: rgba(255,255,255,.97); box-shadow: var(--shadow-md); }
.row-popover a, .row-popover button { width: 100%; min-height: 35px; padding: 0 10px; display: flex; align-items: center; border: 0; border-radius: 8px; color: var(--ink-soft); background: transparent; font-size: 11px; text-align: left; }
.row-popover a:hover, .row-popover button:hover { color: var(--ink); background: var(--porcelain); }
.row-popover form { margin: 0; }
.danger-text { color: var(--red) !important; }
.table-empty, .empty-compact { padding: 45px 20px; color: var(--steel); text-align: center; }
.text-button { border: 0; padding: 5px; color: var(--purple); background: transparent; font-size: 11px; }

.category-layout { grid-template-columns: .75fr 1.25fr; }
.form-surface { position: sticky; top: 82px; }
.stack-form { display: grid; gap: 17px; }
.stack-form .button { margin-top: 3px; }
.category-list { display: grid; }
.category-list article { min-height: 104px; padding: 17px 0; display: grid; grid-template-columns: 46px 1fr auto; align-items: center; gap: 15px; border-top: 1px solid var(--line); }
.category-list article:first-child { border-top: 0; }
.category-symbol { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 13px; color: var(--purple); background: var(--lavender); font-weight: 700; }
.category-list strong { font-size: 14px; }
.category-list p { margin: 6px 0; color: var(--steel); font-size: 11px; }
.category-list small { color: #aaaab0; font-size: 10px; }
.category-actions { display: flex; align-items: center; gap: 4px; }
.category-actions form { margin: 0; }
.users-layout { grid-template-columns: .64fr 1.36fr; }
.generate-password { font-size: 11px; }
.user-cell > span { width: 34px; height: 34px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; color: #fff; background: var(--purple); font-weight: 650; }
.role-badge { padding: 5px 8px; border-radius: 7px; font-size: 10px; font-weight: 650; }
.role-badge.admin { color: var(--purple); background: var(--lavender); }
.role-badge.viewer { color: #4f5e68; background: #edf1f3; }
.form-hint { margin: 0; color: var(--steel); font-size: 11px; line-height: 1.6; }

.modal { width: min(calc(100% - 32px), 580px); max-height: calc(100vh - 40px); padding: 0; overflow: auto; border: 0; border-radius: 24px; color: var(--ink); background: #fff; box-shadow: 0 30px 100px rgba(20,12,26,.32); }
.modal::backdrop { background: rgba(18, 14, 22, .42); backdrop-filter: blur(5px); }
.modal form { margin: 0; }
.modal-head { padding: 25px 27px 19px; display: flex; align-items: start; justify-content: space-between; border-bottom: 1px solid var(--line); }
.modal-head .eyebrow { margin-bottom: 7px; }
.modal-head h2 { margin: 0; font-size: 23px; letter-spacing: -.03em; }
.modal-head > button { width: 34px; height: 34px; border: 0; border-radius: 50%; color: var(--steel); background: var(--porcelain); font-size: 21px; }
.modal-body { padding: 24px 27px; }
.modal-body.form-grid { margin-top: 0; }
.modal-actions { padding: 18px 27px 24px; display: flex; justify-content: flex-end; gap: 10px; }

.activity-surface { padding: 28px; }
.activity-list { display: grid; }
.activity-list article { min-height: 92px; padding: 19px 5px; display: grid; grid-template-columns: 10px 1fr auto; align-items: start; gap: 15px; border-top: 1px solid var(--line); }
.activity-list article:first-child { border-top: 0; }
.activity-dot { width: 8px; height: 8px; margin-top: 5px; border-radius: 50%; background: var(--purple); box-shadow: 0 0 0 5px var(--lavender); }
.activity-main > div { display: flex; align-items: center; gap: 9px; }
.activity-main strong { font-size: 13px; }
.activity-main > div span { padding: 3px 6px; border-radius: 5px; color: var(--purple); background: var(--lavender); font-size: 9px; }
.activity-main p { margin: 8px 0 0; color: var(--steel); font-size: 11px; }
.activity-meta { display: grid; justify-items: end; gap: 4px; }
.activity-meta strong { font-size: 11px; }
.activity-meta span, .activity-meta small { color: var(--steel); font-size: 9px; }

.error-page { min-height: calc(100vh - 158px); padding: 120px 24px; display: grid; place-items: center; align-content: center; text-align: center; }
.error-page h1 { margin: 0; font-size: clamp(40px, 6vw, 72px); letter-spacing: -.055em; }
.error-page > p:not(.eyebrow) { margin: 18px 0 30px; color: var(--steel); }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes float { 50% { transform: translateY(-10px) rotate(2deg); } }

@media (max-width: 1050px) {
  .case-grid { grid-template-columns: repeat(2, 1fr); }
  .library-hero { grid-template-columns: .9fr 1.1fr; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .upload-surface { grid-template-columns: 1fr; gap: 30px; }
  .users-layout, .category-layout { grid-template-columns: 1fr; }
  .form-surface { position: static; }
  .users-layout .form-surface, .category-layout .form-surface { order: -1; }
}

@media (max-width: 760px) {
  .site-header { height: 54px; }
  .nav-shell { width: calc(100% - 28px); }
  .brand img { width: 104px; }
  .brand span { font-size: 11px; }
  .nav-toggle { display: block; }
  .site-nav { position: fixed; top: 54px; left: 0; right: 0; height: auto; max-height: 0; padding: 0 20px; display: grid; gap: 4px; overflow: hidden; background: rgba(250,250,252,.98); opacity: 0; transition: 180ms ease; }
  .site-nav.is-open { max-height: 360px; padding-top: 13px; padding-bottom: 18px; border-bottom: 1px solid var(--line); opacity: 1; }
  .nav-link { height: 44px; padding: 0 12px; }
  .nav-user { min-height: 48px; margin: 6px 0 0; padding: 8px 12px 0; border-left: 0; border-top: 1px solid var(--line); }
  .nav-logout { width: 100%; min-height: 42px; padding: 0 12px; text-align: left; }
  .site-footer { min-height: 120px; padding: 30px 24px; flex-direction: column; justify-content: center; gap: 9px; text-align: center; }

  .login-shell { grid-template-columns: 1fr; }
  .login-story { min-height: 340px; padding: 30px 25px; }
  .login-story .brand span { display: none; }
  .story-copy { left: 25px; right: 25px; bottom: 40px; }
  .story-copy h1 { font-size: clamp(38px, 11vw, 52px); }
  .story-copy > p:last-child { display: none; }
  .story-orbit { width: 100px; height: 100px; top: 24%; right: 10%; }
  .login-panel { min-height: calc(100vh - 340px); padding: 50px 25px 65px; place-items: start center; }

  .library-hero { min-height: auto; padding: 80px 24px 60px; grid-template-columns: 1fr; gap: 55px; }
  .hero-copy { padding: 0; }
  .hero-copy h1 { font-size: clamp(44px, 13vw, 62px); }
  .hero-copy > p:not(.eyebrow) { font-size: 15px; }
  .document-stage { min-height: 400px; }
  .stage-sheet { width: min(68%, 290px); }
  .stage-caption { right: 3%; bottom: 4%; }
  .library-section { width: calc(100% - 40px); padding: 80px 0 95px; }
  .section-heading { align-items: stretch; flex-direction: column; }
  .search-box { width: 100%; }
  .case-grid { grid-template-columns: 1fr; gap: 50px; }
  .case-cover { border-radius: 18px; }
  .case-open { opacity: 1; transform: none; }

  .reader-intro { padding: 38px 20px 30px; }
  .breadcrumb { margin-bottom: 28px; }
  .reader-title-row { align-items: stretch; flex-direction: column; }
  .reader-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .reader-stats { gap: 13px 20px; flex-wrap: wrap; }
  .pdf-reader { width: 100%; padding-top: 12px; }
  .pdf-toolbar { top: 62px; width: calc(100% - 20px); margin-bottom: 13px; grid-template-columns: 1fr 1fr; }
  .pdf-status { display: none !important; }
  .pdf-toolbar > div:last-child { justify-self: end; }
  .pdf-pages { gap: 12px; }
  .pdf-page-shell { min-height: 260px; }
  .page-placeholder { min-height: 400px; }

  .admin-main { width: calc(100% - 32px); padding: 52px 0 90px; }
  .admin-header { align-items: stretch; flex-direction: column; }
  .admin-header .button { align-self: start; }
  .admin-tabs { width: 100%; margin: 36px 0 24px; overflow-x: auto; }
  .admin-tabs a { min-width: max-content; padding: 0 14px; }
  .metric-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .metric-grid article { min-height: 145px; padding: 20px; }
  .metric-grid strong { font-size: 38px; }
  .admin-split { grid-template-columns: 1fr; }
  .surface { padding: 20px; border-radius: 20px; }
  .upload-surface { padding: 22px; border-radius: 20px; }
  .upload-copy h2 { font-size: 27px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .wide { grid-column: auto; }
  .form-actions { align-items: stretch; flex-direction: column; }
  .form-actions .button { width: 100%; }
  .table-surface, .activity-surface { padding: 20px 0; overflow: hidden; }
  .table-surface .surface-heading, .activity-surface .surface-heading { padding: 0 20px; align-items: stretch; flex-direction: column; }
  .small-search { width: 100%; }
  .admin-table th, .admin-table td { padding-left: 12px; padding-right: 12px; }
  .category-list article { grid-template-columns: 42px 1fr; }
  .category-actions { grid-column: 2; }
  .activity-list article { padding-left: 20px; padding-right: 20px; grid-template-columns: 9px 1fr; }
  .activity-meta { grid-column: 2; justify-items: start; grid-auto-flow: column; justify-content: start; }
  .modal-body.form-grid { grid-template-columns: 1fr; }
}

@media (max-width: 430px) {
  .brand span { display: none; }
  .metric-grid { grid-template-columns: 1fr; }
  .reader-actions { grid-template-columns: 1fr; }
  .stage-caption { min-width: 165px; padding: 13px 15px; }
}

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