/* Revenue Tracker: cost upload and Subscriptions, narrow-viewport rules, summary metrics, the cloud cost table. Part of the stylesheet split by page; public/css/README.md says why. */
/* ── Upload provider picker modal ────────────────────────── */
.modal-box--narrow { max-width: 340px; }
.upload-modal-hint {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

/* Beside a subscription's name (Subscriptions modal); the pill is shared. */
.provider-badge { margin-left: 6px; vertical-align: middle; }

/* ── Provider filter tab strip (Subscriptions modal) ─────── */
.subs-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.subs-toolbar .subs-filter { flex: 1; margin-bottom: 0; }
.subs-tag-filter {
  padding: 5px 6px;
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
}

.subs-provider-filter {
  display: flex;
  gap: 2px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2px;
  flex-shrink: 0;
}
.subs-provider-tab {
  background: none;
  border: none;
  border-radius: 6px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: background .15s, color .15s;
}
.subs-provider-tab.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}

/* ── Mobile / narrow viewports ────────────────────────────── */
/* Tablet & small laptop: stack charts. The header's own narrow rules are in 03-shell.css. */
@media (max-width: 900px) {
  #charts {
    grid-template-columns: 1fr;
    padding: 12px;
    gap: 12px;
  }

  #table-container { padding: 12px; }

  /* History modal: stack the fixed grid columns. */
  .history-row {
    grid-template-columns: 1fr;
    gap: 2px;
    padding: 8px 4px;
  }
  .history-delta { text-align: left; }

  /* Subscriptions modal: drop the 800px min so it fits the viewport. */
  #subs-modal .modal-box { min-width: 0 !important; width: 95vw; }
}

/* Phone: hide cosmetic labels, tighten chart cards, allow iframe height to follow wrapped header. */
/* ── Summary Metrics Section ──────────────────────────────── */
.summary-metrics {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
  padding: 12px 16px 0;
  background: var(--bg);
  margin-bottom: 8px;
}

.metric-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.metric-text {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.metric-header {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1.2;
}

.metric-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
  white-space: nowrap;
}

.metric-value.positive { color: var(--growth-pos); }
.metric-value.negative { color: var(--growth-neg); }
.metric-value.warning { color: var(--growth-warn); }

.metric-label {
  font-size: 10px;
  color: var(--text-muted);
}

.metric-sparkline {
  flex-shrink: 0;
  width: 64px;
  height: 28px;
}

.sparkline-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.sp-prior {
  stroke: var(--border-strong);
}

.sp-current {
  stroke: var(--accent);
}

.sp-dot-prior {
  fill: var(--border-strong);
}

.sp-dot-current {
  fill: var(--accent);
}

.sp-dot-prior, .sp-dot-current {
  cursor: pointer;
}

.sp-divider {
  stroke: var(--border);
  stroke-width: 1;
  stroke-dasharray: 2 2;
}

.metric-quarters {
  font-size: 10px;
  color: var(--text-muted);
  text-align: center;
  letter-spacing: 0.05em;
}

@media (max-width: 600px) {
  .chart-card { padding: 12px 12px 10px; }
  .chart-header h2 { font-size: 11px; }
}

/* ── Cloud Cost by Subscription Table ─────────────────────────────────────── */
#cloud-cost-section,
#harmonic-cost-section {
  padding: 0 1rem 2rem;
}
#cloud-cost-header,
#harmonic-cost-header {
  display: flex;
  align-items: baseline;
  gap: .75rem;
  padding: .5rem 0 .25rem;
}
#cloud-cost-header h2,
#harmonic-cost-header h2 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
}
table.cloud-cost-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 12px;
}
table.cloud-cost-table th {
  padding: 5px 8px;
  text-align: right;
  background: var(--header-bg);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11px;
}
th.cc-hdr-provider { width: 40px; text-align: center; }
th.cc-hdr-name { text-align: left; min-width: 200px; max-width: 300px; }
th.cc-hdr-month { width: 72px; }
th.cc-hdr-total { width: 80px; background: var(--actual-bg); }

tr.cc-sep-row td.cc-sep-cell {
  padding: 8px 8px 3px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: transparent;
  border-top: 1px solid var(--border);
}
.cc-sep-toggle {
  all: unset;
  cursor: pointer;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  color: inherit;
}
.cc-sep-toggle::before {
  content: '▾';
  display: inline-block;
  width: 1em;
  transition: transform .15s;
}
.cc-sep-toggle[aria-expanded="false"]::before { transform: rotate(-90deg); }
.cc-sep-toggle:hover { color: var(--text); }
.cc-sep-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
/* A Development subscription's cost center, after its name. */
.cc-team { margin-left: 6px; vertical-align: 1px; }
.cc-team--none { background: var(--amber-bg); color: var(--amber-fg); }
tr.cc-row:hover td { background: var(--hover-bg); }
tr.cc-row td {
  border-bottom: 1px solid var(--border-light);
}
td.cc-provider-cell {
  padding: 4px 6px;
  text-align: center;
  width: 40px;
}
td.cc-name-cell {
  padding: 4px 8px;
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}
td.cc-cell {
  padding: 4px 6px;
  text-align: right;
  position: relative;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  min-width: 64px;
}
td.cc-cell.cc-zero {
  color: var(--text-muted);
}
td.cc-cell .cc-val {
  display: block;
  line-height: 1.3;
}
td.cc-cell .cc-mom {
  display: block;
  font-size: 9px;
  font-weight: 600;
  line-height: 1.1;
  text-align: right;
}
.cc-increase { color: var(--danger); }   /* red  = cost went up   = bad  */
.cc-decrease { color: var(--growth-pos); }   /* green = cost went down = good */
td.cc-fy-cell {
  background: var(--actual-bg);
  font-weight: 600;
}
tr.cc-cat-totals-row td,
tr.cc-grand-row td {
  font-weight: 600;
  background: var(--actual-bg);
  border-top: 2px solid var(--border);
  border-bottom: 2px solid var(--border);
}
tr.cc-grand-row td {
  background: var(--header-bg);
  border-top: 2px solid var(--border-strong);
  border-bottom: 2px solid var(--border-strong);
}
td.cc-totals-label {
  text-align: right;
  padding: 4px 8px;
  color: var(--text-muted);
  font-size: 11px;
}
td.cc-subtotal { }

