/* ═══════════════════════════════════════════════════════════════════════════
   NRT Operations Centre - Analytics Tab
   ═══════════════════════════════════════════════════════════════════════════ */

.anl-wrap { padding: 20px 24px 40px; width: 100%; box-sizing: border-box; }

.anl-hdr { margin-bottom: 20px; }
.anl-title { font-size: 20px; font-weight: 700; color: var(--text); margin: 0 0 4px; }
.anl-sub { font-size: 12px; color: var(--text4); margin: 0; }

.anl-empty { padding: 60px 24px; text-align: center; color: var(--text4); font-size: 14px; }
.anl-empty-sm { padding: 16px 0; color: var(--text4); font-size: 12px; }

/* ── Summary cards row ───────────────────────────────────────────────────── */
.anl-summary-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}
.anl-summary-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
}
.anl-card-val  { font-size: 26px; font-weight: 800; line-height: 1; margin-bottom: 4px; }
.anl-card-lbl  { font-size: 11px; font-weight: 600; color: var(--text2); }
.anl-card-sub  { font-size: 10px; color: var(--text4); margin-top: 2px; }

/* ── Sections ────────────────────────────────────────────────────────────── */
.anl-section { margin-bottom: 32px; }
.anl-section-hdr {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}
.anl-section-title { font-size: 14px; font-weight: 700; color: var(--text); }
.anl-section-note  { font-size: 11px; color: var(--text4); }

