/* Shared responsive Topbar, Single-Row Desktop Nav & Mobile Bottom Bar (Fase V1) */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
  box-shadow: var(--shadow-sm);
  transition: transform 0.22s ease;
}

.topbar.topbar--hidden {
  transform: translateY(-108%);
}

body.in-session .topbar,
body.in-session #mainNav,
body.in-session #navMoreDrawer,
body.in-session .start-bar {
  display: none !important;
}

body.in-session main.container {
  padding-top: 12px !important;
  padding-bottom: 24px !important;
}

.topbar-inner {
  max-width: 1380px;
  margin: 0 auto;
  padding: 8px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: nowrap;
  min-height: 60px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  min-width: 0;
  min-height: 44px;
  flex: 0 1 250px;
  text-decoration: none;
}

.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  font-size: 19px;
  flex-shrink: 0;
}

.brand > div:last-child {
  min-width: 0;
  flex: 1 1 auto;
}

.brand-title {
  font-size: 15px;
  font-weight: 800;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-sub {
  font-size: 11px;
  line-height: 1.2;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 1199px) {
  .brand-sub {
    display: none;
  }
}

.nav-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  scroll-snap-type: x proximity;
  flex: 1 1 auto;
  justify-content: flex-end;
  min-width: 0;
}

.nav-tabs::-webkit-scrollbar {
  display: none;
}

.nav-btn {
  flex: 0 0 auto;
  white-space: nowrap;
  scroll-snap-align: start;
  padding: 8px 12px;
  font-size: 13px;
  min-height: 44px;
  min-width: 44px;
}

.nav-btn .nav-mob-content {
  display: none;
}

.nav-btn.nav-more-btn {
  display: none;
}

/* Account Menu Pill & Popover */
#userHeaderBox {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.account-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
  min-height: 44px;
  min-width: 44px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}

.account-trigger:hover {
  border-color: var(--primary);
  background: var(--surface-3);
}

.account-name-short {
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-meta-inline {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}

.account-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: min(290px, calc(100vw - 24px));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  padding: 14px;
  z-index: 90;
  display: none;
  flex-direction: column;
  gap: 8px;
}

.account-popover.open {
  display: flex;
}

.account-popover-head {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.account-popover-name {
  font-weight: 800;
  font-size: 14.5px;
  color: var(--text);
}

.account-popover-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.account-popover .btn-menu-item {
  width: 100%;
  justify-content: flex-start;
  min-height: 44px;
  padding: 10px 12px;
}

.nav-more-drawer {
  position: fixed;
  right: 10px;
  bottom: calc(64px + env(safe-area-inset-bottom));
  width: min(250px, calc(100vw - 20px));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  padding: 10px;
  z-index: 85;
  display: none;
  flex-direction: column;
  gap: 6px;
}

.nav-more-drawer.open {
  display: flex;
}

.nav-more-drawer .nav-drawer-item {
  width: 100%;
  justify-content: flex-start;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-weight: 600;
  font-size: 13.5px;
}

.nav-more-drawer .nav-drawer-item.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

@media (max-width: 960px) and (min-width: 641px) {
  .topbar-inner {
    padding: 8px 12px;
    gap: 8px;
  }
  .brand {
    flex: 0 1 135px;
  }
  .brand-title {
    font-size: 13.5px;
  }
  .nav-tabs {
    justify-content: center;
    gap: 4px;
    overflow: visible;
  }
  .nav-btn {
    padding: 8px 9px;
    font-size: 12px;
  }
  .nav-btn .nav-desk-content {
    display: none;
  }
  .nav-btn .nav-mob-content {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    gap: 5px;
  }
  .nav-btn .nav-mob-content svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
  }
  .nav-btn .nav-mob-lbl {
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
  }
  .account-trigger {
    padding: 6px 10px;
  }
  .account-name-short {
    max-width: 72px;
  }
  .account-meta-inline {
    display: none;
  }
}

