/* ==========================================================================
   文渊 CiteVault — interface styles
   A warm, editorial research workspace.
   ========================================================================== */

:root {
  --paper: #f2efe7;
  --paper-deep: #e8e2d6;
  --surface: #fffdf8;
  --surface-2: #f8f5ed;
  --surface-3: #f1ece1;
  --ink: #17251f;
  --ink-2: #39473f;
  --muted: #78827a;
  --faint: #9da59d;
  --line: rgba(23, 37, 31, 0.10);
  --line-2: rgba(23, 37, 31, 0.16);
  --forest: #123a31;
  --forest-deep: #0b2a23;
  --forest-light: #1b5a4a;
  --mint: #dfece4;
  --mint-deep: #c6ddd0;
  --gold: #c39a5a;
  --gold-soft: #f0dfc4;
  --clay: #b45f45;
  --clay-soft: #f4ded6;
  --blue: #44658b;
  --shadow-sm: 0 1px 2px rgba(20, 34, 28, 0.04), 0 8px 20px -12px rgba(20, 34, 28, 0.16);
  --shadow-md: 0 24px 60px -26px rgba(10, 27, 21, 0.30), 0 4px 14px -6px rgba(10, 27, 21, 0.10);
  --shadow-lg: 0 40px 100px -30px rgba(8, 24, 18, 0.38);
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;
  --radius-xl: 28px;
  --serif: "Source Han Serif SC", "Noto Serif SC", "Songti SC", "STSong", "SimSun", Georgia, serif;
  --sans: "Aptos", "Segoe UI", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
  --mono: "Cascadia Code", "SFMono-Regular", "Consolas", monospace;
  --sidebar-w: 264px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body.modal-open {
  overflow: hidden;
}

[hidden] {
  display: none !important;
}

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

button {
  border: 0;
  background: none;
  cursor: pointer;
  padding: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

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

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

svg {
  display: block;
}
svg:not(.svg-sprite) {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

::selection {
  background: var(--gold-soft);
  color: var(--forest-deep);
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(23, 37, 31, 0.16);
  border: 3px solid var(--paper);
  border-radius: 8px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(23, 37, 31, 0.28);
}

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

/* --------------------------------------------------------------------------
   Shared atoms
   -------------------------------------------------------------------------- */

.eyebrow {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.20em;
  text-transform: uppercase;
  color: var(--muted);
}

.eyebrow.light {
  color: rgba(241, 234, 217, 0.62);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  height: 42px;
  padding: 0 18px;
  border-radius: 11px;
  border: 1px solid transparent;
  font-size: 13.5px;
  font-weight: 650;
  letter-spacing: 0.01em;
  white-space: nowrap;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}
.btn svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.btn:hover {
  transform: translateY(-1px);
}
.btn:active {
  transform: translateY(0);
}
.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}
.btn-primary {
  background: var(--forest);
  color: #f6f0e3;
  box-shadow: 0 8px 18px -12px rgba(18, 58, 49, 0.7);
}
.btn-primary:hover {
  background: var(--forest-deep);
  box-shadow: 0 12px 24px -14px rgba(18, 58, 49, 0.7);
}
.btn-gold {
  background: var(--gold);
  color: var(--forest-deep);
}
.btn-gold:hover {
  background: #d3aa69;
}
.btn-ghost {
  background: transparent;
  border-color: var(--line-2);
  color: var(--ink-2);
}
.btn-ghost:hover {
  background: var(--surface);
  border-color: rgba(23, 37, 31, 0.28);
}
.btn-soft {
  background: var(--mint);
  color: var(--forest);
}
.btn-soft:hover {
  background: var(--mint-deep);
}
.btn-danger {
  background: var(--clay);
  color: #fff9f4;
}
.btn-danger:hover {
  background: #9f4e37;
}
.btn-quiet-danger {
  color: var(--clay);
  border-color: rgba(180, 95, 69, 0.24);
  background: transparent;
}
.btn-quiet-danger:hover {
  background: var(--clay-soft);
}
.btn-sm {
  height: 34px;
  padding: 0 12px;
  border-radius: 9px;
  font-size: 12.5px;
}
.btn-block {
  width: 100%;
  height: 50px;
  font-size: 14px;
}
.btn .btn-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn.is-loading {
  pointer-events: none;
}
.btn.is-loading > * {
  opacity: 0.25;
}
.btn.is-loading::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.btn-ghost.is-loading::after,
.btn-soft.is-loading::after {
  border-color: rgba(23, 37, 31, 0.2);
  border-top-color: var(--forest);
}
.btn.is-loading {
  position: relative;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid transparent;
  color: var(--muted);
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}
.icon-btn svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-btn:hover {
  background: var(--surface-2);
  color: var(--ink);
  border-color: var(--line);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.field > span:first-child {
  font-size: 12.5px;
  font-weight: 650;
  color: var(--ink-2);
  letter-spacing: 0.01em;
}
.field small {
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.5;
}
.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.input-icon {
  position: absolute;
  left: 14px;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--faint);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
  transition: stroke 0.18s ease;
}
.input-wrap:focus-within .input-icon {
  stroke: var(--forest);
}
.input-wrap input,
.input,
.textarea,
.select {
  width: 100%;
  border: 1px solid var(--line-2);
  background: var(--surface);
  border-radius: 11px;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
.input-wrap input {
  height: 52px;
  padding: 0 46px 0 43px;
  font-size: 14px;
}
.input,
.select {
  height: 42px;
  padding: 0 12px;
  font-size: 13.5px;
}
.textarea {
  padding: 12px 14px;
  min-height: 120px;
  resize: vertical;
  font-size: 13.5px;
  line-height: 1.75;
}
.input-wrap input::placeholder,
.input::placeholder,
.textarea::placeholder {
  color: var(--faint);
}
.input-wrap input:focus,
.input:focus,
.textarea:focus,
.select:focus {
  border-color: var(--forest);
  box-shadow: 0 0 0 3px rgba(18, 58, 49, 0.09);
  background: #fffefb;
}
.password-toggle {
  position: absolute;
  right: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  color: var(--faint);
}
.password-toggle svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.password-toggle:hover {
  background: var(--surface-2);
  color: var(--ink-2);
}

.form-error {
  min-height: 20px;
  margin: 2px 0 0;
  color: var(--clay);
  font-size: 12.5px;
  line-height: 1.5;
}
.form-error:empty {
  min-height: 10px;
}
.form-success {
  color: var(--forest-light);
  font-size: 12.5px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--ink-2);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.badge.dot::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}
.badge-gold {
  background: var(--gold-soft);
  color: #7c5c2c;
}
.badge-green {
  background: var(--mint);
  color: var(--forest-light);
}
.badge-clay {
  background: var(--clay-soft);
  color: var(--clay);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  flex: 0 0 auto;
}
.status-dot.unread { background: var(--faint); }
.status-dot.reading { background: var(--gold); box-shadow: 0 0 0 3px rgba(195, 154, 90, 0.15); }
.status-dot.read { background: var(--forest-light); }

.spinner {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2.5px solid rgba(18, 58, 49, 0.15);
  border-top-color: var(--forest);
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

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

@keyframes fade-up {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes card-in {
  from { opacity: 0; transform: translateY(8px) scale(0.995); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slide-in {
  from { transform: translateX(28px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* --------------------------------------------------------------------------
   Brand
   -------------------------------------------------------------------------- */

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--gold);
  color: var(--forest-deep);
  flex: 0 0 auto;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.24);
}
.brand-mark svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.55;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1;
}
.brand-text strong {
  font-family: var(--serif);
  font-size: 23px;
  font-weight: 700;
  letter-spacing: 0.08em;
}
.brand-text small {
  margin-top: 5px;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.25em;
  opacity: 0.55;
}
.brand-light {
  color: #f4eddd;
}

/* --------------------------------------------------------------------------
   Login
   -------------------------------------------------------------------------- */

.login-shell {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1.03fr) minmax(0, 0.97fr);
  background: var(--paper);
}

.login-brand {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  min-height: 100dvh;
  background:
    radial-gradient(90% 70% at 80% 18%, rgba(58, 122, 101, 0.32), transparent 60%),
    radial-gradient(80% 60% at 10% 100%, rgba(195, 154, 90, 0.12), transparent 60%),
    linear-gradient(150deg, #174437 0%, #0e332a 52%, #09261f 100%);
  color: #f4eddd;
}
.login-brand::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(244, 237, 221, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(244, 237, 221, 0.035) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: radial-gradient(80% 80% at 40% 30%, #000 25%, transparent 78%);
}
.login-brand::after {
  content: "";
  position: absolute;
  left: -18%;
  bottom: -30%;
  width: 72%;
  aspect-ratio: 1;
  border: 1px solid rgba(195, 154, 90, 0.18);
  border-radius: 50%;
  z-index: -1;
}

.login-brand-inner {
  position: relative;
  z-index: 3;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: clamp(28px, 4.5vw, 58px);
  max-width: 760px;
}

.brand-copy {
  margin-top: clamp(64px, 13vh, 136px);
  max-width: 590px;
  animation: fade-up 0.7s 0.05s both;
}
.brand-copy h1 {
  margin-top: 22px;
  font-family: var(--serif);
  font-size: clamp(38px, 4.2vw, 62px);
  font-weight: 600;
  line-height: 1.26;
  letter-spacing: -0.015em;
}
.brand-copy h1 em {
  font-style: normal;
  color: #d9b678;
}
.brand-lead {
  margin-top: 28px;
  max-width: 470px;
  color: rgba(244, 237, 221, 0.66);
  font-size: 14px;
  line-height: 1.95;
}

.brand-features {
  margin-top: auto;
  padding-top: 54px;
  max-width: 560px;
  display: flex;
  flex-direction: column;
  animation: fade-up 0.7s 0.18s both;
}
.feature {
  display: flex;
  align-items: baseline;
  gap: 18px;
  padding: 15px 0;
  border-top: 1px solid rgba(244, 237, 221, 0.12);
}
.feature:last-child {
  border-bottom: 1px solid rgba(244, 237, 221, 0.12);
}
.feature-no {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--gold);
  opacity: 0.8;
}
.feature strong {
  display: block;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.03em;
}
.feature p {
  margin-top: 2px;
  color: rgba(244, 237, 221, 0.48);
  font-size: 11.5px;
}

.brand-foot {
  display: flex;
  justify-content: space-between;
  margin-top: 34px;
  color: rgba(244, 237, 221, 0.34);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.login-art {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}
.orbit {
  position: absolute;
  border: 1px solid rgba(244, 237, 221, 0.09);
  border-radius: 50%;
}
.orbit-a {
  width: 560px;
  height: 560px;
  right: -210px;
  bottom: -170px;
}
.orbit-b {
  width: 430px;
  height: 430px;
  right: -145px;
  bottom: -105px;
  border-color: rgba(195, 154, 90, 0.15);
}
.orbit-c {
  width: 300px;
  height: 300px;
  right: -80px;
  bottom: -40px;
}
.orbit-b::before,
.orbit-b::after {
  content: "";
  position: absolute;
  width: 6px;
  height: 6px;
  background: var(--gold);
  border-radius: 50%;
  box-shadow: 0 0 16px rgba(195, 154, 90, 0.6);
}
.orbit-b::before { top: 36px; left: 74px; }
.orbit-b::after { right: 62px; bottom: 40px; opacity: 0.5; }

.art-card {
  position: absolute;
  border: 1px solid rgba(244, 237, 221, 0.14);
  background: rgba(9, 38, 31, 0.54);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: 0 24px 60px -30px rgba(0, 0, 0, 0.6);
}
.art-card p {
  color: rgba(244, 237, 221, 0.45);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.art-card strong {
  display: block;
  margin-top: 5px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.art-card-a {
  right: clamp(24px, 5vw, 78px);
  bottom: 27%;
  width: 205px;
  transform: rotate(-3deg);
}
.art-card-b {
  right: clamp(100px, 12vw, 180px);
  bottom: 14%;
  width: 160px;
  transform: rotate(2.5deg);
}
.art-card-b strong {
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: 0;
}
.art-card-b strong small {
  font-family: var(--sans);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.08em;
  opacity: 0.45;
}
.art-dot {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 4px rgba(195, 154, 90, 0.11);
}
.art-line {
  display: block;
  width: 26px;
  height: 1px;
  margin-bottom: 9px;
  background: var(--gold);
}

.login-panel {
  position: relative;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 38px clamp(24px, 6vw, 96px);
  background:
    radial-gradient(70% 60% at 100% 0%, rgba(195, 154, 90, 0.10), transparent 60%),
    var(--paper);
}
.login-panel-inner {
  width: min(100%, 420px);
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}
.login-mobile-brand {
  display: none;
  margin-bottom: 34px;
}
.login-card {
  min-width: 0;
  animation: fade-up 0.6s 0.1s both;
}
.login-card h2 {
  margin-top: 15px;
  font-family: var(--serif);
  font-size: clamp(32px, 3vw, 40px);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.3;
}
.login-sub {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}
#loginForm {
  margin-top: 36px;
  display: flex;
  flex-direction: column;
  gap: 17px;
  min-width: 0;
}
#loginForm .field > span:first-child {
  font-size: 12px;
  letter-spacing: 0.02em;
}
#loginForm .btn-block {
  margin-top: 7px;
}
#loginForm .btn svg {
  transition: transform 0.18s ease;
}
#loginForm .btn:hover svg {
  transform: translateX(2px);
}
.login-divider {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 30px 0 18px;
  color: var(--faint);
  font-size: 10.5px;
  text-align: center;
}
.login-divider::before,
.login-divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line);
}
.login-note {
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.75;
  text-align: center;
}
.login-copyright {
  margin-top: 54px;
  color: var(--faint);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  text-align: center;
}
.login-panel.shake {
  animation: shake 0.36s ease;
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* --------------------------------------------------------------------------
   App shell
   -------------------------------------------------------------------------- */

.app-shell {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 24px 17px 18px;
  background:
    radial-gradient(120% 50% at 0% 0%, rgba(57, 120, 99, 0.24), transparent 55%),
    linear-gradient(168deg, #153f34 0%, #0e3028 48%, #0a2921 100%);
  color: #efe8d8;
  overflow-y: auto;
  scrollbar-width: none;
}
.sidebar::-webkit-scrollbar { display: none; }
.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
}
.sidebar-close {
  display: none;
  color: rgba(244, 237, 221, 0.7);
  width: 34px;
  height: 34px;
  border-radius: 8px;
}
.sidebar-close svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
}
.sidebar-close:hover { background: rgba(255, 255, 255, 0.08); }

.sidebar-add {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  height: 46px;
  margin: 25px 0 21px;
  padding: 0 13px;
  border-radius: 11px;
  background: var(--gold);
  color: var(--forest-deep);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.02em;
  box-shadow: 0 10px 26px -16px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.32);
  transition: background 0.18s ease, transform 0.18s ease;
}
.sidebar-add:hover {
  background: #d4ab6c;
  transform: translateY(-1px);
}
.sidebar-add svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}
.sidebar-add kbd {
  margin-left: auto;
  display: grid;
  place-items: center;
  width: 21px;
  height: 21px;
  border-radius: 5px;
  border: 1px solid rgba(11, 42, 35, 0.22);
  background: rgba(11, 42, 35, 0.08);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.side-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  height: 43px;
  padding: 0 13px;
  border-radius: 10px;
  color: rgba(239, 232, 216, 0.66);
  font-size: 13px;
  font-weight: 500;
  transition: background 0.18s ease, color 0.18s ease;
}
.side-link svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.85;
}
.side-link:hover {
  background: rgba(255, 255, 255, 0.055);
  color: #f5eddc;
}
.side-link.active {
  background: rgba(246, 240, 227, 0.10);
  color: #fff9ec;
}
.side-link.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 2px;
  border-radius: 2px;
  background: var(--gold);
}
.nav-count {
  margin-left: auto;
  min-width: 23px;
  height: 20px;
  padding: 0 6px;
  display: inline-grid;
  place-items: center;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.07);
  color: rgba(239, 232, 216, 0.55);
  font-family: var(--mono);
  font-size: 10px;
}
.side-link.active .nav-count {
  background: rgba(195, 154, 90, 0.18);
  color: var(--gold-soft);
}

