:root {
  color-scheme: light;
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-muted: #f8fafc;
  --sidebar: #101a2b;
  --sidebar-muted: #a8b5c8;
  --border: #e3e8f0;
  --text: #182235;
  --muted: #68768b;
  --accent: #2765d8;
  --accent-strong: #1d4fb3;
  --accent-soft: #edf4ff;
  --success: #13845b;
  --success-soft: #e9f8f1;
  --danger: #bd3d46;
  --danger-soft: #fff0f1;
  --warning: #946200;
  --warning-soft: #fff7df;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-card: 0 2px 8px rgba(24, 34, 53, 0.04), 0 12px 28px rgba(24, 34, 53, 0.035);
  --focus-ring: 0 0 0 3px rgba(39, 101, 216, 0.2);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family:
    Inter,
    'Segoe UI',
    -apple-system,
    BlinkMacSystemFont,
    sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex: 0 0 252px;
  flex-direction: column;
  width: 252px;
  height: 100vh;
  padding: 24px 16px 18px;
  color: #f6f8fc;
  background: var(--sidebar);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 10px 28px;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 13px;
  color: #fff;
  background: linear-gradient(145deg, #4385f5, #2759c7);
  box-shadow: 0 5px 14px rgba(24, 79, 179, 0.28);
  font-size: 0.87rem;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.brand h1 {
  margin: 0;
  color: #fff;
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.brand small {
  color: var(--sidebar-muted);
  font-size: 0.78rem;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 4px;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--sidebar-muted);
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition:
    color 150ms ease,
    background-color 150ms ease,
    border-color 150ms ease;
}

.nav-item::before {
  display: grid;
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  place-items: center;
  border-radius: 6px;
  color: currentColor;
  font-size: 1rem;
  line-height: 1;
}

.nav-item[data-section='dashboard']::before {
  content: '⌂';
}

.nav-item[data-section='apps']::before {
  content: '▦';
}

.nav-item[data-section='roles']::before {
  content: '◇';
}

.nav-item[data-section='tenants']::before {
  content: '◎';
}

.nav-item[data-section='users']::before {
  content: '♙';
}

.nav-item[data-section='logs']::before {
  content: '≋';
}

.nav-item:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.nav-item.active {
  border-color: rgba(128, 170, 255, 0.14);
  color: #fff;
  background: rgba(76, 128, 222, 0.2);
}

.nav-item.active::before {
  color: #9fc1ff;
  background: rgba(110, 157, 243, 0.16);
}

.language-control {
  display: grid;
  gap: 6px;
  margin-top: auto;
  padding: 14px 4px 10px;
  color: var(--sidebar-muted);
  font-size: 0.75rem;
  font-weight: 600;
}

#languageSelect {
  min-height: 38px;
  padding: 7px 10px;
  border-color: rgba(255, 255, 255, 0.15);
  color: #f6f8fc;
  background-color: rgba(255, 255, 255, 0.07);
  font-size: 0.84rem;
}

#languageSelect option {
  color: var(--text);
  background: var(--surface);
}

#logoutBtn {
  margin-top: 8px;
}

.content {
  flex: 1;
  min-width: 0;
  padding: 36px clamp(24px, 4vw, 60px) 56px;
}

.panel {
  display: none;
  width: min(100%, 1440px);
  margin: 0 auto;
}

.panel.active {
  display: block;
  animation: panel-enter 180ms ease-out;
}