@media (max-width: 640px) {
  .topbar-inner {
    padding: 8px 12px;
    gap: 8px;
    min-height: 56px;
  }
  .brand {
    flex: 1 1 auto;
    max-width: none;
  }
  .brand-title {
    font-size: 13.5px;
  }
  .account-meta-inline {
    display: none;
  }
  .account-name-short {
    max-width: 90px;
  }
  .nav-tabs {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    height: calc(56px + env(safe-area-inset-bottom));
    padding: 4px 6px calc(4px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(8px);
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 18px rgba(15, 23, 42, 0.08);
    justify-content: space-around;
    gap: 2px;
    overflow: hidden;
  }
  .nav-btn {
    flex: 1 1 0;
    min-width: 44px;
    min-height: 44px;
    height: 46px;
    padding: 4px 2px;
    border-radius: 10px;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    font-size: 10.5px;
    line-height: 1.1;
  }
  .nav-btn .nav-desk-content {
    display: none;
  }
  .nav-btn .nav-mob-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
  }
  .nav-btn .nav-mob-lbl {
    font-size: 10.5px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }
  .nav-btn.nav-overflow-mobile {
    display: none !important;
  }
  .nav-btn.nav-more-btn.visible {
    display: inline-flex;
  }
  body.has-mobile-nav .start-bar {
    bottom: calc(56px + env(safe-area-inset-bottom));
    padding: 8px 12px;
  }
  body.has-mobile-nav .start-bar > .flex {
    flex-wrap: nowrap;
    gap: 8px;
    align-items: stretch;
  }
  body.has-mobile-nav .start-bar #btnStartMock {
    flex: 1 1 60%;
    min-width: 0;
    padding: 9px 12px;
    font-size: 13.5px;
    line-height: 1.25;
  }
  body.has-mobile-nav .start-bar #btnPreviewTest {
    flex: 0 1 40%;
    min-width: 44px;
    padding: 8px 10px;
    font-size: 12px;
    line-height: 1.2;
    white-space: normal;
  }
  body.has-mobile-nav main.container {
    padding-bottom: calc(156px + env(safe-area-inset-bottom));
  }
}

/* =====================================================================
   V2-1: Responsive Tables -> Stacked Cards on Mobile (<= 640px)
   & Compact Tablet Tables (641px..960px) across all 5 modules
   ===================================================================== */

.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.td-val {
  display: contents;
}

.cell-student-name b,
.cell-student-name .stu-name-text {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.3;
  word-break: break-word;
}

@media (max-width: 960px) and (min-width: 641px) {
  .table-wrap table.resp-card-table {
    font-size: 12px !important;
    width: 100% !important;
    table-layout: auto;
  }

  .table-wrap table.resp-card-table th,
  .table-wrap table.resp-card-table td {
    padding: 7px 5px !important;
    min-width: 0 !important;
    max-width: none !important;
    overflow-wrap: anywhere;
    vertical-align: top;
  }

  .table-wrap table.resp-card-table .pill {
    white-space: normal;
    word-break: break-word;
    line-height: 1.25;
  }

  .table-wrap table.resp-card-table .btn-sm {
    min-height: 44px;
    padding: 6px 8px;
    font-size: 11.5px;
  }
}

