:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --panel-soft: #eef6fb;
  --ink: #16213d;
  --muted: #5b6b87;
  --line: #dfe6f1;
  --blue: #2463eb;
  --teal: #087f8c;
  --green: #0f8b5f;
  --warn: #b56a00;
  --danger: #b42342;
  --shadow: 0 20px 45px rgba(35, 52, 92, 0.12);
  font-family: "Segoe UI", Inter, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a.ghost {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px;
  background: #111c33;
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand img {
  width: 44px;
  height: 44px;
  background: #fff;
  border-radius: 8px;
  padding: 6px;
}

.brand h1,
.topbar h2,
.panel h3,
.settings-hero h3,
.modal-form h3 {
  margin: 4px 0 0;
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.sidebar .eyebrow {
  color: #9eb0d4;
}

.nav-tabs {
  display: grid;
  gap: 8px;
}

.nav-tab,
.ghost,
.primary,
.danger-btn,
.key-row,
.person-row.selectable,
.small-btn {
  border: 1px solid transparent;
  border-radius: 8px;
}

.nav-tab {
  padding: 12px 14px;
  text-align: left;
  background: transparent;
  color: #d9e4ff;
}

.nav-tab.active,
.nav-tab:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.signed-in {
  margin-top: auto;
  display: flex;
  gap: 12px;
  align-items: center;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
}

.signed-in strong,
.signed-in span {
  display: block;
}

.signed-in span {
  color: #b9c7e3;
  font-size: 0.82rem;
  overflow-wrap: anywhere;
}

.avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #dceafe;
  color: #134bb1;
  font-weight: 800;
  flex: 0 0 auto;
}

.avatar.small {
  width: 32px;
  height: 32px;
  font-size: 0.76rem;
}

.content {
  padding: 28px;
  display: grid;
  gap: 20px;
  align-content: start;
}

.topbar,
.panel-head,
.detail-head,
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.top-actions,
.modal-actions,
.detail-actions,
.assignment-builder,
.portal-actions,
.backup-actions,
.role-save {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ghost,
a.ghost {
  padding: 10px 14px;
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
  text-decoration: none;
}

.primary,
a.primary {
  padding: 11px 16px;
  background: linear-gradient(135deg, var(--blue), var(--teal));
  color: #fff;
  border: 0;
  border-radius: 8px;
  text-decoration: none;
}

.danger-btn {
  padding: 10px 14px;
  color: var(--danger);
  background: #fff3f5;
  border-color: #ffd6dd;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.metrics article,
.panel,
.settings-card,
.login-card {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.metrics article {
  padding: 18px;
  border-radius: 8px;
}

.metrics strong {
  display: block;
  font-size: 1.55rem;
}

.metrics span,
.detail-grid span,
.person-row span,
.key-row span,
.group-card span,
.access-row span,
.visualizer span {
  color: var(--muted);
  font-size: 0.86rem;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.split-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.85fr) minmax(440px, 1.15fr);
  gap: 18px;
  align-items: start;
}

.portal-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}

.panel,
.settings-card {
  border-radius: 8px;
  padding: 18px;
}

.panel-head {
  margin-bottom: 14px;
}

.panel-head.flat {
  margin: 10px 0;
}

.search,
input,
select,
textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

.search.strong {
  border: 2px solid #111;
}

.key-list,
.people-list,
.group-list {
  display: grid;
  gap: 10px;
  max-height: 610px;
  overflow: auto;
  padding-right: 4px;
}

.key-row,
.person-row,
.access-row,
.group-card {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  background: #fff;
  border: 1px solid var(--line);
  text-align: left;
}

.key-row.active,
.person-row.selected {
  background: #eaf3ff;
  border-color: #acd0ff;
}

.key-row strong,
.key-row span,
.person-row strong,
.person-row span,
.group-card strong,
.group-card span {
  display: block;
}

.key-row-meta {
  display: grid;
  justify-items: end;
  gap: 6px;
}

.pill,
.role-chip,
.permission-pills button,
.admin-pills button {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #e8eefb;
  color: #0d4ed8;
  font-size: 0.8rem;
  font-weight: 700;
  border: 1px solid #d7e2fb;
}

.permission-pills button:hover,
.admin-pills button:hover {
  border-color: #9fc0fa;
  background: #dce8ff;
}

.pill.warn {
  background: #fff6df;
  color: var(--warn);
}

.pill.danger {
  background: #fff0f3;
  color: var(--danger);
}

.detail-panel {
  min-height: 640px;
}

.detail-head p {
  color: var(--muted);
  margin: 8px 0 0;
}

.detail-grid,
.settings-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0;
}

.detail-grid article,
.settings-grid article {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
}

.detail-grid strong,
.settings-grid strong,
.detail-grid span,
.settings-grid span {
  display: block;
  overflow-wrap: anywhere;
}

.azure-status,
.notes-box {
  padding: 14px;
  border-radius: 8px;
  margin-bottom: 12px;
  background: var(--panel-soft);
  color: #315171;
  overflow-wrap: anywhere;
}

.notes-box {
  white-space: pre-wrap;
  background: #fbfcff;
  border: 1px solid var(--line);
}

.access-row {
  margin-bottom: 8px;
  border-radius: 8px;
  justify-content: flex-start;
}

.access-row .role-chip {
  margin-left: auto;
}

.assignment-builder {
  margin: 12px 0;
  align-items: stretch;
}

.assignment-builder select {
  max-width: 245px;
}

.people-list.compact {
  max-height: 320px;
}

.checkbox {
  width: 20px;
  height: 20px;
  border: 1px solid var(--line);
  border-radius: 5px;
  flex: 0 0 auto;
  background: #fff;
}

.selected .checkbox,
.key-row.active .checkbox {
  background: var(--blue);
  border-color: var(--blue);
}

.visualizer-toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
}

