:root {
    --tap-bg: #0b1020;
    --tap-ink: #0f172a;
    --tap-muted: #64748b;
    --tap-accent: #0ea5e9;
    --tap-good: #16a34a;
    --tap-warn: #d97706;
    --tap-bad: #dc2626;
    --tap-card-bg: #ffffff;
    --tap-table-head: #eef4ff;
}

html {
    min-height: 100%;
    background: #f1f5f9;
}

body {
    min-height: 100vh;
    background:
        radial-gradient(circle at 10% -10%, rgba(14, 165, 233, 0.22), transparent 45%),
        radial-gradient(circle at 100% 0%, rgba(34, 197, 94, 0.14), transparent 35%),
        #f1f5f9;
    background-attachment: fixed;
    color: var(--tap-ink);
}

[data-theme="dark"] html {
    background: #0b1220;
}

[data-theme="dark"] body {
    min-height: 100vh;
    background:
        radial-gradient(circle at 10% -10%, rgba(14, 165, 233, 0.16), transparent 45%),
        radial-gradient(circle at 100% 0%, rgba(34, 197, 94, 0.09), transparent 35%),
        #0b1220;
    background-attachment: fixed;
    color: #dbe7ff;
}

.topbar {
    background: linear-gradient(120deg, #0b1020, #111a34 58%, #0e243c);
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.3);
}

.tap-logo {
    width: 36px;
    height: 36px;
    object-fit: contain;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    padding: 4px;
}

.brand {
    color: #e2e8f0;
    font-weight: 700;
    letter-spacing: 0.2px;
}

.navbar-toggler {
    border-color: rgba(226, 232, 240, 0.5);
}

.navbar-toggler:focus {
    box-shadow: none;
}

.navbar-toggler-icon {
    filter: invert(1);
}

.nav-link {
    color: #dbeafe;
    border-radius: 10px;
    padding: 0.5rem 0.75rem;
}

.nav-link:hover,
.nav-link:focus {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.nav-link.active,
.nav-link.show,
.dropdown-item.active {
    color: #fff !important;
    background: rgba(14, 165, 233, 0.28);
    box-shadow: inset 0 0 0 1px rgba(186, 230, 253, 0.32);
}

.dropdown-item.active {
    background: #2563eb;
}

.dropdown-menu {
    border-radius: 10px;
}

.tap-login-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
}

.tap-login-shell {
    width: min(440px, calc(100vw - 32px));
}

.tap-login-card {
    background: var(--tap-card-bg);
    border: 1px solid #dbe1ea;
    border-radius: 18px;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.18);
    padding: 1.5rem;
}

.tap-login-brand {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    margin-bottom: 1.25rem;
}

.tap-login-brand h1 {
    font-size: 1.35rem;
    margin: 0;
}

.tap-login-brand p {
    color: var(--tap-muted);
    margin: 0;
}

.tap-app-info-row {
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr);
    gap: 0.75rem;
    padding: 0.65rem 0;
    border-bottom: 1px solid #e2e8f0;
}

.tap-app-info-row:last-child {
    border-bottom: 0;
}

.tap-app-info-row span {
    color: var(--tap-muted);
    font-weight: 700;
}

.tap-app-info-row strong {
    min-width: 0;
    overflow-wrap: anywhere;
}

.page-title {
    margin: 0 0 1.2rem;
    font-size: 2rem;
    font-weight: 700;
}

main.container {
    max-width: min(1880px, calc(100vw - 32px));
}

