#miscWorkspace .section-card {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    padding: 1rem;
    margin-bottom: 1rem;
}
#miscWorkspace .section-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: #0f172a;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e9ecef;
}

/* Label Editor grid */
#tableLabelsGrid th {
    background: #f8f9fa;
    font-weight: 600;
    font-size: 0.8rem;
    color: #0f172a;
}
#tableLabelsGrid td:first-child {
    vertical-align: middle !important;
    background: #fafbfc;
}
#tableLabelsGrid .label-input {
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
}

/* Scrollable label grid with frozen header */
#tableLabelsGrid {
    max-height: 50vh;
    overflow-y: auto;
    border: 1px solid #dee2e6;
    border-radius: 0.25rem;
}
#tableLabelsGrid table {
    margin-bottom: 0;
}
#tableLabelsGrid thead {
    position: sticky;
    top: 0;
    z-index: 2;
}
#tableLabelsGrid thead th {
    background: #e9ecef;
    box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}

/* Misc module colour-mode bridge. The module contains server-rendered settings,
   dynamic tables and documentation, so keep all overrides under one body scope. */
.misc-module {
    --misc-header-height: 66px;
    --misc-ink: #172033;
    --misc-muted: #64748b;
    --misc-line: #dce4ef;
    --misc-line-strong: #c8d4e4;
    --misc-surface: #ffffff;
    --misc-surface-soft: #f8fafc;
    --misc-surface-raised: #ffffff;
    --misc-canvas: #f4f7fb;
    --misc-input: #ffffff;
    --misc-hover: #eef4ff;
    --misc-primary: #2563eb;
    --misc-primary-soft: #eaf2ff;
    --misc-shadow: 0 12px 30px rgba(15,23,42,.09);
    background: var(--misc-canvas);
    color: var(--misc-ink);
}

html[data-pp-theme="dark"] .misc-module {
    --misc-ink: #e7edf7;
    --misc-muted: #9eacc0;
    --misc-line: #2d3d56;
    --misc-line-strong: #41516b;
    --misc-surface: #111a2b;
    --misc-surface-soft: #162238;
    --misc-surface-raised: #18243a;
    --misc-canvas: #0b1120;
    --misc-input: #0f1829;
    --misc-hover: #1a2a43;
    --misc-primary: #60a5fa;
    --misc-primary-soft: #1d3760;
    --misc-shadow: 0 18px 42px rgba(0,0,0,.32);
}

.misc-module .main-area,
.misc-module .right-workspace,
.misc-module .workspace-content,
.misc-module #miscWorkspace,
.misc-module #miscTabContent {
    color: var(--misc-ink);
    background: var(--misc-canvas) !important;
}

.misc-module .misc-table-panel {
    color: var(--misc-ink);
    background: var(--misc-surface) !important;
    border-color: var(--misc-line) !important;
}