.side-section {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid rgba(244, 237, 221, 0.09);
}
.side-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  margin-bottom: 10px;
  color: rgba(239, 232, 216, 0.36);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.17em;
  text-transform: uppercase;
}
.side-mini-link {
  font-size: 9.5px;
  color: rgba(239, 232, 216, 0.42);
  letter-spacing: 0.06em;
}
.side-mini-link:hover { color: var(--gold); }
.side-categories {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.side-cat {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 33px;
  padding: 0 12px;
  border-radius: 8px;
  color: rgba(239, 232, 216, 0.55);
  font-size: 11.5px;
  transition: background 0.18s ease, color 0.18s ease;
}
.side-cat:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #f5eddc;
}
.side-cat.active {
  color: var(--gold-soft);
  background: rgba(255, 255, 255, 0.05);
}
.side-cat .cat-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex: 0 0 auto;
  opacity: 0.85;
}
.side-cat .cat-count {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 9.5px;
  opacity: 0.45;
}
.sidebar-spacer { flex: 1; min-height: 24px; }

.side-user {
  padding: 15px 6px 2px;
  border-top: 1px solid rgba(244, 237, 221, 0.09);
}
.user-summary {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 6px;
  border-radius: 10px;
  color: inherit;
  text-align: left;
  transition: background 0.18s ease;
}
.user-summary:hover { background: rgba(255, 255, 255, 0.055); }
.avatar {
  display: inline-grid;
  place-items: center;
  width: 35px;
  height: 35px;
  border-radius: 50%;
  background: linear-gradient(145deg, #e0c18d, #b78a4b);
  color: var(--forest-deep);
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 700;
  flex: 0 0 auto;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
}
.user-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.35;
}
.user-meta strong {
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 249, 236, 0.92);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-meta small {
  margin-top: 2px;
  font-size: 9.5px;
  color: rgba(239, 232, 216, 0.38);
  letter-spacing: 0.04em;
}
.user-chevron {
  width: 14px;
  height: 14px;
  margin-left: auto;
  fill: none;
  stroke: rgba(239, 232, 216, 0.35);
  stroke-width: 1.8;
  stroke-linecap: round;
}
.side-user-actions {
  display: flex;
  gap: 4px;
  padding: 5px 4px 0;
}
.side-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 7px;
  color: rgba(239, 232, 216, 0.38);
  transition: background 0.18s ease, color 0.18s ease;
}
.side-icon svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.side-icon:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #f5eddc;
}