.card,
.table-wrap,
.notice {
    border: 1px solid #dbe1ea;
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.table-wrap {
    overflow: hidden;
    background: var(--tap-card-bg);
}

.table-wrap-scroll {
    overflow-x: auto;
}

.table-readable {
    min-width: 100%;
    table-layout: auto;
}

.table-readable th,
.table-readable td {
    white-space: nowrap;
    vertical-align: middle;
}

.table-readable td:last-child {
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-operation {
    --bs-btn-color: #fff;
    --bs-btn-bg: #f97316;
    --bs-btn-border-color: #f97316;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #ea580c;
    --bs-btn-hover-border-color: #ea580c;
    --bs-btn-focus-shadow-rgb: 249, 115, 22;
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: #c2410c;
    --bs-btn-active-border-color: #c2410c;
    --bs-btn-disabled-color: #fff;
    --bs-btn-disabled-bg: #fdba74;
    --bs-btn-disabled-border-color: #fdba74;
}

.btn-primary,
.btn-info,
.btn-secondary,
.btn.btn-primary,
.btn.btn-info,
.btn.btn-secondary {
    color: #fff !important;
}

.btn-secondary,
.btn.btn-secondary {
    --bs-btn-color: #fff;
    --bs-btn-bg: #64748b;
    --bs-btn-border-color: #64748b;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #475569;
    --bs-btn-hover-border-color: #475569;
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: #334155;
    --bs-btn-active-border-color: #334155;
    --bs-btn-disabled-color: #fff;
}

.tap-cart-out {
    position: relative;
    display: inline-block;
    width: 1.25em;
    height: 1em;
    line-height: 1;
}

.tap-cart-out .fa-cart-shopping {
    position: absolute;
    left: 0;
    top: 0.08em;
}

.tap-cart-out .fa-arrow-up {
    position: absolute;
    right: -0.1em;
    top: -0.25em;
    font-size: 0.62em;
    filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.25));
}

.detail-grid .table-readable {
    font-size: 0.9rem;
}

.detail-grid .table-readable th,
.detail-grid .table-readable td {
    padding: 0.52rem 0.56rem;
}

.notice {
    padding: 0.9rem 1rem;
    background: #ecfeff;
    color: #0c4a6e;
}

.notice[data-level="success"] {
    background: #dcfce7;
    color: #14532d;
}

.notice[data-level="error"],
.notice.is-error {
    background: #fee2e2;
    color: #7f1d1d;
}

.metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.metric {
    background: var(--tap-card-bg);
    border: 1px solid #dbe1ea;
    border-radius: 10px;
    padding: 0.75rem 0.85rem;
}

.metric span {
    color: var(--tap-muted);
    font-size: 0.82rem;
}

.metric strong {
    display: block;
    margin-top: 0.2rem;
    font-size: 1.15rem;
    line-height: 1.2;
}

.dashboard-top-grid {
    display: grid;
    grid-template-columns: minmax(640px, 1fr) minmax(190px, 230px);
    gap: 1rem;
    align-items: stretch;
}

.dashboard-panel {
    background: var(--tap-card-bg);
    border: 1px solid #dbe1ea;
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
    padding: 1rem;
}

.dashboard-news-panel {
    min-height: 250px;
}

.dashboard-summary-panel {
    display: flex;
    align-items: center;
    padding-block: 0.7rem;
    min-height: 250px;
}

.dashboard-summary-grid {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
}

.summary-stat {
    min-width: 0;
    padding: 0.88rem 0.15rem;
    border-top: 1px solid #e2e8f0;
    text-align: center;
}

.summary-stat:first-child {
    border-top: 0;
}

.summary-stat i {
    display: block;
    color: #38bdf8;
    font-size: 1.22rem;
    margin-bottom: 0.34rem;
}

.summary-stat span {
    display: block;
    color: var(--tap-muted);
    font-size: 0.88rem;
    font-weight: 650;
}

.summary-stat strong {
    display: block;
    margin-top: 0.26rem;
    font-size: 1.34rem;
    line-height: 1.2;
}

.tap-inline-select {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
}

.tap-inline-select .form-select {
    width: auto;
    min-width: 128px;
}

.dashboard-grid {
    row-gap: 1rem;
}

.dashboard-panel h2 {
    margin-bottom: 0.65rem;
}

.dashboard-flat-panel {
    min-width: 0;
}

.dashboard-flat-panel h2 {
    margin-bottom: 0.65rem;
}

.live-hero {
    display: grid;
    grid-template-columns: minmax(360px, 1fr) minmax(520px, 0.95fr);
    gap: 1rem;
    align-items: stretch;
}

