/* Theme-aware utilities + Directory / dashboard remaps.
   Loaded after app.css. Screen-only so printed marksheets stay light. */

.theme-ink { color: var(--color-gray-800); }
.theme-muted { color: var(--color-gray-500); }
.theme-accent { color: var(--color-secondary); }

.dir-tile {
  padding: 18px;
  text-decoration: none;
  color: inherit;
}
.dir-tile-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.dir-tile-icon {
  font-size: 28px;
  color: var(--color-secondary);
}
.dir-tile-title {
  font-weight: 700;
  color: var(--color-gray-800);
}
.dir-tile-sub {
  font-size: 12.5px;
  color: var(--color-gray-500);
}
.dir-tile:hover {
  border-color: var(--color-secondary);
}

@media screen {
  html[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]):not([type="range"]):not([type="color"]):not(.mark-in),
  html[data-theme="dark"] select,
  html[data-theme="dark"] textarea {
    background-color: var(--color-white) !important;
    color: var(--color-text) !important;
    border-color: var(--color-border) !important;
  }
  html[data-theme="dark"] input::placeholder,
  html[data-theme="dark"] textarea::placeholder {
    color: var(--color-gray-400) !important;
  }
  html[data-theme="dark"] .icon-btn .badge-dot,
  html[data-theme="dark"] .icon-btn .badge-count {
    border-color: var(--color-white);
  }

  /* Inline navy / muted ink used across Directory pages */
  html[data-theme="dark"] [style*="color:#1a1a1a"],
  html[data-theme="dark"] [style*="color: #1a1a1a"],
  html[data-theme="dark"] [style*="color:#1a365d"],
  html[data-theme="dark"] [style*="color: #1a365d"],
  html[data-theme="dark"] [style*="color:#1e3a8a"],
  html[data-theme="dark"] [style*="color: #1e3a8a"],
  html[data-theme="dark"] [style*="color:#1e40af"],
  html[data-theme="dark"] [style*="color: #1e40af"],
  html[data-theme="dark"] [style*="color:#3730a3"],
  html[data-theme="dark"] [style*="color: #3730a3"],
  html[data-theme="dark"] [style*="color:#0f172a"],
  html[data-theme="dark"] [style*="color: #0f172a"],
  html[data-theme="dark"] [style*="color:#1e293b"],
  html[data-theme="dark"] [style*="color: #1e293b"],
  html[data-theme="dark"] [style*="color:#111"],
  html[data-theme="dark"] [style*="color:#334155"],
  html[data-theme="dark"] [style*="color: #334155"],
  html[data-theme="dark"] [style*="color:#475569"],
  html[data-theme="dark"] [style*="color: #475569"] {
    color: var(--color-gray-800) !important;
  }
  html[data-theme="dark"] [style*="color:#64748b"],
  html[data-theme="dark"] [style*="color: #64748b"],
  html[data-theme="dark"] [style*="color:#94a3b8"],
  html[data-theme="dark"] [style*="color: #94a3b8"],
  html[data-theme="dark"] [style*="color:#4b5563"],
  html[data-theme="dark"] [style*="color: #4b5563"] {
    color: var(--color-text-muted) !important;
  }
  html[data-theme="dark"] [style*="color:#2b6cb0"],
  html[data-theme="dark"] [style*="color: #2b6cb0"] {
    color: #93c5fd !important;
  }
  html[data-theme="dark"] [style*="background:#fff"]:not(.print-school):not(.print-controls),
  html[data-theme="dark"] [style*="background: #fff"]:not(.print-school):not(.print-controls),
  html[data-theme="dark"] [style*="background:#ffffff"],
  html[data-theme="dark"] [style*="background: #ffffff"] {
    background-color: var(--color-white) !important;
  }
  html[data-theme="dark"] [style*="background:#e2e8f0"],
  html[data-theme="dark"] [style*="background: #e2e8f0"],
  html[data-theme="dark"] [style*="background:#f1f5f9"],
  html[data-theme="dark"] [style*="background:#f7fafc"],
  html[data-theme="dark"] [style*="background: #f7fafc"],
  html[data-theme="dark"] [style*="background:#f8fafc"] {
    background-color: var(--color-gray-100) !important;
    color: var(--color-gray-700) !important;
  }
  html[data-theme="dark"] [style*="color:#744210"],
  html[data-theme="dark"] [style*="color: #744210"],
  html[data-theme="dark"] [style*="color:#7b341e"],
  html[data-theme="dark"] [style*="color: #7b341e"],
  html[data-theme="dark"] [style*="color:#92400e"] {
    color: #fbd38d !important;
  }
  html[data-theme="dark"] [style*="color:#718096"],
  html[data-theme="dark"] [style*="color: #718096"] {
    color: var(--color-gray-500) !important;
  }
  html[data-theme="dark"] [style*="color:#276749"],
  html[data-theme="dark"] [style*="color:#166534"],
  html[data-theme="dark"] [style*="color:#22543d"] {
    color: #9ae6b4 !important;
  }
  html[data-theme="dark"] [style*="background:#e0e7ff"],
  html[data-theme="dark"] [style*="background:#eef2ff"],
  html[data-theme="dark"] [style*="background:#eff6ff"],
  html[data-theme="dark"] [style*="background:#dbeafe"] {
    background-color: rgba(96, 165, 250, .18) !important;
    color: #93c5fd !important;
  }
  html[data-theme="dark"] [style*="background:#d1fae5"],
  html[data-theme="dark"] [style*="background:#ecfdf5"],
  html[data-theme="dark"] [style*="background:#f0fdf4"] {
    background-color: rgba(47, 133, 90, .2) !important;
  }
  html[data-theme="dark"] [style*="color:#065f46"] { color: #9ae6b4 !important; }
  html[data-theme="dark"] [style*="background:#fee2e2"],
  html[data-theme="dark"] [style*="background:#fef2f2"],
  html[data-theme="dark"] [style*="background:#fff5f5"] {
    background-color: rgba(197, 48, 48, .18) !important;
  }
  html[data-theme="dark"] [style*="color:#991b1b"],
  html[data-theme="dark"] [style*="color:#9b1c1c"],
  html[data-theme="dark"] [style*="color:#b91c1c"] {
    color: #feb2b2 !important;
  }
  html[data-theme="dark"] [style*="background:#fef3c7"],
  html[data-theme="dark"] [style*="background:#fff7ed"],
  html[data-theme="dark"] [style*="background:#fffbeb"] {
    background-color: rgba(214, 158, 46, .16) !important;
  }
  html[data-theme="dark"] [style*="border-color:#fecaca"] {
    border-color: rgba(254, 178, 178, .35) !important;
  }

  /* Shared chrome forced white by page <style> blocks */
  html[data-theme="dark"] .modal,
  html[data-theme="dark"] .import-progress-card {
    background: var(--color-white) !important;
    color: var(--color-text);
  }
  html[data-theme="dark"] .modal-head,
  html[data-theme="dark"] .modal-foot {
    border-color: var(--color-border) !important;
    background: var(--color-gray-50) !important;
  }
  html[data-theme="dark"] .modal-close {
    background: var(--color-gray-100) !important;
    color: var(--color-gray-600) !important;
  }
  html[data-theme="dark"] .import-progress-title,
  html[data-theme="dark"] .codes-pl-title { color: var(--color-gray-800) !important; }
  html[data-theme="dark"] .import-progress-sub,
  html[data-theme="dark"] .import-progress-meta { color: var(--color-gray-500) !important; }
  html[data-theme="dark"] .import-progress-track { background: var(--color-gray-100) !important; }

  html[data-theme="dark"] .ts-code {
    background: rgba(129, 140, 248, .16) !important;
    color: #c7d2fe !important;
  }
  html[data-theme="dark"] .filter-tab {
    background: var(--color-white) !important;
    color: var(--color-gray-600) !important;
    border-color: var(--color-border) !important;
  }
  html[data-theme="dark"] .filter-tab.active {
    background: var(--color-secondary) !important;
    color: #fff !important;
    border-color: var(--color-secondary) !important;
  }
  html[data-theme="dark"] .search-field {
    background: var(--color-white) !important;
    border-color: var(--color-border) !important;
    color: var(--color-text) !important;
  }
  html[data-theme="dark"] .filter-live-meta,
  html[data-theme="dark"] .check-all-wrap { color: var(--color-gray-600) !important; }

  html[data-theme="dark"] .sub-active,
  html[data-theme="dark"] .v-badge.approved,
  html[data-theme="dark"] .ep-pill.ok {
    background: rgba(47, 133, 90, .22) !important;
    color: #9ae6b4 !important;
  }
  html[data-theme="dark"] .sub-inactive,
  html[data-theme="dark"] .v-badge.flagged {
    background: rgba(197, 48, 48, .22) !important;
    color: #feb2b2 !important;
  }
  html[data-theme="dark"] .sub-pending,
  html[data-theme="dark"] .v-badge.pending,
  html[data-theme="dark"] .ep-pill.warn {
    background: rgba(214, 158, 46, .22) !important;
    color: #fbd38d !important;
  }
  html[data-theme="dark"] .sub-archived,
  html[data-theme="dark"] .ep-pill.none {
    background: var(--color-gray-100) !important;
    color: var(--color-gray-600) !important;
  }
  html[data-theme="dark"] .row-invalid { background: rgba(197, 48, 48, .12) !important; }
  html[data-theme="dark"] .flag-notes { color: #feb2b2 !important; }

  html[data-theme="dark"] .sub-chip {
    background: var(--color-gray-100) !important;
    color: var(--color-gray-700) !important;
  }
  html[data-theme="dark"] .sub-chip.comp {
    background: rgba(43, 108, 176, .22) !important;
    color: #93c5fd !important;
  }
  html[data-theme="dark"] .sub-chip.sel {
    background: rgba(47, 133, 90, .22) !important;
    color: #9ae6b4 !important;
  }

  html[data-theme="dark"] .list-tools input,
  html[data-theme="dark"] .list-tools select,
  html[data-theme="dark"] .bulk-tools input[type="search"] {
    background: var(--color-white) !important;
    color: var(--color-text) !important;
    border-color: var(--color-border) !important;
  }

  html[data-theme="dark"] .elective-item,
  html[data-theme="dark"] .allow-extra-toggle,
  html[data-theme="dark"] .sub-op,
  html[data-theme="dark"] .drop-btn {
    background: var(--color-white) !important;
    border-color: var(--color-border) !important;
    color: var(--color-gray-700) !important;
  }
  html[data-theme="dark"] .elective-item:hover,
  html[data-theme="dark"] .sub-op:hover {
    background: var(--color-gray-50) !important;
    border-color: #3d6a94 !important;
  }
  html[data-theme="dark"] .elective-item.active {
    background: rgba(43, 108, 176, .16) !important;
    border-color: #3d6a94 !important;
    box-shadow: 0 0 0 3px rgba(125, 211, 252, .14) !important;
  }
  html[data-theme="dark"] .elective-item .ec { color: #93c5fd !important; }
  html[data-theme="dark"] .elective-item .en { color: var(--color-gray-600) !important; }
  html[data-theme="dark"] .elective-item .cnt,
  html[data-theme="dark"] .stu-count {
    background: var(--color-gray-100) !important;
    color: var(--color-gray-700) !important;
  }
  html[data-theme="dark"] .elective-item.active .cnt {
    background: var(--color-secondary) !important;
    color: #fff !important;
  }
  html[data-theme="dark"] .group-lbl,
  html[data-theme="dark"] .stu-number,
  html[data-theme="dark"] .stu-split,
  html[data-theme="dark"] .paper-lbl,
  html[data-theme="dark"] .save-status,
  html[data-theme="dark"] .ep-live { color: var(--color-gray-500) !important; }

  html[data-theme="dark"] .stu-row,
  html[data-theme="dark"] .mark-row,
  html[data-theme="dark"] .drop-item {
    border-color: var(--color-border) !important;
  }
  html[data-theme="dark"] .stu-row:hover,
  html[data-theme="dark"] .mark-row:hover { background: var(--color-gray-50) !important; }
  html[data-theme="dark"] .stu-row.has-it,
  html[data-theme="dark"] .mark-row.has-mark { background: rgba(47, 133, 90, .12) !important; }
  html[data-theme="dark"] .stu-row.reg-done,
  html[data-theme="dark"] .stu-row.reg-done.has-it {
    background: rgba(16, 185, 129, .14) !important;
    box-shadow: inset 4px 0 0 #34d399 !important;
  }
  html[data-theme="dark"] .stu-row.reg-warn,
  html[data-theme="dark"] .stu-row.reg-warn.has-it {
    background: rgba(245, 158, 11, .14) !important;
    box-shadow: inset 4px 0 0 #f59e0b !important;
  }
  html[data-theme="dark"] .stu-row.reg-excess,
  html[data-theme="dark"] .stu-row.reg-excess.has-it {
    background: rgba(220, 38, 38, .14) !important;
    box-shadow: inset 4px 0 0 #f87171 !important;
  }
  html[data-theme="dark"] .stu-row.reg-done .stu-count { background: #059669 !important; color: #fff !important; }
  html[data-theme="dark"] .stu-row.reg-warn .stu-count { background: #d97706 !important; color: #fff !important; }
  html[data-theme="dark"] .stu-row.reg-done .stu-split { color: #6ee7b7 !important; }
  html[data-theme="dark"] .allow-extra-toggle.on {
    background: rgba(234, 88, 12, .16) !important;
    border-color: #ea580c !important;
    color: #fdba74 !important;
  }
  html[data-theme="dark"] .warn-block {
    background: rgba(214, 158, 46, .14) !important;
    border-color: rgba(251, 211, 141, .35) !important;
    color: #fbd38d !important;
  }
  html[data-theme="dark"] .drop-btn {
    color: #fdba74 !important;
    border-color: #ea580c !important;
  }
  html[data-theme="dark"] .drop-btn:hover { background: rgba(234, 88, 12, .14) !important; }
  html[data-theme="dark"] .prog-item .pl { color: var(--color-gray-700) !important; }
  html[data-theme="dark"] .prog-bar,
  html[data-theme="dark"] .bulk-bar:not(.show) {
    background: var(--color-gray-100);
  }

  html[data-theme="dark"] .ep-card {
    background: var(--color-white) !important;
    border-color: var(--color-border) !important;
    color: var(--color-text) !important;
  }
  html[data-theme="dark"] .ep-card:hover {
    background: var(--color-gray-50) !important;
    border-color: #3d6a94 !important;
  }
  html[data-theme="dark"] .ep-card .sc { color: #93c5fd !important; }
  html[data-theme="dark"] .ep-card .sn { color: var(--color-gray-800) !important; }
  html[data-theme="dark"] .ep-card .meta,
  html[data-theme="dark"] .ep-card .foot { color: var(--color-gray-500) !important; }
  html[data-theme="dark"] .ep-card .pct { color: var(--color-gray-700) !important; }

  html[data-theme="dark"] .bulk-school-item {
    background: var(--color-white) !important;
    border-color: var(--color-border) !important;
  }
  html[data-theme="dark"] .bulk-school-item:hover {
    background: var(--color-gray-50) !important;
    border-color: #3d6a94 !important;
  }
  html[data-theme="dark"] .bulk-school-item .sn,
  html[data-theme="dark"] .bulk-collapse-toggle h3 { color: var(--color-gray-800) !important; }
  html[data-theme="dark"] .bulk-school-item .meta,
  html[data-theme="dark"] .bulk-log,
  html[data-theme="dark"] .bulk-collapse-toggle .chev { color: var(--color-gray-500) !important; }
  html[data-theme="dark"] .print-controls {
    background: var(--color-white) !important;
    border-color: var(--color-border) !important;
    color: var(--color-text);
  }

  html[data-theme="dark"] .student-detail-grid dt { color: var(--color-gray-500) !important; }
  html[data-theme="dark"] .student-detail-grid dd { color: var(--color-gray-800) !important; }

  html[data-theme="dark"] .badge-muted {
    background: var(--color-gray-100);
    color: var(--color-gray-600);
  }

  html[data-theme="dark"] .acc-excellent {
    background: rgba(47, 133, 90, .22) !important;
    color: #9ae6b4 !important;
  }
  html[data-theme="dark"] .acc-good {
    background: rgba(43, 108, 176, .22) !important;
    color: #93c5fd !important;
  }
  html[data-theme="dark"] .acc-fair {
    background: rgba(214, 158, 46, .22) !important;
    color: #fbd38d !important;
  }
  html[data-theme="dark"] .acc-poor {
    background: rgba(197, 48, 48, .22) !important;
    color: #feb2b2 !important;
  }
  html[data-theme="dark"] .batch-info {
    background: rgba(43, 108, 176, .16) !important;
    border-color: rgba(96, 165, 250, .35) !important;
  }
  html[data-theme="dark"] .batch-info .bi-title,
  html[data-theme="dark"] .batch-info .bi-stat-num,
  html[data-theme="dark"] .creds-row .cv { color: var(--color-gray-800) !important; }
  html[data-theme="dark"] .batch-info .bi-desc,
  html[data-theme="dark"] .batch-info .bi-stat-lbl,
  html[data-theme="dark"] .creds-row .ck { color: var(--color-gray-500) !important; }
  html[data-theme="dark"] .creds-box {
    background: rgba(47, 133, 90, .14) !important;
    border-color: rgba(154, 230, 180, .35) !important;
  }
  html[data-theme="dark"] .creds-box h4,
  html[data-theme="dark"] .creds-note { color: #9ae6b4 !important; }
  html[data-theme="dark"] .creds-box.cb-reset {
    background: rgba(43, 108, 176, .16) !important;
    border-color: rgba(144, 205, 244, .35) !important;
  }
  html[data-theme="dark"] .creds-box.cb-reset h4,
  html[data-theme="dark"] .creds-box.cb-reset .creds-note { color: #93c5fd !important; }
  html[data-theme="dark"] .creds-box.cb-custom {
    background: rgba(214, 158, 46, .14) !important;
    border-color: rgba(251, 211, 141, .35) !important;
  }
  html[data-theme="dark"] .creds-box.cb-custom h4,
  html[data-theme="dark"] .creds-box.cb-custom .creds-note { color: #fbd38d !important; }
  html[data-theme="dark"] .creds-row .cv.pw {
    background: var(--color-white) !important;
    color: var(--color-gray-800) !important;
  }
}
