/* Stage 34: dense business structure registry with an object inspector. */
.structure-matrix-shell { gap: 10px; overflow-anchor: none; }
.structure-commandbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid rgba(190, 197, 210, .16);
  border-radius: 8px;
  background: #0b0d10;
}
.structure-commandbar > div:first-child { min-width: 0; display: grid; gap: 3px; }
.structure-commandbar .eyebrow { color: #9199a6; font-size: 10px; }
.structure-commandbar strong { color: #f4f6f8; font-size: 15px; }
.structure-commandbar small { color: #a6adb8; font-size: 12px; line-height: 1.35; }
.structure-command-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.structure-command-actions .button { white-space: nowrap; }
.structure-command-actions .button i,
.structure-inspector-actions .button i { width: 16px; height: 16px; }
.structure-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.structure-kpis > div {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 2px 10px;
  padding: 12px 14px;
  border: 1px solid rgba(190, 197, 210, .14);
  border-radius: 8px;
  background: #0c0f13;
}
.structure-kpis span { color: #a7aeb9; font-size: 11px; }
.structure-kpis strong { grid-row: 1 / 3; grid-column: 2; color: #f5f7fa; font-size: 24px; font-variant-numeric: tabular-nums; }
.structure-kpis small { color: #727b88; font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.structure-scope-tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(190, 197, 210, .14);
  border-radius: 8px;
  background: #07090b;
}
.structure-scope-tabs button {
  min-width: 0;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #a9b0ba;
  font: inherit;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
}
.structure-scope-tabs button:hover { color: #f4f6f8; background: #11151a; }
.structure-scope-tabs button.active { color: #ffffff; border-color: rgba(213, 218, 226, .2); background: #161a20; }
.structure-scope-tabs button b { min-width: 22px; padding: 2px 6px; border-radius: 999px; background: #050607; color: #c7cdd5; font-size: 10px; font-variant-numeric: tabular-nums; }
.structure-workbench {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(292px, 330px);
  gap: 10px;
  align-items: start;
}
.structure-registry,
.structure-inspector {
  min-width: 0;
  border: 1px solid rgba(190, 197, 210, .16);
  border-radius: 8px;
  background: #090b0e;
  overflow: hidden;
}
.structure-registry-tools {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 10px;
  border-bottom: 1px solid rgba(190, 197, 210, .14);
  background: #0e1115;
}
.structure-registry-tools label {
  min-width: min(420px, 70%);
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  border: 1px solid rgba(190, 197, 210, .18);
  border-radius: 6px;
  background: #07090b;
}
.structure-registry-tools label i { width: 16px; height: 16px; color: #828b98; }
.structure-registry-tools input { min-height: 36px; padding: 0; border: 0; background: transparent; box-shadow: none; }
.structure-registry-tools > span { color: #868e9a; font-size: 11px; white-space: nowrap; }
.structure-registry-tools > span strong { color: #eef1f5; font-variant-numeric: tabular-nums; }
.structure-matrix { min-width: 0; display: grid; }
.structure-matrix-head,
.structure-matrix-row {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(220px, 1.55fr) minmax(90px, .55fr) minmax(130px, .8fr) minmax(120px, .72fr) 96px 24px;
  align-items: center;
  gap: 10px;
}
.structure-matrix-head {
  min-height: 34px;
  padding: 0 12px;
  border-bottom: 1px solid rgba(190, 197, 210, .13);
  background: #07090b;
  color: #737c89;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}
.structure-matrix-row {
  min-height: 58px;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(190, 197, 210, .11);
  color: #cbd1d9;
  font-size: 12px;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease;
}
.structure-matrix-row:last-child { border-bottom: 0; }
.structure-matrix-row:hover { background: #111419; }
.structure-matrix-row.selected { background: #171b20; box-shadow: inset 3px 0 #d7dce3; }
.structure-matrix-row.archived { opacity: .56; }
.structure-object-cell { min-width: 0; display: flex; align-items: center; gap: 9px; }
.structure-object-cell .row-check { flex: 0 0 auto; margin: 0; }
.structure-object-icon,
.structure-inspector-icon {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid rgba(190, 197, 210, .16);
  border-radius: 7px;
  background: #12161b;
  color: #dce1e7;
}
.structure-object-icon { width: 32px; height: 32px; }
.structure-object-icon i { width: 16px; height: 16px; }
.structure-object-cell > span:last-child { min-width: 0; display: grid; gap: 3px; }
.structure-object-cell strong,
.structure-object-cell small,
.structure-parent-cell,
.structure-owner-cell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.structure-object-cell strong { color: #f2f4f7; font-size: 12.5px; }
.structure-object-cell small { color: #7f8895; font-size: 10.5px; }
.structure-type-cell { color: #b8bec7; font-weight: 700; }
.structure-parent-cell,
.structure-owner-cell { color: #969eaa; }
.structure-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #d9dee5;
  font-size: 10.5px;
  font-weight: 750;
  white-space: nowrap;
}
.structure-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #bfc5ce; box-shadow: 0 0 0 3px rgba(191, 197, 206, .09); }
.structure-status.archived { color: #a5acb6; }
.structure-status.archived::before { background: #646c78; }
.structure-row-open { display: grid; place-items: center; color: #737c89; }
.structure-row-open i { width: 15px; height: 15px; }
.structure-inspector { position: sticky; top: 10px; display: grid; gap: 0; }
.structure-inspector > header {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 15px;
  border-bottom: 1px solid rgba(190, 197, 210, .13);
  background: #0f1216;
}
.structure-inspector-icon { width: 42px; height: 42px; }
.structure-inspector-icon i { width: 20px; height: 20px; }
.structure-inspector header > div { min-width: 0; display: grid; gap: 2px; }
.structure-inspector header small { color: #8e97a3; font-size: 10px; text-transform: uppercase; }
.structure-inspector header h3 { margin: 0; overflow: hidden; color: #f6f7f9; font-size: 16px; text-overflow: ellipsis; white-space: nowrap; }
.structure-inspector header span { overflow: hidden; color: #8e97a3; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.structure-inspector-status { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border-bottom: 1px solid rgba(190, 197, 210, .11); color: #747d89; font-size: 10.5px; }
.structure-inspector dl { margin: 0; padding: 5px 14px; }
.structure-inspector dl > div { display: grid; grid-template-columns: minmax(0, .82fr) minmax(0, 1.18fr); gap: 9px; padding: 9px 0; border-bottom: 1px solid rgba(190, 197, 210, .09); }
.structure-inspector dt { color: #777f8c; font-size: 10.5px; }
.structure-inspector dd { min-width: 0; margin: 0; color: #d4d9e0; font-size: 11px; line-height: 1.35; overflow-wrap: anywhere; }
.structure-related { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; padding: 10px 12px; }
.structure-related > div { min-width: 0; display: grid; gap: 2px; padding: 8px; border: 1px solid rgba(190, 197, 210, .11); border-radius: 6px; background: #07090b; text-align: center; }
.structure-related strong { color: #f5f7fa; font-size: 17px; font-variant-numeric: tabular-nums; }
.structure-related span { color: #737c88; font-size: 9.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.structure-module-controls { display: grid; gap: 5px; padding: 0 12px 10px; }
.structure-module-controls > div { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 8px; border: 1px solid rgba(190, 197, 210, .11); border-radius: 6px; background: #07090b; }
.structure-module-controls span { min-width: 0; color: #aeb5bf; font-size: 10.5px; }
.structure-module-controls .button { min-height: 30px; padding: 4px 8px; font-size: 10px; white-space: nowrap; }
.structure-readiness { display: flex; gap: 9px; margin: 0 12px 12px; padding: 10px; border: 1px solid rgba(190, 197, 210, .13); border-radius: 7px; background: #0e1115; }
.structure-readiness i { flex: 0 0 auto; width: 17px; height: 17px; color: #c8ced6; }
.structure-readiness > div { display: grid; gap: 3px; }
.structure-readiness strong { color: #e7eaf0; font-size: 11px; }
.structure-readiness span { color: #9098a4; font-size: 10px; line-height: 1.35; }
.structure-readiness.warning { border-color: rgba(227, 179, 106, .24); }
.structure-readiness.warning i { color: #dfb36f; }
.structure-inspector-actions { display: grid; grid-template-columns: minmax(0, 1fr) 40px; gap: 7px; padding: 0 12px 12px; }
.structure-inspector-actions .button { width: 100%; }
.structure-inspector-actions .icon-button { width: 40px; height: 40px; }

@media (max-width: 1180px) {
  .structure-matrix-head,
  .structure-matrix-row { grid-template-columns: minmax(210px, 1.5fr) 92px minmax(120px, .8fr) 96px 24px; }
  .structure-matrix-head > :nth-child(4),
  .structure-matrix-row > :nth-child(4) { display: none; }
}

@media (max-width: 900px) {
  .structure-commandbar { align-items: stretch; flex-direction: column; }
  .structure-command-actions { justify-content: flex-start; }
  .structure-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .structure-scope-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .structure-scope-tabs button:first-child { grid-column: 1 / -1; }
  .structure-workbench { grid-template-columns: minmax(0, 1fr); }
  .structure-inspector { position: static; }
}

@media (max-width: 620px) {
  .structure-command-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .structure-command-actions .button { width: 100%; }
  .structure-command-actions .button:last-child { grid-column: 1 / -1; }
  .structure-kpis > div { padding: 10px; }
  .structure-registry-tools { align-items: stretch; flex-direction: column; }
  .structure-registry-tools label { min-width: 0; width: 100%; }
  .structure-registry-tools > span { padding-left: 2px; }
  .structure-matrix-head { display: none; }
  .structure-matrix-row { grid-template-columns: minmax(0, 1fr) auto 20px; gap: 7px; min-height: 56px; }
  .structure-matrix-row > :nth-child(2),
  .structure-matrix-row > :nth-child(3),
  .structure-matrix-row > :nth-child(4) { display: none; }
  .structure-matrix-row > :nth-child(5) { justify-self: end; }
  .structure-matrix-row > :nth-child(6) { display: grid; }
}

/* Stage 34 follow-up: expandable business hierarchy and store device presence. */
.structure-tree {
  min-width: 0;
  display: grid;
  align-content: start;
  padding: 5px;
  background: #080a0d;
  overflow-anchor: none;
}
.structure-tree-row {
  --tree-indent: calc(var(--tree-level) * 22px);
  position: relative;
  min-width: 0;
  min-height: 52px;
  display: grid;
  grid-template-columns: var(--tree-indent) 28px minmax(190px, 1fr) minmax(86px, .32fr) auto;
  align-items: center;
  gap: 7px;
  padding: 4px 10px 4px 4px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: #d4d8df;
  transition: background-color 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}
.structure-tree-row-exit {
  pointer-events: none;
  transform-origin: top center;
  box-sizing: border-box;
  overflow: hidden;
  background: #080a0d;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .2);
}
.structure-tree-row + .structure-tree-row { margin-top: 2px; }
.structure-tree-row:hover { border-color: rgba(190, 197, 210, .1); background: #101318; }
.structure-tree-row.selected { border-color: rgba(214, 219, 226, .2); background: #171b20; box-shadow: inset 3px 0 #d7dce3; }
.structure-tree-row.archived { opacity: .56; }
.structure-tree-row.group { min-height: 44px; background: #0b0e12; }
.structure-tree-row.group:hover { background: #12161b; }
.structure-tree-guide {
  align-self: stretch;
  border-right: 0;
}
.structure-tree-toggle {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #9ba3ae;
  cursor: pointer;
}
.structure-tree-toggle:hover { background: #1a1e24; color: #f4f6f8; }
.structure-tree-toggle svg { width: 16px; height: 16px; transition: transform 260ms cubic-bezier(.2, .8, .2, 1); }
.structure-tree-toggle[aria-expanded="true"] svg { transform: rotate(90deg); }
.structure-tree-toggle.placeholder { pointer-events: none; }
.structure-tree-object {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 3px;
  border-radius: 6px;
  cursor: pointer;
  outline: none;
}
.structure-tree-object:focus-visible { box-shadow: 0 0 0 2px rgba(215, 220, 227, .28); }
.structure-tree-object .row-check { flex: 0 0 auto; margin: 0; }
.structure-tree-object > span:last-child { min-width: 0; display: grid; gap: 2px; }
.structure-tree-object strong,
.structure-tree-object small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.structure-tree-object strong { color: #f1f3f6; font-size: 12.5px; }
.structure-tree-object small { color: #858e9a; font-size: 10.5px; }
.structure-tree-row.group .structure-tree-object strong { color: #d4d9e0; font-size: 11.5px; }
.structure-tree-row.group .structure-tree-object small { color: #6f7885; }
.structure-tree-row > .structure-status { justify-self: end; }
.structure-store-devices {
  display: grid;
  gap: 5px;
  margin: 0 12px 12px;
  padding: 10px;
  border: 1px solid rgba(190, 197, 210, .13);
  border-radius: 7px;
  background: #07090b;
}
.structure-store-devices > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 2px 6px;
}
.structure-store-devices > header > div { min-width: 0; display: grid; gap: 2px; }
.structure-store-devices > header strong { color: #e8ebef; font-size: 11px; }
.structure-store-devices > header span { color: #747d89; font-size: 9.5px; }
.structure-store-devices > header b { min-width: 24px; padding: 3px 6px; border-radius: 999px; background: #15191e; color: #d7dce3; font-size: 10px; text-align: center; }
.structure-store-devices > p { margin: 4px 2px; color: #7f8894; font-size: 10.5px; line-height: 1.45; }
.structure-device-card {
  min-width: 0;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px 8px;
  padding: 8px;
  border: 1px solid rgba(190, 197, 210, .1);
  border-radius: 6px;
  background: #0d1014;
}
.structure-device-icon { grid-row: 1 / 3; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 6px; background: #171b20; color: #cbd1d9; }
.structure-device-icon svg { width: 15px; height: 15px; }
.structure-device-card > div { min-width: 0; display: grid; gap: 2px; }
.structure-device-card strong,
.structure-device-card small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.structure-device-card strong { color: #e9ecf0; font-size: 10.5px; }
.structure-device-card small { color: #7f8894; font-size: 9px; }
.structure-device-session { color: #929aa5; font-size: 9px; font-weight: 750; white-space: nowrap; }
.structure-device-session.active { color: #d9dee5; }
.structure-device-card time { grid-column: 2 / 4; color: #646d79; font-size: 8.5px; }

@media (min-width: 901px) {
  .structure-workbench {
    height: clamp(500px, calc(100dvh - 350px), 720px);
    min-height: 0;
    align-items: stretch;
    overflow: hidden;
    contain: layout paint;
  }
  .structure-registry {
    height: 100%;
    min-height: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
  }
  .structure-tree,
  .structure-inspector {
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: none;
    overflow-anchor: none;
  }
  .structure-tree::-webkit-scrollbar,
  .structure-inspector::-webkit-scrollbar { width: 0; height: 0; }
  .structure-inspector {
    position: static;
    height: 100%;
    align-content: start;
  }
}

@media (max-width: 1180px) {
  .structure-tree-row { grid-template-columns: var(--tree-indent) 28px minmax(180px, 1fr) auto; }
  .structure-tree-row > .structure-type-cell { display: none; }
}

@media (max-width: 620px) {
  .structure-tree { padding: 3px; }
  .structure-tree-row { --tree-indent: calc(var(--tree-level) * 13px); grid-template-columns: var(--tree-indent) 26px minmax(0, 1fr); min-height: 52px; padding-right: 6px; }
  .structure-tree-row > .structure-type-cell,
  .structure-tree-row > .structure-status { display: none; }
  .structure-tree-toggle { width: 26px; height: 26px; }
  .structure-object-icon { width: 29px; height: 29px; }
}

@media (prefers-reduced-motion: reduce) {
  .structure-tree-row,
  .structure-tree-toggle svg { transition-duration: 0.01ms !important; }
}