.live-hero-main,
.live-kpi-panel,
.live-filter-panel,
.live-table-panel {
    background: var(--tap-card-bg);
    border: 1px solid #dbe1ea;
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.live-hero-main {
    padding: 1.15rem;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 1rem;
    align-items: center;
    min-height: 150px;
}

.live-hero-copy {
    min-width: 0;
}

.live-hero-controls {
    display: grid;
    gap: 0.7rem;
    justify-items: end;
    align-content: center;
}

.live-status-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.5rem;
    max-width: 430px;
}

.live-status {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.35rem 0.65rem;
    border-radius: 999px;
    font-size: 0.84rem;
    font-weight: 750;
    background: #e2e8f0;
    color: #334155;
}

.live-status span {
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 999px;
    background: #64748b;
}

.live-status.is-live {
    background: #dcfce7;
    color: #166534;
}

.live-status.is-live span {
    background: #16a34a;
    box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.14);
}

.live-status.is-stale {
    background: #fef3c7;
    color: #92400e;
}

.live-status.is-stale span {
    background: #d97706;
}

.live-last-tick {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.55rem;
    color: var(--tap-muted);
}

.live-last-tick strong {
    color: var(--tap-ink);
    font-size: 1.4rem;
}

.live-last-tick span {
    font-weight: 750;
    color: #0f766e;
}

.live-last-tick small {
    color: var(--tap-muted);
}

.live-kpi-grid {
    height: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
    align-content: center;
}

.live-kpi {
    min-width: 0;
    border-left: 1px solid #e2e8f0;
}

.live-kpi:first-child {
    border-left: 0;
}

.live-kpi i {
    color: #38bdf8;
}

.live-kpi-panel {
    padding: 0.7rem;
    min-width: 0;
}

.live-kpi strong {
    overflow-wrap: anywhere;
}

.live-filter-panel {
    padding: 0.9rem;
}

.tap-marker-choice-list {
    display: grid;
    gap: 0.6rem;
    text-align: left;
}

.tap-marker-choice {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    width: 100%;
    border: 1px solid #dbeafe;
    border-radius: 8px;
    background: #f8fafc;
    color: var(--tap-ink);
    padding: 0.75rem 0.85rem;
    text-align: left;
}

.tap-marker-choice:hover {
    border-color: #60a5fa;
    background: #eff6ff;
}

.live-filters {
    gap: 0.75rem;
}

.live-filter-control {
    min-width: 160px;
}

.live-filter-search {
    min-width: min(360px, 100%);
    flex: 1 1 320px;
}

.live-table-panel {
    overflow: hidden;
}

.live-table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1rem 0.35rem;
}

.live-table-panel .bootstrap-table {
    padding: 0 1rem 1rem;
}

.live-table-panel .fixed-table-container {
    border-radius: 10px;
    overflow: hidden;
}

.live-table-panel .table td,
.live-table-panel .table th {
    vertical-align: middle;
    white-space: nowrap;
}

.live-table-panel .table td:nth-child(5) {
    font-weight: 750;
}

.detail-grid {
    display: grid;
    grid-template-columns: minmax(560px, 1.06fr) minmax(560px, 1.06fr) minmax(420px, 0.88fr);
    gap: 1.25rem;
    align-items: start;
}

.detail-grid > section {
    min-width: 0;
}

.summary {
    background: var(--tap-card-bg);
    padding: 1rem;
}

.tap-tabs {
    gap: 0.5rem;
}

.tap-tabs-actionbar {
    align-items: center;
}

.tap-actionbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    align-items: center;
    justify-content: space-between;
}

.tap-actionbar-main {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
}

.tap-inline-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.tap-inline-filters .form-select {
    width: auto;
    min-width: 190px;
}

.tap-tabs .nav-link i,
.tap-actionbar .btn i {
    width: 1.05rem;
}

.tap-tabs .nav-link {
    border-radius: 10px;
    border: 1px solid #c8d5e6;
    color: #1e293b;
    background: #fff;
    padding: 0.55rem 0.95rem;
}