.visualizer {
  overflow: auto;
  min-height: 560px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(#eef3fb 1px, transparent 1px),
    linear-gradient(90deg, #eef3fb 1px, transparent 1px),
    #fff;
  background-size: 40px 40px;
}

.map-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(210px, 1fr));
  gap: 18px;
  padding: 18px;
  min-width: 980px;
}

.map-column {
  display: grid;
  gap: 12px;
  align-content: start;
  position: relative;
}

.map-column::after {
  content: "";
  position: absolute;
  top: 58px;
  right: -13px;
  width: 8px;
  height: 8px;
  border-top: 2px solid #9aa8bf;
  border-right: 2px solid #9aa8bf;
  transform: rotate(45deg);
}

.map-column:last-child::after {
  display: none;
}

.map-column-head {
  padding: 7px 10px;
  border-radius: 999px;
  background: #f6f9fd;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.map-node {
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 6px;
  min-height: 124px;
  padding: 14px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 10px 22px rgba(35, 52, 92, 0.08);
  color: var(--ink);
  text-align: center;
}

.map-node:hover {
  border-color: #8ab4f8;
  box-shadow: 0 14px 30px rgba(36, 99, 235, 0.14);
}

.map-node strong {
  display: block;
  max-width: 100%;
  overflow-wrap: anywhere;
  font-size: 0.86rem;
}

.map-node em {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-style: normal;
  overflow-wrap: anywhere;
}

.map-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: #eaf2ff;
  color: #1659c7;
  font-size: 0.78rem;
  font-weight: 900;
}

.map-node.vault .map-icon {
  background: #fff4d6;
  color: #925a00;
}

.map-node.secret .map-icon {
  background: #eefbf4;
  color: #08764f;
}

.map-node.admin .map-icon {
  background: #f1eaff;
  color: #6842b8;
}

.map-node.group .map-icon,
.map-node.environment .map-icon {
  background: #eaf7fb;
  color: #087f8c;
}

.map-node.advisor.warning .map-icon {
  background: #fff0f3;
  color: var(--danger);
}

.map-node.disabled {
  opacity: 0.7;
}

.relationship-panel {
  margin: 0 18px 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  display: grid;
  gap: 8px;
}

.relationship-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) 150px minmax(160px, 1fr);
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
  text-align: left;
}

.relationship-row:hover {
  background: #eef6ff;
  border-color: #b8d4fb;
}

.relationship-row span {
  justify-self: center;
  padding: 3px 9px;
  border-radius: 999px;
  background: #e8eefb;
  color: #0d4ed8;
  font-weight: 700;
}

.relationship-row em {
  color: var(--muted);
  font-style: normal;
  overflow-wrap: anywhere;
}

.graph-summary {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  gap: 10px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
}

.graph-summary span {
  padding: 5px 10px;
  border-radius: 999px;
  background: #eef4ff;
  color: #174ea6;
  font-weight: 700;
}

.graph-canvas {
  position: relative;
  min-width: 100%;
}

.graph-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.graph-link {
  fill: none;
  stroke: #6f7f9d;
  stroke-width: 1.4;
  marker-end: url("#arrow");
}

