:root {
  color-scheme: dark;
  --bg: #07100d;
  --surface: #0e1b17;
  --surface-soft: #12221d;
  --line: rgba(222, 238, 227, 0.12);
  --line-strong: rgba(222, 238, 227, 0.2);
  --text: #f3f5ef;
  --muted: #91a39b;
  --lime: #b8ef62;
  --gold: #edc76d;
  --coral: #ff8e72;
  --radius: 22px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 2%, rgba(63, 128, 91, 0.12), transparent 34rem),
    linear-gradient(145deg, #07100d 0%, #081511 48%, #06100d 100%);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

button, input, textarea { font: inherit; }
button { color: inherit; }
[hidden] { display: none !important; }
.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; }

.ambient {
  position: fixed;
  z-index: -1;
  width: 24rem;
  height: 24rem;
  border-radius: 50%;
  filter: blur(120px);
  opacity: .07;
  pointer-events: none;
}

.ambient-one { top: 16rem; right: -10rem; background: var(--lime); }
.ambient-two { bottom: 0; left: -14rem; background: #3fc894; }

.shell {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding-bottom: 36px;
}

.topbar {
  height: 92px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  gap: 12px;
  align-items: center;
  color: var(--text);
  text-decoration: none;
  font-size: 15px;
  letter-spacing: .01em;
}

.brand strong { color: var(--lime); font-weight: 700; }

.brand-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(184, 239, 98, .3);
  background: rgba(184, 239, 98, .06);
  border-radius: 11px;
}

.brand-mark svg, .reset-button svg, .subsection-icon svg {
  width: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand-mark { color: var(--lime); }

.topbar-actions { display: flex; align-items: center; gap: 18px; }

.reset-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 10px 0 10px 14px;
  font-size: 13px;
  transition: color .2s ease;
}

.reset-button:hover { color: var(--text); }
.reset-button svg { width: 16px; }

.alarm-button {
  min-width: 104px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border: 1px solid rgba(255, 142, 114, .55);
  border-radius: 12px;
  background: rgba(255, 86, 64, .14);
  color: #ffad99;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .1em;
  cursor: pointer;
  box-shadow: 0 0 0 0 rgba(255, 86, 64, .2);
  transition: background .2s ease, color .2s ease, transform .2s ease;
}
.alarm-button span { width: 18px; height: 18px; display: grid; place-items: center; border-radius: 50%; background: #ff674c; color: #fff; font-size: 12px; }
.alarm-button:hover { background: rgba(255, 86, 64, .25); color: #fff; transform: translateY(-1px); }

.hero { padding: 80px 0 52px; }

.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--lime);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .17em;
  text-transform: uppercase;
}

.eyebrow span { width: 28px; height: 1px; background: var(--lime); }

h1 {
  max-width: 800px;
  margin: 20px 0 18px;
  font-size: clamp(42px, 6.2vw, 70px);
  line-height: .98;
  letter-spacing: -.055em;
  font-weight: 630;
}

h1 em { color: var(--lime); font-family: Georgia, "Times New Roman", serif; font-weight: 400; }

.hero > p {
  max-width: 540px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.65;
  margin: 0;
}

.progress-panel {
  margin-top: 45px;
  display: grid;
  grid-template-columns: 150px 1fr 50px;
  align-items: center;
  gap: 22px;
  padding: 21px 24px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(15, 29, 24, .7);
  box-shadow: 0 14px 40px rgba(0, 0, 0, .12);
}