@keyframes panel-enter {
  from {
    opacity: 0.65;
    transform: translateY(4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 26px;
}

.topbar > div:first-child {
  min-width: 0;
}

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

.eyebrow {
  margin: 0 0 5px;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

h2,
h3,
h4 {
  margin: 0;
  color: var(--text);
  letter-spacing: -0.025em;
}

h2 {
  font-size: clamp(1.55rem, 2.1vw, 1.95rem);
  line-height: 1.22;
  font-weight: 720;
}

h3 {
  font-size: 1.05rem;
  line-height: 1.35;
  font-weight: 680;
}

h4 {
  font-size: 0.96rem;
  line-height: 1.4;
  font-weight: 650;
}

.login-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  align-items: start;
  gap: 12px;
  margin-bottom: 18px;
}

.login-row.has-session {
  display: flex;
}

.profile-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  max-width: 100%;
  min-width: 0;
  padding: 10px 14px;
  border: 1px solid #cfeedd;
  border-radius: var(--radius-md);
  color: var(--success);
  background: var(--success-soft);
}

.profile-details {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.profile-banner strong {
  color: #225c45;
  font-size: 0.9rem;
  font-weight: 650;
}

.profile-banner #authenticatedIdentity {
  overflow: hidden;
  color: #456b5b;
  font-size: 0.82rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  color: var(--success);
  background: #d6f2e3;
  font-size: 0.67rem;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.login-card {
  width: 100%;
  max-width: 360px;
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.login-card h3 {
  margin-bottom: 8px;
  font-size: 0.94rem;
}

.login-form {
  display: flex;
  align-items: stretch;
  flex-direction: column;
  gap: 7px;
}

.login-form input {
  min-width: 0;
  min-height: 34px;
  padding: 5px 9px;
  font-size: 0.84rem;
}

.login-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
}

.login-card .login-actions {
  flex: 0 0 auto;
}

.login-card .login-form button,
.login-card > .login-actions button {
  width: 100%;
}

.helper-text {
  margin: 9px 0 14px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.55;
}

.login-card .helper-text:empty {
  display: none;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stat-card,
.card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.stat-card {
  display: flex;
  min-height: 108px;
  flex-direction: column;
  justify-content: center;
  gap: 7px;
  padding: 19px 20px;
}

.stat-card span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 550;
}

.stat-card strong {
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 1.16rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.stat-card.status strong {
  color: var(--success);
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.action-card {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  min-height: 82px;
  padding: 15px 17px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  background: var(--surface);
  text-align: left;
  cursor: pointer;
  box-shadow: var(--shadow-card);
  transition:
    border-color 150ms ease,
    box-shadow 150ms ease,
    transform 150ms ease;
}

.action-card:hover {
  transform: translateY(-1px);
  border-color: #c9d7ef;
  box-shadow: 0 5px 14px rgba(24, 34, 53, 0.08);
}

.action-icon {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  place-items: center;
  border-radius: 12px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 1.25rem;
  font-weight: 650;
}

.action-card strong,
.action-card small {
  display: block;
}

.action-card strong {
  font-size: 0.93rem;
  font-weight: 680;
}

.action-card small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.79rem;
  line-height: 1.45;
}

.card {
  min-width: 0;
  margin-top: 16px;
  padding: 21px;
  border-color: #edf0f5;
  box-shadow: none;
}

.card > h3 + .helper-text {
  margin-top: 7px;
}

.card > h3:not(:last-child) {
  margin-bottom: 12px;
}

.form-card {
  max-width: 100%;
}

.application-form-card,
.role-create-card {
  width: min(100%, 820px);
  margin-right: auto;
  margin-left: auto;
}

.workspace-tab-panel#rolesCreatePanel > #groupMappingCard {
  width: min(100%, 820px);
  margin-right: auto;
  margin-left: auto;
}

.workspace-tab-panel#rolesOperationsPanel > #operationCatalogCard {
  width: min(100%, 980px);
  margin-right: auto;
  margin-left: auto;
}

.application-form-card form,
.role-create-card form {
  max-width: 100%;
}

.tab-list {
  display: flex;
  width: fit-content;
  max-width: 100%;
  gap: 4px;
  margin: 0 0 18px;
  padding: 4px;
  overflow-x: auto;
  border-radius: 11px;
  background: #e9edf4;
}

.tab-button {
  min-height: 38px;
  padding: 8px 14px;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  font-size: 0.84rem;
  font-weight: 650;
  white-space: nowrap;
  cursor: pointer;
}

.tab-button:hover {
  color: var(--text);
}

.tab-button.active {
  color: var(--accent-strong);
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(24, 34, 53, 0.1);
}

.user-tab-panel[hidden] {
  display: none;
}

.wizard-step {
  position: relative;
}

.wizard-step[data-step='2'] {
  border-left: 3px solid #c8d9f5;
}

.wizard-step > .eyebrow,
.wizard-step .topbar .eyebrow {
  margin-bottom: 5px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.4;
}

.status-active {
  color: #176c4b;
  background: #e1f5e9;
}

.status-inactive {
  color: #8c3640;
  background: #ffeaec;
}

.status-default {
  color: #3054a0;
  background: #eaf0ff;
}

.status-neutral {
  color: #526176;
  background: #edf1f6;
}

.tenants-domain-card {
  width: min(100%, 1120px);
  margin-right: auto;
  margin-left: auto;
}

.entra-tenant-admin-card {
  width: min(100%, 1120px);
  margin: 0 auto 18px;
}

.entra-tenant-admin-card .section-header {
  min-height: 82px;
  padding: 16px 21px;
}

.entra-tenant-create-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(220px, 1.5fr) auto;
  align-items: end;
  gap: 12px;
  padding: 14px 21px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--surface-subtle, #f7f9fc);
}

