:root {
  --bg: #ffffff;
  --bg-elev: #ffffff;
  --bg-soft: #f5f5f5;
  --ink: #000000;
  --ink-2: #1a1a1a;
  --ink-3: #555555;
  --ink-4: #999999;
  --line: #e5e5e5;
  --line-2: #cccccc;
  --accent: #d40000;        /* signature red */
  --accent-soft: #ffe5e5;
  --accent-ink: #a00000;
  --accent-dark: #8a0000;

  /* Status colors — limited to red/black/white palette via shades */
  --green: #000000;
  --green-soft: #f0f0f0;
  --amber: #d40000;
  --amber-soft: #ffe5e5;
  --red: #d40000;
  --red-soft: #ffe5e5;
  --blue: #1a1a1a;
  --blue-soft: #f0f0f0;

  --font-display: 'Montserrat', -apple-system, sans-serif;
  --font-body: 'Montserrat', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 1px 3px rgba(0, 0, 0, 0.06), 0 4px 16px rgba(0, 0, 0, 0.04);

  --sidebar-w: 280px;
  --content-max: 760px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.65;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===== LAYOUT ===== */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* ===== SIDEBAR ===== */
.sidebar {
  grid-column: 1;
  border-right: 1px solid var(--line);
  background: var(--bg);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 28px 22px 40px;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 3px; }

.brand {
  display: flex;
  flex-direction: column;
  margin-bottom: 26px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}
.brand-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.01em;
  line-height: 1.1;
  color: var(--ink);
  text-transform: uppercase;
}
.brand-name em {
  font-style: normal;
  font-weight: 800;
  color: var(--accent);
}
.brand-meta {
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 6px;
  font-feature-settings: "tnum";
}
.brand-version {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 3px 8px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--ink-2);
  width: fit-content;
}
.brand-version::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.search {
  position: relative;
  margin-bottom: 22px;
}
.search input {
  width: 100%;
  padding: 9px 12px 9px 34px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-family: inherit;
  font-size: 13px;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search input:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px var(--bg-soft);
}
.search input::placeholder { color: var(--ink-4); }
.search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px; height: 14px;
  color: var(--ink-4);
  pointer-events: none;
}
.search-kbd {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-4);
  background: var(--bg-soft);
  padding: 2px 5px;
  border-radius: 3px;
  border: 1px solid var(--line);
}

.nav-section {
  margin-bottom: 22px;
}
.nav-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--ink-4);
  margin-bottom: 8px;
  padding: 0 10px;
}
.nav-list { list-style: none; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 13.5px;
  color: var(--ink-2);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  border: 1px solid transparent;
  font-weight: 500;
}
.nav-item:hover {
  background: var(--bg-soft);
  color: var(--ink);
}
.nav-item.active {
  background: var(--ink);
  color: #fff;
  font-weight: 600;
}
.nav-num {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-4);
  min-width: 20px;
  font-weight: 500;
}
.nav-item:hover .nav-num { color: var(--ink-3); }
.nav-item.active .nav-num { color: var(--accent); }
.nav-item.search-hidden { display: none; }

/* ===== MAIN ===== */
.main {
  grid-column: 2;
  padding: 60px 64px 120px;
  max-width: none;
  width: 100%;
}

/* HEADER / HERO */
.doc-header {
  margin-bottom: 56px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--line);
}
.doc-eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  color: #fff;
  background: var(--accent);
  letter-spacing: 0.08em;
  margin-bottom: 18px;
  padding: 4px 10px;
  border-radius: 2px;
  text-transform: uppercase;
  font-weight: 500;
}
.doc-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 56px;
  line-height: 1.0;
  letter-spacing: -0.035em;
  color: var(--ink);
  margin-bottom: 18px;
  text-transform: uppercase;
}
.doc-title em {
  font-style: normal;
  font-weight: 800;
  color: var(--accent);
}
.doc-lede {
  font-size: 18px;
  line-height: 1.6;
  color: var(--ink-2);
  max-width: 100%;
  font-weight: 400;
}
.doc-meta-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-top: 36px;
  padding: 22px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.doc-meta-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.doc-meta-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-4);
  font-weight: 500;
}
.doc-meta-value {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
  line-height: 1;
}
.doc-meta-value.text {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--ink-2);
  font-weight: 600;
  line-height: 1.4;
  text-transform: none;
  letter-spacing: 0;
}