/* The data-source and workspace context rows use identical geometry. */
.misc-module .misc-panel-header,
.misc-module #miscToolbar {
    box-sizing: border-box;
    flex: 0 0 var(--misc-header-height);
    width: 100%;
    height: var(--misc-header-height);
    min-height: var(--misc-header-height);
    max-height: var(--misc-header-height);
    margin: 0;
    padding: 10px 14px !important;
    align-items: center;
    color: var(--misc-ink);
    background: var(--misc-surface) !important;
    border-color: var(--misc-line) !important;
}
.misc-module .misc-panel-header { display: flex; justify-content: space-between; }
.misc-module .misc-panel-header > div,
.misc-module .misc-toolbar-context { display: grid; min-width: 0; line-height: 1.05; }
.misc-module .misc-panel-header strong,
.misc-module .misc-toolbar-context strong { color: var(--misc-ink); font-size: .84rem; }
.misc-module .misc-panel-kicker,
.misc-module .misc-toolbar-context small {
    margin-bottom: 5px;
    color: var(--misc-muted);
    font-size: .64rem;
    font-weight: 800;
    letter-spacing: .07em;
    text-transform: uppercase;
}
.misc-module .misc-table-count {
    min-width: 28px;
    height: 24px;
    padding: 0 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--misc-muted);
    background: var(--misc-surface-soft);
    border: 1px solid var(--misc-line);
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 800;
}
.misc-module .misc-toolbar-icon {
    width: 34px;
    height: 34px;
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    color: var(--misc-primary);
    background: var(--misc-primary-soft);
    border-radius: 10px;
}
.misc-module .misc-toolbar-hint { color: var(--misc-muted); font-size: .7rem; }
.misc-module .misc-toolbar-hint i { margin-right: 5px; color: #10b981; }

/* Compact table rail for large projects. */
.misc-module .misc-table-panel .table-list { padding: 7px 6px 10px; }
.misc-module .misc-table-panel .table-list li {
    min-height: 34px;
    margin: 1px 0;
    padding: 4px 8px;
    gap: 7px;
    color: var(--misc-ink);
    background: transparent;
    border: 0;
    border-radius: 8px;
    font-size: .76rem;
}
.misc-module .misc-table-panel .table-list li > i {
    width: 23px;
    height: 23px;
    margin: 0 !important;
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    color: var(--misc-muted);
    background: var(--misc-surface-soft);
    border-radius: 7px;
    font-size: .7rem;
}
.misc-module .misc-table-panel .table-list li:hover { color: var(--misc-ink); background: var(--misc-hover); }
.misc-module .misc-table-panel .table-list li.active {
    color: #fff !important;
    background: linear-gradient(135deg,#1d66df,#3580ee) !important;
    box-shadow: 0 5px 14px rgba(37,99,235,.2);
}
.misc-module .misc-table-panel .table-list li.active > i { color: #fff; background: rgba(255,255,255,.18); }

.misc-module #miscTabs,
.misc-module #labelsSubTabs { border-color: var(--misc-line); gap: .2rem; }
.misc-module #miscTabs .nav-link,
.misc-module #labelsSubTabs .nav-link {
    color: var(--misc-primary);
    background: transparent;
    border-color: transparent;
    font-weight: 650;
}
.misc-module #miscTabs .nav-link:hover,
.misc-module #labelsSubTabs .nav-link:hover { color: var(--misc-ink); background: var(--misc-hover); border-color: var(--misc-line) var(--misc-line) transparent; }
.misc-module #miscTabs .nav-link.active,
.misc-module #labelsSubTabs .nav-link.active { color: var(--misc-ink); background: var(--misc-surface); border-color: var(--misc-line) var(--misc-line) var(--misc-surface); }

.misc-module #miscWorkspace .section-card,
.misc-module #smsDocsPanel .card,
.misc-module .accordion-item,
.misc-module .accordion-button,
.misc-module .accordion-body {
    color: var(--misc-ink) !important;
    background: var(--misc-surface) !important;
    border-color: var(--misc-line) !important;
}
.misc-module #miscWorkspace .section-card { box-shadow: var(--misc-shadow); }
.misc-module #miscWorkspace .section-title {
    color: var(--misc-ink);
    border-color: var(--misc-line);
}
.misc-module .accordion-button:not(.collapsed) { color: var(--misc-primary) !important; background: var(--misc-primary-soft) !important; }
.misc-module .accordion-button::after { filter: none; }
html[data-pp-theme="dark"] .misc-module .accordion-button::after { filter: invert(1) grayscale(100%) brightness(180%); }

.misc-module h1,
.misc-module h2,
.misc-module h3,
.misc-module h4,
.misc-module h5,
.misc-module h6,
.misc-module label,
.misc-module .form-label { color: var(--misc-ink); }
.misc-module .text-muted,
.misc-module .text-secondary,
.misc-module .form-text { color: var(--misc-muted) !important; }
.misc-module hr,
.misc-module .border,
.misc-module .border-top,
.misc-module .border-bottom { border-color: var(--misc-line) !important; }

.misc-module :where(.form-control, .form-select, .input-group-text, textarea, input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="url"]) {
    color: var(--misc-ink) !important;
    background-color: var(--misc-input) !important;
    border-color: var(--misc-line-strong) !important;
}
.misc-module :where(.form-control, textarea, input)::placeholder { color: var(--misc-muted) !important; opacity: .82; }
.misc-module :where(.form-control, .form-select):focus { border-color: #60a5fa !important; box-shadow: 0 0 0 .2rem rgba(59,130,246,.16) !important; }
.misc-module :where(.form-control, .form-select):disabled { color: var(--misc-muted) !important; background: var(--misc-surface-soft) !important; }
.misc-module .form-check-input { background-color: var(--misc-input); border-color: var(--misc-line-strong); }
.misc-module .form-check-input:checked { background-color: #1675f8; border-color: #1675f8; }

.misc-module .table,
.misc-module .table-responsive,
.misc-module #tableLabelsGrid,
.misc-module .list-group-item {
    --bs-table-bg: var(--misc-surface);
    --bs-table-color: var(--misc-ink);
    --bs-table-border-color: var(--misc-line);
    color: var(--misc-ink) !important;
    background: var(--misc-surface) !important;
    border-color: var(--misc-line) !important;
}
.misc-module .table > :not(caption) > * > * { color: var(--misc-ink) !important; background: var(--misc-surface) !important; border-color: var(--misc-line) !important; }
.misc-module .table thead > tr > *,
.misc-module #tableLabelsGrid thead th { color: var(--misc-ink) !important; background: var(--misc-surface-soft) !important; }
.misc-module #tableLabelsGrid td:first-child { background: var(--misc-surface-soft) !important; }

.misc-module pre,
.misc-module pre.bg-light,
.misc-module code {
    color: #334155;
    background: var(--misc-surface-soft) !important;
    border-color: var(--misc-line) !important;
}
html[data-pp-theme="dark"] .misc-module pre,
html[data-pp-theme="dark"] .misc-module pre.bg-light,
html[data-pp-theme="dark"] .misc-module code { color: #c4b5fd; }

/* Languages and custom-provider dialogs. */
.misc-module :where(#languagesModal, #customProviderModal) .modal-content {
    overflow: hidden;
    color: var(--misc-ink) !important;
    background: var(--misc-surface-raised) !important;
    border: 1px solid var(--misc-line) !important;
    border-radius: 14px;
    box-shadow: 0 24px 60px rgba(0,0,0,.28) !important;
}
.misc-module :where(#languagesModal, #customProviderModal) .modal-header {
    min-height: 54px;
    padding: .65rem .85rem !important;
    border-color: rgba(255,255,255,.18) !important;
}
.misc-module :where(#languagesModal, #customProviderModal) .modal-title { color: #fff !important; }
.misc-module :where(#languagesModal, #customProviderModal) .btn-close {
    box-sizing: border-box;
    width: 32px;
    height: 32px;
    margin: 0 0 0 auto;
    padding: 8px;
    border-radius: 9px;
    opacity: .82;
}
.misc-module :where(#languagesModal, #customProviderModal) .btn-close:hover { background-color: rgba(255,255,255,.16); opacity: 1; }

/* Semantic theme contract: module chrome and dialogs follow the active
   application tokens, including theme variants added after this module. */
.misc-module :where(.section-card, .section-header, .toolbar, .tabs, .tab-content, .misc-table-panel, .misc-settings-panel) {
    background-color: var(--misc-surface) !important;
    color: var(--misc-ink) !important;
    border-color: var(--misc-line) !important;
}
.misc-module :where(.section-header, .panel-header, .card-header, .tabs) {
    background-color: var(--misc-surface-soft) !important;
}
.misc-module :where(#languagesModal, #customProviderModal) .modal-header {
    background: var(--misc-surface-soft) !important;
    color: var(--misc-ink) !important;
    border-color: var(--misc-line) !important;
}
.misc-module :where(#languagesModal, #customProviderModal) .modal-title { color: var(--misc-ink) !important; }
.misc-module :where(#languagesModal, #customProviderModal) .btn-close {
    filter: none !important;
    color: var(--misc-ink) !important;
}
.misc-module :where(#languagesModal, #customProviderModal) .modal-body,
.misc-module :where(#languagesModal, #customProviderModal) .modal-footer {
    color: var(--misc-ink) !important;
    background: var(--misc-surface-raised) !important;
    border-color: var(--misc-line) !important;
}
.misc-module :where(#languagesModal, #customProviderModal) .modal-body { padding: .9rem !important; }
.misc-module :where(#languagesModal, #customProviderModal) .modal-footer { padding: .7rem .9rem !important; }
html[data-pp-theme="dark"] .misc-module .modal-backdrop.show { opacity: .68; }

@media (max-width: 767.98px) {
    .misc-module { --misc-header-height: 60px; }
    .misc-module .main-area { flex-direction: column !important; }
    .misc-module .left-panel { width: 100% !important; max-height: 40vh; overflow-y: auto; flex-shrink: 0; }
    .misc-module .left-panel.collapsed { max-height: 0; overflow: hidden; }
    .misc-module .right-workspace { width: 100% !important; flex: 1 1 auto; }
    .misc-module .misc-panel-header,
    .misc-module #miscToolbar { padding: 8px 10px !important; }
    .misc-module .misc-table-panel .table-list li { min-height: 36px; }
    .misc-module #miscTabs { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; }
    .misc-module #miscTabs .nav-link { white-space: nowrap; }
}

@media (prefers-reduced-motion: reduce) {
    .misc-module *,
    .misc-module *::before,
    .misc-module *::after { transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* Field-help ⓘ icons (injected by initMiscTooltips) */
.misc-hint {
    font-size: .78em;
    margin-left: 3px;
    color: var(--pp-text-muted, #94a3b8);
    cursor: help;
    vertical-align: baseline;
    opacity: .75;
    transition: color .12s ease, opacity .12s ease;
}
.misc-hint:hover { color: var(--pp-accent, #4f46e5); opacity: 1; }

/* Default Date/Time — live offset + clock readout beside the timezone select */
.adv-tz-row { display: flex; align-items: center; gap: .5rem; }
.adv-tz-row #advTimezone { flex: 1 1 auto; min-width: 0; }
.adv-tz-info {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    min-width: 8.5rem;
    justify-content: center;
    padding: .32rem .6rem;
    border: 1px solid var(--pp-border, #dbe3ee);
    border-radius: .5rem;
    background: var(--pp-surface-muted, #f1f5f9);
    color: var(--pp-text, #172033);
    font-variant-numeric: tabular-nums;
    font-size: .82rem;
    font-weight: 600;
    white-space: nowrap;
}
.adv-tz-info:empty { display: none; }
.adv-tz-info .adv-tz-off { color: var(--pp-accent, #2563eb); font-weight: 700; }