.progress-copy { display: flex; flex-direction: column; gap: 4px; }
.progress-copy span { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.progress-copy strong { font-size: 14px; font-weight: 650; }

.progress-track { height: 5px; background: rgba(255, 255, 255, .07); border-radius: 99px; overflow: hidden; }
.progress-track span { display: block; height: 100%; width: 0; background: var(--lime); border-radius: inherit; transition: width .35s ease; box-shadow: 0 0 14px rgba(184, 239, 98, .35); }
.progress-percent { color: var(--lime); font-size: 15px; font-weight: 700; text-align: right; }

.procedures { display: grid; gap: 14px; }

.procedure-card {
  --accent: var(--lime);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: rgba(12, 25, 20, .82);
  box-shadow: 0 18px 55px rgba(0, 0, 0, .1);
  transition: border-color .25s ease, background .25s ease;
}

.procedure-card[data-accent="gold"] { --accent: var(--gold); }
.procedure-card[data-accent="coral"] { --accent: var(--coral); }
.procedure-card.is-open { border-color: color-mix(in srgb, var(--accent) 25%, transparent); background: rgba(14, 29, 24, .95); }
.procedure-card.is-complete { border-color: color-mix(in srgb, var(--accent) 40%, transparent); }

.procedure-trigger, .subsection-trigger {
  width: 100%;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.procedure-trigger {
  min-height: 118px;
  padding: 24px 30px;
  display: grid;
  grid-template-columns: 58px 1fr auto;
  gap: 22px;
  align-items: center;
}

.procedure-number {
  align-self: start;
  color: var(--accent);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
  font-style: italic;
}

.procedure-heading { display: flex; flex-direction: column; gap: 8px; }
.procedure-kicker { color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .15em; text-transform: uppercase; }
.procedure-title { font-size: clamp(20px, 3vw, 28px); font-weight: 560; letter-spacing: -.025em; }
.procedure-status { display: flex; align-items: center; gap: 20px; }
.mini-count { min-width: 42px; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }

.chevron {
  width: 10px;
  height: 10px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  color: var(--muted);
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform .25s ease, color .2s ease;
}

[aria-expanded="true"] > .procedure-status .chevron,
[aria-expanded="true"] > .chevron { transform: rotate(225deg) translate(-2px, -2px); color: var(--accent); }

.procedure-content {
  padding: 0 30px 30px 110px;
  border-top: 1px solid var(--line);
  animation: reveal .24s ease both;
}

@keyframes reveal { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: translateY(0); } }

.inner-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding-top: 26px; }
.subsection { border: 1px solid var(--line); border-radius: 15px; background: rgba(255, 255, 255, .018); overflow: hidden; }

.subsection-trigger {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  align-items: center;
  gap: 13px;
  padding: 17px 18px;
  min-height: 76px;
}

.subsection-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 15%, transparent);
}

.subsection-trigger > span:nth-child(2) { display: flex; flex-direction: column; gap: 4px; font-size: 14px; font-weight: 600; }
.subsection-trigger small { color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.subsection-content { border-top: 1px solid var(--line); animation: reveal .2s ease both; }

.flat-list { padding-top: 26px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.emergency-list { padding-bottom: 14px; }
.reduction-section { margin-top: 0; }

.check-item {
  position: relative;
  min-height: 68px;
  padding: 14px 16px;
  display: grid;
  grid-template-columns: 22px 1fr;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  color: #dfe6e1;
  cursor: pointer;
  transition: background .2s ease, color .2s ease;
}

.flat-list > .check-item { border: 1px solid var(--line); border-radius: 13px; }
.check-item:last-child { border-bottom: 0; }
.check-item:hover { background: rgba(255, 255, 255, .025); }
.check-item input { position: absolute; opacity: 0; pointer-events: none; }

.custom-check {
  width: 20px;
  height: 20px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  display: grid;
  place-items: center;
  transition: .2s ease;
}

.custom-check::after {
  content: "";
  width: 8px;
  height: 4px;
  border-left: 1.7px solid #08100d;
  border-bottom: 1.7px solid #08100d;
  transform: rotate(-45deg) translate(1px, -1px) scale(0);
  transition: transform .16s ease;
}

.check-item input:focus-visible + .custom-check { outline: 2px solid var(--accent); outline-offset: 3px; }
.check-item input:checked + .custom-check { background: var(--accent); border-color: var(--accent); }
.check-item input:checked + .custom-check::after { transform: rotate(-45deg) translate(1px, -1px) scale(1); }
.check-item:has(input:checked) { color: var(--muted); background: rgba(255, 255, 255, .012); }
.check-item:has(input:checked) strong { text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--muted) 55%, transparent); }
.check-item > span:last-child { display: flex; flex-direction: column; gap: 4px; line-height: 1.35; }
.check-item strong { font-size: 13px; font-weight: 540; transition: color .2s ease; }
.check-item small { color: var(--muted); font-size: 11px; line-height: 1.45; }

footer {
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: #63736c;
  font-size: 11px;
}

.footer-dot { width: 3px; height: 3px; border-radius: 50%; background: #526159; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 10;
  transform: translate(-50%, 20px);
  padding: 12px 17px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: #172620;
  color: var(--text);
  font-size: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .35);
  opacity: 0;
  pointer-events: none;
  transition: .25s ease;
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }

