@font-face {
  font-family: "Bon";
  src: url("/static/library/fonts/bon-light.ttf") format("truetype");
  font-style: normal;
  font-weight: 300;
  font-display: swap;
}

@font-face {
  font-family: "Bon";
  src: url("/static/library/fonts/bon-regular.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Bon";
  src: url("/static/library/fonts/bon-medium.ttf") format("truetype");
  font-style: normal;
  font-weight: 500;
  font-display: swap;
}

@font-face {
  font-family: "Bon";
  src: url("/static/library/fonts/bon-semibold.ttf") format("truetype");
  font-style: normal;
  font-weight: 600;
  font-display: swap;
}

@font-face {
  font-family: "Bon";
  src: url("/static/library/fonts/bon-bold.ttf") format("truetype");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

:root {
  --ink: #102b46;
  --blue: #087eaf;
  --navy: #06416c;
  --mist: #eef5f9;
  --line: #d5e2ea;
  --green: #1c9a72;
  --brand-red: #df2639;
  --brand-red-dark: #981225;
  --brand-red-soft: #fff0f2;
  --login-ink: #201b1c;
  --login-muted: #776d70;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--mist);
  color: var(--ink);
  font-family: "Bon", Tahoma, Arial, sans-serif;
}

a { color: var(--blue); text-decoration: none; }

.developer-credit {
  width: min(1420px, 94vw);
  margin: 20px auto 28px;
  color: #9b8e92;
  direction: rtl;
  font-size: 10px;
  text-align: center;
  letter-spacing: .1px;
}

.developer-credit bdi {
  color: #6f6266;
  direction: ltr;
  font-family: Arial, sans-serif;
  font-weight: 600;
}

.developer-credit-login,
.developer-credit-overlay {
  position: fixed;
  z-index: 30;
  right: 0;
  bottom: 10px;
  left: 0;
  width: auto;
  margin: 0;
}

.developer-credit-login { color: #9c8f93; }
.developer-credit-overlay { color: #ffffff85; text-shadow: 0 1px 3px #0008; }
.developer-credit-overlay bdi { color: #ffffffb8; }

header {
  min-height: 82px;
  background: #fff;
  margin: 20px auto;
  padding: 16px 28px;
  width: min(1420px, 94vw);
  border-radius: 20px;
  display: flex;
  gap: 24px;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 10px 35px #16466412;
}

header > div { display: flex; align-items: center; gap: 14px; font-size: 20px; }
header img, .login-card img { width: 52px; height: 52px; }
header nav { font-size: 14px; color: #597188; }

main { width: min(1420px, 94vw); margin: 0 auto 32px; }

.hero {
  color: white;
  border-radius: 26px;
  padding: 38px 48px;
  margin: 0 0 24px;
  background: linear-gradient(120deg, #063d68, #087eb0);
}

.hero h1 { margin: 0 0 10px; font-size: 30px; }
.hero p { margin: 0; color: #d5f1ff; }

.search {
  width: 100%;
  border: 1px solid var(--line);
  padding: 15px 18px;
  background: #fff;
  border-radius: 14px;
  font: inherit;
  margin: 0 0 22px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(245px, 1fr));
  gap: 18px;
}

.grid article {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 17px;
  min-height: 255px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  box-shadow: 0 5px 18px #16466408;
}

.book {
  width: 100%;
  height: 96px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #dceff8, #9ed8ef);
  font: bold 34px Arial;
  color: var(--navy);
  border-radius: 12px;
}

.grid h2 { font-size: 17px; margin: 15px 0 8px; }
.grid p, .grid small { margin: 3px 0; color: #72869a; }
.grid a { margin-top: auto; background: var(--blue); color: white; padding: 9px 15px; border-radius: 9px; }

/* Login */
.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  overflow-x: hidden;
  padding: 32px;
  background:
    radial-gradient(circle at 15% 12%, #df263914 0 2px, transparent 3px) 0 0 / 24px 24px,
    linear-gradient(145deg, #fff9f9 0%, #f7f2f3 55%, #f1e9eb 100%);
  color: var(--login-ink);
}

.login-card {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(360px, .9fr) minmax(430px, 1.1fr);
  width: min(1080px, 96vw);
  min-height: 680px;
  margin: 0;
  overflow: hidden;
  border: 1px solid #ffffffb8;
  border-radius: 34px;
  background: #fff;
  box-shadow: 0 30px 90px #54101f24;
}

.login-brand {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 54px 50px 44px;
  overflow: hidden;
  color: #fff;
  background: linear-gradient(145deg, #e73347 0%, #c81831 55%, #981225 100%);
}

.login-brand::before,
.login-brand::after {
  position: absolute;
  content: "";
  border-radius: 50%;
  pointer-events: none;
}

.login-brand::before {
  width: 390px;
  height: 390px;
  top: -205px;
  left: -150px;
  border: 70px solid #ffffff12;
}

.login-brand::after {
  width: 300px;
  height: 300px;
  right: -210px;
  bottom: 25px;
  background: #6e071727;
}

.login-brand-lockup,
.login-brand-copy,
.login-security-note { position: relative; z-index: 1; }

.login-brand-lockup {
  display: flex;
  align-items: center;
  direction: ltr;
}

.login-logo-lockup {
  display: block;
  width: 142px;
  height: 105px;
  flex: 0 0 auto;
  overflow: hidden;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 12px 30px #5b07172f;
}

.login-card .login-logo-lockup img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.login-eyebrow {
  display: inline-block;
  margin-bottom: 15px;
  color: #ffd8dd;
  font-size: 13px;
}

.login-brand-copy h1 {
  margin: 0;
  color: #fff;
  font-size: clamp(34px, 3.4vw, 48px);
  line-height: 1.42;
  letter-spacing: -1.2px;
}

.login-brand-copy p {
  max-width: 360px;
  margin: 20px 0 0;
  color: #ffe7ea;
  font-size: 15px;
  line-height: 2;
}

.login-security-note {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #ffdce1;
  font-size: 12px;
}

.login-security-note span {
  display: grid;
  place-items: center;
  width: 23px;
  height: 23px;
  border: 1px solid #ffffff69;
  border-radius: 50%;
}

.login-form-panel {
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: min(440px, calc(100% - 64px));
  margin: auto;
  padding: 58px 0 42px;
}

.login-mobile-brand { display: none; }

.login-heading {
  display: block;
  width: auto;
  min-height: 0;
  margin: 0 0 36px;
  padding: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.login-kicker {
  display: block;
  margin-bottom: 8px;
  color: var(--brand-red);
  font-size: 13px;
  font-weight: 700;
}

.login-heading h2 {
  margin: 0;
  color: var(--login-ink);
  font-size: clamp(28px, 3vw, 36px);
  line-height: 1.5;
}

.login-heading p {
  margin: 8px 0 0;
  color: var(--login-muted);
  font-size: 14px;
}

.login-form { display: grid; }

.login-form label {
  margin: 0 2px 9px;
  color: #4c4244;
  font-size: 13px;
  font-weight: 700;
}

.login-input-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 58px;
  margin-bottom: 22px;
  padding: 0 17px;
  border: 1px solid transparent;
  border-radius: 15px;
  background: #f5f2f3;
  transition: border-color .18s ease, background .18s ease, box-shadow .18s ease;
}

.login-input-wrap:focus-within {
  border-color: #df263978;
  background: #fff;
  box-shadow: 0 0 0 4px #df263912;
}

.login-input-wrap svg {
  width: 21px;
  height: 21px;
  flex: 0 0 auto;
  fill: none;
  stroke: #a09195;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.login-input-wrap:focus-within svg { stroke: var(--brand-red); }

.login-card .login-input-wrap input {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--login-ink);
  font: inherit;
  direction: ltr;
  text-align: left;
}

.login-input-wrap input::placeholder {
  color: #b0a5a8;
  direction: rtl;
  text-align: right;
}

.login-card .login-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  min-height: 58px;
  margin-top: 8px;
  padding: 13px 20px;
  border: 0;
  border-radius: 17px;
  color: #fff;
  background: linear-gradient(135deg, #ed3e51, #c91831 62%, #a71127);
  box-shadow: 0 13px 28px #c9183142;
  font: 700 15px "Bon", Tahoma, Arial, sans-serif;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
}

.login-card .login-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 17px 34px #c9183152;
  filter: saturate(1.08);
}

.login-card .login-submit:active { transform: translateY(0); }

.login-submit svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.login .error {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: -16px 0 24px;
  padding: 12px 14px;
  border: 1px solid #f3c3ca;
  border-radius: 12px;
  background: var(--brand-red-soft);
  color: #a51429;
  font-size: 13px;
}

.login .error span {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--brand-red);
  color: #fff;
  font-weight: 700;
}

.login-help {
  display: grid;
  gap: 25px;
  margin-top: 30px;
  color: #92878a;
  text-align: center;
  font-size: 11px;
}

.login-help small {
  padding-top: 22px;
  border-top: 1px solid #eee8e9;
  color: #b1a7aa;
}

.login-shape { display: none; }

.error { background: #fff0f0; color: #bf3434; padding: 10px; border-radius: 9px; }

.blocked {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(#0009, #0009), url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20"><rect width="20" height="20" fill="%23dcebf4"/></svg>');
  filter: grayscale(1);
}

.notice {
  max-width: 770px;
  background: #fff;
  border-radius: 23px;
  padding: 32px;
  box-shadow: 0 18px 70px #0007;
  filter: none;
}

.notice section { padding: 16px 0; border-top: 1px solid var(--line); }
.notice section > * { display: block; margin: 7px 0; }
.notice button { border: 0; background: var(--blue); color: #fff; border-radius: 10px; padding: 12px 18px; font: inherit; cursor: pointer; }
.check { font-size: 14px; }
.reader { background: #08141e; min-height: 100vh; }
.reader header { width: 100%; margin: 0; border-radius: 0; min-height: 58px; padding: 9px 22px; }
.reader header button { background: var(--blue); border: 0; color: #fff; border-radius: 8px; padding: 9px 13px; font: inherit; }
.reader iframe { display: block; width: 100%; height: calc(100vh - 58px); border: 0; background: #fff; }

@media (max-width: 860px) {
  .login {
    display: block;
    padding: 0;
    background: #fff;
  }

  .login-card {
    display: block;
    width: 100%;
    min-height: 100vh;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .login-brand { display: none; }

  .login-shape {
    position: absolute;
    z-index: 0;
    display: block;
    pointer-events: none;
  }

  .login-shape-primary {
    width: 490px;
    height: 360px;
    top: -185px;
    right: -180px;
    border-radius: 43% 57% 49% 51% / 45% 38% 62% 55%;
    background: linear-gradient(145deg, #ee3c50, #b5122a);
    transform: rotate(-9deg);
  }

  .login-shape-soft {
    width: 265px;
    height: 185px;
    top: 4px;
    right: -175px;
    border-radius: 50%;
    background: #df26391a;
    transform: rotate(24deg);
  }

  .login-form-panel {
    width: min(430px, calc(100% - 44px));
    min-height: 100vh;
    margin: auto;
    padding: 72px 0 34px;
    justify-content: flex-start;
  }

  .login-mobile-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 74px;
    direction: ltr;
  }

  .login-mobile-brand .login-logo-lockup {
    width: 148px;
    height: 110px;
    border-radius: 20px;
    box-shadow: 0 15px 38px #5d0d1c20;
  }

  .login-heading { margin-bottom: 31px; }
  .login-heading h2 { font-size: 30px; }
  .login-help { margin-top: 35px; }
}

@media (max-width: 650px) {
  body:not(.login) header { margin: 10px auto; padding: 12px 15px; }
  .hero { padding: 28px 22px; }
  .hero h1 { font-size: 24px; }

  .login-form-panel {
    width: min(100% - 40px, 410px);
    padding-top: 54px;
  }

  .login-mobile-brand { margin-bottom: 56px; }
  .login-shape-primary { width: 400px; height: 310px; top: -173px; right: -164px; }
  .login-heading h2 { font-size: 27px; }
  .login-input-wrap { height: 56px; margin-bottom: 19px; }
}

@media (max-width: 380px) {
  .login-form-panel { width: calc(100% - 30px); padding-top: 38px; }
  .login-mobile-brand { margin-bottom: 38px; }
  .login-mobile-brand .login-logo-lockup { width: 132px; height: 98px; }
  .login-heading { margin-bottom: 24px; }
  .login-help { gap: 18px; margin-top: 25px; }
}

@media (prefers-reduced-motion: reduce) {
  .login-input-wrap,
  .login-submit { transition: none !important; }
}

/* Read & Sign */
.read-sign-page { min-height: 100vh; display: grid; place-items: center; padding: 28px; overflow-x: hidden; background: #241b1d; }
.read-sign-backdrop { position: fixed; inset: 0; overflow: hidden; background: linear-gradient(135deg, #f9f4f5e8, #e8dfe1e8), linear-gradient(135deg, #df2639, #54101f); }
.read-sign-backdrop::before { content: "کتابخانه دیجیتال نوین ایر"; position: absolute; top: 11%; right: 8%; color: #221c1e; font-size: clamp(30px, 5vw, 70px); font-weight: 700; opacity: .09; }
.read-sign-backdrop img { position: absolute; width: 190px; left: 8%; bottom: 11%; opacity: .08; }
.read-sign-backdrop span { position: absolute; width: 290px; height: 390px; top: 25%; right: 12%; border-radius: 18px; background: #fff; box-shadow: 0 20px 60px #54101f18; transform: rotate(8deg); opacity: .45; }
.read-sign-backdrop span:nth-child(3) { right: 35%; top: 32%; transform: rotate(-6deg); }
.read-sign-backdrop span:nth-child(4) { right: 58%; top: 19%; transform: rotate(4deg); }
.read-sign-dialog { position: relative; z-index: 2; width: min(620px, 96vw); padding: 40px; border: 1px solid #ffffffaa; border-radius: 28px; background: #fffffff5; box-shadow: 0 28px 90px #3e0b1644; text-align: center; backdrop-filter: blur(16px); }
.read-sign-icon { display: grid; place-items: center; width: 58px; height: 58px; margin: 0 auto 16px; border-radius: 18px; color: #fff; background: linear-gradient(135deg, #ed3e51, #a71127); font: 700 27px Arial; box-shadow: 0 12px 26px #bf193149; }
.read-sign-kicker { color: var(--brand-red); font: 700 11px Arial; letter-spacing: 2px; }
.read-sign-dialog h1 { margin: 8px 0; color: #281f21; font-size: 29px; }
.read-sign-dialog > p { margin: 0 0 22px; color: #84777a; font-size: 13px; }
.release-card { padding: 21px; border: 1px solid #eadfe1; border-radius: 18px; background: #faf7f8; text-align: right; }
.release-card > strong { display: block; margin-bottom: 17px; color: #33282b; font-size: 17px; }
.release-card dl { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin: 0; }
.release-card dl div { padding: 11px; border-radius: 12px; background: #fff; }
.release-card dt { color: #a09396; font-size: 9px; }
.release-card dd { margin: 5px 0 0; color: #4c3f42; font-size: 12px; font-weight: 700; }
.read-sign-check { display: flex; align-items: flex-start; gap: 11px; margin: 20px 0; padding: 15px; border: 1px solid #eadfe1; border-radius: 14px; color: #514548; text-align: right; cursor: pointer; }
.read-sign-check input { width: 19px; height: 19px; flex: 0 0 auto; accent-color: var(--brand-red); }
.read-sign-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.read-sign-actions a { color: #8b7c80; font-size: 12px; }
.read-sign-actions button, .primary-action, .management-form button { border: 0; border-radius: 12px; padding: 12px 19px; color: #fff; background: linear-gradient(135deg, #e93549, #b41329); box-shadow: 0 9px 20px #b4132935; font: 700 13px "Bon"; cursor: pointer; }
.read-sign-audit { display: block; margin-top: 17px; color: #aa9da0; font-size: 10px; }

/* Visual management portal */
.management-page { min-height: 100vh; background: #f5f2f3; color: #302729; }
.management-shell { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; }
.management-sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 28px 20px; color: #fff; background: linear-gradient(180deg, #3a111a, #1f1517); }
.management-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 42px; color: #fff; }
.management-brand img { width: 82px; height: 61px; padding: 3px; border-radius: 14px; background: #fff; object-fit: contain; }
.management-brand span { display: grid; gap: 2px; }.management-brand b { font-size: 17px; }.management-brand small { color: #d7bfc4; font-size: 10px; }
.management-sidebar nav { display: grid; gap: 8px; }
.management-sidebar nav a { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; color: #d9c8cc; font-size: 13px; }
.management-sidebar nav a:hover, .management-sidebar nav a.active { color: #fff; background: #df2639; box-shadow: 0 8px 20px #12060955; }
.management-sidebar nav i { width: 22px; font: normal 18px Arial; text-align: center; }
.sidebar-back { margin-top: auto; padding: 13px; border-top: 1px solid #ffffff17; color: #d9c8cc; font-size: 12px; }
.management-main { min-width: 0; }
.management-header { position: sticky; z-index: 10; top: 0; width: 100%; min-height: 78px; margin: 0; padding: 13px 32px; border-radius: 0; box-shadow: 0 5px 22px #43101a0b; }
.management-header > div:first-child { display: grid; gap: 3px; }.management-header small { color: #a19195; font-size: 9px; }.management-header strong { font-size: 16px; }
.management-user { display: flex; gap: 13px; font-size: 12px; }.management-user a { padding: 7px 11px; border-radius: 9px; color: #a71127; background: #fff0f2; }
.management-content, .flash-stack { width: min(1320px, calc(100% - 48px)); margin: 24px auto; }
.flash { padding: 13px 16px; border: 1px solid #bde3d4; border-radius: 12px; color: #236b52; background: #effaf6; }
.management-welcome { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 20px; overflow: hidden; padding: 30px 34px; border-radius: 22px; color: #fff; background: linear-gradient(125deg, #df2639, #981225); box-shadow: 0 15px 36px #8a10242e; }
.management-welcome::after { content: ""; position: absolute; width: 250px; height: 250px; left: -70px; top: -150px; border: 45px solid #ffffff13; border-radius: 50%; }
.management-welcome span { color: #ffdce1; font-size: 10px; }.management-welcome h1 { margin: 5px 0; font-size: 25px; }.management-welcome p { margin: 0; color: #ffe7ea; font-size: 12px; }
.management-welcome .primary-action { position: relative; z-index: 1; color: #ae142a; background: #fff; box-shadow: none; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 17px; margin: 20px 0; }
.stat-grid a { position: relative; display: grid; gap: 5px; padding: 21px 23px; overflow: hidden; border: 1px solid #eadfe1; border-radius: 18px; color: #3b3033; background: #fff; box-shadow: 0 7px 25px #50101e0a; }
.stat-grid a::after { content: ""; position: absolute; width: 7px; inset: 0 auto 0 0; background: var(--brand-red); }.stat-grid span { color: #897b7f; font-size: 11px; }.stat-grid b { font-size: 28px; }.stat-grid small { color: #aa9da0; font-size: 9px; }
.management-columns { display: grid; grid-template-columns: 1.1fr .9fr; gap: 18px; }
.panel { overflow: hidden; border: 1px solid #eadfe1; border-radius: 18px; background: #fff; box-shadow: 0 8px 28px #50101e0b; }
.panel-heading { display: flex; justify-content: space-between; align-items: center; gap: 15px; padding: 20px 22px; border-bottom: 1px solid #f0e8ea; }.panel-heading h2 { margin: 0; font-size: 15px; }.panel-heading p { margin: 4px 0 0; color: #a09296; font-size: 9px; }.panel-heading > a { color: var(--brand-red); font-size: 10px; }
.compact-list article, .activity-list article { display: flex; align-items: center; gap: 11px; padding: 13px 20px; border-bottom: 1px solid #f3edef; }.compact-list article:last-child, .activity-list article:last-child { border: 0; }
.compact-list article > div:nth-child(2), .activity-list article > div { display: grid; gap: 3px; min-width: 0; flex: 1; }.compact-list b, .activity-list b { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }.compact-list small, .activity-list small { color: #a19497; font-size: 9px; }
.book-mini { display: grid; place-items: center; width: 38px; height: 47px; flex: 0 0 auto; border-radius: 7px 10px 10px 7px; color: #fff; background: linear-gradient(145deg, #e9374a, #9d1226); font: 700 8px Arial; }.activity-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--brand-red); box-shadow: 0 0 0 5px #df263914; }.activity-list time { color: #aa9da0; font-size: 9px; }
.status-pill, .event-badge { display: inline-flex; padding: 5px 9px; border-radius: 999px; color: #806f73; background: #f1ecee; font-size: 9px; white-space: nowrap; }.status-pill.online { color: #197353; background: #e6f7f0; }
.page-actions { display: flex; justify-content: space-between; gap: 15px; margin-bottom: 17px; }.primary-action { display: inline-flex; align-items: center; justify-content: center; }
.management-search { display: flex; width: min(470px, 100%); overflow: hidden; border: 1px solid #e6dade; border-radius: 13px; background: #fff; }.management-search input { min-width: 0; flex: 1; padding: 12px 15px; border: 0; outline: 0; font: 12px "Bon"; }.management-search button { border: 0; padding: 0 16px; color: #fff; background: #35282b; font: 11px "Bon"; }
.table-panel { width: 100%; }.responsive-table { overflow-x: auto; }table { width: 100%; border-collapse: collapse; text-align: right; }th { padding: 13px 17px; color: #97898d; background: #faf8f8; font-size: 9px; font-weight: 600; }td { padding: 14px 17px; border-top: 1px solid #f1eaec; color: #4c4043; font-size: 10px; vertical-align: middle; }td > b, td > small { display: block; }td > small { margin-top: 4px; color: #a4979a; }.table-tags { display: flex; flex-wrap: wrap; gap: 4px; }.table-tags span { padding: 4px 7px; border-radius: 7px; background: #f3eef0; font-size: 8px; }.row-actions { display: flex; gap: 6px; }.row-actions a { padding: 6px 8px; border: 1px solid #eadde0; border-radius: 8px; color: #a71127; white-space: nowrap; }.empty-row { padding: 30px !important; color: #a4979a; text-align: center; }
.form-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 19px; align-items: start; }.management-form { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; padding: 23px; }.form-field { display: grid; align-content: start; gap: 7px; }.form-field > label { color: #5b4e51; font-size: 10px; font-weight: 700; }.form-field.wide, .form-actions, .form-errors { grid-column: 1 / -1; }.form-control { width: 100%; padding: 11px 12px; border: 1px solid #e4d8dc; border-radius: 10px; outline: 0; background: #fcfafb; font: 11px "Bon"; }.form-control:focus { border-color: #df263978; box-shadow: 0 0 0 3px #df263910; }.form-field em { color: #bd1b32; font-size: 9px; font-style: normal; }.checkbox-field > div { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }.checkbox-field > div label { display: flex; gap: 6px; padding: 9px; border: 1px solid #eadfe1; border-radius: 9px; font-size: 9px; }.form-actions { display: flex; align-items: center; justify-content: flex-end; gap: 14px; padding-top: 14px; border-top: 1px solid #f0e8ea; }.form-actions a { color: #8e7f83; font-size: 11px; }.form-guide { padding: 26px; border-radius: 18px; color: #fff; background: linear-gradient(155deg, #3c1820, #9c1327); }.form-guide img { width: 90px; height: 67px; padding: 5px; border-radius: 15px; background: #fff; object-fit: contain; }.form-guide h3 { margin: 18px 0 8px; }.form-guide p, .form-guide li { color: #f1dce0; font-size: 10px; line-height: 1.9; }.form-guide ul { padding-right: 17px; }
.form-guide .guide-cover { width: 105px; height: 145px; padding: 0; border-radius: 12px; object-fit: cover; box-shadow: 0 12px 28px #18050a66; }
.field-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; }.field-title > label { color: #5b4e51; font-size: 10px; font-weight: 700; }.field-title > a { color: var(--brand-red); font-size: 9px; }.field-title > span { padding: 3px 7px; border-radius: 999px; color: #8e7d81; background: #f3edef; font-size: 8px; }
.exceptional-access { padding: 17px; border: 1px dashed #dcbfc5; border-radius: 14px; background: #fdfafb; }.exceptional-access > p { margin: 0; color: #8f7f83; font-size: 9px; line-height: 1.8; }.user-picker-grid { display: grid; grid-template-columns: .8fr 1.2fr; gap: 13px; }.user-picker-grid label { display: grid; gap: 7px; color: #65575a; font-size: 9px; }.user-picker-grid select[multiple] { min-height: 150px; direction: ltr; text-align: left; }
.folder-layout { display: grid; grid-template-columns: minmax(300px, .75fr) minmax(0, 1.25fr); gap: 18px; align-items: start; }.folder-form { grid-template-columns: 1fr; }.folder-form .form-actions { grid-column: 1; }.folder-list article { display: flex; align-items: center; gap: 12px; padding: 14px 20px; border-bottom: 1px solid #f1eaec; }.folder-list article:last-child { border: 0; }.folder-list article > span { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; color: #bb1930; background: #fff0f2; }.folder-list article > div { display: grid; gap: 3px; flex: 1; }.folder-list b { font-size: 11px; }.folder-list small { color: #9b8d91; font-size: 9px; }.folder-list em { color: #a39498; font-size: 9px; font-style: normal; }
.book-table-title { display: flex; align-items: center; gap: 10px; min-width: 220px; }.book-table-title > img, .book-table-title > span { width: 38px; height: 49px; flex: 0 0 auto; border-radius: 6px; object-fit: cover; }.book-table-title > span { display: grid; place-items: center; color: #fff; background: linear-gradient(145deg, #e9374a, #9d1226); font: 700 7px Arial; }.book-table-title > div { min-width: 0; }.book-table-title b, .book-table-title small { display: block; }
.online-summary { display: flex; align-items: center; gap: 15px; margin-bottom: 17px; padding: 17px 20px; border: 1px solid #cce8dd; border-radius: 15px; background: #effaf6; }.online-summary div { display: grid; gap: 3px; }.online-summary b { color: #21684f; font-size: 13px; }.online-summary small { color: #70a08f; font-size: 9px; }.pulse { width: 12px; height: 12px; border-radius: 50%; background: #25a977; box-shadow: 0 0 0 7px #25a9771e; }.log-section + .log-section { margin-top: 18px; }

@media (max-width: 900px) { .management-shell { grid-template-columns: 1fr; }.management-sidebar { position: static; width: 100%; height: auto; padding: 14px; }.management-brand { margin-bottom: 12px; }.management-sidebar nav { display: flex; overflow-x: auto; }.management-sidebar nav a { white-space: nowrap; }.sidebar-back { margin-top: 10px; }.management-columns, .form-layout, .folder-layout { grid-template-columns: 1fr; }.stat-grid { grid-template-columns: 1fr; }.management-header { position: static; }.checkbox-field > div { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .management-content, .flash-stack { width: calc(100% - 24px); }.management-header { padding: 12px 15px; }.management-user span { display: none; }.management-welcome, .page-actions, .read-sign-actions { align-items: stretch; flex-direction: column; }.management-form { grid-template-columns: 1fr; }.form-field { grid-column: 1 / -1; }.checkbox-field > div, .release-card dl, .user-picker-grid { grid-template-columns: 1fr; }.read-sign-dialog { padding: 26px 20px; } }

/* Library dashboard */
.site-header {
  position: sticky;
  z-index: 20;
  top: 12px;
}

.site-brand {
  display: flex;
  align-items: center;
  gap: 13px;
}

.site-brand > img { width: 82px; height: 61px; object-fit: contain; }

.site-brand > div {
  display: grid;
  gap: 4px;
}

.site-brand strong { color: #251f21; font-size: 16px; }
.site-brand small { color: #8a7e81; font-size: 11px; }

.site-header nav {
  display: flex;
  align-items: center;
  gap: 14px;
}

.site-header nav > a:last-child {
  padding: 8px 13px;
  border-radius: 10px;
  color: #a81529;
  background: var(--brand-red-soft);
}

.admin-link {
  padding: 8px 13px;
  border-radius: 10px;
  color: #fff;
  background: var(--brand-red);
}

body > main > .hero {
  position: relative;
  overflow: hidden;
  padding: 44px 50px;
  background: linear-gradient(135deg, #e93449, #b8132a 68%, #8e1022);
  box-shadow: 0 18px 45px #9f132b28;
}

body > main > .hero::after {
  position: absolute;
  content: "";
  width: 330px;
  height: 330px;
  top: -210px;
  left: -80px;
  border: 60px solid #ffffff14;
  border-radius: 50%;
}

.hero > span { color: #ffdce1; font-size: 12px; }
.hero h1 { margin: 9px 0 6px; font-size: 31px; }
.hero p { color: #ffe8eb; }

.search-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
  padding: 0 17px;
  border: 1px solid #eadfe1;
  border-radius: 15px;
  background: #fff;
  box-shadow: 0 8px 24px #50101e0b;
}

.search-wrap > span { color: var(--brand-red); font-size: 24px; }
.search-wrap .search { margin: 0; padding-right: 0; border: 0; outline: 0; box-shadow: none; }

.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 22px;
}

.document-card {
  display: grid;
  grid-template-columns: 112px 1fr;
  min-height: 310px;
  overflow: hidden;
  border: 1px solid #e9dfe1;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 10px 32px #54101f0d;
  transition: transform .2s ease, box-shadow .2s ease;
}

.document-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 38px #54101f17;
}

.document-cover {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  color: #fff;
  background: linear-gradient(160deg, #e63247, #a41127);
}

.document-cover-logo {
  width: 86px;
  height: 64px;
  padding: 5px;
  border-radius: 16px;
  background: #fff;
  object-fit: contain;
}

.document-cover .document-cover-image {
  width: 100%;
  height: 100%;
  padding: 0;
  border-radius: 0;
  object-fit: cover;
  box-shadow: none;
}

.document-cover b { letter-spacing: 3px; }

.document-content {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 20px;
}

.document-topline {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.version-badge,
.offline-badge,
.department-tags span {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 10px;
}

.version-badge { color: #fff; background: var(--brand-red); }
.offline-badge { color: #35695b; background: #e8f6f1; }
.document-content h2 { margin: 14px 0 8px; color: #261f21; font-size: 18px; }
.document-content > p { margin: 0 0 12px; color: #7d7275; font-size: 12px; line-height: 1.9; }

.department-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 14px;
}

.department-tags span { color: #786b6f; background: #f5f1f2; }

.document-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: auto 0 12px;
}

.document-meta div { display: grid; gap: 3px; }
.document-meta dt { color: #a09598; font-size: 9px; }
.document-meta dd { margin: 0; color: #4b4144; font-size: 11px; }

.version-history {
  margin: 2px 0 13px;
  color: #6f6367;
  font-size: 11px;
}

.version-history summary { cursor: pointer; color: var(--brand-red-dark); }
.version-history ul { margin: 9px 0 0; padding: 0; list-style: none; }
.version-history li { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-top: 1px solid #f0eaeb; }

.read-button {
  display: block;
  padding: 11px 15px;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(135deg, #e93449, #b9132b);
  text-align: center;
  font-size: 12px;
  font-weight: 600;
}

.empty-library {
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  min-height: 340px;
  padding: 40px;
  border: 1px dashed #d9c8cc;
  border-radius: 24px;
  background: #fff;
  text-align: center;
}

.empty-library img { width: 108px; height: 80px; object-fit: contain; }
.empty-library h2 { margin: 18px 0 6px; font-size: 18px; }
.empty-library p { margin: 0; color: #857a7d; font-size: 12px; }

/* PDF reader */
.reader {
  min-height: 100vh;
  overflow: hidden;
  background: #11161d;
}

.pdf-reader {
  display: grid;
  grid-template-rows: auto 1fr;
  width: 100%;
  height: 100vh;
  margin: 0;
}

.reader .reader-header {
  position: relative;
  z-index: 10;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto minmax(150px, .6fr);
  gap: 15px;
  align-items: center;
  width: 100%;
  min-height: 72px;
  margin: 0;
  padding: 10px 18px;
  border-radius: 0;
  color: #fff;
  background: #1b222c;
  box-shadow: 0 8px 24px #0005;
}

.reader-title {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 11px;
}

.reader-title > a {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border-radius: 10px;
  color: #fff;
  background: #ffffff12;
}

.reader-title img {
  width: 58px;
  height: 43px;
  padding: 3px;
  border-radius: 11px;
  background: #fff;
  object-fit: contain;
}

.reader-title > div {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.reader-title strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.reader-title small { color: #aeb8c5; font-size: 9px; }

.reader-tools {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  direction: ltr;
}

.reader-tool-group {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.zoom-value {
  min-width: 38px;
  color: #dfe5ec;
  font: 500 10px/1 "Bon", Arial, sans-serif;
  text-align: center;
  white-space: nowrap;
}

.reader .reader-tools button {
  display: grid;
  place-items: center;
  min-width: 34px;
  height: 34px;
  padding: 0 9px;
  border: 1px solid #ffffff12;
  border-radius: 9px;
  color: #fff;
  background: #ffffff0a;
  font: 500 15px "Bon", Arial, sans-serif;
  cursor: pointer;
}

.reader .reader-tools button:hover { border-color: #df263980; background: #df263930; }
.reader .reader-tools button[aria-pressed="true"] { border-color: #df2639; background: #b8132a; }
.reader .reader-tools button:disabled { opacity: .42; cursor: not-allowed; }
.reader .reader-tools button[data-action="fullscreen"] {
  border-color: #df263980;
  background: #b8132a;
}
.tool-separator { width: 1px; height: 23px; background: #ffffff1a; }

.page-control {
  display: flex;
  align-items: center;
  gap: 5px;
  direction: rtl;
  color: #aeb8c5;
  font-size: 10px;
}

.page-control input {
  width: 48px;
  height: 34px;
  border: 1px solid #ffffff18;
  border-radius: 9px;
  outline: 0;
  color: #fff;
  background: #11161d;
  text-align: center;
  font: inherit;
}

.reader-search {
  display: flex;
  align-items: center;
  height: 34px;
  overflow: hidden;
  border: 1px solid #ffffff18;
  border-radius: 9px;
  background: #11161d;
}

.reader-search input {
  width: 135px;
  border: 0;
  outline: 0;
  padding: 0 10px;
  color: #fff;
  background: transparent;
  direction: rtl;
  font: 10px "Bon", Arial, sans-serif;
}

.reader .reader-search button { border: 0; border-radius: 0; background: transparent; }
.search-result { min-width: 38px; color: #aeb8c5; font-size: 9px; direction: rtl; }

.reader-status {
  display: flex;
  justify-content: flex-end;
  color: #8fd7bd;
  font-size: 9px;
}

.reader-status span::before {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-left: 6px;
  border-radius: 50%;
  background: #4ac295;
  content: "";
}

.reader-workspace {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 0;
  direction: ltr;
}

.outline-panel {
  position: relative;
  z-index: 8;
  width: 0;
  min-width: 0;
  flex: 0 0 0;
  overflow: hidden;
  border-right: 0 solid #303946;
  color: #e8edf3;
  background: #1b222c;
  opacity: 0;
  visibility: hidden;
  transition: flex-basis .22s ease, width .22s ease, opacity .18s ease;
}

.outline-open .outline-panel {
  width: 330px;
  flex-basis: 330px;
  border-right-width: 1px;
  opacity: 1;
  visibility: visible;
}

.outline-panel-content {
  display: grid;
  grid-template-rows: auto 1fr;
  width: 330px;
  height: 100%;
  direction: rtl;
}

.outline-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 15px 13px;
  border-bottom: 1px solid #ffffff12;
  text-align: right;
}

.outline-header > div { display: grid; gap: 3px; }
.outline-header strong { font-size: 13px; }
.outline-header small { color: #9aa6b5; font-size: 9px; }
.outline-header button {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid #ffffff18;
  border-radius: 8px;
  color: #fff;
  background: #ffffff09;
  font-size: 20px;
  cursor: pointer;
}

.outline-list {
  overflow: auto;
  padding: 9px 7px 24px;
  direction: ltr;
}

.outline-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 38px;
  margin: 1px 0;
  padding: 7px 9px 7px calc(10px + var(--outline-depth, 0) * 15px);
  border: 0;
  border-left: 3px solid transparent;
  border-radius: 7px;
  color: #d9e0e8;
  background: transparent;
  text-align: left;
  font: 10px/1.55 "Bon", Arial, sans-serif;
  cursor: pointer;
}

.outline-entry span { overflow-wrap: anywhere; unicode-bidi: plaintext; }
.outline-entry small { color: #8895a5; font: 9px "Bon", Arial, sans-serif; }
.outline-entry:hover { color: #fff; background: #ffffff0b; }
.outline-entry.active { border-left-color: #df2639; color: #fff; background: #df26391d; }
.outline-entry.active small { color: #ff9aa8; }

.reader-stage {
  position: relative;
  min-width: 0;
  flex: 1 1 auto;
  overflow: auto;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
  padding: 32px;
  background: radial-gradient(circle at center top, #303945, #151a21 70%);
  text-align: center;
}

.pdf-pages {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  width: 100%;
  min-width: min-content;
}

.pdf-page {
  position: relative;
  flex: 0 0 auto;
  margin: 0;
  overflow: hidden;
  direction: ltr;
  unicode-bidi: isolate;
  background: #fff;
  box-shadow: 0 18px 55px #0009;
}

.pdf-page-placeholder {
  display: grid;
  place-items: center;
  color: #8e99a7;
  background: #f5f6f8;
}

.pdf-page-placeholder.rendering::after {
  width: 28px;
  height: 28px;
  border: 3px solid #d7dce2;
  border-top-color: var(--brand-red);
  border-radius: 50%;
  content: "";
  animation: page-spin .8s linear infinite;
}

.page-number-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 4px 8px;
  border-radius: 999px;
  color: #7c8794;
  background: #e7eaee;
  font-size: 9px;
}

.page-render-error { color: #a81529; font-size: 11px; }

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

.pdf-page canvas { display: block; direction: ltr; }

.annotation-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  direction: ltr;
}

.pdf-link {
  position: absolute;
  z-index: 3;
  border: 1px solid transparent;
  pointer-events: auto;
  cursor: pointer;
  touch-action: manipulation;
}

.pdf-link:hover { border-color: #df2639aa; background: #df263920; }

.reader-watermark {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 50%;
  width: 75%;
  transform: translate(-50%, -50%) rotate(-28deg);
  color: #a4142720;
  font-size: clamp(18px, 3vw, 34px);
  font-weight: 700;
  pointer-events: none;
  user-select: none;
}

.reader-loading {
  position: absolute;
  z-index: 5;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: #d9e0e8;
  background: #151a21;
  font-size: 12px;
}

.reader-loading[hidden] { display: none; }
.reader-loading img { width: 105px; height: 78px; padding: 6px; border-radius: 20px; background: #fff; object-fit: contain; }

.reader-stage:fullscreen {
  width: 100vw;
  height: 100vh;
  padding: 24px;
  overflow: auto;
  background: #151a21;
}

.reader-stage:fullscreen .pdf-pages { gap: 22px; }

.fullscreen-exit {
  display: none;
  position: fixed;
  z-index: 10001;
  top: max(10px, env(safe-area-inset-top));
  right: max(10px, env(safe-area-inset-right));
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid #ffffff4d;
  border-radius: 50%;
  color: #fff;
  background: #b8132ae6;
  box-shadow: 0 5px 18px #0007;
  font: 24px/1 Arial, sans-serif;
  cursor: pointer;
}

.reader-stage:fullscreen .fullscreen-exit,
.reader-stage:-webkit-full-screen .fullscreen-exit,
.reader-pseudo-fullscreen .fullscreen-exit { display: grid; }

.reader-pseudo-fullscreen .reader-stage {
  position: fixed;
  z-index: 10000;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
  overflow: auto;
  background: #151a21;
}

body:has(.reader-pseudo-fullscreen) { overflow: hidden; }

@media (max-width: 980px) {
  .reader .reader-header {
    grid-template-columns: 1fr auto;
  }
  .reader-tools {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 2px;
  }
  .reader-status { grid-column: 2; grid-row: 1; }
  .pdf-reader { grid-template-rows: auto 1fr; }
}

@media (max-width: 650px) {
  .site-header { position: static; align-items: flex-start; }
  .site-header nav { align-items: flex-end; flex-direction: column; gap: 7px; }
  .site-header nav > span { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  body > main > .hero { padding: 32px 25px; }
  .library-grid { grid-template-columns: 1fr; }
  .document-card { grid-template-columns: 85px 1fr; }
  .document-content { padding: 16px; }
  .document-meta { grid-template-columns: 1fr; }
  .reader .reader-header { min-height: 0; padding: 7px 9px; gap: 7px; }
  .reader-title { max-width: calc(100vw - 128px); }
  .reader-title > a { width: 30px; height: 30px; }
  .reader-title strong { font-size: 11px; }
  .reader-title small { font-size: 8px; }
  .reader-title img { display: none; }
  .reader-status { max-width: 100px; font-size: 8px; text-align: left; }
  .reader-tools {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
    width: 100%;
    overflow: visible;
    padding: 0;
  }
  .reader-tool-group { width: 100%; gap: 4px; }
  .reader-navigation-tools { justify-content: space-between; }
  .reader-action-tools { justify-content: stretch; }
  .reader-tools .tool-separator { display: none; }
  .reader .reader-tools button { min-width: 30px; width: 30px; height: 30px; padding: 0 5px; font-size: 13px; }
  .reader .reader-tools .reader-search button { flex: 0 0 30px; }
  .zoom-value { min-width: 29px; font-size: 8px; }
  .reader-stage { padding: 12px 10px 24px; }
  .pdf-pages { gap: 14px; }
  .reader-search { min-width: 0; flex: 1 1 auto; height: 30px; }
  .reader-search input { width: 100%; min-width: 0; font-size: 9px; }
  .search-result { min-width: 42px; font-size: 8px; text-align: center; }
  .page-control { gap: 3px; font-size: 8px; white-space: nowrap; }
  .page-control input { width: 36px; height: 30px; padding: 0; }
  .reader-stage:fullscreen { padding: 10px; }
  .outline-panel {
    position: absolute;
    inset: 0 auto 0 0;
    box-shadow: 12px 0 35px #0009;
  }
  .outline-open .outline-panel {
    width: min(86vw, 330px);
    flex-basis: min(86vw, 330px);
  }
  .outline-panel-content { width: min(86vw, 330px); }
}

/* Global theme switch */
.theme-toggle {
  position: fixed;
  z-index: 100;
  left: 16px;
  bottom: 16px;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid #df263944;
  border-radius: 50%;
  color: #fff;
  background: #b8132a;
  box-shadow: 0 8px 24px #4f0b1738;
  font: 20px/1 Arial, sans-serif;
  cursor: pointer;
}

.theme-toggle:hover { transform: translateY(-1px); }

html[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e8edf3;
  --mist: #11161d;
  --line: #35404d;
  --login-ink: #f2ecee;
  --login-muted: #b8aaae;
  --brand-red-soft: #4a1822;
}

html[data-theme="dark"] body { background: #11161d; color: #e8edf3; }
html[data-theme="dark"] header,
html[data-theme="dark"] .search-wrap,
html[data-theme="dark"] .document-card,
html[data-theme="dark"] .empty-library,
html[data-theme="dark"] .panel,
html[data-theme="dark"] .stat-grid a,
html[data-theme="dark"] .management-header,
html[data-theme="dark"] .management-search,
html[data-theme="dark"] .release-card dl div,
html[data-theme="dark"] .notice { background: #1b222c; border-color: #343d48; color: #e8edf3; }
html[data-theme="dark"] .site-brand strong,
html[data-theme="dark"] .document-content h2,
html[data-theme="dark"] .stat-grid a,
html[data-theme="dark"] .management-header strong,
html[data-theme="dark"] td,
html[data-theme="dark"] .form-field > label,
html[data-theme="dark"] .field-title > label { color: #edf1f5; }
html[data-theme="dark"] .site-brand small,
html[data-theme="dark"] .document-content > p,
html[data-theme="dark"] .document-meta dd,
html[data-theme="dark"] .version-history,
html[data-theme="dark"] .panel-heading p,
html[data-theme="dark"] .compact-list small,
html[data-theme="dark"] .activity-list small { color: #aeb8c5; }
html[data-theme="dark"] .department-tags span,
html[data-theme="dark"] .table-tags span,
html[data-theme="dark"] .status-pill { color: #c8d0d9; background: #303946; }
html[data-theme="dark"] .version-history li,
html[data-theme="dark"] .compact-list article,
html[data-theme="dark"] .activity-list article,
html[data-theme="dark"] td,
html[data-theme="dark"] .panel-heading,
html[data-theme="dark"] .folder-list article { border-color: #323b47; }
html[data-theme="dark"] th { color: #aab4c0; background: #242c36; }
html[data-theme="dark"] .form-control,
html[data-theme="dark"] .management-search input,
html[data-theme="dark"] .search,
html[data-theme="dark"] .checkbox-field > div label,
html[data-theme="dark"] .exceptional-access { border-color: #3b4654; background: #171d25; color: #e8edf3; }
html[data-theme="dark"] .management-page { background: #11161d; color: #e8edf3; }
html[data-theme="dark"] .login { background: radial-gradient(circle at 15% 12%, #df26391a 0 2px, transparent 3px) 0 0 / 24px 24px, linear-gradient(145deg, #171318, #0d1117); }
html[data-theme="dark"] .login-card,
html[data-theme="dark"] .login-form-panel { background: #1b171c; color: #f2ecee; }
html[data-theme="dark"] .login-heading h2,
html[data-theme="dark"] .login-form label { color: #f2ecee; }
html[data-theme="dark"] .login-input-wrap { background: #2a2429; }
html[data-theme="dark"] .login-input-wrap:focus-within { background: #31292f; }
html[data-theme="dark"] .login-help small { border-color: #3b3238; }
html[data-theme="dark"] .read-sign-dialog { border-color: #453b41; background: #1b171cf2; }
html[data-theme="dark"] .read-sign-dialog h1,
html[data-theme="dark"] .release-card > strong,
html[data-theme="dark"] .release-card dd { color: #f1ebed; }
html[data-theme="dark"] .release-card,
html[data-theme="dark"] .read-sign-check { border-color: #453b41; background: #251f23; color: #d9d0d3; }

html[data-theme="light"] .reader .reader-header { color: #201b1c; background: #fff; }
html[data-theme="light"] .reader-title > a,
html[data-theme="light"] .reader .reader-tools button { color: #2c2427; background: #f5f1f2; border-color: #e7dfe1; }
html[data-theme="light"] .reader .reader-tools button[aria-pressed="true"] { color: #fff; background: #b8132a; }
html[data-theme="light"] .reader-title small,
html[data-theme="light"] .search-result { color: #776d70; }
html[data-theme="light"] .page-control input,
html[data-theme="light"] .reader-search { color: #2c2427; background: #f6f3f4; border-color: #e7dfe1; }
html[data-theme="light"] .reader-search input { color: #2c2427; }
html[data-theme="light"] .reader-stage { background: #dfe3e8; }
html[data-theme="light"] .outline-panel { color: #292225; background: #fff; border-color: #ddd5d8; }
html[data-theme="light"] .outline-header { border-color: #eee8ea; }
html[data-theme="light"] .outline-header small { color: #81767a; }
html[data-theme="light"] .outline-header button { color: #30272a; background: #f5f1f2; border-color: #e5dcdf; }
html[data-theme="light"] .outline-entry { color: #51474a; }
html[data-theme="light"] .outline-entry:hover { color: #201b1c; background: #f6f2f3; }
html[data-theme="light"] .outline-entry.active { color: #9f1227; background: #fff0f2; }

@media (max-width: 650px) {
  .theme-toggle { left: 10px; bottom: 10px; width: 38px; height: 38px; font-size: 18px; }
  .site-header { align-items: stretch; flex-direction: column; gap: 10px; }
  .site-header nav { justify-content: space-between; flex-wrap: wrap; gap: 8px; }
  .site-header nav > span { order: -1; width: 100%; max-width: none; }
  .site-brand > img { width: 66px; height: 49px; }
  .library-grid { grid-template-columns: minmax(0, 1fr); }
  .document-card { grid-template-columns: 92px minmax(0, 1fr); }
  .document-content { padding: 15px; }
  .management-sidebar nav { padding-bottom: 5px; scrollbar-width: thin; }
  .responsive-table table { min-width: 720px; }
  .management-content, .flash-stack { overflow-wrap: anywhere; }
}

@media (max-width: 430px) {
  body > main { width: calc(100% - 20px); }
  body > main > .hero { padding: 28px 20px; border-radius: 20px; }
  .document-card { grid-template-columns: 1fr; }
  .document-cover { min-height: 170px; }
  .document-cover .document-cover-image { max-height: 220px; object-position: center; }
  .document-meta { grid-template-columns: 1fr; }
  .management-header > div:first-child small { display: none; }
  .management-user { gap: 6px; }
  .management-form { padding: 15px; }
}
