/* ═══════════════════════════════════════════════════════
   TUI Mode — Keyboard-focused overlay for work queues
   Activated via ?tui=1 query param
   ═══════════════════════════════════════════════════════ */

body.tui-mode {
    background: #0d1117 !important;
    color: #c9d1d9 !important;
    font-family: 'JetBrains Mono', 'Cascadia Code', 'Fira Code', 'Consolas', monospace !important;
    font-size: 13px;
    line-height: 1.5;
}

/* ── Hide mouse-oriented chrome ── */
body.tui-mode .navbar { display: none !important; }
body.tui-mode .alert-dismissible .btn-close { display: none; }
body.tui-mode main.container { max-width: 100%; padding: 0; margin: 0; }
body.tui-mode .pw { max-width: 100%; padding: 0; }

/* ── Status bar (top) ── */
.tui-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #161b22;
    border-bottom: 1px solid #30363d;
    padding: 0.3rem 1rem;
    position: sticky;
    top: 0;
    z-index: 1000;
    font-size: 12px;
}

.tui-bar-left { display: flex; align-items: center; gap: 1rem; }
.tui-bar-right { display: flex; align-items: center; gap: 1rem; color: #8b949e; }

.tui-bar a, .tui-bar-queue {
    color: #58a6ff;
    text-decoration: none;
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
}

.tui-bar-queue.active {
    background: #58a6ff;
    color: #0d1117;
    font-weight: 700;
}

.tui-bar-queue:hover:not(.active) { background: #21262d; }

.tui-bar-count {
    color: #8b949e;
    font-size: 11px;
    margin-left: 0.2rem;
}

.tui-bar-hint {
    color: #484f58;
    font-size: 11px;
}

.tui-bar-hint kbd {
    background: #21262d;
    border: 1px solid #30363d;
    border-radius: 3px;
    padding: 0 0.3rem;
    font-family: inherit;
    font-size: 11px;
    color: #c9d1d9;
}

/* ── Split pane layout ── */
.tui-split {
    display: flex;
    height: calc(100vh - 32px);
    overflow: hidden;
}

.tui-left {
    flex: 0 0 50%;
    overflow-y: auto;
    border-right: 1px solid #30363d;
}

.tui-right {
    flex: 1;
    overflow: hidden;
    background: #0d1117;
    display: flex;
    flex-direction: column;
}

.tui-right-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #484f58;
    font-size: 12px;
}

.tui-right iframe, .tui-right img {
    width: 100%;
    height: 100%;
    border: none;
}

.tui-right-tabs {
    display: flex;
    background: #161b22;
    border-bottom: 1px solid #30363d;
    padding: 0 0.5rem;
}

.tui-right-tab {
    padding: 0.3rem 0.75rem;
    color: #8b949e;
    font-size: 11px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
}

.tui-right-tab.active {
    color: #58a6ff;
    border-bottom-color: #58a6ff;
}

.tui-right-tab kbd {
    background: #21262d;
    border: 1px solid #30363d;
    border-radius: 2px;
    padding: 0 0.2rem;
    font-family: inherit;
    font-size: 10px;
    margin-right: 0.3rem;
}

/* ── Bill list ── */
.tui-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.tui-item {
    display: block;
    padding: 0.5rem 1rem;
    border-bottom: 1px solid #21262d;
    cursor: pointer;
    text-decoration: none;
    color: #c9d1d9;
    transition: background 0.05s;
}

.tui-item:hover { background: #161b22; color: #c9d1d9; }

.tui-item.tui-focused {
    background: #1f6feb !important;
    color: #fff !important;
}

.tui-item.tui-focused .tui-item-meta,
.tui-item.tui-focused .tui-item-flags { color: rgba(255,255,255,0.7) !important; }

.tui-item-row {
    display: flex;
    align-items: baseline;
    gap: 1rem;
}

.tui-item-id {
    color: #58a6ff;
    font-size: 11px;
    min-width: 10ch;
}

.tui-focused .tui-item-id { color: #a5d6ff; }

.tui-item-patient {
    font-weight: 600;
    flex: 1;
}

.tui-item-charge {
    color: #3fb950;
    text-align: right;
    min-width: 8ch;
}

.tui-focused .tui-item-charge { color: #7ee787; }

.tui-item-meta {
    color: #8b949e;
    font-size: 11px;
    margin-top: 0.15rem;
}

.tui-item-flags {
    margin-top: 0.2rem;
}

.tui-flag {
    display: inline-block;
    font-size: 10px;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    margin-right: 0.3rem;
}

.tui-flag-hard { background: #da3633; color: #fff; }
.tui-flag-soft { background: #9e6a03; color: #fff; }

/* ── Inline search ── */
body.tui-mode .pw-search {
    display: flex;
    padding: 0.4rem 1rem;
    background: #161b22;
    border-bottom: 1px solid #30363d;
    gap: 0.5rem;
}

body.tui-mode .pw-search input[type="text"] {
    background: #0d1117;
    border: 1px solid #30363d;
    color: #c9d1d9;
    font-family: inherit;
    font-size: 12px;
    padding: 0.3rem 0.5rem;
    border-radius: 3px;
    flex: 1;
}

body.tui-mode .pw-search input:focus {
    border-color: #58a6ff;
    outline: none;
}

body.tui-mode .pw-search button {
    background: #21262d;
    border: 1px solid #30363d;
    color: #c9d1d9;
    font-family: inherit;
    font-size: 12px;
    padding: 0.3rem 0.75rem;
    border-radius: 3px;
    cursor: pointer;
}

/* ── Lane tabs in TUI ── */
body.tui-mode .pw-lanes { display: none; }
body.tui-mode .pw-subs { display: none; }
body.tui-mode .pw-workers { display: none; }
body.tui-mode .pw-back { display: none; }
body.tui-mode .pw-pag { background: #161b22; border-top: 1px solid #30363d; padding: 0.4rem 1rem; color: #8b949e; }
body.tui-mode .pw-pag a { color: #58a6ff; }

/* ── Global dark overrides for all template elements ── */
body.tui-mode, body.tui-mode * {
    color: #c9d1d9;
}

body.tui-mode .card,
body.tui-mode [style*="background:#fff"],
body.tui-mode [style*="background: #fff"],
body.tui-mode [style*="background:#f"],
body.tui-mode [style*="background: #f"] {
    background: #161b22 !important;
    border-color: #30363d !important;
    color: #c9d1d9 !important;
}

body.tui-mode .text-muted { color: #8b949e !important; }
body.tui-mode .text-dark { color: #c9d1d9 !important; }
body.tui-mode a { color: #58a6ff !important; }
body.tui-mode .badge { font-size: 10px; }
body.tui-mode .alert { background: #21262d !important; border-color: #30363d !important; color: #c9d1d9 !important; }

/* ── Existing bill cards → list items ── */
body.tui-mode .pw-bill {
    display: block;
    padding: 0.5rem 1rem;
    border: none !important;
    border-bottom: 1px solid #21262d !important;
    border-radius: 0 !important;
    background: transparent !important;
    color: #c9d1d9 !important;
    margin: 0;
    box-shadow: none !important;
}

body.tui-mode .pw-bill:hover { background: #161b22 !important; }
body.tui-mode .pw-bill.tui-focused { background: #1f6feb !important; }
body.tui-mode .pw-bill.tui-focused, body.tui-mode .pw-bill.tui-focused * { color: #fff !important; }
body.tui-mode .pw-bill-id { color: #58a6ff !important; font-size: 11px; }
body.tui-mode .pw-bill-patient { color: #c9d1d9 !important; font-weight: 600; }
body.tui-mode .pw-bill-meta { color: #8b949e !important; font-size: 11px; }
body.tui-mode .pw-bill-top { display: flex; justify-content: space-between; }
body.tui-mode .pw-empty { color: #484f58 !important; }

/* ── Pipeline lane/sub tabs ── */
body.tui-mode .pw-lane { background: #161b22 !important; color: #8b949e !important; border-color: #30363d !important; }
body.tui-mode .pw-lane.active { background: #1f6feb !important; color: #fff !important; }
body.tui-mode .pw-lane-count { background: #21262d !important; color: #8b949e !important; }
body.tui-mode .pw-lane.active .pw-lane-count { background: rgba(255,255,255,0.2) !important; color: #fff !important; }
body.tui-mode .pw-lanes { border-color: #30363d !important; }

body.tui-mode .pw-sub { background: #161b22 !important; color: #8b949e !important; border-color: #30363d !important; }
body.tui-mode .pw-sub.active { background: #0E4D64 !important; color: #fff !important; border-color: #0E4D64 !important; }
body.tui-mode .pw-sub-count { background: #21262d !important; }

body.tui-mode .pw-worker { background: #161b22 !important; color: #8b949e !important; border-color: #30363d !important; }
body.tui-mode .pw-worker.active { background: #0E4D64 !important; color: #fff !important; }

/* ── Flags ── */
body.tui-mode .pw-flag-hard { background: #da3633 !important; color: #fff !important; }
body.tui-mode .pw-flag-soft { background: #9e6a03 !important; color: #fff !important; }

/* ── Auth status badges ── */
body.tui-mode .pw-auth-ready { background: #9e6a03 !important; color: #fff !important; }
body.tui-mode .pw-auth-reviewing { background: #1f6feb !important; color: #fff !important; }
body.tui-mode .pw-auth-pending { background: #21262d !important; color: #8b949e !important; }
body.tui-mode .pw-auth-review-link { background: #21262d !important; border-color: #30363d !important; color: #a78bfa !important; }

/* ── Inline style overrides for banners ── */
body.tui-mode div[style*="background:#f5f3ff"],
body.tui-mode div[style*="background:#fffbeb"] {
    background: #21262d !important;
    border-color: #30363d !important;
    color: #c9d1d9 !important;
}

/* ── Help overlay ── */
.tui-help-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.8);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.tui-help-overlay.visible { display: flex; }

.tui-help {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 8px;
    padding: 1.5rem 2rem;
    max-width: 620px;
    width: 90%;
    color: #c9d1d9;
}

.tui-help h3 {
    color: #58a6ff;
    font-size: 14px;
    margin: 0 0 1rem;
    font-weight: 700;
}

.tui-help-section {
    margin-bottom: 1rem;
}

.tui-help-section h4 {
    color: #8b949e;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 0 0.4rem;
}

.tui-help-row {
    display: flex;
    justify-content: space-between;
    padding: 0.2rem 0;
    font-size: 12px;
}

.tui-help-row kbd {
    background: #21262d;
    border: 1px solid #30363d;
    border-radius: 3px;
    padding: 0.1rem 0.4rem;
    font-family: inherit;
    min-width: 2.5ch;
    text-align: center;
}

/* ── Action bar (bottom) ── */
.tui-action-bar {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    background: #161b22;
    border-top: 1px solid #30363d;
    padding: 0.3rem 1rem;
    font-size: 11px;
    color: #8b949e;
}

.tui-action-bar kbd {
    background: #21262d;
    border: 1px solid #30363d;
    border-radius: 2px;
    padding: 0 0.3rem;
    font-family: inherit;
    color: #c9d1d9;
    margin-right: 0.2rem;
}

/* ── Scrollbar ── */
body.tui-mode ::-webkit-scrollbar { width: 6px; }
body.tui-mode ::-webkit-scrollbar-track { background: #0d1117; }
body.tui-mode ::-webkit-scrollbar-thumb { background: #30363d; border-radius: 3px; }
body.tui-mode ::-webkit-scrollbar-thumb:hover { background: #484f58; }

/* ═══════════════════════════════════════════════════════
   Bill Detail — TUI overrides
   ═══════════════════════════════════════════════════════ */

body.tui-mode .bill-detail {
    max-width: none;
    width: calc(55% - 1rem);
    margin: 0;
    margin-right: 45%;
    padding: 0.5rem 1rem;
    font-family: 'JetBrains Mono', 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
    font-size: 12px;
}

body.tui-mode .bill-detail .card {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 4px;
}

body.tui-mode .bill-detail .card-header {
    background: #21262d;
    border-bottom: 1px solid #30363d;
    color: #8b949e;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.3rem 0.5rem;
}

body.tui-mode .bill-detail .card-body {
    padding: 0.4rem 0.5rem;
    color: #c9d1d9;
    font-size: 12px;
}

body.tui-mode .bill-detail .card-body strong { color: #e6edf3; }

body.tui-mode .bill-detail .bill-id { color: #58a6ff; font-size: 14px; }

body.tui-mode .bill-detail .progress {
    background: #21262d;
    border: 1px solid #30363d;
    border-radius: 4px;
    overflow: hidden;
}

body.tui-mode .bill-detail .progress-step {
    color: #8b949e;
    background: #21262d;
    font-size: 11px;
    padding: 0.3rem 0.5rem;
}

body.tui-mode .bill-detail .progress-step.complete { background: #0d419d; color: #a5d6ff; }
body.tui-mode .bill-detail .progress-step.current { background: #1f6feb; color: #fff; font-weight: 700; }

body.tui-mode .bill-detail .flags { background: #2d1b00; border-color: #9e6a03; color: #e3b341; }
body.tui-mode .bill-detail .flags.clear { background: #0a2e12; border-color: #238636; color: #3fb950; }

body.tui-mode .bill-detail .actions { padding: 0.4rem 0; }
body.tui-mode .bill-detail .actions .btn {
    background: #21262d;
    border: 1px solid #30363d;
    color: #c9d1d9;
    font-family: inherit;
    font-size: 11px;
    padding: 0.3rem 0.6rem;
    border-radius: 3px;
}

body.tui-mode .bill-detail .actions .btn:hover { border-color: #58a6ff; color: #58a6ff; }
body.tui-mode .bill-detail .actions .btn-primary { background: #1f6feb !important; border-color: #1f6feb !important; color: #fff !important; }
body.tui-mode .bill-detail .actions .btn-primary:hover { background: #388bfd !important; }

body.tui-mode .bill-detail table { color: #c9d1d9; font-size: 12px; }
body.tui-mode .bill-detail table th { color: #8b949e; border-color: #30363d; font-size: 11px; }
body.tui-mode .bill-detail table td { border-color: #21262d; }
body.tui-mode .bill-detail a { color: #58a6ff !important; }
body.tui-mode .bill-detail .edit-link { color: #58a6ff !important; font-size: 11px; }
body.tui-mode .bill-detail .section-title { color: #e6edf3 !important; }
body.tui-mode .bill-detail .column-header { color: #8b949e !important; font-size: 11px; text-transform: uppercase; }
body.tui-mode .bill-detail .column-header.bill { border-color: #1f6feb !important; }
body.tui-mode .bill-detail .column-header.order { border-color: #238636 !important; }

/* Bill detail form elements */
body.tui-mode .bill-detail input,
body.tui-mode .bill-detail select,
body.tui-mode .bill-detail textarea {
    background: #0d1117 !important;
    border: 1px solid #30363d !important;
    color: #c9d1d9 !important;
    font-family: inherit;
}

body.tui-mode .bill-detail input:focus,
body.tui-mode .bill-detail select:focus,
body.tui-mode .bill-detail textarea:focus {
    border-color: #58a6ff !important;
    outline: none;
}

/* Modals */
body.tui-mode .modal-content,
body.tui-mode .modal-overlay > div {
    background: #161b22 !important;
    border: 1px solid #30363d !important;
    color: #c9d1d9 !important;
}

body.tui-mode .modal-header { border-color: #30363d !important; }
body.tui-mode .modal-footer { border-color: #30363d !important; }

/* Rate suggestion styling */
body.tui-mode .suggested-rate { color: #8b949e !important; }
body.tui-mode .rate-accept { background: #238636 !important; color: #fff !important; border: none !important; }
body.tui-mode .rate-source { font-size: 10px; }
body.tui-mode .status-priced { color: #3fb950 !important; }

/* History / notes */
body.tui-mode .note-item,
body.tui-mode .history-item {
    border-color: #21262d !important;
    color: #c9d1d9 !important;
}

/* Back dropdown */
body.tui-mode .back-dropdown-toggle { background: #21262d !important; border-color: #30363d !important; color: #c9d1d9 !important; }
body.tui-mode .back-dropdown-menu { background: #161b22 !important; border-color: #30363d !important; }
body.tui-mode .back-dropdown-menu a { color: #c9d1d9 !important; }
body.tui-mode .back-dropdown-menu a:hover { background: #21262d !important; }

/* ── Map to Order / Re-Map search ── */
body.tui-mode .map-search-fields .search-field label { color: #8b949e !important; }
body.tui-mode .map-search-fields .search-field input {
    background: #0d1117 !important;
    border: 1px solid #30363d !important;
    color: #c9d1d9 !important;
    font-family: inherit;
}
body.tui-mode .map-search-fields .search-field input:focus { border-color: #58a6ff !important; box-shadow: none !important; }
body.tui-mode .map-search-fields .btn-search { background: #1f6feb !important; }
body.tui-mode .map-search-fields .btn-search:hover { background: #388bfd !important; }

/* Map result cards */
body.tui-mode .map-result-item {
    background: #161b22 !important;
    border: 1px solid #30363d !important;
    color: #c9d1d9 !important;
}
body.tui-mode .map-result-item:hover { border-color: #58a6ff !important; box-shadow: 0 0 0 1px #58a6ff !important; }
body.tui-mode .mr-name { color: #e6edf3 !important; }
body.tui-mode .mr-info { color: #c9d1d9 !important; }
body.tui-mode .map-hint { color: #484f58 !important; }
body.tui-mode .map-results { color: #c9d1d9 !important; }
body.tui-mode .remap-warning { color: #e3b341 !important; background: #2d1b00 !important; border-color: #9e6a03 !important; }
body.tui-mode .remap-cancel { color: #c9d1d9 !important; }

/* Map action button in results */
body.tui-mode .mr-map-btn,
body.tui-mode .map-result-item button,
body.tui-mode .map-result-item .btn {
    background: #238636 !important;
    color: #fff !important;
    border: none !important;
}

/* Line item table */
body.tui-mode .line-table,
body.tui-mode .line-items-table,
body.tui-mode .bill-detail table {
    background: #0d1117 !important;
    border-color: #30363d !important;
}
body.tui-mode .line-table th,
body.tui-mode .bill-detail table th {
    background: #161b22 !important;
    color: #8b949e !important;
    border-color: #30363d !important;
}
body.tui-mode .line-table td,
body.tui-mode .bill-detail table td {
    border-color: #21262d !important;
    color: #c9d1d9 !important;
}
body.tui-mode .bill-detail table tr { border-color: #21262d !important; }
body.tui-mode .bill-detail table tr:hover { background: #161b22 !important; }
body.tui-mode .line-table .cpt { color: #e6edf3 !important; }
body.tui-mode .line-table .status-priced { color: #3fb950 !important; }
body.tui-mode .line-table .status-pending { color: #e3b341 !important; }
body.tui-mode .line-table .edit { color: #58a6ff !important; }

/* Info rows in cards */
body.tui-mode .info-row { border-color: #21262d !important; }
body.tui-mode .info-label { color: #8b949e !important; }
body.tui-mode .info-value { color: #c9d1d9 !important; }

/* Guided entry / misc */
body.tui-mode .gate-tooltip { background: #161b22 !important; border-color: #30363d !important; color: #c9d1d9 !important; }
body.tui-mode .gate-tooltip ul li { color: #f85149 !important; }
body.tui-mode .remap-search-card { background: #161b22 !important; }

/* ── Map search result detail elements ── */
body.tui-mode .mr-meta { color: #8b949e !important; }
body.tui-mode .mr-name { color: #e6edf3 !important; }
body.tui-mode .match-score { font-size: 11px; }
body.tui-mode .match-score.good { background: #0a2e12 !important; color: #3fb950 !important; }
body.tui-mode .match-score.partial { background: #2d1b00 !important; color: #e3b341 !important; }
body.tui-mode .match-score.poor { background: #3d0e0e !important; color: #f85149 !important; }

/* CPT comparison rows in map results */
body.tui-mode .mr-cpt-row,
body.tui-mode .mr-cpt-match,
body.tui-mode .mr-cpt-miss,
body.tui-mode .mr-cpt-note { color: #c9d1d9 !important; }

/* ── Catch-all for remaining bill detail elements ── */
body.tui-mode .bill-detail .btn { color: #c9d1d9 !important; }
body.tui-mode .bill-detail .btn:hover { color: #58a6ff !important; }
body.tui-mode .bill-detail .btn-primary { color: #fff !important; }
body.tui-mode .bill-detail .btn-primary:hover { color: #fff !important; }

body.tui-mode .columns { color: #c9d1d9 !important; }
body.tui-mode .progress { background: #21262d !important; border-color: #30363d !important; }
body.tui-mode .progress-step { background: #21262d !important; color: #8b949e !important; border-color: #30363d !important; }
body.tui-mode .progress-step.complete { background: #0d419d !important; color: #a5d6ff !important; }
body.tui-mode .progress-step.current { background: #1f6feb !important; color: #fff !important; }
body.tui-mode .progress-step.escalated { background: #da3633 !important; color: #fff !important; }
body.tui-mode .progress-step.rejected { background: #6e7681 !important; color: #fff !important; }

/* Notes & history */
body.tui-mode .notes-history { color: #c9d1d9 !important; }
body.tui-mode .note-item { background: #161b22 !important; border-color: #30363d !important; }
body.tui-mode .history-item { border-color: #21262d !important; }
body.tui-mode .note-meta, body.tui-mode .history-meta { color: #8b949e !important; }

/* Side panels (EOBR, docs, fax) */
body.tui-mode .eobr-panel,
body.tui-mode .docs-panel,
body.tui-mode .fax-panel {
    background: #0d1117 !important;
    border-color: #30363d !important;
    color: #c9d1d9 !important;
}
body.tui-mode .eobr-panel-tabs button,
body.tui-mode .auth-doc-item {
    background: #161b22 !important;
    color: #8b949e !important;
    border-color: #30363d !important;
}
body.tui-mode .eobr-panel-tabs button.active,
body.tui-mode .auth-doc-item.active {
    background: #21262d !important;
    color: #58a6ff !important;
}
body.tui-mode .eobr-regen-footer,
body.tui-mode .fax-panel-footer {
    background: #161b22 !important;
    border-color: #30363d !important;
}

/* Fax panel */
body.tui-mode .fax-panel-body label { color: #8b949e !important; }
body.tui-mode .fax-panel-body input,
body.tui-mode .fax-panel-body select,
body.tui-mode .fax-panel-body textarea {
    background: #0d1117 !important;
    border-color: #30363d !important;
    color: #c9d1d9 !important;
}
body.tui-mode .fax-reason-card {
    background: #161b22 !important;
    border-color: #30363d !important;
    color: #c9d1d9 !important;
}
body.tui-mode .fax-reason-card:hover { border-color: #58a6ff !important; }
body.tui-mode .fax-reason-card.selected { border-color: #1f6feb !important; background: #0d2d4d !important; }
body.tui-mode .fax-reason-card p { color: #8b949e !important; }
body.tui-mode .fax-status.pending { background: #2d1b00 !important; color: #e3b341 !important; }
body.tui-mode .fax-status.failed { background: #3d0e0e !important; color: #f85149 !important; }
body.tui-mode .fax-history-item { color: #c9d1d9 !important; }

/* Suggested rate row */
body.tui-mode .suggested-rate { color: #8b949e !important; }
body.tui-mode .cpt-desc { color: #6e7681 !important; }

/* Flag tags */
body.tui-mode .flag-tag { background: #2d1b00 !important; color: #e3b341 !important; border-color: #9e6a03 !important; }
body.tui-mode .flag-hard { background: #3d0e0e !important; color: #f85149 !important; border-color: #da3633 !important; }
body.tui-mode .flag-resolve { color: #3fb950 !important; }

/* Messages */
body.tui-mode .messages .alert { background: #161b22 !important; border-color: #30363d !important; }

/* Modal overlays */
body.tui-mode .modal-overlay {
    background: rgba(0,0,0,0.7) !important;
}
body.tui-mode .modal-overlay .modal-box,
body.tui-mode .modal-content {
    background: #161b22 !important;
    border: 1px solid #30363d !important;
    color: #c9d1d9 !important;
}
body.tui-mode .modal-overlay h3,
body.tui-mode .modal-overlay h4 { color: #e6edf3 !important; }
body.tui-mode .modal-overlay label { color: #8b949e !important; }
body.tui-mode .modal-overlay input,
body.tui-mode .modal-overlay select,
body.tui-mode .modal-overlay textarea {
    background: #0d1117 !important;
    border-color: #30363d !important;
    color: #c9d1d9 !important;
}

/* TUI PDF panel — fixed right side */
body.tui-mode .pdf-panel {
    position: fixed;
    top: 32px;
    right: 0;
    width: 45%;
    height: calc(100vh - 32px);
    background: #0d1117;
    border-left: 1px solid #30363d;
    z-index: 100;
}

body.tui-mode .pdf-panel.open { right: 0; }
body.tui-mode .pdf-panel-header {
    background: #161b22;
    border-bottom: 1px solid #30363d;
    color: #c9d1d9;
    padding: 0.3rem 0.75rem;
    font-size: 12px;
}

/* TUI bill detail bar */
.tui-bill-bar {
    display: none;
}

body.tui-mode .tui-bill-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #161b22;
    border-bottom: 1px solid #30363d;
    padding: 0.3rem 1rem;
    position: sticky;
    top: 0;
    z-index: 1000;
    font-size: 12px;
    font-family: 'JetBrains Mono', 'Cascadia Code', monospace;
}

.tui-bill-bar-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.tui-bill-bar-left a {
    color: #58a6ff;
    text-decoration: none;
}

.tui-bill-bar-right {
    color: #484f58;
    font-size: 11px;
}

.tui-bill-bar-right kbd {
    background: #21262d;
    border: 1px solid #30363d;
    border-radius: 3px;
    padding: 0 0.3rem;
    font-family: inherit;
    font-size: 11px;
    color: #c9d1d9;
}
