:root {
  --ink: #07111f;
  --ink-2: #101e30;
  --panel: #ffffff;
  --paper: #edf2f4;
  --muted: #596b7d;
  --line: #c8d3db;
  --line-dark: #26374b;
  --cyan: #00d8d0;
  --cyan-dark: #007f7b;
  --cyan-pale: #cffffc;
  --danger: #b42318;
  --success: #067647;
  --warning: #9a6700;
  --shadow: 0 18px 44px rgba(7, 17, 31, 0.12);
}

* { box-sizing: border-box; }

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
}

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

.shell {
  width: min(1200px, calc(100% - 48px));
  margin-inline: auto;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 10px;
  z-index: 99;
  padding: 10px 14px;
  color: var(--ink);
  background: #fff;
}

.skip-link:focus { left: 10px; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.97);
  border-top: 5px solid #004c5b;
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.nav-wrap {
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
}

.brand {
  min-width: 320px;
  display: flex;
  align-items: center;
  gap: 17px;
  text-decoration: none;
}

.brand img {
  width: 96px;
  height: 57px;
  display: block;
  object-fit: contain;
}

.brand-divider {
  width: 2px;
  height: 38px;
  display: block;
  background: var(--cyan);
}

.brand-product { display: flex; flex-direction: column; line-height: 1.1; }
.brand-product strong { font-size: 1.1rem; letter-spacing: 0.16em; }
.brand-product small { margin-top: 5px; color: var(--muted); font-size: 0.72rem; font-weight: 700; }

.nav-wrap nav {
  display: flex;
  align-items: center;
  gap: 24px;
}

.nav-wrap nav > a,
.nav-button {
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 750;
  text-decoration: none;
}

.nav-wrap nav > a:hover,
.nav-button:hover { color: var(--cyan); }

.inline-form { display: inline; }

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

.button,
.button-secondary,
.button-danger {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 11px 20px;
  color: #fff;
  background: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 3px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.16s, background 0.16s, border-color 0.16s, transform 0.16s;
}

.site-header .button {
  min-height: 40px;
  color: #fff;
  background: #004c5b;
  border-color: #004c5b;
}

.button:hover {
  color: var(--ink);
  background: var(--cyan);
  border-color: var(--cyan);
  transform: translateY(-1px);
}

.button-small { min-height: 38px; padding: 7px 13px; font-size: 0.84rem; }
.button-wide { width: 100%; min-height: 52px; }
.button-secondary { color: var(--ink); background: #e3eaee; border-color: #c9d4da; }
.button-danger { background: var(--danger); border-color: var(--danger); }

.search-stage {
  position: relative;
  overflow: hidden;
  padding: 86px 0 82px;
  color: #fff;
  background-color: var(--ink);
  background-image:
    linear-gradient(rgba(0, 216, 208, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 216, 208, 0.07) 1px, transparent 1px);
  background-size: 40px 40px;
}

.search-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(7, 17, 31, 0.26), rgba(7, 17, 31, 0.94));
  pointer-events: none;
}

.search-stage::after {
  content: "01 / KNOWLEDGE BASE";
  position: absolute;
  right: 36px;
  bottom: 20px;
  color: rgba(0, 216, 208, 0.48);
  font: 700 0.72rem ui-monospace, SFMono-Regular, Consolas, monospace;
  letter-spacing: 0.16em;
}

.stage-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 72px;
  align-items: center;
}

.stage-action {
  position: relative;
  padding-bottom: 128px;
}

.stage-photo {
  height: 330px;
  margin: 0;
  overflow: hidden;
  border: 1px solid #35516a;
  border-top: 5px solid var(--cyan);
  background: #13263a;
}

.stage-photo img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center 56%;
  filter: saturate(0.82) contrast(1.06);
}

