:root {
  --ink: #132033;
  --muted: #647083;
  --line: #dfe4ea;
  --soft: #f3f6f9;
  --panel: #ffffff;
  --navy: #101a2b;
  --red: #e1262f;
  --blue: #2599cb;
  --green: #16875b;
  --amber: #c96f00;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: #eef2f6;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.65;
}

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 34px;
  color: #fff;
  background: var(--navy);
  border-bottom: 3px solid var(--red);
}
.brand { display: flex; align-items: center; }
.brand-logo {
  display: block;
  width: auto;
  height: 46px;
  filter: brightness(0) invert(1);
}
.draft { color: #c6cfda; font-size: .84rem; }

.page-shell { max-width: 1500px; margin: 0 auto; display: grid; grid-template-columns: 280px minmax(0, 1fr); }
.sidebar {
  position: sticky;
  top: 64px;
  align-self: start;
  min-height: calc(100vh - 64px);
  padding: 54px 30px;
  color: #fff;
  background: #172336;
}
.eyebrow { margin: 0 0 10px; color: #98a6b8; font-size: .76rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.eyebrow.red { color: var(--red); }
.sidebar h1 { margin: 0 0 44px; font-size: 2.25rem; line-height: 1.06; letter-spacing: -.04em; }
.sidebar h1 span { color: #80c7e6; font-weight: 400; }
.sidebar nav { display: grid; }
.sidebar nav a {
  display: flex;
  gap: 14px;
  padding: 13px 0;
  color: #d4dbe5;
  border-top: 1px solid #344156;
  text-decoration: none;
}
.sidebar nav a:last-child { border-bottom: 1px solid #344156; }
.sidebar nav a:hover { color: #fff; }
.sidebar nav span { color: #69badc; font-size: .8rem; font-weight: 700; }
.sidebar-note { margin-top: 40px; padding: 18px; background: #202f45; border-left: 3px solid var(--red); }
.sidebar-note p { margin: 6px 0 0; color: #b9c4d2; font-size: .86rem; line-height: 1.55; }

main { min-width: 0; background: #fff; }
.intro { padding: 70px clamp(32px, 7vw, 100px) 56px; background: linear-gradient(120deg, #fff 60%, #f4f8fb); border-bottom: 1px solid var(--line); }
.intro h2 { max-width: 780px; margin: 0 0 22px; font-size: clamp(2.6rem, 5vw, 5.2rem); line-height: .98; letter-spacing: -.055em; }
.lead { max-width: 820px; margin: 0; color: #4e5b6d; font-size: 1.2rem; line-height: 1.7; }

.chapter { padding: 74px clamp(32px, 7vw, 100px); border-bottom: 1px solid var(--line); scroll-margin-top: 64px; }
.chapter-heading { display: flex; align-items: flex-start; gap: 22px; margin-bottom: 28px; }
.chapter-number { flex: 0 0 auto; padding-top: 7px; color: var(--red); font-size: .86rem; font-weight: 700; letter-spacing: .08em; }
.kicker { margin: 0 0 2px; color: var(--muted); font-size: .78rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.chapter h2 { margin: 0; font-size: clamp(2rem, 3vw, 3.25rem); line-height: 1.08; letter-spacing: -.04em; }
.chapter > p { max-width: 900px; }
.chapter h3 { margin: 42px 0 18px; font-size: 1.35rem; }

figure { margin: 0; }
.figure-wide { margin-top: 34px; }
figure img { display: block; width: 100%; height: auto; border: 1px solid var(--line); border-radius: 8px; }
figcaption { margin-top: 9px; color: var(--muted); font-size: .8rem; }

.three-columns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.info-card { position: relative; padding: 25px 22px 22px; background: var(--soft); border-top: 3px solid #9aa7b6; }
.info-card.featured { border-color: var(--blue); }
.card-index { color: var(--red); font-size: .76rem; font-weight: 700; }
.info-card h4 { margin: 8px 0 7px; font-size: 1.08rem; }
.info-card p { margin: 0; color: var(--muted); font-size: .92rem; }

.sensor-layout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(220px, .5fr); gap: 18px; align-items: stretch; margin-bottom: 32px; }
.sensor-layout figure { padding: 18px; background: var(--soft); border-radius: 8px; }
.reading-note { display: flex; flex-direction: column; justify-content: center; padding: 26px; color: #fff; background: var(--navy); border-radius: 8px; }
.reading-note strong { font-size: 1.2rem; }
.reading-note p { margin: 8px 0 0; color: #c7d0dc; }
.sensor-note-wide { margin-bottom: 32px; }
.sensor-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.sensor-list article { display: grid; grid-template-columns: 48px 1fr; gap: 16px; padding: 24px; background: #fff; }
.sensor-icon { width: 48px; height: 48px; display: grid; place-items: center; color: #0f7eaa; background: #eaf6fb; border-radius: 50%; font-size: .68rem; font-weight: 800; }
.sensor-icon.alarm { color: var(--red); background: #fff0f1; }
.sensor-icon.image-icon { overflow: hidden; background: #fff; border: 1px solid var(--line); }
.sensor-icon.image-icon img { width: 39px; height: 39px; object-fit: contain; border: 0; border-radius: 0; }
.sensor-list h3 { margin: 0 0 5px; font-size: 1.04rem; }
.sensor-list p { margin: 0; color: var(--muted); font-size: .9rem; }
.sensor-list p + p { margin-top: 8px; }
.sensor-threshold { padding-top: 7px; border-top: 1px solid var(--line); }
.state { display: inline-block; padding: 0 6px; border-radius: 3px; font-size: .7rem; font-weight: 800; line-height: 1.7; }
.state.on, .state.warn { color: #a61d24; background: #ffe5e7; }
.state.off, .state.ok { color: #096844; background: #dff6ec; }
.divider { color: #b2bac5; padding: 0 5px; }

.alert-section { background: #f7f9fb; }
.alert-grid { margin-top: 28px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.alert-grid div { display: flex; align-items: center; gap: 14px; padding: 17px 18px; background: #fff; border: 1px solid var(--line); }
.alert-grid span { color: var(--red); font-size: .73rem; font-weight: 800; }
.notice { margin-top: 26px; padding: 24px 28px; background: #fff; border-left: 4px solid var(--red); box-shadow: 0 8px 25px rgba(15, 30, 50, .06); }
.notice p { margin: 5px 0 0; color: var(--muted); }

.tradeoff { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 24px; margin: 30px 0; padding: 30px; color: #fff; background: var(--navy); border-radius: 8px; }
.tradeoff > div:not(.tradeoff-arrow) { display: grid; gap: 5px; }
.tradeoff-label { color: #79c3e2; font-size: .76rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
.tradeoff strong { font-size: 1.15rem; }
.tradeoff p { margin: 0; color: #bbc6d4; font-size: .9rem; }
.tradeoff-arrow { color: var(--red); font-size: 2rem; }
.closing { padding-left: 20px; border-left: 3px solid var(--blue); }

.client-section { background: #fff; }
.client-profile {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(260px, .5fr);
  gap: 1px;
  margin: 0 0 28px;
  color: #fff;
  background: #344156;
  border-left: 4px solid var(--red);
}
.client-profile > div { display: grid; gap: 7px; padding: 23px 26px; background: var(--navy); }
.profile-label { color: #93a3b7; font-size: .74rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.client-profile strong { font-size: 1rem; line-height: 1.45; }
.client-profile a { width: fit-content; color: #7ec9e9; font-size: 1.04rem; font-weight: 700; text-decoration: none; }
.client-profile a:hover { text-decoration: underline; }
.client-settings-layout { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(340px, .95fr); gap: 24px; align-items: start; margin-top: 30px; }
.client-settings-layout figure { padding: 16px; background: var(--soft); border-radius: 8px; }
.settings-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
.settings-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.settings-table th, .settings-table td { padding: 12px 15px; text-align: left; border-bottom: 1px solid var(--line); }
.settings-table th { color: #fff; background: var(--navy); font-size: .76rem; letter-spacing: .04em; text-transform: uppercase; }
.settings-table tbody tr:nth-child(even) { background: var(--soft); }
.settings-table tbody tr:last-child td { border-bottom: 0; }
.client-notice { margin-top: 28px; }
.configured-alerts { margin-top: 58px; padding-top: 46px; border-top: 1px solid var(--line); }
.configured-alerts-figure { max-width: 760px; padding: 18px; background: var(--soft); border-radius: 8px; }
.alert-type-list { display: grid; gap: 12px; margin-top: 26px; }
.alert-type-list > article { display: grid; grid-template-columns: 54px 1fr; gap: 20px; padding: 25px; background: var(--soft); border-left: 3px solid var(--blue); }
.alert-type-list > article:nth-child(2) { border-left-color: var(--amber); }
.alert-type-list > article:nth-child(3) { border-left-color: var(--red); }
.alert-type-list > article:nth-child(4) { border-left-color: var(--blue); }
.alert-type-number { color: var(--red); font-size: .78rem; font-weight: 800; letter-spacing: .08em; }
.alert-type-list h4 { margin: 0 0 6px; font-size: 1.18rem; }
.alert-type-list p { margin: 0; color: var(--muted); }
.alert-type-list dl { display: grid; gap: 1px; margin: 18px 0 0; background: var(--line); border: 1px solid var(--line); }
.alert-type-list dl > div { padding: 15px 17px; background: #fff; }
.alert-type-list dt { margin-bottom: 3px; font-weight: 700; }
.alert-type-list dd { margin: 0; color: var(--muted); font-size: .9rem; }
.alert-anatomy { margin-top: 58px; padding-top: 46px; border-top: 1px solid var(--line); }
.subsection-heading { max-width: 820px; margin-bottom: 24px; }
.subsection-heading > span { color: var(--red); font-size: .75rem; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.subsection-heading h3 { margin: 5px 0 8px; font-size: clamp(1.65rem, 2.4vw, 2.35rem); line-height: 1.15; letter-spacing: -.025em; }
.subsection-heading p { margin: 0; color: var(--muted); }
.alert-example { padding: 18px; background: var(--soft); border-radius: 8px; }
.field-table-wrap { margin-top: 24px; overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
.field-table { width: 100%; min-width: 760px; border-collapse: collapse; font-size: .9rem; }
.field-table th, .field-table td { padding: 14px 15px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.field-table th { color: #fff; background: var(--navy); font-size: .75rem; letter-spacing: .04em; text-transform: uppercase; }
.field-table th:first-child { width: 125px; }
.field-table th:nth-child(2) { width: 250px; }
.field-table tbody tr:nth-child(even) { background: var(--soft); }
.field-table tbody tr:last-child td { border-bottom: 0; }
.field-name { display: inline-block; padding: 3px 8px; color: #0c6f99; background: #e5f4fa; border-radius: 4px; font-size: .76rem; font-weight: 800; }
.field-name.critical { color: #a61d24; background: #ffe5e7; }
.empty-value { color: var(--muted); font-style: italic; }

footer { display: flex; justify-content: space-between; gap: 20px; padding: 30px clamp(32px, 7vw, 100px); color: #c5cfdb; background: var(--navy); font-size: .82rem; }
footer strong { color: #fff; }

@media (max-width: 900px) {
  .page-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; min-height: auto; padding: 30px; }
  .sidebar h1 { margin-bottom: 24px; }
  .sidebar nav { grid-template-columns: repeat(2, 1fr); column-gap: 24px; }
  .sidebar-note { display: none; }
  .sensor-layout, .three-columns, .client-profile, .client-settings-layout { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .topbar { padding: 0 18px; }
  .brand-logo { height: 40px; }
  .intro, .chapter { padding: 48px 22px; }
  .intro h2 { font-size: 2.7rem; }
  .sidebar nav, .sensor-list, .alert-grid { grid-template-columns: 1fr; }
  .tradeoff { grid-template-columns: 1fr; }
  .tradeoff-arrow { transform: rotate(90deg); }
  footer { flex-direction: column; padding: 26px 22px; }
}

@media print {
  .topbar, .sidebar { display: none; }
  .page-shell { display: block; }
  .chapter { break-inside: avoid; }
  body { background: #fff; }
}