.tap-tabs .nav-link.active {
    background: #0ea5e9;
    border-color: #0ea5e9;
    color: #fff;
}

.theme-toggle-btn {
    background: #f59e0b;
    border-color: #f59e0b;
    color: #111827;
    font-weight: 700;
}

.theme-toggle-btn:hover,
.theme-toggle-btn:focus {
    background: #d97706;
    border-color: #d97706;
    color: #111827;
}

.tap-rule-filters {
    display: grid;
    grid-template-columns: minmax(180px, 1.5fr) minmax(130px, 0.7fr) minmax(130px, 0.7fr) auto;
    gap: 0.65rem;
    align-items: end;
}

.tap-rule-row.is-hidden,
.tap-source-row.is-hidden,
.tap-market-row.is-hidden {
    display: none;
}

.badge.low {
    background: var(--tap-good);
}

.badge.medium {
    background: var(--tap-warn);
}

.badge.high {
    background: var(--tap-bad);
}

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    align-items: end;
}

.filters input,
.filters select,
.filters button,
.filters .btn {
    min-height: 40px;
}

.dashboard-news-updated {
    color: var(--tap-muted);
    font-size: 0.86rem;
    margin-left: auto;
}

.news-results-counter {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 0.75rem;
    border-radius: 10px;
    background: #e0f2fe;
    color: #075985;
    font-weight: 700;
}

.news-results-counter i {
    color: #0284c7;
}

.source-form {
    display: grid;
    grid-template-columns: minmax(80px, 120px) minmax(150px, 1fr) auto;
    gap: 8px;
}

.source-form textarea {
    grid-column: 1 / -1;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 0.5rem;
}

.bootstrap-table .fixed-table-toolbar {
    padding: 0.8rem;
}

.bootstrap-table .fixed-table-toolbar:empty {
    display: none;
    padding: 0;
}

.bootstrap-table .table {
    margin-bottom: 0;
}

.bootstrap-table .table thead th {
    background: var(--tap-table-head);
    color: #1e293b;
}

.tap-chart-card {
    background: var(--tap-card-bg);
}

.tap-chart-box {
    position: relative;
    min-height: 340px;
}

.tap-chart-box-dashboard {
    min-height: 380px;
}

.dashboard-chart-panel {
    width: 100%;
}

.tap-chart-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    align-items: end;
}

.tap-chart-controls .form-select {
    min-width: 160px;
}

.tap-pre {
    background: #f8fafc;
    color: #0f172a;
    border: 1px solid #dbe1ea;
    border-radius: 10px;
    padding: 0.85rem;
}

.tap-help-pre {
    margin: 0;
    text-align: left;
    white-space: pre-wrap;
    font-family: inherit;
    line-height: 1.45;
}

.tap-help-content {
    text-align: left;
    line-height: 1.55;
}

.tap-help-content h3 {
    font-size: 1rem;
    margin: 1rem 0 0.35rem;
    color: #0f172a;
}

.tap-help-content p,
.tap-help-content li {
    color: #334155;
}

.tap-help-content ul {
    padding-left: 1.2rem;
    margin-bottom: 0.65rem;
}

.tap-help-lead {
    padding: 0.85rem 1rem;
    border-left: 4px solid #0ea5e9;
    background: #eff6ff;
    border-radius: 10px;
}

.tap-help-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.8rem;
    margin: 0.8rem 0;
}

.tap-help-card {
    border: 1px solid #dbe1ea;
    border-radius: 10px;
    padding: 0.85rem;
    background: #f8fafc;
}

.tap-help-card strong {
    color: #0f172a;
}

.tap-help-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    border-radius: 999px;
    padding: 0.18rem 0.55rem;
    margin: 0.12rem;
    font-size: 0.82rem;
    font-weight: 700;
}

.tap-help-pill.is-good {
    background: #dcfce7;
    color: #14532d;
}

.tap-help-pill.is-warn {
    background: #fef3c7;
    color: #78350f;
}

.tap-help-pill.is-bad {
    background: #fee2e2;
    color: #7f1d1d;
}

details summary {
    cursor: pointer;
}