.sidebar-scrim {
  display: none;
}

.main {
  min-width: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(70% 40% at 100% 0%, rgba(195, 154, 90, 0.075), transparent 70%),
    var(--paper);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  min-height: 76px;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 clamp(20px, 3vw, 40px);
  background: rgba(242, 239, 231, 0.86);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 165px;
}
.mobile-menu {
  display: none;
  width: 38px;
  height: 38px;
  border-radius: 9px;
  color: var(--ink-2);
}
.mobile-menu svg {
  width: 21px;
  height: 21px;
  margin: auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}
.mobile-menu:hover { background: var(--surface-2); }
.topbar-title {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.topbar-kicker {
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.19em;
  color: var(--faint);
}
.topbar-title > span:last-child {
  margin-top: 3px;
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 650;
  letter-spacing: 0.02em;
}
.global-search {
  position: relative;
  display: flex;
  align-items: center;
  width: min(360px, 32vw);
  height: 41px;
  margin-left: auto;
  border: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.72);
  border-radius: 11px;
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}
.global-search:focus-within {
  border-color: rgba(18, 58, 49, 0.4);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(18, 58, 49, 0.06);
}
.global-search > svg {
  width: 17px;
  height: 17px;
  margin-left: 13px;
  fill: none;
  stroke: var(--faint);
  stroke-width: 1.7;
  stroke-linecap: round;
  flex: 0 0 auto;
}
.global-search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0 8px 0 9px;
  border: 0;
  background: transparent;
  outline: 0;
  font-size: 12.5px;
}
.global-search input::placeholder { color: var(--faint); }
.global-search kbd {
  margin-right: 10px;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 10px;
  background: var(--surface-2);
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.topbar-btn {
  border-color: var(--line);
  background: rgba(255, 253, 248, 0.5);
}
.avatar-button {
  width: 36px;
  height: 36px;
  border: 0;
  cursor: pointer;
  font-size: 14px;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.avatar-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 0 3px rgba(195, 154, 90, 0.18);
}

.page {
  width: 100%;
  max-width: 1540px;
  margin: 0 auto;
  padding: clamp(26px, 3.4vw, 42px) clamp(20px, 3vw, 40px) 70px;
  flex: 1;
  animation: fade-up 0.4s ease both;
}
.page-loading {
  min-height: 52vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--muted);
  font-size: 12.5px;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}
.page-head-copy { min-width: 0; }
.page-head h1 {
  margin-top: 8px;
  font-family: var(--serif);
  font-size: clamp(30px, 3.2vw, 42px);
  font-weight: 600;
  line-height: 1.24;
  letter-spacing: -0.018em;
}
.page-head h1 em {
  font-style: normal;
  color: var(--forest-light);
}
.page-lead {
  margin-top: 9px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.7;
}
.page-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 0 0 auto;
  padding-top: 10px;
}
.page-actions .btn svg {
  width: 16px;
  height: 16px;
}

/* --------------------------------------------------------------------------
   Dashboard
   -------------------------------------------------------------------------- */

.dashboard-top {
  display: grid;
  grid-template-columns: minmax(0, 1.58fr) minmax(300px, 0.82fr);
  gap: 18px;
  margin-bottom: 18px;
}

