/* =========================================================
   IEC 62443 -tarkastusympäristö · Siemens-tyyli
   Väripaletti: Siemens Corporate Design (petrol / deep blue / sand)
   Typografia: Arial kuten cheat sheet -pohjassa
   ========================================================= */

:root {
  color-scheme: light;
  --petrol: #009999;
  --petrol-light: #00c1b6;
  --petrol-dark: #005159;
  --teal-90: #196269;
  --blue-900: #000028;
  --blue-750: #2d2d45;
  --blue-650: #4c4c68;
  --sand-100: #fafafa;
  --sand-200: #f5f5f5;
  --sand-400: #ededed;
  --sand-500: #e0e0de;
  --sand-600: #cfcfcb;
  --sand-800: #8a8a85;
  --sand-900: #5e5e5a;
  --alarm: #d91a30;
  --warning: #ec6602;
  --success: #15ad8d;
  --info: #0087be;
  --focus: #199fff;

  --bg: var(--sand-200);
  --surface: #ffffff;
  --surface-alt: var(--sand-100);
  --text: var(--blue-900);
  --muted: var(--sand-900);
  --border: var(--sand-600);
  --border-soft: var(--sand-500);
  --accent: var(--petrol);
  --accent-strong: var(--petrol-dark);
  --topic: #ccf3f0;
  --topic-alt: #e6faf8;
  --shadow: none;
  --radius: 2px;
  --head-bg: var(--petrol);
  --head-fg: #ffffff;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #12122e;
  --surface: #161632;
  --surface-alt: #1d1d3f;
  --text: #e5e5e9;
  --muted: #9999a9;
  --border: #40405e;
  --border-soft: #333353;
  --accent: var(--petrol-light);
  --accent-strong: var(--petrol-light);
  --topic: #0d3b3f;
  --topic-alt: #10484c;
  --head-bg: var(--petrol-dark);
}

* { box-sizing: border-box; }

html { background: var(--bg); scrollbar-gutter: stable; scroll-behavior: smooth; scroll-padding-top: 74px; }
@supports not (scrollbar-gutter: stable) {
  html { overflow-y: scroll; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 Arial, "Helvetica Neue", Helvetica, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-strong); text-decoration: none; }
a:hover, a:focus-visible { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }

code, .mono { font-family: "Courier New", ui-monospace, monospace; font-size: .92em; }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  display: grid;
  grid-template-columns: 20rem minmax(0, 1fr) 19rem;
  align-items: center;
  gap: .75rem;
  padding: 0 1rem;
  min-height: 54px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: .55rem;
  font-weight: 700;
  color: var(--text);
  white-space: normal;
  min-width: 0;
  height: 4rem;
  padding-right: .5rem;
}
.brand:hover { text-decoration: none; }