.entra-tenant-action-group {
  display: flex;
  min-width: 370px;
  flex-wrap: wrap;
  gap: 6px;
}

.entra-tenant-admin-card td {
  vertical-align: middle;
}

.entra-tenant-admin-card td code {
  font-size: 0.72rem;
}

.tenants-domain-card .section-header {
  min-height: 92px;
  padding: 16px 21px;
}

.tenants-domain-card .section-header .helper-text {
  margin-top: 5px;
}

.tenants-domain-card td .status-badge + .status-badge {
  margin-left: 4px;
}

.organization-chart {
  width: min(100%, 1440px);
  margin-right: auto;
  margin-left: auto;
  overflow: hidden;
}

.organization-chart-filters {
  display: grid;
  grid-template-columns: minmax(220px, 1.5fr) minmax(170px, 1fr) minmax(170px, 1fr) auto minmax(
      140px,
      auto
    );
  align-items: end;
  gap: 10px;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--surface-subtle, #f7f9fc);
}

.organization-chart-filters[hidden] {
  display: none;
}

.organization-chart-filters label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 650;
}

.organization-chart-filters input,
.organization-chart-filters select {
  min-height: 36px;
  padding: 7px 10px;
  font-size: 0.85rem;
}

.organization-chart-filters .helper-text {
  margin: 0 0 9px;
  text-align: right;
}

.organization-chart-level-hint {
  margin: 12px 18px 4px;
  color: var(--muted);
  font-size: 0.76rem;
}

.organization-chart-levels {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  padding: 10px 18px 2px;
}

.organization-level-button {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  background: var(--surface);
  cursor: pointer;
  font-size: 0.78rem;
  text-align: left;
}

.organization-level-button strong {
  color: var(--accent-strong);
  font-size: 0.84rem;
}

.organization-level-button.active {
  border-color: var(--accent);
  background: rgba(76, 128, 222, 0.1);
}

.organization-chart-level-hint,
.organization-chart-levels[hidden] {
  display: none;
}

.organization-chart-levels:not([hidden]) + .organization-chart-level-hint {
  display: block;
}

.organization-chart-tree {
  max-width: 100%;
  max-height: min(68vh, 760px);
  padding: 12px 10px 20px;
  overflow: auto;
  overscroll-behavior: contain;
}

.organization-chart-roots,
.organization-chart-children {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 10px;
  min-width: max-content;
  margin: 0;
  padding: 0;
  list-style: none;
}

.organization-chart-node {
  position: relative;
  display: flex;
  align-items: center;
  flex-direction: column;
  padding-top: 14px;
}

