/**
 * Admin console contrast — surface-aware only.
 * Dark / cosmic canvas → light text & icons.
 * White / light panels → dark text & icons.
 * Does not change backgrounds, glass, or layout.
 */

/* Light panels (shared class list across admin/*.html) */
body.ios-theme.admin-console :is(
    .login-box,
    .token-box,
    .stat-card,
    .section,
    .admin-file-key-section,
    .browser-card,
    .data-table,
    .tab:not(.active),
    .tabs,
    .license-nav a,
    .admin-file-drop-zone,
    .notify-warn,
    .license-key,
    .empty-state,
    .form-group,
    .create-form,
    .modal-content,
    #admin-session-check,
    .admin-session-check
  ),
body.admin-console :is(
    .login-box,
    .token-box,
    .stat-card,
    .section,
    .admin-file-key-section,
    .browser-card,
    .data-table,
    .tab:not(.active),
    .tabs,
    .license-nav a,
    .admin-file-drop-zone,
    .notify-warn,
    .license-key,
    .empty-state,
    .form-group,
    .create-form,
    .modal-content,
    #admin-session-check,
    .admin-session-check
  ) {
  color: #1c1c1e;
}

body.ios-theme.admin-console :is(
    .login-box,
    .token-box,
    .stat-card,
    .section,
    .admin-file-key-section,
    .browser-card,
    .data-table,
    .tab:not(.active),
    .tabs,
    .license-nav a,
    .admin-file-drop-zone,
    .form-group,
    .create-form,
    .modal-content,
    #admin-session-check
  )
  :where(
    p,
    li,
    label,
    span,
    td,
    th,
    h1,
    h2,
    h3,
    h4,
    h5,
    h6,
    code,
    pre,
    small,
    dt,
    dd,
    .title,
    .desc,
    .label,
    .hint,
    .section-title,
    .browser-name,
    .admin-file-hint
  ),
body.admin-console :is(.login-box, .token-box, .stat-card, .section, .tabs)
  :where(p, li, label, span, td, th, h1, h2, h3, h4, h5, h6, code, .label) {
  color: #1c1c1e !important;
}

body.ios-theme.admin-console .stat-card .value:not(.purple):not(.blue):not(.red):not(.blue):not(.yellow),
body.admin-console .stat-card .value {
  color: #1c1c1e !important;
}

body.ios-theme.admin-console :is(.login-box, .section, .stat-card, .tabs, .token-box)
  :where(.muted, .hint, .stat-card .label, .col-subtitle),
body.admin-console :is(.login-box, .section, .stat-card) :where(.muted, .hint) {
  color: #636366 !important;
}

body.ios-theme.admin-console .tabs a,
body.admin-console .tabs a {
  color: #8e8e93 !important;
}
body.ios-theme.admin-console .tabs a.active,
body.admin-console .tabs a.active {
  color: #007aff !important;
}

body.ios-theme.admin-console :is(.login-box, .section, .stat-card, .token-box, .form-group, .create-form, .admin-file-key-section, .data-table, .browser-card, .admin-file-drop-zone, .add-domain-row)
  :is(input, textarea, select),
body.admin-console :is(.login-box, .section, .stat-card, .token-box, .form-group)
  :is(input, textarea, select) {
  color: #1c1c1e !important;
  -webkit-text-fill-color: #1c1c1e !important;
  background: #fff !important;
  border-color: rgba(0, 0, 0, 0.12) !important;
}
body.ios-theme.admin-console :is(.login-box, .section, .stat-card, .form-group, .create-form)
  :is(input, textarea)::placeholder {
  color: #8e8e93 !important;
  -webkit-text-fill-color: #8e8e93 !important;
}
body.ios-theme.admin-console :is(.login-box, .section, .stat-card, .tabs)
  select option {
  color: #1c1c1e;
  background: #fff;
}

body.ios-theme.admin-console :is(.login-box, .section, .stat-card, .browser-card, .data-table, .tabs)
  :is(i.fas, i.far, i.fab, svg):not(:is(button, .btn, .tab.active) *),