@media (max-width: 640px) {
  .table-wrap {
    overflow-x: visible !important;
  }

  .table-wrap table.resp-card-table {
    display: block;
    width: 100% !important;
    min-width: 0 !important;
    border-collapse: separate !important;
  }

  .table-wrap table.resp-card-table thead {
    display: none;
  }

  .table-wrap table.resp-card-table tbody {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
  }

  .table-wrap table.resp-card-table tbody tr {
    display: block;
    width: 100%;
    background: var(--surface, #ffffff);
    border: 1px solid var(--border, #e2e8f0) !important;
    border-radius: 12px;
    padding: 8px 12px !important;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  }

  .table-wrap table.resp-card-table tbody tr td {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    padding: 8px 0 !important;
    border: none !important;
    border-top: 1px solid var(--border, #e2e8f0) !important;
    text-align: right;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .table-wrap table.resp-card-table tbody tr td:first-child {
    border-top: none !important;
  }

  .table-wrap table.resp-card-table tbody tr td.td-colspan {
    display: block !important;
    text-align: center !important;
    border-top: none !important;
  }

  .table-wrap table.resp-card-table tbody tr td.td-colspan::before {
    display: none !important;
    content: none !important;
  }

  .table-wrap table.resp-card-table tbody tr td[data-label]:not([data-label=""])::before {
    content: attr(data-label);
    flex: 0 0 38%;
    max-width: 42%;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    color: var(--muted, #475569);
    text-transform: uppercase;
    letter-spacing: 0.02em;
    line-height: 1.35;
  }

  .table-wrap table.resp-card-table tbody tr td > .td-val {
    display: block;
    flex: 1 1 auto;
    min-width: 0;
    text-align: right;
  }

  .table-wrap table.resp-card-table tbody tr td .flex {
    justify-content: flex-end;
    flex-wrap: wrap;
  }

  .table-wrap table.resp-card-table tbody tr td .notes-clamp {
    text-align: right;
  }

  .table-wrap table.resp-card-table tbody tr td.cell-student-name {
    max-width: 100% !important;
  }

  .table-wrap table.resp-card-table tbody tr td.cell-student-name b,
  .table-wrap table.resp-card-table tbody tr td.cell-student-name .stu-name-text {
    max-width: 100%;
    text-align: right;
  }
}

/* =====================================================================
   V3-1: Bank Pagination Bar
   ===================================================================== */

.bank-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding: 12px 14px;
  background: var(--surface, #ffffff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px;
}

.bank-pagination-info {
  font-size: 13px;
  color: var(--muted, #475569);
  font-weight: 600;
}

.bank-pagination .btn-soft,
.bank-pagination button {
  min-height: 44px;
}

/* =====================================================================
   V3-2: Single Primary CTA & Text-Link Secondary Action on Bank Cards
   ===================================================================== */

.card-actions-bar {
  border-top: 1px solid var(--border, #e2e8f0);
  padding-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-link-action {
  background: transparent !important;
  border: 1px solid transparent !important;
  color: var(--primary, #4f46e5) !important;
  padding: 8px 6px !important;
  min-height: 44px !important;
  min-width: 44px !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  text-decoration: underline;
  text-underline-offset: 3px;
  box-shadow: none !important;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

.btn-link-action:hover {
  background: var(--primary-light, #eef2ff) !important;
  border-radius: 8px;
  text-decoration: none;
}

/* =====================================================================
   V3-3: 1-line Compact Progress Strip replacing tall Riwayat hero card
   ===================================================================== */

.progress-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px 14px;
  flex-wrap: wrap;
  padding: 10px 14px;
  margin-bottom: 12px;
  background: var(--surface, #ffffff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px;
  font-size: 13px;
  color: var(--text, #0f172a);
}

.progress-strip-main {
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.progress-strip-meta {
  color: var(--muted, #475569);
  font-weight: 600;
  font-size: 12.5px;
}

/* =====================================================================
   V3-4: 3-column horizontal Stats Strip (<= 120px on mobile <= 640px)
   ===================================================================== */

.stats {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 14px;
  margin-bottom: 18px;
}

.stats > .card {
  margin: 0;
}

.stat-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted, #475569);
}

.stat-val {
  font-size: 26px;
  font-weight: 800;
  margin-top: 4px;
  line-height: 1.15;
}

.stat-sub {
  font-size: 12px;
  color: var(--muted, #475569);
  margin-top: 4px;
}

@media (max-width: 640px) {
  .stats {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 8px !important;
    margin-bottom: 14px !important;
  }

  .stats > .card {
    margin: 0 !important;
    padding: 10px 8px !important;
    border-radius: 10px;
    min-width: 0;
  }

  .stats .stat-label {
    font-size: 10.5px !important;
    line-height: 1.2;
  }

  .stats .stat-val {
    font-size: 20px !important;
    line-height: 1.15;
    margin-top: 3px !important;
  }

  .stats .stat-sub {
    font-size: 10.5px !important;
    line-height: 1.2;
    margin-top: 2px !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .stats .progress-bar {
    margin-top: 5px !important;
    height: 5px !important;
  }
}

/* =====================================================================
   F1/F4/F5/F6/F7: Theme Toggle, Mode Actions, Rumus Accordion,
   Mobile Readability (15.5px), & Cross-Module Dark Mode
   ===================================================================== */

.topbar-tools {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}

.theme-toggle-btn:hover {
  border-color: var(--primary);
  background: var(--surface-3);
  color: var(--text);
}

@media (max-width: 640px) {
  html,
  body {
    font-size: 15.5px;
    -webkit-text-size-adjust: 100%;
  }

  .brand {
    flex: 1 1 auto;
    min-width: 0;
  }

  .mode-desc,
  .q-prompt,
  .passage-text,
  .para-block,
  .question-box p,
  .card li {
    font-size: 15px !important;
    line-height: 1.6;
  }

  .mode-title {
    font-size: 17px !important;
  }

  input,
  select,
  textarea {
    font-size: 16px !important;
  }
}

/* F5: Action bar inside selected skill mode card */
.mode-card-actions {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.mode-card-actions .btn-primary {
  flex: 1 1 auto;
  min-height: 44px;
  padding: 9px 14px;
  font-size: 13.5px;
  border-radius: 10px;
}

.mode-card-actions .btn-soft {
  min-height: 44px;
}

/* F6: Collapsible Rumus / Guide Accordions */
details.rumus-accordion {
  background: var(--surface, #ffffff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px;
  overflow: hidden;
  transition: border-color 0.15s ease;
}

details.rumus-accordion[open] {
  border-color: var(--primary);
}

details.rumus-accordion > summary {
  list-style: none;
  cursor: pointer;
  padding: 12px 14px;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-weight: 700;
  font-size: 14.5px;
  color: var(--text);
  background: var(--surface-2);
  user-select: none;
}

details.rumus-accordion > summary::-webkit-details-marker {
  display: none;
}

details.rumus-accordion > summary::after {
  content: "▸";
  font-size: 14px;
  color: var(--primary);
  flex-shrink: 0;
  transition: transform 0.18s ease;
}

details.rumus-accordion[open] > summary::after {
  transform: rotate(90deg);
}

details.rumus-accordion > summary:hover {
  background: var(--surface-3);
}

.rumus-accordion-body {
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  display: grid;
  gap: 8px;
}

/* F8: Consistent hover/active state — never flash red on neutral buttons */
button:hover,
.btn:hover,
button:active,
.btn:active {
  color: var(--text);
}

.btn-primary:hover,
.btn-primary:active {
  color: #ffffff !important;
}

.btn-soft:hover,
.btn-soft:active {
  color: var(--primary) !important;
}

.btn-danger:hover,
.btn-danger:active {
  color: #ffffff !important;
}

/* F7: Dark Mode Token Overrides & Legibility */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1220;
  --surface: #111827;
  --surface-2: #1e293b;
  --surface-3: var(--dark-surface-3, #1e293b);
  --primary: var(--dark-primary, #818cf8);
  --primary-hover: var(--dark-primary-hover, #6366f1);
  --primary-light: var(--dark-primary-light, rgba(99, 102, 241, 0.24));
  --emerald: #34d399;
  --emerald-light: rgba(16, 185, 129, 0.2);
  --amber: #fbbf24;
  --amber-light: rgba(245, 158, 11, 0.2);
  --rose: #fb7185;
  --rose-light: rgba(244, 63, 94, 0.2);
  --green-600: #34d399;
  --amber-600: #fbbf24;
  --danger: #fb7185;
  --text: #f1f5f9;
  --text-2: #cbd5e1;
  --muted: #94a3b8;
  --border: #334155;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.45);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 16px 36px rgba(0, 0, 0, 0.65);
}

:root[data-theme="dark"] .btn-primary {
  background: var(--btn-primary-bg, #4f46e5);
  border-color: var(--btn-primary-bg, #4f46e5);
  color: #ffffff !important;
}

:root[data-theme="dark"] .btn-primary:hover {
  background: var(--btn-primary-hover-bg, #4338ca);
  border-color: var(--btn-primary-hover-bg, #4338ca);
}

:root[data-theme="dark"] .nav-btn.active {
  background: var(--btn-primary-bg, #4f46e5);
  color: #ffffff;
}

:root[data-theme="dark"] .topbar,
:root[data-theme="dark"] .nav-tabs,
:root[data-theme="dark"] .start-bar {
  background: #111827 !important;
  border-color: #334155 !important;
}

:root[data-theme="dark"] .card,
:root[data-theme="dark"] .topic-card,
:root[data-theme="dark"] .mode-card,
:root[data-theme="dark"] .modal-content,
:root[data-theme="dark"] .cd-pane,
:root[data-theme="dark"] .question-box,
:root[data-theme="dark"] .q-prompt,
:root[data-theme="dark"] .essay-editor,
:root[data-theme="dark"] .tense-card-cell,
:root[data-theme="dark"] .timeline-box {
  background: #111827 !important;
  background-image: none !important;
  color: #f1f5f9 !important;
  border-color: #334155 !important;
}

:root[data-theme="dark"] .mode-card.selected {
  background: var(--dark-selected-bg, rgba(79, 70, 229, 0.16)) !important;
  border-color: var(--dark-primary, #818cf8) !important;
}

:root[data-theme="dark"] .mode-card:hover {
  border-color: var(--dark-primary, #818cf8);
}

:root[data-theme="dark"] .mode-badge {
  background: var(--dark-primary-light, rgba(99, 102, 241, 0.22));
  color: var(--dark-pill-text, #c7d2fe);
}

:root[data-theme="dark"] .mode-card.selected .mode-badge {
  background: var(--btn-primary-bg, #4f46e5);
  color: #ffffff;
}

:root[data-theme="dark"] button,
:root[data-theme="dark"] .btn,
:root[data-theme="dark"] .nav-btn {
  background: #1e293b;
  color: #f1f5f9;
  border-color: #334155;
}

:root[data-theme="dark"] .btn-soft {
  background: var(--dark-soft-bg, rgba(99, 102, 241, 0.16));
  color: var(--dark-soft-text, #a5b4fc);
  border-color: var(--dark-soft-border, rgba(129, 140, 248, 0.35));
}

:root[data-theme="dark"] .btn-link-action {
  color: var(--dark-primary, #818cf8) !important;
}

:root[data-theme="dark"] .btn-link-action:hover {
  background: var(--dark-primary-light, rgba(99, 102, 241, 0.22)) !important;
}

:root[data-theme="dark"] input,
:root[data-theme="dark"] select,
:root[data-theme="dark"] textarea {
  background: #0f172a !important;
  color: #f1f5f9 !important;
  border-color: #334155 !important;
}

:root[data-theme="dark"] .table-wrap th,
:root[data-theme="dark"] .q-group-head,
:root[data-theme="dark"] .cd-pane-header,
:root[data-theme="dark"] .account-trigger,
:root[data-theme="dark"] .phrase-chip,
:root[data-theme="dark"] details.rumus-accordion > summary {
  background: #1e293b !important;
  color: #e2e8f0 !important;
  border-color: #334155 !important;
}

:root[data-theme="dark"] .pill {
  background: var(--dark-primary-light, rgba(99, 102, 241, 0.22));
  color: var(--dark-pill-text, #c7d2fe);
}

:root[data-theme="dark"] .callout-idea {
  background: var(--dark-soft-bg, rgba(99, 102, 241, 0.16));
  border-left-color: var(--dark-primary, #818cf8);
  color: var(--dark-pill-text, #c7d2fe);
}

:root[data-theme="dark"] .pill-green,
:root[data-theme="dark"] .badge-green {
  background: rgba(16, 185, 129, 0.22) !important;
  color: #6ee7b7 !important;
}

:root[data-theme="dark"] .pill-amber,
:root[data-theme="dark"] .badge-amber {
  background: rgba(245, 158, 11, 0.22) !important;
  color: #fde68a !important;
}

:root[data-theme="dark"] .pill-rose,
:root[data-theme="dark"] .badge-red {
  background: rgba(244, 63, 94, 0.24) !important;
  color: #fda4af !important;
}

:root[data-theme="dark"] .chart-frame {
  background: #ffffff !important;
  color: #0f172a !important;
}

/* Override pale inline card/callout hexes cleanly in Dark Mode */
:root[data-theme="dark"] [style*="background:#fff"],
:root[data-theme="dark"] [style*="background: #fff"],
:root[data-theme="dark"] [style*="background:#f8fafc"],
:root[data-theme="dark"] [style*="background: #f8fafc"] {
  background: #1e293b !important;
  color: #e2e8f0 !important;
}

:root[data-theme="dark"] [style*="background:#fffbeb"],
:root[data-theme="dark"] [style*="background:#fff7ed"] {
  background: rgba(245, 158, 11, 0.14) !important;
  border-color: rgba(245, 158, 11, 0.38) !important;
  color: #fde68a !important;
}

:root[data-theme="dark"] [style*="background:#eff6ff"],
:root[data-theme="dark"] [style*="background:#f0f9ff"],
:root[data-theme="dark"] [style*="background:#e0f2fe"],
:root[data-theme="dark"] [style*="background:#dbeafe"] {
  background: rgba(56, 189, 248, 0.14) !important;
  border-color: rgba(56, 189, 248, 0.35) !important;
  color: #bae6fd !important;
}

:root[data-theme="dark"] [style*="background:#ecfdf5"],
:root[data-theme="dark"] [style*="background:#f0fdf4"],
:root[data-theme="dark"] [style*="background:#d1fae5"],
:root[data-theme="dark"] [style*="background:#bbf7d0"] {
  background: rgba(16, 185, 129, 0.15) !important;
  border-color: rgba(16, 185, 129, 0.35) !important;
  color: #a7f3d0 !important;
}

:root[data-theme="dark"] [style*="background:#fff1f2"] {
  background: rgba(244, 63, 94, 0.14) !important;
  border-color: rgba(244, 63, 94, 0.35) !important;
  color: #fecdd3 !important;
}

:root[data-theme="dark"] [style*="color:#065f46"],
:root[data-theme="dark"] [style*="color:#047857"],
:root[data-theme="dark"] [style*="color:#064e3b"] {
  color: #6ee7b7 !important;
}

:root[data-theme="dark"] [style*="color:#92400e"],
:root[data-theme="dark"] [style*="color:#78350f"],
:root[data-theme="dark"] [style*="color:#9a3412"],
:root[data-theme="dark"] [style*="color:#b45309"],
:root[data-theme="dark"] [style*="color:#713f12"] {
  color: #fcd34d !important;
}

:root[data-theme="dark"] [style*="color:#1e3a8a"],
:root[data-theme="dark"] [style*="color:#1e40af"],
:root[data-theme="dark"] [style*="color:#0369a1"],
:root[data-theme="dark"] [style*="color:#0284c7"] {
  color: #93c5fd !important;
}

:root[data-theme="dark"] [style*="color:#334155"],
:root[data-theme="dark"] [style*="color:#475569"],
:root[data-theme="dark"] [style*="color:#1e293b"] {
  color: #cbd5e1 !important;
}

:root[data-theme="dark"] [style*="color:#9f1239"],
:root[data-theme="dark"] [style*="color:#881337"],
:root[data-theme="dark"] [style*="color:#991b1b"] {
  color: #fda4af !important;
}

:root[data-theme="dark"] .chart-frame,
:root[data-theme="dark"] .chart-frame[style],
:root[data-theme="dark"] .chart-frame img,
:root[data-theme="dark"] .topic-card img {
  background: #ffffff !important;
  color: #0f172a !important;
  border-radius: 8px;
}

label:has(> input[type="checkbox"]) {
  min-height: 44px;
}