.organization-chart-roots > .organization-chart-node {
  padding-top: 0;
}

.organization-chart-children {
  position: relative;
  gap: 8px;
  padding-top: 18px;
}

.organization-chart-children::before {
  position: absolute;
  top: 0;
  left: 50%;
  width: 1px;
  height: 14px;
  background: #b9c7dc;
  content: '';
}

.organization-chart-children > .organization-chart-node::before {
  position: absolute;
  top: 0;
  left: 50%;
  width: 1px;
  height: 14px;
  background: #b9c7dc;
  content: '';
}

.organization-person-card {
  display: flex;
  width: 190px;
  min-height: 78px;
  flex-direction: column;
  gap: 3px;
  padding: 9px 11px;
  border: 1px solid #dbe4f1;
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.organization-level-badge {
  width: fit-content;
  padding: 2px 6px;
  border-radius: 999px;
  color: var(--accent-strong);
  background: rgba(76, 128, 222, 0.1);
  font-size: 0.58rem;
  font-weight: 700;
}

.organization-person-card strong {
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 0.74rem;
}

.organization-person-upn {
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 0.64rem;
}

.organization-person-detail {
  overflow-wrap: anywhere;
  color: #45566e;
  font-size: 0.64rem;
}

@media (max-width: 760px) {
  .organization-chart-filters {
    grid-template-columns: minmax(0, 1fr);
  }

  .organization-chart-levels {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding-right: 12px;
    padding-left: 12px;
  }

  .organization-chart-level-hint {
    margin-right: 12px;
    margin-left: 12px;
  }

  .organization-chart-filters .helper-text {
    margin: 0;
    text-align: left;
  }

  .organization-person-card {
    width: 170px;
  }
}

.advanced-operation-entry {
  margin: 10px 0 16px;
  border-bottom: 1px solid var(--border);
}

.advanced-operation-entry summary {
  width: fit-content;
  padding: 8px 0 12px;
  color: var(--accent-strong);
  font-weight: 680;
  cursor: pointer;
}

.advanced-operation-entry[open] summary {
  margin-bottom: 12px;
}

.advanced-operation-entry form {
  padding-bottom: 16px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 15px;
}

.section-header h3 {
  margin: 0;
}

.section-header .eyebrow {
  margin-bottom: 4px;
}

.section-header .helper-text {
  margin-bottom: 0;
}

form {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.field-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: 15px;
}

label {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 7px;
  color: #42516a;
  font-size: 0.84rem;
  font-weight: 600;
}

input,
select {
  width: 100%;
  min-width: 0;
  min-height: 43px;
  padding: 10px 12px;
  border: 1px solid #d5dce7;
  border-radius: var(--radius-sm);
  color: var(--text);
  background: #fff;
  font-size: 0.91rem;
  font-weight: 450;
  transition:
    border-color 150ms ease,
    box-shadow 150ms ease,
    background-color 150ms ease;
}

input::placeholder {
  color: #9aa6b7;
}

input:hover,
select:hover {
  border-color: #b7c3d4;
}

input:focus,
select:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: var(--focus-ring);
}

input[readonly] {
  color: #69768a;
  background: var(--surface-muted);
}

input[type='checkbox'] {
  width: 17px;
  height: 17px;
  min-height: 0;
  margin: 0;
  padding: 0;
  accent-color: var(--accent);
}

input[type='file'] {
  min-height: 46px;
  padding: 8px;
  color: var(--muted);
  background: var(--surface-muted);
}

input[type='file']::file-selector-button {
  margin-right: 10px;
  padding: 6px 10px;
  border: 0;
  border-radius: 6px;
  color: var(--accent-strong);
  background: var(--accent-soft);
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}

.checkbox-label {
  flex-direction: row;
  align-items: center;
  gap: 9px;
}