/* SECTIONS */
section {
  margin-bottom: 72px;
  scroll-margin-top: 80px;
}
h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 30px;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--ink);
  margin-bottom: 8px;
  display: flex;
  align-items: baseline;
  gap: 14px;
  text-transform: uppercase;
}
h2 .h-num {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-4);
  font-weight: 400;
}
.h-sub {
  font-size: 15px;
  color: var(--ink-3);
  margin-bottom: 24px;
  line-height: 1.55;
}
h3 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.005em;
  color: var(--ink);
  margin: 36px 0 12px;
  text-transform: uppercase;
}
h4 {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
  margin: 24px 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

p { margin-bottom: 14px; color: var(--ink-2); }
p strong { color: var(--ink); font-weight: 600; }

ul, ol {
  margin-bottom: 14px;
  padding-left: 22px;
  color: var(--ink-2);
}
li { margin-bottom: 6px; }
li::marker { color: var(--ink-4); }

a { color: var(--accent); text-decoration: none; border-bottom: 1px solid transparent; transition: border-color 0.15s; }
a:hover { border-bottom-color: var(--accent); }

a.credentials-sheet-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 12px 18px;
  background: var(--ink);
  color: #fff;
  border-bottom: none;
  border-radius: 6px;
  font-weight: 600;
  font-size: 14px;
  transition: background 0.15s, transform 0.12s;
}
a.credentials-sheet-link:hover {
  background: var(--ink-2);
  border-bottom: none;
  color: #fff;
  transform: translateY(-1px);
}

code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  background: var(--bg-soft);
  padding: 2px 6px;
  border-radius: 3px;
  color: var(--accent);
  border: 1px solid var(--line);
  font-weight: 500;
}

/* CALLOUTS — left-border style, restrained palette */
.callout {
  display: flex;
  gap: 12px;
  padding: 14px 18px;
  border-radius: 4px;
  margin: 18px 0;
  font-size: 14px;
  line-height: 1.55;
  background: var(--bg-soft);
  border-left: 3px solid var(--ink);
}
.callout-icon {
  flex-shrink: 0;
  width: 18px; height: 18px;
  margin-top: 1px;
}
.callout-body { flex: 1; color: var(--ink-2); }
.callout-body strong { color: var(--ink); }
.callout-warn  { background: var(--accent-soft); border-left-color: var(--accent); }
.callout-warn .callout-icon { color: var(--accent); }
.callout-danger { background: var(--accent); border-left-color: var(--accent-dark); color: #fff; }
.callout-danger .callout-body { color: rgba(255,255,255,0.92); }
.callout-danger .callout-body strong { color: #fff; }
.callout-danger .callout-icon { color: #fff; }
.callout-info  { background: var(--bg-soft); border-left-color: var(--ink); }
.callout-info .callout-icon { color: var(--ink); }
.callout-success { background: var(--bg-soft); border-left-color: var(--ink); }
.callout-success .callout-icon { color: var(--ink); }

/* TABLES */
.table-wrap {
  margin: 18px 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  background: var(--bg-elev);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
th, td {
  text-align: left;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
th {
  background: var(--bg-soft);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-2);
  border-bottom: 1px solid var(--line-2);
}
tr:last-child td { border-bottom: none; }
td { color: var(--ink-2); }
td strong { color: var(--ink); font-weight: 600; }

/* BADGES — 3-color system */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 12px;
  font-size: 10.5px;
  font-weight: 600;
  font-family: var(--font-body);
  line-height: 1.5;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border: 1px solid transparent;
}
.badge-active   { background: var(--accent); color: #fff; }
.badge-pending  { background: transparent; color: var(--ink); border-color: var(--ink); }
.badge-archived { background: var(--bg-soft); color: var(--ink-3); border-color: var(--line); }
.badge-hold     { background: transparent; color: var(--accent); border-color: var(--accent); }

/* CHECKLIST */
.checklist {
  list-style: none;
  padding: 0;
  margin: 14px 0;
}
.checklist li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 5px;
  margin-bottom: 6px;
  background: var(--bg-elev);
  transition: background 0.12s, border-color 0.12s;
}
.checklist li:hover { background: var(--bg-soft); }
.checklist input[type="checkbox"] {
  margin-top: 3px;
  width: 14px; height: 14px;
  accent-color: var(--accent);
  cursor: pointer;
}
.checklist label {
  flex: 1;
  cursor: pointer;
  color: var(--ink-2);
  font-size: 14px;
}
.checklist input:checked + label {
  color: var(--ink-4);
  text-decoration: line-through;
}
.checklist-phase {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin: 18px 0 8px;
  padding: 3px 8px;
  background: var(--accent-soft);
  border-radius: 3px;
  display: inline-block;
}
.progress-bar {
  height: 4px;
  background: var(--bg-soft);
  border-radius: 2px;
  margin: 16px 0 22px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  width: 0%;
}
.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--ink-3);
  margin-top: -16px;
  margin-bottom: 16px;
}
.progress-label strong { color: var(--accent); font-weight: 500; }

/* CARD GRID */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin: 18px 0;
}
.card-grid--2x2 {
  grid-template-columns: repeat(4, 1fr);
}
@media (max-width: 767px) {
  .card-grid--2x2 {
    grid-template-columns: repeat(2, 1fr);
  }
}
.card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 18px 20px;
  transition: border-color 0.15s, transform 0.15s;
}
.card:hover { border-color: var(--ink); }
.card-num {
  font-family: var(--font-display);
  font-size: 44px;
  font-weight: 800;
  line-height: 1;
  color: var(--accent);
  letter-spacing: -0.03em;
}
.card-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink);
  margin-top: 8px;
  font-weight: 700;
}
.card-desc {
  font-size: 13px;
  color: var(--ink-3);
  margin-top: 4px;
  line-height: 1.5;
}