.stage-photo figcaption {
  position: absolute;
  top: 14px;
  right: 14px;
  padding: 6px 9px;
  color: #fff;
  background: rgba(7, 17, 31, 0.84);
  font: 700 0.67rem ui-monospace, SFMono-Regular, Consolas, monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.eyebrow {
  margin: 0 0 13px;
  color: var(--cyan-dark);
  font: 800 0.76rem ui-monospace, SFMono-Regular, Consolas, monospace;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.search-stage .eyebrow { color: var(--cyan); }

.search-stage h1,
.page-heading h1,
.form-intro h1,
.detail-main h1,
.admin-page h1 {
  margin: 0;
  font-size: clamp(2.6rem, 5.4vw, 5.3rem);
  line-height: 0.98;
  letter-spacing: -0.055em;
}

.search-stage h1 span { color: var(--cyan); }

.lead {
  max-width: 620px;
  margin-bottom: 0;
  color: #aebdca;
  font-size: 1.05rem;
}

.search-card {
  position: relative;
  width: calc(100% - 34px);
  position: absolute;
  right: 0;
  bottom: 0;
  padding: 31px;
  color: var(--ink);
  background: #fff;
  border-top: 5px solid var(--cyan);
  box-shadow: var(--shadow);
}

.search-card::before {
  content: "SEARCH";
  position: absolute;
  right: 16px;
  top: 11px;
  color: #8a9aa8;
  font: 700 0.65rem ui-monospace, SFMono-Regular, Consolas, monospace;
  letter-spacing: 0.14em;
}

.search-card label {
  display: block;
  margin-bottom: 12px;
  font-size: 1.06rem;
  font-weight: 800;
}

.search-row { display: flex; gap: 8px; }

.search-row input,
.compact-search input {
  flex: 1;
  min-width: 0;
  padding: 14px 16px;
  color: var(--ink);
  background: #f8fafb;
  border: 1px solid #a9b8c2;
  border-radius: 2px;
}

.search-row input:focus,
.compact-search input:focus {
  outline: 3px solid rgba(0, 216, 208, 0.25);
  border-color: var(--cyan-dark);
}

.search-card > a {
  display: inline-block;
  margin-top: 18px;
  color: var(--cyan-dark);
  font-weight: 800;
  text-decoration: none;
}

.content-section,
.page-section { padding-block: 68px; }

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 26px;
  padding-bottom: 19px;
  border-bottom: 2px solid var(--ink);
}

.section-heading h2 { margin: 0; font-size: 2rem; letter-spacing: -0.03em; }
.section-heading > a { color: var(--cyan-dark); font-weight: 800; }

.term-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.term-card {
  position: relative;
  min-height: 260px;
  display: flex;
  flex-direction: column;
  padding: 23px;
  background: #fff;
  border: 1px solid var(--line);
  border-top: 4px solid var(--ink);
  transition: border-color 0.16s, transform 0.16s, box-shadow 0.16s;
}

.term-card:hover {
  border-top-color: var(--cyan-dark);
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.term-index {
  color: var(--cyan-dark);
  font: 800 0.72rem ui-monospace, SFMono-Regular, Consolas, monospace;
}

.term-card h3 { margin: 27px 0 10px; font-size: 1.4rem; line-height: 1.15; }
.term-card h3 a { text-decoration: none; }
.term-card p { margin: 0; color: var(--muted); }

.card-meta {
  display: flex;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 23px;
  color: var(--muted);
  font-size: 0.79rem;
  border-top: 1px solid #e1e7ea;
}

.empty-state {
  padding: 60px;
  text-align: center;
  background: #fff;
  border: 1px solid var(--line);
  border-left: 5px solid var(--cyan);
}

.empty-state h2,
.empty-state h3 { margin-top: 0; }
.page-heading { margin-bottom: 28px; }
.page-heading p:not(.eyebrow) { color: var(--muted); }
.compact-search { max-width: 780px; display: flex; gap: 8px; margin-bottom: 24px; }

.list-panel {
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-top: 4px solid var(--ink);
}

.term-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 30px;
  align-items: center;
  padding: 23px 25px;
  text-decoration: none;
  border-bottom: 1px solid var(--line);
}

.term-row:last-child { border-bottom: 0; }
.term-row:hover { background: #f5fbfb; }
.term-row h2 { margin: 0 0 5px; font-size: 1.22rem; }
.term-row p { margin: 0; color: var(--muted); }
.term-row > span:last-child { color: var(--cyan-dark); font-size: 1.35rem; }

.pagination { display: flex; justify-content: center; gap: 30px; margin-top: 28px; }
.pagination a { font-weight: 800; }

.detail-layout {
  min-height: 65vh;
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr) 250px;
  gap: 55px;
  padding-block: 88px;
}

.detail-number {
  color: var(--muted);
  font: 700 0.76rem ui-monospace, SFMono-Regular, Consolas, monospace;
}

.detail-main h1 { margin-bottom: 39px; }

.definition {
  padding-left: 26px;
  white-space: pre-line;
  font-family: Georgia, serif;
  font-size: clamp(1.25rem, 2vw, 1.62rem);
  line-height: 1.72;
  border-left: 5px solid var(--cyan);
}

.detail-aside { padding-left: 27px; border-left: 1px solid var(--line); }
.detail-aside dl { margin: 0 0 38px; }
.detail-aside dl div { margin-bottom: 21px; }
.detail-aside dt { color: var(--muted); font: 800 0.69rem ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: 0.1em; text-transform: uppercase; }
.detail-aside dd { margin: 4px 0 0; font-weight: 700; }
.detail-aside > a { color: var(--cyan-dark); font-weight: 800; }

.form-layout {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 78px;
  padding-block: 73px;
}

.form-intro { padding-top: 18px; }
.form-intro h1 { margin-bottom: 25px; font-size: clamp(2.5rem, 5vw, 4.7rem); }
.form-intro > p:not(.eyebrow) { max-width: 470px; color: var(--muted); font-size: 1.06rem; }

.steps { margin: 41px 0; padding: 0; list-style: none; }
.steps li { padding: 14px 0; font-weight: 750; border-top: 1px solid var(--line); }
.steps span { margin-right: 20px; color: var(--cyan-dark); font: 800 0.72rem ui-monospace, SFMono-Regular, Consolas, monospace; }

.form-card {
  padding: 34px;
  background: #fff;
  border: 1px solid var(--line);
  border-top: 5px solid var(--ink);
  box-shadow: var(--shadow);
}

.field { margin-bottom: 22px; }
.field label { display: block; margin-bottom: 7px; font-weight: 800; }

.field input,
.field textarea {
  width: 100%;
  display: block;
  padding: 12px 14px;
  color: var(--ink);
  background: #fbfcfd;
  border: 1px solid #9eafb9;
  border-radius: 2px;
}

.field textarea { resize: vertical; }
.field input:focus,
.field textarea:focus { outline: 3px solid rgba(0, 216, 208, 0.23); border-color: var(--cyan-dark); }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field-hint,
.privacy-note { margin-top: 7px; color: var(--muted); font-size: 0.82rem; }
.field-error { display: block; margin-top: 5px; color: var(--danger); font-size: 0.86rem; font-weight: 750; }

.auth-section { min-height: 65vh; display: grid; place-items: center; padding: 60px 20px; }
.auth-card { width: min(470px, 100%); }
.auth-card h1 { margin: 0 0 26px; font-size: 2rem; }
.flash-stack { padding-top: 16px; }
.flash { padding: 14px 18px; border-left: 4px solid; font-weight: 700; }
.flash-success { color: #05603a; background: #dcfae6; border-color: var(--success); }
.flash-error { color: #912018; background: #fee4e2; border-color: var(--danger); }
.flash-info { color: #075985; background: #e0f2fe; border-color: #0284c7; }

.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 34px; }
.stat { padding: 21px; background: #fff; border: 1px solid var(--line); border-top: 4px solid var(--ink); }
.stat span { display: block; color: var(--muted); font-size: 0.8rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; }
.stat strong { font-size: 2.5rem; line-height: 1.1; }
.stat-accent { background: var(--cyan-pale); border-color: var(--cyan-dark); }

.admin-grid { display: grid; grid-template-columns: 1.35fr 0.8fr; gap: 20px; }
.admin-grid > section { min-width: 0; }
.subheading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.subheading h2 { margin: 0; font-size: 1.23rem; }
.subheading span { min-width: 28px; color: #fff; background: var(--ink); text-align: center; }
.admin-list { overflow: hidden; background: #fff; border: 1px solid var(--line); border-top: 4px solid var(--ink); }
.admin-item { padding: 20px; border-bottom: 1px solid var(--line); }
.admin-item:last-child { border-bottom: 0; }
.admin-item h3 { margin: 0; }
.admin-item p { margin: 5px 0; color: var(--muted); }
.admin-item small,
.activity-row small { display: block; color: var(--muted); }
.actions { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.actions a { font-size: 0.88rem; font-weight: 800; }
.activity-row { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: center; padding: 15px; border-bottom: 1px solid var(--line); }
.activity-row:last-child { border: 0; }

.status { display: inline-block; padding: 4px 8px; border: 1px solid; border-radius: 2px; font-size: 0.7rem; font-weight: 850; }
.status-approved { color: #05603a; background: #dcfae6; border-color: #73c69a; }
.status-pending { color: #854d0e; background: #fff3c6; border-color: #e4b23c; }
.status-rejected { color: #912018; background: #fee4e2; border-color: #ef8f87; }
.empty-small { padding: 24px; color: var(--muted); }

.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-top: 4px solid var(--ink); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 16px 19px; text-align: left; border-bottom: 1px solid var(--line); }
th { color: #fff; background: var(--ink-2); font-size: 0.76rem; letter-spacing: 0.07em; text-transform: uppercase; }
tr:last-child td { border-bottom: 0; }

.danger-zone { display: flex; align-items: center; justify-content: space-between; margin-top: 20px; padding: 20px; background: #fff; border: 1px solid #efaaa4; border-left: 5px solid var(--danger); }
.danger-zone p { margin: 0; color: var(--muted); }

.error-page { padding-block: 100px; text-align: center; }
.error-page > span { color: var(--cyan-dark); font: 850 6rem ui-monospace, SFMono-Regular, Consolas, monospace; }
.error-page h1 { margin: 0; font-size: 2.3rem; }
.error-page p { margin-bottom: 25px; color: var(--muted); }

.about-hero {
  padding: 72px 0;
  color: #fff;
  background-color: var(--ink);
  background-image:
    linear-gradient(rgba(0, 216, 208, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 216, 208, 0.07) 1px, transparent 1px);
  background-size: 40px 40px;
  border-bottom: 5px solid var(--cyan);
}

.about-hero-grid {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 80px;
  align-items: end;
}

.about-hero h1 {
  margin: 0;
  font-size: clamp(2.8rem, 5vw, 5rem);
  line-height: 0.98;
  letter-spacing: -0.055em;
}

.about-hero p:not(.eyebrow) {
  max-width: 670px;
  margin: 0;
  color: #c1cfda;
  font-size: 1.08rem;
}

.about-section { padding-block: 68px; }

.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.about-card {
  position: relative;
  padding: 30px;
  background: #fff;
  border: 1px solid var(--line);
  border-top: 4px solid var(--ink);
}

.about-card-wide { grid-column: 1 / -1; }
.about-card-license { grid-column: 1 / -1; border-top-color: var(--cyan-dark); }

.about-number {
  position: absolute;
  top: 18px;
  right: 20px;
  color: #81919f;
  font: 800 0.72rem ui-monospace, SFMono-Regular, Consolas, monospace;
}

.about-card h2 {
  max-width: 760px;
  margin: 0 0 16px;
  font-size: clamp(1.55rem, 2.4vw, 2.25rem);
  line-height: 1.1;
  letter-spacing: -0.035em;
}

.about-card > p:not(.eyebrow) { color: var(--muted); }

.technology-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin-top: 28px;
  background: var(--line);
  border: 1px solid var(--line);
}

.technology-grid > div {
  min-height: 112px;
  padding: 18px;
  background: #f8fafb;
}

.technology-grid strong { display: block; margin-bottom: 6px; }
.technology-grid span { display: block; color: var(--muted); font-size: 0.87rem; }

.architecture-flow {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 26px 0;
  overflow-x: auto;
}

.architecture-flow span {
  flex: 0 0 auto;
  padding: 9px 11px;
  color: #fff;
  background: var(--ink-2);
  border-bottom: 3px solid var(--cyan);
  font: 750 0.76rem ui-monospace, SFMono-Regular, Consolas, monospace;
}

.architecture-flow b { color: var(--cyan-dark); }

.security-list {
  display: grid;
  gap: 9px;
  margin: 22px 0 0;
  padding: 0;
  list-style: none;
}

.security-list li {
  position: relative;
  padding: 10px 12px 10px 34px;
  background: #f4f8f9;
  border-left: 3px solid #004c5b;
}

.security-list li::before {
  content: "✓";
  position: absolute;
  left: 12px;
  color: var(--cyan-dark);
  font-weight: 900;
}

.repository-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: 20px 0;
  padding: 18px 20px;
  color: #fff;
  background: var(--ink);
  border-left: 5px solid var(--cyan);
  font: 750 0.94rem ui-monospace, SFMono-Regular, Consolas, monospace;
  text-decoration: none;
}

.repository-link:hover { color: var(--cyan); }
.repository-link b { font-size: 1.35rem; }

.license-notice {
  padding: 22px;
  background: var(--cyan-pale);
  border: 1px solid #73d7d2;
}

.license-notice > strong { font-size: 1.05rem; }
.license-notice p { margin: 9px 0 0; color: #294652; }
.license-notice a { font-weight: 800; }

.site-footer { color: var(--muted); background: #fff; border-top: 5px solid #004c5b; }
.footer-inner { min-height: 88px; display: flex; align-items: center; justify-content: space-between; font-size: 0.83rem; }
.footer-inner img { width: 210px; height: 62px; object-fit: contain; }
.footer-meta { display: flex; align-items: flex-end; flex-direction: column; gap: 4px; }
.footer-meta a { color: var(--cyan-dark); font-weight: 800; }

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

@media (max-width: 930px) {
  .stage-grid,
  .form-layout,
  .admin-grid,
  .about-hero-grid { grid-template-columns: 1fr; gap: 40px; }
  .term-grid { grid-template-columns: repeat(2, 1fr); }
  .detail-layout { grid-template-columns: 1fr; gap: 25px; }
  .detail-aside { padding: 25px 0 0; border-top: 1px solid var(--line); border-left: 0; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .nav-wrap nav { gap: 14px; }
  .nav-wrap nav > a:not(.button) { display: none; }
}

@media (max-width: 640px) {
  .shell { width: min(100% - 24px, 1200px); }
  .site-header { position: static; }
  .nav-wrap { min-height: 66px; }
  .brand { min-width: 0; gap: 11px; }
  .brand img { width: 76px; height: 45px; }
  .brand-divider { height: 32px; }
  .brand-product strong { font-size: 0.92rem; }
  .brand-product small { display: none; }
  .search-stage { padding: 54px 0; }
  .search-stage h1 { font-size: 2.72rem; }
  .stage-grid { gap: 30px; }
  .stage-action { padding-bottom: 195px; }
  .stage-photo { height: 220px; }
  .search-card { width: calc(100% - 14px); }
  .search-card,
  .form-card { padding: 21px; }
  .search-row,
  .compact-search { flex-direction: column; }
  .term-grid,
  .field-grid { grid-template-columns: 1fr; }
  .content-section,
  .page-section,
  .form-layout { padding-block: 41px; }
  .about-hero { padding: 52px 0; }
  .about-section { padding-block: 41px; }
  .about-grid { grid-template-columns: 1fr; }
  .about-card-wide,
  .about-card-license { grid-column: auto; }
  .technology-grid { grid-template-columns: 1fr; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .term-card { min-height: 225px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stat { padding: 15px; }
  .stat strong { font-size: 2rem; }
  .actions { align-items: flex-start; flex-wrap: wrap; }
  .activity-row { grid-template-columns: 1fr auto; }
  .activity-row > a { grid-column: 1 / -1; }
  .danger-zone { align-items: flex-start; flex-direction: column; gap: 20px; }
  .footer-inner { min-height: 112px; align-items: flex-start; justify-content: center; flex-direction: column; }
  .footer-inner img { width: 180px; height: 56px; }
  .footer-meta { align-items: flex-start; }
  .definition { padding-left: 18px; font-size: 1.18rem; }
  .detail-layout { padding-block: 51px; }
}