.primary,
.secondary,
.danger {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 15px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 0.87rem;
  font-weight: 650;
  line-height: 1.2;
  cursor: pointer;
  transition:
    color 150ms ease,
    background-color 150ms ease,
    border-color 150ms ease,
    box-shadow 150ms ease,
    transform 150ms ease;
}

.primary {
  border-color: var(--accent);
  color: #fff;
  background: var(--accent);
}

.primary:hover:not(:disabled) {
  border-color: var(--accent-strong);
  background: var(--accent-strong);
  box-shadow: 0 3px 8px rgba(39, 101, 216, 0.2);
}

.secondary {
  border-color: #d8e0ec;
  color: #33445d;
  background: #fff;
}

.secondary:hover:not(:disabled) {
  border-color: #b9c8de;
  color: var(--accent-strong);
  background: #f7f9fc;
}

.danger {
  border-color: #f1c9cd;
  color: var(--danger);
  background: var(--danger-soft);
}

.danger:hover:not(:disabled) {
  border-color: #e6a9af;
  background: #ffe5e7;
}

button:active:not(:disabled) {
  transform: translateY(1px);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.small {
  min-height: 35px;
  padding: 7px 11px;
  font-size: 0.8rem;
}

#logoutBtn {
  width: 100%;
  border-color: rgba(255, 255, 255, 0.13);
  color: #d8e1ef;
  background: rgba(255, 255, 255, 0.055);
}

#logoutBtn:hover {
  border-color: rgba(255, 255, 255, 0.23);
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.inline-form {
  display: flex;
  align-items: end;
}

.inline-form label {
  flex: 1;
}

.helper-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border: 1px solid #d7e5ff;
  border-radius: 999px;
  color: var(--accent-strong);
  background: var(--accent-soft);
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

pre {
  min-height: 74px;
  margin: 12px 0 0;
  padding: 14px 15px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: #34445b;
  background: #f7f9fc;
  font-family: 'Cascadia Code', 'SFMono-Regular', Consolas, monospace;
  font-size: 0.81rem;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

[hidden] {
  display: none !important;
}

.module-block {
  padding: 17px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-muted);
}

.manifest-request {
  display: grid;
  gap: 12px;
  margin-top: 12px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-muted);
}

.manifest-request .section-header {
  margin: 0;
}

.manifest-request .section-header small {
  display: block;
  color: var(--muted);
}

.manifest-request pre {
  max-height: 320px;
  overflow: auto;
}

.module-block h4 {
  margin-bottom: 14px;
}

.table-card {
  min-width: 0;
  padding: 0;
  overflow: hidden;
}

.table-card > .section-header,
.table-card > .field-row,
.table-card > .log-pagination {
  margin-right: 21px;
  margin-left: 21px;
}

.table-card > .section-header:first-child {
  min-height: 68px;
  margin-top: 0;
  margin-bottom: 0;
  border-bottom: 1px solid var(--border);
}

.table-card > .field-row {
  margin-top: 17px;
}

.table-card > table,
.table-card .table-scroll {
  width: 100%;
  overflow-x: auto;
}

.table-card table {
  min-width: 620px;
  border-collapse: collapse;
  background: var(--surface);
}

.table-card th,
.table-card td {
  padding: 13px 15px;
  border-bottom: 1px solid #edf0f5;
  text-align: left;
  vertical-align: middle;
}

.table-card th {
  color: #64738a;
  background: #f8fafc;
  font-size: 0.73rem;
  font-weight: 720;
  letter-spacing: 0.055em;
  text-transform: uppercase;
  white-space: nowrap;
}

.table-card td {
  color: #34445b;
  font-size: 0.86rem;
}

.table-card tbody tr:last-child td {
  border-bottom: 0;
}

.table-card tbody tr:hover {
  background: #f8faff;
}

.table-card code,
.secret-value {
  font-family: 'Cascadia Code', 'SFMono-Regular', Consolas, monospace;
  font-size: 0.81rem;
}

