/* ============================================================================
   KAO Process Swimlane Platform - STYLES
   IRIS-aligned, light, professional. Teal accent, no orange.
   ========================================================================== */

:root {
  /* surfaces */
  --bg:           #EAF0F2;
  --surface:      #FFFFFF;
  --surface-2:    #F4F8F9;
  --border:       #DCE6EA;
  --border-strong:#C3D2D8;

  /* brand teal */
  --teal:         #156082;
  --teal-700:     #0F4A66;
  --teal-300:     #5C97B3;
  --teal-50:      #E7F1F5;

  /* ink */
  --ink:          #15282F;
  --ink-2:        #45606B;
  --ink-3:        #7B939C;

  /* pain (rose scale, no orange) */
  --pain-high:    #BC3B52;
  --pain-med:     #C77488;
  --pain-low:     #D9A7B2;

  /* to-be */
  --tobe:         #16826B;
  --tobe-50:      #E6F3EF;
  --removed:      #9AA7AD;

  --shadow-sm:    0 1px 2px rgba(20,40,47,.06), 0 1px 1px rgba(20,40,47,.04);
  --shadow-md:    0 6px 18px rgba(20,40,47,.10), 0 2px 6px rgba(20,40,47,.06);
  --shadow-lg:    0 18px 48px rgba(20,40,47,.18);

  --r:            10px;
  --font:         "Merriweather", Georgia, serif;
  --mono:         "Merriweather", Georgia, serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* ---------------------------------------------------------------- layout -- */
.app {
  display: grid;
  grid-template-columns: 264px 1fr;
  height: 100vh;
}

/* ------------------------------------------------------------- sidebar --- */
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.brand {
  padding: 22px 22px 18px;
  border-bottom: 1px solid var(--border);
}
.brand .mark {
  font-family: var(--mono);
  font-weight: 600;
  letter-spacing: .26em;
  font-size: 18px;
  color: var(--teal);
}
.brand .sub {
  margin-top: 4px;
  font-size: 11.5px;
  color: var(--ink-3);
  letter-spacing: .02em;
}

/* guided tour */
.tour-trigger { margin: 0 16px 14px; width: calc(100% - 32px); padding: 10px 12px; border: 1px solid var(--teal-700); background: var(--teal); color: #fff; border-radius: 8px; cursor: pointer; font-family: var(--font); font-size: 12.5px; font-weight: 600; transition: background .14s; }
.tour-trigger:hover { background: var(--teal-700); }
.tour-card { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(12px); width: 460px; max-width: 92vw; background: var(--surface); border: 1px solid var(--border-strong); border-top: 4px solid var(--teal); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 18px 20px; z-index: 55; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.tour-card.open { opacity: 1; pointer-events: auto; transform: translateX(-50%) translateY(0); }
.tour-x { position: absolute; top: 10px; right: 12px; border: 0; background: transparent; font-size: 18px; color: var(--ink-3); cursor: pointer; line-height: 1; }
.tour-step { font-family: var(--mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--teal); }
.tour-title { font-size: 16px; font-weight: 700; margin: 4px 0 6px; }
.tour-body { font-size: 13px; color: var(--ink-2); line-height: 1.55; }
.tour-nav { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.tour-nav button { font-family: var(--font); font-size: 12.5px; padding: 7px 16px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink-2); cursor: pointer; }
.tour-nav button.primary { background: var(--teal); color: #fff; border-color: var(--teal-700); }

/* pain explorer modal */
.modal-scrim { position: fixed; inset: 0; background: rgba(20,40,47,.34); backdrop-filter: blur(2px); opacity: 0; pointer-events: none; transition: opacity .16s; z-index: 60; }
.modal-scrim.open { opacity: 1; pointer-events: auto; }
.modal { position: fixed; top: 8vh; left: 50%; transform: translateX(-50%) scale(.98); width: 760px; max-width: 94vw; max-height: 84vh; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 14px; box-shadow: var(--shadow-lg); z-index: 61; opacity: 0; pointer-events: none; transition: opacity .16s, transform .16s; display: flex; flex-direction: column; }
.modal.open { opacity: 1; pointer-events: auto; transform: translateX(-50%) scale(1); }
.modal-head { display: flex; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-head h2 { font-size: 17px; font-weight: 700; flex: 1; }
.modal-count { font-family: var(--mono); font-size: 12px; color: var(--ink-3); font-weight: 400; margin-left: 8px; }
.modal-filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 14px 22px; border-bottom: 1px solid var(--border); }
.modal-filters input { flex: 1; min-width: 180px; border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; font-family: var(--font); font-size: 13px; outline: none; }
.modal-filters input:focus { border-color: var(--teal-300); }
.modal-filters select { border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font-family: var(--font); font-size: 12.5px; color: var(--ink-2); background: var(--surface); }
.pf-chips { display: flex; gap: 6px; }
.pf-chip { font-size: 11.5px; padding: 6px 12px; border-radius: 14px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink-2); cursor: pointer; }
.pf-chip.on { background: var(--teal); color: #fff; border-color: var(--teal-700); }
.modal-body { overflow-y: auto; padding: 8px; }
.pain-row { display: flex; align-items: flex-start; gap: 12px; padding: 11px 14px; border-radius: 8px; cursor: pointer; }
.pain-row:hover { background: var(--surface-2); }
.pain-row .sevdot { width: 9px; height: 9px; border-radius: 50%; margin-top: 5px; flex: none; }
.pain-row .sevdot.high { background: var(--pain-high); }
.pain-row .sevdot.med { background: var(--pain-med); }
.pain-row .pmain { flex: 1; min-width: 0; }
.pain-row .ptitle { font-size: 13.5px; color: var(--ink); line-height: 1.35; }
.pain-row .pmeta { font-size: 11px; color: var(--ink-3); margin-top: 3px; font-family: var(--mono); }
.pain-row .arrow { color: var(--teal-300); align-self: center; }

/* search button + command palette */
.search-btn { margin: 0 16px 14px; display: flex; align-items: center; justify-content: space-between; gap: 8px; width: calc(100% - 32px); padding: 9px 12px; border: 1px solid var(--border); background: var(--surface-2); color: var(--ink-3); border-radius: 8px; cursor: pointer; font-family: var(--font); font-size: 12.5px; transition: border-color .14s; }
.search-btn:hover { border-color: var(--border-strong); color: var(--ink-2); }
.search-btn .kbd { font-size: 10px; color: var(--ink-3); border: 1px solid var(--border); border-radius: 4px; padding: 1px 6px; background: var(--surface); }
.palette-scrim { position: fixed; inset: 0; background: rgba(20,40,47,.34); backdrop-filter: blur(2px); opacity: 0; pointer-events: none; transition: opacity .16s; z-index: 60; }
.palette-scrim.open { opacity: 1; pointer-events: auto; }
.palette { position: fixed; top: 12vh; left: 50%; transform: translateX(-50%) scale(.98); width: 620px; max-width: 92vw; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 14px; box-shadow: var(--shadow-lg); z-index: 61; opacity: 0; pointer-events: none; transition: opacity .16s, transform .16s; overflow: hidden; }
.palette.open { opacity: 1; pointer-events: auto; transform: translateX(-50%) scale(1); }
.palette input { width: 100%; border: 0; border-bottom: 1px solid var(--border); padding: 18px 20px; font-family: var(--font); font-size: 16px; color: var(--ink); outline: none; }
.palette-results { max-height: 52vh; overflow-y: auto; padding: 6px; }
.pal-row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 8px; cursor: pointer; }
.pal-row.sel, .pal-row:hover { background: var(--teal-50); }
.pal-type { font-family: var(--mono); font-size: 9px; letter-spacing: .08em; text-transform: uppercase; color: var(--teal-700); background: var(--surface-2); border: 1px solid var(--border); border-radius: 5px; padding: 2px 7px; flex: none; width: 96px; text-align: center; }
.pal-lbl { flex: 1; font-size: 13.5px; color: var(--ink); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pal-sub { font-size: 11px; color: var(--ink-3); flex: none; }
.pal-empty { padding: 24px; text-align: center; color: var(--ink-3); font-size: 13px; }

/* view tabs */
.viewtabs { display: flex; gap: 4px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.vtab {
  flex: 1; font-family: var(--font); font-size: 12.5px; font-weight: 600;
  padding: 9px 8px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--ink-2);
  transition: all .14s;
}
.vtab:hover { border-color: var(--border-strong); }
.vtab.on { background: var(--teal); border-color: var(--teal-700); color: #fff; }

.rail-section { padding: 18px 16px 12px; flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.rail-title {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding: 0 6px 8px;
}

.proc-list { display: flex; flex-direction: column; gap: 2px; }
.proc {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid transparent;
  color: var(--ink-2);
  transition: background .14s, color .14s;
}
.proc:hover { background: var(--surface-2); }
.proc.active {
  background: var(--teal-50);
  border-color: #CFE3EB;
  color: var(--teal-700);
}
.proc .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--teal-300); flex: none;
}
.proc.active .dot { background: var(--teal); }
.proc .nm { font-size: 13.5px; font-weight: 500; line-height: 1.25; }
.proc .grp { display: block; font-size: 10.5px; color: var(--ink-3); margin-top: 2px; }
.proc.locked { color: var(--ink-3); cursor: default; }
.proc.locked .dot { background: #D6DEE2; }
.proc.locked .lock { margin-left: auto; font-size: 10px; color: var(--ink-3); font-family: var(--mono); }

.legend {
  flex: none;
  border-top: 1px solid var(--border);
  padding: 16px 20px 20px;
  display: flex; flex-direction: column; gap: 12px;
}
.legend .grp-title {
  font-family: var(--mono); font-size: 10px; letter-spacing: .16em;
  text-transform: uppercase; color: var(--ink-3);
}
.legend .row { display: flex; flex-wrap: wrap; gap: 10px 14px; }
.legend .item { display: flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--ink-2); }
.swatch { width: 14px; height: 14px; border-radius: 4px; border: 1px solid var(--border-strong); }
.swatch.proc-s { background: var(--surface); }
.swatch.dec-s { background: var(--surface); transform: rotate(45deg); border-radius: 2px; width: 11px; height: 11px; }
.swatch.term-s { background: var(--teal); border-color: var(--teal-700); border-radius: 7px; }
.pin { width: 10px; height: 10px; border-radius: 50%; }
.pin.high { background: var(--pain-high); }
.pin.med { background: var(--pain-med); }
.pin.low { background: var(--pain-low); }

/* --------------------------------------------------------------- main ---- */
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; }

.topbar {
  display: flex; align-items: center; gap: 18px;
  padding: 16px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.topbar .titles h1 { font-size: 18px; font-weight: 600; letter-spacing: -.01em; }
.topbar .titles p { font-size: 12px; color: var(--ink-3); margin-top: 2px; }

.metrics { display: flex; gap: 22px; margin-left: 8px; }
.metric { display: flex; flex-direction: column; }
.metric .v { font-family: var(--mono); font-size: 16px; font-weight: 600; color: var(--teal-700); line-height: 1; }
.metric .l { font-size: 10px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .08em; margin-top: 5px; }

.spacer { flex: 1; }

/* segmented as-is / to-be toggle */
.seg {
  display: inline-flex; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 9px; padding: 3px;
}
.seg button {
  font-family: var(--font); font-size: 12.5px; font-weight: 500;
  border: 0; background: transparent; color: var(--ink-2);
  padding: 7px 16px; border-radius: 6px; cursor: pointer;
  transition: all .16s;
}
.seg button.on { background: var(--surface); color: var(--teal-700); box-shadow: var(--shadow-sm); }
.seg button.tobe.on { color: var(--tobe); }

.zoom { display: inline-flex; align-items: center; gap: 4px; }
.zoom button {
  width: 32px; height: 32px; border: 1px solid var(--border);
  background: var(--surface); border-radius: 8px; cursor: pointer;
  font-size: 16px; color: var(--ink-2); display: grid; place-items: center;
}
.zoom button:hover { border-color: var(--border-strong); color: var(--ink); }
.zoom .fit { width: auto; padding: 0 12px; font-size: 12px; font-family: var(--mono); }

/* ------------------------------------------------------------- canvas ---- */
.canvas-scroll {
  flex: 1; overflow: auto; position: relative;
  background:
    linear-gradient(var(--bg), var(--bg));
}
.stage { position: relative; transform-origin: 0 0; }

.lane-row { position: absolute; left: 0; right: 0; display: flex; }
.lane-row:nth-child(odd) .lane-band { background: rgba(255,255,255,.45); }
.lane-band { position: absolute; left: 0; right: 0; top: 0; bottom: 0; }
.lane-row .lane-line { position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: var(--border); }

.lane-label {
  position: sticky; left: 0; z-index: 5;
  width: var(--label-w);
  display: flex; align-items: center; gap: 10px;
  padding: 0 16px;
  background: var(--surface);
  border-right: 1px solid var(--border-strong);
  box-shadow: 6px 0 12px -8px rgba(20,40,47,.18);
}
.lane-label .bar { width: 4px; align-self: stretch; margin: 14px 0; border-radius: 3px; }
.lane-label .txt { font-size: 12.5px; font-weight: 600; color: var(--ink); line-height: 1.2; }
.lane-label .txt small { display: block; font-family: var(--mono); font-size: 9.5px; color: var(--ink-3); font-weight: 400; letter-spacing: .04em; margin-top: 3px; }

svg.edges { position: absolute; top: 0; left: 0; overflow: visible; pointer-events: none; }
svg.edges path.edge { fill: none; stroke: var(--border-strong); stroke-width: 1.6; transition: stroke .16s, stroke-width .16s; }
svg.edges path.edge.hot { stroke: var(--teal); stroke-width: 2.4; }
svg.edges .elabel-bg { fill: var(--surface); stroke: var(--border); }
svg.edges .elabel { font-family: var(--mono); font-size: 10px; fill: var(--ink-2); }

/* nodes */
.node {
  position: absolute; cursor: pointer; user-select: none;
  transition: transform .14s, box-shadow .14s, opacity .2s, border-color .14s;
}
.node:hover { transform: translateY(-1px); }
.node.dim { opacity: .32; }

.node .box {
  width: 100%; height: 100%;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
  display: flex; align-items: center; justify-content: center;
  text-align: center; padding: 8px 12px;
}
.node .box .lbl { font-size: 12.5px; font-weight: 500; line-height: 1.28; color: var(--ink); }
.node:hover .box { box-shadow: var(--shadow-md); border-color: var(--teal-300); }
.node.sel .box { border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-50), var(--shadow-md); }

/* terminal (start/end) */
.node.term .box { background: var(--teal); border-color: var(--teal-700); border-radius: 30px; }
.node.term .lbl { color: #fff; font-weight: 600; }

/* decision diamond */
.node.decision .box {
  background: var(--surface); border: 0; border-radius: 0; box-shadow: none;
  position: relative;
}
.node.decision .diamond {
  position: absolute; inset: 0; margin: auto;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-sm);
  transform: rotate(45deg);
  width: 70%; height: 70%; border-radius: 8px;
}
.node.decision:hover .diamond { border-color: var(--teal-300); box-shadow: var(--shadow-md); }
.node.decision.sel .diamond { border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-50), var(--shadow-md); }
.node.decision .lbl { position: relative; z-index: 1; }

/* pain badge */
.painbadge {
  position: absolute; top: -8px; right: -8px; z-index: 3;
  min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 11px; background: var(--pain-high); color: #fff;
  font-family: var(--mono); font-size: 11px; font-weight: 600;
  display: grid; place-items: center;
  box-shadow: 0 2px 5px rgba(188,59,82,.4);
  border: 2px solid var(--surface);
}
.painbadge::after {
  content: ""; position: absolute; inset: -5px; border-radius: 50%;
  border: 2px solid var(--pain-high); opacity: 0; animation: pulse 2.4s ease-out infinite;
}
@keyframes pulse { 0% { transform: scale(.7); opacity: .5; } 70%,100% { transform: scale(1.5); opacity: 0; } }

/* to-be status tags */
.statustag {
  position: absolute; bottom: -9px; left: 50%; transform: translateX(-50%);
  font-family: var(--mono); font-size: 9px; letter-spacing: .08em; text-transform: uppercase;
  padding: 2px 8px; border-radius: 10px; white-space: nowrap; z-index: 3;
  border: 1px solid;
}
.statustag.changed { background: var(--tobe-50); color: var(--tobe); border-color: #BFE0D7; }
.statustag.new     { background: var(--tobe); color: #fff; border-color: var(--tobe); }
.statustag.removed { background: #EEF1F2; color: var(--removed); border-color: #D7DEE1; }

.node.removed-tb .box { border-style: dashed; opacity: .6; }
.node.removed-tb .box .lbl { text-decoration: line-through; color: var(--ink-3); }
.node.changed-tb .box { border-color: var(--tobe); box-shadow: 0 0 0 2px var(--tobe-50), var(--shadow-sm); }

/* --------------------------------------------------------------- drawer -- */
.scrim {
  position: fixed; inset: 0; background: rgba(20,40,47,.28);
  opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 40;
  backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
}
.scrim.open { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed; top: 0; right: 0; height: 100vh; width: 440px; max-width: 92vw;
  background: var(--surface); z-index: 50;
  box-shadow: var(--shadow-lg);
  transform: translateX(100%); transition: transform .26s cubic-bezier(.22,.61,.36,1);
  display: flex; flex-direction: column;
}
.drawer.open { transform: none; }

.drawer-head { padding: 22px 24px 18px; border-bottom: 1px solid var(--border); }
.drawer-head .lane-chip {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 11px; font-weight: 600; color: var(--ink-2);
  background: var(--surface-2); border: 1px solid var(--border);
  padding: 4px 10px; border-radius: 20px;
}
.drawer-head .lane-chip .c { width: 8px; height: 8px; border-radius: 50%; }
.drawer-head h2 { font-size: 20px; font-weight: 600; margin: 12px 0 2px; letter-spacing: -.01em; }
.drawer-head .type { font-family: var(--mono); font-size: 11px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .1em; }
.drawer .close {
  position: absolute; top: 18px; right: 18px; width: 32px; height: 32px;
  border: 1px solid var(--border); background: var(--surface); border-radius: 8px;
  cursor: pointer; font-size: 18px; color: var(--ink-2); display: grid; place-items: center;
}
.drawer .close:hover { border-color: var(--border-strong); color: var(--ink); }

.drawer-seg { padding: 16px 24px 0; }

.drawer-body { padding: 18px 24px 28px; overflow-y: auto; flex: 1; }

.section-title {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--ink-3); margin: 22px 0 10px;
}
.section-title:first-child { margin-top: 0; }
.desc { font-size: 14px; line-height: 1.55; color: var(--ink-2); }

.pain-card {
  border: 1px solid var(--border); border-left: 3px solid var(--pain-high);
  border-radius: 8px; padding: 12px 14px; margin-bottom: 10px; cursor: pointer;
  transition: box-shadow .14s, border-color .14s;
}
.pain-card.sev-med { border-left-color: var(--pain-med); }
.pain-card.sev-low { border-left-color: var(--pain-low); }
.pain-card:hover { box-shadow: var(--shadow-sm); }
.pain-card .ph { display: flex; align-items: flex-start; gap: 9px; }
.pain-card .sev {
  font-family: var(--mono); font-size: 9px; letter-spacing: .08em; text-transform: uppercase;
  padding: 2px 7px; border-radius: 5px; color: #fff; flex: none; margin-top: 1px;
}
.pain-card .sev.high { background: var(--pain-high); }
.pain-card .sev.med { background: var(--pain-med); }
.pain-card .sev.low { background: var(--pain-low); }
.pain-card .pt { font-size: 13.5px; font-weight: 600; color: var(--ink); line-height: 1.35; }
.pain-card .detail { margin-top: 10px; display: none; font-size: 12.5px; line-height: 1.5; }
.pain-card.open .detail { display: block; }
.pain-card .detail .row { display: flex; gap: 8px; margin-top: 7px; }
.pain-card .detail .k { font-family: var(--mono); font-size: 10px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; flex: none; width: 64px; padding-top: 2px; }
.pain-card .detail .v { color: var(--ink-2); }
.pain-card .theme { display: inline-block; margin-top: 9px; font-size: 10.5px; font-family: var(--mono); color: var(--teal-700); background: var(--teal-50); padding: 2px 8px; border-radius: 5px; }

.change-item { display: flex; align-items: flex-start; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--surface-2); font-size: 13.5px; color: var(--ink-2); }
.change-item .ck { color: var(--tobe); flex: none; font-weight: 700; }

.tobe-banner {
  display: flex; align-items: center; gap: 8px;
  font-size: 11.5px; font-family: var(--mono); letter-spacing: .04em;
  padding: 8px 12px; border-radius: 7px; margin-bottom: 16px;
}
.tobe-banner.changed { background: var(--tobe-50); color: var(--tobe); }
.tobe-banner.removed { background: #EEF1F2; color: var(--removed); }
.tobe-banner.new { background: var(--tobe); color: #fff; }
.tobe-banner.same { background: var(--surface-2); color: var(--ink-3); }

.empty-pain { font-size: 13px; color: var(--ink-3); font-style: italic; padding: 4px 0; }

/* ------------------------------------------------- process landscape ----- */
.landscape-scroll { flex: 1; overflow: auto; padding: 26px 30px 40px; }
.landscape {
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  max-width: 1320px; margin: 0 auto;
}

.fn-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow-sm); overflow: hidden;
  display: flex; flex-direction: column;
}
.fn-card .fn-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
}
.fn-card .fn-bar { width: 4px; height: 26px; border-radius: 3px; flex: none; }
.fn-card .fn-h-txt { flex: 1; min-width: 0; }
.fn-card .fn-h-txt .nm { font-size: 13.5px; font-weight: 600; color: var(--ink); line-height: 1.2; }
.fn-card .fn-h-txt .ct { font-family: var(--mono); font-size: 10px; color: var(--ink-3); margin-top: 2px; }
.fn-card .fn-issues {
  font-family: var(--mono); font-size: 11px; font-weight: 600; color: var(--pain-high);
  background: rgba(188,59,82,.08); border: 1px solid rgba(188,59,82,.18);
  padding: 3px 9px; border-radius: 14px; flex: none;
}

.fn-body { padding: 6px; display: flex; flex-direction: column; gap: 2px; }
.proc-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 8px; border: 1px solid transparent;
}
.proc-row .heat { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.proc-row .heat.h { background: var(--pain-high); }
.proc-row .heat.m { background: var(--pain-med); }
.proc-row .heat.l { background: var(--pain-low); }
.proc-row .p-nm { flex: 1; font-size: 13px; color: var(--ink-2); }
.proc-row .p-iss { font-family: var(--mono); font-size: 11px; color: var(--ink-3); }
.proc-row .p-tag {
  font-family: var(--mono); font-size: 9px; letter-spacing: .06em; text-transform: uppercase;
  padding: 2px 7px; border-radius: 5px;
}
.proc-row.soon .p-tag { background: var(--surface-2); color: var(--ink-3); border: 1px solid var(--border); }
.proc-row.live { cursor: pointer; }
.proc-row.live .p-nm { color: var(--ink); font-weight: 600; }
.proc-row.live .p-tag { background: var(--teal-50); color: var(--teal-700); border: 1px solid #CFE3EB; }
.proc-row.live:hover { background: var(--teal-50); border-color: #CFE3EB; }
.proc-row.live .arrow { color: var(--teal); font-weight: 700; opacity: 0; transition: opacity .14s, transform .14s; }
.proc-row.live:hover .arrow { opacity: 1; transform: translateX(2px); }

.land-banner {
  grid-column: 1 / -1; display: flex; align-items: center; gap: 10px;
  font-size: 12.5px; color: var(--ink-2);
  background: var(--teal-50); border: 1px solid #CFE3EB; border-radius: 10px;
  padding: 11px 16px; margin-bottom: 2px;
}
.land-banner b { color: var(--teal-700); }

/* ------------------------------------------------- value chain overview -- */
.overview-scroll { flex: 1; overflow: auto; padding: 26px 30px 40px; }
.overview { max-width: 1340px; margin: 0 auto; }
.vc-intro { margin-bottom: 18px; }
.vc-h { font-size: 18px; font-weight: 600; color: var(--ink); }
.vc-sub { font-size: 12.5px; color: var(--ink-3); margin-top: 4px; max-width: 860px; line-height: 1.5; }
.vc-toggle { margin-top: 13px; font-family: var(--mono); font-size: 11.5px; border: 1px solid var(--border); background: var(--surface); color: var(--teal-700); padding: 7px 14px; border-radius: 8px; cursor: pointer; }
.vc-toggle:hover { border-color: var(--border-strong); }
.vc-toggle.on { background: var(--teal); color: #fff; border-color: var(--teal-700); }

.vc-canvas { position: relative; padding-top: 78px; }
.vc-links { position: absolute; top: 0; left: 0; pointer-events: none; overflow: visible; z-index: 2; }
.vc-row { display: flex; align-items: stretch; position: relative; z-index: 1; }
.vc-stage { flex: 1; min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 11px; box-shadow: var(--shadow-sm); padding: 16px 14px 12px; cursor: pointer; position: relative; overflow: hidden; transition: box-shadow .14s, transform .12s, border-color .14s; }
.vc-stage:hover { box-shadow: var(--shadow-md); border-color: var(--teal-300); transform: translateY(-2px); }
.vc-bar { position: absolute; top: 0; left: 0; right: 0; height: 4px; }
.vc-no { font-family: var(--mono); font-size: 10px; color: var(--ink-3); }
.vc-name { font-size: 13.5px; font-weight: 600; color: var(--ink); line-height: 1.2; margin-top: 3px; min-height: 33px; }
.vc-proc { font-size: 12px; color: var(--ink-2); margin-top: 8px; }
.vc-proc b { font-family: var(--mono); font-size: 15px; color: var(--teal-700); }
.vc-tags { display: flex; gap: 8px; margin-top: 6px; }
.vc-weak { font-family: var(--mono); font-size: 10.5px; color: var(--pain-high); }
.vc-sw { font-family: var(--mono); font-size: 10.5px; color: var(--teal); }
.vc-groups { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 11px; }
.vc-groups span { font-size: 9.5px; color: var(--ink-3); background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px; padding: 1px 6px; }
.vc-arrow { display: flex; align-items: center; color: var(--teal-300); font-size: 22px; padding: 0 5px; flex: none; }
.vc-enable { margin-top: 18px; background: var(--surface-2); border: 1px dashed var(--border-strong); border-radius: 11px; padding: 14px 18px; cursor: pointer; transition: border-color .14s; }
.vc-enable:hover { border-color: var(--teal-300); }
.vc-en-label { font-size: 13px; font-weight: 600; color: var(--ink); }
.vc-en-stats { font-size: 11.5px; color: var(--ink-3); margin-top: 3px; }
.vc-en-stats b { font-family: var(--mono); color: var(--ink); }
.dv-grp { font-size: 10px; color: #fff; background: var(--teal-300); border-radius: 4px; padding: 1px 7px; margin-right: auto; }

/* ------------------------------------------------------- animations ------ */
@keyframes revealIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.reveal { animation: revealIn .42s cubic-bezier(.22,.61,.36,1) both; }
@keyframes viewFade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.view-fade { animation: viewFade .32s ease both; }
@keyframes drawFlow { to { stroke-dashoffset: 0; } }
.flow-draw { stroke-dasharray: 1; stroke-dashoffset: 1; animation: drawFlow .7s ease forwards; }

/* strategic themes layer */
.th-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; }
.th-lbl { font-size: 12px; font-weight: 700; color: var(--ink); margin-right: 4px; }
.th-chip {
  font-family: var(--font); font-size: 11.5px; cursor: pointer;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink-2);
  padding: 6px 12px; border-radius: 16px; transition: all .14s; border-left: 4px solid var(--thc, var(--border-strong));
}
.th-chip:hover { border-color: var(--ink-3); }
.th-chip.on { background: var(--thc, var(--teal)); color: #fff; border-color: var(--thc, var(--teal)); }
.th-toggle { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; margin-left: 6px; }
.th-tg-track { width: 38px; height: 20px; border-radius: 20px; background: var(--border-strong); position: relative; transition: background .16s; flex: none; }
.th-tg-knob { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: left .16s; }
.th-toggle.on .th-tg-track { background: var(--pain-high); }
.th-toggle.on .th-tg-knob { left: 20px; }
.th-tg-lbl { font-size: 11.5px; font-weight: 600; color: var(--ink-2); }
.th-toggle.on .th-tg-lbl { color: var(--pain-high); }
.th-panel { margin-top: 14px; background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--teal); border-radius: 10px; padding: 14px 18px; box-shadow: var(--shadow-sm); }
.th-p-head { display: flex; align-items: center; gap: 12px; }
.th-p-head b { font-size: 14px; color: var(--ink); }
.th-sev { font-size: 10px; font-weight: 700; color: #fff; padding: 2px 9px; border-radius: 10px; }
.th-sum { font-size: 12.5px; color: var(--ink-2); margin: 8px 0 12px; line-height: 1.5; max-width: 900px; }
.th-cols { display: flex; flex-wrap: wrap; gap: 28px; }
.th-cols > div { min-width: 200px; }
.th-h { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-3); margin-bottom: 6px; }
.th-cols ul { margin: 0; padding-left: 16px; }
.th-cols li { font-size: 12px; color: var(--ink-2); line-height: 1.5; }
.th-fp { font-size: 12px; color: var(--ink-2); }
.pg-box.th-dim { opacity: .28; }
.th-heat-b { position: absolute; top: -7px; right: -7px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px; background: var(--pain-high); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--surface); z-index: 4; }

/* nested value-chain map */
.ov-canvas { transform-origin: top left; transition: transform .12s ease-out; }
.vc-block { border: 1px solid var(--border); border-radius: 14px; overflow: hidden; margin-bottom: 22px; box-shadow: var(--shadow-sm); background: var(--surface); }
.vc-bk-head { display: flex; align-items: center; gap: 12px; padding: 12px 20px; color: #fff; flex-wrap: wrap; }
.vc-bk-nm { font-size: 15px; font-weight: 700; letter-spacing: -.01em; }
.vc-bk-meta { font-size: 11.5px; opacity: .88; font-family: var(--mono); }
.vc-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-left: auto; }
.vc-leg { display: flex; align-items: center; gap: 5px; font-size: 10.5px; color: #fff; opacity: .92; }
.vc-leg i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
.ov-master { position: relative; }
.vc-zone { position: absolute; border: 1.5px dashed; border-radius: 14px; background: rgba(255,255,255,.5); z-index: 0; }
.vc-zone-lbl { position: absolute; top: -1px; left: -1px; color: #fff; font-size: 12px; font-weight: 700; padding: 4px 14px; border-radius: 14px 0 14px 0; letter-spacing: .01em; }
.g-lane-lbl { position: absolute; font-size: 11px; font-weight: 700; font-family: var(--mono); letter-spacing: .04em; text-transform: uppercase; z-index: 1; }
.vc-links { position: absolute; top: 0; left: 0; pointer-events: none; overflow: visible; z-index: 1; }
.pg-box { position: absolute; width: 212px; height: 82px; box-sizing: border-box; background: var(--surface); border: 1px solid var(--border-strong); border-top: 3px solid var(--teal); border-radius: 9px; padding: 9px 12px; cursor: pointer; box-shadow: var(--shadow-sm); transition: box-shadow .2s, border-color .14s, background .3s, opacity .3s; z-index: 3; overflow: hidden; }
.pg-box:hover { box-shadow: var(--shadow-md); }
.pg-box.has-sw { box-shadow: 0 0 0 1px var(--teal-50), var(--shadow-sm); }
.overview.editing .pg-box { cursor: grab; }
.pg-box.dragging { z-index: 20; box-shadow: var(--shadow-lg); cursor: grabbing; opacity: .96; }
.pg-nm { font-size: 12.5px; font-weight: 600; color: var(--ink); line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pg-stats { display: flex; align-items: center; gap: 8px; position: absolute; bottom: 9px; left: 12px; right: 12px; }
.pg-proc { font-family: var(--mono); font-size: 14px; font-weight: 600; color: var(--teal-700); }
.pg-weak { font-family: var(--mono); font-size: 10.5px; color: var(--pain-high); }
.pg-sw { font-family: var(--mono); font-size: 10.5px; color: var(--teal); margin-left: auto; }
.ov-tools { display: flex; gap: 10px; align-items: center; margin-top: 13px; flex-wrap: wrap; }
.ov-hint { font-size: 11.5px; color: var(--ink-3); font-family: var(--mono); }
.midcrumb, .crumb .back { cursor: pointer; }

/* groups overview (level 1) */
.landscape.groups { grid-template-columns: 1fr; max-width: 880px; gap: 12px; }
.grp-card {
  display: flex; align-items: center; gap: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow-sm); overflow: hidden; cursor: pointer;
  transition: box-shadow .14s, transform .12s, border-color .14s;
}
.grp-card:hover { box-shadow: var(--shadow-md); border-color: var(--teal-300); transform: translateY(-1px); }
.grp-bar { width: 6px; align-self: stretch; flex: none; }
.grp-main { flex: 1; padding: 16px 20px; }
.grp-nm { font-size: 16px; font-weight: 600; color: var(--ink); }
.grp-stats { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 8px; }
.gst { font-size: 12px; color: var(--ink-3); }
.gst b { font-family: var(--mono); font-size: 13px; color: var(--ink); font-weight: 600; }
.gst.weak b { color: var(--pain-high); }
.gst.swim b { color: var(--teal); }
.grp-arrow { font-size: 22px; color: var(--teal-300); padding: 0 20px; }
.grp-card:hover .grp-arrow { color: var(--teal); }

/* breadcrumb */
.crumb { grid-column: 1/-1; display: flex; align-items: center; gap: 10px; margin-bottom: 4px; font-size: 13px; }
.land-filter { display: flex; gap: 6px; margin-left: auto; }
.lf-chip { font-size: 11.5px; padding: 5px 12px; border-radius: 14px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink-2); cursor: pointer; }
.lf-chip:hover { border-color: var(--ink-3); }
.lf-chip.on { background: var(--teal); color: #fff; border-color: var(--teal-700); }
.crumb .back { color: var(--teal); cursor: pointer; font-weight: 500; }
.crumb .back:hover { text-decoration: underline; }
.crumb .sep { color: var(--ink-3); }
.crumb .cur { color: var(--ink); font-weight: 600; }

/* division detail (level 2) */
.landscape.detail { grid-template-columns: 1fr; max-width: 1320px; }
.dv-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.dv-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-sm); overflow: hidden; display: flex; flex-direction: column; }
.dv-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px 10px; }
.dv-nm { flex: 1; font-size: 14px; font-weight: 600; color: var(--ink); }
.dv-swim {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .04em; cursor: pointer;
  background: var(--teal-50); color: var(--teal-700); border: 1px solid #CFE3EB;
  padding: 3px 9px; border-radius: 14px; white-space: nowrap;
}
.dv-swim:hover { background: var(--teal); color: #fff; }
.dv-stats { display: flex; gap: 14px; padding: 0 16px 10px; border-bottom: 1px solid var(--border); }
.dv-stats span { font-size: 11.5px; color: var(--ink-3); }
.dv-stats b { font-family: var(--mono); color: var(--ink); }
.dv-stats .weak b { color: var(--pain-high); }
.dv-body { padding: 8px 8px 10px; overflow-y: auto; max-height: 420px; }
.cat-block { margin-bottom: 6px; }
.cat-name {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-3); padding: 8px 8px 4px;
}

/* swimlanes list inside a division */
.dv-count { font-family: var(--mono); font-size: 11px; background: var(--teal); color: #fff; border-radius: 11px; padding: 1px 9px; font-weight: 600; }
.sw-block { margin: 10px 8px 8px; border: 1px solid #CFE3EB; background: var(--teal-50); border-radius: 9px; padding: 5px; }
.sw-title { font-family: var(--mono); font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--teal-700); padding: 5px 7px 4px; }
.sw-row { display: flex; align-items: center; gap: 9px; padding: 8px 8px; border-radius: 7px; cursor: pointer; transition: background .12s; }
.sw-row:hover { background: #fff; }
.sw-ic { width: 14px; height: 14px; border-radius: 3px; flex: none; background: linear-gradient(var(--teal) 0 33%, transparent 33% 50%, var(--teal-300) 50% 83%, transparent 83%); }
.sw-nm { flex: 1; font-size: 12.5px; font-weight: 600; color: var(--ink); line-height: 1.25; }
.sw-meta { font-family: var(--mono); font-size: 10px; color: var(--pain-high); white-space: nowrap; }
.sw-row .arrow { color: var(--teal); font-weight: 700; opacity: .45; }
.sw-row:hover .arrow { opacity: 1; }

/* heat dots by efficiency */
.proc-row .heat.h { background: var(--pain-high); }
.proc-row .heat.m { background: var(--pain-med); }
.proc-row .heat.n { background: #C9A227; }
.proc-row .heat.ok { background: var(--tobe); }
.proc-row .heat.u { background: #CDD7DB; }

/* ------------------------------------------------- operating model view -- */
.opmodel-scroll { flex: 1; overflow: auto; padding: 28px 32px 40px; }
.matrix-wrap { max-width: 1100px; margin: 0 auto; }

.matrix { display: grid; gap: 0; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--surface); box-shadow: var(--shadow-sm); }
.mx-row { display: grid; align-items: stretch; }
.mx-row + .mx-row { border-top: 1px solid var(--border); }

.mx-cell { padding: 14px 10px; text-align: center; display: flex; align-items: center; justify-content: center; border-left: 1px solid var(--surface-2); }
.mx-cell:first-child { border-left: 0; }

/* header row */
.mx-head { background: var(--surface-2); }
.mx-head .mx-cell { padding: 14px 8px; flex-direction: column; gap: 6px; }
.mx-head .fn-chip { width: 10px; height: 10px; border-radius: 50%; }
.mx-head .fn-short { font-family: var(--mono); font-size: 12px; font-weight: 600; color: var(--ink); }
.mx-head .fn-name { font-size: 9.5px; color: var(--ink-3); line-height: 1.15; }
.mx-head .corner { justify-content: flex-start; font-family: var(--mono); font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }

/* activity (first) column */
.mx-act { justify-content: flex-start; text-align: left; padding-left: 18px; font-size: 13px; font-weight: 500; color: var(--ink); gap: 8px; }
.mx-act .gapflag { font-family: var(--mono); font-size: 9px; text-transform: uppercase; letter-spacing: .06em; color: #fff; background: var(--pain-high); padding: 2px 6px; border-radius: 5px; }

/* body rows */
.mx-body { cursor: default; transition: background .12s; }
.mx-body.clickable { cursor: pointer; }
.mx-body.clickable:hover { background: var(--surface-2); }
.mx-body.gap { background: rgba(188,59,82,.045); }
.mx-body.gap .mx-act { border-left: 3px solid var(--pain-high); padding-left: 15px; }
.mx-body.gap.sev-med .mx-act { border-left-color: var(--pain-med); }
.mx-body.gap.resolved { background: rgba(22,130,107,.05); }
.mx-body.gap.resolved .mx-act { border-left-color: var(--tobe); }
.mx-body.gap.resolved .gapflag { background: var(--tobe); }

/* raci cell pills */
.cell {
  width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center;
  font-family: var(--mono); font-size: 12px; font-weight: 600;
}
.cell.A { background: var(--teal); color: #fff; }
.cell.R { background: var(--teal-50); color: var(--teal-700); border: 1px solid #CFE3EB; }
.cell.C { background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--border); }
.cell.I { background: transparent; color: var(--ink-3); border: 1px dashed var(--border-strong); }
.cell.new-owner { background: var(--tobe); color: #fff; box-shadow: 0 0 0 3px var(--tobe-50); }

.raci-key { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 18px; padding: 0 4px; }
.raci-key .rk { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-2); }
.raci-key .cell { width: 22px; height: 22px; font-size: 11px; }
.raci-key .gapdot { width: 14px; height: 14px; border-radius: 4px; background: rgba(188,59,82,.18); border-left: 3px solid var(--pain-high); }

.hint {
  position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%);
  background: rgba(21,40,47,.86); color: #fff; font-size: 11.5px;
  padding: 7px 14px; border-radius: 20px; pointer-events: none; z-index: 30;
  font-family: var(--mono); letter-spacing: .02em;
}
.ex-badge {
  font-family: var(--mono); font-size: 10px; font-weight: 700; letter-spacing: .1em;
  color: #fff; background: #6E5AA6; padding: 3px 9px; border-radius: 6px;
  vertical-align: middle; margin-left: 8px;
}
