:root {
  --bd-orange: #ff5a1f;
  --bd-orange-strong: #ed4610;
  --bd-orange-soft: #fff1e9;
  --bd-ink: #171a1f;
  --bd-muted: #68717d;
  --bd-subtle: #929aa4;
  --bd-line: #e0e4e8;
  --bd-line-strong: #cfd5db;
  --bd-surface: #ffffff;
  --bd-canvas: #f6f7f8;
  --bd-sidebar: #17202a;
  --bd-sidebar-deep: #111820;
  --bd-sidebar-text: #f6f8fa;
  --bd-sidebar-muted: #aeb8c5;
  --bd-success: #0aa56d;
  --bd-warning: #d98200;
  --bd-danger: #c83d3d;
  --bd-radius: 8px;
  --bd-shadow: 0 10px 35px rgba(25, 35, 45, 0.08);
  --bd-font: Inter, "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--bd-canvas); }
body {
  margin: 0;
  color: var(--bd-ink);
  background: var(--bd-canvas);
  font-family: var(--bd-font);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button, a, select { -webkit-tap-highlight-color: transparent; }

.ui-icon {
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-shell,
.iam-shell {
  display: grid;
  grid-template-columns: 222px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar,
.iam-sidebar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  width: 222px;
  height: 100vh;
  padding: 20px 14px 16px;
  color: var(--bd-sidebar-text);
  background: linear-gradient(180deg, var(--bd-sidebar) 0%, var(--bd-sidebar-deep) 100%);
  border-right: 1px solid rgba(255,255,255,.06);
}

.sidebar .brand,
.iam-sidebar .brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 48px;
  margin: 0 2px 28px;
  color: #fff;
  text-decoration: none;
}

.sidebar .brand-mark,
.iam-sidebar .brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  min-width: 42px;
  place-items: center;
  color: #fff;
  background: linear-gradient(145deg, #ff6e2d, #f34514);
  border-radius: 11px;
  box-shadow: 0 8px 20px rgba(255, 82, 27, .25);
  font-size: 15px;
  font-weight: 780;
  letter-spacing: -.02em;
}

.sidebar .brand strong,
.iam-sidebar .brand strong { display: block; font-size: 14px; line-height: 1.25; }
.sidebar .brand > div > span,
.iam-sidebar .brand-copy > span { display: block; margin-top: 2px; color: #e6ebf0; font-size: 12px; }
.iam-sidebar .brand-copy { display: block; min-width: 0; }

.sidebar nav,
.iam-sidebar nav { display: grid; gap: 5px; }
.nav-cluster { display: grid; gap: 3px; }
.nav-subitems { display: grid; gap: 2px; margin: -1px 0 5px 31px; }

.sidebar .nav-item,
.iam-sidebar .nav-item {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 43px;
  gap: 12px;
  padding: 9px 11px;
  color: var(--bd-sidebar-muted);
  background: transparent;
  border: 0;
  border-radius: 7px;
  text-align: left;
  text-decoration: none;
  font-size: 13px;
  font-weight: 520;
  line-height: 1.25;
  cursor: pointer;
}

.sidebar .nav-item:hover,
.iam-sidebar .nav-item:hover { color: #fff; background: rgba(255,255,255,.06); }
.sidebar .nav-item.active,
.iam-sidebar .nav-item.active {
  color: #fff;
  background: rgba(255,255,255,.10);
}
.sidebar .nav-item.active::before,
.iam-sidebar .nav-item.active::before {
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: -14px;
  width: 3px;
  background: var(--bd-orange);
  content: "";
}
.nav-subitems .nav-item { min-height: 31px; padding: 5px 8px; font-size: 11.5px; }
.nav-subitems .nav-item::before { left: -45px; }

.side-footer,
.iam-account {
  display: grid;
  gap: 3px;
  margin-top: auto;
  padding: 15px 5px 2px;
  border-top: 1px solid rgba(255,255,255,.09);
  color: var(--bd-sidebar-muted);
  font-size: 11px;
}
.side-footer strong,
.iam-account strong { color: #fff; font-size: 12.5px; }
.side-footer .account-row,
.iam-account .account-row { display: flex; align-items: center; gap: 9px; }
.side-footer .account-copy,
.iam-account .account-copy { display: block; min-width: 0; overflow: hidden; }
.side-footer .account-copy strong,
.side-footer .account-copy span,
.iam-account .account-copy strong,
.iam-account .account-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-footer .account-copy span,
.iam-account .account-copy span { margin-top: 3px; color: var(--bd-sidebar-muted); font-size: 10px; }
.account-avatar {
  display: grid;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  place-items: center;
  color: #16202a;
  background: #ffe0d4;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 750;
}
.side-footer .text-button,
.iam-account button { justify-self: start; margin-top: 7px; padding: 0; color: #d8dfe6; background: transparent; border: 0; font-size: 11px; cursor: pointer; }

.workspace,
.iam-main { min-width: 0; background: var(--bd-canvas); }
.workspace { padding: 0 18px 34px; }

.topbar,
.iam-topbar {
  position: sticky;
  top: 0;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 82px;
  gap: 20px;
  padding: 15px 10px;
  background: rgba(246,247,248,.94);
  border-bottom: 1px solid rgba(207,213,219,.72);
  backdrop-filter: blur(14px);
}

.topbar h1,
.iam-topbar h1 { margin: 0; color: var(--bd-ink); font-size: clamp(22px, 2.1vw, 30px); line-height: 1.15; letter-spacing: -.035em; }
.topbar .eyebrow,
.iam-topbar .eyebrow { display: block; margin-bottom: 5px; color: var(--bd-muted); font-size: 10px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; }
.top-actions,
.iam-top-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }

.ui-search {
  display: flex;
  align-items: center;
  width: clamp(180px, 22vw, 310px);
  height: 40px;
  gap: 9px;
  padding: 0 12px;
  color: var(--bd-muted);
  background: var(--bd-surface);
  border: 1px solid var(--bd-line-strong);
  border-radius: 7px;
}
.ui-search:focus-within { border-color: #9da5ad; box-shadow: 0 0 0 3px rgba(72,80,88,.08); }
.ui-search input { width: 100%; min-width: 0; color: var(--bd-ink); background: transparent; border: 0; outline: 0; font-size: 13px; }
.ui-search input::placeholder { color: #8d949d; }

.locale-switch {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 3px;
  background: #eceff1;
  border: 1px solid #dfe3e7;
  border-radius: 7px;
}
.locale-switch button {
  min-width: 35px;
  height: 28px;
  padding: 0 8px;
  color: var(--bd-muted);
  background: transparent;
  border: 0;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}
.locale-switch button.active { color: var(--bd-ink); background: #fff; box-shadow: 0 1px 4px rgba(20,27,33,.12); }

.ui-icon-button {
  position: relative;
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: #333a42;
  background: var(--bd-surface);
  border: 1px solid var(--bd-line-strong);
  border-radius: 7px;
  cursor: pointer;
}
.ui-icon-button:hover { background: #f0f2f3; }
.attention-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  display: grid;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  place-items: center;
  color: #fff;
  background: var(--bd-orange);
  border: 2px solid var(--bd-canvas);
  border-radius: 999px;
  font-size: 9px;
  font-weight: 800;
}
.ui-primary,
button.primary,
.access-button.primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  gap: 8px;
  padding: 0 15px;
  color: #fff;
  background: linear-gradient(180deg, #ff6428, var(--bd-orange));
  border: 1px solid #f14a10;
  border-radius: 7px;
  box-shadow: 0 5px 14px rgba(255,90,31,.18);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.ui-primary:hover,
button.primary:hover { background: var(--bd-orange-strong); }
.ui-secondary,
button.secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  gap: 7px;
  padding: 0 13px;
  color: #30363d;
  background: #fff;
  border: 1px solid var(--bd-line-strong);
  border-radius: 7px;
  font-size: 12px;
  font-weight: 620;
  cursor: pointer;
}

.page-search-empty { display: none; margin: 18px 0; color: var(--bd-muted); text-align: center; }
.search-hidden { display: none !important; }

.workspace .hero-panel,
.workspace .panel,
.workspace .card,
.workspace .metric,
.workspace .empty-panel {
  background: #fff;
  border: 1px solid var(--bd-line);
  border-radius: var(--bd-radius);
  box-shadow: none;
}
.workspace .hero-panel { margin-top: 18px; }
.workspace .metric { padding: 18px; }
.workspace .metric strong { color: var(--bd-ink); font-size: 24px; }
.workspace table thead { background: #f8f9fa; }
.workspace table th { color: var(--bd-muted); font-size: 10px; letter-spacing: .045em; text-transform: uppercase; }
.workspace table td { border-color: #e5e8eb; font-size: 12px; }

/* Shared resource navigator for Site and Node scoped engineering work */
.context-workspace {
  display: grid;
  grid-template-columns: minmax(280px, 24%) minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  margin-top: 18px;
}
.context-workspace.collapsed { grid-template-columns: 46px minmax(0, 1fr); }
.context-content { min-width: 0; }
.context-content > :first-child { margin-top: 0; }
.context-navigator {
  position: sticky;
  top: 100px;
  display: grid;
  grid-template-rows: auto minmax(260px, 1fr) auto;
  max-height: calc(100vh - 118px);
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--bd-line);
  border-radius: var(--bd-radius);
}
.context-navigator.collapsed { display: block; }
.context-navigator > header { display: grid; gap: 10px; padding: 13px; border-bottom: 1px solid var(--bd-line); }
.context-navigator > header > div { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.context-navigator h2 { margin: 0; font-size: 13px; }
.context-navigator > header button,
.context-rail {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0;
  color: var(--bd-muted);
  background: transparent;
  border: 0;
  font-size: 9px;
  cursor: pointer;
}
.context-navigator > header button .ui-icon { width: 13px; height: 13px; transform: rotate(90deg); }
.context-navigator .ui-search { width: 100%; height: 34px; }
.context-tree { padding: 9px 7px 12px; overflow: auto; }
.context-tree-children { margin-left: 19px; padding-left: 9px; border-left: 1px solid #d9dde1; }
.context-tree-row { position: relative; display: grid; grid-template-columns: 20px minmax(0, 1fr); align-items: stretch; min-height: 39px; padding: 2px 3px; border-radius: 6px; }
.context-tree-row:hover { background: #f5f6f7; }
.context-tree-row.selected { color: var(--bd-orange-strong); background: var(--bd-orange-soft); }
.context-tree-row.selected::before { position: absolute; top: 0; bottom: 0; left: -1px; width: 2px; background: var(--bd-orange); content: ""; }
.context-tree-toggle { display: grid; width: 20px; padding: 0; place-items: center; color: #6f7881; background: transparent; border: 0; cursor: pointer; }
.context-tree-toggle:empty { cursor: default; }
.context-tree-toggle .ui-icon { width: 13px; height: 13px; }
.context-tree-select { display: grid; grid-template-columns: 17px minmax(0, 1fr) auto; align-items: start; min-width: 0; gap: 7px; padding: 6px 5px; color: inherit; background: transparent; border: 0; text-align: left; cursor: pointer; }
.context-tree-select > .ui-icon { width: 16px; height: 16px; margin-top: 1px; color: #5e6872; }
.context-tree-select strong,
.context-tree-select small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.context-tree-select strong { color: inherit; font-size: 10.5px; line-height: 1.3; }
.context-tree-select small { margin-top: 3px; color: var(--bd-muted); font-size: 9px; line-height: 1.3; }
.context-tree-select b { color: var(--bd-muted); font-size: 9px; font-weight: 500; }
.context-tree-empty { padding: 20px; color: var(--bd-muted); text-align: center; font-size: 10px; }
.context-navigator > footer { padding: 12px 13px; background: #fbfbfc; border-top: 1px solid var(--bd-line); }
.context-navigator > footer span,
.context-navigator > footer strong,
.context-navigator > footer small { display: block; }
.context-navigator > footer span { color: var(--bd-muted); font-size: 8.5px; text-transform: uppercase; letter-spacing: .06em; }
.context-navigator > footer strong { margin-top: 5px; overflow: hidden; font-size: 10.5px; text-overflow: ellipsis; white-space: nowrap; }
.context-navigator > footer small { margin-top: 3px; color: var(--bd-muted); font-size: 9px; }
.context-rail { width: 100%; min-height: 200px; flex-direction: column; justify-content: flex-start; padding-top: 14px; }
.context-rail span { max-height: 160px; overflow: hidden; writing-mode: vertical-rl; transform: rotate(180deg); text-overflow: ellipsis; white-space: nowrap; font-weight: 650; letter-spacing: .03em; }

.attention-drawer-backdrop,
.iam-modal-backdrop,
.iam-drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(12,18,24,.34);
  backdrop-filter: blur(2px);
}
.attention-drawer,
.iam-drawer {
  position: absolute;
  top: 0;
  right: 0;
  width: min(410px, 94vw);
  height: 100%;
  padding: 22px;
  overflow: auto;
  background: #fff;
  box-shadow: -18px 0 45px rgba(18,27,35,.16);
}
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding-bottom: 18px; border-bottom: 1px solid var(--bd-line); }
.drawer-head h2 { margin: 0; font-size: 19px; letter-spacing: -.02em; }
.drawer-head p { margin: 6px 0 0; color: var(--bd-muted); font-size: 12px; line-height: 1.5; }
.attention-list { display: grid; gap: 10px; margin-top: 18px; }
.attention-item { display: grid; grid-template-columns: 32px 1fr; gap: 10px; padding: 13px; border: 1px solid var(--bd-line); border-radius: 8px; }
.attention-item .ui-icon { color: var(--bd-warning); }
.attention-item strong { display: block; font-size: 12px; }
.attention-item span { display: block; margin-top: 4px; color: var(--bd-muted); font-size: 11px; line-height: 1.45; }

/* Unified IAM console */
.iam-main { padding: 0 12px 12px; }
.iam-topbar { margin: 0 -12px; padding-inline: 20px; background: rgba(255,255,255,.95); }
.iam-topbar-title { min-width: 190px; }
.iam-top-actions { flex: 1; }
.iam-plane-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  max-width: 880px;
  gap: 8px;
  margin: 12px 0 4px;
}
.iam-plane-switch a {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) 18px;
  align-items: center;
  min-height: 58px;
  gap: 10px;
  padding: 9px 13px;
  color: #46515c;
  background: #fff;
  border: 1px solid var(--bd-line-strong);
  border-radius: 8px;
  text-decoration: none;
}
.iam-plane-switch a > .ui-icon:first-child { width: 21px; height: 21px; color: #5f6973; }
.iam-plane-switch a > .ui-icon:last-child { width: 16px; height: 16px; color: var(--bd-orange-strong); }
.iam-plane-switch strong,
.iam-plane-switch small { display: block; }
.iam-plane-switch strong { font-size: 12px; }
.iam-plane-switch small { margin-top: 3px; color: var(--bd-muted); font-size: 9.5px; line-height: 1.3; }
.iam-plane-switch a.active { color: var(--bd-ink); background: var(--bd-orange-soft); border-color: #ffb18f; box-shadow: inset 3px 0 var(--bd-orange); }
.iam-plane-switch a.active > .ui-icon:first-child { color: var(--bd-orange-strong); }
.iam-viewbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 54px;
  padding: 8px 2px;
}
.iam-tabs { display: flex; align-items: center; gap: 4px; overflow-x: auto; }
.iam-tabs button {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  gap: 7px;
  padding: 0 11px;
  color: var(--bd-muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
  cursor: pointer;
}
.iam-tabs button b { min-width: 17px; padding: 2px 5px; background: #eceff1; border-radius: 999px; font-size: 9px; }
.iam-tabs button.active { color: var(--bd-ink); background: #fff; border-color: var(--bd-line-strong); box-shadow: 0 1px 4px rgba(18,24,30,.06); }
.iam-organization-filter { display: flex; align-items: center; }
.iam-organization-filter label { display: flex; align-items: center; gap: 7px; color: var(--bd-muted); font-size: 10px; }
.iam-organization-filter select { max-width: 190px; height: 32px; padding: 0 8px; color: #313941; background: #fff; border: 1px solid var(--bd-line); border-radius: 5px; font-size: 10px; }

.iam-notice { margin: 0 0 9px; padding: 10px 13px; border: 1px solid #d9e4ec; border-radius: 7px; color: #354452; background: #f6fbff; font-size: 11px; }
.iam-notice.success { color: #126344; background: #effbf6; border-color: #bfe6d6; }
.iam-notice.error { color: #872a2a; background: #fff3f2; border-color: #efc9c6; }

.iam-map-grid {
  display: grid;
  grid-template-columns: minmax(305px, 27%) minmax(640px, 1fr);
  min-height: calc(100vh - 150px);
  gap: 10px;
}
.iam-map-grid.scope-collapsed { grid-template-columns: 46px minmax(640px, 1fr); }
.iam-panel {
  min-width: 0;
  background: #fff;
  border: 1px solid var(--bd-line-strong);
  border-radius: 7px;
  overflow: hidden;
}
.iam-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 54px;
  gap: 14px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--bd-line);
}
.iam-panel-head h2 { margin: 0; font-size: 15px; line-height: 1.25; letter-spacing: -.02em; }
.iam-panel-head p { margin: 4px 0 0; color: var(--bd-muted); font-size: 10.5px; line-height: 1.45; }
.iam-panel-head-meta { display: flex; align-items: center; gap: 10px; color: var(--bd-muted); font-size: 10px; white-space: nowrap; }
.iam-panel-head .ui-icon-button { width: 30px; height: 30px; }

.iam-scope-panel { display: grid; grid-template-rows: auto 1fr auto; min-height: 0; }
.iam-scope-panel.collapsed { display: block; }
.iam-scope-head { display: grid; gap: 10px; padding: 16px; border-bottom: 1px solid var(--bd-line); }
.iam-scope-head > div { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.iam-scope-head h2 { margin: 0; font-size: 15px; }
.iam-scope-head .ui-search { width: 100%; height: 36px; }
.iam-collapse-button,
.iam-scope-rail-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0;
  color: var(--bd-muted);
  background: transparent;
  border: 0;
  font-size: 9px;
  cursor: pointer;
}
.iam-collapse-button .ui-icon { width: 14px; height: 14px; transform: rotate(90deg); }
.iam-scope-rail-button { width: 100%; min-height: 190px; flex-direction: column; justify-content: flex-start; padding-top: 16px; }
.iam-scope-rail-button span { writing-mode: vertical-rl; transform: rotate(180deg); font-weight: 650; letter-spacing: .04em; }
.iam-tree { min-height: 250px; padding: 11px 8px 14px; overflow: auto; }
.iam-tree-group { position: relative; }
.iam-tree-children { margin-left: 20px; padding-left: 10px; border-left: 1px solid #d9dde1; }
.iam-tree-row {
  position: relative;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: stretch;
  width: 100%;
  gap: 2px;
  min-height: 40px;
  padding: 2px 3px;
  color: var(--bd-ink);
  background: transparent;
  border-radius: 6px;
}
.iam-tree-row:hover { background: #f5f6f7; }
.iam-tree-row.selected { color: var(--bd-orange-strong); background: var(--bd-orange-soft); }
.iam-tree-row.selected::before { position: absolute; top: 0; bottom: 0; left: -1px; width: 2px; background: var(--bd-orange); content: ""; }
.iam-tree-select {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: start;
  min-width: 0;
  gap: 7px;
  padding: 6px 5px;
  color: inherit;
  background: transparent;
  border: 0;
  text-align: left;
  cursor: pointer;
}
.iam-tree-select > .ui-icon { width: 16px; height: 16px; margin-top: 1px; color: #5e6872; }
.iam-tree-toggle { display: grid; width: 20px; padding: 0; place-items: center; color: #6f7881; background: transparent; border: 0; cursor: pointer; }
.iam-tree-toggle:empty { cursor: default; }
.iam-tree-toggle .ui-icon { width: 13px; height: 13px; }
.iam-tree-copy { min-width: 0; }
.iam-tree-copy strong { display: block; overflow: hidden; color: inherit; font-size: 11px; line-height: 1.3; text-overflow: ellipsis; white-space: nowrap; }
.iam-tree-copy small { display: block; margin-top: 3px; overflow: hidden; color: var(--bd-muted); font-size: 9.5px; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.iam-tree-count { color: var(--bd-muted); font-size: 9.5px; }
.iam-tree-empty { padding: 18px; color: var(--bd-muted); text-align: center; font-size: 11px; }

.iam-technical {
  padding: 14px 16px 16px;
  border-top: 1px solid var(--bd-line);
  background: #fbfbfc;
}
.iam-technical-title { display: flex; align-items: center; gap: 7px; margin-bottom: 12px; }
.iam-technical-title strong { font-size: 12px; }
.iam-online-dot { width: 7px; height: 7px; background: var(--bd-success); border-radius: 50%; }
.iam-offline-dot { width: 7px; height: 7px; background: var(--bd-danger); border-radius: 50%; }
.iam-technical-title span:last-child { color: var(--bd-muted); font-size: 9.5px; }
.iam-tech-grid { display: grid; grid-template-columns: 100px 1fr; gap: 7px 10px; margin: 0; }
.iam-tech-grid dt { color: var(--bd-muted); font-size: 9.5px; }
.iam-tech-grid dd { margin: 0; overflow-wrap: anywhere; color: #303841; font-size: 9.8px; font-weight: 520; }
.iam-scope-note { margin: 12px 0 0; padding: 8px 9px; color: #5f6872; background: #f1f3f5; border-radius: 5px; font-size: 9px; line-height: 1.45; }

.iam-right-grid { display: grid; grid-template-rows: minmax(310px, .96fr) minmax(360px, 1.04fr); min-height: 0; gap: 10px; }
.iam-access-table-wrap { overflow: auto; }
.iam-access-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.iam-map-table col:nth-child(1) { width: 28%; }
.iam-map-table col:nth-child(2) { width: 16%; }
.iam-map-table col:nth-child(3) { width: 21%; }
.iam-map-table col:nth-child(4) { width: 13%; }
.iam-map-table col:nth-child(5) { width: 7%; }
.iam-map-table col:nth-child(6) { width: 11%; }
.iam-map-table col:nth-child(7) { width: 4%; }
.iam-access-table th { padding: 11px 15px; color: #69717a; background: #fbfbfc; border-bottom: 1px solid var(--bd-line); text-align: left; font-size: 9.5px; font-weight: 620; }
.iam-access-table td { height: 68px; padding: 10px 15px; border-bottom: 1px solid var(--bd-line); color: #2e353d; font-size: 10.2px; vertical-align: middle; }
.iam-access-table tr { cursor: pointer; }
.iam-access-table tbody tr:hover { background: #fafbfb; }
.iam-access-table tr.selected { background: linear-gradient(90deg, #fff1e9, #fff9f5); box-shadow: inset 2px 0 var(--bd-orange); }
.iam-system-access {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin: 10px 14px 0;
  padding: 10px 12px;
  color: #424c55;
  background: #f6f7f8;
  border: 1px solid var(--bd-line);
  border-radius: 6px;
}
.iam-system-access > .ui-icon { width: 18px; height: 18px; color: #64707b; }
.iam-system-access strong { display: block; font-size: 10px; }
.iam-system-access p { margin: 3px 0 0; color: var(--bd-muted); font-size: 8.8px; line-height: 1.4; }
.iam-system-access button { display: inline-flex; align-items: center; gap: 7px; padding: 6px 8px; color: #343d46; background: #fff; border: 1px solid var(--bd-line-strong); border-radius: 5px; font-size: 8.8px; cursor: pointer; }
.iam-system-access button span { min-width: 18px; padding: 2px 5px; background: #eceff1; border-radius: 999px; font-weight: 700; }
.iam-activity-table th:nth-child(1) { width: 18%; }
.iam-activity-table th:nth-child(2) { width: 24%; }
.iam-activity-table th:nth-child(3) { width: 28%; }
.iam-activity-table th:nth-child(4) { width: 30%; }
.iam-person { display: flex; align-items: center; min-width: 0; gap: 10px; }
.iam-avatar { display: grid; width: 36px; height: 36px; flex: 0 0 auto; place-items: center; color: #27313a; background: #eaedef; border-radius: 50%; font-size: 11px; font-weight: 760; }
.iam-avatar.orange { color: #e54b16; background: #fff3ec; border: 1px solid #ffb08d; }
.iam-person strong,
.iam-person small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.iam-person strong { font-size: 10.5px; }
.iam-person small { margin-top: 3px; color: var(--bd-muted); font-size: 8.8px; }
.iam-role-label { display: block; color: #242b31; font-size: 10px; }
.iam-role-key { display: block; margin-top: 3px; color: var(--bd-muted); font-size: 8.5px; }
.iam-status { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.iam-status::before { width: 6px; height: 6px; background: var(--bd-success); border-radius: 50%; content: ""; }
.iam-status.suspended::before { background: var(--bd-warning); }
.iam-status.revoked::before { background: var(--bd-danger); }
.iam-mfa { color: var(--bd-success); }
.iam-mfa .ui-icon { width: 17px; height: 17px; }
.iam-no-mfa { color: var(--bd-subtle); }
.iam-more { width: 28px; height: 28px; padding: 0; color: #4d565f; background: transparent; border: 0; cursor: pointer; }

.iam-details { min-height: 0; }
.iam-detail-actions { display: flex; align-items: center; gap: 7px; }
.iam-detail-actions button { min-height: 30px; padding: 0 11px; color: #3c444c; background: #fff; border: 1px solid var(--bd-line); border-radius: 5px; font-size: 9.5px; cursor: pointer; }
.iam-detail-body { display: grid; grid-template-columns: .88fr .95fr 1.17fr; min-height: 245px; padding: 18px; }
.iam-detail-column { min-width: 0; padding: 0 18px; border-right: 1px solid var(--bd-line); }
.iam-detail-column:first-child { padding-left: 0; }
.iam-detail-column:last-child { padding-right: 0; border-right: 0; }
.iam-detail-column h3 { margin: 0 0 16px; font-size: 10.5px; }
.iam-kv { display: grid; grid-template-columns: 86px minmax(0,1fr); gap: 9px; margin: 0; }
.iam-kv dt { color: var(--bd-muted); font-size: 9px; }
.iam-kv dd { margin: 0; overflow-wrap: anywhere; color: #343c44; font-size: 9.4px; }
.iam-chain { display: grid; gap: 0; }
.iam-chain-item { position: relative; display: grid; grid-template-columns: 18px 1fr; gap: 8px; min-height: 43px; }
.iam-chain-item:not(:last-child)::after { position: absolute; top: 18px; bottom: -1px; left: 8px; width: 1px; background: #ced4d9; content: ""; }
.iam-chain-item .ui-icon { position: relative; z-index: 1; width: 17px; height: 17px; padding: 1px; color: #55606a; background: #fff; }
.iam-chain-item strong { display: block; color: #2f373f; font-size: 9.8px; }
.iam-chain-item small { display: block; margin-top: 3px; color: var(--bd-muted); font-size: 8.7px; line-height: 1.35; }
.iam-chain-item:last-child strong { color: var(--bd-orange-strong); }
.iam-permission-list { display: grid; gap: 11px; margin: 0; padding: 0; list-style: none; }
.iam-permission-list li { display: flex; align-items: flex-start; gap: 8px; color: #343c44; font-size: 9.5px; line-height: 1.35; }
.iam-permission-list .ui-icon { width: 16px; height: 16px; color: var(--bd-success); }
.iam-why { margin-top: 18px; padding-top: 13px; border-top: 1px solid var(--bd-line); }
.iam-why strong { display: block; font-size: 9.5px; }
.iam-why p { margin: 6px 0 0; color: var(--bd-muted); font-size: 8.8px; line-height: 1.5; }

.iam-empty { display: grid; min-height: 160px; padding: 24px; place-items: center; color: var(--bd-muted); text-align: center; font-size: 11px; }
.iam-list-panel { padding-bottom: 12px; }
.iam-list-toolbar { display: grid; grid-template-columns: minmax(220px, 1fr) 180px 170px; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--bd-line); }
.iam-list-toolbar .ui-search { width: 100%; height: 36px; }
.iam-list-toolbar select,
.iam-form select,
.iam-form input,
.iam-drawer select {
  width: 100%;
  height: 36px;
  padding: 0 10px;
  color: #2f373e;
  background: #fff;
  border: 1px solid var(--bd-line-strong);
  border-radius: 6px;
  outline: 0;
  font-size: 11px;
}
.iam-card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; padding: 14px; }
.iam-role-card { padding: 16px; border: 1px solid var(--bd-line); border-radius: 7px; }
.iam-role-card h3 { margin: 0; font-size: 13px; }
.iam-role-card small { display: block; margin-top: 4px; color: var(--bd-muted); font-size: 9px; }
.iam-role-card p { min-height: 37px; color: var(--bd-muted); font-size: 10px; line-height: 1.5; }
.iam-permission-codes { display: flex; flex-wrap: wrap; gap: 5px; }
.iam-permission-codes code { padding: 3px 5px; color: #4c5660; background: #f1f3f5; border-radius: 4px; font-size: 8px; }

.iam-modal-backdrop { display: grid; place-items: center; padding: 20px; }
.iam-modal {
  width: min(620px, 96vw);
  max-height: min(780px, 94vh);
  overflow: auto;
  background: #fff;
  border-radius: 10px;
  box-shadow: var(--bd-shadow);
}
.iam-modal .drawer-head { padding: 20px; }
.iam-modal-body { padding: 20px; }
.iam-form { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.iam-form label,
.iam-drawer label { display: grid; gap: 6px; color: var(--bd-muted); font-size: 10px; }
.iam-form .wide { grid-column: 1 / -1; }
.iam-form-actions { display: flex; justify-content: flex-end; grid-column: 1 / -1; gap: 8px; padding-top: 5px; }
.iam-secret { display: grid; gap: 8px; margin-top: 14px; padding: 12px; color: #31533f; background: #f0faf5; border: 1px solid #c8e9d6; border-radius: 7px; font-size: 10px; }
.iam-secret code { padding: 8px; overflow-wrap: anywhere; color: #24382c; background: #fff; border-radius: 4px; }
.iam-drawer-section { display: grid; gap: 13px; padding: 18px 0; border-bottom: 1px solid var(--bd-line); }
.iam-drawer-section h3 { margin: 0; font-size: 12px; }
.iam-danger-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.iam-danger-actions button { min-height: 34px; padding: 0 11px; color: #3d454d; background: #fff; border: 1px solid var(--bd-line-strong); border-radius: 6px; font-size: 10px; cursor: pointer; }
.iam-danger-actions button.danger { color: var(--bd-danger); border-color: #e6b7b7; }
.iam-session-list { display: grid; gap: 8px; }
.iam-session-list.padded { padding: 14px; }
.iam-session-row { display: flex; justify-content: space-between; gap: 12px; padding: 11px; border: 1px solid var(--bd-line); border-radius: 6px; }
.iam-session-row strong { display: block; font-size: 10px; }
.iam-session-row small { display: block; margin-top: 4px; color: var(--bd-muted); font-size: 8.8px; line-height: 1.4; }

/* Login and IAM lifecycle */
.login-shell,
.activate-shell { background: radial-gradient(circle at 15% 10%, #fff 0, #f6f7f8 42%, #edf0f2 100%); }
.login-card,
.activate-card { border: 1px solid var(--bd-line); border-radius: 10px; box-shadow: 0 18px 55px rgba(26,36,46,.10); }
.lifecycle-locale { display: flex; justify-content: flex-end; margin-bottom: 18px; }

/* Chrome reports the unzoomed CSS viewport at 2K. Match the working 150% reference
   while leaving manually zoomed and smaller viewports untouched. `zoom` already
   reflows the body to the inverse layout width, so an explicit 66.6667% body width
   would apply the reduction twice and leave the right third of the viewport empty. */
@media (min-width: 1800px) {
  body { width: auto; zoom: 1.5; }
  .app-shell,
  .iam-shell { min-height: 66.6667vh; }
  .sidebar,
  .iam-sidebar { height: 66.6667vh; }
  .iam-map-grid { min-height: calc(66.6667vh - 150px); }
  .context-navigator { max-height: calc(66.6667vh - 118px); }
}

@media (max-width: 1120px) {
  .app-shell,
  .iam-shell { grid-template-columns: 78px minmax(0,1fr); }
  .sidebar,
  .iam-sidebar { width: 78px; padding-inline: 9px; }
  .sidebar .brand,
  .iam-sidebar .brand { justify-content: center; margin-inline: 0; }
  .sidebar .brand > div:last-child,
  .iam-sidebar .brand > div:last-child,
  .iam-sidebar .brand > span:last-child,
  .sidebar .nav-item span,
  .iam-sidebar .nav-item span,
  .side-footer .account-copy,
  .iam-account .account-copy { display: none; }
  .sidebar .nav-item,
  .iam-sidebar .nav-item { justify-content: center; padding-inline: 8px; }
  .sidebar .nav-item.active::before,
  .iam-sidebar .nav-item.active::before { left: -9px; }
  .nav-subitems { display: none; }
  .side-footer,
  .iam-account { justify-items: center; }
  .iam-map-grid { grid-template-columns: minmax(280px, 34%) minmax(580px,1fr); }
  .iam-map-grid.scope-collapsed { grid-template-columns: 46px minmax(580px,1fr); }
  .iam-detail-body { grid-template-columns: 1fr 1fr; }
  .iam-detail-column:nth-child(2) { border-right: 0; }
  .iam-detail-column:last-child { grid-column: 1 / -1; margin-top: 18px; padding: 18px 0 0; border-top: 1px solid var(--bd-line); }
  .context-workspace { grid-template-columns: minmax(250px, 31%) minmax(0, 1fr); }
  .context-workspace.collapsed { grid-template-columns: 46px minmax(0, 1fr); }
}

@media (max-width: 860px) {
  .app-shell,
  .iam-shell { display: block; }
  .sidebar,
  .iam-sidebar { position: relative; width: 100%; height: auto; min-height: 70px; flex-direction: row; align-items: center; gap: 12px; padding: 10px 12px; overflow-x: auto; }
  .sidebar .brand,
  .iam-sidebar .brand { flex: 0 0 auto; min-height: 44px; margin: 0; }
  .sidebar .brand-mark,
  .iam-sidebar .brand-mark { width: 38px; height: 38px; min-width: 38px; }
  .sidebar nav,
  .iam-sidebar nav { display: flex; flex: 0 0 auto; }
  .sidebar .nav-item,
  .iam-sidebar .nav-item { width: 43px; height: 43px; min-height: 43px; }
  .sidebar .nav-item.active::before,
  .iam-sidebar .nav-item.active::before { top: auto; right: 8px; bottom: -10px; left: 8px; width: auto; height: 3px; }
  .side-footer,
  .iam-account { display: none; }
  .topbar,
  .iam-topbar { top: 0; }
  .iam-map-grid { display: block; min-height: auto; }
  .iam-scope-panel { min-height: 620px; margin-bottom: 10px; }
  .iam-scope-panel.collapsed { min-height: 52px; }
  .iam-scope-rail-button { min-height: 50px; flex-direction: row; justify-content: center; padding: 0; }
  .iam-scope-rail-button span { writing-mode: initial; transform: none; }
  .iam-right-grid { display: block; }
  .iam-right-grid > .iam-panel { margin-bottom: 10px; }
  .context-workspace,
  .context-workspace.collapsed { display: block; }
  .context-navigator { position: relative; top: auto; max-height: 560px; margin-bottom: 10px; }
  .context-navigator.collapsed { min-height: 48px; }
  .context-rail { min-height: 48px; flex-direction: row; justify-content: center; padding: 0; }
  .context-rail span { max-height: none; writing-mode: initial; transform: none; }
}

@media (max-width: 680px) {
  .workspace { padding-inline: 10px; }
  .iam-main { padding-inline: 8px; }
  .topbar,
  .iam-topbar { align-items: flex-start; min-height: auto; flex-direction: column; padding: 12px 10px; }
  .top-actions,
  .iam-top-actions { width: 100%; justify-content: flex-start; flex-wrap: wrap; }
  .ui-search { width: min(100%, 280px); flex: 1 1 180px; }
  .iam-viewbar { align-items: flex-start; flex-direction: column; }
  .iam-plane-switch { grid-template-columns: 1fr; max-width: none; }
  .iam-organization-filter { width: 100%; }
  .iam-system-access { grid-template-columns: 24px 1fr; }
  .iam-system-access button { grid-column: 1 / -1; justify-self: start; }
  .iam-scope-panel { min-height: 540px; }
  .iam-access-table { min-width: 760px; }
  .iam-detail-body { display: block; }
  .iam-detail-column { padding: 16px 0; border-right: 0; border-bottom: 1px solid var(--bd-line); }
  .iam-detail-column:last-child { margin: 0; border-top: 0; border-bottom: 0; }
  .iam-list-toolbar { grid-template-columns: 1fr; }
  .iam-form { grid-template-columns: 1fr; }
  .iam-form .wide,
  .iam-form-actions { grid-column: auto; }
  .iam-topbar .ui-primary span { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