.brand-mark {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 34px;
  height: 28px;
  background: var(--petrol);
  color: #fff;
  font-size: .64rem;
  font-weight: 700;
  letter-spacing: .02em;
  border-radius: var(--radius);
}
[data-theme="dark"] .brand-mark { background: var(--petrol-light); color: #000028; }

.brand-name { font-size: .95rem; }
.brand-name small {
  display: block;
  font-size: .68rem;
  font-weight: 400;
  color: var(--muted);
  letter-spacing: .04em;
  text-transform: uppercase;
}

.nav {
  display: grid;
  /* Reserve the same space for each label in every language. */
  grid-template-columns: minmax(6.75rem, 1fr) minmax(13.75rem, 1fr) minmax(13.25rem, 1fr) minmax(13.25rem, 1fr) minmax(11.25rem, 1fr) minmax(7.25rem, 1fr) minmax(11.25rem, 1fr);
  min-width: 0;
  gap: 0;
  overflow-x: auto;
}
.nav a {
  display: flex;
  align-items: center;
  gap: .35rem;
  padding: .6rem;
  height: 2.6rem;
  min-width: 0;
  color: var(--text);
  font-size: .86rem;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
  border-bottom: 3px solid transparent;
}
.nav-icon { width: 1rem; height: 1rem; flex: 0 0 1rem; }
.nav a:hover { background: var(--surface-alt); text-decoration: none; }
.nav a[aria-current="page"] {
  border-bottom-color: var(--petrol);
  color: var(--accent-strong);
  font-weight: 700;
}

.tools { display: flex; align-items: center; justify-content: flex-end; gap: .35rem; }
.tools #themeToggle { width: 5rem; flex-shrink: 0; }

.lang {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.lang button {
  width: 2.5rem;
  flex-shrink: 0;
  font: inherit;
  font-size: .76rem;
  font-weight: 700;
  letter-spacing: .06em;
  padding: .32rem .55rem;
  border: 0;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
}
.lang button[aria-pressed="true"] { background: var(--petrol); color: #fff; }
[data-theme="dark"] .lang button[aria-pressed="true"] { background: var(--petrol-light); color: #000028; }

.iconbtn {
  font: inherit;
  font-size: .76rem;
  padding: .32rem .55rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.iconbtn:hover { background: var(--surface-alt); }

/* ---------- Layout ---------- */
.wrap { max-width: 1180px; margin: 0 auto; padding: 1.4rem 1.1rem 3.5rem; }
body[data-page="cheatsheet"] .wrap { max-width: none; width: 100%; }

.page-head {
  width: 100%;
  max-width: calc(1180px - 2.2rem);
  margin: 1.1rem auto 1.4rem;
  border-left: 5px solid var(--petrol);
  padding-left: 1rem;
  text-align: left;
}
.eyebrow {
  text-transform: uppercase;
  letter-spacing: .1em;
  font-size: .72rem;
  font-weight: 700;
  color: var(--accent-strong);
  margin: 0 0 .3rem;
}
h1 { font-size: clamp(1.5rem, 3.4vw, 2.05rem); line-height: 1.15; margin: 0 0 .45rem; }
h2 {
  font-size: 1.22rem;
  margin: 2rem 0 .7rem;
  padding-bottom: .35rem;
  border-bottom: 2px solid var(--petrol);
  color: var(--accent-strong);
}
h3 { font-size: 1.02rem; margin: 1.3rem 0 .5rem; }
p { margin: 0 0 .85rem; }
.lead { font-size: 1rem; color: var(--muted); max-width: 78ch; }

/* ---------- Hero ---------- */
.hero {
  padding: 1.7rem 1.6rem;
  background: linear-gradient(100deg, var(--petrol-dark), var(--petrol) 55%, var(--petrol-light));
  color: #fff;
  border-radius: var(--radius);
}
.hero h1 { color: #fff; }
.hero .lead { color: #e6fbfa; }
.hero .eyebrow { color: #b8f3ee; }
[data-theme="dark"] .hero { background: linear-gradient(100deg, #00383d, var(--petrol-dark) 55%, var(--teal-90)); }

.cards {
  display: grid;
  gap: .75rem;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  margin-top: 1.1rem;
}

.card {
  display: block;
  padding: .95rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--petrol);
  border-radius: var(--radius);
  color: var(--text);
}
.hero .card { background: rgba(255, 255, 255, .13); border-color: rgba(255, 255, 255, .35); color: #fff; }
.hero .card p { color: #e6fbfa; }
.hero .card .num { color: #b8f3ee; }
a.card:hover { background: var(--surface-alt); text-decoration: none; border-color: var(--petrol); }
.hero a.card:hover { background: rgba(255, 255, 255, .22); }
.card h3 { margin: .15rem 0 .3rem; font-size: .98rem; }
.card p { color: var(--muted); margin: 0; font-size: .88rem; }
.card .num {
  font-family: "Courier New", monospace;
  font-size: .72rem;
  letter-spacing: .08em;
  color: var(--accent-strong);
  font-weight: 700;
}

.facts {
  display: grid;
  gap: .75rem;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  margin-top: 1rem;
}
.fact {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--petrol);
  border-radius: var(--radius);
  padding: .75rem .9rem;
}
.fact b { display: block; font-size: 1.5rem; letter-spacing: -.02em; color: var(--accent-strong); }
.fact span { color: var(--muted); font-size: .84rem; }

/* ---------- Panels / callouts ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.05rem 1.15rem;
  margin: 1rem 0;
}

.callout {
  border-left: 4px solid var(--info);
  background: var(--surface-alt);
  padding: .75rem .95rem;
  margin: 1rem 0;
}
.callout.warn { border-left-color: var(--warning); }
.callout.ok { border-left-color: var(--success); }
.callout.alert { border-left-color: var(--alarm); }
.callout p:last-child { margin-bottom: 0; }
.callout strong:first-child { display: block; margin-bottom: .25rem; color: var(--accent-strong); }

/* ---------- Tables ---------- */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  background: var(--surface);
  margin: .8rem 0;
}
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th, td {
  text-align: left;
  padding: .5rem .65rem;
  border: 1px solid var(--border);
  vertical-align: top;
}
thead th {
  background: var(--head-bg);
  color: var(--head-fg);
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .05em;
}
tbody tr:nth-child(even) td { background: var(--surface-alt); }
tbody tr:hover td { background: var(--topic); }
td.center, th.center { text-align: center; }

.badge {
  display: inline-block;
  padding: .05rem .4rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .04em;
  background: var(--surface-alt);
  color: var(--muted);
  white-space: nowrap;
}
.badge.is { background: rgba(21, 173, 141, .16); color: var(--success); border-color: transparent; }
.badge.tr { background: rgba(0, 135, 190, .16); color: var(--info); border-color: transparent; }
.badge.dev { background: rgba(236, 102, 2, .16); color: var(--warning); border-color: transparent; }

.filters { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-bottom: .7rem; }
input[type="search"], select, input[type="text"], input[type="number"] {
  font: inherit;
  font-size: .88rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .4rem .55rem;
}
input[type="search"] { min-width: 230px; }

/* ---------- Lists / steps ---------- */
ul.clean, ol.clean { padding-left: 1.15rem; }
ul.clean li, ol.clean li { margin-bottom: .4rem; }

.steps { counter-reset: step; list-style: none; padding: 0; margin: 1rem 0; }
.steps li {
  position: relative;
  padding: 0 0 1rem 2.9rem;
  border-left: 2px solid var(--border);
  margin-left: .95rem;
}
.steps li:last-child { border-left-color: transparent; padding-bottom: 0; }
.steps li::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: -1rem;
  top: 0;
  width: 1.9rem;
  height: 1.9rem;
  display: grid;
  place-items: center;
  background: var(--petrol);
  color: #fff;
  font-weight: 700;
  font-size: .84rem;
  border-radius: var(--radius);
}
.steps h4 { margin: 0 0 .2rem; font-size: .96rem; }
.steps p { margin: 0; color: var(--muted); font-size: .9rem; }

/* ---------- FR grid ---------- */
.fr-grid { display: grid; gap: .7rem; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); margin: .9rem 0; }
.fr {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--petrol);
  border-radius: var(--radius);
  padding: .8rem .9rem;
}
.fr .fr-id {
  font-family: "Courier New", monospace;
  font-weight: 700;
  color: var(--accent-strong);
  font-size: .78rem;
  letter-spacing: .04em;
}
.fr h4 { margin: .2rem 0 .35rem; font-size: .95rem; }
.fr p { margin: 0; color: var(--muted); font-size: .88rem; }

/* ---------- Timeline ---------- */
.timeline { list-style: none; padding: 0; margin: 1rem 0; border-left: 2px solid var(--petrol); }
.timeline li { position: relative; padding: 0 0 .95rem 1.3rem; }
.timeline li::before {
  content: "";
  position: absolute;
  left: -.45rem;
  top: .45rem;
  width: .7rem;
  height: .7rem;
  background: var(--petrol);
  border-radius: 50%;
}
.timeline .yr { font-family: "Courier New", monospace; font-weight: 700; color: var(--accent-strong); margin-right: .45rem; }
.timeline p { margin: .15rem 0 0; color: var(--muted); font-size: .9rem; }

/* ---------- SL colors ---------- */
.sl-0 { color: var(--muted); }
.sl-1 { color: var(--success); }
.sl-2 { color: var(--info); }
.sl-3 { color: var(--warning); }
.sl-4 { color: var(--alarm); }
.lvl {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 20px;
  font-weight: 700;
  font-size: .8rem;
  border-radius: var(--radius);
  color: #fff;
  font-family: "Courier New", monospace;
}
.lvl-0 { background: var(--sand-800); }
.lvl-1 { background: var(--success); }
.lvl-2 { background: var(--info); }
.lvl-3 { background: var(--warning); }
.lvl-4 { background: var(--alarm); }

/* ---------- Diagram ---------- */
.diagram {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: .8rem;
  overflow-x: auto;
}
.diagram svg { display: block; width: 100%; height: auto; min-width: 620px; }
.diagram text { fill: var(--text); font-family: Arial, sans-serif; }

/* ---------- Checklist ---------- */
.progress {
  height: 10px;
  background: var(--sand-400);
  border: 1px solid var(--border);
  overflow: hidden;
  margin: .5rem 0 .25rem;
}
[data-theme="dark"] .progress { background: var(--border-soft); }
.progress > i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--petrol);
  transition: width .25s ease;
}
.progress-label { font-size: .84rem; color: var(--muted); }

.check-group { margin: 1.1rem 0; }
.check-group h4 {
  margin: 0 0 .5rem;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--accent-strong);
  border-bottom: 1px solid var(--border);
  padding-bottom: .25rem;
}
.check {
  display: flex;
  gap: .7rem;
  align-items: flex-start;
  padding: .6rem .75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  margin-bottom: .4rem;
}
.check:hover { border-color: var(--petrol); }
.check input[type="checkbox"] { margin-top: .25rem; width: 16px; height: 16px; accent-color: var(--petrol); flex: none; }
.check label { flex: 1; cursor: pointer; }
.check .ct { display: block; font-weight: 700; font-size: .92rem; }
.check .cd { display: block; color: var(--muted); font-size: .86rem; }
.check .refs { display: flex; gap: .3rem; flex-wrap: wrap; margin-top: .35rem; }
.check:has(input:checked) { background: var(--topic-alt); }
.check:has(input:checked) .ct { text-decoration: line-through; color: var(--muted); }

.p1 { color: var(--alarm); font-weight: 700; font-size: .72rem; }
.p2 { color: var(--warning); font-weight: 700; font-size: .72rem; }
.p3 { color: var(--info); font-weight: 700; font-size: .72rem; }

/* ---------- Gap tool ---------- */
.gap-grid { display: grid; gap: .5rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); margin: .8rem 0; }
.gap-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  min-width: 0;
  align-items: center;
  gap: .55rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--petrol);
  padding: .5rem .7rem;
}
.gap-row .name { grid-column: 1 / -1; min-width: 0; overflow-wrap: anywhere; font-size: .88rem; font-weight: 700; }
.gap-row .name small { display: block; color: var(--muted); font-weight: 400; }
.gap-row label { font-size: .74rem; color: var(--muted); display: flex; align-items: center; gap: .25rem; }
.gap-row select { padding: .2rem .25rem; font-size: .8rem; }
.gap-out { grid-column: 1 / -1; min-width: 0; padding: .35rem .5rem; text-align: center; overflow-wrap: anywhere; border: 1px solid currentColor; border-radius: var(--radius); font-weight: 700; font-size: .85rem; line-height: 1.4; }
.gap-zero { color: var(--accent-strong); background: var(--topic-alt); }

/* ---------- Cheat sheet ---------- */
.sheet-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 1.4rem 0 .15rem;
  color: var(--text);
}
.sheet-sub { font-size: .86rem; color: var(--muted); margin: 0 0 .8rem; }

