:root {
  --bg: #060d0b;
  --card: #08110e;
  --card-2: #0b1512;
  --line: #17352c;
  --line-soft: #112821;
  --text: #f2f5ef;
  --text-soft: #84b6aa;
  --text-dim: #49655e;
  --green: #57d6b2;
  --green-dark: #12382e;
  --amber: #ffb11c;
  --amber-soft: #422f0b;
  --danger: #ff7f75;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
html { background: var(--bg); }
body {
  margin: 0;
  color: var(--text);
  font-family: "IBM Plex Mono", "Courier New", monospace;
  background: #050b09;
}
button, input { font: inherit; }
button { cursor: pointer; }

.app-shell {
  width: min(100%, 1180px);
  margin: 0 auto;
  min-height: 100vh;
  padding: 5px;
}
.view { display: none; }
.view.active { display: block; }
.login-view.active {
  display: grid;
  min-height: calc(100vh - 10px);
  place-items: center;
}
.maintenance-view.active {
  display: grid;
  min-height: calc(100vh - 10px);
  place-items: center;
}
.maintenance-card {
  width: min(100%, 760px);
  padding: clamp(34px, 6vh, 68px) clamp(24px, 6vw, 72px);
  text-align: center;
}
.maintenance-hero { padding-bottom: 28px; }
.maintenance-hero h1 { margin: 0; font-size: clamp(34px, 5vw, 54px); line-height: 1; }
.maintenance-copy {
  margin: 0 auto 28px;
  padding: 22px 24px;
  border: 1px solid var(--line);
  background: rgba(5, 15, 12, .52);
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.7;
  text-align: left;
}
.maintenance-copy p { margin: 0 0 16px; }
.maintenance-copy p:last-child { margin-bottom: 0; color: var(--text); font-weight: 700; }
.maintenance-continue { min-width: 180px; }
.maintenance-login-note {
  margin: 18px 0 0;
  color: var(--text-soft);
  font-size: 10px;
  line-height: 1.5;
  letter-spacing: .07em;
  text-align: center;
  text-transform: uppercase;
}

.protocol-card {
  width: 100%;
  background: linear-gradient(180deg, #07100d 0%, #08110e 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
}

/* LOGIN */
.login-card {
  width: min(100%, 1180px);
  padding: 28px 32px 28px;
}
.login-hero {
  text-align: center;
  padding: 2px 0 24px;
}
.shield-mark {
  width: 28px;
  height: 28px;
  margin: 0 auto 7px;
  display: grid;
  place-items: center;
  color: var(--amber);
  font-size: 23px;
  transform: rotate(45deg);
}
.eyebrow {
  margin: 0 0 8px;
  color: var(--text-soft);
  font-size: 12px;
  letter-spacing: .2em;
  text-transform: uppercase;
}
.centered { text-align: center; }
.login-hero h1 {
  margin: 0;
  font-size: clamp(34px, 5vw, 44px);
  line-height: 1;
  letter-spacing: .03em;
}
.login-form-panel {
  width: 100%;
  padding: 20px 24px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0a1310;
}
.field-label {
  display: block;
  margin-bottom: 8px;
  color: #b7d4cc;
  font-size: 15px;
}
input {
  width: 100%;
  border: 1px solid #315548;
  border-radius: 5px;
  background: #0c1713;
  color: var(--green);
  padding: 14px 14px;
  outline: none;
  font-size: 17px;
  letter-spacing: .22em;
  text-transform: uppercase;
}
input:focus { border-color: var(--green); }
input::placeholder { color: #4d6e65; }
.field-help {
  margin: 7px 0 0;
  color: var(--text-dim);
  font-size: 10px;
  letter-spacing: .12em;
}
.primary-btn {
  width: 100%;
  margin-top: 18px;
  padding: 12px 16px;
  border: 0;
  border-radius: 5px;
  background: #5fd0b0;
  color: #07100d;
  font-weight: 700;
  font-size: 15px;
}
.feedback {
  min-height: 18px;
  margin: 10px 2px 0;
  color: var(--danger);
  font-size: 12px;
}

/* DASHBOARD */
.dashboard-card {
  min-height: calc(100vh - 10px);
  padding: 18px 26px 18px;
  display: flex;
  flex-direction: column;
}
.dashboard-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 116px;
  gap: 18px;
  align-items: start;
}
.reference-line {
  margin: 0 0 5px;
  color: var(--text-soft);
  font-size: 11px;
  letter-spacing: .12em;
}
.reference-line span { color: var(--green); }
.protocol-heading h1 {
  margin: 0;
  font-size: clamp(27px, 4vw, 36px);
  line-height: 1.05;
  letter-spacing: -.025em;
}
.status-line {
  margin: 24px 0 0;
  color: var(--text-soft);
  font-size: 11px;
}
.status-line strong { color: var(--amber); font-weight: 500; }
.important-info-btn {
  position: relative;
  min-height: 92px;
  padding: 9px 7px 8px;
  border: 1px solid var(--amber);
  border-radius: 7px;
  background: transparent;
  color: var(--amber);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  text-align: center;
  font-size: 9px;
  line-height: 1.2;
  font-weight: 600;
}
.important-info-btn:hover,
.important-info-btn:focus-visible { background: rgba(255,177,28,.07); outline: none; }
.folder-icon { width: 28px; display: block; }
.folder-icon svg { display: block; width: 100%; height: auto; }
.notification-dot {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--amber);
  top: -4px;
  right: -4px;
}
.important-info-btn.seen .notification-dot { display: none; }

.stages-wrap {
  margin-top: 28px;
  border-left: 1px solid #1d4136;
}
.stage-list { display: grid; }
.stage-row {
  width: 100%;
  min-height: 70px;
  padding: 11px 0 11px 14px;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  background: transparent;
  color: inherit;
  display: grid;
  grid-template-columns: 26px minmax(0,1fr) auto;
  gap: 10px;
  align-items: center;
  text-align: left;
  position: relative;
}
.stage-row:last-child { border-bottom: 0; }
.stage-row.available::before,
.stage-row.info-required::before {
  content: "";
  position: absolute;
  left: -1px;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--amber);
}
.stage-row.done::before {
  content: "";
  position: absolute;
  left: -1px;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--green);
}
.stage-icon {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  color: #2c4d45;
  font-size: 17px;
}
.stage-row.done .stage-icon { color: var(--green); }
.stage-row.available .stage-icon,
.stage-row.info-required .stage-icon { color: var(--amber); }
.stage-main { min-width: 0; }
.stage-title {
  display: block;
  color: #3d5550;
  font-size: clamp(16px,2.5vw,20px);
  font-weight: 700;
  line-height: 1.15;
}
.stage-subtitle {
  display: block;
  margin-top: 3px;
  color: #28413b;
  font-size: 12px;
  line-height: 1.25;
}
.stage-row.done .stage-title,
.stage-row.available .stage-title,
.stage-row.info-required .stage-title { color: var(--text); }
.stage-row.done .stage-subtitle { color: var(--green); }
.stage-row.available .stage-subtitle,
.stage-row.info-required .stage-subtitle { color: #6a9b8e; }
.stage-badge {
  margin-right: 0;
  min-width: 90px;
  max-width: 180px;
  padding: 5px 10px;
  border-radius: 4px;
  text-align: center;
  font-size: 10px;
  line-height: 1.2;
  white-space: nowrap;
}
.stage-row.done .stage-badge {
  background: #11352b;
  color: var(--green);
}
.stage-row.available .stage-badge {
  background: var(--amber);
  color: #161006;
}
.stage-row.info-required .stage-badge {
  border: 1px solid var(--amber);
  color: var(--amber);
  background: transparent;
}
.stage-row.locked { opacity: .58; cursor: not-allowed; }
.stage-row.locked .stage-badge {
  min-width: auto;
  color: #3e5a53;
  padding-right: 2px;
}

.dashboard-footer {
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  text-align: center;
}
.quote {
  margin: 0 0 2px;
  color: #6fb4a4;
  font-size: 13px;
  font-style: italic;
}
.access-copy {
  margin: 0;
  color: #395750;
  font-size: 10px;
  letter-spacing: .16em;
}
.dashboard-actions {
  margin-top: 16px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.protocol-reset-link {
  margin-top: 17px;
  padding: 3px 0;
  border: 0;
  border-bottom: 1px solid transparent;
  background: transparent;
  color: #4b655e;
  font: 500 9px "IBM Plex Mono", monospace;
  letter-spacing: .06em;
  cursor: pointer;
}
.protocol-reset-link:hover,
.protocol-reset-link:focus-visible {
  border-bottom-color: #6f978c;
  color: #91b8ac;
  outline: 0;
}
.ghost-btn,
.continue-btn {
  min-height: 46px;
  border-radius: 5px;
  background: transparent;
  font-weight: 600;
}
.ghost-btn {
  border: 1px solid #315548;
  color: var(--text);
}
.continue-btn {
  border: 1px dashed #28463e;
  color: #54746c;
}
.continue-btn:disabled { opacity: .55; cursor: not-allowed; }
.continue-btn.is-admitted {
  border: 1px solid #b48943;
  background: linear-gradient(145deg, #553914, #211506);
  color: #f0cf8c;
  box-shadow: inset 0 0 0 1px rgba(255,220,147,.13), 0 0 14px rgba(166,112,32,.18);
}
.continue-btn.is-admitted:hover,
.continue-btn.is-admitted:focus-visible {
  border-color: #e1bd75;
  background: linear-gradient(145deg, #714b18, #301c08);
  color: #fff0c7;
  outline: 0;
}

/* STAGE */
.stage-card { padding: 22px 24px 28px; min-height: calc(100vh - 10px); }
.back-link {
  border: 0;
  background: transparent;
  color: var(--text-soft);
  padding: 0;
  margin-bottom: 20px;
}
.stage-hero { margin-bottom: 18px; }
.stage-hero h1 { margin: 0; font-size: clamp(30px,6vw,48px); }
.stage-status-line { margin: 8px 0 0; color: var(--amber); font-size: 12px; }
.detail-panel {
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: hidden;
  background: #09120f;
}
.panel-head {
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.panel-head h2 { margin: 0; font-size: 14px; letter-spacing: .08em; }
.panel-head span { color: var(--green); font-size: 10px; }
.context-copy,
.mission-copy,
.stage-actions { padding: 16px 18px 0; }
.context-copy,
.mission-copy {
  color: #a4c3ba;
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-line;
}
.mission-copy { color: var(--text); }
.mission-copy--emphasis { font-weight: 700; }
.stage-actions { padding-bottom: 18px; }
.stage-foot { margin-top: 18px; text-align: center; }

.validation-form { border-top: 1px solid var(--line-soft); padding-top: 16px; }
.validation-label { display: block; margin-bottom: 8px; font-size: 11px; letter-spacing: .14em; }
.validation-code { text-align: center; font-size: 25px; }
.validation-quote { color: #8cb3a8; font-size: 13px; line-height: 1.6; font-style: italic; }
.validation-message { min-height: 24px; color: var(--danger); font-size: 11px; line-height: 1.5; }
.identification-hint { margin-top: 12px; padding: 12px; border: 1px solid #5c4815; color: #d7c181; }
.identification-hint[hidden] { display:none; }
.hint-label { display:block; margin-bottom:5px; font-size:10px; color:var(--amber); }
.identification-hint p { margin:0; font-size:12px; line-height:1.5; }

/* RECORDS / STAGE 2 */
.records-list { display: grid; gap: 10px; }
.record-item,
.attachment-item { border: 1px solid var(--line); border-radius: 5px; background: #08110e; overflow: hidden; }
.record-toggle,
.attachment-toggle {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  padding: 13px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  font-weight: 700;
}
.record-toggle:hover,
.attachment-toggle:hover { background: rgba(87,214,178,.04); }
.record-toggle .chev,
.attachment-toggle .chev { color: var(--green); }
.record-content,
.attachment-content { padding: 0 14px 15px; color: #aac6be; font-size: 12px; line-height: 1.7; }
.record-content[hidden], .attachment-content[hidden] { display:none; }
.record-content h3,
.record-content h4 { color: var(--text); margin: 16px 0 8px; }
.record-content p { margin: 0 0 10px; }
.record-content blockquote { margin: 12px 0; padding-left: 12px; border-left: 2px solid var(--amber); color: #d8e1de; }
.record-content a { color: var(--green); word-break: break-all; }
.attachments-list { display:grid; gap:8px; margin-top:14px; }
.doc-meta { color:#62857c; font-size:10px; margin-bottom:10px; }
.doc-section-title { color:var(--amber); font-size:11px; letter-spacing:.08em; margin:14px 0 7px; }
.doc-list { margin: 5px 0 12px 18px; padding:0; }
.answer-panel { margin-top:16px; padding-top:16px; border-top:1px solid var(--line); }
.answer-panel p { color:#a7c1ba; font-size:12px; line-height:1.65; }
.answer-panel strong { color:var(--text); }
.answer-input { margin-top:10px; letter-spacing:.05em; text-transform:none; color:var(--text); }
.answer-message { min-height:20px; margin-top:8px; font-size:11px; color:var(--danger); }

/* MODAL */
.modal-backdrop {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0,0,0,.76);
}
.modal-backdrop[hidden] { display:none; }
.print-modal {
  position: relative;
  width: min(100%,620px);
  max-height: calc(100vh - 36px);
  overflow:auto;
  padding: 22px;
  border:1px solid var(--line);
  border-radius:7px;
  background:#08110e;
}
.modal-close {
  position:absolute;
  top:10px;
  right:12px;
  border:0;
  background:transparent;
  color:#6e948a;
  font-size:24px;
}
.print-modal h2 { margin:0; font-size:24px; }
.print-copy { color:#9cb9b1; font-size:12px; line-height:1.7; margin-top:16px; }
.print-file-placeholder { margin-top:16px; padding:13px; border:1px dashed #34564c; display:flex; gap:12px; align-items:center; color:#93aea7; }
.print-file-link { text-decoration:none; cursor:pointer; transition:background-color .2s ease, border-color .2s ease; }
.print-file-link:hover, .print-file-link:focus-visible { background:rgba(160,110,60,.08); border-color:#a88362; }
.print-file-link:focus-visible { outline:2px solid #a88362; outline-offset:3px; }
.file-mark { width:44px; height:44px; border:1px solid #3e665b; display:grid; place-items:center; color:var(--amber); font-size:11px; }
.print-file-placeholder strong,.print-file-placeholder small{display:block}.print-file-placeholder small{margin-top:4px;color:#5f8178;font-size:10px}

@media (max-width: 700px) {
  .app-shell { padding: 4px; }
  .dashboard-card { padding: 16px 16px 14px; }
  .dashboard-head { grid-template-columns: minmax(0,1fr) 88px; gap: 10px; }
  .protocol-heading h1 { font-size: 23px; }
  .important-info-btn { min-height: 82px; font-size: 8px; }
  .folder-icon { width:24px; }
  .stage-row { grid-template-columns: 22px minmax(0,1fr) auto; padding-left:10px; gap:8px; }
  .stage-title { font-size:15px; }
  .stage-subtitle { font-size:10px; }
  .stage-badge { min-width:72px; max-width:125px; padding:4px 7px; font-size:8.5px; white-space:normal; }
  .quote { font-size:11px; }
  .login-card { padding: 22px 18px; }
  .login-form-panel { padding: 17px 18px; }
  .stage-card { padding:18px 14px 24px; }
}

@media (max-width: 430px) {
  .dashboard-actions { grid-template-columns: 1fr; }
  .dashboard-head { grid-template-columns: minmax(0,1fr) 82px; }
  .reference-line { font-size:9px; }
  .protocol-heading h1 { font-size:20px; }
  .status-line { margin-top:18px; }
  .important-info-btn { min-height:78px; }
}