.table-card details {
  max-width: 420px;
}

.table-card details pre {
  max-height: 280px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.table-actions {
  min-width: 0;
  flex-wrap: wrap;
}

.logs-card {
  padding: 0;
}

.logs-card > #logTypeDescription,
.logs-card > .logs-filter-form {
  margin-right: 21px;
  margin-left: 21px;
}

.logs-filter-form {
  gap: 10px;
  margin-bottom: 16px;
}

.logs-filter-form .field-row {
  gap: 10px;
}

.logs-card > .section-header:not(:first-child) {
  min-height: 52px;
  margin-top: 0;
}

.log-data-row {
  cursor: pointer;
}

.log-data-row:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.log-expand-indicator {
  display: inline-block;
  width: 18px;
  color: var(--accent);
  font-size: 1.1rem;
  font-weight: 700;
  transition: transform 120ms ease;
}

.log-data-row.is-expanded .log-expand-indicator {
  transform: rotate(90deg);
}

.log-detail-row td {
  padding-top: 0;
  background: #f8fafc;
}

.log-detail-row pre {
  max-height: 280px;
  margin: 0;
  padding: 12px 14px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.log-level-badge {
  display: inline-flex;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 750;
  line-height: 1.4;
}

.log-kind-badge,
.level-unknown {
  color: #536174;
  background: #edf1f6;
}

.level-info {
  color: #285f9e;
  background: #e8f2ff;
}

.level-warn {
  color: #8a5a00;
  background: #fff2cd;
}

.level-error {
  color: #a5333c;
  background: #ffeaec;
}

.log-pagination {
  min-height: 58px;
  align-items: center;
  margin-top: 0;
  margin-bottom: 0;
}

.log-pagination .helper-text {
  margin: 0;
}

.row-actions {
  display: flex;
  min-width: 220px;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.role-filters {
  margin-bottom: 13px;
}

.role-details-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 22px;
  margin-top: 20px;
}

.role-subsection {
  min-width: 0;
}

.role-subsection h4 {
  margin-bottom: 12px;
}

.role-projection {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.role-projection .field-row {
  max-width: 760px;
}

#rolePermissionPreview {
  max-height: 320px;
}

.management-list {
  display: grid;
  gap: 7px;
  margin-bottom: 16px;
}

.management-row {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
}

.management-row span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.user-access-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  margin-top: 18px;
}

.user-access-role {
  min-width: 0;
  padding: 0 12px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
}

.user-access-role .management-row {
  border-bottom: 0;
}

.management-row small,
.assignment-role-option small {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
}

.user-permission-list {
  display: grid;
  gap: 4px;
  margin: 0 0 4px;
  padding-left: 20px;
  color: var(--muted);
  font-size: 0.88rem;
  overflow-wrap: anywhere;
}

.assignment-role-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
}

.portal-role-assignment .assignment-role-option label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
  flex: 1;
  cursor: pointer;
}

.assignment-role-option input {
  flex: 0 0 auto;
  margin-top: 4px;
}

.assignment-role-option span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.assignment-role-option.is-assigned {
  opacity: 0.72;
  cursor: default;
}

.available-operations-field select {
  min-height: 180px;
}

.secret-dialog {
  width: min(560px, calc(100vw - 32px));
  max-width: none;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 24px 72px rgba(18, 29, 48, 0.24);
}

.secret-dialog::backdrop {
  background: rgba(16, 26, 43, 0.55);
  backdrop-filter: blur(3px);
}

.security-notice {
  margin: 0 0 14px;
  padding: 11px 13px;
  border: 1px solid #f1dfac;
  border-radius: var(--radius-sm);
  color: var(--warning);
  background: var(--warning-soft);
  font-size: 0.88rem;
}

.secret-value {
  display: block;
  padding: 14px;
  overflow-wrap: anywhere;
  border: 1px solid #d4e0f2;
  border-radius: var(--radius-sm);
  color: #263b5a;
  background: #f4f8ff;
  user-select: all;
}