.pulse-card {
  position: relative;
  min-height: 292px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  isolation: isolate;
  padding: clamp(22px, 2.6vw, 32px);
  border-radius: var(--radius-lg);
  color: #f4eddd;
  background:
    radial-gradient(80% 110% at 100% 0%, rgba(76, 139, 114, 0.52), transparent 55%),
    linear-gradient(135deg, #19483b 0%, #10372d 55%, #0b2b23 100%);
  box-shadow: 0 25px 55px -30px rgba(9, 34, 27, 0.55);
}
.pulse-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(244, 237, 221, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(244, 237, 221, 0.035) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: linear-gradient(110deg, transparent 20%, #000 100%);
}
.pulse-card::after {
  content: "";
  position: absolute;
  width: 340px;
  height: 340px;
  right: -130px;
  top: -200px;
  border: 1px solid rgba(195, 154, 90, 0.22);
  border-radius: 50%;
  z-index: -1;
}
.pulse-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.pulse-season {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.14em;
  color: rgba(244, 237, 221, 0.40);
}
.pulse-main {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-top: clamp(20px, 3vh, 32px);
}
.pulse-label {
  color: rgba(244, 237, 221, 0.52);
  font-size: 11.5px;
  letter-spacing: 0.06em;
}
.pulse-number {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 6px;
  font-family: var(--serif);
  font-size: clamp(58px, 6vw, 82px);
  font-weight: 600;
  line-height: 0.95;
  letter-spacing: -0.03em;
}
.pulse-number span {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: rgba(244, 237, 221, 0.46);
}
.pulse-sub {
  margin-top: 13px;
  color: rgba(244, 237, 221, 0.48);
  font-size: 11.5px;
}
.pulse-sub b {
  color: #e3c68f;
  font-weight: 650;
}
.read-ring {
  --pct: 0%;
  position: relative;
  width: 96px;
  height: 96px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: conic-gradient(var(--gold) var(--pct), rgba(244, 237, 221, 0.11) 0);
  display: grid;
  place-items: center;
}
.read-ring::before {
  content: "";
  position: absolute;
  inset: 7px;
  border-radius: 50%;
  background: #123a30;
  box-shadow: inset 0 0 0 1px rgba(244, 237, 221, 0.06);
}
.read-ring-inner {
  position: relative;
  z-index: 1;
  text-align: center;
  line-height: 1.2;
}
.read-ring-inner strong {
  display: block;
  font-family: var(--serif);
  font-size: 23px;
  font-weight: 600;
}
.read-ring-inner small {
  display: block;
  margin-top: 2px;
  color: rgba(244, 237, 221, 0.40);
  font-size: 8.5px;
  letter-spacing: 0.10em;
}
.pulse-chart {
  display: flex;
  align-items: flex-end;
  gap: 7px;
  height: 56px;
  margin-top: auto;
  padding-top: 20px;
}
.pulse-bar-col {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 5px;
}
.pulse-bar {
  width: 100%;
  max-width: 34px;
  height: max(3px, var(--h, 0%));
  border-radius: 3px 3px 1px 1px;
  background: rgba(244, 237, 221, 0.14);
  transition: background 0.18s ease;
}
.pulse-bar-col.current .pulse-bar {
  background: linear-gradient(180deg, #d9b678, #b98c4b);
}
.pulse-bar-col span {
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: 0.04em;
  color: rgba(244, 237, 221, 0.30);
}
.pulse-bar-col.current span { color: rgba(227, 198, 143, 0.70); }
.pulse-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(244, 237, 221, 0.10);
  color: rgba(244, 237, 221, 0.46);
  font-size: 10.5px;
}
.pulse-statuses {
  display: flex;
  align-items: center;
  gap: 15px;
  flex-wrap: wrap;
}
.pulse-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.pulse-status b {
  color: rgba(255, 249, 236, 0.86);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
}
.pulse-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #e2c58e;
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
}
.pulse-link svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  transition: transform 0.18s ease;
}
.pulse-link:hover svg { transform: translateX(3px); }

.reading-panel {
  display: flex;
  flex-direction: column;
  padding: 24px 22px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.reading-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.reading-head .eyebrow { font-size: 9.5px; white-space: nowrap; }
.reading-head a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 600;
  white-space: nowrap;
  flex: 0 0 auto;
}
.reading-head a:hover { color: var(--forest); }
.reading-head a svg { width: 13px; height: 13px; }
.reading-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 14px;
}
.reading-item {
  display: block;
  padding: 13px 0;
  border-top: 1px solid var(--line);
  cursor: pointer;
  transition: opacity 0.18s ease;
}
.reading-item:hover { opacity: 0.7; }
.reading-item:first-child { border-top: 0; padding-top: 5px; }
.reading-item-cat {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
.reading-item-cat i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--gold);
}
.reading-item h3 {
  margin-top: 5px;
  font-family: var(--serif);
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.reading-item p {
  margin-top: 4px;
  color: var(--faint);
  font-size: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.reading-progress {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--faint);
  font-size: 9.5px;
}
.reading-progress .track {
  flex: 1;
  height: 3px;
  border-radius: 2px;
  background: var(--surface-3);
  overflow: hidden;
}
.reading-progress .track i {
  display: block;
  height: 100%;
  width: var(--p, 0%);
  background: var(--gold);
}
.reading-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 150px;
  text-align: center;
  color: var(--muted);
}
.reading-empty svg {
  width: 25px;
  height: 25px;
  fill: none;
  stroke: var(--faint);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.reading-empty p { font-size: 11.5px; }
.reading-empty small { color: var(--faint); font-size: 10px; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.stat-card {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 13px;
  padding: 19px 19px 17px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  text-align: left;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  animation: fade-up 0.45s both;
  animation-delay: calc(var(--i, 0) * 45ms);
}
.stat-card:hover {
  transform: translateY(-2px);
  border-color: rgba(18, 58, 49, 0.20);
  box-shadow: 0 12px 30px -20px rgba(18, 58, 49, 0.35);
}
.stat-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--ink-2);
  flex: 0 0 auto;
}
.stat-icon svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.stat-icon.gold { background: var(--gold-soft); color: #8f682f; }
.stat-icon.green { background: var(--mint); color: var(--forest-light); }
.stat-icon.clay { background: var(--clay-soft); color: var(--clay); }
.stat-body { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; }
.stat-label {
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 550;
}
.stat-value {
  margin-top: 1px;
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 600;
  line-height: 1.2;
}
.stat-note {
  margin-top: 3px;
  color: var(--faint);
  font-size: 9.5px;
}
.stat-arrow {
  position: absolute;
  right: 15px;
  top: 17px;
  width: 15px;
  height: 15px;
  fill: none;
  stroke: var(--faint);
  stroke-width: 1.7;
  stroke-linecap: round;
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.stat-card:hover .stat-arrow {
  opacity: 1;
  transform: translateX(0);
}

.dashboard-bottom {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(280px, 0.85fr);
  gap: 18px;
  align-items: start;
}
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 23px 24px 17px;
}
.panel-head h2 {
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.panel-head p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10.5px;
}
.panel-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
  color: var(--forest);
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
}
.panel-link svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
}
.panel-link:hover { color: var(--forest-light); }
.recent-list {
  border-top: 1px solid var(--line);
}
.recent-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 15px 24px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background 0.16s ease;
}
.recent-row:last-child { border-bottom: 0; }
.recent-row:hover { background: rgba(241, 236, 225, 0.45); }
.recent-main { min-width: 0; }
.recent-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.recent-title i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex: 0 0 auto;
}
.recent-title h3 {
  font-family: var(--serif);
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.45;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.recent-meta {
  margin-top: 4px;
  padding-left: 14px;
  color: var(--faint);
  font-size: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.recent-side {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}
.recent-status {
  color: var(--muted);
  font-size: 9.5px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.recent-star {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  color: var(--faint);
}
.recent-star svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linejoin: round;
}
.recent-star.active {
  color: var(--gold);
}
.recent-star.active svg { fill: var(--gold); stroke: var(--gold); }
.recent-star:hover { background: var(--surface-2); }

.side-stack {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.category-panel { padding-bottom: 18px; }
.category-bars {
  display: flex;
  flex-direction: column;
  gap: 11px;
  padding: 0 24px;
}
.category-bar-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 3px 12px;
  align-items: center;
  cursor: pointer;
}
.category-bar-row:hover .category-bar-label { color: var(--forest); }
.category-bar-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 10.5px;
  color: var(--ink-2);
  transition: color 0.16s ease;
}
.category-bar-label i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex: 0 0 auto;
}
.category-bar-count {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--faint);
}
.category-bar-track {
  grid-column: 1 / -1;
  height: 4px;
  border-radius: 2px;
  background: var(--surface-3);
  overflow: hidden;
}
.category-bar-track i {
  display: block;
  height: 100%;
  width: var(--w, 0%);
  border-radius: 2px;
  background: var(--cat);
  opacity: 0.78;
  transition: width 0.5s ease;
}
.tag-panel { padding-bottom: 22px; }
.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 24px;
}
.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 27px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 10px;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}
.tag-chip span {
  font-family: var(--mono);
  font-size: 8.5px;
  color: var(--faint);
}
.tag-chip:hover {
  background: var(--forest);
  border-color: var(--forest);
  color: #f5eddc;
}
.tag-chip:hover span { color: rgba(244, 237, 221, 0.55); }
.panel-empty {
  padding: 14px 24px 6px;
  color: var(--faint);
  font-size: 11px;
}

