/* === ServicePoint Insights — Bill Payments & Money Transfers ===
   Extends the established dark-slate ServicePoint language (the brief asks for biscuits
   "similar to the card-printing page", so the tokens below are the card-printing tokens).
   App-level rather than page-scoped because the chart and pill components are shared. */

.ins-content {
    width: 100%;
}

/* --- Header --- */
.ins-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}

.ins-eyebrow {
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: #0088CC;
    margin: 0 0 0.5rem;
}

.ins-title {
    font-size: 2.25rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: #f1f5f9;
    margin: 0 0 0.35rem;
}

.ins-subtitle {
    font-size: 0.875rem;
    color: #8da1ab;
    margin: 0;
    max-width: 34rem;
}

.ins-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.ins-breadcrumb-link,
.ins-breadcrumb-current {
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    text-decoration: none;
}

.ins-breadcrumb-link { color: #94a3b8; transition: color 0.15s; }
.ins-breadcrumb-link:hover { color: #0088CC; }
.ins-breadcrumb-current { color: #0088CC; }

.ins-breadcrumb-sep {
    width: 1.5rem;
    height: 1px;
    background: #334155;
}

/* --- Range switch --- */
.ins-range {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.ins-range-btn {
    padding: 0.45rem 0.9rem;
    background: #1E293B;
    border: 1px solid #334155;
    border-radius: 9999px;
    color: #94a3b8;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}

.ins-range-btn:hover:not(:disabled) { color: #e2e8f0; border-color: #475569; }

.ins-range-btn.active {
    background: rgba(0, 136, 204, 0.15);
    border-color: #0088CC;
    color: #38bdf8;
}

.ins-range-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* --- Biscuits (card-printing tokens) --- */
.ins-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
    margin-bottom: 1.75rem;
}

.ins-stats-grid.ins-stats-3 { grid-template-columns: repeat(3, 1fr); }

.ins-stat-card {
    background: #111416;
    padding: 1.25rem 1.5rem;
    border-radius: 12px;
    border-left: 4px solid transparent;
}

.ins-stat-card.ins-stat-primary { border-left-color: #0088CC; }
.ins-stat-card.ins-stat-completed { border-left-color: #22c55e; }
.ins-stat-card.ins-stat-pending { border-left-color: #f59e0b; }
.ins-stat-card.ins-stat-error { border-left-color: #ee7d77; }
.ins-stat-card.ins-stat-value-accent { border-left-color: #004c6b; }

.ins-stat-label {
    font-size: 0.65rem;
    font-weight: 700;
    color: #8da1ab;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.25rem;
}

.ins-stat-value-row {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.ins-stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: #e0e6ed;
    line-height: 1.15;
}

/* Text values (biller name, date) can't carry the numeric scale without wrapping badly. */
.ins-stat-value-text {
    font-size: 1.125rem;
    overflow-wrap: anywhere;
}

.ins-stat-tag { font-size: 0.65rem; font-weight: 700; }
.ins-stat-tag.pending { color: #f59e0b; }
.ins-stat-tag.completed { color: #22c55e; }
.ins-stat-tag.muted { color: #64748b; }

.ins-stat-bar {
    margin-top: 1rem;
    height: 4px;
    width: 100%;
    background: #20262c;
    border-radius: 9999px;
    overflow: hidden;
}

.ins-stat-bar-fill { height: 100%; border-radius: 9999px; }
.ins-stat-bar-fill.primary { background: #0088CC; }

.ins-stat-hint {
    font-size: 0.7rem;
    color: #64748b;
    margin: 0.5rem 0 0;
}

/* --- Panels --- */
.ins-split {
    display: grid;
    grid-template-columns: 7fr 5fr;
    gap: 1.25rem;
    margin-bottom: 1.75rem;
}

.ins-panel {
    background: #161a1e;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.75rem;
}

.ins-split .ins-panel { margin-bottom: 0; }

.ins-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.ins-panel-title {
    font-size: 1rem;
    font-weight: 700;
    color: #f1f5f9;
    margin: 0;
}

.ins-count-badge {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #64748b;
    background: #20262c;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

.ins-empty {
    font-size: 0.8125rem;
    color: #64748b;
    margin: 0;
}

/* --- Legend --- */
.ins-legend {
    display: flex;
    gap: 0.9rem;
    flex-wrap: wrap;
}

.ins-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.65rem;
    color: #8da1ab;
}

.ins-swatch {
    width: 9px;
    height: 9px;
    border-radius: 2px;
    display: inline-block;
}

.ins-swatch.count { background: #0088CC; height: 2px; width: 14px; border-radius: 0; }
.ins-swatch.line { background: #f59e0b; height: 2px; width: 14px; border-radius: 0; }

/* --- Chart: two stacked line panels, shared x-axis --- */
.chart-stack { width: 100%; }

.chart-row + .chart-row { margin-top: 1rem; }

.chart-row-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.35rem;
}

.chart-row-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #8da1ab;
}

.chart-row-peak {
    font-size: 0.65rem;
    color: #64748b;
    font-variant-numeric: tabular-nums;
}

.chart-svg {
    width: 100%;
    height: 96px;
    display: block;
    overflow: visible;
}

.chart-line {
    fill: none;
    stroke-width: 2;
    stroke-linejoin: round;
    stroke-linecap: round;
    vector-effect: non-scaling-stroke;
}

.chart-line.count { stroke: #0088CC; }
.chart-line.value { stroke: #f59e0b; }

.chart-line.count-fill {
    fill: rgba(0, 136, 204, 0.12);
    stroke: none;
}

.chart-line.value-fill {
    fill: rgba(245, 158, 11, 0.10);
    stroke: none;
}

.chart-dot { stroke: #111416; stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.chart-dot.count { fill: #0088CC; }
.chart-dot.value { fill: #f59e0b; }

.chart-axis {
    stroke: #20262c;
    stroke-width: 1;
    vector-effect: non-scaling-stroke;
}

.chart-axis-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 0.5rem;
    border-top: 1px solid #20262c;
    padding-top: 0.5rem;
}

.chart-axis-label { font-size: 0.65rem; color: #64748b; }

.chart-empty {
    font-size: 0.8125rem;
    color: #64748b;
    margin: 0;
}

/* --- Ranked list (most active billers) --- */
.ins-rank { list-style: none; padding: 0; margin: 0; }

.ins-rank-row { margin-bottom: 1rem; }
.ins-rank-row:last-child { margin-bottom: 0; }

.ins-rank-main {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.75rem;
    margin-bottom: 0.35rem;
}

.ins-rank-name {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #e2e8f0;
}

.ins-rank-meta {
    font-size: 0.7rem;
    color: #64748b;
    white-space: nowrap;
}

.ins-rank-bar {
    height: 6px;
    background: #20262c;
    border-radius: 9999px;
    overflow: hidden;
}

.ins-rank-fill {
    height: 100%;
    background: linear-gradient(90deg, #0088CC 0%, #004c6b 100%);
    border-radius: 9999px;
}

/* --- Tables --- */
.ins-table {
    width: 100%;
    border-collapse: collapse;
}

.ins-table thead th {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #64748b;
    text-align: left;
    padding: 0 0.75rem 0.75rem;
    border-bottom: 1px solid #20262c;
    white-space: nowrap;
}

.ins-table tbody td {
    padding: 0.75rem;
    border-bottom: 1px solid rgba(32, 38, 44, 0.6);
    font-size: 0.8125rem;
    vertical-align: top;
}

.ins-table tbody tr:last-child td { border-bottom: none; }
.ins-table tbody tr:hover { background: rgba(255, 255, 255, 0.02); }

.ins-muted { color: #64748b; }
.ins-strong { color: #f1f5f9; font-weight: 600; }
.ins-amount { color: #e0e6ed; font-weight: 600; font-variant-numeric: tabular-nums; }

.ins-link {
    color: #38bdf8;
    text-decoration: none;
    font-weight: 600;
}

.ins-link:hover { text-decoration: underline; }

.ins-sub {
    display: block;
    font-size: 0.7rem;
    color: #64748b;
}

.ins-dir {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.ins-dir.out { color: #f59e0b; }
.ins-dir.in { color: #22c55e; }

/* --- Status pill --- */
.ins-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.2rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.ins-pill-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}

.ins-pill.completed { background: rgba(34, 197, 94, 0.12); color: #22c55e; }
.ins-pill.pending { background: rgba(245, 158, 11, 0.12); color: #f59e0b; }
.ins-pill.rejected-funds { background: rgba(238, 125, 119, 0.14); color: #ee7d77; }
.ins-pill.rejected { background: rgba(148, 163, 184, 0.12); color: #94a3b8; }

/* --- Favourites --- */
.ins-fav-list { list-style: none; padding: 0; margin: 0; }

.ins-fav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(32, 38, 44, 0.6);
}

.ins-fav:last-child { border-bottom: none; }
.ins-fav.inactive { opacity: 0.55; }

.ins-fav-main { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }

.ins-fav-name {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #e2e8f0;
    overflow-wrap: anywhere;
}

.ins-fav-meta {
    font-size: 0.7rem;
    color: #64748b;
    overflow-wrap: anywhere;
}

/* The logon, shown beside the person's name — never as a substitute for it. */
.ins-fav-user {
    font-size: 0.7rem;
    color: #94a3b8;
    overflow-wrap: anywhere;
}

.ins-fav-tag {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #94a3b8;
    background: #20262c;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    flex-shrink: 0;
}

/* --- Responsive --- */
@media (max-width: 1200px) {
    .ins-stats-grid { grid-template-columns: repeat(2, 1fr); }
    .ins-split { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
    .ins-stats-grid,
    .ins-stats-grid.ins-stats-3 { grid-template-columns: 1fr; }
    .ins-title { font-size: 1.75rem; }
    .ins-header { align-items: flex-start; }
}

/* Respect reduced-motion: the only transitions here are hover tints, but keep the promise. */
@media (prefers-reduced-motion: reduce) {
    .ins-range-btn { transition: none; }
}

/* --- User activity extras --- */
.ins-chart-note {
    font-size: 0.7rem;
    color: #64748b;
    margin: 0.75rem 0 0;
}

.ins-newdev {
    margin-left: 0.4rem;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.12);
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
    white-space: nowrap;
}
