/* Admin panel: compact, laptop-friendly (1366×768 and up).
   Colour conventions follow the project: red <50%, amber 50-80%, green >=80%. */

.admin-wrap {
    font-size: 0.9rem;
    max-width: 1500px;
}

/* Summary cards */
.admin-summary .summary-card {
    background: #fff;
    border: 1px solid var(--bs-border-color, #dee2e6);
}
.summary-card .ring {
    --pct: 0;
    --col: #dc3545;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    font-size: 0.72rem;
    font-weight: 600;
    color: #fff;
    background: conic-gradient(var(--col) calc(var(--pct) * 1%), #eef1f5 0);
    position: relative;
}
.summary-card .ring::before {
    content: "";
    position: absolute;
    inset: 5px;
    border-radius: 50%;
    background: #fff;
}
.summary-card .ring > span {
    position: relative;
    z-index: 1;
    color: #1f2937;
}

/* Filters */
.admin-filters .form-select,
.admin-filters .form-control,
.admin-filters .input-group-text {
    font-size: 0.82rem;
}

/* Table */
.admin-table {
    font-size: 0.84rem;
    margin: 0;
}
.admin-table thead th {
    background: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
    color: #495057;
    white-space: nowrap;
}
.admin-table tbody tr[aria-expanded="true"] {
    background: #f1f3f5;
}
.admin-table .ticker-cell {
    font-weight: 600;
    color: #1f2937;
}
.admin-table .ticker-name {
    font-size: 0.74rem;
    color: #6c757d;
    font-weight: 400;
}

/* Coverage bar cell */
.cov-bar {
    --pct: 0;
    --col: #dc3545;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.cov-bar .track {
    flex: 1 1 auto;
    height: 8px;
    background: #eef1f5;
    border-radius: 4px;
    overflow: hidden;
    min-width: 60px;
}
.cov-bar .fill {
    height: 100%;
    width: calc(var(--pct) * 1%);
    background: var(--col);
    border-radius: 4px;
    transition: width 0.3s ease;
}
.cov-bar .num {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    min-width: 3ch;
    text-align: right;
    font-size: 0.8rem;
}

/* Pill badges */
.pct-pill {
    display: inline-block;
    padding: 0.1rem 0.45rem;
    border-radius: 1rem;
    font-size: 0.74rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    line-height: 1.3;
}
.pct-pill.ok    { background: #d1e7dd; color: #0a3622; }
.pct-pill.warn  { background: #fff3cd; color: #664d03; }
.pct-pill.bad   { background: #f8d7da; color: #58151c; }
.pct-pill.muted { background: #e9ecef; color: #495057; }

.source-chip {
    display: inline-block;
    padding: 0.12rem 0.4rem;
    border-radius: 0.35rem;
    font-size: 0.7rem;
    font-weight: 600;
    background: #e7f1ff;
    color: #084298;
}
.source-chip.sec        { background: #fde2e4; color: #9d1c2b; }
.source-chip.yahoo      { background: #fff4d6; color: #7a5800; }
.source-chip.twelvedata { background: #e7f1ff; color: #084298; }
.source-chip.alphavantage { background: #e6f9e6; color: #14532d; }
.source-chip.flashalpha { background: #efe7ff; color: #4c1d95; }
.source-chip.synth      { background: #e9ecef; color: #495057; }

.missing-tag {
    display: inline-block;
    padding: 0.08rem 0.4rem;
    margin: 1px 2px 1px 0;
    border-radius: 0.3rem;
    font-size: 0.7rem;
    background: #f8d7da;
    color: #58151c;
}

/* Detail modal body */
.detail-group {
    margin-bottom: 0.75rem;
}
.detail-group h6 {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6c757d;
    margin: 0.4rem 0 0.3rem;
    border-bottom: 1px solid #eef1f5;
    padding-bottom: 0.2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.detail-group h6 .grp-pct {
    font-weight: 700;
}
.detail-metric {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 0.5rem;
    align-items: center;
    padding: 0.2rem 0;
    border-bottom: 1px dashed #f1f3f5;
    font-size: 0.82rem;
}
.detail-metric.missing {
    color: #6c757d;
}
.detail-metric.missing .label {
    text-decoration: line-through;
    text-decoration-color: rgba(220,53,69,0.5);
}
.detail-metric .value {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    color: #1f2937;
}
.detail-metric.missing .value {
    color: #adb5bd;
    font-weight: 400;
}

/* Refresh modal */
.refresh-source {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.5rem;
    border: 1px solid #eef1f5;
    border-radius: 0.4rem;
    margin-bottom: 0.4rem;
}
.refresh-source.disabled {
    opacity: 0.55;
    background: #f8f9fa;
}
.refresh-source .form-check {
    margin: 0;
    flex: 0 0 auto;
}
.refresh-source .meta {
    flex: 1 1 auto;
    min-width: 0;
}
.refresh-source .meta .name {
    font-weight: 600;
    font-size: 0.85rem;
}
.refresh-source .meta .sub {
    font-size: 0.72rem;
    color: #6c757d;
}
.refresh-log {
    max-height: 180px;
    overflow-y: auto;
    background: #0b1220;
    color: #c8d3e0;
    border-radius: 0.4rem;
    padding: 0.5rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.74rem;
    line-height: 1.35;
    margin-top: 0.5rem;
}
.refresh-log .ok    { color: #6fcf97; }
.refresh-log .warn  { color: #f2c94c; }
.refresh-log .err   { color: #eb5757; }
.refresh-log .info  { color: #8aa1c1; }
.refresh-source-block {
    margin-bottom: 0.65rem;
}
.refresh-source-head {
    font-size: 0.82rem;
    margin-bottom: 0.25rem;
}
.refresh-source-line {
    font-size: 0.78rem;
    padding-left: 0.75rem;
    line-height: 1.45;
}

/* Progress */
.progress-thin {
    height: 6px;
    border-radius: 3px;
}

/* Sticky header offset for the table */
.admin-table thead.sticky-top { top: 0; z-index: 5; }

/* Source preference radio grid */
.pref-table { font-size: 0.85rem; }
.pref-table thead th {
    background: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    white-space: nowrap;
}
.pref-table tr.table-light td {
    background: #f1f3f5;
    padding: 0.25rem 0.5rem;
}
.source-opt {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.5rem;
    border: 1px solid #eef1f5;
    border-radius: 0.4rem;
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 500;
    background: #fff;
    transition: background 0.12s, border-color 0.12s;
}
.source-opt:hover { background: #f8f9fa; }
.source-opt input { accent-color: #0d6efd; }
.source-opt:has(input:checked) {
    background: #e7f1ff;
    border-color: #0d6efd;
    color: #084298;
}

/* Compact on small heights */
@media (max-height: 760px) {
    .admin-wrap { font-size: 0.85rem; }
    .summary-card .ring { width: 40px; height: 40px; }
}
