:root {
  --acx-blue-900: #0d2b88;
  --acx-blue-600: #187ee0;
  --acx-blue-800: #15357f;
  --acx-orange-500: #ff7c00;
  --acx-gray-100: #ededed;
  --acx-gray-300: #d2dbe3;
  --acx-gray-500: #6e7a90;
  --acx-text: #1f2d3d;
  --acx-surface: #ffffff;
}

html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

body {
  margin: 0;
  color: var(--acx-text);
  background-color: #f1f5fa;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem rgba(24, 126, 224, 0.35);
}

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

.app-sidebar {
  background: linear-gradient(180deg, #0b225f 0%, var(--acx-blue-900) 100%);
  color: #dbe8ff;
  padding: 1.25rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.brand-title {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  color: #fff;
  padding: 0 0.5rem;
  width: 100%;
  overflow: hidden;
}

.brand-logo {
  width: 100%;
  max-width: 180px;
  height: auto;
}

.brand-subtitle {
  font-size: 0.95rem;
  opacity: 0.9;
}

.sidebar-section-title {
  padding: 0 0.5rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #92acd8;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.sidebar-link {
  display: block;
  color: #e7efff;
  text-decoration: none;
  border-radius: 0.5rem;
  padding: 0.55rem 0.75rem;
  font-weight: 500;
  border: 1px solid transparent;
}

.sidebar-link:hover {
  background-color: rgba(255, 255, 255, 0.06);
}

.sidebar-link.active {
  background-color: rgba(62, 117, 215, 0.42);
  border-color: rgba(255, 255, 255, 0.1);
}

.sidebar-link.disabled {
  opacity: 0.6;
}

.app-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
}

.topbar {
  background-color: #fff;
  border-bottom: 1px solid #dce4f1;
  padding: 0.75rem 1.4rem;
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
}

.topbar-breadcrumb {
  color: var(--acx-gray-500);
  font-size: 0.95rem;
}

.local-action-feedback {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  background-color: #0e2d89;
  color: #fff;
  padding: 0.65rem 0.9rem;
  border-radius: 0.5rem;
  box-shadow: 0 8px 20px rgba(14, 45, 137, 0.24);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 1080;
}

.local-action-feedback.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.local-action-feedback.is-error {
  background-color: #b4233d;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.topbar-user-picker {
  min-width: 280px;
}

.topbar-user-picker .form-label {
  font-size: 0.72rem;
  color: var(--acx-gray-500);
}

.user-badge {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background-color: #d8e6ff;
  color: var(--acx-blue-900);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.user-name {
  font-weight: 600;
  line-height: 1.1;
}

.user-role {
  color: var(--acx-gray-500);
  font-size: 0.82rem;
  line-height: 1.1;
}

.main-content {
  padding: 1.2rem 1.3rem;
  flex: 1 0 auto;
}

h1, h2, h3 {
  color: var(--acx-blue-900);
}

code {
  color: var(--acx-orange-500);
}

.footer {
  margin-top: 0;
  position: static !important;
  border-top: 1px solid #dce4f1;
  background-color: #fff;
  font-size: 0.85rem;
  padding: 0.75rem 1.4rem;
  flex-shrink: 0;
  z-index: 1;
}

.screen-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}

.screen-header h1 {
  font-size: 2rem;
  line-height: 1.05;
}

.status-badges {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.status-badge {
  background-color: #e8eef8;
  color: #3d4d6d;
  border-radius: 999px;
  font-size: 0.82rem;
  padding: 0.3rem 0.75rem;
  font-weight: 600;
}

.btn-primary {
  background-color: #eb1f41;
  border-color: #eb1f41;
}

.btn-primary:hover,
.btn-primary:focus {
  background-color: #cf1736;
  border-color: #cf1736;
}

.credential-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.9fr) minmax(320px, 1fr);
  gap: 1rem;
}

.credential-groups {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.platform-group {
  border: 1px solid #dce4f1;
  border-left: 5px solid var(--dept-accent, #5e6c84);
  border-radius: 0.65rem;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.95) 0%, rgba(246, 250, 255, 0.95) 100%);
  padding: 0.55rem 0.75rem 0.7rem;
}