.tap-summary-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

[data-theme="dark"] {
    --tap-card-bg: #111b2d;
    --tap-table-head: #1c2940;
}

[data-theme="dark"] body,
[data-theme="dark"] p,
[data-theme="dark"] span,
[data-theme="dark"] div,
[data-theme="dark"] li,
[data-theme="dark"] td,
[data-theme="dark"] th {
    color: #dbe7ff;
}

[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3,
[data-theme="dark"] h4,
[data-theme="dark"] h5,
[data-theme="dark"] h6,
[data-theme="dark"] .page-title,
[data-theme="dark"] .modal-title,
[data-theme="dark"] .form-label {
    color: #e8f1ff;
}

[data-theme="dark"] .brand,
[data-theme="dark"] .nav-link {
    color: #cfe1ff;
}

[data-theme="dark"] .settings-toggle.show,
[data-theme="dark"] .settings-toggle:active,
[data-theme="dark"] .settings-toggle:focus {
    color: #ffffff !important;
    background: #1f3150;
}

[data-theme="dark"] .dropdown-menu {
    background: #16233a;
    border-color: #2b3b5f;
}

[data-theme="dark"] .dropdown-item {
    color: #dbe7ff;
}

[data-theme="dark"] .dropdown-item:hover,
[data-theme="dark"] .dropdown-item:focus {
    background: #1f3150;
    color: #ffffff;
}

[data-theme="dark"] .summary {
    border: 1px solid #233455;
}

[data-theme="dark"] .card,
[data-theme="dark"] .table-wrap,
[data-theme="dark"] .notice,
[data-theme="dark"] .metric {
    border-color: #233455;
    box-shadow: 0 10px 30px rgba(2, 6, 23, 0.5);
}

[data-theme="dark"] .notice {
    background: #10273b;
    color: #cdeafe;
}

[data-theme="dark"] .notice[data-level="success"] {
    background: #0f2e21;
    color: #bbf7d0;
    border-color: #166534;
}

[data-theme="dark"] .notice[data-level="error"],
[data-theme="dark"] .notice.is-error {
    background: #3b1218;
    color: #fecdd3;
    border-color: #7f1d1d;
}

[data-theme="dark"] .table,
[data-theme="dark"] .table td,
[data-theme="dark"] .table th {
    color: #dbe7ff;
    border-color: #263757;
}

[data-theme="dark"] .table tbody,
[data-theme="dark"] .table tbody tr,
[data-theme="dark"] .table tbody td {
    background: #111b2d !important;
}

[data-theme="dark"] .table-striped > tbody > tr:nth-of-type(odd) > * {
    background: #15213a !important;
}

[data-theme="dark"] .bootstrap-table .table thead th {
    color: #dbe7ff;
}

[data-theme="dark"] .bootstrap-table .fixed-table-container,
[data-theme="dark"] .bootstrap-table .fixed-table-body,
[data-theme="dark"] .bootstrap-table .table {
    background: #111b2d;
}

[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
    background: #0f1a2c;
    color: #dbe7ff;
    border-color: #2a3d61;
}

[data-theme="dark"] .form-control::placeholder {
    color: #8ca4c9;
}

[data-theme="dark"] .text-secondary,
[data-theme="dark"] small,
[data-theme="dark"] .form-check-label {
    color: #9fb5d8 !important;
}

[data-theme="dark"] .text-muted,
[data-theme="dark"] .text-body-secondary {
    color: #9fb5d8 !important;
}

[data-theme="dark"] .source-form textarea,
[data-theme="dark"] .source-form input {
    background: #0f1a2c;
    color: #dbe7ff;
    border-color: #2a3d61;
}

[data-theme="dark"] .table a {
    color: #7dd3fc;
}

[data-theme="dark"] a {
    color: #7dd3fc;
}

[data-theme="dark"] a:hover {
    color: #bae6fd;
}

[data-theme="dark"] .tap-tabs .nav-link {
    background: #0f1a2c;
    border-color: #2a3d61;
    color: #cfe1ff;
}

[data-theme="dark"] .tap-tabs .nav-link.active {
    background: #0284c7;
    border-color: #0284c7;
    color: #fff;
}

[data-theme="dark"] .modal-content {
    background: #111b2d;
    color: #dbe7ff;
    border: 1px solid #2a3d61;
}

[data-theme="dark"] .modal-body,
[data-theme="dark"] .modal-header,
[data-theme="dark"] .modal-footer {
    background: #111b2d;
}

[data-theme="dark"] .modal-header,
[data-theme="dark"] .modal-footer {
    border-color: #2a3d61;
}

[data-theme="dark"] .btn-close {
    filter: invert(1) grayscale(1) brightness(200%);
}

[data-theme="dark"] .table thead th {
    background: #1c2940;
}

[data-theme="dark"] .card.p-3,
[data-theme="dark"] section.card,
[data-theme="dark"] .summary {
    background: #111b2d !important;
}

[data-theme="dark"] .tap-chart-card {
    background: #111b2d !important;
}

[data-theme="dark"] .tap-pre,
[data-theme="dark"] details,
[data-theme="dark"] summary {
    background: #0f1a2c !important;
    color: #dbe7ff;
    border-color: #233455;
}

[data-theme="dark"] .tap-help-content h3,
[data-theme="dark"] .tap-help-content p,
[data-theme="dark"] .tap-help-content li {
    color: #dbe7ff;
}

[data-theme="dark"] .tap-help-lead {
    background: #10273b;
    border-color: #38bdf8;
}

[data-theme="dark"] .tap-help-card {
    background: #0f1a2c;
    border-color: #2a3d61;
}

[data-theme="dark"] .tap-help-card strong {
    color: #e8f1ff;
}

[data-theme="dark"] .form-check-input {
    background-color: #0f1a2c;
    border-color: #45608b;
}

[data-theme="dark"] input,
[data-theme="dark"] textarea,
[data-theme="dark"] select {
    color: #dbe7ff;
}

[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder {
    color: #8ca4c9 !important;
    opacity: 1;
}

[data-theme="dark"] .fixed-table-toolbar .search input,
[data-theme="dark"] .fixed-table-toolbar .form-control,
[data-theme="dark"] .fixed-table-toolbar .btn {
    background: #0f1a2c;
    color: #dbe7ff;
    border-color: #2a3d61;
}

[data-theme="dark"] .fixed-table-toolbar .btn:hover {
    background: #1a2a45;
}

[data-theme="dark"] a.btn,
[data-theme="dark"] .btn-primary,
[data-theme="dark"] .btn-info,
[data-theme="dark"] .btn-secondary {
    color: #fff !important;
}

[data-theme="dark"] .pagination .page-link {
    background: #0f1a2c;
    color: #cfe1ff;
    border-color: #2a3d61;
}

[data-theme="dark"] .pagination .page-item.active .page-link {
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
}

[data-theme="dark"] .swal2-popup {
    background: #111b2d;
    color: #dbe7ff;
    border: 1px solid #2a3d61;
}

[data-theme="dark"] .swal2-title,
[data-theme="dark"] .swal2-html-container {
    color: #dbe7ff;
}

.news-list {
    display: grid;
    gap: 12px;
}

.news-list-page {
    gap: 14px;
}

.news-ticker {
    max-height: none;
    overflow: visible;
    padding-top: 0.25rem;
    padding-right: 0;
    scrollbar-width: thin;
}

.news-ticker-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) max-content;
    gap: 1.15rem;
    align-items: start;
    padding: 0.65rem 0;
    border-top: 1px solid #e2e8f0;
}