.fr-head {
  background: var(--blue-750);
  color: #fff;
  padding: .45rem .7rem;
  font-weight: 700;
  font-style: italic;
  font-size: .9rem;
  margin: 1.4rem 0 0;
  border-radius: var(--radius);
}
[data-theme="dark"] .fr-head { background: var(--teal-90); }
.cs-table tbody tr:nth-child(even) td.fr-head,
.cs-table tbody tr td.fr-head { background: var(--blue-750); color: #fff; }
[data-theme="dark"] .cs-table tbody tr td.fr-head,
[data-theme="dark"] .cs-table tbody tr:nth-child(even) td.fr-head { background: var(--teal-90); }
.cs-table tbody tr:hover td.fr-head { background: var(--blue-750); }
[data-theme="dark"] .cs-table tbody tr:hover td.fr-head { background: var(--teal-90); }

.cs-table { font-size: .82rem; table-layout: fixed; }
.cs-table td { vertical-align: middle; }
.cs-table .c-id { font-family: "Courier New", monospace; white-space: nowrap; }
.cs-table .c-lvl { text-align: center; white-space: nowrap; }
.cs-table .c-topic { background: var(--topic); }
.cs-table tbody tr:nth-child(even) .c-topic { background: var(--topic); }
/* Highlight requirement rows consistently in both cheat sheet tables. */
.cs-table tbody tr[id]:hover td,
.cs-table tbody tr[id]:focus-within td,
.cs-table tbody tr.is-link-target td { background: var(--topic); }
.cs-table--33 .col-id { width: 8%; }
.cs-table--33 .col-lvl { width: 4%; }
.cs-table--33 .col-topic { width: 18%; }
.cs-table--33 .col-ex { width: 32%; }
.cs-table--33 .col-me { width: 38%; }
.cs-table--21 .col-id { width: 7%; }
.cs-table--21 .col-topic { width: 15%; }
.cs-table--21 .col-ex { width: 28%; }
.cs-table--21 .col-me { width: 36%; }
.cs-table--21 .col-ml { width: 7%; }
.cs-table--21 .col-mb { width: 7%; }
.cs-note { font-size: .82rem; color: var(--muted); margin: .35rem 0 0; }

.spe-head {
  background: var(--petrol-dark);
  color: #fff;
  padding: .4rem .7rem;
  font-weight: 700;
  font-size: .88rem;
  margin: 1.2rem 0 0;
}
[data-theme="dark"] .spe-head { background: var(--petrol); color: #000028; }
.cs-table tbody tr td.spe-head,
.cs-table tbody tr:nth-child(even) td.spe-head { background: var(--petrol-dark); color: #fff; }
.cs-table tbody tr:hover td.spe-head { background: var(--petrol-dark); }
[data-theme="dark"] .cs-table tbody tr td.spe-head,
[data-theme="dark"] .cs-table tbody tr:nth-child(even) td.spe-head,
[data-theme="dark"] .cs-table tbody tr:hover td.spe-head { background: var(--petrol); color: #000028; }
.grp-head { background: var(--topic); font-weight: 700; font-style: italic; }
.cs-table tbody tr td.grp-head,
.cs-table tbody tr:nth-child(even) td.grp-head,
.cs-table tbody tr:hover td.grp-head { background: var(--topic); color: var(--text); }
.cs-table .c-ml { white-space: nowrap; font-family: "Courier New", monospace; font-size: .78rem; }
.cs-table .c-relevant { text-align: center; color: var(--petrol); font-weight: 700; }

/* ---------- Buttons / footer ---------- */
.btn-row { display: flex; gap: .5rem; flex-wrap: wrap; margin: .8rem 0; }
.btn {
  font: inherit;
  font-size: .86rem;
  font-weight: 700;
  padding: .42rem .8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.btn:hover { background: var(--surface-alt); }
.btn.primary { background: var(--petrol); border-color: var(--petrol); color: #fff; }
.btn.primary:hover { background: var(--petrol-dark); }
[data-theme="dark"] .btn.primary { background: var(--petrol-light); border-color: var(--petrol-light); color: #000028; }

.crumb { font-size: .8rem; color: var(--muted); margin-bottom: .25rem; }

footer {
  border-top: 3px solid var(--petrol);
  background: var(--surface);
  padding: 1.2rem 1.1rem 2rem;
  color: var(--muted);
  font-size: .82rem;
  text-align: center;
}

@media (max-width: 1800px) {
  .topbar { grid-template-columns: minmax(0, 1fr) 19rem; padding-bottom: .3rem; }
  .nav { grid-column: 1 / -1; grid-row: 2; }
  html { scroll-padding-top: 120px; }
}
@media (max-width: 650px) {
  .topbar { grid-template-columns: minmax(0, 1fr); }
  .tools { grid-row: 2; justify-content: flex-start; }
  .nav { grid-row: 3; }
}

@media print {
  .topbar, .btn-row, .filters, footer, .tools { display: none !important; }
  body { background: #fff; color: #000; }
  .panel, .card, .table-wrap { border-color: #999; }
  thead th { background: #009999 !important; color: #fff !important; -webkit-print-color-adjust: exact; }
}

/* Glossary: shared Siemens palette and typography. */
.terms-toc { background: var(--surface); border-left: 4px solid var(--accent); padding: .75rem 1.25rem; margin-bottom: 1.5rem; }
.terms-toc ul { margin: 0; padding-left: 1.2rem; }
.terms-toc li + li { margin-top: .45rem; }
.terms-content section { margin-bottom: 2rem; }
.terms-table { min-width: 540px; }
.terms-table tbody th { background: var(--topic); color: var(--text); width: 15%; }
.terms-table td { width: 42.5%; }

/* Relationship between technical controls and security program processes. */
.cs-relation { margin: 2rem 0; }
.relation-flow { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin: 1rem 0; }
.relation-flow p { margin: 0; padding: 1rem; background: var(--topic); border-top: 3px solid var(--accent); font-weight: 700; }
.relation-table { min-width: 680px; }
.relation-table td:first-child { width: 25%; }
.relation-table td:nth-child(2) { width: 23%; }
.relation-table a { display: inline-block; }
.cs-table tr[id] { scroll-margin-top: 9rem; }
.cs-table tr.is-link-target { outline: 3px solid var(--accent); outline-offset: -3px; }
@media (max-width: 860px) { .relation-flow { grid-template-columns: 1fr; } }

/* Technical examples and local comments. */
.cs-table--33 { min-width: 0; width: 100%; }
body[data-page="cheatsheet"] .cs-table th,
body[data-page="cheatsheet"] .cs-table td { overflow-wrap: anywhere; padding: .5rem clamp(.2rem, .5vw, .65rem); }
body[data-page="cheatsheet"] .cs-table .c-id,
body[data-page="cheatsheet"] .cs-table .c-ml { white-space: normal; }
body[data-page="cheatsheet"] .relation-table { min-width: 0; table-layout: fixed; overflow-wrap: anywhere; }
.cs-table--33 .col-id { width: 7%; }
.cs-table--33 .col-lvl { width: 3%; }
.cs-table--33 .col-topic { width: 12%; }
.cs-table--33 .col-ex { width: 16%; }
.cs-table--33 .col-me { width: 18%; }
.cs-table--33 .col-example { width: 25%; }
.cs-table--33 .col-comment { width: 19%; }
.cs-table .c-comment textarea { display: block; min-width: 0; width: 100%; min-height: 7rem; resize: vertical; font: inherit; line-height: 1.5; padding: .55rem; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.cs-table .c-comment textarea:disabled { background: var(--surface-alt); }
.cs-save-info { padding: .65rem 1rem; border-left: 3px solid var(--accent); background: var(--surface); margin: .75rem 0; font-size: .85rem; }
.cs-save-info p { margin: .25rem 0; overflow-wrap: anywhere; }
#csSaveStatus { font-weight: 700; }
#csSaveStatus[data-state="saved"] { color: var(--accent-strong); }
#csSaveStatus[data-state="saveError"], #csSaveStatus[data-state="conflict"], #csSaveStatus[data-state="openError"], #csSaveStatus[data-state="wrongFolder"] { color: var(--alarm); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
@media print { .cs-table--33 { min-width: 0; } .cs-save-info { display: none; } }

/* Optional technical-sheet columns start hidden on every page load. */
.cs-table--33.hide-example .col-example,
.cs-table--33.hide-example .c-example,
.cs-table--33.hide-comment .col-comment,
.cs-table--33.hide-comment .c-comment { display: none; }
.btn[data-cs-column][aria-pressed="true"] { border-color: var(--accent); background: var(--topic); }

/* Five language choices remain accessible on narrow screens. */
.tools { flex-wrap: nowrap; }
.language-note { color: var(--muted); font-size: .85rem; }
.language-note:empty { display: none; }

/* Shared project workflow */
:root { --nav-height: 60px; }
[hidden] { display: none !important; }
html { scroll-padding-top: calc(var(--nav-height) + 110px); }
.project-toolbar { position: sticky; top: var(--nav-height); z-index: 30; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; padding: .65rem; background: var(--surface); border: 1px solid var(--border); box-shadow: 0 2px 4px #0002; }
.project-toolbar [data-project-status] { flex: 1 1 220px; font-size: .85rem; }
[data-state="dirty"], [data-state="draft"], [data-state="conflict"], [data-state="saveError"] { font-weight: 700; }
.project-settings { margin: .8rem 0 1.2rem; padding: .85rem; border: 1px solid var(--border); background: var(--surface); }
.project-settings summary { cursor: pointer; font-weight: 700; }
.project-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px),1fr)); gap: .75rem; margin: .8rem 0; }
.project-fields label, .requirement-filters label, .c-assessment label { display: flex; flex-direction: column; gap: .25rem; font-size: .85rem; }
.project-fields input, .requirement-filters input[type="search"], .requirement-filters select, .c-assessment select, .c-assessment textarea { width: 100%; min-width: 0; padding: .45rem; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; border-radius: var(--radius); }
.project-settings p { font-size: .85rem; margin: .5rem 0 0; }
.project-file { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; overflow-wrap: anywhere; }
.section-jumps { display: flex; flex-wrap: wrap; gap: .6rem 1.5rem; margin: 1rem 0; }
.requirement-filters { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,180px),1fr)); gap: .75rem; align-items: end; padding: .8rem; background: var(--surface); border: 1px solid var(--border); }
.requirement-filters .inline-check { flex-direction: row; align-items: center; align-self: center; }
.c-assessment label + label { margin-top: .5rem; }
.c-assessment textarea { resize: vertical; }
.cs-table.hide-assessment .c-assessment, .cs-table.hide-assessment .col-assessment { display: none; }
.cs-table.hide-comment .c-comment, .cs-table.hide-comment .col-comment { display: none; }
.cs-table .c-comment textarea { width: 100%; min-width: 0; background: var(--surface); color: var(--text); border: 1px solid var(--border); font: inherit; padding: .45rem; resize: vertical; }
.row-detail-toggle { display: none; }
@media (max-width: 900px) {
  .cs-table, .cs-table tbody { display: block; }
  .cs-table colgroup, .cs-table thead { display: none; }
  .cs-table tbody tr { display: grid; grid-template-columns: minmax(0,1fr); margin: .6rem 0; border: 1px solid var(--border); }
  .cs-table td { display: block; width: auto; border: 0; border-bottom: 1px solid var(--border-soft); }
  .cs-table td[data-label]::before { content: attr(data-label); display: block; font-size: .72rem; font-weight: 700; color: var(--muted); margin-bottom: .25rem; }
  .cs-table td.c-lvl, .cs-table td.c-id { text-align: left; }
  .cs-table .row-detail-toggle { display: block; margin-top: .6rem; padding: .45rem .6rem; color: var(--accent-strong); background: var(--surface); border: 1px solid var(--border); font: inherit; cursor: pointer; }
  .cs-table tr:not(.details-open) .c-ex, .cs-table tr:not(.details-open) .c-me, .cs-table tr:not(.details-open) .c-example, .cs-table tr:not(.details-open) .c-comment, .cs-table tr:not(.details-open) .c-assessment, .cs-table tr:not(.details-open) .c-relevant { display: none; }
  .cs-table tr.details-open td.c-example, .cs-table tr.details-open td.c-comment, .cs-table tr.details-open td.c-assessment { display: block; }
  .project-toolbar { gap: .4rem; padding: .4rem; }
  .project-toolbar [data-project-status] { font-size: .75rem; }
  .table-wrap:has(.cs-table) { overflow: visible; }
}
@media print {
  .project-toolbar, .requirement-filters, .section-jumps, .row-detail-toggle { display: none !important; }
  .project-settings { break-inside: avoid; }
}
@media (max-width: 900px) {
  [data-cs-column] { display: none; }
}
:root { --toolbar-height: 0px; }
html { scroll-padding-top: calc(var(--nav-height) + var(--toolbar-height) + 24px); }
/* Only the long requirement tables have viewport-sticky column headings.
   Other tables scroll inside .table-wrap, so a navigation offset would push
   their headings down over the body rows. */
@media screen and (min-width: 901px) {
  .cs-table thead th {
    position: sticky;
    top: calc(var(--nav-height) + var(--toolbar-height));
    z-index: 1;
  }
}
.table-wrap:has(.cs-table) { overflow: visible; }
@media (max-width: 600px) {
  .topbar { position: static; }
  .project-toolbar { top: 0; }
  html { scroll-padding-top: calc(var(--toolbar-height) + 16px); }
}

/* Manual JSON transfer uses ordinary text selection and paste. */
.transfer-page textarea {
  display: block;
  width: 100%;
  min-width: 0;
  margin: .5rem 0;
  padding: .75rem;
  resize: vertical;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  font: .85rem/1.5 "Courier New", monospace;
}
.transfer-page label { display: block; font-weight: 700; }
.transfer-page [role="status"] { overflow-wrap: anywhere; }