/* ── Health grid ─────────────────────────────────────────────────────────── */
.anl-health-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}
.anl-health-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
}
.anl-health-top { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.anl-health-score {
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
  min-width: 40px;
  text-align: center;
}
.anl-health-name { font-size: 12px; font-weight: 600; color: var(--text2); flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.anl-health-bar  { height: 4px; background: var(--border); border-radius: 2px; margin-bottom: 6px; overflow: hidden; }
.anl-health-fill { height: 100%; border-radius: 2px; transition: width .4s; }
.anl-health-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 10px; color: var(--text4); }

/* Health tiers */
.anl-tier-ex   { color: var(--live); }
.anl-tier-good { color: var(--accent); }
.anl-tier-fair { color: #f59e0b; }
.anl-tier-risk { color: #f87171; }

.anl-tier-ex   .anl-health-fill,
.anl-health-fill.anl-tier-ex   { background: var(--live); }
.anl-tier-good .anl-health-fill,
.anl-health-fill.anl-tier-good { background: var(--accent); }
.anl-tier-fair .anl-health-fill,
.anl-health-fill.anl-tier-fair { background: #f59e0b; }
.anl-tier-risk .anl-health-fill,
.anl-health-fill.anl-tier-risk { background: #f87171; }

/* Contract badges in health cards */
.anl-contract          { font-size: 9px; font-weight: 600; padding: 1px 5px; border-radius: 3px; }
.anl-contract.expired  { background: rgba(239,68,68,.2); color: #f87171; }
.anl-contract.exp30    { background: rgba(239,68,68,.15); color: #f87171; }
.anl-contract.exp60    { background: rgba(245,158,11,.15); color: #f59e0b; }
.anl-contract.exp90    { background: rgba(245,158,11,.1); color: #fbbf24; }
.anl-contract.ok       { background: rgba(16,185,129,.1); color: var(--live); }

/* ── Charts row ──────────────────────────────────────────────────────────── */
.anl-charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
@media (max-width: 700px) { .anl-charts-row { grid-template-columns: 1fr; } }

.anl-chart-box {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  overflow: hidden;
}
.anl-chart-title { font-size: 11px; font-weight: 600; color: var(--text3); margin-bottom: 10px; }

/* ── Provider table ──────────────────────────────────────────────────────── */
.anl-table-wrap { overflow-x: auto; }
.anl-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.anl-table thead tr { border-bottom: 1px solid var(--border); }
.anl-table th { text-align: left; padding: 6px 10px; font-size: 10px; font-weight: 600; color: var(--text4); text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; }
.anl-table td { padding: 8px 10px; border-bottom: 1px solid var(--border2); color: var(--text2); }
.anl-table tbody tr:last-child td { border-bottom: none; }
.anl-table tbody tr:hover td { background: var(--border2); }
.anl-num { text-align: right; font-family: ui-monospace, monospace; }

/* ── Service coverage ────────────────────────────────────────────────────── */
.anl-cov-grid { display: flex; flex-direction: column; gap: 7px; }
.anl-cov-row  { display: flex; align-items: center; gap: 10px; font-size: 11px; }
.anl-cov-label { width: 160px; flex-shrink: 0; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.anl-cov-track { flex: 1; height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; display: flex; }
.anl-cov-live  { height: 100%; background: var(--live); transition: width .4s; }
.anl-cov-pend  { height: 100%; background: #f59e0b; transition: width .4s; }
.anl-cov-stat  { width: 36px; text-align: right; color: var(--text4); flex-shrink: 0; }

.anl-leg { display: inline-block; width: 8px; height: 8px; border-radius: 2px; vertical-align: middle; margin-right: 3px; }
.anl-leg.live { background: var(--live); }
.anl-leg.pend { background: #f59e0b; }

/* ── Contract timeline ───────────────────────────────────────────────────── */
.anl-contract-list { display: flex; flex-direction: column; gap: 6px; }
.anl-contract-row  { display: flex; align-items: center; gap: 12px; padding: 8px 12px; background: var(--bg2); border: 1px solid var(--border); border-radius: 6px; font-size: 12px; }
.anl-contract-name { flex: 1; font-weight: 600; color: var(--text2); }
.anl-contract-date { color: var(--text4); font-family: ui-monospace, monospace; font-size: 11px; }

/* ── Contract expiry badges (used in client cards too) ───────────────────── */
.contract-warn      { font-size: 9px; font-weight: 700; padding: 1px 5px; border-radius: 3px; text-transform: uppercase; letter-spacing: .03em; }
.contract-warn.w30  { background: rgba(239,68,68,.18); color: #f87171; }
.contract-warn.w60  { background: rgba(245,158,11,.18); color: #f59e0b; }
.contract-warn.w90  { background: rgba(245,158,11,.12); color: #fbbf24; }
.contract-warn.wexp { background: rgba(239,68,68,.12); color: #f87171; }

/* ── Month-over-month ────────────────────────────────────────────────────── */
.anl-snap-btn {
  background: var(--bg3); border: 1px solid var(--border); border-radius: 6px;
  color: var(--text3); cursor: pointer; font-size: 11px; font-weight: 600;
  font-family: inherit; padding: 5px 12px; white-space: nowrap;
  transition: color .12s, border-color .12s;
}
.anl-snap-btn:hover { color: var(--accent); border-color: var(--accent); }

.anl-mom-cards { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.anl-mom-card {
  background: var(--bg2); border: 1px solid var(--border); border-radius: 8px;
  padding: 12px 16px; min-width: 140px; flex: 1;
}
.anl-mom-metric { font-size: 10px; font-weight: 700; color: var(--text4);
                   text-transform: uppercase; letter-spacing: .07em; margin-bottom: 4px; }
.anl-mom-now    { font-size: 22px; font-weight: 800; color: var(--text); line-height: 1.1; }
.anl-mom-prev   { font-size: 10px; color: var(--text4); margin: 2px 0 6px; }

.anl-delta       { font-size: 11px; font-weight: 700; padding: 2px 7px;
                   border-radius: 4px; display: inline-block; }
.anl-delta-good  { background: rgba(16,185,129,.15); color: var(--live); }
.anl-delta-bad   { background: rgba(239,68,68,.15);  color: #f87171; }
.anl-delta-flat  { background: var(--border2);        color: var(--text4); }

.anl-mom-cov { display: flex; flex-direction: column; gap: 4px; padding: 4px 0; }
.anl-mom-row { display: flex; align-items: center; gap: 10px; font-size: 11px; padding: 3px 0; }
.anl-mom-lbl { flex: 1; color: var(--text2); }
.anl-mom-val { color: var(--text3); min-width: 36px; text-align: right; }

.anl-mom-snap-note {
  font-size: 11px; color: var(--text4); font-style: italic;
  padding: 8px 0; border-top: 1px solid var(--border2); margin-top: 8px;
}

/* ── Security Scorecard ──────────────────────────────────────────────────── */
.anl-sec-grid { display: flex; flex-direction: column; gap: 8px; }
.anl-sec-row  { display: flex; align-items: center; gap: 10px; padding: 6px 0;
                 border-bottom: 1px solid var(--border2); }
.anl-sec-row:last-child { border-bottom: none; }
.anl-sec-name { font-size: 12px; font-weight: 600; color: var(--text2);
                 width: 160px; flex-shrink: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.anl-sec-score { font-size: 18px; font-weight: 800; width: 36px; text-align: right; flex-shrink: 0; }
.anl-sec-bar-wrap { width: 100px; height: 5px; background: var(--border); border-radius: 3px; overflow: hidden; flex-shrink: 0; }
.anl-sec-bar  { height: 100%; border-radius: 3px; transition: width .4s; }
.anl-sec-bar.anl-tier-ex   { background: var(--live); }
.anl-sec-bar.anl-tier-good { background: var(--accent); }
.anl-sec-bar.anl-tier-fair { background: #f59e0b; }
.anl-sec-bar.anl-tier-risk { background: #f87171; }
.anl-sec-gaps { flex: 1; display: flex; flex-wrap: wrap; gap: 4px; }
