/* Phase 98: admin-wide readability, working sidebar toggle, and responsive hardening */
html.admin-ui-active,
html.admin-ui-active body.admin-shell-body{
  --admin-sidebar-w: 292px;
  --admin-bg: #06101f;
  --admin-bg-2: #081426;
  --admin-surface: #0e1a2d;
  --admin-surface-2: #121f34;
  --admin-surface-3: #172741;
  --admin-border: rgba(148,163,184,.20);
  --admin-border-strong: rgba(148,163,184,.34);
  --admin-text: #f8fbff;
  --admin-text-strong: #ffffff;
  --admin-muted: #b7c4d7;
  --admin-soft: #8ea0ba;
  --admin-primary: #2f6bff;
  --admin-primary-2: #49b9ff;
  --admin-success: #35d985;
  --admin-warning: #fbbf24;
  --admin-danger: #fb7185;
  background: radial-gradient(circle at 18% -8%, rgba(47,107,255,.22), transparent 32%), var(--admin-bg) !important;
  color: var(--admin-text) !important;
  overflow-x: hidden !important;
}
html.admin-ui-active *{box-sizing:border-box;}
html.admin-ui-active .app-shell{min-height:100vh;background:transparent!important;}
html.admin-ui-active .admin-app-v91{
  min-height:100vh!important;
  display:block!important;
  background:linear-gradient(135deg,#06101f 0%,#081426 52%,#06101f 100%)!important;
  color:var(--admin-text)!important;
  overflow-x:hidden!important;
}
html.admin-ui-active .admin-sidebar{
  position:fixed!important;
  inset:0 auto 0 0!important;
  width:var(--admin-sidebar-w)!important;
  max-width:var(--admin-sidebar-w)!important;
  height:100dvh!important;
  z-index:1040!important;
  display:flex!important;
  flex-direction:column!important;
  gap:14px!important;
  padding:18px 14px!important;
  overflow:hidden!important;
  background:linear-gradient(180deg,#07111f 0%,#081526 100%)!important;
  border-right:1px solid var(--admin-border)!important;
  box-shadow:18px 0 42px rgba(0,0,0,.26)!important;
  color:var(--admin-text)!important;
}
html.admin-ui-active .admin-sidebar *{color:inherit;}
html.admin-ui-active .admin-sidebar__header,
html.admin-ui-active .admin-sidebar__footer{flex:0 0 auto!important;}
html.admin-ui-active .admin-sidebar__brand{
  display:flex!important;align-items:center!important;gap:12px!important;padding:8px 4px 16px!important;
  text-decoration:none!important;color:#fff!important;border-bottom:1px solid var(--admin-border)!important;
}
html.admin-ui-active .admin-sidebar__brand span{
  width:42px!important;height:42px!important;display:grid!important;place-items:center!important;border-radius:14px!important;
  background:linear-gradient(135deg,#2563eb,#06b6d4)!important;color:#fff!important;box-shadow:0 16px 30px rgba(37,99,235,.25)!important;
}
html.admin-ui-active .admin-sidebar__brand strong{font-size:17px!important;line-height:1.2!important;color:#fff!important;letter-spacing:-.02em!important;}
html.admin-ui-active .admin-sidebar__close{display:none!important;background:transparent!important;border:0!important;color:#fff!important;font-size:20px!important;}
html.admin-ui-active .admin-sidebar__search{
  display:flex!important;align-items:center!important;gap:10px!important;min-height:48px!important;padding:0 13px!important;border-radius:14px!important;
  border:1px solid var(--admin-border)!important;background:#0c192b!important;color:var(--admin-muted)!important;margin:0!important;
}
html.admin-ui-active .admin-sidebar__search input,
html.admin-ui-active .admin-sidebar__search input:focus{
  width:100%!important;border:0!important;outline:0!important;background:transparent!important;color:#fff!important;box-shadow:none!important;font-weight:700!important;
}
html.admin-ui-active .admin-sidebar__search input::placeholder{color:#91a3bb!important;opacity:1!important;}
html.admin-ui-active .admin-sidebar__current{display:none!important;}
html.admin-ui-active .admin-sidebar__nav{
  flex:1 1 auto!important;min-height:0!important;overflow-y:auto!important;overflow-x:hidden!important;padding:2px 2px 10px!important;scrollbar-width:thin!important;scrollbar-color:#3b506c transparent!important;
}
html.admin-ui-active .admin-sidebar__nav::-webkit-scrollbar{width:7px!important;}
html.admin-ui-active .admin-sidebar__nav::-webkit-scrollbar-thumb{background:#3b506c!important;border-radius:999px!important;}
html.admin-ui-active .admin-sidebar__group{margin:0 0 14px!important;}
html.admin-ui-active .admin-sidebar__group-toggle{
  width:100%!important;display:flex!important;align-items:center!important;justify-content:space-between!important;
  padding:8px 4px!important;background:transparent!important;border:0!important;color:#dce7f7!important;
  font-size:11px!important;font-weight:950!important;letter-spacing:.09em!important;text-transform:uppercase!important;
}
html.admin-ui-active .admin-sidebar__group-toggle i{transition:transform .18s ease!important;color:#dce7f7!important;}
html.admin-ui-active .admin-sidebar__group-toggle[aria-expanded='true'] i{transform:rotate(180deg)!important;}
html.admin-ui-active .admin-sidebar__links{display:grid!important;gap:6px!important;}
html.admin-ui-active .admin-sidebar__links[hidden]{display:none!important;}
html.admin-ui-active .admin-sidebar__link{
  min-height:50px!important;display:grid!important;grid-template-columns:36px minmax(0,1fr)!important;align-items:center!important;gap:10px!important;
  padding:8px 10px!important;border-radius:14px!important;text-decoration:none!important;color:#d9e5f6!important;border:1px solid transparent!important;background:transparent!important;
}
html.admin-ui-active .admin-sidebar__link:hover{background:#101e33!important;border-color:var(--admin-border)!important;color:#fff!important;}
html.admin-ui-active .admin-sidebar__link.is-active,
html.admin-ui-active .admin-sidebar__link.active{
  background:linear-gradient(135deg,#2f6bff,#1d4ed8)!important;border-color:rgba(125,170,255,.55)!important;color:#fff!important;box-shadow:0 14px 28px rgba(37,99,235,.28)!important;
}
html.admin-ui-active .admin-sidebar__link i{
  width:34px!important;height:34px!important;display:grid!important;place-items:center!important;border-radius:11px!important;
  background:rgba(148,163,184,.10)!important;color:#dbeafe!important;
}
html.admin-ui-active .admin-sidebar__link.is-active i{background:rgba(255,255,255,.18)!important;color:#fff!important;}
html.admin-ui-active .admin-sidebar__link strong{display:block!important;font-size:14px!important;line-height:1.05!important;color:inherit!important;white-space:nowrap!important;overflow:hidden!important;text-overflow:ellipsis!important;}
html.admin-ui-active .admin-sidebar__link small{display:block!important;margin-top:3px!important;font-size:12px!important;line-height:1.1!important;color:#a9b8ce!important;white-space:nowrap!important;overflow:hidden!important;text-overflow:ellipsis!important;}
html.admin-ui-active .admin-sidebar__link.is-active small{color:#e7efff!important;}
html.admin-ui-active .admin-sidebar__mini-link{
  display:flex!important;align-items:center!important;gap:10px!important;min-height:42px!important;padding:10px 12px!important;margin-top:6px!important;
  border-radius:12px!important;border:1px solid var(--admin-border)!important;background:#0d1a2d!important;color:#dbeafe!important;text-decoration:none!important;font-weight:800!important;
}
html.admin-ui-active .admin-sidebar__mini-link:hover{background:#13223a!important;color:#fff!important;}
html.admin-ui-active .admin-sidebar-backdrop{display:none!important;}
html.admin-ui-active.admin-sidebar-open .admin-sidebar-backdrop{display:block!important;position:fixed!important;inset:0!important;z-index:1030!important;background:rgba(2,6,23,.66)!important;backdrop-filter:blur(3px)!important;}
html.admin-ui-active .admin-app-v91__workspace{
  margin-left:var(--admin-sidebar-w)!important;width:calc(100% - var(--admin-sidebar-w))!important;min-width:0!important;min-height:100vh!important;
  background:linear-gradient(180deg,#081426 0%,#07111f 100%)!important;color:var(--admin-text)!important;
}
html.admin-ui-active .admin-topbar-v91{
  position:sticky!important;top:0!important;z-index:900!important;display:flex!important;align-items:center!important;justify-content:space-between!important;gap:16px!important;
  min-height:78px!important;padding:18px 24px!important;background:rgba(8,20,38,.92)!important;border-bottom:1px solid var(--admin-border)!important;backdrop-filter:blur(18px)!important;
}
html.admin-ui-active .admin-topbar-v91__eyebrow{margin:0 0 3px!important;color:#8fb2ff!important;font-size:11px!important;font-weight:950!important;letter-spacing:.12em!important;text-transform:uppercase!important;}
html.admin-ui-active .admin-topbar-v91 h1{margin:0!important;color:#fff!important;font-size:clamp(22px,2vw,30px)!important;line-height:1.1!important;letter-spacing:-.03em!important;}
html.admin-ui-active .admin-topbar-v91__actions{display:flex!important;align-items:center!important;gap:10px!important;flex-wrap:wrap!important;}
html.admin-ui-active .admin-content-v91{padding:22px!important;max-width:1800px!important;margin:0 auto!important;color:var(--admin-text)!important;}
html.admin-ui-active .admin-content-v91 *{text-shadow:none!important;}
html.admin-ui-active .admin-content-v91 :where(h1,h2,h3,h4,h5,h6,strong,label,th){color:var(--admin-text-strong)!important;}
html.admin-ui-active .admin-content-v91 :where(p,li,td,span,small,div,a){color:inherit;}
html.admin-ui-active .admin-content-v91 :where(p,.text-muted,small,.small,.muted,.section-copy,.workspace-hero__copy){color:var(--admin-muted)!important;}
html.admin-ui-active .admin-content-v91 a:not(.btn):not(.admin-btn-v95){color:#7db7ff!important;}
html.admin-ui-active .admin-content-v91 a:not(.btn):hover{color:#b9dcff!important;}
/* Convert remaining white/light admin cards to readable dark surfaces. */
html.admin-ui-active .admin-content-v91 :where(.card,.surface,.panel,.table-shell,.dashboard-card,.admin-card,.ops-card-v67,.panel-v67,.surface-card,.admin-panel-v95,.metric-tile,.activity-card,.kpi-card,.form-card,.content-card,.accordion-item,.modal-content){
  background:linear-gradient(180deg,var(--admin-surface) 0%, #0b1728 100%)!important;
  border:1px solid var(--admin-border)!important;
  color:var(--admin-text)!important;
  box-shadow:0 16px 40px rgba(0,0,0,.18)!important;
}
html.admin-ui-active .admin-content-v91 :where(.card-header,.card-footer,.accordion-header,.accordion-button,.table thead th,table.dataTable thead th){
  background:#121f34!important;color:#f8fbff!important;border-color:var(--admin-border)!important;
}
html.admin-ui-active .admin-content-v91 .accordion-button:not(.collapsed){background:#172741!important;color:#fff!important;}
html.admin-ui-active .admin-content-v91 .accordion-button::after{filter:invert(1) brightness(1.8)!important;}
html.admin-ui-active .admin-content-v91 :where(.bg-white,.bg-light,.text-bg-light){background:var(--admin-surface)!important;color:var(--admin-text)!important;}
html.admin-ui-active .admin-content-v91 :where(.text-dark,.text-body,.text-black){color:var(--admin-text)!important;}
html.admin-ui-active .admin-content-v91 :where(.admin-contrast-fix,[style*="color: white"],[style*="color:#fff"],[style*="color: #fff"]){color:var(--admin-text)!important;}
html.admin-ui-active .admin-content-v91 [style*="background:#fff"],
html.admin-ui-active .admin-content-v91 [style*="background: #fff"],
html.admin-ui-active .admin-content-v91 [style*="background-color:#fff"],
html.admin-ui-active .admin-content-v91 [style*="background-color: #fff"],
html.admin-ui-active .admin-content-v91 [style*="background:white"],
html.admin-ui-active .admin-content-v91 [style*="background: white"]{
  background:var(--admin-surface)!important;color:var(--admin-text)!important;border-color:var(--admin-border)!important;
}
html.admin-ui-active .admin-content-v91 .btn,
html.admin-ui-active .admin-topbar-v91 .btn{font-weight:850!important;border-radius:12px!important;min-height:40px!important;display:inline-flex!important;align-items:center!important;justify-content:center!important;gap:8px!important;}
html.admin-ui-active .admin-content-v91 .btn-surface,
html.admin-ui-active .admin-topbar-v91 .btn-surface,
html.admin-ui-active .admin-content-v91 .btn-outline-secondary,
html.admin-ui-active .admin-content-v91 .btn-light{
  background:#101e33!important;border:1px solid var(--admin-border)!important;color:#f8fbff!important;
}
html.admin-ui-active .admin-content-v91 .btn-primary,
html.admin-ui-active .admin-topbar-v91 .btn-primary{background:linear-gradient(135deg,#2f6bff,#1d4ed8)!important;border:0!important;color:#fff!important;}
html.admin-ui-active .admin-content-v91 :where(.form-control,.form-select,.select2-selection,.select2-container--default .select2-selection--single,.select2-container--default .select2-selection--multiple,textarea,input,select){
  background:#0b1728!important;color:#f8fbff!important;border:1px solid var(--admin-border-strong)!important;border-radius:12px!important;box-shadow:none!important;
}
html.admin-ui-active .admin-content-v91 :where(.form-control,.form-select,textarea,input,select)::placeholder{color:#7f91aa!important;opacity:1!important;}
html.admin-ui-active .admin-content-v91 .form-control:focus,
html.admin-ui-active .admin-content-v91 .form-select:focus{border-color:#62a2ff!important;box-shadow:0 0 0 .2rem rgba(47,107,255,.18)!important;}
html.admin-ui-active .select2-dropdown{background:#0b1728!important;border:1px solid var(--admin-border-strong)!important;color:#f8fbff!important;z-index:6000!important;}
html.admin-ui-active .select2-results__option{color:#f8fbff!important;}
html.admin-ui-active .select2-container--default .select2-results__option--highlighted[aria-selected]{background:#2f6bff!important;color:#fff!important;}
html.admin-ui-active .select2-container--default .select2-results__option[aria-selected=true]{background:#172741!important;color:#fff!important;}
html.admin-ui-active .admin-content-v91 :where(table,.table,table.dataTable){color:var(--admin-text)!important;background:transparent!important;border-color:var(--admin-border)!important;}
html.admin-ui-active .admin-content-v91 :where(.table td,.table th,table.dataTable td,table.dataTable th){border-color:var(--admin-border)!important;color:var(--admin-text)!important;vertical-align:middle!important;}
html.admin-ui-active .admin-content-v91 :where(.table tbody tr,table.dataTable tbody tr){background:#0b1728!important;}
html.admin-ui-active .admin-content-v91 :where(.table tbody tr:nth-child(even),table.dataTable tbody tr:nth-child(even)){background:#0e1a2d!important;}
html.admin-ui-active .admin-content-v91 :where(.table tbody tr:hover,table.dataTable tbody tr:hover){background:#172741!important;}
html.admin-ui-active .admin-content-v91 :where(.table-responsive,.table-shell,.admin-table-scroll-v95,.dataTables_wrapper){overflow-x:auto!important;max-width:100%!important;border-radius:16px!important;}
html.admin-ui-active .admin-content-v91 :where(.badge,.status-badge){font-weight:850!important;letter-spacing:.01em!important;color:#fff!important;}
html.admin-ui-active .admin-content-v91 .badge.bg-success{background:rgba(53,217,133,.18)!important;color:#8dffc2!important;border:1px solid rgba(53,217,133,.36)!important;}
html.admin-ui-active .admin-content-v91 .badge.bg-warning{background:rgba(251,191,36,.18)!important;color:#ffe08a!important;border:1px solid rgba(251,191,36,.36)!important;}
html.admin-ui-active .admin-content-v91 .badge.bg-danger{background:rgba(251,113,133,.18)!important;color:#ffb4c0!important;border:1px solid rgba(251,113,133,.36)!important;}
html.admin-ui-active .admin-content-v91 .dropdown-menu{background:#0b1728!important;border:1px solid var(--admin-border-strong)!important;box-shadow:0 20px 50px rgba(0,0,0,.42)!important;z-index:6500!important;}
html.admin-ui-active .admin-content-v91 .dropdown-item{color:#e6efff!important;}
html.admin-ui-active .admin-content-v91 .dropdown-item:hover{background:#172741!important;color:#fff!important;}
/* Dashboard-specific readability */
html.admin-ui-active .admin-dashboard-v95{color:var(--admin-text)!important;}
html.admin-ui-active .admin-hero-v95,
html.admin-ui-active .admin-hero-v95 *{color:#fff!important;}
html.admin-ui-active .admin-hero-v95 p{color:#dbeafe!important;}
html.admin-ui-active .metric-card-v95{background:linear-gradient(180deg,#0f1d31,#0b1728)!important;border:1px solid var(--admin-border)!important;color:#fff!important;min-height:112px!important;}
html.admin-ui-active .metric-card-v95 *{color:inherit!important;}
html.admin-ui-active .metric-meta-v95{color:#b7c4d7!important;}
html.admin-ui-active .line-chart-v95{background:#0a1424!important;border:1px solid var(--admin-border)!important;border-radius:14px!important;overflow:hidden!important;}
html.admin-ui-active .admin-panel-v95 .empty,
html.admin-ui-active .empty-state{color:#b7c4d7!important;background:#0b1728!important;border-color:var(--admin-border)!important;}
/* Mobile app bar and sidebar toggle */
html.admin-ui-active .admin-mobile-bar{
  display:none!important;background:#07111f!important;color:#fff!important;border-bottom:1px solid var(--admin-border)!important;
}
html.admin-ui-active .admin-mobile-jump{background:#0b1728!important;color:#fff!important;border:1px solid var(--admin-border)!important;border-radius:12px!important;min-height:40px!important;min-width:0!important;}
@media (max-width:1199.98px){
  html.admin-ui-active{--admin-sidebar-w:270px;}
  html.admin-ui-active .admin-content-v91{padding:18px!important;}
}
@media (max-width:991.98px){
  html.admin-ui-active{--admin-sidebar-w:0px;}
  html.admin-ui-active .admin-sidebar{width:min(88vw,310px)!important;max-width:min(88vw,310px)!important;transform:translateX(-110%)!important;transition:transform .24s ease!important;}
  html.admin-ui-active.admin-sidebar-open .admin-sidebar,
  html.admin-ui-active .admin-sidebar.is-open{transform:translateX(0)!important;}
  html.admin-ui-active .admin-sidebar__close{display:grid!important;place-items:center!important;}
  html.admin-ui-active .admin-app-v91__workspace{margin-left:0!important;width:100%!important;}
  html.admin-ui-active .admin-mobile-bar{display:flex!important;position:sticky!important;top:0!important;z-index:930!important;align-items:center!important;gap:10px!important;padding:10px 12px!important;}
  html.admin-ui-active .admin-sidebar-toggle{white-space:nowrap!important;background:#101e33!important;color:#fff!important;border:1px solid var(--admin-border)!important;}
  html.admin-ui-active .admin-mobile-jump{flex:1 1 auto!important;width:100%!important;}
  html.admin-ui-active .admin-topbar-v91{position:relative!important;top:auto!important;flex-direction:column!important;align-items:flex-start!important;padding:16px!important;}
  html.admin-ui-active .admin-topbar-v91__actions{width:100%!important;display:grid!important;grid-template-columns:1fr 1fr!important;}
  html.admin-ui-active .admin-topbar-v91__actions .btn{width:100%!important;}
  html.admin-ui-active .admin-content-v91{padding:14px!important;}
}
@media (max-width:767.98px){
  html.admin-ui-active .admin-content-v91 .row{--bs-gutter-x:12px!important;--bs-gutter-y:12px!important;}
  html.admin-ui-active .admin-content-v91 :where(.card,.surface,.panel,.table-shell,.admin-panel-v95){border-radius:14px!important;}
  html.admin-ui-active .admin-content-v91 .table:not(.no-mobile-cards) thead{display:none!important;}
  html.admin-ui-active .admin-content-v91 .table:not(.no-mobile-cards),
  html.admin-ui-active .admin-content-v91 .table:not(.no-mobile-cards) tbody,
  html.admin-ui-active .admin-content-v91 .table:not(.no-mobile-cards) tr,
  html.admin-ui-active .admin-content-v91 .table:not(.no-mobile-cards) td{display:block!important;width:100%!important;min-width:0!important;}
  html.admin-ui-active .admin-content-v91 .table:not(.no-mobile-cards) tr{margin:0 0 10px!important;border:1px solid var(--admin-border)!important;border-radius:14px!important;background:#0b1728!important;overflow:hidden!important;}
  html.admin-ui-active .admin-content-v91 .table:not(.no-mobile-cards) td{display:flex!important;justify-content:space-between!important;gap:14px!important;padding:12px 14px!important;border-bottom:1px solid var(--admin-border)!important;text-align:right!important;}
  html.admin-ui-active .admin-content-v91 .table:not(.no-mobile-cards) td:last-child{border-bottom:0!important;}
  html.admin-ui-active .admin-content-v91 .table:not(.no-mobile-cards) td::before{content:attr(data-label);font-weight:900;color:#fff;text-align:left;}
}
@media (max-width:575.98px){
  html.admin-ui-active .admin-mobile-bar{flex-direction:column!important;align-items:stretch!important;}
  html.admin-ui-active .admin-sidebar-toggle{width:100%!important;justify-content:center!important;}
  html.admin-ui-active .admin-topbar-v91__actions{grid-template-columns:1fr!important;}
  html.admin-ui-active .admin-content-v91{padding:10px!important;}
  html.admin-ui-active .admin-topbar-v91 h1{font-size:22px!important;}
}
