/* Sankalpa HMS · system flowcharts — shared styles
   Plain, document-style layout: one typeface, thin rules, one accent colour. */
:root {
  --ink: #0F1B2D; --ink-2: #3A4A5E; --ink-3: #6B788A;
  --navy: #0B2545; --blue: #0B5CAB; --blue-soft: #EEF4FB;
  --green: #4A7F10;
  --line: #E2E7EE; --line-2: #CDD5E0;
  --bg: #FFFFFF; --bg-2: #F7F9FB;
  --f: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --w: 1240px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body { margin: 0; font: 400 14.5px/1.6 var(--f); color: var(--ink-2); background: var(--bg); -webkit-font-smoothing: antialiased; font-feature-settings: 'cv11', 'ss01'; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
h1, h2, h3, h4 { color: var(--ink); margin: 0; font-weight: 600; letter-spacing: -.011em; }
p { margin: 0 0 12px; }
img { max-width: 100%; }
.wrap { max-width: var(--w); margin: 0 auto; padding: 0 32px; }

/* ---------- top bar ---------- */
.top { position: sticky; top: 0; z-index: 50; background: #fff; border-bottom: 1px solid var(--line); }
.top-in { max-width: var(--w); margin: 0 auto; padding: 12px 32px; display: flex; align-items: center; gap: 24px; }
.brand { display: flex; align-items: center; gap: 14px; text-decoration: none !important; }
.brand img { height: 30px; width: auto; }
.brand span { font: 500 13px var(--f); color: var(--ink-3); border-left: 1px solid var(--line-2); padding-left: 14px; }
.top-nav { margin-left: auto; display: flex; align-items: center; gap: 22px; font-size: 14px; }
.top-nav a { color: var(--ink-2); }
.top-nav a:hover { color: var(--blue); }
.top-nav select { height: 34px; border: 1px solid var(--line-2); border-radius: 6px; background: #fff; font: 500 13.5px var(--f); color: var(--ink); padding: 0 30px 0 10px; max-width: 260px; cursor: pointer;
  appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position: calc(100% - 15px) 15px, calc(100% - 10px) 15px; background-size: 5px 5px; background-repeat: no-repeat; }

/* ---------- flow page layout ---------- */
.page { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 48px; padding-top: 40px; padding-bottom: 24px; }
.toc { position: sticky; top: 84px; align-self: start; font-size: 13.5px; }
.toc h6 { margin: 0 0 10px; font: 600 11px var(--f); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.toc li a { display: block; padding: 5px 0 5px 14px; margin-left: -1px; border-left: 2px solid transparent; color: var(--ink-2); }
.toc li a:hover { color: var(--ink); border-left-color: var(--line-2); text-decoration: none; }
.toc .back { display: block; margin-top: 22px; color: var(--ink-3); }

.doc-head { padding-bottom: 28px; border-bottom: 1px solid var(--line); }
.eyebrow { font: 500 12.5px var(--f); color: var(--ink-3); letter-spacing: .02em; margin-bottom: 14px; }
.eyebrow a { color: var(--ink-3); }
.eyebrow span + span::before { content: "/"; margin: 0 8px; color: var(--line-2); }
.doc-head h1 { font-size: 30px; line-height: 1.18; letter-spacing: -.02em; margin-bottom: 14px; max-width: 900px; }
.doc-head .lead { font-size: 16px; line-height: 1.6; color: var(--ink-2); max-width: 820px; margin: 0; }
.facts { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 8px 20px; margin: 24px 0 0; font-size: 14px; max-width: 900px; }
.facts dt { color: var(--ink-3); }
.facts dd { margin: 0; color: var(--ink); }

.sec { padding: 36px 0 8px; }
.sec-h { display: flex; align-items: baseline; gap: 14px; margin-bottom: 18px; }
.sec-h .n { font: 500 13px var(--f); color: var(--ink-3); min-width: 20px; }
.sec-h h2 { font-size: 21px; }
.sec-h p { margin: 0 0 0 auto; color: var(--ink-3); font-size: 13.5px; text-align: right; }

/* storyline */
.story { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 40px; }
.steps { list-style: none; margin: 0; padding: 0; counter-reset: s; }
.steps li { counter-increment: s; display: grid; grid-template-columns: 40px minmax(0, 1fr); padding: 14px 0; border-top: 1px solid var(--line); }
.steps li:first-child { border-top: 0; padding-top: 0; }
.steps li::before { content: counter(s, decimal-leading-zero); font: 500 13px/1.6 var(--f); color: var(--ink-3); }
.steps b { display: block; color: var(--ink); font-weight: 600; margin-bottom: 2px; }
.steps .when { font-weight: 500; color: var(--green); margin-right: 8px; }
.steps span { color: var(--ink-2); }
.people { border-left: 1px solid var(--line); padding-left: 24px; font-size: 14px; }
.people h4 { font: 600 11px var(--f); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 10px; }
.people dl { margin: 0; }
.people dt { color: var(--ink); font-weight: 600; margin-top: 10px; }
.people dd { margin: 0; color: var(--ink-3); }
.people .note { margin-top: 16px; font-size: 12.5px; color: var(--ink-3); }

/* diagram */
.diagram { border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; background: #fff; position: relative; }
.dia-bar { display: flex; align-items: center; gap: 16px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--bg-2); flex-wrap: wrap; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 12.5px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; border: 1.5px solid; border-radius: 2px; display: inline-block; }
.legend i.dec { border-style: dashed; }
.tools { margin-left: auto; display: flex; align-items: center; border: 1px solid var(--line-2); border-radius: 6px; overflow: hidden; background: #fff; }
.tools button { height: 30px; padding: 0 11px; border: 0; border-left: 1px solid var(--line); background: #fff; color: var(--ink-2); cursor: pointer; font: 500 12.5px var(--f); }
.tools button:first-child { border-left: 0; }
.tools button:hover { background: var(--blue-soft); color: var(--blue); }
.tools .pct { min-width: 52px; text-align: center; font: 500 12px var(--f); color: var(--ink-3); border-left: 1px solid var(--line); line-height: 30px; }
.canvas { height: min(76vh, 860px); min-height: 520px; position: relative; cursor: grab; background: #fff; }
.canvas:active { cursor: grabbing; }
.canvas .mermaid { width: 100%; height: 100%; }
.canvas svg { width: 100% !important; height: 100% !important; max-width: none !important; }
.canvas .loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--ink-3); font-size: 14px; }
.diagram.full { position: fixed; inset: 0; z-index: 100; border-radius: 0; border: 0; }
.diagram.full .canvas { height: calc(100vh - 52px); }
.hint { margin: 10px 0 0; font-size: 12.5px; color: var(--ink-3); }
.mermaid .node.clickable { cursor: pointer; }
.dia-err { padding: 24px; color: #B42318; font-size: 14px; white-space: pre-wrap; }

/* tables */
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; font: 600 11.5px var(--f); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); padding: 0 16px 10px 0; border-bottom: 1px solid var(--line-2); }
table.t td { padding: 11px 16px 11px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t td:first-child { color: var(--ink); font-weight: 600; width: 30%; }
table.t tr:last-child td { border-bottom: 0; }

/* feature areas */
.areas { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px 36px; }
.area h3 { font-size: 15px; padding-bottom: 8px; border-bottom: 1px solid var(--ink); display: flex; justify-content: space-between; gap: 10px; }
.area h3 em { font-style: normal; font-weight: 500; color: var(--ink-3); font-size: 13px; }
.area ul { margin: 0; padding: 0; list-style: none; }
.area li { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; line-height: 1.5; }
.area li b { color: var(--ink); font-weight: 600; }
.more { margin-top: 22px; font-size: 14px; color: var(--ink-2); }
.more b { color: var(--ink); font-weight: 600; margin-right: 6px; }

/* rules */
.rules { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 36px; }
.rule { padding: 14px 0; border-top: 1px solid var(--line); }
.rule h4 { font-size: 15px; margin-bottom: 4px; }
.rule p { margin: 0; font-size: 14px; }

/* related + pager */
.related { list-style: none; margin: 0; padding: 0; columns: 2; column-gap: 36px; }
.related li { break-inside: avoid; padding: 9px 0; border-top: 1px solid var(--line); font-size: 14.5px; }
.related .no { color: var(--ink-3); display: inline-block; width: 30px; }
.related small { color: var(--ink-3); margin-left: 6px; }
.pager { display: flex; justify-content: space-between; gap: 20px; margin: 40px 0 0; padding-top: 20px; border-top: 1px solid var(--line); font-size: 14.5px; }
.pager small { display: block; color: var(--ink-3); font-size: 12.5px; margin-bottom: 2px; }
.pager .nx { text-align: right; }

.foot { margin-top: 56px; border-top: 1px solid var(--line); background: var(--bg-2); }
.foot .wrap { padding: 22px 32px; display: flex; gap: 16px; flex-wrap: wrap; justify-content: space-between; font-size: 13px; color: var(--ink-3); }
.foot a { color: var(--ink-2); }

/* ---------- home ---------- */
.home-head { padding: 40px 0 28px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 56px; align-items: start; }
.home-head h1 { font-size: 32px; line-height: 1.15; letter-spacing: -.02em; margin: 0 0 12px; }
.home-head .lead { font-size: 15.5px; line-height: 1.6; max-width: 580px; }
.home-head .links { display: flex; gap: 8px 20px; margin-top: 16px; font-size: 14.5px; font-weight: 500; flex-wrap: wrap; }
.figures { display: flex; gap: 32px; margin-top: 24px; flex-wrap: wrap; }
.figures div b { display: block; font: 600 22px/1.1 var(--f); color: var(--ink); letter-spacing: -.02em; }
.figures div span { font-size: 13px; color: var(--ink-3); }
.visit h2 { font-size: 15px; margin-bottom: 4px; }
.visit p { font-size: 13.5px; color: var(--ink-3); margin-bottom: 12px; }
.visit table.t td:first-child { width: 64px; color: var(--green); font-weight: 500; }
.visit table.t td { padding: 8px 12px 8px 0; }

.howto { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 28px; padding: 24px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; color: var(--ink-3); }
.howto div b { display: block; color: var(--ink); font-weight: 600; margin: 2px 0 2px; font-size: 14px; }
.howto .k { font-size: 13px; color: var(--ink-3); }
.search { display: flex; gap: 16px; align-items: center; padding: 28px 0 4px; flex-wrap: wrap; }
.search h2 { font-size: 20px; margin-right: auto; }
.search input { width: 380px; max-width: 100%; height: 40px; border-radius: 6px; border: 1px solid var(--line-2); padding: 0 14px; font: 400 14.5px var(--f); color: var(--ink); }
.search input:focus { outline: 2px solid #9DC0E8; outline-offset: 0; border-color: var(--blue); }
.chapter { padding: 20px 0 2px; }
.chapter-h { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 32px; margin-bottom: 6px; }
.chapter-h .c { font-size: 13px; color: var(--ink-3); padding-top: 3px; }
.chapter-h h3 { font-size: 16px; }
.chapter-h p { margin: 2px 0 0; font-size: 13.5px; color: var(--ink-3); }
.index { margin-left: 232px; }
.index table.t td:first-child { width: 48px; color: var(--ink-3); font-weight: 500; }
.index table.t td.title { width: 34%; }
.index table.t td.title a { color: var(--ink); font-weight: 600; }
.index table.t td.title a:hover { color: var(--blue); }
.index table.t td.who { width: 22%; color: var(--ink-3); font-size: 13px; }
.index table.t td { padding: 9px 16px 9px 0; }
.index table.t td.desc { font-size: 13.5px; }
.index tr.hidden { display: none; }
.empty { display: none; padding: 40px 0; color: var(--ink-3); }

@media (max-width: 1024px) {
  .page { grid-template-columns: 1fr; gap: 0; }
  .toc { display: none; }
  .home-head { grid-template-columns: 1fr; gap: 36px; }
  .howto { grid-template-columns: 1fr 1fr; }
  .areas { grid-template-columns: 1fr 1fr; }
  .index { margin-left: 0; }
  .chapter-h { grid-template-columns: 1fr; gap: 4px; }
}
@media (max-width: 720px) {
  .wrap, .top-in { padding-left: 16px; padding-right: 16px; }
  .brand span, .top-nav .hide-sm { display: none; }
  .top-nav select { max-width: 170px; }
  .story { grid-template-columns: 1fr; gap: 24px; }
  .people { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); padding-top: 16px; }
  .areas, .rules { grid-template-columns: 1fr; }
  .related { columns: 1; }
  .facts { grid-template-columns: 1fr; gap: 2px; } .facts dd { margin-bottom: 8px; }
  .canvas { height: 70vh; min-height: 420px; }
  .tools .pct { display: none; }
  .index table.t td.who { display: none; }
  .sec-h p { display: none; }
}
@media (max-width: 720px) {
  .index table.t, .index table.t tbody { display: block; }
  .index table.t tr { display: grid; grid-template-columns: 34px minmax(0, 1fr); padding: 11px 0; border-bottom: 1px solid var(--line); }
  .index table.t td { display: block; padding: 0; border: 0; width: auto !important; }
  .index table.t td.desc { grid-column: 2; color: var(--ink-3); font-size: 13px; margin-top: 2px; }
  .index table.t td.who { display: none; }
  .home-head { padding: 24px 0 20px; gap: 24px; }
  .home-head h1 { font-size: 25px; }
  .home-head .lead { font-size: 14.5px; }
  .visit p { display: none; }
  .page { padding-top: 24px; }
  .figures { gap: 20px; margin-top: 18px; } .figures div b { font-size: 19px; }
  .howto { grid-template-columns: 1fr 1fr; gap: 16px; padding: 18px 0; font-size: 13px; }
  .search { padding-top: 22px; } .search input { width: 100%; }
  .chapter-h .c { display: none; }
  table.t td:first-child { width: 38%; }
  .doc-head h1 { font-size: 24px; } .doc-head .lead { font-size: 15px; }
  .sec { padding-top: 28px; }
  .dia-bar { padding: 8px 10px; } .legend { font-size: 11.5px; gap: 3px 12px; }
  .tools { margin-left: 0; flex-wrap: wrap; } .tools button { padding: 0 9px; font-size: 12px; }
}
@media print { .top, .tools, .pager, .foot, .toc { display: none; } .canvas { height: auto; } }