body.admin-console :is(.login-box, .section, .stat-card)
  :is(i.fas, i.far, i.fab):not(:is(button, .btn) *) {
  color: inherit;
}

body.ios-theme.admin-console :is(.login-box, .section, .stat-card, .tabs) a:not(:is(button, .btn)),
body.admin-console :is(.login-box, .section) a:not(:is(button, .btn)) {
  color: #007aff !important;
}
body.ios-theme.admin-console :is(.login-box, .section) a:not(:is(button, .btn)):hover {
  color: #FFC64B !important;
}

/* Buttons on light panels — keep light label on filled buttons */
body.ios-theme.admin-console :is(.login-box, .section, .stat-card, .create-form)
  :is(
    button,
    .btn,
    .btn-primary,
    .btn-create,
    .btn-on,
    .btn-off,
    .badge-coming-soon
  ),
body.admin-console :is(.login-box, .section) :is(button, .btn, .btn-primary) {
  color: #fff !important;
}
body.ios-theme.admin-console :is(.login-box, .section) :is(.btn-admin-secondary, .btn-download-login-file, .btn-admin-danger),
body.ios-theme.admin-console .logout-wrap :is(button, .btn-download-login-file) {
  color: inherit !important;
}

/* Dark admin bar */
body.ios-theme.admin-console .header,
body.admin-console .header {
  color: #fff !important;
}
body.ios-theme.admin-console .header :where(h1, h2, p, span, a:not(.logout-btn)),
body.admin-console .header :where(h1, h2, p, span, a:not(.logout-btn)) {
  color: rgba(255, 255, 255, 0.92) !important;
}
body.ios-theme.admin-console .header .logout-btn,
body.admin-console .header .logout-btn {
  color: #ff3b30 !important;
}
body.ios-theme.admin-console .header :is(i.fas, i.far, i.fab),
body.admin-console .header :is(i.fas, i.far, i.fab) {
  color: rgba(255, 255, 255, 0.88) !important;
}

/* Active tab (dark fill) */
body.ios-theme.admin-console .tab.active,
body.ios-theme.admin-console .tab.active * {
  color: #fff !important;
}

/* Cosmic / dark canvas between panels */
body.ios-theme.admin-console .dashboard,
body.ios-theme.admin-console .main,
body.ios-theme.admin-console .container {
  color: rgba(255, 255, 255, 0.92);
}
body.ios-theme.admin-console :is(.change-password-section, .reset-section, .admin-file-login-divider) {
  color: rgba(255, 255, 255, 0.88) !important;
}
body.ios-theme.admin-console :is(.change-password-section, .reset-section) h2 {
  color: rgba(255, 255, 255, 0.72) !important;
}
body.ios-theme.admin-console .dashboard > :where(h1, .subtitle, p),
body.ios-theme.admin-console .logout-wrap .btn-download-login-file {
  color: rgba(255, 255, 255, 0.92);
}
body.ios-theme.admin-console .logout-wrap button:not(.btn-download-login-file) {
  color: #fff !important;
}

/* Light panel wins over cosmic parent */
body.ios-theme.admin-console .main :is(.section, .stat-card, .login-box, .data-table, .browser-card, .tabs),
body.ios-theme.admin-console .dashboard :is(.stat-card, .admin-file-key-section, .login-box) {
  color: #1c1c1e;
}

body.ios-theme.admin-console .error,
body.ios-theme.admin-console .error-msg,
body.admin-console .error {
  color: #ff3b30 !important;
}

body.ios-theme.admin-console .notify-warn,
body.admin-console .notify-warn {
  color: #856404 !important;
}

/* Tables on white panels */
body.ios-theme.admin-console :is(.section, .main) table:not(.data-table) th {
  color: #636366 !important;
}
body.ios-theme.admin-console :is(.section, .data-table, .main) table td {
  color: #1c1c1e !important;
}
body.ios-theme.admin-console .data-table th {
  color: #fff !important;
}
body.ios-theme.admin-console :is(.section, .main) .action-btn {
  color: #8e8e93 !important;
}
body.ios-theme.admin-console :is(.section, .main) .action-btn:hover {
  color: #007aff !important;
}

