:root {
  color-scheme: light;
  --ink: #241d34;
  --muted: #706b7e;
  --line: #e8e2ee;
  --surface: #fff;
  --canvas: #f7f5fa;
  --accent: #702bb1;
  --accent-dark: #512184;
  --mint: #c8f3e5;
  --mint-deep: #7ed7b9;
  --lavender: #f0e7f8;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--canvas);
  color: var(--ink);
  font: 16px/1.6 "Segoe UI", sans-serif;
}

a { color: var(--accent-dark); }
button, input, select { font: inherit; }
[hidden] { display: none !important; }

.card, .reader, .catalog-tools, .document-section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 14px 38px #382a500d;
}

.login-shell {
  min-height: 100vh;
  padding: 48px 16px 28px;
  display: grid;
  align-content: center;
  justify-items: center;
  background:
    radial-gradient(ellipse at 12% 18%, #d7f8ec 0, transparent 34%),
    radial-gradient(ellipse at 90% 86%, #e8d9f4 0, transparent 36%),
    var(--canvas);
}

.login {
  position: relative;
  width: min(480px, 100%);
  padding: clamp(26px, 6vw, 46px);
  overflow: hidden;
}

.login::before {
  position: absolute;
  inset: 0 0 auto;
  height: 7px;
  background: linear-gradient(90deg, var(--mint-deep), var(--accent));
  content: "";
}

.login-brand { margin-bottom: 36px; }
.login h1 { margin: 8px 0 10px; font-size: clamp(30px, 7vw, 40px); }
.login-lead { margin: 0 0 26px; color: var(--muted); }
.login-footnote { margin: 24px 0 0; }
.login-caption { margin: 22px 0 0; color: var(--muted); font-size: 13px; }
.login-caption span { padding: 0 6px; color: var(--accent); }
.login-submit { width: 100%; margin-top: 4px; display: flex; justify-content: space-between; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  border-radius: 14px;
  background: var(--mint);
  color: var(--accent-dark);
  font-size: 21px;
  font-weight: 850;
}

.brand-copy { display: grid; line-height: 1.15; }
.brand-copy strong { font-size: 15px; letter-spacing: .03em; }
.brand-copy small { margin-top: 4px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .13em; }

.eyebrow {
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}

h1 { line-height: 1.2; }

.button, .link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 0;
  border-radius: 11px;
  padding: 11px 17px;
  background: var(--accent);
  color: white;
  font: inherit;
  font-weight: 750;
  text-decoration: none;
  cursor: pointer;
  transition: background .16s ease, transform .16s ease, box-shadow .16s ease;
}

.button:hover, .link-button:hover { background: var(--accent-dark); box-shadow: 0 6px 16px #51218429; transform: translateY(-1px); }
.button:focus-visible, .link-button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid var(--mint-deep);
  outline-offset: 3px;
}

label { display: block; margin: 18px 0 7px; font-size: 14px; font-weight: 750; }
input[type="password"], input[type="search"], select {
  width: 100%;
  min-height: 46px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  color: var(--ink);
  font: inherit;
}
input[type="password"] { margin-bottom: 16px; }
input::placeholder { color: #9993a4; }

.muted { color: var(--muted); font-size: 13px; }
.notice {
  padding: 12px 14px;
  border: 1px solid #d5efe4;
  border-left: 4px solid #34a77e;
  border-radius: 8px;
  background: #effbf6;
  color: #315a4b;
  font-size: 13px;
}

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.document-total { color: var(--muted); font-size: 14px; }
.document-total strong { color: var(--accent-dark); font-size: 18px; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 3;
  min-height: 76px;
  padding: 12px max(20px, calc((100% - 1180px) / 2));
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  background: #ffffffed;
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.account { display: flex; align-items: center; gap: 18px; color: var(--muted); font-size: 14px; }
.account > a { text-decoration: none; }
.account form { margin: 0; }
.account .link-button { padding: 7px 10px; background: var(--lavender); color: var(--accent-dark); }

.layout {
  width: min(1180px, calc(100% - 36px));
  margin: 38px auto 72px;
}

.hero {
  position: relative;
  min-height: 290px;
  margin-bottom: 24px;
  padding: clamp(26px, 5vw, 52px);
  display: flex;
  align-items: center;
  overflow: hidden;
  border: 1px solid #e6deef;
  border-radius: 22px;
  background: linear-gradient(112deg, #effcf7 0%, #fbf9fd 55%, #f1e9f8 100%);
}

.hero-copy { position: relative; z-index: 1; width: min(720px, 78%); }
.hero h1 { margin: 8px 0 12px; font-size: clamp(36px, 6vw, 56px); letter-spacing: -.045em; }
.hero h1 span { color: var(--accent); }
.hero-copy > p:not(.eyebrow):not(.notice) { max-width: 570px; color: var(--muted); font-size: 17px; }
.hero .notice { margin: 20px 0; }
.hero-orbit {
  position: absolute;
  right: 7%;
  width: clamp(160px, 23vw, 260px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 1px solid #8ccfb56b;
  border-radius: 50%;
  background: #c8f3e56b;
  box-shadow: 0 0 0 20px #c8f3e52e, 0 0 0 42px #f0e7f86e;
  color: #542387;
  font-size: clamp(72px, 12vw, 130px);
  font-weight: 850;
}

.catalog-tools {
  margin: 20px 0 30px;
  padding: 12px 20px 20px;
  display: grid;
  grid-template-columns: minmax(240px, 2fr) minmax(180px, 1fr) minmax(160px, .8fr);
  gap: 16px;
}

.catalog-tools label { margin-top: 6px; }
.search-control input, .filter-control select { min-height: 44px; }
.empty-results { padding: 18px; border-radius: 12px; background: var(--lavender); color: var(--accent-dark); }
.document-section { margin: 24px 0; padding: 22px; }
.section-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.section-heading h2 { margin: 0; font-size: 20px; letter-spacing: -.02em; }
.section-kicker { margin: 0 0 3px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .14em; }
.section-heading .link-button { padding: 8px 12px; background: var(--lavender); color: var(--accent-dark); font-size: 13px; }
.document-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 9px; }
.document-link {
  display: grid;
  grid-template-columns: 54px 1fr 16px;
  gap: 12px;
  align-items: center;
  min-height: 60px;
  padding: 10px 13px;
  border: 1px solid #ece8f0;
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  overflow-wrap: anywhere;
  transition: border-color .16s ease, background .16s ease, transform .16s ease;
}

.document-link:hover {
  transform: translateY(-1px);
  border-color: #bda1d8;
  background: #fcfaff;
}

.document-type {
  width: fit-content;
  min-width: 42px;
  padding: 4px 7px;
  border-radius: 7px;
  background: var(--mint);
  color: #28644f;
  font-size: 10px;
  font-weight: 850;
  text-align: center;
  letter-spacing: .04em;
}

.document-name { font-size: 13px; }
.arrow { color: var(--accent); font-size: 18px; }

.reader {
  width: min(1000px, calc(100% - 32px));
  margin: 36px auto 72px;
  padding: clamp(22px, 5vw, 56px);
  overflow-wrap: anywhere;
}

.reader-crumbs { display: flex; flex-wrap: wrap; gap: 9px; color: var(--muted); font-size: 12px; }
.reader-crumbs a { color: var(--accent); text-decoration: none; font-weight: 700; }
.reader-heading { margin: 28px 0 32px; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.reader-heading .eyebrow { margin-bottom: 8px; }
.reader-heading h1 { margin: 0; font-size: clamp(28px, 5vw, 42px); letter-spacing: -.035em; }
.reader-path { margin: 9px 0 0; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.markdown { line-height: 1.7; }
.markdown h1, .markdown h2, .markdown h3 { margin-top: 1.7em; line-height: 1.25; }
.markdown h1, .markdown h2 { color: var(--accent-dark); }
.markdown table {
  display: block;
  width: 100%;
  margin: 24px 0;
  overflow-x: auto;
  border-collapse: collapse;
  overflow-wrap: normal;
}
.markdown th, .markdown td {
  min-width: 180px;
  max-width: 420px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  line-height: 1.65;
  white-space: normal;
  overflow-wrap: anywhere;
}
.markdown th { background: #f1edf5; }
.markdown pre { overflow-x: auto; padding: 16px; border-radius: 10px; background: #241d34; color: #f7f5ff; }
.markdown code { font-family: Consolas, monospace; }
.markdown :not(pre) > code { padding: 2px 5px; background: #f2edf7; border-radius: 4px; }
.markdown blockquote { margin-left: 0; padding: 12px 16px; border-left: 3px solid var(--mint-deep); background: #effbf6; color: #4a655b; }
.diagram-error { padding: 10px 12px; border-left: 3px solid #d59a19; background: #fff8e8; }

@media (max-width: 760px) {
  .catalog-tools { grid-template-columns: 1fr 1fr; }
  .search-control { grid-column: 1 / -1; }
  .hero-copy { width: 100%; }
  .hero-orbit { right: -80px; opacity: .38; }
}

@media (max-width: 560px) {
  .topbar { position: static; align-items: flex-start; }
  .account { align-items: flex-end; flex-direction: column; gap: 5px; }
  .account > span { display: none; }
  .layout { width: min(100% - 24px, 1180px); margin-top: 18px; }
  .hero { min-height: 0; padding: 26px 20px; }
  .hero h1 { font-size: 36px; }
  .hero-orbit { width: 150px; right: -90px; }
  .catalog-tools { grid-template-columns: 1fr; padding: 8px 16px 16px; }
  .search-control { grid-column: auto; }
  .document-section { padding: 16px; }
  .section-heading { align-items: flex-start; }
  .section-heading .link-button { font-size: 12px; }
  .document-list { grid-template-columns: 1fr; }
  .reader { padding: 20px; }
  .actions { align-items: flex-start; }
  .login-shell { padding-inline: 12px; }
}