.news-ticker-item:first-child {
    border-top: 0;
    padding-top: 0;
}

.news-ticker-title {
    display: block;
    color: var(--tap-ink);
    font-weight: 650;
    line-height: 1.28;
}

.news-ticker-meta {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    color: var(--tap-muted);
    font-size: 0.82rem;
    white-space: nowrap;
}

.news-item {
    padding: 14px;
    border: 1px solid #d8e1ef;
    border-radius: 8px;
    background: #fff;
}

.news-item h2,
.news-item h3 {
    line-height: 1.3;
}

.news-item a {
    color: #1d4ed8;
    text-decoration: none;
}

.news-item a:hover {
    text-decoration: underline;
}

.news-open-btn {
    white-space: nowrap;
}

.news-open-btn:hover {
    text-decoration: none;
}

[data-theme="dark"] .news-item {
    background: #0f1a2c;
    border-color: #2a3d61;
}

[data-theme="dark"] .news-item a {
    color: #93c5fd;
}

[data-theme="dark"] .dashboard-panel {
    background: #0f1a2c;
    border-color: #2a3d61;
}

[data-theme="dark"] .summary-stat {
    border-color: #2a3d61;
}

[data-theme="dark"] .live-hero-main,
[data-theme="dark"] .live-kpi-panel,
[data-theme="dark"] .live-filter-panel,
[data-theme="dark"] .live-table-panel {
    background: #0f1a2c;
    border-color: #2a3d61;
}

