
/* Phase 107 – premium admin component cleanup
   This file is intentionally last. It replaces the visual patch stack with a clean final layer. */
html.admin-ui-active{
  --adm107-bg:#07111f;
  --adm107-bg2:#0a1628;
  --adm107-surface:#0f1d31;
  --adm107-surface2:#102038;
  --adm107-table:#0c192c;
  --adm107-table2:#0f1d31;
  --adm107-head:#14253c;
  --adm107-line:rgba(148,163,184,.095);
  --adm107-line-strong:rgba(148,163,184,.16);
  --adm107-text:#f8fbff;
  --adm107-body:#dbe7f5;
  --adm107-muted:#9fb2c8;
  --adm107-blue:#3b82f6;
  --adm107-cyan:#22d3ee;
  --adm107-green:#34d399;
  --adm107-amber:#fbbf24;
  --adm107-red:#fb7185;
  color-scheme:dark;
}

/* Shell and overflow */
html.admin-ui-active,
html.admin-ui-active body.admin-shell-body,
html.admin-ui-active .main-container,
html.admin-ui-active .admin-app-v91,
html.admin-ui-active .admin-app-v91__workspace{
  background:linear-gradient(180deg,var(--adm107-bg),#06101d)!important;
  color:var(--adm107-text)!important;
  max-width:100%!important;
  overflow-x:hidden!important;
}
html.admin-ui-active .admin-content-v91{
  max-width:1640px!important;
  margin:0 auto!important;
  padding:clamp(14px,2vw,28px)!important;
  color:var(--adm107-text)!important;
  overflow-x:hidden!important;
}

/* General typography */
html.admin-ui-active .admin-content-v91 :where(h1,h2,h3,h4,h5,h6,strong,b,label,th,.section-title,.card-title,.module-title,.surface-title,.metric-value,.metric-value-v95){
  color:var(--adm107-text)!important;
  opacity:1!important;
}
html.admin-ui-active .admin-content-v91 :where(p,li,td,dd,span,small,div,a,.section-copy,.card-text,.form-text,.help-text){
  color:var(--adm107-body)!important;
  opacity:1!important;
}
html.admin-ui-active .admin-content-v91 :where(.text-muted,.muted,small,.small,.section-copy,.help-text,.form-text){
  color:var(--adm107-muted)!important;
}

/* Main card surfaces: one subtle border only */
html.admin-ui-active .admin-content-v91 :where(.workspace-hero,.admin-module-hero,.surface,.card,.panel,.module-card,.settings-card,.content-card,.form-card,.accordion-item,.modal-content,.alert,.empty-state,.list-group-item,.aside-stack > .surface){
  background:linear-gradient(180deg,var(--adm107-surface2),var(--adm107-surface))!important;
  border:1px solid var(--adm107-line)!important;
  border-radius:24px!important;
  box-shadow:0 14px 32px rgba(0,0,0,.13)!important;
  color:var(--adm107-text)!important;
}

/* Nested surfaces should not create frames inside frames */
html.admin-ui-active .admin-content-v91 :where(.surface,.card,.panel,.module-card,.content-card) > :where(.surface-card,.surface-muted,.card,.panel,.content-card,.form-card),
html.admin-ui-active .admin-content-v91 :where(.admin-frameless,.surface-card.admin-frameless,.table-shell.admin-frameless,.admin-readable-table-shell.admin-frameless){
  border:0!important;
  outline:0!important;
  box-shadow:none!important;
  background:transparent!important;
  background-color:transparent!important;
}
html.admin-ui-active .admin-content-v91 :where(.surface-card,.content-card,.form-card):has(table){
  border:0!important;
  box-shadow:none!important;
  background:transparent!important;
  padding:0!important;
}

/* Section headers */
html.admin-ui-active .admin-content-v91 :where(.surface-head,.module-header,.admin-section-header,.card-header){
  background:transparent!important;
  border:0!important;
  border-bottom:1px solid var(--adm107-line)!important;
  border-radius:0!important;
  box-shadow:none!important;
  margin:0 0 16px!important;
  padding:0 0 14px!important;
}

/* Grids */
html.admin-ui-active .admin-content-v91 :where(.metric-grid,.stats-grid,.admin-stat-grid,.cards-grid,.module-grid){
  display:grid!important;
  grid-template-columns:repeat(auto-fit,minmax(220px,1fr))!important;
  gap:18px!important;
  align-items:stretch!important;
}
html.admin-ui-active .admin-content-v91 :where(.section-grid,.section-grid--balanced,.admin-grid-v90,.panel-grid-v67){
  display:grid!important;
  grid-template-columns:minmax(0,1.55fr) minmax(280px,.75fr)!important;
  gap:20px!important;
  align-items:start!important;
}
html.admin-ui-active .admin-content-v91 :where(.domain-review-grid,.admin-single-column){
  grid-template-columns:1fr!important;
}
html.admin-ui-active .admin-content-v91 .domain-review-grid .aside-stack{
  display:grid!important;
  grid-template-columns:repeat(auto-fit,minmax(260px,1fr))!important;
  gap:18px!important;
}

/* Tables: no wrapper borders, only the table itself */
html.admin-ui-active .admin-content-v91 :where(.table-shell,.admin-readable-table-shell,.table-responsive,.dataTables_wrapper,.dataTables_scroll,.dataTables_scrollHead,.dataTables_scrollBody,.admin-table-scroll-v95){
  border:0!important;
  outline:0!important;
  box-shadow:none!important;
  background:transparent!important;
  background-color:transparent!important;
  padding:0!important;
  margin:0!important;
  max-width:100%!important;
  overflow-x:auto!important;
  overflow-y:visible!important;
  -webkit-overflow-scrolling:touch!important;
}
html.admin-ui-active .admin-content-v91 :where(table,.table,table.dataTable,.admin-readable-table){
  --bs-table-bg:var(--adm107-table)!important;
  --bs-table-color:var(--adm107-body)!important;
  --bs-table-striped-bg:var(--adm107-table2)!important;
  --bs-table-striped-color:var(--adm107-text)!important;
  --bs-table-hover-bg:#152942!important;
  --bs-table-hover-color:var(--adm107-text)!important;
  width:100%!important;
  min-width:0!important;
  border:1px solid var(--adm107-line)!important;
  border-radius:16px!important;
  overflow:hidden!important;
  border-collapse:separate!important;
  border-spacing:0!important;
  background:var(--adm107-table)!important;
  color:var(--adm107-body)!important;
  box-shadow:none!important;
}
html.admin-ui-active .admin-content-v91 .table > :not(caption) > * > *,
html.admin-ui-active .admin-content-v91 table.table > :not(caption) > * > *,
html.admin-ui-active .admin-content-v91 table.dataTable > :not(caption) > * > *{
  background-color:var(--bs-table-bg)!important;
  color:var(--bs-table-color)!important;
  border-color:var(--adm107-line)!important;
  box-shadow:none!important;
}
html.admin-ui-active .admin-content-v91 :where(table thead th,.table thead th,table.dataTable thead th){
  --bs-table-bg:var(--adm107-head)!important;
  background:var(--adm107-head)!important;
  color:var(--adm107-text)!important;
  border-bottom:1px solid var(--adm107-line)!important;
  font-weight:850!important;
  letter-spacing:.035em!important;
  text-transform:uppercase!important;
}
html.admin-ui-active .admin-content-v91 :where(table tbody tr:nth-child(even),.table tbody tr:nth-child(even)){
  --bs-table-bg:var(--adm107-table2)!important;
}
html.admin-ui-active .admin-content-v91 :where(table tbody td,.table tbody td,table.dataTable tbody td){
  border-bottom:1px solid rgba(148,163,184,.055)!important;
}
html.admin-ui-active .admin-content-v91 :where(table tbody tr:last-child td,.table tbody tr:last-child td){
  border-bottom:0!important;
}

/* Forms */
html.admin-ui-active .admin-content-v91 :where(input,select,textarea,.form-control,.form-select,.custom-select,.input-group-text){
  background:#0b1728!important;
  border:1px solid rgba(148,163,184,.17)!important;
  color:#fff!important;
  border-radius:14px!important;
  box-shadow:none!important;
}
html.admin-ui-active .admin-content-v91 :where(input,select,textarea,.form-control,.form-select)::placeholder{
  color:#90a5be!important;
  opacity:1!important;
}
html.admin-ui-active .admin-content-v91 textarea.form-control{min-height:118px!important;}

/* Buttons and restored icon spacing */
html.admin-ui-active .admin-content-v91 .btn,
html.admin-ui-active .admin-mobile-bar .btn,
html.admin-ui-active .admin-topbar-v91 .btn{
  display:inline-flex!important;
  align-items:center!important;
  justify-content:center!important;
  gap:.5rem!important;
  min-height:42px!important;
  border-radius:14px!important;
  font-weight:850!important;
  border:1px solid rgba(148,163,184,.16)!important;
  box-shadow:none!important;
  white-space:normal!important;
}
html.admin-ui-active .admin-content-v91 .btn i,
html.admin-ui-active .admin-mobile-bar .btn i,
html.admin-ui-active .admin-topbar-v91 .btn i{
  color:inherit!important;
  opacity:1!important;
}
html.admin-ui-active .admin-content-v91 :where(.btn-surface,.btn-light,.btn-outline-secondary,.btn-ghost),
html.admin-ui-active .admin-mobile-bar :where(.btn-surface,.btn-light,.btn-outline-secondary,.btn-ghost){
  background:#13243b!important;
  color:#fff!important;
}
html.admin-ui-active .admin-content-v91 :where(.btn-primary,.btn-success){
  background:linear-gradient(135deg,#3b82f6,#2563eb)!important;
  color:#fff!important;
  border:0!important;
}

/* Badges */
html.admin-ui-active .admin-content-v91 :where(.badge,.status-pill,.status-badge,.attachment-chip){
  display:inline-flex!important;
  align-items:center!important;
  gap:.35rem!important;
  border-radius:999px!important;
  font-weight:850!important;
}
html.admin-ui-active .admin-content-v91 :where(.status-active,.badge.bg-success){
  background:rgba(52,211,153,.16)!important;
  color:#9af7cc!important;
  border:1px solid rgba(52,211,153,.28)!important;
}
html.admin-ui-active .admin-content-v91 :where(.status-pending,.badge.bg-warning){
  background:rgba(251,191,36,.16)!important;
  color:#ffe08a!important;
  border:1px solid rgba(251,191,36,.28)!important;
}
html.admin-ui-active .admin-content-v91 :where(.status-danger,.badge.bg-danger){
  background:rgba(251,113,133,.16)!important;
  color:#ffb4c0!important;
  border:1px solid rgba(251,113,133,.28)!important;
}
html.admin-ui-active .admin-content-v91 :where(.badge.bg-secondary,.attachment-chip){
  background:rgba(148,163,184,.16)!important;
  color:#dbe7f5!important;
  border:1px solid rgba(148,163,184,.24)!important;
}

/* Summary/list details */
html.admin-ui-active .admin-content-v91 :where(.summary-list,.description-list,.details-list){
  border:0!important;
  background:transparent!important;
  box-shadow:none!important;
}
html.admin-ui-active .admin-content-v91 :where(.summary-list > div,.description-list > div,.details-list > div){
  border:0!important;
  border-bottom:1px solid rgba(148,163,184,.07)!important;
  background:transparent!important;
  border-radius:0!important;
  padding:12px 0!important;
}
html.admin-ui-active .admin-content-v91 :where(.summary-list > div:last-child,.description-list > div:last-child,.details-list > div:last-child){
  border-bottom:0!important;
}

/* Sidebar and mobile nav icon restore */
html.admin-ui-active .admin-sidebar i,
html.admin-ui-active .admin-mobile-bar i{
  display:inline-grid!important;
  place-items:center!important;
  color:inherit!important;
  opacity:1!important;
}
html.admin-ui-active .admin-sidebar__link > i{
  width:38px!important;
  height:38px!important;
  border-radius:13px!important;
  background:rgba(96,165,250,.12)!important;
  color:#bfdbfe!important;
}
html.admin-ui-active .admin-sidebar__link.is-active > i{
  background:linear-gradient(135deg,#3b82f6,#2563eb)!important;
  color:#fff!important;
}

/* Mobile bar */
html.admin-ui-active .admin-mobile-bar{
  display:none!important;
  width:100%!important;
  max-width:100%!important;
  background:#07111f!important;
  border-bottom:1px solid var(--adm107-line)!important;
}
html.admin-ui-active .admin-mobile-current,
html.admin-ui-active .admin-mobile-jump-wrap{
  min-width:0!important;
  min-height:48px!important;
  display:grid!important;
  align-items:center!important;
  border:1px solid rgba(148,163,184,.14)!important;
  border-radius:16px!important;
  background:#101f35!important;
  color:#fff!important;
}
html.admin-ui-active .admin-mobile-current{
  grid-template-columns:42px minmax(0,1fr)!important;
  gap:10px!important;
  padding:8px 12px!important;
}
html.admin-ui-active .admin-mobile-current i{
  width:34px!important;
  height:34px!important;
  border-radius:12px!important;
  background:rgba(96,165,250,.16)!important;
}
html.admin-ui-active .admin-mobile-current small,
html.admin-ui-active .admin-mobile-current strong{
  display:block!important;
  overflow:hidden!important;
  text-overflow:ellipsis!important;
  white-space:nowrap!important;
}
html.admin-ui-active .admin-mobile-current small{color:var(--adm107-muted)!important;font-size:.72rem!important;}
html.admin-ui-active .admin-mobile-current strong{color:#fff!important;}
html.admin-ui-active .admin-mobile-jump-wrap{
  grid-template-columns:42px minmax(0,1fr)!important;
  padding:0 10px!important;
}
html.admin-ui-active .admin-mobile-jump-wrap i{color:#bfdbfe!important;}
html.admin-ui-active .admin-mobile-jump{
  min-width:0!important;
  width:100%!important;
  height:46px!important;
  border:0!important;
  background:transparent!important;
  color:#fff!important;
  box-shadow:none!important;
}

/* Responsive */
@media (max-width:1500px){
  html.admin-ui-active .admin-content-v91 :where(.section-grid,.section-grid--balanced,.admin-grid-v90,.panel-grid-v67){
    grid-template-columns:1fr!important;
  }
  html.admin-ui-active .admin-content-v91 .aside-stack{
    display:grid!important;
    grid-template-columns:repeat(auto-fit,minmax(260px,1fr))!important;
    gap:18px!important;
  }
}
@media (max-width:991.98px){
  html.admin-ui-active .admin-mobile-bar{
    display:grid!important;
    grid-template-columns:auto minmax(170px,240px) minmax(0,1fr)!important;
    gap:10px!important;
    align-items:center!important;
    padding:12px!important;
    position:sticky!important;
    top:0!important;
    z-index:1100!important;
  }
  html.admin-ui-active .admin-sidebar-toggle{
    width:auto!important;
    min-width:96px!important;
    padding-inline:14px!important;
  }
  html.admin-ui-active .admin-topbar-v91{
    display:grid!important;
    grid-template-columns:1fr!important;
    gap:12px!important;
    padding:14px!important;
  }
  html.admin-ui-active .admin-topbar-v91__actions{
    display:grid!important;
    grid-template-columns:1fr 1fr!important;
    gap:10px!important;
    width:100%!important;
  }
  html.admin-ui-active .admin-topbar-v91__actions .btn{width:100%!important;}
}
@media (max-width:767.98px){
  html.admin-ui-active .admin-mobile-bar{
    grid-template-columns:1fr!important;
  }
  html.admin-ui-active .admin-sidebar-toggle{width:100%!important;}
  html.admin-ui-active .admin-content-v91{
    padding:12px!important;
  }
  html.admin-ui-active .admin-content-v91 :where(.workspace-hero,.admin-module-hero,.surface,.card,.panel,.module-card,.settings-card,.content-card){
    border-radius:18px!important;
  }
  html.admin-ui-active .admin-content-v91 :where(.workspace-hero__actions,.admin-topbar-v91__actions){
    display:grid!important;
    grid-template-columns:1fr!important;
    gap:10px!important;
  }
  html.admin-ui-active .admin-content-v91 :where(.workspace-hero__actions .btn,.admin-topbar-v91__actions .btn){
    width:100%!important;
  }
  html.admin-ui-active .admin-content-v91 :where(table,.table,table.dataTable,.admin-readable-table){
    border:0!important;
    background:transparent!important;
  }
  html.admin-ui-active .admin-content-v91 :where(table:not(.no-mobile-cards),.table:not(.no-mobile-cards),.admin-readable-table:not(.no-mobile-cards)) thead{
    display:none!important;
  }
  html.admin-ui-active .admin-content-v91 :where(table:not(.no-mobile-cards),.table:not(.no-mobile-cards),.admin-readable-table:not(.no-mobile-cards)),
  html.admin-ui-active .admin-content-v91 :where(table:not(.no-mobile-cards),.table:not(.no-mobile-cards),.admin-readable-table:not(.no-mobile-cards)) tbody,
  html.admin-ui-active .admin-content-v91 :where(table:not(.no-mobile-cards),.table:not(.no-mobile-cards),.admin-readable-table:not(.no-mobile-cards)) tr,
  html.admin-ui-active .admin-content-v91 :where(table:not(.no-mobile-cards),.table:not(.no-mobile-cards),.admin-readable-table:not(.no-mobile-cards)) td{
    display:block!important;
    width:100%!important;
    min-width:0!important;
  }
  html.admin-ui-active .admin-content-v91 :where(table:not(.no-mobile-cards),.table:not(.no-mobile-cards),.admin-readable-table:not(.no-mobile-cards)) tr{
    border:1px solid var(--adm107-line)!important;
    border-radius:16px!important;
    margin:0 0 12px!important;
    overflow:hidden!important;
    background:var(--adm107-table)!important;
  }
  html.admin-ui-active .admin-content-v91 :where(table:not(.no-mobile-cards),.table:not(.no-mobile-cards),.admin-readable-table:not(.no-mobile-cards)) td{
    display:flex!important;
    justify-content:space-between!important;
    align-items:flex-start!important;
    gap:12px!important;
    padding:12px 14px!important;
    border-bottom:1px solid rgba(148,163,184,.07)!important;
    text-align:right!important;
    background:var(--adm107-table)!important;
  }
  html.admin-ui-active .admin-content-v91 :where(table:not(.no-mobile-cards),.table:not(.no-mobile-cards),.admin-readable-table:not(.no-mobile-cards)) td::before{
    content:attr(data-label)!important;
    flex:0 0 44%!important;
    max-width:44%!important;
    text-align:left!important;
    color:#fff!important;
    font-weight:850!important;
  }
}