/* Admin hub cards (Statistics, Extensions, licences, …) — glass on cosmic */
body.ios-theme.admin-console .dashboard .cards a.card,
body.ios-theme.admin-console .dashboard .cards a.card .title,
body.ios-theme.admin-console .dashboard .cards a.card .desc,
body.ios-theme.admin-console .dashboard .cards a.card span {
  color: rgba(255, 255, 255, 0.96) !important;
}
body.ios-theme.admin-console .dashboard .cards a.card > i.fas,
body.ios-theme.admin-console .dashboard .cards a.card > i.far,
body.ios-theme.admin-console .dashboard .cards a.card > i.fab {
  color: rgba(255, 255, 255, 0.9) !important;
}
body.ios-theme.admin-console .dashboard .cards a.card:hover .title,
body.ios-theme.admin-console .dashboard .cards a.card:hover .desc {
  color: #fff !important;
}
body.ios-theme.admin-console .dashboard .cards a.card:hover > i {
  color: var(--liquid-accent-1, #FFC64B) !important;
}

/* admin-extensions.html — section titles on cosmic (Overview, Activity, …) */
body.ios-theme.admin-console.admin-ext-dashboard .main .section > .section-title,
body.ios-theme.admin-console.admin-ext-dashboard .main .section > .section-title span:first-child {
  color: rgba(255, 255, 255, 0.96) !important;
}
body.ios-theme.admin-console.admin-ext-dashboard .main .section > .section-title span:first-child {
  background: var(--liquid-accent-1, #FFC64B) !important;
}

/* admin-licenses.html — “License by access” block (glass / cosmic) */
body.ios-theme.admin-console.admin-licenses-page #sec-by-access,
body.ios-theme.admin-console.admin-licenses-page #sec-by-access h2,
body.ios-theme.admin-console.admin-licenses-page #sec-by-access h2 i,
body.ios-theme.admin-console.admin-licenses-page #sec-by-access .section-desc,
body.ios-theme.admin-console.admin-licenses-page #sec-by-access .product-cb,
body.ios-theme.admin-console.admin-licenses-page #sec-by-access .form-row label,
body.ios-theme.admin-console.admin-licenses-page #sec-by-access .form-row select {
  color: rgba(255, 255, 255, 0.96) !important;
}
body.ios-theme.admin-console.admin-licenses-page #sec-by-access .form-row input:not([type="checkbox"]) {
  color: #1c1c1e !important;
  -webkit-text-fill-color: #1c1c1e !important;
  background: #fff !important;
  border-color: rgba(0, 0, 0, 0.12) !important;
}
body.ios-theme.admin-console.admin-licenses-page #sec-by-access select option {
  color: #1c1c1e;
  background: #fff;
}