[data-theme="dark"] .live-kpi {
    border-color: #2a3d61;
}

[data-theme="dark"] .live-table-panel .fixed-table-container,
[data-theme="dark"] .live-table-panel .fixed-table-body,
[data-theme="dark"] .live-table-panel .table {
    background: #0f1a2c;
}

[data-theme="dark"] .live-kpi span,
[data-theme="dark"] .live-last-tick small,
[data-theme="dark"] .live-filter-control label {
    color: #a7bddf;
}

[data-theme="dark"] .live-last-tick strong {
    color: #dbe7ff;
}

[data-theme="dark"] .tap-marker-choice {
    background: #111d31;
    border-color: #2a3d61;
    color: #dbe7ff;
}

[data-theme="dark"] .tap-marker-choice:hover {
    background: #172642;
    border-color: #38bdf8;
}

[data-theme="dark"] .live-last-tick span {
    color: #7dd3fc;
}

[data-theme="dark"] .live-status.is-live {
    background: #123524;
    color: #bbf7d0;
}

[data-theme="dark"] .live-status.is-stale {
    background: #3d2d10;
    color: #fde68a;
}

.live-status.is-error {
    background: #fee2e2;
    color: #991b1b;
}

[data-theme="dark"] .live-status.is-error {
    background: #451a1a;
    color: #fecaca;
}

.live-runtime-meta small {
    color: var(--tap-muted);
}

.live-control-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: flex-end;
}

.live-icon-btn {
    width: 2.35rem;
    height: 2.35rem;
    display: inline-grid;
    place-items: center;
    border-radius: 999px;
    color: #fff;
    border: 0;
    padding: 0;
}

.live-icon-btn:hover,
.live-icon-btn:focus {
    color: #fff;
    filter: brightness(0.96);
}

.live-icon-btn.is-start {
    background: #16a34a;
}

.live-icon-btn.is-stop {
    background: #dc2626;
}

.live-icon-btn.is-info {
    background: #2563eb;
}

[data-theme="dark"] .live-runtime-meta small {
    color: #a7bddf;
}

[data-theme="dark"] .news-ticker-item {
    border-color: #2a3d61;
}

[data-theme="dark"] .news-ticker-title {
    color: #dbe7ff;
}

[data-theme="dark"] .summary-stat i {
    color: #7dd3fc;
}

[data-theme="dark"] .news-results-counter {
    background: #12324c;
    color: #dbeafe;
}

[data-theme="dark"] .tap-login-card,
[data-theme="dark"] .tap-app-info-modal {
    background: #0f1a2c;
    border-color: #2a3d61;
}

[data-theme="dark"] .alert-success {
    color: #bbf7d0;
    background-color: #123524;
    border-color: #1f6f44;
}

[data-theme="dark"] .alert-danger {
    color: #fecaca;
    background-color: #451a1a;
    border-color: #7f1d1d;
}

[data-theme="dark"] .tap-app-info-row {
    border-color: #2a3d61;
}

@media (max-width: 1700px) {
    .detail-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .detail-grid > section:last-child {
        grid-column: 1 / -1;
    }
}

