/* ── Aging AR Widget ─────────────────────────── */

/* Layout */
.aging-section { }
.aging-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px 24px;
}
.aging-layout {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}
.aging-donut-col {
  width: 25%;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

/* Toggle */
.aging-donut-toggle-wrap {
  align-self: flex-start;
  margin-bottom: -4px;
}
.aging-donut-toggle-wrap .toggle-group {
  display: flex;
  gap: 2px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px;
}
.aging-donut-toggle-wrap .toggle-btn {
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  background: none;
  border: none;
  padding: 2px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}
.aging-donut-toggle-wrap .toggle-btn:hover { color: var(--text-dim); background: rgba(255,255,255,0.03); }
.aging-donut-toggle-wrap .toggle-btn.active { color: var(--accent); background: var(--accent-glow); }

/* Stroke-based donut segments (business) */
#ar-donut-area .donut-segment {
  pointer-events: none;
  transition:
    stroke  0.6s ease,
    opacity var(--chart-hover-speed) ease;
}

/* Donut */
.aging-donut-wrap {
  position: relative;
  width: 100%;
  max-width: 220px;
}
.aging-donut-center {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
}
.aging-donut-total {
  font-family: var(--font-head);
  font-size: 24px;
  font-weight: 800;
  color: #fff;
  line-height: 1.1;
  transition: color 0.2s;
}
.aging-donut-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Legend */
.aging-legend {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  max-width: 220px;
  padding: 0 18px;
  box-sizing: border-box;
}
.aging-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-dim);
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  transition: background 0.2s;
}
.aging-legend-item:hover { color: var(--text); background: rgba(255,255,255,0.04); }
.aging-legend-item.active { color: var(--text); background: rgba(255,255,255,0.06); }
.aging-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.aging-legend-amt {
  margin-left: auto;
  font-weight: 600;
  font-size: 1.15rem;
  font-family: var(--font-head);
}

/* Table */
.aging-list-col {
  flex: 1;
  min-width: 0;
}
.aging-table {
  width: 100%;
  border-collapse: collapse;
}
.aging-table th {
  font-family: var(--font-head);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 6px 8px;
  text-align: right;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 2;
}
.aging-table th:first-child, .aging-table th:nth-child(2), .aging-table th:nth-child(3) { text-align: left; }
.aging-table td {
  padding: 5px 8px;
  color: var(--text);
  text-align: right;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: 13px;
}
.aging-table td:first-child, .aging-table td:nth-child(2), .aging-table td:nth-child(3) { text-align: left; }
.aging-table td:first-child {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 14px;
}
.aging-table tr:hover td { background: rgba(255,255,255,0.03); }
.aging-table tr.aging-highlight td { background: rgba(255,255,255,0.06); }
.aging-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 3px;
  color: #fff;
}
.aging-table tbody tr { cursor: pointer; }
.aging-count-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 8px;
  background: var(--accent-2);
  color: #000;
  margin-left: 4px;
  vertical-align: middle;
}
.aging-unsent-badge {
  display: inline-block;
  font-family: var(--font-head);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 1px 6px;
  border-radius: 3px;
  background: rgba(251,191,36,0.15);
  color: #fbbf24;
  border: 1px solid rgba(251,191,36,0.3);
  margin-left: 6px;
  vertical-align: middle;
}
.aging-unsent-row td:last-child {
  color: var(--text-muted);
}

/* TV compact variant */
.ar-layout { display:flex; align-items:center; gap:20px; }
.ar-donut-wrap {
  position: relative;
  width: 220px;
  height: 220px;
  flex-shrink: 0;
}
.ar-donut-svg {
  width: 220px;
  height: 220px;
}
.ar-donut-track { fill: none; stroke: rgba(255,255,255,0.04); stroke-width: 22; }
.ar-donut-edge { fill: none; stroke: rgba(255,255,255,0.10); stroke-width: 1; }
.ar-donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.ar-donut-total {
  font-family: var(--font-head);
  font-size: 40px;
  font-weight: 800;
  line-height: 1;
  color: #fff;
}
.ar-donut-label {
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 4px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.ar-legend { display:flex; flex-direction:column; gap:6px; flex:1; min-width:0; }
.ar-legend-item { display:flex; align-items:center; gap:6px; font-size:16px; color:var(--text-dim); }
.ar-legend-dot { width:8px; height:8px; border-radius:50%; }
.ar-legend-amt { font-family:var(--font-head); font-weight:700; font-size:18px; }