/* --------------------------------------------------------------------------
   Library
   -------------------------------------------------------------------------- */

.library-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
  margin-bottom: 18px;
}
.lib-search {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1 1 240px;
  min-width: 210px;
  max-width: 430px;
  height: 40px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: var(--surface);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.lib-search:focus-within {
  border-color: var(--forest);
  box-shadow: 0 0 0 3px rgba(18, 58, 49, 0.07);
}
.lib-search svg {
  width: 16px;
  height: 16px;
  margin-left: 12px;
  fill: none;
  stroke: var(--faint);
  stroke-width: 1.7;
  stroke-linecap: round;
  flex: 0 0 auto;
}
.lib-search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0 10px;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 12px;
}
.lib-search input::placeholder { color: var(--faint); }
.segmented {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 40px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 253, 248, 0.54);
}
.segmented button {
  height: 32px;
  padding: 0 11px;
  border-radius: 7px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.16s ease, color 0.16s ease;
}
.segmented button:hover { color: var(--ink); }
.segmented button.active {
  background: var(--surface);
  color: var(--forest);
  box-shadow: 0 1px 3px rgba(20, 34, 28, 0.09);
}
.select-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.select-wrap::after {
  content: "";
  position: absolute;
  right: 12px;
  width: 6px;
  height: 6px;
  border-right: 1.5px solid var(--faint);
  border-bottom: 1.5px solid var(--faint);
  transform: rotate(45deg) translateY(-2px);
  pointer-events: none;
}
.select-wrap select {
  appearance: none;
  -webkit-appearance: none;
  height: 40px;
  min-width: 112px;
  padding: 0 32px 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 253, 248, 0.6);
  color: var(--ink-2);
  font-size: 10.5px;
  font-weight: 600;
  outline: none;
  cursor: pointer;
}
.select-wrap select:focus { border-color: var(--forest); }
.view-switch {
  display: inline-flex;
  gap: 2px;
  height: 40px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 253, 248, 0.54);
  margin-left: auto;
}
.view-switch button {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 7px;
  color: var(--faint);
}
.view-switch button svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
}
.view-switch button.active {
  background: var(--surface);
  color: var(--forest);
  box-shadow: 0 1px 3px rgba(20, 34, 28, 0.09);
}

.active-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin: -4px 0 18px;
}
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 27px;
  padding: 0 6px 0 10px;
  border-radius: 7px;
  background: var(--mint);
  color: var(--forest);
  font-size: 10px;
  font-weight: 600;
}
.filter-chip button {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  color: var(--forest);
  opacity: 0.55;
}
.filter-chip button:hover { opacity: 1; background: rgba(18, 58, 49, 0.08); }
.filter-chip button svg {
  width: 11px;
  height: 11px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}
.clear-filters {
  color: var(--muted);
  font-size: 10px;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.clear-filters:hover { color: var(--ink); }
.library-summary {
  margin-left: auto;
  color: var(--faint);
  font-size: 10px;
  font-family: var(--mono);
  letter-spacing: 0.03em;
}

.lit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(285px, 1fr));
  gap: 15px;
}
.lit-card {
  --cat: var(--forest-light);
  position: relative;
  min-height: 248px;
  display: flex;
  flex-direction: column;
  padding: 20px 20px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  animation: card-in 0.38s both;
  animation-delay: calc(var(--i, 0) * 28ms);
}
.lit-card:hover {
  transform: translateY(-3px);
  border-color: rgba(18, 58, 49, 0.22);
  box-shadow: 0 20px 44px -28px rgba(18, 58, 49, 0.42);
}
.lit-card::before {
  content: "";
  position: absolute;
  left: 20px;
  right: 20px;
  top: 0;
  height: 2px;
  border-radius: 0 0 2px 2px;
  background: var(--cat);
  opacity: 0.66;
}
.lit-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.cat-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 7px;
  border-radius: 5px;
  background: color-mix(in srgb, var(--cat) 11%, transparent);
  color: var(--cat);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.cat-pill i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
}
.star-btn {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  margin: -4px -4px 0 0;
  border-radius: 6px;
  color: var(--faint);
  transition: color 0.16s ease, background 0.16s ease;
}
.star-btn svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linejoin: round;
}
.star-btn:hover { background: var(--surface-2); color: var(--gold); }
.star-btn.active { color: var(--gold); }
.star-btn.active svg { fill: var(--gold); stroke: var(--gold); }
.lit-title {
  margin-top: 13px;
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.55;
  letter-spacing: -0.005em;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.lit-authors {
  margin-top: 8px;
  color: var(--muted);
  font-size: 10.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lit-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 5px;
  color: var(--faint);
  font-size: 9.5px;
  min-width: 0;
}
.lit-meta span:first-child {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lit-meta i {
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: var(--faint);
  flex: 0 0 auto;
}
.lit-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 13px;
}
.lit-tag {
  display: inline-flex;
  align-items: center;
  height: 21px;
  padding: 0 7px;
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 8.5px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.lit-tag.more { background: transparent; color: var(--faint); padding-left: 1px; }
.lit-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 9px;
}
.lit-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 9px;
  color: var(--muted);
}
.lit-foot time { font-family: var(--mono); font-size: 8.5px; letter-spacing: 0.02em; }

.lit-table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.lit-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
.lit-table th {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-align: left;
  white-space: nowrap;
}
.lit-table th:nth-child(1) { width: 42px; }
.lit-table th:nth-child(3) { width: 112px; }
.lit-table th:nth-child(4) { width: 105px; }
.lit-table th:nth-child(5) { width: 76px; }
.lit-table th:nth-child(6) { width: 92px; }
.lit-table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.lit-table tr:last-child td { border-bottom: 0; }
.lit-table tbody tr {
  cursor: pointer;
  transition: background 0.16s ease;
}
.lit-table tbody tr:hover { background: rgba(241, 236, 225, 0.42); }
.lit-table tbody tr.selected { background: rgba(223, 236, 228, 0.45); }
.table-title {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}
.table-title .cat-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex: 0 0 auto;
}
.table-title-main { min-width: 0; }
.table-title h3 {
  font-family: var(--serif);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.45;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.table-title p {
  margin-top: 2px;
  color: var(--faint);
  font-size: 9.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.table-tags {
  display: flex;
  gap: 3px;
  margin-top: 4px;
}
.table-tags span {
  padding: 0 5px;
  border-radius: 3px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 8px;
  line-height: 16px;
}
.table-link {
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.table-year {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-2);
}
.table-action {
  display: flex;
  justify-content: flex-end;
}
.check {
  appearance: none;
  -webkit-appearance: none;
  width: 15px;
  height: 15px;
  border: 1px solid var(--line-2);
  border-radius: 4px;
  background: var(--surface);
  cursor: pointer;
  position: relative;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.check:checked {
  background: var(--forest);
  border-color: var(--forest);
}
.check:checked::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 1px;
  width: 4px;
  height: 8px;
  border-right: 1.8px solid #fff;
  border-bottom: 1.8px solid #fff;
  transform: rotate(42deg);
}

.bulk-bar {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  margin-bottom: 12px;
  border: 1px solid rgba(18, 58, 49, 0.18);
  border-radius: 11px;
  background: var(--mint);
  color: var(--forest);
  font-size: 11px;
  animation: fade-up 0.22s ease both;
}
.bulk-bar strong { font-family: var(--mono); font-size: 10px; }
.bulk-spacer { flex: 1; }

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 28px;
  color: var(--muted);
  font-size: 10.5px;
}
.page-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 10px;
  font-weight: 600;
}
.page-btn:hover:not(:disabled) { border-color: var(--line-2); background: var(--surface-2); }
.page-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.page-btn svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
}
.page-indicator {
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--faint);
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 360px;
  padding: 50px 24px;
  border: 1px dashed var(--line-2);
  border-radius: var(--radius-lg);
  background: rgba(255, 253, 248, 0.5);
  text-align: center;
}
.empty-icon {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  color: var(--forest-light);
}
.empty-icon svg {
  width: 27px;
  height: 27px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.45;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.empty-state h3 {
  margin-top: 18px;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 600;
}
.empty-state p {
  margin-top: 7px;
  max-width: 360px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.75;
}
.empty-state .btn { margin-top: 18px; }

/* --------------------------------------------------------------------------
   Tags & categories page
   -------------------------------------------------------------------------- */

.tags-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.62fr);
  gap: 18px;
  align-items: start;
}
.category-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 0 24px 24px;
}
.category-card {
  position: relative;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  text-align: left;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}
