.ledger-table-wrap {
    width: 100%;
    overflow-x: auto;
}

.ledger-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.ledger-table thead {
    background: rgba(26, 26, 36, 0.9);
}

.ledger-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    text-align: left;
    color: var(--text-secondary);
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-size: 0.72rem;
    border-bottom: 1px solid var(--border);
    padding: 0.8rem 0.7rem;
}

.sort-button {
    appearance: none;
    background: none;
    border: none;
    color: inherit;
    font: inherit;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    cursor: pointer;
    padding: 0;
}

.sort-button:focus-visible {
    outline: 2px solid var(--accent-cyan);
    outline-offset: 2px;
    border-radius: 4px;
}

.sort-indicator {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.ledger-row {
    border-bottom: 1px solid var(--border-subtle);
    cursor: pointer;
}

.ledger-row:hover {
    background: rgba(26, 26, 36, 0.55);
}

.ledger-row:focus-visible {
    outline: 2px solid var(--accent-cyan);
    outline-offset: -2px;
}

.ledger-row td {
    padding: 0.75rem 0.7rem;
    vertical-align: middle;
}

.theme-main {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.theme-name {
    font-weight: 600;
}

.category-chip {
    display: inline-block;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.1rem 0.45rem;
    font-size: 0.7rem;
    color: var(--text-muted);
    max-width: max-content;
}

.value-mono {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}

.status-text {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.confidence-stack {
    display: flex;
    flex-direction: column;
    gap: 0.14rem;
}

.confidence-tier {
    text-transform: capitalize;
}

.quality-text {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.freshness-chip {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    border: 1px solid transparent;
    padding: 0.15rem 0.5rem;
    font-size: 0.75rem;
}

.freshness-fresh {
    color: var(--freshness-fresh);
    border-color: rgba(0, 212, 170, 0.3);
}

.freshness-recent {
    color: var(--freshness-recent);
    border-color: rgba(255, 159, 28, 0.35);
}

.freshness-warning {
    color: var(--freshness-warning);
    border-color: rgba(255, 107, 53, 0.35);
}

.freshness-stale {
    color: var(--freshness-stale);
    border-color: rgba(255, 56, 100, 0.35);
}

.freshness-unknown {
    color: var(--text-muted);
    border-color: var(--border);
}

.expansion-row {
    background: rgba(10, 10, 15, 0.8);
}

.expansion-cell {
    padding: 0.8rem 0.7rem 1rem;
}

.indicator-table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(10, 10, 15, 0.65);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    overflow: hidden;
}

.indicator-table th,
.indicator-table td {
    text-align: left;
    border-bottom: 1px solid var(--border-subtle);
    padding: 0.5rem 0.6rem;
    font-size: 0.78rem;
}

.indicator-table th {
    color: var(--text-muted);
    font-size: 0.7rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.indicator-table tr:last-child td {
    border-bottom: none;
}

.empty-state {
    color: var(--text-muted);
    font-size: 0.86rem;
    margin: 0;
    padding: 1rem;
}

.pair-drawer {
    border-top: 1px solid var(--border-subtle);
    background: rgba(8, 8, 12, 0.92);
    padding: 0.8rem 1rem 1rem;
}

.pair-drawer-inner h3 {
    margin: 0;
    font-size: 0.95rem;
}

.pair-drawer-subtitle {
    margin: 0.3rem 0 0.8rem;
    color: var(--text-muted);
    font-size: 0.78rem;
}

.pair-stats {
    margin: 0;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.5rem;
}

.pair-stats div {
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 0.4rem 0.5rem;
    background: rgba(255, 255, 255, 0.03);
}

.pair-stats dt {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.7rem;
    text-transform: uppercase;
}

.pair-stats dd {
    margin: 0.25rem 0 0;
    font-family: var(--font-mono);
    font-size: 0.8rem;
}

.pair-theme-grid {
    margin-top: 0.8rem;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.6rem;
}

.pair-theme-card {
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 0.55rem;
    background: rgba(255, 255, 255, 0.03);
}

.pair-theme-card h4 {
    margin: 0;
    font-size: 0.82rem;
}

.pair-theme-meta {
    margin: 0.2rem 0 0.45rem;
    font-size: 0.72rem;
    color: var(--text-muted);
}

.pair-theme-card dl {
    margin: 0;
}

.pair-theme-card dl div {
    display: flex;
    justify-content: space-between;
    gap: 0.4rem;
    font-size: 0.75rem;
    margin-top: 0.2rem;
}

.pair-theme-card dt {
    color: var(--text-muted);
}

.pair-theme-card dd {
    margin: 0;
    font-family: var(--font-mono);
}

.theme-detail-shell {
    padding: 1rem;
}

.theme-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.theme-detail-header h3 {
    margin: 0;
    font-size: 1rem;
}

.theme-detail-meta {
    margin: 0.2rem 0 0;
    color: var(--text-secondary);
    font-size: 0.82rem;
}

.theme-detail-stats {
    margin: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.35rem;
    min-width: 260px;
}

.theme-detail-stats div {
    display: flex;
    justify-content: space-between;
    gap: 0.4rem;
    font-size: 0.76rem;
}

.theme-detail-stats dt {
    color: var(--text-muted);
}

.theme-detail-stats dd {
    margin: 0;
    font-family: var(--font-mono);
}

.theme-detail-pair-note {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.theme-detail-proxy-note {
    margin: 0.35rem 0 0.8rem;
    color: var(--text-muted);
    font-size: 0.74rem;
}

.theme-detail-table-wrap {
    overflow-x: auto;
}

.theme-detail-table .momentum-cell {
    display: grid;
    grid-template-columns: 16px 1fr auto;
    gap: 0.35rem;
    align-items: center;
}

.momentum-arrow {
    font-weight: 700;
}

.momentum-proxy-bar {
    height: 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

.momentum-proxy-bar > span {
    display: block;
    height: 100%;
    background: #7dd3fc;
}

.momentum-up .momentum-arrow {
    color: var(--stress-stable);
}

.momentum-down .momentum-arrow {
    color: var(--stress-critical);
}

.momentum-flat .momentum-arrow {
    color: var(--text-muted);
}

.alert-register-shell {
    padding: 0.8rem 0.95rem 1rem;
}

.alert-filter-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.55rem;
    margin-bottom: 0.7rem;
}

.alert-filter-row label {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.alert-filter-row span {
    font-size: 0.72rem;
    color: var(--text-muted);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.alert-filter-row select {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
    font-size: 0.78rem;
    padding: 0.35rem 0.45rem;
}

.alert-filter-row select:focus-visible {
    outline: 2px solid var(--accent-cyan);
    outline-offset: 1px;
}

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

.alert-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.84rem;
}

.alert-table th,
.alert-table td {
    text-align: left;
    border-bottom: 1px solid var(--border-subtle);
    padding: 0.48rem 0.52rem;
    vertical-align: middle;
}

.alert-table th {
    color: var(--text-muted);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.alert-row {
    cursor: pointer;
}

.alert-row:hover {
    background: rgba(255, 255, 255, 0.04);
}

.alert-row:focus-visible {
    outline: 2px solid var(--accent-cyan);
    outline-offset: -2px;
}

.alert-row.is-selected {
    background: rgba(125, 211, 252, 0.12);
}

.alert-severity,
.alert-status {
    display: inline-flex;
    border-radius: 999px;
    border: 1px solid transparent;
    padding: 0.08rem 0.45rem;
    font-size: 0.72rem;
    text-transform: capitalize;
}

.severity-critical {
    color: var(--stress-critical);
    border-color: rgba(255, 45, 85, 0.35);
}

.severity-warning {
    color: var(--stress-approaching);
    border-color: rgba(255, 107, 53, 0.35);
}

.severity-info {
    color: #5bc0eb;
    border-color: rgba(91, 192, 235, 0.35);
}

.severity-unknown {
    color: var(--text-muted);
    border-color: var(--border);
}

.status-active {
    color: #7dd3fc;
    border-color: rgba(125, 211, 252, 0.35);
}

.status-resolved {
    color: var(--freshness-fresh);
    border-color: rgba(0, 212, 170, 0.35);
}

.status-unknown {
    color: var(--text-muted);
    border-color: var(--border);
}

.alert-drawer {
    margin-top: 0.75rem;
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    background: rgba(9, 10, 16, 0.86);
}

.alert-drawer-inner {
    padding: 0.7rem 0.8rem;
}

.alert-drawer-inner h3 {
    margin: 0;
    font-size: 0.95rem;
}

.alert-drawer-meta {
    margin: 0.25rem 0 0;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.alert-drawer-description {
    margin: 0.55rem 0 0.65rem;
    color: var(--text-primary);
    font-size: 0.8rem;
    line-height: 1.4;
}

.alert-meta-grid {
    margin: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.45rem;
}

.alert-meta-grid div {
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 0.35rem 0.45rem;
    background: rgba(255, 255, 255, 0.02);
}

.alert-meta-grid dt {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.alert-meta-grid dd {
    margin: 0.2rem 0 0;
    font-size: 0.74rem;
    font-family: var(--font-mono);
    word-break: break-word;
}

.alert-sync-note {
    margin: 0.6rem 0 0;
    color: var(--text-muted);
    font-size: 0.74rem;
}

.pattern-shell {
    padding: 0.85rem 0.95rem 1rem;
}

.pattern-header h3 {
    margin: 0;
    font-size: 1rem;
}

.pattern-subhead {
    margin: 0.35rem 0 0;
    color: var(--text-muted);
    font-size: 0.79rem;
}

.pattern-body {
    margin-top: 0.85rem;
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 0.75rem;
}

.pattern-list-block,
.pattern-radar-block {
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    background: rgba(12, 12, 18, 0.62);
    padding: 0.65rem;
}

.pattern-list-block h4 {
    margin: 0 0 0.5rem;
    color: var(--text-secondary);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.pattern-list {
    display: grid;
    gap: 0.45rem;
}

.pattern-item {
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-primary);
    text-align: left;
    padding: 0.5rem 0.55rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.45rem;
    cursor: pointer;
}

.pattern-item:hover {
    border-color: rgba(125, 211, 252, 0.5);
}

.pattern-item:focus-visible {
    outline: 2px solid var(--accent-cyan);
    outline-offset: 1px;
}

.pattern-item.is-active {
    border-color: rgba(0, 212, 170, 0.4);
    background: rgba(0, 212, 170, 0.11);
}

.pattern-item-main {
    display: grid;
    gap: 0.2rem;
}

.pattern-item-label {
    font-size: 0.84rem;
    font-weight: 600;
}

.pattern-item-period {
    color: var(--text-muted);
    font-size: 0.74rem;
}

.pattern-item-side {
    display: grid;
    gap: 0.2rem;
    text-align: right;
}

.pattern-similarity {
    font-size: 0.82rem;
    font-family: var(--font-mono);
}

.pattern-confidence {
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 0.08rem 0.38rem;
}

.confidence-high {
    color: var(--freshness-fresh);
    border-color: rgba(0, 212, 170, 0.35);
}

.confidence-medium {
    color: #7dd3fc;
    border-color: rgba(125, 211, 252, 0.35);
}

.confidence-low {
    color: var(--freshness-warning);
    border-color: rgba(255, 159, 28, 0.35);
}

.confidence-unknown {
    color: var(--text-muted);
    border-color: var(--border);
}

.pattern-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    color: var(--text-muted);
    font-size: 0.72rem;
    margin-bottom: 0.4rem;
}

.pattern-proxy-note {
    margin: 0.5rem 0 0;
    color: var(--text-muted);
    font-size: 0.72rem;
}

.pattern-diagnostics {
    margin-top: 0.75rem;
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    background: rgba(8, 10, 15, 0.7);
    padding: 0.7rem;
}

.pattern-diagnostics-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 0.75rem;
}

.pattern-diagnostics-grid h4 {
    margin: 0;
    font-size: 0.9rem;
}

.pattern-description {
    margin: 0.35rem 0 0.55rem;
    color: var(--text-secondary);
    font-size: 0.79rem;
    line-height: 1.4;
}

.pattern-kv {
    margin: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.35rem;
}

.pattern-kv div {
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 0.3rem 0.4rem;
}

.pattern-kv dt {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.pattern-kv dd {
    margin: 0.16rem 0 0;
    font-size: 0.74rem;
    font-family: var(--font-mono);
}

.pattern-diagnostics-grid h5 {
    margin: 0 0 0.25rem;
    font-size: 0.76rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.pattern-listing {
    margin: 0 0 0.55rem;
    padding-left: 1rem;
    color: var(--text-secondary);
    font-size: 0.74rem;
    max-height: 110px;
    overflow: auto;
}

@media (max-width: 768px) {
    .ledger-table th:nth-child(n + 4),
    .ledger-table td:nth-child(n + 4) {
        display: none;
    }

    .expansion-row td {
        display: table-cell !important;
    }

    .pair-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .pair-theme-grid {
        grid-template-columns: 1fr;
    }

    .theme-detail-header {
        flex-direction: column;
    }

    .theme-detail-stats {
        min-width: 0;
        width: 100%;
    }

    .alert-filter-row {
        grid-template-columns: 1fr;
    }

    .alert-table th:nth-child(3),
    .alert-table td:nth-child(3) {
        display: none;
    }

    .alert-meta-grid {
        grid-template-columns: 1fr;
    }

    .pattern-body {
        grid-template-columns: 1fr;
    }

    .pattern-diagnostics-grid {
        grid-template-columns: 1fr;
    }

    .pattern-kv {
        grid-template-columns: 1fr;
    }
}