/* —— Admin hub sections (admin.html) —— */
.admin-hub-section {
  margin-bottom: 32px;
}
.admin-hub-section > h2 {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--g-neutral, #83819b);
  margin: 0 0 4px;
}
.admin-hub-section > h2 .hub-num {
  color: var(--g-primary, #a693ef);
  margin-right: 6px;
}
.admin-hub-section > p.admin-hub-section-desc {
  font-size: 0.85rem;
  color: var(--g-neutral, #83819b);
  margin: 0 0 14px;
  line-height: 1.45;
  max-width: 52em;
}
body.ios-theme.admin-console .admin-hub-section > h2,
body.ios-theme.admin-console .admin-hub-section > p.admin-hub-section-desc {
  color: rgba(255, 255, 255, 0.72);
}

/* —— Shared admin sub-nav (admin-nav.js) —— */
.admin-header-nav-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
}
.admin-subnav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
}
.admin-subnav-hub {
  color: rgba(255, 255, 255, 0.95);
  font-weight: 600;
  text-decoration: none;
  font-size: 0.92rem;
  padding: 4px 2px;
}
.admin-subnav-hub:hover {
  color: var(--liquid-accent-1, #ffc64b);
}
.admin-subnav-group {
  position: relative;
}
.admin-subnav-group > summary {
  cursor: pointer;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.88rem;
  list-style: none;
  padding: 4px 8px;
  border-radius: 8px;
  user-select: none;
}
.admin-subnav-group > summary::-webkit-details-marker {
  display: none;
}
.admin-subnav-group > summary::after {
  content: ' ▾';
  font-size: 0.75em;
  opacity: 0.7;
}
.admin-subnav-group[open] > summary,
.admin-subnav-group > summary.is-active-group {
  color: #fff;
  background: rgba(166, 147, 239, 0.28);
}
.admin-subnav-panel {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 200;
  background: #1c1c1e;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  padding: 6px;
  min-width: 168px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.4);
}
.admin-subnav-panel a {
  display: block;
  padding: 7px 10px;
  color: rgba(255, 255, 255, 0.88);
  text-decoration: none;
  border-radius: 6px;
  font-size: 0.86rem;
  white-space: nowrap;
}
.admin-subnav-panel a:hover,
.admin-subnav-panel a.is-active {
  background: rgba(166, 147, 239, 0.35);
  color: #fff;
}
.admin-subnav-logout {
  margin-left: auto;
}
.admin-subnav--light {
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e8e4ff;
}
.admin-subnav--light .admin-subnav-hub {
  color: #6b5acd;
}
.admin-subnav--light .admin-subnav-group > summary {
  color: #555;
}
.admin-subnav--light .admin-subnav-group[open] > summary,
.admin-subnav--light .admin-subnav-group > summary.is-active-group {
  color: #3d2860;
  background: rgba(166, 147, 239, 0.15);
}
.admin-subnav--light .admin-subnav-panel {
  background: #fff;
  border-color: #e8e4ff;
  box-shadow: 0 8px 24px rgba(61, 40, 96, 0.12);
}
.admin-subnav--light .admin-subnav-panel a {
  color: #333;
}
.admin-subnav--light .admin-subnav-panel a:hover,
.admin-subnav--light .admin-subnav-panel a.is-active {
  background: #f4f2ff;
  color: #6b5acd;
}
.admin-subnav-logout--light {
  padding: 8px 14px;
  border: 2px solid #f08b83;
  background: transparent;
  color: #b71c1c;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.88rem;
  margin-left: auto;
}

/* —— Phase 2: admin chrome (hide public site nav) —— */
body.admin-console .grigsi-top-bar .home-header-cluster,
body.admin-chrome .grigsi-top-bar .home-header-cluster {
  display: none !important;
}
body.admin-console .grigsi-top-bar,
body.admin-chrome .grigsi-top-bar {
  justify-content: space-between;
  padding-top: 10px;
  padding-bottom: 10px;
}
body.admin-console .grigsi-top-bar-spacer,
body.admin-chrome .grigsi-top-bar-spacer {
  display: none;
}
body.admin-chrome .admin-top-bar-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  vertical-align: middle;
  background: rgba(166, 147, 239, 0.35);
  color: rgba(255, 255, 255, 0.95);
  line-height: 1.4;
}
body.admin-chrome .grigsi-top-bar .admin-top-bar-badge {
  background: rgba(255, 198, 75, 0.25);
  color: #ffc64b;
}
.admin-top-bar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  flex-shrink: 0;
}
.admin-top-bar-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  color: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.06);
  transition: background 0.15s, color 0.15s;
}
.admin-top-bar-link:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}
.admin-top-bar-link i {
  font-size: 0.72rem;
  opacity: 0.85;
}
header.admin-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 20px;
  background: #1c1c1e;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  position: sticky;
  top: 0;
  z-index: 500;
}
.admin-top-bar-logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 1.15rem;
  font-weight: 700;
  color: #a693ef;
  text-decoration: none;
}
.admin-top-bar-logo i {
  font-size: 1rem;
  opacity: 0.9;
}
header.admin-top-bar .admin-top-bar-badge {
  background: rgba(166, 147, 239, 0.28);
  color: #d4c9ff;
}
header.admin-top-bar .admin-top-bar-link {
  color: rgba(255, 255, 255, 0.88);
}

/* admin-broadcast.html — tab bar on light strip */
body.admin-chrome .admin-broadcast-tabs a.is-active {
  color: var(--ios-blue, #007aff);
}