.graph-label {
  fill: #53647f;
  font-size: 11px;
  paint-order: stroke;
  stroke: #fff;
  stroke-width: 4px;
  stroke-linejoin: round;
}

.graph-lane-label {
  position: absolute;
  left: 18px;
  z-index: 2;
  padding: 5px 9px;
  border-radius: 999px;
  background: #f6f9fd;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.graph-node {
  position: absolute;
  z-index: 3;
  width: 156px;
  min-height: 112px;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 5px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(35, 52, 92, 0.09);
  color: var(--ink);
  text-align: center;
}

.graph-node:hover {
  border-color: #8ab4f8;
  box-shadow: 0 14px 30px rgba(36, 99, 235, 0.16);
  transform: translateY(-1px);
}

.graph-node strong {
  display: block;
  max-width: 100%;
  overflow-wrap: anywhere;
  font-size: 0.82rem;
}

.graph-node em {
  color: var(--muted);
  font-size: 0.68rem;
  font-style: normal;
  overflow-wrap: anywhere;
}

.graph-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: #eaf2ff;
  color: #1659c7;
  font-size: 0.8rem;
  font-weight: 900;
}

.graph-node.vault .graph-icon {
  background: #fff4d6;
  color: #925a00;
}

.graph-node.secret .graph-icon,
.graph-node.secret.disabled .graph-icon {
  background: #eefbf4;
  color: #08764f;
}

.graph-node.admin .graph-icon {
  background: #f1eaff;
  color: #6842b8;
}

.graph-node.group .graph-icon {
  background: #eaf7fb;
  color: #087f8c;
}

.graph-node.advisor .graph-icon {
  background: #fff0f3;
  color: var(--danger);
}

.graph-node.disabled,
.graph-node.secret.disabled {
  opacity: 0.72;
}

.resource-table,
.health-list,
.quick-actions,
.activity-list,
.policy-grid {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.resource-table div,
.health-list div,
.activity-row,
.versions-box,
.policy-grid label {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
}

.resource-table span,
.health-list span,
.activity-row span,
.versions-box span {
  display: block;
  color: var(--muted);
  font-size: 0.84rem;
}

.health-list .warning {
  background: #fff8e8;
  border-color: #f2d28a;
}

.health-list .healthy,
.health-list .enabled {
  background: #ecfdf4;
  border-color: #b7ebcd;
}

.health-list .local,
.health-list .info {
  background: #eef6ff;
  border-color: #c7defc;
}

.quick-actions,
.backup-actions,
.portal-actions {
  display: flex;
  flex-wrap: wrap;
}

.activity-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.versions-box {
  margin: 12px 0;
  display: grid;
  gap: 8px;
}

.settings-divider {
  height: 1px;
  margin: 18px 0;
  background: var(--line);
}

.settings-card {
  max-width: 820px;
}

.settings-hero {
  padding: 22px;
  border-radius: 8px;
  background: linear-gradient(135deg, #dceafe, #e8f5f2);
  border: 1px solid #c8dbff;
}

.permission-pills,
.admin-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 16px;
}

.wide {
  width: auto;
  margin-bottom: 12px;
}

.access-manager {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.role-save {
  margin-top: 12px;
}

.role-save select {
  max-width: 260px;
}

dialog {
  width: min(760px, calc(100vw - 24px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(15, 25, 46, 0.45);
}

.modal-form {
  padding: 22px;
  display: grid;
  gap: 12px;
}

.modal-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-weight: 700;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.check-row {
  display: flex !important;
  grid-auto-flow: column;
  align-items: center;
  justify-content: start;
}

.check-row input {
  width: auto;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
}

.empty {
  padding: 22px;
  color: var(--muted);
  text-align: center;
}

.empty.tight {
  padding: 10px;
}

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(560px, 100%);
  border-radius: 8px;
  padding: 28px;
}

.login-card h1 {
  margin: 8px 0;
}

.login-card p {
  color: var(--muted);
  line-height: 1.55;
}

.login-form {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.status {
  margin-top: 14px;
  padding: 12px;
  border-radius: 8px;
  background: #eaf3ff;
  color: var(--blue);
}

.status.error {
  background: #fff0f3;
  color: var(--danger);
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .split-layout,
  .portal-grid,
  .metrics,
  .detail-grid,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .topbar,
  .panel-head,
  .detail-head {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions {
    flex-wrap: wrap;
  }
}
