/* Backing Monitor - Light Theme */

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: #f8fafc;
    color: #1e293b;
}

/* Summary cards */
.summary-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    padding: 1.25rem;
    transition: box-shadow 0.15s;
}
.summary-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}
.card-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
}
.card-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #0f172a;
    margin-top: 0.25rem;
}
.card-value.positive { color: #16a34a; }
.card-value.negative { color: #dc2626; }
.card-value.warning { color: #d97706; }

/* Asset index cards */
.asset-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.15s;
}
.asset-card:hover {
    border-color: #3b82f6;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.1);
    transform: translateY(-1px);
}

/* Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
}
.data-table th {
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    padding: 0.75rem 1rem;
    border-bottom: 2px solid #e2e8f0;
}
.data-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.875rem;
}
.data-table tr:hover td {
    background: #f8fafc;
}

/* Percentage bar */
.pct-bar-container {
    width: 100%;
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
}
.pct-bar {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s;
}

/* Tags */
.tag {
    display: inline-block;
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    margin-left: 0.375rem;
}
.tag-amo { background: #fef2f2; color: #dc2626; }
.tag-circular { background: #fef2f2; color: #dc2626; }
.tag-cross-chain { background: #eff6ff; color: #2563eb; }
.tag-idle { background: #f0fdf4; color: #16a34a; }
.tag-htx { background: #fef2f2; color: #dc2626; }

/* Risk flags */
.risk-flag {
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    border-left: 4px solid;
}
.risk-critical {
    background: #fef2f2;
    border-color: #dc2626;
    color: #991b1b;
}
.risk-warning {
    background: #fffbeb;
    border-color: #d97706;
    color: #92400e;
}
.risk-info {
    background: #eff6ff;
    border-color: #3b82f6;
    color: #1e40af;
}

/* Section panels */
.panel {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    scroll-margin-top: 3rem;
}
#chart-panel { scroll-margin-top: 3rem; }
.panel-title {
    font-size: 1rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 1rem;
}

/* ====== 5-axis frame ====== */
/* Each risk axis is a top-level section; the head carries a numbered marker,
   the axis title, a one-line summary, and the computed rating chip. */
.axis-section { margin-bottom: 2rem; scroll-margin-top: 3rem; }
.axis-head {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.5rem 0.75rem;
    padding-bottom: 0.6rem;
    margin-bottom: 1.25rem;
    border-bottom: 2px solid #e2e8f0;
}
.axis-head:empty { display: none; }
.axis-num {
    flex: none;
    width: 1.5rem; height: 1.5rem;
    display: inline-flex; align-items: center; justify-content: center;
    align-self: center;
    border-radius: 9999px;
    background: #eef2ff; color: #4f46e5;
    font-size: 0.8rem; font-weight: 700;
}
.axis-title { font-size: 1.2rem; font-weight: 700; color: #0f172a; }
.axis-sub { font-size: 0.8rem; color: #64748b; align-self: center; }
.axis-rating {
    margin-left: auto; align-self: center;
    display: inline-flex; align-items: center; gap: 0.4rem;
    padding: 0.2rem 0.7rem;
    border-radius: 9999px;
    font-size: 0.8rem; font-weight: 600;
}
.axis-rating.r-ok   { background: #f0fdf4; color: #15803d; }
.axis-rating.r-warn { background: #fffbeb; color: #b45309; }
.axis-rating.r-crit { background: #fef2f2; color: #b91c1c; }
.axis-rating.r-na   { background: #f1f5f9; color: #64748b; }

/* Dependency / generic link cards */
.dep-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0.75rem; }
.dep-card {
    display: block;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    padding: 1rem 1.1rem;
    transition: all 0.15s;
}
a.dep-card:hover { border-color: #3b82f6; box-shadow: 0 4px 12px rgba(59,130,246,0.1); transform: translateY(-1px); }
.dep-card.dep-stub { border-style: dashed; background: #f8fafc; }
.dep-card-name { font-weight: 700; color: #0f172a; font-size: 0.95rem; }
.dep-card-metric { font-size: 0.8rem; color: #64748b; margin-top: 0.2rem; }
.dep-card-link { font-size: 0.7rem; color: #6366f1; margin-top: 0.5rem; font-weight: 600; }

body.dark .axis-head { border-color: #334155; }
body.dark .axis-title { color: #f1f5f9; }
body.dark .axis-num { background: #312e81; color: #c7d2fe; }
body.dark .axis-rating.r-ok   { background: #052e16; color: #86efac; }
body.dark .axis-rating.r-warn { background: #451a03; color: #fcd34d; }
body.dark .axis-rating.r-crit { background: #450a0a; color: #fca5a5; }
body.dark .axis-rating.r-na   { background: #1e293b; color: #94a3b8; }
body.dark .dep-card { background: #1e293b; border-color: #334155; }
body.dark .dep-card.dep-stub { background: #0f172a; }
body.dark .dep-card-name { color: #f1f5f9; }

/* Chart container */
.chart-container {
    position: relative;
    height: 260px;
}

/* Loading spinner */
.loading-pulse {
    animation: pulse 1.5s ease-in-out infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* Header */
.page-header {
    background: white;
    border-bottom: 1px solid #e2e8f0;
    padding: 1rem 0;
}

/* ====== Dark Mode ====== */
body.dark {
    background-color: #0f172a;
    color: #e2e8f0;
}
body.dark .page-header {
    background: #1e293b;
    border-color: #334155;
}
body.dark .page-header a { color: #e2e8f0; }
body.dark .summary-card,
body.dark .panel {
    background: #1e293b;
    border-color: #334155;
}
body.dark .card-label { color: #94a3b8; }
body.dark .card-value { color: #f1f5f9; }
body.dark .panel-title { color: #f1f5f9; }
body.dark .asset-card {
    background: #1e293b;
    border-color: #334155;
}
body.dark .asset-card:hover {
    border-color: #3b82f6;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}
body.dark .data-table th {
    color: #94a3b8;
    border-color: #334155;
}
body.dark .data-table td {
    border-color: #1e293b;
}
body.dark .data-table tr:hover td {
    background: #0f172a;
}
body.dark .pct-bar-container { background: #334155; }
body.dark .risk-critical { background: #450a0a; color: #fca5a5; }
body.dark .risk-warning { background: #451a03; color: #fcd34d; }
body.dark .risk-info { background: #172554; color: #93c5fd; }
body.dark footer { color: #475569; }

/* R15: mobile table overflow + nav fade ---------------------------- */

/* Wrap data tables so they can scroll horizontally inside their panel
   at narrow viewports. Right-edge mask telegraphs "more to scroll." */
.data-table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    -webkit-mask-image: linear-gradient(to right, black 0, black calc(100% - 18px), transparent 100%);
            mask-image: linear-gradient(to right, black 0, black calc(100% - 18px), transparent 100%);
}

/* At md: and up tables fit; drop the fade so it doesn't suggest a
   scroll affordance that isn't there. overflow-x: auto stays — no-op
   when content fits, defensive otherwise. */
@media (min-width: 768px) {
    .data-table-scroll {
        -webkit-mask-image: none;
                mask-image: none;
    }
}

/* Sticky anchor nav: same fade so the truncated link list is visibly
   scrollable. Targets the inner overflow-x-auto div added in 6af51d9. */
#asset-anchor-nav .overflow-x-auto {
    -webkit-mask-image: linear-gradient(to right, black 0, black calc(100% - 24px), transparent 100%);
            mask-image: linear-gradient(to right, black 0, black calc(100% - 24px), transparent 100%);
}

/* apxUSD's 9 links fit at sm:; apyUSD's 11 may still scroll on phablets
   up to ~720px but the fade is harmless when content fits. */
@media (min-width: 640px) {
    #asset-anchor-nav .overflow-x-auto {
        -webkit-mask-image: none;
                mask-image: none;
    }
}