.admin-only-block,
.consult-only-block {
  transition:
    opacity 180ms ease,
    filter 180ms ease;
}

.admin-only-block.disabled,
.consult-only-block.disabled {
  opacity: 0.55;
  filter: grayscale(0.15);
}

.subsection-heading {
  margin: 22px 0 10px;
}

@media (max-width: 980px) {
  .sidebar {
    flex-basis: 220px;
    width: 220px;
  }

  .content {
    padding-right: 26px;
    padding-left: 26px;
  }

  .login-row {
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
  }

  .login-card {
    width: min(100%, 380px);
  }
}

@media (max-width: 760px) {
  .entra-tenant-create-form {
    grid-template-columns: 1fr;
  }

  .entra-tenant-action-group {
    min-width: 290px;
  }

  .shell {
    flex-direction: column;
  }

  .sidebar {
    position: relative;
    z-index: 2;
    display: grid;
    width: 100%;
    height: auto;
    flex: none;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 0 12px;
    padding: 12px 18px 10px;
  }

  .brand {
    padding: 0 4px 8px;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
  }

  #logoutBtn {
    width: auto;
    min-height: 36px;
    grid-column: 2;
    grid-row: 1;
    margin-top: 0;
  }

  .language-control {
    grid-column: 1 / -1;
    grid-row: 2;
    grid-template-columns: auto minmax(130px, 1fr);
    align-items: center;
    gap: 12px;
    margin-top: 4px;
    padding: 0 4px;
  }

  #languageSelect {
    min-height: 34px;
  }

  .nav {
    grid-column: 1 / -1;
    grid-row: 3;
    flex-direction: row;
    gap: 5px;
    margin: 4px 0 0;
    padding-bottom: 2px;
    overflow-x: auto;
    scrollbar-width: thin;
  }

  .nav-item {
    min-height: 38px;
    flex: 0 0 auto;
    gap: 7px;
    padding: 7px 10px;
    font-size: 0.82rem;
    white-space: nowrap;
  }

  .nav-item::before {
    width: 18px;
    height: 18px;
    flex-basis: 18px;
    font-size: 0.9rem;
  }

  .user-tabs {
    width: 100%;
  }

  .content {
    padding-top: 27px;
  }

  .topbar {
    align-items: flex-start;
  }

  .role-details-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 560px) {
  .sidebar {
    padding-right: 12px;
    padding-left: 12px;
  }

  .content {
    padding: 22px 14px 36px;
  }

  .topbar {
    flex-direction: column;
    gap: 13px;
    margin-bottom: 20px;
  }

  .topbar > button,
  .topbar .toolbar-right > button {
    width: 100%;
  }

  .toolbar-right {
    width: 100%;
  }

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

  .stat-card {
    min-height: 94px;
    padding: 14px;
  }

  .stat-card strong {
    font-size: 1rem;
  }

  .quick-actions {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .card {
    margin-top: 12px;
    padding: 16px;
    border-radius: var(--radius-md);
  }

  .table-card {
    padding: 0;
  }

  .logs-card > #logTypeDescription,
  .logs-card > .logs-filter-form {
    margin-right: 14px;
    margin-left: 14px;
  }

  .table-card > .section-header,
  .table-card > .field-row,
  .table-card > .log-pagination {
    margin-right: 14px;
    margin-left: 14px;
  }

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

  .login-form input {
    flex: 0 1 auto;
  }

  .login-form .login-actions {
    width: 100%;
  }

  .login-form button {
    width: 100%;
  }

  .profile-banner {
    min-height: 56px;
  }

  .profile-banner #authenticatedIdentity {
    overflow-wrap: anywhere;
    white-space: normal;
  }

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

  .user-access-columns {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

  .inline-form button {
    width: 100%;
  }

  .field-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .section-header {
    align-items: flex-start;
  }

  .row-actions {
    min-width: 0;
  }
}

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