@media (max-width: 900px) {
    .metrics {
        grid-template-columns: 1fr;
    }

    .dashboard-top-grid,
    .dashboard-summary-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-summary-panel {
        min-height: auto;
        padding-block: 0.65rem;
    }

    .dashboard-summary-grid {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .summary-stat {
        border-top: 0;
        border-left: 1px solid #e2e8f0;
        padding: 0.5rem 0.25rem;
    }

    .summary-stat:first-child {
        border-left: 0;
    }

    .summary-stat i {
        font-size: 1rem;
        margin-bottom: 0.2rem;
    }

    .summary-stat span {
        font-size: 0.7rem;
    }

    .summary-stat strong {
        font-size: 0.95rem;
    }

    .news-ticker-item {
        grid-template-columns: 1fr;
        gap: 0.35rem;
    }

    .news-ticker-meta {
        justify-content: flex-start;
    }

    .news-results-counter {
        margin-left: 0 !important;
    }

    .dashboard-summary-panel {
        padding-block: 1rem;
    }

    .tap-chart-box-dashboard {
        min-height: 300px;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }

    .detail-grid > section:last-child {
        grid-column: auto;
    }

    .live-hero {
        grid-template-columns: 1fr;
    }

    .live-hero-main {
        grid-template-columns: 1fr;
    }

    .live-hero-controls,
    .live-status-row,
    .live-control-actions {
        justify-content: flex-start;
        justify-items: start;
    }

    .live-kpi-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .live-kpi {
        border-top: 0;
        border-left: 1px solid #e2e8f0;
        padding: 0.5rem 0.25rem;
    }

    .live-kpi:first-child {
        border-left: 0;
    }

    .live-kpi i {
        font-size: 1rem;
        margin-bottom: 0.2rem;
    }

    .live-kpi span {
        font-size: 0.68rem;
    }

    .live-kpi strong {
        font-size: 0.9rem;
    }

    .live-table-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .tap-rule-filters {
        grid-template-columns: 1fr;
    }

    .tap-help-grid {
        grid-template-columns: 1fr;
    }
}

.tap-setup-card {
    border-color: rgba(20, 184, 166, 0.28);
    background:
        radial-gradient(circle at top right, rgba(20, 184, 166, 0.12), transparent 30%),
        var(--tap-card-bg);
}

.tap-setup-step {
    height: 100%;
    border: 1px solid #dbe1ea;
    border-radius: 16px;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.68);
}

.tap-setup-step > i {
    width: 42px;
    height: 42px;
    display: inline-grid;
    place-items: center;
    border-radius: 14px;
    margin-bottom: 0.75rem;
    color: #0f766e;
    background: rgba(20, 184, 166, 0.14);
}

[data-theme="dark"] .tap-setup-card {
    border-color: #2a3d61;
    background:
        radial-gradient(circle at top right, rgba(45, 212, 191, 0.10), transparent 32%),
        #0f1a2c;
}

[data-theme="dark"] .tap-setup-step {
    background: rgba(15, 26, 44, 0.86);
    border-color: #2a3d61;
}

[data-theme="dark"] .tap-setup-step > i {
    color: #5eead4;
    background: rgba(45, 212, 191, 0.13);
}

.tap-setup-only {
    min-height: calc(100vh - 180px);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.tap-results-counter {
    align-self: end;
    justify-self: end;
    color: var(--tap-muted);
    font-size: 0.92rem;
    font-weight: 700;
    white-space: nowrap;
}

[data-theme="dark"] .tap-results-counter {
    color: #cbd5e1;
}

[data-theme="dark"] input[type="date"],
[data-theme="dark"] input[type="time"],
[data-theme="dark"] input[type="datetime-local"] {
    color-scheme: dark;
}

[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator,
[data-theme="dark"] input[type="time"]::-webkit-calendar-picker-indicator,
[data-theme="dark"] input[type="datetime-local"]::-webkit-calendar-picker-indicator {
    filter: invert(1) brightness(1.8);
    opacity: 0.92;
}