.category-card:hover {
  transform: translateY(-2px);
  border-color: var(--line-2);
  background: var(--surface);
}
.category-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.category-card h3 {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 650;
}
.category-card h3 i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cat);
}
.category-card b {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 600;
}
.category-card p {
  margin-top: 6px;
  color: var(--faint);
  font-size: 9.5px;
  line-height: 1.55;
}
.category-card-bar {
  display: block;
  margin-top: 12px;
  height: 3px;
  border-radius: 2px;
  background: var(--surface-3);
  overflow: hidden;
}
.category-card-bar i {
  display: block;
  height: 100%;
  width: var(--w, 0%);
  background: var(--cat);
  border-radius: 2px;
}
.tag-sheet {
  padding: 0 24px 24px;
}
.tag-sheet .tag-chip {
  height: 34px;
  padding: 0 11px;
  font-size: 11px;
  border-radius: 8px;
}
.tag-sheet .tag-chip span { font-size: 9px; }
.tag-cloud-large {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.tag-cloud-large .tag-chip:nth-child(3n+1) { font-size: 12px; }
.tag-cloud-large .tag-chip:nth-child(4n+2) { font-size: 10px; }
.tags-empty {
  padding: 20px 24px 30px;
  color: var(--faint);
  font-size: 11px;
}

/* --------------------------------------------------------------------------
   Admin
   -------------------------------------------------------------------------- */

.admin-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.admin-stat {
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.admin-stat span {
  color: var(--muted);
  font-size: 10px;
}
.admin-stat strong {
  display: block;
  margin-top: 4px;
  font-family: var(--serif);
  font-size: 27px;
  font-weight: 600;
  line-height: 1.2;
}
.admin-panel { overflow: hidden; }
.admin-table {
  width: 100%;
  border-collapse: collapse;
}
.admin-table th {
  padding: 11px 18px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-align: left;
  white-space: nowrap;
}
.admin-table th:nth-child(3) { width: 90px; }
.admin-table th:nth-child(4) { width: 85px; }
.admin-table th:nth-child(5) { width: 150px; }
.admin-table th:nth-child(6) { width: 170px; }
.admin-table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.admin-table tr:last-child td { border-bottom: 0; }
.admin-user {
  display: flex;
  align-items: center;
  gap: 11px;
}
.admin-user .avatar {
  width: 34px;
  height: 34px;
  font-size: 14px;
}
.admin-user-info {
  min-width: 0;
}
.admin-user-info strong {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 650;
}
.admin-user-info small {
  display: block;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 9.5px;
}
.role-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 8px;
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 9px;
  font-weight: 650;
}
.role-pill.admin {
  background: var(--gold-soft);
  color: #7f5c29;
}
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 9.5px;
}
.status-pill i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--faint);
}
.status-pill.active { color: var(--forest-light); }
.status-pill.active i { background: #3d8f72; }
.admin-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  justify-content: flex-end;
}
.text-btn {
  height: 28px;
  padding: 0 8px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 600;
}
.text-btn:hover { background: var(--surface-2); color: var(--ink); }
.text-btn:disabled { opacity: 0.32; cursor: not-allowed; }
.text-btn:disabled:hover { background: transparent; color: var(--muted); }
.text-btn.danger:hover { background: var(--clay-soft); color: var(--clay); }
.self-tag {
  display: inline-flex;
  height: 17px;
  align-items: center;
  padding: 0 5px;
  border-radius: 3px;
  background: var(--mint);
  color: var(--forest-light);
  font-size: 8px;
  font-weight: 700;
}