/* PASSWORD GATE */
body.password-gate-active,
body.ip-restriction-active {
  overflow: hidden;
}

.ip-restriction {
  position: fixed;
  inset: 0;
  z-index: 11000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.ip-restriction[hidden] {
  display: none !important;
}

.ip-restriction__card {
  width: 100%;
  max-width: 460px;
  margin: 0;
  padding: 36px 32px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-md);
}

.ip-restriction__eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  color: #fff;
  background: var(--ink);
  letter-spacing: 0.08em;
  margin: 0 0 16px;
  padding: 4px 10px;
  border-radius: 2px;
  text-transform: uppercase;
  font-weight: 500;
}

.ip-restriction__title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 26px;
  line-height: 1.15;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  color: var(--ink);
  margin: 0 0 14px;
}

.ip-restriction__message {
  font-size: 14px;
  color: var(--ink-3);
  line-height: 1.55;
  margin: 0;
}

.ip-restriction__panel {
  margin-top: 8px;
  font-size: 14px;
  color: var(--ink-2);
  line-height: 1.6;
}

.ip-restriction__panel p {
  margin: 0 0 12px;
}

.ip-restriction__panel p:last-child {
  margin-bottom: 0;
}

.ip-restriction__denied-lead {
  color: var(--accent);
}

.ip-restriction__hint {
  font-size: 13px;
  color: var(--ink-3);
}

.ip-restriction__meta {
  font-size: 12px;
  color: var(--ink-4);
  font-family: var(--font-mono);
  margin-top: 16px !important;
}

.password-gate {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(255, 255, 255, 0.942);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.password-gate[hidden] {
  display: none !important;
}

.password-gate__card {
  width: 100%;
  max-width: 420px;
  margin: 0;
  padding: 36px 32px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-md);
}

.password-gate__eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  color: #fff;
  background: var(--accent);
  letter-spacing: 0.08em;
  margin: 0 0 16px;
  padding: 4px 10px;
  border-radius: 2px;
  text-transform: uppercase;
  font-weight: 500;
}

.password-gate__title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 28px;
  line-height: 1.1;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  color: var(--ink);
  margin: 0 0 10px;
}

.password-gate__title em {
  font-style: normal;
  color: var(--accent);
}

.password-gate__lede {
  font-size: 14px;
  color: var(--ink-3);
  line-height: 1.55;
  margin: 0 0 22px;
}

.password-gate__label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-3);
  margin-bottom: 8px;
}

.password-gate__input {
  width: 100%;
  padding: 12px 14px;
  margin-bottom: 16px;
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-sizing: border-box;
}

.password-gate__input:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px var(--bg-soft);
}

.password-gate__submit {
  width: 100%;
  padding: 12px 18px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  background: var(--ink);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}

.password-gate__submit:hover {
  background: var(--ink-2);
}

.password-gate__error {
  margin: 14px 0 0;
  font-size: 13px;
  color: var(--accent);
  font-weight: 500;
}

@media print {
  .ip-restriction,
  .password-gate {
    display: none !important;
  }
  body.password-gate-active,
  body.ip-restriction-active {
    overflow: visible;
  }
}

/* MOBILE */
.menu-toggle {
  display: none;
  position: fixed;
  top: 14px; left: 14px;
  z-index: 100;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 18px;
  cursor: pointer;
  box-shadow: var(--shadow-md);
}

@media (max-width: 1100px) {
  .main { padding: 60px 48px 120px; }
}
@media (max-width: 768px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    left: -300px;
    width: var(--sidebar-w);
    transition: left 0.25s;
    z-index: 50;
    box-shadow: var(--shadow-md);
  }
  .sidebar.open { left: 0; }
  .menu-toggle { display: block; }
  .main { padding: 70px 24px 80px; }
  .doc-title { font-size: 36px; }
  .doc-meta-grid { grid-template-columns: repeat(2, 1fr); }
  h2 { font-size: 26px; }
}

/* PRINT */
@media print {
  .sidebar, .menu-toggle { display: none; }
  .main { padding: 0; max-width: 100%; }
  .app { display: block; }
  section { page-break-inside: avoid; }
  body { background: white; }
}