.chat-modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 18px; }
.chat-backdrop { position: absolute; inset: 0; background: rgba(0, 6, 4, .8); backdrop-filter: blur(8px); }
.chat-panel {
  position: relative;
  width: min(680px, 100%);
  max-height: min(780px, calc(100vh - 36px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(255, 142, 114, .3);
  border-radius: 22px;
  background: #0d1b17;
  box-shadow: 0 35px 100px rgba(0, 0, 0, .55);
}
.chat-header { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 22px 24px 18px; border-bottom: 1px solid var(--line); }
.chat-kicker { display: block; margin-bottom: 5px; color: var(--coral); font-size: 10px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.chat-header h2 { margin: 0; font-size: 20px; font-weight: 620; letter-spacing: -.02em; }
.chat-close { width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 11px; background: transparent; color: var(--muted); font-size: 25px; cursor: pointer; }
.chat-close:hover { color: #fff; border-color: var(--line-strong); }
.chat-notice { padding: 11px 24px; border-bottom: 1px solid var(--line); background: rgba(255, 142, 114, .055); color: #b8c5bf; font-size: 11px; line-height: 1.5; }
.pin-gate { padding: 30px 24px 34px; }
.pin-gate label { display: block; margin-bottom: 9px; color: var(--text); font-size: 13px; font-weight: 650; }
.pin-row { display: flex; gap: 9px; }
.pin-row input, .chat-composer textarea { width: 100%; border: 1px solid var(--line-strong); border-radius: 12px; background: #08130f; color: var(--text); outline: none; }
.pin-row input { min-width: 0; padding: 13px 14px; }
.pin-row input:focus, .chat-composer textarea:focus { border-color: rgba(184, 239, 98, .55); box-shadow: 0 0 0 3px rgba(184, 239, 98, .07); }
.pin-row button, .chat-composer button { border: 0; border-radius: 12px; background: var(--coral); color: #170a07; font-weight: 750; cursor: pointer; }
.pin-row button { flex: 0 0 auto; padding: 0 17px; }
.pin-gate small { display: block; margin-top: 9px; color: var(--muted); font-size: 10px; line-height: 1.45; }
.pin-gate small.is-error { color: #ff9d87; }
.chat-workspace { min-height: 360px; display: flex; flex-direction: column; overflow: hidden; }
.chat-messages { flex: 1; min-height: 220px; overflow-y: auto; padding: 20px 24px; display: flex; flex-direction: column; gap: 12px; }
.chat-message { max-width: 88%; padding: 12px 14px; border-radius: 14px; font-size: 13px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-message.user { align-self: flex-end; background: rgba(184, 239, 98, .13); border: 1px solid rgba(184, 239, 98, .2); }
.chat-message.model { align-self: flex-start; background: rgba(255, 255, 255, .045); border: 1px solid var(--line); }
.chat-message.error { align-self: stretch; max-width: 100%; background: rgba(255, 86, 64, .09); border: 1px solid rgba(255, 142, 114, .25); color: #ffc0b0; }
.chat-message.loading { color: var(--muted); font-style: italic; }
.chat-composer { display: grid; grid-template-columns: 1fr 90px; gap: 9px; padding: 14px 18px 18px; border-top: 1px solid var(--line); }
.chat-composer textarea { resize: none; min-height: 54px; max-height: 130px; padding: 10px 12px; line-height: 1.4; }
.chat-composer button { background: var(--lime); }
.chat-composer button:disabled, .pin-row button:disabled { opacity: .55; cursor: wait; }
body.chat-open { overflow: hidden; }

@media (max-width: 760px) {
  .shell { width: min(100% - 24px, 620px); }
  .topbar { height: 74px; }
  .topbar-actions { gap: 10px; }
  .hero { padding: 54px 0 34px; }
  h1 { font-size: clamp(37px, 11vw, 52px); }
  .progress-panel { grid-template-columns: 1fr 48px; gap: 14px; margin-top: 34px; }
  .progress-track { grid-row: 2; grid-column: 1 / -1; }
  .progress-percent { grid-column: 2; grid-row: 1; }
  .procedure-trigger { min-height: 102px; padding: 20px; grid-template-columns: 34px 1fr auto; gap: 12px; }
  .procedure-title { font-size: 20px; line-height: 1.2; }
  .procedure-kicker { line-height: 1.4; }
  .procedure-status { gap: 11px; }
  .mini-count { min-width: 32px; }
  .procedure-content { padding: 0 14px 16px; }
  .inner-grid, .flat-list { grid-template-columns: 1fr; }
  .inner-grid { padding-top: 14px; }
  .flat-list { padding-top: 14px; }
  footer { flex-wrap: wrap; padding: 28px 20px; text-align: center; line-height: 1.5; }
  .chat-modal { padding: 0; align-items: end; }
  .chat-panel { width: 100%; max-height: 92vh; border-radius: 22px 22px 0 0; }
  .chat-header, .chat-messages { padding-left: 18px; padding-right: 18px; }
  .chat-notice { padding-left: 18px; padding-right: 18px; }
}

@media (max-width: 430px) {
  .reset-button { font-size: 0; }
  .reset-button svg { width: 19px; }
  .alarm-button { min-width: 88px; padding: 10px 13px; }
  .procedure-number { font-size: 15px; }
  .mini-count { display: none; }
  .pin-row { flex-direction: column; }
  .pin-row button { min-height: 46px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