/* --------------------------------------------------------------------------
   Modal
   -------------------------------------------------------------------------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(8, 24, 18, 0.54);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  animation: fade-in 0.18s ease both;
}
.modal {
  width: min(940px, 100%);
  max-height: calc(100dvh - 48px);
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: fade-up 0.24s ease both;
}
.modal.modal-sm { width: min(460px, 100%); }
.modal.modal-md { width: min(580px, 100%); }
.modal-head {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 24px 26px 17px;
  border-bottom: 1px solid var(--line);
}
.modal-head-copy { min-width: 0; flex: 1; }
.modal-head h2 {
  margin-top: 5px;
  font-family: var(--serif);
  font-size: 25px;
  font-weight: 600;
  line-height: 1.3;
}
.modal-head p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}
.modal-close {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  color: var(--muted);
  flex: 0 0 auto;
}
.modal-close svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}
.modal-close:hover { background: var(--surface-2); color: var(--ink); }
.modal-body {
  padding: 22px 26px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.modal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 26px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}
.modal-foot-note {
  color: var(--muted);
  font-size: 10.5px;
  min-width: 0;
}
.modal-foot-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.tabs {
  display: flex;
  gap: 3px;
  width: max-content;
  max-width: 100%;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
}
.tabs button {
  height: 33px;
  padding: 0 13px;
  border-radius: 7px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
}
.tabs button.active {
  background: var(--surface);
  color: var(--forest);
  box-shadow: 0 1px 3px rgba(20, 34, 28, 0.08);
}
.composer {
  border: 1px solid var(--line-2);
  border-radius: 13px;
  background: var(--surface);
  overflow: hidden;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.composer:focus-within {
  border-color: var(--forest);
  box-shadow: 0 0 0 3px rgba(18, 58, 49, 0.06);
}
.composer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.composer-head button {
  color: var(--forest);
  font-size: 9.5px;
  font-weight: 650;
  letter-spacing: 0;
  text-transform: none;
}
.composer-head button:hover { text-decoration: underline; text-underline-offset: 3px; }
.composer textarea {
  width: 100%;
  min-height: 150px;
  padding: 14px 15px;
  border: 0;
  outline: 0;
  resize: vertical;
  background: transparent;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.8;
  color: var(--ink-2);
}
.composer textarea::placeholder { color: var(--faint); font-family: var(--sans); }
.composer-hint {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 9.5px;
  line-height: 1.5;
  flex-wrap: wrap;
}
.composer-hint svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
}
.parse-state {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 16px 0 10px;
  color: var(--muted);
  font-size: 10.5px;
}
.parse-state::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--gold);
}
.parse-state.error { color: var(--clay); }
.parse-state.error::before { background: var(--clay); }
.preview-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-top: 10px;
}
.preview-card {
  padding: 14px 15px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
}
.preview-card.duplicate { border-color: rgba(195, 154, 90, 0.32); background: #fffbf2; }
.preview-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.preview-index {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 9px;
}
.preview-title {
  margin-top: 6px;
  font-family: var(--serif);
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.5;
}
.preview-meta {
  margin-top: 5px;
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.55;
}
.preview-bottom {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.preview-warning {
  color: var(--clay);
  font-size: 9px;
}
.preview-duplicate {
  color: #8a662f;
  font-size: 9px;
  font-weight: 600;
}
.manual-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.manual-grid .span-2 { grid-column: 1 / -1; }
.manual-grid .field > span:first-child { font-size: 11px; }
.manual-grid .input,
.manual-grid .textarea { font-size: 12px; }
.form-row {
  display: flex;
  gap: 10px;
}
.form-row > * { flex: 1; }

.confirm-copy {
  color: var(--ink-2);
  font-size: 12.5px;
  line-height: 1.8;
}
.confirm-copy strong { color: var(--ink); }
.confirm-hint {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--clay-soft);
  color: #87422f;
  font-size: 10.5px;
  line-height: 1.65;
}

.export-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.export-option {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease;
}
.export-option:hover { border-color: var(--line-2); background: var(--surface-2); }
.export-option.selected {
  border-color: var(--forest);
  background: var(--mint);
}
.export-option input { position: absolute; opacity: 0; }
.export-radio {
  width: 15px;
  height: 15px;
  margin-top: 2px;
  border: 1px solid var(--line-2);
  border-radius: 50%;
  background: var(--surface);
  flex: 0 0 auto;
  position: relative;
}
.export-option.selected .export-radio { border-color: var(--forest); }
.export-option.selected .export-radio::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--forest);
}
.export-option strong {
  display: block;
  font-size: 11.5px;
  font-weight: 650;
}
.export-option span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 9.5px;
}

.account-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
}
.account-card .avatar {
  width: 48px;
  height: 48px;
  font-size: 20px;
}
.account-card h3 {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 600;
}
.account-card p {
  margin-top: 2px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9.5px;
}
.account-card .role-pill { margin-top: 5px; }
.account-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}
.account-details div {
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.account-details span {
  display: block;
  color: var(--faint);
  font-size: 9px;
}
.account-details strong {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  font-weight: 600;
}
.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 22px 0 12px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.section-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}
.account-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* --------------------------------------------------------------------------
   Drawer
   -------------------------------------------------------------------------- */

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(8, 24, 18, 0.38);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: fade-in 0.2s ease both;
}
.drawer {
  position: fixed;
  z-index: 91;
  top: 0;
  right: 0;
  width: min(570px, 100%);
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  box-shadow: -30px 0 90px -30px rgba(8, 24, 18, 0.45);
  animation: slide-in 0.26s ease both;
}
.drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 26px 16px;
  border-bottom: 1px solid var(--line);
}
.drawer-head-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.drawer-kicker {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.drawer-head-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}
.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 25px 26px 32px;
  overscroll-behavior: contain;
}
.drawer-edit-form {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.drawer-edit-form .drawer-body {
  flex: 1;
  overflow-y: auto;
}
.drawer-title {
  font-family: var(--serif);
  font-size: clamp(22px, 2.2vw, 27px);
  font-weight: 600;
  line-height: 1.45;
  letter-spacing: -0.015em;
}
.drawer-authors {
  margin-top: 13px;
  color: var(--ink-2);
  font-size: 12px;
  line-height: 1.75;
}
.drawer-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin-top: 14px;
}
.drawer-meta .badge {
  background: var(--surface-2);
  color: var(--muted);
  font-weight: 550;
}
.drawer-section {
  margin-top: 26px;
}
.drawer-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}
.drawer-section-title span { font-family: var(--mono); letter-spacing: 0.04em; }
.status-segments {
  display: flex;
  gap: 5px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-2);
}
.status-segments button {
  flex: 1;
  height: 31px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  transition: background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}
.status-segments button:hover { color: var(--ink); }
.status-segments button.active {
  background: var(--surface);
  color: var(--forest);
  box-shadow: 0 1px 3px rgba(20, 34, 28, 0.09);
}
.drawer-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.drawer-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 9px;
  border-radius: 6px;
  background: var(--mint);
  color: var(--forest);
  font-size: 9.5px;
  font-weight: 550;
}
.drawer-tag.empty { background: var(--surface-2); color: var(--faint); }
.notes-area {
  width: 100%;
  min-height: 120px;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  outline: 0;
  resize: vertical;
  font-size: 12px;
  line-height: 1.8;
  transition: border-color 0.18s ease, background 0.18s ease;
}
.notes-area:focus { border-color: var(--forest); background: var(--surface); }
.notes-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 7px;
  gap: 10px;
  color: var(--faint);
  font-size: 9px;
}
.ident-list {
  border-top: 1px solid var(--line);
}
.ident-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: 10px;
}
.ident-row > span {
  width: 58px;
  flex: 0 0 auto;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.ident-row code {
  flex: 1;
  min-width: 0;
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 10px;
  overflow-wrap: anywhere;
}
.ident-copy {
  color: var(--faint);
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 5px;
  flex: 0 0 auto;
}
.ident-copy:hover { background: var(--surface-2); color: var(--forest); }
.ident-copy svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
}
.citation-box {
  position: relative;
  padding: 14px 15px 14px 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--ink-2);
  font-family: var(--serif);
  font-size: 11.5px;
  line-height: 1.85;
}
.citation-box > svg {
  position: absolute;
  left: 13px;
  top: 13px;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: var(--gold);
  stroke-width: 1.5;
  stroke-linecap: round;
}
.citation-copy {
  margin-top: 7px;
  color: var(--forest);
  font-size: 9.5px;
  font-weight: 650;
}
.citation-copy:hover { text-decoration: underline; text-underline-offset: 3px; }
.original-cite {
  margin-top: 22px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}
.original-cite summary {
  cursor: pointer;
  font-size: 9.5px;
  font-weight: 650;
  letter-spacing: 0.04em;
  color: var(--faint);
  list-style: none;
}
.original-cite summary::-webkit-details-marker { display: none; }
.original-cite summary::before {
  content: "+";
  display: inline-block;
  width: 14px;
  color: var(--gold);
  font-family: var(--mono);
}
.original-cite[open] summary::before { content: "−"; }
.original-cite p {
  margin-top: 9px;
  padding: 11px 12px;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9.5px;
  line-height: 1.75;
  overflow-wrap: anywhere;
}
.drawer-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 26px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}
.drawer-foot-group { display: flex; gap: 6px; align-items: center; }
.edit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.edit-grid .span-2 { grid-column: 1 / -1; }
.edit-grid .field > span:first-child { font-size: 10px; }
.edit-grid .input,
.edit-grid .select,
.edit-grid .textarea { font-size: 11.5px; }
.edit-grid .input, .edit-grid .select { height: 39px; }
.drawer-tag-edit {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-height: 39px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}
.tag-editor-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 27px;
  padding: 0 7px;
  border-radius: 5px;
  background: var(--mint);
  color: var(--forest);
  font-size: 9.5px;
}
.tag-editor-chip button {
  display: grid;
  place-items: center;
  width: 14px;
  height: 14px;
  color: var(--forest);
  opacity: 0.55;
}
.tag-editor-chip button:hover { opacity: 1; }
.tag-editor-chip button svg {
  width: 9px;
  height: 9px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
}
.tag-editor-input {
  flex: 1;
  min-width: 100px;
  height: 27px;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 10px;
  padding: 0 4px;
}