.platform-group:first-child {
  border-top: 1px solid #dce4f1;
}

.platform-group > summary {
  cursor: pointer;
  list-style: none;
}

.platform-group > summary::-webkit-details-marker {
  display: none;
}

.platform-group-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.platform-group-heading {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.platform-group-department {
  background: #eef3fc;
  color: var(--dept-accent, #163b89);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.16rem 0.55rem;
  border: 1px solid #d5e0f0;
}

.platform-group-name {
  font-weight: 800;
  color: var(--dept-accent, #15357f);
  letter-spacing: 0.01em;
}

.platform-group-count {
  font-size: 0.78rem;
  color: #50658e;
  font-weight: 600;
}

.platform-group[open] {
  box-shadow: 0 8px 18px rgba(13, 43, 136, 0.08);
}

.panel-card {
  background: var(--acx-surface);
  border: 1px solid #dde5f1;
  border-radius: 0.75rem;
  box-shadow: 0 2px 10px rgba(15, 34, 74, 0.05);
  overflow: hidden;
}

.panel-card-header {
  padding: 0.9rem 1rem;
  border-bottom: 1px solid #e7edf6;
}

.panel-card-body {
  padding: 1rem;
}

.table-action-cell {
  min-width: 180px;
  vertical-align: top;
}

.table-more-cell {
  width: 38px;
  text-align: right;
  vertical-align: top;
}

.btn-soft {
  border: 1px solid #cfd9ea;
  background-color: #fff;
  color: #2f4268;
  border-radius: 0.5rem;
  padding: 0.3rem 0.7rem;
  font-weight: 600;
}

.btn-soft:hover {
  background-color: #f2f6fc;
}

.btn-more {
  border: 0;
  background-color: transparent;
  color: #4f648d;
  font-size: 1.15rem;
  line-height: 1;
  padding: 0.15rem 0.3rem;
  border-radius: 0.35rem;
}

.btn-more:hover {
  background-color: #eff4fb;
}

.endpoint-code {
  max-width: 100%;
}

.endpoint-code code {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.72rem;
}

.table {
  margin-bottom: 0;
  table-layout: fixed;
}

.table thead th {
  background-color: #f1f5fa;
  border-bottom-color: #dce4f1;
  color: #344767;
  font-size: 0.86rem;
}

.row-featured td {
  background-color: #edf3ff !important;
}

.credential-table-wrap {
  width: 100%;
}

.credential-logo {
  width: 24px;
  height: 24px;
  object-fit: contain;
  border-radius: 0.25rem;
  background-color: #f3f7fd;
}

.credential-logo-detail {
  width: 52px;
  height: 52px;
  object-fit: contain;
  border-radius: 0.45rem;
  background-color: #f3f7fd;
  border: 1px solid #d9e2ef;
  padding: 0.2rem;
}

.detail-row {
  margin-bottom: 0.75rem;
}

.detail-label {
  display: block;
  color: var(--acx-gray-500);
  font-size: 0.8rem;
  margin-bottom: 0.2rem;
}

.detail-value {
  border: 1px solid #d9e2ef;
  border-radius: 0.45rem;
  background-color: #f9fbfe;
  padding: 0.45rem 0.65rem;
}

.btn-inline-icon {
  border: 0;
  background-color: transparent;
  color: #4f648d;
  padding: 0;
  line-height: 1;
  font-size: 0.95rem;
}

.copy-secret-btn {
  width: 100%;
  background-color: var(--acx-blue-900);
  color: #fff;
  border: none;
  border-radius: 0.45rem;
  padding: 0.6rem 0.7rem;
  font-weight: 600;
}

.copy-secret-btn:hover {
  background-color: #0a236f;
}

.recent-activity {
  margin-top: 1rem;
}

.recent-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
  border-top: 1px solid #e8eef7;
  padding: 0.65rem 0;
}

.recent-row.recent-empty {
  grid-template-columns: 1fr;
}

.recent-avatar {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: #e4ecfa;
  color: #315186;
  font-weight: 700;
  font-size: 0.8rem;
}

.recent-muted {
  color: var(--acx-gray-500);
  font-size: 0.88rem;
}

.tag-pill {
  display: inline-block;
  margin-right: 0.3rem;
  margin-top: 0.2rem;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #fff;
  background-color: var(--tag-color, #6e7a90);
}

.tag-pill-sm {
  font-size: 0.68rem;
  padding: 0.08rem 0.38rem;
}

.tag-pill-inactive {
  opacity: 0.6;
  text-decoration: line-through;
}

.js-tag-filter-chip {
  border: 1px solid var(--tag-color, #6e7a90);
  color: var(--tag-color, #6e7a90);
  background: #fff;
  border-radius: 999px;
  font-size: 0.72rem;
  padding: 0.1rem 0.5rem;
}

.js-tag-filter-chip.is-active {
  color: #fff;
  background: var(--tag-color, #6e7a90);
}

.login-page {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at 20% 10%, rgba(24, 126, 224, 0.34) 0%, rgba(24, 126, 224, 0) 42%),
    linear-gradient(165deg, #0b225f 0%, var(--acx-blue-900) 54%, #15357f 100%);
}

.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.login-card {
  width: min(520px, 100%);
  background: #fff;
  border-radius: 1rem;
  box-shadow: 0 28px 52px rgba(6, 26, 81, 0.34);
  overflow: hidden;
}

.login-brand {
  background: #ffffff;
  border-bottom: 1px solid #d9e6ff;
  padding: 1.25rem 1.5rem 0.9rem;
}

.login-brand-logo {
  width: 190px;
  max-width: 100%;
  height: auto;
  filter: brightness(0) saturate(100%) invert(14%) sepia(52%) saturate(3301%) hue-rotate(214deg) brightness(92%) contrast(95%);
}

.login-brand-subtitle {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.9rem;
  color: #28467e;
}

.login-main {
  padding: 1.25rem 1.5rem 0.4rem;
}

.login-muted {
  color: var(--acx-gray-500);
}

.login-sso-button {
  min-height: 46px;
  border: 1px solid #cfd9ea;
  background-color: #fff;
  color: #1f2d3d;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
}

.login-sso-button:hover,
.login-sso-button:focus {
  border-color: #b7c8e4;
  background-color: #f7faff;
  color: #1f2d3d;
}

.ms-logo {
  display: grid;
  grid-template-columns: repeat(2, 8px);
  grid-template-rows: repeat(2, 8px);
  gap: 2px;
}

.ms-logo span {
  display: block;
  width: 8px;
  height: 8px;
}

.ms-logo-red { background-color: #f25022; }
.ms-logo-green { background-color: #7fba00; }
.ms-logo-blue { background-color: #00a4ef; }
.ms-logo-yellow { background-color: #ffb900; }

.login-emergency-details summary {
  display: inline-block;
  font-size: 0.82rem;
  color: #2e4f90;
  text-decoration: underline;
  cursor: pointer;
  list-style: none;
}

.login-emergency-details summary::-webkit-details-marker {
  display: none;
}

.login-emergency-details[open] summary {
  margin-bottom: 0.45rem;
}

.login-emergency {
  border-top: 1px solid #e7edf8;
  margin-top: 0.2rem;
  padding: 0.75rem 1.5rem 1.2rem;
}

.login-emergency-help {
  margin-bottom: 0.5rem;
  font-size: 0.78rem;
  color: #6e7a90;
}

.login-emergency-label {
  font-size: 0.76rem;
  margin-bottom: 0.2rem;
  color: #526280;
}

@media (max-width: 1100px) {
  .credential-grid {
    grid-template-columns: 1fr;
  }
}

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

  .app-sidebar {
    padding: 0.9rem;
  }

  .sidebar-nav {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-actions {
    flex-wrap: wrap;
    justify-content: space-between;
  }

  .topbar-user-picker {
    min-width: 0;
    width: 100%;
  }

  .login-card {
    border-radius: 0.85rem;
  }

  .login-brand,
  .login-main,
  .login-emergency {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}