/* --------------------------------------------------------------------------
   Toasts
   -------------------------------------------------------------------------- */

.toast-root {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transform: translateX(-50%);
  pointer-events: none;
  width: min(92vw, 480px);
}
.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: 100%;
  padding: 11px 16px;
  border-radius: 10px;
  background: var(--forest-deep);
  color: #f4eddd;
  box-shadow: 0 16px 40px -16px rgba(8, 24, 18, 0.55);
  font-size: 11.5px;
  line-height: 1.5;
  animation: toast-in 0.24s ease both;
}
.toast svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: var(--gold);
  stroke-width: 2;
  stroke-linecap: round;
  flex: 0 0 auto;
}
.toast.error {
  background: #6f2f20;
}
.toast.error svg { stroke: #f0c0ae; }
.toast.leaving { animation: fade-in 0.2s reverse both; }

.noscript {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: grid;
  place-items: center;
  padding: 30px;
  background: var(--paper);
  color: var(--ink);
  text-align: center;
  font-size: 15px;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 1240px) {
  .page { padding-left: 28px; padding-right: 28px; }
  .topbar { padding-left: 28px; padding-right: 28px; }
  .dashboard-top { grid-template-columns: minmax(0, 1.45fr) minmax(285px, 0.8fr); }
  .lit-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
}

@media (max-width: 1100px) {
  :root { --sidebar-w: 238px; }
  .sidebar { padding-left: 14px; padding-right: 14px; }
  .global-search { width: min(310px, 28vw); }
  .dashboard-top { grid-template-columns: minmax(0, 1fr); }
  .pulse-card, .reading-panel { min-width: 0; }
  .reading-panel { min-height: 0; }
  .reading-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px; }
  .reading-item:nth-child(2) { border-top: 0; padding-top: 5px; }
  .dashboard-bottom { grid-template-columns: minmax(0, 1.35fr) minmax(270px, 0.8fr); }
  .tags-layout { grid-template-columns: 1fr; }
}

@media (max-width: 920px) {
  :root { --sidebar-w: 0px; }
  .app-shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 276px;
    height: 100dvh;
    transform: translateX(-102%);
    transition: transform 0.26s ease;
    box-shadow: 24px 0 70px -30px rgba(0, 0, 0, 0.55);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close { display: grid; place-items: center; }
  .sidebar-scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 39;
    background: rgba(8, 24, 18, 0.42);
    backdrop-filter: blur(3px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.24s ease;
  }
  .sidebar-scrim.open { opacity: 1; pointer-events: auto; }
  .mobile-menu { display: grid; place-items: center; }
  .topbar { min-height: 68px; }
  .topbar-left { min-width: 0; }
  .global-search { width: min(300px, 38vw); }
  .page { padding-top: 26px; }
  .admin-table th:nth-child(5), .admin-table td:nth-child(5) { display: none; }
  .admin-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .login-shell { display: flex; flex-direction: column; min-height: 100dvh; }
  .login-brand { display: none; }
  .login-mobile-brand { display: block; }
  .login-panel { width: 100%; flex: 1; padding: 34px 22px 44px; min-height: 100dvh; }
  .login-panel-inner { width: 100%; max-width: 430px; }
  .login-copyright { margin-top: 36px; }
  .page-head { flex-direction: column; gap: 6px; margin-bottom: 22px; }
  .page-actions { padding-top: 8px; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-bottom { grid-template-columns: minmax(0, 1fr); }
  .side-stack { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
  .panel-head { padding: 20px 20px 14px; }
  .recent-row { padding: 14px 20px; }
  .category-bars, .tag-cloud { padding-left: 20px; padding-right: 20px; }
  .library-toolbar { gap: 7px; }
  .lib-search { flex-basis: 100%; max-width: none; }
  .library-summary { order: 10; }
  .view-switch { margin-left: auto; }
  .category-card-grid { padding: 0 20px 20px; }
  .tag-sheet { padding: 0 20px 20px; }
  .lit-table th:nth-child(3), .lit-table td:nth-child(3),
  .lit-table th:nth-child(5), .lit-table td:nth-child(5) { display: none; }
  .lit-table th:nth-child(4), .lit-table td:nth-child(4) { width: 92px; }
  .admin-table th:nth-child(4), .admin-table td:nth-child(4) { display: none; }
  .admin-table th:nth-child(6), .admin-table td:nth-child(6) { width: 110px; }
  .modal-backdrop { padding: 12px; }
  .modal { max-height: calc(100dvh - 24px); border-radius: 18px; }
  .modal-head { padding: 20px 20px 14px; }
  .modal-body { padding: 18px 20px; }
  .modal-foot { padding: 13px 20px; }
  .drawer { width: 100%; }
  .drawer-head, .drawer-body, .drawer-foot { padding-left: 20px; padding-right: 20px; }
}

@media (max-width: 560px) {
  .page { padding: 20px 15px 50px; }
  .topbar { padding: 0 15px; gap: 10px; }
  .global-search { display: none; }
  .topbar-left { flex: 1; }
  .topbar-actions { margin-left: auto; }
  .page-head h1 { font-size: 30px; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }
  .pulse-card { min-height: 270px; padding: 22px 20px; border-radius: 20px; min-width: 0; }
  .pulse-main { margin-top: 22px; gap: 12px; }
  .pulse-main > div:first-child { min-width: 0; flex: 1; }
  .pulse-number { font-size: 56px; }
  .pulse-sub { line-height: 1.75; max-width: 230px; }
  .read-ring { width: 78px; height: 78px; }
  .read-ring-inner strong { font-size: 20px; }
  .pulse-foot { align-items: flex-start; flex-direction: column; gap: 10px; }
  .pulse-statuses { gap: 11px; }
  .reading-list { grid-template-columns: 1fr; }
  .reading-item:nth-child(2) { border-top: 1px solid var(--line); padding-top: 13px; }
  .stat-grid { gap: 9px; }
  .stat-card { padding: 14px 13px; gap: 9px; border-radius: 13px; }
  .stat-icon { width: 31px; height: 31px; border-radius: 8px; }
  .stat-icon svg { width: 15px; height: 15px; }
  .stat-value { font-size: 25px; }
  .stat-note { display: none; }
  .stat-arrow { display: none; }
  .recent-row { grid-template-columns: minmax(0, 1fr); gap: 7px; }
  .recent-side { padding-left: 14px; }
  .side-stack { grid-template-columns: 1fr; }
  .lit-grid { grid-template-columns: 1fr; }
  .lit-card { min-height: 230px; }
  .lit-table th:nth-child(4), .lit-table td:nth-child(4) { display: none; }
  .lit-table th:nth-child(6), .lit-table td:nth-child(6) { width: 58px; }
  .admin-summary { grid-template-columns: 1fr 1fr; gap: 9px; }
  .admin-stat { padding: 14px; }
  .admin-stat strong { font-size: 23px; }
  .admin-table th:nth-child(3), .admin-table td:nth-child(3) { display: none; }
  .admin-table th, .admin-table td { padding: 11px 12px; }
  .category-card-grid { grid-template-columns: 1fr; }
  .segmented { order: 2; }
  .select-wrap { order: 3; }
  .view-switch { order: 1; }
  .manual-grid, .edit-grid { grid-template-columns: 1fr; }
  .manual-grid .span-2, .edit-grid .span-2 { grid-column: auto; }
  .modal-foot { align-items: stretch; flex-direction: column; }
  .modal-foot-actions .btn { flex: 1; }
  .export-options { grid-template-columns: 1fr; }
  .drawer-title { font-size: 25px; }
  .toast-root { bottom: 16px; }
}

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